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
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { __awaiter } from "tslib";
|
|
1
2
|
import { StatusMessage } from '@inkjs/ui';
|
|
2
3
|
import { Option } from 'clipanion';
|
|
3
4
|
import { Text } from 'ink';
|
|
@@ -7,43 +8,42 @@ import { RenderableCommand } from '../../commands/RenderableCommand.js';
|
|
|
7
8
|
import { createEnvironment } from '../../environment/createEnvironment.js';
|
|
8
9
|
import { CrankScriptProvider } from './contexts/CrankScriptContext.js';
|
|
9
10
|
export class EnvironmentAwareCommand extends RenderableCommand {
|
|
11
|
+
constructor() {
|
|
12
|
+
super(...arguments);
|
|
13
|
+
this.verbose = Option.Boolean('-vvv,--verbose', false, {
|
|
14
|
+
description: 'Enable verbose logging',
|
|
15
|
+
});
|
|
16
|
+
}
|
|
10
17
|
render() {
|
|
11
18
|
if (!this.environment) {
|
|
12
19
|
throw new Error('Environment is not set');
|
|
13
20
|
}
|
|
14
21
|
return this.renderWithEnvironment(this.environment);
|
|
15
22
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
environment: environmentHealth
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
constructor(...args){
|
|
42
|
-
super(...args);
|
|
43
|
-
this.verbose = Option.Boolean('-vvv,--verbose', false, {
|
|
44
|
-
description: 'Enable verbose logging'
|
|
23
|
+
execute() {
|
|
24
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
+
const environmentHealth = createEnvironment();
|
|
26
|
+
if (!environmentHealth.isHealthy) {
|
|
27
|
+
this.renderElement(React.createElement(HealthReport, { environment: environmentHealth }));
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
this.environment = environmentHealth.environment;
|
|
31
|
+
try {
|
|
32
|
+
const toRender = this.render();
|
|
33
|
+
this.renderElement(React.createElement(CrankScriptProvider, { verbose: this.verbose }, toRender));
|
|
34
|
+
}
|
|
35
|
+
catch (error) {
|
|
36
|
+
this.renderElement(React.createElement(StatusMessage, { variant: "error" },
|
|
37
|
+
React.createElement(Text, { color: "red" },
|
|
38
|
+
error instanceof Error
|
|
39
|
+
? error.message
|
|
40
|
+
: 'An unknown error occurred',
|
|
41
|
+
this.verbose &&
|
|
42
|
+
error instanceof Error &&
|
|
43
|
+
error.stack && (React.createElement(Text, { color: "red" }, error.stack)))));
|
|
44
|
+
process.exit(1);
|
|
45
|
+
}
|
|
45
46
|
});
|
|
46
47
|
}
|
|
47
48
|
}
|
|
48
|
-
|
|
49
49
|
//# sourceMappingURL=EnvironmentAwareCommand.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../libs/cli/src/commands/EnvironmentAwareCommand/EnvironmentAwareCommand.tsx"],"
|
|
1
|
+
{"version":3,"file":"EnvironmentAwareCommand.js","sourceRoot":"","sources":["../../../../../../libs/cli/src/commands/EnvironmentAwareCommand/EnvironmentAwareCommand.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AACnC,OAAO,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AAC3B,OAAO,KAAmB,MAAM,OAAO,CAAC;AACxC,OAAO,EAAE,YAAY,EAAE,MAAM,mEAAmE,CAAC;AACjG,OAAO,EAAE,iBAAiB,EAAE,MAAM,qCAAqC,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,wCAAwC,CAAC;AAE3E,OAAO,EAAE,mBAAmB,EAAE,MAAM,kCAAkC,CAAC;AAEvE,MAAM,OAAgB,uBAAwB,SAAQ,iBAAiB;IAAvE;;QAOI,YAAO,GAAG,MAAM,CAAC,OAAO,CAAC,gBAAgB,EAAE,KAAK,EAAE;YAC9C,WAAW,EAAE,wBAAwB;SACxC,CAAC,CAAC;IAiDP,CAAC;IA/CY,MAAM;QACX,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE,C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 'react';
|
|
4
|
-
import { HealthCheckStatusType } from '../../../types.js';
|
|
4
|
+
import { HealthCheckStatusType, } from '../../../types.js';
|
|
5
5
|
const SuccessMessages = {
|
|
6
6
|
sdkPathKnown: {
|
|
7
7
|
[HealthCheckStatusType.Unknown]: 'SDK path status unknown',
|
|
8
|
-
[HealthCheckStatusType.Healthy]: (sdkPath)
|
|
9
|
-
[HealthCheckStatusType.Unhealthy]: 'SDK path not found'
|
|
10
|
-
}
|
|
8
|
+
[HealthCheckStatusType.Healthy]: (sdkPath) => `SDK path found ("${sdkPath.path}")`,
|
|
9
|
+
[HealthCheckStatusType.Unhealthy]: 'SDK path not found',
|
|
10
|
+
},
|
|
11
11
|
};
|
|
12
12
|
const ColorMap = {
|
|
13
13
|
[HealthCheckStatusType.Healthy]: 'green',
|
|
14
14
|
[HealthCheckStatusType.Unhealthy]: 'red',
|
|
15
|
-
[HealthCheckStatusType.Unknown]: 'gray'
|
|
15
|
+
[HealthCheckStatusType.Unknown]: 'gray',
|
|
16
16
|
};
|
|
17
|
-
export const HealthReport = ({ environment })=>{
|
|
17
|
+
export const HealthReport = ({ environment }) => {
|
|
18
18
|
const { health } = environment;
|
|
19
|
-
return Object.keys(health).map((eachKey)=>{
|
|
19
|
+
return Object.keys(health).map((eachKey) => {
|
|
20
20
|
const healthKey = eachKey;
|
|
21
21
|
const keyHealth = health[healthKey];
|
|
22
22
|
let variant = 'info';
|
|
23
23
|
let message = SuccessMessages[healthKey][HealthCheckStatusType.Unknown];
|
|
24
24
|
if (health[healthKey].healthStatus === HealthCheckStatusType.Unhealthy) {
|
|
25
|
-
message =
|
|
25
|
+
message =
|
|
26
|
+
SuccessMessages[healthKey][HealthCheckStatusType.Unhealthy];
|
|
26
27
|
variant = 'error';
|
|
27
28
|
}
|
|
28
29
|
if (health[healthKey].healthStatus === HealthCheckStatusType.Healthy) {
|
|
29
30
|
message = SuccessMessages[healthKey][HealthCheckStatusType.Healthy](health[healthKey].argument);
|
|
30
31
|
variant = 'success';
|
|
31
32
|
}
|
|
32
|
-
return
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}, keyHealth.healthStatus === HealthCheckStatusType.Unhealthy && ' ', message));
|
|
33
|
+
return (React.createElement(StatusMessage, { key: healthKey, variant: variant },
|
|
34
|
+
React.createElement(Text, { color: ColorMap[keyHealth.healthStatus] },
|
|
35
|
+
keyHealth.healthStatus ===
|
|
36
|
+
HealthCheckStatusType.Unhealthy && ' ',
|
|
37
|
+
message)));
|
|
38
38
|
});
|
|
39
39
|
};
|
|
40
|
-
|
|
41
40
|
//# sourceMappingURL=HealthReport.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../libs/cli/src/commands/EnvironmentAwareCommand/components/HealthReport.tsx"],"
|
|
1
|
+
{"version":3,"file":"HealthReport.js","sourceRoot":"","sources":["../../../../../../../libs/cli/src/commands/EnvironmentAwareCommand/components/HealthReport.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAA2B,MAAM,WAAW,CAAC;AACnE,OAAO,EAAE,IAAI,EAAkB,MAAM,KAAK,CAAC;AAC3C,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAGH,qBAAqB,GACxB,MAAM,gBAAgB,CAAC;AAMxB,MAAM,eAAe,GAAG;IACpB,YAAY,EAAE;QACV,CAAC,qBAAqB,CAAC,OAAO,CAAC,EAAE,yBAAyB;QAC1D,CAAC,qBAAqB,CAAC,OAAO,CAAC,EAAE,CAAC,OAAwB,EAAE,EAAE,CAC1D,oBAAoB,OAAO,CAAC,IAAI,IAAI;QACxC,CAAC,qBAAqB,CAAC,SAAS,CAAC,EAAE,oBAAoB;KAC1D;CACK,CAAC;AAEX,MAAM,QAAQ,GAAG;IACb,CAAC,qBAAqB,CAAC,OAAO,CAAC,EAAE,OAAO;IACxC,CAAC,qBAAqB,CAAC,SAAS,CAAC,EAAE,KAAK;IACxC,CAAC,qBAAq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}
|
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
import React, { createContext, useContext } from 'react';
|
|
2
|
-
export const CrankScriptContext =
|
|
3
|
-
verbose: false
|
|
2
|
+
export const CrankScriptContext = createContext({
|
|
3
|
+
verbose: false,
|
|
4
4
|
});
|
|
5
|
-
export const CrankScriptProvider = ({ children, verbose })=>{
|
|
6
|
-
return
|
|
7
|
-
value: {
|
|
8
|
-
verbose
|
|
9
|
-
}
|
|
10
|
-
}, children);
|
|
5
|
+
export const CrankScriptProvider = ({ children, verbose, }) => {
|
|
6
|
+
return (React.createElement(CrankScriptContext.Provider, { value: { verbose } }, children));
|
|
11
7
|
};
|
|
12
|
-
export const useCrankScriptContext = ()=>{
|
|
8
|
+
export const useCrankScriptContext = () => {
|
|
13
9
|
const context = useContext(CrankScriptContext);
|
|
14
10
|
if (!context) {
|
|
15
11
|
throw new Error('CrankScriptContext not found');
|
|
16
12
|
}
|
|
17
13
|
return context;
|
|
18
14
|
};
|
|
19
|
-
|
|
20
15
|
//# sourceMappingURL=CrankScriptContext.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../libs/cli/src/commands/EnvironmentAwareCommand/contexts/CrankScriptContext.tsx"],"
|
|
1
|
+
{"version":3,"file":"CrankScriptContext.js","sourceRoot":"","sources":["../../../../../../../libs/cli/src/commands/EnvironmentAwareCommand/contexts/CrankScriptContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAMzD,MAAM,CAAC,MAAM,kBAAkB,GAAG,aAAa,CAAyB;IACpE,OAAO,EAAE,KAAK;CACjB,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,EAChC,QAAQ,EACR,OAAO,GAIV,EAAE,EAAE;IACD,OAAO,CACH,oBAAC,kBAAkB,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,OAAO,EAAE,IAC1C,QAAQ,CACiB,CACjC,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAG,GAAG,EAAE;IACtC,MAAM,OAAO,GAAG,UAAU,CAAC,kBAAkB,CAAC,CAAC;IAE/C,IAAI,CAAC,OAAO,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;IACpD,CAAC;IAED,OAAO,OAAO,CAAC;AACnB,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../libs/cli/src/commands/EnvironmentAwareCommand/index.ts"],"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../libs/cli/src/commands/EnvironmentAwareCommand/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC"}
|
|
@@ -7,39 +7,32 @@ import { RenderableCommand } from '../../commands/RenderableCommand.js';
|
|
|
7
7
|
import { PlaydateSdkVersionIdentifier } from '../../types.js';
|
|
8
8
|
import { GenerateTypes } from './components/GenerateTypes.js';
|
|
9
9
|
export class GenerateTypesCommand extends RenderableCommand {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return /*#__PURE__*/ React.createElement(GenerateTypes, {
|
|
13
|
-
output: output,
|
|
14
|
-
version: this.version,
|
|
15
|
-
overwriteJson: this.overwriteJson
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
constructor(...args){
|
|
19
|
-
super(...args);
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments);
|
|
20
12
|
this.output = Option.String('-o,--output', process.cwd(), {
|
|
21
13
|
description: `Where to generate the playdate.d.ts file. Defaults to the current working directory ("${process.cwd()}")`,
|
|
22
|
-
validator: t.isString()
|
|
14
|
+
validator: t.isString(),
|
|
23
15
|
});
|
|
24
16
|
this.overwriteJson = Option.Boolean('-j,--overwrite-json', false, {
|
|
25
|
-
description: 'Overwrite the JSON data file with the new data'
|
|
17
|
+
description: 'Overwrite the JSON data file with the new data',
|
|
26
18
|
});
|
|
27
19
|
this.version = Option.String({
|
|
28
20
|
name: 'version',
|
|
29
21
|
validator: t.isOneOf([
|
|
30
22
|
t.isLiteral(PlaydateSdkVersionIdentifier.Latest),
|
|
31
|
-
t.matchesRegExp(/^[0-9]+\.[0-9]+\.[0-9]+$/)
|
|
32
|
-
])
|
|
23
|
+
t.matchesRegExp(/^[0-9]+\.[0-9]+\.[0-9]+$/),
|
|
24
|
+
]),
|
|
33
25
|
});
|
|
34
26
|
}
|
|
27
|
+
render() {
|
|
28
|
+
const output = this.output.endsWith('.d.ts')
|
|
29
|
+
? this.output
|
|
30
|
+
: join(this.output, 'playdate.d.ts');
|
|
31
|
+
return (React.createElement(GenerateTypes, { output: output, version: this.version, overwriteJson: this.overwriteJson }));
|
|
32
|
+
}
|
|
35
33
|
}
|
|
36
|
-
GenerateTypesCommand.paths = [
|
|
37
|
-
[
|
|
38
|
-
'generate-types'
|
|
39
|
-
]
|
|
40
|
-
];
|
|
34
|
+
GenerateTypesCommand.paths = [['generate-types']];
|
|
41
35
|
GenerateTypesCommand.usage = Command.Usage({
|
|
42
|
-
description: 'Generate types from the Playdate SDK documentation'
|
|
36
|
+
description: 'Generate types from the Playdate SDK documentation',
|
|
43
37
|
});
|
|
44
|
-
|
|
45
38
|
//# sourceMappingURL=GenerateTypesCommand.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../libs/cli/src/commands/GenerateTypes/GenerateTypesCommand.tsx"],"
|
|
1
|
+
{"version":3,"file":"GenerateTypesCommand.js","sourceRoot":"","sources":["../../../../../../libs/cli/src/commands/GenerateTypes/GenerateTypesCommand.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,KAAK,OAAO,MAAM,cAAc,CAAC;AACxC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAC5C,OAAO,KAAK,MAAM,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C,AAAvB,CAAwB;AAC7B,0BAAK,GAAG,OAAO,CAAC,KAAK,CAAC;IAClC,WAAW,EAAE,oDAAoD;CACpE,CAAC,AAFmB,CAElB"}
|
|
@@ -5,36 +5,32 @@ import { useGenerateTypeFile } from '../../../commands/GenerateTypes/hooks/useGe
|
|
|
5
5
|
import { useGetVersion } from '../../../commands/GenerateTypes/hooks/useGetVersion.js';
|
|
6
6
|
import { useParseDocumentation } from '../../../commands/GenerateTypes/hooks/useParseDocumentation.js';
|
|
7
7
|
import { CheckList } from '../../../components/CheckList/index.js';
|
|
8
|
-
export const GenerateTypes = ({ output, version, overwriteJson })=>{
|
|
8
|
+
export const GenerateTypes = ({ output, version, overwriteJson }) => {
|
|
9
9
|
const { typeProvider, fetchedVersion, getVersion } = useGetVersion(version);
|
|
10
10
|
const { html, fetchHtml } = useFetchHtml(fetchedVersion);
|
|
11
11
|
const { definitions, parseDocumentation } = useParseDocumentation(html, version);
|
|
12
12
|
const { generateTypeFile } = useGenerateTypeFile(output, definitions, typeProvider);
|
|
13
13
|
const { formatTypeFile } = useFormatTypeFile(output);
|
|
14
|
-
const items = useMemo(()=>{
|
|
14
|
+
const items = useMemo(() => {
|
|
15
15
|
return [
|
|
16
16
|
getVersion,
|
|
17
17
|
fetchHtml,
|
|
18
18
|
parseDocumentation,
|
|
19
19
|
generateTypeFile,
|
|
20
|
-
formatTypeFile
|
|
20
|
+
formatTypeFile,
|
|
21
21
|
];
|
|
22
22
|
}, [
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
formatTypeFile,
|
|
24
|
+
getVersion,
|
|
25
|
+
parseDocumentation,
|
|
26
|
+
generateTypeFile,
|
|
27
|
+
fetchHtml,
|
|
28
28
|
]);
|
|
29
|
-
return
|
|
30
|
-
items: items,
|
|
31
|
-
onFinish: ()=>{
|
|
29
|
+
return (React.createElement(CheckList, { items: items, onFinish: () => {
|
|
32
30
|
if (overwriteJson) {
|
|
33
|
-
typeProvider
|
|
31
|
+
typeProvider === null || typeProvider === void 0 ? void 0 : typeProvider.save();
|
|
34
32
|
}
|
|
35
33
|
process.exit();
|
|
36
|
-
}
|
|
37
|
-
});
|
|
34
|
+
} }));
|
|
38
35
|
};
|
|
39
|
-
|
|
40
36
|
//# sourceMappingURL=GenerateTypes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"
|
|
1
|
+
{"version":3,"file":"GenerateTypes.js","sourceRoot":"","sources":["../../../../../../../libs/cli/src/commands/GenerateTypes/components/GenerateTypes.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,EAAE,YAAY,EAAE,MAAM,oDAAoD,CAAC;AAClF,OAAO,EAAE,iBAAiB,EAAE,MAAM,yDAAyD,CAAC;AAC5F,OAAO,EAAE,mBAAmB,EAAE,MAAM,2DAA2D,CAAC;AAChG,OAAO,EAAE,aAAa,EAAE,MAAM,qDAAqD,CAAC;AACpF,OAAO,EAAE,qBAAqB,EAAE,MAAM,6DAA6D,CAAC;AACpG,OAAO,EAAE,SAAS,EAAE,MAAM,qCAAqC,CAAC;AAShE,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,aAAa,EAAS,EAAE,EAAE;IACvE,MAAM,EAAE,YAAY,EAAE,cAAc,EAAE,UAAU,EAAE,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;IAC5E,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,YAAY,CAAC,cAAc,CAAC,CAAC;IACzD,MAAM,EAAE,WAAW,EAAE,kBAAkB,EAAE,GAAG,qBAAqB,CAC7D,IAAI,EACJ,OAAO,CACV,CAAC;IACF,MAAM,EAAE,gBAAgB,EAAE,GAAG,mBAAmB,CAC5C,MAAM,EACN,WAAW,EACX,YAAY,CACf,CAAC;IACF,MAAM,EAAE,cAAc,EAAE,GAAG,iBAAiB,CAAC,MAAM,CAAC,CAAC;IAErD,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,EAAE;QACvB,OAAO;YACH,UAAU;YACV,SAAS;YACT,kBAAkB;YAClB,gBAAgB;YAChB,cAAc;SACW,CAAC;IAClC,CAAC,EAAE;QACC,cAAc;QACd,UAAU;QACV,kBAAkB;QAClB,gBAAgB;QAChB,SAAS;KACZ,CAAC,CAAC;IAEH,OAAO,CACH,oBAAC,SAAS,IACN,KAAK,EAAE,KAAK,EACZ,QAAQ,EAAE,GAAG,EAAE;YACX,IAAI,aAAa,EAAE,CAAC;gBAChB,YAAY,aAAZ,YAAY,uBAAZ,YAAY,CAAE,IAAI,EAAE,CAAC;YACzB,CAAC;YAED,OAAO,CAAC,IAAI,EAAE,CAAC;QACnB,CAAC,GACH,CACL,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../libs/cli/src/commands/GenerateTypes/constants.ts"],"
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../../../../libs/cli/src/commands/GenerateTypes/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,cAAc,GAAG,wBAAwB,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { ApiDefinitions, FunctionDescription,
|
|
1
|
+
import type { ApiDefinitions, FunctionDescription, FunctionTypeOverrideMap, PropertyDescription } from '../../../types.js';
|
|
2
2
|
export declare const getApiDefinitions: (functions: FunctionDescription[], properties: PropertyDescription[], functionTypeOverride: FunctionTypeOverrideMap) => ApiDefinitions;
|
|
@@ -1,39 +1,37 @@
|
|
|
1
|
-
export const getApiDefinitions = (functions, properties, functionTypeOverride)=>{
|
|
1
|
+
export const getApiDefinitions = (functions, properties, functionTypeOverride) => {
|
|
2
2
|
const global = {
|
|
3
3
|
functions: [],
|
|
4
4
|
methods: [],
|
|
5
5
|
properties: [],
|
|
6
|
-
namespaces: {}
|
|
6
|
+
namespaces: {},
|
|
7
7
|
};
|
|
8
|
-
const getOrCreateNamespace = (path, root)=>{
|
|
9
|
-
return path.reduce((currentNamespace, ns)=>{
|
|
8
|
+
const getOrCreateNamespace = (path, root) => {
|
|
9
|
+
return path.reduce((currentNamespace, ns) => {
|
|
10
10
|
if (!currentNamespace.namespaces[ns]) {
|
|
11
11
|
currentNamespace.namespaces[ns] = {
|
|
12
12
|
functions: [],
|
|
13
13
|
methods: [],
|
|
14
14
|
properties: [],
|
|
15
|
-
namespaces: {}
|
|
15
|
+
namespaces: {},
|
|
16
16
|
};
|
|
17
17
|
}
|
|
18
18
|
return currentNamespace.namespaces[ns];
|
|
19
19
|
}, root);
|
|
20
20
|
};
|
|
21
|
-
functions.forEach((func)=>{
|
|
22
|
-
var
|
|
21
|
+
functions.forEach((func) => {
|
|
22
|
+
var _a;
|
|
23
23
|
const targetNamespace = getOrCreateNamespace(func.namespaces, global);
|
|
24
|
-
if (func.hasSelf || ((
|
|
24
|
+
if (func.hasSelf || ((_a = functionTypeOverride[func.signature]) === null || _a === void 0 ? void 0 : _a.isMethod)) {
|
|
25
25
|
targetNamespace.methods.push(func);
|
|
26
|
-
}
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
27
28
|
targetNamespace.functions.push(func);
|
|
28
29
|
}
|
|
29
30
|
});
|
|
30
|
-
properties.forEach((prop)=>{
|
|
31
|
+
properties.forEach((prop) => {
|
|
31
32
|
const targetNamespace = getOrCreateNamespace(prop.namespaces, global);
|
|
32
33
|
targetNamespace.properties.push(prop);
|
|
33
34
|
});
|
|
34
|
-
return {
|
|
35
|
-
global
|
|
36
|
-
};
|
|
35
|
+
return { global };
|
|
37
36
|
};
|
|
38
|
-
|
|
39
37
|
//# sourceMappingURL=getApiDefinitions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../../../../libs/cli/src/commands/GenerateTypes/fn/getApiDefinitions.ts"],"
|
|
1
|
+
{"version":3,"file":"getApiDefinit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,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;QACxB,MAAM,eAAe,GAAG,oBAAoB,CAAC,IAAI,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC;QACtE,eAAe,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;IAEH,OAAO,EAAE,MAAM,EAAE,CAAC;AACtB,CAAC,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { FunctionDescription, PropertyDescription } from '../../../types.js';
|
|
1
|
+
import type { FunctionDescription, PropertyDescription } from '../../../types.js';
|
|
2
2
|
export declare const getDescriptionsFromHtml: (html: string, version: string) => {
|
|
3
3
|
functions: FunctionDescription[];
|
|
4
4
|
properties: PropertyDescription[];
|
|
@@ -1,49 +1,59 @@
|
|
|
1
|
-
import { _ as _extends } from "@swc/helpers/_/_extends";
|
|
2
1
|
import { load } from 'cheerio';
|
|
3
2
|
import Turndown from 'turndown';
|
|
4
3
|
import { PlaydateSdkUrl } from '../../../commands/GenerateTypes/constants.js';
|
|
5
4
|
import { parseFunctionSignature } from '../../../commands/GenerateTypes/fn/parseFunctionSignature.js';
|
|
6
|
-
const extractFunctionCalls = (input)=>{
|
|
5
|
+
const extractFunctionCalls = (input) => {
|
|
7
6
|
const functionCallRegex = /([a-zA-Z_]\w*(\.[a-zA-Z_]\w*)*(?::[a-zA-Z_]\w*)?)\s*(\([^)]*\))?/g;
|
|
8
7
|
const matches = [];
|
|
9
|
-
let match;
|
|
10
|
-
while(
|
|
8
|
+
let match = functionCallRegex.exec(input);
|
|
9
|
+
while (match !== null) {
|
|
11
10
|
matches.push(match[0].trim());
|
|
11
|
+
match = functionCallRegex.exec(input);
|
|
12
12
|
}
|
|
13
13
|
return matches;
|
|
14
14
|
};
|
|
15
|
-
const normalizeSignature = (signature)=>{
|
|
15
|
+
const normalizeSignature = (signature) => {
|
|
16
16
|
const closingParenIndex = signature.indexOf(')');
|
|
17
|
-
return closingParenIndex !== -1
|
|
17
|
+
return closingParenIndex !== -1
|
|
18
|
+
? signature.slice(0, closingParenIndex + 1)
|
|
19
|
+
: signature;
|
|
18
20
|
};
|
|
19
|
-
export const getDescriptionsFromHtml = (html, version)=>{
|
|
21
|
+
export const getDescriptionsFromHtml = (html, version) => {
|
|
22
|
+
var _a, _b;
|
|
20
23
|
const $ = load(html);
|
|
21
24
|
const functionSignatures = $('[id^="m-"], [id^="f-"], [id^="c-"], [id^="v-"]').toArray();
|
|
22
25
|
const functions = [];
|
|
23
26
|
const properties = [];
|
|
24
27
|
const visitedSignatures = [];
|
|
25
28
|
const turndown = new Turndown();
|
|
26
|
-
for (const element of functionSignatures){
|
|
27
|
-
|
|
28
|
-
const id = (_$_attr = $(element).attr('id')) != null ? _$_attr : '';
|
|
29
|
+
for (const element of functionSignatures) {
|
|
30
|
+
const id = (_a = $(element).attr('id')) !== null && _a !== void 0 ? _a : '';
|
|
29
31
|
const isProperty = id.startsWith('v-');
|
|
30
32
|
const titleText = $(element).find('> .title').text();
|
|
31
|
-
if (titleText.indexOf('#') !== -1 ||
|
|
33
|
+
if (titleText.indexOf('#') !== -1 ||
|
|
34
|
+
/[a-zA-Z]\[/.test(titleText) ||
|
|
35
|
+
/^-[a-zA-Z]/.test(titleText) ||
|
|
36
|
+
/[+*/]/.test(titleText) ||
|
|
37
|
+
titleText.indexOf(' - ') !== -1 ||
|
|
38
|
+
titleText.indexOf(' .. ') !== -1) {
|
|
32
39
|
continue;
|
|
33
40
|
}
|
|
34
|
-
const titles = isProperty
|
|
35
|
-
|
|
36
|
-
|
|
41
|
+
const titles = isProperty
|
|
42
|
+
? titleText.split(' ')
|
|
43
|
+
: extractFunctionCalls(titleText);
|
|
44
|
+
let docsString = ((_b = $(element).find('.content').html()) !== null && _b !== void 0 ? _b : '').trim();
|
|
37
45
|
if (docsString.startsWith('<div class="paragraph">')) {
|
|
38
46
|
docsString = docsString.slice('<div class="paragraph">'.length);
|
|
39
47
|
}
|
|
40
48
|
if (docsString.endsWith('</div>')) {
|
|
41
49
|
docsString = docsString.slice(0, docsString.length - '</div>'.length);
|
|
42
50
|
}
|
|
43
|
-
docsString = docsString.replace(/<a href="#/g,
|
|
51
|
+
docsString = docsString.replace(/<a href="#/g, `<a href="${PlaydateSdkUrl}${version}#`);
|
|
44
52
|
docsString = turndown.turndown(docsString);
|
|
45
|
-
const baseDocs = id
|
|
46
|
-
|
|
53
|
+
const baseDocs = id
|
|
54
|
+
? `${docsString}\n\n[Read more](${PlaydateSdkUrl}${version}#${id})`
|
|
55
|
+
: docsString;
|
|
56
|
+
for (const title of titles) {
|
|
47
57
|
const signature = normalizeSignature(title);
|
|
48
58
|
if (visitedSignatures.includes(signature)) {
|
|
49
59
|
continue;
|
|
@@ -54,25 +64,23 @@ export const getDescriptionsFromHtml = (html, version)=>{
|
|
|
54
64
|
name: title.split('.').slice(-1)[0],
|
|
55
65
|
namespaces: signature.split('.').slice(0, -1),
|
|
56
66
|
signature,
|
|
57
|
-
docs: baseDocs
|
|
67
|
+
docs: baseDocs,
|
|
58
68
|
});
|
|
59
|
-
}
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
60
71
|
try {
|
|
61
72
|
const description = parseFunctionSignature(signature);
|
|
62
|
-
const docs = description.hasSelf
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}));
|
|
66
|
-
}
|
|
67
|
-
|
|
73
|
+
const docs = description.hasSelf
|
|
74
|
+
? baseDocs
|
|
75
|
+
: `${baseDocs}\n\n@noSelf`;
|
|
76
|
+
functions.push(Object.assign(Object.assign({}, description), { docs }));
|
|
77
|
+
}
|
|
78
|
+
catch (_error) {
|
|
79
|
+
// Ignore
|
|
68
80
|
}
|
|
69
81
|
}
|
|
70
82
|
}
|
|
71
83
|
}
|
|
72
|
-
return {
|
|
73
|
-
functions,
|
|
74
|
-
properties
|
|
75
|
-
};
|
|
84
|
+
return { functions, properties };
|
|
76
85
|
};
|
|
77
|
-
|
|
78
86
|
//# sourceMappingURL=getDescriptionsFromHtml.js.map
|