@shell-shock/preset-script 0.6.63 → 0.6.66
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/_virtual/_rolldown/runtime.cjs +29 -1
- package/dist/components/bin-entry.cjs +149 -3
- package/dist/components/bin-entry.d.cts.map +1 -1
- package/dist/components/bin-entry.d.mts.map +1 -1
- package/dist/components/bin-entry.mjs +145 -3
- package/dist/components/bin-entry.mjs.map +1 -1
- package/dist/components/command-entry.cjs +205 -3
- package/dist/components/command-entry.d.mts.map +1 -1
- package/dist/components/command-entry.mjs +200 -3
- package/dist/components/command-entry.mjs.map +1 -1
- package/dist/components/command-router.cjs +159 -2
- package/dist/components/command-router.d.cts.map +1 -1
- package/dist/components/command-router.d.mts.map +1 -1
- package/dist/components/command-router.mjs +156 -2
- package/dist/components/command-router.mjs.map +1 -1
- package/dist/components/exit-function-declaration.cjs +112 -6
- package/dist/components/exit-function-declaration.d.cts +1 -3
- package/dist/components/exit-function-declaration.d.cts.map +1 -1
- package/dist/components/exit-function-declaration.d.mts +1 -3
- package/dist/components/exit-function-declaration.d.mts.map +1 -1
- package/dist/components/exit-function-declaration.mjs +111 -6
- package/dist/components/exit-function-declaration.mjs.map +1 -1
- package/dist/components/index.cjs +18 -1
- package/dist/components/index.mjs +7 -1
- package/dist/components/virtual-command-entry.cjs +156 -1
- package/dist/components/virtual-command-entry.d.mts.map +1 -1
- package/dist/components/virtual-command-entry.mjs +152 -1
- package/dist/components/virtual-command-entry.mjs.map +1 -1
- package/dist/helpers/get-global-options.cjs +73 -1
- package/dist/helpers/get-global-options.d.cts.map +1 -1
- package/dist/helpers/get-global-options.d.mts.map +1 -1
- package/dist/helpers/get-global-options.mjs +71 -1
- package/dist/helpers/get-global-options.mjs.map +1 -1
- package/dist/index.cjs +123 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +117 -1
- package/dist/index.mjs.map +1 -1
- package/dist/types/index.mjs +1 -1
- package/dist/types/plugin.d.mts.map +1 -1
- package/dist/types/plugin.mjs +1 -1
- package/package.json +17 -17
|
@@ -1,2 +1,153 @@
|
|
|
1
|
-
import{CommandRouter
|
|
1
|
+
import { CommandRouter } from "./command-router.mjs";
|
|
2
|
+
import { CommandEntry } from "./command-entry.mjs";
|
|
3
|
+
import { createComponent, createIntrinsic, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
4
|
+
import { For, Show, code, computed } from "@alloy-js/core";
|
|
5
|
+
import { FunctionDeclaration } from "@alloy-js/typescript";
|
|
6
|
+
import { Spacing } from "@powerlines/plugin-alloy/core/components";
|
|
7
|
+
import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
|
|
8
|
+
import { TSDoc, TSDocParam, TSDocRemarks, TSDocTitle } from "@powerlines/plugin-alloy/typescript/components/tsdoc";
|
|
9
|
+
import { getAppBin, getDynamicPathSegmentName, isDynamicPathSegment } from "@shell-shock/core/plugin-utils";
|
|
10
|
+
import { pascalCase } from "@stryke/string-format/pascal-case";
|
|
11
|
+
import defu from "defu";
|
|
12
|
+
import { joinPaths } from "@stryke/path/join";
|
|
13
|
+
import { constantCase } from "@stryke/string-format/constant-case";
|
|
14
|
+
import { TypescriptFile } from "@powerlines/plugin-alloy/typescript/components/typescript-file";
|
|
15
|
+
|
|
16
|
+
//#region src/components/virtual-command-entry.tsx
|
|
17
|
+
/**
|
|
18
|
+
* A component that generates the `handler` function declaration for a command.
|
|
19
|
+
*/
|
|
20
|
+
function VirtualCommandHandlerDeclaration(props) {
|
|
21
|
+
const { command, children, banner } = props;
|
|
22
|
+
const context = usePowerlines();
|
|
23
|
+
return [createComponent(TSDoc, {
|
|
24
|
+
get heading() {
|
|
25
|
+
return `The ${command.title} (${getAppBin(context)} ${command.segments.map((segment) => isDynamicPathSegment(segment) ? `[${constantCase(getDynamicPathSegmentName(segment))}]` : segment).join(" ")}) virtual command.`;
|
|
26
|
+
},
|
|
27
|
+
get children() {
|
|
28
|
+
return [
|
|
29
|
+
createComponent(TSDocRemarks, { get children() {
|
|
30
|
+
return `${command.description.replace(/\.+$/, "")}.`;
|
|
31
|
+
} }),
|
|
32
|
+
createIntrinsic("hbr", {}),
|
|
33
|
+
createComponent(TSDocTitle, { get children() {
|
|
34
|
+
return command.title;
|
|
35
|
+
} }),
|
|
36
|
+
createComponent(TSDocParam, {
|
|
37
|
+
name: "args",
|
|
38
|
+
children: `The command-line arguments passed to the command.`
|
|
39
|
+
})
|
|
40
|
+
];
|
|
41
|
+
}
|
|
42
|
+
}), createComponent(FunctionDeclaration, {
|
|
43
|
+
"export": true,
|
|
44
|
+
async: true,
|
|
45
|
+
name: "handler",
|
|
46
|
+
parameters: [{
|
|
47
|
+
name: "args",
|
|
48
|
+
type: "string[]",
|
|
49
|
+
default: "useArgs()"
|
|
50
|
+
}],
|
|
51
|
+
get children() {
|
|
52
|
+
return [
|
|
53
|
+
createComponent(Spacing, {}),
|
|
54
|
+
children,
|
|
55
|
+
createComponent(Spacing, {}),
|
|
56
|
+
createComponent(Show, {
|
|
57
|
+
get when() {
|
|
58
|
+
return Boolean(banner);
|
|
59
|
+
},
|
|
60
|
+
children: banner
|
|
61
|
+
}),
|
|
62
|
+
createComponent(Spacing, {}),
|
|
63
|
+
code`return showHelp(); `
|
|
64
|
+
];
|
|
65
|
+
}
|
|
66
|
+
})];
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* The virtual command entry point for the Shell Shock project.
|
|
70
|
+
*/
|
|
71
|
+
function VirtualCommandEntry(props) {
|
|
72
|
+
const { command, imports, builtinImports, ...rest } = props;
|
|
73
|
+
const context = usePowerlines();
|
|
74
|
+
const filePath = computed(() => joinPaths(context.entryPath, command.segments.filter((segment) => !isDynamicPathSegment(segment)).join("/"), "index.ts"));
|
|
75
|
+
return [createComponent(TypescriptFile, mergeProps(rest, {
|
|
76
|
+
get path() {
|
|
77
|
+
return filePath.value;
|
|
78
|
+
},
|
|
79
|
+
get imports() {
|
|
80
|
+
return defu(imports ?? {}, Object.entries(command.children).filter(([, child]) => child.virtual).reduce((ret, [name, child]) => {
|
|
81
|
+
ret[`./${child.name}`] = [{
|
|
82
|
+
name: "handler",
|
|
83
|
+
alias: `handle${pascalCase(name)}`
|
|
84
|
+
}];
|
|
85
|
+
return ret;
|
|
86
|
+
}, {}));
|
|
87
|
+
},
|
|
88
|
+
get builtinImports() {
|
|
89
|
+
return defu(builtinImports ?? {}, {
|
|
90
|
+
env: ["isDevelopment", "isDebug"],
|
|
91
|
+
console: [
|
|
92
|
+
"warn",
|
|
93
|
+
"error",
|
|
94
|
+
"writeLine",
|
|
95
|
+
"textColors"
|
|
96
|
+
],
|
|
97
|
+
utils: [
|
|
98
|
+
"isMinimal",
|
|
99
|
+
"isUnicodeSupported",
|
|
100
|
+
"findSuggestions"
|
|
101
|
+
],
|
|
102
|
+
state: [
|
|
103
|
+
{
|
|
104
|
+
name: "GlobalOptions",
|
|
105
|
+
type: true
|
|
106
|
+
},
|
|
107
|
+
"useGlobal",
|
|
108
|
+
"useGlobalOptions",
|
|
109
|
+
"withCommand",
|
|
110
|
+
"useArgs",
|
|
111
|
+
"hasFlag"
|
|
112
|
+
],
|
|
113
|
+
[joinPaths("help", ...command.segments.filter((segment) => !isDynamicPathSegment(segment)))]: ["showHelp"],
|
|
114
|
+
[joinPaths("banner", ...command.segments.filter((segment) => !isDynamicPathSegment(segment)))]: ["showBanner"]
|
|
115
|
+
});
|
|
116
|
+
},
|
|
117
|
+
get children() {
|
|
118
|
+
return [createComponent(Spacing, {}), createComponent(VirtualCommandHandlerDeclaration, {
|
|
119
|
+
command,
|
|
120
|
+
banner: code`await showBanner(); `,
|
|
121
|
+
get children() {
|
|
122
|
+
return createComponent(CommandRouter, {
|
|
123
|
+
get segments() {
|
|
124
|
+
return command.segments;
|
|
125
|
+
},
|
|
126
|
+
get commands() {
|
|
127
|
+
return command.children;
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
})];
|
|
132
|
+
}
|
|
133
|
+
})), createComponent(For, {
|
|
134
|
+
get each() {
|
|
135
|
+
return Object.values(command.children);
|
|
136
|
+
},
|
|
137
|
+
children: (child) => createComponent(Show, {
|
|
138
|
+
get when() {
|
|
139
|
+
return child.virtual;
|
|
140
|
+
},
|
|
141
|
+
get fallback() {
|
|
142
|
+
return createComponent(CommandEntry, { command: child });
|
|
143
|
+
},
|
|
144
|
+
get children() {
|
|
145
|
+
return createComponent(VirtualCommandEntry, { command: child });
|
|
146
|
+
}
|
|
147
|
+
})
|
|
148
|
+
})];
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
//#endregion
|
|
152
|
+
export { VirtualCommandEntry, VirtualCommandHandlerDeclaration };
|
|
2
153
|
//# sourceMappingURL=virtual-command-entry.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"virtual-command-entry.mjs","names":[],"sources":[
|
|
1
|
+
{"version":3,"file":"virtual-command-entry.mjs","names":[],"sources":[],"mappings":""}
|
|
@@ -1 +1,73 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
|
|
3
|
+
//#region src/helpers/get-global-options.ts
|
|
4
|
+
/**
|
|
5
|
+
* Get the default command options.
|
|
6
|
+
*
|
|
7
|
+
* @returns The default command options.
|
|
8
|
+
*/
|
|
9
|
+
function getGlobalOptions() {
|
|
10
|
+
return [
|
|
11
|
+
{
|
|
12
|
+
name: "help",
|
|
13
|
+
title: "Help",
|
|
14
|
+
description: "Show help information.",
|
|
15
|
+
env: false,
|
|
16
|
+
alias: ["h", "?"],
|
|
17
|
+
type: "boolean",
|
|
18
|
+
required: false,
|
|
19
|
+
default: false,
|
|
20
|
+
variadic: false,
|
|
21
|
+
skipAddingNegative: true
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: "version",
|
|
25
|
+
title: "Version",
|
|
26
|
+
description: "Show the version of the application.",
|
|
27
|
+
env: false,
|
|
28
|
+
alias: ["v"],
|
|
29
|
+
type: "boolean",
|
|
30
|
+
required: false,
|
|
31
|
+
default: false,
|
|
32
|
+
variadic: false,
|
|
33
|
+
skipAddingNegative: true
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: "verbose",
|
|
37
|
+
title: "Verbose",
|
|
38
|
+
description: "Enable verbose output.",
|
|
39
|
+
env: "VERBOSE",
|
|
40
|
+
alias: ["V"],
|
|
41
|
+
type: "boolean",
|
|
42
|
+
required: false,
|
|
43
|
+
default: false,
|
|
44
|
+
variadic: false,
|
|
45
|
+
skipAddingNegative: true
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: "color",
|
|
49
|
+
title: "Color",
|
|
50
|
+
description: "Enable colored terminal output.",
|
|
51
|
+
env: "COLOR",
|
|
52
|
+
alias: ["colors"],
|
|
53
|
+
type: "boolean",
|
|
54
|
+
required: false,
|
|
55
|
+
variadic: false,
|
|
56
|
+
skipAddingNegative: false
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: "no-banner",
|
|
60
|
+
title: "Hide Banner",
|
|
61
|
+
description: "Do not display the application banner displayed while running the CLI - will be set to true if running in a CI pipeline.",
|
|
62
|
+
env: "NO_BANNER",
|
|
63
|
+
alias: ["hide-banner"],
|
|
64
|
+
type: "boolean",
|
|
65
|
+
required: false,
|
|
66
|
+
variadic: false,
|
|
67
|
+
default: false
|
|
68
|
+
}
|
|
69
|
+
];
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
//#endregion
|
|
73
|
+
exports.getGlobalOptions = getGlobalOptions;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-global-options.d.cts","names":[],"sources":["../../src/helpers/get-global-options.ts"],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"get-global-options.d.cts","names":[],"sources":["../../src/helpers/get-global-options.ts"],"mappings":";;;;;AAyBA;;;iBAAgB,gBAAA,IAAoB,aAAa"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-global-options.d.mts","names":[],"sources":["../../src/helpers/get-global-options.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"get-global-options.d.mts","names":[],"sources":["../../src/helpers/get-global-options.ts"],"mappings":""}
|
|
@@ -1,2 +1,72 @@
|
|
|
1
|
-
|
|
1
|
+
//#region src/helpers/get-global-options.ts
|
|
2
|
+
/**
|
|
3
|
+
* Get the default command options.
|
|
4
|
+
*
|
|
5
|
+
* @returns The default command options.
|
|
6
|
+
*/
|
|
7
|
+
function getGlobalOptions() {
|
|
8
|
+
return [
|
|
9
|
+
{
|
|
10
|
+
name: "help",
|
|
11
|
+
title: "Help",
|
|
12
|
+
description: "Show help information.",
|
|
13
|
+
env: false,
|
|
14
|
+
alias: ["h", "?"],
|
|
15
|
+
type: "boolean",
|
|
16
|
+
required: false,
|
|
17
|
+
default: false,
|
|
18
|
+
variadic: false,
|
|
19
|
+
skipAddingNegative: true
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
name: "version",
|
|
23
|
+
title: "Version",
|
|
24
|
+
description: "Show the version of the application.",
|
|
25
|
+
env: false,
|
|
26
|
+
alias: ["v"],
|
|
27
|
+
type: "boolean",
|
|
28
|
+
required: false,
|
|
29
|
+
default: false,
|
|
30
|
+
variadic: false,
|
|
31
|
+
skipAddingNegative: true
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
name: "verbose",
|
|
35
|
+
title: "Verbose",
|
|
36
|
+
description: "Enable verbose output.",
|
|
37
|
+
env: "VERBOSE",
|
|
38
|
+
alias: ["V"],
|
|
39
|
+
type: "boolean",
|
|
40
|
+
required: false,
|
|
41
|
+
default: false,
|
|
42
|
+
variadic: false,
|
|
43
|
+
skipAddingNegative: true
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: "color",
|
|
47
|
+
title: "Color",
|
|
48
|
+
description: "Enable colored terminal output.",
|
|
49
|
+
env: "COLOR",
|
|
50
|
+
alias: ["colors"],
|
|
51
|
+
type: "boolean",
|
|
52
|
+
required: false,
|
|
53
|
+
variadic: false,
|
|
54
|
+
skipAddingNegative: false
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: "no-banner",
|
|
58
|
+
title: "Hide Banner",
|
|
59
|
+
description: "Do not display the application banner displayed while running the CLI - will be set to true if running in a CI pipeline.",
|
|
60
|
+
env: "NO_BANNER",
|
|
61
|
+
alias: ["hide-banner"],
|
|
62
|
+
type: "boolean",
|
|
63
|
+
required: false,
|
|
64
|
+
variadic: false,
|
|
65
|
+
default: false
|
|
66
|
+
}
|
|
67
|
+
];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
//#endregion
|
|
71
|
+
export { getGlobalOptions };
|
|
2
72
|
//# sourceMappingURL=get-global-options.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-global-options.mjs","names":[],"sources":[
|
|
1
|
+
{"version":3,"file":"get-global-options.mjs","names":[],"sources":[],"mappings":""}
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1,123 @@
|
|
|
1
|
-
Object.defineProperties(exports,
|
|
1
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
|
+
const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
const require_components_bin_entry = require('./components/bin-entry.cjs');
|
|
4
|
+
const require_components_command_router = require('./components/command-router.cjs');
|
|
5
|
+
const require_components_virtual_command_entry = require('./components/virtual-command-entry.cjs');
|
|
6
|
+
const require_components_command_entry = require('./components/command-entry.cjs');
|
|
7
|
+
const require_helpers_get_global_options = require('./helpers/get-global-options.cjs');
|
|
8
|
+
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
9
|
+
let _alloy_js_core = require("@alloy-js/core");
|
|
10
|
+
let _alloy_js_typescript = require("@alloy-js/typescript");
|
|
11
|
+
let _powerlines_plugin_alloy_core_components = require("@powerlines/plugin-alloy/core/components");
|
|
12
|
+
let _powerlines_plugin_alloy_render = require("@powerlines/plugin-alloy/render");
|
|
13
|
+
let _shell_shock_plugin_banner = require("@shell-shock/plugin-banner");
|
|
14
|
+
_shell_shock_plugin_banner = require_runtime.__toESM(_shell_shock_plugin_banner);
|
|
15
|
+
let _shell_shock_plugin_console = require("@shell-shock/plugin-console");
|
|
16
|
+
_shell_shock_plugin_console = require_runtime.__toESM(_shell_shock_plugin_console);
|
|
17
|
+
let _shell_shock_plugin_help = require("@shell-shock/plugin-help");
|
|
18
|
+
_shell_shock_plugin_help = require_runtime.__toESM(_shell_shock_plugin_help);
|
|
19
|
+
|
|
20
|
+
//#region src/index.tsx
|
|
21
|
+
/**
|
|
22
|
+
* The Shell Shock base plugin.
|
|
23
|
+
*/
|
|
24
|
+
const plugin = (options = {}) => {
|
|
25
|
+
return [
|
|
26
|
+
...(0, _shell_shock_plugin_console.default)(options),
|
|
27
|
+
...(0, _shell_shock_plugin_help.default)(options),
|
|
28
|
+
...(0, _shell_shock_plugin_banner.default)(options.banner),
|
|
29
|
+
{
|
|
30
|
+
name: "shell-shock/script-preset",
|
|
31
|
+
config() {
|
|
32
|
+
this.debug("Providing default configuration for the Shell Shock `script` preset.");
|
|
33
|
+
return {
|
|
34
|
+
globalOptions: require_helpers_get_global_options.getGlobalOptions,
|
|
35
|
+
isCaseSensitive: false,
|
|
36
|
+
...options
|
|
37
|
+
};
|
|
38
|
+
},
|
|
39
|
+
prepare: {
|
|
40
|
+
order: "post",
|
|
41
|
+
async handler() {
|
|
42
|
+
const _self$ = this;
|
|
43
|
+
this.debug("Rendering entrypoint modules for the Shell Shock `script` preset.");
|
|
44
|
+
return (0, _powerlines_plugin_alloy_render.render)(this, [(0, _alloy_js_core_jsx_runtime.createComponent)(require_components_bin_entry.BinEntry, {
|
|
45
|
+
builtinImports: {
|
|
46
|
+
console: [
|
|
47
|
+
"divider",
|
|
48
|
+
"stripAnsi",
|
|
49
|
+
"writeLine",
|
|
50
|
+
"splitText",
|
|
51
|
+
"help"
|
|
52
|
+
],
|
|
53
|
+
utils: ["isMinimal"],
|
|
54
|
+
state: [
|
|
55
|
+
"useArgs",
|
|
56
|
+
"hasFlag",
|
|
57
|
+
"isHelp"
|
|
58
|
+
]
|
|
59
|
+
},
|
|
60
|
+
get children() {
|
|
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`useArgs();`
|
|
73
|
+
}),
|
|
74
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
75
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(require_components_command_router.CommandRouter, {
|
|
76
|
+
segments: [],
|
|
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.createComponent)(_powerlines_plugin_alloy_core_components.Spacing, {}),
|
|
86
|
+
_alloy_js_core.code`await showBanner();`,
|
|
87
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components.Spacing, {}),
|
|
88
|
+
_alloy_js_core.code`return showHelp();`
|
|
89
|
+
];
|
|
90
|
+
}
|
|
91
|
+
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
92
|
+
get when() {
|
|
93
|
+
return Object.values(_self$.commands).length > 0;
|
|
94
|
+
},
|
|
95
|
+
get children() {
|
|
96
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
97
|
+
get each() {
|
|
98
|
+
return Object.values(_self$.commands);
|
|
99
|
+
},
|
|
100
|
+
doubleHardline: true,
|
|
101
|
+
children: (child) => (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
102
|
+
get when() {
|
|
103
|
+
return child.virtual;
|
|
104
|
+
},
|
|
105
|
+
get fallback() {
|
|
106
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_command_entry.CommandEntry, { command: child });
|
|
107
|
+
},
|
|
108
|
+
get children() {
|
|
109
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_virtual_command_entry.VirtualCommandEntry, { command: child });
|
|
110
|
+
}
|
|
111
|
+
})
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
})]);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
];
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
//#endregion
|
|
122
|
+
exports.default = plugin;
|
|
123
|
+
exports.plugin = plugin;
|
package/dist/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"mappings":""}
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,118 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { BinEntry } from "./components/bin-entry.mjs";
|
|
2
|
+
import { CommandRouter } from "./components/command-router.mjs";
|
|
3
|
+
import { VirtualCommandEntry } from "./components/virtual-command-entry.mjs";
|
|
4
|
+
import { CommandEntry } from "./components/command-entry.mjs";
|
|
5
|
+
import { getGlobalOptions } from "./helpers/get-global-options.mjs";
|
|
6
|
+
import { createComponent, createIntrinsic, memo } from "@alloy-js/core/jsx-runtime";
|
|
7
|
+
import { For, Show, code } from "@alloy-js/core";
|
|
8
|
+
import { VarDeclaration } from "@alloy-js/typescript";
|
|
9
|
+
import { Spacing } from "@powerlines/plugin-alloy/core/components";
|
|
10
|
+
import { render } from "@powerlines/plugin-alloy/render";
|
|
11
|
+
import banner from "@shell-shock/plugin-banner";
|
|
12
|
+
import console from "@shell-shock/plugin-console";
|
|
13
|
+
import help from "@shell-shock/plugin-help";
|
|
14
|
+
|
|
15
|
+
//#region src/index.tsx
|
|
16
|
+
/**
|
|
17
|
+
* The Shell Shock base plugin.
|
|
18
|
+
*/
|
|
19
|
+
const plugin = (options = {}) => {
|
|
20
|
+
return [
|
|
21
|
+
...console(options),
|
|
22
|
+
...help(options),
|
|
23
|
+
...banner(options.banner),
|
|
24
|
+
{
|
|
25
|
+
name: "shell-shock/script-preset",
|
|
26
|
+
config() {
|
|
27
|
+
this.debug("Providing default configuration for the Shell Shock `script` preset.");
|
|
28
|
+
return {
|
|
29
|
+
globalOptions: getGlobalOptions,
|
|
30
|
+
isCaseSensitive: false,
|
|
31
|
+
...options
|
|
32
|
+
};
|
|
33
|
+
},
|
|
34
|
+
prepare: {
|
|
35
|
+
order: "post",
|
|
36
|
+
async handler() {
|
|
37
|
+
const _self$ = this;
|
|
38
|
+
this.debug("Rendering entrypoint modules for the Shell Shock `script` preset.");
|
|
39
|
+
return render(this, [createComponent(BinEntry, {
|
|
40
|
+
builtinImports: {
|
|
41
|
+
console: [
|
|
42
|
+
"divider",
|
|
43
|
+
"stripAnsi",
|
|
44
|
+
"writeLine",
|
|
45
|
+
"splitText",
|
|
46
|
+
"help"
|
|
47
|
+
],
|
|
48
|
+
utils: ["isMinimal"],
|
|
49
|
+
state: [
|
|
50
|
+
"useArgs",
|
|
51
|
+
"hasFlag",
|
|
52
|
+
"isHelp"
|
|
53
|
+
]
|
|
54
|
+
},
|
|
55
|
+
get children() {
|
|
56
|
+
return [
|
|
57
|
+
createComponent(Show, {
|
|
58
|
+
get when() {
|
|
59
|
+
return Object.keys(_self$.commands).length > 0;
|
|
60
|
+
},
|
|
61
|
+
get children() {
|
|
62
|
+
return [
|
|
63
|
+
createComponent(VarDeclaration, {
|
|
64
|
+
"const": true,
|
|
65
|
+
name: "args",
|
|
66
|
+
type: "string[]",
|
|
67
|
+
initializer: code`useArgs();`
|
|
68
|
+
}),
|
|
69
|
+
createIntrinsic("hbr", {}),
|
|
70
|
+
createComponent(CommandRouter, {
|
|
71
|
+
segments: [],
|
|
72
|
+
get commands() {
|
|
73
|
+
return _self$.commands ?? {};
|
|
74
|
+
}
|
|
75
|
+
}),
|
|
76
|
+
createIntrinsic("hbr", {})
|
|
77
|
+
];
|
|
78
|
+
}
|
|
79
|
+
}),
|
|
80
|
+
createComponent(Spacing, {}),
|
|
81
|
+
code`await showBanner();`,
|
|
82
|
+
createComponent(Spacing, {}),
|
|
83
|
+
code`return showHelp();`
|
|
84
|
+
];
|
|
85
|
+
}
|
|
86
|
+
}), createComponent(Show, {
|
|
87
|
+
get when() {
|
|
88
|
+
return Object.values(_self$.commands).length > 0;
|
|
89
|
+
},
|
|
90
|
+
get children() {
|
|
91
|
+
return createComponent(For, {
|
|
92
|
+
get each() {
|
|
93
|
+
return Object.values(_self$.commands);
|
|
94
|
+
},
|
|
95
|
+
doubleHardline: true,
|
|
96
|
+
children: (child) => createComponent(Show, {
|
|
97
|
+
get when() {
|
|
98
|
+
return child.virtual;
|
|
99
|
+
},
|
|
100
|
+
get fallback() {
|
|
101
|
+
return createComponent(CommandEntry, { command: child });
|
|
102
|
+
},
|
|
103
|
+
get children() {
|
|
104
|
+
return createComponent(VirtualCommandEntry, { command: child });
|
|
105
|
+
}
|
|
106
|
+
})
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
})]);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
];
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
//#endregion
|
|
117
|
+
export { plugin as default, plugin };
|
|
2
118
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":[
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":[],"mappings":""}
|
package/dist/types/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{};
|
|
1
|
+
export { };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/types/plugin.ts"],"mappings":""}
|
package/dist/types/plugin.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export{};
|
|
1
|
+
export { };
|