typescript-to-lua 1.22.0 → 1.23.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/LuaAST.d.ts
CHANGED
|
@@ -33,25 +33,25 @@ export declare enum SyntaxKind {
|
|
|
33
33
|
Identifier = 29,
|
|
34
34
|
TableIndexExpression = 30,
|
|
35
35
|
ParenthesizedExpression = 31,
|
|
36
|
-
AdditionOperator = 32,
|
|
36
|
+
AdditionOperator = 32,// Maybe use abbreviations for those add, sub, mul ...
|
|
37
37
|
SubtractionOperator = 33,
|
|
38
38
|
MultiplicationOperator = 34,
|
|
39
39
|
DivisionOperator = 35,
|
|
40
40
|
FloorDivisionOperator = 36,
|
|
41
41
|
ModuloOperator = 37,
|
|
42
42
|
PowerOperator = 38,
|
|
43
|
-
NegationOperator = 39
|
|
43
|
+
NegationOperator = 39,// Unary minus
|
|
44
44
|
ConcatOperator = 40,
|
|
45
|
-
LengthOperator = 41
|
|
45
|
+
LengthOperator = 41,// Unary
|
|
46
46
|
EqualityOperator = 42,
|
|
47
47
|
InequalityOperator = 43,
|
|
48
48
|
LessThanOperator = 44,
|
|
49
49
|
LessEqualOperator = 45,
|
|
50
50
|
GreaterThanOperator = 46,
|
|
51
|
-
GreaterEqualOperator = 47
|
|
51
|
+
GreaterEqualOperator = 47,// Syntax Sugar `x >= y` <=> `not (y < x)`
|
|
52
52
|
AndOperator = 48,
|
|
53
53
|
OrOperator = 49,
|
|
54
|
-
NotOperator = 50
|
|
54
|
+
NotOperator = 50,// Unary
|
|
55
55
|
BitwiseAndOperator = 51,
|
|
56
56
|
BitwiseOrOperator = 52,
|
|
57
57
|
BitwiseExclusiveOrOperator = 53,
|
|
@@ -69,8 +69,8 @@ export type SymbolId = number & {
|
|
|
69
69
|
};
|
|
70
70
|
export declare enum NodeFlags {
|
|
71
71
|
None = 0,
|
|
72
|
-
Inline = 1
|
|
73
|
-
Declaration = 2
|
|
72
|
+
Inline = 1,// Keep function body on same line
|
|
73
|
+
Declaration = 2,// Prefer declaration syntax `function foo()` over assignment syntax `foo = function()`
|
|
74
74
|
TableUnpackCall = 4
|
|
75
75
|
}
|
|
76
76
|
export interface TextRange {
|
|
@@ -74,7 +74,11 @@ function findRootDeclarations(context, callExpression) {
|
|
|
74
74
|
? callExpression.tagName
|
|
75
75
|
: ts.isJsxOpeningElement(callExpression)
|
|
76
76
|
? callExpression.tagName
|
|
77
|
-
: callExpression
|
|
77
|
+
: ts.isCallExpression(callExpression)
|
|
78
|
+
? callExpression.expression
|
|
79
|
+
: undefined;
|
|
80
|
+
if (!calledExpression)
|
|
81
|
+
return [];
|
|
78
82
|
const calledSymbol = context.checker.getSymbolAtLocation(calledExpression);
|
|
79
83
|
if (calledSymbol === undefined)
|
|
80
84
|
return [];
|
|
@@ -13,7 +13,7 @@ const find_lua_requires_1 = require("./find-lua-requires");
|
|
|
13
13
|
const picomatch = require("picomatch");
|
|
14
14
|
const resolver = resolve.ResolverFactory.createResolver({
|
|
15
15
|
extensions: [".lua"],
|
|
16
|
-
enforceExtension: true,
|
|
16
|
+
enforceExtension: true, // Resolved file must be a lua file
|
|
17
17
|
fileSystem: { ...new resolve.CachedInputFileSystem(fs, 0) },
|
|
18
18
|
useSyncFileSystemCalls: true,
|
|
19
19
|
conditionNames: ["require", "node", "tstl", "default"],
|
|
@@ -220,10 +220,10 @@ class ResolutionContext {
|
|
|
220
220
|
}
|
|
221
221
|
searchForFileFromPath(resolvedPath) {
|
|
222
222
|
const possibleProjectFiles = [
|
|
223
|
-
resolvedPath,
|
|
224
|
-
resolvedPath + ".ts",
|
|
225
|
-
path.join(resolvedPath, "index.ts"),
|
|
226
|
-
resolvedPath + ".tsx",
|
|
223
|
+
resolvedPath, // JSON files need their extension as part of the import path, caught by this branch,
|
|
224
|
+
resolvedPath + ".ts", // Regular ts file
|
|
225
|
+
path.join(resolvedPath, "index.ts"), // Index ts file,
|
|
226
|
+
resolvedPath + ".tsx", // tsx file
|
|
227
227
|
path.join(resolvedPath, "index.tsx"), // tsx index
|
|
228
228
|
];
|
|
229
229
|
for (const possibleFile of possibleProjectFiles) {
|
|
@@ -233,8 +233,8 @@ class ResolutionContext {
|
|
|
233
233
|
}
|
|
234
234
|
// Check if this is a lua file in the project sources
|
|
235
235
|
const possibleLuaProjectFiles = [
|
|
236
|
-
resolvedPath + ".lua",
|
|
237
|
-
path.join(resolvedPath, "index.lua"),
|
|
236
|
+
resolvedPath + ".lua", // lua file in sources
|
|
237
|
+
path.join(resolvedPath, "index.lua"), // lua index file in sources
|
|
238
238
|
path.join(resolvedPath, "init.lua"), // lua looks for <require>/init.lua if it cannot find <require>.lua
|
|
239
239
|
];
|
|
240
240
|
for (const possibleFile of possibleLuaProjectFiles) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "typescript-to-lua",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.23.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/",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"node": ">=16.10.0"
|
|
43
43
|
},
|
|
44
44
|
"peerDependencies": {
|
|
45
|
-
"typescript": "5.
|
|
45
|
+
"typescript": "5.3.3"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
48
|
"@typescript-to-lua/language-extensions": "1.19.0",
|
|
@@ -72,6 +72,6 @@
|
|
|
72
72
|
"prettier": "^2.8.4",
|
|
73
73
|
"ts-jest": "^29.1.0",
|
|
74
74
|
"ts-node": "^10.9.1",
|
|
75
|
-
"typescript": "^5.
|
|
75
|
+
"typescript": "^5.3.3"
|
|
76
76
|
}
|
|
77
77
|
}
|