typescript-to-lua 1.33.2 → 1.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CompilerOptions.d.ts +1 -0
- package/dist/CompilerOptions.js +1 -0
- package/dist/lualib/5.0/SourceMapTraceBack.lua +1 -1
- package/dist/lualib/5.0/lualib_bundle.lua +1 -1
- package/dist/lualib/universal/SourceMapTraceBack.lua +1 -1
- package/dist/lualib/universal/lualib_bundle.lua +1 -1
- package/dist/transformation/visitors/break-continue.js +1 -0
- package/dist/transformation/visitors/enum.js +1 -1
- package/dist/transpilation/bundle.js +3 -1
- package/package.json +3 -3
package/dist/CompilerOptions.js
CHANGED
|
@@ -29,7 +29,7 @@ local function __TS__SourceMapTraceBack(fileName, sourceMap)
|
|
|
29
29
|
end
|
|
30
30
|
local result = string.gsub(
|
|
31
31
|
trace,
|
|
32
|
-
"(
|
|
32
|
+
"([^%s<]+)%.lua:(%d+)",
|
|
33
33
|
function(file, line) return replacer(nil, file .. ".lua", file .. ".ts", line) end
|
|
34
34
|
)
|
|
35
35
|
local function stringReplacer(____, file, line)
|
|
@@ -2309,7 +2309,7 @@ local function __TS__SourceMapTraceBack(fileName, sourceMap)
|
|
|
2309
2309
|
end
|
|
2310
2310
|
local result = string.gsub(
|
|
2311
2311
|
trace,
|
|
2312
|
-
"(
|
|
2312
|
+
"([^%s<]+)%.lua:(%d+)",
|
|
2313
2313
|
function(file, line) return replacer(nil, file .. ".lua", file .. ".ts", line) end
|
|
2314
2314
|
)
|
|
2315
2315
|
local function stringReplacer(____, file, line)
|
|
@@ -29,7 +29,7 @@ local function __TS__SourceMapTraceBack(fileName, sourceMap)
|
|
|
29
29
|
end
|
|
30
30
|
local result = string.gsub(
|
|
31
31
|
trace,
|
|
32
|
-
"(
|
|
32
|
+
"([^%s<]+)%.lua:(%d+)",
|
|
33
33
|
function(file, line) return replacer(nil, file .. ".lua", file .. ".ts", line) end
|
|
34
34
|
)
|
|
35
35
|
local function stringReplacer(____, file, line)
|
|
@@ -2241,7 +2241,7 @@ local function __TS__SourceMapTraceBack(fileName, sourceMap)
|
|
|
2241
2241
|
end
|
|
2242
2242
|
local result = string.gsub(
|
|
2243
2243
|
trace,
|
|
2244
|
-
"(
|
|
2244
|
+
"([^%s<]+)%.lua:(%d+)",
|
|
2245
2245
|
function(file, line) return replacer(nil, file .. ".lua", file .. ".ts", line) end
|
|
2246
2246
|
)
|
|
2247
2247
|
local function stringReplacer(____, file, line)
|
|
@@ -19,6 +19,7 @@ const transformContinueStatement = (statement, context) => {
|
|
|
19
19
|
[CompilerOptions_1.LuaTarget.Lua52]: scope_1.LoopContinued.WithGoto,
|
|
20
20
|
[CompilerOptions_1.LuaTarget.Lua53]: scope_1.LoopContinued.WithGoto,
|
|
21
21
|
[CompilerOptions_1.LuaTarget.Lua54]: scope_1.LoopContinued.WithGoto,
|
|
22
|
+
[CompilerOptions_1.LuaTarget.Lua55]: scope_1.LoopContinued.WithGoto,
|
|
22
23
|
[CompilerOptions_1.LuaTarget.LuaJIT]: scope_1.LoopContinued.WithGoto,
|
|
23
24
|
[CompilerOptions_1.LuaTarget.Luau]: scope_1.LoopContinued.WithContinue,
|
|
24
25
|
}[context.luaTarget];
|
|
@@ -28,7 +28,7 @@ const transformEnumDeclaration = (node, context) => {
|
|
|
28
28
|
const result = [];
|
|
29
29
|
if (!membersOnly && (0, typescript_1.isFirstDeclaration)(context, node)) {
|
|
30
30
|
const name = (0, identifier_1.transformIdentifier)(context, node.name);
|
|
31
|
-
const table = lua.createBinaryExpression(
|
|
31
|
+
const table = lua.createBinaryExpression((0, export_1.addExportToIdentifier)(context, name), lua.createTableExpression(), lua.SyntaxKind.OrOperator);
|
|
32
32
|
result.push(...(0, lua_ast_1.createLocalOrExportedOrGlobalDeclaration)(context, name, table, node));
|
|
33
33
|
}
|
|
34
34
|
const enumReference = context.transformExpression(node.name);
|
|
@@ -93,7 +93,9 @@ function getBundleResult(program, files) {
|
|
|
93
93
|
const moduleTable = createModuleTableNode(moduleTableEntries);
|
|
94
94
|
// return require("<entry module path>")
|
|
95
95
|
const args = options.luaTarget === CompilerOptions_1.LuaTarget.Lua50 ? "unpack(arg == nil and {} or arg)" : "...";
|
|
96
|
-
|
|
96
|
+
// Avoid producing a tail-call (which removes the bundle's stack frame) by assigning the `require` result to a local and returning it.
|
|
97
|
+
const entryPath = createModulePath(entryModuleFilePath !== null && entryModuleFilePath !== void 0 ? entryModuleFilePath : entryModule, program);
|
|
98
|
+
const entryPoint = `local ____entry = require(${entryPath}, ${args})\nreturn ____entry\n`;
|
|
97
99
|
const footers = [];
|
|
98
100
|
if (options.sourceMapTraceback) {
|
|
99
101
|
// Generates SourceMapTraceback for the entire file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "typescript-to-lua",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.34.0",
|
|
4
4
|
"description": "A generic TypeScript to Lua transpiler. Write your code in TypeScript and publish Lua!",
|
|
5
5
|
"repository": "https://github.com/TypeScriptToLua/TypeScriptToLua",
|
|
6
6
|
"homepage": "https://typescripttolua.github.io/",
|
|
@@ -64,8 +64,8 @@
|
|
|
64
64
|
"javascript-stringify": "^2.0.1",
|
|
65
65
|
"jest": "^29.5.0",
|
|
66
66
|
"jest-circus": "^29.7.0",
|
|
67
|
-
"lua-types": "^2.
|
|
68
|
-
"lua-wasm-bindings": "^0.3
|
|
67
|
+
"lua-types": "^2.14.1",
|
|
68
|
+
"lua-wasm-bindings": "^0.5.3",
|
|
69
69
|
"prettier": "^2.8.8",
|
|
70
70
|
"ts-jest": "^29.2.5",
|
|
71
71
|
"ts-node": "^10.9.2",
|