@shell-shock/preset-script 0.6.20 → 0.6.21

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.
@@ -112,14 +112,7 @@ function BinEntry(props) {
112
112
  output: "bin"
113
113
  },
114
114
  get imports() {
115
- return (0, defu.default)({ didyoumean2: [
116
- {
117
- name: "didYouMean",
118
- default: true
119
- },
120
- { name: "ReturnTypeEnums" },
121
- { name: "ThresholdTypeEnums" }
122
- ] }, imports ?? {}, Object.entries(context.commands).filter(([, command]) => command.isVirtual).reduce((ret, [name, command]) => {
115
+ return (0, defu.default)(imports ?? {}, Object.entries(context.commands).filter(([, command]) => command.isVirtual).reduce((ret, [name, command]) => {
123
116
  ret[`./${command.name}`] = [{
124
117
  name: "handler",
125
118
  alias: `handle${(0, __stryke_string_format_pascal_case.pascalCase)(name)}`
@@ -144,7 +137,8 @@ function BinEntry(props) {
144
137
  "hasFlag",
145
138
  "isUnicodeSupported",
146
139
  "internal_appContext",
147
- "getArgs"
140
+ "getArgs",
141
+ "findSuggestions"
148
142
  ]
149
143
  });
150
144
  },
@@ -1 +1 @@
1
- {"version":3,"file":"bin-entry.cjs","names":["code","computed","For","Show","FunctionDeclaration","IfStatement","Spacing","usePowerlines","EntryFile","TSDoc","getAppTitle","getUnique","findFileName","replaceExtension","pascalCase","defu","ExitFunctionDeclaration","RunApplication","_$createComponent","_$createIntrinsic","BinEntry","props","prefix","postfix","builtinImports","imports","children","rest","context","bins","Object","values","config","bin","each","value","_$mergeProps","path","typeDefinition","file","output","didyoumean2","name","default","entries","commands","filter","command","isVirtual","reduce","ret","alias","env","console","utils","when","Boolean","heading","async","returnType","condition","packageJson","version","fallback"],"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 { TSDoc } from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { getAppTitle } from \"@shell-shock/core/plugin-utils/context-helpers\";\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 {\n didyoumean2: [\n { name: \"didYouMean\", default: true },\n { name: \"ReturnTypeEnums\" },\n { name: \"ThresholdTypeEnums\" }\n ]\n },\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 \"hasFlag\",\n \"isUnicodeSupported\",\n \"internal_appContext\",\n \"getArgs\"\n ]\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 )} CLI application.`}></TSDoc>\n <FunctionDeclaration async returnType=\"any\" 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":";;;;;;;;;;;;;;;;;;;;;AAuCA,SAAgBiB,iBAAiB;AAC/B,QAAA;mDAEKX,2DAAO,EAAA,CAAA;EACPN,oBAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;mDAkEJ,OAAA,EAAA,CAAA;EAAA;;;;;AAkBP,SAAgBoB,SAASC,OAAsB;CAC7C,MAAM,EAAEC,QAAQC,SAASC,gBAAgBC,SAASC,UAAU,GAAGC,SAASN;CAExE,MAAMO,8EAA8C;CACpD,MAAMC,sFAAgCC,OAAOC,OAAOH,QAAQI,OAAOC,IAAI,CAAC,CAAC;AAEzE,yDACG/B,qBAAG;EAAA,IAACgC,OAAI;AAAA,UAAEL,KAAKM;;EAAKT,WAClBO,yDACEzB,kHACKmB,MAAI;GAAA,IACRU,OAAI;AAAA,qGAAgCJ,IAAI,CAAC;;GACzCK,gBAAgB;IACdC,MAAMN;IACNO,QAAQ;IACT;GAAA,IACDf,UAAO;AAAA,6BACL,EACEgB,aAAa;KACX;MAAEC,MAAM;MAAcC,SAAS;MAAM;K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A;sDAAA,OAAA,EAAA,CAAA;sDAMVvB,sBAAI;MAAA,IAACoD,OAAI;AAAA,cAAEC,QAAQjC,QAAQ;;MAAA,IAAEwC,WAAQ;AAAA,+DAAG9C,gBAAc,EAAA,CAAA;;MAAAS,UACpDH;MAAO,CAAA;sDAAA,OAAA,EAAA,CAAA;KAAA;;GAAA,CAAA,CAAA;EAIb,CAAA"}
1
+ {"version":3,"file":"bin-entry.cjs","names":["code","computed","For","Show","FunctionDeclaration","IfStatement","Spacing","usePowerlines","EntryFile","TSDoc","getAppTitle","getUnique","findFileName","replaceExtension","pascalCase","defu","ExitFunctionDeclaration","RunApplication","_$createComponent","_$createIntrinsic","BinEntry","props","prefix","postfix","builtinImports","imports","children","rest","context","bins","Object","values","config","bin","each","value","_$mergeProps","path","typeDefinition","file","output","entries","commands","filter","command","isVirtual","reduce","ret","name","alias","env","console","utils","when","Boolean","heading","async","returnType","condition","packageJson","version","fallback"],"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 { TSDoc } from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { getAppTitle } from \"@shell-shock/core/plugin-utils/context-helpers\";\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 \"hasFlag\",\n \"isUnicodeSupported\",\n \"internal_appContext\",\n \"getArgs\",\n \"findSuggestions\"\n ]\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 )} CLI application.`}></TSDoc>\n <FunctionDeclaration async returnType=\"any\" 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":";;;;;;;;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,OAAO;;MAAA,IAAAI,WAAA;AAAA,cAAA,CACxBJ,yDACAhB,2DAAO,EAAA,CAAA,CAAA;;MAAA,CAAA;sDAETG,6DAAK,EAAA,IACJ8C,UAAO;AAAA,aAAE,+FACP3B,QACD,CAAA;QAAmB,CAAA;sDACrBxB,2CAAmB;MAACoD,OAAK;MAACC,YAAU;MAAOT,MAAI;MAAA,IAAAtB,WAAA;AAAA,cAAA;yDAC7CrB,mCAAW;SAACqD,WAAW1D,oBAAI;SAA2B,IAAA0B,WAAA;AAAA,iBACpD1B,oBAAI,eACH4B,SAAS+B,YAAYC,UACjB,IAAIhC,SAAS+B,YAAYC,QAAO,KAChC,QAAO;;;SAET,CAAA;yDAELtD,2DAAO,EAAA,CAAA;QACPoB;yDAAQ,OAAA,EAAA,CAAA;QAAA;;MAAA,CAAA;sDAAA,OAAA,EAAA,CAAA;sDAAA,OAAA,EAAA,CAAA;sDAAA,OAAA,EAAA,CAAA;sDAMVvB,sBAAI;MAAA,IAACkD,OAAI;AAAA,cAAEC,QAAQ/B,QAAQ;;MAAA,IAAEsC,WAAQ;AAAA,+DAAG5C,gBAAc,EAAA,CAAA;;MAAAS,UACpDH;MAAO,CAAA;sDAAA,OAAA,EAAA,CAAA;KAAA;;GAAA,CAAA,CAAA;EAIb,CAAA"}
@@ -110,14 +110,7 @@ function BinEntry(props) {
110
110
  output: "bin"
111
111
  },
112
112
  get imports() {
113
- return defu({ didyoumean2: [
114
- {
115
- name: "didYouMean",
116
- default: true
117
- },
118
- { name: "ReturnTypeEnums" },
119
- { name: "ThresholdTypeEnums" }
120
- ] }, imports ?? {}, Object.entries(context.commands).filter(([, command]) => command.isVirtual).reduce((ret, [name, command]) => {
113
+ return defu(imports ?? {}, Object.entries(context.commands).filter(([, command]) => command.isVirtual).reduce((ret, [name, command]) => {
121
114
  ret[`./${command.name}`] = [{
122
115
  name: "handler",
123
116
  alias: `handle${pascalCase(name)}`
@@ -142,7 +135,8 @@ function BinEntry(props) {
142
135
  "hasFlag",
143
136
  "isUnicodeSupported",
144
137
  "internal_appContext",
145
- "getArgs"
138
+ "getArgs",
139
+ "findSuggestions"
146
140
  ]
147
141
  });
148
142
  },
@@ -1 +1 @@
1
- {"version":3,"file":"bin-entry.mjs","names":["code","computed","For","Show","FunctionDeclaration","IfStatement","Spacing","usePowerlines","EntryFile","TSDoc","getAppTitle","getUnique","findFileName","replaceExtension","pascalCase","defu","ExitFunctionDeclaration","RunApplication","_$createComponent","_$createIntrinsic","BinEntry","props","prefix","postfix","builtinImports","imports","children","rest","context","bins","Object","values","config","bin","each","value","_$mergeProps","path","typeDefinition","file","output","didyoumean2","name","default","entries","commands","filter","command","isVirtual","reduce","ret","alias","env","console","utils","when","Boolean","heading","async","returnType","condition","packageJson","version","fallback"],"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 { TSDoc } from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { getAppTitle } from \"@shell-shock/core/plugin-utils/context-helpers\";\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 {\n didyoumean2: [\n { name: \"didYouMean\", default: true },\n { name: \"ReturnTypeEnums\" },\n { name: \"ThresholdTypeEnums\" }\n ]\n },\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 \"hasFlag\",\n \"isUnicodeSupported\",\n \"internal_appContext\",\n \"getArgs\"\n ]\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 )} CLI application.`}></TSDoc>\n <FunctionDeclaration async returnType=\"any\" 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":";;;;;;;;;;;;;;;;;;;AAuCA,SAAgB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;MACA;MACA;MACA;MAAS;KAEZ,CAAC;;GAAA,IAAA5B,WAAA;AAAA,WAAA;KAAAR,gBACDF,yBAAuB,EAAA,CAAA;KAAAE,gBACvBZ,SAAO,EAAA,CAAA;KAAAY,gBACPf,MAAI;MAAA,IAACoD,OAAI;AAAA,cAAEC,QAAQlC,OAAO;;MAAA,IAAAI,WAAA;AAAA,cAAA,CACxBJ,QAAMJ,gBACNZ,SAAO,EAAA,CAAA,CAAA;;MAAA,CAAA;KAAAY,gBAETT,OAAK,EAAA,IACJgD,UAAO;AAAA,aAAE,8BAA8B/C,YACrCkB,QACD,CAAA;QAAmB,CAAA;KAAAV,gBACrBd,qBAAmB;MAACsD,OAAK;MAACC,YAAU;MAAOjB,MAAI;MAAA,IAAAhB,WAAA;AAAA,cAAA;QAAAR,gBAC7Cb,aAAW;SAACuD,WAAW5D,IAAI;SAA2B,IAAA0B,WAAA;AAAA,iBACpD1B,IAAI,eACH4B,SAASiC,YAAYC,UACjB,IAAIlC,SAASiC,YAAYC,QAAO,KAChC,QAAO;;;SAET,CAAA;QAAA5C,gBAELZ,SAAO,EAAA,CAAA;QACPoB;QAAQP,gBAAA,OAAA,EAAA,CAAA;QAAA;;MAAA,CAAA;KAAAA,gBAAA,OAAA,EAAA,CAAA;KAAAA,gBAAA,OAAA,EAAA,CAAA;KAAAA,gBAAA,OAAA,EAAA,CAAA;KAAAD,gBAMVf,MAAI;MAAA,IAACoD,OAAI;AAAA,cAAEC,QAAQjC,QAAQ;;MAAA,IAAEwC,WAAQ;AAAA,cAAA7C,gBAAGD,gBAAc,EAAA,CAAA;;MAAAS,UACpDH;MAAO,CAAA;KAAAJ,gBAAA,OAAA,EAAA,CAAA;KAAA;;GAAA,CAAA,CAAA;EAIb,CAAA"}
1
+ {"version":3,"file":"bin-entry.mjs","names":["code","computed","For","Show","FunctionDeclaration","IfStatement","Spacing","usePowerlines","EntryFile","TSDoc","getAppTitle","getUnique","findFileName","replaceExtension","pascalCase","defu","ExitFunctionDeclaration","RunApplication","_$createComponent","_$createIntrinsic","BinEntry","props","prefix","postfix","builtinImports","imports","children","rest","context","bins","Object","values","config","bin","each","value","_$mergeProps","path","typeDefinition","file","output","entries","commands","filter","command","isVirtual","reduce","ret","name","alias","env","console","utils","when","Boolean","heading","async","returnType","condition","packageJson","version","fallback"],"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 { TSDoc } from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { getAppTitle } from \"@shell-shock/core/plugin-utils/context-helpers\";\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 \"hasFlag\",\n \"isUnicodeSupported\",\n \"internal_appContext\",\n \"getArgs\",\n \"findSuggestions\"\n ]\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 )} CLI application.`}></TSDoc>\n <FunctionDeclaration async returnType=\"any\" 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":";;;;;;;;;;;;;;;;;;;AAuCA,SAAgBiB,iBAAiB;AAC/B,QAAA;EAAAC,gBAEKZ,SAAO,EAAA,CAAA;EACPN,IAAI;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAkEJmB,gBAAA,OAAA,EAAA,CAAA;EAAA;;;;;AAkBP,SAAgBC,SAASC,OAAsB;CAC7C,MAAM,EAAEC,QAAQC,SAASC,gBAAgBC,SAASC,UAAU,GAAGC,SAASN;CAExE,MAAMO,UAAUrB,eAAoC;CACpD,MAAMsB,OAAO5B,eAAeU,UAAU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AAAA,cAAA;QAAAR,gBAC7Cb,aAAW;SAACqD,WAAW1D,IAAI;SAA2B,IAAA0B,WAAA;AAAA,iBACpD1B,IAAI,eACH4B,SAAS+B,YAAYC,UACjB,IAAIhC,SAAS+B,YAAYC,QAAO,KAChC,QAAO;;;SAET,CAAA;QAAA1C,gBAELZ,SAAO,EAAA,CAAA;QACPoB;QAAQP,gBAAA,OAAA,EAAA,CAAA;QAAA;;MAAA,CAAA;KAAAA,gBAAA,OAAA,EAAA,CAAA;KAAAA,gBAAA,OAAA,EAAA,CAAA;KAAAA,gBAAA,OAAA,EAAA,CAAA;KAAAD,gBAMVf,MAAI;MAAA,IAACkD,OAAI;AAAA,cAAEC,QAAQ/B,QAAQ;;MAAA,IAAEsC,WAAQ;AAAA,cAAA3C,gBAAGD,gBAAc,EAAA,CAAA;;MAAAS,UACpDH;MAAO,CAAA;KAAAJ,gBAAA,OAAA,EAAA,CAAA;KAAA;;GAAA,CAAA,CAAA;EAIb,CAAA"}
@@ -144,12 +144,7 @@ function CommandRouterBody(props) {
144
144
  }), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.ElseIfClause, {
145
145
  condition: __alloy_js_core.code`Boolean(command) && !command.startsWith("-")`,
146
146
  get children() {
147
- return __alloy_js_core.code`const suggestions = didYouMean(command, [${Object.values(commands ?? {}).map((cmd) => `"${cmd.name}"${(cmd.alias ?? []).map((alias) => `, "${alias}"`).join("")}`).join(", ")}], {
148
- caseSensitive: ${JSON.stringify(context.config.isCaseSensitive)},
149
- returnType: ReturnTypeEnums.ALL_CLOSEST_MATCHES,
150
- thresholdType: ThresholdTypeEnums.SIMILARITY,
151
- threshold: 0.25
152
- });
147
+ return __alloy_js_core.code`const suggestions = findSuggestions(command, [${Object.values(commands ?? {}).map((cmd) => `"${cmd.name}"${(cmd.alias ?? []).map((alias) => `, "${alias}"`).join("")}`).join(", ")}]).slice(0, 3);
153
148
  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}"\`)}?\` : ""} \`);`;
154
149
  }
155
150
  })];
@@ -1 +1 @@
1
- {"version":3,"file":"command-router.cjs","names":["code","computed","For","Show","ElseIfClause","IfStatement","VarDeclaration","Spacing","usePowerlines","DynamicImportStatement","CommandContext","useCommand","isDynamicPathSegment","pascalCase","CommandRouterRoute","command","_$createComponent","when","isVirtual","children","name","importPath","segments","filter","segment","length","exportName","_$createIntrinsic","_$memo","CommandRouter","props","commands","route","index","Object","keys","type","initializer","condition","value","CommandRouterBody","context","each","values","subcommand","idx","Provider","Boolean","fallback","config","isCaseSensitive","toLowerCase","replaceAll","alias","map","join","cmd","JSON","stringify"],"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/context-helpers\";\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 <hbr />\n <hbr />\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 <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 when={Boolean(route)} 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 = didYouMean(command, [${Object.values(\n commands ?? {}\n )\n .map(\n cmd =>\n `\"${cmd.name}\"${(cmd.alias ?? []).map(alias => `, \"${alias}\"`).join(\"\")}`\n )\n .join(\", \")}], {\n caseSensitive: ${JSON.stringify(context.config.isCaseSensitive)},\n returnType: ReturnTypeEnums.ALL_CLOSEST_MATCHES,\n thresholdType: ThresholdTypeEnums.SIMILARITY,\n threshold: 0.25\n });\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 </Show>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAkCA,SAAgBc,qBAAqB;CACnC,MAAMC,+DAAsB;AAE5B,QAAA;mDAEKZ,sBAAI;GAAA,IAACc,OAAI;AAAA,WAAE,CAACF,QAAQG;;GAAS,IAAAC,WAAA;AAAA,4DAC3BV,iGAAsB;KAAA,IACrBW,OAAI;AAAA,aAAE,4DAAoBL,QAAQK,KAAK;;KAAE,IACzCC,aAAU;AAAA,aAAE,KACVN,QAAQO,SAASC,QAAOC,YAAW,2EAAsBA,QAAQ,CAAC,CAChET,QAAQO,SAASC,QAAOC,YAAW,2EAAsBA,QAAQ,CAAC,CAC/DC,SAAS;;KAGhBC,YAAU;KAAA,CAAA;;GAAA,CAAA;mDAAA,OAAA,EAAA,CAAA;8CAIb1B,oBAAI,mEAA2Be,QAAQK,KAAK,CAAA,SAAS;EAAA;;;;;AAc5D,SAAgBS,cAAcC,OAA2B;CACvD,MAAM,EAAER,UAAUS,UAAUC,UAAUF;CAEtC,MAAMG,4CAAuB,KAAKX,SAASG,UAAU,GAAG;AAExD,yDACGtB,sBAAI;EAAA,IAACc,OAAI;AAAA,UAAEc,YAAYG,OAAOC,KAAKJ,SAAS,CAACN,SAAS;;EAAC,IAAAN,WAAA;AAAA,UAAA;qDACrDb,sCAAc;KAAA,OAAA;KAEbc,MAAI;KACJgB,MAAI;KACJC,aAAarC,oBAAI;KAAK,CAAA;qDAEvBO,2DAAO,EAAA,CAAA;qDACPJ,sBAAI;KAAA,IAACc,OAAI;AAAA,aAAEc,YAAYG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S,EAAE,EAAEC,KAAID,UAAS,MAAMA,MAAK,GAAI,CAACE,KAAK,GAAG,GAC1E,CACAA,KAAK,KAAK,CAAA;2BACQE,KAAKC,UAAUjB,QAAQQ,OAAOC,gBAAgB,CAAA;;;;;;;IAK4N,CAAA,CAAA;;EAAA,CAAA"}
1
+ {"version":3,"file":"command-router.cjs","names":["code","computed","For","Show","ElseIfClause","IfStatement","VarDeclaration","Spacing","usePowerlines","DynamicImportStatement","CommandContext","useCommand","isDynamicPathSegment","pascalCase","CommandRouterRoute","command","_$createComponent","when","isVirtual","children","name","importPath","segments","filter","segment","length","exportName","_$createIntrinsic","_$memo","CommandRouter","props","commands","route","index","Object","keys","type","initializer","condition","value","CommandRouterBody","context","each","values","subcommand","idx","Provider","Boolean","fallback","config","isCaseSensitive","toLowerCase","replaceAll","alias","map","join","cmd"],"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/context-helpers\";\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 <hbr />\n <hbr />\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 <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 when={Boolean(route)} 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 </Show>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAkCA,SAAgBc,qBAAqB;CACnC,MAAMC,+DAAsB;AAE5B,QAAA;mDAEKZ,sBAAI;GAAA,IAACc,OAAI;AAAA,WAAE,CAACF,QAAQG;;GAAS,IAAAC,WAAA;AAAA,4DAC3BV,iGAAsB;KAAA,IACrBW,OAAI;AAAA,aAAE,4DAAoBL,QAAQK,KAAK;;KAAE,IACzCC,aAAU;AAAA,aAAE,KACVN,QAAQO,SAASC,QAAOC,YAAW,2EAAsBA,QAAQ,CAAC,CAChET,QAAQO,SAASC,QAAOC,YAAW,2EAAsBA,QAAQ,CAAC,CAC/DC,SAAS;;KAGhBC,YAAU;KAAA,CAAA;;GAAA,CAAA;mDAAA,OAAA,EAAA,CAAA;8CAIb1B,oBAAI,mEAA2Be,QAAQK,KAAK,CAAA,SAAS;EAAA;;;;;AAc5D,SAAgBS,cAAcC,OAA2B;CACvD,MAAM,EAAER,UAAUS,UAAUC,UAAUF;CAEtC,MAAMG,4CAAuB,KAAKX,SAASG,UAAU,GAAG;AAExD,yDACGtB,sBAAI;EAAA,IAACc,OAAI;AAAA,UAAEc,YAAYG,OAAOC,KAAKJ,SAAS,CAACN,SAAS;;EAAC,IAAAN,WAAA;AAAA,UAAA;qDACrDb,sCAAc;KAAA,OAAA;KAEbc,MAAI;KACJgB,MAAI;KACJC,aAAarC,oBAAI;KAAK,CAAA;qDAEvBO,2DAAO,EAAA,CAAA;qDACPJ,sBAAI;KAAA,IAACc,OAAI;AAAA,aAAEc,YAAYG,OAAOC,KAAKJ,SAAS,CAACN,SAAS;;KAAC,IAAAN,WAAA;AAAA,aAAA;wDACrDd,mCAAW;QAAA,IACViC,YAAS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IACkR,CAAA,CAAA;;EAAA,CAAA"}
@@ -143,12 +143,7 @@ function CommandRouterBody(props) {
143
143
  }), createComponent(ElseIfClause, {
144
144
  condition: code`Boolean(command) && !command.startsWith("-")`,
145
145
  get children() {
146
- return code`const suggestions = didYouMean(command, [${Object.values(commands ?? {}).map((cmd) => `"${cmd.name}"${(cmd.alias ?? []).map((alias) => `, "${alias}"`).join("")}`).join(", ")}], {
147
- caseSensitive: ${JSON.stringify(context.config.isCaseSensitive)},
148
- returnType: ReturnTypeEnums.ALL_CLOSEST_MATCHES,
149
- thresholdType: ThresholdTypeEnums.SIMILARITY,
150
- threshold: 0.25
151
- });
146
+ return code`const suggestions = findSuggestions(command, [${Object.values(commands ?? {}).map((cmd) => `"${cmd.name}"${(cmd.alias ?? []).map((alias) => `, "${alias}"`).join("")}`).join(", ")}]).slice(0, 3);
152
147
  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}"\`)}?\` : ""} \`);`;
153
148
  }
154
149
  })];
@@ -1 +1 @@
1
- {"version":3,"file":"command-router.mjs","names":["code","computed","For","Show","ElseIfClause","IfStatement","VarDeclaration","Spacing","usePowerlines","DynamicImportStatement","CommandContext","useCommand","isDynamicPathSegment","pascalCase","CommandRouterRoute","command","_$createComponent","when","isVirtual","children","name","importPath","segments","filter","segment","length","exportName","_$createIntrinsic","_$memo","CommandRouter","props","commands","route","index","Object","keys","type","initializer","condition","value","CommandRouterBody","context","each","values","subcommand","idx","Provider","Boolean","fallback","config","isCaseSensitive","toLowerCase","replaceAll","alias","map","join","cmd","JSON","stringify"],"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/context-helpers\";\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 <hbr />\n <hbr />\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 <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 when={Boolean(route)} 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 = didYouMean(command, [${Object.values(\n commands ?? {}\n )\n .map(\n cmd =>\n `\"${cmd.name}\"${(cmd.alias ?? []).map(alias => `, \"${alias}\"`).join(\"\")}`\n )\n .join(\", \")}], {\n caseSensitive: ${JSON.stringify(context.config.isCaseSensitive)},\n returnType: ReturnTypeEnums.ALL_CLOSEST_MATCHES,\n thresholdType: ThresholdTypeEnums.SIMILARITY,\n threshold: 0.25\n });\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 </Show>\n );\n}\n"],"mappings":";;;;;;;;;;;AAkCA,SAAgBc,qBAAqB;CACnC,MAAMC,UAAUJ,YAAY;AAE5B,QAAA;EAAAK,gBAEKb,MAAI;GAAA,IAACc,OAAI;AAAA,WAAE,CAACF,QAAQG;;GAAS,IAAAC,WAAA;AAAA,WAAAH,gBAC3BP,wBAAsB;KAAA,IACrBW,OAAI;AAAA,aAAE,SAASP,WAAWE,QAAQK,KAAK;;KAAE,IACzCC,aAAU;AAAA,aAAE,KACVN,QAAQO,SAASC,QAAOC,YAAW,CAACZ,qBAAqBY,QAAQ,CAAC,CA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B,KACR+B,aAAa,CACbC,WAAW,KAAK,GAAG,CACnBA,WAAW,KAAK,GAAG,CAAA,GAE1BR,WAAWS,SAAST,WAAWS,MAAM5B,SAAS,IAC1C,OAAOmB,WAAWS,MACfC,KACCD,UACE,GAAGZ,QAAQQ,OAAOC,kBAAkB,YAAY,wEAA+D,QAC7GT,QAAQQ,OAAOC,kBACXG,QACAA,MACGF,aAAa,CACbC,WAAW,KAAK,GAAG,CACnBA,WAAW,KAAK,GAAG,CAAA,GAE/B,CACAG,KAAK,OAAO,KACf;;SACJ,IAAApC,WAAA;AAAA,iBAAAH,gBACDb,MAAI;WAAA,IAACc,OAAI;AAAA,mBAAE8B,QAAQf,MAAM;;WAAA,IAAEgB,WAAQ;AAAA,mBAAAhC,gBAAGF,oBAAkB,EAAA,CAAA;;WAAAK,UACtDa;WAAK,CAAA;;SAAA,CAAA;;OAAA,CAAA;;KAAA,CAAA;IAKf,CAAA,EAAAhB,gBAEFZ,cAAY;IACXkC,WAAWtC,IAAI;IAA8C,IAAAmB,WAAA;AAAA,YAAGnB,IAAI,4CAA4CkC,OAAOS,OACvHZ,YAAY,EACd,CAAC,CACEuB,KACCE,QACE,IAAIA,IAAIpC,KAAI,IAAKoC,IAAIH,SAAS,EAAE,EAAEC,KAAID,UAAS,MAAMA,MAAK,GAAI,CAACE,KAAK,GAAG,GAC1E,CACAA,KAAK,KAAK,CAAA;2BACQE,KAAKC,UAAUjB,QAAQQ,OAAOC,gBAAgB,CAAA;;;;;;;IAK4N,CAAA,CAAA;;EAAA,CAAA"}
1
+ {"version":3,"file":"command-router.mjs","names":["code","computed","For","Show","ElseIfClause","IfStatement","VarDeclaration","Spacing","usePowerlines","DynamicImportStatement","CommandContext","useCommand","isDynamicPathSegment","pascalCase","CommandRouterRoute","command","_$createComponent","when","isVirtual","children","name","importPath","segments","filter","segment","length","exportName","_$createIntrinsic","_$memo","CommandRouter","props","commands","route","index","Object","keys","type","initializer","condition","value","CommandRouterBody","context","each","values","subcommand","idx","Provider","Boolean","fallback","config","isCaseSensitive","toLowerCase","replaceAll","alias","map","join","cmd"],"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/context-helpers\";\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 <hbr />\n <hbr />\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 <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 when={Boolean(route)} 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 </Show>\n );\n}\n"],"mappings":";;;;;;;;;;;AAkCA,SAAgBc,qBAAqB;CACnC,MAAMC,UAAUJ,YAAY;AAE5B,QAAA;EAAAK,gBAEKb,MAAI;GAAA,IAACc,OAAI;AAAA,WAAE,CAACF,QAAQG;;GAAS,IAAAC,WAAA;AAAA,WAAAH,gBAC3BP,wBAAsB;KAAA,IACrBW,OAAI;AAAA,aAAE,SAASP,WAAWE,QAAQK,KAAK;;KAAE,IACz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QAAQQ,OAAOC,kBACX,YACA,wEAA+D,QAEnET,QAAQQ,OAAOC,kBACXN,WAAWxB,OACXwB,WAAWxB,KACR+B,aAAa,CACbC,WAAW,KAAK,GAAG,CACnBA,WAAW,KAAK,GAAG,CAAA,GAE1BR,WAAWS,SAAST,WAAWS,MAAM5B,SAAS,IAC1C,OAAOmB,WAAWS,MACfC,KACCD,UACE,GAAGZ,QAAQQ,OAAOC,kBAAkB,YAAY,wEAA+D,QAC7GT,QAAQQ,OAAOC,kBACXG,QACAA,MACGF,aAAa,CACbC,WAAW,KAAK,GAAG,CACnBA,WAAW,KAAK,GAAG,CAAA,GAE/B,CACAG,KAAK,OAAO,KACf;;SACJ,IAAApC,WAAA;AAAA,iBAAAH,gBACDb,MAAI;WAAA,IAACc,OAAI;AAAA,mBAAE8B,QAAQf,MAAM;;WAAA,IAAEgB,WAAQ;AAAA,mBAAAhC,gBAAGF,oBAAkB,EAAA,CAAA;;WAAAK,UACtDa;WAAK,CAAA;;SAAA,CAAA;;OAAA,CAAA;;KAAA,CAAA;IAKf,CAAA,EAAAhB,gBAEFZ,cAAY;IACXkC,WAAWtC,IAAI;IAA8C,IAAAmB,WAAA;AAAA,YAAGnB,IAAI,iDAAiDkC,OAAOS,OAC5HZ,YAAY,EACd,CAAC,CACEuB,KACCE,QACE,IAAIA,IAAIpC,KAAI,IAAKoC,IAAIH,SAAS,EAAE,EAAEC,KAAID,UAAS,MAAMA,MAAK,GAAI,CAACE,KAAK,GAAG,GAC1E,CACAA,KAAK,KAAK,CAAA;;;IACkR,CAAA,CAAA;;EAAA,CAAA"}
@@ -1,10 +1,10 @@
1
- import * as _alloy_js_core3 from "@alloy-js/core";
1
+ import * as _alloy_js_core0 from "@alloy-js/core";
2
2
 
3
3
  //#region src/components/exit-function-declaration.d.ts
4
4
  /**
5
5
  * The `exit` handler function declaration code for the Shell Shock project.
6
6
  */
7
- declare function ExitFunctionDeclaration(): _alloy_js_core3.Children;
7
+ declare function ExitFunctionDeclaration(): _alloy_js_core0.Children;
8
8
  //#endregion
9
9
  export { ExitFunctionDeclaration };
10
10
  //# sourceMappingURL=exit-function-declaration.d.cts.map
@@ -68,7 +68,7 @@ function HelpOptions(props) {
68
68
  if (alias.length === 1) flags.push(`-${alias}`);
69
69
  else names.push(`--${(0, __stryke_string_format_kebab_case.kebabCase)(alias)}`);
70
70
  });
71
- return __alloy_js_core.code`[{ value: colors.text.body.primary("${flags.length > 0 ? `${flags.sort().join(", ")}${names.length > 0 ? ", " : ""}` : ""}${names.length > 0 ? names.sort().join(", ") : ""}${option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.string ? ` <${(0, __stryke_string_format_snake_case.snakeCase)(option.name)}${option.variadic ? "..." : ""}>` : option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number ? ` <${(0, __stryke_string_format_snake_case.snakeCase)(option.name)}${option.variadic ? "..." : ""}>` : ""}"), align: "right", border: "none", maxWidth: "1/3" }, { value: colors.text.body.tertiary("${option.description.replace(/\.+$/, "")} ${option.env || option.default !== void 0 ? `(${option.env ? `env: ${context.config.envPrefix}_${option.env}${option.default !== void 0 ? ", " : ""}` : ""}${option.default !== void 0 ? `default: ${JSON.stringify(option.default)}` : ""})` : ""}."), align: "left", border: "none" }], `;
71
+ return __alloy_js_core.code`[{ value: colors.text.body.primary("${flags.length > 0 ? `${flags.sort().join(", ")}${names.length > 0 ? ", " : ""}` : ""}${names.length > 0 ? names.sort().join(", ") : ""}${option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.string ? ` <${(0, __stryke_string_format_snake_case.snakeCase)(option.name)}${option.variadic ? "..." : ""}>` : option.kind === __powerlines_deepkit_vendor_type.ReflectionKind.number ? ` <${(0, __stryke_string_format_snake_case.snakeCase)(option.name)}${option.variadic ? "..." : ""}>` : ""}"), align: "right", border: "none", maxWidth: "1/3" }, { value: colors.text.body.tertiary("${option.description.replace(/\.+$/, "")} ${option.env || option.default !== void 0 ? `(${option.env ? `env: ${context.config.envPrefix}_${option.env}${option.default !== void 0 ? ", " : ""}` : ""}${option.default !== void 0 ? `default: ${JSON.stringify(option.default).replace(/"/g, "\\\"")}` : ""})` : ""}."), align: "left", border: "none" }], `;
72
72
  }
73
73
  }),
74
74
  (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
@@ -1 +1 @@
1
- {"version":3,"file":"help.cjs","names":["code","computed","For","Show","ReflectionKind","Spacing","usePowerlines","getAppBin","getDynamicPathSegmentName","isDynamicPathSegment","sortOptions","useTheme","kebabCase","snakeCase","HelpUsage","props","command","indent","context","theme","_$createComponent","each","Object","keys","config","bin","hardline","children","_$memo","segments","length","map","segment","join","values","arguments","argument","name","kind","string","number","variadic","padding","app","_$createIntrinsic","when","HelpOptions","options","option","flags","names","push","alias","forEach","sort","description","replace","env","default","undefined","envPrefix","JSON","stringify","HelpCommands","commands","child","BaseHelp","filterGlobalOptions","filter","some","globalOption","includes","value","VirtualHelp","doubleHardline","joiner","ender","icon","title","isVirtual","CommandHelp"],"sources":["../../src/components/help.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, computed, For, Show } from \"@alloy-js/core\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport {\n getAppBin,\n getDynamicPathSegmentName,\n isDynamicPathSegment\n} from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport { sortOptions } from \"@shell-shock/core/plugin-utils/reflect\";\nimport type {\n CommandOption,\n CommandTree\n} from \"@shell-shock/core/types/command\";\nimport { useTheme } from \"@shell-shock/plugin-theme/contexts/theme\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { snakeCase } from \"@stryke/string-format/snake-case\";\nimport type { ScriptPresetContext } from \"../types/plugin\";\n\nexport interface HelpUsageProps {\n /**\n * The command to generate help for.\n */\n command: CommandTree;\n\n /**\n * The padding scale to apply to the help display headings.\n *\n * @remarks\n * This value is multiplied by the theme's app padding to determine the final padding.\n *\n * @defaultValue 2\n */\n indent?: number;\n}\n\n/**\n * A component that generates the usage display for a command.\n */\nexport function HelpUsage(props: HelpUsageProps) {\n const { command, indent = 2 } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n const theme = useTheme();\n\n return (\n <>\n <For each={Object.keys(context.config.bin)} hardline>\n {bin => (\n <>\n {code`\n writeLine(\n colors.text.body.secondary(\\`\\$ \\${colors.text.usage.bin(\"${bin}\")}${\n command.segments.length > 0\n ? ` ${command.segments\n .map(\n segment =>\n `\\${colors.text.usage.${isDynamicPathSegment(segment) ? \"dynamic\" : \"command\"}(\"${\n isDynamicPathSegment(segment)\n ? `[${snakeCase(getDynamicPathSegmentName(segment))}]`\n : segment\n }\")}`\n )\n .join(\" \")}`\n : \"\"\n }${Object.values(command.children).length > 0 ? ` \\${colors.text.usage.dynamic(\"[command]\")}` : \"\"}${\n command.arguments.length > 0\n ? ` ${command.arguments\n .map(\n argument =>\n `\\${colors.text.usage.arguments(\"<${snakeCase(argument.name)}${\n (argument.kind === ReflectionKind.string ||\n argument.kind === ReflectionKind.number) &&\n argument.variadic\n ? \"...\"\n : \"\"\n }>\")}`\n )\n .join(\" \")}`\n : \"\"\n } \\${colors.text.usage.options(\"[options]\")}\\`), { padding: ${theme.padding.app * indent} }\n );`}\n <hbr />\n </>\n )}\n </For>\n <Show when={command.arguments.length > 0}>\n <hbr />\n <For each={Object.keys(context.config.bin)} hardline>\n {bin => (\n <>\n {code`\n writeLine(\n colors.text.body.secondary(\\`\\$ \\${colors.text.usage.bin(\"${bin}\")}${\n command.segments.length > 0\n ? ` ${command.segments\n .map(\n segment =>\n `\\${colors.text.usage.${isDynamicPathSegment(segment) ? \"dynamic\" : \"command\"}(\"${\n isDynamicPathSegment(segment)\n ? `[${snakeCase(getDynamicPathSegmentName(segment))}]`\n : segment\n }\")}`\n )\n .join(\" \")}`\n : \"\"\n }${Object.values(command.children).length > 0 ? ` \\${colors.text.usage.dynamic(\"[command]\")}` : \"\"} \\${colors.text.usage.options(\"[options]\")}${\n command.arguments.length > 0\n ? ` ${command.arguments\n .map(\n argument =>\n `\\${colors.text.usage.arguments(\"<${snakeCase(argument.name)}${\n (argument.kind === ReflectionKind.string ||\n argument.kind === ReflectionKind.number) &&\n argument.variadic\n ? \"...\"\n : \"\"\n }>\")}`\n )\n .join(\" \")}`\n : \"\"\n }\\`), { padding: ${theme.padding.app * indent} }\n );`}\n <hbr />\n </>\n )}\n </For>\n </Show>\n </>\n );\n}\n\nexport interface HelpOptionsProps {\n /**\n * The options to display help for.\n */\n options: CommandOption[];\n}\n\n/**\n * A component that generates the options table display for a command.\n */\nexport function HelpOptions(props: HelpOptionsProps) {\n const { options } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n\n return (\n <>\n {code`table([ `}\n <hbr />\n <For each={sortOptions(options)} hardline>\n {option => {\n const flags = [] as string[];\n const names = [] as string[];\n if (option.name.length === 1) {\n flags.push(`-${option.name}`);\n } else {\n names.push(`--${kebabCase(option.name)}`);\n }\n\n option.alias.forEach((alias: string) => {\n if (alias.length === 1) {\n flags.push(`-${alias}`);\n } else {\n names.push(`--${kebabCase(alias)}`);\n }\n });\n\n return code`[{ value: colors.text.body.primary(\"${\n flags.length > 0\n ? `${flags.sort().join(\", \")}${names.length > 0 ? \", \" : \"\"}`\n : \"\"\n }${names.length > 0 ? names.sort().join(\", \") : \"\"}${\n option.kind === ReflectionKind.string\n ? ` <${snakeCase(option.name)}${option.variadic ? \"...\" : \"\"}>`\n : option.kind === ReflectionKind.number\n ? ` <${snakeCase(option.name)}${option.variadic ? \"...\" : \"\"}>`\n : \"\"\n }\"), align: \"right\", border: \"none\", maxWidth: \"1/3\" }, { value: colors.text.body.tertiary(\"${option.description.replace(\n /\\.+$/,\n \"\"\n )} ${\n option.env || option.default !== undefined\n ? `(${\n option.env\n ? `env: ${context.config.envPrefix}_${option.env}${\n option.default !== undefined ? \", \" : \"\"\n }`\n : \"\"\n }${\n option.default !== undefined\n ? `default: ${JSON.stringify(option.default)}`\n : \"\"\n })`\n : \"\"\n }.\"), align: \"left\", border: \"none\" }], `;\n }}\n </For>\n <hbr />\n {code` ]); `}\n </>\n );\n}\n\nexport interface HelpCommandsProps {\n /**\n * A mapping of command names to their command definitions.\n */\n commands: Record<string, CommandTree>;\n}\n\n/**\n * A component that generates the commands table display for a command.\n */\nexport function HelpCommands(props: HelpCommandsProps) {\n const { commands } = props;\n\n return (\n <>\n {code`table([ `}\n <hbr />\n <For each={Object.values(commands)} hardline>\n {child =>\n code`[{ value: colors.text.body.primary(\"${\n child.name\n }\"), align: \"right\", border: \"none\" }, { value: colors.text.body.tertiary(\"${child.description.replace(\n /\\.+$/,\n \"\"\n )}\"), align: \"left\", border: \"none\" }], `\n }\n </For>\n <hbr />\n {code` ]); `}\n </>\n );\n}\n\nexport interface BaseHelpProps {\n /**\n * The command to generate help for.\n */\n command: CommandTree;\n\n /**\n * Whether to filter out global options from the help display.\n *\n * @remarks\n * When enabled, any options that are present in the global options context will be filtered out from the help display. This is useful for sub-commands to avoid displaying global options that are not relevant to the specific command.\n *\n * @defaultValue false\n */\n filterGlobalOptions?: boolean;\n\n /**\n * The padding scale to apply to the help display headings.\n *\n * @remarks\n * This value is multiplied by the theme's app padding to determine the final padding.\n *\n * @defaultValue 1\n */\n indent?: number;\n}\n\n/**\n * A component that generates the `help` function declaration for a command.\n */\nexport function BaseHelp(props: BaseHelpProps) {\n const { command, indent = 1, filterGlobalOptions = false } = props;\n\n const theme = useTheme();\n const context = usePowerlines<ScriptPresetContext>();\n\n const options = computed(() =>\n filterGlobalOptions\n ? Object.values(command.options).filter(\n option =>\n !context.options.some(\n globalOption =>\n globalOption.name === option.name ||\n option.alias.includes(globalOption.name) ||\n globalOption.alias?.includes(option.name) ||\n globalOption.alias?.some(alias => option.alias.includes(alias))\n )\n )\n : Object.values(command.options)\n );\n\n return (\n <>\n {code`writeLine(colors.bold(colors.text.heading.secondary(\"Usage:\"))${\n indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : \"\"\n });`}\n <hbr />\n <HelpUsage command={command} indent={indent} />\n <Spacing />\n <Show when={options.value.length > 0}>\n {code`writeLine(\"\");\n writeLine(colors.bold(colors.text.heading.secondary(\"Options:\"))${\n indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : \"\"\n });`}\n <hbr />\n <HelpOptions options={options.value} />\n <hbr />\n <hbr />\n </Show>\n <Show when={Object.keys(command.children).length > 0}>\n {code`writeLine(\"\");\n writeLine(colors.bold(colors.text.heading.secondary(\"Commands:\"))${\n indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : \"\"\n });`}\n <hbr />\n <HelpCommands commands={command.children} />\n <hbr />\n <hbr />\n </Show>\n </>\n );\n}\n\nexport interface VirtualHelpProps {\n /**\n * The options to display help for.\n */\n options: CommandOption[];\n\n /**\n * A mapping of command names to their command definitions.\n */\n commands: Record<string, CommandTree>;\n\n /**\n * The command path to generate help for, used for generating the help invocation instructions.\n *\n * @remarks\n * This is optional since the virtual command entry component can be used for both the global binary executable and virtual commands (there will be no command definition for the binary executable).\n */\n segments?: string[];\n}\n\n/**\n * A component that generates the invocation of the `help` function for a command.\n */\nexport function VirtualHelp(props: VirtualHelpProps) {\n const { options, segments, commands } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n\n return (\n <>\n <hbr />\n {code`writeLine(colors.bold(colors.text.heading.secondary(\"Global Options:\")));`}\n <hbr />\n <HelpOptions options={options} />\n {code`writeLine(\"\"); `}\n <Spacing />\n <Show when={Object.keys(commands).length > 0}>\n {code`writeLine(colors.text.body.secondary(\"The following commands are available:\"));\n writeLine(\"\"); `}\n <hbr />\n <hbr />\n <For\n each={Object.values(commands)}\n doubleHardline\n joiner={code`writeLine(\"\"); `}\n ender={code`writeLine(\"\"); `}>\n {child => (\n <>\n {code`\n writeLine(colors.text.heading.primary(${\n child.icon\n ? `(isUnicodeSupported ? \" ${child.icon} \" : \"\") + `\n : \"\"\n }\"${child.title} ${child.isVirtual ? \"\" : \"Command\"}\"));\n writeLine(\"\");\n writeLine(colors.text.body.secondary(\"${child.description}\"));\n writeLine(\"\");\n `}\n <hbr />\n <BaseHelp command={child} indent={2} filterGlobalOptions />\n <hbr />\n </>\n )}\n </For>\n {code`help(\"Running a specific command with the help flag (via: '${getAppBin(\n context\n )}${\n segments && segments.length > 0 ? ` ${segments.join(\" \")}` : \"\"\n } <specific command> --help') will provide additional information that is specific to that command.\");\n writeLine(\"\");`}\n </Show>\n </>\n );\n}\n\nexport interface CommandHelpProps {\n /**\n * A mapping of command names to their command definitions.\n */\n command: CommandTree;\n}\n\n/**\n * A component that generates the invocation of the `help` function for a command.\n */\nexport function CommandHelp(props: CommandHelpProps) {\n const { command } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n\n return (\n <>\n {code`writeLine(\"\"); `}\n <Spacing />\n <BaseHelp command={command} filterGlobalOptions={false} />\n {code`writeLine(\"\"); `}\n <Spacing />\n <Show when={Object.keys(command.children).length > 0}>\n {code`writeLine(colors.text.body.secondary(\"The following sub-commands are available:\"));\n writeLine(\"\"); `}\n <hbr />\n <hbr />\n <For\n each={Object.values(command.children)}\n doubleHardline\n joiner={code`writeLine(\"\"); `}\n ender={code`writeLine(\"\"); `}>\n {child => (\n <>\n {code`\n writeLine(colors.text.heading.primary(${\n child.icon\n ? `(isUnicodeSupported ? \" ${child.icon} \" : \"\") + `\n : \"\"\n }\"${child.title} ${child.isVirtual ? \"\" : \"Command\"}\"));\n writeLine(\"\");\n writeLine(colors.text.body.secondary(\"${child.description}\"));\n writeLine(\"\");\n `}\n <hbr />\n <BaseHelp command={child} indent={2} filterGlobalOptions />\n <hbr />\n </>\n )}\n </For>\n {code`help(\"Running a specific command with the help flag (via: '${getAppBin(\n context\n )} ${command.segments.join(\n \" \"\n )} <specific command> --help') will provide additional information that is specific to that command.\");\n writeLine(\"\");`}\n </Show>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAyDA,SAAgBc,UAAUC,OAAuB;CAC/C,MAAM,EAAEC,SAASC,SAAS,MAAMF;CAEhC,MAAMG,8EAA8C;CACpD,MAAMC,iEAAkB;AAExB,QAAA,kDAEKjB,qBAAG;EAAA,IAACmB,OAAI;AAAA,UAAEC,OAAOC,KAAKL,QAAQM,OAAOC,IAAI;;EAAEC,UAAQ;EAAAC,WACjDF,QAAG,6CAECzB,oBAAI;;oEAEmDyB,IAAG,KAC7DT,QAAQa,SAASC,SAAS,IACtB,IAAId,QAAQa,SACTE,KACCC,YACE,kGAA6CA,QAAQ,GAAG,YAAY,UAAS,8EACtDA,QAAQ,GACzB,oIAAwCA,QAAQ,CAAC,CAAA,KACjDA,QAAO,KAEhB,CACAC,KAAK,IAAI,KACZ,KACHX,OAAOY,OAAOlB,QAAQW,SAAS,CAACG,SAAS,IAAI,gDAAgD,KAC9Fd,QAAQmB,UAAUL,SAAS,IACvB,IAAId,QAAQmB,UACTJ,KACCK,aACE,qFAA8CA,SAASC,KAAK,IACzDD,SAASE,SAASlC,gDAAemC,UAChCH,SAASE,SAASlC,gDAAeoC,WACnCJ,SAASK,WACL,QACA,GAAE,MAEX,CACAR,KAAK,IAAI,KACZ,GAAE,6DACsDd,MAAMuB,QAAQC,MAAM1B,OAAM;UACvF,mDAAA,OAAA,EAAA,CAAA,CAAA;EAGA,CAAA,mDAEFd,sBAAI;EAAA,IAAC0C,OAAI;AAAA,UAAE7B,QAAQmB,UAAUL,SAAS;;EAAC,IAAAH,WAAA;AAAA,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AA,CAAA;EAAA;;;;;AAgBvB,SAAgB+C,YAAYjE,OAAyB;CACnD,MAAM,EAAEC,YAAYD;CAEpB,MAAMG,8EAA8C;AAEpD,QAAA;EAEKlB,oBAAI;mDACJK,2DAAO,EAAA,CAAA;mDACP6D,UAAQ;GAAUlD;GAASmD,qBAAqB;GAAK,CAAA;EACrDnE,oBAAI;mDACJK,2DAAO,EAAA,CAAA;mDACPF,sBAAI;GAAA,IAAC0C,OAAI;AAAA,WAAEvB,OAAOC,KAAKP,QAAQW,SAAS,CAACG,SAAS;;GAAC,IAAAH,WAAA;AAAA,WAAA;KACjD3B,oBAAI;;sDACW,OAAA,EAAA,CAAA;sDAAA,OAAA,EAAA,CAAA;sDAGfE,qBAAG;MAAA,IACFmB,OAAI;AAAA,cAAEC,OAAOY,OAAOlB,QAAQW,SAAS;;MACrC+C,gBAAc;MACdC,QAAQ3E,oBAAI;MACZ4E,OAAO5E,oBAAI;MAAiB2B,WAC3BsC,UAAK;mDAEDjE,oBAAI;wDAEDiE,MAAMY,OACF,2BAA2BZ,MAAMY,KAAI,gBACrC,GAAE,GACJZ,MAAMa,MAAK,GAAIb,MAAMc,YAAY,KAAK,UAAS;;wDAEXd,MAAMV,YAAW;;kBAExD;wDAAA,OAAA,EAAA,CAAA;wDAEFW,UAAQ;QAAClD,SAASiD;QAAOhD,QAAQ;QAAGkD,qBAAmB;QAAA,CAAA;wDAAA,OAAA,EAAA,CAAA;OAAA;MAG3D,CAAA;iDAEFnE,oBAAI,6HACHkB,QACD,CAAA,GAAIF,QAAQa,SAASI,KACpB,IACD,CAAA;wBACc;KAAA;;GAAA,CAAA;EAAA"}
1
+ {"version":3,"file":"help.cjs","names":["code","computed","For","Show","ReflectionKind","Spacing","usePowerlines","getAppBin","getDynamicPathSegmentName","isDynamicPathSegment","sortOptions","useTheme","kebabCase","snakeCase","HelpUsage","props","command","indent","context","theme","_$createComponent","each","Object","keys","config","bin","hardline","children","_$memo","segments","length","map","segment","join","values","arguments","argument","name","kind","string","number","variadic","padding","app","_$createIntrinsic","when","HelpOptions","options","option","flags","names","push","alias","forEach","sort","description","replace","env","default","undefined","envPrefix","JSON","stringify","HelpCommands","commands","child","BaseHelp","filterGlobalOptions","filter","some","globalOption","includes","value","VirtualHelp","doubleHardline","joiner","ender","icon","title","isVirtual","CommandHelp"],"sources":["../../src/components/help.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, computed, For, Show } from \"@alloy-js/core\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport {\n getAppBin,\n getDynamicPathSegmentName,\n isDynamicPathSegment\n} from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport { sortOptions } from \"@shell-shock/core/plugin-utils/reflect\";\nimport type {\n CommandOption,\n CommandTree\n} from \"@shell-shock/core/types/command\";\nimport { useTheme } from \"@shell-shock/plugin-theme/contexts/theme\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { snakeCase } from \"@stryke/string-format/snake-case\";\nimport type { ScriptPresetContext } from \"../types/plugin\";\n\nexport interface HelpUsageProps {\n /**\n * The command to generate help for.\n */\n command: CommandTree;\n\n /**\n * The padding scale to apply to the help display headings.\n *\n * @remarks\n * This value is multiplied by the theme's app padding to determine the final padding.\n *\n * @defaultValue 2\n */\n indent?: number;\n}\n\n/**\n * A component that generates the usage display for a command.\n */\nexport function HelpUsage(props: HelpUsageProps) {\n const { command, indent = 2 } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n const theme = useTheme();\n\n return (\n <>\n <For each={Object.keys(context.config.bin)} hardline>\n {bin => (\n <>\n {code`\n writeLine(\n colors.text.body.secondary(\\`\\$ \\${colors.text.usage.bin(\"${bin}\")}${\n command.segments.length > 0\n ? ` ${command.segments\n .map(\n segment =>\n `\\${colors.text.usage.${isDynamicPathSegment(segment) ? \"dynamic\" : \"command\"}(\"${\n isDynamicPathSegment(segment)\n ? `[${snakeCase(getDynamicPathSegmentName(segment))}]`\n : segment\n }\")}`\n )\n .join(\" \")}`\n : \"\"\n }${Object.values(command.children).length > 0 ? ` \\${colors.text.usage.dynamic(\"[command]\")}` : \"\"}${\n command.arguments.length > 0\n ? ` ${command.arguments\n .map(\n argument =>\n `\\${colors.text.usage.arguments(\"<${snakeCase(argument.name)}${\n (argument.kind === ReflectionKind.string ||\n argument.kind === ReflectionKind.number) &&\n argument.variadic\n ? \"...\"\n : \"\"\n }>\")}`\n )\n .join(\" \")}`\n : \"\"\n } \\${colors.text.usage.options(\"[options]\")}\\`), { padding: ${theme.padding.app * indent} }\n );`}\n <hbr />\n </>\n )}\n </For>\n <Show when={command.arguments.length > 0}>\n <hbr />\n <For each={Object.keys(context.config.bin)} hardline>\n {bin => (\n <>\n {code`\n writeLine(\n colors.text.body.secondary(\\`\\$ \\${colors.text.usage.bin(\"${bin}\")}${\n command.segments.length > 0\n ? ` ${command.segments\n .map(\n segment =>\n `\\${colors.text.usage.${isDynamicPathSegment(segment) ? \"dynamic\" : \"command\"}(\"${\n isDynamicPathSegment(segment)\n ? `[${snakeCase(getDynamicPathSegmentName(segment))}]`\n : segment\n }\")}`\n )\n .join(\" \")}`\n : \"\"\n }${Object.values(command.children).length > 0 ? ` \\${colors.text.usage.dynamic(\"[command]\")}` : \"\"} \\${colors.text.usage.options(\"[options]\")}${\n command.arguments.length > 0\n ? ` ${command.arguments\n .map(\n argument =>\n `\\${colors.text.usage.arguments(\"<${snakeCase(argument.name)}${\n (argument.kind === ReflectionKind.string ||\n argument.kind === ReflectionKind.number) &&\n argument.variadic\n ? \"...\"\n : \"\"\n }>\")}`\n )\n .join(\" \")}`\n : \"\"\n }\\`), { padding: ${theme.padding.app * indent} }\n );`}\n <hbr />\n </>\n )}\n </For>\n </Show>\n </>\n );\n}\n\nexport interface HelpOptionsProps {\n /**\n * The options to display help for.\n */\n options: CommandOption[];\n}\n\n/**\n * A component that generates the options table display for a command.\n */\nexport function HelpOptions(props: HelpOptionsProps) {\n const { options } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n\n return (\n <>\n {code`table([ `}\n <hbr />\n <For each={sortOptions(options)} hardline>\n {option => {\n const flags = [] as string[];\n const names = [] as string[];\n if (option.name.length === 1) {\n flags.push(`-${option.name}`);\n } else {\n names.push(`--${kebabCase(option.name)}`);\n }\n\n option.alias.forEach((alias: string) => {\n if (alias.length === 1) {\n flags.push(`-${alias}`);\n } else {\n names.push(`--${kebabCase(alias)}`);\n }\n });\n\n return code`[{ value: colors.text.body.primary(\"${\n flags.length > 0\n ? `${flags.sort().join(\", \")}${names.length > 0 ? \", \" : \"\"}`\n : \"\"\n }${names.length > 0 ? names.sort().join(\", \") : \"\"}${\n option.kind === ReflectionKind.string\n ? ` <${snakeCase(option.name)}${option.variadic ? \"...\" : \"\"}>`\n : option.kind === ReflectionKind.number\n ? ` <${snakeCase(option.name)}${option.variadic ? \"...\" : \"\"}>`\n : \"\"\n }\"), align: \"right\", border: \"none\", maxWidth: \"1/3\" }, { value: colors.text.body.tertiary(\"${option.description.replace(\n /\\.+$/,\n \"\"\n )} ${\n option.env || option.default !== undefined\n ? `(${\n option.env\n ? `env: ${context.config.envPrefix}_${option.env}${\n option.default !== undefined ? \", \" : \"\"\n }`\n : \"\"\n }${\n option.default !== undefined\n ? `default: ${JSON.stringify(option.default).replace(/\"/g, '\\\\\"')}`\n : \"\"\n })`\n : \"\"\n }.\"), align: \"left\", border: \"none\" }], `;\n }}\n </For>\n <hbr />\n {code` ]); `}\n </>\n );\n}\n\nexport interface HelpCommandsProps {\n /**\n * A mapping of command names to their command definitions.\n */\n commands: Record<string, CommandTree>;\n}\n\n/**\n * A component that generates the commands table display for a command.\n */\nexport function HelpCommands(props: HelpCommandsProps) {\n const { commands } = props;\n\n return (\n <>\n {code`table([ `}\n <hbr />\n <For each={Object.values(commands)} hardline>\n {child =>\n code`[{ value: colors.text.body.primary(\"${\n child.name\n }\"), align: \"right\", border: \"none\" }, { value: colors.text.body.tertiary(\"${child.description.replace(\n /\\.+$/,\n \"\"\n )}\"), align: \"left\", border: \"none\" }], `\n }\n </For>\n <hbr />\n {code` ]); `}\n </>\n );\n}\n\nexport interface BaseHelpProps {\n /**\n * The command to generate help for.\n */\n command: CommandTree;\n\n /**\n * Whether to filter out global options from the help display.\n *\n * @remarks\n * When enabled, any options that are present in the global options context will be filtered out from the help display. This is useful for sub-commands to avoid displaying global options that are not relevant to the specific command.\n *\n * @defaultValue false\n */\n filterGlobalOptions?: boolean;\n\n /**\n * The padding scale to apply to the help display headings.\n *\n * @remarks\n * This value is multiplied by the theme's app padding to determine the final padding.\n *\n * @defaultValue 1\n */\n indent?: number;\n}\n\n/**\n * A component that generates the `help` function declaration for a command.\n */\nexport function BaseHelp(props: BaseHelpProps) {\n const { command, indent = 1, filterGlobalOptions = false } = props;\n\n const theme = useTheme();\n const context = usePowerlines<ScriptPresetContext>();\n\n const options = computed(() =>\n filterGlobalOptions\n ? Object.values(command.options).filter(\n option =>\n !context.options.some(\n globalOption =>\n globalOption.name === option.name ||\n option.alias.includes(globalOption.name) ||\n globalOption.alias?.includes(option.name) ||\n globalOption.alias?.some(alias => option.alias.includes(alias))\n )\n )\n : Object.values(command.options)\n );\n\n return (\n <>\n {code`writeLine(colors.bold(colors.text.heading.secondary(\"Usage:\"))${\n indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : \"\"\n });`}\n <hbr />\n <HelpUsage command={command} indent={indent} />\n <Spacing />\n <Show when={options.value.length > 0}>\n {code`writeLine(\"\");\n writeLine(colors.bold(colors.text.heading.secondary(\"Options:\"))${\n indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : \"\"\n });`}\n <hbr />\n <HelpOptions options={options.value} />\n <hbr />\n <hbr />\n </Show>\n <Show when={Object.keys(command.children).length > 0}>\n {code`writeLine(\"\");\n writeLine(colors.bold(colors.text.heading.secondary(\"Commands:\"))${\n indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : \"\"\n });`}\n <hbr />\n <HelpCommands commands={command.children} />\n <hbr />\n <hbr />\n </Show>\n </>\n );\n}\n\nexport interface VirtualHelpProps {\n /**\n * The options to display help for.\n */\n options: CommandOption[];\n\n /**\n * A mapping of command names to their command definitions.\n */\n commands: Record<string, CommandTree>;\n\n /**\n * The command path to generate help for, used for generating the help invocation instructions.\n *\n * @remarks\n * This is optional since the virtual command entry component can be used for both the global binary executable and virtual commands (there will be no command definition for the binary executable).\n */\n segments?: string[];\n}\n\n/**\n * A component that generates the invocation of the `help` function for a command.\n */\nexport function VirtualHelp(props: VirtualHelpProps) {\n const { options, segments, commands } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n\n return (\n <>\n <hbr />\n {code`writeLine(colors.bold(colors.text.heading.secondary(\"Global Options:\")));`}\n <hbr />\n <HelpOptions options={options} />\n {code`writeLine(\"\"); `}\n <Spacing />\n <Show when={Object.keys(commands).length > 0}>\n {code`writeLine(colors.text.body.secondary(\"The following commands are available:\"));\n writeLine(\"\"); `}\n <hbr />\n <hbr />\n <For\n each={Object.values(commands)}\n doubleHardline\n joiner={code`writeLine(\"\"); `}\n ender={code`writeLine(\"\"); `}>\n {child => (\n <>\n {code`\n writeLine(colors.text.heading.primary(${\n child.icon\n ? `(isUnicodeSupported ? \" ${child.icon} \" : \"\") + `\n : \"\"\n }\"${child.title} ${child.isVirtual ? \"\" : \"Command\"}\"));\n writeLine(\"\");\n writeLine(colors.text.body.secondary(\"${child.description}\"));\n writeLine(\"\");\n `}\n <hbr />\n <BaseHelp command={child} indent={2} filterGlobalOptions />\n <hbr />\n </>\n )}\n </For>\n {code`help(\"Running a specific command with the help flag (via: '${getAppBin(\n context\n )}${\n segments && segments.length > 0 ? ` ${segments.join(\" \")}` : \"\"\n } <specific command> --help') will provide additional information that is specific to that command.\");\n writeLine(\"\");`}\n </Show>\n </>\n );\n}\n\nexport interface CommandHelpProps {\n /**\n * A mapping of command names to their command definitions.\n */\n command: CommandTree;\n}\n\n/**\n * A component that generates the invocation of the `help` function for a command.\n */\nexport function CommandHelp(props: CommandHelpProps) {\n const { command } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n\n return (\n <>\n {code`writeLine(\"\"); `}\n <Spacing />\n <BaseHelp command={command} filterGlobalOptions={false} />\n {code`writeLine(\"\"); `}\n <Spacing />\n <Show when={Object.keys(command.children).length > 0}>\n {code`writeLine(colors.text.body.secondary(\"The following sub-commands are available:\"));\n writeLine(\"\"); `}\n <hbr />\n <hbr />\n <For\n each={Object.values(command.children)}\n doubleHardline\n joiner={code`writeLine(\"\"); `}\n ender={code`writeLine(\"\"); `}>\n {child => (\n <>\n {code`\n writeLine(colors.text.heading.primary(${\n child.icon\n ? `(isUnicodeSupported ? \" ${child.icon} \" : \"\") + `\n : \"\"\n }\"${child.title} ${child.isVirtual ? \"\" : \"Command\"}\"));\n writeLine(\"\");\n writeLine(colors.text.body.secondary(\"${child.description}\"));\n writeLine(\"\");\n `}\n <hbr />\n <BaseHelp command={child} indent={2} filterGlobalOptions />\n <hbr />\n </>\n )}\n </For>\n {code`help(\"Running a specific command with the help flag (via: '${getAppBin(\n context\n )} ${command.segments.join(\n \" \"\n )} <specific command> --help') will provide additional information that is specific to that command.\");\n writeLine(\"\");`}\n </Show>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAyDA,SAAgBc,UAAUC,OAAuB;CAC/C,MAAM,EAAEC,SAASC,SAAS,MAAMF;CAEhC,MAAMG,8EAA8C;CACp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AA,WAAA;KACjD3B,oBAAI;;sDACW,OAAA,EAAA,CAAA;sDAAA,OAAA,EAAA,CAAA;sDAGfE,qBAAG;MAAA,IACFmB,OAAI;AAAA,cAAEC,OAAOY,OAAOlB,QAAQW,SAAS;;MACrC+C,gBAAc;MACdC,QAAQ3E,oBAAI;MACZ4E,OAAO5E,oBAAI;MAAiB2B,WAC3BsC,UAAK;mDAEDjE,oBAAI;wDAEDiE,MAAMY,OACF,2BAA2BZ,MAAMY,KAAI,gBACrC,GAAE,GACJZ,MAAMa,MAAK,GAAIb,MAAMc,YAAY,KAAK,UAAS;;wDAEXd,MAAMV,YAAW;;kBAExD;wDAAA,OAAA,EAAA,CAAA;wDAEFW,UAAQ;QAAClD,SAASiD;QAAOhD,QAAQ;QAAGkD,qBAAmB;QAAA,CAAA;wDAAA,OAAA,EAAA,CAAA;OAAA;MAG3D,CAAA;iDAEFnE,oBAAI,6HACHkB,QACD,CAAA,GAAIF,QAAQa,SAASI,KACpB,IACD,CAAA;wBACc;KAAA;;GAAA,CAAA;EAAA"}
@@ -1,4 +1,4 @@
1
- import * as _alloy_js_core4 from "@alloy-js/core";
1
+ import * as _alloy_js_core0 from "@alloy-js/core";
2
2
  import { CommandOption, CommandTree } from "@shell-shock/core/types/command";
3
3
 
4
4
  //#region src/components/help.d.ts
@@ -20,7 +20,7 @@ interface HelpUsageProps {
20
20
  /**
21
21
  * A component that generates the usage display for a command.
22
22
  */
23
- declare function HelpUsage(props: HelpUsageProps): _alloy_js_core4.Children;
23
+ declare function HelpUsage(props: HelpUsageProps): _alloy_js_core0.Children;
24
24
  interface HelpOptionsProps {
25
25
  /**
26
26
  * The options to display help for.
@@ -30,7 +30,7 @@ interface HelpOptionsProps {
30
30
  /**
31
31
  * A component that generates the options table display for a command.
32
32
  */
33
- declare function HelpOptions(props: HelpOptionsProps): _alloy_js_core4.Children;
33
+ declare function HelpOptions(props: HelpOptionsProps): _alloy_js_core0.Children;
34
34
  interface HelpCommandsProps {
35
35
  /**
36
36
  * A mapping of command names to their command definitions.
@@ -40,7 +40,7 @@ interface HelpCommandsProps {
40
40
  /**
41
41
  * A component that generates the commands table display for a command.
42
42
  */
43
- declare function HelpCommands(props: HelpCommandsProps): _alloy_js_core4.Children;
43
+ declare function HelpCommands(props: HelpCommandsProps): _alloy_js_core0.Children;
44
44
  interface BaseHelpProps {
45
45
  /**
46
46
  * The command to generate help for.
@@ -68,7 +68,7 @@ interface BaseHelpProps {
68
68
  /**
69
69
  * A component that generates the `help` function declaration for a command.
70
70
  */
71
- declare function BaseHelp(props: BaseHelpProps): _alloy_js_core4.Children;
71
+ declare function BaseHelp(props: BaseHelpProps): _alloy_js_core0.Children;
72
72
  interface VirtualHelpProps {
73
73
  /**
74
74
  * The options to display help for.
@@ -89,7 +89,7 @@ interface VirtualHelpProps {
89
89
  /**
90
90
  * A component that generates the invocation of the `help` function for a command.
91
91
  */
92
- declare function VirtualHelp(props: VirtualHelpProps): _alloy_js_core4.Children;
92
+ declare function VirtualHelp(props: VirtualHelpProps): _alloy_js_core0.Children;
93
93
  interface CommandHelpProps {
94
94
  /**
95
95
  * A mapping of command names to their command definitions.
@@ -99,7 +99,7 @@ interface CommandHelpProps {
99
99
  /**
100
100
  * A component that generates the invocation of the `help` function for a command.
101
101
  */
102
- declare function CommandHelp(props: CommandHelpProps): _alloy_js_core4.Children;
102
+ declare function CommandHelp(props: CommandHelpProps): _alloy_js_core0.Children;
103
103
  //#endregion
104
104
  export { BaseHelp, BaseHelpProps, CommandHelp, CommandHelpProps, HelpCommands, HelpCommandsProps, HelpOptions, HelpOptionsProps, HelpUsage, HelpUsageProps, VirtualHelp, VirtualHelpProps };
105
105
  //# sourceMappingURL=help.d.mts.map
@@ -67,7 +67,7 @@ function HelpOptions(props) {
67
67
  if (alias.length === 1) flags.push(`-${alias}`);
68
68
  else names.push(`--${kebabCase(alias)}`);
69
69
  });
70
- return code`[{ value: colors.text.body.primary("${flags.length > 0 ? `${flags.sort().join(", ")}${names.length > 0 ? ", " : ""}` : ""}${names.length > 0 ? names.sort().join(", ") : ""}${option.kind === ReflectionKind.string ? ` <${snakeCase(option.name)}${option.variadic ? "..." : ""}>` : option.kind === ReflectionKind.number ? ` <${snakeCase(option.name)}${option.variadic ? "..." : ""}>` : ""}"), align: "right", border: "none", maxWidth: "1/3" }, { value: colors.text.body.tertiary("${option.description.replace(/\.+$/, "")} ${option.env || option.default !== void 0 ? `(${option.env ? `env: ${context.config.envPrefix}_${option.env}${option.default !== void 0 ? ", " : ""}` : ""}${option.default !== void 0 ? `default: ${JSON.stringify(option.default)}` : ""})` : ""}."), align: "left", border: "none" }], `;
70
+ return code`[{ value: colors.text.body.primary("${flags.length > 0 ? `${flags.sort().join(", ")}${names.length > 0 ? ", " : ""}` : ""}${names.length > 0 ? names.sort().join(", ") : ""}${option.kind === ReflectionKind.string ? ` <${snakeCase(option.name)}${option.variadic ? "..." : ""}>` : option.kind === ReflectionKind.number ? ` <${snakeCase(option.name)}${option.variadic ? "..." : ""}>` : ""}"), align: "right", border: "none", maxWidth: "1/3" }, { value: colors.text.body.tertiary("${option.description.replace(/\.+$/, "")} ${option.env || option.default !== void 0 ? `(${option.env ? `env: ${context.config.envPrefix}_${option.env}${option.default !== void 0 ? ", " : ""}` : ""}${option.default !== void 0 ? `default: ${JSON.stringify(option.default).replace(/"/g, "\\\"")}` : ""})` : ""}."), align: "left", border: "none" }], `;
71
71
  }
72
72
  }),
73
73
  createIntrinsic("hbr", {}),
@@ -1 +1 @@
1
- {"version":3,"file":"help.mjs","names":["code","computed","For","Show","ReflectionKind","Spacing","usePowerlines","getAppBin","getDynamicPathSegmentName","isDynamicPathSegment","sortOptions","useTheme","kebabCase","snakeCase","HelpUsage","props","command","indent","context","theme","_$createComponent","each","Object","keys","config","bin","hardline","children","_$memo","segments","length","map","segment","join","values","arguments","argument","name","kind","string","number","variadic","padding","app","_$createIntrinsic","when","HelpOptions","options","option","flags","names","push","alias","forEach","sort","description","replace","env","default","undefined","envPrefix","JSON","stringify","HelpCommands","commands","child","BaseHelp","filterGlobalOptions","filter","some","globalOption","includes","value","VirtualHelp","doubleHardline","joiner","ender","icon","title","isVirtual","CommandHelp"],"sources":["../../src/components/help.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, computed, For, Show } from \"@alloy-js/core\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport {\n getAppBin,\n getDynamicPathSegmentName,\n isDynamicPathSegment\n} from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport { sortOptions } from \"@shell-shock/core/plugin-utils/reflect\";\nimport type {\n CommandOption,\n CommandTree\n} from \"@shell-shock/core/types/command\";\nimport { useTheme } from \"@shell-shock/plugin-theme/contexts/theme\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { snakeCase } from \"@stryke/string-format/snake-case\";\nimport type { ScriptPresetContext } from \"../types/plugin\";\n\nexport interface HelpUsageProps {\n /**\n * The command to generate help for.\n */\n command: CommandTree;\n\n /**\n * The padding scale to apply to the help display headings.\n *\n * @remarks\n * This value is multiplied by the theme's app padding to determine the final padding.\n *\n * @defaultValue 2\n */\n indent?: number;\n}\n\n/**\n * A component that generates the usage display for a command.\n */\nexport function HelpUsage(props: HelpUsageProps) {\n const { command, indent = 2 } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n const theme = useTheme();\n\n return (\n <>\n <For each={Object.keys(context.config.bin)} hardline>\n {bin => (\n <>\n {code`\n writeLine(\n colors.text.body.secondary(\\`\\$ \\${colors.text.usage.bin(\"${bin}\")}${\n command.segments.length > 0\n ? ` ${command.segments\n .map(\n segment =>\n `\\${colors.text.usage.${isDynamicPathSegment(segment) ? \"dynamic\" : \"command\"}(\"${\n isDynamicPathSegment(segment)\n ? `[${snakeCase(getDynamicPathSegmentName(segment))}]`\n : segment\n }\")}`\n )\n .join(\" \")}`\n : \"\"\n }${Object.values(command.children).length > 0 ? ` \\${colors.text.usage.dynamic(\"[command]\")}` : \"\"}${\n command.arguments.length > 0\n ? ` ${command.arguments\n .map(\n argument =>\n `\\${colors.text.usage.arguments(\"<${snakeCase(argument.name)}${\n (argument.kind === ReflectionKind.string ||\n argument.kind === ReflectionKind.number) &&\n argument.variadic\n ? \"...\"\n : \"\"\n }>\")}`\n )\n .join(\" \")}`\n : \"\"\n } \\${colors.text.usage.options(\"[options]\")}\\`), { padding: ${theme.padding.app * indent} }\n );`}\n <hbr />\n </>\n )}\n </For>\n <Show when={command.arguments.length > 0}>\n <hbr />\n <For each={Object.keys(context.config.bin)} hardline>\n {bin => (\n <>\n {code`\n writeLine(\n colors.text.body.secondary(\\`\\$ \\${colors.text.usage.bin(\"${bin}\")}${\n command.segments.length > 0\n ? ` ${command.segments\n .map(\n segment =>\n `\\${colors.text.usage.${isDynamicPathSegment(segment) ? \"dynamic\" : \"command\"}(\"${\n isDynamicPathSegment(segment)\n ? `[${snakeCase(getDynamicPathSegmentName(segment))}]`\n : segment\n }\")}`\n )\n .join(\" \")}`\n : \"\"\n }${Object.values(command.children).length > 0 ? ` \\${colors.text.usage.dynamic(\"[command]\")}` : \"\"} \\${colors.text.usage.options(\"[options]\")}${\n command.arguments.length > 0\n ? ` ${command.arguments\n .map(\n argument =>\n `\\${colors.text.usage.arguments(\"<${snakeCase(argument.name)}${\n (argument.kind === ReflectionKind.string ||\n argument.kind === ReflectionKind.number) &&\n argument.variadic\n ? \"...\"\n : \"\"\n }>\")}`\n )\n .join(\" \")}`\n : \"\"\n }\\`), { padding: ${theme.padding.app * indent} }\n );`}\n <hbr />\n </>\n )}\n </For>\n </Show>\n </>\n );\n}\n\nexport interface HelpOptionsProps {\n /**\n * The options to display help for.\n */\n options: CommandOption[];\n}\n\n/**\n * A component that generates the options table display for a command.\n */\nexport function HelpOptions(props: HelpOptionsProps) {\n const { options } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n\n return (\n <>\n {code`table([ `}\n <hbr />\n <For each={sortOptions(options)} hardline>\n {option => {\n const flags = [] as string[];\n const names = [] as string[];\n if (option.name.length === 1) {\n flags.push(`-${option.name}`);\n } else {\n names.push(`--${kebabCase(option.name)}`);\n }\n\n option.alias.forEach((alias: string) => {\n if (alias.length === 1) {\n flags.push(`-${alias}`);\n } else {\n names.push(`--${kebabCase(alias)}`);\n }\n });\n\n return code`[{ value: colors.text.body.primary(\"${\n flags.length > 0\n ? `${flags.sort().join(\", \")}${names.length > 0 ? \", \" : \"\"}`\n : \"\"\n }${names.length > 0 ? names.sort().join(\", \") : \"\"}${\n option.kind === ReflectionKind.string\n ? ` <${snakeCase(option.name)}${option.variadic ? \"...\" : \"\"}>`\n : option.kind === ReflectionKind.number\n ? ` <${snakeCase(option.name)}${option.variadic ? \"...\" : \"\"}>`\n : \"\"\n }\"), align: \"right\", border: \"none\", maxWidth: \"1/3\" }, { value: colors.text.body.tertiary(\"${option.description.replace(\n /\\.+$/,\n \"\"\n )} ${\n option.env || option.default !== undefined\n ? `(${\n option.env\n ? `env: ${context.config.envPrefix}_${option.env}${\n option.default !== undefined ? \", \" : \"\"\n }`\n : \"\"\n }${\n option.default !== undefined\n ? `default: ${JSON.stringify(option.default)}`\n : \"\"\n })`\n : \"\"\n }.\"), align: \"left\", border: \"none\" }], `;\n }}\n </For>\n <hbr />\n {code` ]); `}\n </>\n );\n}\n\nexport interface HelpCommandsProps {\n /**\n * A mapping of command names to their command definitions.\n */\n commands: Record<string, CommandTree>;\n}\n\n/**\n * A component that generates the commands table display for a command.\n */\nexport function HelpCommands(props: HelpCommandsProps) {\n const { commands } = props;\n\n return (\n <>\n {code`table([ `}\n <hbr />\n <For each={Object.values(commands)} hardline>\n {child =>\n code`[{ value: colors.text.body.primary(\"${\n child.name\n }\"), align: \"right\", border: \"none\" }, { value: colors.text.body.tertiary(\"${child.description.replace(\n /\\.+$/,\n \"\"\n )}\"), align: \"left\", border: \"none\" }], `\n }\n </For>\n <hbr />\n {code` ]); `}\n </>\n );\n}\n\nexport interface BaseHelpProps {\n /**\n * The command to generate help for.\n */\n command: CommandTree;\n\n /**\n * Whether to filter out global options from the help display.\n *\n * @remarks\n * When enabled, any options that are present in the global options context will be filtered out from the help display. This is useful for sub-commands to avoid displaying global options that are not relevant to the specific command.\n *\n * @defaultValue false\n */\n filterGlobalOptions?: boolean;\n\n /**\n * The padding scale to apply to the help display headings.\n *\n * @remarks\n * This value is multiplied by the theme's app padding to determine the final padding.\n *\n * @defaultValue 1\n */\n indent?: number;\n}\n\n/**\n * A component that generates the `help` function declaration for a command.\n */\nexport function BaseHelp(props: BaseHelpProps) {\n const { command, indent = 1, filterGlobalOptions = false } = props;\n\n const theme = useTheme();\n const context = usePowerlines<ScriptPresetContext>();\n\n const options = computed(() =>\n filterGlobalOptions\n ? Object.values(command.options).filter(\n option =>\n !context.options.some(\n globalOption =>\n globalOption.name === option.name ||\n option.alias.includes(globalOption.name) ||\n globalOption.alias?.includes(option.name) ||\n globalOption.alias?.some(alias => option.alias.includes(alias))\n )\n )\n : Object.values(command.options)\n );\n\n return (\n <>\n {code`writeLine(colors.bold(colors.text.heading.secondary(\"Usage:\"))${\n indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : \"\"\n });`}\n <hbr />\n <HelpUsage command={command} indent={indent} />\n <Spacing />\n <Show when={options.value.length > 0}>\n {code`writeLine(\"\");\n writeLine(colors.bold(colors.text.heading.secondary(\"Options:\"))${\n indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : \"\"\n });`}\n <hbr />\n <HelpOptions options={options.value} />\n <hbr />\n <hbr />\n </Show>\n <Show when={Object.keys(command.children).length > 0}>\n {code`writeLine(\"\");\n writeLine(colors.bold(colors.text.heading.secondary(\"Commands:\"))${\n indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : \"\"\n });`}\n <hbr />\n <HelpCommands commands={command.children} />\n <hbr />\n <hbr />\n </Show>\n </>\n );\n}\n\nexport interface VirtualHelpProps {\n /**\n * The options to display help for.\n */\n options: CommandOption[];\n\n /**\n * A mapping of command names to their command definitions.\n */\n commands: Record<string, CommandTree>;\n\n /**\n * The command path to generate help for, used for generating the help invocation instructions.\n *\n * @remarks\n * This is optional since the virtual command entry component can be used for both the global binary executable and virtual commands (there will be no command definition for the binary executable).\n */\n segments?: string[];\n}\n\n/**\n * A component that generates the invocation of the `help` function for a command.\n */\nexport function VirtualHelp(props: VirtualHelpProps) {\n const { options, segments, commands } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n\n return (\n <>\n <hbr />\n {code`writeLine(colors.bold(colors.text.heading.secondary(\"Global Options:\")));`}\n <hbr />\n <HelpOptions options={options} />\n {code`writeLine(\"\"); `}\n <Spacing />\n <Show when={Object.keys(commands).length > 0}>\n {code`writeLine(colors.text.body.secondary(\"The following commands are available:\"));\n writeLine(\"\"); `}\n <hbr />\n <hbr />\n <For\n each={Object.values(commands)}\n doubleHardline\n joiner={code`writeLine(\"\"); `}\n ender={code`writeLine(\"\"); `}>\n {child => (\n <>\n {code`\n writeLine(colors.text.heading.primary(${\n child.icon\n ? `(isUnicodeSupported ? \" ${child.icon} \" : \"\") + `\n : \"\"\n }\"${child.title} ${child.isVirtual ? \"\" : \"Command\"}\"));\n writeLine(\"\");\n writeLine(colors.text.body.secondary(\"${child.description}\"));\n writeLine(\"\");\n `}\n <hbr />\n <BaseHelp command={child} indent={2} filterGlobalOptions />\n <hbr />\n </>\n )}\n </For>\n {code`help(\"Running a specific command with the help flag (via: '${getAppBin(\n context\n )}${\n segments && segments.length > 0 ? ` ${segments.join(\" \")}` : \"\"\n } <specific command> --help') will provide additional information that is specific to that command.\");\n writeLine(\"\");`}\n </Show>\n </>\n );\n}\n\nexport interface CommandHelpProps {\n /**\n * A mapping of command names to their command definitions.\n */\n command: CommandTree;\n}\n\n/**\n * A component that generates the invocation of the `help` function for a command.\n */\nexport function CommandHelp(props: CommandHelpProps) {\n const { command } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n\n return (\n <>\n {code`writeLine(\"\"); `}\n <Spacing />\n <BaseHelp command={command} filterGlobalOptions={false} />\n {code`writeLine(\"\"); `}\n <Spacing />\n <Show when={Object.keys(command.children).length > 0}>\n {code`writeLine(colors.text.body.secondary(\"The following sub-commands are available:\"));\n writeLine(\"\"); `}\n <hbr />\n <hbr />\n <For\n each={Object.values(command.children)}\n doubleHardline\n joiner={code`writeLine(\"\"); `}\n ender={code`writeLine(\"\"); `}>\n {child => (\n <>\n {code`\n writeLine(colors.text.heading.primary(${\n child.icon\n ? `(isUnicodeSupported ? \" ${child.icon} \" : \"\") + `\n : \"\"\n }\"${child.title} ${child.isVirtual ? \"\" : \"Command\"}\"));\n writeLine(\"\");\n writeLine(colors.text.body.secondary(\"${child.description}\"));\n writeLine(\"\");\n `}\n <hbr />\n <BaseHelp command={child} indent={2} filterGlobalOptions />\n <hbr />\n </>\n )}\n </For>\n {code`help(\"Running a specific command with the help flag (via: '${getAppBin(\n context\n )} ${command.segments.join(\n \" \"\n )} <specific command> --help') will provide additional information that is specific to that command.\");\n writeLine(\"\");`}\n </Show>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAyDA,SAAgBc,UAAUC,OAAuB;CAC/C,MAAM,EAAEC,SAASC,SAAS,MAAMF;CAEhC,MAAMG,UAAUZ,eAAoC;CACpD,MAAMa,QAAQR,UAAU;AAExB,QAAA,CAAAS,gBAEKlB,KAAG;EAAA,IAACmB,OAAI;AAAA,UAAEC,OAAOC,KAAKL,QAAQM,OA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;;AAgBvB,SAAgB+C,YAAYjE,OAAyB;CACnD,MAAM,EAAEC,YAAYD;CAEpB,MAAMG,UAAUZ,eAAoC;AAEpD,QAAA;EAEKN,IAAI;EAAiBoB,gBACrBf,SAAO,EAAA,CAAA;EAAAe,gBACP8C,UAAQ;GAAUlD;GAASmD,qBAAqB;GAAK,CAAA;EACrDnE,IAAI;EAAiBoB,gBACrBf,SAAO,EAAA,CAAA;EAAAe,gBACPjB,MAAI;GAAA,IAAC0C,OAAI;AAAA,WAAEvB,OAAOC,KAAKP,QAAQW,SAAS,CAACG,SAAS;;GAAC,IAAAH,WAAA;AAAA,WAAA;KACjD3B,IAAI;;KACW4C,gBAAA,OAAA,EAAA,CAAA;KAAAA,gBAAA,OAAA,EAAA,CAAA;KAAAxB,gBAGflB,KAAG;MAAA,IACFmB,OAAI;AAAA,cAAEC,OAAOY,OAAOlB,QAAQW,SAAS;;MACrC+C,gBAAc;MACdC,QAAQ3E,IAAI;MACZ4E,OAAO5E,IAAI;MAAiB2B,WAC3BsC,UAAK;OAAArC,WAED5B,IAAI;wDAEDiE,MAAMY,OACF,2BAA2BZ,MAAMY,KAAI,gBACrC,GAAE,GACJZ,MAAMa,MAAK,GAAIb,MAAMc,YAAY,KAAK,UAAS;;wDAEXd,MAAMV,YAAW;;kBAExD;OAAAX,gBAAA,OAAA,EAAA,CAAA;OAAAxB,gBAEF8C,UAAQ;QAAClD,SAASiD;QAAOhD,QAAQ;QAAGkD,qBAAmB;QAAA,CAAA;OAAAvB,gBAAA,OAAA,EAAA,CAAA;OAAA;MAG3D,CAAA;KAAAhB,WAEF5B,IAAI,8DAA8DO,UACjEW,QACD,CAAA,GAAIF,QAAQa,SAASI,KACpB,IACD,CAAA;wBACc;KAAA;;GAAA,CAAA;EAAA"}
1
+ {"version":3,"file":"help.mjs","names":["code","computed","For","Show","ReflectionKind","Spacing","usePowerlines","getAppBin","getDynamicPathSegmentName","isDynamicPathSegment","sortOptions","useTheme","kebabCase","snakeCase","HelpUsage","props","command","indent","context","theme","_$createComponent","each","Object","keys","config","bin","hardline","children","_$memo","segments","length","map","segment","join","values","arguments","argument","name","kind","string","number","variadic","padding","app","_$createIntrinsic","when","HelpOptions","options","option","flags","names","push","alias","forEach","sort","description","replace","env","default","undefined","envPrefix","JSON","stringify","HelpCommands","commands","child","BaseHelp","filterGlobalOptions","filter","some","globalOption","includes","value","VirtualHelp","doubleHardline","joiner","ender","icon","title","isVirtual","CommandHelp"],"sources":["../../src/components/help.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, computed, For, Show } from \"@alloy-js/core\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport {\n getAppBin,\n getDynamicPathSegmentName,\n isDynamicPathSegment\n} from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport { sortOptions } from \"@shell-shock/core/plugin-utils/reflect\";\nimport type {\n CommandOption,\n CommandTree\n} from \"@shell-shock/core/types/command\";\nimport { useTheme } from \"@shell-shock/plugin-theme/contexts/theme\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { snakeCase } from \"@stryke/string-format/snake-case\";\nimport type { ScriptPresetContext } from \"../types/plugin\";\n\nexport interface HelpUsageProps {\n /**\n * The command to generate help for.\n */\n command: CommandTree;\n\n /**\n * The padding scale to apply to the help display headings.\n *\n * @remarks\n * This value is multiplied by the theme's app padding to determine the final padding.\n *\n * @defaultValue 2\n */\n indent?: number;\n}\n\n/**\n * A component that generates the usage display for a command.\n */\nexport function HelpUsage(props: HelpUsageProps) {\n const { command, indent = 2 } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n const theme = useTheme();\n\n return (\n <>\n <For each={Object.keys(context.config.bin)} hardline>\n {bin => (\n <>\n {code`\n writeLine(\n colors.text.body.secondary(\\`\\$ \\${colors.text.usage.bin(\"${bin}\")}${\n command.segments.length > 0\n ? ` ${command.segments\n .map(\n segment =>\n `\\${colors.text.usage.${isDynamicPathSegment(segment) ? \"dynamic\" : \"command\"}(\"${\n isDynamicPathSegment(segment)\n ? `[${snakeCase(getDynamicPathSegmentName(segment))}]`\n : segment\n }\")}`\n )\n .join(\" \")}`\n : \"\"\n }${Object.values(command.children).length > 0 ? ` \\${colors.text.usage.dynamic(\"[command]\")}` : \"\"}${\n command.arguments.length > 0\n ? ` ${command.arguments\n .map(\n argument =>\n `\\${colors.text.usage.arguments(\"<${snakeCase(argument.name)}${\n (argument.kind === ReflectionKind.string ||\n argument.kind === ReflectionKind.number) &&\n argument.variadic\n ? \"...\"\n : \"\"\n }>\")}`\n )\n .join(\" \")}`\n : \"\"\n } \\${colors.text.usage.options(\"[options]\")}\\`), { padding: ${theme.padding.app * indent} }\n );`}\n <hbr />\n </>\n )}\n </For>\n <Show when={command.arguments.length > 0}>\n <hbr />\n <For each={Object.keys(context.config.bin)} hardline>\n {bin => (\n <>\n {code`\n writeLine(\n colors.text.body.secondary(\\`\\$ \\${colors.text.usage.bin(\"${bin}\")}${\n command.segments.length > 0\n ? ` ${command.segments\n .map(\n segment =>\n `\\${colors.text.usage.${isDynamicPathSegment(segment) ? \"dynamic\" : \"command\"}(\"${\n isDynamicPathSegment(segment)\n ? `[${snakeCase(getDynamicPathSegmentName(segment))}]`\n : segment\n }\")}`\n )\n .join(\" \")}`\n : \"\"\n }${Object.values(command.children).length > 0 ? ` \\${colors.text.usage.dynamic(\"[command]\")}` : \"\"} \\${colors.text.usage.options(\"[options]\")}${\n command.arguments.length > 0\n ? ` ${command.arguments\n .map(\n argument =>\n `\\${colors.text.usage.arguments(\"<${snakeCase(argument.name)}${\n (argument.kind === ReflectionKind.string ||\n argument.kind === ReflectionKind.number) &&\n argument.variadic\n ? \"...\"\n : \"\"\n }>\")}`\n )\n .join(\" \")}`\n : \"\"\n }\\`), { padding: ${theme.padding.app * indent} }\n );`}\n <hbr />\n </>\n )}\n </For>\n </Show>\n </>\n );\n}\n\nexport interface HelpOptionsProps {\n /**\n * The options to display help for.\n */\n options: CommandOption[];\n}\n\n/**\n * A component that generates the options table display for a command.\n */\nexport function HelpOptions(props: HelpOptionsProps) {\n const { options } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n\n return (\n <>\n {code`table([ `}\n <hbr />\n <For each={sortOptions(options)} hardline>\n {option => {\n const flags = [] as string[];\n const names = [] as string[];\n if (option.name.length === 1) {\n flags.push(`-${option.name}`);\n } else {\n names.push(`--${kebabCase(option.name)}`);\n }\n\n option.alias.forEach((alias: string) => {\n if (alias.length === 1) {\n flags.push(`-${alias}`);\n } else {\n names.push(`--${kebabCase(alias)}`);\n }\n });\n\n return code`[{ value: colors.text.body.primary(\"${\n flags.length > 0\n ? `${flags.sort().join(\", \")}${names.length > 0 ? \", \" : \"\"}`\n : \"\"\n }${names.length > 0 ? names.sort().join(\", \") : \"\"}${\n option.kind === ReflectionKind.string\n ? ` <${snakeCase(option.name)}${option.variadic ? \"...\" : \"\"}>`\n : option.kind === ReflectionKind.number\n ? ` <${snakeCase(option.name)}${option.variadic ? \"...\" : \"\"}>`\n : \"\"\n }\"), align: \"right\", border: \"none\", maxWidth: \"1/3\" }, { value: colors.text.body.tertiary(\"${option.description.replace(\n /\\.+$/,\n \"\"\n )} ${\n option.env || option.default !== undefined\n ? `(${\n option.env\n ? `env: ${context.config.envPrefix}_${option.env}${\n option.default !== undefined ? \", \" : \"\"\n }`\n : \"\"\n }${\n option.default !== undefined\n ? `default: ${JSON.stringify(option.default).replace(/\"/g, '\\\\\"')}`\n : \"\"\n })`\n : \"\"\n }.\"), align: \"left\", border: \"none\" }], `;\n }}\n </For>\n <hbr />\n {code` ]); `}\n </>\n );\n}\n\nexport interface HelpCommandsProps {\n /**\n * A mapping of command names to their command definitions.\n */\n commands: Record<string, CommandTree>;\n}\n\n/**\n * A component that generates the commands table display for a command.\n */\nexport function HelpCommands(props: HelpCommandsProps) {\n const { commands } = props;\n\n return (\n <>\n {code`table([ `}\n <hbr />\n <For each={Object.values(commands)} hardline>\n {child =>\n code`[{ value: colors.text.body.primary(\"${\n child.name\n }\"), align: \"right\", border: \"none\" }, { value: colors.text.body.tertiary(\"${child.description.replace(\n /\\.+$/,\n \"\"\n )}\"), align: \"left\", border: \"none\" }], `\n }\n </For>\n <hbr />\n {code` ]); `}\n </>\n );\n}\n\nexport interface BaseHelpProps {\n /**\n * The command to generate help for.\n */\n command: CommandTree;\n\n /**\n * Whether to filter out global options from the help display.\n *\n * @remarks\n * When enabled, any options that are present in the global options context will be filtered out from the help display. This is useful for sub-commands to avoid displaying global options that are not relevant to the specific command.\n *\n * @defaultValue false\n */\n filterGlobalOptions?: boolean;\n\n /**\n * The padding scale to apply to the help display headings.\n *\n * @remarks\n * This value is multiplied by the theme's app padding to determine the final padding.\n *\n * @defaultValue 1\n */\n indent?: number;\n}\n\n/**\n * A component that generates the `help` function declaration for a command.\n */\nexport function BaseHelp(props: BaseHelpProps) {\n const { command, indent = 1, filterGlobalOptions = false } = props;\n\n const theme = useTheme();\n const context = usePowerlines<ScriptPresetContext>();\n\n const options = computed(() =>\n filterGlobalOptions\n ? Object.values(command.options).filter(\n option =>\n !context.options.some(\n globalOption =>\n globalOption.name === option.name ||\n option.alias.includes(globalOption.name) ||\n globalOption.alias?.includes(option.name) ||\n globalOption.alias?.some(alias => option.alias.includes(alias))\n )\n )\n : Object.values(command.options)\n );\n\n return (\n <>\n {code`writeLine(colors.bold(colors.text.heading.secondary(\"Usage:\"))${\n indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : \"\"\n });`}\n <hbr />\n <HelpUsage command={command} indent={indent} />\n <Spacing />\n <Show when={options.value.length > 0}>\n {code`writeLine(\"\");\n writeLine(colors.bold(colors.text.heading.secondary(\"Options:\"))${\n indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : \"\"\n });`}\n <hbr />\n <HelpOptions options={options.value} />\n <hbr />\n <hbr />\n </Show>\n <Show when={Object.keys(command.children).length > 0}>\n {code`writeLine(\"\");\n writeLine(colors.bold(colors.text.heading.secondary(\"Commands:\"))${\n indent > 1 ? `, { padding: ${theme.padding.app * indent} }` : \"\"\n });`}\n <hbr />\n <HelpCommands commands={command.children} />\n <hbr />\n <hbr />\n </Show>\n </>\n );\n}\n\nexport interface VirtualHelpProps {\n /**\n * The options to display help for.\n */\n options: CommandOption[];\n\n /**\n * A mapping of command names to their command definitions.\n */\n commands: Record<string, CommandTree>;\n\n /**\n * The command path to generate help for, used for generating the help invocation instructions.\n *\n * @remarks\n * This is optional since the virtual command entry component can be used for both the global binary executable and virtual commands (there will be no command definition for the binary executable).\n */\n segments?: string[];\n}\n\n/**\n * A component that generates the invocation of the `help` function for a command.\n */\nexport function VirtualHelp(props: VirtualHelpProps) {\n const { options, segments, commands } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n\n return (\n <>\n <hbr />\n {code`writeLine(colors.bold(colors.text.heading.secondary(\"Global Options:\")));`}\n <hbr />\n <HelpOptions options={options} />\n {code`writeLine(\"\"); `}\n <Spacing />\n <Show when={Object.keys(commands).length > 0}>\n {code`writeLine(colors.text.body.secondary(\"The following commands are available:\"));\n writeLine(\"\"); `}\n <hbr />\n <hbr />\n <For\n each={Object.values(commands)}\n doubleHardline\n joiner={code`writeLine(\"\"); `}\n ender={code`writeLine(\"\"); `}>\n {child => (\n <>\n {code`\n writeLine(colors.text.heading.primary(${\n child.icon\n ? `(isUnicodeSupported ? \" ${child.icon} \" : \"\") + `\n : \"\"\n }\"${child.title} ${child.isVirtual ? \"\" : \"Command\"}\"));\n writeLine(\"\");\n writeLine(colors.text.body.secondary(\"${child.description}\"));\n writeLine(\"\");\n `}\n <hbr />\n <BaseHelp command={child} indent={2} filterGlobalOptions />\n <hbr />\n </>\n )}\n </For>\n {code`help(\"Running a specific command with the help flag (via: '${getAppBin(\n context\n )}${\n segments && segments.length > 0 ? ` ${segments.join(\" \")}` : \"\"\n } <specific command> --help') will provide additional information that is specific to that command.\");\n writeLine(\"\");`}\n </Show>\n </>\n );\n}\n\nexport interface CommandHelpProps {\n /**\n * A mapping of command names to their command definitions.\n */\n command: CommandTree;\n}\n\n/**\n * A component that generates the invocation of the `help` function for a command.\n */\nexport function CommandHelp(props: CommandHelpProps) {\n const { command } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n\n return (\n <>\n {code`writeLine(\"\"); `}\n <Spacing />\n <BaseHelp command={command} filterGlobalOptions={false} />\n {code`writeLine(\"\"); `}\n <Spacing />\n <Show when={Object.keys(command.children).length > 0}>\n {code`writeLine(colors.text.body.secondary(\"The following sub-commands are available:\"));\n writeLine(\"\"); `}\n <hbr />\n <hbr />\n <For\n each={Object.values(command.children)}\n doubleHardline\n joiner={code`writeLine(\"\"); `}\n ender={code`writeLine(\"\"); `}>\n {child => (\n <>\n {code`\n writeLine(colors.text.heading.primary(${\n child.icon\n ? `(isUnicodeSupported ? \" ${child.icon} \" : \"\") + `\n : \"\"\n }\"${child.title} ${child.isVirtual ? \"\" : \"Command\"}\"));\n writeLine(\"\");\n writeLine(colors.text.body.secondary(\"${child.description}\"));\n writeLine(\"\");\n `}\n <hbr />\n <BaseHelp command={child} indent={2} filterGlobalOptions />\n <hbr />\n </>\n )}\n </For>\n {code`help(\"Running a specific command with the help flag (via: '${getAppBin(\n context\n )} ${command.segments.join(\n \" \"\n )} <specific command> --help') will provide additional information that is specific to that command.\");\n writeLine(\"\");`}\n </Show>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;AAyDA,SAAgBc,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AA8DO,UACjEW,QACD,CAAA,GAAIF,QAAQa,SAASI,KACpB,IACD,CAAA;wBACc;KAAA;;GAAA,CAAA;EAAA"}
@@ -1,4 +1,4 @@
1
- import * as _alloy_js_core0 from "@alloy-js/core";
1
+ import * as _alloy_js_core6 from "@alloy-js/core";
2
2
 
3
3
  //#region src/components/helpers.d.ts
4
4
 
@@ -8,22 +8,22 @@ import * as _alloy_js_core0 from "@alloy-js/core";
8
8
  * @remarks
9
9
  * This is used to conditionally include debug-only logic in the generated application, such as additional logging or development tools. The logic should check for common indicators of debug mode, such as environment variables or the presence of a debugger.
10
10
  */
11
- declare function IsDebug(): _alloy_js_core0.Children;
11
+ declare function IsDebug(): _alloy_js_core6.Children;
12
12
  /**
13
13
  * Write the logic to determine if the application is **not** running in debug mode.
14
14
  */
15
- declare function IsNotDebug(): _alloy_js_core0.Children;
15
+ declare function IsNotDebug(): _alloy_js_core6.Children;
16
16
  /**
17
17
  * Write the logic to determine if the application is running in verbose mode.
18
18
  *
19
19
  * @remarks
20
20
  * This is used to conditionally include verbose-only logic in the generated application, such as additional logging or detailed output. The logic should check for common indicators of verbose mode, such as environment variables or command-line flags.
21
21
  */
22
- declare function IsVerbose(): _alloy_js_core0.Children;
22
+ declare function IsVerbose(): _alloy_js_core6.Children;
23
23
  /**
24
24
  * Write the logic to determine if the application is **not** running in verbose mode.
25
25
  */
26
- declare function IsNotVerbose(): _alloy_js_core0.Children;
26
+ declare function IsNotVerbose(): _alloy_js_core6.Children;
27
27
  //#endregion
28
28
  export { IsDebug, IsNotDebug, IsNotVerbose, IsVerbose };
29
29
  //# sourceMappingURL=helpers.d.mts.map
@@ -93,14 +93,7 @@ function VirtualCommandEntry(props) {
93
93
  return filePath.value;
94
94
  },
95
95
  get imports() {
96
- return (0, defu.default)({ didyoumean2: [
97
- {
98
- name: "didYouMean",
99
- default: true
100
- },
101
- { name: "ReturnTypeEnums" },
102
- { name: "ThresholdTypeEnums" }
103
- ] }, imports ?? {}, Object.entries(command.children).filter(([, child]) => child.isVirtual).reduce((ret, [name, child]) => {
96
+ return (0, defu.default)(imports ?? {}, Object.entries(command.children).filter(([, child]) => child.isVirtual).reduce((ret, [name, child]) => {
104
97
  ret[`./${child.name}`] = [{
105
98
  name: "handler",
106
99
  alias: `handle${(0, __stryke_string_format_pascal_case.pascalCase)(name)}`
@@ -125,7 +118,8 @@ function VirtualCommandEntry(props) {
125
118
  "useArgs",
126
119
  "hasFlag",
127
120
  "isMinimal",
128
- "isUnicodeSupported"
121
+ "isUnicodeSupported",
122
+ "findSuggestions"
129
123
  ]
130
124
  });
131
125
  },
@@ -1 +1 @@
1
- {"version":3,"file":"virtual-command-entry.cjs","names":["code","computed","For","Show","FunctionDeclaration","usePowerlines","TSDoc","TSDocParam","TSDocRemarks","TSDocTitle","TypescriptFile","getAppBin","getDynamicPathSegmentName","isDynamicPathSegment","joinPaths","constantCase","pascalCase","defu","BannerFunctionDeclaration","CommandEntry","CommandRouter","VirtualHelp","VirtualCommandHandlerDeclaration","props","command","children","banner","context","_$createComponent","heading","title","segments","map","segment","join","description","replace","_$createIntrinsic","name","async","parameters","type","default","when","Boolean","options","Object","values","commands","VirtualCommandEntry","imports","builtinImports","rest","filePath","entryPath","filter","_$mergeProps","path","value","didyoumean2","entries","child","isVirtual","reduce","ret","alias","env","console","utils","each","fallback"],"sources":["../../src/components/virtual-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 { FunctionDeclaration } from \"@alloy-js/typescript\";\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 {\n TSDoc,\n TSDocParam,\n TSDocRemarks,\n TSDocTitle\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { TypescriptFile } from \"@powerlines/plugin-alloy/typescript/components/typescript-file\";\nimport {\n getAppBin,\n getDynamicPathSegmentName,\n isDynamicPathSegment\n} from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport type { CommandTree } from \"@shell-shock/core/types/command\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { constantCase } from \"@stryke/string-format/constant-case\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport defu from \"defu\";\nimport type { ScriptPresetContext } from \"../types/plugin\";\nimport { BannerFunctionDeclaration } from \"./banner-function-declaration\";\nimport { CommandEntry } from \"./command-entry\";\nimport { CommandRouter } from \"./command-router\";\nimport { VirtualHelp } from \"./help\";\n\nexport interface VirtualCommandHandlerDeclarationProps {\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 VirtualCommandHandlerDeclaration(\n props: VirtualCommandHandlerDeclarationProps\n) {\n const { command, children, banner } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n\n return (\n <>\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(\" \")}) virtual 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 <hbr />\n <hbr />\n {children}\n <hbr />\n <hbr />\n <Show when={Boolean(banner)}>{banner}</Show>\n <hbr />\n <hbr />\n <VirtualHelp\n segments={command.segments}\n options={Object.values(command.options)}\n commands={command.children ?? {}}\n />\n </FunctionDeclaration>\n </>\n );\n}\n\nexport interface VirtualCommandEntryProps extends Omit<\n EntryFileProps,\n \"path\" | \"typeDefinition\"\n> {\n command: CommandTree;\n}\n\n/**\n * The virtual command entry point for the Shell Shock project.\n */\nexport function VirtualCommandEntry(props: VirtualCommandEntryProps) {\n const { command, imports, builtinImports, ...rest } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n const filePath = computed(() =>\n joinPaths(\n context.entryPath,\n command.segments\n .filter(segment => !isDynamicPathSegment(segment))\n .join(\"/\"),\n \"index.ts\"\n )\n );\n\n return (\n <>\n <TypescriptFile\n {...rest}\n path={filePath.value}\n imports={defu(\n {\n didyoumean2: [\n { name: \"didYouMean\", default: true },\n { name: \"ReturnTypeEnums\" },\n { name: \"ThresholdTypeEnums\" }\n ]\n },\n imports ?? {},\n Object.entries(command.children)\n .filter(([, child]) => child.isVirtual)\n .reduce((ret, [name, child]) => {\n ret[`./${child.name}`] = [\n { name: \"handler\", alias: `handle${pascalCase(name)}` }\n ];\n\n return ret;\n }, {} as TypescriptFileImports)\n )}\n builtinImports={defu(builtinImports ?? {}, {\n env: [\"isDevelopment\", \"isDebug\"],\n console: [\n \"help\",\n \"warn\",\n \"error\",\n \"table\",\n \"colors\",\n \"writeLine\",\n \"splitText\",\n \"stripAnsi\"\n ],\n utils: [\"useArgs\", \"hasFlag\", \"isMinimal\", \"isUnicodeSupported\"]\n })}>\n <BannerFunctionDeclaration command={command} />\n <hbr />\n <hbr />\n <VirtualCommandHandlerDeclaration\n command={command}\n banner={code`banner(); `}>\n <CommandRouter\n segments={command.segments}\n commands={command.children}\n />\n </VirtualCommandHandlerDeclaration>\n </TypescriptFile>\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":";;;;;;;;;;;;;;;;;;;;;;AAwDA,SAAgBsB,iCACdC,OACA;CACA,MAAM,EAAEC,SAASC,UAAUC,WAAWH;CAEtC,MAAMI,8EAA8C;AAEpD,QAAA,kDAEKrB,6DAAK;EAAA,IACJuB,UAAO;AAAA,UAAE,OAAOL,QAAQM,MAAK,mEAAeH,QAAQ,CAAA,GAAIH,QAAQO,SAC7DC,KAAIC,sFACkBA,QAAQ,GACzB,0IAA2CA,QAAQ,CAAC,CAAA,KACpDA,QACL,CACAC,KAAK,IAAI,CAAA;;EAAoB,IAAAT,WAAA;AAAA,UAAA;qDAC/BjB,oEAAY,EAAA,IAAAiB,WAAA;AAAA,YAAE,GAAGD,QAAQW,YAAYC,QAAQ,QAAQ,GAAG,CAAA;OAAG,CAAA;qDAAA,OAAA,EAAA,CAAA;qDAE3D3B,kEAAU,EAAA,IAAAgB,WAAA;AAAA,YAAED,QAAQM;OAAK,CAAA;qDACzBvB,kEAAU;KAAC+B,MAAI;KAAAb,UAAS;KAAmD,CAAA;IAAA;;EAAA,CAAA,mDAE7ErB,2CAAmB;EAAA,UAAA;EAElBmC,OAAK;EACLD,MAAI;EACJE,YAAY,CAAC;GAAEF,MAAM;GAAQG,MAAM;GAAYC,SAAS;GAAa,CAAC;EAAA,IAAAjB,WAAA;AAAA,UAAA;qDAAA,OAAA,EAAA,CAAA;qDAAA,OAAA,EAAA,CAAA;IAGrEA;qDAAQ,OAAA,EAAA,CAAA;qDAAA,OAAA,EAAA,CAAA;qDAGRtB,sBAAI;KAAA,IAACwC,OAAI;AAAA,aAAEC,QAAQlB,OAAO;;KAAAD,UAAGC;KAAM,CAAA;qDAAA,OAAA,EAAA,CAAA;qDAAA,OAAA,EA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,EAAUM,SAAO,CAAA;qDAAA,OAAA,EAAA,CAAA;qDAAA,OAAA,EAAA,CAAA;qDAG1CF,kCAAgC;KACtBE;KACTE,QAAQ1B,oBAAI;KAAY,IAAAyB,WAAA;AAAA,8DACvBL,iDAAa;OAAA,IACZW,WAAQ;AAAA,eAAEP,QAAQO;;OAAQ,IAC1BiB,WAAQ;AAAA,eAAExB,QAAQC;;OAAQ,CAAA;;KAAA,CAAA;IAAA;;EAAA,CAAA,CAAA,mDAI/BvB,qBAAG;EAAA,IAACmE,OAAI;AAAA,UAAEvB,OAAOC,OAAOvB,QAAQC,SAAS;;EAAAA,WACvCoC,2DACE1D,sBAAI;GAAA,IACHwC,OAAI;AAAA,WAAEkB,MAAMC;;GAAS,IACrBQ,WAAQ;AAAA,4DAAGnD,+CAAY,EAACK,SAASqC,OAAK,CAAA;;GAAA,IAAApC,WAAA;AAAA,4DACrCwB,qBAAmB,EAACzB,SAASqC,OAAK,CAAA;;GAAA,CAAA;EAEtC,CAAA,CAAA"}
1
+ {"version":3,"file":"virtual-command-entry.cjs","names":["code","computed","For","Show","FunctionDeclaration","usePowerlines","TSDoc","TSDocParam","TSDocRemarks","TSDocTitle","TypescriptFile","getAppBin","getDynamicPathSegmentName","isDynamicPathSegment","joinPaths","constantCase","pascalCase","defu","BannerFunctionDeclaration","CommandEntry","CommandRouter","VirtualHelp","VirtualCommandHandlerDeclaration","props","command","children","banner","context","_$createComponent","heading","title","segments","map","segment","join","description","replace","_$createIntrinsic","name","async","parameters","type","default","when","Boolean","options","Object","values","commands","VirtualCommandEntry","imports","builtinImports","rest","filePath","entryPath","filter","_$mergeProps","path","value","entries","child","isVirtual","reduce","ret","alias","env","console","utils","each","fallback"],"sources":["../../src/components/virtual-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 { FunctionDeclaration } from \"@alloy-js/typescript\";\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 {\n TSDoc,\n TSDocParam,\n TSDocRemarks,\n TSDocTitle\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { TypescriptFile } from \"@powerlines/plugin-alloy/typescript/components/typescript-file\";\nimport {\n getAppBin,\n getDynamicPathSegmentName,\n isDynamicPathSegment\n} from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport type { CommandTree } from \"@shell-shock/core/types/command\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { constantCase } from \"@stryke/string-format/constant-case\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport defu from \"defu\";\nimport type { ScriptPresetContext } from \"../types/plugin\";\nimport { BannerFunctionDeclaration } from \"./banner-function-declaration\";\nimport { CommandEntry } from \"./command-entry\";\nimport { CommandRouter } from \"./command-router\";\nimport { VirtualHelp } from \"./help\";\n\nexport interface VirtualCommandHandlerDeclarationProps {\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 VirtualCommandHandlerDeclaration(\n props: VirtualCommandHandlerDeclarationProps\n) {\n const { command, children, banner } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n\n return (\n <>\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(\" \")}) virtual 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 <hbr />\n <hbr />\n {children}\n <hbr />\n <hbr />\n <Show when={Boolean(banner)}>{banner}</Show>\n <hbr />\n <hbr />\n <VirtualHelp\n segments={command.segments}\n options={Object.values(command.options)}\n commands={command.children ?? {}}\n />\n </FunctionDeclaration>\n </>\n );\n}\n\nexport interface VirtualCommandEntryProps extends Omit<\n EntryFileProps,\n \"path\" | \"typeDefinition\"\n> {\n command: CommandTree;\n}\n\n/**\n * The virtual command entry point for the Shell Shock project.\n */\nexport function VirtualCommandEntry(props: VirtualCommandEntryProps) {\n const { command, imports, builtinImports, ...rest } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n const filePath = computed(() =>\n joinPaths(\n context.entryPath,\n command.segments\n .filter(segment => !isDynamicPathSegment(segment))\n .join(\"/\"),\n \"index.ts\"\n )\n );\n\n return (\n <>\n <TypescriptFile\n {...rest}\n path={filePath.value}\n imports={defu(\n imports ?? {},\n Object.entries(command.children)\n .filter(([, child]) => child.isVirtual)\n .reduce((ret, [name, child]) => {\n ret[`./${child.name}`] = [\n { name: \"handler\", alias: `handle${pascalCase(name)}` }\n ];\n\n return ret;\n }, {} as TypescriptFileImports)\n )}\n builtinImports={defu(builtinImports ?? {}, {\n env: [\"isDevelopment\", \"isDebug\"],\n console: [\n \"help\",\n \"warn\",\n \"error\",\n \"table\",\n \"colors\",\n \"writeLine\",\n \"splitText\",\n \"stripAnsi\"\n ],\n utils: [\n \"useArgs\",\n \"hasFlag\",\n \"isMinimal\",\n \"isUnicodeSupported\",\n \"findSuggestions\"\n ]\n })}>\n <BannerFunctionDeclaration command={command} />\n <hbr />\n <hbr />\n <VirtualCommandHandlerDeclaration\n command={command}\n banner={code`banner(); `}>\n <CommandRouter\n segments={command.segments}\n commands={command.children}\n />\n </VirtualCommandHandlerDeclaration>\n </TypescriptFile>\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":";;;;;;;;;;;;;;;;;;;;;;AAwDA,SAAgBsB,iCACdC,OACA;CACA,MAAM,EAAEC,SAASC,UAAUC,WAAWH;CAEtC,MAAMI,8EAA8C;AAEpD,QAAA,kDAEKrB,6DAAK;EAAA,IACJuB,UAAO;AAAA,UAAE,OAAOL,QAAQM,MAAK,mEAAeH,QAAQ,CAAA,GAAIH,QAAQO,SAC7DC,KAAIC,sFACkBA,QAAQ,GACzB,0IAA2CA,QAAQ,CAAC,CAAA,KACpDA,QACL,CACAC,KAAK,IAAI,CAAA;;EAAoB,IAAAT,WAAA;AAAA,UAAA;qDAC/BjB,oEAAY,EAAA,IAAAiB,WAAA;AAAA,YAAE,GAAGD,QAAQW,YAAYC,QAAQ,QAAQ,GAAG,CAAA;OAAG,CAAA;qDAAA,OAAA,EAAA,CAAA;qDAE3D3B,kEAAU,EAAA,IAAAgB,WAAA;AAAA,YAAED,QAAQM;OAAK,CAAA;qDACzBvB,kEAAU;KAAC+B,MAAI;KAAAb,UAAS;KAAmD,CAAA;IAAA;;EAAA,CAAA,mDAE7ErB,2CAAmB;EAAA,UAAA;EAElBmC,OAAK;EACLD,MAAI;EACJE,YAAY,CAAC;GAAEF,MAAM;GAAQG,MAAM;GAAYC,SAAS;GAAa,CAAC;EAAA,IAAAjB,WAAA;AAAA,UAAA;qDAAA,OAAA,EAAA,CAAA;qDAAA,OAAA,EAAA,CAAA;IAGrEA;qDAAQ,OAAA,EA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AA,IAAA1C,WAAA;AAAA,UAAA;qDACDP,0EAAyB,EAAUM,SAAO,CAAA;qDAAA,OAAA,EAAA,CAAA;qDAAA,OAAA,EAAA,CAAA;qDAG1CF,kCAAgC;KACtBE;KACTE,QAAQ1B,oBAAI;KAAY,IAAAyB,WAAA;AAAA,8DACvBL,iDAAa;OAAA,IACZW,WAAQ;AAAA,eAAEP,QAAQO;;OAAQ,IAC1BiB,WAAQ;AAAA,eAAExB,QAAQC;;OAAQ,CAAA;;KAAA,CAAA;IAAA;;EAAA,CAAA,CAAA,mDAI/BvB,qBAAG;EAAA,IAACkE,OAAI;AAAA,UAAEtB,OAAOC,OAAOvB,QAAQC,SAAS;;EAAAA,WACvCmC,2DACEzD,sBAAI;GAAA,IACHwC,OAAI;AAAA,WAAEiB,MAAMC;;GAAS,IACrBQ,WAAQ;AAAA,4DAAGlD,+CAAY,EAACK,SAASoC,OAAK,CAAA;;GAAA,IAAAnC,WAAA;AAAA,4DACrCwB,qBAAmB,EAACzB,SAASoC,OAAK,CAAA;;GAAA,CAAA;EAEtC,CAAA,CAAA"}
@@ -91,14 +91,7 @@ function VirtualCommandEntry(props) {
91
91
  return filePath.value;
92
92
  },
93
93
  get imports() {
94
- return defu({ didyoumean2: [
95
- {
96
- name: "didYouMean",
97
- default: true
98
- },
99
- { name: "ReturnTypeEnums" },
100
- { name: "ThresholdTypeEnums" }
101
- ] }, imports ?? {}, Object.entries(command.children).filter(([, child]) => child.isVirtual).reduce((ret, [name, child]) => {
94
+ return defu(imports ?? {}, Object.entries(command.children).filter(([, child]) => child.isVirtual).reduce((ret, [name, child]) => {
102
95
  ret[`./${child.name}`] = [{
103
96
  name: "handler",
104
97
  alias: `handle${pascalCase(name)}`
@@ -123,7 +116,8 @@ function VirtualCommandEntry(props) {
123
116
  "useArgs",
124
117
  "hasFlag",
125
118
  "isMinimal",
126
- "isUnicodeSupported"
119
+ "isUnicodeSupported",
120
+ "findSuggestions"
127
121
  ]
128
122
  });
129
123
  },
@@ -1 +1 @@
1
- {"version":3,"file":"virtual-command-entry.mjs","names":["code","computed","For","Show","FunctionDeclaration","usePowerlines","TSDoc","TSDocParam","TSDocRemarks","TSDocTitle","TypescriptFile","getAppBin","getDynamicPathSegmentName","isDynamicPathSegment","joinPaths","constantCase","pascalCase","defu","BannerFunctionDeclaration","CommandEntry","CommandRouter","VirtualHelp","VirtualCommandHandlerDeclaration","props","command","children","banner","context","_$createComponent","heading","title","segments","map","segment","join","description","replace","_$createIntrinsic","name","async","parameters","type","default","when","Boolean","options","Object","values","commands","VirtualCommandEntry","imports","builtinImports","rest","filePath","entryPath","filter","_$mergeProps","path","value","didyoumean2","entries","child","isVirtual","reduce","ret","alias","env","console","utils","each","fallback"],"sources":["../../src/components/virtual-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 { FunctionDeclaration } from \"@alloy-js/typescript\";\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 {\n TSDoc,\n TSDocParam,\n TSDocRemarks,\n TSDocTitle\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { TypescriptFile } from \"@powerlines/plugin-alloy/typescript/components/typescript-file\";\nimport {\n getAppBin,\n getDynamicPathSegmentName,\n isDynamicPathSegment\n} from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport type { CommandTree } from \"@shell-shock/core/types/command\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { constantCase } from \"@stryke/string-format/constant-case\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport defu from \"defu\";\nimport type { ScriptPresetContext } from \"../types/plugin\";\nimport { BannerFunctionDeclaration } from \"./banner-function-declaration\";\nimport { CommandEntry } from \"./command-entry\";\nimport { CommandRouter } from \"./command-router\";\nimport { VirtualHelp } from \"./help\";\n\nexport interface VirtualCommandHandlerDeclarationProps {\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 VirtualCommandHandlerDeclaration(\n props: VirtualCommandHandlerDeclarationProps\n) {\n const { command, children, banner } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n\n return (\n <>\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(\" \")}) virtual 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 <hbr />\n <hbr />\n {children}\n <hbr />\n <hbr />\n <Show when={Boolean(banner)}>{banner}</Show>\n <hbr />\n <hbr />\n <VirtualHelp\n segments={command.segments}\n options={Object.values(command.options)}\n commands={command.children ?? {}}\n />\n </FunctionDeclaration>\n </>\n );\n}\n\nexport interface VirtualCommandEntryProps extends Omit<\n EntryFileProps,\n \"path\" | \"typeDefinition\"\n> {\n command: CommandTree;\n}\n\n/**\n * The virtual command entry point for the Shell Shock project.\n */\nexport function VirtualCommandEntry(props: VirtualCommandEntryProps) {\n const { command, imports, builtinImports, ...rest } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n const filePath = computed(() =>\n joinPaths(\n context.entryPath,\n command.segments\n .filter(segment => !isDynamicPathSegment(segment))\n .join(\"/\"),\n \"index.ts\"\n )\n );\n\n return (\n <>\n <TypescriptFile\n {...rest}\n path={filePath.value}\n imports={defu(\n {\n didyoumean2: [\n { name: \"didYouMean\", default: true },\n { name: \"ReturnTypeEnums\" },\n { name: \"ThresholdTypeEnums\" }\n ]\n },\n imports ?? {},\n Object.entries(command.children)\n .filter(([, child]) => child.isVirtual)\n .reduce((ret, [name, child]) => {\n ret[`./${child.name}`] = [\n { name: \"handler\", alias: `handle${pascalCase(name)}` }\n ];\n\n return ret;\n }, {} as TypescriptFileImports)\n )}\n builtinImports={defu(builtinImports ?? {}, {\n env: [\"isDevelopment\", \"isDebug\"],\n console: [\n \"help\",\n \"warn\",\n \"error\",\n \"table\",\n \"colors\",\n \"writeLine\",\n \"splitText\",\n \"stripAnsi\"\n ],\n utils: [\"useArgs\", \"hasFlag\", \"isMinimal\", \"isUnicodeSupported\"]\n })}>\n <BannerFunctionDeclaration command={command} />\n <hbr />\n <hbr />\n <VirtualCommandHandlerDeclaration\n command={command}\n banner={code`banner(); `}>\n <CommandRouter\n segments={command.segments}\n commands={command.children}\n />\n </VirtualCommandHandlerDeclaration>\n </TypescriptFile>\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":";;;;;;;;;;;;;;;;;;;;AAwDA,SAAgBsB,iCACdC,OACA;CACA,MAAM,EAAEC,SAASC,UAAUC,WAAWH;CAEtC,MAAMI,UAAUtB,eAAoC;AAEpD,QAAA,CAAAuB,gBAEKtB,OAAK;EAAA,IACJuB,UAAO;AAAA,UAAE,OAAOL,QAA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G,gBACvBR,eAAa;OAAA,IACZW,WAAQ;AAAA,eAAEP,QAAQO;;OAAQ,IAC1BiB,WAAQ;AAAA,eAAExB,QAAQC;;OAAQ,CAAA;;KAAA,CAAA;IAAA;;EAAA,CAAA,CAAA,EAAAG,gBAI/B1B,KAAG;EAAA,IAACmE,OAAI;AAAA,UAAEvB,OAAOC,OAAOvB,QAAQC,SAAS;;EAAAA,WACvCoC,UAAKjC,gBACHzB,MAAI;GAAA,IACHwC,OAAI;AAAA,WAAEkB,MAAMC;;GAAS,IACrBQ,WAAQ;AAAA,WAAA1C,gBAAGT,cAAY,EAACK,SAASqC,OAAK,CAAA;;GAAA,IAAApC,WAAA;AAAA,WAAAG,gBACrCqB,qBAAmB,EAACzB,SAASqC,OAAK,CAAA;;GAAA,CAAA;EAEtC,CAAA,CAAA"}
1
+ {"version":3,"file":"virtual-command-entry.mjs","names":["code","computed","For","Show","FunctionDeclaration","usePowerlines","TSDoc","TSDocParam","TSDocRemarks","TSDocTitle","TypescriptFile","getAppBin","getDynamicPathSegmentName","isDynamicPathSegment","joinPaths","constantCase","pascalCase","defu","BannerFunctionDeclaration","CommandEntry","CommandRouter","VirtualHelp","VirtualCommandHandlerDeclaration","props","command","children","banner","context","_$createComponent","heading","title","segments","map","segment","join","description","replace","_$createIntrinsic","name","async","parameters","type","default","when","Boolean","options","Object","values","commands","VirtualCommandEntry","imports","builtinImports","rest","filePath","entryPath","filter","_$mergeProps","path","value","entries","child","isVirtual","reduce","ret","alias","env","console","utils","each","fallback"],"sources":["../../src/components/virtual-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 { FunctionDeclaration } from \"@alloy-js/typescript\";\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 {\n TSDoc,\n TSDocParam,\n TSDocRemarks,\n TSDocTitle\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { TypescriptFile } from \"@powerlines/plugin-alloy/typescript/components/typescript-file\";\nimport {\n getAppBin,\n getDynamicPathSegmentName,\n isDynamicPathSegment\n} from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport type { CommandTree } from \"@shell-shock/core/types/command\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { constantCase } from \"@stryke/string-format/constant-case\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport defu from \"defu\";\nimport type { ScriptPresetContext } from \"../types/plugin\";\nimport { BannerFunctionDeclaration } from \"./banner-function-declaration\";\nimport { CommandEntry } from \"./command-entry\";\nimport { CommandRouter } from \"./command-router\";\nimport { VirtualHelp } from \"./help\";\n\nexport interface VirtualCommandHandlerDeclarationProps {\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 VirtualCommandHandlerDeclaration(\n props: VirtualCommandHandlerDeclarationProps\n) {\n const { command, children, banner } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n\n return (\n <>\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(\" \")}) virtual 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 <hbr />\n <hbr />\n {children}\n <hbr />\n <hbr />\n <Show when={Boolean(banner)}>{banner}</Show>\n <hbr />\n <hbr />\n <VirtualHelp\n segments={command.segments}\n options={Object.values(command.options)}\n commands={command.children ?? {}}\n />\n </FunctionDeclaration>\n </>\n );\n}\n\nexport interface VirtualCommandEntryProps extends Omit<\n EntryFileProps,\n \"path\" | \"typeDefinition\"\n> {\n command: CommandTree;\n}\n\n/**\n * The virtual command entry point for the Shell Shock project.\n */\nexport function VirtualCommandEntry(props: VirtualCommandEntryProps) {\n const { command, imports, builtinImports, ...rest } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n const filePath = computed(() =>\n joinPaths(\n context.entryPath,\n command.segments\n .filter(segment => !isDynamicPathSegment(segment))\n .join(\"/\"),\n \"index.ts\"\n )\n );\n\n return (\n <>\n <TypescriptFile\n {...rest}\n path={filePath.value}\n imports={defu(\n imports ?? {},\n Object.entries(command.children)\n .filter(([, child]) => child.isVirtual)\n .reduce((ret, [name, child]) => {\n ret[`./${child.name}`] = [\n { name: \"handler\", alias: `handle${pascalCase(name)}` }\n ];\n\n return ret;\n }, {} as TypescriptFileImports)\n )}\n builtinImports={defu(builtinImports ?? {}, {\n env: [\"isDevelopment\", \"isDebug\"],\n console: [\n \"help\",\n \"warn\",\n \"error\",\n \"table\",\n \"colors\",\n \"writeLine\",\n \"splitText\",\n \"stripAnsi\"\n ],\n utils: [\n \"useArgs\",\n \"hasFlag\",\n \"isMinimal\",\n \"isUnicodeSupported\",\n \"findSuggestions\"\n ]\n })}>\n <BannerFunctionDeclaration command={command} />\n <hbr />\n <hbr />\n <VirtualCommandHandlerDeclaration\n command={command}\n banner={code`banner(); `}>\n <CommandRouter\n segments={command.segments}\n commands={command.children}\n />\n </VirtualCommandHandlerDeclaration>\n </TypescriptFile>\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":";;;;;;;;;;;;;;;;;;;;AAwDA,SAAgBsB,iCACdC,OACA;CACA,MAAM,EAAEC,SAASC,UAAUC,WAAWH;CAEtC,MAAMI,UAAUtB,eAAoC;AAEpD,QAAA,CAAAuB,gBAEKtB,OAAK;EAAA,IACJuB,UAAO;AAAA,UAAE,OAAOL,QAAQM,MAAK,IAAKnB,UAAUgB,QAAQ,CAAA,GAAIH,QAAQO,SAC7DC,KAAIC,YACHpB,qBAAqBoB,QAAQ,GACzB,IAAIlB,aAAaH,0BAA0BqB,QAAQ,CAAC,CAAA,KACpDA,QACL,CACAC,KAAK,IAAI,CAAA;;EAAoB,IAAAT,WAAA;AAAA,UAAA;IAAAG,gBAC/BpB,cAAY,EAAA,IAAAiB,WAAA;AAAA,YAAE,GAAGD,QAAQW,YAAYC,QAAQ,QAAQ,GAAG,CAAA;OAAG,CAAA;IAAAC,gBAAA,OAAA,EAAA,CAAA;IAAAT,gBAE3DnB,YAAU,EAAA,IAAAgB,WAAA;AAAA,YAAED,QAAQM;OAAK,CAAA;IAAAF,gBACzBrB,YAAU;KAAC+B,MAAI;KAAAb,UAAS;KAAmD,CAAA;IAAA;;EAAA,CAAA,EAAAG,gBAE7ExB,qBAAmB;EAAA,UAAA;EAElBmC,OAAK;EACLD,MAAI;EACJE,YAAY,CAAC;GAAEF,MAAM;GAAQG,MAAM;GAAYC,SAAS;GAAa,CAAC;EAAA,IAAAjB,WAAA;AAAA,UAAA;IAAAY,gBAAA,OAAA,EAAA,CAAA;IAAAA,gBAAA,OAAA,EAAA,CAAA;IAGrEZ;IAAQY,gBAAA,OAAA,EAAA,CAAA;IAAAA,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KACA;KACA;KACA;KACD;IACDC,OAAO;KACL;KACA;KACA;KACA;KACA;KAAiB;IAEpB,CAAC;;EAAA,IAAA1C,WAAA;AAAA,UAAA;IAAAG,gBACDV,2BAAyB,EAAUM,SAAO,CAAA;IAAAa,gBAAA,OAAA,EAAA,CAAA;IAAAA,gBAAA,OAAA,EAAA,CAAA;IAAAT,gBAG1CN,kCAAgC;KACtBE;KACTE,QAAQ1B,IAAI;KAAY,IAAAyB,WAAA;AAAA,aAAAG,gBACvBR,eAAa;OAAA,IACZW,WAAQ;AAAA,eAAEP,QAAQO;;OAAQ,IAC1BiB,WAAQ;AAAA,eAAExB,QAAQC;;OAAQ,CAAA;;KAAA,CAAA;IAAA;;EAAA,CAAA,CAAA,EAAAG,gBAI/B1B,KAAG;EAAA,IAACkE,OAAI;AAAA,UAAEtB,OAAOC,OAAOvB,QAAQC,SAAS;;EAAAA,WACvCmC,UAAKhC,gBACHzB,MAAI;GAAA,IACHwC,OAAI;AAAA,WAAEiB,MAAMC;;GAAS,IACrBQ,WAAQ;AAAA,WAAAzC,gBAAGT,cAAY,EAACK,SAASoC,OAAK,CAAA;;GAAA,IAAAnC,WAAA;AAAA,WAAAG,gBACrCqB,qBAAmB,EAACzB,SAASoC,OAAK,CAAA;;GAAA,CAAA;EAEtC,CAAA,CAAA"}
package/dist/index.cjs CHANGED
@@ -31,9 +31,6 @@ const plugin = (options = {}) => {
31
31
  isCaseSensitive: false,
32
32
  ...options
33
33
  };
34
- },
35
- configResolved() {
36
- this.dependencies.didyoumean2 = "^7.0.4";
37
34
  }
38
35
  },
39
36
  {
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["code","For","Show","VarDeclaration","render","console","BannerFunctionDeclaration","VirtualHelp","BinEntry","CommandEntry","CommandRouter","VirtualCommandEntry","getDefaultOptions","plugin","options","name","config","debug","defaultOptions","isCaseSensitive","configResolved","dependencies","didyoumean2","prepare","order","handler","_self$","_$createComponent","builtinImports","utils","prefix","_$createIntrinsic","children","when","Object","keys","commands","length","type","initializer","segments","values","each","doubleHardline","child","isVirtual","fallback","command"],"sources":["../src/index.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, For, Show } from \"@alloy-js/core\";\nimport { VarDeclaration } from \"@alloy-js/typescript\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport console from \"@shell-shock/plugin-console\";\nimport type { Plugin } from \"powerlines/types/plugin\";\nimport { BannerFunctionDeclaration, VirtualHelp } from \"./components\";\nimport { BinEntry } from \"./components/bin-entry\";\nimport { CommandEntry } from \"./components/command-entry\";\nimport { CommandRouter } from \"./components/command-router\";\nimport { VirtualCommandEntry } from \"./components/virtual-command-entry\";\nimport { getDefaultOptions } from \"./helpers/get-default-options\";\nimport type { ScriptPresetContext, ScriptPresetOptions } from \"./types/plugin\";\n\n/**\n * The Shell Shock base plugin.\n */\nexport const plugin = <\n TContext extends ScriptPresetContext = ScriptPresetContext\n>(\n options: ScriptPresetOptions = {}\n) => {\n return [\n console(options),\n {\n name: \"shell-shock:script-preset\",\n config() {\n this.debug(\n \"Providing default configuration for the Shell Shock `script` preset.\"\n );\n\n return {\n defaultOptions: getDefaultOptions,\n isCaseSensitive: false,\n ...options\n };\n },\n configResolved() {\n this.dependencies.didyoumean2 = \"^7.0.4\";\n }\n },\n {\n name: \"shell-shock:script-preset:generate-entrypoint\",\n prepare: {\n order: \"post\",\n async handler() {\n this.debug(\n \"Rendering entrypoint modules for the Shell Shock `script` preset.\"\n );\n\n return render(\n this,\n <>\n <BinEntry\n builtinImports={{\n console: [\n \"divider\",\n \"stripAnsi\",\n \"writeLine\",\n \"splitText\",\n \"colors\",\n \"help\"\n ],\n utils: [\"useArgs\", \"isMinimal\"]\n }}\n prefix={\n <>\n <BannerFunctionDeclaration />\n <hbr />\n <hbr />\n </>\n }>\n <Show when={Object.keys(this.commands).length > 0}>\n <VarDeclaration\n const\n name=\"args\"\n type=\"string[]\"\n initializer={code`useArgs();`}\n />\n <hbr />\n <CommandRouter segments={[]} commands={this.commands ?? {}} />\n <hbr />\n </Show>\n <hbr />\n <hbr />\n {code`banner();`}\n <hbr />\n <hbr />\n <VirtualHelp\n options={this.options}\n commands={this.commands ?? {}}\n />\n </BinEntry>\n <Show when={Object.values(this.commands).length > 0}>\n <For each={Object.values(this.commands)} doubleHardline>\n {child => (\n <Show\n when={child.isVirtual}\n fallback={<CommandEntry command={child} />}>\n <VirtualCommandEntry command={child} />\n </Show>\n )}\n </For>\n </Show>\n </>\n );\n }\n }\n }\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAkCA,MAAaa,UAGXC,UAA+B,EAAE,KAC9B;AACH,QAAO;4CACGA,QAAQ;EAChB;GACEC,MAAM;GACNC,SAAS;AACP,SAAKC,MACH,uEACD;AAED,WAAO;KACLC,gBAAgBN;KAChBO,iBAAiB;KACjB,GAAGL;KACJ;;GAEHM,iBAAiB;AACf,SAAKC,aAAaC,cAAc;;GAEnC;EACD;GACEP,MAAM;GACNQ,SAAS;IACPC,OAAO;IACP,MAAMC,UAAU;KAAA,MAAAC,SAAA;AACd,UAAKT,MACH,oEACD;AAED,yDACE,MAAI,kDAEDT,uCAAQ;MACPoB,gBAAgB;OACdvB,SAAS;QACP;QACA;QACA;QACA;QACA;QACA;QACD;OACDwB,OAAO,CAAC,WAAW,YAAW;OAC/B;MAAA,IACDC,SAAM;AAAA,cAAA;yDAEDxB,0EAAyB,EAAA,CAAA;yDAAA,OAAA,E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e/B"}
1
+ {"version":3,"file":"index.cjs","names":["code","For","Show","VarDeclaration","render","console","BannerFunctionDeclaration","VirtualHelp","BinEntry","CommandEntry","CommandRouter","VirtualCommandEntry","getDefaultOptions","plugin","options","name","config","debug","defaultOptions","isCaseSensitive","prepare","order","handler","_self$","_$createComponent","builtinImports","utils","prefix","_$createIntrinsic","children","when","Object","keys","commands","length","type","initializer","segments","values","each","doubleHardline","child","isVirtual","fallback","command"],"sources":["../src/index.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, For, Show } from \"@alloy-js/core\";\nimport { VarDeclaration } from \"@alloy-js/typescript\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport console from \"@shell-shock/plugin-console\";\nimport type { Plugin } from \"powerlines\";\nimport { BannerFunctionDeclaration, VirtualHelp } from \"./components\";\nimport { BinEntry } from \"./components/bin-entry\";\nimport { CommandEntry } from \"./components/command-entry\";\nimport { CommandRouter } from \"./components/command-router\";\nimport { VirtualCommandEntry } from \"./components/virtual-command-entry\";\nimport { getDefaultOptions } from \"./helpers/get-default-options\";\nimport type { ScriptPresetContext, ScriptPresetOptions } from \"./types/plugin\";\n\n/**\n * The Shell Shock base plugin.\n */\nexport const plugin = <\n TContext extends ScriptPresetContext = ScriptPresetContext\n>(\n options: ScriptPresetOptions = {}\n) => {\n return [\n console(options),\n {\n name: \"shell-shock:script-preset\",\n config() {\n this.debug(\n \"Providing default configuration for the Shell Shock `script` preset.\"\n );\n\n return {\n defaultOptions: getDefaultOptions,\n isCaseSensitive: false,\n ...options\n };\n }\n },\n {\n name: \"shell-shock:script-preset:generate-entrypoint\",\n prepare: {\n order: \"post\",\n async handler() {\n this.debug(\n \"Rendering entrypoint modules for the Shell Shock `script` preset.\"\n );\n\n return render(\n this,\n <>\n <BinEntry\n builtinImports={{\n console: [\n \"divider\",\n \"stripAnsi\",\n \"writeLine\",\n \"splitText\",\n \"colors\",\n \"help\"\n ],\n utils: [\"useArgs\", \"isMinimal\"]\n }}\n prefix={\n <>\n <BannerFunctionDeclaration />\n <hbr />\n <hbr />\n </>\n }>\n <Show when={Object.keys(this.commands).length > 0}>\n <VarDeclaration\n const\n name=\"args\"\n type=\"string[]\"\n initializer={code`useArgs();`}\n />\n <hbr />\n <CommandRouter segments={[]} commands={this.commands ?? {}} />\n <hbr />\n </Show>\n <hbr />\n <hbr />\n {code`banner();`}\n <hbr />\n <hbr />\n <VirtualHelp\n options={this.options}\n commands={this.commands ?? {}}\n />\n </BinEntry>\n <Show when={Object.values(this.commands).length > 0}>\n <For each={Object.values(this.commands)} doubleHardline>\n {child => (\n <Show\n when={child.isVirtual}\n fallback={<CommandEntry command={child} />}>\n <VirtualCommandEntry command={child} />\n </Show>\n )}\n </For>\n </Show>\n </>\n );\n }\n }\n }\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAkCA,MAAaa,UAGXC,UAA+B,EAAE,KAC9B;AACH,QAAO;4CACGA,QAAQ;EAChB;GACEC,MAAM;GACNC,SAAS;AACP,SAAKC,MACH,uEACD;AAED,WAAO;KACLC,gBAAgBN;KAChBO,iBAAiB;KACjB,GAAGL;KACJ;;GAEJ;EACD;GACEC,MAAM;GACNK,SAAS;IACPC,OAAO;IACP,MAAMC,UAAU;KAAA,MAAAC,SAAA;AACd,UAAKN,MACH,oEACD;AAED,yDACE,MAAI,kDAEDT,uCAAQ;MACPiB,gBAAgB;OACdpB,SAAS;QACP;QACA;QACA;QACA;QACA;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ACrClB,8DAAmB,EAACiC,SAASH,OAAK,CAAA;;SAAA,CAAA;QAEtC,CAAA;;MAAA,CAAA,CAIT,CAAC;;IAEL;GACD;EACF;;AAGH,kBAAe5B"}
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ScriptPresetContext, ScriptPresetOptions } from "./types/plugin.cjs";
2
- import { Plugin } from "powerlines/types/plugin";
2
+ import { Plugin } from "powerlines";
3
3
 
4
4
  //#region src/index.d.ts
5
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"sourcesContent":[],"mappings":";;;;;;;AAkCA;AACmB,cADN,MACM,EAAA,CAAA,iBAAA,mBAAA,GAAsB,mBAAtB,CAAA,CAAA,OAAA,CAAA,EAER,mBAFQ,EAAA,GA2FZ,MA3FY,CA2FL,QA3FK,CAAA,EAAA"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"sourcesContent":[],"mappings":";;;;;;;AAkCA;AACmB,cADN,MACM,EAAA,CAAA,iBAAA,mBAAA,GAAsB,mBAAtB,CAAA,CAAA,OAAA,CAAA,EAER,mBAFQ,EAAA,GAwFZ,MAxFY,CAwFL,QAxFK,CAAA,EAAA"}
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { ScriptPresetContext, ScriptPresetOptions } from "./types/plugin.mjs";
2
- import { Plugin } from "powerlines/types/plugin";
2
+ import { Plugin } from "powerlines";
3
3
 
4
4
  //#region src/index.d.ts
5
5
 
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"sourcesContent":[],"mappings":";;;;;;;AAkCA;AACmB,cADN,MACM,EAAA,CAAA,iBAAA,mBAAA,GAAsB,mBAAtB,CAAA,CAAA,OAAA,CAAA,EAER,mBAFQ,EAAA,GA2FZ,MA3FY,CA2FL,QA3FK,CAAA,EAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"sourcesContent":[],"mappings":";;;;;;;AAkCA;AACmB,cADN,MACM,EAAA,CAAA,iBAAA,mBAAA,GAAsB,mBAAtB,CAAA,CAAA,OAAA,CAAA,EAER,mBAFQ,EAAA,GAwFZ,MAxFY,CAwFL,QAxFK,CAAA,EAAA"}
package/dist/index.mjs CHANGED
@@ -28,9 +28,6 @@ const plugin = (options = {}) => {
28
28
  isCaseSensitive: false,
29
29
  ...options
30
30
  };
31
- },
32
- configResolved() {
33
- this.dependencies.didyoumean2 = "^7.0.4";
34
31
  }
35
32
  },
36
33
  {
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["code","For","Show","VarDeclaration","render","console","BannerFunctionDeclaration","VirtualHelp","BinEntry","CommandEntry","CommandRouter","VirtualCommandEntry","getDefaultOptions","plugin","options","name","config","debug","defaultOptions","isCaseSensitive","configResolved","dependencies","didyoumean2","prepare","order","handler","_self$","_$createComponent","builtinImports","utils","prefix","_$createIntrinsic","children","when","Object","keys","commands","length","type","initializer","segments","values","each","doubleHardline","child","isVirtual","fallback","command"],"sources":["../src/index.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, For, Show } from \"@alloy-js/core\";\nimport { VarDeclaration } from \"@alloy-js/typescript\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport console from \"@shell-shock/plugin-console\";\nimport type { Plugin } from \"powerlines/types/plugin\";\nimport { BannerFunctionDeclaration, VirtualHelp } from \"./components\";\nimport { BinEntry } from \"./components/bin-entry\";\nimport { CommandEntry } from \"./components/command-entry\";\nimport { CommandRouter } from \"./components/command-router\";\nimport { VirtualCommandEntry } from \"./components/virtual-command-entry\";\nimport { getDefaultOptions } from \"./helpers/get-default-options\";\nimport type { ScriptPresetContext, ScriptPresetOptions } from \"./types/plugin\";\n\n/**\n * The Shell Shock base plugin.\n */\nexport const plugin = <\n TContext extends ScriptPresetContext = ScriptPresetContext\n>(\n options: ScriptPresetOptions = {}\n) => {\n return [\n console(options),\n {\n name: \"shell-shock:script-preset\",\n config() {\n this.debug(\n \"Providing default configuration for the Shell Shock `script` preset.\"\n );\n\n return {\n defaultOptions: getDefaultOptions,\n isCaseSensitive: false,\n ...options\n };\n },\n configResolved() {\n this.dependencies.didyoumean2 = \"^7.0.4\";\n }\n },\n {\n name: \"shell-shock:script-preset:generate-entrypoint\",\n prepare: {\n order: \"post\",\n async handler() {\n this.debug(\n \"Rendering entrypoint modules for the Shell Shock `script` preset.\"\n );\n\n return render(\n this,\n <>\n <BinEntry\n builtinImports={{\n console: [\n \"divider\",\n \"stripAnsi\",\n \"writeLine\",\n \"splitText\",\n \"colors\",\n \"help\"\n ],\n utils: [\"useArgs\", \"isMinimal\"]\n }}\n prefix={\n <>\n <BannerFunctionDeclaration />\n <hbr />\n <hbr />\n </>\n }>\n <Show when={Object.keys(this.commands).length > 0}>\n <VarDeclaration\n const\n name=\"args\"\n type=\"string[]\"\n initializer={code`useArgs();`}\n />\n <hbr />\n <CommandRouter segments={[]} commands={this.commands ?? {}} />\n <hbr />\n </Show>\n <hbr />\n <hbr />\n {code`banner();`}\n <hbr />\n <hbr />\n <VirtualHelp\n options={this.options}\n commands={this.commands ?? {}}\n />\n </BinEntry>\n <Show when={Object.values(this.commands).length > 0}>\n <For each={Object.values(this.commands)} doubleHardline>\n {child => (\n <Show\n when={child.isVirtual}\n fallback={<CommandEntry command={child} />}>\n <VirtualCommandEntry command={child} />\n </Show>\n )}\n </For>\n </Show>\n </>\n );\n }\n }\n }\n ] as Plugin<TCont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gBAAA,OAAA,EAAA,CAAA;QAAAA,gBAAA,OAAA,EAAA,CAAA;QAAAJ,gBAGfpB,aAAW;SAAA,IACVO,UAAO;AAAA,iBAAEY,OAAKZ;;SAAO,IACrBsB,WAAQ;AAAA,iBAAEV,OAAKU,YAAY,EAAE;;SAAA,CAAA;QAAA;;MAAA,CAAA,EAAAT,gBAGhCzB,MAAI;MAAA,IAAC+B,OAAI;AAAA,cAAEC,OAAOO,OAAOf,OAAKU,SAAS,CAACC,SAAS;;MAAC,IAAAL,WAAA;AAAA,cAAAL,gBAChD1B,KAAG;QAAA,IAACyC,OAAI;AAAA,gBAAER,OAAOO,OAAOf,OAAKU,SAAS;;QAAEO,gBAAc;QAAAX,WACpDY,UAAKjB,gBACHzB,MAAI;SAAA,IACH+B,OAAI;AAAA,iBAAEW,MAAMC;;SAAS,IACrBC,WAAQ;AAAA,iBAAAnB,gBAAGlB,cAAY,EAACsC,SAASH,OAAK,CAAA;;SAAA,IAAAZ,WAAA;AAAA,iBAAAL,gBACrChB,qBAAmB,EAACoC,SAASH,OAAK,CAAA;;SAAA,CAAA;QAEtC,CAAA;;MAAA,CAAA,CAIT,CAAC;;IAEL;GACD;EACF;;AAGH,kBAAe/B"}
1
+ {"version":3,"file":"index.mjs","names":["code","For","Show","VarDeclaration","render","console","BannerFunctionDeclaration","VirtualHelp","BinEntry","CommandEntry","CommandRouter","VirtualCommandEntry","getDefaultOptions","plugin","options","name","config","debug","defaultOptions","isCaseSensitive","prepare","order","handler","_self$","_$createComponent","builtinImports","utils","prefix","_$createIntrinsic","children","when","Object","keys","commands","length","type","initializer","segments","values","each","doubleHardline","child","isVirtual","fallback","command"],"sources":["../src/index.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, For, Show } from \"@alloy-js/core\";\nimport { VarDeclaration } from \"@alloy-js/typescript\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport console from \"@shell-shock/plugin-console\";\nimport type { Plugin } from \"powerlines\";\nimport { BannerFunctionDeclaration, VirtualHelp } from \"./components\";\nimport { BinEntry } from \"./components/bin-entry\";\nimport { CommandEntry } from \"./components/command-entry\";\nimport { CommandRouter } from \"./components/command-router\";\nimport { VirtualCommandEntry } from \"./components/virtual-command-entry\";\nimport { getDefaultOptions } from \"./helpers/get-default-options\";\nimport type { ScriptPresetContext, ScriptPresetOptions } from \"./types/plugin\";\n\n/**\n * The Shell Shock base plugin.\n */\nexport const plugin = <\n TContext extends ScriptPresetContext = ScriptPresetContext\n>(\n options: ScriptPresetOptions = {}\n) => {\n return [\n console(options),\n {\n name: \"shell-shock:script-preset\",\n config() {\n this.debug(\n \"Providing default configuration for the Shell Shock `script` preset.\"\n );\n\n return {\n defaultOptions: getDefaultOptions,\n isCaseSensitive: false,\n ...options\n };\n }\n },\n {\n name: \"shell-shock:script-preset:generate-entrypoint\",\n prepare: {\n order: \"post\",\n async handler() {\n this.debug(\n \"Rendering entrypoint modules for the Shell Shock `script` preset.\"\n );\n\n return render(\n this,\n <>\n <BinEntry\n builtinImports={{\n console: [\n \"divider\",\n \"stripAnsi\",\n \"writeLine\",\n \"splitText\",\n \"colors\",\n \"help\"\n ],\n utils: [\"useArgs\", \"isMinimal\"]\n }}\n prefix={\n <>\n <BannerFunctionDeclaration />\n <hbr />\n <hbr />\n </>\n }>\n <Show when={Object.keys(this.commands).length > 0}>\n <VarDeclaration\n const\n name=\"args\"\n type=\"string[]\"\n initializer={code`useArgs();`}\n />\n <hbr />\n <CommandRouter segments={[]} commands={this.commands ?? {}} />\n <hbr />\n </Show>\n <hbr />\n <hbr />\n {code`banner();`}\n <hbr />\n <hbr />\n <VirtualHelp\n options={this.options}\n commands={this.commands ?? {}}\n />\n </BinEntry>\n <Show when={Object.values(this.commands).length > 0}>\n <For each={Object.values(this.commands)} doubleHardline>\n {child => (\n <Show\n when={child.isVirtual}\n fallback={<CommandEntry command={child} />}>\n <VirtualCommandEntry command={child} />\n </Show>\n )}\n </For>\n </Show>\n </>\n );\n }\n }\n }\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAkCA,MAAaa,UAGXC,UAA+B,EAAE,KAC9B;AACH,QAAO;EACLT,QAAQS,QAAQ;EAChB;GACEC,MAAM;GACNC,SAAS;AACP,SAAKC,MACH,uEACD;AAED,WAAO;KACLC,gBAAgBN;KAChBO,iBAAiB;KACjB,GAAGL;KACJ;;GAEJ;EACD;GACEC,MAAM;GACNK,SAAS;IACPC,OAAO;IACP,MAAMC,UAAU;KAAA,MAAAC,SAAA;AACd,UAAKN,MACH,oEACD;AAED,YAAOb,OACL,MAAI,CAAAoB,gBAEDhB,UAAQ;MACPiB,gBAAgB;OACdpB,SAAS;QACP;QACA;QACA;QACA;QACA;QACA;QACD;OACDqB,OAAO,CAAC,WAAW,YAAW;OAC/B;MAAA,IACDC,SAAM;AAAA,cAAA;QAAAH,gBAEDlB,2BAAyB,EAAA,CAAA;QAAAsB,gBAAA,OAAA,EAAA,CAAA;QAAAA,gBAAA,OAAA,EAAA,CAAA;QAAA;;MAAA,IAAAC,WAAA;AAAA,cAAA;QAAAL,gBAK7BtB,MAAI;SAAA,IAAC4B,OAAI;AAAA,iBAAEC,OAAOC,KAAKT,OAAKU,SAAS,CAACC,SAAS;;SAAC,IAAAL,WAAA;AAAA,iBAAA;WAAAL,gBAC9CrB,gBAAc;YAAA,SAAA;YAEbY,MAAI;YACJoB,MAAI;YACJC,aAAapC,IAAI;YAAY,CAAA;WAAA4B,gBAAA,OA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A,OAAA,EAJpB,OAIiC,EAAA,KAAA,EAJjB,WAIoC,EAAA,GAJpB,aAIoB,EAAA,CAAA,GAAA,KAAA;AAErE;AAAyC,KAF7B,sBAAA,GAAyB,UAEI,GAFS,mBAET;AACzB,KADJ,0BAAA,GAA6B,cACzB,GAAd,QAAc,CAAL,IAAK,CAAA,mBAAA,EAAA,OAAA,CAAA,CAAA,GACd,yBADc;AAAL,KAGC,mBAHD,CAAA,wBAIe,0BAJf,GAKP,0BALO,CAAA,GAMP,kBANO,CAMY,eANZ,CAAA,GAOT,kBAPS,CAOU,eAPV,CAAA,GAQT,OARS,CAQD,eARC,CAAA"}
1
+ {"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/types/plugin.ts"],"sourcesContent":[],"mappings":";;;;;;;UAmCiB,mBAAA,SACP,KAAK,4BAA4B,QAAQ;;AADnD;;;;;;;;;;EAmBY,cAAA,CAAA,EALN,aAK4B,EAAA,GAAA,CAAA,CAAG,OAAA,EAJpB,OAIiC,EAAA,KAAA,EAJjB,WAIoC,EAAA,GAJpB,aAIoB,EAAA,CAAA,GAAA,KAAA;AAErE;AAAyC,KAF7B,sBAAA,GAAyB,UAEI,GAFS,mBAET;AACzB,KADJ,0BAAA,GAA6B,cACzB,GAAd,QAAc,CAAL,IAAK,CAAA,mBAAA,EAAA,OAAA,CAAA,CAAA,GACd,yBADc;AAAL,KAGC,mBAHD,CAAA,wBAIe,0BAJf,GAKP,0BALO,CAAA,GAMP,kBANO,CAMY,eANZ,CAAA,GAOT,kBAPS,CAOU,eAPV,CAAA,GAQT,OARS,CAQD,eARC,CAAA"}
package/package.json CHANGED
@@ -1,18 +1,29 @@
1
1
  {
2
2
  "name": "@shell-shock/preset-script",
3
- "version": "0.6.20",
4
- "type": "module",
3
+ "version": "0.6.21",
4
+ "private": false,
5
5
  "description": "A Shell Shock preset that generates a fully-featured script application.",
6
+ "keywords": [
7
+ "shell-shock",
8
+ "shell-shock-plugin",
9
+ "powerlines",
10
+ "storm-software"
11
+ ],
12
+ "homepage": "https://stormsoftware.com",
13
+ "bugs": {
14
+ "url": "https://stormsoftware.com/support",
15
+ "email": "support@stormsoftware.com"
16
+ },
6
17
  "repository": {
7
18
  "type": "github",
8
19
  "url": "https://github.com/storm-software/shell-shock.git",
9
20
  "directory": "packages/preset-script"
10
21
  },
11
- "homepage": "https://stormsoftware.com",
12
- "bugs": {
13
- "url": "https://stormsoftware.com/support",
14
- "email": "support@stormsoftware.com"
22
+ "funding": {
23
+ "type": "github",
24
+ "url": "https://github.com/sponsors/storm-software"
15
25
  },
26
+ "license": "Apache-2.0",
16
27
  "author": {
17
28
  "name": "Storm Software",
18
29
  "email": "contact@stormsoftware.com",
@@ -32,14 +43,7 @@
32
43
  "url": "https://stormsoftware.com"
33
44
  }
34
45
  ],
35
- "funding": {
36
- "type": "github",
37
- "url": "https://github.com/sponsors/storm-software"
38
- },
39
- "license": "Apache-2.0",
40
- "private": false,
41
- "main": "./dist/index.cjs",
42
- "module": "./dist/index.mjs",
46
+ "type": "module",
43
47
  "exports": {
44
48
  ".": {
45
49
  "require": {
@@ -55,6 +59,7 @@
55
59
  "default": "./dist/index.mjs"
56
60
  }
57
61
  },
62
+ "./*": "./*",
58
63
  "./components": {
59
64
  "require": {
60
65
  "types": "./dist/components/index.d.cts",
@@ -195,7 +200,6 @@
195
200
  "default": "./dist/helpers/get-default-options.mjs"
196
201
  }
197
202
  },
198
- "./package.json": "./package.json",
199
203
  "./types": {
200
204
  "require": {
201
205
  "types": "./dist/types/index.d.cts",
@@ -225,35 +229,31 @@
225
229
  }
226
230
  }
227
231
  },
232
+ "main": "./dist/index.cjs",
233
+ "module": "./dist/index.mjs",
228
234
  "types": "./dist/index.d.cts",
229
235
  "typings": "dist/index.d.mts",
230
236
  "files": ["dist/**/*"],
231
- "keywords": [
232
- "shell-shock",
233
- "shell-shock-plugin",
234
- "powerlines",
235
- "storm-software"
236
- ],
237
237
  "dependencies": {
238
238
  "@alloy-js/core": "0.23.0-dev.8",
239
239
  "@alloy-js/typescript": "0.23.0-dev.4",
240
- "@powerlines/deepkit": "^0.6.70",
241
- "@powerlines/plugin-alloy": "^0.23.20",
242
- "@powerlines/plugin-plugin": "^0.12.241",
243
- "@shell-shock/core": "^0.9.7",
244
- "@shell-shock/plugin-theme": "^0.3.9",
240
+ "@powerlines/deepkit": "^0.6.88",
241
+ "@powerlines/plugin-alloy": "^0.23.40",
242
+ "@powerlines/plugin-plugin": "^0.12.260",
243
+ "@shell-shock/core": "^0.10.0",
244
+ "@shell-shock/plugin-console": "^0.1.6",
245
+ "@shell-shock/plugin-theme": "^0.3.10",
245
246
  "@stryke/helpers": "^0.9.42",
246
- "@stryke/path": "0.26.6",
247
- "@stryke/string-format": "0.14.2",
248
- "defu": "6.1.4",
249
- "powerlines": "^0.38.57",
250
- "@shell-shock/plugin-console": "^0.1.5"
247
+ "@stryke/path": "^0.26.6",
248
+ "@stryke/string-format": "^0.14.2",
249
+ "defu": "^6.1.4",
250
+ "powerlines": "^0.39.17"
251
251
  },
252
252
  "devDependencies": {
253
253
  "@babel/core": "^7.29.0",
254
- "@powerlines/plugin-alloy": "^0.23.20",
255
- "@types/node": "^25.3.1"
254
+ "@powerlines/plugin-alloy": "^0.23.40",
255
+ "@types/node": "^25.3.3"
256
256
  },
257
257
  "publishConfig": { "access": "public" },
258
- "gitHead": "169e28edb54c3e7e189cab2fa0797143a8f76c6f"
258
+ "gitHead": "d0abdaa95b5e40df2157d393f0ba8499589140ca"
259
259
  }