@shell-shock/plugin-help 0.2.40 → 0.2.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/display.cjs +15 -15
- package/dist/components/display.d.cts +0 -1
- package/dist/components/display.d.cts.map +1 -1
- package/dist/components/display.d.mts +0 -1
- package/dist/components/display.mjs +3 -3
- package/dist/components/help-builtin.cjs +10 -13
- package/dist/components/help-builtin.d.cts +1 -2
- package/dist/components/help-builtin.d.cts.map +1 -1
- package/dist/components/help-builtin.d.mts +1 -2
- package/dist/components/help-builtin.mjs +5 -6
- package/dist/components/help-command.cjs +13 -13
- package/dist/components/help-command.d.cts.map +1 -1
- package/dist/components/help-command.mjs +4 -4
- package/dist/generator.cjs +62 -0
- package/dist/generator.d.cts +10 -0
- package/dist/generator.d.cts.map +1 -0
- package/dist/generator.d.mts +10 -0
- package/dist/generator.d.mts.map +1 -0
- package/dist/generator.mjs +61 -0
- package/dist/generator.mjs.map +1 -0
- package/dist/index.cjs +10 -40
- package/dist/index.d.cts +3 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +3 -2
- package/dist/index.mjs +13 -40
- package/dist/types/index.cjs +1 -0
- package/dist/types/index.mjs +2 -0
- package/dist/types/plugin.d.cts +0 -1
- package/dist/types/plugin.d.cts.map +1 -1
- package/dist/types/plugin.d.mts +0 -1
- package/package.json +33 -19
- package/dist/_virtual/_rolldown/runtime.cjs +0 -29
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
3
|
-
let _alloy_js_core = require("@alloy-js/core");
|
|
4
3
|
let _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
|
|
5
|
-
let
|
|
6
|
-
let
|
|
4
|
+
let _alloy_js_core = require("@alloy-js/core");
|
|
5
|
+
let _power_plant_alloy_js_core_components_spacing = require("@power-plant/alloy-js/core/components/spacing");
|
|
6
|
+
let _shell_shock_core_contexts_power_plant = require("@shell-shock/core/contexts/power-plant");
|
|
7
7
|
let _shell_shock_plugin_theme_contexts_theme = require("@shell-shock/plugin-theme/contexts/theme");
|
|
8
8
|
let _stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
|
|
9
9
|
let _stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
|
|
@@ -15,7 +15,7 @@ let _stryke_string_format_snake_case = require("@stryke/string-format/snake-case
|
|
|
15
15
|
*/
|
|
16
16
|
function HelpUsageDisplay(props) {
|
|
17
17
|
const { command, indent = 2 } = props;
|
|
18
|
-
const context = (0,
|
|
18
|
+
const context = (0, _shell_shock_core_contexts_power_plant.usePowerlines)();
|
|
19
19
|
const theme = (0, _shell_shock_plugin_theme_contexts_theme.useTheme)();
|
|
20
20
|
return [
|
|
21
21
|
(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`writeLine(
|
|
@@ -75,7 +75,7 @@ function HelpUsageDisplay(props) {
|
|
|
75
75
|
*/
|
|
76
76
|
function HelpOptionsDisplay(props) {
|
|
77
77
|
const { options } = props;
|
|
78
|
-
const context = (0,
|
|
78
|
+
const context = (0, _shell_shock_core_contexts_power_plant.usePowerlines)();
|
|
79
79
|
return [
|
|
80
80
|
_alloy_js_core.code`table([ `,
|
|
81
81
|
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
@@ -125,7 +125,7 @@ function HelpCommandsDisplay(props) {
|
|
|
125
125
|
function BaseHelpDisplay(props) {
|
|
126
126
|
const { command, indent = 1, filterGlobalOptions = false } = props;
|
|
127
127
|
const theme = (0, _shell_shock_plugin_theme_contexts_theme.useTheme)();
|
|
128
|
-
const context = (0,
|
|
128
|
+
const context = (0, _shell_shock_core_contexts_power_plant.usePowerlines)();
|
|
129
129
|
const options = (0, _alloy_js_core.computed)(() => filterGlobalOptions ? Object.values(command.options) : [...Object.values(command.options), ...context.globalOptions.filter((globalOption) => !Object.values(command.options).some((option) => option.name.toLowerCase() === globalOption.name.toLowerCase()) && !globalOption.alias.some((alias) => Object.values(command.options).some((option) => option.alias.some((a) => a.toLowerCase() === alias.toLowerCase()))))]);
|
|
130
130
|
return [
|
|
131
131
|
(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`writeLine(bold(textColors.heading.secondary("Usage:"))${indent > 1 ? `, { padding: ${(theme.padding.app ?? 1) * indent} }` : ""});`),
|
|
@@ -134,7 +134,7 @@ function BaseHelpDisplay(props) {
|
|
|
134
134
|
command,
|
|
135
135
|
indent
|
|
136
136
|
}),
|
|
137
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
137
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_core_components_spacing.Spacing, {}),
|
|
138
138
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
139
139
|
get when() {
|
|
140
140
|
return options.value.length > 0;
|
|
@@ -147,7 +147,7 @@ function BaseHelpDisplay(props) {
|
|
|
147
147
|
(0, _alloy_js_core_jsx_runtime.createComponent)(HelpOptionsDisplay, { get options() {
|
|
148
148
|
return options.value;
|
|
149
149
|
} }),
|
|
150
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
150
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_core_components_spacing.Spacing, {})
|
|
151
151
|
];
|
|
152
152
|
}
|
|
153
153
|
}),
|
|
@@ -163,7 +163,7 @@ function BaseHelpDisplay(props) {
|
|
|
163
163
|
(0, _alloy_js_core_jsx_runtime.createComponent)(HelpCommandsDisplay, { get commands() {
|
|
164
164
|
return command.children;
|
|
165
165
|
} }),
|
|
166
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
166
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_core_components_spacing.Spacing, {})
|
|
167
167
|
];
|
|
168
168
|
}
|
|
169
169
|
})
|
|
@@ -185,14 +185,14 @@ function sortCommands(commands) {
|
|
|
185
185
|
*/
|
|
186
186
|
function VirtualCommandHelpDisplay(props) {
|
|
187
187
|
const { options, commands } = props;
|
|
188
|
-
const context = (0,
|
|
188
|
+
const context = (0, _shell_shock_core_contexts_power_plant.usePowerlines)();
|
|
189
189
|
return [
|
|
190
190
|
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
191
191
|
_alloy_js_core.code`writeLine(bold(textColors.heading.secondary("Common Options:")));`,
|
|
192
192
|
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
193
193
|
(0, _alloy_js_core_jsx_runtime.createComponent)(HelpOptionsDisplay, { options }),
|
|
194
194
|
_alloy_js_core.code`writeLine(""); `,
|
|
195
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
195
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_core_components_spacing.Spacing, {}),
|
|
196
196
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
197
197
|
get when() {
|
|
198
198
|
return Object.keys(commands).length > 0;
|
|
@@ -201,7 +201,7 @@ function VirtualCommandHelpDisplay(props) {
|
|
|
201
201
|
return [
|
|
202
202
|
(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`writeLine(textColors.body.tertiary("The following commands are available through the ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context, true)} command-line interface:"));
|
|
203
203
|
writeLine(""); `),
|
|
204
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
204
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_core_components_spacing.Spacing, {}),
|
|
205
205
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
206
206
|
get each() {
|
|
207
207
|
return sortCommands(commands);
|
|
@@ -237,13 +237,13 @@ function CommandHelpDisplay(props) {
|
|
|
237
237
|
const { command } = props;
|
|
238
238
|
return [
|
|
239
239
|
_alloy_js_core.code`writeLine(""); `,
|
|
240
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
240
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_core_components_spacing.Spacing, {}),
|
|
241
241
|
(0, _alloy_js_core_jsx_runtime.createComponent)(BaseHelpDisplay, {
|
|
242
242
|
command,
|
|
243
243
|
filterGlobalOptions: false
|
|
244
244
|
}),
|
|
245
245
|
_alloy_js_core.code`writeLine(""); `,
|
|
246
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
246
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_core_components_spacing.Spacing, {}),
|
|
247
247
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
248
248
|
get when() {
|
|
249
249
|
return Object.keys(command.children).length > 0;
|
|
@@ -252,7 +252,7 @@ function CommandHelpDisplay(props) {
|
|
|
252
252
|
return [
|
|
253
253
|
_alloy_js_core.code`writeLine(textColors.body.tertiary("The following sub-commands are available:"));
|
|
254
254
|
writeLine(""); `,
|
|
255
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
255
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_core_components_spacing.Spacing, {}),
|
|
256
256
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
257
257
|
get each() {
|
|
258
258
|
return sortCommands(command.children);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"display.d.cts","names":[],"sources":["../../src/components/display.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"display.d.cts","names":[],"sources":["../../src/components/display.tsx"],"mappings":";;UAqCiB;;;;EAIf,SAAS;;;;;;;;;EAUT;;;;;iBAMc,iBAAiB,OAAO,iDAAqB;UAkO5C;;;;EAIf,SAAS;;;;;iBAMK,mBAAmB,OAAO,mDAAuB;UAoFhD;;;;EAIf,UAAU,eAAe;;;;;iBAMX,oBAAoB,OAAO,oDAAwB;UA+BlD;;;;EAIf,SAAS;;;;;;;;;EAUT;;;;;;;;;EAUA;;;;;iBAMc,gBAAgB,OAAO,gDAAoB;UA0D1C;;;;EAIf,SAAS;;;;EAKT,UAAU,eAAe;;;;;;;EAQzB;;;;;iBA4Cc,0BACd,OAAO,0DAA8B;UA8DtB;;;;EAIf,SAAS;;;;;iBAMK,mBAAmB,OAAO,mDAAuB"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createComponent, createIntrinsic, memo } from "@alloy-js/core/jsx-runtime";
|
|
2
|
-
import { For, Show, code, computed } from "@alloy-js/core";
|
|
3
2
|
import { formatDescription, formatShortDescription, getAppBin, getAppTitle, getDynamicPathSegmentName, isDynamicPathSegment, sortOptions } from "@shell-shock/core/plugin-utils";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import { For, Show, code, computed } from "@alloy-js/core";
|
|
4
|
+
import { Spacing } from "@power-plant/alloy-js/core/components/spacing";
|
|
5
|
+
import { usePowerlines } from "@shell-shock/core/contexts/power-plant";
|
|
6
6
|
import { useTheme } from "@shell-shock/plugin-theme/contexts/theme";
|
|
7
7
|
import { camelCase } from "@stryke/string-format/camel-case";
|
|
8
8
|
import { kebabCase } from "@stryke/string-format/kebab-case";
|
|
@@ -1,19 +1,16 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
2
|
const require_components_display = require('./display.cjs');
|
|
4
3
|
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
5
|
-
let _alloy_js_core = require("@alloy-js/core");
|
|
6
4
|
let _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
|
|
7
5
|
let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
8
6
|
let defu = require("defu");
|
|
9
|
-
|
|
10
|
-
let
|
|
11
|
-
let
|
|
7
|
+
let _alloy_js_core = require("@alloy-js/core");
|
|
8
|
+
let _power_plant_alloy_js_core_components_spacing = require("@power-plant/alloy-js/core/components/spacing");
|
|
9
|
+
let _shell_shock_core_contexts_power_plant = require("@shell-shock/core/contexts/power-plant");
|
|
12
10
|
let _shell_shock_plugin_theme_contexts_theme = require("@shell-shock/plugin-theme/contexts/theme");
|
|
13
11
|
let _stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
|
|
14
12
|
let _alloy_js_typescript = require("@alloy-js/typescript");
|
|
15
|
-
let
|
|
16
|
-
let _powerlines_plugin_alloy_typescript_components_builtin_file = require("@powerlines/plugin-alloy/typescript/components/builtin-file");
|
|
13
|
+
let _power_plant_alloy_js_typescript = require("@power-plant/alloy-js/typescript");
|
|
17
14
|
let _stryke_path = require("@stryke/path");
|
|
18
15
|
|
|
19
16
|
//#region src/components/help-builtin.tsx
|
|
@@ -22,9 +19,9 @@ let _stryke_path = require("@stryke/path");
|
|
|
22
19
|
*/
|
|
23
20
|
function HelpBuiltin(props) {
|
|
24
21
|
const [{ command, children }, rest] = (0, _alloy_js_core.splitProps)(props, ["command", "children"]);
|
|
25
|
-
const context = (0,
|
|
22
|
+
const context = (0, _shell_shock_core_contexts_power_plant.usePowerlines)();
|
|
26
23
|
const theme = (0, _shell_shock_plugin_theme_contexts_theme.useTheme)();
|
|
27
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
24
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_shell_shock_core_contexts_power_plant.BuiltinFile, (0, _alloy_js_core_jsx_runtime.mergeProps)({
|
|
28
25
|
get id() {
|
|
29
26
|
return (0, _stryke_path.joinPaths)("help", ...command.segments.filter((segment) => !(0, _shell_shock_core_plugin_utils.isDynamicPathSegment)(segment)));
|
|
30
27
|
},
|
|
@@ -33,7 +30,7 @@ function HelpBuiltin(props) {
|
|
|
33
30
|
}
|
|
34
31
|
}, rest, {
|
|
35
32
|
get builtinImports() {
|
|
36
|
-
return (0, defu.
|
|
33
|
+
return (0, defu.defu)(rest.builtinImports ?? {}, {
|
|
37
34
|
utils: ["isUnicodeSupported"],
|
|
38
35
|
console: [
|
|
39
36
|
"splitText",
|
|
@@ -51,12 +48,12 @@ function HelpBuiltin(props) {
|
|
|
51
48
|
},
|
|
52
49
|
get children() {
|
|
53
50
|
return [
|
|
54
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
51
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript.TSDoc, {
|
|
55
52
|
get heading() {
|
|
56
53
|
return `Utility functions for displaying help information for the ${command.path ? `${command.title} command` : `${(0, _shell_shock_core_plugin_utils.getAppTitle)(context, true)} application`}.`;
|
|
57
54
|
},
|
|
58
55
|
get children() {
|
|
59
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
56
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript.TSDocRemarks, { get children() {
|
|
60
57
|
return `This module contains utility functions that assist in displaying help information for the ${command.path ? `${command.title} command` : `${(0, _shell_shock_core_plugin_utils.getAppTitle)(context, true)} application`}. The main function exported by this module is the \`showHelp\` function, which can be used to display help information for the specified command or application. This function can be called from within the command's handler or from any other part of the application where help information needs to be displayed.`;
|
|
61
58
|
} });
|
|
62
59
|
}
|
|
@@ -116,7 +113,7 @@ function HelpBuiltin(props) {
|
|
|
116
113
|
];
|
|
117
114
|
}
|
|
118
115
|
}),
|
|
119
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
116
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_core_components_spacing.Spacing, {}),
|
|
120
117
|
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
121
118
|
get when() {
|
|
122
119
|
return Boolean(children);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { CommandTree } from "@shell-shock/core";
|
|
2
|
-
import { BuiltinFileProps } from "@
|
|
3
|
-
|
|
2
|
+
import { BuiltinFileProps } from "@shell-shock/core/contexts/power-plant";
|
|
4
3
|
//#region src/components/help-builtin.d.ts
|
|
5
4
|
interface HelpBuiltinProps extends Omit<BuiltinFileProps, "id" | "description"> {
|
|
6
5
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help-builtin.d.cts","names":[],"sources":["../../src/components/help-builtin.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"help-builtin.d.cts","names":[],"sources":["../../src/components/help-builtin.tsx"],"mappings":";;;UAyCiB,yBAAyB,KACxC;;;;EAMA,SAAS;;;;;iBAMK,YAAY,OAAO,4CAAgB"}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { BuiltinFileProps } from "@
|
|
1
|
+
import { BuiltinFileProps } from "@shell-shock/core/contexts/power-plant";
|
|
2
2
|
import { CommandTree } from "@shell-shock/core";
|
|
3
|
-
|
|
4
3
|
//#region src/components/help-builtin.d.ts
|
|
5
4
|
interface HelpBuiltinProps extends Omit<BuiltinFileProps, "id" | "description"> {
|
|
6
5
|
/**
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { CommandHelpDisplay, VirtualCommandHelpDisplay } from "./display.mjs";
|
|
2
2
|
import { createComponent, createIntrinsic, memo, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
3
|
-
import { Show, code, splitProps } from "@alloy-js/core";
|
|
4
3
|
import { getAppBin, getAppTitle, isDynamicPathSegment } from "@shell-shock/core/plugin-utils";
|
|
5
4
|
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
6
|
-
import defu from "defu";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
5
|
+
import { defu } from "defu";
|
|
6
|
+
import { Show, code, splitProps } from "@alloy-js/core";
|
|
7
|
+
import { Spacing } from "@power-plant/alloy-js/core/components/spacing";
|
|
8
|
+
import { BuiltinFile, usePowerlines } from "@shell-shock/core/contexts/power-plant";
|
|
9
9
|
import { useTheme } from "@shell-shock/plugin-theme/contexts/theme";
|
|
10
10
|
import { camelCase } from "@stryke/string-format/camel-case";
|
|
11
11
|
import { FunctionDeclaration } from "@alloy-js/typescript";
|
|
12
|
-
import { TSDoc, TSDocRemarks } from "@
|
|
13
|
-
import { BuiltinFile } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
|
|
12
|
+
import { TSDoc, TSDocRemarks } from "@power-plant/alloy-js/typescript";
|
|
14
13
|
import { joinPaths } from "@stryke/path";
|
|
15
14
|
|
|
16
15
|
//#region src/components/help-builtin.tsx
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
3
3
|
let _alloy_js_core = require("@alloy-js/core");
|
|
4
|
-
let
|
|
5
|
-
let _powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
4
|
+
let _shell_shock_core_contexts_power_plant = require("@shell-shock/core/contexts/power-plant");
|
|
6
5
|
let _alloy_js_typescript = require("@alloy-js/typescript");
|
|
7
|
-
let
|
|
6
|
+
let _power_plant_alloy_js_typescript = require("@power-plant/alloy-js/typescript");
|
|
8
7
|
let _stryke_path = require("@stryke/path");
|
|
9
|
-
let
|
|
8
|
+
let _power_plant_alloy_js_core_components = require("@power-plant/alloy-js/core/components");
|
|
9
|
+
let _power_plant_alloy_js_typescript_components_tsdoc = require("@power-plant/alloy-js/typescript/components/tsdoc");
|
|
10
10
|
let _stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
|
|
11
11
|
|
|
12
12
|
//#region src/components/help-command.tsx
|
|
@@ -14,19 +14,19 @@ let _stryke_string_format_pascal_case = require("@stryke/string-format/pascal-ca
|
|
|
14
14
|
* A temporary placeholder component for the help command. The actual content of this component will be rendered in the `prepare` step of the help plugin, after the command list has been fully resolved. This is necessary to ensure that the help command's entry file is generated, and to avoid any issues with missing files or circular dependencies during the rendering process.
|
|
15
15
|
*/
|
|
16
16
|
function TemporaryHelpCommand() {
|
|
17
|
-
const context = (0,
|
|
18
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
17
|
+
const context = (0, _shell_shock_core_contexts_power_plant.usePowerlines)();
|
|
18
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript.TypescriptFile, {
|
|
19
19
|
get path() {
|
|
20
20
|
return (0, _stryke_path.joinPaths)(context.entryPath, "help", "command.ts");
|
|
21
21
|
},
|
|
22
22
|
get children() {
|
|
23
23
|
return [
|
|
24
24
|
_alloy_js_core.code` // Temporary placeholder file to ensure the help command's entry file is generated. The actual content of this file will be rendered in the \`prepare\` step of this plugin, after the command list has been fully resolved. `,
|
|
25
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
26
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
25
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_core_components.Spacing, {}),
|
|
26
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_tsdoc.TSDoc, {
|
|
27
27
|
heading: "Display command usage details and other useful information to the user.",
|
|
28
28
|
get children() {
|
|
29
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
29
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_tsdoc.TSDocParam, {
|
|
30
30
|
name: "commands",
|
|
31
31
|
children: `The command segments for the command to show help for. This is used to determine which command's help information to display. If no commands are provided, general help information about the CLI application will be displayed.`
|
|
32
32
|
});
|
|
@@ -51,7 +51,7 @@ function TemporaryHelpCommand() {
|
|
|
51
51
|
* The Help command's handler wrapper for the Shell Shock project.
|
|
52
52
|
*/
|
|
53
53
|
function HelpCommand(props) {
|
|
54
|
-
const context = (0,
|
|
54
|
+
const context = (0, _shell_shock_core_contexts_power_plant.usePowerlines)();
|
|
55
55
|
const helpImports = (0, _alloy_js_core.computed)(() => props.commands ? props.commands.reduce((ret, commands) => {
|
|
56
56
|
ret[(0, _stryke_path.joinPaths)("help", ...commands)] = [{
|
|
57
57
|
name: "showHelp",
|
|
@@ -60,7 +60,7 @@ function HelpCommand(props) {
|
|
|
60
60
|
return ret;
|
|
61
61
|
}, {}) : {});
|
|
62
62
|
const commandSegmentsList = props.commands ?? [];
|
|
63
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
63
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript.TypescriptFile, {
|
|
64
64
|
get path() {
|
|
65
65
|
return (0, _stryke_path.joinPaths)(context.entryPath, "help", "command.ts");
|
|
66
66
|
},
|
|
@@ -87,10 +87,10 @@ function HelpCommand(props) {
|
|
|
87
87
|
};
|
|
88
88
|
},
|
|
89
89
|
get children() {
|
|
90
|
-
return [(0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
90
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_tsdoc.TSDoc, {
|
|
91
91
|
heading: "Display command usage details and other useful information to the user.",
|
|
92
92
|
get children() {
|
|
93
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(
|
|
93
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_typescript_components_tsdoc.TSDocParam, {
|
|
94
94
|
name: "commands",
|
|
95
95
|
children: `The command segments for the command to show help for. This is used to determine which command's help information to display. If no commands are provided, general help information about the CLI application will be displayed.`
|
|
96
96
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"help-command.d.cts","names":[],"sources":["../../src/components/help-command.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"help-command.d.cts","names":[],"sources":["../../src/components/help-command.tsx"],"mappings":";;;;iBAuCgB,iDAAoB;UAwBnB;EACf;;;;;iBAMc,YAAY,OAAO,6CAAiB"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { createComponent, memo } from "@alloy-js/core/jsx-runtime";
|
|
2
2
|
import { For, Show, code, computed } from "@alloy-js/core";
|
|
3
|
-
import {
|
|
4
|
-
import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
|
|
3
|
+
import { usePowerlines } from "@shell-shock/core/contexts/power-plant";
|
|
5
4
|
import { ElseClause, ElseIfClause, FunctionDeclaration, IfStatement } from "@alloy-js/typescript";
|
|
6
|
-
import { TypescriptFile } from "@
|
|
5
|
+
import { TypescriptFile } from "@power-plant/alloy-js/typescript";
|
|
7
6
|
import { joinPaths } from "@stryke/path";
|
|
8
|
-
import {
|
|
7
|
+
import { Spacing } from "@power-plant/alloy-js/core/components";
|
|
8
|
+
import { TSDoc as TSDoc$1, TSDocParam } from "@power-plant/alloy-js/typescript/components/tsdoc";
|
|
9
9
|
import { pascalCase } from "@stryke/string-format/pascal-case";
|
|
10
10
|
|
|
11
11
|
//#region src/components/help-command.tsx
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
|
+
const require_components_help_builtin = require('./components/help-builtin.cjs');
|
|
3
|
+
const require_components_help_command = require('./components/help-command.cjs');
|
|
4
|
+
require('./components/index.cjs');
|
|
5
|
+
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
6
|
+
let _shell_shock_core_helpers_power_plant = require("@shell-shock/core/helpers/power-plant");
|
|
7
|
+
let _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
|
|
8
|
+
let _alloy_js_core = require("@alloy-js/core");
|
|
9
|
+
let _power_plant_alloy_js_core_components = require("@power-plant/alloy-js/core/components");
|
|
10
|
+
let _stryke_helpers_get_unique = require("@stryke/helpers/get-unique");
|
|
11
|
+
|
|
12
|
+
//#region src/generator.tsx
|
|
13
|
+
/**
|
|
14
|
+
* Power Plant generator for Shell Shock help builtins and commands.
|
|
15
|
+
*
|
|
16
|
+
* @see https://github.com/storm-software/power-plant/tree/main/packages/generators/alloy-js
|
|
17
|
+
*/
|
|
18
|
+
const helpGenerator = (0, _shell_shock_core_helpers_power_plant.defineCommandGenerator)({
|
|
19
|
+
meta: {
|
|
20
|
+
name: "shell-shock-help",
|
|
21
|
+
title: "Shell Shock Help Generator",
|
|
22
|
+
description: "Generates help built-in modules and the help command from the Shell Shock command tree specification.",
|
|
23
|
+
version: "1.0",
|
|
24
|
+
tags: [
|
|
25
|
+
"shell-shock",
|
|
26
|
+
"help",
|
|
27
|
+
"alloy-js"
|
|
28
|
+
]
|
|
29
|
+
},
|
|
30
|
+
generator: async (_commands, options) => {
|
|
31
|
+
const context = options.context;
|
|
32
|
+
const commands = await (0, _shell_shock_core_plugin_utils.getCommandList)(context);
|
|
33
|
+
const segments = (0, _alloy_js_core.computed)(() => (0, _stryke_helpers_get_unique.getUniqueBy)(commands.map((command) => command.segments.filter((segment) => !(0, _shell_shock_core_plugin_utils.isDynamicPathSegment)(segment)).filter((segment) => segment.length > 0)), (segments) => segments.join("/")).filter((segments) => segments.length > 0).sort((a, b) => a.join("/").localeCompare(b.join("/"))));
|
|
34
|
+
await (0, _shell_shock_core_helpers_power_plant.renderCommandTemplate)(options, [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
35
|
+
get when() {
|
|
36
|
+
return context.config.help.builtins !== false;
|
|
37
|
+
},
|
|
38
|
+
get children() {
|
|
39
|
+
return [
|
|
40
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(require_components_help_builtin.HelpBuiltin, { get command() {
|
|
41
|
+
return (0, _shell_shock_core_plugin_utils.computeBin)(context);
|
|
42
|
+
} }),
|
|
43
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_core_components.Spacing, {}),
|
|
44
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
45
|
+
get each() {
|
|
46
|
+
return commands.sort((a, b) => a.name.localeCompare(b.name));
|
|
47
|
+
},
|
|
48
|
+
doubleHardline: true,
|
|
49
|
+
children: (command) => (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_help_builtin.HelpBuiltin, { command })
|
|
50
|
+
}),
|
|
51
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(require_components_help_command.HelpCommand, { get commands() {
|
|
52
|
+
return segments.value;
|
|
53
|
+
} })
|
|
54
|
+
];
|
|
55
|
+
}
|
|
56
|
+
})]);
|
|
57
|
+
}
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
//#endregion
|
|
61
|
+
exports.default = helpGenerator;
|
|
62
|
+
exports.helpGenerator = helpGenerator;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/generator.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Power Plant generator for Shell Shock help builtins and commands.
|
|
4
|
+
*
|
|
5
|
+
* @see https://github.com/storm-software/power-plant/tree/main/packages/generators/alloy-js
|
|
6
|
+
*/
|
|
7
|
+
declare const helpGenerator: import("@power-plant/core").GeneratorConfigObject<Record<string, import("@shell-shock/schema").SerializedCommandTree>, import("@shell-shock/core/helpers/power-plant").CommandGeneratorOptions, void>;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { helpGenerator as default, helpGenerator };
|
|
10
|
+
//# sourceMappingURL=generator.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.d.cts","names":[],"sources":["../src/generator.tsx"],"mappings":";;;;;;cAsCa,2CAAa,sBAAA,6CAAA,wEAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/generator.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Power Plant generator for Shell Shock help builtins and commands.
|
|
4
|
+
*
|
|
5
|
+
* @see https://github.com/storm-software/power-plant/tree/main/packages/generators/alloy-js
|
|
6
|
+
*/
|
|
7
|
+
declare const helpGenerator: import("@power-plant/core").GeneratorConfigObject<Record<string, import("@shell-shock/schema").SerializedCommandTree>, import("@shell-shock/core/helpers/power-plant").CommandGeneratorOptions, void>;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { helpGenerator as default, helpGenerator };
|
|
10
|
+
//# sourceMappingURL=generator.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.d.mts","names":[],"sources":["../src/generator.tsx"],"mappings":""}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { HelpBuiltin } from "./components/help-builtin.mjs";
|
|
2
|
+
import { HelpCommand } from "./components/help-command.mjs";
|
|
3
|
+
import "./components/index.mjs";
|
|
4
|
+
import { createComponent } from "@alloy-js/core/jsx-runtime";
|
|
5
|
+
import { defineCommandGenerator, renderCommandTemplate } from "@shell-shock/core/helpers/power-plant";
|
|
6
|
+
import { computeBin, getCommandList, isDynamicPathSegment } from "@shell-shock/core/plugin-utils";
|
|
7
|
+
import { For, Show, computed } from "@alloy-js/core";
|
|
8
|
+
import { Spacing } from "@power-plant/alloy-js/core/components";
|
|
9
|
+
import { getUniqueBy } from "@stryke/helpers/get-unique";
|
|
10
|
+
|
|
11
|
+
//#region src/generator.tsx
|
|
12
|
+
/**
|
|
13
|
+
* Power Plant generator for Shell Shock help builtins and commands.
|
|
14
|
+
*
|
|
15
|
+
* @see https://github.com/storm-software/power-plant/tree/main/packages/generators/alloy-js
|
|
16
|
+
*/
|
|
17
|
+
const helpGenerator = defineCommandGenerator({
|
|
18
|
+
meta: {
|
|
19
|
+
name: "shell-shock-help",
|
|
20
|
+
title: "Shell Shock Help Generator",
|
|
21
|
+
description: "Generates help built-in modules and the help command from the Shell Shock command tree specification.",
|
|
22
|
+
version: "1.0",
|
|
23
|
+
tags: [
|
|
24
|
+
"shell-shock",
|
|
25
|
+
"help",
|
|
26
|
+
"alloy-js"
|
|
27
|
+
]
|
|
28
|
+
},
|
|
29
|
+
generator: async (_commands, options) => {
|
|
30
|
+
const context = options.context;
|
|
31
|
+
const commands = await getCommandList(context);
|
|
32
|
+
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("/"))));
|
|
33
|
+
await renderCommandTemplate(options, [createComponent(Show, {
|
|
34
|
+
get when() {
|
|
35
|
+
return context.config.help.builtins !== false;
|
|
36
|
+
},
|
|
37
|
+
get children() {
|
|
38
|
+
return [
|
|
39
|
+
createComponent(HelpBuiltin, { get command() {
|
|
40
|
+
return computeBin(context);
|
|
41
|
+
} }),
|
|
42
|
+
createComponent(Spacing, {}),
|
|
43
|
+
createComponent(For, {
|
|
44
|
+
get each() {
|
|
45
|
+
return commands.sort((a, b) => a.name.localeCompare(b.name));
|
|
46
|
+
},
|
|
47
|
+
doubleHardline: true,
|
|
48
|
+
children: (command) => createComponent(HelpBuiltin, { command })
|
|
49
|
+
}),
|
|
50
|
+
createComponent(HelpCommand, { get commands() {
|
|
51
|
+
return segments.value;
|
|
52
|
+
} })
|
|
53
|
+
];
|
|
54
|
+
}
|
|
55
|
+
})]);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
//#endregion
|
|
60
|
+
export { helpGenerator as default, helpGenerator };
|
|
61
|
+
//# sourceMappingURL=generator.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.mjs","names":[],"sources":[],"mappings":""}
|
package/dist/index.cjs
CHANGED
|
@@ -1,22 +1,15 @@
|
|
|
1
1
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
|
-
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
3
|
-
const require_components_help_builtin = require('./components/help-builtin.cjs');
|
|
4
2
|
const require_components_help_command = require('./components/help-command.cjs');
|
|
5
3
|
require('./components/index.cjs');
|
|
4
|
+
const require_generator = require('./generator.cjs');
|
|
6
5
|
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
7
|
-
let
|
|
8
|
-
let _powerlines_plugin_alloy_core_components = require("@powerlines/plugin-alloy/core/components");
|
|
9
|
-
let _powerlines_plugin_alloy_render = require("@powerlines/plugin-alloy/render");
|
|
6
|
+
let _shell_shock_core_helpers_power_plant = require("@shell-shock/core/helpers/power-plant");
|
|
10
7
|
let _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
|
|
11
8
|
let _shell_shock_plugin_console = require("@shell-shock/plugin-console");
|
|
12
|
-
_shell_shock_plugin_console = require_runtime.__toESM(_shell_shock_plugin_console, 1);
|
|
13
9
|
let _shell_shock_plugin_theme = require("@shell-shock/plugin-theme");
|
|
14
|
-
_shell_shock_plugin_theme = require_runtime.__toESM(_shell_shock_plugin_theme, 1);
|
|
15
|
-
let _stryke_helpers_get_unique = require("@stryke/helpers/get-unique");
|
|
16
10
|
let _stryke_path_join = require("@stryke/path/join");
|
|
17
11
|
let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
18
12
|
let defu = require("defu");
|
|
19
|
-
defu = require_runtime.__toESM(defu, 1);
|
|
20
13
|
|
|
21
14
|
//#region src/index.tsx
|
|
22
15
|
/**
|
|
@@ -24,14 +17,14 @@ defu = require_runtime.__toESM(defu, 1);
|
|
|
24
17
|
*/
|
|
25
18
|
const plugin = (options = {}) => {
|
|
26
19
|
return [
|
|
27
|
-
...(0, _shell_shock_plugin_theme.
|
|
28
|
-
...(0, _shell_shock_plugin_console.
|
|
20
|
+
...(0, _shell_shock_plugin_theme.plugin)(options.theme),
|
|
21
|
+
...(0, _shell_shock_plugin_console.plugin)(options.console),
|
|
29
22
|
{
|
|
30
23
|
name: "shell-shock/help",
|
|
31
24
|
enforce: "post",
|
|
32
25
|
config() {
|
|
33
26
|
this.debug("Providing default configuration for the Shell Shock `help` plugin.");
|
|
34
|
-
return { help: (0, defu.
|
|
27
|
+
return { help: (0, defu.defu)({ command: options.command === false ? false : (0, _stryke_type_checks_is_set_string.isSetString)(options.command) ? { name: options.command } : { name: "help" } }, options, { builtins: true }) };
|
|
35
28
|
},
|
|
36
29
|
async configResolved() {
|
|
37
30
|
this.debug("Adding the Help command to the application context.");
|
|
@@ -53,39 +46,15 @@ const plugin = (options = {}) => {
|
|
|
53
46
|
virtual: false,
|
|
54
47
|
...this.config.help.command
|
|
55
48
|
});
|
|
56
|
-
await (0,
|
|
49
|
+
await (0, _shell_shock_core_helpers_power_plant.renderCommandTemplate)({ context: this }, (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_help_command.TemporaryHelpCommand, {}));
|
|
57
50
|
}
|
|
58
51
|
},
|
|
59
52
|
prepare: {
|
|
60
53
|
order: "post",
|
|
61
54
|
async handler() {
|
|
62
|
-
const _self$ = this;
|
|
63
55
|
const commands = await (0, _shell_shock_core_plugin_utils.getCommandList)(this);
|
|
64
|
-
this.debug(`Rendering \`help\` built-ins for each of the ${commands.length} command modules.`);
|
|
65
|
-
|
|
66
|
-
return (0, _powerlines_plugin_alloy_render.render)(this, [(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
67
|
-
get when() {
|
|
68
|
-
return _self$.config.help.builtins !== false;
|
|
69
|
-
},
|
|
70
|
-
get children() {
|
|
71
|
-
return [
|
|
72
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(require_components_help_builtin.HelpBuiltin, { get command() {
|
|
73
|
-
return (0, _shell_shock_core_plugin_utils.computeBin)(_self$);
|
|
74
|
-
} }),
|
|
75
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components.Spacing, {}),
|
|
76
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
77
|
-
get each() {
|
|
78
|
-
return commands.sort((a, b) => a.name.localeCompare(b.name));
|
|
79
|
-
},
|
|
80
|
-
doubleHardline: true,
|
|
81
|
-
children: (command) => (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_help_builtin.HelpBuiltin, { command })
|
|
82
|
-
}),
|
|
83
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(require_components_help_command.HelpCommand, { get commands() {
|
|
84
|
-
return segments.value;
|
|
85
|
-
} })
|
|
86
|
-
];
|
|
87
|
-
}
|
|
88
|
-
})]);
|
|
56
|
+
this.debug(`Rendering \`help\` built-ins via Power Plant for each of the ${commands.length} command modules.`);
|
|
57
|
+
return (0, _shell_shock_core_helpers_power_plant.executeCommandGenerator)(this, require_generator.default);
|
|
89
58
|
}
|
|
90
59
|
}
|
|
91
60
|
}
|
|
@@ -94,4 +63,5 @@ const plugin = (options = {}) => {
|
|
|
94
63
|
|
|
95
64
|
//#endregion
|
|
96
65
|
exports.default = plugin;
|
|
97
|
-
exports.plugin = plugin;
|
|
66
|
+
exports.plugin = plugin;
|
|
67
|
+
exports.helpGenerator = require_generator.default;
|
package/dist/index.d.cts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
import helpGenerator from "./generator.cjs";
|
|
1
2
|
import { HelpPluginContext, HelpPluginOptions, HelpPluginResolvedConfig, HelpPluginUserConfig } from "./types/plugin.cjs";
|
|
3
|
+
import "./types/index.cjs";
|
|
2
4
|
import { Plugin } from "powerlines";
|
|
3
|
-
|
|
4
5
|
//#region src/index.d.ts
|
|
5
6
|
/**
|
|
6
7
|
* The Help - Shell Shock plugin to add a help command to the application.
|
|
7
8
|
*/
|
|
8
9
|
declare const plugin: <TContext extends HelpPluginContext = HelpPluginContext>(options?: HelpPluginOptions) => Plugin<TContext>[];
|
|
9
10
|
//#endregion
|
|
10
|
-
export { type HelpPluginContext, type HelpPluginOptions, type HelpPluginResolvedConfig, type HelpPluginUserConfig, plugin as default, plugin };
|
|
11
|
+
export { type HelpPluginContext, type HelpPluginOptions, type HelpPluginResolvedConfig, type HelpPluginUserConfig, plugin as default, plugin, helpGenerator };
|
|
11
12
|
//# sourceMappingURL=index.d.cts.map
|
package/dist/index.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"mappings":";;;;;;;;cAwCa,SAAU,iBAAiB,oBAAoB,mBAC1D,UAAS,sBACR,OAAO"}
|
package/dist/index.d.mts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
import helpGenerator from "./generator.mjs";
|
|
1
2
|
import { HelpPluginContext, HelpPluginOptions, HelpPluginResolvedConfig, HelpPluginUserConfig } from "./types/plugin.mjs";
|
|
3
|
+
import "./types/index.mjs";
|
|
2
4
|
import { Plugin } from "powerlines";
|
|
3
|
-
|
|
4
5
|
//#region src/index.d.ts
|
|
5
6
|
/**
|
|
6
7
|
* The Help - Shell Shock plugin to add a help command to the application.
|
|
7
8
|
*/
|
|
8
9
|
declare const plugin: <TContext extends HelpPluginContext = HelpPluginContext>(options?: HelpPluginOptions) => Plugin<TContext>[];
|
|
9
10
|
//#endregion
|
|
10
|
-
export { type HelpPluginContext, type HelpPluginOptions, type HelpPluginResolvedConfig, type HelpPluginUserConfig, plugin as default, plugin };
|
|
11
|
+
export { type HelpPluginContext, type HelpPluginOptions, type HelpPluginResolvedConfig, type HelpPluginUserConfig, plugin as default, plugin, helpGenerator };
|
|
11
12
|
//# sourceMappingURL=index.d.mts.map
|
package/dist/index.mjs
CHANGED
|
@@ -1,17 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { HelpCommand, TemporaryHelpCommand } from "./components/help-command.mjs";
|
|
1
|
+
import { TemporaryHelpCommand } from "./components/help-command.mjs";
|
|
3
2
|
import "./components/index.mjs";
|
|
3
|
+
import helpGenerator from "./generator.mjs";
|
|
4
4
|
import { createComponent } from "@alloy-js/core/jsx-runtime";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import console from "@shell-shock/plugin-console";
|
|
10
|
-
import theme from "@shell-shock/plugin-theme";
|
|
11
|
-
import { getUniqueBy } from "@stryke/helpers/get-unique";
|
|
5
|
+
import { executeCommandGenerator, renderCommandTemplate } from "@shell-shock/core/helpers/power-plant";
|
|
6
|
+
import { getCommandList } from "@shell-shock/core/plugin-utils";
|
|
7
|
+
import { plugin as plugin$1 } from "@shell-shock/plugin-console";
|
|
8
|
+
import { plugin as plugin$2 } from "@shell-shock/plugin-theme";
|
|
12
9
|
import { joinPaths } from "@stryke/path/join";
|
|
13
10
|
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
14
|
-
import defu from "defu";
|
|
11
|
+
import { defu } from "defu";
|
|
15
12
|
|
|
16
13
|
//#region src/index.tsx
|
|
17
14
|
/**
|
|
@@ -19,8 +16,8 @@ import defu from "defu";
|
|
|
19
16
|
*/
|
|
20
17
|
const plugin = (options = {}) => {
|
|
21
18
|
return [
|
|
22
|
-
...
|
|
23
|
-
...
|
|
19
|
+
...plugin$2(options.theme),
|
|
20
|
+
...plugin$1(options.console),
|
|
24
21
|
{
|
|
25
22
|
name: "shell-shock/help",
|
|
26
23
|
enforce: "post",
|
|
@@ -48,39 +45,15 @@ const plugin = (options = {}) => {
|
|
|
48
45
|
virtual: false,
|
|
49
46
|
...this.config.help.command
|
|
50
47
|
});
|
|
51
|
-
await
|
|
48
|
+
await renderCommandTemplate({ context: this }, createComponent(TemporaryHelpCommand, {}));
|
|
52
49
|
}
|
|
53
50
|
},
|
|
54
51
|
prepare: {
|
|
55
52
|
order: "post",
|
|
56
53
|
async handler() {
|
|
57
|
-
const _self$ = this;
|
|
58
54
|
const commands = await getCommandList(this);
|
|
59
|
-
this.debug(`Rendering \`help\` built-ins for each of the ${commands.length} command modules.`);
|
|
60
|
-
|
|
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
|
-
})]);
|
|
55
|
+
this.debug(`Rendering \`help\` built-ins via Power Plant for each of the ${commands.length} command modules.`);
|
|
56
|
+
return executeCommandGenerator(this, helpGenerator);
|
|
84
57
|
}
|
|
85
58
|
}
|
|
86
59
|
}
|
|
@@ -88,5 +61,5 @@ const plugin = (options = {}) => {
|
|
|
88
61
|
};
|
|
89
62
|
|
|
90
63
|
//#endregion
|
|
91
|
-
export { plugin as default, plugin };
|
|
64
|
+
export { plugin as default, plugin, helpGenerator };
|
|
92
65
|
//# sourceMappingURL=index.mjs.map
|
package/dist/types/index.cjs
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
require('./plugin.cjs');
|
package/dist/types/index.mjs
CHANGED
package/dist/types/plugin.d.cts
CHANGED
|
@@ -3,7 +3,6 @@ import { Context } from "@shell-shock/core/types/context";
|
|
|
3
3
|
import { ConsolePluginContext, ConsolePluginOptions, ConsolePluginResolvedConfig, ConsolePluginUserConfig } from "@shell-shock/plugin-console";
|
|
4
4
|
import { ThemePluginContext, ThemePluginOptions, ThemePluginResolvedConfig, ThemePluginUserConfig } from "@shell-shock/plugin-theme";
|
|
5
5
|
import { RequiredKeys } from "@stryke/types/base";
|
|
6
|
-
|
|
7
6
|
//#region src/types/plugin.d.ts
|
|
8
7
|
interface HelpPluginOptions {
|
|
9
8
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":";;;;;;UAsCiB;;;;;;EAMf;;;;;;;;;EAUA,UAAU,QAAQ;;;;EAKlB,QAAQ;;;;EAKR,UAAU;;KAGA,uBAAuB,wBACjC,0BACA;;;;EAIE,MAAM,KAAK;;;;;;IAMT,SAAS,QAAQ;;;KAIX,2BAA2B,4BACrC,8BACA;;;;EAIE,MAAM,SAAS,KAAK;;;;;;IAMlB,SAAS,aAAa,QAAQ;;;KAIxB,kBACV,wBAAwB,2BAA2B,4BACjD,mBAAmB,mBACrB,qBAAqB,mBACrB,QAAQ"}
|
package/dist/types/plugin.d.mts
CHANGED
|
@@ -3,7 +3,6 @@ import { ThemePluginContext, ThemePluginOptions, ThemePluginResolvedConfig, Them
|
|
|
3
3
|
import { CommandConfig, ResolvedConfig, UserConfig } from "@shell-shock/core";
|
|
4
4
|
import { Context } from "@shell-shock/core/types/context";
|
|
5
5
|
import { RequiredKeys } from "@stryke/types/base";
|
|
6
|
-
|
|
7
6
|
//#region src/types/plugin.d.ts
|
|
8
7
|
interface HelpPluginOptions {
|
|
9
8
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shell-shock/plugin-help",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.42",
|
|
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": [
|
|
@@ -115,6 +115,20 @@
|
|
|
115
115
|
"default": "./dist/components/help-command.mjs"
|
|
116
116
|
}
|
|
117
117
|
},
|
|
118
|
+
"./generator": {
|
|
119
|
+
"require": {
|
|
120
|
+
"types": "./dist/generator.d.cts",
|
|
121
|
+
"default": "./dist/generator.cjs"
|
|
122
|
+
},
|
|
123
|
+
"import": {
|
|
124
|
+
"types": "./dist/generator.d.mts",
|
|
125
|
+
"default": "./dist/generator.mjs"
|
|
126
|
+
},
|
|
127
|
+
"default": {
|
|
128
|
+
"types": "./dist/generator.d.mts",
|
|
129
|
+
"default": "./dist/generator.mjs"
|
|
130
|
+
}
|
|
131
|
+
},
|
|
118
132
|
"./package.json": "./package.json",
|
|
119
133
|
"./types": {
|
|
120
134
|
"require": {
|
|
@@ -149,28 +163,28 @@
|
|
|
149
163
|
"module": "./dist/index.mjs",
|
|
150
164
|
"types": "./dist/index.d.cts",
|
|
151
165
|
"typings": "dist/index.d.mts",
|
|
152
|
-
"files": ["dist
|
|
166
|
+
"files": ["dist"],
|
|
153
167
|
"dependencies": {
|
|
154
|
-
"@alloy-js/core": "^0.
|
|
155
|
-
"@alloy-js/typescript": "^0.
|
|
156
|
-
"@
|
|
157
|
-
"@powerlines/plugin-alloy": "^0.26.
|
|
158
|
-
"@powerlines/plugin-plugin": "^0.12.
|
|
159
|
-
"@shell-shock/core": "0.17.
|
|
160
|
-
"@shell-shock/plugin-console": "0.2.
|
|
161
|
-
"@shell-shock/plugin-theme": "0.4.
|
|
162
|
-
"@stryke/helpers": "^0.10.
|
|
163
|
-
"@stryke/path": "^0.29.
|
|
164
|
-
"@stryke/string-format": "^0.17.
|
|
165
|
-
"@stryke/type-checks": "^0.6.
|
|
166
|
-
"@stryke/types": "^0.12.
|
|
168
|
+
"@alloy-js/core": "^0.24.1",
|
|
169
|
+
"@alloy-js/typescript": "^0.24.0",
|
|
170
|
+
"@power-plant/alloy-js": "^0.0.87",
|
|
171
|
+
"@powerlines/plugin-alloy": "^0.26.309",
|
|
172
|
+
"@powerlines/plugin-plugin": "^0.12.624",
|
|
173
|
+
"@shell-shock/core": "0.17.24",
|
|
174
|
+
"@shell-shock/plugin-console": "0.2.28",
|
|
175
|
+
"@shell-shock/plugin-theme": "0.4.37",
|
|
176
|
+
"@stryke/helpers": "^0.10.48",
|
|
177
|
+
"@stryke/path": "^0.29.35",
|
|
178
|
+
"@stryke/string-format": "^0.17.50",
|
|
179
|
+
"@stryke/type-checks": "^0.6.41",
|
|
180
|
+
"@stryke/types": "^0.12.36",
|
|
167
181
|
"defu": "^6.1.7",
|
|
168
|
-
"powerlines": "^0.47.
|
|
182
|
+
"powerlines": "^0.47.211"
|
|
169
183
|
},
|
|
170
184
|
"devDependencies": {
|
|
171
|
-
"@powerlines/plugin-deepkit": "^0.11.
|
|
172
|
-
"@types/node": "^25.9.
|
|
185
|
+
"@powerlines/plugin-deepkit": "^0.11.554",
|
|
186
|
+
"@types/node": "^25.9.5"
|
|
173
187
|
},
|
|
174
188
|
"publishConfig": { "access": "public" },
|
|
175
|
-
"gitHead": "
|
|
189
|
+
"gitHead": "06592cb0cccc2c7e9297af4c5138550e86fa4eec"
|
|
176
190
|
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
//#region \0rolldown/runtime.js
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __copyProps = (to, from, except, desc) => {
|
|
9
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
-
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
-
key = keys[i];
|
|
12
|
-
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
13
|
-
__defProp(to, key, {
|
|
14
|
-
get: ((k) => from[k]).bind(null, key),
|
|
15
|
-
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return to;
|
|
21
|
-
};
|
|
22
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
23
|
-
value: mod,
|
|
24
|
-
enumerable: true
|
|
25
|
-
}) : target, mod));
|
|
26
|
-
|
|
27
|
-
//#endregion
|
|
28
|
-
|
|
29
|
-
exports.__toESM = __toESM;
|