crankscript 0.17.0 → 0.18.0-beta.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.
Files changed (284) hide show
  1. package/CHANGELOG.md +11 -5
  2. package/assets/ImportMap/ImportMap.js +26 -65
  3. package/assets/ImportMap/ImportMap.js.map +1 -1
  4. package/assets/ImportMap/index.js +3 -6
  5. package/assets/ImportMap/index.js.map +1 -1
  6. package/assets/beforeEmit/getBeforeEmit.js +11 -16
  7. package/assets/beforeEmit/getBeforeEmit.js.map +1 -1
  8. package/assets/beforeEmit/index.js +3 -6
  9. package/assets/beforeEmit/index.js.map +1 -1
  10. package/assets/beforeEmit/withAutomaticImportWarning.js +4 -11
  11. package/assets/beforeEmit/withAutomaticImportWarning.js.map +1 -1
  12. package/assets/index.js +18 -28
  13. package/assets/index.js.map +1 -1
  14. package/assets/transformCallExpression/getTransformCallExpression.js +66 -18
  15. package/assets/transformCallExpression/getTransformCallExpression.js.map +1 -1
  16. package/assets/transformCallExpression/index.js +3 -6
  17. package/assets/transformCallExpression/index.js.map +1 -1
  18. package/assets/transformClassDeclaration/createClasCall.js +11 -24
  19. package/assets/transformClassDeclaration/createClasCall.js.map +1 -1
  20. package/assets/transformClassDeclaration/getExportedClassDeclarationStatements.js +14 -15
  21. package/assets/transformClassDeclaration/getExportedClassDeclarationStatements.js.map +1 -1
  22. package/assets/transformClassDeclaration/getTransformClassDeclaration.js +47 -43
  23. package/assets/transformClassDeclaration/getTransformClassDeclaration.js.map +1 -1
  24. package/assets/transformClassDeclaration/index.js +3 -6
  25. package/assets/transformClassDeclaration/index.js.map +1 -1
  26. package/assets/transformClassDeclaration/transformConstructor.js +44 -56
  27. package/assets/transformClassDeclaration/transformConstructor.js.map +1 -1
  28. package/assets/transformClassDeclaration/transformMethodDeclaration.js +12 -20
  29. package/assets/transformClassDeclaration/transformMethodDeclaration.js.map +1 -1
  30. package/assets/transformClassDeclaration/transformPropertyName.js +14 -19
  31. package/assets/transformClassDeclaration/transformPropertyName.js.map +1 -1
  32. package/assets/transformExportDeclaration/getTransformExportDeclaration.d.ts +6 -0
  33. package/assets/transformExportDeclaration/getTransformExportDeclaration.js +52 -0
  34. package/assets/transformExportDeclaration/getTransformExportDeclaration.js.map +1 -0
  35. package/assets/transformNewExpression/index.js +3 -6
  36. package/assets/transformNewExpression/index.js.map +1 -1
  37. package/assets/transformNewExpression/isBuiltinNewExpression.js +11 -15
  38. package/assets/transformNewExpression/isBuiltinNewExpression.js.map +1 -1
  39. package/assets/transformNewExpression/transformNewExpression.js +12 -23
  40. package/assets/transformNewExpression/transformNewExpression.js.map +1 -1
  41. package/assets/transformPropertyAccessExpression/a.js +24 -0
  42. package/assets/transformPropertyAccessExpression/a.js.map +1 -0
  43. package/assets/transformPropertyAccessExpression/getTransformPropertyAccessExpression.js +6 -13
  44. package/assets/transformPropertyAccessExpression/getTransformPropertyAccessExpression.js.map +1 -1
  45. package/assets/transformPropertyAccessExpression/index.js +3 -6
  46. package/assets/transformPropertyAccessExpression/index.js.map +1 -1
  47. package/assets/transformSuperExpression/index.js +3 -6
  48. package/assets/transformSuperExpression/index.js.map +1 -1
  49. package/assets/transformSuperExpression/transformSuperExpression.js +8 -16
  50. package/assets/transformSuperExpression/transformSuperExpression.js.map +1 -1
  51. package/assets/types.js +1 -4
  52. package/assets/types.js.map +1 -1
  53. package/package.json +8 -5
  54. package/src/commands/CompileCommand/CompileCommand.d.ts +1 -1
  55. package/src/commands/CompileCommand/CompileCommand.js +3 -10
  56. package/src/commands/CompileCommand/CompileCommand.js.map +1 -1
  57. package/src/commands/CompileCommand/components/Compile.d.ts +1 -1
  58. package/src/commands/CompileCommand/components/Compile.js +3 -7
  59. package/src/commands/CompileCommand/components/Compile.js.map +1 -1
  60. package/src/commands/CompileCommand/fn/getPdcPathFromEnvironment.d.ts +1 -1
  61. package/src/commands/CompileCommand/fn/getPdcPathFromEnvironment.js +1 -2
  62. package/src/commands/CompileCommand/fn/getPdcPathFromEnvironment.js.map +1 -1
  63. package/src/commands/CompileCommand/hooks/task/compile.d.ts +5 -2
  64. package/src/commands/CompileCommand/hooks/task/compile.js +10 -9
  65. package/src/commands/CompileCommand/hooks/task/compile.js.map +1 -1
  66. package/src/commands/CompileCommand/hooks/useCompileTasks.d.ts +5 -2
  67. package/src/commands/CompileCommand/hooks/useCompileTasks.js +33 -30
  68. package/src/commands/CompileCommand/hooks/useCompileTasks.js.map +1 -1
  69. package/src/commands/CompileCommand/index.js +0 -1
  70. package/src/commands/CompileCommand/index.js.map +1 -1
  71. package/src/commands/DoctorCommand.js +5 -12
  72. package/src/commands/DoctorCommand.js.map +1 -1
  73. package/src/commands/EnvironmentAwareCommand/EnvironmentAwareCommand.d.ts +2 -2
  74. package/src/commands/EnvironmentAwareCommand/EnvironmentAwareCommand.js +30 -30
  75. package/src/commands/EnvironmentAwareCommand/EnvironmentAwareCommand.js.map +1 -1
  76. package/src/commands/EnvironmentAwareCommand/components/HealthReport.d.ts +1 -1
  77. package/src/commands/EnvironmentAwareCommand/components/HealthReport.js +14 -15
  78. package/src/commands/EnvironmentAwareCommand/components/HealthReport.js.map +1 -1
  79. package/src/commands/EnvironmentAwareCommand/contexts/CrankScriptContext.js +5 -10
  80. package/src/commands/EnvironmentAwareCommand/contexts/CrankScriptContext.js.map +1 -1
  81. package/src/commands/EnvironmentAwareCommand/index.js +0 -1
  82. package/src/commands/EnvironmentAwareCommand/index.js.map +1 -1
  83. package/src/commands/GenerateTypes/GenerateTypesCommand.js +14 -21
  84. package/src/commands/GenerateTypes/GenerateTypesCommand.js.map +1 -1
  85. package/src/commands/GenerateTypes/components/GenerateTypes.d.ts +1 -1
  86. package/src/commands/GenerateTypes/components/GenerateTypes.js +11 -15
  87. package/src/commands/GenerateTypes/components/GenerateTypes.js.map +1 -1
  88. package/src/commands/GenerateTypes/constants.js +0 -1
  89. package/src/commands/GenerateTypes/constants.js.map +1 -1
  90. package/src/commands/GenerateTypes/fn/getApiDefinitions.d.ts +1 -1
  91. package/src/commands/GenerateTypes/fn/getApiDefinitions.js +12 -14
  92. package/src/commands/GenerateTypes/fn/getApiDefinitions.js.map +1 -1
  93. package/src/commands/GenerateTypes/fn/getDescriptionsFromHtml.d.ts +1 -1
  94. package/src/commands/GenerateTypes/fn/getDescriptionsFromHtml.js +38 -30
  95. package/src/commands/GenerateTypes/fn/getDescriptionsFromHtml.js.map +1 -1
  96. package/src/commands/GenerateTypes/fn/getFunctionTypeOverride.js +5 -4
  97. package/src/commands/GenerateTypes/fn/getFunctionTypeOverride.js.map +1 -1
  98. package/src/commands/GenerateTypes/fn/getHtmlForVersion.js +6 -9
  99. package/src/commands/GenerateTypes/fn/getHtmlForVersion.js.map +1 -1
  100. package/src/commands/GenerateTypes/fn/parseFunctionSignature.js +13 -10
  101. package/src/commands/GenerateTypes/fn/parseFunctionSignature.js.map +1 -1
  102. package/src/commands/GenerateTypes/hooks/useFetchHtml.js +10 -12
  103. package/src/commands/GenerateTypes/hooks/useFetchHtml.js.map +1 -1
  104. package/src/commands/GenerateTypes/hooks/useFormatTypeFile.js +23 -29
  105. package/src/commands/GenerateTypes/hooks/useFormatTypeFile.js.map +1 -1
  106. package/src/commands/GenerateTypes/hooks/useGenerateTypeFile.d.ts +2 -2
  107. package/src/commands/GenerateTypes/hooks/useGenerateTypeFile.js +44 -75
  108. package/src/commands/GenerateTypes/hooks/useGenerateTypeFile.js.map +1 -1
  109. package/src/commands/GenerateTypes/hooks/useGetVersion.d.ts +1 -1
  110. package/src/commands/GenerateTypes/hooks/useGetVersion.js +19 -19
  111. package/src/commands/GenerateTypes/hooks/useGetVersion.js.map +1 -1
  112. package/src/commands/GenerateTypes/hooks/useParseDocumentation.d.ts +1 -1
  113. package/src/commands/GenerateTypes/hooks/useParseDocumentation.js +10 -12
  114. package/src/commands/GenerateTypes/hooks/useParseDocumentation.js.map +1 -1
  115. package/src/commands/GenerateTypes/index.js +0 -1
  116. package/src/commands/GenerateTypes/index.js.map +1 -1
  117. package/src/commands/GenerateTypes/types.d.ts +1 -1
  118. package/src/commands/GenerateTypes/types.js +1 -2
  119. package/src/commands/GenerateTypes/types.js.map +1 -1
  120. package/src/commands/GenerateTypes/utils/createTypeProvider.d.ts +2 -2
  121. package/src/commands/GenerateTypes/utils/createTypeProvider.js +63 -85
  122. package/src/commands/GenerateTypes/utils/createTypeProvider.js.map +1 -1
  123. package/src/commands/GenerateTypes/utils/functionTypeOverrides.d.ts +1 -1
  124. package/src/commands/GenerateTypes/utils/functionTypeOverrides.js +6 -7
  125. package/src/commands/GenerateTypes/utils/functionTypeOverrides.js.map +1 -1
  126. package/src/commands/NewCommand/NewCommand.js +9 -17
  127. package/src/commands/NewCommand/NewCommand.js.map +1 -1
  128. package/src/commands/NewCommand/components/New.d.ts +1 -1
  129. package/src/commands/NewCommand/components/New.js +19 -25
  130. package/src/commands/NewCommand/components/New.js.map +1 -1
  131. package/src/commands/NewLibCommand/NewLibCommand.js +9 -17
  132. package/src/commands/NewLibCommand/NewLibCommand.js.map +1 -1
  133. package/src/commands/NewLibCommand/components/NewLib.d.ts +1 -1
  134. package/src/commands/NewLibCommand/components/NewLib.js +19 -25
  135. package/src/commands/NewLibCommand/components/NewLib.js.map +1 -1
  136. package/src/commands/NewLibCommand/index.js +0 -1
  137. package/src/commands/NewLibCommand/index.js.map +1 -1
  138. package/src/commands/RenderableCommand.d.ts +1 -1
  139. package/src/commands/RenderableCommand.js +5 -3
  140. package/src/commands/RenderableCommand.js.map +1 -1
  141. package/src/commands/SimulatorCommand/SimulatorCommand.d.ts +1 -1
  142. package/src/commands/SimulatorCommand/SimulatorCommand.js +23 -38
  143. package/src/commands/SimulatorCommand/SimulatorCommand.js.map +1 -1
  144. package/src/commands/SimulatorCommand/components/Simulator.d.ts +3 -2
  145. package/src/commands/SimulatorCommand/components/Simulator.js +19 -17
  146. package/src/commands/SimulatorCommand/components/Simulator.js.map +1 -1
  147. package/src/commands/SimulatorCommand/components/TemporaryFolderCreator.d.ts +1 -1
  148. package/src/commands/SimulatorCommand/components/TemporaryFolderCreator.js +15 -22
  149. package/src/commands/SimulatorCommand/components/TemporaryFolderCreator.js.map +1 -1
  150. package/src/commands/SimulatorCommand/fn/createTemporaryFolderPathFromEntryFile.js +8 -6
  151. package/src/commands/SimulatorCommand/fn/createTemporaryFolderPathFromEntryFile.js.map +1 -1
  152. package/src/commands/SimulatorCommand/fn/getSimulatorPathFromEnvironment.d.ts +1 -1
  153. package/src/commands/SimulatorCommand/fn/getSimulatorPathFromEnvironment.js +1 -2
  154. package/src/commands/SimulatorCommand/fn/getSimulatorPathFromEnvironment.js.map +1 -1
  155. package/src/commands/SimulatorCommand/hooks/useFileWatcher.js +10 -10
  156. package/src/commands/SimulatorCommand/hooks/useFileWatcher.js.map +1 -1
  157. package/src/commands/SimulatorCommand/hooks/useSimulatorTasks.d.ts +6 -2
  158. package/src/commands/SimulatorCommand/hooks/useSimulatorTasks.js +52 -50
  159. package/src/commands/SimulatorCommand/hooks/useSimulatorTasks.js.map +1 -1
  160. package/src/commands/SimulatorCommand/index.js +0 -1
  161. package/src/commands/SimulatorCommand/index.js.map +1 -1
  162. package/src/commands/TestCommand/TestCommand.d.ts +12 -0
  163. package/src/commands/TestCommand/TestCommand.js +32 -0
  164. package/src/commands/TestCommand/TestCommand.js.map +1 -0
  165. package/src/commands/TestCommand/components/Test.d.ts +9 -0
  166. package/src/commands/TestCommand/components/Test.js +73 -0
  167. package/src/commands/TestCommand/components/Test.js.map +1 -0
  168. package/src/commands/TestCommand/components/TestLine.d.ts +10 -0
  169. package/src/commands/TestCommand/components/TestLine.js +11 -0
  170. package/src/commands/TestCommand/components/TestLine.js.map +1 -0
  171. package/src/commands/TestCommand/components/TestResult.d.ts +8 -0
  172. package/src/commands/TestCommand/components/TestResult.js +21 -0
  173. package/src/commands/TestCommand/components/TestResult.js.map +1 -0
  174. package/src/commands/TestCommand/components/TestSuite.d.ts +8 -0
  175. package/src/commands/TestCommand/components/TestSuite.js +60 -0
  176. package/src/commands/TestCommand/components/TestSuite.js.map +1 -0
  177. package/src/commands/TestCommand/components/TestSummary.d.ts +7 -0
  178. package/src/commands/TestCommand/components/TestSummary.js +9 -0
  179. package/src/commands/TestCommand/components/TestSummary.js.map +1 -0
  180. package/src/commands/TestCommand/hooks/useTestFiles.d.ts +3 -0
  181. package/src/commands/TestCommand/hooks/useTestFiles.js +8 -0
  182. package/src/commands/TestCommand/hooks/useTestFiles.js.map +1 -0
  183. package/src/commands/TestCommand/hooks/useTestServer.d.ts +5 -0
  184. package/src/commands/TestCommand/hooks/useTestServer.js +26 -0
  185. package/src/commands/TestCommand/hooks/useTestServer.js.map +1 -0
  186. package/src/commands/TestCommand/hooks/useTestTasks.d.ts +14 -0
  187. package/src/commands/TestCommand/hooks/useTestTasks.js +61 -0
  188. package/src/commands/TestCommand/hooks/useTestTasks.js.map +1 -0
  189. package/src/commands/TestCommand/index.d.ts +1 -0
  190. package/src/commands/TestCommand/index.js +2 -0
  191. package/src/commands/TestCommand/index.js.map +1 -0
  192. package/src/commands/TestCommand/server/TestServer.d.ts +72 -0
  193. package/src/commands/TestCommand/server/TestServer.js +249 -0
  194. package/src/commands/TestCommand/server/TestServer.js.map +1 -0
  195. package/src/commands/TestCommand/types.d.ts +4 -0
  196. package/src/commands/TestCommand/types.js +6 -0
  197. package/src/commands/TestCommand/types.js.map +1 -0
  198. package/src/commands/TestCommand/utils/formatTestError.d.ts +1 -0
  199. package/src/commands/TestCommand/utils/formatTestError.js +7 -0
  200. package/src/commands/TestCommand/utils/formatTestError.js.map +1 -0
  201. package/src/commands/TranspileCommand/TranspileCommand.d.ts +1 -0
  202. package/src/commands/TranspileCommand/TranspileCommand.js +23 -28
  203. package/src/commands/TranspileCommand/TranspileCommand.js.map +1 -1
  204. package/src/commands/TranspileCommand/components/Transpile.d.ts +4 -3
  205. package/src/commands/TranspileCommand/components/Transpile.js +4 -7
  206. package/src/commands/TranspileCommand/components/Transpile.js.map +1 -1
  207. package/src/commands/TranspileCommand/fn/getErrorMessage.d.ts +1 -1
  208. package/src/commands/TranspileCommand/fn/getErrorMessage.js +5 -6
  209. package/src/commands/TranspileCommand/fn/getErrorMessage.js.map +1 -1
  210. package/src/commands/TranspileCommand/fn/transpile.d.ts +4 -3
  211. package/src/commands/TranspileCommand/fn/transpile.js +21 -24
  212. package/src/commands/TranspileCommand/fn/transpile.js.map +1 -1
  213. package/src/commands/TranspileCommand/fn/validateEntryPoint.d.ts +1 -1
  214. package/src/commands/TranspileCommand/fn/validateEntryPoint.js +2 -3
  215. package/src/commands/TranspileCommand/fn/validateEntryPoint.js.map +1 -1
  216. package/src/commands/TranspileCommand/fn/validateExitPoint.d.ts +1 -1
  217. package/src/commands/TranspileCommand/fn/validateExitPoint.js +6 -6
  218. package/src/commands/TranspileCommand/fn/validateExitPoint.js.map +1 -1
  219. package/src/commands/TranspileCommand/hooks/useTranspileTasks.d.ts +6 -5
  220. package/src/commands/TranspileCommand/hooks/useTranspileTasks.js +35 -33
  221. package/src/commands/TranspileCommand/hooks/useTranspileTasks.js.map +1 -1
  222. package/src/commands/TranspileCommand/index.js +0 -1
  223. package/src/commands/TranspileCommand/index.js.map +1 -1
  224. package/src/commands/TranspileCommand/model/ValidatedEntryPoint.js +1 -2
  225. package/src/commands/TranspileCommand/model/ValidatedEntryPoint.js.map +1 -1
  226. package/src/commands/TranspileCommand/model/ValidatedExitPoint.js +1 -2
  227. package/src/commands/TranspileCommand/model/ValidatedExitPoint.js.map +1 -1
  228. package/src/commands/TranspileCommand/types.js +1 -2
  229. package/src/commands/TranspileCommand/types.js.map +1 -1
  230. package/src/components/CheckList/CheckList.d.ts +3 -2
  231. package/src/components/CheckList/CheckList.js +14 -21
  232. package/src/components/CheckList/CheckList.js.map +1 -1
  233. package/src/components/CheckList/Item.d.ts +3 -2
  234. package/src/components/CheckList/Item.js +47 -44
  235. package/src/components/CheckList/Item.js.map +1 -1
  236. package/src/components/CheckList/index.js +0 -1
  237. package/src/components/CheckList/index.js.map +1 -1
  238. package/src/components/ErrorBoundary.d.ts +14 -0
  239. package/src/components/ErrorBoundary.js +7 -13
  240. package/src/components/ErrorBoundary.js.map +1 -1
  241. package/src/components/Spinner.d.ts +1 -1
  242. package/src/components/Spinner.js +13 -18
  243. package/src/components/Spinner.js.map +1 -1
  244. package/src/constants.js +1 -6
  245. package/src/constants.js.map +1 -1
  246. package/src/environment/createEnvironment.d.ts +1 -1
  247. package/src/environment/createEnvironment.js +13 -16
  248. package/src/environment/createEnvironment.js.map +1 -1
  249. package/src/environment/dto/Environment.d.ts +1 -1
  250. package/src/environment/dto/Environment.js +1 -2
  251. package/src/environment/dto/Environment.js.map +1 -1
  252. package/src/environment/error/EnvironmentError.js +0 -1
  253. package/src/environment/error/EnvironmentError.js.map +1 -1
  254. package/src/environment/path/dto/PlaydateSdkPath.js +3 -4
  255. package/src/environment/path/dto/PlaydateSdkPath.js.map +1 -1
  256. package/src/environment/path/error/PlaydateSdkPathVariableNotSetError.js +1 -2
  257. package/src/environment/path/error/PlaydateSdkPathVariableNotSetError.js.map +1 -1
  258. package/src/environment/path/getPlaydateSdkPath.js +5 -3
  259. package/src/environment/path/getPlaydateSdkPath.js.map +1 -1
  260. package/src/index.js +7 -5
  261. package/src/index.js.map +1 -1
  262. package/src/types.d.ts +3 -3
  263. package/src/types.js +4 -5
  264. package/src/types.js.map +1 -1
  265. package/src/utils/appendExeOnWindows.js +1 -2
  266. package/src/utils/appendExeOnWindows.js.map +1 -1
  267. package/src/utils/dirname.js +0 -1
  268. package/src/utils/dirname.js.map +1 -1
  269. package/src/utils/platform.js +0 -1
  270. package/src/utils/platform.js.map +1 -1
  271. package/src/commands/TranspileCommand/fn/_tests/test-abstract/src/index.js +0 -4
  272. package/src/commands/TranspileCommand/fn/_tests/test-abstract/src/index.js.map +0 -1
  273. package/src/commands/TranspileCommand/fn/_tests/test-automatic-imports/src/index.js +0 -3
  274. package/src/commands/TranspileCommand/fn/_tests/test-automatic-imports/src/index.js.map +0 -1
  275. package/src/commands/TranspileCommand/fn/_tests/test-builtins/src/index.js +0 -4
  276. package/src/commands/TranspileCommand/fn/_tests/test-builtins/src/index.js.map +0 -1
  277. package/src/commands/TranspileCommand/fn/_tests/test-default-parameters/src/index.js +0 -17
  278. package/src/commands/TranspileCommand/fn/_tests/test-default-parameters/src/index.js.map +0 -1
  279. package/src/commands/TranspileCommand/fn/_tests/test-implicit-constructor/src/index.js +0 -10
  280. package/src/commands/TranspileCommand/fn/_tests/test-implicit-constructor/src/index.js.map +0 -1
  281. package/src/commands/TranspileCommand/fn/_tests/test-static/src/index.js +0 -18
  282. package/src/commands/TranspileCommand/fn/_tests/test-static/src/index.js.map +0 -1
  283. package/src/commands/TranspileCommand/fn/_tests/test-super/src/index.js +0 -24
  284. package/src/commands/TranspileCommand/fn/_tests/test-super/src/index.js.map +0 -1
@@ -9,48 +9,43 @@ import { validateExitPoint } from './fn/validateExitPoint.js';
9
9
  export const defaultProjectPath = process.cwd();
10
10
  export const projectPathOption = Option.String('-p,--path', defaultProjectPath, {
11
11
  description: `Where to find the project. Defaults to the current working directory ("${defaultProjectPath}")`,
12
- validator: t.isString()
12
+ validator: t.isString(),
13
13
  });
14
14
  export class TranspileCommand extends RenderableCommand {
15
- render() {
16
- const validatedEntryPoint = validateEntryPoint({
17
- projectPath: this.projectPath,
18
- entryFile: this.entryFile
19
- });
20
- const validatedExitPoint = validateExitPoint({
21
- projectPath: this.projectPath,
22
- exitFile: this.exitFile
23
- });
24
- return /*#__PURE__*/ React.createElement(Transpile, {
25
- entryPoint: validatedEntryPoint,
26
- exitPoint: validatedExitPoint,
27
- toybox: this.toybox
28
- });
29
- }
30
- constructor(...args){
31
- super(...args);
15
+ constructor() {
16
+ super(...arguments);
32
17
  this.entryFile = Option.String('-i,--input', 'src/index.ts', {
33
18
  description: 'The entry point to transpile',
34
- validator: t.isString()
19
+ validator: t.isString(),
35
20
  });
36
21
  this.exitFile = Option.String('-o,--output', 'Source/index.lua', {
37
22
  description: 'The output bundle',
38
- validator: t.isString()
23
+ validator: t.isString(),
39
24
  });
40
25
  this.toybox = Option.String('--toybox', {
41
26
  description: 'Output a toybox compatible bundle which exports to this namespace',
42
- validator: t.isString()
27
+ validator: t.isString(),
28
+ });
29
+ this.library = Option.Boolean('--library', false, {
30
+ description: 'Build as a library',
43
31
  });
44
32
  this.projectPath = projectPathOption;
45
33
  }
34
+ render() {
35
+ const validatedEntryPoint = validateEntryPoint({
36
+ projectPath: this.projectPath,
37
+ entryFile: this.entryFile,
38
+ });
39
+ const validatedExitPoint = validateExitPoint({
40
+ projectPath: this.projectPath,
41
+ exitFile: this.exitFile,
42
+ requireWithinProjectPath: false,
43
+ });
44
+ return (React.createElement(Transpile, { entryPoint: validatedEntryPoint, exitPoint: validatedExitPoint, toybox: this.toybox, library: this.library }));
45
+ }
46
46
  }
47
- TranspileCommand.paths = [
48
- [
49
- 'transpile'
50
- ]
51
- ];
47
+ TranspileCommand.paths = [['transpile']];
52
48
  TranspileCommand.usage = Command.Usage({
53
- description: 'Transpile TypeScript files to Lua'
49
+ description: 'Transpile TypeScript files to Lua',
54
50
  });
55
-
56
51
  //# sourceMappingURL=TranspileCommand.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../libs/cli/src/commands/TranspileCommand/TranspileCommand.tsx"],"sourcesContent":["import process from 'node:process';\nimport { Command, Option } from 'clipanion';\nimport React from 'react';\nimport * as t from 'typanion';\nimport { RenderableCommand } from '@/cli/commands/RenderableCommand.js';\nimport { Transpile } from '@/cli/commands/TranspileCommand/components/Transpile.js';\nimport { validateEntryPoint } from '@/cli/commands/TranspileCommand/fn/validateEntryPoint.js';\nimport { validateExitPoint } from './fn/validateExitPoint.js';\n\nexport const defaultProjectPath = process.cwd();\nexport const projectPathOption = Option.String(\n '-p,--path',\n defaultProjectPath,\n {\n description: `Where to find the project. Defaults to the current working directory (\"${defaultProjectPath}\")`,\n validator: t.isString(),\n },\n);\n\nexport class TranspileCommand extends RenderableCommand {\n static override paths = [['transpile']];\n\n static override usage = Command.Usage({\n description: 'Transpile TypeScript files to Lua',\n });\n\n entryFile = Option.String('-i,--input', 'src/index.ts', {\n description: 'The entry point to transpile',\n validator: t.isString(),\n });\n\n exitFile = Option.String('-o,--output', 'Source/index.lua', {\n description: 'The output bundle',\n validator: t.isString(),\n });\n\n toybox = Option.String('--toybox', {\n description:\n 'Output a toybox compatible bundle which exports to this namespace',\n validator: t.isString(),\n });\n\n projectPath = projectPathOption;\n\n override render() {\n const validatedEntryPoint = validateEntryPoint({\n projectPath: this.projectPath,\n entryFile: this.entryFile,\n });\n\n const validatedExitPoint = validateExitPoint({\n projectPath: this.projectPath,\n exitFile: this.exitFile,\n });\n\n return (\n <Transpile\n entryPoint={validatedEntryPoint}\n exitPoint={validatedExitPoint}\n toybox={this.toybox}\n />\n );\n }\n}\n"],"names":["process","Command","Option","React","t","RenderableCommand","Transpile","validateEntryPoint","validateExitPoint","defaultProjectPath","cwd","projectPathOption","String","description","validator","isString","TranspileCommand","render","validatedEntryPoint","projectPath","entryFile","validatedExitPoint","exitFile","entryPoint","exitPoint","toybox","paths","usage","Usage"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,OAAOA,aAAa,eAAe;AACnC,SAASC,OAAO,EAAEC,MAAM,QAAQ,YAAY;AAC5C,OAAOC,WAAW,QAAQ;AAC1B,YAAYC,OAAO,WAAW;AAC9B,SAASC,iBAAiB,QAAQ,sCAAsC;AACxE,SAASC,SAAS,QAAQ,0DAA0D;AACpF,SAASC,kBAAkB,QAAQ,2DAA2D;AAC9F,SAASC,iBAAiB,QAAQ,4BAA4B;AAE9D,OAAO,MAAMC,qBAAqBT,QAAQU,GAAG,GAAG;AAChD,OAAO,MAAMC,oBAAoBT,OAAOU,MAAM,CAC1C,aACAH,oBACA;IACII,aAAa,CAAC,uEAAuE,EAAEJ,mBAAmB,EAAE,CAAC;IAC7GK,WAAWV,EAAEW,QAAQ;AACzB,GACF;AAEF,OAAO,MAAMC,yBAAyBX;IAyBzBY,SAAS;QACd,MAAMC,sBAAsBX,mBAAmB;YAC3CY,aAAa,IAAI,CAACA,WAAW;YAC7BC,WAAW,IAAI,CAACA,SAAS;QAC7B;QAEA,MAAMC,qBAAqBb,kBAAkB;YACzCW,aAAa,IAAI,CAACA,WAAW;YAC7BG,UAAU,IAAI,CAACA,QAAQ;QAC3B;QAEA,qBACI,oBAAChB;YACGiB,YAAYL;YACZM,WAAWH;YACXI,QAAQ,IAAI,CAACA,MAAM;;IAG/B;;;aApCAL,YAAYlB,OAAOU,MAAM,CAAC,cAAc,gBAAgB;YACpDC,aAAa;YACbC,WAAWV,EAAEW,QAAQ;QACzB;aAEAO,WAAWpB,OAAOU,MAAM,CAAC,eAAe,oBAAoB;YACxDC,aAAa;YACbC,WAAWV,EAAEW,QAAQ;QACzB;aAEAU,SAASvB,OAAOU,MAAM,CAAC,YAAY;YAC/BC,aACI;YACJC,WAAWV,EAAEW,QAAQ;QACzB;aAEAI,cAAcR;;AAqBlB;AA5CaK,iBACOU,QAAQ;IAAC;QAAC;KAAY;CAAC;AAD9BV,iBAGOW,QAAQ1B,QAAQ2B,KAAK,CAAC;IAClCf,aAAa;AACjB"}
1
+ {"version":3,"file":"TranspileCommand.js","sourceRoot":"","sources":["../../../../../../libs/cli/src/commands/TranspileCommand/TranspileCommand.tsx"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,cAAc,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,CAAC,MAAM,UAAU,CAAC;AAC9B,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,yDAAyD,CAAC;AACpF,OAAO,EAAE,kBAAkB,EAAE,MAAM,0DAA0D,CAAC;AAC9F,OAAO,EAAE,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AAE9D,MAAM,CAAC,MAAM,kBAAkB,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;AAChD,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,CAC1C,WAAW,EACX,kBAAkB,EAClB;IACI,WAAW,EAAE,0EAA0E,kBAAkB,IAAI;IAC7G,SAAS,EAAE,CAAC,CAAC,QAAQ,EAAE;CAC1B,CACJ,CAAC;AAEF,MAAM,OAAO,gBAAiB,SAAQ,iBAAiB;IAAvD;;QAOI,cAAS,GAAG,MAAM,CAAC,MAAM,CAAC,YAAY,EAAE,cAAc,EAAE;YACpD,WAAW,EAAE,8BAA8B;YAC3C,SAAS,EAAE,CAAC,CAAC,QAAQ,EAAE;SAC1B,CAAC,CAAC;QAEH,aAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,aAAa,EAAE,kBAAkB,EAAE;YACxD,WAAW,EAAE,mBAAmB;YAChC,SAAS,EAAE,CAAC,CAAC,QAAQ,EAAE;SAC1B,CAAC,CAAC;QAEH,WAAM,GAAG,MAAM,CAAC,MAAM,CAAC,UAAU,EAAE;YAC/B,WAAW,EACP,mEAAmE;YACvE,SAAS,EAAE,CAAC,CAAC,QAAQ,EAAE;SAC1B,CAAC,CAAC;QAEH,YAAO,GAAG,MAAM,CAAC,OAAO,CAAC,WAAW,EAAE,KAAK,EAAE;YACzC,WAAW,EAAE,oBAAoB;SACpC,CAAC,CAAC;QAEH,gBAAW,GAAG,iBAAiB,CAAC;IAuBpC,CAAC;IArBY,MAAM;QACX,MAAM,mBAAmB,GAAG,kBAAkB,CAAC;YAC3C,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,SAAS,EAAE,IAAI,CAAC,SAAS;SAC5B,CAAC,CAAC;QAEH,MAAM,kBAAkB,GAAG,iBAAiB,CAAC;YACzC,WAAW,EAAE,IAAI,CAAC,WAAW;YAC7B,QAAQ,EAAE,IAAI,CAAC,QAAQ;YACvB,wBAAwB,EAAE,KAAK;SAClC,CAAC,CAAC;QAEH,OAAO,CACH,oBAAC,SAAS,IACN,UAAU,EAAE,mBAAmB,EAC/B,SAAS,EAAE,kBAAkB,EAC7B,MAAM,EAAE,IAAI,CAAC,MAAM,EACnB,OAAO,EAAE,IAAI,CAAC,OAAO,GACvB,CACL,CAAC;IACN,CAAC;;AAhDe,sBAAK,GAAG,CAAC,CAAC,WAAW,CAAC,CAAC,AAAlB,CAAmB;AAExB,sBAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IAClC,WAAW,EAAE,mCAAmC;CACnD,CAAC,AAFmB,CAElB"}
@@ -1,10 +1,11 @@
1
1
  import React from 'react';
2
- import { ValidatedEntryPoint } from '../../../commands/TranspileCommand/model/ValidatedEntryPoint.js';
3
- import { ValidatedExitPoint } from '../model/ValidatedExitPoint.js';
2
+ import type { ValidatedEntryPoint } from '../../../commands/TranspileCommand/model/ValidatedEntryPoint.js';
3
+ import type { ValidatedExitPoint } from '../model/ValidatedExitPoint.js';
4
4
  interface Props {
5
5
  entryPoint: ValidatedEntryPoint;
6
6
  exitPoint: ValidatedExitPoint;
7
7
  toybox?: string;
8
+ library?: boolean;
8
9
  }
9
- export declare const Transpile: ({ entryPoint, exitPoint, toybox }: Props) => React.JSX.Element;
10
+ export declare const Transpile: ({ entryPoint, exitPoint, toybox, library }: Props) => React.JSX.Element;
10
11
  export {};
@@ -1,16 +1,13 @@
1
1
  import React from 'react';
2
2
  import { useTranspileTasks } from '../../../commands/TranspileCommand/hooks/useTranspileTasks.js';
3
3
  import { CheckList } from '../../../components/CheckList/index.js';
4
- export const Transpile = ({ entryPoint, exitPoint, toybox })=>{
4
+ export const Transpile = ({ entryPoint, exitPoint, toybox, library }) => {
5
5
  const items = useTranspileTasks({
6
6
  entryPoint,
7
7
  exitPoint,
8
- toybox
9
- });
10
- return /*#__PURE__*/ React.createElement(CheckList, {
11
- items: items,
12
- onFinish: ()=>process.exit
8
+ toybox,
9
+ library,
13
10
  });
11
+ return React.createElement(CheckList, { items: items, onFinish: () => process.exit(0) });
14
12
  };
15
-
16
13
  //# sourceMappingURL=Transpile.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../libs/cli/src/commands/TranspileCommand/components/Transpile.tsx"],"sourcesContent":["import React from 'react';\nimport { useTranspileTasks } from '@/cli/commands/TranspileCommand/hooks/useTranspileTasks.js';\nimport { ValidatedEntryPoint } from '@/cli/commands/TranspileCommand/model/ValidatedEntryPoint.js';\nimport { CheckList } from '@/cli/components/CheckList/index.js';\nimport { ValidatedExitPoint } from '../model/ValidatedExitPoint.js';\n\ninterface Props {\n entryPoint: ValidatedEntryPoint;\n exitPoint: ValidatedExitPoint;\n toybox?: string;\n}\n\nexport const Transpile = ({ entryPoint, exitPoint, toybox }: Props) => {\n const items = useTranspileTasks({\n entryPoint,\n exitPoint,\n toybox,\n });\n\n return <CheckList items={items} onFinish={() => process.exit} />;\n};\n"],"names":["React","useTranspileTasks","CheckList","Transpile","entryPoint","exitPoint","toybox","items","onFinish","process","exit"],"rangeMappings":";;;;;;;;;;;;;","mappings":"AAAA,OAAOA,WAAW,QAAQ;AAC1B,SAASC,iBAAiB,QAAQ,6DAA6D;AAE/F,SAASC,SAAS,QAAQ,sCAAsC;AAShE,OAAO,MAAMC,YAAY,CAAC,EAAEC,UAAU,EAAEC,SAAS,EAAEC,MAAM,EAAS;IAC9D,MAAMC,QAAQN,kBAAkB;QAC5BG;QACAC;QACAC;IACJ;IAEA,qBAAO,oBAACJ;QAAUK,OAAOA;QAAOC,UAAU,IAAMC,QAAQC,IAAI;;AAChE,EAAE"}
1
+ {"version":3,"file":"Transpile.js","sourceRoot":"","sources":["../../../../../../../libs/cli/src/commands/TranspileCommand/components/Transpile.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,iBAAiB,EAAE,MAAM,4DAA4D,CAAC;AAE/F,OAAO,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAUhE,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,OAAO,EAAS,EAAE,EAAE;IAC3E,MAAM,KAAK,GAAG,iBAAiB,CAAC;QAC5B,UAAU;QACV,SAAS;QACT,MAAM;QACN,OAAO;KACV,CAAC,CAAC;IAEH,OAAO,oBAAC,SAAS,IAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,GAAI,CAAC;AACxE,CAAC,CAAC"}
@@ -1,2 +1,2 @@
1
- import { Diagnostic } from 'typescript';
1
+ import { type Diagnostic } from 'typescript';
2
2
  export declare const getErrorMessage: (diagnostics: readonly Diagnostic[]) => string;
@@ -1,10 +1,9 @@
1
- import { formatDiagnosticsWithColorAndContext } from 'typescript';
2
- export const getErrorMessage = (diagnostics)=>{
1
+ import { formatDiagnosticsWithColorAndContext, } from 'typescript';
2
+ export const getErrorMessage = (diagnostics) => {
3
3
  return formatDiagnosticsWithColorAndContext(diagnostics, {
4
- getCurrentDirectory: ()=>process.cwd(),
5
- getCanonicalFileName: (fileName)=>fileName,
6
- getNewLine: ()=>'\n'
4
+ getCurrentDirectory: () => process.cwd(),
5
+ getCanonicalFileName: (fileName) => fileName,
6
+ getNewLine: () => '\n',
7
7
  });
8
8
  };
9
-
10
9
  //# sourceMappingURL=getErrorMessage.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../libs/cli/src/commands/TranspileCommand/fn/getErrorMessage.ts"],"sourcesContent":["import { Diagnostic, formatDiagnosticsWithColorAndContext } from 'typescript';\n\nexport const getErrorMessage = (diagnostics: readonly Diagnostic[]) => {\n return formatDiagnosticsWithColorAndContext(diagnostics, {\n getCurrentDirectory: () => process.cwd(),\n getCanonicalFileName: fileName => fileName,\n getNewLine: () => '\\n',\n });\n};\n"],"names":["formatDiagnosticsWithColorAndContext","getErrorMessage","diagnostics","getCurrentDirectory","process","cwd","getCanonicalFileName","fileName","getNewLine"],"rangeMappings":";;;;;;;","mappings":"AAAA,SAAqBA,oCAAoC,QAAQ,aAAa;AAE9E,OAAO,MAAMC,kBAAkB,CAACC;IAC5B,OAAOF,qCAAqCE,aAAa;QACrDC,qBAAqB,IAAMC,QAAQC,GAAG;QACtCC,sBAAsBC,CAAAA,WAAYA;QAClCC,YAAY,IAAM;IACtB;AACJ,EAAE"}
1
+ {"version":3,"file":"getErrorMessage.js","sourceRoot":"","sources":["../../../../../../../libs/cli/src/commands/TranspileCommand/fn/getErrorMessage.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,oCAAoC,GACvC,MAAM,YAAY,CAAC;AAEpB,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,WAAkC,EAAE,EAAE;IAClE,OAAO,oCAAoC,CAAC,WAAW,EAAE;QACrD,mBAAmB,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE;QACxC,oBAAoB,EAAE,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ;QAC5C,UAAU,EAAE,GAAG,EAAE,CAAC,IAAI;KACzB,CAAC,CAAC;AACP,CAAC,CAAC"}
@@ -1,9 +1,10 @@
1
1
  import * as tstl from 'typescript-to-lua';
2
- import { ValidatedEntryPoint } from '../model/ValidatedEntryPoint.js';
3
- import { ValidatedExitPoint } from '../model/ValidatedExitPoint.js';
2
+ import type { ValidatedEntryPoint } from '../model/ValidatedEntryPoint.js';
3
+ import type { ValidatedExitPoint } from '../model/ValidatedExitPoint.js';
4
4
  import { TranspileMode } from '../types.js';
5
- export declare const transpile: ({ entryPoint, exitPoint, transpileMode, }: {
5
+ export declare const transpile: ({ entryPoint, exitPoint, transpileMode, library, }: {
6
6
  entryPoint: ValidatedEntryPoint;
7
7
  exitPoint: ValidatedExitPoint;
8
8
  transpileMode?: TranspileMode;
9
+ library?: boolean;
9
10
  }) => tstl.EmitResult;
@@ -1,21 +1,20 @@
1
- import { existsSync } from 'node:fs';
2
- import { mkdirSync } from 'node:fs';
1
+ import { existsSync, mkdirSync } from 'node:fs';
3
2
  import { basename, dirname, join } from 'node:path';
4
3
  import * as tstl from 'typescript-to-lua';
5
4
  import { LuaTarget } from 'typescript-to-lua';
6
5
  import { RootFolder } from '../../../constants.js';
7
6
  import { TranspileMode } from '../types.js';
8
- export const transpile = ({ entryPoint, exitPoint, transpileMode = TranspileMode.Project })=>{
7
+ export const transpile = ({ entryPoint, exitPoint, transpileMode, library, }) => {
9
8
  const exitDir = dirname(exitPoint.exitPath);
10
9
  if (!existsSync(exitDir)) {
11
- mkdirSync(exitDir, {
12
- recursive: true
13
- });
10
+ mkdirSync(exitDir, { recursive: true });
14
11
  }
15
- if (transpileMode === TranspileMode.File) {
16
- return tstl.transpileFiles([
17
- entryPoint.entryFile
18
- ], {
12
+ const actualTranspileMode = transpileMode ||
13
+ (existsSync(join(entryPoint.projectPath, 'tsconfig.json'))
14
+ ? TranspileMode.Project
15
+ : TranspileMode.File);
16
+ if (actualTranspileMode === TranspileMode.File) {
17
+ return tstl.transpileFiles([entryPoint.entryFile], {
19
18
  luaTarget: LuaTarget.Lua54,
20
19
  outDir: dirname(exitPoint.exitPath),
21
20
  luaBundle: basename(exitPoint.exitPath),
@@ -23,22 +22,20 @@ export const transpile = ({ entryPoint, exitPoint, transpileMode = TranspileMode
23
22
  skipLibCheck: true,
24
23
  luaPlugins: [
25
24
  {
26
- name: join(RootFolder, 'assets', 'index.js')
27
- }
28
- ]
25
+ name: join(RootFolder, 'assets', 'index.js'),
26
+ },
27
+ ],
29
28
  });
30
29
  }
31
- return tstl.transpileProject(join(entryPoint.projectPath, 'tsconfig.json'), {
32
- luaTarget: LuaTarget.Lua54,
33
- outDir: dirname(exitPoint.exitPath),
34
- luaBundle: basename(exitPoint.exitPath),
35
- luaBundleEntry: join(entryPoint.entryFile),
36
- luaPlugins: [
30
+ return tstl.transpileProject(join(entryPoint.projectPath, 'tsconfig.json'), Object.assign({ luaTarget: LuaTarget.Lua54, outDir: dirname(exitPoint.exitPath), luaPlugins: [
37
31
  {
38
- name: join(RootFolder, 'assets', 'index.js')
39
- }
40
- ]
41
- });
32
+ name: join(RootFolder, 'assets', 'index.js'),
33
+ },
34
+ ] }, (library
35
+ ? {}
36
+ : {
37
+ luaBundle: basename(exitPoint.exitPath),
38
+ luaBundleEntry: join(entryPoint.entryFile),
39
+ })));
42
40
  };
43
-
44
41
  //# sourceMappingURL=transpile.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../libs/cli/src/commands/TranspileCommand/fn/transpile.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { mkdirSync } from 'node:fs';\nimport { basename, dirname, join } from 'node:path';\nimport * as tstl from 'typescript-to-lua';\nimport { LuaTarget } from 'typescript-to-lua';\nimport { RootFolder } from '@/cli/constants.js';\nimport { ValidatedEntryPoint } from '../model/ValidatedEntryPoint.js';\nimport { ValidatedExitPoint } from '../model/ValidatedExitPoint.js';\nimport { TranspileMode } from '../types.js';\n\nexport const transpile = ({\n entryPoint,\n exitPoint,\n transpileMode = TranspileMode.Project,\n}: {\n entryPoint: ValidatedEntryPoint;\n exitPoint: ValidatedExitPoint;\n transpileMode?: TranspileMode;\n}) => {\n const exitDir = dirname(exitPoint.exitPath);\n\n if (!existsSync(exitDir)) {\n mkdirSync(exitDir, { recursive: true });\n }\n\n if (transpileMode === TranspileMode.File) {\n return tstl.transpileFiles([entryPoint.entryFile], {\n luaTarget: LuaTarget.Lua54,\n outDir: dirname(exitPoint.exitPath),\n luaBundle: basename(exitPoint.exitPath),\n luaBundleEntry: join(entryPoint.entryFile),\n skipLibCheck: true,\n luaPlugins: [\n {\n name: join(RootFolder, 'assets', 'index.js'),\n },\n ],\n });\n }\n\n return tstl.transpileProject(\n join(entryPoint.projectPath, 'tsconfig.json'),\n {\n luaTarget: LuaTarget.Lua54,\n outDir: dirname(exitPoint.exitPath),\n luaBundle: basename(exitPoint.exitPath),\n luaBundleEntry: join(entryPoint.entryFile),\n luaPlugins: [\n {\n name: join(RootFolder, 'assets', 'index.js'),\n },\n ],\n },\n );\n};\n"],"names":["existsSync","mkdirSync","basename","dirname","join","tstl","LuaTarget","RootFolder","TranspileMode","transpile","entryPoint","exitPoint","transpileMode","Project","exitDir","exitPath","recursive","File","transpileFiles","entryFile","luaTarget","Lua54","outDir","luaBundle","luaBundleEntry","skipLibCheck","luaPlugins","name","transpileProject","projectPath"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,UAAU,QAAQ,UAAU;AACrC,SAASC,SAAS,QAAQ,UAAU;AACpC,SAASC,QAAQ,EAAEC,OAAO,EAAEC,IAAI,QAAQ,YAAY;AACpD,YAAYC,UAAU,oBAAoB;AAC1C,SAASC,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,UAAU,QAAQ,qBAAqB;AAGhD,SAASC,aAAa,QAAQ,cAAc;AAE5C,OAAO,MAAMC,YAAY,CAAC,EACtBC,UAAU,EACVC,SAAS,EACTC,gBAAgBJ,cAAcK,OAAO,EAKxC;IACG,MAAMC,UAAUX,QAAQQ,UAAUI,QAAQ;IAE1C,IAAI,CAACf,WAAWc,UAAU;QACtBb,UAAUa,SAAS;YAAEE,WAAW;QAAK;IACzC;IAEA,IAAIJ,kBAAkBJ,cAAcS,IAAI,EAAE;QACtC,OAAOZ,KAAKa,cAAc,CAAC;YAACR,WAAWS,SAAS;SAAC,EAAE;YAC/CC,WAAWd,UAAUe,KAAK;YAC1BC,QAAQnB,QAAQQ,UAAUI,QAAQ;YAClCQ,WAAWrB,SAASS,UAAUI,QAAQ;YACtCS,gBAAgBpB,KAAKM,WAAWS,SAAS;YACzCM,cAAc;YACdC,YAAY;gBACR;oBACIC,MAAMvB,KAAKG,YAAY,UAAU;gBACrC;aACH;QACL;IACJ;IAEA,OAAOF,KAAKuB,gBAAgB,CACxBxB,KAAKM,WAAWmB,WAAW,EAAE,kBAC7B;QACIT,WAAWd,UAAUe,KAAK;QAC1BC,QAAQnB,QAAQQ,UAAUI,QAAQ;QAClCQ,WAAWrB,SAASS,UAAUI,QAAQ;QACtCS,gBAAgBpB,KAAKM,WAAWS,SAAS;QACzCO,YAAY;YACR;gBACIC,MAAMvB,KAAKG,YAAY,UAAU;YACrC;SACH;IACL;AAER,EAAE"}
1
+ {"version":3,"file":"transpile.js","sourceRoot":"","sources":["../../../../../../../libs/cli/src/commands/TranspileCommand/fn/transpile.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAChD,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,KAAK,IAAI,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAGhD,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAE5C,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,EACtB,UAAU,EACV,SAAS,EACT,aAAa,EACb,OAAO,GAMV,EAAE,EAAE;IACD,MAAM,OAAO,GAAG,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC;IAE5C,IAAI,CAAC,UAAU,CAAC,OAAO,CAAC,EAAE,CAAC;QACvB,SAAS,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC5C,CAAC;IAED,MAAM,mBAAmB,GACrB,aAAa;QACb,CAAC,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,eAAe,CAAC,CAAC;YACtD,CAAC,CAAC,aAAa,CAAC,OAAO;YACvB,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAE9B,IAAI,mBAAmB,KAAK,aAAa,CAAC,IAAI,EAAE,CAAC;QAC7C,OAAO,IAAI,CAAC,cAAc,CAAC,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE;YAC/C,SAAS,EAAE,SAAS,CAAC,KAAK;YAC1B,MAAM,EAAE,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC;YACnC,SAAS,EAAE,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC;YACvC,cAAc,EAAE,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC;YAC1C,YAAY,EAAE,IAAI;YAClB,UAAU,EAAE;gBACR;oBACI,IAAI,EAAE,IAAI,CAAC,UAAU,EAAE,QAAQ,EAAE,UAAU,CAAC;iBAC/C;aACJ;SACJ,CAAC,CAAC;IACP,CAAC;IAED,OAAO,IAAI,CAAC,gBAAgB,CACxB,IAAI,CAAC,UAAU,CAAC,WAAW,EAAE,eAAe,CAAC,kBAEzC,SAAS,EAAE,SAAS,CAAC,KAAK,EAC1B,MAAM,EAAE,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,EACnC,UAAU,EAAE;YACR;gBACI,IAAI,EAAE,IAAI,CAAC,UAAU,EAAE,QAAQ,EAAE,UAAU,CAAC;aAC/C;SACJ,IACE,CAAC,OAAO;QACP,CAAC,CAAC,EAAE;QACJ,CAAC,CAAC;YACI,SAAS,EAAE,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC;YACvC,cAAc,EAAE,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC;SAC7C,CAAC,EAEf,CAAC;AACN,CAAC,CAAC"}
@@ -1,4 +1,4 @@
1
- import { ValidatedEntryPoint } from '../model/ValidatedEntryPoint.js';
1
+ import type { ValidatedEntryPoint } from '../model/ValidatedEntryPoint.js';
2
2
  export declare const validateEntryPoint: ({ projectPath, entryFile, requireWithinProjectPath, }: {
3
3
  projectPath: string;
4
4
  entryFile: string;
@@ -1,6 +1,6 @@
1
1
  import { existsSync, statSync } from 'node:fs';
2
2
  import { resolve } from 'node:path';
3
- export const validateEntryPoint = ({ projectPath, entryFile, requireWithinProjectPath = true })=>{
3
+ export const validateEntryPoint = ({ projectPath, entryFile, requireWithinProjectPath = true, }) => {
4
4
  const resolvedPath = resolve(projectPath);
5
5
  const resolvedEntry = resolve(entryFile);
6
6
  const projectPathExists = existsSync(resolvedPath);
@@ -25,8 +25,7 @@ export const validateEntryPoint = ({ projectPath, entryFile, requireWithinProjec
25
25
  return {
26
26
  __validated: true,
27
27
  projectPath: resolvedPath,
28
- entryFile: resolvedEntry
28
+ entryFile: resolvedEntry,
29
29
  };
30
30
  };
31
-
32
31
  //# sourceMappingURL=validateEntryPoint.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../libs/cli/src/commands/TranspileCommand/fn/validateEntryPoint.ts"],"sourcesContent":["import { existsSync, statSync } from 'node:fs';\nimport { resolve } from 'node:path';\nimport { ValidatedEntryPoint } from '../model/ValidatedEntryPoint.js';\n\nexport const validateEntryPoint = ({\n projectPath,\n entryFile,\n requireWithinProjectPath = true,\n}: {\n projectPath: string;\n entryFile: string;\n requireWithinProjectPath?: boolean;\n}): ValidatedEntryPoint => {\n const resolvedPath = resolve(projectPath);\n const resolvedEntry = resolve(entryFile);\n const projectPathExists = existsSync(resolvedPath);\n const projectPathIsDirectory =\n projectPathExists && statSync(resolvedPath).isDirectory();\n const entryFileExists = existsSync(resolvedEntry);\n const entryFileIsFile = entryFileExists && statSync(resolvedEntry).isFile();\n\n if (!projectPathExists) {\n throw new Error(`Path \"${resolvedPath}\" does not exist`);\n }\n\n if (!projectPathIsDirectory) {\n throw new Error(`Path \"${resolvedPath}\" is not a directory`);\n }\n\n if (!entryFileExists) {\n throw new Error(`Path \"${resolvedEntry}\" does not exist`);\n }\n\n if (!entryFileIsFile) {\n throw new Error(`Path \"${resolvedEntry}\" is not a file`);\n }\n\n if (requireWithinProjectPath && !resolvedEntry.startsWith(resolvedPath)) {\n throw new Error(\n `Entry \"${resolvedEntry}\" must be inside project path \"${resolvedPath}\"`,\n );\n }\n\n return {\n __validated: true,\n projectPath: resolvedPath,\n entryFile: resolvedEntry,\n } satisfies ValidatedEntryPoint;\n};\n"],"names":["existsSync","statSync","resolve","validateEntryPoint","projectPath","entryFile","requireWithinProjectPath","resolvedPath","resolvedEntry","projectPathExists","projectPathIsDirectory","isDirectory","entryFileExists","entryFileIsFile","isFile","Error","startsWith","__validated"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,UAAU,EAAEC,QAAQ,QAAQ,UAAU;AAC/C,SAASC,OAAO,QAAQ,YAAY;AAGpC,OAAO,MAAMC,qBAAqB,CAAC,EAC/BC,WAAW,EACXC,SAAS,EACTC,2BAA2B,IAAI,EAKlC;IACG,MAAMC,eAAeL,QAAQE;IAC7B,MAAMI,gBAAgBN,QAAQG;IAC9B,MAAMI,oBAAoBT,WAAWO;IACrC,MAAMG,yBACFD,qBAAqBR,SAASM,cAAcI,WAAW;IAC3D,MAAMC,kBAAkBZ,WAAWQ;IACnC,MAAMK,kBAAkBD,mBAAmBX,SAASO,eAAeM,MAAM;IAEzE,IAAI,CAACL,mBAAmB;QACpB,MAAM,IAAIM,MAAM,CAAC,MAAM,EAAER,aAAa,gBAAgB,CAAC;IAC3D;IAEA,IAAI,CAACG,wBAAwB;QACzB,MAAM,IAAIK,MAAM,CAAC,MAAM,EAAER,aAAa,oBAAoB,CAAC;IAC/D;IAEA,IAAI,CAACK,iBAAiB;QAClB,MAAM,IAAIG,MAAM,CAAC,MAAM,EAAEP,cAAc,gBAAgB,CAAC;IAC5D;IAEA,IAAI,CAACK,iBAAiB;QAClB,MAAM,IAAIE,MAAM,CAAC,MAAM,EAAEP,cAAc,eAAe,CAAC;IAC3D;IAEA,IAAIF,4BAA4B,CAACE,cAAcQ,UAAU,CAACT,eAAe;QACrE,MAAM,IAAIQ,MACN,CAAC,OAAO,EAAEP,cAAc,+BAA+B,EAAED,aAAa,CAAC,CAAC;IAEhF;IAEA,OAAO;QACHU,aAAa;QACbb,aAAaG;QACbF,WAAWG;IACf;AACJ,EAAE"}
1
+ {"version":3,"file":"validateEntryPoint.js","sourceRoot":"","sources":["../../../../../../../libs/cli/src/commands/TranspileCommand/fn/validateEntryPoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,EAC/B,WAAW,EACX,SAAS,EACT,wBAAwB,GAAG,IAAI,GAKlC,EAAuB,EAAE;IACtB,MAAM,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAC1C,MAAM,aAAa,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;IACzC,MAAM,iBAAiB,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;IACnD,MAAM,sBAAsB,GACxB,iBAAiB,IAAI,QAAQ,CAAC,YAAY,CAAC,CAAC,WAAW,EAAE,CAAC;IAC9D,MAAM,eAAe,GAAG,UAAU,CAAC,aAAa,CAAC,CAAC;IAClD,MAAM,eAAe,GAAG,eAAe,IAAI,QAAQ,CAAC,aAAa,CAAC,CAAC,MAAM,EAAE,CAAC;IAE5E,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,SAAS,YAAY,kBAAkB,CAAC,CAAC;IAC7D,CAAC;IAED,IAAI,CAAC,sBAAsB,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,SAAS,YAAY,sBAAsB,CAAC,CAAC;IACjE,CAAC;IAED,IAAI,CAAC,eAAe,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,SAAS,aAAa,kBAAkB,CAAC,CAAC;IAC9D,CAAC;IAED,IAAI,CAAC,eAAe,EAAE,CAAC;QACnB,MAAM,IAAI,KAAK,CAAC,SAAS,aAAa,iBAAiB,CAAC,CAAC;IAC7D,CAAC;IAED,IAAI,wBAAwB,IAAI,CAAC,aAAa,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;QACtE,MAAM,IAAI,KAAK,CACX,UAAU,aAAa,kCAAkC,YAAY,GAAG,CAC3E,CAAC;IACN,CAAC;IAED,OAAO;QACH,WAAW,EAAE,IAAI;QACjB,WAAW,EAAE,YAAY;QACzB,SAAS,EAAE,aAAa;KACG,CAAC;AACpC,CAAC,CAAC"}
@@ -1,4 +1,4 @@
1
- import { ValidatedExitPoint } from '../model/ValidatedExitPoint.js';
1
+ import type { ValidatedExitPoint } from '../model/ValidatedExitPoint.js';
2
2
  export declare const validateExitPoint: ({ projectPath, exitFile, requireWithinProjectPath, }: {
3
3
  projectPath: string;
4
4
  exitFile: string;
@@ -1,6 +1,6 @@
1
1
  import { existsSync, statSync } from 'node:fs';
2
- import { resolve, dirname } from 'node:path';
3
- export const validateExitPoint = ({ projectPath, exitFile, requireWithinProjectPath = true })=>{
2
+ import { dirname, resolve } from 'node:path';
3
+ export const validateExitPoint = ({ projectPath, exitFile, requireWithinProjectPath = true, }) => {
4
4
  const resolvedPath = resolve(projectPath);
5
5
  const resolvedExit = resolve(exitFile);
6
6
  const exitDir = dirname(resolvedExit);
@@ -15,8 +15,9 @@ export const validateExitPoint = ({ projectPath, exitFile, requireWithinProjectP
15
15
  throw new Error(`Path "${resolvedPath}" is not a directory`);
16
16
  }
17
17
  if (!exitDirExists) {
18
- // Will be created
19
- } else if (!exitDirIsDirectory) {
18
+ // Will be created
19
+ }
20
+ else if (!exitDirIsDirectory) {
20
21
  throw new Error(`Path "${exitDir}" exists but is not a directory`);
21
22
  }
22
23
  if (requireWithinProjectPath && !exitDir.startsWith(resolvedPath)) {
@@ -25,8 +26,7 @@ export const validateExitPoint = ({ projectPath, exitFile, requireWithinProjectP
25
26
  return {
26
27
  __validated: true,
27
28
  projectPath: resolvedPath,
28
- exitPath: resolvedExit
29
+ exitPath: resolvedExit,
29
30
  };
30
31
  };
31
-
32
32
  //# sourceMappingURL=validateExitPoint.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../libs/cli/src/commands/TranspileCommand/fn/validateExitPoint.ts"],"sourcesContent":["import { existsSync, statSync } from 'node:fs';\nimport { resolve, dirname } from 'node:path';\nimport { ValidatedExitPoint } from '../model/ValidatedExitPoint.js';\n\nexport const validateExitPoint = ({\n projectPath,\n exitFile,\n requireWithinProjectPath = true,\n}: {\n projectPath: string;\n exitFile: string;\n requireWithinProjectPath?: boolean;\n}): ValidatedExitPoint => {\n const resolvedPath = resolve(projectPath);\n const resolvedExit = resolve(exitFile);\n const exitDir = dirname(resolvedExit);\n const projectPathExists = existsSync(resolvedPath);\n const projectPathIsDirectory =\n projectPathExists && statSync(resolvedPath).isDirectory();\n const exitDirExists = existsSync(exitDir);\n const exitDirIsDirectory = exitDirExists && statSync(exitDir).isDirectory();\n\n if (!projectPathExists) {\n throw new Error(`Path \"${resolvedPath}\" does not exist`);\n }\n\n if (!projectPathIsDirectory) {\n throw new Error(`Path \"${resolvedPath}\" is not a directory`);\n }\n\n if (!exitDirExists) {\n // Will be created\n } else if (!exitDirIsDirectory) {\n throw new Error(`Path \"${exitDir}\" exists but is not a directory`);\n }\n\n if (requireWithinProjectPath && !exitDir.startsWith(resolvedPath)) {\n throw new Error(`Exit path must be inside project path`);\n }\n\n return {\n __validated: true,\n projectPath: resolvedPath,\n exitPath: resolvedExit,\n } satisfies ValidatedExitPoint;\n};\n"],"names":["existsSync","statSync","resolve","dirname","validateExitPoint","projectPath","exitFile","requireWithinProjectPath","resolvedPath","resolvedExit","exitDir","projectPathExists","projectPathIsDirectory","isDirectory","exitDirExists","exitDirIsDirectory","Error","startsWith","__validated","exitPath"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,UAAU,EAAEC,QAAQ,QAAQ,UAAU;AAC/C,SAASC,OAAO,EAAEC,OAAO,QAAQ,YAAY;AAG7C,OAAO,MAAMC,oBAAoB,CAAC,EAC9BC,WAAW,EACXC,QAAQ,EACRC,2BAA2B,IAAI,EAKlC;IACG,MAAMC,eAAeN,QAAQG;IAC7B,MAAMI,eAAeP,QAAQI;IAC7B,MAAMI,UAAUP,QAAQM;IACxB,MAAME,oBAAoBX,WAAWQ;IACrC,MAAMI,yBACFD,qBAAqBV,SAASO,cAAcK,WAAW;IAC3D,MAAMC,gBAAgBd,WAAWU;IACjC,MAAMK,qBAAqBD,iBAAiBb,SAASS,SAASG,WAAW;IAEzE,IAAI,CAACF,mBAAmB;QACpB,MAAM,IAAIK,MAAM,CAAC,MAAM,EAAER,aAAa,gBAAgB,CAAC;IAC3D;IAEA,IAAI,CAACI,wBAAwB;QACzB,MAAM,IAAII,MAAM,CAAC,MAAM,EAAER,aAAa,oBAAoB,CAAC;IAC/D;IAEA,IAAI,CAACM,eAAe;IAChB,kBAAkB;IACtB,OAAO,IAAI,CAACC,oBAAoB;QAC5B,MAAM,IAAIC,MAAM,CAAC,MAAM,EAAEN,QAAQ,+BAA+B,CAAC;IACrE;IAEA,IAAIH,4BAA4B,CAACG,QAAQO,UAAU,CAACT,eAAe;QAC/D,MAAM,IAAIQ,MAAM,CAAC,qCAAqC,CAAC;IAC3D;IAEA,OAAO;QACHE,aAAa;QACbb,aAAaG;QACbW,UAAUV;IACd;AACJ,EAAE"}
1
+ {"version":3,"file":"validateExitPoint.js","sourceRoot":"","sources":["../../../../../../../libs/cli/src/commands/TranspileCommand/fn/validateExitPoint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAG7C,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,EAC9B,WAAW,EACX,QAAQ,EACR,wBAAwB,GAAG,IAAI,GAKlC,EAAsB,EAAE;IACrB,MAAM,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;IAC1C,MAAM,YAAY,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;IACvC,MAAM,OAAO,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IACtC,MAAM,iBAAiB,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;IACnD,MAAM,sBAAsB,GACxB,iBAAiB,IAAI,QAAQ,CAAC,YAAY,CAAC,CAAC,WAAW,EAAE,CAAC;IAC9D,MAAM,aAAa,GAAG,UAAU,CAAC,OAAO,CAAC,CAAC;IAC1C,MAAM,kBAAkB,GAAG,aAAa,IAAI,QAAQ,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC;IAE5E,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,SAAS,YAAY,kBAAkB,CAAC,CAAC;IAC7D,CAAC;IAED,IAAI,CAAC,sBAAsB,EAAE,CAAC;QAC1B,MAAM,IAAI,KAAK,CAAC,SAAS,YAAY,sBAAsB,CAAC,CAAC;IACjE,CAAC;IAED,IAAI,CAAC,aAAa,EAAE,CAAC;QACjB,kBAAkB;IACtB,CAAC;SAAM,IAAI,CAAC,kBAAkB,EAAE,CAAC;QAC7B,MAAM,IAAI,KAAK,CAAC,SAAS,OAAO,iCAAiC,CAAC,CAAC;IACvE,CAAC;IAED,IAAI,wBAAwB,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE,CAAC;QAChE,MAAM,IAAI,KAAK,CAAC,uCAAuC,CAAC,CAAC;IAC7D,CAAC;IAED,OAAO;QACH,WAAW,EAAE,IAAI;QACjB,WAAW,EAAE,YAAY;QACzB,QAAQ,EAAE,YAAY;KACI,CAAC;AACnC,CAAC,CAAC"}
@@ -1,10 +1,11 @@
1
- import { ValidatedEntryPoint } from '../../../commands/TranspileCommand/model/ValidatedEntryPoint.js';
2
- import { ValidatedExitPoint } from '../../../commands/TranspileCommand/model/ValidatedExitPoint.js';
3
- import { CheckListItem } from '../../../types.js';
4
- import { TranspileMode } from '../types.js';
5
- export declare const useTranspileTasks: ({ entryPoint, exitPoint, toybox, transpileMode, }: {
1
+ import type { ValidatedEntryPoint } from '../../../commands/TranspileCommand/model/ValidatedEntryPoint.js';
2
+ import type { ValidatedExitPoint } from '../../../commands/TranspileCommand/model/ValidatedExitPoint.js';
3
+ import type { CheckListItem } from '../../../types.js';
4
+ import type { TranspileMode } from '../types.js';
5
+ export declare const useTranspileTasks: ({ entryPoint, exitPoint, toybox, transpileMode, library, }: {
6
6
  entryPoint: ValidatedEntryPoint;
7
7
  exitPoint: ValidatedExitPoint;
8
8
  toybox?: string;
9
9
  transpileMode?: TranspileMode;
10
+ library?: boolean;
10
11
  }) => CheckListItem<unknown>[];
@@ -1,51 +1,53 @@
1
+ import { __awaiter } from "tslib";
1
2
  import { writeFileSync } from 'node:fs';
2
3
  import { basename, dirname, join } from 'node:path';
3
4
  import { useMemo } from 'react';
4
5
  import { getErrorMessage } from '../../../commands/TranspileCommand/fn/getErrorMessage.js';
5
6
  import { transpile } from '../../../commands/TranspileCommand/fn/transpile.js';
6
- import { TranspileMode } from '../types.js';
7
- const getToyboxTemplate = (namespace, entryPoint)=>`${namespace} = ${namespace} or {}
7
+ const getToyboxTemplate = (namespace, entryPoint) => `${namespace} = ${namespace} or {}
8
8
  local ____exports = import("${entryPoint}")
9
9
  for k, v in pairs(____exports) do
10
10
  ${namespace}[k] = v
11
11
  end
12
12
  `;
13
- export const useTranspileTasks = ({ entryPoint, exitPoint, toybox, transpileMode = TranspileMode.Project })=>{
14
- return useMemo(()=>[
15
- {
16
- waitingDescription: 'Waiting to transpile code...',
17
- errorDescription: 'Could not transpile code',
18
- runningDescription: 'Transpiling code...',
19
- finishedDescription: ()=>'Code transpiled',
20
- runner: async ()=>{
21
- const result = transpile({
22
- entryPoint,
23
- exitPoint,
24
- transpileMode
25
- });
26
- if (result.diagnostics.length > 0) {
27
- const errors = getErrorMessage(result.diagnostics);
28
- throw new Error(`${result.diagnostics.length === 1 ? 'An error' : 'Errors'} occurred while transpiling the code:\n${errors}`);
29
- }
30
- },
31
- ready: true,
32
- quitOnError: false
33
- },
34
- ...toybox ? [
13
+ export const useTranspileTasks = ({ entryPoint, exitPoint, toybox, transpileMode, library, }) => {
14
+ return useMemo(() => [
15
+ {
16
+ waitingDescription: 'Waiting to transpile code...',
17
+ errorDescription: 'Could not transpile code',
18
+ runningDescription: 'Transpiling code...',
19
+ finishedDescription: () => 'Code transpiled',
20
+ runner: () => __awaiter(void 0, void 0, void 0, function* () {
21
+ const result = transpile({
22
+ entryPoint,
23
+ exitPoint,
24
+ transpileMode,
25
+ library,
26
+ });
27
+ if (result.diagnostics.length > 0) {
28
+ const errors = getErrorMessage(result.diagnostics);
29
+ throw new Error(`${result.diagnostics.length === 1
30
+ ? 'An error'
31
+ : 'Errors'} occurred while transpiling the code:\n${errors}`);
32
+ }
33
+ }),
34
+ ready: true,
35
+ quitOnError: false,
36
+ },
37
+ ...(toybox
38
+ ? [
35
39
  {
36
40
  waitingDescription: 'Waiting to create toybox import file...',
37
41
  errorDescription: 'Could not create toybox import file',
38
42
  runningDescription: 'Creating toybox import file...',
39
- finishedDescription: ()=>'Toybox import file created',
40
- runner: async ()=>{
43
+ finishedDescription: () => 'Toybox import file created',
44
+ runner: () => __awaiter(void 0, void 0, void 0, function* () {
41
45
  const template = getToyboxTemplate(toybox, basename(exitPoint.exitPath));
42
46
  writeFileSync(join(dirname(exitPoint.exitPath), 'import.lua'), template);
43
- }
44
- }
45
- ] : []
46
- ], [
47
- toybox
48
- ]);
47
+ }),
48
+ },
49
+ ]
50
+ : []),
51
+ ], [entryPoint, exitPoint, toybox, transpileMode]);
49
52
  };
50
-
51
53
  //# sourceMappingURL=useTranspileTasks.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../libs/cli/src/commands/TranspileCommand/hooks/useTranspileTasks.ts"],"sourcesContent":["import { writeFileSync } from 'node:fs';\nimport { basename, dirname, join } from 'node:path';\nimport { useMemo } from 'react';\nimport { getErrorMessage } from '@/cli/commands/TranspileCommand/fn/getErrorMessage.js';\nimport { transpile } from '@/cli/commands/TranspileCommand/fn/transpile.js';\nimport { ValidatedEntryPoint } from '@/cli/commands/TranspileCommand/model/ValidatedEntryPoint.js';\nimport { ValidatedExitPoint } from '@/cli/commands/TranspileCommand/model/ValidatedExitPoint.js';\nimport { CheckListItem } from '@/cli/types.js';\nimport { TranspileMode } from '../types.js';\n\nconst getToyboxTemplate = (\n namespace: string,\n entryPoint: string,\n) => `${namespace} = ${namespace} or {}\nlocal ____exports = import(\"${entryPoint}\")\nfor k, v in pairs(____exports) do\n ${namespace}[k] = v\nend\n`;\n\nexport const useTranspileTasks = ({\n entryPoint,\n exitPoint,\n toybox,\n transpileMode = TranspileMode.Project,\n}: {\n entryPoint: ValidatedEntryPoint;\n exitPoint: ValidatedExitPoint;\n toybox?: string;\n transpileMode?: TranspileMode;\n}) => {\n return useMemo(\n () => [\n {\n waitingDescription: 'Waiting to transpile code...',\n errorDescription: 'Could not transpile code',\n runningDescription: 'Transpiling code...',\n finishedDescription: () => 'Code transpiled',\n runner: async () => {\n const result = transpile({\n entryPoint,\n exitPoint,\n transpileMode,\n });\n\n if (result.diagnostics.length > 0) {\n const errors = getErrorMessage(result.diagnostics);\n\n throw new Error(\n `${\n result.diagnostics.length === 1\n ? 'An error'\n : 'Errors'\n } occurred while transpiling the code:\\n${errors}`,\n );\n }\n },\n ready: true,\n quitOnError: false,\n },\n ...(toybox\n ? [\n {\n waitingDescription:\n 'Waiting to create toybox import file...',\n errorDescription:\n 'Could not create toybox import file',\n runningDescription: 'Creating toybox import file...',\n finishedDescription: () =>\n 'Toybox import file created',\n runner: async () => {\n const template = getToyboxTemplate(\n toybox,\n basename(exitPoint.exitPath),\n );\n\n writeFileSync(\n join(\n dirname(exitPoint.exitPath),\n 'import.lua',\n ),\n template,\n );\n },\n },\n ]\n : []),\n ],\n [toybox],\n ) as CheckListItem<unknown>[];\n};\n"],"names":["writeFileSync","basename","dirname","join","useMemo","getErrorMessage","transpile","TranspileMode","getToyboxTemplate","namespace","entryPoint","useTranspileTasks","exitPoint","toybox","transpileMode","Project","waitingDescription","errorDescription","runningDescription","finishedDescription","runner","result","diagnostics","length","errors","Error","ready","quitOnError","template","exitPath"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,aAAa,QAAQ,UAAU;AACxC,SAASC,QAAQ,EAAEC,OAAO,EAAEC,IAAI,QAAQ,YAAY;AACpD,SAASC,OAAO,QAAQ,QAAQ;AAChC,SAASC,eAAe,QAAQ,wDAAwD;AACxF,SAASC,SAAS,QAAQ,kDAAkD;AAI5E,SAASC,aAAa,QAAQ,cAAc;AAE5C,MAAMC,oBAAoB,CACtBC,WACAC,aACC,CAAC,EAAED,UAAU,GAAG,EAAEA,UAAU;4BACL,EAAEC,WAAW;;EAEvC,EAAED,UAAU;;AAEd,CAAC;AAED,OAAO,MAAME,oBAAoB,CAAC,EAC9BD,UAAU,EACVE,SAAS,EACTC,MAAM,EACNC,gBAAgBP,cAAcQ,OAAO,EAMxC;IACG,OAAOX,QACH,IAAM;YACF;gBACIY,oBAAoB;gBACpBC,kBAAkB;gBAClBC,oBAAoB;gBACpBC,qBAAqB,IAAM;gBAC3BC,QAAQ;oBACJ,MAAMC,SAASf,UAAU;wBACrBI;wBACAE;wBACAE;oBACJ;oBAEA,IAAIO,OAAOC,WAAW,CAACC,MAAM,GAAG,GAAG;wBAC/B,MAAMC,SAASnB,gBAAgBgB,OAAOC,WAAW;wBAEjD,MAAM,IAAIG,MACN,CAAC,EACGJ,OAAOC,WAAW,CAACC,MAAM,KAAK,IACxB,aACA,SACT,uCAAuC,EAAEC,OAAO,CAAC;oBAE1D;gBACJ;gBACAE,OAAO;gBACPC,aAAa;YACjB;eACId,SACE;gBACI;oBACIG,oBACI;oBACJC,kBACI;oBACJC,oBAAoB;oBACpBC,qBAAqB,IACjB;oBACJC,QAAQ;wBACJ,MAAMQ,WAAWpB,kBACbK,QACAZ,SAASW,UAAUiB,QAAQ;wBAG/B7B,cACIG,KACID,QAAQU,UAAUiB,QAAQ,GAC1B,eAEJD;oBAER;gBACJ;aACH,GACD,EAAE;SACX,EACD;QAACf;KAAO;AAEhB,EAAE"}
1
+ {"version":3,"file":"useTranspileTasks.js","sourceRoot":"","sources":["../../../../../../../libs/cli/src/commands/TranspileCommand/hooks/useTranspileTasks.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACpD,OAAO,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,uDAAuD,CAAC;AACxF,OAAO,EAAE,SAAS,EAAE,MAAM,iDAAiD,CAAC;AAM5E,MAAM,iBAAiB,GAAG,CACtB,SAAiB,EACjB,UAAkB,EACpB,EAAE,CAAC,GAAG,SAAS,MAAM,SAAS;8BACF,UAAU;;IAEpC,SAAS;;CAEZ,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,EAC9B,UAAU,EACV,SAAS,EACT,MAAM,EACN,aAAa,EACb,OAAO,GAOV,EAAE,EAAE;IACD,OAAO,OAAO,CACV,GAAG,EAAE,CAAC;QACF;YACI,kBAAkB,EAAE,8BAA8B;YAClD,gBAAgB,EAAE,0BAA0B;YAC5C,kBAAkB,EAAE,qBAAqB;YACzC,mBAAmB,EAAE,GAAG,EAAE,CAAC,iBAAiB;YAC5C,MAAM,EAAE,GAAS,EAAE;gBACf,MAAM,MAAM,GAAG,SAAS,CAAC;oBACrB,UAAU;oBACV,SAAS;oBACT,aAAa;oBACb,OAAO;iBACV,CAAC,CAAC;gBAEH,IAAI,MAAM,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBAChC,MAAM,MAAM,GAAG,eAAe,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;oBAEnD,MAAM,IAAI,KAAK,CACX,GACI,MAAM,CAAC,WAAW,CAAC,MAAM,KAAK,CAAC;wBAC3B,CAAC,CAAC,UAAU;wBACZ,CAAC,CAAC,QACV,0CAA0C,MAAM,EAAE,CACrD,CAAC;gBACN,CAAC;YACL,CAAC,CAAA;YACD,KAAK,EAAE,IAAI;YACX,WAAW,EAAE,KAAK;SACrB;QACD,GAAG,CAAC,MAAM;YACN,CAAC,CAAC;gBACI;oBACI,kBAAkB,EACd,yCAAyC;oBAC7C,gBAAgB,EACZ,qCAAqC;oBACzC,kBAAkB,EAAE,gCAAgC;oBACpD,mBAAmB,EAAE,GAAG,EAAE,CACtB,4BAA4B;oBAChC,MAAM,EAAE,GAAS,EAAE;wBACf,MAAM,QAAQ,GAAG,iBAAiB,CAC9B,MAAM,EACN,QAAQ,CAAC,SAAS,CAAC,QAAQ,CAAC,CAC/B,CAAC;wBAEF,aAAa,CACT,IAAI,CACA,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,EAC3B,YAAY,CACf,EACD,QAAQ,CACX,CAAC;oBACN,CAAC,CAAA;iBACJ;aACJ;YACH,CAAC,CAAC,EAAE,CAAC;KACZ,EACD,CAAC,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,aAAa,CAAC,CACrB,CAAC;AAClC,CAAC,CAAC"}
@@ -1,3 +1,2 @@
1
1
  export * from './TranspileCommand.js';
2
-
3
2
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../libs/cli/src/commands/TranspileCommand/index.ts"],"sourcesContent":["export * from './TranspileCommand.js';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,wBAAwB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../libs/cli/src/commands/TranspileCommand/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC"}
@@ -1,3 +1,2 @@
1
- export { };
2
-
1
+ export {};
3
2
  //# sourceMappingURL=ValidatedEntryPoint.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../libs/cli/src/commands/TranspileCommand/model/ValidatedEntryPoint.ts"],"sourcesContent":["export type ValidatedEntryPoint = {\n __validated: true;\n\n /**\n * The path to a directory containing a tsconfig.json file\n */\n projectPath: string;\n /**\n * The entry point to transpile. Must be within the path.\n */\n entryFile: string;\n};\n"],"names":[],"rangeMappings":"","mappings":"AAAA,WAWE"}
1
+ {"version":3,"file":"ValidatedEntryPoint.js","sourceRoot":"","sources":["../../../../../../../libs/cli/src/commands/TranspileCommand/model/ValidatedEntryPoint.ts"],"names":[],"mappings":""}
@@ -1,3 +1,2 @@
1
- export { };
2
-
1
+ export {};
3
2
  //# sourceMappingURL=ValidatedExitPoint.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../libs/cli/src/commands/TranspileCommand/model/ValidatedExitPoint.ts"],"sourcesContent":["export type ValidatedExitPoint = {\n __validated: true;\n\n /**\n * The path to a directory containing a tsconfig.json file\n */\n projectPath: string;\n /**\n * The path to the output directory. Must be within the project path.\n */\n exitPath: string;\n};\n"],"names":[],"rangeMappings":"","mappings":"AAAA,WAWE"}
1
+ {"version":3,"file":"ValidatedExitPoint.js","sourceRoot":"","sources":["../../../../../../../libs/cli/src/commands/TranspileCommand/model/ValidatedExitPoint.ts"],"names":[],"mappings":""}
@@ -1,7 +1,6 @@
1
1
  export var TranspileMode;
2
- (function(TranspileMode) {
2
+ (function (TranspileMode) {
3
3
  TranspileMode["Project"] = "Project";
4
4
  TranspileMode["File"] = "File";
5
5
  })(TranspileMode || (TranspileMode = {}));
6
-
7
6
  //# sourceMappingURL=types.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../libs/cli/src/commands/TranspileCommand/types.ts"],"sourcesContent":["export enum TranspileMode {\n Project = 'Project',\n File = 'File',\n}\n"],"names":["TranspileMode"],"rangeMappings":";;;;","mappings":";UAAYA;;;GAAAA,kBAAAA"}
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../../../libs/cli/src/commands/TranspileCommand/types.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,aAGX;AAHD,WAAY,aAAa;IACrB,oCAAmB,CAAA;IACnB,8BAAa,CAAA;AACjB,CAAC,EAHW,aAAa,KAAb,aAAa,QAGxB"}
@@ -1,7 +1,8 @@
1
1
  import React from 'react';
2
- import { CheckListItem } from '../../types.js';
2
+ import type { CheckListItem } from '../../types.js';
3
3
  export interface CheckListProps<TResult = unknown> {
4
4
  items: CheckListItem<TResult>[];
5
5
  onFinish?: (hasFailure: boolean) => void;
6
+ display?: 'silent' | Pick<CheckListItem<TResult>, 'finishedDescription' | 'skipDescription' | 'errorDescription' | 'waitingDescription' | 'runningDescription'>;
6
7
  }
7
- export declare const CheckList: <TResult>({ items, onFinish, }: CheckListProps<TResult>) => React.JSX.Element;
8
+ export declare const CheckList: <TResult>({ items, onFinish, display, }: CheckListProps<TResult>) => React.JSX.Element;