Skip to content

Commit c5e3e9e

Browse files
committed
PR feedback
1 parent 8d5283c commit c5e3e9e

File tree

4 files changed

+8
-11
lines changed

4 files changed

+8
-11
lines changed

src/LuaPrinter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ export class LuaPrinter {
173173

174174
public print(file: lua.File): PrintResult {
175175
// Add traceback lualib if sourcemap traceback option is enabled
176-
if (this.options.sourceMapTraceback && !isBundleEnabled(this.options)) {
176+
if (this.options.sourceMapTraceback) {
177177
file.luaLibFeatures.add(LuaLibFeature.SourceMapTraceBack);
178178
}
179179

src/transpilation/bundle.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ export function getBundleResult(program: ts.Program, files: ProcessedFile[]): [t
104104
const footers: string[] = [];
105105
if (options.sourceMapTraceback) {
106106
// Generates SourceMapTraceback for the entire file
107-
// TODO: remove
108107
footers.push('local __TS__SourceMapTraceBack = require("lualib_bundle").__TS__SourceMapTraceBack\n');
109108
footers.push(`${sourceMapTracebackBundlePlaceholder}\n`);
110109
}

src/transpilation/transpiler.ts

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -100,22 +100,19 @@ export class Transpiler {
100100
} else {
101101
emitPlan = resolutionResult.resolvedFiles.map(file => ({
102102
...file,
103-
outputPath: getEmitPath(file, program),
103+
outputPath: file.isRawFile
104+
? path.join(getEmitOutDir(program), file.fileName)
105+
: getEmitPath(file.fileName, program),
104106
}));
105107
}
106108

107109
return { emitPlan };
108110
}
109111
}
110112

111-
export function getEmitPath(file: string | ProcessedFile, program: ts.Program): string {
113+
export function getEmitPath(file: string, program: ts.Program): string {
112114
const outDir = getEmitOutDir(program);
113-
if (typeof file !== "string" && file.isRawFile) {
114-
return path.join(outDir, file.fileName);
115-
}
116-
const fileName = typeof file === "string" ? file : file.fileName;
117-
const relativeOutputPath = getEmitPathRelativeToOutDir(fileName, program);
118-
115+
const relativeOutputPath = getEmitPathRelativeToOutDir(file, program);
119116
return path.join(outDir, relativeOutputPath);
120117
}
121118

test/transpile/module-resolution.spec.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,8 @@ test("includes lualib_bundle when external lua requests it", () => {
490490
.addExtraFile(
491491
"lualibuser.lua",
492492
`
493-
local __TS__ArrayPush = require("lualib_bundle").__TS__ArrayPush
493+
local ____lualib = require("lualib_bundle")
494+
local __TS__ArrayPush = ____lualib.__TS__ArrayPush
494495
495496
local result = {}
496497
__TS__ArrayPush(result, "foo")

0 commit comments

Comments
 (0)