Skip to content

Commit e8b89cd

Browse files
committed
Add Lua AST to TranspiledFile interface
1 parent d5b8e65 commit e8b89cd

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Transpile.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import * as ts from "typescript";
22
import { CompilerOptions } from "./CompilerOptions";
33
import { transpileError } from "./diagnostics";
4+
import { Block } from './LuaAST';
45
import { LuaPrinter } from "./LuaPrinter";
56
import { LuaTransformer } from "./LuaTransformer";
67
import { TranspileError } from "./TranspileError";
@@ -36,6 +37,7 @@ function getCustomTransformers(
3637
}
3738

3839
export interface TranspiledFile {
40+
luaAst?: Block;
3941
lua?: string;
4042
sourceMap?: string;
4143
declaration?: string;
@@ -101,14 +103,14 @@ export function transpile({
101103

102104
const processSourceFile = (sourceFile: ts.SourceFile) => {
103105
try {
104-
const [luaAST, lualibFeatureSet] = transformer.transformSourceFile(sourceFile);
106+
const [luaAst, lualibFeatureSet] = transformer.transformSourceFile(sourceFile);
105107
if (!options.noEmit && !options.emitDeclarationOnly) {
106108
const [lua, sourceMap] = printer.print(
107-
luaAST,
109+
luaAst,
108110
lualibFeatureSet,
109111
sourceFile.fileName
110112
);
111-
updateTranspiledFile(sourceFile.fileName, { lua, sourceMap });
113+
updateTranspiledFile(sourceFile.fileName, { luaAst, lua, sourceMap });
112114
}
113115
} catch (err) {
114116
if (!(err instanceof TranspileError)) throw err;

0 commit comments

Comments
 (0)