@shell-shock/plugin-help 0.2.26 → 0.2.29

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 (34) hide show
  1. package/dist/_virtual/_rolldown/runtime.cjs +29 -1
  2. package/dist/components/display.cjs +276 -18
  3. package/dist/components/display.d.cts +6 -7
  4. package/dist/components/display.d.cts.map +1 -1
  5. package/dist/components/display.d.mts +6 -7
  6. package/dist/components/display.d.mts.map +1 -1
  7. package/dist/components/display.mjs +270 -18
  8. package/dist/components/display.mjs.map +1 -1
  9. package/dist/components/help-builtin.cjs +99 -1
  10. package/dist/components/help-builtin.d.cts +1 -2
  11. package/dist/components/help-builtin.d.cts.map +1 -1
  12. package/dist/components/help-builtin.d.mts +2 -3
  13. package/dist/components/help-builtin.d.mts.map +1 -1
  14. package/dist/components/help-builtin.mjs +96 -1
  15. package/dist/components/help-builtin.mjs.map +1 -1
  16. package/dist/components/help-command.cjs +151 -1
  17. package/dist/components/help-command.d.cts +3 -5
  18. package/dist/components/help-command.d.cts.map +1 -1
  19. package/dist/components/help-command.d.mts +3 -5
  20. package/dist/components/help-command.d.mts.map +1 -1
  21. package/dist/components/help-command.mjs +149 -1
  22. package/dist/components/help-command.mjs.map +1 -1
  23. package/dist/components/index.cjs +14 -1
  24. package/dist/components/index.mjs +5 -1
  25. package/dist/index.cjs +97 -1
  26. package/dist/index.d.cts +1 -1
  27. package/dist/index.d.mts +1 -1
  28. package/dist/index.d.mts.map +1 -1
  29. package/dist/index.mjs +91 -1
  30. package/dist/index.mjs.map +1 -1
  31. package/dist/types/index.mjs +1 -1
  32. package/dist/types/plugin.d.mts.map +1 -1
  33. package/dist/types/plugin.mjs +1 -1
  34. package/package.json +18 -18
package/dist/index.mjs CHANGED
@@ -1,2 +1,92 @@
1
- import{HelpBuiltin as e}from"./components/help-builtin.mjs";import{HelpCommand as t,TemporaryHelpCommand as n}from"./components/help-command.mjs";import"./components/index.mjs";import{createComponent as r}from"@alloy-js/core/jsx-runtime";import{For as i,Show as a,computed as o}from"@alloy-js/core";import{Spacing as s}from"@powerlines/plugin-alloy/core/components";import{render as c}from"@powerlines/plugin-alloy/render";import{computeBin as l,getCommandList as u,isDynamicPathSegment as d}from"@shell-shock/core/plugin-utils";import f from"@shell-shock/plugin-console";import p from"@shell-shock/plugin-theme";import{getUniqueBy as m}from"@stryke/helpers/get-unique";import{joinPaths as h}from"@stryke/path/join";import{isSetString as g}from"@stryke/type-checks/is-set-string";import _ from"defu";const v=(v={})=>[...p(v.theme),...f(v.console),{name:`shell-shock:help`,enforce:`post`,config(){return this.debug("Providing default configuration for the Shell Shock `help` plugin."),{help:_({command:v.command===!1?!1:g(v.command)?{name:v.command}:{name:`help`}},v,{builtins:!0})}},async configResolved(){this.debug(`Adding the Help command to the application context.`),this.config.help.command!==!1&&(this.inputs??=[],this.inputs.some(e=>e.name===this.config.help.command.name)?this.info("The `help` command already exists in the commands list. If you would like the help command to be managed by the `@shell-shock/plugin-help` package, please remove or rename the command."):this.inputs.push({id:this.config.help.command.name,path:this.config.help.command.name,segments:[this.config.help.command.name],title:`Help`,icon:`🛈`,tags:[`Utility`],description:`Display command usage details and other useful information to the user.`,entry:{file:h(this.entryPath,`help`,`index.ts`),input:{file:h(this.entryPath,`help`,`command.ts`)}},isVirtual:!1,source:`help-plugin`,...this.config.help.command}),await c(this,r(n,{})))},prepare:{order:`post`,async handler(){let n=this,f=await u(this);this.debug(`Rendering \`help\` built-ins for each of the ${f.length} command modules.`);let p=o(()=>m(f.map(e=>e.segments.filter(e=>!d(e)).filter(e=>e.length>0)),e=>e.join(`/`)).filter(e=>e.length>0).sort((e,t)=>e.join(`/`).localeCompare(t.join(`/`))));return c(this,[r(a,{get when(){return n.config.help.builtins!==!1},get children(){return[r(e,{get command(){return l(n)}}),r(s,{}),r(i,{get each(){return f.sort((e,t)=>e.name.localeCompare(t.name))},doubleHardline:!0,children:t=>r(e,{command:t})}),r(t,{get segments(){return p.value}})]}})])}}}];export{v as default,v as plugin};
1
+ import { HelpBuiltin } from "./components/help-builtin.mjs";
2
+ import { HelpCommand, TemporaryHelpCommand } from "./components/help-command.mjs";
3
+ import "./components/index.mjs";
4
+ import { createComponent } from "@alloy-js/core/jsx-runtime";
5
+ import { For, Show, computed } from "@alloy-js/core";
6
+ import { Spacing } from "@powerlines/plugin-alloy/core/components";
7
+ import { render } from "@powerlines/plugin-alloy/render";
8
+ import { computeBin, getCommandList, isDynamicPathSegment } from "@shell-shock/core/plugin-utils";
9
+ import console from "@shell-shock/plugin-console";
10
+ import theme from "@shell-shock/plugin-theme";
11
+ import { getUniqueBy } from "@stryke/helpers/get-unique";
12
+ import { joinPaths } from "@stryke/path/join";
13
+ import { isSetString } from "@stryke/type-checks/is-set-string";
14
+ import defu from "defu";
15
+
16
+ //#region src/index.tsx
17
+ /**
18
+ * The Help - Shell Shock plugin to add a help command to the application.
19
+ */
20
+ const plugin = (options = {}) => {
21
+ return [
22
+ ...theme(options.theme),
23
+ ...console(options.console),
24
+ {
25
+ name: "shell-shock/help",
26
+ enforce: "post",
27
+ config() {
28
+ this.debug("Providing default configuration for the Shell Shock `help` plugin.");
29
+ return { help: defu({ command: options.command === false ? false : isSetString(options.command) ? { name: options.command } : { name: "help" } }, options, { builtins: true }) };
30
+ },
31
+ async configResolved() {
32
+ this.debug("Adding the Help command to the application context.");
33
+ if (this.config.help.command !== false) {
34
+ this.inputs ??= [];
35
+ if (this.inputs.some((input) => input.name === this.config.help.command.name)) this.info("The `help` command already exists in the commands list. If you would like the help command to be managed by the `@shell-shock/plugin-help` package, please remove or rename the command.");
36
+ else this.inputs.push({
37
+ id: this.config.help.command.name,
38
+ path: this.config.help.command.name,
39
+ segments: [this.config.help.command.name],
40
+ title: "Help",
41
+ icon: "🛈",
42
+ tags: ["Utility"],
43
+ description: `Display command usage details and other useful information to the user.`,
44
+ entry: {
45
+ file: joinPaths(this.entryPath, "help", "index.ts"),
46
+ input: { file: joinPaths(this.entryPath, "help", "command.ts") }
47
+ },
48
+ virtual: false,
49
+ ...this.config.help.command
50
+ });
51
+ await render(this, createComponent(TemporaryHelpCommand, {}));
52
+ }
53
+ },
54
+ prepare: {
55
+ order: "post",
56
+ async handler() {
57
+ const _self$ = this;
58
+ const commands = await getCommandList(this);
59
+ this.debug(`Rendering \`help\` built-ins for each of the ${commands.length} command modules.`);
60
+ const segments = computed(() => getUniqueBy(commands.map((command) => command.segments.filter((segment) => !isDynamicPathSegment(segment)).filter((segment) => segment.length > 0)), (segments) => segments.join("/")).filter((segments) => segments.length > 0).sort((a, b) => a.join("/").localeCompare(b.join("/"))));
61
+ return render(this, [createComponent(Show, {
62
+ get when() {
63
+ return _self$.config.help.builtins !== false;
64
+ },
65
+ get children() {
66
+ return [
67
+ createComponent(HelpBuiltin, { get command() {
68
+ return computeBin(_self$);
69
+ } }),
70
+ createComponent(Spacing, {}),
71
+ createComponent(For, {
72
+ get each() {
73
+ return commands.sort((a, b) => a.name.localeCompare(b.name));
74
+ },
75
+ doubleHardline: true,
76
+ children: (command) => createComponent(HelpBuiltin, { command })
77
+ }),
78
+ createComponent(HelpCommand, { get commands() {
79
+ return segments.value;
80
+ } })
81
+ ];
82
+ }
83
+ })]);
84
+ }
85
+ }
86
+ }
87
+ ];
88
+ };
89
+
90
+ //#endregion
91
+ export { plugin as default, plugin };
2
92
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":[],"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 { computed, For, Show } from \"@alloy-js/core\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport {\n computeBin,\n getCommandList,\n isDynamicPathSegment\n} from \"@shell-shock/core/plugin-utils\";\nimport type { CommandConfig } from \"@shell-shock/core/types/command\";\nimport console from \"@shell-shock/plugin-console\";\nimport theme from \"@shell-shock/plugin-theme\";\nimport { getUniqueBy } from \"@stryke/helpers/get-unique\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport defu from \"defu\";\nimport type { Plugin } from \"powerlines\";\nimport { HelpBuiltin, HelpCommand, TemporaryHelpCommand } from \"./components\";\nimport type { HelpPluginContext, HelpPluginOptions } from \"./types/plugin\";\n\nexport type * from \"./types\";\n\n/**\n * The Help - Shell Shock plugin to add a help command to the application.\n */\nexport const plugin = <TContext extends HelpPluginContext = HelpPluginContext>(\n options: HelpPluginOptions = {}\n): Plugin<TContext>[] => {\n return [\n ...theme<TContext>(options.theme),\n ...console<TContext>(options.console),\n {\n name: \"shell-shock:help\",\n enforce: \"post\",\n config() {\n this.debug(\n \"Providing default configuration for the Shell Shock `help` plugin.\"\n );\n\n return {\n help: defu(\n {\n command:\n options.command === false\n ? false\n : isSetString(options.command)\n ? { name: options.command }\n : { name: \"help\" }\n },\n options,\n {\n builtins: true\n }\n )\n };\n },\n async configResolved() {\n this.debug(\"Adding the Help command to the application context.\");\n\n if (this.config.help.command !== false) {\n this.inputs ??= [];\n if (\n this.inputs.some(\n (input: CommandConfig) =>\n input.name === (this.config.help.command as CommandConfig).name\n )\n ) {\n this.info(\n \"The `help` command already exists in the commands list. If you would like the help command to be managed by the `@shell-shock/plugin-help` package, please remove or rename the command.\"\n );\n } else {\n this.inputs.push({\n id: this.config.help.command.name,\n path: this.config.help.command.name,\n segments: [this.config.help.command.name],\n title: \"Help\",\n icon: \"🛈\",\n tags: [\"Utility\"],\n description: `Display command usage details and other useful information to the user.`,\n entry: {\n file: joinPaths(this.entryPath, \"help\", \"index.ts\"),\n input: {\n file: joinPaths(this.entryPath, \"help\", \"command.ts\")\n }\n },\n isVirtual: false,\n source: \"help-plugin\",\n ...this.config.help.command\n });\n }\n\n await render(this, <TemporaryHelpCommand />);\n }\n },\n prepare: {\n order: \"post\",\n async handler() {\n const commands = await getCommandList(this);\n this.debug(\n `Rendering \\`help\\` built-ins for each of the ${\n commands.length\n } command modules.`\n );\n\n const segments = computed(() =>\n getUniqueBy(\n commands.map(command =>\n command.segments\n .filter(segment => !isDynamicPathSegment(segment))\n .filter(segment => segment.length > 0)\n ),\n segments => segments.join(\"/\")\n )\n .filter(segments => segments.length > 0)\n .sort((a, b) => a.join(\"/\").localeCompare(b.join(\"/\")))\n );\n\n return render(\n this,\n <>\n <Show when={this.config.help.builtins !== false}>\n <HelpBuiltin command={computeBin(this)} />\n <Spacing />\n <For\n each={commands.sort((a, b) => a.name.localeCompare(b.name))}\n doubleHardline>\n {command => <HelpBuiltin command={command} />}\n </For>\n <HelpCommand segments={segments.value} />\n </Show>\n </>\n );\n }\n }\n }\n ];\n};\n\nexport default plugin;\n"],"mappings":"gyBAiCA,MAAa,GAAU,EAAM,EAAA,GACpB,CAAA,GAAA,EAAA,EAAa,MAAW,CAAE,GAAA,EAAA,EAAA,QAA2B,CAAE,CAChE,KAAO,kCAEP,QAAa,CAEX,wFAAA,CACK,KAAO,EAAK,CACjB,QAAA,EAAA,UAAA,GAAA,GAAA,EAAA,EAAA,QAAA,CAAA,CACU,KAAC,EAAU,QACZ,CAAA,CACD,KAAQ,OACT,CACF,CAAA,EAAM,CACN,SAAQ,GACX,CAAA,CACE,EAEF,MAAE,gBAAS,CACT,KAAE,MAAK,sDAAK,CACR,KAAC,OAAU,KAAA,UAAQ,KACrB,KAAC,SAAA,EAAA,6DAED,KAAO,KAAA,2LAAA,CAEL,KAAE,OAAA,KAAA,CACA,GAAE,KAAO,OAAA,KAAA,QAAA,KAC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AAA,EAAA,OAEA,CAAA,CAAK,EAER,CAAA,CAAA,CAAA,EAEF,CACF,CAAC"}
1
+ {"version":3,"file":"index.mjs","names":[],"sources":[],"mappings":""}
@@ -1 +1 @@
1
- export{};
1
+ export { };
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":";;;;;;;UAsCiB,iBAAA;;AAAjB;;;;EAME,QAAA;EAeQ;;;;;;;;EALR,OAAA,GAAU,OAAA,CAAQ,aAAA;EAKV;;;EAAR,KAAA,GAAQ,kBAAA;EAKsB;AAGhC;;EAHE,OAAA,GAAU,oBAAA;AAAA;AAAA,KAGA,oBAAA,GAAuB,qBAAA,GACjC,uBAAA,GACA,UAAA;EAAA;;;EAIE,IAAA,EAAM,IAAA,CAAK,iBAAA;IAMA;;;;;IAAT,OAAA,EAAS,OAAA,CAAQ,aAAA;EAAA;AAAA;AAAA,KAIX,wBAAA,GAA2B,yBAAA,GACrC,2BAAA,GACA,cAAA;EANI;;;EAUF,IAAA,EAAM,QAAA,CAAS,IAAA,CAAK,iBAAA;IAVY;AAIpC;;;;IAYM,OAAA,EAAS,YAAA,CAAa,OAAA,CAAQ,aAAA;EAAA;AAAA;AAAA,KAIxB,iBAAA,yBACc,wBAAA,GAA2B,wBAAA,IACjD,kBAAA,CAAmB,eAAA,IACrB,oBAAA,CAAqB,eAAA,IACrB,OAAA,CAAQ,eAAA"}
1
+ {"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":""}
@@ -1 +1 @@
1
- export{};
1
+ export { };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shell-shock/plugin-help",
3
- "version": "0.2.26",
3
+ "version": "0.2.29",
4
4
  "private": false,
5
5
  "description": "A package containing a Shell Shock plugin to provide help and documentation for the local application's commands.",
6
6
  "keywords": [
@@ -151,26 +151,26 @@
151
151
  "typings": "dist/index.d.mts",
152
152
  "files": ["dist/**/*"],
153
153
  "dependencies": {
154
- "@alloy-js/core": "0.23.0-dev.8",
155
- "@alloy-js/typescript": "0.23.0-dev.4",
156
- "@powerlines/deepkit": "^0.8.49",
157
- "@powerlines/plugin-alloy": "^0.26.67",
158
- "@powerlines/plugin-plugin": "^0.12.399",
159
- "@shell-shock/core": "^0.17.8",
160
- "@shell-shock/plugin-console": "^0.2.12",
161
- "@shell-shock/plugin-theme": "^0.4.21",
162
- "@stryke/helpers": "^0.10.11",
163
- "@stryke/path": "^0.28.1",
164
- "@stryke/string-format": "^0.17.12",
165
- "@stryke/type-checks": "^0.6.4",
166
- "@stryke/types": "^0.11.6",
154
+ "@alloy-js/core": "^0.23.1",
155
+ "@alloy-js/typescript": "^0.23.0",
156
+ "@powerlines/deepkit": "^0.9.78",
157
+ "@powerlines/plugin-alloy": "^0.26.217",
158
+ "@powerlines/plugin-plugin": "^0.12.536",
159
+ "@shell-shock/core": "0.17.11",
160
+ "@shell-shock/plugin-console": "0.2.15",
161
+ "@shell-shock/plugin-theme": "0.4.24",
162
+ "@stryke/helpers": "^0.10.24",
163
+ "@stryke/path": "^0.29.11",
164
+ "@stryke/string-format": "^0.17.26",
165
+ "@stryke/type-checks": "^0.6.17",
166
+ "@stryke/types": "^0.12.12",
167
167
  "defu": "^6.1.7",
168
- "powerlines": "^0.44.12"
168
+ "powerlines": "^0.47.124"
169
169
  },
170
170
  "devDependencies": {
171
- "@powerlines/plugin-deepkit": "^0.11.330",
172
- "@types/node": "^25.6.0"
171
+ "@powerlines/plugin-deepkit": "^0.11.467",
172
+ "@types/node": "^25.9.1"
173
173
  },
174
174
  "publishConfig": { "access": "public" },
175
- "gitHead": "832c19e668deb4d29b5e0219a7708d111790f607"
175
+ "gitHead": "9401c1de122d800040306fc89ad1835930c1a826"
176
176
  }