@shell-shock/preset-cli 0.9.20 → 0.9.23
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/banner-builtin.cjs +92 -5
- package/dist/components/banner-builtin.d.cts +2 -3
- package/dist/components/banner-builtin.d.cts.map +1 -1
- package/dist/components/banner-builtin.d.mts +3 -4
- package/dist/components/banner-builtin.d.mts.map +1 -1
- package/dist/components/banner-builtin.mjs +90 -5
- package/dist/components/banner-builtin.mjs.map +1 -1
- package/dist/components/command-entry.cjs +358 -56
- 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.d.mts.map +1 -1
- package/dist/components/command-entry.mjs +355 -56
- package/dist/components/command-entry.mjs.map +1 -1
- package/dist/components/command-router.cjs +59 -4
- package/dist/components/command-router.d.cts +2 -3
- package/dist/components/command-router.d.cts.map +1 -1
- package/dist/components/command-router.d.mts +3 -4
- package/dist/components/command-router.d.mts.map +1 -1
- package/dist/components/command-router.mjs +57 -4
- package/dist/components/command-router.mjs.map +1 -1
- package/dist/components/index.cjs +15 -1
- package/dist/components/index.mjs +7 -1
- package/dist/components/upgrade-builtin.cjs +134 -14
- package/dist/components/upgrade-builtin.d.cts +2 -3
- package/dist/components/upgrade-builtin.d.cts.map +1 -1
- package/dist/components/upgrade-builtin.d.mts +2 -3
- package/dist/components/upgrade-builtin.d.mts.map +1 -1
- package/dist/components/upgrade-builtin.mjs +132 -14
- package/dist/components/upgrade-builtin.mjs.map +1 -1
- package/dist/components/virtual-command-entry.cjs +116 -1
- 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.d.mts.map +1 -1
- package/dist/components/virtual-command-entry.mjs +113 -1
- package/dist/components/virtual-command-entry.mjs.map +1 -1
- package/dist/helpers/get-global-options.cjs +37 -1
- package/dist/helpers/get-global-options.mjs +37 -1
- package/dist/helpers/get-global-options.mjs.map +1 -1
- package/dist/index.cjs +185 -1
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +175 -1
- package/dist/index.mjs.map +1 -1
- package/dist/types/index.mjs +1 -1
- package/dist/types/plugin.d.cts +11 -3
- package/dist/types/plugin.d.cts.map +1 -1
- package/dist/types/plugin.d.mts +12 -4
- package/dist/types/plugin.d.mts.map +1 -1
- package/dist/types/plugin.mjs +1 -1
- package/package.json +24 -23
|
@@ -1,15 +1,71 @@
|
|
|
1
|
-
import{createComponent
|
|
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({
|
|
2
37
|
message: "Checking for updates..."
|
|
3
|
-
}).start(); `
|
|
4
|
-
|
|
5
|
-
|
|
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 as CheckForUpdatesErrorResult).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: \${red(\`v\${(result as CheckForUpdatesSuccessResult).currentVersion}\`)} \${textColors.body.tertiary("➜")} \${green(\`v\${(result as CheckForUpdatesSuccessResult).latestVersion}\`)}\${(result as CheckForUpdatesSuccessResult).package?.date ? textColors.body.tertiary(\` (updated on \${(result as CheckForUpdatesSuccessResult).package?.date})\`) : ""}\`);
|
|
6
62
|
|
|
7
63
|
try {
|
|
8
64
|
await upgrade();
|
|
9
65
|
spinner.success("Update successful! Please restart the application to apply the update.");
|
|
10
66
|
|
|
11
67
|
writeLine("");
|
|
12
|
-
help(\`
|
|
68
|
+
help(\`The changelog for this release can be viewed by running the \${inlineCode("${getAppBin(context)} changelog")} command.\`);
|
|
13
69
|
|
|
14
70
|
writeLine("");
|
|
15
71
|
writeLine("Press any key to exit the application...");
|
|
@@ -17,10 +73,21 @@ import{createComponent as e,memo as t,mergeProps as n}from"@alloy-js/core/jsx-ru
|
|
|
17
73
|
await waitForKeyPress();
|
|
18
74
|
return;
|
|
19
75
|
} catch (err) {
|
|
20
|
-
spinner.error(\`An error occurred while updating ${
|
|
76
|
+
spinner.error(\`An error occurred while updating ${getAppTitle(context, true)} to v\${(result as CheckForUpdatesSuccessResult).latestVersion}. Please try again later - if the problem persists, please contact support.\`);
|
|
21
77
|
debug(err);
|
|
22
|
-
} `),
|
|
23
|
-
|
|
78
|
+
} `), createComponent(Spacing, {})];
|
|
79
|
+
},
|
|
80
|
+
get children() {
|
|
81
|
+
return [
|
|
82
|
+
memo(() => code`spinner.stop();
|
|
83
|
+
warn(\`A new version of ${getAppTitle(context, true)} is available: \${red(\`v\${(result as CheckForUpdatesSuccessResult).currentVersion}\`)} \${textColors.body.tertiary("➜")} \${green(\`v\${(result as CheckForUpdatesSuccessResult).latestVersion}\`)}\${(result as CheckForUpdatesSuccessResult).package.date ? textColors.body.tertiary(\` (updated on \${(result as CheckForUpdatesSuccessResult).package.date})\`) : ""}${context.config.upgradeType !== false && context.config.upgradeType === "manual" ? ` \\nPlease run \`${getAppBin(context)} upgrade\` to upgrade to the latest version.` : ""}\`); `),
|
|
84
|
+
createComponent(Spacing, {}),
|
|
85
|
+
createComponent(Show, {
|
|
86
|
+
get when() {
|
|
87
|
+
return context.config.upgradeType !== false && context.config.upgradeType === "confirm";
|
|
88
|
+
},
|
|
89
|
+
get children() {
|
|
90
|
+
return code`const willUpgradeNow = await confirm({
|
|
24
91
|
message: \`Would you like to update to v\${(result as CheckForUpdatesSuccessResult).latestVersion} now?\`,
|
|
25
92
|
initialValue: true
|
|
26
93
|
});
|
|
@@ -29,7 +96,7 @@ import{createComponent as e,memo as t,mergeProps as n}from"@alloy-js/core/jsx-ru
|
|
|
29
96
|
}
|
|
30
97
|
|
|
31
98
|
if (willUpgradeNow) {
|
|
32
|
-
spinner.text = \`Updating ${
|
|
99
|
+
spinner.text = \`Updating ${getAppTitle(context, true)} to v\${(result as CheckForUpdatesSuccessResult).latestVersion}...\`;
|
|
33
100
|
spinner.start();
|
|
34
101
|
|
|
35
102
|
try {
|
|
@@ -37,7 +104,7 @@ import{createComponent as e,memo as t,mergeProps as n}from"@alloy-js/core/jsx-ru
|
|
|
37
104
|
spinner.success("Update successful! Please restart the application to apply the update.");
|
|
38
105
|
|
|
39
106
|
writeLine("");
|
|
40
|
-
help(\`
|
|
107
|
+
help(\`The changelog for this release can be viewed by running the \${inlineCode("${getAppBin(context)} changelog")} command.\`);
|
|
41
108
|
|
|
42
109
|
writeLine("");
|
|
43
110
|
writeLine("Press any key to exit the application...");
|
|
@@ -45,12 +112,63 @@ import{createComponent as e,memo as t,mergeProps as n}from"@alloy-js/core/jsx-ru
|
|
|
45
112
|
await waitForKeyPress();
|
|
46
113
|
return;
|
|
47
114
|
} catch (err) {
|
|
48
|
-
spinner.error(\`An error occurred while updating ${
|
|
115
|
+
spinner.error(\`An error occurred while updating ${getAppTitle(context, true)} to v\${(result as CheckForUpdatesSuccessResult).latestVersion}. Please try again later - if the problem persists, please contact support.\`);
|
|
49
116
|
return { error: err };
|
|
50
117
|
}
|
|
51
118
|
} else {
|
|
52
|
-
help("Updates can be performed at any time by running the \`${
|
|
53
|
-
}
|
|
119
|
+
help("Updates can be performed at any time by running the \`${getAppBin(context)} upgrade\` command. Please remember that keeping your application up to date is important for ensuring you have the latest features, performance improvements, and security patches.");
|
|
120
|
+
} `;
|
|
121
|
+
}
|
|
122
|
+
})
|
|
123
|
+
];
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
}),
|
|
128
|
+
createComponent(ElseClause, { get children() {
|
|
129
|
+
return code`spinner.success("Currently running the latest version of ${getAppTitle(context, true)}.");
|
|
54
130
|
writeLine("");
|
|
55
|
-
|
|
131
|
+
`;
|
|
132
|
+
} })
|
|
133
|
+
];
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* A built-in upgrade module for Shell Shock.
|
|
143
|
+
*/
|
|
144
|
+
function UpgradeBuiltin(props) {
|
|
145
|
+
const [{ children, builtinImports }, rest] = splitProps(props, ["children", "builtinImports"]);
|
|
146
|
+
return createComponent(UpgradeBuiltin$1, mergeProps(rest, {
|
|
147
|
+
get builtinImports() {
|
|
148
|
+
return defu$1(builtinImports ?? {}, {
|
|
149
|
+
console: [
|
|
150
|
+
"createSpinner",
|
|
151
|
+
"debug",
|
|
152
|
+
"info"
|
|
153
|
+
],
|
|
154
|
+
prompts: ["waitForKeyPress"]
|
|
155
|
+
});
|
|
156
|
+
},
|
|
157
|
+
get children() {
|
|
158
|
+
return [
|
|
159
|
+
createComponent(ExecuteUpgradeFunctionDeclaration, {}),
|
|
160
|
+
createComponent(Spacing, {}),
|
|
161
|
+
createComponent(Show, {
|
|
162
|
+
get when() {
|
|
163
|
+
return Boolean(children);
|
|
164
|
+
},
|
|
165
|
+
children
|
|
166
|
+
})
|
|
167
|
+
];
|
|
168
|
+
}
|
|
169
|
+
}));
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
//#endregion
|
|
173
|
+
export { ExecuteUpgradeFunctionDeclaration, UpgradeBuiltin };
|
|
56
174
|
//# sourceMappingURL=upgrade-builtin.mjs.map
|
|
@@ -1 +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 as CheckForUpdatesErrorResult).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: \\${red(\\`v\\${(result as CheckForUpdatesSuccessResult).currentVersion}\\`)} \\${textColors.body.tertiary(\"➜\")} \\${green(\\`v\\${(result as CheckForUpdatesSuccessResult).latestVersion}\\`)}\\${(result as CheckForUpdatesSuccessResult).package?.date ? textColors.body.tertiary(\\` (updated on \\${(result as CheckForUpdatesSuccessResult).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 help(\\`You can view the changelog for this release at any time by running the \\${inlineCode(\"${getAppBin(\n context\n )} changelog --latest\")} command.\\`);\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 as CheckForUpdatesSuccessResult).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: \\${red(\\`v\\${(result as CheckForUpdatesSuccessResult).currentVersion}\\`)} \\${textColors.body.tertiary(\"➜\")} \\${green(\\`v\\${(result as CheckForUpdatesSuccessResult).latestVersion}\\`)}\\${(result as CheckForUpdatesSuccessResult).package.date ? textColors.body.tertiary(\\` (updated on \\${(result as CheckForUpdatesSuccessResult).package.date})\\`) : \"\"}${\n context.config.upgradeType !== false &&\n context.config.upgradeType === \"manual\"\n ? ` \\\\nPlease run \\`${getAppBin(\n context\n )} upgrade\\` 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 as CheckForUpdatesSuccessResult).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 as CheckForUpdatesSuccessResult).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 help(\\`You can view the changelog for this release at any time by running the \\${inlineCode(\"${getAppBin(\n context\n )} changelog --latest\")} command.\\`);\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 as CheckForUpdatesSuccessResult).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 )} upgrade\\` 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: [\"createSpinner\", \"debug\", \"info\"],\n prompts: [\"waitForKeyPress\"]\n })}>\n <ExecuteUpgradeFunctionDeclaration />\n <Spacing />\n <Show when={Boolean(children)}>{children}</Show>\n </BaseUpgradeBuiltin>\n );\n}\n"],"mappings":"mnBA6BA,SAAc,GAAmC,CACjD,IAAQ,EAAC,GAAkB,CAC3B,OAAS,EAAkB,EAAA,CAC3B,IAAO,MAAO,mCAGV,IAAC,UAAa,CAChB,OAAA,EAAA,EAAA,CACK,OAAS,GACR,MAAO,yBAEP,IAAC,KAAA,CACC,MAAM,kCAA+B,EAAM,EAAA,GAAA,CAAA,gBAE7C,IAAA,UAAA,CACA,OAAA,EAAA,EAAA,CACI,UAAE,CAAA,oCACF,IAAE,UAAY,CAChB,MAAO,CAAA,EAAA,EAAA,CACP,MAAA,GACC,KAAW,UACb,YAAY,CAAW;;4BAGpB,CAAI,CAAE,EAAO,EAAA,CACb,MAAa,GACT,KAAA,SACA,YAAW,CAAA,2CAChB,CAAA,CAAA,EAAA,EAAA,CACA,UAAA,CAAA,kDACC,IAAA,UAAA,CACM,MAAM,EAAA,wDAAA,EAAA,EAAA,GAAA,CAAA;sEAGb,CAAA,CAAA,EAAA,EAAA,CACC,UAAe,CAAE,wDAChB,IAAK,UAAa,CACjB,OAAO,EAAA,EAAA,CACP,IAAA,MAAA,CACC,OAAY,EAAS,OAAO,cAAiB,KAAQ,EAAQ,OAAS,cAAgB,WAAW,EAAA,OAAA,cAAA,WAEpG,IAAW,UAAA,CACZ,MAAA,CAAA,MAAA,CAAA;8CAC6B,EAAA,EAAA,GAA+B,CAAA;;;;;;;qHAOhD,EAAA,EAAA,CAAA;;;;;;;;yEAQC,EAAA,EAAA,GAAA,CAAA;;wBAEF,CAAA,EAAiB,EAAO,EAAA,CAAU,CAAC,EAErC,IAAE,UAAa,CACb,MAAO,CAAA,MAAa,CAAI;0CACtB,EAAA,EAAA,GAAA,CAAA,6WAAA,EAAA,OAAA,cAAA,IAAA,EAAA,OAAA,cAAA,SAAA,oBAAA,EAAA,EAAA,CAAA,8CAAA,GAAA,OAAA,CAAA,EAAA,EAAA,EAAA,CAAA,CAAA,EAAA,EAAA,CACA,IAAC,MAAU,qEAGb,IAAA,UAAiB;;;;;;;;;8CAUhB,EAAA,EAAA,GAAA,CAAA;;;;;;;;mHAQuF,EAAe,EAAC,CAAQ;;;;;;;;uEAQ9G,EAAA,EAAA,GAAA,CAAA;;;;gFAIiC,EAAA,EAAA,CAAA;qBAGvC,CAAA,CAAO,EAEP,CAAA,EAEH,CAAC,CAAE,EAAM,EAAA,CACR,IAAA,UAAA;;eAKD,CAAC,CAAC,EAEN,CAAC,EAEL,CAAC,EAEL,CAAC,eAOF,GAAM,CAAC,CACL,WAAA,kBAEC,GAAQ,EAAO,EAAM,CAAA,WAAiB,iBAAA,CAAA,CACzC,OAAO,EAAiB,EAAA,EAAA,EAAA,CACtB,IAAI,gBAAiB,CACnB,OAAO,EAAK,GAAkB,EAAE,CAAC,CAC/B,QAAS,CAAC,gBAAW,QAAA,OAAA,CACrB,QAAS,CAAC,kBAAI,CACf,CAAC,EAEJ,IAAI,UAAU,CACZ,MAAO,CAAC,EAAS,EAAA,EAAA,CAAA,CAAA,EAAA,EAAA,EAAA,CAAA,CAAA,EAAA,EAAA,CACf,IAAI,MAAM,CACR,MAAO,EAAG,GAEF,WACX,CAAC,CAAC,EAEN,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"upgrade-builtin.mjs","names":[],"sources":[],"mappings":""}
|
|
@@ -1 +1,116 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
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 _powerlines_plugin_alloy_core_components = require("@powerlines/plugin-alloy/core/components");
|
|
8
|
+
let _shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
|
|
9
|
+
let _stryke_path_join = require("@stryke/path/join");
|
|
10
|
+
let _powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
11
|
+
let _stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
|
|
12
|
+
let defu = require("defu");
|
|
13
|
+
defu = require_runtime.__toESM(defu);
|
|
14
|
+
let _powerlines_plugin_alloy_typescript_components_typescript_file = require("@powerlines/plugin-alloy/typescript/components/typescript-file");
|
|
15
|
+
let _shell_shock_preset_script_components_virtual_command_entry = require("@shell-shock/preset-script/components/virtual-command-entry");
|
|
16
|
+
|
|
17
|
+
//#region src/components/virtual-command-entry.tsx
|
|
18
|
+
/**
|
|
19
|
+
* The virtual command entry point for the Shell Shock project.
|
|
20
|
+
*/
|
|
21
|
+
function VirtualCommandEntry(props) {
|
|
22
|
+
const { command, imports, builtinImports, ...rest } = props;
|
|
23
|
+
const context = (0, _powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
24
|
+
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"));
|
|
25
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_typescript_components_typescript_file.TypescriptFile, (0, _alloy_js_core_jsx_runtime.mergeProps)(rest, {
|
|
26
|
+
get path() {
|
|
27
|
+
return filePath.value;
|
|
28
|
+
},
|
|
29
|
+
get imports() {
|
|
30
|
+
return (0, defu.default)(imports ?? {}, Object.entries(command.children).filter(([, child]) => child.virtual).reduce((ret, [name, child]) => {
|
|
31
|
+
ret[`./${child.name}`] = [{
|
|
32
|
+
name: "handler",
|
|
33
|
+
alias: `handle${(0, _stryke_string_format_pascal_case.pascalCase)(name)}`
|
|
34
|
+
}];
|
|
35
|
+
return ret;
|
|
36
|
+
}, {}));
|
|
37
|
+
},
|
|
38
|
+
get builtinImports() {
|
|
39
|
+
return (0, defu.default)(builtinImports ?? {}, {
|
|
40
|
+
env: ["isDevelopment", "isDebug"],
|
|
41
|
+
console: [
|
|
42
|
+
"warn",
|
|
43
|
+
"error",
|
|
44
|
+
"info",
|
|
45
|
+
"help",
|
|
46
|
+
"table",
|
|
47
|
+
"writeLine",
|
|
48
|
+
"splitText",
|
|
49
|
+
"textColors",
|
|
50
|
+
"stripAnsi"
|
|
51
|
+
],
|
|
52
|
+
utils: [
|
|
53
|
+
"isMinimal",
|
|
54
|
+
"isUnicodeSupported",
|
|
55
|
+
"isInteractive",
|
|
56
|
+
"findSuggestions",
|
|
57
|
+
"sleep"
|
|
58
|
+
],
|
|
59
|
+
state: [
|
|
60
|
+
{
|
|
61
|
+
name: "GlobalOptions",
|
|
62
|
+
type: true
|
|
63
|
+
},
|
|
64
|
+
"useGlobal",
|
|
65
|
+
"useGlobalOptions",
|
|
66
|
+
"withCommand",
|
|
67
|
+
"useArgs",
|
|
68
|
+
"hasFlag",
|
|
69
|
+
"isHelp"
|
|
70
|
+
],
|
|
71
|
+
prompts: [
|
|
72
|
+
"text",
|
|
73
|
+
"numeric",
|
|
74
|
+
"toggle",
|
|
75
|
+
"select",
|
|
76
|
+
"isCancel"
|
|
77
|
+
],
|
|
78
|
+
[(0, _stryke_path_join.joinPaths)("help", ...command.segments.filter((segment) => !(0, _shell_shock_core_plugin_utils.isDynamicPathSegment)(segment)))]: ["showHelp"],
|
|
79
|
+
[(0, _stryke_path_join.joinPaths)("banner", ...command.segments.filter((segment) => !(0, _shell_shock_core_plugin_utils.isDynamicPathSegment)(segment)))]: ["showBanner"]
|
|
80
|
+
});
|
|
81
|
+
},
|
|
82
|
+
get children() {
|
|
83
|
+
return [(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components.Spacing, {}), (0, _alloy_js_core_jsx_runtime.createComponent)(_shell_shock_preset_script_components_virtual_command_entry.VirtualCommandHandlerDeclaration, {
|
|
84
|
+
command,
|
|
85
|
+
get children() {
|
|
86
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_command_router.CommandRouter, {
|
|
87
|
+
get segments() {
|
|
88
|
+
return command.segments;
|
|
89
|
+
},
|
|
90
|
+
get commands() {
|
|
91
|
+
return command.children;
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
})];
|
|
96
|
+
}
|
|
97
|
+
})), (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core.For, {
|
|
98
|
+
get each() {
|
|
99
|
+
return Object.values(command.children);
|
|
100
|
+
},
|
|
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)(VirtualCommandEntry, { command: child });
|
|
110
|
+
}
|
|
111
|
+
})
|
|
112
|
+
})];
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
//#endregion
|
|
116
|
+
exports.VirtualCommandEntry = VirtualCommandEntry;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as _$_alloy_js_core0 from "@alloy-js/core";
|
|
2
1
|
import { CommandTree } from "@shell-shock/core";
|
|
3
2
|
import { EntryFileProps } from "@powerlines/plugin-alloy/typescript/components/entry-file";
|
|
4
3
|
|
|
@@ -9,7 +8,7 @@ interface VirtualCommandEntryProps extends Omit<EntryFileProps, "path" | "typeDe
|
|
|
9
8
|
/**
|
|
10
9
|
* The virtual command entry point for the Shell Shock project.
|
|
11
10
|
*/
|
|
12
|
-
declare function VirtualCommandEntry(props: VirtualCommandEntryProps):
|
|
11
|
+
declare function VirtualCommandEntry(props: VirtualCommandEntryProps): import("@alloy-js/core").Children;
|
|
13
12
|
//#endregion
|
|
14
13
|
export { VirtualCommandEntry, VirtualCommandEntryProps };
|
|
15
14
|
//# sourceMappingURL=virtual-command-entry.d.cts.map
|
|
@@ -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":";;;;UAkCiB,wBAAA,SAAiC,IAAA,CAChD,cAAA;EAGA,OAAA,EAAS,WAAA;AAAA;;;;iBAMK,mBAAA,CAAoB,KAAA,EAAO,wBAAwB,4BAAA,QAAA"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as _$_alloy_js_core0 from "@alloy-js/core";
|
|
2
1
|
import { EntryFileProps } from "@powerlines/plugin-alloy/typescript/components/entry-file";
|
|
3
2
|
import { CommandTree } from "@shell-shock/core";
|
|
4
3
|
|
|
@@ -9,7 +8,7 @@ interface VirtualCommandEntryProps extends Omit<EntryFileProps, "path" | "typeDe
|
|
|
9
8
|
/**
|
|
10
9
|
* The virtual command entry point for the Shell Shock project.
|
|
11
10
|
*/
|
|
12
|
-
declare function VirtualCommandEntry(props: VirtualCommandEntryProps):
|
|
11
|
+
declare function VirtualCommandEntry(props: VirtualCommandEntryProps): import("@alloy-js/core").Children;
|
|
13
12
|
//#endregion
|
|
14
13
|
export { VirtualCommandEntry, VirtualCommandEntryProps };
|
|
15
14
|
//# 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"],"mappings":"
|
|
1
|
+
{"version":3,"file":"virtual-command-entry.d.mts","names":[],"sources":["../../src/components/virtual-command-entry.tsx"],"mappings":""}
|
|
@@ -1,2 +1,114 @@
|
|
|
1
|
-
import{CommandRouter
|
|
1
|
+
import { CommandRouter } from "./command-router.mjs";
|
|
2
|
+
import { CommandEntry } from "./command-entry.mjs";
|
|
3
|
+
import { createComponent, mergeProps } from "@alloy-js/core/jsx-runtime";
|
|
4
|
+
import { For, Show, computed } from "@alloy-js/core";
|
|
5
|
+
import { Spacing } from "@powerlines/plugin-alloy/core/components";
|
|
6
|
+
import { isDynamicPathSegment } from "@shell-shock/core/plugin-utils";
|
|
7
|
+
import { joinPaths } from "@stryke/path/join";
|
|
8
|
+
import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
|
|
9
|
+
import { pascalCase } from "@stryke/string-format/pascal-case";
|
|
10
|
+
import defu from "defu";
|
|
11
|
+
import { TypescriptFile } from "@powerlines/plugin-alloy/typescript/components/typescript-file";
|
|
12
|
+
import { VirtualCommandHandlerDeclaration } from "@shell-shock/preset-script/components/virtual-command-entry";
|
|
13
|
+
|
|
14
|
+
//#region src/components/virtual-command-entry.tsx
|
|
15
|
+
/**
|
|
16
|
+
* The virtual command entry point for the Shell Shock project.
|
|
17
|
+
*/
|
|
18
|
+
function VirtualCommandEntry(props) {
|
|
19
|
+
const { command, imports, builtinImports, ...rest } = props;
|
|
20
|
+
const context = usePowerlines();
|
|
21
|
+
const filePath = computed(() => joinPaths(context.entryPath, command.segments.filter((segment) => !isDynamicPathSegment(segment)).join("/"), "index.ts"));
|
|
22
|
+
return [createComponent(TypescriptFile, mergeProps(rest, {
|
|
23
|
+
get path() {
|
|
24
|
+
return filePath.value;
|
|
25
|
+
},
|
|
26
|
+
get imports() {
|
|
27
|
+
return defu(imports ?? {}, Object.entries(command.children).filter(([, child]) => child.virtual).reduce((ret, [name, child]) => {
|
|
28
|
+
ret[`./${child.name}`] = [{
|
|
29
|
+
name: "handler",
|
|
30
|
+
alias: `handle${pascalCase(name)}`
|
|
31
|
+
}];
|
|
32
|
+
return ret;
|
|
33
|
+
}, {}));
|
|
34
|
+
},
|
|
35
|
+
get builtinImports() {
|
|
36
|
+
return defu(builtinImports ?? {}, {
|
|
37
|
+
env: ["isDevelopment", "isDebug"],
|
|
38
|
+
console: [
|
|
39
|
+
"warn",
|
|
40
|
+
"error",
|
|
41
|
+
"info",
|
|
42
|
+
"help",
|
|
43
|
+
"table",
|
|
44
|
+
"writeLine",
|
|
45
|
+
"splitText",
|
|
46
|
+
"textColors",
|
|
47
|
+
"stripAnsi"
|
|
48
|
+
],
|
|
49
|
+
utils: [
|
|
50
|
+
"isMinimal",
|
|
51
|
+
"isUnicodeSupported",
|
|
52
|
+
"isInteractive",
|
|
53
|
+
"findSuggestions",
|
|
54
|
+
"sleep"
|
|
55
|
+
],
|
|
56
|
+
state: [
|
|
57
|
+
{
|
|
58
|
+
name: "GlobalOptions",
|
|
59
|
+
type: true
|
|
60
|
+
},
|
|
61
|
+
"useGlobal",
|
|
62
|
+
"useGlobalOptions",
|
|
63
|
+
"withCommand",
|
|
64
|
+
"useArgs",
|
|
65
|
+
"hasFlag",
|
|
66
|
+
"isHelp"
|
|
67
|
+
],
|
|
68
|
+
prompts: [
|
|
69
|
+
"text",
|
|
70
|
+
"numeric",
|
|
71
|
+
"toggle",
|
|
72
|
+
"select",
|
|
73
|
+
"isCancel"
|
|
74
|
+
],
|
|
75
|
+
[joinPaths("help", ...command.segments.filter((segment) => !isDynamicPathSegment(segment)))]: ["showHelp"],
|
|
76
|
+
[joinPaths("banner", ...command.segments.filter((segment) => !isDynamicPathSegment(segment)))]: ["showBanner"]
|
|
77
|
+
});
|
|
78
|
+
},
|
|
79
|
+
get children() {
|
|
80
|
+
return [createComponent(Spacing, {}), createComponent(VirtualCommandHandlerDeclaration, {
|
|
81
|
+
command,
|
|
82
|
+
get children() {
|
|
83
|
+
return createComponent(CommandRouter, {
|
|
84
|
+
get segments() {
|
|
85
|
+
return command.segments;
|
|
86
|
+
},
|
|
87
|
+
get commands() {
|
|
88
|
+
return command.children;
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
})];
|
|
93
|
+
}
|
|
94
|
+
})), createComponent(For, {
|
|
95
|
+
get each() {
|
|
96
|
+
return Object.values(command.children);
|
|
97
|
+
},
|
|
98
|
+
children: (child) => createComponent(Show, {
|
|
99
|
+
get when() {
|
|
100
|
+
return child.virtual;
|
|
101
|
+
},
|
|
102
|
+
get fallback() {
|
|
103
|
+
return createComponent(CommandEntry, { command: child });
|
|
104
|
+
},
|
|
105
|
+
get children() {
|
|
106
|
+
return createComponent(VirtualCommandEntry, { command: child });
|
|
107
|
+
}
|
|
108
|
+
})
|
|
109
|
+
})];
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
//#endregion
|
|
113
|
+
export { VirtualCommandEntry };
|
|
2
114
|
//# 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,37 @@
|
|
|
1
|
-
|
|
1
|
+
let _shell_shock_preset_script_helpers_get_global_options = require("@shell-shock/preset-script/helpers/get-global-options");
|
|
2
|
+
|
|
3
|
+
//#region src/helpers/get-global-options.ts
|
|
4
|
+
/**
|
|
5
|
+
* Get the default command options.
|
|
6
|
+
*
|
|
7
|
+
* @param context - The build context.
|
|
8
|
+
* @param _ - The command input.
|
|
9
|
+
* @returns The default command options.
|
|
10
|
+
*/
|
|
11
|
+
function getGlobalOptions(context, _) {
|
|
12
|
+
return [
|
|
13
|
+
...(0, _shell_shock_preset_script_helpers_get_global_options.getGlobalOptions)(),
|
|
14
|
+
context.config.interactive !== "never" && context.config.interactive !== true && {
|
|
15
|
+
name: "interactive",
|
|
16
|
+
title: "Interactive",
|
|
17
|
+
description: "Enable interactive mode - will be set to false if running in a CI pipeline.",
|
|
18
|
+
alias: ["i", "interact"],
|
|
19
|
+
type: "boolean",
|
|
20
|
+
required: false,
|
|
21
|
+
default: context.config.interactive !== false
|
|
22
|
+
},
|
|
23
|
+
context.config.interactive !== "never" && context.config.interactive !== false && {
|
|
24
|
+
name: "non-interactive",
|
|
25
|
+
title: "Non-Interactive",
|
|
26
|
+
description: "Disable interactive mode - will be set to true if running in a CI pipeline.",
|
|
27
|
+
alias: ["no-interactive"],
|
|
28
|
+
type: "boolean",
|
|
29
|
+
required: false,
|
|
30
|
+
default: false,
|
|
31
|
+
isNegativeOf: "interactive"
|
|
32
|
+
}
|
|
33
|
+
].filter(Boolean);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
//#endregion
|
|
37
|
+
exports.getGlobalOptions = getGlobalOptions;
|
|
@@ -1,2 +1,38 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import { getGlobalOptions } from "@shell-shock/preset-script/helpers/get-global-options";
|
|
2
|
+
|
|
3
|
+
//#region src/helpers/get-global-options.ts
|
|
4
|
+
/**
|
|
5
|
+
* Get the default command options.
|
|
6
|
+
*
|
|
7
|
+
* @param context - The build context.
|
|
8
|
+
* @param _ - The command input.
|
|
9
|
+
* @returns The default command options.
|
|
10
|
+
*/
|
|
11
|
+
function getGlobalOptions$1(context, _) {
|
|
12
|
+
return [
|
|
13
|
+
...getGlobalOptions(),
|
|
14
|
+
context.config.interactive !== "never" && context.config.interactive !== true && {
|
|
15
|
+
name: "interactive",
|
|
16
|
+
title: "Interactive",
|
|
17
|
+
description: "Enable interactive mode - will be set to false if running in a CI pipeline.",
|
|
18
|
+
alias: ["i", "interact"],
|
|
19
|
+
type: "boolean",
|
|
20
|
+
required: false,
|
|
21
|
+
default: context.config.interactive !== false
|
|
22
|
+
},
|
|
23
|
+
context.config.interactive !== "never" && context.config.interactive !== false && {
|
|
24
|
+
name: "non-interactive",
|
|
25
|
+
title: "Non-Interactive",
|
|
26
|
+
description: "Disable interactive mode - will be set to true if running in a CI pipeline.",
|
|
27
|
+
alias: ["no-interactive"],
|
|
28
|
+
type: "boolean",
|
|
29
|
+
required: false,
|
|
30
|
+
default: false,
|
|
31
|
+
isNegativeOf: "interactive"
|
|
32
|
+
}
|
|
33
|
+
].filter(Boolean);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
//#endregion
|
|
37
|
+
export { getGlobalOptions$1 as getGlobalOptions };
|
|
2
38
|
//# 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":""}
|