typescript-to-lua 1.32.0 → 1.33.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.
@@ -7,7 +7,7 @@ export declare const lualibDiagnostic: ((message: string, file?: ts.SourceFile |
7
7
  };
8
8
  declare class LuaLibPlugin implements tstl.Plugin {
9
9
  visitors: {
10
- 307: (file: ts.SourceFile, context: tstl.TransformationContext) => tstl.File;
10
+ 308: (file: ts.SourceFile, context: tstl.TransformationContext) => tstl.File;
11
11
  };
12
12
  printer: tstl.Printer;
13
13
  afterPrint(program: ts.Program, options: tstl.CompilerOptions, emitHost: EmitHost, result: ProcessedFile[]): ts.Diagnostic[];
@@ -42,10 +42,9 @@ function* walkScopesUp(context) {
42
42
  }
43
43
  }
44
44
  function markSymbolAsReferencedInCurrentScopes(context, symbolId, identifier) {
45
+ var _a;
45
46
  for (const scope of context.scopeStack) {
46
- if (!scope.referencedSymbols) {
47
- scope.referencedSymbols = new Map();
48
- }
47
+ (_a = scope.referencedSymbols) !== null && _a !== void 0 ? _a : (scope.referencedSymbols = new Map());
49
48
  const references = (0, utils_1.getOrUpdate)(scope.referencedSymbols, symbolId, () => []);
50
49
  references.push(identifier);
51
50
  }
@@ -65,9 +64,8 @@ function findScope(context, scopeTypes) {
65
64
  }
66
65
  }
67
66
  function addScopeVariableDeclaration(scope, declaration) {
68
- if (!scope.variableDeclarations) {
69
- scope.variableDeclarations = [];
70
- }
67
+ var _a;
68
+ (_a = scope.variableDeclarations) !== null && _a !== void 0 ? _a : (scope.variableDeclarations = []);
71
69
  scope.variableDeclarations.push(declaration);
72
70
  }
73
71
  function isHoistableFunctionDeclaredInScope(symbol, scopeNode) {
@@ -191,10 +191,8 @@ const transformSuperExpression = (expression, context) => {
191
191
  baseClassName = (0, identifier_1.transformIdentifier)(context, extendsExpression);
192
192
  }
193
193
  }
194
- if (!baseClassName) {
195
- // Use "className.____super" if the base is not a simple identifier
196
- baseClassName = lua.createTableIndexExpression(className, lua.createStringLiteral("____super"), expression);
197
- }
194
+ // Use "className.____super" if the base is not a simple identifier
195
+ baseClassName !== null && baseClassName !== void 0 ? baseClassName : (baseClassName = lua.createTableIndexExpression(className, lua.createStringLiteral("____super"), expression));
198
196
  const f = (0, typescript_1.findFirstNodeAbove)(expression, ts.isFunctionLike);
199
197
  if (f && ts.canHaveModifiers(f) && (0, utils_1.isStaticNode)(f)) {
200
198
  // In static method, don't add prototype to super call
@@ -49,9 +49,7 @@ const transformEnumDeclaration = (node, context) => {
49
49
  valueExpression = lua.createTableIndexExpression(enumReference, otherMemberName);
50
50
  }
51
51
  }
52
- if (!valueExpression) {
53
- valueExpression = context.transformExpression(member.initializer);
54
- }
52
+ valueExpression !== null && valueExpression !== void 0 ? valueExpression : (valueExpression = context.transformExpression(member.initializer));
55
53
  }
56
54
  else {
57
55
  valueExpression = lua.createNilLiteral();
@@ -234,7 +234,7 @@ function transformFunctionLikeDeclaration(node, context) {
234
234
  : functionExpression;
235
235
  }
236
236
  const transformFunctionDeclaration = (node, context) => {
237
- var _a;
237
+ var _a, _b;
238
238
  // Don't transform functions without body (overload declarations)
239
239
  if (node.body === undefined) {
240
240
  return undefined;
@@ -248,10 +248,8 @@ const transformFunctionDeclaration = (node, context) => {
248
248
  // Remember symbols referenced in this function for hoisting later
249
249
  if (name.symbolId !== undefined) {
250
250
  const scope = (0, scope_1.peekScope)(context);
251
- if (!scope.functionDefinitions) {
252
- scope.functionDefinitions = new Map();
253
- }
254
- const functionInfo = { referencedSymbols: (_a = functionScope.referencedSymbols) !== null && _a !== void 0 ? _a : new Map() };
251
+ (_a = scope.functionDefinitions) !== null && _a !== void 0 ? _a : (scope.functionDefinitions = new Map());
252
+ const functionInfo = { referencedSymbols: (_b = functionScope.referencedSymbols) !== null && _b !== void 0 ? _b : new Map() };
255
253
  scope.functionDefinitions.set(name.symbolId, functionInfo);
256
254
  }
257
255
  // Wrap functions with properties into a callable table
@@ -46,10 +46,9 @@ function transformImportSpecifier(context, importSpecifier, moduleTableName) {
46
46
  return lua.createVariableDeclarationStatement(leftIdentifier, lua.createTableIndexExpression(moduleTableName, propertyName), importSpecifier);
47
47
  }
48
48
  const transformImportDeclaration = (statement, context) => {
49
+ var _a;
49
50
  const scope = (0, scope_1.peekScope)(context);
50
- if (!scope.importStatements) {
51
- scope.importStatements = [];
52
- }
51
+ (_a = scope.importStatements) !== null && _a !== void 0 ? _a : (scope.importStatements = []);
53
52
  const result = [];
54
53
  const requireCall = createModuleRequire(context, statement.moduleSpecifier);
55
54
  // import "./module";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "typescript-to-lua",
3
- "version": "1.32.0",
3
+ "version": "1.33.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.8.2"
45
+ "typescript": "5.9.3"
46
46
  },
47
47
  "dependencies": {
48
48
  "@typescript-to-lua/language-extensions": "1.19.0",
@@ -69,7 +69,7 @@
69
69
  "prettier": "^2.8.8",
70
70
  "ts-jest": "^29.2.5",
71
71
  "ts-node": "^10.9.2",
72
- "typescript": "5.8.2",
73
- "typescript-eslint": "^8.26.0"
72
+ "typescript": "5.9.3",
73
+ "typescript-eslint": "^8.46.3"
74
74
  }
75
75
  }