@shell-shock/preset-cli 0.1.0 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/components/banner-function-declaration.cjs +68 -0
  2. package/dist/components/banner-function-declaration.d.cts +11 -0
  3. package/dist/components/banner-function-declaration.d.cts.map +1 -0
  4. package/dist/components/banner-function-declaration.d.mts +11 -0
  5. package/dist/components/banner-function-declaration.d.mts.map +1 -0
  6. package/dist/components/banner-function-declaration.mjs +68 -0
  7. package/dist/components/banner-function-declaration.mjs.map +1 -0
  8. package/dist/components/command-entry.cjs +90 -0
  9. package/dist/components/command-entry.d.cts +15 -0
  10. package/dist/components/command-entry.d.cts.map +1 -0
  11. package/dist/components/command-entry.d.mts +15 -0
  12. package/dist/components/command-entry.d.mts.map +1 -0
  13. package/dist/components/command-entry.mjs +89 -0
  14. package/dist/components/command-entry.mjs.map +1 -0
  15. package/dist/components/index.cjs +6 -2
  16. package/dist/components/index.d.cts +4 -2
  17. package/dist/components/index.d.mts +4 -2
  18. package/dist/components/index.mjs +4 -2
  19. package/dist/components/virtual-command-entry.cjs +86 -0
  20. package/dist/components/virtual-command-entry.d.cts +15 -0
  21. package/dist/components/virtual-command-entry.d.cts.map +1 -0
  22. package/dist/components/virtual-command-entry.d.mts +15 -0
  23. package/dist/components/virtual-command-entry.d.mts.map +1 -0
  24. package/dist/components/virtual-command-entry.mjs +85 -0
  25. package/dist/components/virtual-command-entry.mjs.map +1 -0
  26. package/dist/helpers/get-default-options.cjs +2 -2
  27. package/dist/helpers/get-default-options.mjs +2 -2
  28. package/dist/helpers/get-default-options.mjs.map +1 -1
  29. package/dist/index.cjs +24 -58
  30. package/dist/index.d.cts.map +1 -1
  31. package/dist/index.d.mts.map +1 -1
  32. package/dist/index.mjs +24 -58
  33. package/dist/index.mjs.map +1 -1
  34. package/package.json +49 -19
  35. package/dist/components/banner.cjs +0 -82
  36. package/dist/components/banner.d.cts +0 -16
  37. package/dist/components/banner.d.cts.map +0 -1
  38. package/dist/components/banner.d.mts +0 -16
  39. package/dist/components/banner.d.mts.map +0 -1
  40. package/dist/components/banner.mjs +0 -82
  41. package/dist/components/banner.mjs.map +0 -1
@@ -0,0 +1,85 @@
1
+ import { BannerFunctionDeclaration } from "./banner-function-declaration.mjs";
2
+ import { CommandEntry } from "./command-entry.mjs";
3
+ import { createComponent, createIntrinsic, mergeProps } from "@alloy-js/core/jsx-runtime";
4
+ import { For, Show, computed } from "@alloy-js/core";
5
+ import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
6
+ import { isPositionalCommandOption } from "@shell-shock/core/plugin-utils/context-helpers";
7
+ import { joinPaths } from "@stryke/path/join";
8
+ import { pascalCase } from "@stryke/string-format/pascal-case";
9
+ import defu from "defu";
10
+ import { TypescriptFile } from "@powerlines/plugin-alloy/typescript/components/typescript-file";
11
+ import { VirtualCommandHandlerDeclaration } from "@shell-shock/preset-script/components/virtual-command-entry";
12
+
13
+ //#region src/components/virtual-command-entry.tsx
14
+ /**
15
+ * The virtual command entry point for the Shell Shock project.
16
+ */
17
+ function VirtualCommandEntry(props) {
18
+ const { command, imports, builtinImports, ...rest } = props;
19
+ const context = usePowerlines();
20
+ const filePath = computed(() => joinPaths(context.entryPath, command.path.segments.filter((segment) => !isPositionalCommandOption(segment)).join("/"), "index.ts"));
21
+ return [createComponent(TypescriptFile, mergeProps(rest, {
22
+ get path() {
23
+ return filePath.value;
24
+ },
25
+ get imports() {
26
+ return defu({ didyoumean2: [
27
+ {
28
+ name: "didYouMean",
29
+ default: true
30
+ },
31
+ { name: "ReturnTypeEnums" },
32
+ { name: "ThresholdTypeEnums" }
33
+ ] }, imports ?? {}, Object.entries(command.children).filter(([, child]) => child.isVirtual).reduce((ret, [name, child]) => {
34
+ ret[`./${child.name}`] = [{
35
+ name: "handler",
36
+ alias: `handle${pascalCase(name)}`
37
+ }];
38
+ return ret;
39
+ }, {}));
40
+ },
41
+ get builtinImports() {
42
+ return defu(builtinImports ?? {}, {
43
+ console: [
44
+ "warn",
45
+ "error",
46
+ "table",
47
+ "colors",
48
+ "writeLine"
49
+ ],
50
+ utils: [
51
+ "getArgs",
52
+ "hasFlag",
53
+ "isMinimal"
54
+ ]
55
+ });
56
+ },
57
+ get children() {
58
+ return [
59
+ createComponent(BannerFunctionDeclaration, { command }),
60
+ createIntrinsic("hbr", {}),
61
+ createIntrinsic("hbr", {}),
62
+ createComponent(VirtualCommandHandlerDeclaration, { command })
63
+ ];
64
+ }
65
+ })), createComponent(For, {
66
+ get each() {
67
+ return Object.values(command.children);
68
+ },
69
+ children: (child) => createComponent(Show, {
70
+ get when() {
71
+ return child.isVirtual;
72
+ },
73
+ get fallback() {
74
+ return createComponent(CommandEntry, { command: child });
75
+ },
76
+ get children() {
77
+ return createComponent(VirtualCommandEntry, { command: child });
78
+ }
79
+ })
80
+ })];
81
+ }
82
+
83
+ //#endregion
84
+ export { VirtualCommandEntry };
85
+ //# sourceMappingURL=virtual-command-entry.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"virtual-command-entry.mjs","names":["computed","For","Show","usePowerlines","TypescriptFile","isPositionalCommandOption","VirtualCommandHandlerDeclaration","joinPaths","pascalCase","defu","BannerFunctionDeclaration","CommandEntry","VirtualCommandEntry","props","command","imports","builtinImports","rest","context","filePath","entryPath","path","segments","filter","segment","join","_$createComponent","_$mergeProps","value","didyoumean2","name","default","Object","entries","children","child","isVirtual","reduce","ret","alias","console","utils","_$createIntrinsic","each","values","when","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 { computed, For, Show } from \"@alloy-js/core\";\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 { TypescriptFile } from \"@powerlines/plugin-alloy/typescript/components/typescript-file\";\nimport { isPositionalCommandOption } from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport type { CommandTree } from \"@shell-shock/core/types/command\";\nimport { VirtualCommandHandlerDeclaration } from \"@shell-shock/preset-script/components/virtual-command-entry\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport defu from \"defu\";\nimport type { CLIPresetContext } from \"../types/plugin\";\nimport { BannerFunctionDeclaration } from \"./banner-function-declaration\";\nimport { CommandEntry } from \"./command-entry\";\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<CLIPresetContext>();\n const filePath = computed(() =>\n joinPaths(\n context.entryPath,\n command.path.segments\n .filter(segment => !isPositionalCommandOption(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 console: [\"warn\", \"error\", \"table\", \"colors\", \"writeLine\"],\n utils: [\"getArgs\", \"hasFlag\", \"isMinimal\"]\n })}>\n <BannerFunctionDeclaration command={command} />\n <hbr />\n <hbr />\n <VirtualCommandHandlerDeclaration command={command} />\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":";;;;;;;;;;;;;;;;AA2CA,SAAgBY,oBAAoBC,OAAiC;CACnE,MAAM,EAAEC,SAASC,SAASC,gBAAgB,GAAGC,SAASJ;CAEtD,MAAMK,UAAUf,eAAiC;CACjD,MAAMgB,WAAWnB,eACfO,UACEW,QAAQE,WACRN,QAAQO,KAAKC,SACVC,QAAOC,YAAW,CAACnB,0BAA0BmB,QAAQ,CAAC,CACtDC,KAAK,IAAI,EACZ,WAEJ,CAAC;AAED,QAAA,CAAAC,gBAEKtB,gBAAcuB,WACTV,MAAI;EAAA,IACRI,OAAI;AAAA,UAAEF,SAASS;;EAAK,IACpBb,UAAO;AAAA,UAAEN,KACP,EACEoB,aAAa;IACX;KAAEC,MAAM;KAAcC,SAAS;KAAM;IACrC,EAAED,MAAM,mBAAmB;IAC3B,EAAEA,MAAM,sBAAsB;IAAA,EAEjC,EACDf,WAAW,EAAE,EACbiB,OAAOC,QAAQnB,QAAQoB,SAAS,CAC7BX,QAAQ,GAAGY,WAAWA,MAAMC,UAAU,CACtCC,QAAQC,KAAK,CAACR,MAAMK,WAAW;AAC9BG,QAAI,KAAKH,MAAML,UAAU,CACvB;KAAEA,MAAM;KAAWS,OAAO,SAAS/B,WAAWsB,KAAK;KAAI,CACxD;AAED,WAAOQ;MACN,EAA2B,CAClC,CAAC;;EAAA,IACDtB,iBAAc;AAAA,UAAEP,KAAKO,kBAAkB,EAAE,EAAE;IACzCwB,SAAS;KAAC;KAAQ;KAAS;KAAS;KAAU;KAAY;IAC1DC,OAAO;KAAC;KAAW;KAAW;KAAW;IAC1C,CAAC;;EAAA,IAAAP,WAAA;AAAA,UAAA;IAAAR,gBACDhB,2BAAyB,EAAUI,SAAO,CAAA;IAAA4B,gBAAA,OAAA,EAAA,CAAA;IAAAA,gBAAA,OAAA,EAAA,CAAA;IAAAhB,gBAG1CpB,kCAAgC,EAAUQ,SAAO,CAAA;IAAA;;EAAA,CAAA,CAAA,EAAAY,gBAEnDzB,KAAG;EAAA,IAAC0C,OAAI;AAAA,UAAEX,OAAOY,OAAO9B,QAAQoB,SAAS;;EAAAA,WACvCC,UAAKT,gBACHxB,MAAI;GAAA,IACH2C,OAAI;AAAA,WAAEV,MAAMC;;GAAS,IACrBU,WAAQ;AAAA,WAAApB,gBAAGf,cAAY,EAACG,SAASqB,OAAK,CAAA;;GAAA,IAAAD,WAAA;AAAA,WAAAR,gBACrCd,qBAAmB,EAACE,SAASqB,OAAK,CAAA;;GAAA,CAAA;EAEtC,CAAA,CAAA"}
@@ -16,7 +16,7 @@ function getDefaultOptions(context, _) {
16
16
  context.config.interactive !== "never" && context.config.interactive !== true && {
17
17
  name: "interactive",
18
18
  title: "Interactive",
19
- description: "Enable interactive mode (will be set to false if running in a CI pipeline).",
19
+ description: "Enable interactive mode - will be set to false if running in a CI pipeline.",
20
20
  alias: ["i", "interact"],
21
21
  kind: __powerlines_deepkit_vendor_type.ReflectionKind.boolean,
22
22
  optional: true,
@@ -25,7 +25,7 @@ function getDefaultOptions(context, _) {
25
25
  context.config.interactive !== "never" && context.config.interactive !== false && {
26
26
  name: "no-interactive",
27
27
  title: "Non-Interactive",
28
- description: "Disable interactive mode (will be set to true if running in a CI pipeline).",
28
+ description: "Disable interactive mode - will be set to true if running in a CI pipeline.",
29
29
  alias: ["no-interact"],
30
30
  kind: __powerlines_deepkit_vendor_type.ReflectionKind.boolean,
31
31
  optional: true,
@@ -15,7 +15,7 @@ function getDefaultOptions$1(context, _) {
15
15
  context.config.interactive !== "never" && context.config.interactive !== true && {
16
16
  name: "interactive",
17
17
  title: "Interactive",
18
- description: "Enable interactive mode (will be set to false if running in a CI pipeline).",
18
+ description: "Enable interactive mode - will be set to false if running in a CI pipeline.",
19
19
  alias: ["i", "interact"],
20
20
  kind: ReflectionKind.boolean,
21
21
  optional: true,
@@ -24,7 +24,7 @@ function getDefaultOptions$1(context, _) {
24
24
  context.config.interactive !== "never" && context.config.interactive !== false && {
25
25
  name: "no-interactive",
26
26
  title: "Non-Interactive",
27
- description: "Disable interactive mode (will be set to true if running in a CI pipeline).",
27
+ description: "Disable interactive mode - will be set to true if running in a CI pipeline.",
28
28
  alias: ["no-interact"],
29
29
  kind: ReflectionKind.boolean,
30
30
  optional: true,
@@ -1 +1 @@
1
- {"version":3,"file":"get-default-options.mjs","names":["ReflectionKind","getDefaultOptions","getDefaultOptionsBase","context","_","config","interactive","name","title","description","alias","kind","boolean","optional","default","isNegativeOf","filter","Boolean"],"sources":["../../src/helpers/get-default-options.ts"],"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 { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport type { CommandBase, CommandOption } from \"@shell-shock/core\";\nimport { getDefaultOptions as getDefaultOptionsBase } from \"@shell-shock/preset-script/helpers/get-default-options\";\nimport type { CLIPresetContext } from \"../types\";\n\n/**\n * Get the default command options.\n *\n * @param context - The build context.\n * @param _ - The command input.\n * @returns The default command options.\n */\nexport function getDefaultOptions(\n context: CLIPresetContext,\n _: CommandBase\n): CommandOption[] {\n return [\n ...getDefaultOptionsBase(),\n context.config.interactive !== \"never\" &&\n context.config.interactive !== true && {\n name: \"interactive\",\n title: \"Interactive\",\n description:\n \"Enable interactive mode (will be set to false if running in a CI pipeline).\",\n alias: [\"i\", \"interact\"],\n kind: ReflectionKind.boolean,\n optional: true,\n default: context.config.interactive !== false\n },\n context.config.interactive !== \"never\" &&\n context.config.interactive !== false && {\n name: \"no-interactive\",\n title: \"Non-Interactive\",\n description:\n \"Disable interactive mode (will be set to true if running in a CI pipeline).\",\n alias: [\"no-interact\"],\n kind: ReflectionKind.boolean,\n optional: true,\n default: false,\n isNegativeOf: \"interactive\"\n }\n ].filter(Boolean) as CommandOption[];\n}\n"],"mappings":";;;;;;;;;;;AA8BA,SAAgBC,oBACdE,SACAC,GACiB;AACjB,QAAO;EACL,GAAGF,mBAAuB;EAC1BC,QAAQE,OAAOC,gBAAgB,WAC7BH,QAAQE,OAAOC,gBAAgB,QAAQ;GACrCC,MAAM;GACNC,OAAO;GACPC,aACE;GACFC,OAAO,CAAC,KAAK,WAAW;GACxBC,MAAMX,eAAeY;GACrBC,UAAU;GACVC,SAASX,QAAQE,OAAOC,gBAAgB;GACzC;EACHH,QAAQE,OAAOC,gBAAgB,WAC7BH,QAAQE,OAAOC,gBAAgB,SAAS;GACtCC,MAAM;GACNC,OAAO;GACPC,aACE;GACFC,OAAO,CAAC,cAAc;GACtBC,MAAMX,eAAeY;GACrBC,UAAU;GACVC,SAAS;GACTC,cAAc;GACf;EACJ,CAACC,OAAOC,QAAQ"}
1
+ {"version":3,"file":"get-default-options.mjs","names":["ReflectionKind","getDefaultOptions","getDefaultOptionsBase","context","_","config","interactive","name","title","description","alias","kind","boolean","optional","default","isNegativeOf","filter","Boolean"],"sources":["../../src/helpers/get-default-options.ts"],"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 { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport type { CommandBase, CommandOption } from \"@shell-shock/core\";\nimport { getDefaultOptions as getDefaultOptionsBase } from \"@shell-shock/preset-script/helpers/get-default-options\";\nimport type { CLIPresetContext } from \"../types\";\n\n/**\n * Get the default command options.\n *\n * @param context - The build context.\n * @param _ - The command input.\n * @returns The default command options.\n */\nexport function getDefaultOptions(\n context: CLIPresetContext,\n _: CommandBase\n): CommandOption[] {\n return [\n ...getDefaultOptionsBase(),\n context.config.interactive !== \"never\" &&\n context.config.interactive !== true && {\n name: \"interactive\",\n title: \"Interactive\",\n description:\n \"Enable interactive mode - will be set to false if running in a CI pipeline.\",\n alias: [\"i\", \"interact\"],\n kind: ReflectionKind.boolean,\n optional: true,\n default: context.config.interactive !== false\n },\n context.config.interactive !== \"never\" &&\n context.config.interactive !== false && {\n name: \"no-interactive\",\n title: \"Non-Interactive\",\n description:\n \"Disable interactive mode - will be set to true if running in a CI pipeline.\",\n alias: [\"no-interact\"],\n kind: ReflectionKind.boolean,\n optional: true,\n default: false,\n isNegativeOf: \"interactive\"\n }\n ].filter(Boolean) as CommandOption[];\n}\n"],"mappings":";;;;;;;;;;;AA8BA,SAAgBC,oBACdE,SACAC,GACiB;AACjB,QAAO;EACL,GAAGF,mBAAuB;EAC1BC,QAAQE,OAAOC,gBAAgB,WAC7BH,QAAQE,OAAOC,gBAAgB,QAAQ;GACrCC,MAAM;GACNC,OAAO;GACPC,aACE;GACFC,OAAO,CAAC,KAAK,WAAW;GACxBC,MAAMX,eAAeY;GACrBC,UAAU;GACVC,SAASX,QAAQE,OAAOC,gBAAgB;GACzC;EACHH,QAAQE,OAAOC,gBAAgB,WAC7BH,QAAQE,OAAOC,gBAAgB,SAAS;GACtCC,MAAM;GACNC,OAAO;GACPC,aACE;GACFC,OAAO,CAAC,cAAc;GACtBC,MAAMX,eAAeY;GACrBC,UAAU;GACVC,SAAS;GACTC,cAAc;GACf;EACJ,CAACC,OAAOC,QAAQ"}
package/dist/index.cjs CHANGED
@@ -1,22 +1,20 @@
1
1
  Object.defineProperty(exports, '__esModule', { value: true });
2
2
  const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
3
- const require_components_banner = require('./components/banner.cjs');
4
- require('./components/index.cjs');
3
+ const require_components_banner_function_declaration = require('./components/banner-function-declaration.cjs');
4
+ const require_components_virtual_command_entry = require('./components/virtual-command-entry.cjs');
5
+ const require_components_command_entry = require('./components/command-entry.cjs');
5
6
  const require_get_default_options = require('./helpers/get-default-options.cjs');
6
7
  let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
7
8
  let __alloy_js_core = require("@alloy-js/core");
8
9
  let __alloy_js_typescript = require("@alloy-js/typescript");
9
10
  let __powerlines_plugin_alloy_render = require("@powerlines/plugin-alloy/render");
10
- let __shell_shock_core_plugin_utils_context_helpers = require("@shell-shock/core/plugin-utils/context-helpers");
11
11
  let __shell_shock_plugin_theme = require("@shell-shock/plugin-theme");
12
12
  __shell_shock_plugin_theme = require_rolldown_runtime.__toESM(__shell_shock_plugin_theme);
13
13
  let __shell_shock_preset_script_components_bin_entry = require("@shell-shock/preset-script/components/bin-entry");
14
- let __shell_shock_preset_script_components_command_entry = require("@shell-shock/preset-script/components/command-entry");
15
14
  let __shell_shock_preset_script_components_command_router = require("@shell-shock/preset-script/components/command-router");
16
15
  let __shell_shock_preset_script_components_console_builtin = require("@shell-shock/preset-script/components/console-builtin");
17
16
  let __shell_shock_preset_script_components_help = require("@shell-shock/preset-script/components/help");
18
17
  let __shell_shock_preset_script_components_utils_builtin = require("@shell-shock/preset-script/components/utils-builtin");
19
- let __shell_shock_preset_script_components_virtual_command_entry = require("@shell-shock/preset-script/components/virtual-command-entry");
20
18
 
21
19
  //#region src/index.tsx
22
20
  /**
@@ -40,9 +38,7 @@ const plugin = (options = {}) => {
40
38
  },
41
39
  async prepare() {
42
40
  this.debug("Rendering built-in modules for the Shell Shock `cli` preset.");
43
- return (0, __powerlines_plugin_alloy_render.render)(this, [(0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_utils_builtin.UtilsBuiltin, {}), (0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_console_builtin.ConsoleBuiltin, { get banner() {
44
- return (0, __alloy_js_core_jsx_runtime.createComponent)(require_components_banner.BannerFunctionDeclaration, {});
45
- } })]);
41
+ return (0, __powerlines_plugin_alloy_render.render)(this, [(0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_utils_builtin.UtilsBuiltin, {}), (0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_console_builtin.ConsoleBuiltin, {})]);
46
42
  }
47
43
  },
48
44
  {
@@ -56,12 +52,21 @@ const plugin = (options = {}) => {
56
52
  builtinImports: {
57
53
  console: [
58
54
  "divider",
55
+ "stripAnsi",
59
56
  "writeLine",
57
+ "splitText",
60
58
  "colors",
61
- "banner",
62
59
  "help"
63
60
  ],
64
- utils: ["getArgs"]
61
+ utils: ["getArgs", "isMinimal"],
62
+ env: ["isCI"]
63
+ },
64
+ get prefix() {
65
+ return [
66
+ (0, __alloy_js_core_jsx_runtime.createComponent)(require_components_banner_function_declaration.BannerFunctionDeclaration, {}),
67
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
68
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
69
+ ];
65
70
  },
66
71
  get children() {
67
72
  return [
@@ -89,55 +94,16 @@ const plugin = (options = {}) => {
89
94
  }
90
95
  }),
91
96
  (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
92
- __alloy_js_core.code`
93
- writeLine("");
94
- banner();
95
- writeLine(""); `,
97
+ __alloy_js_core.code`writeLine("");
98
+ banner();`,
96
99
  (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
97
100
  (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
98
- __alloy_js_core.code`writeLine(colors.text.heading.secondary("Global Options:"));`,
99
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
100
- (0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_help.HelpOptions, { get options() {
101
- return _self$.options;
102
- } }),
103
- __alloy_js_core.code`writeLine(""); `,
104
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
105
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
106
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
107
- get when() {
108
- return Object.keys(_self$.commands).length > 0;
101
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_help.VirtualHelp, {
102
+ get options() {
103
+ return _self$.options;
109
104
  },
110
- get children() {
111
- return [
112
- __alloy_js_core.code`writeLine(colors.text.body.secondary("The following commands are available:"));
113
- writeLine(""); `,
114
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
115
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
116
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
117
- get each() {
118
- return Object.values(_self$.commands);
119
- },
120
- doubleHardline: true,
121
- joiner: __alloy_js_core.code`writeLine(""); `,
122
- ender: __alloy_js_core.code`writeLine(""); `,
123
- children: (child) => [
124
- (0, __alloy_js_core_jsx_runtime.memo)(() => __alloy_js_core.code`
125
- writeLine(colors.text.heading.primary("${child.title} ${child.isVirtual ? "" : "Command"}"));
126
- writeLine("");
127
- writeLine(colors.text.body.secondary("${child.description}"));
128
- writeLine("");
129
- `),
130
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
131
- (0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_help.Help, {
132
- command: child,
133
- indent: 2
134
- }),
135
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
136
- ]
137
- }),
138
- (0, __alloy_js_core_jsx_runtime.memo)(() => __alloy_js_core.code`help("Running a specific command with the help flag (via: '${(0, __shell_shock_core_plugin_utils_context_helpers.getAppBin)(_self$)} <specific command> --help') will provide additional information that is specific to that command.");
139
- writeLine("");`)
140
- ];
105
+ get commands() {
106
+ return _self$.commands ?? {};
141
107
  }
142
108
  })
143
109
  ];
@@ -157,10 +123,10 @@ const plugin = (options = {}) => {
157
123
  return child.isVirtual;
158
124
  },
159
125
  get fallback() {
160
- return (0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_command_entry.CommandEntry, { command: child });
126
+ return (0, __alloy_js_core_jsx_runtime.createComponent)(require_components_command_entry.CommandEntry, { command: child });
161
127
  },
162
128
  get children() {
163
- return (0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_virtual_command_entry.VirtualCommandEntry, { command: child });
129
+ return (0, __alloy_js_core_jsx_runtime.createComponent)(require_components_virtual_command_entry.VirtualCommandEntry, { command: child });
164
130
  }
165
131
  })
166
132
  });
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"sourcesContent":[],"mappings":";;;;;;;AAsCA;AAAwC,cAA3B,MAA2B,EAAA,CAAA,iBAAA,gBAAA,GAAmB,gBAAnB,CAAA,CAAA,OAAA,CAAA,EAC7B,gBAD6B,EAAA,GA4HjC,MA5HiC,CA4H1B,QA5H0B,CAAA,EAAA"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"sourcesContent":[],"mappings":";;;;;;;AAqCA;AAAwC,cAA3B,MAA2B,EAAA,CAAA,iBAAA,gBAAA,GAAmB,gBAAnB,CAAA,CAAA,OAAA,CAAA,EAC7B,gBAD6B,EAAA,GA0GjC,MA1GiC,CA0G1B,QA1G0B,CAAA,EAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"sourcesContent":[],"mappings":";;;;;;;AAsCA;AAAwC,cAA3B,MAA2B,EAAA,CAAA,iBAAA,gBAAA,GAAmB,gBAAnB,CAAA,CAAA,OAAA,CAAA,EAC7B,gBAD6B,EAAA,GA4HjC,MA5HiC,CA4H1B,QA5H0B,CAAA,EAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"sourcesContent":[],"mappings":";;;;;;;AAqCA;AAAwC,cAA3B,MAA2B,EAAA,CAAA,iBAAA,gBAAA,GAAmB,gBAAnB,CAAA,CAAA,OAAA,CAAA,EAC7B,gBAD6B,EAAA,GA0GjC,MA1GiC,CA0G1B,QA1G0B,CAAA,EAAA"}
package/dist/index.mjs CHANGED
@@ -1,19 +1,17 @@
1
- import { BannerFunctionDeclaration } from "./components/banner.mjs";
2
- import "./components/index.mjs";
1
+ import { BannerFunctionDeclaration } from "./components/banner-function-declaration.mjs";
2
+ import { VirtualCommandEntry } from "./components/virtual-command-entry.mjs";
3
+ import { CommandEntry } from "./components/command-entry.mjs";
3
4
  import { getDefaultOptions } from "./helpers/get-default-options.mjs";
4
- import { createComponent, createIntrinsic, memo } from "@alloy-js/core/jsx-runtime";
5
+ import { createComponent, createIntrinsic } from "@alloy-js/core/jsx-runtime";
5
6
  import { For, Show, code } from "@alloy-js/core";
6
7
  import { VarDeclaration } from "@alloy-js/typescript";
7
8
  import { render } from "@powerlines/plugin-alloy/render";
8
- import { getAppBin } from "@shell-shock/core/plugin-utils/context-helpers";
9
9
  import theme from "@shell-shock/plugin-theme";
10
10
  import { BinEntry } from "@shell-shock/preset-script/components/bin-entry";
11
- import { CommandEntry } from "@shell-shock/preset-script/components/command-entry";
12
11
  import { CommandRouter } from "@shell-shock/preset-script/components/command-router";
13
12
  import { ConsoleBuiltin } from "@shell-shock/preset-script/components/console-builtin";
14
- import { Help, HelpOptions } from "@shell-shock/preset-script/components/help";
13
+ import { VirtualHelp } from "@shell-shock/preset-script/components/help";
15
14
  import { UtilsBuiltin } from "@shell-shock/preset-script/components/utils-builtin";
16
- import { VirtualCommandEntry } from "@shell-shock/preset-script/components/virtual-command-entry";
17
15
 
18
16
  //#region src/index.tsx
19
17
  /**
@@ -37,9 +35,7 @@ const plugin = (options = {}) => {
37
35
  },
38
36
  async prepare() {
39
37
  this.debug("Rendering built-in modules for the Shell Shock `cli` preset.");
40
- return render(this, [createComponent(UtilsBuiltin, {}), createComponent(ConsoleBuiltin, { get banner() {
41
- return createComponent(BannerFunctionDeclaration, {});
42
- } })]);
38
+ return render(this, [createComponent(UtilsBuiltin, {}), createComponent(ConsoleBuiltin, {})]);
43
39
  }
44
40
  },
45
41
  {
@@ -53,12 +49,21 @@ const plugin = (options = {}) => {
53
49
  builtinImports: {
54
50
  console: [
55
51
  "divider",
52
+ "stripAnsi",
56
53
  "writeLine",
54
+ "splitText",
57
55
  "colors",
58
- "banner",
59
56
  "help"
60
57
  ],
61
- utils: ["getArgs"]
58
+ utils: ["getArgs", "isMinimal"],
59
+ env: ["isCI"]
60
+ },
61
+ get prefix() {
62
+ return [
63
+ createComponent(BannerFunctionDeclaration, {}),
64
+ createIntrinsic("hbr", {}),
65
+ createIntrinsic("hbr", {})
66
+ ];
62
67
  },
63
68
  get children() {
64
69
  return [
@@ -86,55 +91,16 @@ const plugin = (options = {}) => {
86
91
  }
87
92
  }),
88
93
  createIntrinsic("hbr", {}),
89
- code`
90
- writeLine("");
91
- banner();
92
- writeLine(""); `,
94
+ code`writeLine("");
95
+ banner();`,
93
96
  createIntrinsic("hbr", {}),
94
97
  createIntrinsic("hbr", {}),
95
- code`writeLine(colors.text.heading.secondary("Global Options:"));`,
96
- createIntrinsic("hbr", {}),
97
- createComponent(HelpOptions, { get options() {
98
- return _self$.options;
99
- } }),
100
- code`writeLine(""); `,
101
- createIntrinsic("hbr", {}),
102
- createIntrinsic("hbr", {}),
103
- createComponent(Show, {
104
- get when() {
105
- return Object.keys(_self$.commands).length > 0;
98
+ createComponent(VirtualHelp, {
99
+ get options() {
100
+ return _self$.options;
106
101
  },
107
- get children() {
108
- return [
109
- code`writeLine(colors.text.body.secondary("The following commands are available:"));
110
- writeLine(""); `,
111
- createIntrinsic("hbr", {}),
112
- createIntrinsic("hbr", {}),
113
- createComponent(For, {
114
- get each() {
115
- return Object.values(_self$.commands);
116
- },
117
- doubleHardline: true,
118
- joiner: code`writeLine(""); `,
119
- ender: code`writeLine(""); `,
120
- children: (child) => [
121
- memo(() => code`
122
- writeLine(colors.text.heading.primary("${child.title} ${child.isVirtual ? "" : "Command"}"));
123
- writeLine("");
124
- writeLine(colors.text.body.secondary("${child.description}"));
125
- writeLine("");
126
- `),
127
- createIntrinsic("hbr", {}),
128
- createComponent(Help, {
129
- command: child,
130
- indent: 2
131
- }),
132
- createIntrinsic("hbr", {})
133
- ]
134
- }),
135
- memo(() => code`help("Running a specific command with the help flag (via: '${getAppBin(_self$)} <specific command> --help') will provide additional information that is specific to that command.");
136
- writeLine("");`)
137
- ];
102
+ get commands() {
103
+ return _self$.commands ?? {};
138
104
  }
139
105
  })
140
106
  ];
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["code","For","Show","VarDeclaration","render","getAppBin","theme","BinEntry","CommandEntry","CommandRouter","ConsoleBuiltin","Help","HelpOptions","UtilsBuiltin","VirtualCommandEntry","BannerFunctionDeclaration","getDefaultOptions","plugin","options","name","config","debug","defaultOptions","isCaseSensitive","configResolved","dependencies","didyoumean2","prepare","_$createComponent","banner","order","handler","_self$","builtinImports","console","utils","children","when","Object","keys","commands","length","type","initializer","_$createIntrinsic","path","each","values","doubleHardline","joiner","ender","child","_$memo","title","isVirtual","description","command","indent","fallback"],"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 { getAppBin } from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport theme from \"@shell-shock/plugin-theme\";\nimport { BinEntry } from \"@shell-shock/preset-script/components/bin-entry\";\nimport { CommandEntry } from \"@shell-shock/preset-script/components/command-entry\";\nimport { CommandRouter } from \"@shell-shock/preset-script/components/command-router\";\nimport { ConsoleBuiltin } from \"@shell-shock/preset-script/components/console-builtin\";\nimport { Help, HelpOptions } from \"@shell-shock/preset-script/components/help\";\nimport { UtilsBuiltin } from \"@shell-shock/preset-script/components/utils-builtin\";\nimport { VirtualCommandEntry } from \"@shell-shock/preset-script/components/virtual-command-entry\";\nimport type { Plugin } from \"powerlines/types/plugin\";\nimport { BannerFunctionDeclaration } from \"./components\";\nimport { getDefaultOptions } from \"./helpers/get-default-options\";\nimport type { CLIPresetContext, CLIPresetOptions } from \"./types/plugin\";\n\n/**\n * The Shell Shock base plugin.\n */\nexport const plugin = <TContext extends CLIPresetContext = CLIPresetContext>(\n options: CLIPresetOptions = {}\n) => {\n return [\n theme({\n theme: options.theme\n }),\n {\n name: \"shell-shock:cli-preset\",\n config() {\n this.debug(\n \"Providing default configuration for the Shell Shock `cli` 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 async prepare() {\n this.debug(\n \"Rendering built-in modules for the Shell Shock `cli` preset.\"\n );\n\n return render(\n this,\n <>\n <UtilsBuiltin />\n <ConsoleBuiltin banner={<BannerFunctionDeclaration />} />\n </>\n );\n }\n },\n {\n name: \"shell-shock:cli-preset:generate-entrypoint\",\n prepare: {\n order: \"post\",\n async handler() {\n this.debug(\n \"Rendering entrypoint modules for the Shell Shock `cli` preset.\"\n );\n\n return render(\n this,\n <>\n <BinEntry\n builtinImports={{\n console: [\"divider\", \"writeLine\", \"colors\", \"banner\", \"help\"],\n utils: [\"getArgs\"]\n }}>\n <Show when={Object.keys(this.commands).length > 0}>\n <VarDeclaration\n const\n name=\"args\"\n type=\"string[]\"\n initializer={code`getArgs();`}\n />\n <hbr />\n <CommandRouter path={[]} commands={this.commands ?? {}} />\n <hbr />\n </Show>\n <hbr />\n {code`\n writeLine(\"\");\n banner();\n writeLine(\"\"); `}\n <hbr />\n <hbr />\n {code`writeLine(colors.text.heading.secondary(\"Global Options:\"));`}\n <hbr />\n <HelpOptions options={this.options} />\n {code`writeLine(\"\"); `}\n <hbr />\n <hbr />\n <Show when={Object.keys(this.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(this.commands)}\n doubleHardline\n joiner={code`writeLine(\"\"); `}\n ender={code`writeLine(\"\"); `}>\n {child => (\n <>\n {code`\n writeLine(colors.text.heading.primary(\"${child.title} ${child.isVirtual ? \"\" : \"Command\"}\"));\n writeLine(\"\");\n writeLine(colors.text.body.secondary(\"${child.description}\"));\n writeLine(\"\");\n `}\n <hbr />\n <Help command={child} indent={2} />\n <hbr />\n </>\n )}\n </For>\n {code`help(\"Running a specific command with the help flag (via: '${getAppBin(\n this\n )} <specific command> --help') will provide additional information that is specific to that command.\");\n writeLine(\"\");`}\n </Show>\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":";;;;;;;;;;;;;;;;;;;;;AAsCA,MAAaiB,UACXC,UAA4B,EAAE,KAC3B;AACH,QAAO;EACLZ,MAAM,EACJA,OAAOY,QAAQZ,OAChB,CAAC;EACF;GACEa,MAAM;GACNC,SAAS;AACP,SAAKC,MACH,oEACD;AAED,WAAO;KACLC,gBAAgBN;KAChBO,iBAAiB;KACjB,GAAGL;KACJ;;GAEHM,iBAAiB;AACf,SAAKC,aAAaC,cAAc;;GAElC,MAAMC,UAAU;AACd,SAAKN,MACH,+DACD;AAED,WAAOjB,OACL,MAAI,CAAAwB,gBAEDf,cAAY,EAAA,CAAA,EAAAe,gBACZlB,gBAAc,EAAA,IAACmB,SAAM;AAAA,YAAAD,gBAAGb,2BAAyB,EAAA,CAAA;OAAA,CAAA,CAEtD,CAAC;;GAEJ;EACD;GACEI,MAAM;GACNQ,SAAS;IACPG,OAAO;IACP,MAAMC,UAAU;KAAA,MAAAC,SAAA;AACd,UAAKX,MACH,iEACD;AAED,YAAOjB,OACL,MAAI,CAAAwB,gBAEDrB,UAAQ;MACP0B,gBAAgB;OACdC,SAAS;QAAC;QAAW;QAAa;QAAU;QAAU;QAAO;OAC7DC,OAAO,CAAC,UAAS;OAClB;MAAA,IAAAC,WAAA;AAAA,cAAA;QAAAR,gBACA1B,MAAI;SAAA,IAACmC,OAAI;AAAA,iBAAEC,OAAOC,KAAKP,OAAKQ,SAAS,CAACC,SAAS;;SAAC,IAAAL,WAAA;AAAA,iBAAA;WAAAR,gBAC9CzB,gBAAc;YAAA,SAAA;YAEbgB,MAAI;YACJuB,MAAI;YACJC,aAAa3C,IAAI;YAAY,CAAA;WAAA4C,gBAAA,OAAA,EAAA,CAAA;WAAAhB,gBAG9BnB,eAAa;YAACoC,MAAM,EAAE;YAAA,IAAEL,WAAQ;AAAA,oBAAER,OAAKQ,YAAY,EAAE;;YAAA,CAAA;WAAAI,gBAAA,OAAA,EAAA,CAAA;WAAA;;SAAA,CAAA;QAAAA,gBAAA,OAAA,EAAA,CAAA;QAIvD5C,IAAI;;;;QAGW4C,gBAAA,OAAA,EAAA,CAAA;QAAAA,gBAAA,OAAA,EAAA,CAAA;QAGf5C,IAAI;QAA8D4C,gBAAA,OAAA,EAAA,CAAA;QAAAhB,gBAElEhB,aAAW,EAAA,IAACM,UAAO;AAAA,gBAAEc,OAAKd;WAAO,CAAA;QACjClB,IAAI;QAAiB4C,gBAAA,OAAA,EAAA,CAAA;QAAAA,gBAAA,OAAA,EAAA,CAAA;QAAAhB,gBAGrB1B,MAAI;SAAA,IAACmC,OAAI;AAAA,iBAAEC,OAAOC,KAAKP,OAAKQ,SAAS,CAACC,SAAS;;SAAC,IAAAL,WAAA;AAAA,iBAAA;WAC9CpC,IAAI;;WACW4C,gBAAA,OAAA,EAAA,CAAA;WAAAA,gBAAA,OAAA,EAAA,CAAA;WAAAhB,gBAGf3B,KAAG;YAAA,IACF6C,OAAI;AAAA,oBAAER,OAAOS,OAAOf,OAAKQ,SAAS;;YAClCQ,gBAAc;YACdC,QAAQjD,IAAI;YACZkD,OAAOlD,IAAI;YAAiBoC,WAC3Be,UAAK;aAAAC,WAEDpD,IAAI;yDAC4BmD,MAAME,MAAK,GAAIF,MAAMG,YAAY,KAAK,UAAS;;wDAEhDH,MAAMI,YAAW;;kBAExD;aAAAX,gBAAA,OAAA,EAAA,CAAA;aAAAhB,gBAEQjB,MAAI;cAAC6C,SAASL;cAAOM,QAAQ;cAAC,CAAA;aAAAb,gBAAA,OAAA,EAAA,CAAA;aAAA;YAGlC,CAAA;WAAAQ,WAEFpD,IAAI,8DAA8DK,UAAS2B,OAE3E,CAAA;kCACc;WAAA;;SAAA,CAAA;QAAA;;MAAA,CAAA,EAAAJ,gBAGlB1B,MAAI;MAAA,IAACmC,OAAI;AAAA,cAAEC,OAAOS,OAAOf,OAAKQ,SAAS,CAACC,SAAS;;MAAC,IAAAL,WAAA;AAAA,cAAAR,gBAChD3B,KAAG;QAAA,IAAC6C,OAAI;AAAA,gBAAER,OAAOS,OAAOf,OAAKQ,SAAS;;QAAEQ,gBAAc;QAAAZ,WACpDe,UAAKvB,gBACH1B,MAAI;SAAA,IACHmC,OAAI;AAAA,iBAAEc,MAAMG;;SAAS,IACrBI,WAAQ;AAAA,iBAAA9B,gBAAGpB,cAAY,EAACgD,SAASL,OAAK,CAAA;;SAAA,IAAAf,WAAA;AAAA,iBAAAR,gBACrCd,qBAAmB,EAAC0C,SAASL,OAAK,CAAA;;SAAA,CAAA;QAEtC,CAAA;;MAAA,CAAA,CAIT,CAAC;;IAEL;GACD;EACF;;AAGH,kBAAelC"}
1
+ {"version":3,"file":"index.mjs","names":["code","For","Show","VarDeclaration","render","theme","BinEntry","CommandRouter","ConsoleBuiltin","VirtualHelp","UtilsBuiltin","BannerFunctionDeclaration","CommandEntry","VirtualCommandEntry","getDefaultOptions","plugin","options","name","config","debug","defaultOptions","isCaseSensitive","configResolved","dependencies","didyoumean2","prepare","_$createComponent","order","handler","_self$","builtinImports","console","utils","env","prefix","_$createIntrinsic","children","when","Object","keys","commands","length","type","initializer","path","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 theme from \"@shell-shock/plugin-theme\";\nimport { BinEntry } from \"@shell-shock/preset-script/components/bin-entry\";\nimport { CommandRouter } from \"@shell-shock/preset-script/components/command-router\";\nimport { ConsoleBuiltin } from \"@shell-shock/preset-script/components/console-builtin\";\nimport { VirtualHelp } from \"@shell-shock/preset-script/components/help\";\nimport { UtilsBuiltin } from \"@shell-shock/preset-script/components/utils-builtin\";\nimport type { Plugin } from \"powerlines/types/plugin\";\nimport { BannerFunctionDeclaration } from \"./components/banner-function-declaration\";\nimport { CommandEntry } from \"./components/command-entry\";\nimport { VirtualCommandEntry } from \"./components/virtual-command-entry\";\nimport { getDefaultOptions } from \"./helpers/get-default-options\";\nimport type { CLIPresetContext, CLIPresetOptions } from \"./types/plugin\";\n\n/**\n * The Shell Shock base plugin.\n */\nexport const plugin = <TContext extends CLIPresetContext = CLIPresetContext>(\n options: CLIPresetOptions = {}\n) => {\n return [\n theme({\n theme: options.theme\n }),\n {\n name: \"shell-shock:cli-preset\",\n config() {\n this.debug(\n \"Providing default configuration for the Shell Shock `cli` 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 async prepare() {\n this.debug(\n \"Rendering built-in modules for the Shell Shock `cli` preset.\"\n );\n\n return render(\n this,\n <>\n <UtilsBuiltin />\n <ConsoleBuiltin />\n </>\n );\n }\n },\n {\n name: \"shell-shock:cli-preset:generate-entrypoint\",\n prepare: {\n order: \"post\",\n async handler() {\n this.debug(\n \"Rendering entrypoint modules for the Shell Shock `cli` 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: [\"getArgs\", \"isMinimal\"],\n env: [\"isCI\"]\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`getArgs();`}\n />\n <hbr />\n <CommandRouter path={[]} commands={this.commands ?? {}} />\n <hbr />\n </Show>\n <hbr />\n {code`writeLine(\"\");\n 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":";;;;;;;;;;;;;;;;;;;AAqCA,MAAae,UACXC,UAA4B,EAAE,KAC3B;AACH,QAAO;EACLX,MAAM,EACJA,OAAOW,QAAQX,OAChB,CAAC;EACF;GACEY,MAAM;GACNC,SAAS;AACP,SAAKC,MACH,oEACD;AAED,WAAO;KACLC,gBAAgBN;KAChBO,iBAAiB;KACjB,GAAGL;KACJ;;GAEHM,iBAAiB;AACf,SAAKC,aAAaC,cAAc;;GAElC,MAAMC,UAAU;AACd,SAAKN,MACH,+DACD;AAED,WAAOf,OACL,MAAI,CAAAsB,gBAEDhB,cAAY,EAAA,CAAA,EAAAgB,gBACZlB,gBAAc,EAAA,CAAA,CAEnB,CAAC;;GAEJ;EACD;GACES,MAAM;GACNQ,SAAS;IACPE,OAAO;IACP,MAAMC,UAAU;KAAA,MAAAC,SAAA;AACd,UAAKV,MACH,iEACD;AAED,YAAOf,OACL,MAAI,CAAAsB,gBAEDpB,UAAQ;MACPwB,gBAAgB;OACdC,SAAS;QACP;QACA;QACA;QACA;QACA;QACA;QACD;OACDC,OAAO,CAAC,WAAW,YAAY;OAC/BC,KAAK,CAAC,OAAM;OACb;MAAA,IACDC,SAAM;AAAA,cAAA;QAAAR,gBAEDf,2BAAyB,EAAA,CAAA;QAAAwB,gBAAA,OAAA,EAAA,CAAA;QAAAA,gBAAA,OAAA,EAAA,CAAA;QAAA;;MAAA,IAAAC,WAAA;AAAA,cAAA;QAAAV,gBAK7BxB,MAAI;SAAA,IAACmC,OAAI;AAAA,iBAAEC,OAAOC,KAAKV,OAAKW,SAAS,CAACC,SAAS;;SAAC,IAAAL,WAAA;AAAA,iBAAA;WAAAV,gBAC9CvB,gBAAc;YAAA,SAAA;YAEbc,MAAI;YACJyB,MAAI;YACJC,aAAa3C,IAAI;YAAY,CAAA;WAAAmC,gBAAA,OAAA,EAAA,CAAA;WAAAT,gBAG9BnB,eAAa;YAACqC,MAAM,EAAE;YAAA,IAAEJ,WAAQ;AAAA,oBAAEX,OAAKW,YAAY,EAAE;;YAAA,CAAA;WAAAL,gBAAA,OAAA,EAAA,CAAA;WAAA;;SAAA,CAAA;QAAAA,gBAAA,OAAA,EAAA,CAAA;QAIvDnC,IAAI;;QACKmC,gBAAA,OAAA,EAAA,CAAA;QAAAA,gBAAA,OAAA,EAAA,CAAA;QAAAT,gBAGTjB,aAAW;SAAA,IACVO,UAAO;AAAA,iBAAEa,OAAKb;;SAAO,IACrBwB,WAAQ;AAAA,iBAAEX,OAAKW,YAAY,EAAE;;SAAA,CAAA;QAAA;;MAAA,CAAA,EAAAd,gBAGhCxB,MAAI;MAAA,IAACmC,OAAI;AAAA,cAAEC,OAAOO,OAAOhB,OAAKW,SAAS,CAACC,SAAS;;MAAC,IAAAL,WAAA;AAAA,cAAAV,gBAChDzB,KAAG;QAAA,IAAC6C,OAAI;AAAA,gBAAER,OAAOO,OAAOhB,OAAKW,SAAS;;QAAEO,gBAAc;QAAAX,WACpDY,UAAKtB,gBACHxB,MAAI;SAAA,IACHmC,OAAI;AAAA,iBAAEW,MAAMC;;SAAS,IACrBC,WAAQ;AAAA,iBAAAxB,gBAAGd,cAAY,EAACuC,SAASH,OAAK,CAAA;;SAAA,IAAAZ,WAAA;AAAA,iBAAAV,gBACrCb,qBAAmB,EAACsC,SAASH,OAAK,CAAA;;SAAA,CAAA;QAEtC,CAAA;;MAAA,CAAA,CAIT,CAAC;;IAEL;GACD;EACF;;AAGH,kBAAejC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shell-shock/preset-cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.2",
4
4
  "type": "module",
5
5
  "description": "A package containing a Shell Shock plugin to generate source code given a list design tokens.",
6
6
  "repository": {
@@ -69,18 +69,46 @@
69
69
  "default": "./dist/components/index.mjs"
70
70
  }
71
71
  },
72
- "./components/banner": {
72
+ "./components/banner-function-declaration": {
73
73
  "require": {
74
- "types": "./dist/components/banner.d.cts",
75
- "default": "./dist/components/banner.cjs"
74
+ "types": "./dist/components/banner-function-declaration.d.cts",
75
+ "default": "./dist/components/banner-function-declaration.cjs"
76
76
  },
77
77
  "import": {
78
- "types": "./dist/components/banner.d.mts",
79
- "default": "./dist/components/banner.mjs"
78
+ "types": "./dist/components/banner-function-declaration.d.mts",
79
+ "default": "./dist/components/banner-function-declaration.mjs"
80
80
  },
81
81
  "default": {
82
- "types": "./dist/components/banner.d.mts",
83
- "default": "./dist/components/banner.mjs"
82
+ "types": "./dist/components/banner-function-declaration.d.mts",
83
+ "default": "./dist/components/banner-function-declaration.mjs"
84
+ }
85
+ },
86
+ "./components/command-entry": {
87
+ "require": {
88
+ "types": "./dist/components/command-entry.d.cts",
89
+ "default": "./dist/components/command-entry.cjs"
90
+ },
91
+ "import": {
92
+ "types": "./dist/components/command-entry.d.mts",
93
+ "default": "./dist/components/command-entry.mjs"
94
+ },
95
+ "default": {
96
+ "types": "./dist/components/command-entry.d.mts",
97
+ "default": "./dist/components/command-entry.mjs"
98
+ }
99
+ },
100
+ "./components/virtual-command-entry": {
101
+ "require": {
102
+ "types": "./dist/components/virtual-command-entry.d.cts",
103
+ "default": "./dist/components/virtual-command-entry.cjs"
104
+ },
105
+ "import": {
106
+ "types": "./dist/components/virtual-command-entry.d.mts",
107
+ "default": "./dist/components/virtual-command-entry.mjs"
108
+ },
109
+ "default": {
110
+ "types": "./dist/components/virtual-command-entry.d.mts",
111
+ "default": "./dist/components/virtual-command-entry.mjs"
84
112
  }
85
113
  },
86
114
  "./package.json": "./package.json",
@@ -113,6 +141,7 @@
113
141
  }
114
142
  }
115
143
  },
144
+ "types": "./dist/index.d.cts",
116
145
  "typings": "dist/index.d.mts",
117
146
  "files": ["dist/**/*"],
118
147
  "keywords": [
@@ -122,17 +151,19 @@
122
151
  "storm-software"
123
152
  ],
124
153
  "dependencies": {
125
- "@alloy-js/core": "0.22.0",
154
+ "@alloy-js/core": "^0.22.0",
126
155
  "@alloy-js/typescript": "^0.22.0",
127
- "@powerlines/deepkit": "^0.6.47",
128
- "@powerlines/plugin-alloy": "^0.20.10",
129
- "@powerlines/plugin-plugin": "^0.12.218",
130
- "@shell-shock/core": "^0.4.4",
131
- "@shell-shock/plugin-theme": "^0.0.12",
132
- "@shell-shock/preset-script": "^0.3.2",
133
- "@stryke/string-format": "^0.13.7",
156
+ "@powerlines/deepkit": "^0.6.50",
157
+ "@powerlines/plugin-alloy": "^0.20.14",
158
+ "@powerlines/plugin-plugin": "^0.12.221",
159
+ "@shell-shock/core": "^0.5.1",
160
+ "@shell-shock/plugin-theme": "^0.0.14",
161
+ "@shell-shock/preset-script": "^0.4.0",
162
+ "@stryke/path": "0.26.4",
163
+ "@stryke/string-format": "0.13.7",
134
164
  "cfonts": "^3.3.1",
135
- "powerlines": "^0.38.34"
165
+ "defu": "6.1.4",
166
+ "powerlines": "^0.38.37"
136
167
  },
137
168
  "devDependencies": {
138
169
  "@babel/core": "^7.29.0",
@@ -162,6 +193,5 @@
162
193
  "./package.json": "./package.json"
163
194
  }
164
195
  },
165
- "types": "./dist/index.d.cts",
166
- "gitHead": "2905cdd0c86c5c4f8b4205e82fd180ee0b97351e"
196
+ "gitHead": "b2c853aae1d2d29bd12900d7850f8742382816ed"
167
197
  }