@shell-shock/preset-script 0.6.76 → 0.6.78
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/README.md +16 -7
- package/dist/command-entry-BlT9_UEL.cjs +367 -0
- package/dist/command-entry-DWSekIys.mjs +339 -0
- package/dist/command-entry-DWSekIys.mjs.map +1 -0
- package/dist/components/bin-entry.cjs +20 -18
- package/dist/components/bin-entry.d.cts +2 -3
- package/dist/components/bin-entry.d.cts.map +1 -1
- package/dist/components/bin-entry.d.mts +2 -3
- package/dist/components/bin-entry.mjs +10 -6
- package/dist/components/command-entry.cjs +4 -204
- package/dist/components/command-entry.d.cts +1 -2
- package/dist/components/command-entry.d.cts.map +1 -1
- package/dist/components/command-entry.d.mts +1 -2
- package/dist/components/command-entry.mjs +2 -201
- package/dist/components/command-router.cjs +7 -7
- package/dist/components/command-router.d.cts +0 -1
- package/dist/components/command-router.d.cts.map +1 -1
- package/dist/components/command-router.d.mts +0 -1
- package/dist/components/command-router.mjs +3 -3
- package/dist/components/exit-function-declaration.cjs +11 -11
- package/dist/components/exit-function-declaration.d.cts.map +1 -1
- package/dist/components/exit-function-declaration.mjs +3 -3
- package/dist/components/index.cjs +6 -7
- package/dist/components/index.mjs +1 -2
- package/dist/components/virtual-command-entry.cjs +3 -154
- package/dist/components/virtual-command-entry.d.cts +1 -2
- package/dist/components/virtual-command-entry.d.cts.map +1 -1
- package/dist/components/virtual-command-entry.d.mts +1 -2
- package/dist/components/virtual-command-entry.mjs +2 -152
- package/dist/generator.cjs +108 -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 +107 -0
- package/dist/generator.mjs.map +1 -0
- package/dist/helpers/get-global-options.cjs +0 -1
- package/dist/helpers/get-global-options.d.cts +0 -1
- package/dist/helpers/get-global-options.d.cts.map +1 -1
- package/dist/helpers/get-global-options.d.mts +0 -1
- package/dist/index.cjs +9 -90
- package/dist/index.d.cts +2 -2
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.mjs +11 -89
- 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 +32 -18
- package/dist/_virtual/_rolldown/runtime.cjs +0 -29
- package/dist/components/command-entry.mjs.map +0 -1
- package/dist/components/virtual-command-entry.mjs.map +0 -1
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { ExitFunctionDeclaration } from "./exit-function-declaration.mjs";
|
|
2
2
|
import { BinEntry, RunApplication } from "./bin-entry.mjs";
|
|
3
3
|
import { CommandRouter, CommandRouterBody, CommandRouterRoute } from "./command-router.mjs";
|
|
4
|
-
import { VirtualCommandEntry,
|
|
5
|
-
import { CommandEntry, CommandHandlerDeclaration, CommandInvocation } from "./command-entry.mjs";
|
|
4
|
+
import { a as VirtualCommandHandlerDeclaration, i as VirtualCommandEntry, n as CommandHandlerDeclaration, r as CommandInvocation, t as CommandEntry } from "../command-entry-DWSekIys.mjs";
|
|
6
5
|
|
|
7
6
|
export { BinEntry, CommandEntry, CommandHandlerDeclaration, CommandInvocation, CommandRouter, CommandRouterBody, CommandRouterRoute, ExitFunctionDeclaration, RunApplication, VirtualCommandEntry, VirtualCommandHandlerDeclaration };
|
|
@@ -1,156 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
-
const
|
|
3
|
-
const require_components_command_router = require('./command-router.cjs');
|
|
4
|
-
const require_components_command_entry = require('./command-entry.cjs');
|
|
5
|
-
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
6
|
-
let _alloy_js_core = require("@alloy-js/core");
|
|
7
|
-
let _alloy_js_typescript = require("@alloy-js/typescript");
|
|
8
|
-
let _powerlines_plugin_alloy_core_components = require("@powerlines/plugin-alloy/core/components");
|
|
9
|
-
let _powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
10
|
-
let _powerlines_plugin_alloy_typescript_components_tsdoc = require("@powerlines/plugin-alloy/typescript/components/tsdoc");
|
|
11
|
-
let _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
|
|
12
|
-
let _stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
|
|
13
|
-
let defu = require("defu");
|
|
14
|
-
defu = require_runtime.__toESM(defu, 1);
|
|
15
|
-
let _stryke_path_join = require("@stryke/path/join");
|
|
16
|
-
let _stryke_string_format_constant_case = require("@stryke/string-format/constant-case");
|
|
17
|
-
let _powerlines_plugin_alloy_typescript_components_typescript_file = require("@powerlines/plugin-alloy/typescript/components/typescript-file");
|
|
2
|
+
const require_command_entry = require('../command-entry-BlT9_UEL.cjs');
|
|
18
3
|
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
* A component that generates the `handler` function declaration for a command.
|
|
22
|
-
*/
|
|
23
|
-
function VirtualCommandHandlerDeclaration(props) {
|
|
24
|
-
const { command, children, banner } = props;
|
|
25
|
-
const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
26
|
-
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
27
|
-
get heading() {
|
|
28
|
-
return `The ${command.title} (${(0, _shell_shock_core_plugin_utils.getAppBin)(context)} ${command.segments.map((segment) => (0, _shell_shock_core_plugin_utils.isDynamicPathSegment)(segment) ? `[${(0, _stryke_string_format_constant_case.constantCase)((0, _shell_shock_core_plugin_utils.getDynamicPathSegmentName)(segment))}]` : segment).join(" ")}) virtual command.`;
|
|
29
|
-
},
|
|
30
|
-
get children() {
|
|
31
|
-
return [
|
|
32
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { get children() {
|
|
33
|
-
return `${command.description.replace(/\.+$/, "")}.`;
|
|
34
|
-
} }),
|
|
35
|
-
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
36
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocTitle, { get children() {
|
|
37
|
-
return command.title;
|
|
38
|
-
} }),
|
|
39
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
|
|
40
|
-
name: "args",
|
|
41
|
-
children: `The command-line arguments passed to the command.`
|
|
42
|
-
})
|
|
43
|
-
];
|
|
44
|
-
}
|
|
45
|
-
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
46
|
-
"export": true,
|
|
47
|
-
async: true,
|
|
48
|
-
name: "handler",
|
|
49
|
-
parameters: [{
|
|
50
|
-
name: "args",
|
|
51
|
-
type: "string[]",
|
|
52
|
-
default: "useArgs()"
|
|
53
|
-
}],
|
|
54
|
-
get children() {
|
|
55
|
-
return [
|
|
56
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components.Spacing, {}),
|
|
57
|
-
children,
|
|
58
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components.Spacing, {}),
|
|
59
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
60
|
-
get when() {
|
|
61
|
-
return Boolean(banner);
|
|
62
|
-
},
|
|
63
|
-
children: banner
|
|
64
|
-
}),
|
|
65
|
-
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components.Spacing, {}),
|
|
66
|
-
_alloy_js_core.code`return showHelp(); `
|
|
67
|
-
];
|
|
68
|
-
}
|
|
69
|
-
})];
|
|
70
|
-
}
|
|
71
|
-
/**
|
|
72
|
-
* The virtual command entry point for the Shell Shock project.
|
|
73
|
-
*/
|
|
74
|
-
function VirtualCommandEntry(props) {
|
|
75
|
-
const { command, imports, builtinImports, ...rest } = props;
|
|
76
|
-
const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
77
|
-
const filePath = (0, _alloy_js_core.computed)(() => (0, _stryke_path_join.joinPaths)(context.entryPath, command.segments.filter((segment) => !(0, _shell_shock_core_plugin_utils.isDynamicPathSegment)(segment)).join("/"), "index.ts"));
|
|
78
|
-
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_typescript_file.TypescriptFile, (0, _alloy_js_core_jsx_runtime.mergeProps)(rest, {
|
|
79
|
-
get path() {
|
|
80
|
-
return filePath.value;
|
|
81
|
-
},
|
|
82
|
-
get imports() {
|
|
83
|
-
return (0, defu.default)(imports ?? {}, Object.entries(command.children).filter(([, child]) => child.virtual).reduce((ret, [name, child]) => {
|
|
84
|
-
ret[`./${child.name}`] = [{
|
|
85
|
-
name: "handler",
|
|
86
|
-
alias: `handle${(0, _stryke_string_format_pascal_case.pascalCase)(name)}`
|
|
87
|
-
}];
|
|
88
|
-
return ret;
|
|
89
|
-
}, {}));
|
|
90
|
-
},
|
|
91
|
-
get builtinImports() {
|
|
92
|
-
return (0, defu.default)(builtinImports ?? {}, {
|
|
93
|
-
env: ["isDevelopment", "isDebug"],
|
|
94
|
-
console: [
|
|
95
|
-
"warn",
|
|
96
|
-
"error",
|
|
97
|
-
"writeLine",
|
|
98
|
-
"textColors"
|
|
99
|
-
],
|
|
100
|
-
utils: [
|
|
101
|
-
"isMinimal",
|
|
102
|
-
"isUnicodeSupported",
|
|
103
|
-
"findSuggestions"
|
|
104
|
-
],
|
|
105
|
-
state: [
|
|
106
|
-
{
|
|
107
|
-
name: "GlobalOptions",
|
|
108
|
-
type: true
|
|
109
|
-
},
|
|
110
|
-
"useGlobal",
|
|
111
|
-
"useGlobalOptions",
|
|
112
|
-
"withCommand",
|
|
113
|
-
"useArgs",
|
|
114
|
-
"hasFlag"
|
|
115
|
-
],
|
|
116
|
-
[(0, _stryke_path_join.joinPaths)("help", ...command.segments.filter((segment) => !(0, _shell_shock_core_plugin_utils.isDynamicPathSegment)(segment)))]: ["showHelp"],
|
|
117
|
-
[(0, _stryke_path_join.joinPaths)("banner", ...command.segments.filter((segment) => !(0, _shell_shock_core_plugin_utils.isDynamicPathSegment)(segment)))]: ["showBanner"]
|
|
118
|
-
});
|
|
119
|
-
},
|
|
120
|
-
get children() {
|
|
121
|
-
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components.Spacing, {}), (0, _alloy_js_core_jsx_runtime.createComponent)(VirtualCommandHandlerDeclaration, {
|
|
122
|
-
command,
|
|
123
|
-
banner: _alloy_js_core.code`await showBanner(); `,
|
|
124
|
-
get children() {
|
|
125
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_command_router.CommandRouter, {
|
|
126
|
-
get segments() {
|
|
127
|
-
return command.segments;
|
|
128
|
-
},
|
|
129
|
-
get commands() {
|
|
130
|
-
return command.children;
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
}
|
|
134
|
-
})];
|
|
135
|
-
}
|
|
136
|
-
})), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
137
|
-
get each() {
|
|
138
|
-
return Object.values(command.children);
|
|
139
|
-
},
|
|
140
|
-
children: (child) => (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
141
|
-
get when() {
|
|
142
|
-
return child.virtual;
|
|
143
|
-
},
|
|
144
|
-
get fallback() {
|
|
145
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_command_entry.CommandEntry, { command: child });
|
|
146
|
-
},
|
|
147
|
-
get children() {
|
|
148
|
-
return (0, _alloy_js_core_jsx_runtime.createComponent)(VirtualCommandEntry, { command: child });
|
|
149
|
-
}
|
|
150
|
-
})
|
|
151
|
-
})];
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
//#endregion
|
|
155
|
-
exports.VirtualCommandEntry = VirtualCommandEntry;
|
|
156
|
-
exports.VirtualCommandHandlerDeclaration = VirtualCommandHandlerDeclaration;
|
|
4
|
+
exports.VirtualCommandEntry = require_command_entry.VirtualCommandEntry;
|
|
5
|
+
exports.VirtualCommandHandlerDeclaration = require_command_entry.VirtualCommandHandlerDeclaration;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Children } from "@alloy-js/core";
|
|
2
|
-
import { EntryFileProps } from "@
|
|
2
|
+
import { EntryFileProps } from "@shell-shock/core/contexts/power-plant";
|
|
3
3
|
import { CommandTree } from "@shell-shock/core/types/command";
|
|
4
|
-
|
|
5
4
|
//#region src/components/virtual-command-entry.d.ts
|
|
6
5
|
interface VirtualCommandHandlerDeclarationProps {
|
|
7
6
|
command: CommandTree;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"virtual-command-entry.d.cts","names":[],"sources":["../../src/components/virtual-command-entry.tsx"],"mappings":"
|
|
1
|
+
{"version":3,"file":"virtual-command-entry.d.cts","names":[],"sources":["../../src/components/virtual-command-entry.tsx"],"mappings":";;;;UA8CiB;EACf,SAAS;EACT,SAAS;EACT,WAAW;;;;;iBAMG,iCACd,OAAO,wCAAqC;UAqC7B,iCAAiC,KAChD;EAGA,SAAS;;;;;iBAMK,oBAAoB,OAAO,2BAAwB"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Children } from "@alloy-js/core";
|
|
2
|
-
import { EntryFileProps } from "@
|
|
2
|
+
import { EntryFileProps } from "@shell-shock/core/contexts/power-plant";
|
|
3
3
|
import { CommandTree } from "@shell-shock/core/types/command";
|
|
4
|
-
|
|
5
4
|
//#region src/components/virtual-command-entry.d.ts
|
|
6
5
|
interface VirtualCommandHandlerDeclarationProps {
|
|
7
6
|
command: CommandTree;
|
|
@@ -1,153 +1,3 @@
|
|
|
1
|
-
import {
|
|
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";
|
|
1
|
+
import { a as VirtualCommandHandlerDeclaration, i as VirtualCommandEntry } from "../command-entry-DWSekIys.mjs";
|
|
15
2
|
|
|
16
|
-
|
|
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 };
|
|
153
|
-
//# sourceMappingURL=virtual-command-entry.mjs.map
|
|
3
|
+
export { VirtualCommandEntry, VirtualCommandHandlerDeclaration };
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
|
+
const require_components_bin_entry = require('./components/bin-entry.cjs');
|
|
3
|
+
const require_components_command_router = require('./components/command-router.cjs');
|
|
4
|
+
const require_command_entry = require('./command-entry-BlT9_UEL.cjs');
|
|
5
|
+
let _shell_shock_core_helpers_power_plant = require("@shell-shock/core/helpers/power-plant");
|
|
6
|
+
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
7
|
+
let _alloy_js_core = require("@alloy-js/core");
|
|
8
|
+
let _alloy_js_typescript = require("@alloy-js/typescript");
|
|
9
|
+
let _power_plant_alloy_js_core_components = require("@power-plant/alloy-js/core/components");
|
|
10
|
+
|
|
11
|
+
//#region src/generator.tsx
|
|
12
|
+
/**
|
|
13
|
+
* Power Plant generator for Shell Shock script preset entrypoint modules.
|
|
14
|
+
*
|
|
15
|
+
* @see https://github.com/storm-software/power-plant/tree/main/packages/generators/alloy-js
|
|
16
|
+
*/
|
|
17
|
+
const scriptEntrypointGenerator = (0, _shell_shock_core_helpers_power_plant.defineCommandGenerator)({
|
|
18
|
+
meta: {
|
|
19
|
+
name: "shell-shock-script-entrypoint",
|
|
20
|
+
title: "Shell Shock Script Entrypoint Generator",
|
|
21
|
+
description: "Generates script preset entrypoint and command router modules from the Shell Shock command tree specification.",
|
|
22
|
+
version: "1.0",
|
|
23
|
+
tags: [
|
|
24
|
+
"shell-shock",
|
|
25
|
+
"script",
|
|
26
|
+
"alloy-js",
|
|
27
|
+
"entrypoint"
|
|
28
|
+
]
|
|
29
|
+
},
|
|
30
|
+
generator: async (_commands, options) => {
|
|
31
|
+
const context = options.context;
|
|
32
|
+
await (0, _shell_shock_core_helpers_power_plant.renderCommandTemplate)(options, [(0, _alloy_js_core_jsx_runtime.createComponent)(require_components_bin_entry.BinEntry, {
|
|
33
|
+
builtinImports: {
|
|
34
|
+
console: [
|
|
35
|
+
"divider",
|
|
36
|
+
"stripAnsi",
|
|
37
|
+
"writeLine",
|
|
38
|
+
"splitText",
|
|
39
|
+
"help"
|
|
40
|
+
],
|
|
41
|
+
utils: ["isMinimal"],
|
|
42
|
+
state: [
|
|
43
|
+
"useArgs",
|
|
44
|
+
"hasFlag",
|
|
45
|
+
"isHelp"
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
get children() {
|
|
49
|
+
return [
|
|
50
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
51
|
+
get when() {
|
|
52
|
+
return Object.keys(context.commands).length > 0;
|
|
53
|
+
},
|
|
54
|
+
get children() {
|
|
55
|
+
return [
|
|
56
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
57
|
+
"const": true,
|
|
58
|
+
name: "args",
|
|
59
|
+
type: "string[]",
|
|
60
|
+
initializer: _alloy_js_core.code`useArgs();`
|
|
61
|
+
}),
|
|
62
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
63
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(require_components_command_router.CommandRouter, {
|
|
64
|
+
segments: [],
|
|
65
|
+
get commands() {
|
|
66
|
+
return context.commands ?? {};
|
|
67
|
+
}
|
|
68
|
+
}),
|
|
69
|
+
(0, _alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {})
|
|
70
|
+
];
|
|
71
|
+
}
|
|
72
|
+
}),
|
|
73
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_core_components.Spacing, {}),
|
|
74
|
+
_alloy_js_core.code`await showBanner();`,
|
|
75
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_power_plant_alloy_js_core_components.Spacing, {}),
|
|
76
|
+
_alloy_js_core.code`return showHelp();`
|
|
77
|
+
];
|
|
78
|
+
}
|
|
79
|
+
}), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
80
|
+
get when() {
|
|
81
|
+
return Object.values(context.commands).length > 0;
|
|
82
|
+
},
|
|
83
|
+
get children() {
|
|
84
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
85
|
+
get each() {
|
|
86
|
+
return Object.values(context.commands);
|
|
87
|
+
},
|
|
88
|
+
doubleHardline: true,
|
|
89
|
+
children: (child) => (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
90
|
+
get when() {
|
|
91
|
+
return child.virtual;
|
|
92
|
+
},
|
|
93
|
+
get fallback() {
|
|
94
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_command_entry.CommandEntry, { command: child });
|
|
95
|
+
},
|
|
96
|
+
get children() {
|
|
97
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_command_entry.VirtualCommandEntry, { command: child });
|
|
98
|
+
}
|
|
99
|
+
})
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
})]);
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
//#endregion
|
|
107
|
+
exports.default = scriptEntrypointGenerator;
|
|
108
|
+
exports.scriptEntrypointGenerator = scriptEntrypointGenerator;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/generator.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Power Plant generator for Shell Shock script preset entrypoint modules.
|
|
4
|
+
*
|
|
5
|
+
* @see https://github.com/storm-software/power-plant/tree/main/packages/generators/alloy-js
|
|
6
|
+
*/
|
|
7
|
+
declare const scriptEntrypointGenerator: 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 { scriptEntrypointGenerator as default, scriptEntrypointGenerator };
|
|
10
|
+
//# sourceMappingURL=generator.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.d.cts","names":[],"sources":["../src/generator.tsx"],"mappings":";;;;;;cAmCa,uDAAyB,sBAAA,6CAAA,wEAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
//#region src/generator.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Power Plant generator for Shell Shock script preset entrypoint modules.
|
|
4
|
+
*
|
|
5
|
+
* @see https://github.com/storm-software/power-plant/tree/main/packages/generators/alloy-js
|
|
6
|
+
*/
|
|
7
|
+
declare const scriptEntrypointGenerator: 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 { scriptEntrypointGenerator as default, scriptEntrypointGenerator };
|
|
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,107 @@
|
|
|
1
|
+
import { BinEntry } from "./components/bin-entry.mjs";
|
|
2
|
+
import { CommandRouter } from "./components/command-router.mjs";
|
|
3
|
+
import { i as VirtualCommandEntry, t as CommandEntry } from "./command-entry-DWSekIys.mjs";
|
|
4
|
+
import { defineCommandGenerator, renderCommandTemplate } from "@shell-shock/core/helpers/power-plant";
|
|
5
|
+
import { createComponent, createIntrinsic, memo } from "@alloy-js/core/jsx-runtime";
|
|
6
|
+
import { For, Show, code } from "@alloy-js/core";
|
|
7
|
+
import { VarDeclaration } from "@alloy-js/typescript";
|
|
8
|
+
import { Spacing } from "@power-plant/alloy-js/core/components";
|
|
9
|
+
|
|
10
|
+
//#region src/generator.tsx
|
|
11
|
+
/**
|
|
12
|
+
* Power Plant generator for Shell Shock script preset entrypoint modules.
|
|
13
|
+
*
|
|
14
|
+
* @see https://github.com/storm-software/power-plant/tree/main/packages/generators/alloy-js
|
|
15
|
+
*/
|
|
16
|
+
const scriptEntrypointGenerator = defineCommandGenerator({
|
|
17
|
+
meta: {
|
|
18
|
+
name: "shell-shock-script-entrypoint",
|
|
19
|
+
title: "Shell Shock Script Entrypoint Generator",
|
|
20
|
+
description: "Generates script preset entrypoint and command router modules from the Shell Shock command tree specification.",
|
|
21
|
+
version: "1.0",
|
|
22
|
+
tags: [
|
|
23
|
+
"shell-shock",
|
|
24
|
+
"script",
|
|
25
|
+
"alloy-js",
|
|
26
|
+
"entrypoint"
|
|
27
|
+
]
|
|
28
|
+
},
|
|
29
|
+
generator: async (_commands, options) => {
|
|
30
|
+
const context = options.context;
|
|
31
|
+
await renderCommandTemplate(options, [createComponent(BinEntry, {
|
|
32
|
+
builtinImports: {
|
|
33
|
+
console: [
|
|
34
|
+
"divider",
|
|
35
|
+
"stripAnsi",
|
|
36
|
+
"writeLine",
|
|
37
|
+
"splitText",
|
|
38
|
+
"help"
|
|
39
|
+
],
|
|
40
|
+
utils: ["isMinimal"],
|
|
41
|
+
state: [
|
|
42
|
+
"useArgs",
|
|
43
|
+
"hasFlag",
|
|
44
|
+
"isHelp"
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
get children() {
|
|
48
|
+
return [
|
|
49
|
+
createComponent(Show, {
|
|
50
|
+
get when() {
|
|
51
|
+
return Object.keys(context.commands).length > 0;
|
|
52
|
+
},
|
|
53
|
+
get children() {
|
|
54
|
+
return [
|
|
55
|
+
createComponent(VarDeclaration, {
|
|
56
|
+
"const": true,
|
|
57
|
+
name: "args",
|
|
58
|
+
type: "string[]",
|
|
59
|
+
initializer: code`useArgs();`
|
|
60
|
+
}),
|
|
61
|
+
createIntrinsic("hbr", {}),
|
|
62
|
+
createComponent(CommandRouter, {
|
|
63
|
+
segments: [],
|
|
64
|
+
get commands() {
|
|
65
|
+
return context.commands ?? {};
|
|
66
|
+
}
|
|
67
|
+
}),
|
|
68
|
+
createIntrinsic("hbr", {})
|
|
69
|
+
];
|
|
70
|
+
}
|
|
71
|
+
}),
|
|
72
|
+
createComponent(Spacing, {}),
|
|
73
|
+
code`await showBanner();`,
|
|
74
|
+
createComponent(Spacing, {}),
|
|
75
|
+
code`return showHelp();`
|
|
76
|
+
];
|
|
77
|
+
}
|
|
78
|
+
}), createComponent(Show, {
|
|
79
|
+
get when() {
|
|
80
|
+
return Object.values(context.commands).length > 0;
|
|
81
|
+
},
|
|
82
|
+
get children() {
|
|
83
|
+
return createComponent(For, {
|
|
84
|
+
get each() {
|
|
85
|
+
return Object.values(context.commands);
|
|
86
|
+
},
|
|
87
|
+
doubleHardline: true,
|
|
88
|
+
children: (child) => createComponent(Show, {
|
|
89
|
+
get when() {
|
|
90
|
+
return child.virtual;
|
|
91
|
+
},
|
|
92
|
+
get fallback() {
|
|
93
|
+
return createComponent(CommandEntry, { command: child });
|
|
94
|
+
},
|
|
95
|
+
get children() {
|
|
96
|
+
return createComponent(VirtualCommandEntry, { command: child });
|
|
97
|
+
}
|
|
98
|
+
})
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
})]);
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
|
|
105
|
+
//#endregion
|
|
106
|
+
export { scriptEntrypointGenerator as default, scriptEntrypointGenerator };
|
|
107
|
+
//# sourceMappingURL=generator.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.mjs","names":[],"sources":[],"mappings":""}
|
|
@@ -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":";;;;;;;iBAyBgB,oBAAoB"}
|