typescript-to-lua 1.25.2 → 1.26.1
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.js +2 -2
- package/dist/LuaAST.js +76 -77
- package/dist/LuaLib.d.ts +1 -0
- package/dist/LuaLib.js +13 -12
- package/dist/LuaPrinter.js +2 -2
- package/dist/cli/information.js +2 -2
- package/dist/cli/parse.js +3 -3
- package/dist/cli/report.d.ts +4 -4
- package/dist/cli/report.js +2 -2
- package/dist/cli/tsconfig.js +3 -4
- package/dist/lualib/5.0/MathSign.lua +5 -4
- package/dist/lualib/5.0/MathTrunc.lua +6 -0
- package/dist/lualib/5.0/Set.lua +58 -0
- package/dist/lualib/5.0/lualib_bundle.lua +79 -12
- package/dist/lualib/5.0/lualib_module_info.json +13 -1
- package/dist/lualib/universal/MathSign.lua +5 -4
- package/dist/lualib/universal/MathTrunc.lua +6 -0
- package/dist/lualib/universal/Set.lua +58 -0
- package/dist/lualib/universal/lualib_bundle.lua +79 -12
- package/dist/lualib/universal/lualib_module_info.json +13 -1
- package/dist/lualib-build/plugin.d.ts +1 -1
- package/dist/lualib-build/util.js +8 -9
- package/dist/measure-performance.js +7 -8
- package/dist/transformation/builtins/array.js +3 -4
- package/dist/transformation/builtins/console.js +1 -2
- package/dist/transformation/builtins/function.js +2 -3
- package/dist/transformation/builtins/global.js +1 -2
- package/dist/transformation/builtins/index.js +4 -5
- package/dist/transformation/builtins/map.js +1 -2
- package/dist/transformation/builtins/math.js +5 -3
- package/dist/transformation/builtins/number.js +3 -4
- package/dist/transformation/builtins/object.js +2 -3
- package/dist/transformation/builtins/promise.js +4 -5
- package/dist/transformation/builtins/string.js +3 -4
- package/dist/transformation/builtins/symbol.js +1 -2
- package/dist/transformation/context/context.d.ts +0 -3
- package/dist/transformation/index.js +2 -3
- package/dist/transformation/pre-transformers/using-transformer.js +1 -2
- package/dist/transformation/utils/annotations.js +5 -5
- package/dist/transformation/utils/assignment-validation.js +1 -2
- package/dist/transformation/utils/export.js +14 -14
- package/dist/transformation/utils/function-context.js +3 -3
- package/dist/transformation/utils/language-extensions.js +10 -10
- package/dist/transformation/utils/lua-ast.js +12 -12
- package/dist/transformation/utils/lualib.js +3 -3
- package/dist/transformation/utils/preceding-statements.js +1 -2
- package/dist/transformation/utils/safe-names.js +3 -3
- package/dist/transformation/utils/scope.js +11 -11
- package/dist/transformation/utils/symbols.js +4 -5
- package/dist/transformation/utils/typescript/index.js +13 -14
- package/dist/transformation/utils/typescript/nodes.js +8 -9
- package/dist/transformation/utils/typescript/types.js +10 -11
- package/dist/transformation/visitors/access.js +4 -4
- package/dist/transformation/visitors/async-await.js +3 -3
- package/dist/transformation/visitors/binary-expression/assignments.js +5 -6
- package/dist/transformation/visitors/binary-expression/bit.js +3 -3
- package/dist/transformation/visitors/binary-expression/compound.js +3 -3
- package/dist/transformation/visitors/binary-expression/destructuring-assignments.js +3 -4
- package/dist/transformation/visitors/binary-expression/index.js +4 -4
- package/dist/transformation/visitors/block.js +3 -3
- package/dist/transformation/visitors/call.js +6 -6
- package/dist/transformation/visitors/class/decorators.js +6 -7
- package/dist/transformation/visitors/class/index.js +14 -3
- package/dist/transformation/visitors/class/members/accessors.js +1 -2
- package/dist/transformation/visitors/class/members/constructor.js +3 -4
- package/dist/transformation/visitors/class/members/fields.js +2 -3
- package/dist/transformation/visitors/class/members/method.js +3 -4
- package/dist/transformation/visitors/class/setup.js +2 -3
- package/dist/transformation/visitors/class/utils.js +5 -6
- package/dist/transformation/visitors/conditional.js +3 -3
- package/dist/transformation/visitors/enum.js +2 -2
- package/dist/transformation/visitors/expression-list.js +4 -5
- package/dist/transformation/visitors/expression-statement.js +2 -2
- package/dist/transformation/visitors/function.js +9 -9
- package/dist/transformation/visitors/identifier.js +4 -4
- package/dist/transformation/visitors/language-extensions/call-extension.js +2 -2
- package/dist/transformation/visitors/language-extensions/identifier.js +2 -3
- package/dist/transformation/visitors/language-extensions/iterable.js +3 -4
- package/dist/transformation/visitors/language-extensions/multi.js +8 -9
- package/dist/transformation/visitors/language-extensions/range.js +3 -4
- package/dist/transformation/visitors/language-extensions/table.js +2 -2
- package/dist/transformation/visitors/language-extensions/vararg.js +2 -3
- package/dist/transformation/visitors/literal.js +3 -3
- package/dist/transformation/visitors/loops/utils.js +4 -5
- package/dist/transformation/visitors/modules/export.js +0 -3
- package/dist/transformation/visitors/modules/import.js +2 -2
- package/dist/transformation/visitors/namespace.js +3 -3
- package/dist/transformation/visitors/optional-chaining.js +6 -7
- package/dist/transformation/visitors/return.js +3 -3
- package/dist/transformation/visitors/spread.js +2 -2
- package/dist/transformation/visitors/typeof.js +2 -2
- package/dist/transformation/visitors/unary-expression.js +2 -2
- package/dist/transformation/visitors/variable-declaration.js +6 -6
- package/dist/transpilation/bundle.js +3 -3
- package/dist/transpilation/find-lua-requires.js +1 -2
- package/dist/transpilation/index.js +5 -6
- package/dist/transpilation/output-collector.js +1 -2
- package/dist/transpilation/plugins.js +1 -2
- package/dist/transpilation/resolve.js +1 -2
- package/dist/transpilation/transformers.js +2 -2
- package/dist/transpilation/transpile.js +1 -2
- package/dist/transpilation/transpiler.js +6 -6
- package/dist/transpilation/utils.js +2 -2
- package/dist/utils.js +9 -9
- package/package.json +6 -7
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.Transpiler = void 0;
|
|
4
|
+
exports.getEmitPath = getEmitPath;
|
|
5
|
+
exports.getEmitPathRelativeToOutDir = getEmitPathRelativeToOutDir;
|
|
6
|
+
exports.getSourceDir = getSourceDir;
|
|
7
|
+
exports.getEmitOutDir = getEmitOutDir;
|
|
8
|
+
exports.getProjectRoot = getProjectRoot;
|
|
4
9
|
const path = require("path");
|
|
5
10
|
const ts = require("typescript");
|
|
6
11
|
const CompilerOptions_1 = require("../CompilerOptions");
|
|
@@ -120,7 +125,6 @@ function getEmitPath(file, program) {
|
|
|
120
125
|
const outDir = getEmitOutDir(program);
|
|
121
126
|
return path.join(outDir, relativeOutputPath);
|
|
122
127
|
}
|
|
123
|
-
exports.getEmitPath = getEmitPath;
|
|
124
128
|
function getEmitPathRelativeToOutDir(fileName, program) {
|
|
125
129
|
var _a;
|
|
126
130
|
const sourceDir = getSourceDir(program);
|
|
@@ -139,7 +143,6 @@ function getEmitPathRelativeToOutDir(fileName, program) {
|
|
|
139
143
|
(0, utils_1.trimExtension)(emitPathSplits[emitPathSplits.length - 1]) + "." + trimmedExtension;
|
|
140
144
|
return path.join(...emitPathSplits);
|
|
141
145
|
}
|
|
142
|
-
exports.getEmitPathRelativeToOutDir = getEmitPathRelativeToOutDir;
|
|
143
146
|
function getSourceDir(program) {
|
|
144
147
|
const rootDir = program.getCompilerOptions().rootDir;
|
|
145
148
|
if (rootDir && rootDir.length > 0) {
|
|
@@ -148,7 +151,6 @@ function getSourceDir(program) {
|
|
|
148
151
|
// If no rootDir is given, source is relative to the project root
|
|
149
152
|
return getProjectRoot(program);
|
|
150
153
|
}
|
|
151
|
-
exports.getSourceDir = getSourceDir;
|
|
152
154
|
function getEmitOutDir(program) {
|
|
153
155
|
const outDir = program.getCompilerOptions().outDir;
|
|
154
156
|
if (outDir && outDir.length > 0) {
|
|
@@ -157,12 +159,10 @@ function getEmitOutDir(program) {
|
|
|
157
159
|
// If no outDir is provided, emit in project root
|
|
158
160
|
return getProjectRoot(program);
|
|
159
161
|
}
|
|
160
|
-
exports.getEmitOutDir = getEmitOutDir;
|
|
161
162
|
function getProjectRoot(program) {
|
|
162
163
|
// Try to get the directory the tsconfig is in
|
|
163
164
|
const tsConfigPath = program.getCompilerOptions().configFilePath;
|
|
164
165
|
// If no tsconfig is known, use common source directory
|
|
165
166
|
return tsConfigPath ? path.dirname(tsConfigPath) : program.getCommonSourceDirectory();
|
|
166
167
|
}
|
|
167
|
-
exports.getProjectRoot = getProjectRoot;
|
|
168
168
|
//# sourceMappingURL=transpiler.js.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getConfigDirectory = void 0;
|
|
4
|
+
exports.resolvePlugin = resolvePlugin;
|
|
4
5
|
const path = require("path");
|
|
5
6
|
const resolve = require("resolve");
|
|
6
7
|
// TODO: Don't depend on CLI?
|
|
@@ -44,5 +45,4 @@ function resolvePlugin(kind, optionName, basedir, query, importName = "default")
|
|
|
44
45
|
}
|
|
45
46
|
return { result };
|
|
46
47
|
}
|
|
47
|
-
exports.resolvePlugin = resolvePlugin;
|
|
48
48
|
//# sourceMappingURL=utils.js.map
|
package/dist/utils.js
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.trimExtension = exports.normalizeSlashes = exports.createSerialDiagnosticFactory = exports.createDiagnosticFactoryWithCode = exports.intersection = exports.union = exports.intersperse = void 0;
|
|
4
|
+
exports.castArray = castArray;
|
|
5
|
+
exports.formatPathToLuaPath = formatPathToLuaPath;
|
|
6
|
+
exports.getOrUpdate = getOrUpdate;
|
|
7
|
+
exports.isNonNull = isNonNull;
|
|
8
|
+
exports.cast = cast;
|
|
9
|
+
exports.assert = assert;
|
|
10
|
+
exports.assertNever = assertNever;
|
|
11
|
+
exports.assume = assume;
|
|
4
12
|
const ts = require("typescript");
|
|
5
13
|
const nativeAssert = require("assert");
|
|
6
14
|
const path = require("path");
|
|
7
15
|
function castArray(value) {
|
|
8
16
|
return Array.isArray(value) ? value : [value];
|
|
9
17
|
}
|
|
10
|
-
exports.castArray = castArray;
|
|
11
18
|
const intersperse = (values, separator) => values.flatMap((value, index) => (index === 0 ? [value] : [separator, value]));
|
|
12
19
|
exports.intersperse = intersperse;
|
|
13
20
|
const union = (...values) => [...new Set(...values)];
|
|
@@ -39,7 +46,6 @@ function formatPathToLuaPath(filePath) {
|
|
|
39
46
|
}
|
|
40
47
|
return filePath.replace(/\.\//g, "").replace(/\//g, ".");
|
|
41
48
|
}
|
|
42
|
-
exports.formatPathToLuaPath = formatPathToLuaPath;
|
|
43
49
|
function getOrUpdate(
|
|
44
50
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
45
51
|
map, key, getDefaultValue) {
|
|
@@ -48,12 +54,10 @@ map, key, getDefaultValue) {
|
|
|
48
54
|
}
|
|
49
55
|
return map.get(key);
|
|
50
56
|
}
|
|
51
|
-
exports.getOrUpdate = getOrUpdate;
|
|
52
57
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
53
58
|
function isNonNull(value) {
|
|
54
59
|
return value != null;
|
|
55
60
|
}
|
|
56
|
-
exports.isNonNull = isNonNull;
|
|
57
61
|
function cast(item, cast) {
|
|
58
62
|
if (cast(item)) {
|
|
59
63
|
return item;
|
|
@@ -62,15 +66,11 @@ function cast(item, cast) {
|
|
|
62
66
|
throw new Error(`Failed to cast value to expected type using ${cast.name}.`);
|
|
63
67
|
}
|
|
64
68
|
}
|
|
65
|
-
exports.cast = cast;
|
|
66
69
|
function assert(value, message) {
|
|
67
70
|
nativeAssert(value, message);
|
|
68
71
|
}
|
|
69
|
-
exports.assert = assert;
|
|
70
72
|
function assertNever(_value) {
|
|
71
73
|
throw new Error("Value is expected to be never");
|
|
72
74
|
}
|
|
73
|
-
exports.assertNever = assertNever;
|
|
74
75
|
function assume(_value) { }
|
|
75
|
-
exports.assume = assume;
|
|
76
76
|
//# sourceMappingURL=utils.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "typescript-to-lua",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.26.1",
|
|
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/",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"node": ">=16.10.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"typescript": "5.
|
|
45
|
+
"typescript": "5.5.2"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@typescript-to-lua/language-extensions": "1.19.0",
|
|
@@ -58,10 +58,8 @@
|
|
|
58
58
|
"@types/node": "^13.7.7",
|
|
59
59
|
"@types/picomatch": "^2.3.0",
|
|
60
60
|
"@types/resolve": "1.14.0",
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"eslint": "^8.47.0",
|
|
64
|
-
"eslint-plugin-import": "^2.27.5",
|
|
61
|
+
"eslint": "^8.57.0",
|
|
62
|
+
"eslint-plugin-import": "^2.29.1",
|
|
65
63
|
"eslint-plugin-jest": "^26.9.0",
|
|
66
64
|
"fs-extra": "^8.1.0",
|
|
67
65
|
"javascript-stringify": "^2.0.1",
|
|
@@ -72,6 +70,7 @@
|
|
|
72
70
|
"prettier": "^2.8.4",
|
|
73
71
|
"ts-jest": "^29.1.0",
|
|
74
72
|
"ts-node": "^10.9.1",
|
|
75
|
-
"typescript": "^5.
|
|
73
|
+
"typescript": "^5.5.2",
|
|
74
|
+
"typescript-eslint": "^7.13.1"
|
|
76
75
|
}
|
|
77
76
|
}
|