@shell-shock/preset-cli 0.8.0 → 0.8.3
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 → _rolldown/runtime.cjs} +1 -1
- package/dist/_virtual/_rolldown/runtime.mjs +3 -0
- package/dist/components/banner-function-declaration.cjs +48 -164
- package/dist/components/banner-function-declaration.d.cts +2 -2
- package/dist/components/banner-function-declaration.d.cts.map +1 -1
- package/dist/components/banner-function-declaration.d.mts +2 -2
- package/dist/components/banner-function-declaration.d.mts.map +1 -1
- package/dist/components/banner-function-declaration.mjs +29 -146
- package/dist/components/banner-function-declaration.mjs.map +1 -1
- package/dist/components/command-entry.cjs +122 -120
- package/dist/components/command-entry.d.cts.map +1 -1
- package/dist/components/command-entry.d.mts +3 -3
- package/dist/components/command-entry.d.mts.map +1 -1
- package/dist/components/command-entry.mjs +21 -20
- package/dist/components/command-entry.mjs.map +1 -1
- package/dist/components/command-router.cjs +20 -19
- package/dist/components/command-router.d.cts +3 -3
- 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 +1 -1
- package/dist/components/command-router.mjs.map +1 -1
- package/dist/components/index.cjs +4 -0
- package/dist/components/index.d.cts +2 -1
- package/dist/components/index.d.mts +2 -1
- package/dist/components/index.mjs +2 -1
- package/dist/components/upgrade-builtin.cjs +171 -0
- package/dist/components/upgrade-builtin.d.cts +15 -0
- package/dist/components/upgrade-builtin.d.cts.map +1 -0
- package/dist/components/upgrade-builtin.d.mts +15 -0
- package/dist/components/upgrade-builtin.d.mts.map +1 -0
- package/dist/components/upgrade-builtin.mjs +169 -0
- package/dist/components/upgrade-builtin.mjs.map +1 -0
- package/dist/components/virtual-command-entry.cjs +26 -24
- package/dist/components/virtual-command-entry.d.cts.map +1 -1
- package/dist/components/virtual-command-entry.d.mts +3 -3
- package/dist/components/virtual-command-entry.d.mts.map +1 -1
- package/dist/components/virtual-command-entry.mjs +7 -6
- package/dist/components/virtual-command-entry.mjs.map +1 -1
- package/dist/helpers/get-default-options.cjs +6 -6
- package/dist/helpers/get-default-options.mjs.map +1 -1
- package/dist/index.cjs +49 -62
- package/dist/index.d.cts +0 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +0 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +23 -36
- package/dist/index.mjs.map +1 -1
- package/dist/plugin-help/dist/components/display.cjs +259 -0
- package/dist/plugin-help/dist/components/display.mjs +254 -0
- package/dist/plugin-help/dist/components/display.mjs.map +1 -0
- package/dist/plugin-help/dist/components/help-builtin.cjs +85 -0
- package/dist/plugin-help/dist/components/help-builtin.mjs +84 -0
- package/dist/plugin-help/dist/components/help-builtin.mjs.map +1 -0
- package/dist/plugin-help/dist/components/help-command.cjs +96 -0
- package/dist/plugin-help/dist/components/help-command.mjs +96 -0
- package/dist/plugin-help/dist/components/help-command.mjs.map +1 -0
- package/dist/plugin-help/dist/components/index.cjs +3 -0
- package/dist/plugin-help/dist/components/index.mjs +5 -0
- package/dist/plugin-help/dist/index.cjs +103 -0
- package/dist/plugin-help/dist/index.d.cts +2 -0
- package/dist/plugin-help/dist/index.d.mts +2 -0
- package/dist/plugin-help/dist/index.mjs +100 -0
- package/dist/plugin-help/dist/index.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/constant-case.cjs +17 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/constant-case.mjs +17 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/constant-case.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/get-words.cjs +38 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/get-words.mjs +38 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/get-words.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/kebab-case.cjs +33 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/kebab-case.mjs +34 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/kebab-case.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/snake-case.cjs +40 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/snake-case.mjs +41 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/snake-case.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/upper-case-first.cjs +17 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/upper-case-first.mjs +17 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_string-format@0.17.4/node_modules/@stryke/string-format/dist/upper-case-first.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-empty.cjs +20 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-empty.mjs +21 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-empty.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-null.cjs +12 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-null.mjs +12 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-null.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set-string.cjs +20 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set-string.mjs +21 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set-string.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set.cjs +19 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set.mjs +20 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-set.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-string.cjs +12 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-string.mjs +12 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-string.mjs.map +1 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-undefined.cjs +8 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-undefined.mjs +8 -0
- package/dist/plugin-help/dist/node_modules/.pnpm/@stryke_type-checks@0.5.39/node_modules/@stryke/type-checks/dist/is-undefined.mjs.map +1 -0
- package/dist/plugin-help/dist/types/plugin.d.cts +62 -0
- package/dist/plugin-help/dist/types/plugin.d.cts.map +1 -0
- package/dist/plugin-help/dist/types/plugin.d.mts +62 -0
- package/dist/plugin-help/dist/types/plugin.d.mts.map +1 -0
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.mts +2 -2
- package/dist/types/plugin.d.cts +20 -34
- package/dist/types/plugin.d.cts.map +1 -1
- package/dist/types/plugin.d.mts +20 -34
- package/dist/types/plugin.d.mts.map +1 -1
- package/package.json +30 -16
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
4
|
+
let _alloy_js_core = require("@alloy-js/core");
|
|
5
|
+
let _alloy_js_typescript = require("@alloy-js/typescript");
|
|
6
|
+
let _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
|
|
7
|
+
let _powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
|
|
8
|
+
let _powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
9
|
+
let defu = require("defu");
|
|
10
|
+
let _shell_shock_plugin_upgrade_components_upgrade_builtin = require("@shell-shock/plugin-upgrade/components/upgrade-builtin");
|
|
11
|
+
|
|
12
|
+
//#region src/components/upgrade-builtin.tsx
|
|
13
|
+
/**
|
|
14
|
+
* A component to generate the `executeUpgrade` function in the `shell-shock:upgrade` builtin module.
|
|
15
|
+
*/
|
|
16
|
+
function ExecuteUpgradeFunctionDeclaration() {
|
|
17
|
+
const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
18
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
19
|
+
get when() {
|
|
20
|
+
return context.config.upgradeType !== false;
|
|
21
|
+
},
|
|
22
|
+
get children() {
|
|
23
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.FunctionDeclaration, {
|
|
24
|
+
"export": true,
|
|
25
|
+
async: true,
|
|
26
|
+
name: "executeUpgrade",
|
|
27
|
+
get doc() {
|
|
28
|
+
return `Run upgrade processing for the ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context, true)} application.`;
|
|
29
|
+
},
|
|
30
|
+
get children() {
|
|
31
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
32
|
+
condition: _alloy_js_core.code`await isCheckForUpdatesRequired()`,
|
|
33
|
+
get children() {
|
|
34
|
+
return [
|
|
35
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
36
|
+
"const": true,
|
|
37
|
+
name: "spinner",
|
|
38
|
+
initializer: _alloy_js_core.code`createSpinner({
|
|
39
|
+
message: "Checking for updates..."
|
|
40
|
+
}).start(); `
|
|
41
|
+
}),
|
|
42
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.VarDeclaration, {
|
|
43
|
+
"const": true,
|
|
44
|
+
name: "result",
|
|
45
|
+
initializer: _alloy_js_core.code`await checkForUpdates({ force: true }); `
|
|
46
|
+
}),
|
|
47
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.IfStatement, {
|
|
48
|
+
condition: _alloy_js_core.code`(result as CheckForUpdatesErrorResult)?.isError`,
|
|
49
|
+
get children() {
|
|
50
|
+
return _alloy_js_core.code`spinner.error(\`An error occurred while checking for ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context, true)} application updates. Please try again later - if the problem persists, please contact support.\`);
|
|
51
|
+
debug(result.error); `;
|
|
52
|
+
}
|
|
53
|
+
}),
|
|
54
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseIfClause, {
|
|
55
|
+
condition: _alloy_js_core.code`!(result as CheckForUpdatesSuccessResult)?.isUpToDate`,
|
|
56
|
+
get children() {
|
|
57
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
58
|
+
get when() {
|
|
59
|
+
return context.config.upgradeType !== false && (context.config.upgradeType === "confirm" || context.config.upgradeType === "manual");
|
|
60
|
+
},
|
|
61
|
+
get fallback() {
|
|
62
|
+
return [(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`spinner.stop();
|
|
63
|
+
info(\`A new version of ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context, true)} is available: \${colors.red(\`v\${result.currentVersion}\`)} \${colors.text.body.tertiary("➜")} \${colors.green(\`v\${result.latestVersion}\`)}\${result.package.date ? colors.text.body.tertiary(\` (updated on \${result.package.date})\`) : ""}\`);
|
|
64
|
+
|
|
65
|
+
try {
|
|
66
|
+
await upgrade();
|
|
67
|
+
spinner.success("Update successful! Please restart the application to apply the update.");
|
|
68
|
+
|
|
69
|
+
writeLine("");
|
|
70
|
+
writeLine("Press any key to exit the application...");
|
|
71
|
+
|
|
72
|
+
await waitForKeyPress();
|
|
73
|
+
return;
|
|
74
|
+
} catch (err) {
|
|
75
|
+
spinner.error(\`An error occurred while updating ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context, true)} to v\${result.latestVersion}. Please try again later - if the problem persists, please contact support.\`);
|
|
76
|
+
debug(err);
|
|
77
|
+
} `), (0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {})];
|
|
78
|
+
},
|
|
79
|
+
get children() {
|
|
80
|
+
return [
|
|
81
|
+
(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`spinner.stop();
|
|
82
|
+
warn(\`A new version of ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context, true)} is available: \${colors.red(\`v\${result.currentVersion}\`)} \${colors.text.body.tertiary("➜")} \${colors.green(\`v\${result.latestVersion}\`)}\${result.package.date ? colors.text.body.tertiary(\` (updated on \${result.package.date})\`) : ""}${context.config.upgradeType !== false && context.config.upgradeType === "manual" ? ` \\nPlease run \`${(0, _shell_shock_core_plugin_utils.getAppBin)(context)} update\` to upgrade to the latest version.` : ""}\`); `),
|
|
83
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
84
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
85
|
+
get when() {
|
|
86
|
+
return context.config.upgradeType !== false && context.config.upgradeType === "confirm";
|
|
87
|
+
},
|
|
88
|
+
get children() {
|
|
89
|
+
return _alloy_js_core.code`const willUpgradeNow = await confirm({
|
|
90
|
+
message: \`Would you like to update to v\${result.latestVersion} now?\`,
|
|
91
|
+
initialValue: true
|
|
92
|
+
});
|
|
93
|
+
if (isCancel(willUpgradeNow)) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
if (willUpgradeNow) {
|
|
98
|
+
spinner.text = \`Updating ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context, true)} to v\${result.latestVersion}...\`;
|
|
99
|
+
spinner.start();
|
|
100
|
+
|
|
101
|
+
try {
|
|
102
|
+
await upgrade();
|
|
103
|
+
spinner.success("Update successful! Please restart the application to apply the update.");
|
|
104
|
+
|
|
105
|
+
writeLine("");
|
|
106
|
+
writeLine("Press any key to exit the application...");
|
|
107
|
+
|
|
108
|
+
await waitForKeyPress();
|
|
109
|
+
return;
|
|
110
|
+
} catch (err) {
|
|
111
|
+
spinner.error(\`An error occurred while updating ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context, true)} to v\${result.latestVersion}. Please try again later - if the problem persists, please contact support.\`);
|
|
112
|
+
return { error: err };
|
|
113
|
+
}
|
|
114
|
+
} else {
|
|
115
|
+
help("Updates can be performed at any time by running the \`${(0, _shell_shock_core_plugin_utils.getAppBin)(context)} update\` command. Please remember that keeping your application up to date is important for ensuring you have the latest features, performance improvements, and security patches.");
|
|
116
|
+
} `;
|
|
117
|
+
}
|
|
118
|
+
})
|
|
119
|
+
];
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
}),
|
|
124
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_typescript.ElseClause, { get children() {
|
|
125
|
+
return _alloy_js_core.code`spinner.success("Currently running the latest version of ${(0, _shell_shock_core_plugin_utils.getAppTitle)(context, true)}.");
|
|
126
|
+
writeLine("");
|
|
127
|
+
`;
|
|
128
|
+
} })
|
|
129
|
+
];
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* A built-in upgrade module for Shell Shock.
|
|
139
|
+
*/
|
|
140
|
+
function UpgradeBuiltin(props) {
|
|
141
|
+
const [{ children, builtinImports }, rest] = (0, _alloy_js_core.splitProps)(props, ["children", "builtinImports"]);
|
|
142
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(_shell_shock_plugin_upgrade_components_upgrade_builtin.UpgradeBuiltin, (0, _alloy_js_core_jsx_runtime.mergeProps)(rest, {
|
|
143
|
+
get builtinImports() {
|
|
144
|
+
return (0, defu.defu)(builtinImports ?? {}, {
|
|
145
|
+
console: [
|
|
146
|
+
"colors",
|
|
147
|
+
"createSpinner",
|
|
148
|
+
"debug",
|
|
149
|
+
"info"
|
|
150
|
+
],
|
|
151
|
+
prompts: ["waitForKeyPress"]
|
|
152
|
+
});
|
|
153
|
+
},
|
|
154
|
+
get children() {
|
|
155
|
+
return [
|
|
156
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(ExecuteUpgradeFunctionDeclaration, {}),
|
|
157
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
158
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
159
|
+
get when() {
|
|
160
|
+
return Boolean(children);
|
|
161
|
+
},
|
|
162
|
+
children
|
|
163
|
+
})
|
|
164
|
+
];
|
|
165
|
+
}
|
|
166
|
+
}));
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
//#endregion
|
|
170
|
+
exports.ExecuteUpgradeFunctionDeclaration = ExecuteUpgradeFunctionDeclaration;
|
|
171
|
+
exports.UpgradeBuiltin = UpgradeBuiltin;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
2
|
+
import { UpgradeBuiltinProps } from "@shell-shock/plugin-upgrade/components/upgrade-builtin";
|
|
3
|
+
|
|
4
|
+
//#region src/components/upgrade-builtin.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* A component to generate the `executeUpgrade` function in the `shell-shock:upgrade` builtin module.
|
|
7
|
+
*/
|
|
8
|
+
declare function ExecuteUpgradeFunctionDeclaration(): _alloy_js_core0.Children;
|
|
9
|
+
/**
|
|
10
|
+
* A built-in upgrade module for Shell Shock.
|
|
11
|
+
*/
|
|
12
|
+
declare function UpgradeBuiltin(props: UpgradeBuiltinProps): _alloy_js_core0.Children;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { ExecuteUpgradeFunctionDeclaration, UpgradeBuiltin };
|
|
15
|
+
//# sourceMappingURL=upgrade-builtin.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upgrade-builtin.d.cts","names":[],"sources":["../../src/components/upgrade-builtin.tsx"],"mappings":";;;;;;;iBAqCgB,iCAAA,CAAA,GAAiC,eAAA,CAAA,QAAA;;;;iBA6IjC,cAAA,CAAe,KAAA,EAAO,mBAAA,GAAmB,eAAA,CAAA,QAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
2
|
+
import { UpgradeBuiltinProps } from "@shell-shock/plugin-upgrade/components/upgrade-builtin";
|
|
3
|
+
|
|
4
|
+
//#region src/components/upgrade-builtin.d.ts
|
|
5
|
+
/**
|
|
6
|
+
* A component to generate the `executeUpgrade` function in the `shell-shock:upgrade` builtin module.
|
|
7
|
+
*/
|
|
8
|
+
declare function ExecuteUpgradeFunctionDeclaration(): _alloy_js_core0.Children;
|
|
9
|
+
/**
|
|
10
|
+
* A built-in upgrade module for Shell Shock.
|
|
11
|
+
*/
|
|
12
|
+
declare function UpgradeBuiltin(props: UpgradeBuiltinProps): _alloy_js_core0.Children;
|
|
13
|
+
//#endregion
|
|
14
|
+
export { ExecuteUpgradeFunctionDeclaration, UpgradeBuiltin };
|
|
15
|
+
//# sourceMappingURL=upgrade-builtin.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upgrade-builtin.d.mts","names":[],"sources":["../../src/components/upgrade-builtin.tsx"],"mappings":";;;;;;;iBAqCgB,iCAAA,CAAA,GAAiC,eAAA,CAAA,QAAA;;;;iBA6IjC,cAAA,CAAe,KAAA,EAAO,mBAAA,GAAmB,eAAA,CAAA,QAAA"}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { createComponent, memo, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { Show, code, splitProps } from "@alloy-js/core";
|
|
3
|
+
import { ElseClause, ElseIfClause, FunctionDeclaration, IfStatement, VarDeclaration } from "@alloy-js/typescript";
|
|
4
|
+
import { getAppBin, getAppTitle } from "@shell-shock/core/plugin-utils";
|
|
5
|
+
import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
|
|
6
|
+
import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
|
|
7
|
+
import { defu as defu$1 } from "defu";
|
|
8
|
+
import { UpgradeBuiltin as UpgradeBuiltin$1 } from "@shell-shock/plugin-upgrade/components/upgrade-builtin";
|
|
9
|
+
|
|
10
|
+
//#region src/components/upgrade-builtin.tsx
|
|
11
|
+
/**
|
|
12
|
+
* A component to generate the `executeUpgrade` function in the `shell-shock:upgrade` builtin module.
|
|
13
|
+
*/
|
|
14
|
+
function ExecuteUpgradeFunctionDeclaration() {
|
|
15
|
+
const context = usePowerlines();
|
|
16
|
+
return createComponent(Show, {
|
|
17
|
+
get when() {
|
|
18
|
+
return context.config.upgradeType !== false;
|
|
19
|
+
},
|
|
20
|
+
get children() {
|
|
21
|
+
return createComponent(FunctionDeclaration, {
|
|
22
|
+
"export": true,
|
|
23
|
+
async: true,
|
|
24
|
+
name: "executeUpgrade",
|
|
25
|
+
get doc() {
|
|
26
|
+
return `Run upgrade processing for the ${getAppTitle(context, true)} application.`;
|
|
27
|
+
},
|
|
28
|
+
get children() {
|
|
29
|
+
return createComponent(IfStatement, {
|
|
30
|
+
condition: code`await isCheckForUpdatesRequired()`,
|
|
31
|
+
get children() {
|
|
32
|
+
return [
|
|
33
|
+
createComponent(VarDeclaration, {
|
|
34
|
+
"const": true,
|
|
35
|
+
name: "spinner",
|
|
36
|
+
initializer: code`createSpinner({
|
|
37
|
+
message: "Checking for updates..."
|
|
38
|
+
}).start(); `
|
|
39
|
+
}),
|
|
40
|
+
createComponent(VarDeclaration, {
|
|
41
|
+
"const": true,
|
|
42
|
+
name: "result",
|
|
43
|
+
initializer: code`await checkForUpdates({ force: true }); `
|
|
44
|
+
}),
|
|
45
|
+
createComponent(IfStatement, {
|
|
46
|
+
condition: code`(result as CheckForUpdatesErrorResult)?.isError`,
|
|
47
|
+
get children() {
|
|
48
|
+
return code`spinner.error(\`An error occurred while checking for ${getAppTitle(context, true)} application updates. Please try again later - if the problem persists, please contact support.\`);
|
|
49
|
+
debug(result.error); `;
|
|
50
|
+
}
|
|
51
|
+
}),
|
|
52
|
+
createComponent(ElseIfClause, {
|
|
53
|
+
condition: code`!(result as CheckForUpdatesSuccessResult)?.isUpToDate`,
|
|
54
|
+
get children() {
|
|
55
|
+
return createComponent(Show, {
|
|
56
|
+
get when() {
|
|
57
|
+
return context.config.upgradeType !== false && (context.config.upgradeType === "confirm" || context.config.upgradeType === "manual");
|
|
58
|
+
},
|
|
59
|
+
get fallback() {
|
|
60
|
+
return [memo(() => code`spinner.stop();
|
|
61
|
+
info(\`A new version of ${getAppTitle(context, true)} is available: \${colors.red(\`v\${result.currentVersion}\`)} \${colors.text.body.tertiary("➜")} \${colors.green(\`v\${result.latestVersion}\`)}\${result.package.date ? colors.text.body.tertiary(\` (updated on \${result.package.date})\`) : ""}\`);
|
|
62
|
+
|
|
63
|
+
try {
|
|
64
|
+
await upgrade();
|
|
65
|
+
spinner.success("Update successful! Please restart the application to apply the update.");
|
|
66
|
+
|
|
67
|
+
writeLine("");
|
|
68
|
+
writeLine("Press any key to exit the application...");
|
|
69
|
+
|
|
70
|
+
await waitForKeyPress();
|
|
71
|
+
return;
|
|
72
|
+
} catch (err) {
|
|
73
|
+
spinner.error(\`An error occurred while updating ${getAppTitle(context, true)} to v\${result.latestVersion}. Please try again later - if the problem persists, please contact support.\`);
|
|
74
|
+
debug(err);
|
|
75
|
+
} `), createComponent(Spacing, {})];
|
|
76
|
+
},
|
|
77
|
+
get children() {
|
|
78
|
+
return [
|
|
79
|
+
memo(() => code`spinner.stop();
|
|
80
|
+
warn(\`A new version of ${getAppTitle(context, true)} is available: \${colors.red(\`v\${result.currentVersion}\`)} \${colors.text.body.tertiary("➜")} \${colors.green(\`v\${result.latestVersion}\`)}\${result.package.date ? colors.text.body.tertiary(\` (updated on \${result.package.date})\`) : ""}${context.config.upgradeType !== false && context.config.upgradeType === "manual" ? ` \\nPlease run \`${getAppBin(context)} update\` to upgrade to the latest version.` : ""}\`); `),
|
|
81
|
+
createComponent(Spacing, {}),
|
|
82
|
+
createComponent(Show, {
|
|
83
|
+
get when() {
|
|
84
|
+
return context.config.upgradeType !== false && context.config.upgradeType === "confirm";
|
|
85
|
+
},
|
|
86
|
+
get children() {
|
|
87
|
+
return code`const willUpgradeNow = await confirm({
|
|
88
|
+
message: \`Would you like to update to v\${result.latestVersion} now?\`,
|
|
89
|
+
initialValue: true
|
|
90
|
+
});
|
|
91
|
+
if (isCancel(willUpgradeNow)) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (willUpgradeNow) {
|
|
96
|
+
spinner.text = \`Updating ${getAppTitle(context, true)} to v\${result.latestVersion}...\`;
|
|
97
|
+
spinner.start();
|
|
98
|
+
|
|
99
|
+
try {
|
|
100
|
+
await upgrade();
|
|
101
|
+
spinner.success("Update successful! Please restart the application to apply the update.");
|
|
102
|
+
|
|
103
|
+
writeLine("");
|
|
104
|
+
writeLine("Press any key to exit the application...");
|
|
105
|
+
|
|
106
|
+
await waitForKeyPress();
|
|
107
|
+
return;
|
|
108
|
+
} catch (err) {
|
|
109
|
+
spinner.error(\`An error occurred while updating ${getAppTitle(context, true)} to v\${result.latestVersion}. Please try again later - if the problem persists, please contact support.\`);
|
|
110
|
+
return { error: err };
|
|
111
|
+
}
|
|
112
|
+
} else {
|
|
113
|
+
help("Updates can be performed at any time by running the \`${getAppBin(context)} update\` command. Please remember that keeping your application up to date is important for ensuring you have the latest features, performance improvements, and security patches.");
|
|
114
|
+
} `;
|
|
115
|
+
}
|
|
116
|
+
})
|
|
117
|
+
];
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
}),
|
|
122
|
+
createComponent(ElseClause, { get children() {
|
|
123
|
+
return code`spinner.success("Currently running the latest version of ${getAppTitle(context, true)}.");
|
|
124
|
+
writeLine("");
|
|
125
|
+
`;
|
|
126
|
+
} })
|
|
127
|
+
];
|
|
128
|
+
}
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* A built-in upgrade module for Shell Shock.
|
|
137
|
+
*/
|
|
138
|
+
function UpgradeBuiltin(props) {
|
|
139
|
+
const [{ children, builtinImports }, rest] = splitProps(props, ["children", "builtinImports"]);
|
|
140
|
+
return createComponent(UpgradeBuiltin$1, mergeProps(rest, {
|
|
141
|
+
get builtinImports() {
|
|
142
|
+
return defu$1(builtinImports ?? {}, {
|
|
143
|
+
console: [
|
|
144
|
+
"colors",
|
|
145
|
+
"createSpinner",
|
|
146
|
+
"debug",
|
|
147
|
+
"info"
|
|
148
|
+
],
|
|
149
|
+
prompts: ["waitForKeyPress"]
|
|
150
|
+
});
|
|
151
|
+
},
|
|
152
|
+
get children() {
|
|
153
|
+
return [
|
|
154
|
+
createComponent(ExecuteUpgradeFunctionDeclaration, {}),
|
|
155
|
+
createComponent(Spacing, {}),
|
|
156
|
+
createComponent(Show, {
|
|
157
|
+
get when() {
|
|
158
|
+
return Boolean(children);
|
|
159
|
+
},
|
|
160
|
+
children
|
|
161
|
+
})
|
|
162
|
+
];
|
|
163
|
+
}
|
|
164
|
+
}));
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
//#endregion
|
|
168
|
+
export { ExecuteUpgradeFunctionDeclaration, UpgradeBuiltin };
|
|
169
|
+
//# sourceMappingURL=upgrade-builtin.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"upgrade-builtin.mjs","names":[],"sources":["../../src/components/upgrade-builtin.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, Show, splitProps } from \"@alloy-js/core\";\nimport {\n ElseClause,\n ElseIfClause,\n FunctionDeclaration,\n IfStatement,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport { getAppBin, getAppTitle } from \"@shell-shock/core/plugin-utils\";\nimport type { UpgradeBuiltinProps } from \"@shell-shock/plugin-upgrade/components/upgrade-builtin\";\nimport { UpgradeBuiltin as BaseUpgradeBuiltin } from \"@shell-shock/plugin-upgrade/components/upgrade-builtin\";\nimport { defu } from \"defu\";\nimport type { CLIPresetContext } from \"../types/plugin\";\n\n/**\n * A component to generate the `executeUpgrade` function in the `shell-shock:upgrade` builtin module.\n */\nexport function ExecuteUpgradeFunctionDeclaration() {\n const context = usePowerlines<CLIPresetContext>();\n\n return (\n <Show when={context.config.upgradeType !== false}>\n <FunctionDeclaration\n export\n async\n name=\"executeUpgrade\"\n doc={`Run upgrade processing for the ${getAppTitle(\n context,\n true\n )} application.`}>\n <IfStatement condition={code`await isCheckForUpdatesRequired()`}>\n <VarDeclaration\n const\n name=\"spinner\"\n initializer={code`createSpinner({\n message: \"Checking for updates...\"\n }).start(); `}\n />\n <VarDeclaration\n const\n name=\"result\"\n initializer={code`await checkForUpdates({ force: true }); `}\n />\n <IfStatement\n condition={code`(result as CheckForUpdatesErrorResult)?.isError`}>\n {code`spinner.error(\\`An error occurred while checking for ${getAppTitle(\n context,\n true\n )} application updates. Please try again later - if the problem persists, please contact support.\\`);\n debug(result.error); `}\n </IfStatement>\n <ElseIfClause\n condition={code`!(result as CheckForUpdatesSuccessResult)?.isUpToDate`}>\n <Show\n when={\n context.config.upgradeType !== false &&\n (context.config.upgradeType === \"confirm\" ||\n context.config.upgradeType === \"manual\")\n }\n fallback={\n <>\n {code`spinner.stop();\n info(\\`A new version of ${getAppTitle(\n context,\n true\n )} is available: \\${colors.red(\\`v\\${result.currentVersion}\\`)} \\${colors.text.body.tertiary(\"➜\")} \\${colors.green(\\`v\\${result.latestVersion}\\`)}\\${result.package.date ? colors.text.body.tertiary(\\` (updated on \\${result.package.date})\\`) : \"\"}\\`);\n\n try {\n await upgrade();\n spinner.success(\"Update successful! Please restart the application to apply the update.\");\n\n writeLine(\"\");\n writeLine(\"Press any key to exit the application...\");\n\n await waitForKeyPress();\n return;\n } catch (err) {\n spinner.error(\\`An error occurred while updating ${getAppTitle(\n context,\n true\n )} to v\\${result.latestVersion}. Please try again later - if the problem persists, please contact support.\\`);\n debug(err);\n } `}\n <Spacing />\n </>\n }>\n {code`spinner.stop();\n warn(\\`A new version of ${getAppTitle(\n context,\n true\n )} is available: \\${colors.red(\\`v\\${result.currentVersion}\\`)} \\${colors.text.body.tertiary(\"➜\")} \\${colors.green(\\`v\\${result.latestVersion}\\`)}\\${result.package.date ? colors.text.body.tertiary(\\` (updated on \\${result.package.date})\\`) : \"\"}${\n context.config.upgradeType !== false &&\n context.config.upgradeType === \"manual\"\n ? ` \\\\nPlease run \\`${getAppBin(\n context\n )} update\\` to upgrade to the latest version.`\n : \"\"\n }\\`); `}\n <Spacing />\n <Show\n when={\n context.config.upgradeType !== false &&\n context.config.upgradeType === \"confirm\"\n }>\n {code`const willUpgradeNow = await confirm({\n message: \\`Would you like to update to v\\${result.latestVersion} now?\\`,\n initialValue: true\n });\n if (isCancel(willUpgradeNow)) {\n return;\n }\n\n if (willUpgradeNow) {\n spinner.text = \\`Updating ${getAppTitle(\n context,\n true\n )} to v\\${result.latestVersion}...\\`;\n spinner.start();\n\n try {\n await upgrade();\n spinner.success(\"Update successful! Please restart the application to apply the update.\");\n\n writeLine(\"\");\n writeLine(\"Press any key to exit the application...\");\n\n await waitForKeyPress();\n return;\n } catch (err) {\n spinner.error(\\`An error occurred while updating ${getAppTitle(\n context,\n true\n )} to v\\${result.latestVersion}. Please try again later - if the problem persists, please contact support.\\`);\n return { error: err };\n }\n } else {\n help(\"Updates can be performed at any time by running the \\`${getAppBin(\n context\n )} update\\` command. Please remember that keeping your application up to date is important for ensuring you have the latest features, performance improvements, and security patches.\");\n } `}\n </Show>\n </Show>\n </ElseIfClause>\n <ElseClause>{code`spinner.success(\"Currently running the latest version of ${getAppTitle(\n context,\n true\n )}.\");\n writeLine(\"\");\n `}</ElseClause>\n </IfStatement>\n </FunctionDeclaration>\n </Show>\n );\n}\n\n/**\n * A built-in upgrade module for Shell Shock.\n */\nexport function UpgradeBuiltin(props: UpgradeBuiltinProps) {\n const [{ children, builtinImports }, rest] = splitProps(props, [\n \"children\",\n \"builtinImports\"\n ]);\n\n return (\n <BaseUpgradeBuiltin\n {...rest}\n builtinImports={defu(builtinImports ?? {}, {\n console: [\"colors\", \"createSpinner\", \"debug\", \"info\"],\n prompts: [\"waitForKeyPress\"]\n })}>\n <ExecuteUpgradeFunctionDeclaration />\n <Spacing />\n <Show when={Boolean(children)}>{children}</Show>\n </BaseUpgradeBuiltin>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAgCA,SAAc,oCAAkC;;AAE9C,QAAA,gBAAA,MAAA;EACE,IAAC,OAAU;AACb,UAAA,QAAA,OAAA,gBAAA;;EAEA,IAAM,WAAU;;IAEV,UAAC;IACJ,OAAU;IACR,MAAA;IACC,IAAA,MAAA;AACA,YAAA,kCAAA,YAAA,SAAA,KAAA,CAAA;;IAEA,IAAI,WAAM;AACR,YAAO,gBAAA,aAAA;MACP,WAAA,IAAA;MACC,IAAA,WAAc;AAChB,cAAY;QAAA,gBAAgB,gBAAM;SAChC,SAAA;SACC,MAAA;SACI,aAAS,IAAA;;;SAGV,CAAC;QAAC,gBAAU,gBAAA;SAChB,SAAA;SACA,MAAA;SACC,aAAA,IAAA;SACA,CAAI;QAAE,gBAAM,aAAA;SACZ,WAAa,IAAK;SACnB,IAAA,WAAA;AACA,iBAAA,IAAA,wDAAA,YAAA,SAAA,KAAA,CAAA;;;SAGG,CAAA;QAAA,gBAAO,cAAA;SACP,WAAA,IAAA;SACC,IAAA,WAAY;AACb,iBAAM,gBAAgB,MAAA;WACxB,IAAW,OAAA;AACZ,mBAAA,QAAA,OAAA,gBAAA,UAAA,QAAA,OAAA,gBAAA,aAAA,QAAA,OAAA,gBAAA;;WAEE,IAAA,WAAA;AACM,mBAAA,CAAA,WAAA,IAAA;8CAC2B,YAAQ,SAAA,KAAA,CAAA;;;;;;;;;;;;yEAY9B,YAAA,SAAA,KAAA,CAAA;;wBAEF,EAAA,gBAAiB,SAAO,EAAA,CAAU,CAAC;;WAErC,IAAE,WAAa;AACb,mBAAA;aAAA,WAAqB,IAAI;;;;cAEzB,IAAM,OAAA;AACN,sBAAM,QAAA,OAAA,gBAAA,SAAA,QAAA,OAAA,gBAAA;;cAEN,IAAA,WAAgB;AACd,sBAAO,IAAA;;;;;;;;;8CASW,YAAW,SAAA,KAAA,CAAA;;;;;;;;;;;;;uEAahC,YAAA,SAAA,KAAA,CAAA;;;;gFAIsC,UAAA,QAAA,CAAA;;;cAGzC,CAAA;aAAA;;WAEA,CAAA;;;sCAGF,IAAI,WAAA;AACF,gBAAO,IAAC,4DAA+B,YAAA,SAAA,KAAA,CAAA;;;WAI1C,CAAC;QAAC;;MAEN,CAAC;;IAEL,CAAC;;EAEL,CAAC;;;;;AAMJ,SAAgB,eAAY,OAA+B;CACzD,MAAM,CAAC,EACL,UACA,kBACC,QAAQ,WAAO,OAAS,CAAA,YAAY,iBAAA,CAAA;AACvC,QAAO,gBAAS,kBAAA,WAAA,MAAA;EACd,IAAI,iBAAe;AACjB,UAAO,OAAK,kBAAkB,EAAE,EAAC;IAC/B,SAAS;KAAC;KAAE;KAAA;KAAA;KAAA;IACZ,SAAS,CAAC,kBAAY;IACvB,CAAC;;EAEJ,IAAI,WAAU;AACZ,UAAM;IAAA,gBAAY,mCAAA,EAAA,CAAA;IAAA,gBAAA,SAAA,EAAA,CAAA;IAAA,gBAAA,MAAA;KAChB,IAAG,OAAA;AACD,aAAE,QAAO,SAAA;;KAEJ;KACR,CAAC;IAAC;;EAEN,CAAC,CAAC"}
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
2
3
|
const require_components_banner_function_declaration = require('./banner-function-declaration.cjs');
|
|
3
4
|
const require_components_command_router = require('./command-router.cjs');
|
|
4
5
|
const require_components_command_entry = require('./command-entry.cjs');
|
|
5
|
-
let
|
|
6
|
-
let
|
|
7
|
-
let
|
|
8
|
-
let
|
|
9
|
-
let
|
|
10
|
-
let __stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
|
|
6
|
+
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
7
|
+
let _alloy_js_core = require("@alloy-js/core");
|
|
8
|
+
let _powerlines_plugin_alloy_core_components = require("@powerlines/plugin-alloy/core/components");
|
|
9
|
+
let _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
|
|
10
|
+
let _powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
11
11
|
let defu = require("defu");
|
|
12
|
-
defu =
|
|
13
|
-
let
|
|
14
|
-
let
|
|
12
|
+
defu = require_runtime.__toESM(defu);
|
|
13
|
+
let _stryke_path_join = require("@stryke/path/join");
|
|
14
|
+
let _stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
|
|
15
|
+
let _powerlines_plugin_alloy_typescript_components_typescript_file = require("@powerlines/plugin-alloy/typescript/components/typescript-file");
|
|
16
|
+
let _shell_shock_preset_script_components_virtual_command_entry = require("@shell-shock/preset-script/components/virtual-command-entry");
|
|
15
17
|
|
|
16
18
|
//#region src/components/virtual-command-entry.tsx
|
|
17
19
|
/**
|
|
@@ -19,9 +21,9 @@ let __shell_shock_preset_script_components_virtual_command_entry = require("@she
|
|
|
19
21
|
*/
|
|
20
22
|
function VirtualCommandEntry(props) {
|
|
21
23
|
const { command, imports, builtinImports, ...rest } = props;
|
|
22
|
-
const context = (0,
|
|
23
|
-
const filePath = (0,
|
|
24
|
-
return [(0,
|
|
24
|
+
const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
25
|
+
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"));
|
|
26
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_typescript_file.TypescriptFile, (0, _alloy_js_core_jsx_runtime.mergeProps)(rest, {
|
|
25
27
|
get path() {
|
|
26
28
|
return filePath.value;
|
|
27
29
|
},
|
|
@@ -29,7 +31,7 @@ function VirtualCommandEntry(props) {
|
|
|
29
31
|
return (0, defu.default)(imports ?? {}, Object.entries(command.children).filter(([, child]) => child.isVirtual).reduce((ret, [name, child]) => {
|
|
30
32
|
ret[`./${child.name}`] = [{
|
|
31
33
|
name: "handler",
|
|
32
|
-
alias: `handle${(0,
|
|
34
|
+
alias: `handle${(0, _stryke_string_format_pascal_case.pascalCase)(name)}`
|
|
33
35
|
}];
|
|
34
36
|
return ret;
|
|
35
37
|
}, {}));
|
|
@@ -65,18 +67,18 @@ function VirtualCommandEntry(props) {
|
|
|
65
67
|
"select",
|
|
66
68
|
"isCancel",
|
|
67
69
|
"sleep"
|
|
68
|
-
]
|
|
70
|
+
],
|
|
71
|
+
[(0, _stryke_path_join.joinPaths)("help", ...command.segments.filter((segment) => !(0, _shell_shock_core_plugin_utils.isDynamicPathSegment)(segment)))]: ["showHelp"]
|
|
69
72
|
});
|
|
70
73
|
},
|
|
71
74
|
get children() {
|
|
72
75
|
return [
|
|
73
|
-
(0,
|
|
74
|
-
(0,
|
|
75
|
-
(0,
|
|
76
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_virtual_command_entry.VirtualCommandHandlerDeclaration, {
|
|
76
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(require_components_banner_function_declaration.BannerFunctionDeclaration, { command }),
|
|
77
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components.Spacing, {}),
|
|
78
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_shell_shock_preset_script_components_virtual_command_entry.VirtualCommandHandlerDeclaration, {
|
|
77
79
|
command,
|
|
78
80
|
get children() {
|
|
79
|
-
return (0,
|
|
81
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_command_router.CommandRouter, {
|
|
80
82
|
get segments() {
|
|
81
83
|
return command.segments;
|
|
82
84
|
},
|
|
@@ -88,19 +90,19 @@ function VirtualCommandEntry(props) {
|
|
|
88
90
|
})
|
|
89
91
|
];
|
|
90
92
|
}
|
|
91
|
-
})), (0,
|
|
93
|
+
})), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
92
94
|
get each() {
|
|
93
95
|
return Object.values(command.children);
|
|
94
96
|
},
|
|
95
|
-
children: (child) => (0,
|
|
97
|
+
children: (child) => (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.Show, {
|
|
96
98
|
get when() {
|
|
97
99
|
return child.isVirtual;
|
|
98
100
|
},
|
|
99
101
|
get fallback() {
|
|
100
|
-
return (0,
|
|
102
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_command_entry.CommandEntry, { command: child });
|
|
101
103
|
},
|
|
102
104
|
get children() {
|
|
103
|
-
return (0,
|
|
105
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(VirtualCommandEntry, { command: child });
|
|
104
106
|
}
|
|
105
107
|
})
|
|
106
108
|
})];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"virtual-command-entry.d.cts","names":[],"sources":["../../src/components/virtual-command-entry.tsx"],"
|
|
1
|
+
{"version":3,"file":"virtual-command-entry.d.cts","names":[],"sources":["../../src/components/virtual-command-entry.tsx"],"mappings":";;;;;UAmCiB,wBAAA,SAAiC,IAAA,CAChD,cAAA;EAGA,OAAA,EAAS,WAAA;AAAA;AAJX;;;AAAA,iBAUgB,mBAAA,CAAoB,KAAA,EAAO,wBAAA,GAAwB,eAAA,CAAA,QAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { EntryFileProps } from "@powerlines/plugin-alloy/typescript/components/entry-file";
|
|
1
|
+
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
3
2
|
import { CommandTree } from "@shell-shock/core";
|
|
3
|
+
import { EntryFileProps } from "@powerlines/plugin-alloy/typescript/components/entry-file";
|
|
4
4
|
|
|
5
5
|
//#region src/components/virtual-command-entry.d.ts
|
|
6
6
|
interface VirtualCommandEntryProps extends Omit<EntryFileProps, "path" | "typeDefinition"> {
|
|
@@ -9,7 +9,7 @@ interface VirtualCommandEntryProps extends Omit<EntryFileProps, "path" | "typeDe
|
|
|
9
9
|
/**
|
|
10
10
|
* The virtual command entry point for the Shell Shock project.
|
|
11
11
|
*/
|
|
12
|
-
declare function VirtualCommandEntry(props: VirtualCommandEntryProps):
|
|
12
|
+
declare function VirtualCommandEntry(props: VirtualCommandEntryProps): _alloy_js_core0.Children;
|
|
13
13
|
//#endregion
|
|
14
14
|
export { VirtualCommandEntry, VirtualCommandEntryProps };
|
|
15
15
|
//# sourceMappingURL=virtual-command-entry.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"virtual-command-entry.d.mts","names":[],"sources":["../../src/components/virtual-command-entry.tsx"],"
|
|
1
|
+
{"version":3,"file":"virtual-command-entry.d.mts","names":[],"sources":["../../src/components/virtual-command-entry.tsx"],"mappings":";;;;;UAmCiB,wBAAA,SAAiC,IAAA,CAChD,cAAA;EAGA,OAAA,EAAS,WAAA;AAAA;AAJX;;;AAAA,iBAUgB,mBAAA,CAAoB,KAAA,EAAO,wBAAA,GAAwB,eAAA,CAAA,QAAA"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { BannerFunctionDeclaration } from "./banner-function-declaration.mjs";
|
|
2
2
|
import { CommandRouter } from "./command-router.mjs";
|
|
3
3
|
import { CommandEntry } from "./command-entry.mjs";
|
|
4
|
-
import { createComponent,
|
|
4
|
+
import { createComponent, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
5
5
|
import { For, Show, computed } from "@alloy-js/core";
|
|
6
|
-
import {
|
|
6
|
+
import { Spacing } from "@powerlines/plugin-alloy/core/components";
|
|
7
7
|
import { isDynamicPathSegment } from "@shell-shock/core/plugin-utils";
|
|
8
|
+
import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
|
|
9
|
+
import defu from "defu";
|
|
8
10
|
import { joinPaths } from "@stryke/path/join";
|
|
9
11
|
import { pascalCase } from "@stryke/string-format/pascal-case";
|
|
10
|
-
import defu from "defu";
|
|
11
12
|
import { TypescriptFile } from "@powerlines/plugin-alloy/typescript/components/typescript-file";
|
|
12
13
|
import { VirtualCommandHandlerDeclaration } from "@shell-shock/preset-script/components/virtual-command-entry";
|
|
13
14
|
|
|
@@ -63,14 +64,14 @@ function VirtualCommandEntry(props) {
|
|
|
63
64
|
"select",
|
|
64
65
|
"isCancel",
|
|
65
66
|
"sleep"
|
|
66
|
-
]
|
|
67
|
+
],
|
|
68
|
+
[joinPaths("help", ...command.segments.filter((segment) => !isDynamicPathSegment(segment)))]: ["showHelp"]
|
|
67
69
|
});
|
|
68
70
|
},
|
|
69
71
|
get children() {
|
|
70
72
|
return [
|
|
71
73
|
createComponent(BannerFunctionDeclaration, { command }),
|
|
72
|
-
|
|
73
|
-
createIntrinsic("hbr", {}),
|
|
74
|
+
createComponent(Spacing, {}),
|
|
74
75
|
createComponent(VirtualCommandHandlerDeclaration, {
|
|
75
76
|
command,
|
|
76
77
|
get children() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"virtual-command-entry.mjs","names":[
|
|
1
|
+
{"version":3,"file":"virtual-command-entry.mjs","names":[],"sources":["../../src/components/virtual-command-entry.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { computed, For, Show } from \"@alloy-js/core\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport type { TypescriptFileImports } from \"@powerlines/plugin-alloy/types/components\";\nimport type { EntryFileProps } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport { TypescriptFile } from \"@powerlines/plugin-alloy/typescript/components/typescript-file\";\nimport type { CommandTree } from \"@shell-shock/core\";\nimport { isDynamicPathSegment } from \"@shell-shock/core/plugin-utils\";\nimport { VirtualCommandHandlerDeclaration } from \"@shell-shock/preset-script/components/virtual-command-entry\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport defu from \"defu\";\nimport type { CLIPresetContext } from \"../types/plugin\";\nimport { BannerFunctionDeclaration } from \"./banner-function-declaration\";\nimport { CommandEntry } from \"./command-entry\";\nimport { CommandRouter } from \"./command-router\";\n\nexport interface VirtualCommandEntryProps extends Omit<\n EntryFileProps,\n \"path\" | \"typeDefinition\"\n> {\n command: CommandTree;\n}\n\n/**\n * The virtual command entry point for the Shell Shock project.\n */\nexport function VirtualCommandEntry(props: VirtualCommandEntryProps) {\n const { command, imports, builtinImports, ...rest } = props;\n\n const context = usePowerlines<CLIPresetContext>();\n const filePath = computed(() =>\n joinPaths(\n context.entryPath,\n command.segments\n .filter(segment => !isDynamicPathSegment(segment))\n .join(\"/\"),\n \"index.ts\"\n )\n );\n\n return (\n <>\n <TypescriptFile\n {...rest}\n path={filePath.value}\n imports={defu(\n imports ?? {},\n Object.entries(command.children)\n .filter(([, child]) => child.isVirtual)\n .reduce((ret, [name, child]) => {\n ret[`./${child.name}`] = [\n { name: \"handler\", alias: `handle${pascalCase(name)}` }\n ];\n\n return ret;\n }, {} as TypescriptFileImports)\n )}\n builtinImports={defu(builtinImports ?? {}, {\n env: [\"isDevelopment\", \"isDebug\"],\n console: [\n \"warn\",\n \"error\",\n \"info\",\n \"help\",\n \"table\",\n \"colors\",\n \"writeLine\",\n \"splitText\",\n \"stripAnsi\"\n ],\n utils: [\n \"useApp\",\n \"useArgs\",\n \"hasFlag\",\n \"isMinimal\",\n \"isUnicodeSupported\",\n \"isInteractive\",\n \"isHelp\",\n \"findSuggestions\"\n ],\n prompts: [\"text\", \"numeric\", \"toggle\", \"select\", \"isCancel\", \"sleep\"],\n [joinPaths(\n \"help\",\n ...command.segments.filter(\n segment => !isDynamicPathSegment(segment)\n )\n )]: [\"showHelp\"]\n })}>\n <BannerFunctionDeclaration command={command} />\n <Spacing />\n <VirtualCommandHandlerDeclaration command={command}>\n <CommandRouter\n segments={command.segments}\n commands={command.children}\n />\n </VirtualCommandHandlerDeclaration>\n </TypescriptFile>\n <For each={Object.values(command.children)}>\n {child => (\n <Show\n when={child.isVirtual}\n fallback={<CommandEntry command={child} />}>\n <VirtualCommandEntry command={child} />\n </Show>\n )}\n </For>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AA0CA,SAAE,oBAAA,OAAA;CACA,MAAK,EACL,SACF,SACE,4BAEA;CACA,MAAM,UAAU,eAAc;CAC9B,MAAE,WAAS,eAAA,UAAA,QAAA,WAAA,QAAA,SAAA,QAAA,YAAA,CAAA,qBAAA,QAAA,CAAA,CAAA,KAAA,IAAA,EAAA,WAAA,CAAA;AACX,QAAI,CAAA,gBAAiB,gBAAA,WAAA,MAAA;EACnB,IAAE,OAAQ;AACR,UAAG,SAAO;;EAEZ,IAAG,UAAQ;AACX,UAAA,KAAA,WAAA,EAAA,EAAA,OAAA,QAAA,QAAA,SAAA,CAAA,QAAA,GAAA,WAAA,MAAA,UAAA,CAAA,QAAA,KAAA,CAAA,MAAA,WAAA;AACD,QAAA,KAAA,MAAA,UAAA,CAAA;;KAEM,OAAA,SAAA,WAAA,KAAA;KACJ,CAAA;AACE,WAAA;MACE,EAAE,CAAK,CAAA;;EAEZ,IAAI,iBAAa;AACf,UAAI,KAAQ,kBAAK,EAAA,EAAA;IACf,KAAE,CAAA,iBAAe,UAAgB;IACjC,SAAK;KAAA;KAAW;KAAW;KAAM;KAAS;KAAA;KAAA;KAAA;KAAA;KAAA;IAC1C,OAAK;KAAA;KAAa;KAAO;KAAW;KAAA;KAAA;KAAA;KAAA;KAAA;IACpC,SAAS;KAAC;KAAK;KAAc;KAAE;KAAA;KAAA;KAAA;KAC9B,UAAS,QAAO,GAAA,QAAU,SAAQ,QAAQ,YAAW,CAAI,qBAAI,QAAA,CAAA,CAAA,GAAA,CAAA,WAAA;IAC/D,CAAC;;EAEJ,IAAI,WAAM;AACR,UAAO;IAAC,gBAAO,2BAAqB,EACjC,SACF,CAAC;IAAA,gBAAoB,SAAC,EAAA,CAAA;IAAA,gBAAsB,kCAAA;KAClC;KACT,IAAE,WAAS;AACT,aAAO,gBAAC,eAAA;OACN,IAAC,WAAM;AACN,eAAK,QAAA;;OAEN,IAAC,WAAM;AACN,eAAO,QAAA;;OAET,CAAC;;KAEL,CAAC;IAAC;;EAEN,CAAC,CAAC,EAAE,gBAAa,KAAA;EAChB,IAAI,OAAK;AACP,UAAO,OAAO,OAAC,QAAA,SAAA;;EAEjB,WAAS,UAAA,gBAAmB,MAAA;GAC1B,IAAI,OAAG;AACL,WAAK,MAAO;;GAEd,IAAI,WAAC;AACH,WAAE,gBAAmB,cAAkB,EACrC,SAAC,OACF,CAAC;;GAEJ,IAAI,WAAW;AACb,WAAI,gBAAA,qBAAA,EACF,SAAM,OACP,CAAC;;GAEL,CAAC;EACH,CAAC,CAAC"}
|