typescript-to-lua 1.3.2 → 1.4.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.
Files changed (135) hide show
  1. package/dist/CompilerOptions.d.ts +1 -1
  2. package/dist/CompilerOptions.js +0 -1
  3. package/dist/LuaLib.d.ts +12 -1
  4. package/dist/LuaLib.js +61 -65
  5. package/dist/LuaPrinter.js +9 -8
  6. package/dist/cli/parse.js +5 -0
  7. package/dist/index.d.ts +1 -0
  8. package/dist/index.js +5 -1
  9. package/dist/lualib/ArrayConcat.lua +1 -1
  10. package/dist/lualib/ArrayEntries.lua +1 -1
  11. package/dist/lualib/ArrayEvery.lua +2 -2
  12. package/dist/lualib/ArrayFilter.lua +2 -2
  13. package/dist/lualib/ArrayFind.lua +2 -2
  14. package/dist/lualib/ArrayFindIndex.lua +2 -2
  15. package/dist/lualib/ArrayFlat.lua +1 -1
  16. package/dist/lualib/ArrayFlatMap.lua +2 -2
  17. package/dist/lualib/ArrayForEach.lua +2 -2
  18. package/dist/lualib/ArrayIncludes.lua +1 -1
  19. package/dist/lualib/ArrayIndexOf.lua +1 -1
  20. package/dist/lualib/ArrayIsArray.lua +1 -1
  21. package/dist/lualib/ArrayJoin.lua +1 -1
  22. package/dist/lualib/ArrayMap.lua +2 -2
  23. package/dist/lualib/ArrayPush.lua +1 -1
  24. package/dist/lualib/ArrayReduce.lua +2 -2
  25. package/dist/lualib/ArrayReduceRight.lua +2 -2
  26. package/dist/lualib/ArrayReverse.lua +1 -1
  27. package/dist/lualib/ArraySetLength.lua +1 -1
  28. package/dist/lualib/ArrayShift.lua +1 -1
  29. package/dist/lualib/ArraySlice.lua +1 -1
  30. package/dist/lualib/ArraySome.lua +2 -2
  31. package/dist/lualib/ArraySort.lua +2 -2
  32. package/dist/lualib/ArraySplice.lua +1 -1
  33. package/dist/lualib/ArrayToObject.lua +1 -1
  34. package/dist/lualib/ArrayUnshift.lua +1 -1
  35. package/dist/lualib/Await.lua +13 -13
  36. package/dist/lualib/Class.lua +1 -1
  37. package/dist/lualib/ClassExtends.lua +1 -1
  38. package/dist/lualib/CloneDescriptor.lua +1 -1
  39. package/dist/lualib/Decorate.lua +5 -5
  40. package/dist/lualib/DecorateParam.lua +2 -2
  41. package/dist/lualib/DelegatedYield.lua +1 -1
  42. package/dist/lualib/Delete.lua +1 -1
  43. package/dist/lualib/Error.lua +68 -69
  44. package/dist/lualib/FunctionBind.lua +1 -1
  45. package/dist/lualib/Generator.lua +26 -23
  46. package/dist/lualib/InstanceOf.lua +1 -1
  47. package/dist/lualib/InstanceOfObject.lua +1 -1
  48. package/dist/lualib/Iterator.lua +35 -32
  49. package/dist/lualib/Map.lua +131 -129
  50. package/dist/lualib/MathAtan2.lua +1 -1
  51. package/dist/lualib/MathSign.lua +1 -1
  52. package/dist/lualib/New.lua +1 -1
  53. package/dist/lualib/Number.lua +1 -1
  54. package/dist/lualib/NumberIsFinite.lua +1 -1
  55. package/dist/lualib/NumberIsNaN.lua +1 -1
  56. package/dist/lualib/NumberToString.lua +42 -39
  57. package/dist/lualib/ObjectAssign.lua +1 -1
  58. package/dist/lualib/ObjectDefineProperty.lua +1 -1
  59. package/dist/lualib/ObjectEntries.lua +1 -1
  60. package/dist/lualib/ObjectFromEntries.lua +1 -1
  61. package/dist/lualib/ObjectGetOwnPropertyDescriptor.lua +1 -1
  62. package/dist/lualib/ObjectGetOwnPropertyDescriptors.lua +1 -1
  63. package/dist/lualib/ObjectKeys.lua +1 -1
  64. package/dist/lualib/ObjectRest.lua +1 -1
  65. package/dist/lualib/ObjectValues.lua +1 -1
  66. package/dist/lualib/ParseFloat.lua +1 -1
  67. package/dist/lualib/ParseInt.lua +39 -36
  68. package/dist/lualib/Promise.lua +148 -152
  69. package/dist/lualib/PromiseAll.lua +5 -5
  70. package/dist/lualib/PromiseAllSettled.lua +5 -5
  71. package/dist/lualib/PromiseAny.lua +5 -5
  72. package/dist/lualib/PromiseRace.lua +5 -5
  73. package/dist/lualib/Set.lua +120 -118
  74. package/dist/lualib/SetDescriptor.lua +67 -64
  75. package/dist/lualib/SourceMapTraceBack.lua +7 -6
  76. package/dist/lualib/SparseArrayNew.lua +1 -1
  77. package/dist/lualib/SparseArrayPush.lua +1 -1
  78. package/dist/lualib/SparseArraySpread.lua +1 -1
  79. package/dist/lualib/Spread.lua +1 -1
  80. package/dist/lualib/StringAccess.lua +1 -1
  81. package/dist/lualib/StringCharAt.lua +1 -1
  82. package/dist/lualib/StringCharCodeAt.lua +1 -1
  83. package/dist/lualib/StringConcat.lua +1 -1
  84. package/dist/lualib/StringEndsWith.lua +1 -1
  85. package/dist/lualib/StringIncludes.lua +1 -1
  86. package/dist/lualib/StringPadEnd.lua +1 -1
  87. package/dist/lualib/StringPadStart.lua +1 -1
  88. package/dist/lualib/StringReplace.lua +2 -2
  89. package/dist/lualib/StringReplaceAll.lua +4 -4
  90. package/dist/lualib/StringSlice.lua +1 -1
  91. package/dist/lualib/StringSplit.lua +1 -1
  92. package/dist/lualib/StringStartsWith.lua +1 -1
  93. package/dist/lualib/StringSubstr.lua +1 -1
  94. package/dist/lualib/StringSubstring.lua +1 -1
  95. package/dist/lualib/StringTrim.lua +1 -1
  96. package/dist/lualib/StringTrimEnd.lua +1 -1
  97. package/dist/lualib/StringTrimStart.lua +1 -1
  98. package/dist/lualib/Symbol.lua +14 -11
  99. package/dist/lualib/SymbolRegistry.lua +13 -10
  100. package/dist/lualib/TypeOf.lua +1 -1
  101. package/dist/lualib/Unpack.lua +1 -1
  102. package/dist/lualib/WeakMap.lua +41 -39
  103. package/dist/lualib/WeakSet.lua +37 -35
  104. package/dist/lualib/lualib_bundle.lua +1054 -924
  105. package/dist/lualib/lualib_module_info.json +619 -0
  106. package/dist/lualib-build/plugin.d.ts +23 -0
  107. package/dist/lualib-build/plugin.js +138 -0
  108. package/dist/lualib-build/util.d.ts +19 -0
  109. package/dist/lualib-build/util.js +43 -0
  110. package/dist/transformation/builtins/function.js +2 -1
  111. package/dist/transformation/builtins/index.d.ts +1 -0
  112. package/dist/transformation/builtins/index.js +63 -16
  113. package/dist/transformation/context/index.js +5 -1
  114. package/dist/transformation/utils/diagnostics.d.ts +3 -0
  115. package/dist/transformation/utils/diagnostics.js +2 -1
  116. package/dist/transformation/utils/typescript/index.js +5 -1
  117. package/dist/transformation/utils/typescript/types.d.ts +2 -0
  118. package/dist/transformation/utils/typescript/types.js +10 -1
  119. package/dist/transformation/visitors/class/index.js +1 -5
  120. package/dist/transformation/visitors/class/members/constructor.js +1 -3
  121. package/dist/transformation/visitors/class/members/fields.js +12 -8
  122. package/dist/transformation/visitors/class/new.d.ts +1 -2
  123. package/dist/transformation/visitors/class/new.js +1 -40
  124. package/dist/transformation/visitors/conditional.js +15 -14
  125. package/dist/transformation/visitors/identifier.js +5 -0
  126. package/dist/transformation/visitors/literal.js +22 -0
  127. package/dist/transformation/visitors/modules/import.js +4 -14
  128. package/dist/transpilation/bundle.js +1 -1
  129. package/dist/transpilation/index.js +5 -1
  130. package/dist/transpilation/plugins.d.ts +11 -0
  131. package/dist/transpilation/resolve.js +2 -2
  132. package/dist/transpilation/transpile.js +13 -0
  133. package/dist/transpilation/transpiler.js +6 -2
  134. package/package.json +12 -11
  135. package/CHANGELOG.md +0 -703
@@ -7,29 +7,30 @@ const preceding_statements_1 = require("../utils/preceding-statements");
7
7
  const scope_1 = require("../utils/scope");
8
8
  const block_1 = require("./block");
9
9
  const typescript_1 = require("../utils/typescript");
10
- function transformProtectedConditionalExpression(context, expression) {
10
+ function transformProtectedConditionalExpression(context, expression, condition, whenTrue, whenFalse) {
11
11
  const tempVar = context.createTempNameForNode(expression.condition);
12
- const condition = context.transformExpression(expression.condition);
13
- const [trueStatements, val1] = (0, preceding_statements_1.transformInPrecedingStatementScope)(context, () => context.transformExpression(expression.whenTrue));
14
- trueStatements.push(lua.createAssignmentStatement(lua.cloneIdentifier(tempVar), val1, expression.whenTrue));
15
- const [falseStatements, val2] = (0, preceding_statements_1.transformInPrecedingStatementScope)(context, () => context.transformExpression(expression.whenFalse));
16
- falseStatements.push(lua.createAssignmentStatement(lua.cloneIdentifier(tempVar), val2, expression.whenFalse));
12
+ const trueStatements = whenTrue[0].concat(lua.createAssignmentStatement(lua.cloneIdentifier(tempVar), whenTrue[1], expression.whenTrue));
13
+ const falseStatements = whenFalse[0].concat(lua.createAssignmentStatement(lua.cloneIdentifier(tempVar), whenFalse[1], expression.whenFalse));
17
14
  context.addPrecedingStatements([
18
15
  lua.createVariableDeclarationStatement(tempVar, undefined, expression.condition),
19
- lua.createIfStatement(condition, lua.createBlock(trueStatements, expression.whenTrue), lua.createBlock(falseStatements, expression.whenFalse), expression),
16
+ ...condition[0],
17
+ lua.createIfStatement(condition[1], lua.createBlock(trueStatements, expression.whenTrue), lua.createBlock(falseStatements, expression.whenFalse), expression),
20
18
  ]);
21
19
  return lua.cloneIdentifier(tempVar);
22
20
  }
23
21
  const transformConditionalExpression = (expression, context) => {
24
- if ((0, typescript_1.canBeFalsy)(context, context.checker.getTypeAtLocation(expression.whenTrue))) {
25
- return transformProtectedConditionalExpression(context, expression);
22
+ const condition = (0, preceding_statements_1.transformInPrecedingStatementScope)(context, () => context.transformExpression(expression.condition));
23
+ const whenTrue = (0, preceding_statements_1.transformInPrecedingStatementScope)(context, () => context.transformExpression(expression.whenTrue));
24
+ const whenFalse = (0, preceding_statements_1.transformInPrecedingStatementScope)(context, () => context.transformExpression(expression.whenFalse));
25
+ if (whenTrue[0].length > 0 ||
26
+ whenFalse[0].length > 0 ||
27
+ (0, typescript_1.canBeFalsy)(context, context.checker.getTypeAtLocation(expression.whenTrue))) {
28
+ return transformProtectedConditionalExpression(context, expression, condition, whenTrue, whenFalse);
26
29
  }
27
- const condition = context.transformExpression(expression.condition);
28
- const val1 = context.transformExpression(expression.whenTrue);
29
- const val2 = context.transformExpression(expression.whenFalse);
30
30
  // condition and v1 or v2
31
- const conditionAnd = lua.createBinaryExpression(condition, val1, lua.SyntaxKind.AndOperator);
32
- return lua.createBinaryExpression(conditionAnd, val2, lua.SyntaxKind.OrOperator, expression);
31
+ context.addPrecedingStatements(condition[0]);
32
+ const conditionAnd = lua.createBinaryExpression(condition[1], whenTrue[1], lua.SyntaxKind.AndOperator);
33
+ return lua.createBinaryExpression(conditionAnd, whenFalse[1], lua.SyntaxKind.OrOperator, expression);
33
34
  };
34
35
  exports.transformConditionalExpression = transformConditionalExpression;
35
36
  function transformIfStatement(statement, context) {
@@ -18,6 +18,7 @@ const range_1 = require("./language-extensions/range");
18
18
  const table_1 = require("./language-extensions/table");
19
19
  const vararg_1 = require("./language-extensions/vararg");
20
20
  const optional_chaining_1 = require("./optional-chaining");
21
+ const typescript_1 = require("../utils/typescript");
21
22
  function transformIdentifier(context, identifier) {
22
23
  if ((0, optional_chaining_1.isOptionalContinuation)(identifier)) {
23
24
  return lua.createIdentifier(identifier.text, undefined, context_1.tempSymbolId);
@@ -47,6 +48,10 @@ function transformIdentifier(context, identifier) {
47
48
  (0, lualib_1.importLuaLibFeature)(context, lualib_1.LuaLibFeature.Promise);
48
49
  return (0, promise_1.createPromiseIdentifier)(identifier);
49
50
  }
51
+ const type = context.checker.getTypeAtLocation(identifier);
52
+ if ((0, typescript_1.isStandardLibraryType)(context, type, undefined)) {
53
+ (0, builtins_1.checkForLuaLibType)(context, type);
54
+ }
50
55
  const text = (0, safe_names_1.hasUnsafeIdentifierName)(context, identifier) ? (0, safe_names_1.createSafeName)(identifier.text) : identifier.text;
51
56
  const symbolId = (0, symbols_1.getIdentifierSymbolId)(context, identifier);
52
57
  return lua.createIdentifier(text, identifier, symbolId, identifier.text);
@@ -174,10 +174,32 @@ const transformObjectLiteralExpression = (expression, context) => {
174
174
  }
175
175
  };
176
176
  const transformArrayLiteralExpression = (expression, context) => {
177
+ // Disallow using undefined/null in array literals
178
+ checkForUndefinedOrNullInArrayLiteral(expression, context);
177
179
  const filteredElements = expression.elements.map(e => ts.isOmittedExpression(e) ? ts.factory.createIdentifier("undefined") : e);
178
180
  const values = (0, expression_list_1.transformExpressionList)(context, filteredElements).map(e => lua.createTableFieldExpression(e));
179
181
  return lua.createTableExpression(values, expression);
180
182
  };
183
+ function checkForUndefinedOrNullInArrayLiteral(array, context) {
184
+ // Look for last non-nil element in literal
185
+ let lastNonUndefinedIndex = array.elements.length - 1;
186
+ for (; lastNonUndefinedIndex >= 0; lastNonUndefinedIndex--) {
187
+ if (!isUndefinedOrNull(array.elements[lastNonUndefinedIndex])) {
188
+ break;
189
+ }
190
+ }
191
+ // Add diagnostics for non-trailing nil elements in array literal
192
+ for (let i = 0; i < array.elements.length; i++) {
193
+ if (i < lastNonUndefinedIndex && isUndefinedOrNull(array.elements[i])) {
194
+ context.diagnostics.push((0, diagnostics_1.undefinedInArrayLiteral)(array.elements[i]));
195
+ }
196
+ }
197
+ }
198
+ function isUndefinedOrNull(node) {
199
+ return (node.kind === ts.SyntaxKind.UndefinedKeyword ||
200
+ node.kind === ts.SyntaxKind.NullKeyword ||
201
+ (ts.isIdentifier(node) && node.text === "undefined"));
202
+ }
181
203
  exports.literalVisitors = {
182
204
  [ts.SyntaxKind.NullKeyword]: node => lua.createNilLiteral(node),
183
205
  [ts.SyntaxKind.TrueKeyword]: node => lua.createBooleanLiteral(true, node),
@@ -48,13 +48,8 @@ const transformImportDeclaration = (statement, context) => {
48
48
  // require("module")
49
49
  if (statement.importClause === undefined) {
50
50
  result.push(lua.createExpressionStatement(requireCall));
51
- if (scope.importStatements) {
52
- scope.importStatements.push(...result);
53
- return undefined;
54
- }
55
- else {
56
- return result;
57
- }
51
+ scope.importStatements.push(...result);
52
+ return undefined;
58
53
  }
59
54
  const importPath = ts.isStringLiteral(statement.moduleSpecifier)
60
55
  ? statement.moduleSpecifier.text.replace(/"/g, "")
@@ -100,13 +95,8 @@ const transformImportDeclaration = (statement, context) => {
100
95
  if (usingRequireStatement) {
101
96
  result.unshift(lua.createVariableDeclarationStatement(importUniqueName, requireCall, statement));
102
97
  }
103
- if (scope.importStatements) {
104
- scope.importStatements.push(...result);
105
- return undefined;
106
- }
107
- else {
108
- return result;
109
- }
98
+ scope.importStatements.push(...result);
99
+ return undefined;
110
100
  };
111
101
  exports.transformImportDeclaration = transformImportDeclaration;
112
102
  const transformExternalModuleReference = (node, context) => createModuleRequire(context, node.expression, node);
@@ -85,7 +85,7 @@ function getBundleResult(program, files) {
85
85
  const footers = [];
86
86
  if (options.sourceMapTraceback) {
87
87
  // Generates SourceMapTraceback for the entire file
88
- footers.push('require("lualib_bundle")\n');
88
+ footers.push('local __TS__SourceMapTraceBack = require("lualib_bundle").__TS__SourceMapTraceBack\n');
89
89
  footers.push(`${exports.sourceMapTracebackBundlePlaceholder}\n`);
90
90
  }
91
91
  const sourceChunks = [requireOverride, moduleTable, ...footers, entryPoint];
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -1,6 +1,9 @@
1
1
  import * as ts from "typescript";
2
+ import { EmitHost } from "..";
3
+ import { CompilerOptions } from "../CompilerOptions";
2
4
  import { Printer } from "../LuaPrinter";
3
5
  import { Visitors } from "../transformation/context";
6
+ import { ProcessedFile } from "./utils";
4
7
  export interface Plugin {
5
8
  /**
6
9
  * An augmentation to the map of visitors that transform TypeScript AST to Lua AST.
@@ -14,5 +17,13 @@ export interface Plugin {
14
17
  * At most one custom printer can be provided across all plugins.
15
18
  */
16
19
  printer?: Printer;
20
+ /**
21
+ * This function is called before transpilation of the TypeScript program starts.
22
+ */
23
+ beforeTransform?: (program: ts.Program, options: CompilerOptions, emitHost: EmitHost) => ts.Diagnostic[] | void;
24
+ /**
25
+ * This function is called after TypeScriptToLua has translated the input program to Lua.
26
+ */
27
+ afterPrint?: (program: ts.Program, options: CompilerOptions, emitHost: EmitHost, result: ProcessedFile[]) => ts.Diagnostic[] | void;
17
28
  }
18
29
  export declare function getPlugins(program: ts.Program, diagnostics: ts.Diagnostic[], customPlugins: Plugin[]): Plugin[];
@@ -135,14 +135,14 @@ function resolveFileDependencies(file, context) {
135
135
  dependencies.push(...resolvedDependency.resolvedFiles);
136
136
  diagnostics.push(...resolvedDependency.diagnostics);
137
137
  }
138
- return { resolvedFiles: dependencies, diagnostics };
138
+ return { resolvedFiles: deduplicateResolvedFiles(dependencies), diagnostics };
139
139
  }
140
140
  function resolveDependency(requiringFile, dependency, program, emitHost) {
141
141
  var _a;
142
142
  const options = program.getCompilerOptions();
143
143
  const fileDirectory = path.dirname(requiringFile.fileName);
144
144
  if (options.tstlVerbose) {
145
- console.log(`Resolving "${dependency}" from ${(0, utils_1.normalizeSlashes)(fileDirectory)}`);
145
+ console.log(`Resolving "${dependency}" from ${(0, utils_1.normalizeSlashes)(requiringFile.fileName)}`);
146
146
  }
147
147
  // Check if the import is relative
148
148
  const isRelative = ["/", "./", "../"].some(p => dependency.startsWith(p));
@@ -10,6 +10,7 @@ const utils_1 = require("../utils");
10
10
  const plugins_1 = require("./plugins");
11
11
  const transformers_1 = require("./transformers");
12
12
  function getProgramTranspileResult(emitHost, writeFileResult, { program, sourceFiles: targetSourceFiles, customTransformers = {}, plugins: customPlugins = [] }) {
13
+ var _a, _b;
13
14
  const options = program.getCompilerOptions();
14
15
  if (options.tstlVerbose) {
15
16
  console.log("Parsing project settings");
@@ -43,6 +44,12 @@ function getProgramTranspileResult(emitHost, writeFileResult, { program, sourceF
43
44
  if (options.tstlVerbose) {
44
45
  console.log(`Successfully loaded ${plugins.length} plugins`);
45
46
  }
47
+ for (const plugin of plugins) {
48
+ if (plugin.beforeTransform) {
49
+ const pluginDiagnostics = (_a = plugin.beforeTransform(program, options, emitHost)) !== null && _a !== void 0 ? _a : [];
50
+ diagnostics.push(...pluginDiagnostics);
51
+ }
52
+ }
46
53
  const visitorMap = (0, transformation_1.createVisitorMap)(plugins.map(p => p.visitors).filter(utils_1.isNonNull));
47
54
  const printer = (0, LuaPrinter_1.createPrinter)(plugins.map(p => p.printer).filter(utils_1.isNonNull));
48
55
  const processSourceFile = (sourceFile) => {
@@ -95,6 +102,12 @@ function getProgramTranspileResult(emitHost, writeFileResult, { program, sourceF
95
102
  if (options.noEmit || (options.noEmitOnError && diagnostics.length > 0)) {
96
103
  transpiledFiles = [];
97
104
  }
105
+ for (const plugin of plugins) {
106
+ if (plugin.afterPrint) {
107
+ const pluginDiagnostics = (_b = plugin.afterPrint(program, options, emitHost, transpiledFiles)) !== null && _b !== void 0 ? _b : [];
108
+ diagnostics.push(...pluginDiagnostics);
109
+ }
110
+ }
98
111
  return { diagnostics, transpiledFiles };
99
112
  }
100
113
  exports.getProgramTranspileResult = getProgramTranspileResult;
@@ -80,6 +80,7 @@ function getEmitPath(file, program) {
80
80
  }
81
81
  exports.getEmitPath = getEmitPath;
82
82
  function getEmitPathRelativeToOutDir(fileName, program) {
83
+ var _a;
83
84
  const sourceDir = getSourceDir(program);
84
85
  // Default output path is relative path in source dir
85
86
  let emitPathSplits = path.relative(sourceDir, fileName).split(path.sep);
@@ -89,8 +90,11 @@ function getEmitPathRelativeToOutDir(fileName, program) {
89
90
  if (emitPathSplits[0] === "node_modules") {
90
91
  emitPathSplits[0] = "lua_modules";
91
92
  }
92
- // Make extension lua
93
- emitPathSplits[emitPathSplits.length - 1] = (0, utils_1.trimExtension)(emitPathSplits[emitPathSplits.length - 1]) + ".lua";
93
+ // Set extension
94
+ const extension = ((_a = program.getCompilerOptions().extension) !== null && _a !== void 0 ? _a : "lua").trim();
95
+ const trimmedExtension = extension.startsWith(".") ? extension.substring(1) : extension;
96
+ emitPathSplits[emitPathSplits.length - 1] =
97
+ (0, utils_1.trimExtension)(emitPathSplits[emitPathSplits.length - 1]) + "." + trimmedExtension;
94
98
  return path.join(...emitPathSplits);
95
99
  }
96
100
  exports.getEmitPathRelativeToOutDir = getEmitPathRelativeToOutDir;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "typescript-to-lua",
3
- "version": "1.3.2",
3
+ "version": "1.4.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/",
@@ -18,13 +18,14 @@
18
18
  "dist/**/*.js",
19
19
  "dist/**/*.lua",
20
20
  "dist/**/*.ts",
21
+ "dist/lualib/*.json",
21
22
  "language-extensions/**/*.ts"
22
23
  ],
23
24
  "main": "dist/index.js",
24
25
  "types": "dist/index.d.ts",
25
26
  "scripts": {
26
27
  "build": "tsc && npm run build-lualib",
27
- "build-lualib": "node build-lualib.js",
28
+ "build-lualib": "node dist/tstl.js -p src/lualib/tsconfig.json",
28
29
  "pretest": "npm run lint && npm run check:language-extensions && npm run build-lualib",
29
30
  "test": "jest",
30
31
  "lint": "npm run lint:eslint && npm run lint:prettier",
@@ -42,7 +43,7 @@
42
43
  "node": ">=12.13.0"
43
44
  },
44
45
  "peerDependencies": {
45
- "typescript": "~4.5.2"
46
+ "typescript": "~4.6.2"
46
47
  },
47
48
  "dependencies": {
48
49
  "enhanced-resolve": "^5.8.2",
@@ -52,14 +53,14 @@
52
53
  "devDependencies": {
53
54
  "@types/fs-extra": "^8.1.0",
54
55
  "@types/glob": "^7.1.1",
55
- "@types/jest": "^25.1.3",
56
+ "@types/jest": "^27.4.1",
56
57
  "@types/node": "^13.7.7",
57
58
  "@types/resolve": "1.14.0",
58
- "@typescript-eslint/eslint-plugin": "^5.4.0",
59
- "@typescript-eslint/parser": "^5.4.0",
60
- "eslint": "^7.32.0",
61
- "eslint-plugin-import": "^2.24.2",
62
- "eslint-plugin-jest": "^24.4.0",
59
+ "@typescript-eslint/eslint-plugin": "^5.13.0",
60
+ "@typescript-eslint/parser": "^5.13.0",
61
+ "eslint": "^8.10.0",
62
+ "eslint-plugin-import": "^2.25.4",
63
+ "eslint-plugin-jest": "^26.1.1",
63
64
  "fs-extra": "^8.1.0",
64
65
  "javascript-stringify": "^2.0.1",
65
66
  "jest": "^27.3.0",
@@ -67,8 +68,8 @@
67
68
  "lua-types": "2.10.1",
68
69
  "lua-wasm-bindings": "^0.2.2",
69
70
  "prettier": "^2.3.2",
70
- "ts-jest": "^27.0.7",
71
+ "ts-jest": "^27.1.3",
71
72
  "ts-node": "^10.3.0",
72
- "typescript": "~4.5.2"
73
+ "typescript": "~4.6.2"
73
74
  }
74
75
  }