@shell-shock/preset-script 0.6.63 → 0.6.66

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 (41) hide show
  1. package/dist/_virtual/_rolldown/runtime.cjs +29 -1
  2. package/dist/components/bin-entry.cjs +149 -3
  3. package/dist/components/bin-entry.d.cts.map +1 -1
  4. package/dist/components/bin-entry.d.mts.map +1 -1
  5. package/dist/components/bin-entry.mjs +145 -3
  6. package/dist/components/bin-entry.mjs.map +1 -1
  7. package/dist/components/command-entry.cjs +205 -3
  8. package/dist/components/command-entry.d.mts.map +1 -1
  9. package/dist/components/command-entry.mjs +200 -3
  10. package/dist/components/command-entry.mjs.map +1 -1
  11. package/dist/components/command-router.cjs +159 -2
  12. package/dist/components/command-router.d.cts.map +1 -1
  13. package/dist/components/command-router.d.mts.map +1 -1
  14. package/dist/components/command-router.mjs +156 -2
  15. package/dist/components/command-router.mjs.map +1 -1
  16. package/dist/components/exit-function-declaration.cjs +112 -6
  17. package/dist/components/exit-function-declaration.d.cts +1 -3
  18. package/dist/components/exit-function-declaration.d.cts.map +1 -1
  19. package/dist/components/exit-function-declaration.d.mts +1 -3
  20. package/dist/components/exit-function-declaration.d.mts.map +1 -1
  21. package/dist/components/exit-function-declaration.mjs +111 -6
  22. package/dist/components/exit-function-declaration.mjs.map +1 -1
  23. package/dist/components/index.cjs +18 -1
  24. package/dist/components/index.mjs +7 -1
  25. package/dist/components/virtual-command-entry.cjs +156 -1
  26. package/dist/components/virtual-command-entry.d.mts.map +1 -1
  27. package/dist/components/virtual-command-entry.mjs +152 -1
  28. package/dist/components/virtual-command-entry.mjs.map +1 -1
  29. package/dist/helpers/get-global-options.cjs +73 -1
  30. package/dist/helpers/get-global-options.d.cts.map +1 -1
  31. package/dist/helpers/get-global-options.d.mts.map +1 -1
  32. package/dist/helpers/get-global-options.mjs +71 -1
  33. package/dist/helpers/get-global-options.mjs.map +1 -1
  34. package/dist/index.cjs +123 -1
  35. package/dist/index.d.mts.map +1 -1
  36. package/dist/index.mjs +117 -1
  37. package/dist/index.mjs.map +1 -1
  38. package/dist/types/index.mjs +1 -1
  39. package/dist/types/plugin.d.mts.map +1 -1
  40. package/dist/types/plugin.mjs +1 -1
  41. package/package.json +17 -17
@@ -1,4 +1,94 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_virtual/_rolldown/runtime.cjs`);let e=require(`@alloy-js/core/jsx-runtime`),t=require(`@alloy-js/core`),n=require(`@alloy-js/typescript`),r=require(`@powerlines/plugin-alloy/core/components/spacing`),i=require(`@powerlines/plugin-alloy/core/contexts/context`),a=require(`@shell-shock/core/plugin-utils`),o=require(`@shell-shock/core/components/helpers`);function s(){let s=(0,i.usePowerlines)();return[(0,e.createComponent)(n.InterfaceDeclaration,{export:!0,name:`ExitOptions`,doc:`Options for the exit handler function.`,get children(){return[(0,e.createComponent)(n.InterfaceMember,{name:`exception`,optional:!0,type:`string | Error`,doc:`An optional exception that caused the exit. This can be a string message or an Error object.`}),(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(n.InterfaceMember,{name:`skipProcessExit`,optional:!0,type:`boolean`,doc:`Indicates whether the exit function should manually exit the process or not. If set to true, the exit function will not call process.exit() and will allow the application to continue running. If set to false or not specified, the exit function will call process.exit() to terminate the application.`}),(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(n.InterfaceMember,{name:`isSynchronous`,optional:!0,type:`boolean`,doc:`Indicates whether the exit function should perform synchronous operations only. If set to true, the exit function will avoid any asynchronous operations during exit. If set to false or not specified, the exit function may perform asynchronous operations as needed.`}),(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(n.InterfaceMember,{name:`signal`,optional:!0,type:`number`,doc:`The signal number that triggered the exit. This is typically used when the shutdown is initiated by a system signal (e.g., SIGINT, SIGTERM).`}),(0,e.createIntrinsic)(`hbr`,{}),(0,e.createComponent)(n.InterfaceMember,{name:`startDate`,optional:!0,type:`Date`,doc:`A Date object representing the timestamp when the process started. This can be used to measure the duration of the shutdown process.`})]}}),(0,e.createComponent)(r.Spacing,{}),(0,e.createComponent)(n.VarDeclaration,{let:!0,name:`isExiting`,type:`boolean`,initializer:t.code`false;`}),(0,e.createComponent)(n.VarDeclaration,{const:!0,name:`callbackAsyncQueue`,type:`Array<[(code: number | string) => Promise<void> | void, number]>`,initializer:t.code`[];`}),(0,e.createComponent)(n.VarDeclaration,{const:!0,name:`callbackSyncQueue`,type:`Array<(code: number | string) => void>`,initializer:t.code`[];`}),(0,e.createComponent)(r.Spacing,{}),(0,e.createComponent)(n.FunctionDeclaration,{export:!0,async:!0,name:`exit`,parameters:[{name:`options`,type:`ExitOptions`,default:`{}`}],get children(){return[(0,e.memo)(()=>t.code`
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
3
+ let _alloy_js_core = require("@alloy-js/core");
4
+ let _alloy_js_typescript = require("@alloy-js/typescript");
5
+ let _powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
6
+ let _powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
7
+ let _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
8
+ let _shell_shock_core_components_helpers = require("@shell-shock/core/components/helpers");
9
+
10
+ //#region src/components/exit-function-declaration.tsx
11
+ /**
12
+ * The `exit` handler function declaration code for the Shell Shock project.
13
+ */
14
+ function ExitFunctionDeclaration() {
15
+ const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
16
+ return [
17
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceDeclaration, {
18
+ "export": true,
19
+ name: "ExitOptions",
20
+ doc: "Options for the exit handler function.",
21
+ get children() {
22
+ return [
23
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
24
+ name: "exception",
25
+ optional: true,
26
+ type: "string | Error",
27
+ doc: "An optional exception that caused the exit. This can be a string message or an Error object."
28
+ }),
29
+ (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
30
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
31
+ name: "skipProcessExit",
32
+ optional: true,
33
+ type: "boolean",
34
+ doc: "Indicates whether the exit function should manually exit the process or not. If set to true, the exit function will not call process.exit() and will allow the application to continue running. If set to false or not specified, the exit function will call process.exit() to terminate the application."
35
+ }),
36
+ (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
37
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
38
+ name: "isSynchronous",
39
+ optional: true,
40
+ type: "boolean",
41
+ doc: "Indicates whether the exit function should perform synchronous operations only. If set to true, the exit function will avoid any asynchronous operations during exit. If set to false or not specified, the exit function may perform asynchronous operations as needed."
42
+ }),
43
+ (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
44
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
45
+ name: "signal",
46
+ optional: true,
47
+ type: "number",
48
+ doc: "The signal number that triggered the exit. This is typically used when the shutdown is initiated by a system signal (e.g., SIGINT, SIGTERM)."
49
+ }),
50
+ (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
51
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.InterfaceMember, {
52
+ name: "startDate",
53
+ optional: true,
54
+ type: "Date",
55
+ doc: "A Date object representing the timestamp when the process started. This can be used to measure the duration of the shutdown process."
56
+ })
57
+ ];
58
+ }
59
+ }),
60
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
61
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
62
+ "let": true,
63
+ name: "isExiting",
64
+ type: "boolean",
65
+ initializer: _alloy_js_core.code`false;`
66
+ }),
67
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
68
+ "const": true,
69
+ name: "callbackAsyncQueue",
70
+ type: "Array<[(code: number | string) => Promise<void> | void, number]>",
71
+ initializer: _alloy_js_core.code`[];`
72
+ }),
73
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
74
+ "const": true,
75
+ name: "callbackSyncQueue",
76
+ type: "Array<(code: number | string) => void>",
77
+ initializer: _alloy_js_core.code`[];`
78
+ }),
79
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
80
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
81
+ "export": true,
82
+ async: true,
83
+ name: "exit",
84
+ parameters: [{
85
+ name: "options",
86
+ type: "ExitOptions",
87
+ default: "{}"
88
+ }],
89
+ get children() {
90
+ return [
91
+ (0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`
2
92
  try {
3
93
  if (isExiting) {
4
94
  return;
@@ -14,13 +104,21 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_
14
104
  }
15
105
 
16
106
  if (options.exception) {
17
- error({ message: \`A fatal error occured while running the application - please contact the ${(0,a.getAppTitle)(s)} support team\${options.exception && typeof options.exception !== "symbol" ? \`: \\n\\n\${typeof options.exception === "string" ? options.exception : options.exception.message}\` : "."}\`,
107
+ error({ message: \`A fatal error occured while running the application - please contact the ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context)} support team\${options.exception && typeof options.exception !== "symbol" ? \`: \\n\\n\${typeof options.exception === "string" ? options.exception : options.exception.message}\` : "."}\`,
18
108
  ...(options.exception && typeof options.exception === "object" ? { stack: (options.exception as { message: string; stack?: string }).stack } : {})
19
109
  });
20
110
  }
21
111
 
22
- const terminate = (force = false) => { `),(0,e.createComponent)(n.IfStatement,{get condition(){return(0,e.createComponent)(o.IsVerbose,{})},children:t.code`writeLine("");`}),(0,e.createIntrinsic)(`hbr`,{}),(0,e.memo)(()=>t.code`
23
- verbose(\`The ${(0,a.getAppTitle)(s,!0)} application exited \${options.exception ? \`early due to an exception\` : "successfully"}\${options.startDate ? \`. Total processing time is \${Date.now() - options.startDate.getTime() > 5000 ? Math.floor((Date.now() - options.startDate.getTime()) / 1000) : Date.now() - options.startDate.getTime()} \${Date.now() - options.startDate.getTime() > 5000 ? "seconds" : "milliseconds"}\` : ""}...\`);
112
+ const terminate = (force = false) => { `),
113
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
114
+ get condition() {
115
+ return (0, _alloy_js_core_jsx_runtime.createComponent)(_shell_shock_core_components_helpers.IsVerbose, {});
116
+ },
117
+ children: _alloy_js_core.code`writeLine("");`
118
+ }),
119
+ (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
120
+ (0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`
121
+ verbose(\`The ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context, true)} application exited \${options.exception ? \`early due to an exception\` : "successfully"}\${options.startDate ? \`. Total processing time is \${Date.now() - options.startDate.getTime() > 5000 ? Math.floor((Date.now() - options.startDate.getTime()) / 1000) : Date.now() - options.startDate.getTime()} \${Date.now() - options.startDate.getTime() > 5000 ? "seconds" : "milliseconds"}\` : ""}...\`);
24
122
  if (!options.skipProcessExit) {
25
123
  process.nextTick(() => process.exit(exitCode));
26
124
  }
@@ -47,10 +145,18 @@ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require(`../_
47
145
 
48
146
  terminate();
49
147
  } catch (err) {
50
- error(\`The exit process failed to complete\${(err as Error)?.message ? \` - \${(err as Error).message}\` : ""}. Please contact the ${(0,a.getAppTitle)(s,!0)} support team.\`);
148
+ error(\`The exit process failed to complete\${(err as Error)?.message ? \` - \${(err as Error).message}\` : ""}. Please contact the ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context, true)} support team.\`);
51
149
 
52
150
  if (!options.skipProcessExit) {
53
151
  process.nextTick(() => process.exit(1));
54
152
  }
55
153
  }
56
- `)]}})]}exports.ExitFunctionDeclaration=s;
154
+ `)
155
+ ];
156
+ }
157
+ })
158
+ ];
159
+ }
160
+
161
+ //#endregion
162
+ exports.ExitFunctionDeclaration = ExitFunctionDeclaration;
@@ -1,10 +1,8 @@
1
- import * as _$_alloy_js_core0 from "@alloy-js/core";
2
-
3
1
  //#region src/components/exit-function-declaration.d.ts
4
2
  /**
5
3
  * The `exit` handler function declaration code for the Shell Shock project.
6
4
  */
7
- declare function ExitFunctionDeclaration(): _$_alloy_js_core0.Children;
5
+ declare function ExitFunctionDeclaration(): import("@alloy-js/core").Children;
8
6
  //#endregion
9
7
  export { ExitFunctionDeclaration };
10
8
  //# sourceMappingURL=exit-function-declaration.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"exit-function-declaration.d.cts","names":[],"sources":["../../src/components/exit-function-declaration.tsx"],"mappings":";;;;;;iBAmCgB,uBAAA,CAAA,GAAuB,iBAAA,CAAA,QAAA"}
1
+ {"version":3,"file":"exit-function-declaration.d.cts","names":[],"sources":["../../src/components/exit-function-declaration.tsx"],"mappings":";;AAmCA;;iBAAgB,uBAAA,6BAAuB,QAAA"}
@@ -1,10 +1,8 @@
1
- import * as _$_alloy_js_core0 from "@alloy-js/core";
2
-
3
1
  //#region src/components/exit-function-declaration.d.ts
4
2
  /**
5
3
  * The `exit` handler function declaration code for the Shell Shock project.
6
4
  */
7
- declare function ExitFunctionDeclaration(): _$_alloy_js_core0.Children;
5
+ declare function ExitFunctionDeclaration(): import("@alloy-js/core").Children;
8
6
  //#endregion
9
7
  export { ExitFunctionDeclaration };
10
8
  //# sourceMappingURL=exit-function-declaration.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"exit-function-declaration.d.mts","names":[],"sources":["../../src/components/exit-function-declaration.tsx"],"mappings":";;;;;;iBAmCgB,uBAAA,CAAA,GAAuB,iBAAA,CAAA,QAAA"}
1
+ {"version":3,"file":"exit-function-declaration.d.mts","names":[],"sources":["../../src/components/exit-function-declaration.tsx"],"mappings":""}
@@ -1,4 +1,93 @@
1
- import{createComponent as e,createIntrinsic as t,memo as n}from"@alloy-js/core/jsx-runtime";import{code as r}from"@alloy-js/core";import{FunctionDeclaration as i,IfStatement as a,InterfaceDeclaration as o,InterfaceMember as s,VarDeclaration as c}from"@alloy-js/typescript";import{Spacing as l}from"@powerlines/plugin-alloy/core/components/spacing";import{usePowerlines as u}from"@powerlines/plugin-alloy/core/contexts/context";import{getAppTitle as d}from"@shell-shock/core/plugin-utils";import{IsVerbose as f}from"@shell-shock/core/components/helpers";function p(){let p=u();return[e(o,{export:!0,name:`ExitOptions`,doc:`Options for the exit handler function.`,get children(){return[e(s,{name:`exception`,optional:!0,type:`string | Error`,doc:`An optional exception that caused the exit. This can be a string message or an Error object.`}),t(`hbr`,{}),e(s,{name:`skipProcessExit`,optional:!0,type:`boolean`,doc:`Indicates whether the exit function should manually exit the process or not. If set to true, the exit function will not call process.exit() and will allow the application to continue running. If set to false or not specified, the exit function will call process.exit() to terminate the application.`}),t(`hbr`,{}),e(s,{name:`isSynchronous`,optional:!0,type:`boolean`,doc:`Indicates whether the exit function should perform synchronous operations only. If set to true, the exit function will avoid any asynchronous operations during exit. If set to false or not specified, the exit function may perform asynchronous operations as needed.`}),t(`hbr`,{}),e(s,{name:`signal`,optional:!0,type:`number`,doc:`The signal number that triggered the exit. This is typically used when the shutdown is initiated by a system signal (e.g., SIGINT, SIGTERM).`}),t(`hbr`,{}),e(s,{name:`startDate`,optional:!0,type:`Date`,doc:`A Date object representing the timestamp when the process started. This can be used to measure the duration of the shutdown process.`})]}}),e(l,{}),e(c,{let:!0,name:`isExiting`,type:`boolean`,initializer:r`false;`}),e(c,{const:!0,name:`callbackAsyncQueue`,type:`Array<[(code: number | string) => Promise<void> | void, number]>`,initializer:r`[];`}),e(c,{const:!0,name:`callbackSyncQueue`,type:`Array<(code: number | string) => void>`,initializer:r`[];`}),e(l,{}),e(i,{export:!0,async:!0,name:`exit`,parameters:[{name:`options`,type:`ExitOptions`,default:`{}`}],get children(){return[n(()=>r`
1
+ import { createComponent, createIntrinsic, memo } from "@alloy-js/core/jsx-runtime";
2
+ import { code } from "@alloy-js/core";
3
+ import { FunctionDeclaration, IfStatement, InterfaceDeclaration, InterfaceMember, VarDeclaration } from "@alloy-js/typescript";
4
+ import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
5
+ import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
6
+ import { getAppTitle } from "@shell-shock/core/plugin-utils";
7
+ import { IsVerbose } from "@shell-shock/core/components/helpers";
8
+
9
+ //#region src/components/exit-function-declaration.tsx
10
+ /**
11
+ * The `exit` handler function declaration code for the Shell Shock project.
12
+ */
13
+ function ExitFunctionDeclaration() {
14
+ const context = usePowerlines();
15
+ return [
16
+ createComponent(InterfaceDeclaration, {
17
+ "export": true,
18
+ name: "ExitOptions",
19
+ doc: "Options for the exit handler function.",
20
+ get children() {
21
+ return [
22
+ createComponent(InterfaceMember, {
23
+ name: "exception",
24
+ optional: true,
25
+ type: "string | Error",
26
+ doc: "An optional exception that caused the exit. This can be a string message or an Error object."
27
+ }),
28
+ createIntrinsic("hbr", {}),
29
+ createComponent(InterfaceMember, {
30
+ name: "skipProcessExit",
31
+ optional: true,
32
+ type: "boolean",
33
+ doc: "Indicates whether the exit function should manually exit the process or not. If set to true, the exit function will not call process.exit() and will allow the application to continue running. If set to false or not specified, the exit function will call process.exit() to terminate the application."
34
+ }),
35
+ createIntrinsic("hbr", {}),
36
+ createComponent(InterfaceMember, {
37
+ name: "isSynchronous",
38
+ optional: true,
39
+ type: "boolean",
40
+ doc: "Indicates whether the exit function should perform synchronous operations only. If set to true, the exit function will avoid any asynchronous operations during exit. If set to false or not specified, the exit function may perform asynchronous operations as needed."
41
+ }),
42
+ createIntrinsic("hbr", {}),
43
+ createComponent(InterfaceMember, {
44
+ name: "signal",
45
+ optional: true,
46
+ type: "number",
47
+ doc: "The signal number that triggered the exit. This is typically used when the shutdown is initiated by a system signal (e.g., SIGINT, SIGTERM)."
48
+ }),
49
+ createIntrinsic("hbr", {}),
50
+ createComponent(InterfaceMember, {
51
+ name: "startDate",
52
+ optional: true,
53
+ type: "Date",
54
+ doc: "A Date object representing the timestamp when the process started. This can be used to measure the duration of the shutdown process."
55
+ })
56
+ ];
57
+ }
58
+ }),
59
+ createComponent(Spacing, {}),
60
+ createComponent(VarDeclaration, {
61
+ "let": true,
62
+ name: "isExiting",
63
+ type: "boolean",
64
+ initializer: code`false;`
65
+ }),
66
+ createComponent(VarDeclaration, {
67
+ "const": true,
68
+ name: "callbackAsyncQueue",
69
+ type: "Array<[(code: number | string) => Promise<void> | void, number]>",
70
+ initializer: code`[];`
71
+ }),
72
+ createComponent(VarDeclaration, {
73
+ "const": true,
74
+ name: "callbackSyncQueue",
75
+ type: "Array<(code: number | string) => void>",
76
+ initializer: code`[];`
77
+ }),
78
+ createComponent(Spacing, {}),
79
+ createComponent(FunctionDeclaration, {
80
+ "export": true,
81
+ async: true,
82
+ name: "exit",
83
+ parameters: [{
84
+ name: "options",
85
+ type: "ExitOptions",
86
+ default: "{}"
87
+ }],
88
+ get children() {
89
+ return [
90
+ memo(() => code`
2
91
  try {
3
92
  if (isExiting) {
4
93
  return;
@@ -14,13 +103,21 @@ import{createComponent as e,createIntrinsic as t,memo as n}from"@alloy-js/core/j
14
103
  }
15
104
 
16
105
  if (options.exception) {
17
- error({ message: \`A fatal error occured while running the application - please contact the ${d(p)} support team\${options.exception && typeof options.exception !== "symbol" ? \`: \\n\\n\${typeof options.exception === "string" ? options.exception : options.exception.message}\` : "."}\`,
106
+ error({ message: \`A fatal error occured while running the application - please contact the ${getAppTitle(context)} support team\${options.exception && typeof options.exception !== "symbol" ? \`: \\n\\n\${typeof options.exception === "string" ? options.exception : options.exception.message}\` : "."}\`,
18
107
  ...(options.exception && typeof options.exception === "object" ? { stack: (options.exception as { message: string; stack?: string }).stack } : {})
19
108
  });
20
109
  }
21
110
 
22
- const terminate = (force = false) => { `),e(a,{get condition(){return e(f,{})},children:r`writeLine("");`}),t(`hbr`,{}),n(()=>r`
23
- verbose(\`The ${d(p,!0)} application exited \${options.exception ? \`early due to an exception\` : "successfully"}\${options.startDate ? \`. Total processing time is \${Date.now() - options.startDate.getTime() > 5000 ? Math.floor((Date.now() - options.startDate.getTime()) / 1000) : Date.now() - options.startDate.getTime()} \${Date.now() - options.startDate.getTime() > 5000 ? "seconds" : "milliseconds"}\` : ""}...\`);
111
+ const terminate = (force = false) => { `),
112
+ createComponent(IfStatement, {
113
+ get condition() {
114
+ return createComponent(IsVerbose, {});
115
+ },
116
+ children: code`writeLine("");`
117
+ }),
118
+ createIntrinsic("hbr", {}),
119
+ memo(() => code`
120
+ verbose(\`The ${getAppTitle(context, true)} application exited \${options.exception ? \`early due to an exception\` : "successfully"}\${options.startDate ? \`. Total processing time is \${Date.now() - options.startDate.getTime() > 5000 ? Math.floor((Date.now() - options.startDate.getTime()) / 1000) : Date.now() - options.startDate.getTime()} \${Date.now() - options.startDate.getTime() > 5000 ? "seconds" : "milliseconds"}\` : ""}...\`);
24
121
  if (!options.skipProcessExit) {
25
122
  process.nextTick(() => process.exit(exitCode));
26
123
  }
@@ -47,11 +144,19 @@ import{createComponent as e,createIntrinsic as t,memo as n}from"@alloy-js/core/j
47
144
 
48
145
  terminate();
49
146
  } catch (err) {
50
- error(\`The exit process failed to complete\${(err as Error)?.message ? \` - \${(err as Error).message}\` : ""}. Please contact the ${d(p,!0)} support team.\`);
147
+ error(\`The exit process failed to complete\${(err as Error)?.message ? \` - \${(err as Error).message}\` : ""}. Please contact the ${getAppTitle(context, true)} support team.\`);
51
148
 
52
149
  if (!options.skipProcessExit) {
53
150
  process.nextTick(() => process.exit(1));
54
151
  }
55
152
  }
56
- `)]}})]}export{p as ExitFunctionDeclaration};
153
+ `)
154
+ ];
155
+ }
156
+ })
157
+ ];
158
+ }
159
+
160
+ //#endregion
161
+ export { ExitFunctionDeclaration };
57
162
  //# sourceMappingURL=exit-function-declaration.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"exit-function-declaration.mjs","names":[],"sources":["../../src/components/exit-function-declaration.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code } from \"@alloy-js/core\";\nimport {\n FunctionDeclaration,\n IfStatement,\n InterfaceDeclaration,\n InterfaceMember,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport { IsVerbose } from \"@shell-shock/core/components/helpers\";\nimport { getAppTitle } from \"@shell-shock/core/plugin-utils\";\nimport type { ScriptPresetContext } from \"../types/plugin\";\n\n/**\n * The `exit` handler function declaration code for the Shell Shock project.\n */\nexport function ExitFunctionDeclaration() {\n const context = usePowerlines<ScriptPresetContext>();\n\n return (\n <>\n <InterfaceDeclaration\n export\n name=\"ExitOptions\"\n doc=\"Options for the exit handler function.\">\n <InterfaceMember\n name=\"exception\"\n optional\n type=\"string | Error\"\n doc=\"An optional exception that caused the exit. This can be a string message or an Error object.\"\n />\n <hbr />\n <InterfaceMember\n name=\"skipProcessExit\"\n optional\n type=\"boolean\"\n doc=\"Indicates whether the exit function should manually exit the process or not. If set to true, the exit function will not call process.exit() and will allow the application to continue running. If set to false or not specified, the exit function will call process.exit() to terminate the application.\"\n />\n <hbr />\n <InterfaceMember\n name=\"isSynchronous\"\n optional\n type=\"boolean\"\n doc=\"Indicates whether the exit function should perform synchronous operations only. If set to true, the exit function will avoid any asynchronous operations during exit. If set to false or not specified, the exit function may perform asynchronous operations as needed.\"\n />\n <hbr />\n <InterfaceMember\n name=\"signal\"\n optional\n type=\"number\"\n doc=\"The signal number that triggered the exit. This is typically used when the shutdown is initiated by a system signal (e.g., SIGINT, SIGTERM).\"\n />\n <hbr />\n <InterfaceMember\n name=\"startDate\"\n optional\n type=\"Date\"\n doc=\"A Date object representing the timestamp when the process started. This can be used to measure the duration of the shutdown process.\"\n />\n </InterfaceDeclaration>\n <Spacing />\n <VarDeclaration\n let\n name=\"isExiting\"\n type=\"boolean\"\n initializer={code`false;`}\n />\n <VarDeclaration\n const\n name=\"callbackAsyncQueue\"\n type=\"Array<[(code: number | string) => Promise<void> | void, number]>\"\n initializer={code`[];`}\n />\n <VarDeclaration\n const\n name=\"callbackSyncQueue\"\n type=\"Array<(code: number | string) => void>\"\n initializer={code`[];`}\n />\n <Spacing />\n <FunctionDeclaration\n export\n async\n name=\"exit\"\n parameters={[\n {\n name: \"options\",\n type: \"ExitOptions\",\n default: \"{}\"\n }\n ]}>\n {code`\n try {\n if (isExiting) {\n return;\n }\n\n isExiting = true;\n\n let exitCode: number | string = 0;\n if ((options.signal !== undefined && options.signal > 0) || options.exception) {\n exitCode = 128 + (options.signal ?? 1);\n } else if (typeof process.exitCode === \"number\" || typeof process.exitCode === \"string\") {\n exitCode = process.exitCode;\n }\n\n if (options.exception) {\n error({ message: \\`A fatal error occured while running the application - please contact the ${getAppTitle(\n context\n )} support team\\${options.exception && typeof options.exception !== \"symbol\" ? \\`: \\\\n\\\\n\\${typeof options.exception === \"string\" ? options.exception : options.exception.message}\\` : \".\"}\\`,\n ...(options.exception && typeof options.exception === \"object\" ? { stack: (options.exception as { message: string; stack?: string }).stack } : {})\n });\n }\n\n const terminate = (force = false) => { `}\n <IfStatement\n condition={<IsVerbose />}>{code`writeLine(\"\");`}</IfStatement>\n <hbr />\n {code`\n verbose(\\`The ${getAppTitle(\n context,\n true\n )} application exited \\${options.exception ? \\`early due to an exception\\` : \"successfully\"}\\${options.startDate ? \\`. Total processing time is \\${Date.now() - options.startDate.getTime() > 5000 ? Math.floor((Date.now() - options.startDate.getTime()) / 1000) : Date.now() - options.startDate.getTime()} \\${Date.now() - options.startDate.getTime() > 5000 ? \"seconds\" : \"milliseconds\"}\\` : \"\"}...\\`);\n if (!options.skipProcessExit) {\n process.nextTick(() => process.exit(exitCode));\n }\n };\n\n for (const callbackSync of callbackSyncQueue) {\n callbackSync(exitCode);\n }\n\n if (!options.isSynchronous) {\n const promises = [];\n let forceAfter = 0;\n for (const [callbackAsync, wait] of callbackAsyncQueue) {\n forceAfter = Math.max(forceAfter, wait);\n promises.push(Promise.resolve(callbackAsync(exitCode)));\n }\n\n const asyncTimer = setTimeout(() => {\n terminate(true);\n }, forceAfter);\n await Promise.all(promises);\n clearTimeout(asyncTimer);\n }\n\n terminate();\n } catch (err) {\n error(\\`The exit process failed to complete\\${(err as Error)?.message ? \\` - \\${(err as Error).message}\\` : \"\"}. Please contact the ${getAppTitle(\n context,\n true\n )} support team.\\`);\n\n if (!options.skipProcessExit) {\n process.nextTick(() => process.exit(1));\n }\n }\n `}\n </FunctionDeclaration>\n </>\n );\n}\n"],"mappings":"yiBA4BA,SAAS,GAA+B,CACxC,IAAQ,EAAC,GAAqB,CAC9B,MAAO,CAAA,EAAO,EAAoC,WAEhD,KAAA,cACC,IAAK,yCACN,IAAA,UAAA,CACI,MAAC,CAAA,EAAS,EAA0B,CAClC,KAAA,wBAEA,KAAC,iBACJ,IAAA,+FACE,CAAA,CAAA,EAAA,MAAA,EAAA,CAAA,CAAA,EAAA,EAAA,CACC,KAAA,kBACA,SAAM,GACN,KAAK,UACL,IAAC,6SACF,CAAC,CAAE,EAAe,MAAA,EAAA,CAAA,CAAA,EAAA,EAAA,CACjB,KAAE,gBACF,SAAQ,GACR,KAAM,UACN,IAAC,2QACF,CAAC,CAAC,EAAK,MAAA,EAAA,CAAA,CAAA,EAAA,EAAA,CACN,KAAC,SACD,SAAQ,GACR,KAAE,SACF,IAAE,+IACH,CAAC,CAAE,EAAe,MAAQ,EAAI,CAAA,CAAA,EAAqB,EAAiB,CACnE,KAAC,YACD,SAAM,GACN,KAAC,OACD,IAAE,uIACH,CAAC,CAAC,EAEN,CAAC,CAAE,EAAkB,EAAS,EAAA,CAAG,CAAC,EAAc,EAAe,CAC9D,IAAK,GACL,KAAK,YACL,KAAK,UACL,YAAY,CAAA,SACb,CAAC,CAAE,EAAI,EAAA,CACN,MAAM,GACN,KAAM,qBACN,KAAK,mEACL,YAAU,CAAA,MACX,CAAC,CAAE,EAAG,EAAA,CACL,MAAM,GACN,KAAM,oBACN,KAAM,yCACN,YAAa,CAAI,MAClB,CAAC,CAAE,EAAG,EAAA,EAAA,CAAA,CAAA,EAAA,EAAA,CACL,OAAI,GACJ,MAAG,GACH,KAAG,OACH,WAAI,CAAA,CACF,KAAM,UACN,KAAM,cACN,QAAE,KACH,CAAC,CACF,IAAG,UAAA,CACD,MAAE,CAAA,MAAA,CAAA;;;;;;;;;;;;;;;;4GAgBY,EAAA,EAAA,CAAA;;;;;qDAKV,CAAA,EAAA,EAAA,CACF,IAAE,WAAA,CACD,OAAI,EAAA,EAAA,EAAA,CAAA,EAEL,SAAQ,CAAA,iBACT,CAAC,CAAE,EAAU,MAAA,EAAA,CAAA,CAAA,MAAA,CAAA;8BACR,EAAA,EAAA,GAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;kJA2B+H,EAAmB,EAAQ,GAAM,CAAC;;;;;;UAMnK,CAAC,EAER,CAAC,CAAC"}
1
+ {"version":3,"file":"exit-function-declaration.mjs","names":[],"sources":[],"mappings":""}
@@ -1 +1,18 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./exit-function-declaration.cjs`),t=require(`./bin-entry.cjs`),n=require(`./command-router.cjs`),r=require(`./virtual-command-entry.cjs`),i=require(`./command-entry.cjs`);exports.BinEntry=t.BinEntry,exports.CommandEntry=i.CommandEntry,exports.CommandHandlerDeclaration=i.CommandHandlerDeclaration,exports.CommandInvocation=i.CommandInvocation,exports.CommandRouter=n.CommandRouter,exports.CommandRouterBody=n.CommandRouterBody,exports.CommandRouterRoute=n.CommandRouterRoute,exports.ExitFunctionDeclaration=e.ExitFunctionDeclaration,exports.RunApplication=t.RunApplication,exports.VirtualCommandEntry=r.VirtualCommandEntry,exports.VirtualCommandHandlerDeclaration=r.VirtualCommandHandlerDeclaration;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_components_exit_function_declaration = require('./exit-function-declaration.cjs');
3
+ const require_components_bin_entry = require('./bin-entry.cjs');
4
+ const require_components_command_router = require('./command-router.cjs');
5
+ const require_components_virtual_command_entry = require('./virtual-command-entry.cjs');
6
+ const require_components_command_entry = require('./command-entry.cjs');
7
+
8
+ exports.BinEntry = require_components_bin_entry.BinEntry;
9
+ exports.CommandEntry = require_components_command_entry.CommandEntry;
10
+ exports.CommandHandlerDeclaration = require_components_command_entry.CommandHandlerDeclaration;
11
+ exports.CommandInvocation = require_components_command_entry.CommandInvocation;
12
+ exports.CommandRouter = require_components_command_router.CommandRouter;
13
+ exports.CommandRouterBody = require_components_command_router.CommandRouterBody;
14
+ exports.CommandRouterRoute = require_components_command_router.CommandRouterRoute;
15
+ exports.ExitFunctionDeclaration = require_components_exit_function_declaration.ExitFunctionDeclaration;
16
+ exports.RunApplication = require_components_bin_entry.RunApplication;
17
+ exports.VirtualCommandEntry = require_components_virtual_command_entry.VirtualCommandEntry;
18
+ exports.VirtualCommandHandlerDeclaration = require_components_virtual_command_entry.VirtualCommandHandlerDeclaration;
@@ -1 +1,7 @@
1
- import{ExitFunctionDeclaration as e}from"./exit-function-declaration.mjs";import{BinEntry as t,RunApplication as n}from"./bin-entry.mjs";import{CommandRouter as r,CommandRouterBody as i,CommandRouterRoute as a}from"./command-router.mjs";import{VirtualCommandEntry as o,VirtualCommandHandlerDeclaration as s}from"./virtual-command-entry.mjs";import{CommandEntry as c,CommandHandlerDeclaration as l,CommandInvocation as u}from"./command-entry.mjs";export{t as BinEntry,c as CommandEntry,l as CommandHandlerDeclaration,u as CommandInvocation,r as CommandRouter,i as CommandRouterBody,a as CommandRouterRoute,e as ExitFunctionDeclaration,n as RunApplication,o as VirtualCommandEntry,s as VirtualCommandHandlerDeclaration};
1
+ import { ExitFunctionDeclaration } from "./exit-function-declaration.mjs";
2
+ import { BinEntry, RunApplication } from "./bin-entry.mjs";
3
+ import { CommandRouter, CommandRouterBody, CommandRouterRoute } from "./command-router.mjs";
4
+ import { VirtualCommandEntry, VirtualCommandHandlerDeclaration } from "./virtual-command-entry.mjs";
5
+ import { CommandEntry, CommandHandlerDeclaration, CommandInvocation } from "./command-entry.mjs";
6
+
7
+ export { BinEntry, CommandEntry, CommandHandlerDeclaration, CommandInvocation, CommandRouter, CommandRouterBody, CommandRouterRoute, ExitFunctionDeclaration, RunApplication, VirtualCommandEntry, VirtualCommandHandlerDeclaration };
@@ -1 +1,156 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../_virtual/_rolldown/runtime.cjs`),t=require(`./command-router.cjs`),n=require(`./command-entry.cjs`);let r=require(`@alloy-js/core/jsx-runtime`),i=require(`@alloy-js/core`),a=require(`@alloy-js/typescript`),o=require(`@powerlines/plugin-alloy/core/components`),s=require(`@powerlines/plugin-alloy/core/contexts/context`),c=require(`@powerlines/plugin-alloy/typescript/components/tsdoc`),l=require(`@shell-shock/core/plugin-utils`),u=require(`@stryke/string-format/pascal-case`),d=require(`defu`);d=e.__toESM(d);let f=require(`@stryke/path/join`),p=require(`@stryke/string-format/constant-case`),m=require(`@powerlines/plugin-alloy/typescript/components/typescript-file`);function h(e){let{command:t,children:n,banner:u}=e,d=(0,s.usePowerlines)();return[(0,r.createComponent)(c.TSDoc,{get heading(){return`The ${t.title} (${(0,l.getAppBin)(d)} ${t.segments.map(e=>(0,l.isDynamicPathSegment)(e)?`[${(0,p.constantCase)((0,l.getDynamicPathSegmentName)(e))}]`:e).join(` `)}) virtual command.`},get children(){return[(0,r.createComponent)(c.TSDocRemarks,{get children(){return`${t.description.replace(/\.+$/,``)}.`}}),(0,r.createIntrinsic)(`hbr`,{}),(0,r.createComponent)(c.TSDocTitle,{get children(){return t.title}}),(0,r.createComponent)(c.TSDocParam,{name:`args`,children:`The command-line arguments passed to the command.`})]}}),(0,r.createComponent)(a.FunctionDeclaration,{export:!0,async:!0,name:`handler`,parameters:[{name:`args`,type:`string[]`,default:`useArgs()`}],get children(){return[(0,r.createComponent)(o.Spacing,{}),n,(0,r.createComponent)(o.Spacing,{}),(0,r.createComponent)(i.Show,{get when(){return!!u},children:u}),(0,r.createComponent)(o.Spacing,{}),i.code`return showHelp(); `]}})]}function g(e){let{command:a,imports:c,builtinImports:p,..._}=e,v=(0,s.usePowerlines)(),y=(0,i.computed)(()=>(0,f.joinPaths)(v.entryPath,a.segments.filter(e=>!(0,l.isDynamicPathSegment)(e)).join(`/`),`index.ts`));return[(0,r.createComponent)(m.TypescriptFile,(0,r.mergeProps)(_,{get path(){return y.value},get imports(){return(0,d.default)(c??{},Object.entries(a.children).filter(([,e])=>e.isVirtual).reduce((e,[t,n])=>(e[`./${n.name}`]=[{name:`handler`,alias:`handle${(0,u.pascalCase)(t)}`}],e),{}))},get builtinImports(){return(0,d.default)(p??{},{env:[`isDevelopment`,`isDebug`],console:[`warn`,`error`,`writeLine`,`textColors`],utils:[`isMinimal`,`isUnicodeSupported`,`findSuggestions`],state:[{name:`GlobalOptions`,type:!0},`useGlobal`,`useGlobalOptions`,`withCommand`,`useArgs`,`hasFlag`],[(0,f.joinPaths)(`help`,...a.segments.filter(e=>!(0,l.isDynamicPathSegment)(e)))]:[`showHelp`],[(0,f.joinPaths)(`banner`,...a.segments.filter(e=>!(0,l.isDynamicPathSegment)(e)))]:[`showBanner`]})},get children(){return[(0,r.createComponent)(o.Spacing,{}),(0,r.createComponent)(h,{command:a,banner:i.code`await showBanner(); `,get children(){return(0,r.createComponent)(t.CommandRouter,{get segments(){return a.segments},get commands(){return a.children}})}})]}})),(0,r.createComponent)(i.For,{get each(){return Object.values(a.children)},children:e=>(0,r.createComponent)(i.Show,{get when(){return e.isVirtual},get fallback(){return(0,r.createComponent)(n.CommandEntry,{command:e})},get children(){return(0,r.createComponent)(g,{command:e})}})})]}exports.VirtualCommandEntry=g,exports.VirtualCommandHandlerDeclaration=h;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
+ const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
3
+ const require_components_command_router = require('./command-router.cjs');
4
+ const require_components_command_entry = require('./command-entry.cjs');
5
+ let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
6
+ let _alloy_js_core = require("@alloy-js/core");
7
+ let _alloy_js_typescript = require("@alloy-js/typescript");
8
+ let _powerlines_plugin_alloy_core_components = require("@powerlines/plugin-alloy/core/components");
9
+ let _powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
10
+ let _powerlines_plugin_alloy_typescript_components_tsdoc = require("@powerlines/plugin-alloy/typescript/components/tsdoc");
11
+ let _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
12
+ let _stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
13
+ let defu = require("defu");
14
+ defu = require_runtime.__toESM(defu);
15
+ let _stryke_path_join = require("@stryke/path/join");
16
+ let _stryke_string_format_constant_case = require("@stryke/string-format/constant-case");
17
+ let _powerlines_plugin_alloy_typescript_components_typescript_file = require("@powerlines/plugin-alloy/typescript/components/typescript-file");
18
+
19
+ //#region src/components/virtual-command-entry.tsx
20
+ /**
21
+ * A component that generates the `handler` function declaration for a command.
22
+ */
23
+ function VirtualCommandHandlerDeclaration(props) {
24
+ const { command, children, banner } = props;
25
+ const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
26
+ return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
27
+ get heading() {
28
+ return `The ${command.title} (${(0, _shell_shock_core_plugin_utils.getAppBin)(context)} ${command.segments.map((segment) => (0, _shell_shock_core_plugin_utils.isDynamicPathSegment)(segment) ? `[${(0, _stryke_string_format_constant_case.constantCase)((0, _shell_shock_core_plugin_utils.getDynamicPathSegmentName)(segment))}]` : segment).join(" ")}) virtual command.`;
29
+ },
30
+ get children() {
31
+ return [
32
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { get children() {
33
+ return `${command.description.replace(/\.+$/, "")}.`;
34
+ } }),
35
+ (0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
36
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocTitle, { get children() {
37
+ return command.title;
38
+ } }),
39
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
40
+ name: "args",
41
+ children: `The command-line arguments passed to the command.`
42
+ })
43
+ ];
44
+ }
45
+ }), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
46
+ "export": true,
47
+ async: true,
48
+ name: "handler",
49
+ parameters: [{
50
+ name: "args",
51
+ type: "string[]",
52
+ default: "useArgs()"
53
+ }],
54
+ get children() {
55
+ return [
56
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components.Spacing, {}),
57
+ children,
58
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components.Spacing, {}),
59
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
60
+ get when() {
61
+ return Boolean(banner);
62
+ },
63
+ children: banner
64
+ }),
65
+ (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components.Spacing, {}),
66
+ _alloy_js_core.code`return showHelp(); `
67
+ ];
68
+ }
69
+ })];
70
+ }
71
+ /**
72
+ * The virtual command entry point for the Shell Shock project.
73
+ */
74
+ function VirtualCommandEntry(props) {
75
+ const { command, imports, builtinImports, ...rest } = props;
76
+ const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
77
+ const filePath = (0, _alloy_js_core.computed)(() => (0, _stryke_path_join.joinPaths)(context.entryPath, command.segments.filter((segment) => !(0, _shell_shock_core_plugin_utils.isDynamicPathSegment)(segment)).join("/"), "index.ts"));
78
+ return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_typescript_file.TypescriptFile, (0, _alloy_js_core_jsx_runtime.mergeProps)(rest, {
79
+ get path() {
80
+ return filePath.value;
81
+ },
82
+ get imports() {
83
+ return (0, defu.default)(imports ?? {}, Object.entries(command.children).filter(([, child]) => child.virtual).reduce((ret, [name, child]) => {
84
+ ret[`./${child.name}`] = [{
85
+ name: "handler",
86
+ alias: `handle${(0, _stryke_string_format_pascal_case.pascalCase)(name)}`
87
+ }];
88
+ return ret;
89
+ }, {}));
90
+ },
91
+ get builtinImports() {
92
+ return (0, defu.default)(builtinImports ?? {}, {
93
+ env: ["isDevelopment", "isDebug"],
94
+ console: [
95
+ "warn",
96
+ "error",
97
+ "writeLine",
98
+ "textColors"
99
+ ],
100
+ utils: [
101
+ "isMinimal",
102
+ "isUnicodeSupported",
103
+ "findSuggestions"
104
+ ],
105
+ state: [
106
+ {
107
+ name: "GlobalOptions",
108
+ type: true
109
+ },
110
+ "useGlobal",
111
+ "useGlobalOptions",
112
+ "withCommand",
113
+ "useArgs",
114
+ "hasFlag"
115
+ ],
116
+ [(0, _stryke_path_join.joinPaths)("help", ...command.segments.filter((segment) => !(0, _shell_shock_core_plugin_utils.isDynamicPathSegment)(segment)))]: ["showHelp"],
117
+ [(0, _stryke_path_join.joinPaths)("banner", ...command.segments.filter((segment) => !(0, _shell_shock_core_plugin_utils.isDynamicPathSegment)(segment)))]: ["showBanner"]
118
+ });
119
+ },
120
+ get children() {
121
+ return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components.Spacing, {}), (0, _alloy_js_core_jsx_runtime.createComponent)(VirtualCommandHandlerDeclaration, {
122
+ command,
123
+ banner: _alloy_js_core.code`await showBanner(); `,
124
+ get children() {
125
+ return (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_command_router.CommandRouter, {
126
+ get segments() {
127
+ return command.segments;
128
+ },
129
+ get commands() {
130
+ return command.children;
131
+ }
132
+ });
133
+ }
134
+ })];
135
+ }
136
+ })), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
137
+ get each() {
138
+ return Object.values(command.children);
139
+ },
140
+ children: (child) => (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
141
+ get when() {
142
+ return child.virtual;
143
+ },
144
+ get fallback() {
145
+ return (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_command_entry.CommandEntry, { command: child });
146
+ },
147
+ get children() {
148
+ return (0, _alloy_js_core_jsx_runtime.createComponent)(VirtualCommandEntry, { command: child });
149
+ }
150
+ })
151
+ })];
152
+ }
153
+
154
+ //#endregion
155
+ exports.VirtualCommandEntry = VirtualCommandEntry;
156
+ exports.VirtualCommandHandlerDeclaration = VirtualCommandHandlerDeclaration;
@@ -1 +1 @@
1
- {"version":3,"file":"virtual-command-entry.d.mts","names":[],"sources":["../../src/components/virtual-command-entry.tsx"],"mappings":";;;;;UA8CiB,qCAAA;EACf,OAAA,EAAS,WAAA;EACT,MAAA,GAAS,QAAA;EACT,QAAA,GAAW,QAAA;AAAA;;;;iBAMG,gCAAA,CACd,KAAA,EAAO,qCAAA,GAAqC,QAAA;AAAA,UAqC7B,wBAAA,SAAiC,IAAA,CAChD,cAAA;EAGA,OAAA,EAAS,WAAA;AAAA;;;;iBAMK,mBAAA,CAAoB,KAAA,EAAO,wBAAA,GAAwB,QAAA"}
1
+ {"version":3,"file":"virtual-command-entry.d.mts","names":[],"sources":["../../src/components/virtual-command-entry.tsx"],"mappings":""}