@shell-shock/preset-script 0.6.23 → 0.6.26
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/dist/_virtual/{rolldown_runtime.cjs → _rolldown/runtime.cjs} +1 -1
- package/dist/_virtual/_rolldown/runtime.mjs +3 -0
- package/dist/components/banner-function-declaration.cjs +28 -27
- package/dist/components/banner-function-declaration.cjs.map +1 -1
- package/dist/components/banner-function-declaration.d.cts.map +1 -1
- package/dist/components/banner-function-declaration.d.mts.map +1 -1
- package/dist/components/banner-function-declaration.mjs +2 -2
- package/dist/components/banner-function-declaration.mjs.map +1 -1
- package/dist/components/bin-entry.cjs +54 -45
- package/dist/components/bin-entry.cjs.map +1 -1
- package/dist/components/bin-entry.d.cts +0 -1
- package/dist/components/bin-entry.d.cts.map +1 -1
- package/dist/components/bin-entry.d.mts +0 -1
- package/dist/components/bin-entry.d.mts.map +1 -1
- package/dist/components/bin-entry.mjs +17 -9
- package/dist/components/bin-entry.mjs.map +1 -1
- package/dist/components/command-entry.cjs +76 -235
- package/dist/components/command-entry.cjs.map +1 -1
- package/dist/components/command-entry.d.cts +1 -8
- package/dist/components/command-entry.d.cts.map +1 -1
- package/dist/components/command-entry.d.mts +2 -9
- package/dist/components/command-entry.d.mts.map +1 -1
- package/dist/components/command-entry.mjs +24 -183
- package/dist/components/command-entry.mjs.map +1 -1
- package/dist/components/command-router.cjs +85 -83
- package/dist/components/command-router.cjs.map +1 -1
- package/dist/components/command-router.d.cts.map +1 -1
- package/dist/components/command-router.d.mts.map +1 -1
- package/dist/components/command-router.mjs +59 -58
- package/dist/components/command-router.mjs.map +1 -1
- package/dist/components/exit-function-declaration.cjs +38 -37
- package/dist/components/exit-function-declaration.cjs.map +1 -1
- package/dist/components/exit-function-declaration.d.cts +2 -2
- package/dist/components/exit-function-declaration.d.cts.map +1 -1
- package/dist/components/exit-function-declaration.d.mts +2 -2
- package/dist/components/exit-function-declaration.d.mts.map +1 -1
- package/dist/components/exit-function-declaration.mjs +3 -3
- package/dist/components/exit-function-declaration.mjs.map +1 -1
- package/dist/components/index.cjs +2 -9
- package/dist/components/index.d.cts +2 -3
- package/dist/components/index.d.mts +2 -3
- package/dist/components/index.mjs +2 -3
- package/dist/components/virtual-command-entry.cjs +43 -59
- package/dist/components/virtual-command-entry.cjs.map +1 -1
- package/dist/components/virtual-command-entry.d.cts.map +1 -1
- package/dist/components/virtual-command-entry.d.mts.map +1 -1
- package/dist/components/virtual-command-entry.mjs +13 -30
- package/dist/components/virtual-command-entry.mjs.map +1 -1
- package/dist/helpers/get-default-options.cjs +8 -7
- package/dist/helpers/get-default-options.cjs.map +1 -1
- package/dist/helpers/get-default-options.d.cts +0 -1
- package/dist/helpers/get-default-options.d.cts.map +1 -1
- package/dist/helpers/get-default-options.d.mts +0 -1
- package/dist/helpers/get-default-options.d.mts.map +1 -1
- package/dist/helpers/get-default-options.mjs.map +1 -1
- package/dist/index.cjs +30 -42
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +0 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +0 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +8 -20
- package/dist/index.mjs.map +1 -1
- package/dist/plugin-help/dist/components/display.cjs +260 -0
- package/dist/plugin-help/dist/components/display.cjs.map +1 -0
- package/dist/{components/help.mjs → plugin-help/dist/components/display.mjs} +26 -30
- package/dist/plugin-help/dist/components/display.mjs.map +1 -0
- package/dist/plugin-help/dist/components/help-builtin.cjs +86 -0
- package/dist/plugin-help/dist/components/help-builtin.cjs.map +1 -0
- package/dist/plugin-help/dist/components/help-builtin.mjs +84 -0
- package/dist/plugin-help/dist/components/help-builtin.mjs.map +1 -0
- package/dist/plugin-help/dist/components/help-command.cjs +97 -0
- package/dist/plugin-help/dist/components/help-command.cjs.map +1 -0
- package/dist/plugin-help/dist/components/help-command.mjs +96 -0
- package/dist/plugin-help/dist/components/help-command.mjs.map +1 -0
- package/dist/plugin-help/dist/components/index.cjs +3 -0
- package/dist/plugin-help/dist/components/index.mjs +5 -0
- package/dist/plugin-help/dist/index.cjs +104 -0
- package/dist/plugin-help/dist/index.cjs.map +1 -0
- package/dist/plugin-help/dist/index.d.cts +2 -0
- package/dist/plugin-help/dist/index.d.mts +2 -0
- package/dist/plugin-help/dist/index.mjs +100 -0
- package/dist/plugin-help/dist/index.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/constant-case.cjs +18 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/constant-case.cjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/constant-case.mjs +17 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/constant-case.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/get-words.cjs +39 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/get-words.cjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/get-words.mjs +38 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/get-words.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/kebab-case.cjs +34 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/kebab-case.cjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/kebab-case.mjs +34 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/kebab-case.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/snake-case.cjs +41 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/snake-case.cjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/snake-case.mjs +41 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/snake-case.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/upper-case-first.cjs +18 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/upper-case-first.cjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/upper-case-first.mjs +17 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/upper-case-first.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-empty.cjs +21 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-empty.cjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-empty.mjs +21 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-empty.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-null.cjs +13 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-null.cjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-null.mjs +12 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-null.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set-string.cjs +21 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set-string.cjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set-string.mjs +21 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set-string.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set.cjs +20 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set.cjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set.mjs +20 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-string.cjs +13 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-string.cjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-string.mjs +12 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-string.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-undefined.cjs +9 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-undefined.cjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-undefined.mjs +8 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-undefined.mjs.map +1 -0
- package/dist/plugin-help/dist/types/plugin.d.cts +62 -0
- package/dist/plugin-help/dist/types/plugin.d.cts.map +1 -0
- package/dist/plugin-help/dist/types/plugin.d.mts +62 -0
- package/dist/plugin-help/dist/types/plugin.d.mts.map +1 -0
- package/dist/types/plugin.d.cts +9 -9
- package/dist/types/plugin.d.cts.map +1 -1
- package/dist/types/plugin.d.mts +9 -9
- package/dist/types/plugin.d.mts.map +1 -1
- package/package.json +15 -29
- package/dist/components/help.cjs +0 -264
- package/dist/components/help.cjs.map +0 -1
- package/dist/components/help.d.cts +0 -105
- package/dist/components/help.d.cts.map +0 -1
- package/dist/components/help.d.mts +0 -105
- package/dist/components/help.d.mts.map +0 -1
- package/dist/components/help.mjs.map +0 -1
|
@@ -2,16 +2,16 @@ import { ExitFunctionDeclaration } from "./exit-function-declaration.mjs";
|
|
|
2
2
|
import { createComponent, createIntrinsic, memo, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
3
3
|
import { For, Show, code, computed } from "@alloy-js/core";
|
|
4
4
|
import { FunctionDeclaration, IfStatement } from "@alloy-js/typescript";
|
|
5
|
+
import { getAppTitle } from "@shell-shock/core/plugin-utils";
|
|
5
6
|
import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
|
|
6
7
|
import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
|
|
7
|
-
import
|
|
8
|
+
import defu from "defu";
|
|
9
|
+
import { TSDoc, TSDocRemarks, TSDocReturns } from "@powerlines/plugin-alloy/typescript/components/tsdoc";
|
|
8
10
|
import { EntryFile } from "@powerlines/plugin-alloy/typescript/components/entry-file";
|
|
9
|
-
import { TSDoc } from "@powerlines/plugin-alloy/typescript/components/tsdoc";
|
|
10
11
|
import { getUnique } from "@stryke/helpers/get-unique";
|
|
11
12
|
import { findFileName } from "@stryke/path/file-path-fns";
|
|
12
13
|
import { replaceExtension } from "@stryke/path/replace";
|
|
13
14
|
import { pascalCase } from "@stryke/string-format/pascal-case";
|
|
14
|
-
import defu from "defu";
|
|
15
15
|
|
|
16
16
|
//#region src/components/bin-entry.tsx
|
|
17
17
|
/**
|
|
@@ -138,7 +138,8 @@ function BinEntry(props) {
|
|
|
138
138
|
"internal_appContext",
|
|
139
139
|
"getArgs",
|
|
140
140
|
"findSuggestions"
|
|
141
|
-
]
|
|
141
|
+
],
|
|
142
|
+
help: ["showHelp"]
|
|
142
143
|
});
|
|
143
144
|
},
|
|
144
145
|
get children() {
|
|
@@ -153,12 +154,19 @@ function BinEntry(props) {
|
|
|
153
154
|
return [prefix, createComponent(Spacing, {})];
|
|
154
155
|
}
|
|
155
156
|
}),
|
|
156
|
-
createComponent(TSDoc, {
|
|
157
|
-
|
|
158
|
-
|
|
157
|
+
createComponent(TSDoc, {
|
|
158
|
+
get heading() {
|
|
159
|
+
return `Binary entry point for the ${getAppTitle(context, true)} command-line interface application.`;
|
|
160
|
+
},
|
|
161
|
+
get children() {
|
|
162
|
+
return [createComponent(TSDocRemarks, { get children() {
|
|
163
|
+
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.`;
|
|
164
|
+
} }), createComponent(TSDocReturns, { children: `Returns a promise that resolves to either a successful result or an error object.` })];
|
|
165
|
+
}
|
|
166
|
+
}),
|
|
159
167
|
createComponent(FunctionDeclaration, {
|
|
160
168
|
async: true,
|
|
161
|
-
returnType: "any",
|
|
169
|
+
returnType: "any | { error: string | Error }",
|
|
162
170
|
name: "main",
|
|
163
171
|
get children() {
|
|
164
172
|
return [
|
|
@@ -166,7 +174,7 @@ function BinEntry(props) {
|
|
|
166
174
|
condition: code`hasFlag(["version", "v"])`,
|
|
167
175
|
get children() {
|
|
168
176
|
return code`console.log(${context?.packageJson.version ? `"${context?.packageJson.version}"` : "0.0.1"});
|
|
169
|
-
|
|
177
|
+
return; `;
|
|
170
178
|
}
|
|
171
179
|
}),
|
|
172
180
|
createComponent(Spacing, {}),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bin-entry.mjs","names":[
|
|
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 internal_appContext.run(new Map([[\"args\", getArgs()]]), 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: [\"error\", \"verbose\", \"table\", \"writeLine\"],\n utils: [\n \"useApp\",\n \"hasFlag\",\n \"isUnicodeSupported\",\n \"internal_appContext\",\n \"getArgs\",\n \"findSuggestions\"\n ],\n help: [\"showHelp\"]\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;MAAQ;MAAQ;KAC3C,OAAO;MAAA;MAAA;MAAA;MAAA;MAAA;MAAA;MAAA;;KAER,CAAC;;GAEJ,IAAI,WAAC;AACH,WAAE;KAAA,gBAAqB,yBAAsB,EAAA,CAAA;KAAA,gBAAA,SAAA,EAAA,CAAA;KAAA,gBAAA,MAAA;MAC3C,IAAE,OAAO;AACP,cAAO,QAAI,OAAS;;MAEtB,IAAI,WAAQ;AACV,cAAG,CAAA,QAAQ,gBAAA,SAAA,EAAA,CAAA,CAAA;;MAEd,CAAC;KAAE,gBAAG,OAAoB;MACzB,IAAI,UAAS;AACX,cAAG,8BAAe,YAAA,SAAA,KAAA,CAAA;;MAEpB,IAAE,WAAQ;AACR,cAAC,CAAA,gBAAA,cAAA,EACF,IAAA,WAAA;AACA,eAAS,6EAAA,YAAA,SAAA,KAAA,CAAA;UAEP,CAAA,EAAA,gBAAM,cAAA,EACN,UAAS,qFACV,CAAA,CAAA;;MAEH,CAAC;KAAE,gBAAiB,qBAAsB;MACzC,OAAI;MACJ,YAAI;MACJ,MAAK;MACL,IAAG,WAAY;AACb,cAAI;QAAI,gBAAgB,aAAe;SACrC,WAAS,IAAA;SACT,IAAE,WAAA;AACA,iBAAC,IAAQ,eAAe,SAAW,YAAY,UAAK,IAAS,SAAC,YAAoB,QAAK,KAAA,QAAY;;;SAGtG,CAAC;QAAE,gBAAkB,SAAK,EAAA,CAAA;QAAS;QAAU,gBAAa,OAAY,EAAC,CAAA;QAAA;;MAE3E,CAAC;KAAE,gBAAK,OAAA,EAAA,CAAA;KAAA,gBAAA,OAAA,EAAA,CAAA;KAAA,gBAAA,OAAA,EAAA,CAAA;KAAA,gBAAA,MAAA;MACP,IAAC,OAAA;AACC,cAAA,QAAA,QAAA;;MAEF,IAAE,WAAW;AACX,cAAC,gBAAuB,gBAAe,EAAA,CAAA;;MAEzC,UAAM;MACP,CAAC;KAAE,gBAAY,OAAS,EAAA,CAAA;KAAA;;GAE5B,CAAC,CAAC;EACJ,CAAC"}
|
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
2
3
|
const require_components_banner_function_declaration = require('./banner-function-declaration.cjs');
|
|
3
|
-
const require_components_help = require('./help.cjs');
|
|
4
4
|
const require_components_virtual_command_entry = require('./virtual-command-entry.cjs');
|
|
5
|
-
let
|
|
6
|
-
let
|
|
7
|
-
let
|
|
8
|
-
let
|
|
9
|
-
let
|
|
10
|
-
let
|
|
11
|
-
let __powerlines_plugin_alloy_typescript_components_entry_file = require("@powerlines/plugin-alloy/typescript/components/entry-file");
|
|
12
|
-
let __powerlines_plugin_alloy_typescript_components_tsdoc = require("@powerlines/plugin-alloy/typescript/components/tsdoc");
|
|
13
|
-
let __stryke_path_replace = require("@stryke/path/replace");
|
|
14
|
-
let __stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
|
|
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 _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
|
|
9
|
+
let _powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
|
|
10
|
+
let _powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
15
11
|
let defu = require("defu");
|
|
16
|
-
defu =
|
|
17
|
-
let
|
|
18
|
-
let
|
|
19
|
-
let
|
|
20
|
-
let
|
|
21
|
-
let
|
|
22
|
-
let
|
|
23
|
-
let
|
|
24
|
-
let
|
|
12
|
+
defu = require_runtime.__toESM(defu);
|
|
13
|
+
let _powerlines_plugin_alloy_typescript_components_tsdoc = require("@powerlines/plugin-alloy/typescript/components/tsdoc");
|
|
14
|
+
let _stryke_path_join = require("@stryke/path/join");
|
|
15
|
+
let _powerlines_plugin_alloy_typescript_components_entry_file = require("@powerlines/plugin-alloy/typescript/components/entry-file");
|
|
16
|
+
let _stryke_path_replace = require("@stryke/path/replace");
|
|
17
|
+
let _stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
|
|
18
|
+
let _shell_shock_core_components_helpers = require("@shell-shock/core/components/helpers");
|
|
19
|
+
let _shell_shock_core_components_command_validation_logic = require("@shell-shock/core/components/command-validation-logic");
|
|
20
|
+
let _shell_shock_core_components_options_parser_logic = require("@shell-shock/core/components/options-parser-logic");
|
|
21
|
+
let _stryke_path_find = require("@stryke/path/find");
|
|
22
|
+
let _stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
|
|
23
|
+
let _stryke_string_format_constant_case = require("@stryke/string-format/constant-case");
|
|
24
|
+
let _stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
|
|
25
25
|
|
|
26
26
|
//#region src/components/command-entry.tsx
|
|
27
27
|
function CommandInvocation(props) {
|
|
28
28
|
const { command } = props;
|
|
29
29
|
return [
|
|
30
|
-
(0,
|
|
30
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
31
31
|
name: "__context",
|
|
32
32
|
get initializer() {
|
|
33
|
-
return
|
|
33
|
+
return _alloy_js_core.code`{ path: \`${command.segments.map((segment) => (0, _shell_shock_core_plugin_utils.isDynamicPathSegment)(segment) ? `\${${(0, _stryke_string_format_camel_case.camelCase)((0, _shell_shock_core_plugin_utils.getDynamicPathSegmentName)(segment))}}` : segment).join("/")}\`, segments: [${command.segments.map((segment) => (0, _shell_shock_core_plugin_utils.isDynamicPathSegment)(segment) ? (0, _stryke_string_format_camel_case.camelCase)((0, _shell_shock_core_plugin_utils.getDynamicPathSegmentName)(segment)) : `"${segment}"`).join(", ")}] }`;
|
|
34
34
|
}
|
|
35
35
|
}),
|
|
36
|
-
(0,
|
|
37
|
-
(0,
|
|
36
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
37
|
+
(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`
|
|
38
38
|
|
|
39
39
|
return internal_commandContext.run(__context, () => {
|
|
40
|
-
return Promise.resolve(Reflect.apply(handle${(0,
|
|
40
|
+
return Promise.resolve(Reflect.apply(handle${(0, _stryke_string_format_pascal_case.pascalCase)(command.name)}, __context, [options${command.args.length > 0 ? `, ${command.args.map((arg) => (0, _stryke_string_format_camel_case.camelCase)(arg.name)).join(", ")}` : ""}]));
|
|
41
41
|
});
|
|
42
42
|
|
|
43
43
|
`),
|
|
44
|
-
(0,
|
|
44
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
|
|
45
45
|
];
|
|
46
46
|
}
|
|
47
47
|
/**
|
|
@@ -49,31 +49,31 @@ function CommandInvocation(props) {
|
|
|
49
49
|
*/
|
|
50
50
|
function CommandHandlerDeclaration(props) {
|
|
51
51
|
const { command, banner, children } = props;
|
|
52
|
-
const context = (0,
|
|
52
|
+
const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
53
53
|
return [
|
|
54
|
-
(0,
|
|
55
|
-
(0,
|
|
56
|
-
(0,
|
|
54
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_shell_shock_core_components_options_parser_logic.OptionsInterfaceDeclaration, { command }),
|
|
55
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
56
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
57
57
|
get heading() {
|
|
58
|
-
return `The ${command.title} (${(0,
|
|
58
|
+
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(" ")}) command.`;
|
|
59
59
|
},
|
|
60
60
|
get children() {
|
|
61
61
|
return [
|
|
62
|
-
(0,
|
|
62
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { get children() {
|
|
63
63
|
return `${command.description.replace(/\.+$/, "")}.`;
|
|
64
64
|
} }),
|
|
65
|
-
(0,
|
|
66
|
-
(0,
|
|
65
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
66
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocTitle, { get children() {
|
|
67
67
|
return command.title;
|
|
68
68
|
} }),
|
|
69
|
-
(0,
|
|
69
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
|
|
70
70
|
name: "args",
|
|
71
71
|
children: `The command-line arguments passed to the command.`
|
|
72
72
|
})
|
|
73
73
|
];
|
|
74
74
|
}
|
|
75
75
|
}),
|
|
76
|
-
(0,
|
|
76
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
77
77
|
"export": true,
|
|
78
78
|
async: true,
|
|
79
79
|
name: "handler",
|
|
@@ -84,7 +84,7 @@ function CommandHandlerDeclaration(props) {
|
|
|
84
84
|
}],
|
|
85
85
|
get children() {
|
|
86
86
|
return [
|
|
87
|
-
(0,
|
|
87
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_shell_shock_core_components_options_parser_logic.CommandParserLogic, {
|
|
88
88
|
command,
|
|
89
89
|
get appSpecificEnvPrefix() {
|
|
90
90
|
return context.config.appSpecificEnvPrefix;
|
|
@@ -93,40 +93,34 @@ function CommandHandlerDeclaration(props) {
|
|
|
93
93
|
return context.config.isCaseSensitive;
|
|
94
94
|
}
|
|
95
95
|
}),
|
|
96
|
-
(0,
|
|
97
|
-
(0,
|
|
98
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
96
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
97
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
99
98
|
get when() {
|
|
100
99
|
return Boolean(banner);
|
|
101
100
|
},
|
|
102
101
|
children: banner
|
|
103
102
|
}),
|
|
104
|
-
(0,
|
|
105
|
-
(0,
|
|
106
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
103
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
104
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
107
105
|
get condition() {
|
|
108
|
-
return (0,
|
|
106
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_shell_shock_core_components_helpers.IsDebug, {});
|
|
109
107
|
},
|
|
110
108
|
get children() {
|
|
111
|
-
return
|
|
109
|
+
return _alloy_js_core.code`writeLine("");
|
|
112
110
|
writeLine(colors.text.body.tertiary("Debug mode is enabled. Additional debug information may be logged to the console."));
|
|
113
|
-
debug(\`Command path: ${command.segments.map((segment) => (0,
|
|
111
|
+
debug(\`Command path: ${command.segments.map((segment) => (0, _shell_shock_core_plugin_utils.isDynamicPathSegment)(segment) ? `\${${(0, _stryke_string_format_camel_case.camelCase)((0, _shell_shock_core_plugin_utils.getDynamicPathSegmentName)(segment))}}` : segment).join(" / ")} \\n\\nOptions: \\n${Object.values(command.options).map((option) => ` - ${(0, _stryke_string_format_kebab_case.kebabCase)(option.name)}: \${options.${(0, _stryke_string_format_camel_case.camelCase)(option.name)} === undefined ? "" : JSON.stringify(options.${(0, _stryke_string_format_camel_case.camelCase)(option.name)})}`).join("\\n")}${command.args.length > 0 ? ` \\n\\nArguments: \\n${command.args.map((arg) => ` - ${(0, _stryke_string_format_kebab_case.kebabCase)(arg.name)}: \${${(0, _stryke_string_format_camel_case.camelCase)(arg.name)} === undefined ? "" : JSON.stringify(${(0, _stryke_string_format_camel_case.camelCase)(arg.name)})}`).join("\\n")}` : ""}\`);
|
|
114
112
|
writeLine(""); `;
|
|
115
113
|
}
|
|
116
114
|
}),
|
|
117
|
-
(0,
|
|
118
|
-
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
115
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
119
116
|
children,
|
|
120
|
-
(0,
|
|
121
|
-
(0,
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
get children() {
|
|
125
|
-
return (0, __alloy_js_core_jsx_runtime.createComponent)(require_components_help.CommandHelp, { command });
|
|
126
|
-
}
|
|
117
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
118
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
119
|
+
condition: _alloy_js_core.code`options.help`,
|
|
120
|
+
children: _alloy_js_core.code`return showHelp(); `
|
|
127
121
|
}),
|
|
128
|
-
(0,
|
|
129
|
-
return [(0,
|
|
122
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseClause, { get children() {
|
|
123
|
+
return [(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}), (0, _alloy_js_core_jsx_runtime.createComponent)(CommandInvocation, { command })];
|
|
130
124
|
} })
|
|
131
125
|
];
|
|
132
126
|
}
|
|
@@ -134,170 +128,18 @@ function CommandHandlerDeclaration(props) {
|
|
|
134
128
|
];
|
|
135
129
|
}
|
|
136
130
|
/**
|
|
137
|
-
* A component that generates command validation logic for required options and arguments.
|
|
138
|
-
*/
|
|
139
|
-
function CommandValidationLogic(props) {
|
|
140
|
-
const { command } = props;
|
|
141
|
-
return [
|
|
142
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
|
|
143
|
-
name: "failures",
|
|
144
|
-
type: "string[]",
|
|
145
|
-
initializer: __alloy_js_core.code`[];`
|
|
146
|
-
}),
|
|
147
|
-
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
148
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
|
|
149
|
-
get each() {
|
|
150
|
-
return Object.values(command.options ?? {});
|
|
151
|
-
},
|
|
152
|
-
doubleHardline: true,
|
|
153
|
-
children: (option) => [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
154
|
-
get when() {
|
|
155
|
-
return !option.optional;
|
|
156
|
-
},
|
|
157
|
-
get children() {
|
|
158
|
-
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
159
|
-
get condition() {
|
|
160
|
-
return __alloy_js_core.code`!options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, __stryke_string_format_camel_case.camelCase)(option.name)}`}`;
|
|
161
|
-
},
|
|
162
|
-
get children() {
|
|
163
|
-
return __alloy_js_core.code`failures.push("Missing required \\"${option.name}\\" option");`;
|
|
164
|
-
}
|
|
165
|
-
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
166
|
-
get when() {
|
|
167
|
-
return (option.kind === __shell_shock_core.CommandParameterKinds.string || option.kind === __shell_shock_core.CommandParameterKinds.number) && option.variadic;
|
|
168
|
-
},
|
|
169
|
-
get children() {
|
|
170
|
-
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ElseIfClause, {
|
|
171
|
-
get condition() {
|
|
172
|
-
return __alloy_js_core.code`options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, __stryke_string_format_camel_case.camelCase)(option.name)}`}.length === 0`;
|
|
173
|
-
},
|
|
174
|
-
get children() {
|
|
175
|
-
return __alloy_js_core.code`failures.push("No values were provided to the required \\"${option.name}\\" array option");`;
|
|
176
|
-
}
|
|
177
|
-
});
|
|
178
|
-
}
|
|
179
|
-
})];
|
|
180
|
-
}
|
|
181
|
-
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
182
|
-
get when() {
|
|
183
|
-
return option.kind === __shell_shock_core.CommandParameterKinds.number;
|
|
184
|
-
},
|
|
185
|
-
get children() {
|
|
186
|
-
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
187
|
-
get when() {
|
|
188
|
-
return option.variadic;
|
|
189
|
-
},
|
|
190
|
-
get fallback() {
|
|
191
|
-
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
192
|
-
get condition() {
|
|
193
|
-
return __alloy_js_core.code`options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, __stryke_string_format_camel_case.camelCase)(option.name)}`} && Number.isNaN(options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, __stryke_string_format_camel_case.camelCase)(option.name)}`})`;
|
|
194
|
-
},
|
|
195
|
-
get children() {
|
|
196
|
-
return __alloy_js_core.code`failures.push("Invalid numeric value provided for the \\"${option.name}\\" option");`;
|
|
197
|
-
}
|
|
198
|
-
});
|
|
199
|
-
},
|
|
200
|
-
get children() {
|
|
201
|
-
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
202
|
-
get condition() {
|
|
203
|
-
return __alloy_js_core.code`options${option.name.includes("?") ? `["${option.name}"]` : `.${(0, __stryke_string_format_camel_case.camelCase)(option.name)}`}.some(value => Number.isNaN(value))`;
|
|
204
|
-
},
|
|
205
|
-
get children() {
|
|
206
|
-
return __alloy_js_core.code`failures.push("Invalid numeric value provided in the \\"${option.name}\\" array option");`;
|
|
207
|
-
}
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
})]
|
|
213
|
-
}),
|
|
214
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
215
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
|
|
216
|
-
get each() {
|
|
217
|
-
return command.args;
|
|
218
|
-
},
|
|
219
|
-
doubleHardline: true,
|
|
220
|
-
children: (argument) => [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
221
|
-
get when() {
|
|
222
|
-
return !argument.optional;
|
|
223
|
-
},
|
|
224
|
-
get children() {
|
|
225
|
-
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
226
|
-
get condition() {
|
|
227
|
-
return __alloy_js_core.code`!${(0, __stryke_string_format_camel_case.camelCase)(argument.name)}`;
|
|
228
|
-
},
|
|
229
|
-
get children() {
|
|
230
|
-
return __alloy_js_core.code`failures.push("Missing required \\"${argument.name}\\" positional argument");`;
|
|
231
|
-
}
|
|
232
|
-
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
233
|
-
get when() {
|
|
234
|
-
return (argument.kind === __shell_shock_core.CommandParameterKinds.string || argument.kind === __shell_shock_core.CommandParameterKinds.number) && argument.variadic;
|
|
235
|
-
},
|
|
236
|
-
get children() {
|
|
237
|
-
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ElseIfClause, {
|
|
238
|
-
get condition() {
|
|
239
|
-
return __alloy_js_core.code`${(0, __stryke_string_format_camel_case.camelCase)(argument.name)}.length === 0`;
|
|
240
|
-
},
|
|
241
|
-
get children() {
|
|
242
|
-
return __alloy_js_core.code`failures.push("No values were provided to the required \\"${argument.name}\\" array positional argument");`;
|
|
243
|
-
}
|
|
244
|
-
});
|
|
245
|
-
}
|
|
246
|
-
})];
|
|
247
|
-
}
|
|
248
|
-
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
249
|
-
get when() {
|
|
250
|
-
return argument.kind === __shell_shock_core.CommandParameterKinds.number;
|
|
251
|
-
},
|
|
252
|
-
get children() {
|
|
253
|
-
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
254
|
-
get when() {
|
|
255
|
-
return argument.variadic;
|
|
256
|
-
},
|
|
257
|
-
get fallback() {
|
|
258
|
-
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
259
|
-
get condition() {
|
|
260
|
-
return __alloy_js_core.code`${(0, __stryke_string_format_camel_case.camelCase)(argument.name)} && Number.isNaN(${(0, __stryke_string_format_camel_case.camelCase)(argument.name)})`;
|
|
261
|
-
},
|
|
262
|
-
get children() {
|
|
263
|
-
return __alloy_js_core.code`failures.push("Invalid numeric value provided for the \\"${argument.name}\\" positional argument");`;
|
|
264
|
-
}
|
|
265
|
-
});
|
|
266
|
-
},
|
|
267
|
-
get children() {
|
|
268
|
-
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
269
|
-
get condition() {
|
|
270
|
-
return __alloy_js_core.code`${(0, __stryke_string_format_camel_case.camelCase)(argument.name)}.some(value => Number.isNaN(value))`;
|
|
271
|
-
},
|
|
272
|
-
get children() {
|
|
273
|
-
return __alloy_js_core.code`failures.push("Invalid numeric value provided in the \\"${argument.name}\\" array positional argument");`;
|
|
274
|
-
}
|
|
275
|
-
});
|
|
276
|
-
}
|
|
277
|
-
});
|
|
278
|
-
}
|
|
279
|
-
})]
|
|
280
|
-
}),
|
|
281
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.IfStatement, {
|
|
282
|
-
condition: __alloy_js_core.code`failures.length > 0`,
|
|
283
|
-
children: __alloy_js_core.code`error("The following validation failures were found while processing the user provided input, and must be corrected before the command-line process can be executed: \\n\\n" + failures.map(failure => " - " + failure).join("\\n"));
|
|
284
|
-
options.help = true; `
|
|
285
|
-
})
|
|
286
|
-
];
|
|
287
|
-
}
|
|
288
|
-
/**
|
|
289
131
|
* The command entry point for the Shell Shock project.
|
|
290
132
|
*/
|
|
291
133
|
function CommandEntry(props) {
|
|
292
134
|
const { command, imports, builtinImports, ...rest } = props;
|
|
293
|
-
const context = (0,
|
|
294
|
-
const filePath = (0,
|
|
295
|
-
const commandSourcePath = (0,
|
|
296
|
-
const typeDefinition = (0,
|
|
135
|
+
const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
136
|
+
const filePath = (0, _alloy_js_core.computed)(() => (0, _stryke_path_join.joinPaths)(command.segments.filter((segment) => !(0, _shell_shock_core_plugin_utils.isDynamicPathSegment)(segment)).join("/"), "index.ts"));
|
|
137
|
+
const commandSourcePath = (0, _alloy_js_core.computed)(() => (0, _stryke_path_replace.replaceExtension)((0, _stryke_path_find.relativePath)((0, _stryke_path_join.joinPaths)(context.entryPath, (0, _stryke_path_find.findFilePath)(filePath.value)), command.entry.input?.file || command.entry.file)));
|
|
138
|
+
const typeDefinition = (0, _alloy_js_core.computed)(() => ({
|
|
297
139
|
...command.entry,
|
|
298
140
|
output: command.id
|
|
299
141
|
}));
|
|
300
|
-
return [(0,
|
|
142
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_entry_file.EntryFile, (0, _alloy_js_core_jsx_runtime.mergeProps)(rest, {
|
|
301
143
|
get path() {
|
|
302
144
|
return filePath.value;
|
|
303
145
|
},
|
|
@@ -305,7 +147,7 @@ function CommandEntry(props) {
|
|
|
305
147
|
return typeDefinition.value;
|
|
306
148
|
},
|
|
307
149
|
get imports() {
|
|
308
|
-
return (0, defu.default)(imports ?? {}, { [commandSourcePath.value]: `handle${(0,
|
|
150
|
+
return (0, defu.default)(imports ?? {}, { [commandSourcePath.value.startsWith(".") ? commandSourcePath.value : `./${commandSourcePath.value}`]: `handle${(0, _stryke_string_format_pascal_case.pascalCase)(command.name)}` });
|
|
309
151
|
},
|
|
310
152
|
get builtinImports() {
|
|
311
153
|
return (0, defu.default)(builtinImports ?? {}, {
|
|
@@ -318,11 +160,8 @@ function CommandEntry(props) {
|
|
|
318
160
|
"debug",
|
|
319
161
|
"warn",
|
|
320
162
|
"error",
|
|
321
|
-
"table",
|
|
322
163
|
"colors",
|
|
323
|
-
"
|
|
324
|
-
"writeLine",
|
|
325
|
-
"splitText"
|
|
164
|
+
"writeLine"
|
|
326
165
|
],
|
|
327
166
|
utils: [
|
|
328
167
|
"useArgs",
|
|
@@ -330,39 +169,42 @@ function CommandEntry(props) {
|
|
|
330
169
|
"isMinimal",
|
|
331
170
|
"isUnicodeSupported",
|
|
332
171
|
"internal_commandContext"
|
|
333
|
-
]
|
|
172
|
+
],
|
|
173
|
+
[(0, _stryke_path_join.joinPaths)("help", ...command.segments.filter((segment) => !(0, _shell_shock_core_plugin_utils.isDynamicPathSegment)(segment)))]: ["showHelp"]
|
|
334
174
|
});
|
|
335
175
|
},
|
|
336
176
|
get children() {
|
|
337
177
|
return [
|
|
338
|
-
(0,
|
|
339
|
-
(0,
|
|
340
|
-
(0,
|
|
341
|
-
(0,
|
|
342
|
-
(0,
|
|
343
|
-
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
344
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(CommandHandlerDeclaration, {
|
|
178
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(require_components_banner_function_declaration.BannerFunctionDeclaration, { command }),
|
|
179
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
180
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_shell_shock_core_components_options_parser_logic.OptionsInterfaceDeclaration, { command }),
|
|
181
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
182
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(CommandHandlerDeclaration, {
|
|
345
183
|
command,
|
|
346
|
-
banner:
|
|
184
|
+
banner: _alloy_js_core.code`banner(); `,
|
|
347
185
|
get children() {
|
|
348
|
-
return (0,
|
|
186
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_shell_shock_core_components_command_validation_logic.CommandValidationLogic, { command }), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
187
|
+
condition: _alloy_js_core.code`failures.length > 0`,
|
|
188
|
+
children: _alloy_js_core.code`error("The following validation failures were found while processing the user provided input, and must be corrected before the command-line process can be executed: \\n\\n" + failures.map(failure => " - " + failure).join("\\n"));
|
|
189
|
+
options.help = true; `
|
|
190
|
+
})];
|
|
349
191
|
}
|
|
350
192
|
})
|
|
351
193
|
];
|
|
352
194
|
}
|
|
353
|
-
})), (0,
|
|
195
|
+
})), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
354
196
|
get each() {
|
|
355
197
|
return Object.values(command.children);
|
|
356
198
|
},
|
|
357
|
-
children: (child) => (0,
|
|
199
|
+
children: (child) => (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
358
200
|
get when() {
|
|
359
201
|
return child.isVirtual;
|
|
360
202
|
},
|
|
361
203
|
get fallback() {
|
|
362
|
-
return (0,
|
|
204
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(CommandEntry, { command: child });
|
|
363
205
|
},
|
|
364
206
|
get children() {
|
|
365
|
-
return (0,
|
|
207
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_virtual_command_entry.VirtualCommandEntry, { command: child });
|
|
366
208
|
}
|
|
367
209
|
})
|
|
368
210
|
})];
|
|
@@ -372,5 +214,4 @@ function CommandEntry(props) {
|
|
|
372
214
|
exports.CommandEntry = CommandEntry;
|
|
373
215
|
exports.CommandHandlerDeclaration = CommandHandlerDeclaration;
|
|
374
216
|
exports.CommandInvocation = CommandInvocation;
|
|
375
|
-
exports.CommandValidationLogic = CommandValidationLogic;
|
|
376
217
|
//# sourceMappingURL=command-entry.cjs.map
|