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.
- package/CHANGELOG.md +11 -5
- package/assets/ImportMap/ImportMap.js +26 -65
- package/assets/ImportMap/ImportMap.js.map +1 -1
- package/assets/ImportMap/index.js +3 -6
- package/assets/ImportMap/index.js.map +1 -1
- package/assets/beforeEmit/getBeforeEmit.js +11 -16
- package/assets/beforeEmit/getBeforeEmit.js.map +1 -1
- package/assets/beforeEmit/index.js +3 -6
- package/assets/beforeEmit/index.js.map +1 -1
- package/assets/beforeEmit/withAutomaticImportWarning.js +4 -11
- package/assets/beforeEmit/withAutomaticImportWarning.js.map +1 -1
- package/assets/index.js +18 -28
- package/assets/index.js.map +1 -1
- package/assets/transformCallExpression/getTransformCallExpression.js +66 -18
- package/assets/transformCallExpression/getTransformCallExpression.js.map +1 -1
- package/assets/transformCallExpression/index.js +3 -6
- package/assets/transformCallExpression/index.js.map +1 -1
- package/assets/transformClassDeclaration/createClasCall.js +11 -24
- package/assets/transformClassDeclaration/createClasCall.js.map +1 -1
- package/assets/transformClassDeclaration/getExportedClassDeclarationStatements.js +14 -15
- package/assets/transformClassDeclaration/getExportedClassDeclarationStatements.js.map +1 -1
- package/assets/transformClassDeclaration/getTransformClassDeclaration.js +47 -43
- package/assets/transformClassDeclaration/getTransformClassDeclaration.js.map +1 -1
- package/assets/transformClassDeclaration/index.js +3 -6
- package/assets/transformClassDeclaration/index.js.map +1 -1
- package/assets/transformClassDeclaration/transformConstructor.js +44 -56
- package/assets/transformClassDeclaration/transformConstructor.js.map +1 -1
- package/assets/transformClassDeclaration/transformMethodDeclaration.js +12 -20
- package/assets/transformClassDeclaration/transformMethodDeclaration.js.map +1 -1
- package/assets/transformClassDeclaration/transformPropertyName.js +14 -19
- package/assets/transformClassDeclaration/transformPropertyName.js.map +1 -1
- package/assets/transformExportDeclaration/getTransformExportDeclaration.d.ts +6 -0
- package/assets/transformExportDeclaration/getTransformExportDeclaration.js +52 -0
- package/assets/transformExportDeclaration/getTransformExportDeclaration.js.map +1 -0
- package/assets/transformNewExpression/index.js +3 -6
- package/assets/transformNewExpression/index.js.map +1 -1
- package/assets/transformNewExpression/isBuiltinNewExpression.js +11 -15
- package/assets/transformNewExpression/isBuiltinNewExpression.js.map +1 -1
- package/assets/transformNewExpression/transformNewExpression.js +12 -23
- package/assets/transformNewExpression/transformNewExpression.js.map +1 -1
- package/assets/transformPropertyAccessExpression/a.js +24 -0
- package/assets/transformPropertyAccessExpression/a.js.map +1 -0
- package/assets/transformPropertyAccessExpression/getTransformPropertyAccessExpression.js +6 -13
- package/assets/transformPropertyAccessExpression/getTransformPropertyAccessExpression.js.map +1 -1
- package/assets/transformPropertyAccessExpression/index.js +3 -6
- package/assets/transformPropertyAccessExpression/index.js.map +1 -1
- package/assets/transformSuperExpression/index.js +3 -6
- package/assets/transformSuperExpression/index.js.map +1 -1
- package/assets/transformSuperExpression/transformSuperExpression.js +8 -16
- package/assets/transformSuperExpression/transformSuperExpression.js.map +1 -1
- package/assets/types.js +1 -4
- package/assets/types.js.map +1 -1
- package/package.json +8 -5
- package/src/commands/CompileCommand/CompileCommand.d.ts +1 -1
- package/src/commands/CompileCommand/CompileCommand.js +3 -10
- package/src/commands/CompileCommand/CompileCommand.js.map +1 -1
- package/src/commands/CompileCommand/components/Compile.d.ts +1 -1
- package/src/commands/CompileCommand/components/Compile.js +3 -7
- package/src/commands/CompileCommand/components/Compile.js.map +1 -1
- package/src/commands/CompileCommand/fn/getPdcPathFromEnvironment.d.ts +1 -1
- package/src/commands/CompileCommand/fn/getPdcPathFromEnvironment.js +1 -2
- package/src/commands/CompileCommand/fn/getPdcPathFromEnvironment.js.map +1 -1
- package/src/commands/CompileCommand/hooks/task/compile.d.ts +5 -2
- package/src/commands/CompileCommand/hooks/task/compile.js +10 -9
- package/src/commands/CompileCommand/hooks/task/compile.js.map +1 -1
- package/src/commands/CompileCommand/hooks/useCompileTasks.d.ts +5 -2
- package/src/commands/CompileCommand/hooks/useCompileTasks.js +33 -30
- package/src/commands/CompileCommand/hooks/useCompileTasks.js.map +1 -1
- package/src/commands/CompileCommand/index.js +0 -1
- package/src/commands/CompileCommand/index.js.map +1 -1
- package/src/commands/DoctorCommand.js +5 -12
- package/src/commands/DoctorCommand.js.map +1 -1
- package/src/commands/EnvironmentAwareCommand/EnvironmentAwareCommand.d.ts +2 -2
- package/src/commands/EnvironmentAwareCommand/EnvironmentAwareCommand.js +30 -30
- package/src/commands/EnvironmentAwareCommand/EnvironmentAwareCommand.js.map +1 -1
- package/src/commands/EnvironmentAwareCommand/components/HealthReport.d.ts +1 -1
- package/src/commands/EnvironmentAwareCommand/components/HealthReport.js +14 -15
- package/src/commands/EnvironmentAwareCommand/components/HealthReport.js.map +1 -1
- package/src/commands/EnvironmentAwareCommand/contexts/CrankScriptContext.js +5 -10
- package/src/commands/EnvironmentAwareCommand/contexts/CrankScriptContext.js.map +1 -1
- package/src/commands/EnvironmentAwareCommand/index.js +0 -1
- package/src/commands/EnvironmentAwareCommand/index.js.map +1 -1
- package/src/commands/GenerateTypes/GenerateTypesCommand.js +14 -21
- package/src/commands/GenerateTypes/GenerateTypesCommand.js.map +1 -1
- package/src/commands/GenerateTypes/components/GenerateTypes.d.ts +1 -1
- package/src/commands/GenerateTypes/components/GenerateTypes.js +11 -15
- package/src/commands/GenerateTypes/components/GenerateTypes.js.map +1 -1
- package/src/commands/GenerateTypes/constants.js +0 -1
- package/src/commands/GenerateTypes/constants.js.map +1 -1
- package/src/commands/GenerateTypes/fn/getApiDefinitions.d.ts +1 -1
- package/src/commands/GenerateTypes/fn/getApiDefinitions.js +12 -14
- package/src/commands/GenerateTypes/fn/getApiDefinitions.js.map +1 -1
- package/src/commands/GenerateTypes/fn/getDescriptionsFromHtml.d.ts +1 -1
- package/src/commands/GenerateTypes/fn/getDescriptionsFromHtml.js +38 -30
- package/src/commands/GenerateTypes/fn/getDescriptionsFromHtml.js.map +1 -1
- package/src/commands/GenerateTypes/fn/getFunctionTypeOverride.js +5 -4
- package/src/commands/GenerateTypes/fn/getFunctionTypeOverride.js.map +1 -1
- package/src/commands/GenerateTypes/fn/getHtmlForVersion.js +6 -9
- package/src/commands/GenerateTypes/fn/getHtmlForVersion.js.map +1 -1
- package/src/commands/GenerateTypes/fn/parseFunctionSignature.js +13 -10
- package/src/commands/GenerateTypes/fn/parseFunctionSignature.js.map +1 -1
- package/src/commands/GenerateTypes/hooks/useFetchHtml.js +10 -12
- package/src/commands/GenerateTypes/hooks/useFetchHtml.js.map +1 -1
- package/src/commands/GenerateTypes/hooks/useFormatTypeFile.js +23 -29
- package/src/commands/GenerateTypes/hooks/useFormatTypeFile.js.map +1 -1
- package/src/commands/GenerateTypes/hooks/useGenerateTypeFile.d.ts +2 -2
- package/src/commands/GenerateTypes/hooks/useGenerateTypeFile.js +44 -75
- package/src/commands/GenerateTypes/hooks/useGenerateTypeFile.js.map +1 -1
- package/src/commands/GenerateTypes/hooks/useGetVersion.d.ts +1 -1
- package/src/commands/GenerateTypes/hooks/useGetVersion.js +19 -19
- package/src/commands/GenerateTypes/hooks/useGetVersion.js.map +1 -1
- package/src/commands/GenerateTypes/hooks/useParseDocumentation.d.ts +1 -1
- package/src/commands/GenerateTypes/hooks/useParseDocumentation.js +10 -12
- package/src/commands/GenerateTypes/hooks/useParseDocumentation.js.map +1 -1
- package/src/commands/GenerateTypes/index.js +0 -1
- package/src/commands/GenerateTypes/index.js.map +1 -1
- package/src/commands/GenerateTypes/types.d.ts +1 -1
- package/src/commands/GenerateTypes/types.js +1 -2
- package/src/commands/GenerateTypes/types.js.map +1 -1
- package/src/commands/GenerateTypes/utils/createTypeProvider.d.ts +2 -2
- package/src/commands/GenerateTypes/utils/createTypeProvider.js +63 -85
- package/src/commands/GenerateTypes/utils/createTypeProvider.js.map +1 -1
- package/src/commands/GenerateTypes/utils/functionTypeOverrides.d.ts +1 -1
- package/src/commands/GenerateTypes/utils/functionTypeOverrides.js +6 -7
- package/src/commands/GenerateTypes/utils/functionTypeOverrides.js.map +1 -1
- package/src/commands/NewCommand/NewCommand.js +9 -17
- package/src/commands/NewCommand/NewCommand.js.map +1 -1
- package/src/commands/NewCommand/components/New.d.ts +1 -1
- package/src/commands/NewCommand/components/New.js +19 -25
- package/src/commands/NewCommand/components/New.js.map +1 -1
- package/src/commands/NewLibCommand/NewLibCommand.js +9 -17
- package/src/commands/NewLibCommand/NewLibCommand.js.map +1 -1
- package/src/commands/NewLibCommand/components/NewLib.d.ts +1 -1
- package/src/commands/NewLibCommand/components/NewLib.js +19 -25
- package/src/commands/NewLibCommand/components/NewLib.js.map +1 -1
- package/src/commands/NewLibCommand/index.js +0 -1
- package/src/commands/NewLibCommand/index.js.map +1 -1
- package/src/commands/RenderableCommand.d.ts +1 -1
- package/src/commands/RenderableCommand.js +5 -3
- package/src/commands/RenderableCommand.js.map +1 -1
- package/src/commands/SimulatorCommand/SimulatorCommand.d.ts +1 -1
- package/src/commands/SimulatorCommand/SimulatorCommand.js +23 -38
- package/src/commands/SimulatorCommand/SimulatorCommand.js.map +1 -1
- package/src/commands/SimulatorCommand/components/Simulator.d.ts +3 -2
- package/src/commands/SimulatorCommand/components/Simulator.js +19 -17
- package/src/commands/SimulatorCommand/components/Simulator.js.map +1 -1
- package/src/commands/SimulatorCommand/components/TemporaryFolderCreator.d.ts +1 -1
- package/src/commands/SimulatorCommand/components/TemporaryFolderCreator.js +15 -22
- package/src/commands/SimulatorCommand/components/TemporaryFolderCreator.js.map +1 -1
- package/src/commands/SimulatorCommand/fn/createTemporaryFolderPathFromEntryFile.js +8 -6
- package/src/commands/SimulatorCommand/fn/createTemporaryFolderPathFromEntryFile.js.map +1 -1
- package/src/commands/SimulatorCommand/fn/getSimulatorPathFromEnvironment.d.ts +1 -1
- package/src/commands/SimulatorCommand/fn/getSimulatorPathFromEnvironment.js +1 -2
- package/src/commands/SimulatorCommand/fn/getSimulatorPathFromEnvironment.js.map +1 -1
- package/src/commands/SimulatorCommand/hooks/useFileWatcher.js +10 -10
- package/src/commands/SimulatorCommand/hooks/useFileWatcher.js.map +1 -1
- package/src/commands/SimulatorCommand/hooks/useSimulatorTasks.d.ts +6 -2
- package/src/commands/SimulatorCommand/hooks/useSimulatorTasks.js +52 -50
- package/src/commands/SimulatorCommand/hooks/useSimulatorTasks.js.map +1 -1
- package/src/commands/SimulatorCommand/index.js +0 -1
- package/src/commands/SimulatorCommand/index.js.map +1 -1
- package/src/commands/TestCommand/TestCommand.d.ts +12 -0
- package/src/commands/TestCommand/TestCommand.js +32 -0
- package/src/commands/TestCommand/TestCommand.js.map +1 -0
- package/src/commands/TestCommand/components/Test.d.ts +9 -0
- package/src/commands/TestCommand/components/Test.js +73 -0
- package/src/commands/TestCommand/components/Test.js.map +1 -0
- package/src/commands/TestCommand/components/TestLine.d.ts +10 -0
- package/src/commands/TestCommand/components/TestLine.js +11 -0
- package/src/commands/TestCommand/components/TestLine.js.map +1 -0
- package/src/commands/TestCommand/components/TestResult.d.ts +8 -0
- package/src/commands/TestCommand/components/TestResult.js +21 -0
- package/src/commands/TestCommand/components/TestResult.js.map +1 -0
- package/src/commands/TestCommand/components/TestSuite.d.ts +8 -0
- package/src/commands/TestCommand/components/TestSuite.js +60 -0
- package/src/commands/TestCommand/components/TestSuite.js.map +1 -0
- package/src/commands/TestCommand/components/TestSummary.d.ts +7 -0
- package/src/commands/TestCommand/components/TestSummary.js +9 -0
- package/src/commands/TestCommand/components/TestSummary.js.map +1 -0
- package/src/commands/TestCommand/hooks/useTestFiles.d.ts +3 -0
- package/src/commands/TestCommand/hooks/useTestFiles.js +8 -0
- package/src/commands/TestCommand/hooks/useTestFiles.js.map +1 -0
- package/src/commands/TestCommand/hooks/useTestServer.d.ts +5 -0
- package/src/commands/TestCommand/hooks/useTestServer.js +26 -0
- package/src/commands/TestCommand/hooks/useTestServer.js.map +1 -0
- package/src/commands/TestCommand/hooks/useTestTasks.d.ts +14 -0
- package/src/commands/TestCommand/hooks/useTestTasks.js +61 -0
- package/src/commands/TestCommand/hooks/useTestTasks.js.map +1 -0
- package/src/commands/TestCommand/index.d.ts +1 -0
- package/src/commands/TestCommand/index.js +2 -0
- package/src/commands/TestCommand/index.js.map +1 -0
- package/src/commands/TestCommand/server/TestServer.d.ts +72 -0
- package/src/commands/TestCommand/server/TestServer.js +249 -0
- package/src/commands/TestCommand/server/TestServer.js.map +1 -0
- package/src/commands/TestCommand/types.d.ts +4 -0
- package/src/commands/TestCommand/types.js +6 -0
- package/src/commands/TestCommand/types.js.map +1 -0
- package/src/commands/TestCommand/utils/formatTestError.d.ts +1 -0
- package/src/commands/TestCommand/utils/formatTestError.js +7 -0
- package/src/commands/TestCommand/utils/formatTestError.js.map +1 -0
- package/src/commands/TranspileCommand/TranspileCommand.d.ts +1 -0
- package/src/commands/TranspileCommand/TranspileCommand.js +23 -28
- package/src/commands/TranspileCommand/TranspileCommand.js.map +1 -1
- package/src/commands/TranspileCommand/components/Transpile.d.ts +4 -3
- package/src/commands/TranspileCommand/components/Transpile.js +4 -7
- package/src/commands/TranspileCommand/components/Transpile.js.map +1 -1
- package/src/commands/TranspileCommand/fn/getErrorMessage.d.ts +1 -1
- package/src/commands/TranspileCommand/fn/getErrorMessage.js +5 -6
- package/src/commands/TranspileCommand/fn/getErrorMessage.js.map +1 -1
- package/src/commands/TranspileCommand/fn/transpile.d.ts +4 -3
- package/src/commands/TranspileCommand/fn/transpile.js +21 -24
- package/src/commands/TranspileCommand/fn/transpile.js.map +1 -1
- package/src/commands/TranspileCommand/fn/validateEntryPoint.d.ts +1 -1
- package/src/commands/TranspileCommand/fn/validateEntryPoint.js +2 -3
- package/src/commands/TranspileCommand/fn/validateEntryPoint.js.map +1 -1
- package/src/commands/TranspileCommand/fn/validateExitPoint.d.ts +1 -1
- package/src/commands/TranspileCommand/fn/validateExitPoint.js +6 -6
- package/src/commands/TranspileCommand/fn/validateExitPoint.js.map +1 -1
- package/src/commands/TranspileCommand/hooks/useTranspileTasks.d.ts +6 -5
- package/src/commands/TranspileCommand/hooks/useTranspileTasks.js +35 -33
- package/src/commands/TranspileCommand/hooks/useTranspileTasks.js.map +1 -1
- package/src/commands/TranspileCommand/index.js +0 -1
- package/src/commands/TranspileCommand/index.js.map +1 -1
- package/src/commands/TranspileCommand/model/ValidatedEntryPoint.js +1 -2
- package/src/commands/TranspileCommand/model/ValidatedEntryPoint.js.map +1 -1
- package/src/commands/TranspileCommand/model/ValidatedExitPoint.js +1 -2
- package/src/commands/TranspileCommand/model/ValidatedExitPoint.js.map +1 -1
- package/src/commands/TranspileCommand/types.js +1 -2
- package/src/commands/TranspileCommand/types.js.map +1 -1
- package/src/components/CheckList/CheckList.d.ts +3 -2
- package/src/components/CheckList/CheckList.js +14 -21
- package/src/components/CheckList/CheckList.js.map +1 -1
- package/src/components/CheckList/Item.d.ts +3 -2
- package/src/components/CheckList/Item.js +47 -44
- package/src/components/CheckList/Item.js.map +1 -1
- package/src/components/CheckList/index.js +0 -1
- package/src/components/CheckList/index.js.map +1 -1
- package/src/components/ErrorBoundary.d.ts +14 -0
- package/src/components/ErrorBoundary.js +7 -13
- package/src/components/ErrorBoundary.js.map +1 -1
- package/src/components/Spinner.d.ts +1 -1
- package/src/components/Spinner.js +13 -18
- package/src/components/Spinner.js.map +1 -1
- package/src/constants.js +1 -6
- package/src/constants.js.map +1 -1
- package/src/environment/createEnvironment.d.ts +1 -1
- package/src/environment/createEnvironment.js +13 -16
- package/src/environment/createEnvironment.js.map +1 -1
- package/src/environment/dto/Environment.d.ts +1 -1
- package/src/environment/dto/Environment.js +1 -2
- package/src/environment/dto/Environment.js.map +1 -1
- package/src/environment/error/EnvironmentError.js +0 -1
- package/src/environment/error/EnvironmentError.js.map +1 -1
- package/src/environment/path/dto/PlaydateSdkPath.js +3 -4
- package/src/environment/path/dto/PlaydateSdkPath.js.map +1 -1
- package/src/environment/path/error/PlaydateSdkPathVariableNotSetError.js +1 -2
- package/src/environment/path/error/PlaydateSdkPathVariableNotSetError.js.map +1 -1
- package/src/environment/path/getPlaydateSdkPath.js +5 -3
- package/src/environment/path/getPlaydateSdkPath.js.map +1 -1
- package/src/index.js +7 -5
- package/src/index.js.map +1 -1
- package/src/types.d.ts +3 -3
- package/src/types.js +4 -5
- package/src/types.js.map +1 -1
- package/src/utils/appendExeOnWindows.js +1 -2
- package/src/utils/appendExeOnWindows.js.map +1 -1
- package/src/utils/dirname.js +0 -1
- package/src/utils/dirname.js.map +1 -1
- package/src/utils/platform.js +0 -1
- package/src/utils/platform.js.map +1 -1
- package/src/commands/TranspileCommand/fn/_tests/test-abstract/src/index.js +0 -4
- package/src/commands/TranspileCommand/fn/_tests/test-abstract/src/index.js.map +0 -1
- package/src/commands/TranspileCommand/fn/_tests/test-automatic-imports/src/index.js +0 -3
- package/src/commands/TranspileCommand/fn/_tests/test-automatic-imports/src/index.js.map +0 -1
- package/src/commands/TranspileCommand/fn/_tests/test-builtins/src/index.js +0 -4
- package/src/commands/TranspileCommand/fn/_tests/test-builtins/src/index.js.map +0 -1
- package/src/commands/TranspileCommand/fn/_tests/test-default-parameters/src/index.js +0 -17
- package/src/commands/TranspileCommand/fn/_tests/test-default-parameters/src/index.js.map +0 -1
- package/src/commands/TranspileCommand/fn/_tests/test-implicit-constructor/src/index.js +0 -10
- package/src/commands/TranspileCommand/fn/_tests/test-implicit-constructor/src/index.js.map +0 -1
- package/src/commands/TranspileCommand/fn/_tests/test-static/src/index.js +0 -18
- package/src/commands/TranspileCommand/fn/_tests/test-static/src/index.js.map +0 -1
- package/src/commands/TranspileCommand/fn/_tests/test-super/src/index.js +0 -24
- 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
|
-
|
|
16
|
-
|
|
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"],"
|
|
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,E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E,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,"
|
|
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"],"
|
|
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
|
|
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
|
-
|
|
16
|
-
|
|
17
|
-
|
|
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"],"
|
|
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,MA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,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"],"
|
|
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 {
|
|
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
|
-
|
|
19
|
-
}
|
|
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"],"
|
|
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
|
-
|
|
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
|
|
14
|
-
return useMemo(()=>[
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
},
|
|
34
|
-
|
|
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:
|
|
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
|
-
|
|
48
|
-
]);
|
|
47
|
+
}),
|
|
48
|
+
},
|
|
49
|
+
]
|
|
50
|
+
: []),
|
|
51
|
+
], [entryPoint, exitPoint, toybox, transpileMode]);
|
|
49
52
|
};
|
|
50
|
-
|
|
51
53
|
//# sourceMappingURL=useTranspileTasks.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"useTranspileTasks.js","sourceRoot":"","sources":["../../../../../../../libs/cli/src/commands/TranspileCommand/hooks/useTranspileTasks.ts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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 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../libs/cli/src/commands/TranspileCommand/index.ts"],"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../libs/cli/src/commands/TranspileCommand/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../libs/cli/src/commands/TranspileCommand/model/ValidatedEntryPoint.ts"],"
|
|
1
|
+
{"version":3,"file":"ValidatedEntryPoint.js","sourceRoot":"","sources":["../../../../../../../libs/cli/src/commands/TranspileCommand/model/ValidatedEntryPoint.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../libs/cli/src/commands/TranspileCommand/model/ValidatedExitPoint.ts"],"
|
|
1
|
+
{"version":3,"file":"ValidatedExitPoint.js","sourceRoot":"","sources":["../../../../../../../libs/cli/src/commands/TranspileCommand/model/ValidatedExitPoint.ts"],"names":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../libs/cli/src/commands/TranspileCommand/types.ts"],"
|
|
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;
|