@shell-shock/preset-script 0.6.61 → 0.6.63
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/_virtual/_rolldown/runtime.cjs +1 -29
- package/dist/components/bin-entry.cjs +3 -149
- package/dist/components/bin-entry.d.cts.map +1 -1
- package/dist/components/bin-entry.d.mts.map +1 -1
- package/dist/components/bin-entry.mjs +3 -144
- package/dist/components/bin-entry.mjs.map +1 -1
- package/dist/components/command-entry.cjs +3 -203
- package/dist/components/command-entry.mjs +3 -197
- package/dist/components/command-entry.mjs.map +1 -1
- package/dist/components/command-router.cjs +2 -161
- package/dist/components/command-router.mjs +2 -156
- package/dist/components/command-router.mjs.map +1 -1
- package/dist/components/exit-function-declaration.cjs +6 -114
- package/dist/components/exit-function-declaration.mjs +6 -111
- package/dist/components/exit-function-declaration.mjs.map +1 -1
- package/dist/components/index.cjs +1 -18
- package/dist/components/index.mjs +1 -7
- package/dist/components/virtual-command-entry.cjs +1 -154
- package/dist/components/virtual-command-entry.mjs +1 -149
- package/dist/components/virtual-command-entry.mjs.map +1 -1
- package/dist/helpers/get-global-options.cjs +1 -76
- package/dist/helpers/get-global-options.mjs +1 -73
- package/dist/helpers/get-global-options.mjs.map +1 -1
- package/dist/index.cjs +1 -127
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -120
- package/dist/index.mjs.map +1 -1
- package/dist/types/index.mjs +1 -1
- package/dist/types/plugin.mjs +1 -1
- package/package.json +15 -19
- package/dist/components/bin-entry.cjs.map +0 -1
- package/dist/components/command-entry.cjs.map +0 -1
- package/dist/components/command-router.cjs.map +0 -1
- package/dist/components/exit-function-declaration.cjs.map +0 -1
- package/dist/components/virtual-command-entry.cjs.map +0 -1
- package/dist/helpers/get-global-options.cjs.map +0 -1
- package/dist/index.cjs.map +0 -1
package/README.md
CHANGED
|
@@ -249,7 +249,7 @@ generation of development tools, please reach out on our
|
|
|
249
249
|
|
|
250
250
|
<div align="center"><a href="https://stormsoftware.com" target="_blank"><img src="https://public.storm-cdn.com/storm-software/icon-circle-fill-dark.png" alt="Storm Software" width="200px"/></a></div>
|
|
251
251
|
<br />
|
|
252
|
-
<div align="center"><a href="https://stormsoftware.com" target="_blank"><img src="https://public.storm-cdn.com/visit-us-
|
|
252
|
+
<div align="center"><a href="https://stormsoftware.com" target="_blank"><picture><source media="(prefers-color-scheme: dark)" srcset="https://public.storm-cdn.com/misc/text/visit-us-dark.png"><source media="(prefers-color-scheme: light)" srcset="https://public.storm-cdn.com/misc/text/visit-us-light.png"><img src="https://public.storm-cdn.com/misc/text/visit-us-dark.png" height="90px" alt="Visit us at stormsoftware.com" /></picture></a></div>
|
|
253
253
|
|
|
254
254
|
<br />
|
|
255
255
|
|
|
@@ -1,29 +1 @@
|
|
|
1
|
-
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
-
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
-
key = keys[i];
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
13
|
-
__defProp(to, key, {
|
|
14
|
-
get: ((k) => from[k]).bind(null, key),
|
|
15
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return to;
|
|
21
|
-
};
|
|
22
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
23
|
-
value: mod,
|
|
24
|
-
enumerable: true
|
|
25
|
-
}) : target, mod));
|
|
26
|
-
|
|
27
|
-
//#endregion
|
|
28
|
-
|
|
29
|
-
exports.__toESM = __toESM;
|
|
1
|
+
var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));exports.__toESM=s;
|
|
@@ -1,29 +1,4 @@
|
|
|
1
|
-
Object.defineProperty(exports,
|
|
2
|
-
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
|
-
const require_components_exit_function_declaration = require('./exit-function-declaration.cjs');
|
|
4
|
-
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
5
|
-
let _alloy_js_core = require("@alloy-js/core");
|
|
6
|
-
let _alloy_js_typescript = require("@alloy-js/typescript");
|
|
7
|
-
let _powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
|
|
8
|
-
let _powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
9
|
-
let _powerlines_plugin_alloy_typescript_components_entry_file = require("@powerlines/plugin-alloy/typescript/components/entry-file");
|
|
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_helpers_get_unique = require("@stryke/helpers/get-unique");
|
|
13
|
-
let _stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
|
|
14
|
-
let _stryke_path_replace = require("@stryke/path/replace");
|
|
15
|
-
let _stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
|
|
16
|
-
let defu = require("defu");
|
|
17
|
-
defu = require_runtime.__toESM(defu);
|
|
18
|
-
|
|
19
|
-
//#region src/components/bin-entry.tsx
|
|
20
|
-
/**
|
|
21
|
-
* Runs the application main logic with proper exit handling.
|
|
22
|
-
*/
|
|
23
|
-
function RunApplication() {
|
|
24
|
-
return [
|
|
25
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
26
|
-
_alloy_js_core.code`// Run the application main logic inside an asynchronous IIFE
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`../_virtual/_rolldown/runtime.cjs`),t=require(`./exit-function-declaration.cjs`);let n=require(`@alloy-js/core/jsx-runtime`),r=require(`@alloy-js/core`),i=require(`@alloy-js/typescript`),a=require(`@powerlines/plugin-alloy/core/components/spacing`),o=require(`@powerlines/plugin-alloy/core/contexts/context`),s=require(`@powerlines/plugin-alloy/typescript/components/entry-file`),c=require(`@powerlines/plugin-alloy/typescript/components/tsdoc`),l=require(`@shell-shock/core/plugin-utils`),u=require(`@stryke/helpers/get-unique`),d=require(`@stryke/path/file-path-fns`),f=require(`@stryke/path/replace`),p=require(`@stryke/string-format/pascal-case`),m=require(`defu`);m=e.__toESM(m);function h(){return[(0,n.createComponent)(a.Spacing,{}),r.code`// Run the application main logic inside an asynchronous IIFE
|
|
27
2
|
(async () => {
|
|
28
3
|
const startDate = new Date();
|
|
29
4
|
try {
|
|
@@ -89,126 +64,5 @@ function RunApplication() {
|
|
|
89
64
|
exit({ startDate, exception: err as Error });
|
|
90
65
|
}
|
|
91
66
|
})();
|
|
92
|
-
`,
|
|
93
|
-
|
|
94
|
-
];
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* The binary entry point for the Shell Shock project.
|
|
98
|
-
*/
|
|
99
|
-
function BinEntry(props) {
|
|
100
|
-
const { prefix, postfix, builtinImports, imports, children, ...rest } = props;
|
|
101
|
-
const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
102
|
-
const bins = (0, _alloy_js_core.computed)(() => (0, _stryke_helpers_get_unique.getUnique)(Object.values(context.config.bin)));
|
|
103
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
104
|
-
get each() {
|
|
105
|
-
return bins.value;
|
|
106
|
-
},
|
|
107
|
-
children: (bin) => (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_entry_file.EntryFile, (0, _alloy_js_core_jsx_runtime.mergeProps)(rest, {
|
|
108
|
-
get path() {
|
|
109
|
-
return (0, _stryke_path_file_path_fns.findFileName)((0, _stryke_path_replace.replaceExtension)(bin));
|
|
110
|
-
},
|
|
111
|
-
typeDefinition: {
|
|
112
|
-
file: bin,
|
|
113
|
-
output: "bin"
|
|
114
|
-
},
|
|
115
|
-
get imports() {
|
|
116
|
-
return (0, defu.default)(imports ?? {}, Object.entries(context.commands).filter(([, command]) => command.isVirtual).reduce((ret, [name, command]) => {
|
|
117
|
-
ret[`./${command.name}`] = [{
|
|
118
|
-
name: "handler",
|
|
119
|
-
alias: `handle${(0, _stryke_string_format_pascal_case.pascalCase)(name)}`
|
|
120
|
-
}];
|
|
121
|
-
return ret;
|
|
122
|
-
}, {}));
|
|
123
|
-
},
|
|
124
|
-
get builtinImports() {
|
|
125
|
-
return (0, defu.default)(builtinImports ?? {}, {
|
|
126
|
-
env: [
|
|
127
|
-
"env",
|
|
128
|
-
"isDevelopment",
|
|
129
|
-
"isDebug"
|
|
130
|
-
],
|
|
131
|
-
console: [
|
|
132
|
-
"verbose",
|
|
133
|
-
"table",
|
|
134
|
-
"writeLine",
|
|
135
|
-
"borderColors",
|
|
136
|
-
"textColors",
|
|
137
|
-
"stripAnsi",
|
|
138
|
-
"error",
|
|
139
|
-
"warn"
|
|
140
|
-
],
|
|
141
|
-
utils: ["isUnicodeSupported", "findSuggestions"],
|
|
142
|
-
state: [
|
|
143
|
-
"withGlobal",
|
|
144
|
-
"useGlobal",
|
|
145
|
-
"hasFlag"
|
|
146
|
-
],
|
|
147
|
-
help: ["showHelp"],
|
|
148
|
-
banner: ["showBanner"]
|
|
149
|
-
});
|
|
150
|
-
},
|
|
151
|
-
get children() {
|
|
152
|
-
return [
|
|
153
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(require_components_exit_function_declaration.ExitFunctionDeclaration, {}),
|
|
154
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
155
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
156
|
-
get when() {
|
|
157
|
-
return Boolean(prefix);
|
|
158
|
-
},
|
|
159
|
-
get children() {
|
|
160
|
-
return [prefix, (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {})];
|
|
161
|
-
}
|
|
162
|
-
}),
|
|
163
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
164
|
-
get heading() {
|
|
165
|
-
return `Binary entry point for the ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context, true)} command-line interface application.`;
|
|
166
|
-
},
|
|
167
|
-
get children() {
|
|
168
|
-
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { get children() {
|
|
169
|
-
return `This file serves as the main entry point for the binary executable of the ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context, true)} command-line interface application. It sets up the necessary environment and runs the application logic with proper exit handling. The main function is defined within this file, and the application is executed inside an asynchronous IIFE to allow for the use of async/await syntax. The file also includes signal handling for graceful shutdowns and error handling for uncaught exceptions and unhandled promise rejections.`;
|
|
170
|
-
} }), (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocReturns, { children: `Returns a promise that resolves to either a successful result or an error object.` })];
|
|
171
|
-
}
|
|
172
|
-
}),
|
|
173
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
174
|
-
async: true,
|
|
175
|
-
returnType: "any | { error: string | Error }",
|
|
176
|
-
name: "main",
|
|
177
|
-
get children() {
|
|
178
|
-
return [
|
|
179
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
180
|
-
condition: _alloy_js_core.code`hasFlag(["version", "v"])`,
|
|
181
|
-
get children() {
|
|
182
|
-
return _alloy_js_core.code`console.log(${context?.packageJson.version ? `"${context?.packageJson.version}"` : "0.0.1"});
|
|
183
|
-
return; `;
|
|
184
|
-
}
|
|
185
|
-
}),
|
|
186
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
187
|
-
children,
|
|
188
|
-
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
|
|
189
|
-
];
|
|
190
|
-
}
|
|
191
|
-
}),
|
|
192
|
-
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
193
|
-
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
194
|
-
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
195
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
196
|
-
get when() {
|
|
197
|
-
return Boolean(postfix);
|
|
198
|
-
},
|
|
199
|
-
get fallback() {
|
|
200
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(RunApplication, {});
|
|
201
|
-
},
|
|
202
|
-
children: postfix
|
|
203
|
-
}),
|
|
204
|
-
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
|
|
205
|
-
];
|
|
206
|
-
}
|
|
207
|
-
}))
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
|
|
211
|
-
//#endregion
|
|
212
|
-
exports.BinEntry = BinEntry;
|
|
213
|
-
exports.RunApplication = RunApplication;
|
|
214
|
-
//# sourceMappingURL=bin-entry.cjs.map
|
|
67
|
+
`,(0,n.createIntrinsic)(`hbr`,{})]}function g(e){let{prefix:g,postfix:_,builtinImports:v,imports:y,children:b,...x}=e,S=(0,o.usePowerlines)(),C=(0,r.computed)(()=>(0,u.getUnique)(Object.values(S.config.bin)));return(0,n.createComponent)(r.For,{get each(){return C.value},children:e=>(0,n.createComponent)(s.EntryFile,(0,n.mergeProps)(x,{get path(){return(0,d.findFileName)((0,f.replaceExtension)(e))},typeDefinition:{file:e,output:`bin`,input:{file:e}},get imports(){return(0,m.default)(y??{},Object.entries(S.commands).filter(([,e])=>e.isVirtual).reduce((e,[t,n])=>(e[`./${n.name}`]=[{name:`handler`,alias:`handle${(0,p.pascalCase)(t)}`}],e),{}))},get builtinImports(){return(0,m.default)(v??{},{env:[`env`,`isDevelopment`,`isDebug`],console:[`verbose`,`table`,`writeLine`,`borderColors`,`textColors`,`stripAnsi`,`error`,`warn`],utils:[`isUnicodeSupported`,`findSuggestions`],state:[`withGlobal`,`useGlobal`,`hasFlag`],help:[`showHelp`],banner:[`showBanner`]})},get children(){return[(0,n.createComponent)(t.ExitFunctionDeclaration,{}),(0,n.createComponent)(a.Spacing,{}),(0,n.createComponent)(r.Show,{get when(){return!!g},get children(){return[g,(0,n.createComponent)(a.Spacing,{})]}}),(0,n.createComponent)(c.TSDoc,{get heading(){return`Binary entry point for the ${(0,l.getAppTitle)(S,!0)} command-line interface application.`},get children(){return[(0,n.createComponent)(c.TSDocRemarks,{get children(){return`This file serves as the main entry point for the binary executable of the ${(0,l.getAppTitle)(S,!0)} command-line interface application. It sets up the necessary environment and runs the application logic with proper exit handling. The main function is defined within this file, and the application is executed inside an asynchronous IIFE to allow for the use of async/await syntax. The file also includes signal handling for graceful shutdowns and error handling for uncaught exceptions and unhandled promise rejections.`}}),(0,n.createComponent)(c.TSDocReturns,{children:`Returns a promise that resolves to either a successful result or an error object.`})]}}),(0,n.createComponent)(i.FunctionDeclaration,{async:!0,returnType:`any | { error: string | Error }`,name:`main`,get children(){return[(0,n.createComponent)(i.IfStatement,{condition:r.code`hasFlag(["version", "v"])`,get children(){return r.code`console.log(${S?.packageJson.version?`"${S?.packageJson.version}"`:`0.0.1`});
|
|
68
|
+
return; `}}),(0,n.createComponent)(a.Spacing,{}),b,(0,n.createIntrinsic)(`hbr`,{})]}}),(0,n.createIntrinsic)(`hbr`,{}),(0,n.createIntrinsic)(`hbr`,{}),(0,n.createIntrinsic)(`hbr`,{}),(0,n.createComponent)(r.Show,{get when(){return!!_},get fallback(){return(0,n.createComponent)(h,{})},children:_}),(0,n.createIntrinsic)(`hbr`,{})]}}))})}exports.BinEntry=g,exports.RunApplication=h;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bin-entry.d.cts","names":[],"sources":["../../src/components/bin-entry.tsx"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"bin-entry.d.cts","names":[],"sources":["../../src/components/bin-entry.tsx"],"mappings":";;;;;;AA4CA;iBAAgB,cAAA,CAAA,GAAc,QAAA;AAAA,UA4Eb,aAAA,SAAsB,IAAA,CACrC,cAAA;EAGA,MAAA,GAAS,QAAA;EACT,OAAA,GAAU,QAAA;EACV,QAAA,EAAU,QAAA;AAAA;;;;iBAMI,QAAA,CAAS,KAAA,EAAO,aAAA,GAAa,QAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bin-entry.d.mts","names":[],"sources":["../../src/components/bin-entry.tsx"],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"bin-entry.d.mts","names":[],"sources":["../../src/components/bin-entry.tsx"],"mappings":";;;;;;AA4CA;iBAAgB,cAAA,CAAA,GAAc,QAAA;AAAA,UA4Eb,aAAA,SAAsB,IAAA,CACrC,cAAA;EAGA,MAAA,GAAS,QAAA;EACT,OAAA,GAAU,QAAA;EACV,QAAA,EAAU,QAAA;AAAA;;;;iBAMI,QAAA,CAAS,KAAA,EAAO,aAAA,GAAa,QAAA"}
|
|
@@ -1,26 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { createComponent, createIntrinsic, memo, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
3
|
-
import { For, Show, code, computed } from "@alloy-js/core";
|
|
4
|
-
import { FunctionDeclaration, IfStatement } from "@alloy-js/typescript";
|
|
5
|
-
import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
|
|
6
|
-
import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
|
|
7
|
-
import { EntryFile } from "@powerlines/plugin-alloy/typescript/components/entry-file";
|
|
8
|
-
import { TSDoc, TSDocRemarks, TSDocReturns } from "@powerlines/plugin-alloy/typescript/components/tsdoc";
|
|
9
|
-
import { getAppTitle } from "@shell-shock/core/plugin-utils";
|
|
10
|
-
import { getUnique } from "@stryke/helpers/get-unique";
|
|
11
|
-
import { findFileName } from "@stryke/path/file-path-fns";
|
|
12
|
-
import { replaceExtension } from "@stryke/path/replace";
|
|
13
|
-
import { pascalCase } from "@stryke/string-format/pascal-case";
|
|
14
|
-
import defu from "defu";
|
|
15
|
-
|
|
16
|
-
//#region src/components/bin-entry.tsx
|
|
17
|
-
/**
|
|
18
|
-
* Runs the application main logic with proper exit handling.
|
|
19
|
-
*/
|
|
20
|
-
function RunApplication() {
|
|
21
|
-
return [
|
|
22
|
-
createComponent(Spacing, {}),
|
|
23
|
-
code`// Run the application main logic inside an asynchronous IIFE
|
|
1
|
+
import{ExitFunctionDeclaration as e}from"./exit-function-declaration.mjs";import{createComponent as t,createIntrinsic as n,mergeProps as r}from"@alloy-js/core/jsx-runtime";import{For as i,Show as a,code as o,computed as s}from"@alloy-js/core";import{FunctionDeclaration as c,IfStatement as l}from"@alloy-js/typescript";import{Spacing as u}from"@powerlines/plugin-alloy/core/components/spacing";import{usePowerlines as d}from"@powerlines/plugin-alloy/core/contexts/context";import{EntryFile as f}from"@powerlines/plugin-alloy/typescript/components/entry-file";import{TSDoc as p,TSDocRemarks as m,TSDocReturns as h}from"@powerlines/plugin-alloy/typescript/components/tsdoc";import{getAppTitle as g}from"@shell-shock/core/plugin-utils";import{getUnique as _}from"@stryke/helpers/get-unique";import{findFileName as v}from"@stryke/path/file-path-fns";import{replaceExtension as y}from"@stryke/path/replace";import{pascalCase as b}from"@stryke/string-format/pascal-case";import x from"defu";function S(){return[t(u,{}),o`// Run the application main logic inside an asynchronous IIFE
|
|
24
2
|
(async () => {
|
|
25
3
|
const startDate = new Date();
|
|
26
4
|
try {
|
|
@@ -86,125 +64,6 @@ function RunApplication() {
|
|
|
86
64
|
exit({ startDate, exception: err as Error });
|
|
87
65
|
}
|
|
88
66
|
})();
|
|
89
|
-
`,
|
|
90
|
-
|
|
91
|
-
];
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* The binary entry point for the Shell Shock project.
|
|
95
|
-
*/
|
|
96
|
-
function BinEntry(props) {
|
|
97
|
-
const { prefix, postfix, builtinImports, imports, children, ...rest } = props;
|
|
98
|
-
const context = usePowerlines();
|
|
99
|
-
const bins = computed(() => getUnique(Object.values(context.config.bin)));
|
|
100
|
-
return createComponent(For, {
|
|
101
|
-
get each() {
|
|
102
|
-
return bins.value;
|
|
103
|
-
},
|
|
104
|
-
children: (bin) => createComponent(EntryFile, mergeProps(rest, {
|
|
105
|
-
get path() {
|
|
106
|
-
return findFileName(replaceExtension(bin));
|
|
107
|
-
},
|
|
108
|
-
typeDefinition: {
|
|
109
|
-
file: bin,
|
|
110
|
-
output: "bin"
|
|
111
|
-
},
|
|
112
|
-
get imports() {
|
|
113
|
-
return defu(imports ?? {}, Object.entries(context.commands).filter(([, command]) => command.isVirtual).reduce((ret, [name, command]) => {
|
|
114
|
-
ret[`./${command.name}`] = [{
|
|
115
|
-
name: "handler",
|
|
116
|
-
alias: `handle${pascalCase(name)}`
|
|
117
|
-
}];
|
|
118
|
-
return ret;
|
|
119
|
-
}, {}));
|
|
120
|
-
},
|
|
121
|
-
get builtinImports() {
|
|
122
|
-
return defu(builtinImports ?? {}, {
|
|
123
|
-
env: [
|
|
124
|
-
"env",
|
|
125
|
-
"isDevelopment",
|
|
126
|
-
"isDebug"
|
|
127
|
-
],
|
|
128
|
-
console: [
|
|
129
|
-
"verbose",
|
|
130
|
-
"table",
|
|
131
|
-
"writeLine",
|
|
132
|
-
"borderColors",
|
|
133
|
-
"textColors",
|
|
134
|
-
"stripAnsi",
|
|
135
|
-
"error",
|
|
136
|
-
"warn"
|
|
137
|
-
],
|
|
138
|
-
utils: ["isUnicodeSupported", "findSuggestions"],
|
|
139
|
-
state: [
|
|
140
|
-
"withGlobal",
|
|
141
|
-
"useGlobal",
|
|
142
|
-
"hasFlag"
|
|
143
|
-
],
|
|
144
|
-
help: ["showHelp"],
|
|
145
|
-
banner: ["showBanner"]
|
|
146
|
-
});
|
|
147
|
-
},
|
|
148
|
-
get children() {
|
|
149
|
-
return [
|
|
150
|
-
createComponent(ExitFunctionDeclaration, {}),
|
|
151
|
-
createComponent(Spacing, {}),
|
|
152
|
-
createComponent(Show, {
|
|
153
|
-
get when() {
|
|
154
|
-
return Boolean(prefix);
|
|
155
|
-
},
|
|
156
|
-
get children() {
|
|
157
|
-
return [prefix, createComponent(Spacing, {})];
|
|
158
|
-
}
|
|
159
|
-
}),
|
|
160
|
-
createComponent(TSDoc, {
|
|
161
|
-
get heading() {
|
|
162
|
-
return `Binary entry point for the ${getAppTitle(context, true)} command-line interface application.`;
|
|
163
|
-
},
|
|
164
|
-
get children() {
|
|
165
|
-
return [createComponent(TSDocRemarks, { get children() {
|
|
166
|
-
return `This file serves as the main entry point for the binary executable of the ${getAppTitle(context, true)} command-line interface application. It sets up the necessary environment and runs the application logic with proper exit handling. The main function is defined within this file, and the application is executed inside an asynchronous IIFE to allow for the use of async/await syntax. The file also includes signal handling for graceful shutdowns and error handling for uncaught exceptions and unhandled promise rejections.`;
|
|
167
|
-
} }), createComponent(TSDocReturns, { children: `Returns a promise that resolves to either a successful result or an error object.` })];
|
|
168
|
-
}
|
|
169
|
-
}),
|
|
170
|
-
createComponent(FunctionDeclaration, {
|
|
171
|
-
async: true,
|
|
172
|
-
returnType: "any | { error: string | Error }",
|
|
173
|
-
name: "main",
|
|
174
|
-
get children() {
|
|
175
|
-
return [
|
|
176
|
-
createComponent(IfStatement, {
|
|
177
|
-
condition: code`hasFlag(["version", "v"])`,
|
|
178
|
-
get children() {
|
|
179
|
-
return code`console.log(${context?.packageJson.version ? `"${context?.packageJson.version}"` : "0.0.1"});
|
|
180
|
-
return; `;
|
|
181
|
-
}
|
|
182
|
-
}),
|
|
183
|
-
createComponent(Spacing, {}),
|
|
184
|
-
children,
|
|
185
|
-
createIntrinsic("hbr", {})
|
|
186
|
-
];
|
|
187
|
-
}
|
|
188
|
-
}),
|
|
189
|
-
createIntrinsic("hbr", {}),
|
|
190
|
-
createIntrinsic("hbr", {}),
|
|
191
|
-
createIntrinsic("hbr", {}),
|
|
192
|
-
createComponent(Show, {
|
|
193
|
-
get when() {
|
|
194
|
-
return Boolean(postfix);
|
|
195
|
-
},
|
|
196
|
-
get fallback() {
|
|
197
|
-
return createComponent(RunApplication, {});
|
|
198
|
-
},
|
|
199
|
-
children: postfix
|
|
200
|
-
}),
|
|
201
|
-
createIntrinsic("hbr", {})
|
|
202
|
-
];
|
|
203
|
-
}
|
|
204
|
-
}))
|
|
205
|
-
});
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
//#endregion
|
|
209
|
-
export { BinEntry, RunApplication };
|
|
67
|
+
`,n(`hbr`,{})]}function C(C){let{prefix:w,postfix:T,builtinImports:E,imports:D,children:O,...k}=C,A=d(),j=s(()=>_(Object.values(A.config.bin)));return t(i,{get each(){return j.value},children:i=>t(f,r(k,{get path(){return v(y(i))},typeDefinition:{file:i,output:`bin`,input:{file:i}},get imports(){return x(D??{},Object.entries(A.commands).filter(([,e])=>e.isVirtual).reduce((e,[t,n])=>(e[`./${n.name}`]=[{name:`handler`,alias:`handle${b(t)}`}],e),{}))},get builtinImports(){return x(E??{},{env:[`env`,`isDevelopment`,`isDebug`],console:[`verbose`,`table`,`writeLine`,`borderColors`,`textColors`,`stripAnsi`,`error`,`warn`],utils:[`isUnicodeSupported`,`findSuggestions`],state:[`withGlobal`,`useGlobal`,`hasFlag`],help:[`showHelp`],banner:[`showBanner`]})},get children(){return[t(e,{}),t(u,{}),t(a,{get when(){return!!w},get children(){return[w,t(u,{})]}}),t(p,{get heading(){return`Binary entry point for the ${g(A,!0)} command-line interface application.`},get children(){return[t(m,{get children(){return`This file serves as the main entry point for the binary executable of the ${g(A,!0)} command-line interface application. It sets up the necessary environment and runs the application logic with proper exit handling. The main function is defined within this file, and the application is executed inside an asynchronous IIFE to allow for the use of async/await syntax. The file also includes signal handling for graceful shutdowns and error handling for uncaught exceptions and unhandled promise rejections.`}}),t(h,{children:`Returns a promise that resolves to either a successful result or an error object.`})]}}),t(c,{async:!0,returnType:`any | { error: string | Error }`,name:`main`,get children(){return[t(l,{condition:o`hasFlag(["version", "v"])`,get children(){return o`console.log(${A?.packageJson.version?`"${A?.packageJson.version}"`:`0.0.1`});
|
|
68
|
+
return; `}}),t(u,{}),O,n(`hbr`,{})]}}),n(`hbr`,{}),n(`hbr`,{}),n(`hbr`,{}),t(a,{get when(){return!!T},get fallback(){return t(S,{})},children:T}),n(`hbr`,{})]}}))})}export{C as BinEntry,S as RunApplication};
|
|
210
69
|
//# sourceMappingURL=bin-entry.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bin-entry.mjs","names":[],"sources":["../../src/components/bin-entry.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 type { Children } from \"@alloy-js/core\";\nimport { code, computed, For, Show } from \"@alloy-js/core\";\nimport { FunctionDeclaration, IfStatement } from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport type { TypescriptFileImports } from \"@powerlines/plugin-alloy/types/components\";\nimport type { EntryFileProps } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport { EntryFile } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport {\n TSDoc,\n TSDocRemarks,\n TSDocReturns\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { getAppTitle } from \"@shell-shock/core/plugin-utils\";\nimport { getUnique } from \"@stryke/helpers/get-unique\";\nimport { findFileName } from \"@stryke/path/file-path-fns\";\nimport { replaceExtension } from \"@stryke/path/replace\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport defu from \"defu\";\nimport type { ScriptPresetContext } from \"../types/plugin\";\nimport { ExitFunctionDeclaration } from \"./exit-function-declaration\";\n\n/**\n * Runs the application main logic with proper exit handling.\n */\nexport function RunApplication() {\n return (\n <>\n <Spacing />\n {code`// Run the application main logic inside an asynchronous IIFE\n (async () => {\n const startDate = new Date();\n try {\n process.on(\"exit\", () => exit({\n startDate,\n skipProcessExit: true,\n isSynchronous: true,\n signal: 0\n }));\n process.on(\"beforeExit\", () => exit({\n startDate,\n signal: 0\n }));\n process.on(\"message\", message => {\n if (message === 'shutdown') {\n exit({\n startDate,\n isSynchronous: true,\n signal: -128\n });\n }\n });\n\n process.once(\"SIGTERM\", () => exit({\n startDate,\n signal: 15\n }));\n process.once(\"SIGINT\", () => exit({\n startDate,\n signal: 2\n }));\n process.once(\"SIGUSR2\", () => {\n verbose(\"The application was terminated by the user\");\n return exit({\n startDate,\n signal: 12\n });\n });\n process.once(\"SIGQUIT\", () => {\n verbose(\"The application was terminated by the user\");\n return exit({\n startDate,\n signal: 12\n });\n });\n\n for (const type of [\"unhandledRejection\", \"uncaughtException\"]) {\n process.on(type, err => exit({\n startDate,\n exception: err || new Error(\\`An \\${type === \"unhandledRejection\" ? \"unhandled promise rejection\" : \"uncaught exception\"} occurred during processing - the application is shutting down.\\`)\n }));\n }\n\n await withGlobal(async () => {\n const result = await main();\n if (result?.error) {\n error(result.error);\n }\n });\n\n exit({ startDate });\n } catch (err) {\n exit({ startDate, exception: err as Error });\n }\n })();\n `}\n <hbr />\n </>\n );\n}\n\nexport interface BinEntryProps extends Omit<\n EntryFileProps,\n \"path\" | \"hashbang\"\n> {\n prefix?: Children;\n postfix?: Children;\n children: Children;\n}\n\n/**\n * The binary entry point for the Shell Shock project.\n */\nexport function BinEntry(props: BinEntryProps) {\n const { prefix, postfix, builtinImports, imports, children, ...rest } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n const bins = computed(() => getUnique(Object.values(context.config.bin)));\n\n return (\n <For each={bins.value}>\n {bin => (\n <EntryFile\n {...rest}\n path={findFileName(replaceExtension(bin))}\n typeDefinition={{\n file: bin,\n output: \"bin\"\n }}\n imports={defu(\n imports ?? {},\n Object.entries(context.commands)\n .filter(([, command]) => command.isVirtual)\n .reduce((ret, [name, command]) => {\n ret[`./${command.name}`] = [\n { name: \"handler\", alias: `handle${pascalCase(name)}` }\n ];\n\n return ret;\n }, {} as TypescriptFileImports)\n )}\n builtinImports={defu(builtinImports ?? {}, {\n env: [\"env\", \"isDevelopment\", \"isDebug\"],\n console: [\n \"verbose\",\n \"table\",\n \"writeLine\",\n \"borderColors\",\n \"textColors\",\n \"stripAnsi\",\n \"error\",\n \"warn\"\n ],\n utils: [\"isUnicodeSupported\", \"findSuggestions\"],\n state: [\"withGlobal\", \"useGlobal\", \"hasFlag\"],\n help: [\"showHelp\"],\n banner: [\"showBanner\"]\n })}>\n <ExitFunctionDeclaration />\n <Spacing />\n <Show when={Boolean(prefix)}>\n {prefix}\n <Spacing />\n </Show>\n <TSDoc\n heading={`Binary entry point for the ${getAppTitle(\n context,\n true\n )} command-line interface application.`}>\n <TSDocRemarks>\n {`This file serves as the main entry point for the binary executable of the ${getAppTitle(\n context,\n true\n )} command-line interface application. It sets up the necessary environment and runs the application logic with proper exit handling. The main function is defined within this file, and the application is executed inside an asynchronous IIFE to allow for the use of async/await syntax. The file also includes signal handling for graceful shutdowns and error handling for uncaught exceptions and unhandled promise rejections.`}\n </TSDocRemarks>\n <TSDocReturns>\n {`Returns a promise that resolves to either a successful result or an error object.`}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n async\n returnType=\"any | { error: string | Error }\"\n name=\"main\">\n <IfStatement condition={code`hasFlag([\"version\", \"v\"])`}>\n {code`console.log(${\n context?.packageJson.version\n ? `\"${context?.packageJson.version}\"`\n : \"0.0.1\"\n });\n return; `}\n </IfStatement>\n <Spacing />\n {children}\n <hbr />\n </FunctionDeclaration>\n <hbr />\n <hbr />\n <hbr />\n <Show when={Boolean(postfix)} fallback={<RunApplication />}>\n {postfix}\n </Show>\n <hbr />\n </EntryFile>\n )}\n </For>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAwCA,SAAE,iBAAA;AACA,QAAM;EAAA,gBAAoB,SAAO,EAAI,CAAC;EAAA,IAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8E9C,MAAO,EACL,QACC,SACD,gBACA,SACA,UACA,GAAA,SACF;;CAEE,MAAA,OAAA,eAAA,UAAA,OAAA,OAAA,QAAA,OAAA,IAAA,CAAA,CAAA;AACA,QAAK,gBAAmB,KAAI;EAC5B,IAAA,OAAA;AACI,UAAC,KAAS;;;GAGd,IAAM,OAAS;AACT,WAAO,aAAa,iBAAY,IAAO,CAAA;;GAE7C,gBAAO;IACD,MAAM;IACP,QAAO;IACP;GACD,IAAI,UAAQ;AACV,WAAO,KAAC,WAAa,EAAA,EAAA,OAAA,QAAqB,QAAC,SAAA,CAAA,QAAA,GAAA,aAAA,QAAA,UAAA,CAAA,QAAA,KAAA,CAAA,MAAA,aAAA;AACzC,SAAA,KAAA,QAAgB,UAAA,CAAA;MACd,MAAM;MACN,OAAO,SAAK,WAAA,KAAA;MACb,CAAA;AACD,YAAO;OACN,EAAC,CAAa,CAAA;;GAEnB,IAAI,iBAAgB;AAClB,WAAO,KAAA,kBAAoB,EAAA,EAAO;KAChC,KAAK;MAAC;MAAO;MAAiB;MAAG;KACjC,SAAS;MAAC;MAAO;MAAU;MAAgB;MAAgB;MAAG;MAAA;MAAA;MAAA;KAC9D,OAAO,CAAA,sBAAA,kBAAA;;;;;;KAEP,MAAM,CAAA,WAAU;KAChB,QAAQ,CAAC,aAAI;KACd,CAAC;;GAEJ,IAAI,WAAS;AACX,WAAI;KAAA,gBAAS,yBAAA,EAAA,CAAA;KAAA,gBAAA,SAAA,EAAA,CAAA;KAAA,gBAAA,MAAA;MACX,IAAI,OAAC;AACH,cAAG,QAAM,OAAA;;MAEX,IAAI,WAAC;AACH,cAAG,CAAA,QAAW,gBAAA,SAAA,EAAA,CAAA,CAAA;;MAEjB,CAAC;KAAE,gBAAS,OAAA;MACX,IAAI,UAAK;AACP,cAAC,8BAAA,YAAA,SAAA,KAAA,CAAA;;MAEH,IAAE,WAAS;AACT,cAAO,CAAC,gBAAU,cAAA,EAClB,IAAM,WAAI;AACT,eAAA,6EAAA,YAAA,SAAA,KAAA,CAAA;UAEF,CAAA,EAAA,gBAAS,cAAA,EACT,UAAW,qFACT,CAAA,CAAA;;MAEJ,CAAC;KAAE,gBAAI,qBAAA;MACN,OAAC;MACD,YAAY;MACZ,MAAI;MACJ,IAAI,WAAA;AACF,cAAG;QAAA,gBAAuB,aAAa;SACtC,WAAY,IAAA;SACX,IAAE,WAAU;AACV,iBAAO,IAAA,eAAA,SAAA,YAAA,UAAA,IAAA,SAAA,YAAA,QAAA,KAAA,QAAA;;;SAGV,CAAC;QAAA,gBAAY,SAAA,EAAA,CAAA;QAAA;QAAA,gBAAA,OAAA,EAAA,CAAA;QAAA;;MAEjB,CAAC;KAAE,gBAAc,OAAQ,EAAK,CAAA;KAAA,gBAAqB,OAAA,EAAA,CAAU;KAAC,gBAAmB,OAAO,EAAC,CAAA;KAAA,gBAAA,MAAA;MACxF,IAAI,OAAA;AACF,cAAK,QAAA,QAAA;;MAEP,IAAE,WAAA;AACA,cAAA,gBAAyB,gBAAgB,EAAE,CAAA;;MAE7C,UAAG;MACJ,CAAC;KAAE,gBAAgB,OAAK,EAAA,CAAA;KAAA;;GAE5B,CAAC,CAAC;EACJ,CAAC"}
|
|
1
|
+
{"version":3,"file":"bin-entry.mjs","names":[],"sources":["../../src/components/bin-entry.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 type { Children } from \"@alloy-js/core\";\nimport { code, computed, For, Show } from \"@alloy-js/core\";\nimport { FunctionDeclaration, IfStatement } from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport type { TypescriptFileImports } from \"@powerlines/plugin-alloy/types/components\";\nimport type { EntryFileProps } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport { EntryFile } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport {\n TSDoc,\n TSDocRemarks,\n TSDocReturns\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { getAppTitle } from \"@shell-shock/core/plugin-utils\";\nimport type { CommandTree } from \"@shell-shock/core/types/command\";\nimport { getUnique } from \"@stryke/helpers/get-unique\";\nimport { findFileName } from \"@stryke/path/file-path-fns\";\nimport { replaceExtension } from \"@stryke/path/replace\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport defu from \"defu\";\nimport type { ScriptPresetContext } from \"../types/plugin\";\nimport { ExitFunctionDeclaration } from \"./exit-function-declaration\";\n\n/**\n * Runs the application main logic with proper exit handling.\n */\nexport function RunApplication() {\n return (\n <>\n <Spacing />\n {code`// Run the application main logic inside an asynchronous IIFE\n (async () => {\n const startDate = new Date();\n try {\n process.on(\"exit\", () => exit({\n startDate,\n skipProcessExit: true,\n isSynchronous: true,\n signal: 0\n }));\n process.on(\"beforeExit\", () => exit({\n startDate,\n signal: 0\n }));\n process.on(\"message\", message => {\n if (message === 'shutdown') {\n exit({\n startDate,\n isSynchronous: true,\n signal: -128\n });\n }\n });\n\n process.once(\"SIGTERM\", () => exit({\n startDate,\n signal: 15\n }));\n process.once(\"SIGINT\", () => exit({\n startDate,\n signal: 2\n }));\n process.once(\"SIGUSR2\", () => {\n verbose(\"The application was terminated by the user\");\n return exit({\n startDate,\n signal: 12\n });\n });\n process.once(\"SIGQUIT\", () => {\n verbose(\"The application was terminated by the user\");\n return exit({\n startDate,\n signal: 12\n });\n });\n\n for (const type of [\"unhandledRejection\", \"uncaughtException\"]) {\n process.on(type, err => exit({\n startDate,\n exception: err || new Error(\\`An \\${type === \"unhandledRejection\" ? \"unhandled promise rejection\" : \"uncaught exception\"} occurred during processing - the application is shutting down.\\`)\n }));\n }\n\n await withGlobal(async () => {\n const result = await main();\n if (result?.error) {\n error(result.error);\n }\n });\n\n exit({ startDate });\n } catch (err) {\n exit({ startDate, exception: err as Error });\n }\n })();\n `}\n <hbr />\n </>\n );\n}\n\nexport interface BinEntryProps extends Omit<\n EntryFileProps,\n \"path\" | \"hashbang\"\n> {\n prefix?: Children;\n postfix?: Children;\n children: Children;\n}\n\n/**\n * The binary entry point for the Shell Shock project.\n */\nexport function BinEntry(props: BinEntryProps) {\n const { prefix, postfix, builtinImports, imports, children, ...rest } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n const bins = computed<string[]>(() =>\n getUnique(Object.values(context.config.bin))\n );\n\n return (\n <For each={bins.value}>\n {bin => (\n <EntryFile\n {...rest}\n path={findFileName(replaceExtension(bin))}\n typeDefinition={{\n file: bin,\n output: \"bin\",\n input: {\n file: bin\n }\n }}\n imports={defu(\n imports ?? {},\n Object.entries(context.commands as Record<string, CommandTree>)\n .filter(([, command]) => command.isVirtual)\n .reduce((ret, [name, command]) => {\n ret[`./${command.name}`] = [\n { name: \"handler\", alias: `handle${pascalCase(name)}` }\n ];\n\n return ret;\n }, {} as TypescriptFileImports)\n )}\n builtinImports={defu(builtinImports ?? {}, {\n env: [\"env\", \"isDevelopment\", \"isDebug\"],\n console: [\n \"verbose\",\n \"table\",\n \"writeLine\",\n \"borderColors\",\n \"textColors\",\n \"stripAnsi\",\n \"error\",\n \"warn\"\n ],\n utils: [\"isUnicodeSupported\", \"findSuggestions\"],\n state: [\"withGlobal\", \"useGlobal\", \"hasFlag\"],\n help: [\"showHelp\"],\n banner: [\"showBanner\"]\n })}>\n <ExitFunctionDeclaration />\n <Spacing />\n <Show when={Boolean(prefix)}>\n {prefix}\n <Spacing />\n </Show>\n <TSDoc\n heading={`Binary entry point for the ${getAppTitle(\n context,\n true\n )} command-line interface application.`}>\n <TSDocRemarks>\n {`This file serves as the main entry point for the binary executable of the ${getAppTitle(\n context,\n true\n )} command-line interface application. It sets up the necessary environment and runs the application logic with proper exit handling. The main function is defined within this file, and the application is executed inside an asynchronous IIFE to allow for the use of async/await syntax. The file also includes signal handling for graceful shutdowns and error handling for uncaught exceptions and unhandled promise rejections.`}\n </TSDocRemarks>\n <TSDocReturns>\n {`Returns a promise that resolves to either a successful result or an error object.`}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n async\n returnType=\"any | { error: string | Error }\"\n name=\"main\">\n <IfStatement condition={code`hasFlag([\"version\", \"v\"])`}>\n {code`console.log(${\n context?.packageJson.version\n ? `\"${context?.packageJson.version}\"`\n : \"0.0.1\"\n });\n return; `}\n </IfStatement>\n <Spacing />\n {children}\n <hbr />\n </FunctionDeclaration>\n <hbr />\n <hbr />\n <hbr />\n <Show when={Boolean(postfix)} fallback={<RunApplication />}>\n {postfix}\n </Show>\n <hbr />\n </EntryFile>\n )}\n </For>\n );\n}\n"],"mappings":"y9BAoCA,SAAS,GAAoB,CAC7B,MAAO,CAAA,EAAgB,EAAA,EAAA,CAAA,CAAA,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;QAkEd,EAAkB,MAAM,EAAA,CAAI,CAAC,eAMpC,GAAM,CACJ,SACA,UACA,iBACA,UACA,WACA,GAAG,GACD,EACH,EAAA,GAAA,CACH,EAAA,MAAA,EAAA,OAAA,OAAA,EAAA,OAAA,IAAA,CAAA,CAAA,aAEA,IAAO,MAAA,CACL,OAAA,EAAc,OAEd,SAAA,GAAA,EAAA,EAAA,EAAA,EAAA,CACA,IAAQ,MAAC,CACT,OAAU,EAAQ,EAAA,EAAA,CAAA,EAEpB,eAAA,QAEE,OAAA,MACK,MAAO,CACZ,KAAA,EACK,CACA,eAEC,OAAO,EAAG,GAAa,EAAC,CAAA,OAAA,QAAA,EAAsB,SAAA,CAAA,QAAA,EAAA,KAAA,EAAA,UAAA,CAAA,QAAA,EAAA,CAAA,EAAA,MAC9C,EAAM,KAAC,EAAS,QAAa,CAAC,CAClC,KAAU,UACX,MAAA,SAAA,EAAA,EAAA,KAEM,GACA,EAAI,CAAC,CAAC,EAET,IAAG,gBAAA,CACD,OAAM,EAAI,GAAA,EAAA,CAAA,CACR,IAAK,CAAC,MAAA,gBAAa,UAAqB,CACxC,QAAA,CAAA,UAAgB,QAAA,YAAA,eAAA,aAAA,YAAA,QAAA,OAAA,CAChB,MAAO,CAAC,qBAAG,kBAAA,CACX,MAAE,CAAM,aAAO,YAAA,UAAA,CACf,KAAE,CAAK,WAAE,CACT,OAAQ,CAAC,aAAC,CACX,CAAC,EAEJ,IAAI,UAAS,CACX,MAAI,CAAA,EAAa,EAAA,EAAA,CAAA,CAAA,EAAA,EAAA,EAAA,CAAA,CAAA,EAAA,EAAA,CACf,IAAE,MAAO,CACP,MAAG,EAAW,GAEhB,IAAI,UAAW,CACb,MAAO,CAAC,EAAO,EAAkB,EAAQ,EAAA,CAAA,CAAA,SAG3C,IAAI,SAAS,CACX,MAAO,8BAAyB,EAAA,EAAA,GAAA,CAAA,uCAElC,IAAA,UAAe,CACb,MAAO,CAAA,EAAO,EAA0B,CACxC,IAAA,UAAS,CACN,MAAQ,6EAAA,EAAA,EAAA,GAAA,CAAA,waAEV,CAAC,CAAC,EAAU,EAAA,CACX,SAAC,oFACF,CAAC,CAAC,EAEN,CAAC,CAAE,EAAS,EAAA,CACX,MAAK,GACL,WAAG,kCACH,KAAE,OACF,IAAE,UAAS,CACT,MAAO,CAAC,EAAU,EAAA,CAClB,UAAU,CAAA,4BACT,IAAA,UAAA,CACF,MAAA,EAAA,eAAyB,GAAA,YAAA,QAAA,IAAA,GAAA,YAAA,QAAA,GAAA,QAAA;yBAGvB,CAAA,CAAA,EAAM,EAAA,EAAA,CAAA,CAAA,EAAA,EAAA,MAAA,EAAA,CAAA,CAAA,EAEV,CAAC,CAAE,EAAI,MAAA,EAAA,CAAA,CAAA,EAAA,MAAA,EAAA,CAAA,CAAA,EAAA,MAAA,EAAA,CAAA,CAAA,EAAA,EAAA,CACN,IAAC,MAAA,CACC,MAAO,EAAG,GAEZ,IAAI,UAAA,CACF,OAAG,EAAsB,EAAe,EAAA,CAAA,EAE1C,SAAU,EACX,CAAC,CAAE,EAAW,MAAA,EAAA,CAAA,CAAA,EAElB,CAAC,CAAC,CACJ,CAAC"}
|