crankscript 0.9.11 → 0.10.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 (70) hide show
  1. package/assets/plugin.js +11 -0
  2. package/assets/plugin.ts +23 -0
  3. package/package.json +3 -1
  4. package/src/commands/CompileCommand/CompileCommand.d.ts +0 -1
  5. package/src/commands/CompileCommand/CompileCommand.js +2 -9
  6. package/src/commands/CompileCommand/CompileCommand.js.map +1 -1
  7. package/src/commands/CompileCommand/components/Compile.d.ts +1 -2
  8. package/src/commands/CompileCommand/components/Compile.js +5 -35
  9. package/src/commands/CompileCommand/components/Compile.js.map +1 -1
  10. package/src/commands/CompileCommand/fn/getPdcPathFromEnvironment.d.ts +2 -0
  11. package/src/commands/CompileCommand/fn/getPdcPathFromEnvironment.js +6 -0
  12. package/src/commands/CompileCommand/fn/getPdcPathFromEnvironment.js.map +1 -0
  13. package/src/commands/CompileCommand/hooks/useCompileTasks.d.ts +2 -0
  14. package/src/commands/CompileCommand/hooks/useCompileTasks.js +34 -0
  15. package/src/commands/CompileCommand/hooks/useCompileTasks.js.map +1 -0
  16. package/src/commands/GenerateTypes/components/GenerateTypes.js +0 -2
  17. package/src/commands/GenerateTypes/components/GenerateTypes.js.map +1 -1
  18. package/src/commands/GenerateTypes/fn/getApiDefinitions.d.ts +2 -2
  19. package/src/commands/GenerateTypes/fn/getApiDefinitions.js +3 -2
  20. package/src/commands/GenerateTypes/fn/getApiDefinitions.js.map +1 -1
  21. package/src/commands/GenerateTypes/fn/getDescriptionsFromHtml.js +4 -1
  22. package/src/commands/GenerateTypes/fn/getDescriptionsFromHtml.js.map +1 -1
  23. package/src/commands/GenerateTypes/fn/getFunctionTypeOverride.d.ts +1 -0
  24. package/src/commands/GenerateTypes/fn/getFunctionTypeOverride.js +7 -0
  25. package/src/commands/GenerateTypes/fn/getFunctionTypeOverride.js.map +1 -0
  26. package/src/commands/GenerateTypes/hooks/useParseDocumentation.js +2 -1
  27. package/src/commands/GenerateTypes/hooks/useParseDocumentation.js.map +1 -1
  28. package/src/commands/GenerateTypes/utils/functionTypeOverrides.d.ts +2 -0
  29. package/src/commands/GenerateTypes/utils/functionTypeOverrides.js +18 -0
  30. package/src/commands/GenerateTypes/utils/functionTypeOverrides.js.map +1 -0
  31. package/src/commands/NewCommand/NewCommand.d.ts +10 -0
  32. package/src/commands/NewCommand/NewCommand.js +35 -0
  33. package/src/commands/NewCommand/NewCommand.js.map +1 -0
  34. package/src/commands/NewCommand/components/New.d.ts +8 -0
  35. package/src/commands/NewCommand/components/New.js +26 -0
  36. package/src/commands/NewCommand/components/New.js.map +1 -0
  37. package/src/commands/SimulatorCommand/SimulatorCommand.d.ts +11 -0
  38. package/src/commands/SimulatorCommand/SimulatorCommand.js +35 -0
  39. package/src/commands/SimulatorCommand/SimulatorCommand.js.map +1 -0
  40. package/src/commands/SimulatorCommand/components/Simulator.d.ts +10 -0
  41. package/src/commands/SimulatorCommand/components/Simulator.js +66 -0
  42. package/src/commands/SimulatorCommand/components/Simulator.js.map +1 -0
  43. package/src/commands/SimulatorCommand/index.d.ts +1 -0
  44. package/src/commands/SimulatorCommand/index.js +3 -0
  45. package/src/commands/SimulatorCommand/index.js.map +1 -0
  46. package/src/commands/TranspileCommand/TranspileCommand.d.ts +2 -0
  47. package/src/commands/TranspileCommand/TranspileCommand.js +9 -5
  48. package/src/commands/TranspileCommand/TranspileCommand.js.map +1 -1
  49. package/src/commands/TranspileCommand/components/Transpile.d.ts +4 -2
  50. package/src/commands/TranspileCommand/components/Transpile.js +2 -30
  51. package/src/commands/TranspileCommand/components/Transpile.js.map +1 -1
  52. package/src/commands/TranspileCommand/fn/transpile.d.ts +1 -0
  53. package/src/commands/TranspileCommand/fn/transpile.js +19 -0
  54. package/src/commands/TranspileCommand/fn/transpile.js.map +1 -0
  55. package/src/commands/TranspileCommand/hooks/useTranspileTasks.d.ts +2 -0
  56. package/src/commands/TranspileCommand/hooks/useTranspileTasks.js +18 -0
  57. package/src/commands/TranspileCommand/hooks/useTranspileTasks.js.map +1 -0
  58. package/src/components/CheckList/Item.js +5 -21
  59. package/src/components/CheckList/Item.js.map +1 -1
  60. package/src/components/Spinner.d.ts +3 -0
  61. package/src/components/Spinner.js +26 -0
  62. package/src/components/Spinner.js.map +1 -0
  63. package/src/index.js +10 -1
  64. package/src/index.js.map +1 -1
  65. package/src/types.d.ts +6 -0
  66. package/src/types.js +4 -0
  67. package/src/types.js.map +1 -1
  68. package/src/hooks/useQuitOnCtrlC.d.ts +0 -1
  69. package/src/hooks/useQuitOnCtrlC.js +0 -10
  70. package/src/hooks/useQuitOnCtrlC.js.map +0 -1
@@ -0,0 +1,35 @@
1
+ import { Command, Option } from 'clipanion';
2
+ import React from 'react';
3
+ import { EnvironmentAwareCommand } from '../../commands/EnvironmentAwareCommand/index.js';
4
+ import { Simulator } from '../../commands/SimulatorCommand/components/Simulator.js';
5
+ import { projectPathOption } from '../../commands/TranspileCommand/index.js';
6
+ export class SimulatorCommand extends EnvironmentAwareCommand {
7
+ renderWithEnvironment(environment) {
8
+ return /*#__PURE__*/ React.createElement(Simulator, {
9
+ environment: environment,
10
+ path: this.projectPath,
11
+ watch: this.watch,
12
+ background: this.background
13
+ });
14
+ }
15
+ constructor(...args){
16
+ super(...args);
17
+ this.watch = Option.Boolean('-w,--watch', false, {
18
+ description: 'Watch for changes'
19
+ });
20
+ this.background = Option.Boolean('-b,--background', false, {
21
+ description: 'Do not bring simulator to foreground'
22
+ });
23
+ this.projectPath = projectPathOption;
24
+ }
25
+ }
26
+ SimulatorCommand.paths = [
27
+ [
28
+ 'simulator'
29
+ ]
30
+ ];
31
+ SimulatorCommand.usage = Command.Usage({
32
+ description: 'Transpile, compile, and run the simulator'
33
+ });
34
+
35
+ //# sourceMappingURL=SimulatorCommand.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../libs/cli/src/commands/SimulatorCommand/SimulatorCommand.tsx"],"sourcesContent":["import { Command, Option } from 'clipanion';\nimport React from 'react';\nimport { EnvironmentAwareCommand } from '@/cli/commands/EnvironmentAwareCommand/index.js';\nimport { Simulator } from '@/cli/commands/SimulatorCommand/components/Simulator.js';\nimport { projectPathOption } from '@/cli/commands/TranspileCommand/index.js';\nimport { Environment } from '@/cli/environment/dto/Environment.js';\n\nexport class SimulatorCommand extends EnvironmentAwareCommand {\n static override paths = [['simulator']];\n\n static override usage = Command.Usage({\n description: 'Transpile, compile, and run the simulator',\n });\n\n watch = Option.Boolean('-w,--watch', false, {\n description: 'Watch for changes',\n });\n\n background = Option.Boolean('-b,--background', false, {\n description: 'Do not bring simulator to foreground',\n });\n\n projectPath = projectPathOption;\n\n override renderWithEnvironment(environment: Environment) {\n return (\n <Simulator\n environment={environment}\n path={this.projectPath}\n watch={this.watch}\n background={this.background}\n />\n );\n }\n}\n"],"names":["Command","Option","React","EnvironmentAwareCommand","Simulator","projectPathOption","SimulatorCommand","renderWithEnvironment","environment","path","projectPath","watch","background","Boolean","description","paths","usage","Usage"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,OAAO,EAAEC,MAAM,QAAQ,YAAY;AAC5C,OAAOC,WAAW,QAAQ;AAC1B,SAASC,uBAAuB,QAAQ,kDAAkD;AAC1F,SAASC,SAAS,QAAQ,0DAA0D;AACpF,SAASC,iBAAiB,QAAQ,2CAA2C;AAG7E,OAAO,MAAMC,yBAAyBH;IAiBzBI,sBAAsBC,WAAwB,EAAE;QACrD,qBACI,oBAACJ;YACGI,aAAaA;YACbC,MAAM,IAAI,CAACC,WAAW;YACtBC,OAAO,IAAI,CAACA,KAAK;YACjBC,YAAY,IAAI,CAACA,UAAU;;IAGvC;;;aAnBAD,QAAQV,OAAOY,OAAO,CAAC,cAAc,OAAO;YACxCC,aAAa;QACjB;aAEAF,aAAaX,OAAOY,OAAO,CAAC,mBAAmB,OAAO;YAClDC,aAAa;QACjB;aAEAJ,cAAcL;;AAYlB;AA3BaC,iBACOS,QAAQ;IAAC;QAAC;KAAY;CAAC;AAD9BT,iBAGOU,QAAQhB,QAAQiB,KAAK,CAAC;IAClCH,aAAa;AACjB"}
@@ -0,0 +1,10 @@
1
+ import React from 'react';
2
+ import { Environment } from '../../../environment/dto/Environment.js';
3
+ interface Props {
4
+ environment: Environment;
5
+ path: string;
6
+ watch?: boolean;
7
+ background?: boolean;
8
+ }
9
+ export declare const Simulator: ({ environment, path, watch, background, }: Props) => React.JSX.Element;
10
+ export {};
@@ -0,0 +1,66 @@
1
+ import { exec } from 'node:child_process';
2
+ import { watch as watchDir } from 'node:fs';
3
+ import { join } from 'node:path';
4
+ import { StatusMessage } from '@inkjs/ui';
5
+ import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react';
6
+ import { getPdcPathFromEnvironment } from '../../../commands/CompileCommand/fn/getPdcPathFromEnvironment.js';
7
+ import { useCompileTasks } from '../../../commands/CompileCommand/hooks/useCompileTasks.js';
8
+ import { useTranspileTasks } from '../../../commands/TranspileCommand/hooks/useTranspileTasks.js';
9
+ import { CheckList } from '../../../components/CheckList/index.js';
10
+ export const Simulator = ({ environment, path, watch = false, background = false })=>{
11
+ const watcher = useRef(null);
12
+ const [isWatching, setIsWatching] = useState(false);
13
+ const [hasChanged, setHasChanged] = useState(false);
14
+ const [hasChangedMessage, setHasChangedMessage] = useState(false);
15
+ const transpileTasks = useTranspileTasks(path);
16
+ const compileTasks = useCompileTasks(getPdcPathFromEnvironment(environment));
17
+ useEffect(()=>{
18
+ if (hasChanged) {
19
+ setHasChanged(false);
20
+ }
21
+ }, [
22
+ hasChanged,
23
+ setHasChanged
24
+ ]);
25
+ const handleFinish = useCallback(()=>{
26
+ exec(`open ${background ? '--background' : ''} Source.pdx`);
27
+ if (!watch) {
28
+ process.exit();
29
+ }
30
+ setHasChangedMessage(false);
31
+ if (watcher.current) {
32
+ watcher.current.close();
33
+ }
34
+ setIsWatching(true);
35
+ watcher.current = watchDir(join(path, 'src'), {
36
+ recursive: true
37
+ }, ()=>{
38
+ setHasChanged(true);
39
+ setHasChangedMessage(true);
40
+ setIsWatching(false);
41
+ });
42
+ }, [
43
+ watch,
44
+ setHasChanged,
45
+ setIsWatching
46
+ ]);
47
+ const tasks = useMemo(()=>{
48
+ return [
49
+ ...transpileTasks,
50
+ ...compileTasks
51
+ ];
52
+ }, [
53
+ transpileTasks,
54
+ compileTasks
55
+ ]);
56
+ return /*#__PURE__*/ React.createElement(React.Fragment, null, !hasChanged && /*#__PURE__*/ React.createElement(CheckList, {
57
+ items: tasks,
58
+ onFinish: handleFinish
59
+ }), isWatching && !hasChangedMessage && /*#__PURE__*/ React.createElement(StatusMessage, {
60
+ variant: "info"
61
+ }, "Watching for changes..."), hasChangedMessage && /*#__PURE__*/ React.createElement(StatusMessage, {
62
+ variant: "info"
63
+ }, "Change detected"));
64
+ };
65
+
66
+ //# sourceMappingURL=Simulator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../libs/cli/src/commands/SimulatorCommand/components/Simulator.tsx"],"sourcesContent":["import { exec } from 'node:child_process';\nimport { FSWatcher, watch as watchDir } from 'node:fs';\nimport { join } from 'node:path';\nimport { StatusMessage } from '@inkjs/ui';\nimport React, {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { getPdcPathFromEnvironment } from '@/cli/commands/CompileCommand/fn/getPdcPathFromEnvironment.js';\nimport { useCompileTasks } from '@/cli/commands/CompileCommand/hooks/useCompileTasks.js';\nimport { useTranspileTasks } from '@/cli/commands/TranspileCommand/hooks/useTranspileTasks.js';\nimport { CheckList } from '@/cli/components/CheckList/index.js';\nimport { Environment } from '@/cli/environment/dto/Environment.js';\n\ninterface Props {\n environment: Environment;\n path: string;\n watch?: boolean;\n background?: boolean;\n}\n\nexport const Simulator = ({\n environment,\n path,\n watch = false,\n background = false,\n}: Props) => {\n const watcher = useRef<FSWatcher | null>(null);\n const [isWatching, setIsWatching] = useState(false);\n const [hasChanged, setHasChanged] = useState(false);\n const [hasChangedMessage, setHasChangedMessage] = useState(false);\n const transpileTasks = useTranspileTasks(path);\n const compileTasks = useCompileTasks(\n getPdcPathFromEnvironment(environment)\n );\n\n useEffect(() => {\n if (hasChanged) {\n setHasChanged(false);\n }\n }, [hasChanged, setHasChanged]);\n\n const handleFinish = useCallback(() => {\n exec(`open ${background ? '--background' : ''} Source.pdx`);\n\n if (!watch) {\n process.exit();\n }\n\n setHasChangedMessage(false);\n\n if (watcher.current) {\n watcher.current.close();\n }\n\n setIsWatching(true);\n\n watcher.current = watchDir(\n join(path, 'src'),\n { recursive: true },\n () => {\n setHasChanged(true);\n setHasChangedMessage(true);\n setIsWatching(false);\n }\n );\n }, [watch, setHasChanged, setIsWatching]);\n\n const tasks = useMemo(() => {\n return [...transpileTasks, ...compileTasks];\n }, [transpileTasks, compileTasks]);\n\n return (\n <>\n {!hasChanged && <CheckList items={tasks} onFinish={handleFinish} />}\n {isWatching && !hasChangedMessage && (\n <StatusMessage variant=\"info\">\n Watching for changes...\n </StatusMessage>\n )}\n {hasChangedMessage && (\n <StatusMessage variant=\"info\">Change detected</StatusMessage>\n )}\n </>\n );\n};\n"],"names":["exec","watch","watchDir","join","StatusMessage","React","useCallback","useEffect","useMemo","useRef","useState","getPdcPathFromEnvironment","useCompileTasks","useTranspileTasks","CheckList","Simulator","environment","path","background","watcher","isWatching","setIsWatching","hasChanged","setHasChanged","hasChangedMessage","setHasChangedMessage","transpileTasks","compileTasks","handleFinish","process","exit","current","close","recursive","tasks","items","onFinish","variant"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,IAAI,QAAQ,qBAAqB;AAC1C,SAAoBC,SAASC,QAAQ,QAAQ,UAAU;AACvD,SAASC,IAAI,QAAQ,YAAY;AACjC,SAASC,aAAa,QAAQ,YAAY;AAC1C,OAAOC,SACHC,WAAW,EACXC,SAAS,EACTC,OAAO,EACPC,MAAM,EACNC,QAAQ,QACL,QAAQ;AACf,SAASC,yBAAyB,QAAQ,gEAAgE;AAC1G,SAASC,eAAe,QAAQ,yDAAyD;AACzF,SAASC,iBAAiB,QAAQ,6DAA6D;AAC/F,SAASC,SAAS,QAAQ,sCAAsC;AAUhE,OAAO,MAAMC,YAAY,CAAC,EACtBC,WAAW,EACXC,IAAI,EACJhB,QAAQ,KAAK,EACbiB,aAAa,KAAK,EACd;IACJ,MAAMC,UAAUV,OAAyB;IACzC,MAAM,CAACW,YAAYC,cAAc,GAAGX,SAAS;IAC7C,MAAM,CAACY,YAAYC,cAAc,GAAGb,SAAS;IAC7C,MAAM,CAACc,mBAAmBC,qBAAqB,GAAGf,SAAS;IAC3D,MAAMgB,iBAAiBb,kBAAkBI;IACzC,MAAMU,eAAef,gBACjBD,0BAA0BK;IAG9BT,UAAU;QACN,IAAIe,YAAY;YACZC,cAAc;QAClB;IACJ,GAAG;QAACD;QAAYC;KAAc;IAE9B,MAAMK,eAAetB,YAAY;QAC7BN,KAAK,CAAC,KAAK,EAAEkB,aAAa,iBAAiB,GAAG,WAAW,CAAC;QAE1D,IAAI,CAACjB,OAAO;YACR4B,QAAQC,IAAI;QAChB;QAEAL,qBAAqB;QAErB,IAAIN,QAAQY,OAAO,EAAE;YACjBZ,QAAQY,OAAO,CAACC,KAAK;QACzB;QAEAX,cAAc;QAEdF,QAAQY,OAAO,GAAG7B,SACdC,KAAKc,MAAM,QACX;YAAEgB,WAAW;QAAK,GAClB;YACIV,cAAc;YACdE,qBAAqB;YACrBJ,cAAc;QAClB;IAER,GAAG;QAACpB;QAAOsB;QAAeF;KAAc;IAExC,MAAMa,QAAQ1B,QAAQ;QAClB,OAAO;eAAIkB;eAAmBC;SAAa;IAC/C,GAAG;QAACD;QAAgBC;KAAa;IAEjC,qBACI,0CACK,CAACL,4BAAc,oBAACR;QAAUqB,OAAOD;QAAOE,UAAUR;QAClDR,cAAc,CAACI,mCACZ,oBAACpB;QAAciC,SAAQ;OAAO,4BAIjCb,mCACG,oBAACpB;QAAciC,SAAQ;OAAO;AAI9C,EAAE"}
@@ -0,0 +1 @@
1
+ export * from './SimulatorCommand.js';
@@ -0,0 +1,3 @@
1
+ export * from './SimulatorCommand.js';
2
+
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../libs/cli/src/commands/SimulatorCommand/index.ts"],"sourcesContent":["export * from './SimulatorCommand.js';\n"],"names":[],"rangeMappings":"","mappings":"AAAA,cAAc,wBAAwB"}
@@ -1,7 +1,9 @@
1
1
  import React from 'react';
2
2
  import { RenderableCommand } from '../../commands/RenderableCommand.js';
3
+ export declare const projectPathOption: string;
3
4
  export declare class TranspileCommand extends RenderableCommand {
4
5
  static paths: string[][];
6
+ static usage: import("clipanion").Usage;
5
7
  projectPath: string;
6
8
  render(): React.JSX.Element;
7
9
  }
@@ -1,9 +1,13 @@
1
1
  import process from 'node:process';
2
- import { Option } from 'clipanion';
2
+ import { Command, Option } from 'clipanion';
3
3
  import React from 'react';
4
4
  import * as t from 'typanion';
5
5
  import { RenderableCommand } from '../../commands/RenderableCommand.js';
6
6
  import { Transpile } from '../../commands/TranspileCommand/components/Transpile.js';
7
+ export const projectPathOption = Option.String('-p,--path', process.cwd(), {
8
+ description: `Where to find the project. Defaults to the current working directory ("${process.cwd()}")`,
9
+ validator: t.isString()
10
+ });
7
11
  export class TranspileCommand extends RenderableCommand {
8
12
  render() {
9
13
  return /*#__PURE__*/ React.createElement(Transpile, {
@@ -12,10 +16,7 @@ export class TranspileCommand extends RenderableCommand {
12
16
  }
13
17
  constructor(...args){
14
18
  super(...args);
15
- this.projectPath = Option.String('-p,--path', process.cwd(), {
16
- description: `Where to find the project. Defaults to the current working directory ("${process.cwd()}")`,
17
- validator: t.isString()
18
- });
19
+ this.projectPath = projectPathOption;
19
20
  }
20
21
  }
21
22
  TranspileCommand.paths = [
@@ -23,5 +24,8 @@ TranspileCommand.paths = [
23
24
  'transpile'
24
25
  ]
25
26
  ];
27
+ TranspileCommand.usage = Command.Usage({
28
+ description: 'Transpile TypeScript files to Lua'
29
+ });
26
30
 
27
31
  //# sourceMappingURL=TranspileCommand.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../libs/cli/src/commands/TranspileCommand/TranspileCommand.tsx"],"sourcesContent":["import process from 'node:process';\nimport { Option } from 'clipanion';\nimport React from 'react';\nimport * as t from 'typanion';\nimport { RenderableCommand } from '@/cli/commands/RenderableCommand.js';\nimport { Transpile } from '@/cli/commands/TranspileCommand/components/Transpile.js';\n\nexport class TranspileCommand extends RenderableCommand {\n static override paths = [['transpile']];\n\n projectPath = Option.String('-p,--path', process.cwd(), {\n description: `Where to find the project. Defaults to the current working directory (\"${process.cwd()}\")`,\n validator: t.isString(),\n });\n\n override render() {\n return <Transpile path={this.projectPath} />;\n }\n}\n"],"names":["process","Option","React","t","RenderableCommand","Transpile","TranspileCommand","render","path","projectPath","String","cwd","description","validator","isString","paths"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,OAAOA,aAAa,eAAe;AACnC,SAASC,MAAM,QAAQ,YAAY;AACnC,OAAOC,WAAW,QAAQ;AAC1B,YAAYC,OAAO,WAAW;AAC9B,SAASC,iBAAiB,QAAQ,sCAAsC;AACxE,SAASC,SAAS,QAAQ,0DAA0D;AAEpF,OAAO,MAAMC,yBAAyBF;IAQzBG,SAAS;QACd,qBAAO,oBAACF;YAAUG,MAAM,IAAI,CAACC,WAAW;;IAC5C;;;aAPAA,cAAcR,OAAOS,MAAM,CAAC,aAAaV,QAAQW,GAAG,IAAI;YACpDC,aAAa,CAAC,uEAAuE,EAAEZ,QAAQW,GAAG,GAAG,EAAE,CAAC;YACxGE,WAAWV,EAAEW,QAAQ;QACzB;;AAKJ;AAXaR,iBACOS,QAAQ;IAAC;QAAC;KAAY;CAAC"}
1
+ {"version":3,"sources":["../../../../../../libs/cli/src/commands/TranspileCommand/TranspileCommand.tsx"],"sourcesContent":["import process from 'node:process';\nimport { Command, Option } from 'clipanion';\nimport React from 'react';\nimport * as t from 'typanion';\nimport { RenderableCommand } from '@/cli/commands/RenderableCommand.js';\nimport { Transpile } from '@/cli/commands/TranspileCommand/components/Transpile.js';\n\nexport const projectPathOption = Option.String('-p,--path', process.cwd(), {\n description: `Where to find the project. Defaults to the current working directory (\"${process.cwd()}\")`,\n validator: t.isString(),\n});\n\nexport class TranspileCommand extends RenderableCommand {\n static override paths = [['transpile']];\n\n static override usage = Command.Usage({\n description: 'Transpile TypeScript files to Lua',\n });\n\n projectPath = projectPathOption;\n\n override render() {\n return <Transpile path={this.projectPath} />;\n }\n}\n"],"names":["process","Command","Option","React","t","RenderableCommand","Transpile","projectPathOption","String","cwd","description","validator","isString","TranspileCommand","render","path","projectPath","paths","usage","Usage"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,OAAOA,aAAa,eAAe;AACnC,SAASC,OAAO,EAAEC,MAAM,QAAQ,YAAY;AAC5C,OAAOC,WAAW,QAAQ;AAC1B,YAAYC,OAAO,WAAW;AAC9B,SAASC,iBAAiB,QAAQ,sCAAsC;AACxE,SAASC,SAAS,QAAQ,0DAA0D;AAEpF,OAAO,MAAMC,oBAAoBL,OAAOM,MAAM,CAAC,aAAaR,QAAQS,GAAG,IAAI;IACvEC,aAAa,CAAC,uEAAuE,EAAEV,QAAQS,GAAG,GAAG,EAAE,CAAC;IACxGE,WAAWP,EAAEQ,QAAQ;AACzB,GAAG;AAEH,OAAO,MAAMC,yBAAyBR;IASzBS,SAAS;QACd,qBAAO,oBAACR;YAAUS,MAAM,IAAI,CAACC,WAAW;;IAC5C;;;aAJAA,cAAcT;;AAKlB;AAZaM,iBACOI,QAAQ;IAAC;QAAC;KAAY;CAAC;AAD9BJ,iBAGOK,QAAQjB,QAAQkB,KAAK,CAAC;IAClCT,aAAa;AACjB"}
@@ -1,4 +1,6 @@
1
1
  import React from 'react';
2
- export declare const Transpile: ({ path }: {
2
+ interface Props {
3
3
  path: string;
4
- }) => React.JSX.Element;
4
+ }
5
+ export declare const Transpile: ({ path }: Props) => React.JSX.Element;
6
+ export {};
@@ -1,36 +1,8 @@
1
- import { join } from 'node:path';
2
1
  import React from 'react';
3
- import { useMemo } from 'react';
4
- import * as tstl from 'typescript-to-lua';
5
- import { LuaTarget } from 'typescript-to-lua';
2
+ import { useTranspileTasks } from '../../../commands/TranspileCommand/hooks/useTranspileTasks.js';
6
3
  import { CheckList } from '../../../components/CheckList/index.js';
7
- import { RootFolder } from '../../../constants.js';
8
- const transpile = (path)=>{
9
- tstl.transpileProject(join(path, 'tsconfig.json'), {
10
- luaTarget: LuaTarget.Lua54,
11
- outDir: join(path, 'Source'),
12
- luaBundle: 'main.lua',
13
- luaBundleEntry: join(path, 'src', 'index.ts'),
14
- luaPlugins: [
15
- {
16
- name: join(RootFolder, 'assets', 'plugin.js')
17
- }
18
- ]
19
- });
20
- };
21
4
  export const Transpile = ({ path })=>{
22
- const items = useMemo(()=>[
23
- {
24
- waitingDescription: 'Waiting to transpile code...',
25
- errorDescription: 'Could not transpile code',
26
- runningDescription: 'Transpiling code...',
27
- finishedDescription: ()=>'Code transpiled',
28
- runner: async ()=>{
29
- transpile(path);
30
- },
31
- ready: true
32
- }
33
- ], []);
5
+ const items = useTranspileTasks(path);
34
6
  return /*#__PURE__*/ React.createElement(CheckList, {
35
7
  items: items,
36
8
  onFinish: process.exit
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../libs/cli/src/commands/TranspileCommand/components/Transpile.tsx"],"sourcesContent":["import { join } from 'node:path';\nimport React from 'react';\nimport { useMemo } from 'react';\nimport * as tstl from 'typescript-to-lua';\nimport { LuaTarget } from 'typescript-to-lua';\nimport { CheckList } from '@/cli/components/CheckList/index.js';\nimport { RootFolder } from '@/cli/constants.js';\nimport { CheckListItem } from '@/cli/types.js';\n\nconst transpile = (path: string) => {\n tstl.transpileProject(join(path, 'tsconfig.json'), {\n luaTarget: LuaTarget.Lua54,\n outDir: join(path, 'Source'),\n luaBundle: 'main.lua',\n luaBundleEntry: join(path, 'src', 'index.ts'),\n luaPlugins: [\n {\n name: join(RootFolder, 'assets', 'plugin.js'),\n },\n ],\n });\n};\n\nexport const Transpile = ({ path }: { path: string }) => {\n const items = useMemo(\n () => [\n {\n waitingDescription: 'Waiting to transpile code...',\n errorDescription: 'Could not transpile code',\n runningDescription: 'Transpiling code...',\n finishedDescription: () => 'Code transpiled',\n runner: async () => {\n transpile(path);\n },\n ready: true,\n },\n ],\n []\n ) as CheckListItem<unknown>[];\n\n return <CheckList items={items} onFinish={process.exit} />;\n};\n"],"names":["join","React","useMemo","tstl","LuaTarget","CheckList","RootFolder","transpile","path","transpileProject","luaTarget","Lua54","outDir","luaBundle","luaBundleEntry","luaPlugins","name","Transpile","items","waitingDescription","errorDescription","runningDescription","finishedDescription","runner","ready","onFinish","process","exit"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,IAAI,QAAQ,YAAY;AACjC,OAAOC,WAAW,QAAQ;AAC1B,SAASC,OAAO,QAAQ,QAAQ;AAChC,YAAYC,UAAU,oBAAoB;AAC1C,SAASC,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,SAAS,QAAQ,sCAAsC;AAChE,SAASC,UAAU,QAAQ,qBAAqB;AAGhD,MAAMC,YAAY,CAACC;IACfL,KAAKM,gBAAgB,CAACT,KAAKQ,MAAM,kBAAkB;QAC/CE,WAAWN,UAAUO,KAAK;QAC1BC,QAAQZ,KAAKQ,MAAM;QACnBK,WAAW;QACXC,gBAAgBd,KAAKQ,MAAM,OAAO;QAClCO,YAAY;YACR;gBACIC,MAAMhB,KAAKM,YAAY,UAAU;YACrC;SACH;IACL;AACJ;AAEA,OAAO,MAAMW,YAAY,CAAC,EAAET,IAAI,EAAoB;IAChD,MAAMU,QAAQhB,QACV,IAAM;YACF;gBACIiB,oBAAoB;gBACpBC,kBAAkB;gBAClBC,oBAAoB;gBACpBC,qBAAqB,IAAM;gBAC3BC,QAAQ;oBACJhB,UAAUC;gBACd;gBACAgB,OAAO;YACX;SACH,EACD,EAAE;IAGN,qBAAO,oBAACnB;QAAUa,OAAOA;QAAOO,UAAUC,QAAQC,IAAI;;AAC1D,EAAE"}
1
+ {"version":3,"sources":["../../../../../../../libs/cli/src/commands/TranspileCommand/components/Transpile.tsx"],"sourcesContent":["import React from 'react';\nimport { useTranspileTasks } from '@/cli/commands/TranspileCommand/hooks/useTranspileTasks.js';\nimport { CheckList } from '@/cli/components/CheckList/index.js';\n\ninterface Props {\n path: string;\n}\n\nexport const Transpile = ({ path }: Props) => {\n const items = useTranspileTasks(path);\n\n return <CheckList items={items} onFinish={process.exit} />;\n};\n"],"names":["React","useTranspileTasks","CheckList","Transpile","path","items","onFinish","process","exit"],"rangeMappings":";;;;;;;;;","mappings":"AAAA,OAAOA,WAAW,QAAQ;AAC1B,SAASC,iBAAiB,QAAQ,6DAA6D;AAC/F,SAASC,SAAS,QAAQ,sCAAsC;AAMhE,OAAO,MAAMC,YAAY,CAAC,EAAEC,IAAI,EAAS;IACrC,MAAMC,QAAQJ,kBAAkBG;IAEhC,qBAAO,oBAACF;QAAUG,OAAOA;QAAOC,UAAUC,QAAQC,IAAI;;AAC1D,EAAE"}
@@ -0,0 +1 @@
1
+ export declare const transpile: (path: string) => void;
@@ -0,0 +1,19 @@
1
+ import { join } from 'node:path';
2
+ import * as tstl from 'typescript-to-lua';
3
+ import { LuaTarget } from 'typescript-to-lua';
4
+ import { RootFolder } from '../../../constants.js';
5
+ export const transpile = (path)=>{
6
+ tstl.transpileProject(join(path, 'tsconfig.json'), {
7
+ luaTarget: LuaTarget.Lua54,
8
+ outDir: join(path, 'Source'),
9
+ luaBundle: 'main.lua',
10
+ luaBundleEntry: join(path, 'src', 'index.ts'),
11
+ luaPlugins: [
12
+ {
13
+ name: join(RootFolder, 'assets', 'plugin.js')
14
+ }
15
+ ]
16
+ });
17
+ };
18
+
19
+ //# sourceMappingURL=transpile.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../libs/cli/src/commands/TranspileCommand/fn/transpile.ts"],"sourcesContent":["import { join } from 'node:path';\nimport * as tstl from 'typescript-to-lua';\nimport { LuaTarget } from 'typescript-to-lua';\nimport { RootFolder } from '@/cli/constants.js';\n\nexport const transpile = (path: string) => {\n tstl.transpileProject(join(path, 'tsconfig.json'), {\n luaTarget: LuaTarget.Lua54,\n outDir: join(path, 'Source'),\n luaBundle: 'main.lua',\n luaBundleEntry: join(path, 'src', 'index.ts'),\n luaPlugins: [\n {\n name: join(RootFolder, 'assets', 'plugin.js'),\n },\n ],\n });\n};\n"],"names":["join","tstl","LuaTarget","RootFolder","transpile","path","transpileProject","luaTarget","Lua54","outDir","luaBundle","luaBundleEntry","luaPlugins","name"],"rangeMappings":";;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,IAAI,QAAQ,YAAY;AACjC,YAAYC,UAAU,oBAAoB;AAC1C,SAASC,SAAS,QAAQ,oBAAoB;AAC9C,SAASC,UAAU,QAAQ,qBAAqB;AAEhD,OAAO,MAAMC,YAAY,CAACC;IACtBJ,KAAKK,gBAAgB,CAACN,KAAKK,MAAM,kBAAkB;QAC/CE,WAAWL,UAAUM,KAAK;QAC1BC,QAAQT,KAAKK,MAAM;QACnBK,WAAW;QACXC,gBAAgBX,KAAKK,MAAM,OAAO;QAClCO,YAAY;YACR;gBACIC,MAAMb,KAAKG,YAAY,UAAU;YACrC;SACH;IACL;AACJ,EAAE"}
@@ -0,0 +1,2 @@
1
+ import { CheckListItem } from '../../../types.js';
2
+ export declare const useTranspileTasks: (path: string) => CheckListItem<unknown>[];
@@ -0,0 +1,18 @@
1
+ import { useMemo } from 'react';
2
+ import { transpile } from '../../../commands/TranspileCommand/fn/transpile.js';
3
+ export const useTranspileTasks = (path)=>{
4
+ return useMemo(()=>[
5
+ {
6
+ waitingDescription: 'Waiting to transpile code...',
7
+ errorDescription: 'Could not transpile code',
8
+ runningDescription: 'Transpiling code...',
9
+ finishedDescription: ()=>'Code transpiled',
10
+ runner: async ()=>{
11
+ transpile(path);
12
+ },
13
+ ready: true
14
+ }
15
+ ], []);
16
+ };
17
+
18
+ //# sourceMappingURL=useTranspileTasks.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../../../libs/cli/src/commands/TranspileCommand/hooks/useTranspileTasks.ts"],"sourcesContent":["import { useMemo } from 'react';\nimport { transpile } from '@/cli/commands/TranspileCommand/fn/transpile.js';\nimport { CheckListItem } from '@/cli/types.js';\n\nexport const useTranspileTasks = (path: string) => {\n return useMemo(\n () => [\n {\n waitingDescription: 'Waiting to transpile code...',\n errorDescription: 'Could not transpile code',\n runningDescription: 'Transpiling code...',\n finishedDescription: () => 'Code transpiled',\n runner: async () => {\n transpile(path);\n },\n ready: true,\n },\n ],\n []\n ) as CheckListItem<unknown>[];\n};\n"],"names":["useMemo","transpile","useTranspileTasks","path","waitingDescription","errorDescription","runningDescription","finishedDescription","runner","ready"],"rangeMappings":";;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,OAAO,QAAQ,QAAQ;AAChC,SAASC,SAAS,QAAQ,kDAAkD;AAG5E,OAAO,MAAMC,oBAAoB,CAACC;IAC9B,OAAOH,QACH,IAAM;YACF;gBACII,oBAAoB;gBACpBC,kBAAkB;gBAClBC,oBAAoB;gBACpBC,qBAAqB,IAAM;gBAC3BC,QAAQ;oBACJP,UAAUE;gBACd;gBACAM,OAAO;YACX;SACH,EACD,EAAE;AAEV,EAAE"}
@@ -1,21 +1,7 @@
1
- import { StatusMessage, Spinner, extendTheme, defaultTheme, ThemeProvider } from '@inkjs/ui';
1
+ import { StatusMessage } from '@inkjs/ui';
2
2
  import { Text } from 'ink';
3
3
  import React, { useEffect, useRef, useState } from 'react';
4
- // todo: possibly extract this
5
- const SpinnerTheme = extendTheme(defaultTheme, {
6
- components: {
7
- Spinner: {
8
- styles: {
9
- frame: ()=>({
10
- color: 'yellowBright'
11
- }),
12
- label: ()=>({
13
- color: 'yellowBright'
14
- })
15
- }
16
- }
17
- }
18
- });
4
+ import { Spinner } from '../../components/Spinner.js';
19
5
  export const Item = ({ item: { runningDescription, waitingDescription, errorDescription, finishedDescription, runner, onFinish, ready }, start })=>{
20
6
  const executed = useRef(false);
21
7
  const interval = useRef(null);
@@ -86,11 +72,9 @@ export const Item = ({ item: { runningDescription, waitingDescription, errorDesc
86
72
  variant = 'success';
87
73
  }
88
74
  if (isRunning) {
89
- return /*#__PURE__*/ React.createElement(ThemeProvider, {
90
- theme: SpinnerTheme
91
- }, /*#__PURE__*/ React.createElement(Spinner, {
92
- label: ` ${message}`
93
- }));
75
+ return /*#__PURE__*/ React.createElement(Spinner, {
76
+ label: message
77
+ });
94
78
  }
95
79
  return /*#__PURE__*/ React.createElement(StatusMessage, {
96
80
  variant: variant
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../libs/cli/src/components/CheckList/Item.tsx"],"sourcesContent":["import {\n StatusMessage,\n StatusMessageProps,\n Spinner,\n extendTheme,\n defaultTheme,\n ThemeProvider,\n} from '@inkjs/ui';\nimport { Text, TextProps } from 'ink';\nimport React, { useEffect, useRef, useState } from 'react';\nimport { CheckListItem } from '@/cli/types.js';\n\nexport interface ItemProps<TResult> {\n item: CheckListItem<TResult>;\n start: boolean;\n}\n\n// todo: possibly extract this\nconst SpinnerTheme = extendTheme(defaultTheme, {\n components: {\n Spinner: {\n styles: {\n frame: (): TextProps => ({\n color: 'yellowBright',\n }),\n label: (): TextProps => ({\n color: 'yellowBright',\n }),\n },\n },\n },\n});\n\nexport const Item = <TResult,>({\n item: {\n runningDescription,\n waitingDescription,\n errorDescription,\n finishedDescription,\n runner,\n onFinish,\n ready,\n },\n start,\n}: ItemProps<TResult>) => {\n const executed = useRef(false);\n const interval = useRef<NodeJS.Timeout | null>(null);\n const [dotCount, setDotCount] = useState(0);\n const [result, setResult] = useState<TResult | null>(null);\n const [failedReason, setfailedReason] = useState<string | null>(null);\n const hasResult = !failedReason && result !== null;\n const isRunning = !failedReason && !hasResult && start && ready !== false;\n const isWaiting = !failedReason && !hasResult && (!start || !ready);\n const couldStartButNotReady =\n !failedReason && !hasResult && start && ready === false;\n\n useEffect(() => {\n if (failedReason) {\n process.exit();\n }\n }, [failedReason]);\n\n useEffect(() => {\n if (couldStartButNotReady) {\n interval.current = setInterval(() => {\n setDotCount((count) => (count + 1) % 4);\n }, 250);\n } else {\n if (interval.current) {\n clearInterval(interval.current);\n }\n }\n\n return () => {\n if (interval.current) {\n clearInterval(interval.current);\n }\n };\n }, [couldStartButNotReady]);\n\n useEffect(() => {\n if (!start || executed.current || ready === false) {\n return;\n }\n\n runner()\n .then((result) => {\n executed.current = true;\n\n if (result === false) {\n setfailedReason(errorDescription);\n\n return;\n }\n\n setResult(result);\n onFinish?.(result);\n })\n .catch((reason) => {\n console.log(reason);\n setfailedReason(reason.message);\n });\n }, [errorDescription, onFinish, runner, start]);\n\n let message = waitingDescription;\n let variant: StatusMessageProps['variant'] = 'info';\n\n if (failedReason) {\n message = ` ${failedReason}`;\n variant = 'error';\n } else if (isRunning) {\n message = runningDescription;\n variant = 'warning';\n } else if (hasResult) {\n message = finishedDescription(result);\n variant = 'success';\n }\n\n if (isRunning) {\n return (\n <ThemeProvider theme={SpinnerTheme}>\n <Spinner label={` ${message}`} />\n </ThemeProvider>\n );\n }\n\n return (\n <StatusMessage variant={variant}>\n <Text\n bold={!isWaiting}\n color={\n isRunning\n ? 'yellow'\n : isWaiting\n ? 'gray'\n : failedReason\n ? 'red'\n : 'green'\n }\n >\n {message}{' '}\n {couldStartButNotReady &&\n `— not ready yet${'.'.repeat(dotCount)}`}\n </Text>\n </StatusMessage>\n );\n};\n"],"names":["StatusMessage","Spinner","extendTheme","defaultTheme","ThemeProvider","Text","React","useEffect","useRef","useState","SpinnerTheme","components","styles","frame","color","label","Item","item","runningDescription","waitingDescription","errorDescription","finishedDescription","runner","onFinish","ready","start","executed","interval","dotCount","setDotCount","result","setResult","failedReason","setfailedReason","hasResult","isRunning","isWaiting","couldStartButNotReady","process","exit","current","setInterval","count","clearInterval","then","catch","reason","console","log","message","variant","theme","bold","repeat"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SACIA,aAAa,EAEbC,OAAO,EACPC,WAAW,EACXC,YAAY,EACZC,aAAa,QACV,YAAY;AACnB,SAASC,IAAI,QAAmB,MAAM;AACtC,OAAOC,SAASC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AAQ3D,8BAA8B;AAC9B,MAAMC,eAAeR,YAAYC,cAAc;IAC3CQ,YAAY;QACRV,SAAS;YACLW,QAAQ;gBACJC,OAAO,IAAkB,CAAA;wBACrBC,OAAO;oBACX,CAAA;gBACAC,OAAO,IAAkB,CAAA;wBACrBD,OAAO;oBACX,CAAA;YACJ;QACJ;IACJ;AACJ;AAEA,OAAO,MAAME,OAAO,CAAW,EAC3BC,MAAM,EACFC,kBAAkB,EAClBC,kBAAkB,EAClBC,gBAAgB,EAChBC,mBAAmB,EACnBC,MAAM,EACNC,QAAQ,EACRC,KAAK,EACR,EACDC,KAAK,EACY;IACjB,MAAMC,WAAWlB,OAAO;IACxB,MAAMmB,WAAWnB,OAA8B;IAC/C,MAAM,CAACoB,UAAUC,YAAY,GAAGpB,SAAS;IACzC,MAAM,CAACqB,QAAQC,UAAU,GAAGtB,SAAyB;IACrD,MAAM,CAACuB,cAAcC,gBAAgB,GAAGxB,SAAwB;IAChE,MAAMyB,YAAY,CAACF,gBAAgBF,WAAW;IAC9C,MAAMK,YAAY,CAACH,gBAAgB,CAACE,aAAaT,SAASD,UAAU;IACpE,MAAMY,YAAY,CAACJ,gBAAgB,CAACE,aAAc,CAAA,CAACT,SAAS,CAACD,KAAI;IACjE,MAAMa,wBACF,CAACL,gBAAgB,CAACE,aAAaT,SAASD,UAAU;IAEtDjB,UAAU;QACN,IAAIyB,cAAc;YACdM,QAAQC,IAAI;QAChB;IACJ,GAAG;QAACP;KAAa;IAEjBzB,UAAU;QACN,IAAI8B,uBAAuB;YACvBV,SAASa,OAAO,GAAGC,YAAY;gBAC3BZ,YAAY,CAACa,QAAU,AAACA,CAAAA,QAAQ,CAAA,IAAK;YACzC,GAAG;QACP,OAAO;YACH,IAAIf,SAASa,OAAO,EAAE;gBAClBG,cAAchB,SAASa,OAAO;YAClC;QACJ;QAEA,OAAO;YACH,IAAIb,SAASa,OAAO,EAAE;gBAClBG,cAAchB,SAASa,OAAO;YAClC;QACJ;IACJ,GAAG;QAACH;KAAsB;IAE1B9B,UAAU;QACN,IAAI,CAACkB,SAASC,SAASc,OAAO,IAAIhB,UAAU,OAAO;YAC/C;QACJ;QAEAF,SACKsB,IAAI,CAAC,CAACd;YACHJ,SAASc,OAAO,GAAG;YAEnB,IAAIV,WAAW,OAAO;gBAClBG,gBAAgBb;gBAEhB;YACJ;YAEAW,UAAUD;YACVP,4BAAAA,SAAWO;QACf,GACCe,KAAK,CAAC,CAACC;YACJC,QAAQC,GAAG,CAACF;YACZb,gBAAgBa,OAAOG,OAAO;QAClC;IACR,GAAG;QAAC7B;QAAkBG;QAAUD;QAAQG;KAAM;IAE9C,IAAIwB,UAAU9B;IACd,IAAI+B,UAAyC;IAE7C,IAAIlB,cAAc;QACdiB,UAAU,CAAC,CAAC,EAAEjB,aAAa,CAAC;QAC5BkB,UAAU;IACd,OAAO,IAAIf,WAAW;QAClBc,UAAU/B;QACVgC,UAAU;IACd,OAAO,IAAIhB,WAAW;QAClBe,UAAU5B,oBAAoBS;QAC9BoB,UAAU;IACd;IAEA,IAAIf,WAAW;QACX,qBACI,oBAAC/B;YAAc+C,OAAOzC;yBAClB,oBAACT;YAAQc,OAAO,CAAC,CAAC,EAAEkC,QAAQ,CAAC;;IAGzC;IAEA,qBACI,oBAACjD;QAAckD,SAASA;qBACpB,oBAAC7C;QACG+C,MAAM,CAAChB;QACPtB,OACIqB,YACM,WACAC,YACA,SACAJ,eACA,QACA;OAGTiB,SAAS,KACTZ,yBACG,CAAC,eAAe,EAAE,IAAIgB,MAAM,CAACzB,UAAU,CAAC;AAI5D,EAAE"}
1
+ {"version":3,"sources":["../../../../../../libs/cli/src/components/CheckList/Item.tsx"],"sourcesContent":["import { StatusMessage, StatusMessageProps } from '@inkjs/ui';\nimport { Text } from 'ink';\nimport React, { useEffect, useRef, useState } from 'react';\nimport { Spinner } from '@/cli/components/Spinner.js';\nimport { CheckListItem } from '@/cli/types.js';\n\nexport interface ItemProps<TResult> {\n item: CheckListItem<TResult>;\n start: boolean;\n}\n\nexport const Item = <TResult,>({\n item: {\n runningDescription,\n waitingDescription,\n errorDescription,\n finishedDescription,\n runner,\n onFinish,\n ready,\n },\n start,\n}: ItemProps<TResult>) => {\n const executed = useRef(false);\n const interval = useRef<NodeJS.Timeout | null>(null);\n const [dotCount, setDotCount] = useState(0);\n const [result, setResult] = useState<TResult | null>(null);\n const [failedReason, setfailedReason] = useState<string | null>(null);\n const hasResult = !failedReason && result !== null;\n const isRunning = !failedReason && !hasResult && start && ready !== false;\n const isWaiting = !failedReason && !hasResult && (!start || !ready);\n const couldStartButNotReady =\n !failedReason && !hasResult && start && ready === false;\n\n useEffect(() => {\n if (failedReason) {\n process.exit();\n }\n }, [failedReason]);\n\n useEffect(() => {\n if (couldStartButNotReady) {\n interval.current = setInterval(() => {\n setDotCount((count) => (count + 1) % 4);\n }, 250);\n } else {\n if (interval.current) {\n clearInterval(interval.current);\n }\n }\n\n return () => {\n if (interval.current) {\n clearInterval(interval.current);\n }\n };\n }, [couldStartButNotReady]);\n\n useEffect(() => {\n if (!start || executed.current || ready === false) {\n return;\n }\n\n runner()\n .then((result) => {\n executed.current = true;\n\n if (result === false) {\n setfailedReason(errorDescription);\n\n return;\n }\n\n setResult(result);\n onFinish?.(result);\n })\n .catch((reason) => {\n console.log(reason);\n setfailedReason(reason.message);\n });\n }, [errorDescription, onFinish, runner, start]);\n\n let message = waitingDescription;\n let variant: StatusMessageProps['variant'] = 'info';\n\n if (failedReason) {\n message = ` ${failedReason}`;\n variant = 'error';\n } else if (isRunning) {\n message = runningDescription;\n variant = 'warning';\n } else if (hasResult) {\n message = finishedDescription(result);\n variant = 'success';\n }\n\n if (isRunning) {\n return <Spinner label={message} />;\n }\n\n return (\n <StatusMessage variant={variant}>\n <Text\n bold={!isWaiting}\n color={\n isRunning\n ? 'yellow'\n : isWaiting\n ? 'gray'\n : failedReason\n ? 'red'\n : 'green'\n }\n >\n {message}{' '}\n {couldStartButNotReady &&\n `— not ready yet${'.'.repeat(dotCount)}`}\n </Text>\n </StatusMessage>\n );\n};\n"],"names":["StatusMessage","Text","React","useEffect","useRef","useState","Spinner","Item","item","runningDescription","waitingDescription","errorDescription","finishedDescription","runner","onFinish","ready","start","executed","interval","dotCount","setDotCount","result","setResult","failedReason","setfailedReason","hasResult","isRunning","isWaiting","couldStartButNotReady","process","exit","current","setInterval","count","clearInterval","then","catch","reason","console","log","message","variant","label","bold","color","repeat"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":"AAAA,SAASA,aAAa,QAA4B,YAAY;AAC9D,SAASC,IAAI,QAAQ,MAAM;AAC3B,OAAOC,SAASC,SAAS,EAAEC,MAAM,EAAEC,QAAQ,QAAQ,QAAQ;AAC3D,SAASC,OAAO,QAAQ,8BAA8B;AAQtD,OAAO,MAAMC,OAAO,CAAW,EAC3BC,MAAM,EACFC,kBAAkB,EAClBC,kBAAkB,EAClBC,gBAAgB,EAChBC,mBAAmB,EACnBC,MAAM,EACNC,QAAQ,EACRC,KAAK,EACR,EACDC,KAAK,EACY;IACjB,MAAMC,WAAWb,OAAO;IACxB,MAAMc,WAAWd,OAA8B;IAC/C,MAAM,CAACe,UAAUC,YAAY,GAAGf,SAAS;IACzC,MAAM,CAACgB,QAAQC,UAAU,GAAGjB,SAAyB;IACrD,MAAM,CAACkB,cAAcC,gBAAgB,GAAGnB,SAAwB;IAChE,MAAMoB,YAAY,CAACF,gBAAgBF,WAAW;IAC9C,MAAMK,YAAY,CAACH,gBAAgB,CAACE,aAAaT,SAASD,UAAU;IACpE,MAAMY,YAAY,CAACJ,gBAAgB,CAACE,aAAc,CAAA,CAACT,SAAS,CAACD,KAAI;IACjE,MAAMa,wBACF,CAACL,gBAAgB,CAACE,aAAaT,SAASD,UAAU;IAEtDZ,UAAU;QACN,IAAIoB,cAAc;YACdM,QAAQC,IAAI;QAChB;IACJ,GAAG;QAACP;KAAa;IAEjBpB,UAAU;QACN,IAAIyB,uBAAuB;YACvBV,SAASa,OAAO,GAAGC,YAAY;gBAC3BZ,YAAY,CAACa,QAAU,AAACA,CAAAA,QAAQ,CAAA,IAAK;YACzC,GAAG;QACP,OAAO;YACH,IAAIf,SAASa,OAAO,EAAE;gBAClBG,cAAchB,SAASa,OAAO;YAClC;QACJ;QAEA,OAAO;YACH,IAAIb,SAASa,OAAO,EAAE;gBAClBG,cAAchB,SAASa,OAAO;YAClC;QACJ;IACJ,GAAG;QAACH;KAAsB;IAE1BzB,UAAU;QACN,IAAI,CAACa,SAASC,SAASc,OAAO,IAAIhB,UAAU,OAAO;YAC/C;QACJ;QAEAF,SACKsB,IAAI,CAAC,CAACd;YACHJ,SAASc,OAAO,GAAG;YAEnB,IAAIV,WAAW,OAAO;gBAClBG,gBAAgBb;gBAEhB;YACJ;YAEAW,UAAUD;YACVP,4BAAAA,SAAWO;QACf,GACCe,KAAK,CAAC,CAACC;YACJC,QAAQC,GAAG,CAACF;YACZb,gBAAgBa,OAAOG,OAAO;QAClC;IACR,GAAG;QAAC7B;QAAkBG;QAAUD;QAAQG;KAAM;IAE9C,IAAIwB,UAAU9B;IACd,IAAI+B,UAAyC;IAE7C,IAAIlB,cAAc;QACdiB,UAAU,CAAC,CAAC,EAAEjB,aAAa,CAAC;QAC5BkB,UAAU;IACd,OAAO,IAAIf,WAAW;QAClBc,UAAU/B;QACVgC,UAAU;IACd,OAAO,IAAIhB,WAAW;QAClBe,UAAU5B,oBAAoBS;QAC9BoB,UAAU;IACd;IAEA,IAAIf,WAAW;QACX,qBAAO,oBAACpB;YAAQoC,OAAOF;;IAC3B;IAEA,qBACI,oBAACxC;QAAcyC,SAASA;qBACpB,oBAACxC;QACG0C,MAAM,CAAChB;QACPiB,OACIlB,YACM,WACAC,YACA,SACAJ,eACA,QACA;OAGTiB,SAAS,KACTZ,yBACG,CAAC,eAAe,EAAE,IAAIiB,MAAM,CAAC1B,UAAU,CAAC;AAI5D,EAAE"}
@@ -0,0 +1,3 @@
1
+ import { SpinnerProps } from '@inkjs/ui';
2
+ import React from 'react';
3
+ export declare const Spinner: (props: SpinnerProps) => React.JSX.Element;
@@ -0,0 +1,26 @@
1
+ import { _ as _extends } from "@swc/helpers/_/_extends";
2
+ import { Spinner as InkUiSpinner, extendTheme, defaultTheme, ThemeProvider } from '@inkjs/ui';
3
+ import React from 'react';
4
+ const SpinnerTheme = extendTheme(defaultTheme, {
5
+ components: {
6
+ Spinner: {
7
+ styles: {
8
+ frame: ()=>({
9
+ color: 'yellowBright'
10
+ }),
11
+ label: ()=>({
12
+ color: 'yellowBright'
13
+ })
14
+ }
15
+ }
16
+ }
17
+ });
18
+ export const Spinner = (props)=>{
19
+ return /*#__PURE__*/ React.createElement(ThemeProvider, {
20
+ theme: SpinnerTheme
21
+ }, /*#__PURE__*/ React.createElement(InkUiSpinner, _extends({}, props, {
22
+ label: ` ${props.label}`
23
+ })));
24
+ };
25
+
26
+ //# sourceMappingURL=Spinner.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../../libs/cli/src/components/Spinner.tsx"],"sourcesContent":["import {\n Spinner as InkUiSpinner,\n SpinnerProps,\n extendTheme,\n defaultTheme,\n ThemeProvider,\n} from '@inkjs/ui';\nimport { TextProps } from 'ink';\nimport React from 'react';\n\nconst SpinnerTheme = extendTheme(defaultTheme, {\n components: {\n Spinner: {\n styles: {\n frame: (): TextProps => ({\n color: 'yellowBright',\n }),\n label: (): TextProps => ({\n color: 'yellowBright',\n }),\n },\n },\n },\n});\n\nexport const Spinner = (props: SpinnerProps) => {\n return (\n <ThemeProvider theme={SpinnerTheme}>\n <InkUiSpinner {...props} label={` ${props.label}`} />\n </ThemeProvider>\n );\n};\n"],"names":["Spinner","InkUiSpinner","extendTheme","defaultTheme","ThemeProvider","React","SpinnerTheme","components","styles","frame","color","label","props","theme"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;","mappings":";AAAA,SACIA,WAAWC,YAAY,EAEvBC,WAAW,EACXC,YAAY,EACZC,aAAa,QACV,YAAY;AAEnB,OAAOC,WAAW,QAAQ;AAE1B,MAAMC,eAAeJ,YAAYC,cAAc;IAC3CI,YAAY;QACRP,SAAS;YACLQ,QAAQ;gBACJC,OAAO,IAAkB,CAAA;wBACrBC,OAAO;oBACX,CAAA;gBACAC,OAAO,IAAkB,CAAA;wBACrBD,OAAO;oBACX,CAAA;YACJ;QACJ;IACJ;AACJ;AAEA,OAAO,MAAMV,UAAU,CAACY;IACpB,qBACI,oBAACR;QAAcS,OAAOP;qBAClB,oBAACL,2BAAiBW;QAAOD,OAAO,CAAC,CAAC,EAAEC,MAAMD,KAAK,CAAC,CAAC;;AAG7D,EAAE"}
package/src/index.js CHANGED
@@ -1,10 +1,12 @@
1
1
  #!/usr/bin/env node --no-warnings=ExperimentalWarning
2
2
  import { readFileSync } from 'fs';
3
3
  import { join } from 'node:path';
4
- import { Cli } from 'clipanion';
4
+ import { Builtins, Cli } from 'clipanion';
5
5
  import { CompileCommand } from './commands/CompileCommand/index.js';
6
6
  import { DoctorCommand } from './commands/DoctorCommand.js';
7
7
  import { GenerateTypesCommand } from './commands/GenerateTypes/index.js';
8
+ import { NewCommand } from './commands/NewCommand/NewCommand.js';
9
+ import { SimulatorCommand } from './commands/SimulatorCommand/index.js';
8
10
  import { TranspileCommand } from './commands/TranspileCommand/index.js';
9
11
  import { RootFolder } from './constants.js';
10
12
  const packageJsonContents = readFileSync(join(RootFolder, 'package.json'), 'utf-8');
@@ -15,10 +17,17 @@ const cli = new Cli({
15
17
  binaryName: 'crankscript',
16
18
  binaryVersion: packageJson.version
17
19
  });
20
+ process.on('SIGINT', function() {
21
+ process.exit();
22
+ });
23
+ cli.register(Builtins.HelpCommand);
24
+ cli.register(Builtins.VersionCommand);
18
25
  cli.register(DoctorCommand);
26
+ cli.register(NewCommand);
19
27
  cli.register(TranspileCommand);
20
28
  cli.register(CompileCommand);
21
29
  cli.register(GenerateTypesCommand);
30
+ cli.register(SimulatorCommand);
22
31
  cli.runExit(args);
23
32
 
24
33
  //# sourceMappingURL=index.js.map
package/src/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../libs/cli/src/index.ts"],"sourcesContent":["#!/usr/bin/env node --no-warnings=ExperimentalWarning\n\nimport { readFileSync } from 'fs';\nimport { join } from 'node:path';\nimport { Cli } from 'clipanion';\nimport { CompileCommand } from '@/cli/commands/CompileCommand/index.js';\nimport { DoctorCommand } from '@/cli/commands/DoctorCommand.js';\nimport { GenerateTypesCommand } from '@/cli/commands/GenerateTypes/index.js';\nimport { TranspileCommand } from '@/cli/commands/TranspileCommand/index.js';\nimport { RootFolder } from '@/cli/constants.js';\n\nconst packageJsonContents = readFileSync(\n join(RootFolder, 'package.json'),\n 'utf-8'\n);\nconst packageJson = JSON.parse(packageJsonContents);\n\nconst args = process.argv.slice(2);\n\nconst cli = new Cli({\n binaryLabel: 'crankscript',\n binaryName: 'crankscript',\n binaryVersion: packageJson.version,\n});\n\ncli.register(DoctorCommand);\ncli.register(TranspileCommand);\ncli.register(CompileCommand);\ncli.register(GenerateTypesCommand);\ncli.runExit(args);\n"],"names":["readFileSync","join","Cli","CompileCommand","DoctorCommand","GenerateTypesCommand","TranspileCommand","RootFolder","packageJsonContents","packageJson","JSON","parse","args","process","argv","slice","cli","binaryLabel","binaryName","binaryVersion","version","register","runExit"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;","mappings":";AAEA,SAASA,YAAY,QAAQ,KAAK;AAClC,SAASC,IAAI,QAAQ,YAAY;AACjC,SAASC,GAAG,QAAQ,YAAY;AAChC,SAASC,cAAc,QAAQ,yCAAyC;AACxE,SAASC,aAAa,QAAQ,kCAAkC;AAChE,SAASC,oBAAoB,QAAQ,wCAAwC;AAC7E,SAASC,gBAAgB,QAAQ,2CAA2C;AAC5E,SAASC,UAAU,QAAQ,qBAAqB;AAEhD,MAAMC,sBAAsBR,aACxBC,KAAKM,YAAY,iBACjB;AAEJ,MAAME,cAAcC,KAAKC,KAAK,CAACH;AAE/B,MAAMI,OAAOC,QAAQC,IAAI,CAACC,KAAK,CAAC;AAEhC,MAAMC,MAAM,IAAId,IAAI;IAChBe,aAAa;IACbC,YAAY;IACZC,eAAeV,YAAYW,OAAO;AACtC;AAEAJ,IAAIK,QAAQ,CAACjB;AACbY,IAAIK,QAAQ,CAACf;AACbU,IAAIK,QAAQ,CAAClB;AACba,IAAIK,QAAQ,CAAChB;AACbW,IAAIM,OAAO,CAACV"}
1
+ {"version":3,"sources":["../../../../libs/cli/src/index.ts"],"sourcesContent":["#!/usr/bin/env node --no-warnings=ExperimentalWarning\n\nimport { readFileSync } from 'fs';\nimport { join } from 'node:path';\nimport { Builtins, Cli } from 'clipanion';\nimport { CompileCommand } from '@/cli/commands/CompileCommand/index.js';\nimport { DoctorCommand } from '@/cli/commands/DoctorCommand.js';\nimport { GenerateTypesCommand } from '@/cli/commands/GenerateTypes/index.js';\nimport { NewCommand } from '@/cli/commands/NewCommand/NewCommand.js';\nimport { SimulatorCommand } from '@/cli/commands/SimulatorCommand/index.js';\nimport { TranspileCommand } from '@/cli/commands/TranspileCommand/index.js';\nimport { RootFolder } from '@/cli/constants.js';\n\nconst packageJsonContents = readFileSync(\n join(RootFolder, 'package.json'),\n 'utf-8'\n);\nconst packageJson = JSON.parse(packageJsonContents);\n\nconst args = process.argv.slice(2);\n\nconst cli = new Cli({\n binaryLabel: 'crankscript',\n binaryName: 'crankscript',\n binaryVersion: packageJson.version,\n});\n\nprocess.on('SIGINT', function () {\n process.exit();\n});\n\ncli.register(Builtins.HelpCommand);\ncli.register(Builtins.VersionCommand);\ncli.register(DoctorCommand);\ncli.register(NewCommand);\ncli.register(TranspileCommand);\ncli.register(CompileCommand);\ncli.register(GenerateTypesCommand);\ncli.register(SimulatorCommand);\ncli.runExit(args);\n"],"names":["readFileSync","join","Builtins","Cli","CompileCommand","DoctorCommand","GenerateTypesCommand","NewCommand","SimulatorCommand","TranspileCommand","RootFolder","packageJsonContents","packageJson","JSON","parse","args","process","argv","slice","cli","binaryLabel","binaryName","binaryVersion","version","on","exit","register","HelpCommand","VersionCommand","runExit"],"rangeMappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;","mappings":";AAEA,SAASA,YAAY,QAAQ,KAAK;AAClC,SAASC,IAAI,QAAQ,YAAY;AACjC,SAASC,QAAQ,EAAEC,GAAG,QAAQ,YAAY;AAC1C,SAASC,cAAc,QAAQ,yCAAyC;AACxE,SAASC,aAAa,QAAQ,kCAAkC;AAChE,SAASC,oBAAoB,QAAQ,wCAAwC;AAC7E,SAASC,UAAU,QAAQ,0CAA0C;AACrE,SAASC,gBAAgB,QAAQ,2CAA2C;AAC5E,SAASC,gBAAgB,QAAQ,2CAA2C;AAC5E,SAASC,UAAU,QAAQ,qBAAqB;AAEhD,MAAMC,sBAAsBX,aACxBC,KAAKS,YAAY,iBACjB;AAEJ,MAAME,cAAcC,KAAKC,KAAK,CAACH;AAE/B,MAAMI,OAAOC,QAAQC,IAAI,CAACC,KAAK,CAAC;AAEhC,MAAMC,MAAM,IAAIhB,IAAI;IAChBiB,aAAa;IACbC,YAAY;IACZC,eAAeV,YAAYW,OAAO;AACtC;AAEAP,QAAQQ,EAAE,CAAC,UAAU;IACjBR,QAAQS,IAAI;AAChB;AAEAN,IAAIO,QAAQ,CAACxB,SAASyB,WAAW;AACjCR,IAAIO,QAAQ,CAACxB,SAAS0B,cAAc;AACpCT,IAAIO,QAAQ,CAACrB;AACbc,IAAIO,QAAQ,CAACnB;AACbY,IAAIO,QAAQ,CAACjB;AACbU,IAAIO,QAAQ,CAACtB;AACbe,IAAIO,QAAQ,CAACpB;AACba,IAAIO,QAAQ,CAAClB;AACbW,IAAIU,OAAO,CAACd"}
package/src/types.d.ts CHANGED
@@ -88,3 +88,9 @@ export type TypeProviderData = {
88
88
  properties: Record<string, PropertyDetails>;
89
89
  functions: Record<string, FunctionDetails>;
90
90
  };
91
+ export type FunctionTypeOverrideMap = Record<string, {
92
+ isMethod: boolean;
93
+ }>;
94
+ export declare enum TemplateName {
95
+ Blank = "blank"
96
+ }
package/src/types.js CHANGED
@@ -8,5 +8,9 @@ export var HealthCheckStatusType;
8
8
  HealthCheckStatusType["Unhealthy"] = "Unhealthy";
9
9
  HealthCheckStatusType["Unknown"] = "Unknown";
10
10
  })(HealthCheckStatusType || (HealthCheckStatusType = {}));
11
+ export var TemplateName;
12
+ (function(TemplateName) {
13
+ TemplateName["Blank"] = "blank";
14
+ })(TemplateName || (TemplateName = {}));
11
15
 
12
16
  //# sourceMappingURL=types.js.map
package/src/types.js.map CHANGED
@@ -1 +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}\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"],"names":["PlaydateSdkVersionIdentifier","HealthCheckStatusType"],"rangeMappings":";;;;;;;;;","mappings":";UASYA;;GAAAA,iCAAAA;;UAiBAC;;;;GAAAA,0BAAAA"}
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"}
@@ -1 +0,0 @@
1
- export declare const useQuitOnCtrlC: () => void;
@@ -1,10 +0,0 @@
1
- import { useInput } from 'ink';
2
- export const useQuitOnCtrlC = ()=>{
3
- useInput((input, key)=>{
4
- if (key.ctrl && input === 'c') {
5
- process.exit();
6
- }
7
- });
8
- };
9
-
10
- //# sourceMappingURL=useQuitOnCtrlC.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../../../../libs/cli/src/hooks/useQuitOnCtrlC.ts"],"sourcesContent":["import { useInput } from 'ink';\n\nexport const useQuitOnCtrlC = () => {\n useInput((input, key) => {\n if (key.ctrl && input === 'c') {\n process.exit();\n }\n });\n};\n"],"names":["useInput","useQuitOnCtrlC","input","key","ctrl","process","exit"],"rangeMappings":";;;;;;;","mappings":"AAAA,SAASA,QAAQ,QAAQ,MAAM;AAE/B,OAAO,MAAMC,iBAAiB;IAC1BD,SAAS,CAACE,OAAOC;QACb,IAAIA,IAAIC,IAAI,IAAIF,UAAU,KAAK;YAC3BG,QAAQC,IAAI;QAChB;IACJ;AACJ,EAAE"}