crankscript 0.4.1 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/package.json +2 -3
  2. package/src/commands/DoctorCommand.js +1 -1
  3. package/src/commands/DoctorCommand.js.map +1 -1
  4. package/src/commands/EnvironmentAwareCommand/EnvironmentAwareCommand.js +1 -1
  5. package/src/commands/EnvironmentAwareCommand/EnvironmentAwareCommand.js.map +1 -1
  6. package/src/commands/EnvironmentAwareCommand/components/HealthReport.d.ts +3 -3
  7. package/src/commands/EnvironmentAwareCommand/components/HealthReport.js +16 -22
  8. package/src/commands/EnvironmentAwareCommand/components/HealthReport.js.map +1 -1
  9. package/src/commands/GenerateTypes/GenerateTypesCommand.d.ts +4 -4
  10. package/src/commands/GenerateTypes/GenerateTypesCommand.js +14 -8
  11. package/src/commands/GenerateTypes/GenerateTypesCommand.js.map +1 -1
  12. package/src/commands/GenerateTypes/components/GenerateTypes.d.ts +4 -3
  13. package/src/commands/GenerateTypes/components/GenerateTypes.js +7 -3
  14. package/src/commands/GenerateTypes/components/GenerateTypes.js.map +1 -1
  15. package/src/commands/GenerateTypes/fn/generateNamespace.d.ts +3 -0
  16. package/src/commands/GenerateTypes/fn/generateNamespace.js +33 -0
  17. package/src/commands/GenerateTypes/fn/generateNamespace.js.map +1 -0
  18. package/src/commands/GenerateTypes/fn/getApiDefinitions.d.ts +14 -0
  19. package/src/commands/GenerateTypes/fn/getApiDefinitions.js +58 -0
  20. package/src/commands/GenerateTypes/fn/getApiDefinitions.js.map +1 -0
  21. package/src/commands/GenerateTypes/fn/getFunctionDescriptionsFromHtml.d.ts +2 -0
  22. package/src/commands/GenerateTypes/fn/getFunctionDescriptionsFromHtml.js +37 -0
  23. package/src/commands/GenerateTypes/fn/getFunctionDescriptionsFromHtml.js.map +1 -0
  24. package/src/commands/GenerateTypes/fn/parseFunctionSignature.d.ts +10 -0
  25. package/src/commands/GenerateTypes/fn/parseFunctionSignature.js +24 -0
  26. package/src/commands/GenerateTypes/fn/parseFunctionSignature.js.map +1 -0
  27. package/src/commands/GenerateTypes/hooks/useGenerateTypeFile.d.ts +2 -1
  28. package/src/commands/GenerateTypes/hooks/useGenerateTypeFile.js +29 -9
  29. package/src/commands/GenerateTypes/hooks/useGenerateTypeFile.js.map +1 -1
  30. package/src/commands/GenerateTypes/hooks/useGetVersion.d.ts +2 -2
  31. package/src/commands/GenerateTypes/hooks/useGetVersion.js.map +1 -1
  32. package/src/commands/GenerateTypes/hooks/useParseDocumentation.d.ts +25 -0
  33. package/src/commands/GenerateTypes/hooks/useParseDocumentation.js +33 -0
  34. package/src/commands/GenerateTypes/hooks/useParseDocumentation.js.map +1 -0
  35. package/src/commands/GenerateTypes/utils/playdateConstants.d.ts +9 -0
  36. package/src/commands/GenerateTypes/utils/playdateConstants.js +134 -0
  37. package/src/commands/GenerateTypes/utils/playdateConstants.js.map +1 -0
  38. package/src/constants.d.ts +1 -0
  39. package/src/constants.js +5 -0
  40. package/src/constants.js.map +1 -1
  41. package/src/environment/createEnvironment.js +8 -24
  42. package/src/environment/createEnvironment.js.map +1 -1
  43. package/src/environment/dto/Environment.d.ts +1 -4
  44. package/src/environment/dto/Environment.js +1 -2
  45. package/src/environment/dto/Environment.js.map +1 -1
  46. package/src/types.d.ts +43 -9
  47. package/src/types.js +6 -12
  48. package/src/types.js.map +1 -1
  49. package/src/environment/configuration/ConfigurationSchema.d.ts +0 -9
  50. package/src/environment/configuration/ConfigurationSchema.js +0 -9
  51. package/src/environment/configuration/ConfigurationSchema.js.map +0 -1
  52. package/src/environment/configuration/dto/Configuration.d.ts +0 -4
  53. package/src/environment/configuration/dto/Configuration.js +0 -7
  54. package/src/environment/configuration/dto/Configuration.js.map +0 -1
  55. package/src/environment/configuration/error/ConfigurationFileNotFoundError.d.ts +0 -4
  56. package/src/environment/configuration/error/ConfigurationFileNotFoundError.js +0 -8
  57. package/src/environment/configuration/error/ConfigurationFileNotFoundError.js.map +0 -1
  58. package/src/environment/configuration/error/ConfigurationFileValidationError.d.ts +0 -5
  59. package/src/environment/configuration/error/ConfigurationFileValidationError.js +0 -8
  60. package/src/environment/configuration/error/ConfigurationFileValidationError.js.map +0 -1
  61. package/src/environment/configuration/getConfiguration.d.ts +0 -4
  62. package/src/environment/configuration/getConfiguration.js +0 -31
  63. package/src/environment/configuration/getConfiguration.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../libs/cli/src/commands/GenerateTypes/hooks/useGenerateTypeFile.ts"],"sourcesContent":["import { join } from 'node:path';\nimport { load } from 'cheerio';\nimport { useMemo } from 'react';\nimport { Project } from 'ts-morph';\nimport { CheckListItem } from '@/cli/types.js';\n\nexport const useGenerateTypeFile = (path: string, html: string | null) => {\n const generateTypeFile = useMemo(() => {\n return {\n waitingDescription: 'Waiting to generate the type file...',\n errorDescription: 'Failed to generate the type file',\n finishedDescription: () => 'Type file generated',\n runningDescription: 'Generating the type file...',\n runner: async () => {\n if (!html) {\n throw new Error('HTML is not set');\n }\n\n const project = new Project();\n const typeFile = project.createSourceFile(\n join(path, 'playdate.d.ts'),\n '',\n {\n overwrite: true,\n }\n );\n\n typeFile.addStatements(\n '/// <reference types=\"lua-types/5.4\" />'\n );\n\n const $ = load(html);\n\n typeFile.saveSync();\n },\n ready: html !== null,\n } satisfies CheckListItem<void>;\n }, [html]);\n\n return {\n generateTypeFile,\n };\n};\n"],"names":["join","load","useMemo","Project","useGenerateTypeFile","path","html","generateTypeFile","waitingDescription","errorDescription","finishedDescription","runningDescription","runner","Error","project","typeFile","createSourceFile","overwrite","addStatements","$","saveSync","ready"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,IAAI,QAAQ,YAAY;AACjC,SAASC,IAAI,QAAQ,UAAU;AAC/B,SAASC,OAAO,QAAQ,QAAQ;AAChC,SAASC,OAAO,QAAQ,WAAW;AAGnC,OAAO,MAAMC,sBAAsB,CAACC,MAAcC;IAC9C,MAAMC,mBAAmBL,QAAQ;QAC7B,OAAO;YACHM,oBAAoB;YACpBC,kBAAkB;YAClBC,qBAAqB,IAAM;YAC3BC,oBAAoB;YACpBC,QAAQ;gBACJ,IAAI,CAACN,MAAM;oBACP,MAAM,IAAIO,MAAM;gBACpB;gBAEA,MAAMC,UAAU,IAAIX;gBACpB,MAAMY,WAAWD,QAAQE,gBAAgB,CACrChB,KAAKK,MAAM,kBACX,IACA;oBACIY,WAAW;gBACf;gBAGJF,SAASG,aAAa,CAClB;gBAGJ,MAAMC,IAAIlB,KAAKK;gBAEfS,SAASK,QAAQ;YACrB;YACAC,OAAOf,SAAS;QACpB;IACJ,GAAG;QAACA;KAAK;IAET,OAAO;QACHC;IACJ;AACJ,EAAE"}
1
+ {"version":3,"sources":["../../../../../../../libs/cli/src/commands/GenerateTypes/hooks/useGenerateTypeFile.ts"],"sourcesContent":["import { useMemo } from 'react';\nimport { Project } from 'ts-morph';\nimport { generateNamespace } from '@/cli/commands/GenerateTypes/fn/generateNamespace.js';\nimport { CheckListItem, ApiDefinitions } from '@/cli/types.js';\n\nexport const useGenerateTypeFile = (\n path: string,\n definitions: ApiDefinitions | null\n) => {\n const generateTypeFile = useMemo(() => {\n return {\n waitingDescription: 'Waiting to generate the type file...',\n errorDescription: 'Failed to generate the type file',\n finishedDescription: () => 'Type file generated',\n runningDescription: 'Generating the type file...',\n runner: async () => {\n if (!definitions) {\n throw new Error('Definitions are not set');\n }\n\n const project = new Project();\n const typeFile = project.createSourceFile(path, '', {\n overwrite: true,\n });\n\n typeFile.addStatements(\n '/// <reference types=\"lua-types/5.4\" />'\n );\n\n for (const constantDefinition of definitions.constants) {\n typeFile.addEnum({\n name: constantDefinition.name,\n docs: [constantDefinition.docs],\n isConst: true,\n isExported: true,\n members: constantDefinition.values.map((value) => ({\n name: value.name,\n docs: [value.docs],\n value: value.value,\n })),\n });\n }\n\n Object.keys(definitions.namespaces).forEach((namespace) => {\n const namespaceDescription =\n definitions.namespaces[namespace];\n const namespaces = namespace.split('.');\n generateNamespace(\n typeFile,\n namespaces[0],\n namespaceDescription,\n namespaces.slice(1)\n );\n });\n\n typeFile.saveSync();\n },\n ready: definitions !== null,\n } satisfies CheckListItem<void>;\n }, [definitions]);\n\n return {\n generateTypeFile,\n };\n};\n"],"names":["useMemo","Project","generateNamespace","useGenerateTypeFile","path","definitions","generateTypeFile","waitingDescription","errorDescription","finishedDescription","runningDescription","runner","Error","project","typeFile","createSourceFile","overwrite","addStatements","constantDefinition","constants","addEnum","name","docs","isConst","isExported","members","values","map","value","Object","keys","namespaces","forEach","namespace","namespaceDescription","split","slice","saveSync","ready"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,OAAO,QAAQ,QAAQ;AAChC,SAASC,OAAO,QAAQ,WAAW;AACnC,SAASC,iBAAiB,QAAQ,uDAAuD;AAGzF,OAAO,MAAMC,sBAAsB,CAC/BC,MACAC;IAEA,MAAMC,mBAAmBN,QAAQ;QAC7B,OAAO;YACHO,oBAAoB;YACpBC,kBAAkB;YAClBC,qBAAqB,IAAM;YAC3BC,oBAAoB;YACpBC,QAAQ;gBACJ,IAAI,CAACN,aAAa;oBACd,MAAM,IAAIO,MAAM;gBACpB;gBAEA,MAAMC,UAAU,IAAIZ;gBACpB,MAAMa,WAAWD,QAAQE,gBAAgB,CAACX,MAAM,IAAI;oBAChDY,WAAW;gBACf;gBAEAF,SAASG,aAAa,CAClB;gBAGJ,KAAK,MAAMC,sBAAsBb,YAAYc,SAAS,CAAE;oBACpDL,SAASM,OAAO,CAAC;wBACbC,MAAMH,mBAAmBG,IAAI;wBAC7BC,MAAM;4BAACJ,mBAAmBI,IAAI;yBAAC;wBAC/BC,SAAS;wBACTC,YAAY;wBACZC,SAASP,mBAAmBQ,MAAM,CAACC,GAAG,CAAC,CAACC,QAAW,CAAA;gCAC/CP,MAAMO,MAAMP,IAAI;gCAChBC,MAAM;oCAACM,MAAMN,IAAI;iCAAC;gCAClBM,OAAOA,MAAMA,KAAK;4BACtB,CAAA;oBACJ;gBACJ;gBAEAC,OAAOC,IAAI,CAACzB,YAAY0B,UAAU,EAAEC,OAAO,CAAC,CAACC;oBACzC,MAAMC,uBACF7B,YAAY0B,UAAU,CAACE,UAAU;oBACrC,MAAMF,aAAaE,UAAUE,KAAK,CAAC;oBACnCjC,kBACIY,UACAiB,UAAU,CAAC,EAAE,EACbG,sBACAH,WAAWK,KAAK,CAAC;gBAEzB;gBAEAtB,SAASuB,QAAQ;YACrB;YACAC,OAAOjC,gBAAgB;QAC3B;IACJ,GAAG;QAACA;KAAY;IAEhB,OAAO;QACHC;IACJ;AACJ,EAAE"}
@@ -1,5 +1,5 @@
1
- import { ConfigurationType } from '../../../environment/configuration/ConfigurationSchema.js';
2
- export declare const useGetVersion: (version: ConfigurationType["version"]) => {
1
+ import { PlaydateSdkVersion } from '../../../types.js';
2
+ export declare const useGetVersion: (version: PlaydateSdkVersion) => {
3
3
  fetchedVersion: string | null;
4
4
  getVersion: {
5
5
  waitingDescription: string;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../libs/cli/src/commands/GenerateTypes/hooks/useGetVersion.ts"],"sourcesContent":["import { useCallback, useMemo, useState } from 'react';\nimport { PlaydateSdkUrl } from '@/cli/commands/GenerateTypes/constants.js';\nimport { ConfigurationType } from '@/cli/environment/configuration/ConfigurationSchema.js';\nimport { CheckListItem, PlaydateSdkVersionIdentifier } from '@/cli/types.js';\n\nexport const useGetVersion = (version: ConfigurationType['version']) => {\n const [result, setResult] = useState<string | null>(null);\n const fetchLastVersion = useCallback(async () => {\n const response = await fetch(PlaydateSdkUrl);\n const url = response.url;\n\n const regex = /https:\\/\\/sdk.play.date\\/([0-9]+\\.[0-9]+\\.[0-9]+)\\//;\n const match = url.match(regex);\n\n if (!match || match.length < 2) {\n throw new Error('Could not find version in URL');\n }\n\n return match[1];\n }, []);\n const validateVersion = useCallback(async (version: string) => {\n const response = await fetch(`https://sdk.play.date/${version}/`);\n\n if (!response.ok) {\n throw new Error(`Failed to fetch version ${version}`);\n }\n\n return true;\n }, []);\n\n const getVersion = useMemo(() => {\n return {\n waitingDescription: `Waiting to fetch version`,\n runningDescription: 'Fetching version...',\n errorDescription: 'Failed to fetch version',\n finishedDescription: (result) => `Fetched version ${result}`,\n runner: async () => {\n let versionLiteral = version;\n\n if (version === PlaydateSdkVersionIdentifier.Latest) {\n versionLiteral = await fetchLastVersion();\n }\n\n await validateVersion(versionLiteral);\n\n return versionLiteral;\n },\n onFinish: (result) => {\n setResult(result);\n },\n } satisfies CheckListItem<string>;\n }, []);\n\n return {\n fetchedVersion: result,\n getVersion,\n };\n};\n"],"names":["useCallback","useMemo","useState","PlaydateSdkUrl","PlaydateSdkVersionIdentifier","useGetVersion","version","result","setResult","fetchLastVersion","response","fetch","url","regex","match","length","Error","validateVersion","ok","getVersion","waitingDescription","runningDescription","errorDescription","finishedDescription","runner","versionLiteral","Latest","onFinish","fetchedVersion"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,WAAW,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,QAAQ;AACvD,SAASC,cAAc,QAAQ,4CAA4C;AAE3E,SAAwBC,4BAA4B,QAAQ,iBAAiB;AAE7E,OAAO,MAAMC,gBAAgB,CAACC;IAC1B,MAAM,CAACC,QAAQC,UAAU,GAAGN,SAAwB;IACpD,MAAMO,mBAAmBT,YAAY;QACjC,MAAMU,WAAW,MAAMC,MAAMR;QAC7B,MAAMS,MAAMF,SAASE,GAAG;QAExB,MAAMC,QAAQ;QACd,MAAMC,QAAQF,IAAIE,KAAK,CAACD;QAExB,IAAI,CAACC,SAASA,MAAMC,MAAM,GAAG,GAAG;YAC5B,MAAM,IAAIC,MAAM;QACpB;QAEA,OAAOF,KAAK,CAAC,EAAE;IACnB,GAAG,EAAE;IACL,MAAMG,kBAAkBjB,YAAY,OAAOM;QACvC,MAAMI,WAAW,MAAMC,MAAM,CAAC,sBAAsB,EAAEL,QAAQ,CAAC,CAAC;QAEhE,IAAI,CAACI,SAASQ,EAAE,EAAE;YACd,MAAM,IAAIF,MAAM,CAAC,wBAAwB,EAAEV,QAAQ,CAAC;QACxD;QAEA,OAAO;IACX,GAAG,EAAE;IAEL,MAAMa,aAAalB,QAAQ;QACvB,OAAO;YACHmB,oBAAoB,CAAC,wBAAwB,CAAC;YAC9CC,oBAAoB;YACpBC,kBAAkB;YAClBC,qBAAqB,CAAChB,SAAW,CAAC,gBAAgB,EAAEA,OAAO,CAAC;YAC5DiB,QAAQ;gBACJ,IAAIC,iBAAiBnB;gBAErB,IAAIA,YAAYF,6BAA6BsB,MAAM,EAAE;oBACjDD,iBAAiB,MAAMhB;gBAC3B;gBAEA,MAAMQ,gBAAgBQ;gBAEtB,OAAOA;YACX;YACAE,UAAU,CAACpB;gBACPC,UAAUD;YACd;QACJ;IACJ,GAAG,EAAE;IAEL,OAAO;QACHqB,gBAAgBrB;QAChBY;IACJ;AACJ,EAAE"}
1
+ {"version":3,"sources":["../../../../../../../libs/cli/src/commands/GenerateTypes/hooks/useGetVersion.ts"],"sourcesContent":["import { useCallback, useMemo, useState } from 'react';\nimport { PlaydateSdkUrl } from '@/cli/commands/GenerateTypes/constants.js';\nimport {\n CheckListItem,\n PlaydateSdkVersion,\n PlaydateSdkVersionIdentifier,\n} from '@/cli/types.js';\n\nexport const useGetVersion = (version: PlaydateSdkVersion) => {\n const [result, setResult] = useState<string | null>(null);\n const fetchLastVersion = useCallback(async () => {\n const response = await fetch(PlaydateSdkUrl);\n const url = response.url;\n\n const regex = /https:\\/\\/sdk.play.date\\/([0-9]+\\.[0-9]+\\.[0-9]+)\\//;\n const match = url.match(regex);\n\n if (!match || match.length < 2) {\n throw new Error('Could not find version in URL');\n }\n\n return match[1];\n }, []);\n const validateVersion = useCallback(async (version: string) => {\n const response = await fetch(`https://sdk.play.date/${version}/`);\n\n if (!response.ok) {\n throw new Error(`Failed to fetch version ${version}`);\n }\n\n return true;\n }, []);\n\n const getVersion = useMemo(() => {\n return {\n waitingDescription: `Waiting to fetch version`,\n runningDescription: 'Fetching version...',\n errorDescription: 'Failed to fetch version',\n finishedDescription: (result) => `Fetched version ${result}`,\n runner: async () => {\n let versionLiteral = version;\n\n if (version === PlaydateSdkVersionIdentifier.Latest) {\n versionLiteral = await fetchLastVersion();\n }\n\n await validateVersion(versionLiteral);\n\n return versionLiteral;\n },\n onFinish: (result) => {\n setResult(result);\n },\n } satisfies CheckListItem<string>;\n }, []);\n\n return {\n fetchedVersion: result,\n getVersion,\n };\n};\n"],"names":["useCallback","useMemo","useState","PlaydateSdkUrl","PlaydateSdkVersionIdentifier","useGetVersion","version","result","setResult","fetchLastVersion","response","fetch","url","regex","match","length","Error","validateVersion","ok","getVersion","waitingDescription","runningDescription","errorDescription","finishedDescription","runner","versionLiteral","Latest","onFinish","fetchedVersion"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,WAAW,EAAEC,OAAO,EAAEC,QAAQ,QAAQ,QAAQ;AACvD,SAASC,cAAc,QAAQ,4CAA4C;AAC3E,SAGIC,4BAA4B,QACzB,iBAAiB;AAExB,OAAO,MAAMC,gBAAgB,CAACC;IAC1B,MAAM,CAACC,QAAQC,UAAU,GAAGN,SAAwB;IACpD,MAAMO,mBAAmBT,YAAY;QACjC,MAAMU,WAAW,MAAMC,MAAMR;QAC7B,MAAMS,MAAMF,SAASE,GAAG;QAExB,MAAMC,QAAQ;QACd,MAAMC,QAAQF,IAAIE,KAAK,CAACD;QAExB,IAAI,CAACC,SAASA,MAAMC,MAAM,GAAG,GAAG;YAC5B,MAAM,IAAIC,MAAM;QACpB;QAEA,OAAOF,KAAK,CAAC,EAAE;IACnB,GAAG,EAAE;IACL,MAAMG,kBAAkBjB,YAAY,OAAOM;QACvC,MAAMI,WAAW,MAAMC,MAAM,CAAC,sBAAsB,EAAEL,QAAQ,CAAC,CAAC;QAEhE,IAAI,CAACI,SAASQ,EAAE,EAAE;YACd,MAAM,IAAIF,MAAM,CAAC,wBAAwB,EAAEV,QAAQ,CAAC;QACxD;QAEA,OAAO;IACX,GAAG,EAAE;IAEL,MAAMa,aAAalB,QAAQ;QACvB,OAAO;YACHmB,oBAAoB,CAAC,wBAAwB,CAAC;YAC9CC,oBAAoB;YACpBC,kBAAkB;YAClBC,qBAAqB,CAAChB,SAAW,CAAC,gBAAgB,EAAEA,OAAO,CAAC;YAC5DiB,QAAQ;gBACJ,IAAIC,iBAAiBnB;gBAErB,IAAIA,YAAYF,6BAA6BsB,MAAM,EAAE;oBACjDD,iBAAiB,MAAMhB;gBAC3B;gBAEA,MAAMQ,gBAAgBQ;gBAEtB,OAAOA;YACX;YACAE,UAAU,CAACpB;gBACPC,UAAUD;YACd;QACJ;IACJ,GAAG,EAAE;IAEL,OAAO;QACHqB,gBAAgBrB;QAChBY;IACJ;AACJ,EAAE"}
@@ -0,0 +1,25 @@
1
+ import { ApiDefinitions } from '../../../types.js';
2
+ export declare const useParseDocumentation: (html: string | null, version: string) => {
3
+ definitions: ApiDefinitions | null;
4
+ parseDocumentation: {
5
+ waitingDescription: string;
6
+ errorDescription: string;
7
+ finishedDescription: () => string;
8
+ runningDescription: string;
9
+ runner: () => Promise<{
10
+ namespaces: Record<string, import("../../../types.js").PlaydateNamespace>;
11
+ types: Record<string, import("../../../types.js").PlaydateType>;
12
+ constants: {
13
+ name: string;
14
+ values: {
15
+ name: string;
16
+ value: number;
17
+ docs: string;
18
+ }[];
19
+ docs: string;
20
+ }[];
21
+ }>;
22
+ onFinish: (result: ApiDefinitions) => void;
23
+ ready: boolean;
24
+ };
25
+ };
@@ -0,0 +1,33 @@
1
+ import { useMemo, useState } from 'react';
2
+ import { getApiDefinitions } from '../../../commands/GenerateTypes/fn/getApiDefinitions.js';
3
+ import { getFunctionDescriptionsFromHtml } from '../../../commands/GenerateTypes/fn/getFunctionDescriptionsFromHtml.js';
4
+ export const useParseDocumentation = (html, version)=>{
5
+ const [result, setResult] = useState(null);
6
+ const parseDocumentation = useMemo(()=>{
7
+ return {
8
+ waitingDescription: 'Waiting to parse the documentation...',
9
+ errorDescription: 'Failed to parse the documentation',
10
+ finishedDescription: ()=>'Documentation parsed',
11
+ runningDescription: 'Parsing the documentation...',
12
+ runner: async ()=>{
13
+ if (!html) {
14
+ throw new Error('HTML is not set');
15
+ }
16
+ const functions = getFunctionDescriptionsFromHtml(html, version);
17
+ return getApiDefinitions(functions);
18
+ },
19
+ onFinish: (result)=>{
20
+ setResult(result);
21
+ },
22
+ ready: html !== null
23
+ };
24
+ }, [
25
+ html
26
+ ]);
27
+ return {
28
+ definitions: result,
29
+ parseDocumentation
30
+ };
31
+ };
32
+
33
+ //# sourceMappingURL=useParseDocumentation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../libs/cli/src/commands/GenerateTypes/hooks/useParseDocumentation.ts"],"sourcesContent":["import { useMemo, useState } from 'react';\nimport { getApiDefinitions } from '@/cli/commands/GenerateTypes/fn/getApiDefinitions.js';\nimport { getFunctionDescriptionsFromHtml } from '@/cli/commands/GenerateTypes/fn/getFunctionDescriptionsFromHtml.js';\nimport { CheckListItem, ApiDefinitions } from '@/cli/types.js';\n\nexport const useParseDocumentation = (html: string | null, version: string) => {\n const [result, setResult] = useState<ApiDefinitions | null>(null);\n\n const parseDocumentation = useMemo(() => {\n return {\n waitingDescription: 'Waiting to parse the documentation...',\n errorDescription: 'Failed to parse the documentation',\n finishedDescription: () => 'Documentation parsed',\n runningDescription: 'Parsing the documentation...',\n runner: async () => {\n if (!html) {\n throw new Error('HTML is not set');\n }\n\n const functions = getFunctionDescriptionsFromHtml(\n html,\n version\n );\n\n return getApiDefinitions(functions);\n },\n onFinish: (result) => {\n setResult(result);\n },\n ready: html !== null,\n } satisfies CheckListItem<ApiDefinitions>;\n }, [html]);\n\n return {\n definitions: result,\n parseDocumentation,\n };\n};\n"],"names":["useMemo","useState","getApiDefinitions","getFunctionDescriptionsFromHtml","useParseDocumentation","html","version","result","setResult","parseDocumentation","waitingDescription","errorDescription","finishedDescription","runningDescription","runner","Error","functions","onFinish","ready","definitions"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,OAAO,EAAEC,QAAQ,QAAQ,QAAQ;AAC1C,SAASC,iBAAiB,QAAQ,uDAAuD;AACzF,SAASC,+BAA+B,QAAQ,qEAAqE;AAGrH,OAAO,MAAMC,wBAAwB,CAACC,MAAqBC;IACvD,MAAM,CAACC,QAAQC,UAAU,GAAGP,SAAgC;IAE5D,MAAMQ,qBAAqBT,QAAQ;QAC/B,OAAO;YACHU,oBAAoB;YACpBC,kBAAkB;YAClBC,qBAAqB,IAAM;YAC3BC,oBAAoB;YACpBC,QAAQ;gBACJ,IAAI,CAACT,MAAM;oBACP,MAAM,IAAIU,MAAM;gBACpB;gBAEA,MAAMC,YAAYb,gCACdE,MACAC;gBAGJ,OAAOJ,kBAAkBc;YAC7B;YACAC,UAAU,CAACV;gBACPC,UAAUD;YACd;YACAW,OAAOb,SAAS;QACpB;IACJ,GAAG;QAACA;KAAK;IAET,OAAO;QACHc,aAAaZ;QACbE;IACJ;AACJ,EAAE"}
@@ -0,0 +1,9 @@
1
+ export declare const playdateConstants: {
2
+ name: string;
3
+ values: {
4
+ name: string;
5
+ value: number;
6
+ docs: string;
7
+ }[];
8
+ docs: string;
9
+ }[];
@@ -0,0 +1,134 @@
1
+ export const playdateConstants = [
2
+ {
3
+ name: 'PlaydateColor',
4
+ values: [
5
+ {
6
+ name: 'Black',
7
+ value: 0,
8
+ docs: ''
9
+ },
10
+ {
11
+ name: 'White',
12
+ value: 1,
13
+ docs: ''
14
+ },
15
+ {
16
+ name: 'Clear',
17
+ value: 2,
18
+ docs: ''
19
+ },
20
+ {
21
+ name: 'XOR',
22
+ value: 4,
23
+ docs: ''
24
+ }
25
+ ],
26
+ docs: ''
27
+ },
28
+ {
29
+ name: 'PlaydateImageFlip',
30
+ values: [
31
+ {
32
+ name: 'Unflipped',
33
+ value: 0,
34
+ docs: ''
35
+ },
36
+ {
37
+ name: 'FlippedX',
38
+ value: 1,
39
+ docs: ''
40
+ },
41
+ {
42
+ name: 'FlippedY',
43
+ value: 2,
44
+ docs: ''
45
+ },
46
+ {
47
+ name: 'FlippedXY',
48
+ value: 4,
49
+ docs: ''
50
+ }
51
+ ],
52
+ docs: ''
53
+ },
54
+ {
55
+ name: 'PlaydatePolygonFill',
56
+ values: [
57
+ {
58
+ name: 'NonZero',
59
+ value: 1,
60
+ docs: ''
61
+ },
62
+ {
63
+ name: 'EvenOdd',
64
+ value: 2,
65
+ docs: ''
66
+ }
67
+ ],
68
+ docs: ''
69
+ },
70
+ {
71
+ name: 'PlaydateButton',
72
+ values: [
73
+ {
74
+ name: 'Left',
75
+ value: 1,
76
+ docs: ''
77
+ },
78
+ {
79
+ name: 'Right',
80
+ value: 2,
81
+ docs: ''
82
+ },
83
+ {
84
+ name: 'Up',
85
+ value: 4,
86
+ docs: ''
87
+ },
88
+ {
89
+ name: 'Down',
90
+ value: 8,
91
+ docs: ''
92
+ },
93
+ {
94
+ name: 'B',
95
+ value: 16,
96
+ docs: ''
97
+ },
98
+ {
99
+ name: 'A',
100
+ value: 32,
101
+ docs: ''
102
+ },
103
+ {
104
+ name: 'Menu',
105
+ value: 64,
106
+ docs: ''
107
+ },
108
+ {
109
+ name: 'Lock',
110
+ value: 124,
111
+ docs: ''
112
+ }
113
+ ],
114
+ docs: ''
115
+ },
116
+ {
117
+ name: 'PlaydateLanguage',
118
+ values: [
119
+ {
120
+ name: 'English',
121
+ value: 1,
122
+ docs: ''
123
+ },
124
+ {
125
+ name: 'Japanese',
126
+ value: 2,
127
+ docs: ''
128
+ }
129
+ ],
130
+ docs: ''
131
+ }
132
+ ];
133
+
134
+ //# sourceMappingURL=playdateConstants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../libs/cli/src/commands/GenerateTypes/utils/playdateConstants.ts"],"sourcesContent":["import { ConstantDescription } from '@/cli/types.js';\n\nexport const playdateConstants = [\n {\n name: 'PlaydateColor',\n values: [\n { name: 'Black', value: 0, docs: '' },\n { name: 'White', value: 1, docs: '' },\n { name: 'Clear', value: 2, docs: '' },\n { name: 'XOR', value: 4, docs: '' },\n ],\n docs: '',\n },\n {\n name: 'PlaydateImageFlip',\n values: [\n { name: 'Unflipped', value: 0, docs: '' },\n { name: 'FlippedX', value: 1, docs: '' },\n { name: 'FlippedY', value: 2, docs: '' },\n { name: 'FlippedXY', value: 4, docs: '' },\n ],\n docs: '',\n },\n {\n name: 'PlaydatePolygonFill',\n values: [\n { name: 'NonZero', value: 1, docs: '' },\n { name: 'EvenOdd', value: 2, docs: '' },\n ],\n docs: '',\n },\n {\n name: 'PlaydateButton',\n values: [\n { name: 'Left', value: 1, docs: '' },\n { name: 'Right', value: 2, docs: '' },\n { name: 'Up', value: 4, docs: '' },\n { name: 'Down', value: 8, docs: '' },\n { name: 'B', value: 16, docs: '' },\n { name: 'A', value: 32, docs: '' },\n { name: 'Menu', value: 64, docs: '' },\n { name: 'Lock', value: 124, docs: '' },\n ],\n docs: '',\n },\n {\n name: 'PlaydateLanguage',\n values: [\n { name: 'English', value: 1, docs: '' },\n { name: 'Japanese', value: 2, docs: '' },\n ],\n docs: '',\n },\n] satisfies ConstantDescription[];\n"],"names":["playdateConstants","name","values","value","docs"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAEA,OAAO,MAAMA,oBAAoB;IAC7B;QACIC,MAAM;QACNC,QAAQ;YACJ;gBAAED,MAAM;gBAASE,OAAO;gBAAGC,MAAM;YAAG;YACpC;gBAAEH,MAAM;gBAASE,OAAO;gBAAGC,MAAM;YAAG;YACpC;gBAAEH,MAAM;gBAASE,OAAO;gBAAGC,MAAM;YAAG;YACpC;gBAAEH,MAAM;gBAAOE,OAAO;gBAAGC,MAAM;YAAG;SACrC;QACDA,MAAM;IACV;IACA;QACIH,MAAM;QACNC,QAAQ;YACJ;gBAAED,MAAM;gBAAaE,OAAO;gBAAGC,MAAM;YAAG;YACxC;gBAAEH,MAAM;gBAAYE,OAAO;gBAAGC,MAAM;YAAG;YACvC;gBAAEH,MAAM;gBAAYE,OAAO;gBAAGC,MAAM;YAAG;YACvC;gBAAEH,MAAM;gBAAaE,OAAO;gBAAGC,MAAM;YAAG;SAC3C;QACDA,MAAM;IACV;IACA;QACIH,MAAM;QACNC,QAAQ;YACJ;gBAAED,MAAM;gBAAWE,OAAO;gBAAGC,MAAM;YAAG;YACtC;gBAAEH,MAAM;gBAAWE,OAAO;gBAAGC,MAAM;YAAG;SACzC;QACDA,MAAM;IACV;IACA;QACIH,MAAM;QACNC,QAAQ;YACJ;gBAAED,MAAM;gBAAQE,OAAO;gBAAGC,MAAM;YAAG;YACnC;gBAAEH,MAAM;gBAASE,OAAO;gBAAGC,MAAM;YAAG;YACpC;gBAAEH,MAAM;gBAAME,OAAO;gBAAGC,MAAM;YAAG;YACjC;gBAAEH,MAAM;gBAAQE,OAAO;gBAAGC,MAAM;YAAG;YACnC;gBAAEH,MAAM;gBAAKE,OAAO;gBAAIC,MAAM;YAAG;YACjC;gBAAEH,MAAM;gBAAKE,OAAO;gBAAIC,MAAM;YAAG;YACjC;gBAAEH,MAAM;gBAAQE,OAAO;gBAAIC,MAAM;YAAG;YACpC;gBAAEH,MAAM;gBAAQE,OAAO;gBAAKC,MAAM;YAAG;SACxC;QACDA,MAAM;IACV;IACA;QACIH,MAAM;QACNC,QAAQ;YACJ;gBAAED,MAAM;gBAAWE,OAAO;gBAAGC,MAAM;YAAG;YACtC;gBAAEH,MAAM;gBAAYE,OAAO;gBAAGC,MAAM;YAAG;SAC1C;QACDA,MAAM;IACV;CACH,CAAiC"}
@@ -1 +1,2 @@
1
1
  export declare const CrankscriptConfigurationFileName = "crankscript.json";
2
+ export declare const TypescriptReservedNamed: string[];
package/src/constants.js CHANGED
@@ -1,3 +1,8 @@
1
1
  export const CrankscriptConfigurationFileName = 'crankscript.json';
2
+ export const TypescriptReservedNamed = [
3
+ 'delete',
4
+ 'new',
5
+ 'function'
6
+ ];
2
7
 
3
8
  //# sourceMappingURL=constants.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../libs/cli/src/constants.ts"],"sourcesContent":["export const CrankscriptConfigurationFileName = 'crankscript.json';\n"],"names":["CrankscriptConfigurationFileName"],"rangeMappings":"","mappings":"AAAA,OAAO,MAAMA,mCAAmC,mBAAmB"}
1
+ {"version":3,"sources":["../../../../libs/cli/src/constants.ts"],"sourcesContent":["export const CrankscriptConfigurationFileName = 'crankscript.json';\nexport const TypescriptReservedNamed = ['delete', 'new', 'function'];\n"],"names":["CrankscriptConfigurationFileName","TypescriptReservedNamed"],"rangeMappings":";;;;;","mappings":"AAAA,OAAO,MAAMA,mCAAmC,mBAAmB;AACnE,OAAO,MAAMC,0BAA0B;IAAC;IAAU;IAAO;CAAW,CAAC"}
@@ -1,27 +1,11 @@
1
- import { HealthCheckStatus } from '../types.js';
2
- import { ConfigurationFileNotFoundError } from './configuration/error/ConfigurationFileNotFoundError.js';
3
- import { ConfigurationFileValidationError } from './configuration/error/ConfigurationFileValidationError.js';
4
- import { getConfiguration } from './configuration/getConfiguration.js';
1
+ import { HealthCheckStatusType } from '../types.js';
5
2
  import { Environment } from './dto/Environment.js';
6
3
  import { getPlaydateSdkPath } from './path/getPlaydateSdkPath.js';
7
4
  /**
8
5
  * Will create a configuration object from the environment.
9
6
  */ export const createEnvironment = (input)=>{
10
7
  const { environment = process.env } = input != null ? input : {};
11
- let configuration;
12
8
  let sdkPath;
13
- try {
14
- configuration = getConfiguration();
15
- } catch (error) {
16
- return {
17
- isHealthy: false,
18
- health: {
19
- configurationFilePresent: error instanceof ConfigurationFileNotFoundError ? HealthCheckStatus.Unhealthy : HealthCheckStatus.Healthy,
20
- configurationFileValid: error instanceof ConfigurationFileValidationError && !(error instanceof ConfigurationFileNotFoundError) ? HealthCheckStatus.Unhealthy : error instanceof ConfigurationFileValidationError ? HealthCheckStatus.Unhealthy : HealthCheckStatus.Unknown,
21
- sdkPathKnown: HealthCheckStatus.Unknown
22
- }
23
- };
24
- }
25
9
  try {
26
10
  sdkPath = getPlaydateSdkPath({
27
11
  environment
@@ -30,22 +14,22 @@ import { getPlaydateSdkPath } from './path/getPlaydateSdkPath.js';
30
14
  return {
31
15
  isHealthy: false,
32
16
  health: {
33
- configurationFilePresent: HealthCheckStatus.Healthy,
34
- configurationFileValid: HealthCheckStatus.Healthy,
35
- sdkPathKnown: HealthCheckStatus.Unhealthy
17
+ sdkPathKnown: {
18
+ healthStatus: HealthCheckStatusType.Unhealthy
19
+ }
36
20
  }
37
21
  };
38
22
  }
39
23
  return {
40
24
  isHealthy: true,
41
25
  environment: new Environment({
42
- configuration,
43
26
  sdkPath
44
27
  }),
45
28
  health: {
46
- configurationFilePresent: HealthCheckStatus.Healthy,
47
- configurationFileValid: HealthCheckStatus.Healthy,
48
- sdkPathKnown: HealthCheckStatus.Healthy
29
+ sdkPathKnown: {
30
+ healthStatus: HealthCheckStatusType.Healthy,
31
+ argument: sdkPath
32
+ }
49
33
  }
50
34
  };
51
35
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../libs/cli/src/environment/createEnvironment.ts"],"sourcesContent":["import { EnvironmentHealthResult, HealthCheckStatus } from '../types.js';\nimport { Configuration } from './configuration/dto/Configuration.js';\nimport { ConfigurationFileNotFoundError } from './configuration/error/ConfigurationFileNotFoundError.js';\nimport { ConfigurationFileValidationError } from './configuration/error/ConfigurationFileValidationError.js';\nimport { getConfiguration } from './configuration/getConfiguration.js';\nimport { Environment } from './dto/Environment.js';\nimport { PlaydateSdkPath } from './path/dto/PlaydateSdkPath.js';\nimport { getPlaydateSdkPath } from './path/getPlaydateSdkPath.js';\n\n/**\n * Will create a configuration object from the environment.\n */\nexport const createEnvironment = (input?: {\n /**\n * The environment to create the configuration from.\n *\n * Defaults to `process.env`.\n */\n environment: Record<string, unknown>;\n}): EnvironmentHealthResult => {\n const { environment = process.env } = input ?? {};\n let configuration: Configuration;\n let sdkPath: PlaydateSdkPath;\n\n try {\n configuration = getConfiguration();\n } catch (error) {\n return {\n isHealthy: false,\n health: {\n configurationFilePresent:\n error instanceof ConfigurationFileNotFoundError\n ? HealthCheckStatus.Unhealthy\n : HealthCheckStatus.Healthy,\n configurationFileValid:\n error instanceof ConfigurationFileValidationError &&\n !(error instanceof ConfigurationFileNotFoundError)\n ? HealthCheckStatus.Unhealthy\n : error instanceof ConfigurationFileValidationError\n ? HealthCheckStatus.Unhealthy\n : HealthCheckStatus.Unknown,\n sdkPathKnown: HealthCheckStatus.Unknown,\n },\n };\n }\n\n try {\n sdkPath = getPlaydateSdkPath({ environment });\n } catch (error) {\n return {\n isHealthy: false,\n health: {\n configurationFilePresent: HealthCheckStatus.Healthy,\n configurationFileValid: HealthCheckStatus.Healthy,\n sdkPathKnown: HealthCheckStatus.Unhealthy,\n },\n };\n }\n\n return {\n isHealthy: true,\n environment: new Environment({\n configuration,\n sdkPath,\n }),\n health: {\n configurationFilePresent: HealthCheckStatus.Healthy,\n configurationFileValid: HealthCheckStatus.Healthy,\n sdkPathKnown: HealthCheckStatus.Healthy,\n },\n };\n};\n"],"names":["HealthCheckStatus","ConfigurationFileNotFoundError","ConfigurationFileValidationError","getConfiguration","Environment","getPlaydateSdkPath","createEnvironment","input","environment","process","env","configuration","sdkPath","error","isHealthy","health","configurationFilePresent","Unhealthy","Healthy","configurationFileValid","Unknown","sdkPathKnown"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAAkCA,iBAAiB,QAAQ,cAAc;AAEzE,SAASC,8BAA8B,QAAQ,0DAA0D;AACzG,SAASC,gCAAgC,QAAQ,4DAA4D;AAC7G,SAASC,gBAAgB,QAAQ,sCAAsC;AACvE,SAASC,WAAW,QAAQ,uBAAuB;AAEnD,SAASC,kBAAkB,QAAQ,+BAA+B;AAElE;;CAEC,GACD,OAAO,MAAMC,oBAAoB,CAACC;IAQ9B,MAAM,EAAEC,cAAcC,QAAQC,GAAG,EAAE,GAAGH,gBAAAA,QAAS,CAAC;IAChD,IAAII;IACJ,IAAIC;IAEJ,IAAI;QACAD,gBAAgBR;IACpB,EAAE,OAAOU,OAAO;QACZ,OAAO;YACHC,WAAW;YACXC,QAAQ;gBACJC,0BACIH,iBAAiBZ,iCACXD,kBAAkBiB,SAAS,GAC3BjB,kBAAkBkB,OAAO;gBACnCC,wBACIN,iBAAiBX,oCACjB,CAAEW,CAAAA,iBAAiBZ,8BAA6B,IAC1CD,kBAAkBiB,SAAS,GAC3BJ,iBAAiBX,mCACjBF,kBAAkBiB,SAAS,GAC3BjB,kBAAkBoB,OAAO;gBACnCC,cAAcrB,kBAAkBoB,OAAO;YAC3C;QACJ;IACJ;IAEA,IAAI;QACAR,UAAUP,mBAAmB;YAAEG;QAAY;IAC/C,EAAE,OAAOK,OAAO;QACZ,OAAO;YACHC,WAAW;YACXC,QAAQ;gBACJC,0BAA0BhB,kBAAkBkB,OAAO;gBACnDC,wBAAwBnB,kBAAkBkB,OAAO;gBACjDG,cAAcrB,kBAAkBiB,SAAS;YAC7C;QACJ;IACJ;IAEA,OAAO;QACHH,WAAW;QACXN,aAAa,IAAIJ,YAAY;YACzBO;YACAC;QACJ;QACAG,QAAQ;YACJC,0BAA0BhB,kBAAkBkB,OAAO;YACnDC,wBAAwBnB,kBAAkBkB,OAAO;YACjDG,cAAcrB,kBAAkBkB,OAAO;QAC3C;IACJ;AACJ,EAAE"}
1
+ {"version":3,"sources":["../../../../../libs/cli/src/environment/createEnvironment.ts"],"sourcesContent":["import { EnvironmentHealthResult, HealthCheckStatusType } from '../types.js';\nimport { Environment } from './dto/Environment.js';\nimport { PlaydateSdkPath } from './path/dto/PlaydateSdkPath.js';\nimport { getPlaydateSdkPath } from './path/getPlaydateSdkPath.js';\n\n/**\n * Will create a configuration object from the environment.\n */\nexport const createEnvironment = (input?: {\n /**\n * The environment to create the configuration from.\n *\n * Defaults to `process.env`.\n */\n environment: Record<string, unknown>;\n}): EnvironmentHealthResult => {\n const { environment = process.env } = input ?? {};\n let sdkPath: PlaydateSdkPath;\n\n try {\n sdkPath = getPlaydateSdkPath({ environment });\n } catch (error) {\n return {\n isHealthy: false,\n health: {\n sdkPathKnown: { healthStatus: HealthCheckStatusType.Unhealthy },\n },\n };\n }\n\n return {\n isHealthy: true,\n environment: new Environment({\n sdkPath,\n }),\n health: {\n sdkPathKnown: {\n healthStatus: HealthCheckStatusType.Healthy,\n argument: sdkPath,\n },\n },\n };\n};\n"],"names":["HealthCheckStatusType","Environment","getPlaydateSdkPath","createEnvironment","input","environment","process","env","sdkPath","error","isHealthy","health","sdkPathKnown","healthStatus","Unhealthy","Healthy","argument"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAAkCA,qBAAqB,QAAQ,cAAc;AAC7E,SAASC,WAAW,QAAQ,uBAAuB;AAEnD,SAASC,kBAAkB,QAAQ,+BAA+B;AAElE;;CAEC,GACD,OAAO,MAAMC,oBAAoB,CAACC;IAQ9B,MAAM,EAAEC,cAAcC,QAAQC,GAAG,EAAE,GAAGH,gBAAAA,QAAS,CAAC;IAChD,IAAII;IAEJ,IAAI;QACAA,UAAUN,mBAAmB;YAAEG;QAAY;IAC/C,EAAE,OAAOI,OAAO;QACZ,OAAO;YACHC,WAAW;YACXC,QAAQ;gBACJC,cAAc;oBAAEC,cAAcb,sBAAsBc,SAAS;gBAAC;YAClE;QACJ;IACJ;IAEA,OAAO;QACHJ,WAAW;QACXL,aAAa,IAAIJ,YAAY;YACzBO;QACJ;QACAG,QAAQ;YACJC,cAAc;gBACVC,cAAcb,sBAAsBe,OAAO;gBAC3CC,UAAUR;YACd;QACJ;IACJ;AACJ,EAAE"}
@@ -1,10 +1,7 @@
1
- import { ConfigurationType } from '../configuration/ConfigurationSchema.js';
2
1
  import { PlaydateSdkPath } from '../path/dto/PlaydateSdkPath.js';
3
2
  export declare class Environment {
4
- configuration: ConfigurationType;
5
3
  sdkPath: PlaydateSdkPath;
6
- constructor({ configuration, sdkPath, }: {
7
- configuration: ConfigurationType;
4
+ constructor({ sdkPath }: {
8
5
  sdkPath: PlaydateSdkPath;
9
6
  });
10
7
  }
@@ -1,6 +1,5 @@
1
1
  export class Environment {
2
- constructor({ configuration, sdkPath }){
3
- this.configuration = configuration;
2
+ constructor({ sdkPath }){
4
3
  this.sdkPath = sdkPath;
5
4
  }
6
5
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../libs/cli/src/environment/dto/Environment.ts"],"sourcesContent":["import { ConfigurationType } from '../configuration/ConfigurationSchema.js';\nimport { PlaydateSdkPath } from '../path/dto/PlaydateSdkPath.js';\n\nexport class Environment {\n configuration: ConfigurationType;\n sdkPath: PlaydateSdkPath;\n\n public constructor({\n configuration,\n sdkPath,\n }: {\n configuration: ConfigurationType;\n sdkPath: PlaydateSdkPath;\n }) {\n this.configuration = configuration;\n this.sdkPath = sdkPath;\n }\n}\n"],"names":["Environment","configuration","sdkPath"],"rangeMappings":";;;;;","mappings":"AAGA,OAAO,MAAMA;IAIT,YAAmB,EACfC,aAAa,EACbC,OAAO,EAIV,CAAE;QACC,IAAI,CAACD,aAAa,GAAGA;QACrB,IAAI,CAACC,OAAO,GAAGA;IACnB;AACJ"}
1
+ {"version":3,"sources":["../../../../../../libs/cli/src/environment/dto/Environment.ts"],"sourcesContent":["import { PlaydateSdkPath } from '../path/dto/PlaydateSdkPath.js';\n\nexport class Environment {\n sdkPath: PlaydateSdkPath;\n\n public constructor({ sdkPath }: { sdkPath: PlaydateSdkPath }) {\n this.sdkPath = sdkPath;\n }\n}\n"],"names":["Environment","sdkPath"],"rangeMappings":";;;;","mappings":"AAEA,OAAO,MAAMA;IAGT,YAAmB,EAAEC,OAAO,EAAgC,CAAE;QAC1D,IAAI,CAACA,OAAO,GAAGA;IACnB;AACJ"}
package/src/types.d.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  import { Environment } from './environment/dto/Environment.js';
2
+ import { PlaydateSdkPath } from './environment/path/dto/PlaydateSdkPath.js';
2
3
  export declare enum PlaydateSdkVersionIdentifier {
3
- FromConfig = "FromConfig",
4
4
  Latest = "latest"
5
5
  }
6
+ export type PlaydateSdkVersion = PlaydateSdkVersionIdentifier.Latest | string;
6
7
  export type EnvironmentHealthResult = {
7
8
  isHealthy: true;
8
9
  environment: Environment;
@@ -11,19 +12,19 @@ export type EnvironmentHealthResult = {
11
12
  isHealthy: false;
12
13
  health: EnvironmentHealth;
13
14
  };
14
- export declare enum HealthCheckStatus {
15
+ export declare enum HealthCheckStatusType {
15
16
  Healthy = "Healthy",
16
17
  Unhealthy = "Unhealthy",
17
18
  Unknown = "Unknown"
18
19
  }
20
+ export type HealthCheckStatus<TArgument> = {
21
+ healthStatus: HealthCheckStatusType.Unknown | HealthCheckStatusType.Unhealthy;
22
+ } | {
23
+ healthStatus: HealthCheckStatusType.Healthy;
24
+ argument: TArgument;
25
+ };
19
26
  export interface EnvironmentHealth {
20
- configurationFilePresent: HealthCheckStatus;
21
- configurationFileValid: HealthCheckStatus;
22
- sdkPathKnown: HealthCheckStatus;
23
- }
24
- export declare enum ConfigurationFileValidationErrorType {
25
- InvalidJson = "InvalidJson",
26
- InvalidSchema = "InvalidSchema"
27
+ sdkPathKnown: HealthCheckStatus<PlaydateSdkPath>;
27
28
  }
28
29
  export type CheckListItem<TResult> = {
29
30
  runningDescription: string;
@@ -34,3 +35,36 @@ export type CheckListItem<TResult> = {
34
35
  onFinish?: (result: TResult) => void;
35
36
  ready?: boolean;
36
37
  };
38
+ export interface ParameterDescription {
39
+ name: string;
40
+ required: boolean;
41
+ type: string;
42
+ }
43
+ export interface FunctionDescription {
44
+ name: string;
45
+ namespaces: string[];
46
+ parameters: ParameterDescription[];
47
+ hasSelf: boolean;
48
+ docs: string;
49
+ }
50
+ export interface ConstantDescription {
51
+ name: string;
52
+ docs: string;
53
+ values: {
54
+ name: string;
55
+ value: number;
56
+ docs: string;
57
+ }[];
58
+ }
59
+ export interface PlaydateNamespace {
60
+ functions: FunctionDescription[];
61
+ callbacks: FunctionDescription[];
62
+ }
63
+ export interface PlaydateType {
64
+ methods: FunctionDescription[];
65
+ }
66
+ export interface ApiDefinitions {
67
+ namespaces: Record<string, PlaydateNamespace>;
68
+ types: Record<string, PlaydateType>;
69
+ constants: ConstantDescription[];
70
+ }
package/src/types.js CHANGED
@@ -1,18 +1,12 @@
1
1
  export var PlaydateSdkVersionIdentifier;
2
2
  (function(PlaydateSdkVersionIdentifier) {
3
- PlaydateSdkVersionIdentifier["FromConfig"] = "FromConfig";
4
3
  PlaydateSdkVersionIdentifier["Latest"] = "latest";
5
4
  })(PlaydateSdkVersionIdentifier || (PlaydateSdkVersionIdentifier = {}));
6
- export var HealthCheckStatus;
7
- (function(HealthCheckStatus) {
8
- HealthCheckStatus["Healthy"] = "Healthy";
9
- HealthCheckStatus["Unhealthy"] = "Unhealthy";
10
- HealthCheckStatus["Unknown"] = "Unknown";
11
- })(HealthCheckStatus || (HealthCheckStatus = {}));
12
- export var ConfigurationFileValidationErrorType;
13
- (function(ConfigurationFileValidationErrorType) {
14
- ConfigurationFileValidationErrorType["InvalidJson"] = "InvalidJson";
15
- ConfigurationFileValidationErrorType["InvalidSchema"] = "InvalidSchema";
16
- })(ConfigurationFileValidationErrorType || (ConfigurationFileValidationErrorType = {}));
5
+ export var HealthCheckStatusType;
6
+ (function(HealthCheckStatusType) {
7
+ HealthCheckStatusType["Healthy"] = "Healthy";
8
+ HealthCheckStatusType["Unhealthy"] = "Unhealthy";
9
+ HealthCheckStatusType["Unknown"] = "Unknown";
10
+ })(HealthCheckStatusType || (HealthCheckStatusType = {}));
17
11
 
18
12
  //# sourceMappingURL=types.js.map
package/src/types.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../libs/cli/src/types.ts"],"sourcesContent":["import { Environment } from '@/cli/environment/dto/Environment.js';\n\nexport enum PlaydateSdkVersionIdentifier {\n FromConfig = 'FromConfig',\n Latest = 'latest',\n}\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 HealthCheckStatus {\n Healthy = 'Healthy',\n Unhealthy = 'Unhealthy',\n Unknown = 'Unknown',\n}\n\nexport interface EnvironmentHealth {\n configurationFilePresent: HealthCheckStatus;\n configurationFileValid: HealthCheckStatus;\n sdkPathKnown: HealthCheckStatus;\n}\n\nexport enum ConfigurationFileValidationErrorType {\n InvalidJson = 'InvalidJson',\n InvalidSchema = 'InvalidSchema',\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"],"names":["PlaydateSdkVersionIdentifier","HealthCheckStatus","ConfigurationFileValidationErrorType"],"rangeMappings":";;;;;;;;;;;;;;;","mappings":";UAEYA;;;GAAAA,iCAAAA;;UAgBAC;;;;GAAAA,sBAAAA;;UAYAC;;;GAAAA,yCAAAA"}
1
+ {"version":3,"sources":["../../../../libs/cli/src/types.ts"],"sourcesContent":["import { 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 type: string;\n}\n\nexport interface FunctionDescription {\n name: string;\n namespaces: string[];\n parameters: ParameterDescription[];\n hasSelf: boolean;\n docs: string;\n}\n\nexport interface ConstantDescription {\n name: string;\n docs: string;\n values: {\n name: string;\n value: number;\n docs: string;\n }[];\n}\n\nexport interface PlaydateNamespace {\n functions: FunctionDescription[];\n callbacks: FunctionDescription[];\n}\n\nexport interface PlaydateType {\n methods: FunctionDescription[];\n}\n\nexport interface ApiDefinitions {\n namespaces: Record<string, PlaydateNamespace>;\n types: Record<string, PlaydateType>;\n constants: ConstantDescription[];\n}\n"],"names":["PlaydateSdkVersionIdentifier","HealthCheckStatusType"],"rangeMappings":";;;;;;;;;","mappings":";UAGYA;;GAAAA,iCAAAA;;UAiBAC;;;;GAAAA,0BAAAA"}
@@ -1,9 +0,0 @@
1
- import { z } from 'zod';
2
- export declare const ConfigurationSchema: z.ZodObject<{
3
- version: z.ZodUnion<[z.ZodString, z.ZodLiteral<"latest">]>;
4
- }, "strip", z.ZodTypeAny, {
5
- version: string;
6
- }, {
7
- version: string;
8
- }>;
9
- export type ConfigurationType = z.infer<typeof ConfigurationSchema>;
@@ -1,9 +0,0 @@
1
- import { z } from 'zod';
2
- export const ConfigurationSchema = z.object({
3
- version: z.union([
4
- z.string().regex(/^\d+\.\d+\.\d+$/),
5
- z.literal('latest')
6
- ])
7
- });
8
-
9
- //# sourceMappingURL=ConfigurationSchema.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../../libs/cli/src/environment/configuration/ConfigurationSchema.ts"],"sourcesContent":["import { z } from 'zod';\n\nexport const ConfigurationSchema = z.object({\n version: z.union([\n z.string().regex(/^\\d+\\.\\d+\\.\\d+$/),\n z.literal('latest'),\n ]),\n});\n\nexport type ConfigurationType = z.infer<typeof ConfigurationSchema>;\n"],"names":["z","ConfigurationSchema","object","version","union","string","regex","literal"],"rangeMappings":";;;;;;","mappings":"AAAA,SAASA,CAAC,QAAQ,MAAM;AAExB,OAAO,MAAMC,sBAAsBD,EAAEE,MAAM,CAAC;IACxCC,SAASH,EAAEI,KAAK,CAAC;QACbJ,EAAEK,MAAM,GAAGC,KAAK,CAAC;QACjBN,EAAEO,OAAO,CAAC;KACb;AACL,GAAG"}
@@ -1,4 +0,0 @@
1
- export declare class Configuration {
2
- readonly version: string;
3
- constructor(version: string);
4
- }
@@ -1,7 +0,0 @@
1
- export class Configuration {
2
- constructor(version){
3
- this.version = version;
4
- }
5
- }
6
-
7
- //# sourceMappingURL=Configuration.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../../../libs/cli/src/environment/configuration/dto/Configuration.ts"],"sourcesContent":["export class Configuration {\n public constructor(public readonly version: string) {}\n}\n"],"names":["Configuration","version"],"rangeMappings":";;;;","mappings":"AAAA,OAAO,MAAMA;IACT,YAAmB,AAAgBC,OAAe,CAAE;aAAjBA,UAAAA;IAAkB;AACzD"}
@@ -1,4 +0,0 @@
1
- import { EnvironmentError } from '../../error/EnvironmentError.js';
2
- export declare class ConfigurationFileNotFoundError extends EnvironmentError {
3
- constructor();
4
- }
@@ -1,8 +0,0 @@
1
- import { EnvironmentError } from '../../error/EnvironmentError.js';
2
- export class ConfigurationFileNotFoundError extends EnvironmentError {
3
- constructor(){
4
- super('Configuration file not found');
5
- }
6
- }
7
-
8
- //# sourceMappingURL=ConfigurationFileNotFoundError.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../../../libs/cli/src/environment/configuration/error/ConfigurationFileNotFoundError.ts"],"sourcesContent":["import { EnvironmentError } from '../../error/EnvironmentError.js';\n\nexport class ConfigurationFileNotFoundError extends EnvironmentError {\n public constructor() {\n super('Configuration file not found');\n }\n}\n"],"names":["EnvironmentError","ConfigurationFileNotFoundError"],"rangeMappings":";;;;;","mappings":"AAAA,SAASA,gBAAgB,QAAQ,kCAAkC;AAEnE,OAAO,MAAMC,uCAAuCD;IAChD,aAAqB;QACjB,KAAK,CAAC;IACV;AACJ"}
@@ -1,5 +0,0 @@
1
- import { ConfigurationFileValidationErrorType } from '../../../types.js';
2
- import { EnvironmentError } from '../../error/EnvironmentError.js';
3
- export declare class ConfigurationFileValidationError extends EnvironmentError {
4
- constructor(errorType: ConfigurationFileValidationErrorType, reason?: string);
5
- }
@@ -1,8 +0,0 @@
1
- import { EnvironmentError } from '../../error/EnvironmentError.js';
2
- export class ConfigurationFileValidationError extends EnvironmentError {
3
- constructor(errorType, reason = 'Unknown reason'){
4
- super(`Configuration file is invalid (${errorType}): ${reason}`);
5
- }
6
- }
7
-
8
- //# sourceMappingURL=ConfigurationFileValidationError.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../../../libs/cli/src/environment/configuration/error/ConfigurationFileValidationError.ts"],"sourcesContent":["import { ConfigurationFileValidationErrorType } from '../../../types.js';\nimport { EnvironmentError } from '../../error/EnvironmentError.js';\n\nexport class ConfigurationFileValidationError extends EnvironmentError {\n public constructor(\n errorType: ConfigurationFileValidationErrorType,\n reason = 'Unknown reason'\n ) {\n super(`Configuration file is invalid (${errorType}): ${reason}`);\n }\n}\n"],"names":["EnvironmentError","ConfigurationFileValidationError","errorType","reason"],"rangeMappings":";;;;;","mappings":"AACA,SAASA,gBAAgB,QAAQ,kCAAkC;AAEnE,OAAO,MAAMC,yCAAyCD;IAClD,YACIE,SAA+C,EAC/CC,SAAS,gBAAgB,CAC3B;QACE,KAAK,CAAC,CAAC,+BAA+B,EAAED,UAAU,GAAG,EAAEC,OAAO,CAAC;IACnE;AACJ"}
@@ -1,4 +0,0 @@
1
- import { Configuration } from './dto/Configuration.js';
2
- export declare const getConfiguration: (input?: {
3
- workingDirectory: string;
4
- }) => Configuration;