@shell-shock/preset-script 0.6.65 → 0.6.67
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/components/bin-entry.cjs +1 -1
- 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 +1 -1
- package/dist/components/bin-entry.mjs.map +1 -1
- package/dist/components/command-entry.cjs +1 -1
- package/dist/components/command-entry.d.mts.map +1 -1
- package/dist/components/command-entry.mjs +1 -1
- package/dist/components/command-entry.mjs.map +1 -1
- package/dist/components/command-router.cjs +1 -2
- 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 +1 -1
- package/dist/components/command-router.mjs.map +1 -1
- package/dist/components/exit-function-declaration.cjs +0 -1
- package/dist/components/exit-function-declaration.d.cts +1 -3
- package/dist/components/exit-function-declaration.d.cts.map +1 -1
- package/dist/components/exit-function-declaration.d.mts +1 -3
- package/dist/components/exit-function-declaration.d.mts.map +1 -1
- package/dist/components/exit-function-declaration.mjs.map +1 -1
- package/dist/components/virtual-command-entry.cjs +2 -2
- package/dist/components/virtual-command-entry.d.mts.map +1 -1
- package/dist/components/virtual-command-entry.mjs +2 -2
- package/dist/components/virtual-command-entry.mjs.map +1 -1
- package/dist/helpers/get-global-options.cjs +10 -12
- package/dist/helpers/get-global-options.d.cts.map +1 -1
- package/dist/helpers/get-global-options.d.mts.map +1 -1
- package/dist/helpers/get-global-options.mjs +10 -12
- package/dist/helpers/get-global-options.mjs.map +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/dist/types/plugin.d.mts.map +1 -1
- package/package.json +17 -17
|
@@ -114,7 +114,7 @@ function BinEntry(props) {
|
|
|
114
114
|
input: { file: bin }
|
|
115
115
|
},
|
|
116
116
|
get imports() {
|
|
117
|
-
return (0, defu.default)(imports ?? {}, Object.entries(context.commands).filter(([, command]) => command.
|
|
117
|
+
return (0, defu.default)(imports ?? {}, Object.entries(context.commands).filter(([, command]) => command.virtual).reduce((ret, [name, command]) => {
|
|
118
118
|
ret[`./${command.name}`] = [{
|
|
119
119
|
name: "handler",
|
|
120
120
|
alias: `handle${(0, _stryke_string_format_pascal_case.pascalCase)(name)}`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bin-entry.d.cts","names":[],"sources":["../../src/components/bin-entry.tsx"],"mappings":";;;;;;AA4CA;iBAAgB,cAAA,
|
|
1
|
+
{"version":3,"file":"bin-entry.d.cts","names":[],"sources":["../../src/components/bin-entry.tsx"],"mappings":";;;;;;AA4CA;iBAAgB,cAAA,IAAc,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":""}
|
|
@@ -111,7 +111,7 @@ function BinEntry(props) {
|
|
|
111
111
|
input: { file: bin }
|
|
112
112
|
},
|
|
113
113
|
get imports() {
|
|
114
|
-
return defu(imports ?? {}, Object.entries(context.commands).filter(([, command]) => command.
|
|
114
|
+
return defu(imports ?? {}, Object.entries(context.commands).filter(([, command]) => command.virtual).reduce((ret, [name, command]) => {
|
|
115
115
|
ret[`./${command.name}`] = [{
|
|
116
116
|
name: "handler",
|
|
117
117
|
alias: `handle${pascalCase(name)}`
|
|
@@ -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 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":";;;;;;;;;;;;;;;;;;;AAoCA,SAAS,iBAAoB;AAC7B,QAAO;EAAA,gBAAgB,SAAA,EAAA,CAAA;EAAA,IAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;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cAAO,8BAAyB,YAAA,SAAA,KAAA,CAAA;;MAElC,IAAA,WAAe;AACb,cAAO,CAAA,gBAAO,cAA0B,EACxC,IAAA,WAAS;AACN,eAAQ,6EAAA,YAAA,SAAA,KAAA,CAAA;UAEV,CAAC,EAAC,gBAAU,cAAA,EACX,UAAC,qFACF,CAAC,CAAC;;MAEN,CAAC;KAAE,gBAAS,qBAAA;MACX,OAAK;MACL,YAAG;MACH,MAAE;MACF,IAAE,WAAS;AACT,cAAO;QAAC,gBAAU,aAAA;SAClB,WAAU,IAAA;SACT,IAAA,WAAA;AACF,iBAAA,IAAA,eAAyB,SAAA,YAAA,UAAA,IAAA,SAAA,YAAA,QAAA,KAAA,QAAA;;;SAGvB,CAAA;QAAA,gBAAM,SAAA,EAAA,CAAA;QAAA;QAAA,gBAAA,OAAA,EAAA,CAAA;QAAA;;MAEV,CAAC;KAAE,gBAAI,OAAA,EAAA,CAAA;KAAA,gBAAA,OAAA,EAAA,CAAA;KAAA,gBAAA,OAAA,EAAA,CAAA;KAAA,gBAAA,MAAA;MACN,IAAC,OAAA;AACC,cAAO,QAAG,QAAa;;MAEzB,IAAI,WAAA;AACF,cAAG,gBAAsB,gBAAe,EAAA,CAAA;;MAE1C,UAAU;MACX,CAAC;KAAE,gBAAW,OAAA,EAAA,CAAA;KAAA;;GAElB,CAAC,CAAC;EACJ,CAAC"}
|
|
1
|
+
{"version":3,"file":"bin-entry.mjs","names":[],"sources":[],"mappings":""}
|
|
@@ -188,7 +188,7 @@ function CommandEntry(props) {
|
|
|
188
188
|
},
|
|
189
189
|
children: (child) => (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
190
190
|
get when() {
|
|
191
|
-
return child.
|
|
191
|
+
return child.virtual;
|
|
192
192
|
},
|
|
193
193
|
get fallback() {
|
|
194
194
|
return (0, _alloy_js_core_jsx_runtime.createComponent)(CommandEntry, { command: child });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-entry.d.mts","names":[],"sources":["../../src/components/command-entry.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"command-entry.d.mts","names":[],"sources":["../../src/components/command-entry.tsx"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-entry.mjs","names":[],"sources":["../../src/components/command-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 {\n ElseClause,\n FunctionDeclaration,\n IfStatement\n} from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\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 TSDocParam,\n TSDocRemarks,\n TSDocTitle\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport type { CommandTree } from \"@shell-shock/core\";\nimport { CommandValidationLogic } from \"@shell-shock/core/components/command-validation-logic\";\nimport { IsDebug } from \"@shell-shock/core/components/helpers\";\nimport {\n CommandParserLogic,\n OptionsInterfaceDeclaration\n} from \"@shell-shock/core/components/options-parser-logic\";\nimport {\n getAppBin,\n getDynamicPathSegmentName,\n isDynamicPathSegment\n} from \"@shell-shock/core/plugin-utils\";\nimport { findFilePath, relativePath } from \"@stryke/path/find\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { replaceExtension } from \"@stryke/path/replace\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { constantCase } from \"@stryke/string-format/constant-case\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport defu from \"defu\";\nimport type { ScriptPresetContext } from \"../types/plugin\";\nimport { VirtualCommandEntry } from \"./virtual-command-entry\";\n\nexport function CommandInvocation(props: { command: CommandTree }) {\n const { command } = props;\n\n return (\n <>\n {code` return withCommand(\"${command.path}\", [${command.segments\n .map(segment =>\n isDynamicPathSegment(segment)\n ? camelCase(getDynamicPathSegmentName(segment))\n : `\"${segment}\"`\n )\n .join(\", \")}], [${\n Object.keys(command.options).length > 0 ? `options` : \"\"\n }${\n command.args.length > 0\n ? `${\n Object.keys(command.options).length > 0 ? \", \" : \"\"\n }${command.args.map(arg => camelCase(arg.name)).join(\", \")}`\n : \"\"\n }], handle${pascalCase(command.name)}); `}\n <hbr />\n </>\n );\n}\n\nexport interface CommandHandlerDeclarationProps {\n command: CommandTree;\n banner?: Children;\n children?: Children;\n}\n\n/**\n * A component that generates the `handler` function declaration for a command.\n */\nexport function CommandHandlerDeclaration(\n props: CommandHandlerDeclarationProps\n) {\n const { command, banner, children } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n\n return (\n <>\n <OptionsInterfaceDeclaration command={command} />\n <Spacing />\n <TSDoc\n heading={`The ${command.title} (${getAppBin(context)} ${command.segments\n .map(segment =>\n isDynamicPathSegment(segment)\n ? `[${constantCase(getDynamicPathSegmentName(segment))}]`\n : segment\n )\n .join(\" \")}) command.`}>\n <TSDocRemarks>{`${command.description.replace(/\\.+$/, \"\")}.`}</TSDocRemarks>\n <hbr />\n <TSDocTitle>{command.title}</TSDocTitle>\n <TSDocParam name=\"args\">{`The command-line arguments passed to the command.`}</TSDocParam>\n </TSDoc>\n <FunctionDeclaration\n export\n async\n name=\"handler\"\n parameters={[{ name: \"args\", type: \"string[]\", default: \"useArgs()\" }]}>\n <CommandParserLogic\n command={command}\n appSpecificEnvPrefix={context.config.appSpecificEnvPrefix}\n isCaseSensitive={context.config.isCaseSensitive}\n />\n <Spacing />\n <Show when={Boolean(banner)}>{banner}</Show>\n <Spacing />\n {code`writeLine(\"\");`}\n <IfStatement condition={<IsDebug />}>\n {code`writeLine(textColors.body.tertiary(\"Debug mode is enabled. Additional debug information may be logged to the console.\"));\n writeLine(\"\");\n debug(\\`Command path: ${command.segments\n .map(segment =>\n isDynamicPathSegment(segment)\n ? `\\${${camelCase(getDynamicPathSegmentName(segment))}}`\n : segment\n )\n .join(\" / \")} \\\\n\\\\nOptions: \\\\n${Object.values(command.options)\n .map(\n option =>\n ` - ${kebabCase(option.name)}: \\${options.${camelCase(\n option.name\n )} === undefined ? \"\" : JSON.stringify(options.${camelCase(\n option.name\n )})}`\n )\n .join(\"\\\\n\")}${\n command.args.length > 0\n ? ` \\\\n\\\\nArguments: \\\\n${command.args\n .map(\n arg =>\n ` - ${kebabCase(arg.name)}: \\${${camelCase(\n arg.name\n )} === undefined ? \"\" : JSON.stringify(${camelCase(\n arg.name\n )})}`\n )\n .join(\"\\\\n\")}`\n : \"\"\n }\\`); `}\n </IfStatement>\n <Spacing />\n {children}\n <Spacing />\n <IfStatement condition={code`options.help`}>\n {code`return showHelp(); `}\n </IfStatement>\n <ElseClause>\n <hbr />\n <CommandInvocation command={command} />\n </ElseClause>\n </FunctionDeclaration>\n </>\n );\n}\n\nexport interface CommandEntryProps extends Omit<\n EntryFileProps,\n \"path\" | \"typeDefinition\"\n> {\n command: CommandTree;\n}\n\n/**\n * The command entry point for the Shell Shock project.\n */\nexport function CommandEntry(props: CommandEntryProps) {\n const { command, imports, builtinImports, ...rest } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n const filePath = computed(() =>\n joinPaths(\n command.segments\n .filter(segment => !isDynamicPathSegment(segment))\n .join(\"/\"),\n \"index.ts\"\n )\n );\n const commandSourcePath = computed(() =>\n replaceExtension(\n relativePath(\n joinPaths(context.entryPath, findFilePath(filePath.value)),\n command.entry.input?.file || command.entry.file\n )\n )\n );\n const typeDefinition = computed(() => ({\n ...command.entry,\n output: command.id\n }));\n\n return (\n <>\n <EntryFile\n {...rest}\n path={filePath.value}\n typeDefinition={typeDefinition.value}\n imports={defu(imports ?? {}, {\n [commandSourcePath.value.startsWith(\".\")\n ? commandSourcePath.value\n : `./${commandSourcePath.value}`]:\n `handle${pascalCase(command.name)}`\n })}\n builtinImports={defu(builtinImports ?? {}, {\n env: [\"env\", \"isDevelopment\", \"isDebug\"],\n console: [\"debug\", \"warn\", \"error\", \"writeLine\", \"textColors\"],\n utils: [\"isMinimal\", \"isUnicodeSupported\"],\n state: [\n { name: \"GlobalOptions\", type: true },\n \"useGlobal\",\n \"useGlobalOptions\",\n \"useArgs\",\n \"hasFlag\",\n \"withCommand\"\n ],\n [joinPaths(\n \"help\",\n ...command.segments.filter(\n segment => !isDynamicPathSegment(segment)\n )\n )]: [\"showHelp\"],\n [joinPaths(\n \"banner\",\n ...command.segments.filter(\n segment => !isDynamicPathSegment(segment)\n )\n )]: [\"showBanner\"]\n })}>\n <Spacing />\n <OptionsInterfaceDeclaration command={command} />\n <Spacing />\n <CommandHandlerDeclaration\n command={command}\n banner={code`await showBanner(); `}>\n <CommandValidationLogic command={command} />\n <IfStatement condition={code`failures.length > 0`}>\n {code`error(\\`The following validation failures were found while processing the user provided input, and must be corrected before the \\${italic(\"${\n command.title\n }\")} command can be executed: \\\\n\\\\n\\${failures.map(failure => \" - \" + failure).join(\"\\\\n\")}\\`);\n options.help = true; `}\n </IfStatement>\n </CommandHandlerDeclaration>\n </EntryFile>\n <For each={Object.values(command.children)}>\n {child => (\n <Show\n when={child.isVirtual}\n fallback={<CommandEntry command={child} />}>\n <VirtualCommandEntry command={child} />\n </Show>\n )}\n </For>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAsCA,SAAO,kBAAA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A,EAAA,CAAA;IAAA,gBAAA,6BAAA,EACJ,SACV,CAAC;IAAC,gBAAQ,SAAA,EAAA,CAAA;IAAA,gBAAA,2BAAA;KACA;KACT,QAAC,IAAW;KACZ,IAAG,WAAY;AACb,aAAA,CAAA,gBAAW,wBAAA,EACF,SACR,CAAA,EAAG,gBAAE,aAAA;OACL,WAAA,IAAA;OACD,IAAA,WAAU;AACZ,eAAA,IAAA,8IAAmB,QAAA,MAAA;;;OAG3B,CAAA,CAAA;;KAEO,CAAA;IAAA;;EAEJ,CAAA,CAAA,EAAI,gBAAK,KAAc;EACxB,IAAA,OAAA;AACA,UAAS,OAAA,OAAW,QAAA,SAAA;;;GAGpB,IAAA,OAAA;AACK,WAAQ,MAAM;;GAEf,IAAC,WAAS;AACR,WAAE,gBAAkB,cAAmB,kBAEvC,CAAA;;GAEJ,IAAA,WAAS;AACP,WAAQ,gBAAA,qBAAA,EACL,SAAO,OACP,CAAA;;GAEL,CAAA;EACD,CAAA,CAAA"}
|
|
1
|
+
{"version":3,"file":"command-entry.mjs","names":[],"sources":[],"mappings":""}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
2
|
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
4
3
|
let _alloy_js_core = require("@alloy-js/core");
|
|
5
4
|
let _alloy_js_typescript = require("@alloy-js/typescript");
|
|
@@ -16,7 +15,7 @@ function CommandRouterRoute() {
|
|
|
16
15
|
return [
|
|
17
16
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
18
17
|
get when() {
|
|
19
|
-
return !command.
|
|
18
|
+
return !command.virtual;
|
|
20
19
|
},
|
|
21
20
|
get children() {
|
|
22
21
|
return (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_dynamic_import_statement.DynamicImportStatement, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-router.d.cts","names":[],"sources":["../../src/components/command-router.tsx"],"mappings":";;;;iBAkCgB,kBAAA,
|
|
1
|
+
{"version":3,"file":"command-router.d.cts","names":[],"sources":["../../src/components/command-router.tsx"],"mappings":";;;;iBAkCgB,kBAAA,IAAkB,QAAA;AAAA,UAuBjB,kBAAA;EACf,QAAA;EACA,QAAA,GAAW,MAAA,SAAe,WAAA;EAC1B,KAAA,GAAQ,QAAA;AAAA;AA1BwB;AAuBlC;;AAvBkC,iBAgClB,aAAA,CAAc,KAAA,EAAO,kBAAA,GAAkB,QAAA;;;;iBAmCvC,iBAAA,CAAkB,KAAA,EAAO,kBAAA,GAAkB,QAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-router.d.mts","names":[],"sources":["../../src/components/command-router.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"command-router.d.mts","names":[],"sources":["../../src/components/command-router.tsx"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command-router.mjs","names":[],"sources":["../../src/components/command-router.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 {\n ElseIfClause,\n IfStatement,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport { DynamicImportStatement } from \"@powerlines/plugin-alloy/typescript/components/dynamic-import-statement\";\nimport { CommandContext, useCommand } from \"@shell-shock/core/contexts/command\";\nimport { isDynamicPathSegment } from \"@shell-shock/core/plugin-utils\";\nimport type { CommandTree } from \"@shell-shock/core/types/command\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport type { ScriptPresetContext } from \"../types/plugin\";\n\nexport function CommandRouterRoute() {\n const command = useCommand();\n\n return (\n <>\n <Show when={!command.isVirtual}>\n <DynamicImportStatement\n name={`handle${pascalCase(command.name)}`}\n importPath={`./${\n command.segments.filter(segment => !isDynamicPathSegment(segment))[\n command.segments.filter(segment => !isDynamicPathSegment(segment))\n .length - 1\n ]\n }`}\n exportName=\"handler\"\n />\n </Show>\n <hbr />\n {code`return handle${pascalCase(command.name)}(args);`}\n </>\n );\n}\n\nexport interface CommandRouterProps {\n segments: string[];\n commands?: Record<string, CommandTree>;\n route?: Children;\n}\n\n/**\n * The command router component.\n */\nexport function CommandRouter(props: CommandRouterProps) {\n const { segments, commands, route } = props;\n\n const index = computed(() => 2 + (segments.length ?? 0));\n\n return (\n <Show when={commands && Object.keys(commands).length > 0}>\n <VarDeclaration\n let\n name=\"command\"\n type=\"string\"\n initializer={code`\"\";`}\n />\n <Spacing />\n <Show when={commands && Object.keys(commands).length > 0}>\n <IfStatement\n condition={code`args.length > ${\n index.value\n } && args[${index.value}]`}>{code`command = args[${\n index.value\n }];`}</IfStatement>\n <Spacing />\n </Show>\n <CommandRouterBody\n segments={segments}\n commands={commands}\n route={route}\n />\n </Show>\n );\n}\n\n/**\n * The internal command router body logic component.\n */\nexport function CommandRouterBody(props: CommandRouterProps) {\n const { commands, route } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n\n return (\n <Show when={commands && Object.keys(commands).length > 0}>\n <IfStatement condition={code`!command.startsWith(\"-\")`}>\n <For each={Object.values(commands ?? {})}>\n {(subcommand, idx) => (\n <CommandContext.Provider value={subcommand}>\n <Show\n when={Boolean(idx)}\n fallback={\n <IfStatement\n condition={code`${\n context.config.isCaseSensitive\n ? \"command\"\n : 'command.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")'\n } === \"${\n context.config.isCaseSensitive\n ? subcommand.name\n : subcommand.name\n .toLowerCase()\n .replaceAll(\"-\", \"\")\n .replaceAll(\"_\", \"\")\n }\"${\n subcommand.alias && subcommand.alias.length > 0\n ? ` || ${subcommand.alias\n .map(\n alias =>\n `${context.config.isCaseSensitive ? \"command\" : 'command.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")'} === \"${\n context.config.isCaseSensitive\n ? alias\n : alias\n .toLowerCase()\n .replaceAll(\"-\", \"\")\n .replaceAll(\"_\", \"\")\n }\"`\n )\n .join(\" || \")}`\n : \"\"\n }`}>\n <Show\n when={Boolean(route)}\n fallback={<CommandRouterRoute />}>\n {route}\n </Show>\n </IfStatement>\n }>\n <ElseIfClause\n condition={code`${\n context.config.isCaseSensitive\n ? \"command\"\n : 'command.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")'\n } === \"${\n context.config.isCaseSensitive\n ? subcommand.name\n : subcommand.name\n .toLowerCase()\n .replaceAll(\"-\", \"\")\n .replaceAll(\"_\", \"\")\n }\"${\n subcommand.alias && subcommand.alias.length > 0\n ? ` || ${subcommand.alias\n .map(\n alias =>\n `${context.config.isCaseSensitive ? \"command\" : 'command.toLowerCase().replaceAll(\"-\", \"\").replaceAll(\"_\", \"\")'} === \"${\n context.config.isCaseSensitive\n ? alias\n : alias\n .toLowerCase()\n .replaceAll(\"-\", \"\")\n .replaceAll(\"_\", \"\")\n }\"`\n )\n .join(\" || \")}`\n : \"\"\n }`}>\n <Show when={Boolean(route)} fallback={<CommandRouterRoute />}>\n {route}\n </Show>\n </ElseIfClause>\n </Show>\n </CommandContext.Provider>\n )}\n </For>\n <ElseIfClause\n condition={code`Boolean(command) && !command.startsWith(\"-\")`}>{code`const suggestions = findSuggestions(command, [${Object.values(\n commands ?? {}\n )\n .map(\n cmd =>\n `\"${cmd.name}\"${(cmd.alias ?? []).map(alias => `, \"${alias}\"`).join(\"\")}`\n )\n .join(\", \")}]).slice(0, 3);\n error(\\`Unknown command: \"\\${command}\"\\${suggestions && suggestions.length > 0 ? \\`, did you mean: \\${suggestions.length === 1 ? \\`\"\\${suggestions[0]}\"\\` : suggestions.map((suggestion, i) => i < suggestions.length - 1 ? \\`\"\\${suggestion}\", \\` : \\`or \"\\${suggestion}\"\\`)}?\\` : \"\"} \\`);`}</ElseIfClause>\n </IfStatement>\n </Show>\n );\n}\n"],"mappings":";;;;;;;;;;;AA2BA,SAAS,qBAAyB;CAClC,MAAQ,UAAC,YAAgB;AACzB,QAAS;EAAA,gBAAA,MAAuB;GAChC,IAAO,OAAO;AACR,WAAG,CAAA,QAAa;;;AAGhB,WAAC,gBAAS,wBAAqB;KAC7B,IAAA,OAAU;;;KAGb,IAAA,aAAA;AACE,aAAU,KAAE,QAAQ,SAAU,QAAA,YAAA,CAAA,qBAAA,QAAA,CAAA,CAAA,QAAA,SAAA,QAAA,YAAA,CAAA,qBAAA,QAAA,CAAA,CAAA,SAAA;;KAE7B,YAAS;KACV,CAAC;;GAEL,CAAC;EAAE,gBAAgB,OAAS,EAAA,CAAA;EAAA,WAAkB,IAAC,gBAAA,WAA6B,QAAA,KAAA,CAAA,SAAA;EAAA;;;;;AAK/E,SAAS,cAAA,OAAA;CACP,MAAM,EACJ,UACA,UACA,UACD;CACH,MAAA,QAAA,eAAA,KAAA,SAAA,UAAA,GAAA;;EAEA,IAAO,OAAA;AACL,UAAU,YAAQ,OAAA,KAAA,SAAA,CAAA,SAAA;;EAElB,IAAM,WAAU;AAClB,UAAA;IAAA,gBAAA,gBAAA;;KAEE,MAAA;KACK,MAAO;KACZ,aAAA,IAAA;KACK,CAAA;IAAA,gBAAS,SAAqB,EAAA,CAAA;IAAA,gBAAoB,MAAA;KACjD,IAAE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defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
2
|
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
4
3
|
let _alloy_js_core = require("@alloy-js/core");
|
|
5
4
|
let _alloy_js_typescript = require("@alloy-js/typescript");
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import * as _$_alloy_js_core0 from "@alloy-js/core";
|
|
2
|
-
|
|
3
1
|
//#region src/components/exit-function-declaration.d.ts
|
|
4
2
|
/**
|
|
5
3
|
* The `exit` handler function declaration code for the Shell Shock project.
|
|
6
4
|
*/
|
|
7
|
-
declare function ExitFunctionDeclaration():
|
|
5
|
+
declare function ExitFunctionDeclaration(): import("@alloy-js/core").Children;
|
|
8
6
|
//#endregion
|
|
9
7
|
export { ExitFunctionDeclaration };
|
|
10
8
|
//# sourceMappingURL=exit-function-declaration.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exit-function-declaration.d.cts","names":[],"sources":["../../src/components/exit-function-declaration.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"exit-function-declaration.d.cts","names":[],"sources":["../../src/components/exit-function-declaration.tsx"],"mappings":";;AAmCA;;iBAAgB,uBAAA,6BAAuB,QAAA"}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import * as _$_alloy_js_core0 from "@alloy-js/core";
|
|
2
|
-
|
|
3
1
|
//#region src/components/exit-function-declaration.d.ts
|
|
4
2
|
/**
|
|
5
3
|
* The `exit` handler function declaration code for the Shell Shock project.
|
|
6
4
|
*/
|
|
7
|
-
declare function ExitFunctionDeclaration():
|
|
5
|
+
declare function ExitFunctionDeclaration(): import("@alloy-js/core").Children;
|
|
8
6
|
//#endregion
|
|
9
7
|
export { ExitFunctionDeclaration };
|
|
10
8
|
//# sourceMappingURL=exit-function-declaration.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exit-function-declaration.d.mts","names":[],"sources":["../../src/components/exit-function-declaration.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"exit-function-declaration.d.mts","names":[],"sources":["../../src/components/exit-function-declaration.tsx"],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"exit-function-declaration.mjs","names":[],"sources":[
|
|
1
|
+
{"version":3,"file":"exit-function-declaration.mjs","names":[],"sources":[],"mappings":""}
|
|
@@ -80,7 +80,7 @@ function VirtualCommandEntry(props) {
|
|
|
80
80
|
return filePath.value;
|
|
81
81
|
},
|
|
82
82
|
get imports() {
|
|
83
|
-
return (0, defu.default)(imports ?? {}, Object.entries(command.children).filter(([, child]) => child.
|
|
83
|
+
return (0, defu.default)(imports ?? {}, Object.entries(command.children).filter(([, child]) => child.virtual).reduce((ret, [name, child]) => {
|
|
84
84
|
ret[`./${child.name}`] = [{
|
|
85
85
|
name: "handler",
|
|
86
86
|
alias: `handle${(0, _stryke_string_format_pascal_case.pascalCase)(name)}`
|
|
@@ -139,7 +139,7 @@ function VirtualCommandEntry(props) {
|
|
|
139
139
|
},
|
|
140
140
|
children: (child) => (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
141
141
|
get when() {
|
|
142
|
-
return child.
|
|
142
|
+
return child.virtual;
|
|
143
143
|
},
|
|
144
144
|
get fallback() {
|
|
145
145
|
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_command_entry.CommandEntry, { command: child });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"virtual-command-entry.d.mts","names":[],"sources":["../../src/components/virtual-command-entry.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"virtual-command-entry.d.mts","names":[],"sources":["../../src/components/virtual-command-entry.tsx"],"mappings":""}
|
|
@@ -77,7 +77,7 @@ function VirtualCommandEntry(props) {
|
|
|
77
77
|
return filePath.value;
|
|
78
78
|
},
|
|
79
79
|
get imports() {
|
|
80
|
-
return defu(imports ?? {}, Object.entries(command.children).filter(([, child]) => child.
|
|
80
|
+
return defu(imports ?? {}, Object.entries(command.children).filter(([, child]) => child.virtual).reduce((ret, [name, child]) => {
|
|
81
81
|
ret[`./${child.name}`] = [{
|
|
82
82
|
name: "handler",
|
|
83
83
|
alias: `handle${pascalCase(name)}`
|
|
@@ -136,7 +136,7 @@ function VirtualCommandEntry(props) {
|
|
|
136
136
|
},
|
|
137
137
|
children: (child) => createComponent(Show, {
|
|
138
138
|
get when() {
|
|
139
|
-
return child.
|
|
139
|
+
return child.virtual;
|
|
140
140
|
},
|
|
141
141
|
get fallback() {
|
|
142
142
|
return createComponent(CommandEntry, { command: child });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"virtual-command-entry.mjs","names":[],"sources":[
|
|
1
|
+
{"version":3,"file":"virtual-command-entry.mjs","names":[],"sources":[],"mappings":""}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
|
-
let _shell_shock_core = require("@shell-shock/core");
|
|
4
2
|
|
|
5
3
|
//#region src/helpers/get-global-options.ts
|
|
6
4
|
/**
|
|
@@ -16,8 +14,8 @@ function getGlobalOptions() {
|
|
|
16
14
|
description: "Show help information.",
|
|
17
15
|
env: false,
|
|
18
16
|
alias: ["h", "?"],
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
type: "boolean",
|
|
18
|
+
required: false,
|
|
21
19
|
default: false,
|
|
22
20
|
variadic: false,
|
|
23
21
|
skipAddingNegative: true
|
|
@@ -28,8 +26,8 @@ function getGlobalOptions() {
|
|
|
28
26
|
description: "Show the version of the application.",
|
|
29
27
|
env: false,
|
|
30
28
|
alias: ["v"],
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
type: "boolean",
|
|
30
|
+
required: false,
|
|
33
31
|
default: false,
|
|
34
32
|
variadic: false,
|
|
35
33
|
skipAddingNegative: true
|
|
@@ -40,8 +38,8 @@ function getGlobalOptions() {
|
|
|
40
38
|
description: "Enable verbose output.",
|
|
41
39
|
env: "VERBOSE",
|
|
42
40
|
alias: ["V"],
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
type: "boolean",
|
|
42
|
+
required: false,
|
|
45
43
|
default: false,
|
|
46
44
|
variadic: false,
|
|
47
45
|
skipAddingNegative: true
|
|
@@ -52,8 +50,8 @@ function getGlobalOptions() {
|
|
|
52
50
|
description: "Enable colored terminal output.",
|
|
53
51
|
env: "COLOR",
|
|
54
52
|
alias: ["colors"],
|
|
55
|
-
|
|
56
|
-
|
|
53
|
+
type: "boolean",
|
|
54
|
+
required: false,
|
|
57
55
|
variadic: false,
|
|
58
56
|
skipAddingNegative: false
|
|
59
57
|
},
|
|
@@ -63,8 +61,8 @@ function getGlobalOptions() {
|
|
|
63
61
|
description: "Do not display the application banner displayed while running the CLI - will be set to true if running in a CI pipeline.",
|
|
64
62
|
env: "NO_BANNER",
|
|
65
63
|
alias: ["hide-banner"],
|
|
66
|
-
|
|
67
|
-
|
|
64
|
+
type: "boolean",
|
|
65
|
+
required: false,
|
|
68
66
|
variadic: false,
|
|
69
67
|
default: false
|
|
70
68
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-global-options.d.cts","names":[],"sources":["../../src/helpers/get-global-options.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"get-global-options.d.cts","names":[],"sources":["../../src/helpers/get-global-options.ts"],"mappings":";;;;;AAyBA;;;iBAAgB,gBAAA,IAAoB,aAAa"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-global-options.d.mts","names":[],"sources":["../../src/helpers/get-global-options.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-global-options.d.mts","names":[],"sources":["../../src/helpers/get-global-options.ts"],"mappings":""}
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { CommandParameterKinds } from "@shell-shock/core";
|
|
2
|
-
|
|
3
1
|
//#region src/helpers/get-global-options.ts
|
|
4
2
|
/**
|
|
5
3
|
* Get the default command options.
|
|
@@ -14,8 +12,8 @@ function getGlobalOptions() {
|
|
|
14
12
|
description: "Show help information.",
|
|
15
13
|
env: false,
|
|
16
14
|
alias: ["h", "?"],
|
|
17
|
-
|
|
18
|
-
|
|
15
|
+
type: "boolean",
|
|
16
|
+
required: false,
|
|
19
17
|
default: false,
|
|
20
18
|
variadic: false,
|
|
21
19
|
skipAddingNegative: true
|
|
@@ -26,8 +24,8 @@ function getGlobalOptions() {
|
|
|
26
24
|
description: "Show the version of the application.",
|
|
27
25
|
env: false,
|
|
28
26
|
alias: ["v"],
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
type: "boolean",
|
|
28
|
+
required: false,
|
|
31
29
|
default: false,
|
|
32
30
|
variadic: false,
|
|
33
31
|
skipAddingNegative: true
|
|
@@ -38,8 +36,8 @@ function getGlobalOptions() {
|
|
|
38
36
|
description: "Enable verbose output.",
|
|
39
37
|
env: "VERBOSE",
|
|
40
38
|
alias: ["V"],
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
type: "boolean",
|
|
40
|
+
required: false,
|
|
43
41
|
default: false,
|
|
44
42
|
variadic: false,
|
|
45
43
|
skipAddingNegative: true
|
|
@@ -50,8 +48,8 @@ function getGlobalOptions() {
|
|
|
50
48
|
description: "Enable colored terminal output.",
|
|
51
49
|
env: "COLOR",
|
|
52
50
|
alias: ["colors"],
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
type: "boolean",
|
|
52
|
+
required: false,
|
|
55
53
|
variadic: false,
|
|
56
54
|
skipAddingNegative: false
|
|
57
55
|
},
|
|
@@ -61,8 +59,8 @@ function getGlobalOptions() {
|
|
|
61
59
|
description: "Do not display the application banner displayed while running the CLI - will be set to true if running in a CI pipeline.",
|
|
62
60
|
env: "NO_BANNER",
|
|
63
61
|
alias: ["hide-banner"],
|
|
64
|
-
|
|
65
|
-
|
|
62
|
+
type: "boolean",
|
|
63
|
+
required: false,
|
|
66
64
|
variadic: false,
|
|
67
65
|
default: false
|
|
68
66
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-global-options.mjs","names":[],"sources":[
|
|
1
|
+
{"version":3,"file":"get-global-options.mjs","names":[],"sources":[],"mappings":""}
|
package/dist/index.cjs
CHANGED
|
@@ -27,7 +27,7 @@ const plugin = (options = {}) => {
|
|
|
27
27
|
...(0, _shell_shock_plugin_help.default)(options),
|
|
28
28
|
...(0, _shell_shock_plugin_banner.default)(options.banner),
|
|
29
29
|
{
|
|
30
|
-
name: "shell-shock
|
|
30
|
+
name: "shell-shock/script-preset",
|
|
31
31
|
config() {
|
|
32
32
|
this.debug("Providing default configuration for the Shell Shock `script` preset.");
|
|
33
33
|
return {
|
|
@@ -100,7 +100,7 @@ const plugin = (options = {}) => {
|
|
|
100
100
|
doubleHardline: true,
|
|
101
101
|
children: (child) => (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
102
102
|
get when() {
|
|
103
|
-
return child.
|
|
103
|
+
return child.virtual;
|
|
104
104
|
},
|
|
105
105
|
get fallback() {
|
|
106
106
|
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_command_entry.CommandEntry, { command: child });
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"mappings":""}
|
package/dist/index.mjs
CHANGED
|
@@ -22,7 +22,7 @@ const plugin = (options = {}) => {
|
|
|
22
22
|
...help(options),
|
|
23
23
|
...banner(options.banner),
|
|
24
24
|
{
|
|
25
|
-
name: "shell-shock
|
|
25
|
+
name: "shell-shock/script-preset",
|
|
26
26
|
config() {
|
|
27
27
|
this.debug("Providing default configuration for the Shell Shock `script` preset.");
|
|
28
28
|
return {
|
|
@@ -95,7 +95,7 @@ const plugin = (options = {}) => {
|
|
|
95
95
|
doubleHardline: true,
|
|
96
96
|
children: (child) => createComponent(Show, {
|
|
97
97
|
get when() {
|
|
98
|
-
return child.
|
|
98
|
+
return child.virtual;
|
|
99
99
|
},
|
|
100
100
|
get fallback() {
|
|
101
101
|
return createComponent(CommandEntry, { command: child });
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":[
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":[],"mappings":""}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":""}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shell-shock/preset-script",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.67",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A Shell Shock preset that generates a fully-featured script application.",
|
|
6
6
|
"keywords": [
|
|
@@ -193,23 +193,23 @@
|
|
|
193
193
|
"typings": "dist/index.d.mts",
|
|
194
194
|
"files": ["dist/**/*"],
|
|
195
195
|
"dependencies": {
|
|
196
|
-
"@alloy-js/core": "0.23.
|
|
197
|
-
"@alloy-js/typescript": "0.23.0
|
|
198
|
-
"@powerlines/deepkit": "^0.
|
|
199
|
-
"@powerlines/plugin-alloy": "^0.26.
|
|
200
|
-
"@powerlines/plugin-plugin": "^0.12.
|
|
201
|
-
"@shell-shock/core": "
|
|
202
|
-
"@shell-shock/plugin-banner": "
|
|
203
|
-
"@shell-shock/plugin-console": "
|
|
204
|
-
"@shell-shock/plugin-help": "
|
|
205
|
-
"@shell-shock/plugin-theme": "
|
|
206
|
-
"@stryke/helpers": "^0.10.
|
|
207
|
-
"@stryke/path": "^0.
|
|
208
|
-
"@stryke/string-format": "^0.17.
|
|
196
|
+
"@alloy-js/core": "^0.23.1",
|
|
197
|
+
"@alloy-js/typescript": "^0.23.0",
|
|
198
|
+
"@powerlines/deepkit": "^0.9.80",
|
|
199
|
+
"@powerlines/plugin-alloy": "^0.26.219",
|
|
200
|
+
"@powerlines/plugin-plugin": "^0.12.538",
|
|
201
|
+
"@shell-shock/core": "0.17.12",
|
|
202
|
+
"@shell-shock/plugin-banner": "0.1.39",
|
|
203
|
+
"@shell-shock/plugin-console": "0.2.16",
|
|
204
|
+
"@shell-shock/plugin-help": "0.2.30",
|
|
205
|
+
"@shell-shock/plugin-theme": "0.4.25",
|
|
206
|
+
"@stryke/helpers": "^0.10.24",
|
|
207
|
+
"@stryke/path": "^0.29.11",
|
|
208
|
+
"@stryke/string-format": "^0.17.26",
|
|
209
209
|
"defu": "^6.1.7",
|
|
210
|
-
"powerlines": "^0.47.
|
|
210
|
+
"powerlines": "^0.47.126"
|
|
211
211
|
},
|
|
212
|
-
"devDependencies": { "@types/node": "^25.
|
|
212
|
+
"devDependencies": { "@types/node": "^25.9.1" },
|
|
213
213
|
"publishConfig": { "access": "public" },
|
|
214
|
-
"gitHead": "
|
|
214
|
+
"gitHead": "3c10901dd3fbbc3c9d6d1a3373f01cc5f56d3321"
|
|
215
215
|
}
|