@shell-shock/preset-script 0.2.0 → 0.2.1

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 (36) hide show
  1. package/README.md +2 -2
  2. package/dist/components/args-parser-logic.d.cts +7 -7
  3. package/dist/components/args-parser-logic.d.cts.map +1 -1
  4. package/dist/components/command-entry.d.cts +4 -4
  5. package/dist/components/command-router.cjs +3 -5
  6. package/dist/components/command-router.cjs.map +1 -1
  7. package/dist/components/command-router.mjs +3 -5
  8. package/dist/components/command-router.mjs.map +1 -1
  9. package/dist/components/console-builtin.cjs +69 -49
  10. package/dist/components/console-builtin.cjs.map +1 -1
  11. package/dist/components/console-builtin.d.cts.map +1 -1
  12. package/dist/components/console-builtin.d.mts.map +1 -1
  13. package/dist/components/console-builtin.mjs +69 -49
  14. package/dist/components/console-builtin.mjs.map +1 -1
  15. package/dist/components/help.cjs +33 -21
  16. package/dist/components/help.cjs.map +1 -1
  17. package/dist/components/help.d.cts +19 -11
  18. package/dist/components/help.d.cts.map +1 -1
  19. package/dist/components/help.d.mts +19 -11
  20. package/dist/components/help.d.mts.map +1 -1
  21. package/dist/components/help.mjs +34 -22
  22. package/dist/components/help.mjs.map +1 -1
  23. package/dist/components/index.d.cts +2 -2
  24. package/dist/components/index.d.mts +2 -2
  25. package/dist/components/utils-builtin.d.cts +7 -7
  26. package/dist/components/utils-builtin.d.mts +7 -7
  27. package/dist/components/virtual-command-entry.d.cts +3 -3
  28. package/dist/components/virtual-command-entry.d.cts.map +1 -1
  29. package/dist/index.cjs +91 -71
  30. package/dist/index.cjs.map +1 -1
  31. package/dist/index.d.cts.map +1 -1
  32. package/dist/index.d.mts.map +1 -1
  33. package/dist/index.mjs +92 -72
  34. package/dist/index.mjs.map +1 -1
  35. package/dist/types/plugin.d.mts.map +1 -1
  36. package/package.json +9 -9
@@ -1,4 +1,4 @@
1
- import * as _alloy_js_core18 from "@alloy-js/core";
1
+ import * as _alloy_js_core0 from "@alloy-js/core";
2
2
  import { CommandTree } from "@shell-shock/core/types/command";
3
3
  import { EntryFileProps } from "@powerlines/plugin-alloy/typescript/components/entry-file";
4
4
 
@@ -8,14 +8,14 @@ import { EntryFileProps } from "@powerlines/plugin-alloy/typescript/components/e
8
8
  */
9
9
  declare function VirtualCommandHandlerDeclaration(props: {
10
10
  command: CommandTree;
11
- }): _alloy_js_core18.Children;
11
+ }): _alloy_js_core0.Children;
12
12
  interface VirtualCommandEntryProps extends Omit<EntryFileProps, "path" | "typeDefinition"> {
13
13
  command: CommandTree;
14
14
  }
15
15
  /**
16
16
  * The virtual command entry point for the Shell Shock project.
17
17
  */
18
- declare function VirtualCommandEntry(props: VirtualCommandEntryProps): _alloy_js_core18.Children;
18
+ declare function VirtualCommandEntry(props: VirtualCommandEntryProps): _alloy_js_core0.Children;
19
19
  //#endregion
20
20
  export { VirtualCommandEntry, VirtualCommandEntryProps, VirtualCommandHandlerDeclaration };
21
21
  //# sourceMappingURL=virtual-command-entry.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"virtual-command-entry.d.cts","names":[],"sources":["../../src/components/virtual-command-entry.tsx"],"sourcesContent":[],"mappings":";;;;;;;;AAiDgB,iBAAA,gCAAA,CACL,KAAA,EAAW;EA+CL,OAAA,EA/CN,WA+CM;CACf,CAAA,EAhDoB,gBAAA,CACrB,QA+CC;AAGS,UAJM,wBAAA,SAAiC,IAIvC,CAHT,cAGS,EAAA,MAAA,GAAA,gBAAA,CAAA,CAAA;EAJuC,OAAA,EAIvC,WAJuC;;AAUlD;;;iBAAgB,mBAAA,QAA2B,2BAAwB,gBAAA,CAAA"}
1
+ {"version":3,"file":"virtual-command-entry.d.cts","names":[],"sources":["../../src/components/virtual-command-entry.tsx"],"sourcesContent":[],"mappings":";;;;;;;;AAiDgB,iBAAA,gCAAA,CACL,KAAA,EAAW;EA+CL,OAAA,EA/CN,WA+CM;CACf,CAAA,EAhDoB,eAAA,CACrB,QA+CC;AAGS,UAJM,wBAAA,SAAiC,IAIvC,CAHT,cAGS,EAAA,MAAA,GAAA,gBAAA,CAAA,CAAA;EAJuC,OAAA,EAIvC,WAJuC;;AAUlD;;;iBAAgB,mBAAA,QAA2B,2BAAwB,eAAA,CAAA"}
package/dist/index.cjs CHANGED
@@ -12,7 +12,6 @@ let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
12
12
  let __alloy_js_core = require("@alloy-js/core");
13
13
  let __alloy_js_typescript = require("@alloy-js/typescript");
14
14
  let __powerlines_plugin_alloy_render = require("@powerlines/plugin-alloy/render");
15
- let __shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
16
15
  let __shell_shock_core_plugin_utils_context_helpers = require("@shell-shock/core/plugin-utils/context-helpers");
17
16
  let __shell_shock_plugin_theme = require("@shell-shock/plugin-theme");
18
17
  __shell_shock_plugin_theme = require_rolldown_runtime.__toESM(__shell_shock_plugin_theme);
@@ -49,7 +48,6 @@ const plugin = (options = {}) => {
49
48
  async handler() {
50
49
  const _self$ = this;
51
50
  this.debug("Rendering entrypoint modules for the Shell Shock `script` preset.");
52
- const commands = this.inputs.map((input) => (0, __shell_shock_core_plugin_utils.getCommandTree)(this, input.path.segments)).filter(Boolean);
53
51
  return (0, __powerlines_plugin_alloy_render.render)(this, [(0, __alloy_js_core_jsx_runtime.createComponent)(require_components_bin_entry.BinEntry, {
54
52
  builtinImports: {
55
53
  console: [
@@ -60,85 +58,107 @@ const plugin = (options = {}) => {
60
58
  utils: ["getArgs"]
61
59
  },
62
60
  get children() {
63
- return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
64
- get when() {
65
- return (0, __alloy_js_core_jsx_runtime.memo)(() => !!_self$.commands)() && Object.keys(_self$.commands).length > 0;
66
- },
67
- get children() {
68
- return [
69
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
70
- "const": true,
71
- name: "args",
72
- type: "string[]",
73
- initializer: __alloy_js_core.code`getArgs();`
74
- }),
75
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
76
- (0, __alloy_js_core_jsx_runtime.createComponent)(require_components_command_router.CommandRouter, {
77
- path: [],
78
- get commands() {
79
- return _self$.commands ?? {};
80
- }
81
- }),
82
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
83
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
84
- (0, __alloy_js_core_jsx_runtime.memo)(() => __alloy_js_core.code`
61
+ return [
62
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
63
+ get when() {
64
+ return Object.keys(_self$.commands).length > 0;
65
+ },
66
+ get children() {
67
+ return [
68
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
69
+ "const": true,
70
+ name: "args",
71
+ type: "string[]",
72
+ initializer: __alloy_js_core.code`getArgs();`
73
+ }),
74
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
75
+ (0, __alloy_js_core_jsx_runtime.createComponent)(require_components_command_router.CommandRouter, {
76
+ path: [],
77
+ get commands() {
78
+ return _self$.commands ?? {};
79
+ }
80
+ }),
81
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
82
+ ];
83
+ }
84
+ }),
85
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
86
+ (0, __alloy_js_core_jsx_runtime.memo)(() => __alloy_js_core.code`
85
87
  writeLine("");
86
88
  writeLine(colors.text.heading.primary("${/(?:cli|command-line|command line)\s+(?:application|app)?$/.test((0, __shell_shock_core_plugin_utils_context_helpers.getAppTitle)(_self$).toLowerCase()) ? (0, __shell_shock_core_plugin_utils_context_helpers.getAppTitle)(_self$) : `${(0, __shell_shock_core_plugin_utils_context_helpers.getAppTitle)(_self$)} Command-Line Application`} v${_self$.packageJson.version}"));
87
89
  writeLine("");
88
90
  writeLine(colors.text.body.primary("${(0, __shell_shock_core_plugin_utils_context_helpers.getAppDescription)(_self$)}"));
89
- writeLine("");
90
- divider({ style: "primary" });
91
- writeLine("");
92
- writeLine("");`),
93
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
94
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
95
- (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
96
- get each() {
97
- return Object.values(commands);
98
- },
99
- doubleHardline: true,
100
- joiner: __alloy_js_core.code`
101
- writeLine("");
102
- divider({ style: "secondary" });
103
- writeLine("");
104
- writeLine("");
105
- `,
106
- children: (child) => [
107
- (0, __alloy_js_core_jsx_runtime.memo)(() => __alloy_js_core.code`
108
- writeLine("");
109
- writeLine(colors.text.heading.secondary("${child.title}"));
91
+ writeLine(""); `),
92
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
93
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
94
+ __alloy_js_core.code`writeLine(colors.text.heading.secondary("GLOBAL OPTIONS:"));`,
95
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
96
+ (0, __alloy_js_core_jsx_runtime.createComponent)(require_components_help.HelpOptions, { get options() {
97
+ return _self$.options;
98
+ } }),
99
+ __alloy_js_core.code`writeLine(""); `,
100
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
101
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
102
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
103
+ get when() {
104
+ return Object.keys(_self$.commands).length > 0;
105
+ },
106
+ get children() {
107
+ return [
108
+ __alloy_js_core.code`writeLine(colors.text.body.secondary("The following commands are available:"));
109
+ writeLine(""); `,
110
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
111
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
112
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
113
+ get each() {
114
+ return Object.values(_self$.commands);
115
+ },
116
+ doubleHardline: true,
117
+ joiner: __alloy_js_core.code`writeLine(""); `,
118
+ ender: __alloy_js_core.code`writeLine(""); `,
119
+ children: (child) => [
120
+ (0, __alloy_js_core_jsx_runtime.memo)(() => __alloy_js_core.code`
121
+ writeLine(colors.text.heading.primary("${child.title} ${child.isVirtual ? "" : "Command"}"));
110
122
  writeLine("");
111
123
  writeLine(colors.text.body.secondary("${child.description}"));
112
124
  writeLine("");
113
- writeLine("");
114
125
  `),
115
- (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
116
- (0, __alloy_js_core_jsx_runtime.createComponent)(require_components_help.Help, {
117
- command: child,
118
- indent: 2
119
- })
120
- ]
121
- })
122
- ];
123
- }
124
- });
126
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
127
+ (0, __alloy_js_core_jsx_runtime.createComponent)(require_components_help.Help, {
128
+ command: child,
129
+ indent: 2
130
+ }),
131
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
132
+ ]
133
+ })
134
+ ];
135
+ }
136
+ })
137
+ ];
125
138
  }
126
- }), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
127
- get each() {
128
- return Object.values(commands);
139
+ }), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
140
+ get when() {
141
+ return Object.values(_self$.commands).length > 0;
129
142
  },
130
- doubleHardline: true,
131
- children: (child) => (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
132
- get when() {
133
- return child.isVirtual;
134
- },
135
- get fallback() {
136
- return (0, __alloy_js_core_jsx_runtime.createComponent)(require_components_command_entry.CommandEntry, { command: child });
137
- },
138
- get children() {
139
- return (0, __alloy_js_core_jsx_runtime.createComponent)(require_components_virtual_command_entry.VirtualCommandEntry, { command: child });
140
- }
141
- })
143
+ get children() {
144
+ return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
145
+ get each() {
146
+ return Object.values(_self$.commands);
147
+ },
148
+ doubleHardline: true,
149
+ children: (child) => (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
150
+ get when() {
151
+ return child.isVirtual;
152
+ },
153
+ get fallback() {
154
+ return (0, __alloy_js_core_jsx_runtime.createComponent)(require_components_command_entry.CommandEntry, { command: child });
155
+ },
156
+ get children() {
157
+ return (0, __alloy_js_core_jsx_runtime.createComponent)(require_components_virtual_command_entry.VirtualCommandEntry, { command: child });
158
+ }
159
+ })
160
+ });
161
+ }
142
162
  })]);
143
163
  }
144
164
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["code","For","Show","VarDeclaration","render","getCommandTree","getAppDescription","getAppTitle","theme","BinEntry","CommandEntry","CommandRouter","ConsoleBuiltin","Help","UtilsBuiltin","VirtualCommandEntry","getDefaultOptions","plugin","options","name","config","debug","defaultOptions","isCaseSensitive","configResolved","dependencies","didyoumean2","prepare","_$createComponent","order","handler","_self$","commands","inputs","map","input","path","segments","filter","Boolean","builtinImports","console","utils","children","when","_$memo","Object","keys","length","type","initializer","_$createIntrinsic","test","toLowerCase","packageJson","version","each","values","doubleHardline","joiner","child","title","description","command","indent","isVirtual","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 { getCommandTree } from \"@shell-shock/core/plugin-utils\";\nimport {\n getAppDescription,\n getAppTitle\n} from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport type { CommandTree } from \"@shell-shock/core/types/command\";\nimport theme from \"@shell-shock/plugin-theme\";\nimport type { Plugin } from \"powerlines/types/plugin\";\nimport { BinEntry } from \"./components/bin-entry\";\nimport { CommandEntry } from \"./components/command-entry\";\nimport { CommandRouter } from \"./components/command-router\";\nimport { ConsoleBuiltin } from \"./components/console-builtin\";\nimport { Help } from \"./components/help\";\nimport { UtilsBuiltin } from \"./components/utils-builtin\";\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 theme({\n theme: options.theme\n }),\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 async prepare() {\n this.debug(\n \"Rendering built-in modules for the Shell Shock `script` preset.\"\n );\n\n return render(\n this,\n <>\n <UtilsBuiltin />\n <ConsoleBuiltin />\n </>\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 const commands = this.inputs\n .map(input => getCommandTree(this, input.path.segments))\n .filter(Boolean) as CommandTree[];\n\n return render(\n this,\n <>\n <BinEntry\n builtinImports={{\n console: [\"divider\", \"writeLine\", \"colors\"],\n utils: [\"getArgs\"]\n }}>\n <Show\n when={this.commands && 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 <hbr />\n {code`\n writeLine(\"\");\n writeLine(colors.text.heading.primary(\"${\n /(?:cli|command-line|command line)\\s+(?:application|app)?$/.test(\n getAppTitle(this).toLowerCase()\n )\n ? getAppTitle(this)\n : `${getAppTitle(this)} Command-Line Application`\n } v${this.packageJson.version}\"));\n writeLine(\"\");\n writeLine(colors.text.body.primary(\"${getAppDescription(\n this\n )}\"));\n writeLine(\"\");\n divider({ style: \"primary\" });\n writeLine(\"\");\n writeLine(\"\");`}\n <hbr />\n <hbr />\n <For\n each={Object.values(commands)}\n doubleHardline\n joiner={code`\n writeLine(\"\");\n divider({ style: \"secondary\" });\n writeLine(\"\");\n writeLine(\"\");\n `}>\n {child => (\n <>\n {code`\n writeLine(\"\");\n writeLine(colors.text.heading.secondary(\"${child.title}\"));\n writeLine(\"\");\n writeLine(colors.text.body.secondary(\"${child.description}\"));\n writeLine(\"\");\n writeLine(\"\");\n `}\n <hbr />\n <Help command={child} indent={2} />\n </>\n )}\n </For>\n </Show>\n </BinEntry>\n <For each={Object.values(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 </>\n );\n }\n }\n }\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA0CA,MAAaiB,UAGXC,UAA+B,EAAE,KAC9B;AACH,QAAO;0CACC,EACJV,OAAOU,QAAQV,OAChB,CAAC;EACF;GACEW,MAAM;GACNC,SAAS;AACP,SAAKC,MACH,uEACD;AAED,WAAO;KACLC,gBAAgBN;KAChBO,iBAAiB;KACjB,GAAGL;KACJ;;GAEHM,iBAAiB;AACf,SAAKC,aAAaC,cAAc;;GAElC,MAAMC,UAAU;AACd,SA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AQ3D,oBAAI;;;;;;WAKf2C,WACIiB,UAAK;wDAED5D,oBAAI;;2DAE8B4D,MAAMC,MAAK;;wDAEdD,MAAME,YAAW;;;kBAGxD;6DAAA,OAAA,EAAA,CAAA;6DAEQjD,8BAAI;aAACkD,SAASH;aAAOI,QAAQ;aAAC,CAAA;YAAA;WAElC,CAAA;UAAA;;QAAA,CAAA;;MAAA,CAAA,mDAIN/D,qBAAG;MAAA,IAACuD,OAAI;AAAA,cAAEV,OAAOW,OAAOzB,SAAS;;MAAE0B,gBAAc;MAAAf,WAC/CiB,2DACE1D,sBAAI;OAAA,IACH0C,OAAI;AAAA,eAAEgB,MAAMK;;OAAS,IACrBC,WAAQ;AAAA,gEAAGxD,+CAAY,EAACqD,SAASH,OAAK,CAAA;;OAAA,IAAAjB,WAAA;AAAA,gEACrC5B,8DAAmB,EAACgD,SAASH,OAAK,CAAA;;OAAA,CAAA;MAEtC,CAAA,CAGP,CAAC;;IAEL;GACD;EACF;;AAGH,kBAAe3C"}
1
+ {"version":3,"file":"index.cjs","names":["code","For","Show","VarDeclaration","render","getAppDescription","getAppTitle","theme","BinEntry","CommandEntry","CommandRouter","ConsoleBuiltin","Help","HelpOptions","UtilsBuiltin","VirtualCommandEntry","getDefaultOptions","plugin","options","name","config","debug","defaultOptions","isCaseSensitive","configResolved","dependencies","didyoumean2","prepare","_$createComponent","order","handler","_self$","builtinImports","console","utils","children","when","Object","keys","commands","length","type","initializer","_$createIntrinsic","path","_$memo","test","toLowerCase","packageJson","version","each","values","doubleHardline","joiner","ender","child","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 {\n getAppDescription,\n getAppTitle\n} from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport theme from \"@shell-shock/plugin-theme\";\nimport type { Plugin } from \"powerlines/types/plugin\";\nimport { BinEntry } from \"./components/bin-entry\";\nimport { CommandEntry } from \"./components/command-entry\";\nimport { CommandRouter } from \"./components/command-router\";\nimport { ConsoleBuiltin } from \"./components/console-builtin\";\nimport { Help, HelpOptions } from \"./components/help\";\nimport { UtilsBuiltin } from \"./components/utils-builtin\";\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 theme({\n theme: options.theme\n }),\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 async prepare() {\n this.debug(\n \"Rendering built-in modules for the Shell Shock `script` preset.\"\n );\n\n return render(\n this,\n <>\n <UtilsBuiltin />\n <ConsoleBuiltin />\n </>\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: [\"divider\", \"writeLine\", \"colors\"],\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 writeLine(colors.text.heading.primary(\"${\n /(?:cli|command-line|command line)\\s+(?:application|app)?$/.test(\n getAppTitle(this).toLowerCase()\n )\n ? getAppTitle(this)\n : `${getAppTitle(this)} Command-Line Application`\n } v${this.packageJson.version}\"));\n writeLine(\"\");\n writeLine(colors.text.body.primary(\"${getAppDescription(\n this\n )}\"));\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 </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":";;;;;;;;;;;;;;;;;;;;;;AAwCA,MAAaiB,UAGXC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mB,EAAC4C,SAASJ,OAAK,CAAA;;SAAA,CAAA;QAEtC,CAAA;;MAAA,CAAA,CAIT,CAAC;;IAEL;GACD;EACF;;AAGH,kBAAetC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"sourcesContent":[],"mappings":";;;;;;;AA0CA;AACmB,cADN,MACM,EAAA,CAAA,iBAAA,mBAAA,GAAsB,mBAAtB,CAAA,CAAA,OAAA,CAAA,EAER,mBAFQ,EAAA,GAkIZ,MAlIY,CAkIL,QAlIK,CAAA,EAAA"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"sourcesContent":[],"mappings":";;;;;;;AAwCA;AACmB,cADN,MACM,EAAA,CAAA,iBAAA,mBAAA,GAAsB,mBAAtB,CAAA,CAAA,OAAA,CAAA,EAER,mBAFQ,EAAA,GAmIZ,MAnIY,CAmIL,QAnIK,CAAA,EAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"sourcesContent":[],"mappings":";;;;;;;AA0CA;AACmB,cADN,MACM,EAAA,CAAA,iBAAA,mBAAA,GAAsB,mBAAtB,CAAA,CAAA,OAAA,CAAA,EAER,mBAFQ,EAAA,GAkIZ,MAlIY,CAkIL,QAlIK,CAAA,EAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"sourcesContent":[],"mappings":";;;;;;;AAwCA;AACmB,cADN,MACM,EAAA,CAAA,iBAAA,mBAAA,GAAsB,mBAAtB,CAAA,CAAA,OAAA,CAAA,EAER,mBAFQ,EAAA,GAmIZ,MAnIY,CAmIL,QAnIK,CAAA,EAAA"}
package/dist/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  import { BinEntry } from "./components/bin-entry.mjs";
2
- import { Help } from "./components/help.mjs";
2
+ import { Help, HelpOptions } from "./components/help.mjs";
3
3
  import { CommandRouter } from "./components/command-router.mjs";
4
4
  import { VirtualCommandEntry } from "./components/virtual-command-entry.mjs";
5
5
  import { CommandEntry } from "./components/command-entry.mjs";
@@ -10,7 +10,6 @@ import { createComponent, createIntrinsic, memo } from "@alloy-js/core/jsx-runti
10
10
  import { For, Show, code } from "@alloy-js/core";
11
11
  import { VarDeclaration } from "@alloy-js/typescript";
12
12
  import { render } from "@powerlines/plugin-alloy/render";
13
- import { getCommandTree } from "@shell-shock/core/plugin-utils";
14
13
  import { getAppDescription, getAppTitle } from "@shell-shock/core/plugin-utils/context-helpers";
15
14
  import theme from "@shell-shock/plugin-theme";
16
15
 
@@ -46,7 +45,6 @@ const plugin = (options = {}) => {
46
45
  async handler() {
47
46
  const _self$ = this;
48
47
  this.debug("Rendering entrypoint modules for the Shell Shock `script` preset.");
49
- const commands = this.inputs.map((input) => getCommandTree(this, input.path.segments)).filter(Boolean);
50
48
  return render(this, [createComponent(BinEntry, {
51
49
  builtinImports: {
52
50
  console: [
@@ -57,85 +55,107 @@ const plugin = (options = {}) => {
57
55
  utils: ["getArgs"]
58
56
  },
59
57
  get children() {
60
- return createComponent(Show, {
61
- get when() {
62
- return memo(() => !!_self$.commands)() && Object.keys(_self$.commands).length > 0;
63
- },
64
- get children() {
65
- return [
66
- createComponent(VarDeclaration, {
67
- "const": true,
68
- name: "args",
69
- type: "string[]",
70
- initializer: code`getArgs();`
71
- }),
72
- createIntrinsic("hbr", {}),
73
- createComponent(CommandRouter, {
74
- path: [],
75
- get commands() {
76
- return _self$.commands ?? {};
77
- }
78
- }),
79
- createIntrinsic("hbr", {}),
80
- createIntrinsic("hbr", {}),
81
- memo(() => code`
58
+ return [
59
+ createComponent(Show, {
60
+ get when() {
61
+ return Object.keys(_self$.commands).length > 0;
62
+ },
63
+ get children() {
64
+ return [
65
+ createComponent(VarDeclaration, {
66
+ "const": true,
67
+ name: "args",
68
+ type: "string[]",
69
+ initializer: code`getArgs();`
70
+ }),
71
+ createIntrinsic("hbr", {}),
72
+ createComponent(CommandRouter, {
73
+ path: [],
74
+ get commands() {
75
+ return _self$.commands ?? {};
76
+ }
77
+ }),
78
+ createIntrinsic("hbr", {})
79
+ ];
80
+ }
81
+ }),
82
+ createIntrinsic("hbr", {}),
83
+ memo(() => code`
82
84
  writeLine("");
83
85
  writeLine(colors.text.heading.primary("${/(?:cli|command-line|command line)\s+(?:application|app)?$/.test(getAppTitle(_self$).toLowerCase()) ? getAppTitle(_self$) : `${getAppTitle(_self$)} Command-Line Application`} v${_self$.packageJson.version}"));
84
86
  writeLine("");
85
87
  writeLine(colors.text.body.primary("${getAppDescription(_self$)}"));
86
- writeLine("");
87
- divider({ style: "primary" });
88
- writeLine("");
89
- writeLine("");`),
90
- createIntrinsic("hbr", {}),
91
- createIntrinsic("hbr", {}),
92
- createComponent(For, {
93
- get each() {
94
- return Object.values(commands);
95
- },
96
- doubleHardline: true,
97
- joiner: code`
98
- writeLine("");
99
- divider({ style: "secondary" });
100
- writeLine("");
101
- writeLine("");
102
- `,
103
- children: (child) => [
104
- memo(() => code`
105
- writeLine("");
106
- writeLine(colors.text.heading.secondary("${child.title}"));
88
+ writeLine(""); `),
89
+ createIntrinsic("hbr", {}),
90
+ createIntrinsic("hbr", {}),
91
+ code`writeLine(colors.text.heading.secondary("GLOBAL OPTIONS:"));`,
92
+ createIntrinsic("hbr", {}),
93
+ createComponent(HelpOptions, { get options() {
94
+ return _self$.options;
95
+ } }),
96
+ code`writeLine(""); `,
97
+ createIntrinsic("hbr", {}),
98
+ createIntrinsic("hbr", {}),
99
+ createComponent(Show, {
100
+ get when() {
101
+ return Object.keys(_self$.commands).length > 0;
102
+ },
103
+ get children() {
104
+ return [
105
+ code`writeLine(colors.text.body.secondary("The following commands are available:"));
106
+ writeLine(""); `,
107
+ createIntrinsic("hbr", {}),
108
+ createIntrinsic("hbr", {}),
109
+ createComponent(For, {
110
+ get each() {
111
+ return Object.values(_self$.commands);
112
+ },
113
+ doubleHardline: true,
114
+ joiner: code`writeLine(""); `,
115
+ ender: code`writeLine(""); `,
116
+ children: (child) => [
117
+ memo(() => code`
118
+ writeLine(colors.text.heading.primary("${child.title} ${child.isVirtual ? "" : "Command"}"));
107
119
  writeLine("");
108
120
  writeLine(colors.text.body.secondary("${child.description}"));
109
121
  writeLine("");
110
- writeLine("");
111
122
  `),
112
- createIntrinsic("hbr", {}),
113
- createComponent(Help, {
114
- command: child,
115
- indent: 2
116
- })
117
- ]
118
- })
119
- ];
120
- }
121
- });
123
+ createIntrinsic("hbr", {}),
124
+ createComponent(Help, {
125
+ command: child,
126
+ indent: 2
127
+ }),
128
+ createIntrinsic("hbr", {})
129
+ ]
130
+ })
131
+ ];
132
+ }
133
+ })
134
+ ];
122
135
  }
123
- }), createComponent(For, {
124
- get each() {
125
- return Object.values(commands);
136
+ }), createComponent(Show, {
137
+ get when() {
138
+ return Object.values(_self$.commands).length > 0;
126
139
  },
127
- doubleHardline: true,
128
- children: (child) => createComponent(Show, {
129
- get when() {
130
- return child.isVirtual;
131
- },
132
- get fallback() {
133
- return createComponent(CommandEntry, { command: child });
134
- },
135
- get children() {
136
- return createComponent(VirtualCommandEntry, { command: child });
137
- }
138
- })
140
+ get children() {
141
+ return createComponent(For, {
142
+ get each() {
143
+ return Object.values(_self$.commands);
144
+ },
145
+ doubleHardline: true,
146
+ children: (child) => createComponent(Show, {
147
+ get when() {
148
+ return child.isVirtual;
149
+ },
150
+ get fallback() {
151
+ return createComponent(CommandEntry, { command: child });
152
+ },
153
+ get children() {
154
+ return createComponent(VirtualCommandEntry, { command: child });
155
+ }
156
+ })
157
+ });
158
+ }
139
159
  })]);
140
160
  }
141
161
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["code","For","Show","VarDeclaration","render","getCommandTree","getAppDescription","getAppTitle","theme","BinEntry","CommandEntry","CommandRouter","ConsoleBuiltin","Help","UtilsBuiltin","VirtualCommandEntry","getDefaultOptions","plugin","options","name","config","debug","defaultOptions","isCaseSensitive","configResolved","dependencies","didyoumean2","prepare","_$createComponent","order","handler","_self$","commands","inputs","map","input","path","segments","filter","Boolean","builtinImports","console","utils","children","when","_$memo","Object","keys","length","type","initializer","_$createIntrinsic","test","toLowerCase","packageJson","version","each","values","doubleHardline","joiner","child","title","description","command","indent","isVirtual","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 { getCommandTree } from \"@shell-shock/core/plugin-utils\";\nimport {\n getAppDescription,\n getAppTitle\n} from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport type { CommandTree } from \"@shell-shock/core/types/command\";\nimport theme from \"@shell-shock/plugin-theme\";\nimport type { Plugin } from \"powerlines/types/plugin\";\nimport { BinEntry } from \"./components/bin-entry\";\nimport { CommandEntry } from \"./components/command-entry\";\nimport { CommandRouter } from \"./components/command-router\";\nimport { ConsoleBuiltin } from \"./components/console-builtin\";\nimport { Help } from \"./components/help\";\nimport { UtilsBuiltin } from \"./components/utils-builtin\";\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 theme({\n theme: options.theme\n }),\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 async prepare() {\n this.debug(\n \"Rendering built-in modules for the Shell Shock `script` preset.\"\n );\n\n return render(\n this,\n <>\n <UtilsBuiltin />\n <ConsoleBuiltin />\n </>\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 const commands = this.inputs\n .map(input => getCommandTree(this, input.path.segments))\n .filter(Boolean) as CommandTree[];\n\n return render(\n this,\n <>\n <BinEntry\n builtinImports={{\n console: [\"divider\", \"writeLine\", \"colors\"],\n utils: [\"getArgs\"]\n }}>\n <Show\n when={this.commands && 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 <hbr />\n {code`\n writeLine(\"\");\n writeLine(colors.text.heading.primary(\"${\n /(?:cli|command-line|command line)\\s+(?:application|app)?$/.test(\n getAppTitle(this).toLowerCase()\n )\n ? getAppTitle(this)\n : `${getAppTitle(this)} Command-Line Application`\n } v${this.packageJson.version}\"));\n writeLine(\"\");\n writeLine(colors.text.body.primary(\"${getAppDescription(\n this\n )}\"));\n writeLine(\"\");\n divider({ style: \"primary\" });\n writeLine(\"\");\n writeLine(\"\");`}\n <hbr />\n <hbr />\n <For\n each={Object.values(commands)}\n doubleHardline\n joiner={code`\n writeLine(\"\");\n divider({ style: \"secondary\" });\n writeLine(\"\");\n writeLine(\"\");\n `}>\n {child => (\n <>\n {code`\n writeLine(\"\");\n writeLine(colors.text.heading.secondary(\"${child.title}\"));\n writeLine(\"\");\n writeLine(colors.text.body.secondary(\"${child.description}\"));\n writeLine(\"\");\n writeLine(\"\");\n `}\n <hbr />\n <Help command={child} indent={2} />\n </>\n )}\n </For>\n </Show>\n </BinEntry>\n <For each={Object.values(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 </>\n );\n }\n }\n }\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA0CA,MAAaiB,UAGXC,UAA+B,EAAE,KAC9B;AACH,QAAO;EACLV,MAAM,EACJA,OAAOU,QAAQV,OAChB,CAAC;EACF;GACEW,MAAM;GACNC,SAAS;AACP,SAAKC,MACH,uEACD;AAED,WAAO;KACLC,gBAAgBN;KAChBO,iBAAiB;KACjB,GAAGL;KACJ;;GAEHM,iBAAiB;AACf,SAAKC,aAAaC,cAAc;;GAElC,MAAMC,UAAU;AACd,SAAKN,MACH,kEACD;AAED,WAAOjB,OACL,MAAI,CAAAwB,gBAEDd,cAAY,EAAA,CAAA,EAAAc,gBACZhB,gBAAc,EAAA,CAAA,CAEnB,CAAC;;GAEJ;EACD;GACEO,MAAM;GACNQ,SAAS;IACPE,OAAO;IACP,MAAMC,UAAU;KAAA,MAAAC,SAAA;AACd,UAAKV,MACH,oEACD;KAED,MAAMW,WAAW,KAAKC,OACnBC,KAAIC,UAAS9B,eAAe,MAAM8B,MAAMC,KAAKC,SAAS,CAAC,CACvDC,OAAOC,QAAyB;AAEnC,YAAOnC,OACL,MAAI,CAAAwB,gBAEDnB,UAAQ;MACP+B,gBAAgB;OACdC,SAAS;QAAC;QAAW;QAAa;QAAS;OAC3CC,OAAO,CAAC,UAAS;OAClB;MAAA,IAAAC,WAAA;AAAA,cAAAf,gBACA1B,MAAI;QAAA,IACH0C,OAAI;AAAA,gBAAEC,WAAA,CAAA,CAAAd,OAAKC,SAAQ,EAAA,IAAIc,OAAOC,KAAKhB,OAAKC,SAAS,CAACgB,SAAS;;QAA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SAASH,OAAK,CAAA;;OAAA,IAAAjB,WAAA;AAAA,eAAAf,gBACrCb,qBAAmB,EAACgD,SAASH,OAAK,CAAA;;OAAA,CAAA;MAEtC,CAAA,CAGP,CAAC;;IAEL;GACD;EACF;;AAGH,kBAAe3C"}
1
+ {"version":3,"file":"index.mjs","names":["code","For","Show","VarDeclaration","render","getAppDescription","getAppTitle","theme","BinEntry","CommandEntry","CommandRouter","ConsoleBuiltin","Help","HelpOptions","UtilsBuiltin","VirtualCommandEntry","getDefaultOptions","plugin","options","name","config","debug","defaultOptions","isCaseSensitive","configResolved","dependencies","didyoumean2","prepare","_$createComponent","order","handler","_self$","builtinImports","console","utils","children","when","Object","keys","commands","length","type","initializer","_$createIntrinsic","path","_$memo","test","toLowerCase","packageJson","version","each","values","doubleHardline","joiner","ender","child","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 {\n getAppDescription,\n getAppTitle\n} from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport theme from \"@shell-shock/plugin-theme\";\nimport type { Plugin } from \"powerlines/types/plugin\";\nimport { BinEntry } from \"./components/bin-entry\";\nimport { CommandEntry } from \"./components/command-entry\";\nimport { CommandRouter } from \"./components/command-router\";\nimport { ConsoleBuiltin } from \"./components/console-builtin\";\nimport { Help, HelpOptions } from \"./components/help\";\nimport { UtilsBuiltin } from \"./components/utils-builtin\";\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 theme({\n theme: options.theme\n }),\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 async prepare() {\n this.debug(\n \"Rendering built-in modules for the Shell Shock `script` preset.\"\n );\n\n return render(\n this,\n <>\n <UtilsBuiltin />\n <ConsoleBuiltin />\n </>\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: [\"divider\", \"writeLine\", \"colors\"],\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 writeLine(colors.text.heading.primary(\"${\n /(?:cli|command-line|command line)\\s+(?:application|app)?$/.test(\n getAppTitle(this).toLowerCase()\n )\n ? getAppTitle(this)\n : `${getAppTitle(this)} Command-Line Application`\n } v${this.packageJson.version}\"));\n writeLine(\"\");\n writeLine(colors.text.body.primary(\"${getAppDescription(\n this\n )}\"));\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 </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":";;;;;;;;;;;;;;;;;;;AAwCA,MAAaiB,UAGXC,UAA+B,EAAE,KAC9B;AACH,QAAO;EACLX,MAAM,EACJA,OAAOW,QAAQX,OAChB,CAAC;EACF;GACEY,MAAM;GACNC,SAAS;AACP,SAAKC,MACH,uEACD;AAED,WAAO;KACLC,gBAAgBN;KAChBO,iBAAiB;KACjB,GAAGL;KACJ;;GAEHM,iBAAiB;AACf,SAAKC,aAAaC,cAAc;;GAElC,MAAMC,UAAU;AACd,SAAKN,MACH,kEACD;AAED,WAAOjB,OACL,MAAI,CAAAwB,gBAEDd,cAAY,EAAA,CAAA,EAAAc,gBACZjB,gBAAc,EAAA,CAAA,CAEnB,CAAC;;GAEJ;EACD;GACEQ,MAAM;GACNQ,SAAS;IACPE,OAAO;IACP,MAAMC,UAAU;KAAA,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;;;;;;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"}
1
+ {"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/types/plugin.ts"],"sourcesContent":[],"mappings":";;;;;;;UAmCiB,mBAAA,SACP,KAAK,4BAA4B,QAAQ;;AADnD;;;;;;;;;;EAmBY,cAAA,CAAA,EALN,aAK4B,EAAA,GAAA,CAAG,CAAA,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,6 +1,6 @@
1
1
  {
2
2
  "name": "@shell-shock/preset-script",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "type": "module",
5
5
  "description": "A Shell Shock preset that generates a fully-featured script application.",
6
6
  "repository": {
@@ -251,23 +251,23 @@
251
251
  "dependencies": {
252
252
  "@alloy-js/core": "0.22.0",
253
253
  "@alloy-js/typescript": "^0.22.0",
254
- "@powerlines/deepkit": "^0.6.43",
255
- "@powerlines/plugin-alloy": "^0.20.6",
256
- "@powerlines/plugin-plugin": "^0.12.214",
257
- "@shell-shock/core": "^0.4.0",
258
- "@shell-shock/plugin-theme": "^0.0.8",
254
+ "@powerlines/deepkit": "^0.6.44",
255
+ "@powerlines/plugin-alloy": "^0.20.7",
256
+ "@powerlines/plugin-plugin": "^0.12.215",
257
+ "@shell-shock/core": "^0.4.1",
258
+ "@shell-shock/plugin-theme": "^0.0.9",
259
259
  "@stryke/path": "^0.26.4",
260
260
  "@stryke/string-format": "^0.13.7",
261
261
  "@stryke/type-checks": "^0.5.23",
262
262
  "defu": "^6.1.4",
263
- "powerlines": "^0.38.30",
263
+ "powerlines": "^0.38.31",
264
264
  "@stryke/helpers": "0.9.40"
265
265
  },
266
266
  "devDependencies": {
267
267
  "@babel/core": "^7.29.0",
268
- "@powerlines/plugin-alloy": "^0.20.6",
268
+ "@powerlines/plugin-alloy": "^0.20.7",
269
269
  "@types/node": "^22.19.7"
270
270
  },
271
271
  "publishConfig": { "access": "public" },
272
- "gitHead": "ad8f1104e63a42de787eb5c5ec5c57e27f8a682e"
272
+ "gitHead": "e40c2e1e052ea01a5c75aae48a9e9436d4bff313"
273
273
  }