crankscript 0.1.2 → 0.1.5-beta

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 (156) hide show
  1. package/README.md +1 -11
  2. package/assets/package.json +4 -0
  3. package/assets/plugin.js +260 -0
  4. package/assets/plugin.ts +372 -0
  5. package/assets/tsconfig.json +10 -0
  6. package/package.json +30 -17
  7. package/src/commands/CompileCommand/CompileCommand.d.ts +8 -0
  8. package/src/commands/CompileCommand/CompileCommand.js +21 -0
  9. package/src/commands/CompileCommand/CompileCommand.js.map +1 -0
  10. package/src/commands/CompileCommand/components/Compile.d.ts +7 -0
  11. package/src/commands/CompileCommand/components/Compile.js +14 -0
  12. package/src/commands/CompileCommand/components/Compile.js.map +1 -0
  13. package/src/commands/CompileCommand/fn/getPdcPathFromEnvironment.d.ts +2 -0
  14. package/src/commands/CompileCommand/fn/getPdcPathFromEnvironment.js +6 -0
  15. package/src/commands/CompileCommand/fn/getPdcPathFromEnvironment.js.map +1 -0
  16. package/src/commands/CompileCommand/fn/getSimulatorPathFromEnvironment.d.ts +2 -0
  17. package/src/commands/CompileCommand/fn/getSimulatorPathFromEnvironment.js +6 -0
  18. package/src/commands/CompileCommand/fn/getSimulatorPathFromEnvironment.js.map +1 -0
  19. package/src/commands/CompileCommand/hooks/useCompileTasks.d.ts +2 -0
  20. package/src/commands/CompileCommand/hooks/useCompileTasks.js +60 -0
  21. package/src/commands/CompileCommand/hooks/useCompileTasks.js.map +1 -0
  22. package/src/commands/CompileCommand/index.d.ts +1 -0
  23. package/src/commands/CompileCommand/index.js +3 -0
  24. package/src/commands/CompileCommand/index.js.map +1 -0
  25. package/src/commands/DoctorCommand.d.ts +7 -0
  26. package/src/commands/DoctorCommand.js +26 -0
  27. package/src/commands/DoctorCommand.js.map +1 -0
  28. package/src/commands/EnvironmentAwareCommand/EnvironmentAwareCommand.d.ts +9 -0
  29. package/src/commands/EnvironmentAwareCommand/EnvironmentAwareCommand.js +25 -0
  30. package/src/commands/EnvironmentAwareCommand/EnvironmentAwareCommand.js.map +1 -0
  31. package/src/commands/EnvironmentAwareCommand/components/HealthReport.d.ts +7 -0
  32. package/src/commands/EnvironmentAwareCommand/components/HealthReport.js +41 -0
  33. package/src/commands/EnvironmentAwareCommand/components/HealthReport.js.map +1 -0
  34. package/src/commands/EnvironmentAwareCommand/index.d.ts +1 -0
  35. package/src/commands/EnvironmentAwareCommand/index.js +3 -0
  36. package/src/commands/EnvironmentAwareCommand/index.js.map +1 -0
  37. package/src/commands/GenerateTypes/GenerateTypesCommand.d.ts +10 -0
  38. package/src/commands/GenerateTypes/GenerateTypesCommand.js +45 -0
  39. package/src/commands/GenerateTypes/GenerateTypesCommand.js.map +1 -0
  40. package/src/commands/GenerateTypes/components/GenerateTypes.d.ts +9 -0
  41. package/src/commands/GenerateTypes/components/GenerateTypes.js +36 -0
  42. package/src/commands/GenerateTypes/components/GenerateTypes.js.map +1 -0
  43. package/src/commands/GenerateTypes/constants.d.ts +1 -0
  44. package/src/commands/GenerateTypes/constants.js +3 -0
  45. package/src/commands/GenerateTypes/constants.js.map +1 -0
  46. package/src/commands/GenerateTypes/fn/getApiDefinitions.d.ts +2 -0
  47. package/src/commands/GenerateTypes/fn/getApiDefinitions.js +39 -0
  48. package/src/commands/GenerateTypes/fn/getApiDefinitions.js.map +1 -0
  49. package/src/commands/GenerateTypes/fn/getDescriptionsFromHtml.d.ts +5 -0
  50. package/src/commands/GenerateTypes/fn/getDescriptionsFromHtml.js +78 -0
  51. package/src/commands/GenerateTypes/fn/getDescriptionsFromHtml.js.map +1 -0
  52. package/src/commands/GenerateTypes/fn/getFunctionTypeOverride.d.ts +1 -0
  53. package/src/commands/GenerateTypes/fn/getFunctionTypeOverride.js +7 -0
  54. package/src/commands/GenerateTypes/fn/getFunctionTypeOverride.js.map +1 -0
  55. package/src/commands/GenerateTypes/fn/getHtmlForVersion.d.ts +1 -0
  56. package/src/commands/GenerateTypes/fn/getHtmlForVersion.js +21 -0
  57. package/src/commands/GenerateTypes/fn/getHtmlForVersion.js.map +1 -0
  58. package/src/commands/GenerateTypes/fn/parseFunctionSignature.d.ts +10 -0
  59. package/src/commands/GenerateTypes/fn/parseFunctionSignature.js +22 -0
  60. package/src/commands/GenerateTypes/fn/parseFunctionSignature.js.map +1 -0
  61. package/src/commands/GenerateTypes/hooks/useFetchHtml.d.ts +12 -0
  62. package/src/commands/GenerateTypes/hooks/useFetchHtml.js +31 -0
  63. package/src/commands/GenerateTypes/hooks/useFetchHtml.js.map +1 -0
  64. package/src/commands/GenerateTypes/hooks/useGenerateTypeFile.d.ts +12 -0
  65. package/src/commands/GenerateTypes/hooks/useGenerateTypeFile.js +126 -0
  66. package/src/commands/GenerateTypes/hooks/useGenerateTypeFile.js.map +1 -0
  67. package/src/commands/GenerateTypes/hooks/useGetVersion.d.ts +53 -0
  68. package/src/commands/GenerateTypes/hooks/useGetVersion.js +52 -0
  69. package/src/commands/GenerateTypes/hooks/useGetVersion.js.map +1 -0
  70. package/src/commands/GenerateTypes/hooks/useParseDocumentation.d.ts +13 -0
  71. package/src/commands/GenerateTypes/hooks/useParseDocumentation.js +34 -0
  72. package/src/commands/GenerateTypes/hooks/useParseDocumentation.js.map +1 -0
  73. package/src/commands/GenerateTypes/index.d.ts +1 -0
  74. package/src/commands/GenerateTypes/index.js +3 -0
  75. package/src/commands/GenerateTypes/index.js.map +1 -0
  76. package/src/commands/GenerateTypes/utils/createTypeProvider.d.ts +43 -0
  77. package/src/commands/GenerateTypes/utils/createTypeProvider.js +156 -0
  78. package/src/commands/GenerateTypes/utils/createTypeProvider.js.map +1 -0
  79. package/src/commands/GenerateTypes/utils/functionTypeOverrides.d.ts +2 -0
  80. package/src/commands/GenerateTypes/utils/functionTypeOverrides.js +18 -0
  81. package/src/commands/GenerateTypes/utils/functionTypeOverrides.js.map +1 -0
  82. package/src/commands/NewCommand/NewCommand.d.ts +10 -0
  83. package/src/commands/NewCommand/NewCommand.js +35 -0
  84. package/src/commands/NewCommand/NewCommand.js.map +1 -0
  85. package/src/commands/NewCommand/components/New.d.ts +8 -0
  86. package/src/commands/NewCommand/components/New.js +26 -0
  87. package/src/commands/NewCommand/components/New.js.map +1 -0
  88. package/src/commands/RenderableCommand.d.ts +7 -0
  89. package/src/commands/RenderableCommand.js +12 -0
  90. package/src/commands/RenderableCommand.js.map +1 -0
  91. package/src/commands/SimulatorCommand/SimulatorCommand.d.ts +12 -0
  92. package/src/commands/SimulatorCommand/SimulatorCommand.js +39 -0
  93. package/src/commands/SimulatorCommand/SimulatorCommand.js.map +1 -0
  94. package/src/commands/SimulatorCommand/components/Simulator.d.ts +11 -0
  95. package/src/commands/SimulatorCommand/components/Simulator.js +80 -0
  96. package/src/commands/SimulatorCommand/components/Simulator.js.map +1 -0
  97. package/src/commands/SimulatorCommand/index.d.ts +1 -0
  98. package/src/commands/SimulatorCommand/index.js +3 -0
  99. package/src/commands/SimulatorCommand/index.js.map +1 -0
  100. package/src/commands/TranspileCommand/TranspileCommand.d.ts +9 -0
  101. package/src/commands/TranspileCommand/TranspileCommand.js +31 -0
  102. package/src/commands/TranspileCommand/TranspileCommand.js.map +1 -0
  103. package/src/commands/TranspileCommand/components/Transpile.d.ts +6 -0
  104. package/src/commands/TranspileCommand/components/Transpile.js +12 -0
  105. package/src/commands/TranspileCommand/components/Transpile.js.map +1 -0
  106. package/src/commands/TranspileCommand/fn/transpile.d.ts +1 -0
  107. package/src/commands/TranspileCommand/fn/transpile.js +19 -0
  108. package/src/commands/TranspileCommand/fn/transpile.js.map +1 -0
  109. package/src/commands/TranspileCommand/hooks/useTranspileTasks.d.ts +2 -0
  110. package/src/commands/TranspileCommand/hooks/useTranspileTasks.js +18 -0
  111. package/src/commands/TranspileCommand/hooks/useTranspileTasks.js.map +1 -0
  112. package/src/commands/TranspileCommand/index.d.ts +1 -0
  113. package/src/commands/TranspileCommand/index.js +3 -0
  114. package/src/commands/TranspileCommand/index.js.map +1 -0
  115. package/src/components/CheckList/CheckList.d.ts +8 -0
  116. package/src/components/CheckList/CheckList.js +34 -0
  117. package/src/components/CheckList/CheckList.js.map +1 -0
  118. package/src/components/CheckList/Item.d.ts +7 -0
  119. package/src/components/CheckList/Item.js +87 -0
  120. package/src/components/CheckList/Item.js.map +1 -0
  121. package/src/components/CheckList/index.d.ts +1 -0
  122. package/src/components/CheckList/index.js +3 -0
  123. package/src/components/CheckList/index.js.map +1 -0
  124. package/src/components/Spinner.d.ts +3 -0
  125. package/src/components/Spinner.js +26 -0
  126. package/src/components/Spinner.js.map +1 -0
  127. package/src/constants.d.ts +3 -0
  128. package/src/constants.js +11 -0
  129. package/src/constants.js.map +1 -0
  130. package/src/environment/createEnvironment.d.ts +12 -0
  131. package/src/environment/createEnvironment.js +37 -0
  132. package/src/environment/createEnvironment.js.map +1 -0
  133. package/src/environment/dto/Environment.d.ts +7 -0
  134. package/src/environment/dto/Environment.js +7 -0
  135. package/src/environment/dto/Environment.js.map +1 -0
  136. package/src/environment/error/EnvironmentError.d.ts +2 -0
  137. package/src/environment/error/EnvironmentError.js +4 -0
  138. package/src/environment/error/EnvironmentError.js.map +1 -0
  139. package/src/environment/path/dto/PlaydateSdkPath.d.ts +5 -0
  140. package/src/environment/path/dto/PlaydateSdkPath.js +10 -0
  141. package/src/environment/path/dto/PlaydateSdkPath.js.map +1 -0
  142. package/src/environment/path/error/PlaydateSdkPathVariableNotSetError.d.ts +4 -0
  143. package/src/environment/path/error/PlaydateSdkPathVariableNotSetError.js +8 -0
  144. package/src/environment/path/error/PlaydateSdkPathVariableNotSetError.js.map +1 -0
  145. package/src/environment/path/getPlaydateSdkPath.d.ts +14 -0
  146. package/src/environment/path/getPlaydateSdkPath.js +16 -0
  147. package/src/environment/path/getPlaydateSdkPath.js.map +1 -0
  148. package/src/index.d.ts +1 -1
  149. package/src/index.js +30 -13
  150. package/src/index.js.map +1 -1
  151. package/src/types.d.ts +96 -0
  152. package/src/types.js +16 -0
  153. package/src/types.js.map +1 -0
  154. package/src/utils/dirname.d.ts +1 -0
  155. package/src/utils/dirname.js +5 -0
  156. package/src/utils/dirname.js.map +1 -0
package/src/types.d.ts ADDED
@@ -0,0 +1,96 @@
1
+ import { ClassDeclarationStructure, FunctionDeclarationStructure, MethodDeclarationStructure, ParameterDeclarationStructure } from 'ts-morph';
2
+ import { Environment } from './environment/dto/Environment.js';
3
+ import { PlaydateSdkPath } from './environment/path/dto/PlaydateSdkPath.js';
4
+ export declare enum PlaydateSdkVersionIdentifier {
5
+ Latest = "latest"
6
+ }
7
+ export type PlaydateSdkVersion = PlaydateSdkVersionIdentifier.Latest | string;
8
+ export type EnvironmentHealthResult = {
9
+ isHealthy: true;
10
+ environment: Environment;
11
+ health: EnvironmentHealth;
12
+ } | {
13
+ isHealthy: false;
14
+ health: EnvironmentHealth;
15
+ };
16
+ export declare enum HealthCheckStatusType {
17
+ Healthy = "Healthy",
18
+ Unhealthy = "Unhealthy",
19
+ Unknown = "Unknown"
20
+ }
21
+ export type HealthCheckStatus<TArgument> = {
22
+ healthStatus: HealthCheckStatusType.Unknown | HealthCheckStatusType.Unhealthy;
23
+ } | {
24
+ healthStatus: HealthCheckStatusType.Healthy;
25
+ argument: TArgument;
26
+ };
27
+ export interface EnvironmentHealth {
28
+ sdkPathKnown: HealthCheckStatus<PlaydateSdkPath>;
29
+ }
30
+ export type CheckListItem<TResult> = {
31
+ runningDescription: string;
32
+ waitingDescription: string;
33
+ errorDescription: string;
34
+ finishedDescription: (result: TResult) => string;
35
+ runner: () => Promise<TResult> | Promise<false>;
36
+ onFinish?: (result: TResult) => void;
37
+ ready?: boolean;
38
+ };
39
+ export interface ParameterDescription {
40
+ name: string;
41
+ required: boolean;
42
+ }
43
+ export interface PropertyDescription {
44
+ signature: string;
45
+ name: string;
46
+ namespaces: string[];
47
+ docs: string;
48
+ }
49
+ export interface FunctionDescription {
50
+ signature: string;
51
+ name: string;
52
+ namespaces: string[];
53
+ parameters: ParameterDescription[];
54
+ hasSelf: boolean;
55
+ docs: string;
56
+ }
57
+ export interface ApiObject {
58
+ functions: FunctionDescription[];
59
+ methods: FunctionDescription[];
60
+ properties: PropertyDescription[];
61
+ namespaces: Record<string, ApiObject>;
62
+ }
63
+ export interface ApiDefinitions {
64
+ global: ApiObject;
65
+ }
66
+ export interface ParameterDetails {
67
+ name: string;
68
+ type: string;
69
+ overrideOptions?: Partial<Omit<ParameterDeclarationStructure, 'kind' | 'name' | 'type'>>;
70
+ }
71
+ export interface PropertyDetails {
72
+ signature: string;
73
+ type: string;
74
+ isStatic?: boolean;
75
+ isReadOnly?: boolean;
76
+ }
77
+ export interface FunctionDetails {
78
+ signature: string;
79
+ parameters: ParameterDetails[];
80
+ returnType: string;
81
+ overrideParameters?: boolean;
82
+ overrideOptions?: Partial<FunctionDeclarationStructure | MethodDeclarationStructure>;
83
+ }
84
+ export type TypeProviderData = {
85
+ globalStatements: string[];
86
+ statements: string[];
87
+ classes: Record<string, Partial<ClassDeclarationStructure>>;
88
+ properties: Record<string, PropertyDetails>;
89
+ functions: Record<string, FunctionDetails>;
90
+ };
91
+ export type FunctionTypeOverrideMap = Record<string, {
92
+ isMethod: boolean;
93
+ }>;
94
+ export declare enum TemplateName {
95
+ Blank = "blank"
96
+ }
package/src/types.js ADDED
@@ -0,0 +1,16 @@
1
+ export var PlaydateSdkVersionIdentifier;
2
+ (function(PlaydateSdkVersionIdentifier) {
3
+ PlaydateSdkVersionIdentifier["Latest"] = "latest";
4
+ })(PlaydateSdkVersionIdentifier || (PlaydateSdkVersionIdentifier = {}));
5
+ export var HealthCheckStatusType;
6
+ (function(HealthCheckStatusType) {
7
+ HealthCheckStatusType["Healthy"] = "Healthy";
8
+ HealthCheckStatusType["Unhealthy"] = "Unhealthy";
9
+ HealthCheckStatusType["Unknown"] = "Unknown";
10
+ })(HealthCheckStatusType || (HealthCheckStatusType = {}));
11
+ export var TemplateName;
12
+ (function(TemplateName) {
13
+ TemplateName["Blank"] = "blank";
14
+ })(TemplateName || (TemplateName = {}));
15
+
16
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../libs/cli/src/types.ts"],"sourcesContent":["import {\n ClassDeclarationStructure,\n FunctionDeclarationStructure,\n MethodDeclarationStructure,\n ParameterDeclarationStructure,\n} from 'ts-morph';\nimport { Environment } from '@/cli/environment/dto/Environment.js';\nimport { PlaydateSdkPath } from '@/cli/environment/path/dto/PlaydateSdkPath.js';\n\nexport enum PlaydateSdkVersionIdentifier {\n Latest = 'latest',\n}\n\nexport type PlaydateSdkVersion = PlaydateSdkVersionIdentifier.Latest | string;\n\nexport type EnvironmentHealthResult =\n | {\n isHealthy: true;\n environment: Environment;\n health: EnvironmentHealth;\n }\n | {\n isHealthy: false;\n health: EnvironmentHealth;\n };\n\nexport enum HealthCheckStatusType {\n Healthy = 'Healthy',\n Unhealthy = 'Unhealthy',\n Unknown = 'Unknown',\n}\n\nexport type HealthCheckStatus<TArgument> =\n | {\n healthStatus:\n | HealthCheckStatusType.Unknown\n | HealthCheckStatusType.Unhealthy;\n }\n | {\n healthStatus: HealthCheckStatusType.Healthy;\n argument: TArgument;\n };\n\nexport interface EnvironmentHealth {\n sdkPathKnown: HealthCheckStatus<PlaydateSdkPath>;\n}\n\nexport type CheckListItem<TResult> = {\n runningDescription: string;\n waitingDescription: string;\n errorDescription: string;\n finishedDescription: (result: TResult) => string;\n runner: () => Promise<TResult> | Promise<false>;\n onFinish?: (result: TResult) => void;\n ready?: boolean;\n};\n\nexport interface ParameterDescription {\n name: string;\n required: boolean;\n}\n\nexport interface PropertyDescription {\n signature: string;\n name: string;\n namespaces: string[];\n docs: string;\n}\n\nexport interface FunctionDescription {\n signature: string;\n name: string;\n namespaces: string[];\n parameters: ParameterDescription[];\n hasSelf: boolean;\n docs: string;\n}\n\nexport interface ApiObject {\n functions: FunctionDescription[];\n methods: FunctionDescription[];\n properties: PropertyDescription[];\n namespaces: Record<string, ApiObject>;\n}\n\nexport interface ApiDefinitions {\n global: ApiObject;\n}\n\nexport interface ParameterDetails {\n name: string;\n type: string;\n overrideOptions?: Partial<\n Omit<ParameterDeclarationStructure, 'kind' | 'name' | 'type'>\n >;\n}\n\nexport interface PropertyDetails {\n signature: string;\n type: string;\n isStatic?: boolean;\n isReadOnly?: boolean;\n}\n\nexport interface FunctionDetails {\n signature: string;\n parameters: ParameterDetails[];\n returnType: string;\n overrideParameters?: boolean;\n overrideOptions?: Partial<\n FunctionDeclarationStructure | MethodDeclarationStructure\n >;\n}\n\nexport type TypeProviderData = {\n globalStatements: string[];\n statements: string[];\n classes: Record<string, Partial<ClassDeclarationStructure>>;\n properties: Record<string, PropertyDetails>;\n functions: Record<string, FunctionDetails>;\n};\n\nexport type FunctionTypeOverrideMap = Record<string, { isMethod: boolean }>;\n\nexport enum TemplateName {\n Blank = 'blank',\n}\n"],"names":["PlaydateSdkVersionIdentifier","HealthCheckStatusType","TemplateName"],"rangeMappings":";;;;;;;;;;;;;","mappings":";UASYA;;GAAAA,iCAAAA;;UAiBAC;;;;GAAAA,0BAAAA;;UAkGAC;;GAAAA,iBAAAA"}
@@ -0,0 +1 @@
1
+ export declare const __dirname: string;
@@ -0,0 +1,5 @@
1
+ import { dirname } from 'node:path';
2
+ import { fileURLToPath } from 'node:url';
3
+ export const __dirname = dirname(fileURLToPath(import.meta.url));
4
+
5
+ //# sourceMappingURL=dirname.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../libs/cli/src/utils/dirname.ts"],"sourcesContent":["import { dirname } from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\nexport const __dirname = dirname(fileURLToPath(import.meta.url));\n"],"names":["dirname","fileURLToPath","__dirname","url"],"rangeMappings":";;","mappings":"AAAA,SAASA,OAAO,QAAQ,YAAY;AACpC,SAASC,aAAa,QAAQ,WAAW;AAEzC,OAAO,MAAMC,YAAYF,QAAQC,cAAc,YAAYE,GAAG,GAAG"}