@shell-shock/preset-cli 0.0.2 → 0.0.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/README.md +1 -1
- package/dist/components/banner.cjs +64 -0
- package/dist/components/banner.d.cts +47 -0
- package/dist/components/banner.d.cts.map +1 -0
- package/dist/components/banner.d.mts +47 -0
- package/dist/components/banner.d.mts.map +1 -0
- package/dist/components/banner.mjs +64 -0
- package/dist/components/banner.mjs.map +1 -0
- package/dist/components/index.cjs +3 -0
- package/dist/components/index.d.cts +2 -0
- package/dist/components/index.d.mts +2 -0
- package/dist/components/index.mjs +3 -0
- package/dist/helpers/get-default-options.cjs +3 -3
- package/dist/helpers/get-default-options.mjs +5 -4
- package/dist/helpers/get-default-options.mjs.map +1 -0
- package/dist/index.cjs +61 -7
- package/dist/index.d.cts +2 -1
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +2 -1
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +63 -8
- package/dist/index.mjs.map +1 -0
- package/dist/types/plugin.d.cts +7 -1
- package/dist/types/plugin.d.cts.map +1 -0
- package/dist/types/plugin.d.mts +7 -1
- package/dist/types/plugin.d.mts.map +1 -0
- package/package.json +73 -90
- package/dist/components/builtin/console.cjs +0 -77
- package/dist/components/builtin/console.d.cts +0 -16
- package/dist/components/builtin/console.d.mts +0 -16
- package/dist/components/builtin/console.mjs +0 -75
- package/dist/components/builtin/index.cjs +0 -4
- package/dist/components/builtin/index.d.cts +0 -2
- package/dist/components/builtin/index.d.mts +0 -2
- package/dist/components/builtin/index.mjs +0 -3
package/README.md
CHANGED
|
@@ -27,7 +27,7 @@ This package is part of the ⚡<b>Shell Shock</b> monorepo. The Shell Shock pack
|
|
|
27
27
|
|
|
28
28
|
<h3 align="center">💻 Visit <a href="https://stormsoftware.com" target="_blank">stormsoftware.com</a> to stay up to date with this developer</h3><br />
|
|
29
29
|
|
|
30
|
-
[](https://stormsoftware.com/projects/shell-shock/) [](http://commitizen.github.io/cz-cli/)  
|
|
31
31
|
|
|
32
32
|
<!-- prettier-ignore-start -->
|
|
33
33
|
<!-- markdownlint-disable -->
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
3
|
+
let __alloy_js_core = require("@alloy-js/core");
|
|
4
|
+
let __alloy_js_typescript = require("@alloy-js/typescript");
|
|
5
|
+
let __powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
|
|
6
|
+
let __powerlines_plugin_alloy_typescript_components_tsdoc = require("@powerlines/plugin-alloy/typescript/components/tsdoc");
|
|
7
|
+
let __shell_shock_preset_script_contexts_theme = require("@shell-shock/preset-script/contexts/theme");
|
|
8
|
+
let __stryke_string_format_title_case = require("@stryke/string-format/title-case");
|
|
9
|
+
let cfonts = require("cfonts");
|
|
10
|
+
|
|
11
|
+
//#region src/components/banner.tsx
|
|
12
|
+
/**
|
|
13
|
+
* The `banner` handler function declaration code for the Shell Shock project.
|
|
14
|
+
*/
|
|
15
|
+
function BannerFunctionDeclaration(props) {
|
|
16
|
+
const { title: propTitle, description: propDescription } = props;
|
|
17
|
+
const context = (0, __powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
|
|
18
|
+
const theme = (0, __shell_shock_preset_script_contexts_theme.useTheme)();
|
|
19
|
+
const title = propTitle || (0, __stryke_string_format_title_case.titleCase)(context.config.title);
|
|
20
|
+
const description = propDescription || context.config.description;
|
|
21
|
+
const renderedTitle = (0, cfonts.render)(title, {
|
|
22
|
+
font: "tiny",
|
|
23
|
+
align: "left",
|
|
24
|
+
colors: ["system"],
|
|
25
|
+
background: "transparent",
|
|
26
|
+
letterSpacing: 1,
|
|
27
|
+
lineHeight: 1,
|
|
28
|
+
gradient: false,
|
|
29
|
+
transitionGradient: false,
|
|
30
|
+
env: "node"
|
|
31
|
+
});
|
|
32
|
+
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
33
|
+
heading: `Write the application banner display to the console.`,
|
|
34
|
+
get children() {
|
|
35
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `This function should be run at the start of an application and should identify the current application/command to the user.` });
|
|
36
|
+
}
|
|
37
|
+
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.FunctionDeclaration, {
|
|
38
|
+
name: "banner",
|
|
39
|
+
get children() {
|
|
40
|
+
return __alloy_js_core.code`
|
|
41
|
+
writeLine(colors.border.banner.outline.primary("${theme.borderStyles.banner.outline.primary.topLeft}") + colors.border.banner.outline.primary("${theme.borderStyles.banner.outline.primary.top}".repeat(Math.max(process.stdout.columns - ${(Math.max(theme.padding.app, 0) + Math.max(theme.padding.banner, 0)) * 2 + theme.borderStyles.banner.outline.primary.topLeft.length + theme.borderStyles.banner.outline.primary.topRight.length}, 0) / ${theme.borderStyles.banner.outline.primary.top.length ?? 1})) + colors.border.banner.outline.primary("${theme.borderStyles.banner.outline.primary.topRight}"), { consoleFn: console.info });
|
|
42
|
+
|
|
43
|
+
${renderedTitle ? renderedTitle.array.map((line) => `writeLine(colors.border.banner.outline.primary("${theme.borderStyles.banner.outline.primary.left}") +
|
|
44
|
+
" ".repeat(Math.max(theme.padding.banner, 0)) +
|
|
45
|
+
colors.text.banner.title("${line}") +
|
|
46
|
+
" ".repeat(Math.max(theme.padding.banner, 0)) +
|
|
47
|
+
colors.border.banner.outline.primary("${theme.borderStyles.banner.outline.primary.right}"), { consoleFn: console.info });`).join(`\n`) : ""}
|
|
48
|
+
|
|
49
|
+
splitText(
|
|
50
|
+
${description ? __alloy_js_core.code`"${description.replace(/"/g, "\\\"")}"` : "''"},
|
|
51
|
+
Math.max(process.stdout.columns - ${(Math.max(theme.padding.app, 0) + Math.max(theme.padding.banner, 0)) * 2 + theme.borderStyles.banner.outline.primary.left.length + theme.borderStyles.banner.outline.primary.right.length}, 0)
|
|
52
|
+
).forEach((line) => {
|
|
53
|
+
writeLine(colors.border.banner.outline.primary("${theme.borderStyles.banner.outline.primary.left + " ".repeat(Math.max(theme.padding.banner, 0))}") + colors.text.banner.description(line) + colors.border.banner.outline.primary("${" ".repeat(Math.max(theme.padding.banner, 0)) + theme.borderStyles.banner.outline.primary.right}"), { consoleFn: console.info });
|
|
54
|
+
});
|
|
55
|
+
writeLine(colors.border.banner.outline.primary("${theme.borderStyles.banner.outline.primary.bottomLeft}") + colors.border.banner.outline.primary("$"{
|
|
56
|
+
theme.borderStyles.banner.outline.primary.bottom
|
|
57
|
+
}".repeat(Math.max(process.stdout.columns - ${(Math.max(theme.padding.app, 0) + Math.max(theme.padding.banner, 0)) * 2 + theme.borderStyles.banner.outline.primary.bottomLeft.length + theme.borderStyles.banner.outline.primary.bottomRight.length}, 0) / ${theme.borderStyles.banner.outline.primary.bottom.length ?? 1})) + colors.border.banner.outline.primary("${theme.borderStyles.banner.outline.primary.bottomRight}"), { consoleFn: console.info });
|
|
58
|
+
`;
|
|
59
|
+
}
|
|
60
|
+
})];
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
//#endregion
|
|
64
|
+
exports.BannerFunctionDeclaration = BannerFunctionDeclaration;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
2
|
+
|
|
3
|
+
//#region src/components/banner.d.ts
|
|
4
|
+
interface BannerFunctionDeclarationProps {
|
|
5
|
+
/**
|
|
6
|
+
* The title to display in the banner.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* If not provided, the application title from the configuration will be used.
|
|
10
|
+
*/
|
|
11
|
+
title?: string;
|
|
12
|
+
/**
|
|
13
|
+
* The sub-title text to display in the banner.
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* This will be displayed in small text below the title.
|
|
17
|
+
*/
|
|
18
|
+
subTitle?: string;
|
|
19
|
+
/**
|
|
20
|
+
* The description of the command/application to display in the banner.
|
|
21
|
+
*
|
|
22
|
+
* @remarks
|
|
23
|
+
* This text will be displayed in small text below the title.
|
|
24
|
+
*/
|
|
25
|
+
description?: string;
|
|
26
|
+
/**
|
|
27
|
+
* An optional header to display above the banner. If not provided, the application's name and version will be displayed. If set to `false`, no header will be displayed.
|
|
28
|
+
*
|
|
29
|
+
* @remarks
|
|
30
|
+
* This can be used to provide additional context or information before the banner. It will be displayed in the border surrounding the banner.
|
|
31
|
+
*/
|
|
32
|
+
header?: string | false;
|
|
33
|
+
/**
|
|
34
|
+
* An optional footer to display below the banner. If not provided, the organization name or workspace name will be used. If set to `false`, no footer will be displayed.
|
|
35
|
+
*
|
|
36
|
+
* @remarks
|
|
37
|
+
* This can be used to provide additional context or information after the banner. It will be displayed in the border surrounding the banner.
|
|
38
|
+
*/
|
|
39
|
+
footer?: string | false;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The `banner` handler function declaration code for the Shell Shock project.
|
|
43
|
+
*/
|
|
44
|
+
declare function BannerFunctionDeclaration(props: BannerFunctionDeclarationProps): _alloy_js_core0.Children;
|
|
45
|
+
//#endregion
|
|
46
|
+
export { BannerFunctionDeclaration, BannerFunctionDeclarationProps };
|
|
47
|
+
//# sourceMappingURL=banner.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"banner.d.cts","names":[],"sources":["../../src/components/banner.tsx"],"sourcesContent":[],"mappings":";;;UAkCiB,8BAAA;;;AAAjB;AA6CA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAgB,yBAAA,QACP,iCAA8B,eAAA,CAAA"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
2
|
+
|
|
3
|
+
//#region src/components/banner.d.ts
|
|
4
|
+
interface BannerFunctionDeclarationProps {
|
|
5
|
+
/**
|
|
6
|
+
* The title to display in the banner.
|
|
7
|
+
*
|
|
8
|
+
* @remarks
|
|
9
|
+
* If not provided, the application title from the configuration will be used.
|
|
10
|
+
*/
|
|
11
|
+
title?: string;
|
|
12
|
+
/**
|
|
13
|
+
* The sub-title text to display in the banner.
|
|
14
|
+
*
|
|
15
|
+
* @remarks
|
|
16
|
+
* This will be displayed in small text below the title.
|
|
17
|
+
*/
|
|
18
|
+
subTitle?: string;
|
|
19
|
+
/**
|
|
20
|
+
* The description of the command/application to display in the banner.
|
|
21
|
+
*
|
|
22
|
+
* @remarks
|
|
23
|
+
* This text will be displayed in small text below the title.
|
|
24
|
+
*/
|
|
25
|
+
description?: string;
|
|
26
|
+
/**
|
|
27
|
+
* An optional header to display above the banner. If not provided, the application's name and version will be displayed. If set to `false`, no header will be displayed.
|
|
28
|
+
*
|
|
29
|
+
* @remarks
|
|
30
|
+
* This can be used to provide additional context or information before the banner. It will be displayed in the border surrounding the banner.
|
|
31
|
+
*/
|
|
32
|
+
header?: string | false;
|
|
33
|
+
/**
|
|
34
|
+
* An optional footer to display below the banner. If not provided, the organization name or workspace name will be used. If set to `false`, no footer will be displayed.
|
|
35
|
+
*
|
|
36
|
+
* @remarks
|
|
37
|
+
* This can be used to provide additional context or information after the banner. It will be displayed in the border surrounding the banner.
|
|
38
|
+
*/
|
|
39
|
+
footer?: string | false;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The `banner` handler function declaration code for the Shell Shock project.
|
|
43
|
+
*/
|
|
44
|
+
declare function BannerFunctionDeclaration(props: BannerFunctionDeclarationProps): _alloy_js_core0.Children;
|
|
45
|
+
//#endregion
|
|
46
|
+
export { BannerFunctionDeclaration, BannerFunctionDeclarationProps };
|
|
47
|
+
//# sourceMappingURL=banner.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"banner.d.mts","names":[],"sources":["../../src/components/banner.tsx"],"sourcesContent":[],"mappings":";;;UAkCiB,8BAAA;;;AAAjB;AA6CA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAgB,yBAAA,QACP,iCAA8B,eAAA,CAAA"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { createComponent, memo } from "@alloy-js/core/jsx-runtime";
|
|
2
|
+
import { code } from "@alloy-js/core";
|
|
3
|
+
import { FunctionDeclaration } from "@alloy-js/typescript";
|
|
4
|
+
import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
|
|
5
|
+
import { TSDoc, TSDocRemarks } from "@powerlines/plugin-alloy/typescript/components/tsdoc";
|
|
6
|
+
import { useTheme } from "@shell-shock/preset-script/contexts/theme";
|
|
7
|
+
import { titleCase } from "@stryke/string-format/title-case";
|
|
8
|
+
import { render } from "cfonts";
|
|
9
|
+
|
|
10
|
+
//#region src/components/banner.tsx
|
|
11
|
+
/**
|
|
12
|
+
* The `banner` handler function declaration code for the Shell Shock project.
|
|
13
|
+
*/
|
|
14
|
+
function BannerFunctionDeclaration(props) {
|
|
15
|
+
const { title: propTitle, description: propDescription } = props;
|
|
16
|
+
const context = usePowerlines();
|
|
17
|
+
const theme = useTheme();
|
|
18
|
+
const title = propTitle || titleCase(context.config.title);
|
|
19
|
+
const description = propDescription || context.config.description;
|
|
20
|
+
const renderedTitle = render(title, {
|
|
21
|
+
font: "tiny",
|
|
22
|
+
align: "left",
|
|
23
|
+
colors: ["system"],
|
|
24
|
+
background: "transparent",
|
|
25
|
+
letterSpacing: 1,
|
|
26
|
+
lineHeight: 1,
|
|
27
|
+
gradient: false,
|
|
28
|
+
transitionGradient: false,
|
|
29
|
+
env: "node"
|
|
30
|
+
});
|
|
31
|
+
return [createComponent(TSDoc, {
|
|
32
|
+
heading: `Write the application banner display to the console.`,
|
|
33
|
+
get children() {
|
|
34
|
+
return createComponent(TSDocRemarks, { children: `This function should be run at the start of an application and should identify the current application/command to the user.` });
|
|
35
|
+
}
|
|
36
|
+
}), createComponent(FunctionDeclaration, {
|
|
37
|
+
name: "banner",
|
|
38
|
+
get children() {
|
|
39
|
+
return code`
|
|
40
|
+
writeLine(colors.border.banner.outline.primary("${theme.borderStyles.banner.outline.primary.topLeft}") + colors.border.banner.outline.primary("${theme.borderStyles.banner.outline.primary.top}".repeat(Math.max(process.stdout.columns - ${(Math.max(theme.padding.app, 0) + Math.max(theme.padding.banner, 0)) * 2 + theme.borderStyles.banner.outline.primary.topLeft.length + theme.borderStyles.banner.outline.primary.topRight.length}, 0) / ${theme.borderStyles.banner.outline.primary.top.length ?? 1})) + colors.border.banner.outline.primary("${theme.borderStyles.banner.outline.primary.topRight}"), { consoleFn: console.info });
|
|
41
|
+
|
|
42
|
+
${renderedTitle ? renderedTitle.array.map((line) => `writeLine(colors.border.banner.outline.primary("${theme.borderStyles.banner.outline.primary.left}") +
|
|
43
|
+
" ".repeat(Math.max(theme.padding.banner, 0)) +
|
|
44
|
+
colors.text.banner.title("${line}") +
|
|
45
|
+
" ".repeat(Math.max(theme.padding.banner, 0)) +
|
|
46
|
+
colors.border.banner.outline.primary("${theme.borderStyles.banner.outline.primary.right}"), { consoleFn: console.info });`).join(`\n`) : ""}
|
|
47
|
+
|
|
48
|
+
splitText(
|
|
49
|
+
${description ? code`"${description.replace(/"/g, "\\\"")}"` : "''"},
|
|
50
|
+
Math.max(process.stdout.columns - ${(Math.max(theme.padding.app, 0) + Math.max(theme.padding.banner, 0)) * 2 + theme.borderStyles.banner.outline.primary.left.length + theme.borderStyles.banner.outline.primary.right.length}, 0)
|
|
51
|
+
).forEach((line) => {
|
|
52
|
+
writeLine(colors.border.banner.outline.primary("${theme.borderStyles.banner.outline.primary.left + " ".repeat(Math.max(theme.padding.banner, 0))}") + colors.text.banner.description(line) + colors.border.banner.outline.primary("${" ".repeat(Math.max(theme.padding.banner, 0)) + theme.borderStyles.banner.outline.primary.right}"), { consoleFn: console.info });
|
|
53
|
+
});
|
|
54
|
+
writeLine(colors.border.banner.outline.primary("${theme.borderStyles.banner.outline.primary.bottomLeft}") + colors.border.banner.outline.primary("$"{
|
|
55
|
+
theme.borderStyles.banner.outline.primary.bottom
|
|
56
|
+
}".repeat(Math.max(process.stdout.columns - ${(Math.max(theme.padding.app, 0) + Math.max(theme.padding.banner, 0)) * 2 + theme.borderStyles.banner.outline.primary.bottomLeft.length + theme.borderStyles.banner.outline.primary.bottomRight.length}, 0) / ${theme.borderStyles.banner.outline.primary.bottom.length ?? 1})) + colors.border.banner.outline.primary("${theme.borderStyles.banner.outline.primary.bottomRight}"), { consoleFn: console.info });
|
|
57
|
+
`;
|
|
58
|
+
}
|
|
59
|
+
})];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
//#endregion
|
|
63
|
+
export { BannerFunctionDeclaration };
|
|
64
|
+
//# sourceMappingURL=banner.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"banner.mjs","names":["code","FunctionDeclaration","usePowerlines","TSDoc","TSDocRemarks","useTheme","titleCase","render","BannerFunctionDeclaration","props","title","propTitle","description","propDescription","context","theme","config","renderedTitle","font","align","colors","background","letterSpacing","lineHeight","gradient","transitionGradient","env","_$createComponent","heading","children","name","borderStyles","banner","outline","primary","topLeft","top","Math","max","padding","app","length","topRight","array","map","line","left","right","join","replace","repeat","bottomLeft","bottomRight","bottom"],"sources":["../../src/components/banner.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 } from \"@alloy-js/core\";\nimport { FunctionDeclaration } from \"@alloy-js/typescript\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport {\n TSDoc,\n TSDocRemarks\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { useTheme } from \"@shell-shock/preset-script/contexts/theme\";\nimport type { ScriptPresetContext } from \"@shell-shock/preset-script/types/plugin\";\nimport { titleCase } from \"@stryke/string-format/title-case\";\nimport { render } from \"cfonts\";\n// import {\n// getOrganizationName,\n// getWorkspaceName\n// } from \"powerlines/plugin-utils/context-helpers\";\n\nexport interface BannerFunctionDeclarationProps {\n /**\n * The title to display in the banner.\n *\n * @remarks\n * If not provided, the application title from the configuration will be used.\n */\n title?: string;\n\n /**\n * The sub-title text to display in the banner.\n *\n * @remarks\n * This will be displayed in small text below the title.\n */\n subTitle?: string;\n\n /**\n * The description of the command/application to display in the banner.\n *\n * @remarks\n * This text will be displayed in small text below the title.\n */\n description?: string;\n\n /**\n * An optional header to display above the banner. If not provided, the application's name and version will be displayed. If set to `false`, no header will be displayed.\n *\n * @remarks\n * This can be used to provide additional context or information before the banner. It will be displayed in the border surrounding the banner.\n */\n header?: string | false;\n\n /**\n * An optional footer to display below the banner. If not provided, the organization name or workspace name will be used. If set to `false`, no footer will be displayed.\n *\n * @remarks\n * This can be used to provide additional context or information after the banner. It will be displayed in the border surrounding the banner.\n */\n footer?: string | false;\n}\n\n/**\n * The `banner` handler function declaration code for the Shell Shock project.\n */\nexport function BannerFunctionDeclaration(\n props: BannerFunctionDeclarationProps\n) {\n const { title: propTitle, description: propDescription } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n const theme = useTheme();\n\n const title = propTitle || titleCase(context.config.title);\n const description = propDescription || context.config.description;\n // const header =\n // propHeader !== false\n // ? propHeader ||\n // `${title} ${context.packageJson?.version ? `v${context.packageJson.version}` : \"\"}`.trim()\n // : undefined;\n // const footer =\n // propFooter !== false\n // ? propFooter ||\n // titleCase(getOrganizationName(context) || getWorkspaceName(context))\n // : undefined;\n\n const renderedTitle = render(title, {\n font: \"tiny\",\n align: \"left\",\n colors: [\"system\"],\n background: \"transparent\",\n letterSpacing: 1,\n lineHeight: 1,\n gradient: false,\n transitionGradient: false,\n env: \"node\"\n });\n\n return (\n <>\n <TSDoc heading={`Write the application banner display to the console.`}>\n <TSDocRemarks>\n {`This function should be run at the start of an application and should identify the current application/command to the user.`}\n </TSDocRemarks>\n </TSDoc>\n <FunctionDeclaration name=\"banner\">\n {code`\n writeLine(colors.border.banner.outline.primary(\"${\n theme.borderStyles.banner.outline.primary.topLeft\n }\") + colors.border.banner.outline.primary(\"${\n theme.borderStyles.banner.outline.primary.top\n }\".repeat(Math.max(process.stdout.columns - ${\n (Math.max(theme.padding.app, 0) + Math.max(theme.padding.banner, 0)) *\n 2 +\n theme.borderStyles.banner.outline.primary.topLeft.length +\n theme.borderStyles.banner.outline.primary.topRight.length\n }, 0) / ${\n theme.borderStyles.banner.outline.primary.top.length ?? 1\n })) + colors.border.banner.outline.primary(\"${\n theme.borderStyles.banner.outline.primary.topRight\n }\"), { consoleFn: console.info });\n\n ${\n renderedTitle\n ? renderedTitle.array\n .map(\n line =>\n `writeLine(colors.border.banner.outline.primary(\"${\n theme.borderStyles.banner.outline.primary.left\n }\") +\n \" \".repeat(Math.max(theme.padding.banner, 0)) +\n colors.text.banner.title(\"${line}\") +\n \" \".repeat(Math.max(theme.padding.banner, 0)) +\n colors.border.banner.outline.primary(\"${\n theme.borderStyles.banner.outline.primary.right\n }\"), { consoleFn: console.info });`\n )\n .join(`\\n`)\n : \"\"\n }\n\n splitText(\n ${description ? code`\"${description.replace(/\"/g, '\\\\\"')}\"` : \"''\"},\n Math.max(process.stdout.columns - ${\n (Math.max(theme.padding.app, 0) +\n Math.max(theme.padding.banner, 0)) *\n 2 +\n theme.borderStyles.banner.outline.primary.left.length +\n theme.borderStyles.banner.outline.primary.right.length\n }, 0)\n ).forEach((line) => {\n writeLine(colors.border.banner.outline.primary(\"${\n theme.borderStyles.banner.outline.primary.left +\n \" \".repeat(Math.max(theme.padding.banner, 0))\n }\") + colors.text.banner.description(line) + colors.border.banner.outline.primary(\"${\n \" \".repeat(Math.max(theme.padding.banner, 0)) +\n theme.borderStyles.banner.outline.primary.right\n }\"), { consoleFn: console.info });\n });\n writeLine(colors.border.banner.outline.primary(\"${\n theme.borderStyles.banner.outline.primary.bottomLeft\n }\") + colors.border.banner.outline.primary(\"$\"{\n theme.borderStyles.banner.outline.primary.bottom\n }\".repeat(Math.max(process.stdout.columns - ${\n (Math.max(theme.padding.app, 0) + Math.max(theme.padding.banner, 0)) *\n 2 +\n theme.borderStyles.banner.outline.primary.bottomLeft.length +\n theme.borderStyles.banner.outline.primary.bottomRight.length\n }, 0) / ${\n theme.borderStyles.banner.outline.primary.bottom.length ?? 1\n })) + colors.border.banner.outline.primary(\"${\n theme.borderStyles.banner.outline.primary.bottomRight\n }\"), { consoleFn: console.info });\n`}\n </FunctionDeclaration>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AA+EA,SAAgBQ,0BACdC,OACA;CACA,MAAM,EAAEC,OAAOC,WAAWC,aAAaC,oBAAoBJ;CAE3D,MAAMK,UAAUZ,eAAoC;CACpD,MAAMa,QAAQV,UAAU;CAExB,MAAMK,QAAQC,aAAaL,UAAUQ,QAAQE,OAAON,MAAM;CAC1D,MAAME,cAAcC,mBAAmBC,QAAQE,OAAOJ;CAYtD,MAAMK,gBAAgBV,OAAOG,OAAO;EAClCQ,MAAM;EACNC,OAAO;EACPC,QAAQ,CAAC,SAAS;EAClBC,YAAY;EACZC,eAAe;EACfC,YAAY;EACZC,UAAU;EACVC,oBAAoB;EACpBC,KAAK;EACN,CAAC;AAEF,QAAA,CAAAC,gBAEKxB,OAAK;EAACyB,SAAS;EAAsD,IAAAC,WAAA;AAAA,UAAAF,gBACnEvB,cAAY,EAAAyB,UACV,+HAA6H,CAAA;;EAAA,CAAA,EAAAF,gBAGjI1B,qBAAmB;EAAC6B,MAAI;EAAA,IAAAD,WAAA;AAAA,UACtB7B,IAAI;0DAEHe,MAAMgB,aAAaC,OAAOC,QAAQC,QAAQC,QAAO,6CAEjDpB,MAAMgB,aAAaC,OAAOC,QAAQC,QAAQE,IAAG,8CAE5CC,KAAKC,IAAIvB,MAAMwB,QAAQC,KAAK,EAAE,GAAGH,KAAKC,IAAIvB,MAAMwB,QAAQP,QAAQ,EAAE,IACjE,IACFjB,MAAMgB,aAAaC,OAAOC,QAAQC,QAAQC,QAAQM,SAClD1B,MAAMgB,aAAaC,OAAOC,QAAQC,QAAQQ,SAASD,OAAM,SAEzD1B,MAAMgB,aAAaC,OAAOC,QAAQC,QAAQE,IAAIK,UAAU,EAAC,6CAEzD1B,MAAMgB,aAAaC,OAAOC,QAAQC,QAAQQ,SAAQ;;UAIlDzB,gBACIA,cAAc0B,MACXC,KACCC,SACE,mDACE9B,MAAMgB,aAAaC,OAAOC,QAAQC,QAAQY,KAAI;;gDAGpBD,KAAI;;4DAG9B9B,MAAMgB,aAAaC,OAAOC,QAAQC,QAAQa,MAAK,mCAEpD,CACAC,KAAK,KAAK,GACb,GAAE;;;YAIJpC,cAAcZ,IAAI,IAAIY,YAAYqC,QAAQ,MAAM,OAAM,CAAA,KAAM,KAAI;+CAE/DZ,KAAKC,IAAIvB,MAAMwB,QAAQC,KAAK,EAAE,GAC7BH,KAAKC,IAAIvB,MAAMwB,QAAQP,QAAQ,EAAE,IACjC,IACFjB,MAAMgB,aAAaC,OAAOC,QAAQC,QAAQY,KAAKL,SAC/C1B,MAAMgB,aAAaC,OAAOC,QAAQC,QAAQa,MAAMN,OAAM;;4DAItD1B,MAAMgB,aAAaC,OAAOC,QAAQC,QAAQY,OAC1C,IAAII,OAAOb,KAAKC,IAAIvB,MAAMwB,QAAQP,QAAQ,EAAE,CAAC,CAAA,oFAE7C,IAAIkB,OAAOb,KAAKC,IAAIvB,MAAMwB,QAAQP,QAAQ,EAAE,CAAC,GAC7CjB,MAAMgB,aAAaC,OAAOC,QAAQC,QAAQa,MAAK;;0DAIjDhC,MAAMgB,aAAaC,OAAOC,QAAQC,QAAQiB,WAAU;;uDAInDd,KAAKC,IAAIvB,MAAMwB,QAAQC,KAAK,EAAE,GAAGH,KAAKC,IAAIvB,MAAMwB,QAAQP,QAAQ,EAAE,IACjE,IACFjB,MAAMgB,aAAaC,OAAOC,QAAQC,QAAQiB,WAAWV,SACrD1B,MAAMgB,aAAaC,OAAOC,QAAQC,QAAQkB,YAAYX,OAAM,SAE5D1B,MAAMgB,aAAaC,OAAOC,QAAQC,QAAQmB,OAAOZ,UAAU,EAAC,6CAE5D1B,MAAMgB,aAAaC,OAAOC,QAAQC,QAAQkB,YAAW;;;EAE9D,CAAA,CAAA"}
|
|
@@ -6,10 +6,10 @@ let __powerlines_deepkit_vendor_type = require("@powerlines/deepkit/vendor/type"
|
|
|
6
6
|
* Get the default command options.
|
|
7
7
|
*
|
|
8
8
|
* @param context - The build context.
|
|
9
|
-
* @param
|
|
9
|
+
* @param _ - The command input.
|
|
10
10
|
* @returns The default command options.
|
|
11
11
|
*/
|
|
12
|
-
function getDefaultOptions(context,
|
|
12
|
+
function getDefaultOptions(context, _) {
|
|
13
13
|
return [
|
|
14
14
|
{
|
|
15
15
|
name: "help",
|
|
@@ -59,7 +59,7 @@ function getDefaultOptions(context, command) {
|
|
|
59
59
|
default: false,
|
|
60
60
|
isNegativeOf: "banner"
|
|
61
61
|
},
|
|
62
|
-
|
|
62
|
+
{
|
|
63
63
|
name: "verbose",
|
|
64
64
|
title: "Verbose",
|
|
65
65
|
description: "Enable verbose output.",
|
|
@@ -5,10 +5,10 @@ import { ReflectionKind } from "@powerlines/deepkit/vendor/type";
|
|
|
5
5
|
* Get the default command options.
|
|
6
6
|
*
|
|
7
7
|
* @param context - The build context.
|
|
8
|
-
* @param
|
|
8
|
+
* @param _ - The command input.
|
|
9
9
|
* @returns The default command options.
|
|
10
10
|
*/
|
|
11
|
-
function getDefaultOptions(context,
|
|
11
|
+
function getDefaultOptions(context, _) {
|
|
12
12
|
return [
|
|
13
13
|
{
|
|
14
14
|
name: "help",
|
|
@@ -58,7 +58,7 @@ function getDefaultOptions(context, command) {
|
|
|
58
58
|
default: false,
|
|
59
59
|
isNegativeOf: "banner"
|
|
60
60
|
},
|
|
61
|
-
|
|
61
|
+
{
|
|
62
62
|
name: "verbose",
|
|
63
63
|
title: "Verbose",
|
|
64
64
|
description: "Enable verbose output.",
|
|
@@ -71,4 +71,5 @@ function getDefaultOptions(context, command) {
|
|
|
71
71
|
}
|
|
72
72
|
|
|
73
73
|
//#endregion
|
|
74
|
-
export { getDefaultOptions };
|
|
74
|
+
export { getDefaultOptions };
|
|
75
|
+
//# sourceMappingURL=get-default-options.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-default-options.mjs","names":["ReflectionKind","getDefaultOptions","context","_","name","title","description","alias","kind","boolean","optional","default","skipAddingNegative","config","interactive","isNegativeOf","filter","Boolean"],"sources":["../../src/helpers/get-default-options.ts"],"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 { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\nimport type { CommandBase, CommandOption } from \"@shell-shock/core\";\nimport type { CLIPresetContext } from \"../types\";\n\n/**\n * Get the default command options.\n *\n * @param context - The build context.\n * @param _ - The command input.\n * @returns The default command options.\n */\nexport function getDefaultOptions(\n context: CLIPresetContext,\n _: CommandBase\n): CommandOption[] {\n return [\n {\n name: \"help\",\n title: \"Help\",\n description: \"Show help information.\",\n alias: [\"h\", \"?\"],\n kind: ReflectionKind.boolean,\n optional: true,\n default: false,\n skipAddingNegative: true\n },\n {\n name: \"version\",\n title: \"Version\",\n description: \"Show the version of the application.\",\n alias: [\"v\"],\n kind: ReflectionKind.boolean,\n optional: true,\n default: false,\n skipAddingNegative: true\n },\n context.config.interactive !== \"never\" &&\n context.config.interactive !== true && {\n name: \"interactive\",\n title: \"Interactive\",\n description:\n \"Enable interactive mode (will be set to false if running in a CI pipeline).\",\n alias: [\"i\", \"interact\"],\n kind: ReflectionKind.boolean,\n optional: true,\n default: context.config.interactive !== false\n },\n context.config.interactive !== \"never\" &&\n context.config.interactive !== false && {\n name: \"no-interactive\",\n title: \"Non-Interactive\",\n description:\n \"Disable interactive mode (will be set to true if running in a CI pipeline).\",\n alias: [\"no-interact\"],\n kind: ReflectionKind.boolean,\n optional: true,\n default: false,\n isNegativeOf: \"interactive\"\n },\n {\n name: \"no-banner\",\n title: \"Hide Banner\",\n description:\n \"Hide the banner displayed while running the CLI application (will be set to true if running in a CI pipeline).\",\n kind: ReflectionKind.boolean,\n optional: true,\n default: false,\n isNegativeOf: \"banner\"\n },\n {\n name: \"verbose\",\n title: \"Verbose\",\n description: \"Enable verbose output.\",\n kind: ReflectionKind.boolean,\n optional: true,\n default: false,\n skipAddingNegative: true\n }\n ].filter(Boolean) as CommandOption[];\n}\n"],"mappings":";;;;;;;;;;AA6BA,SAAgBC,kBACdC,SACAC,GACiB;AACjB,QAAO;EACL;GACEC,MAAM;GACNC,OAAO;GACPC,aAAa;GACbC,OAAO,CAAC,KAAK,IAAI;GACjBC,MAAMR,eAAeS;GACrBC,UAAU;GACVC,SAAS;GACTC,oBAAoB;GACrB;EACD;GACER,MAAM;GACNC,OAAO;GACPC,aAAa;GACbC,OAAO,CAAC,IAAI;GACZC,MAAMR,eAAeS;GACrBC,UAAU;GACVC,SAAS;GACTC,oBAAoB;GACrB;EACDV,QAAQW,OAAOC,gBAAgB,WAC7BZ,QAAQW,OAAOC,gBAAgB,QAAQ;GACrCV,MAAM;GACNC,OAAO;GACPC,aACE;GACFC,OAAO,CAAC,KAAK,WAAW;GACxBC,MAAMR,eAAeS;GACrBC,UAAU;GACVC,SAAST,QAAQW,OAAOC,gBAAgB;GACzC;EACHZ,QAAQW,OAAOC,gBAAgB,WAC7BZ,QAAQW,OAAOC,gBAAgB,SAAS;GACtCV,MAAM;GACNC,OAAO;GACPC,aACE;GACFC,OAAO,CAAC,cAAc;GACtBC,MAAMR,eAAeS;GACrBC,UAAU;GACVC,SAAS;GACTI,cAAc;GACf;EACH;GACEX,MAAM;GACNC,OAAO;GACPC,aACE;GACFE,MAAMR,eAAeS;GACrBC,UAAU;GACVC,SAAS;GACTI,cAAc;GACf;EACD;GACEX,MAAM;GACNC,OAAO;GACPC,aAAa;GACbE,MAAMR,eAAeS;GACrBC,UAAU;GACVC,SAAS;GACTC,oBAAoB;GACrB;EACF,CAACI,OAAOC,QAAQ"}
|
package/dist/index.cjs
CHANGED
|
@@ -1,20 +1,29 @@
|
|
|
1
1
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
2
2
|
const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
|
|
3
|
-
const require_components_builtin_console = require('./components/builtin/console.cjs');
|
|
4
3
|
const require_get_default_options = require('./helpers/get-default-options.cjs');
|
|
5
4
|
let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
6
|
-
let
|
|
7
|
-
|
|
5
|
+
let __alloy_js_core = require("@alloy-js/core");
|
|
6
|
+
let __alloy_js_typescript = require("@alloy-js/typescript");
|
|
7
|
+
let __powerlines_plugin_alloy_render = require("@powerlines/plugin-alloy/render");
|
|
8
|
+
let __shell_shock_core_plugin_utils = require("@shell-shock/core/plugin-utils");
|
|
9
|
+
let __shell_shock_plugin_theme = require("@shell-shock/plugin-theme");
|
|
10
|
+
__shell_shock_plugin_theme = require_rolldown_runtime.__toESM(__shell_shock_plugin_theme);
|
|
11
|
+
let __shell_shock_preset_script_components_bin_entry = require("@shell-shock/preset-script/components/bin-entry");
|
|
12
|
+
let __shell_shock_preset_script_components_command_entry = require("@shell-shock/preset-script/components/command-entry");
|
|
13
|
+
let __shell_shock_preset_script_components_command_router = require("@shell-shock/preset-script/components/command-router");
|
|
14
|
+
let __shell_shock_preset_script_components_console_builtin = require("@shell-shock/preset-script/components/console-builtin");
|
|
15
|
+
let __shell_shock_preset_script_components_utils_builtin = require("@shell-shock/preset-script/components/utils-builtin");
|
|
16
|
+
let __shell_shock_preset_script_components_virtual_command_entry = require("@shell-shock/preset-script/components/virtual-command-entry");
|
|
8
17
|
|
|
9
18
|
//#region src/index.tsx
|
|
10
19
|
/**
|
|
11
20
|
* The Shell Shock base plugin.
|
|
12
21
|
*/
|
|
13
22
|
const plugin = (options = {}) => {
|
|
14
|
-
return [(0,
|
|
23
|
+
return [(0, __shell_shock_plugin_theme.default)({ theme: options.theme }), {
|
|
15
24
|
name: "shell-shock:cli-preset",
|
|
16
25
|
config() {
|
|
17
|
-
this.
|
|
26
|
+
this.debug("Providing default configuration for the Shell Shock `cli` preset plugin.");
|
|
18
27
|
return {
|
|
19
28
|
interactive: true,
|
|
20
29
|
defaultOptions: require_get_default_options.getDefaultOptions,
|
|
@@ -22,8 +31,53 @@ const plugin = (options = {}) => {
|
|
|
22
31
|
};
|
|
23
32
|
},
|
|
24
33
|
async prepare() {
|
|
25
|
-
|
|
26
|
-
|
|
34
|
+
const _self$ = this;
|
|
35
|
+
this.debug("Rendering source code with the Shell Shock `cli` preset.");
|
|
36
|
+
const commands = this.inputs.map((input) => (0, __shell_shock_core_plugin_utils.getCommandTree)(this, input.path.segments)).filter(Boolean);
|
|
37
|
+
return (0, __powerlines_plugin_alloy_render.render)(this, [
|
|
38
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_bin_entry.BinEntry, { get children() {
|
|
39
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
40
|
+
get when() {
|
|
41
|
+
return (0, __alloy_js_core_jsx_runtime.memo)(() => !!_self$.commands)() && Object.keys(_self$.commands).length > 0;
|
|
42
|
+
},
|
|
43
|
+
get children() {
|
|
44
|
+
return [
|
|
45
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.VarDeclaration, {
|
|
46
|
+
"const": true,
|
|
47
|
+
name: "args",
|
|
48
|
+
type: "string[]",
|
|
49
|
+
initializer: __alloy_js_core.code`getArgs();`
|
|
50
|
+
}),
|
|
51
|
+
(0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
|
|
52
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_command_router.CommandRouter, {
|
|
53
|
+
path: [],
|
|
54
|
+
get commands() {
|
|
55
|
+
return _self$.commands ?? {};
|
|
56
|
+
}
|
|
57
|
+
})
|
|
58
|
+
];
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
} }),
|
|
62
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
|
|
63
|
+
get each() {
|
|
64
|
+
return Object.values(commands);
|
|
65
|
+
},
|
|
66
|
+
children: (child) => (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
67
|
+
get when() {
|
|
68
|
+
return child.isVirtual;
|
|
69
|
+
},
|
|
70
|
+
get fallback() {
|
|
71
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_command_entry.CommandEntry, { command: child });
|
|
72
|
+
},
|
|
73
|
+
get children() {
|
|
74
|
+
return (0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_virtual_command_entry.VirtualCommandEntry, { command: child });
|
|
75
|
+
}
|
|
76
|
+
})
|
|
77
|
+
}),
|
|
78
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_utils_builtin.UtilsBuiltin, {}),
|
|
79
|
+
(0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_console_builtin.ConsoleBuiltin, {})
|
|
80
|
+
]);
|
|
27
81
|
}
|
|
28
82
|
}];
|
|
29
83
|
};
|
package/dist/index.d.cts
CHANGED
|
@@ -8,4 +8,5 @@ import { Plugin } from "powerlines/types/plugin";
|
|
|
8
8
|
*/
|
|
9
9
|
declare const plugin: <TContext extends CLIPresetContext = CLIPresetContext>(options?: CLIPresetOptions) => Plugin<TContext>[];
|
|
10
10
|
//#endregion
|
|
11
|
-
export { plugin as default, plugin };
|
|
11
|
+
export { plugin as default, plugin };
|
|
12
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"sourcesContent":[],"mappings":";;;;;;;AAqCA;AAAwC,cAA3B,MAA2B,EAAA,CAAA,iBAAA,gBAAA,GAAmB,gBAAnB,CAAA,CAAA,OAAA,CAAA,EAC7B,gBAD6B,EAAA,GA0DjC,MA1DiC,CA0D1B,QA1D0B,CAAA,EAAA"}
|
package/dist/index.d.mts
CHANGED
|
@@ -8,4 +8,5 @@ import { Plugin } from "powerlines/types/plugin";
|
|
|
8
8
|
*/
|
|
9
9
|
declare const plugin: <TContext extends CLIPresetContext = CLIPresetContext>(options?: CLIPresetOptions) => Plugin<TContext>[];
|
|
10
10
|
//#endregion
|
|
11
|
-
export { plugin as default, plugin };
|
|
11
|
+
export { plugin as default, plugin };
|
|
12
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"sourcesContent":[],"mappings":";;;;;;;AAqCA;AAAwC,cAA3B,MAA2B,EAAA,CAAA,iBAAA,gBAAA,GAAmB,gBAAnB,CAAA,CAAA,OAAA,CAAA,EAC7B,gBAD6B,EAAA,GA0DjC,MA1DiC,CA0D1B,QA1D0B,CAAA,EAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,17 +1,26 @@
|
|
|
1
|
-
import { ConsoleBuiltin } from "./components/builtin/console.mjs";
|
|
2
1
|
import { getDefaultOptions } from "./helpers/get-default-options.mjs";
|
|
3
|
-
import { createComponent } from "@alloy-js/core/jsx-runtime";
|
|
4
|
-
import
|
|
2
|
+
import { createComponent, createIntrinsic, memo } from "@alloy-js/core/jsx-runtime";
|
|
3
|
+
import { For, Show, code } from "@alloy-js/core";
|
|
4
|
+
import { VarDeclaration } from "@alloy-js/typescript";
|
|
5
|
+
import { render } from "@powerlines/plugin-alloy/render";
|
|
6
|
+
import { getCommandTree } from "@shell-shock/core/plugin-utils";
|
|
7
|
+
import theme from "@shell-shock/plugin-theme";
|
|
8
|
+
import { BinEntry } from "@shell-shock/preset-script/components/bin-entry";
|
|
9
|
+
import { CommandEntry } from "@shell-shock/preset-script/components/command-entry";
|
|
10
|
+
import { CommandRouter } from "@shell-shock/preset-script/components/command-router";
|
|
11
|
+
import { ConsoleBuiltin } from "@shell-shock/preset-script/components/console-builtin";
|
|
12
|
+
import { UtilsBuiltin } from "@shell-shock/preset-script/components/utils-builtin";
|
|
13
|
+
import { VirtualCommandEntry } from "@shell-shock/preset-script/components/virtual-command-entry";
|
|
5
14
|
|
|
6
15
|
//#region src/index.tsx
|
|
7
16
|
/**
|
|
8
17
|
* The Shell Shock base plugin.
|
|
9
18
|
*/
|
|
10
19
|
const plugin = (options = {}) => {
|
|
11
|
-
return [
|
|
20
|
+
return [theme({ theme: options.theme }), {
|
|
12
21
|
name: "shell-shock:cli-preset",
|
|
13
22
|
config() {
|
|
14
|
-
this.
|
|
23
|
+
this.debug("Providing default configuration for the Shell Shock `cli` preset plugin.");
|
|
15
24
|
return {
|
|
16
25
|
interactive: true,
|
|
17
26
|
defaultOptions: getDefaultOptions,
|
|
@@ -19,12 +28,58 @@ const plugin = (options = {}) => {
|
|
|
19
28
|
};
|
|
20
29
|
},
|
|
21
30
|
async prepare() {
|
|
22
|
-
|
|
23
|
-
|
|
31
|
+
const _self$ = this;
|
|
32
|
+
this.debug("Rendering source code with the Shell Shock `cli` preset.");
|
|
33
|
+
const commands = this.inputs.map((input) => getCommandTree(this, input.path.segments)).filter(Boolean);
|
|
34
|
+
return render(this, [
|
|
35
|
+
createComponent(BinEntry, { get children() {
|
|
36
|
+
return createComponent(Show, {
|
|
37
|
+
get when() {
|
|
38
|
+
return memo(() => !!_self$.commands)() && Object.keys(_self$.commands).length > 0;
|
|
39
|
+
},
|
|
40
|
+
get children() {
|
|
41
|
+
return [
|
|
42
|
+
createComponent(VarDeclaration, {
|
|
43
|
+
"const": true,
|
|
44
|
+
name: "args",
|
|
45
|
+
type: "string[]",
|
|
46
|
+
initializer: code`getArgs();`
|
|
47
|
+
}),
|
|
48
|
+
createIntrinsic("hbr", {}),
|
|
49
|
+
createComponent(CommandRouter, {
|
|
50
|
+
path: [],
|
|
51
|
+
get commands() {
|
|
52
|
+
return _self$.commands ?? {};
|
|
53
|
+
}
|
|
54
|
+
})
|
|
55
|
+
];
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
} }),
|
|
59
|
+
createComponent(For, {
|
|
60
|
+
get each() {
|
|
61
|
+
return Object.values(commands);
|
|
62
|
+
},
|
|
63
|
+
children: (child) => createComponent(Show, {
|
|
64
|
+
get when() {
|
|
65
|
+
return child.isVirtual;
|
|
66
|
+
},
|
|
67
|
+
get fallback() {
|
|
68
|
+
return createComponent(CommandEntry, { command: child });
|
|
69
|
+
},
|
|
70
|
+
get children() {
|
|
71
|
+
return createComponent(VirtualCommandEntry, { command: child });
|
|
72
|
+
}
|
|
73
|
+
})
|
|
74
|
+
}),
|
|
75
|
+
createComponent(UtilsBuiltin, {}),
|
|
76
|
+
createComponent(ConsoleBuiltin, {})
|
|
77
|
+
]);
|
|
24
78
|
}
|
|
25
79
|
}];
|
|
26
80
|
};
|
|
27
81
|
var src_default = plugin;
|
|
28
82
|
|
|
29
83
|
//#endregion
|
|
30
|
-
export { src_default as default, plugin };
|
|
84
|
+
export { src_default as default, plugin };
|
|
85
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["code","For","Show","VarDeclaration","render","getCommandTree","theme","BinEntry","CommandEntry","CommandRouter","ConsoleBuiltin","UtilsBuiltin","VirtualCommandEntry","getDefaultOptions","plugin","options","name","config","debug","interactive","defaultOptions","prepare","_self$","commands","inputs","map","input","path","segments","filter","Boolean","_$createComponent","children","when","_$memo","Object","keys","length","type","initializer","_$createIntrinsic","each","values","child","isVirtual","fallback","command"],"sources":["../src/index.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, For, Show } from \"@alloy-js/core\";\nimport { VarDeclaration } from \"@alloy-js/typescript\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport { getCommandTree } from \"@shell-shock/core/plugin-utils\";\nimport type { CommandTree } from \"@shell-shock/core/types/command\";\nimport theme from \"@shell-shock/plugin-theme\";\nimport { BinEntry } from \"@shell-shock/preset-script/components/bin-entry\";\nimport { CommandEntry } from \"@shell-shock/preset-script/components/command-entry\";\nimport { CommandRouter } from \"@shell-shock/preset-script/components/command-router\";\nimport { ConsoleBuiltin } from \"@shell-shock/preset-script/components/console-builtin\";\nimport { UtilsBuiltin } from \"@shell-shock/preset-script/components/utils-builtin\";\nimport { VirtualCommandEntry } from \"@shell-shock/preset-script/components/virtual-command-entry\";\nimport type { Plugin } from \"powerlines/types/plugin\";\nimport { getDefaultOptions } from \"./helpers/get-default-options\";\nimport type { CLIPresetContext, CLIPresetOptions } from \"./types/plugin\";\n\n/**\n * The Shell Shock base plugin.\n */\nexport const plugin = <TContext extends CLIPresetContext = CLIPresetContext>(\n options: CLIPresetOptions = {}\n) => {\n return [\n theme({\n theme: options.theme\n }),\n {\n name: \"shell-shock:cli-preset\",\n config() {\n this.debug(\n \"Providing default configuration for the Shell Shock `cli` preset plugin.\"\n );\n\n return {\n interactive: true,\n defaultOptions: getDefaultOptions,\n ...options\n };\n },\n async prepare() {\n this.debug(\"Rendering source code with the Shell Shock `cli` preset.\");\n\n const commands = this.inputs\n .map(input => getCommandTree(this, input.path.segments))\n .filter(Boolean) as CommandTree[];\n\n return render(\n this,\n <>\n <BinEntry>\n <Show\n when={this.commands && Object.keys(this.commands).length > 0}>\n <VarDeclaration\n const\n name=\"args\"\n type=\"string[]\"\n initializer={code`getArgs();`}\n />\n <hbr />\n <CommandRouter path={[]} commands={this.commands ?? {}} />\n </Show>\n </BinEntry>\n <For each={Object.values(commands)}>\n {child => (\n <Show\n when={child.isVirtual}\n fallback={<CommandEntry command={child} />}>\n <VirtualCommandEntry command={child} />\n </Show>\n )}\n </For>\n <UtilsBuiltin />\n <ConsoleBuiltin />\n </>\n );\n }\n }\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;AAqCA,MAAac,UACXC,UAA4B,EAAE,KAC3B;AACH,QAAO,CACLT,MAAM,EACJA,OAAOS,QAAQT,OAChB,CAAC,EACF;EACEU,MAAM;EACNC,SAAS;AACP,QAAKC,MACH,2EACD;AAED,UAAO;IACLC,aAAa;IACbC,gBAAgBP;IAChB,GAAGE;IACJ;;EAEH,MAAMM,UAAU;GAAA,MAAAC,SAAA;AACd,QAAKJ,MAAM,2DAA2D;GAEtE,MAAMK,WAAW,KAAKC,OACnBC,KAAIC,UAASrB,eAAe,MAAMqB,MAAMC,KAAKC,SAAS,CAAC,CACvDC,OAAOC,QAAyB;AAEnC,UAAO1B,OACL,MAAI;IAAA2B,gBAEDxB,UAAQ,EAAA,IAAAyB,WAAA;AAAA,YAAAD,gBACN7B,MAAI;MAAA,IACH+B,OAAI;AAAA,cAAEC,WAAA,CAAA,CAAAZ,OAAKC,SAAQ,EAAA,IAAIY,OAAOC,KAAKd,OAAKC,SAAS,CAACc,SAAS;;MAAC,IAAAL,WAAA;AAAA,cAAA;QAAAD,gBAC3D5B,gBAAc;SAAA,SAAA;SAEba,MAAI;SACJsB,MAAI;SACJC,aAAavC,IAAI;SAAY,CAAA;QAAAwC,gBAAA,OAAA,EAAA,CAAA;QAAAT,gBAG9BtB,eAAa;SAACkB,MAAM,EAAE;SAAA,IAAEJ,WAAQ;AAAA,iBAAED,OAAKC,YAAY,EAAE;;SAAA,CAAA;QAAA;;MAAA,CAAA;OAAA,CAAA;IAAAQ,gBAGzD9B,KAAG;KAAA,IAACwC,OAAI;AAAA,aAAEN,OAAOO,OAAOnB,SAAS;;KAAAS,WAC/BW,UAAKZ,gBACH7B,MAAI;MAAA,IACH+B,OAAI;AAAA,cAAEU,MAAMC;;MAAS,IACrBC,WAAQ;AAAA,cAAAd,gBAAGvB,cAAY,EAACsC,SAASH,OAAK,CAAA;;MAAA,IAAAX,WAAA;AAAA,cAAAD,gBACrCnB,qBAAmB,EAACkC,SAASH,OAAK,CAAA;;MAAA,CAAA;KAEtC,CAAA;IAAAZ,gBAEFpB,cAAY,EAAA,CAAA;IAAAoB,gBACZrB,gBAAc,EAAA,CAAA;IAEnB,CAAC;;EAEJ,CACF;;AAGH,kBAAeI"}
|
package/dist/types/plugin.d.cts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Children } from "@alloy-js/core";
|
|
1
2
|
import { CommandBase, CommandOption } from "@shell-shock/core/types/command";
|
|
2
3
|
import { Context } from "@shell-shock/core/types/context";
|
|
3
4
|
import { ThemePluginResolvedConfig } from "@shell-shock/plugin-theme/types/plugin";
|
|
@@ -32,9 +33,14 @@ interface CLIPresetOptions extends Omit<ScriptPresetOptions, "defaultOptions"> {
|
|
|
32
33
|
* To disable the addition of these default options, set this property to `false`, or provide a custom set of options/a function that returns them.
|
|
33
34
|
*/
|
|
34
35
|
defaultOptions?: CommandOption[] | ((context: Context, input: CommandBase) => CommandOption[]) | false;
|
|
36
|
+
/**
|
|
37
|
+
* An alloy-js component to render the banner that is displayed when the application starts.
|
|
38
|
+
*/
|
|
39
|
+
banner?: Children;
|
|
35
40
|
}
|
|
36
41
|
type CLIPresetUserConfig = ScriptPresetUserConfig & CLIPresetOptions;
|
|
37
42
|
type CLIPresetResolvedConfig = ScriptPresetResolvedConfig & Required<Omit<CLIPresetOptions, "theme">> & Pick<ThemePluginResolvedConfig, "theme">;
|
|
38
43
|
type CLIPresetContext<TResolvedConfig extends CLIPresetResolvedConfig = CLIPresetResolvedConfig> = ScriptPresetContext<TResolvedConfig>;
|
|
39
44
|
//#endregion
|
|
40
|
-
export { CLIPresetContext, CLIPresetOptions, CLIPresetResolvedConfig, CLIPresetUserConfig };
|
|
45
|
+
export { CLIPresetContext, CLIPresetOptions, CLIPresetResolvedConfig, CLIPresetUserConfig };
|
|
46
|
+
//# sourceMappingURL=plugin.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/types/plugin.ts"],"sourcesContent":[],"mappings":";;;;;;;UAgCiB,gBAAA,SAAyB,KACxC;;AADF;;;;;;;;;AA0CA;EAEY,WAAA,CAAA,EAAA,OAAA,GAAA,OAAuB;EAAG;;;;;;;AAItC;;;;;;;mBAhBM,6BACW,gBAAgB,gBAAgB;;;;WAMtC;;KAGC,mBAAA,GAAsB,yBAAyB;KAE/C,uBAAA,GAA0B,6BACpC,SAAS,KAAK,8BACd,KAAK;KAEK,yCACc,0BAA0B,2BAChD,oBAAoB"}
|
package/dist/types/plugin.d.mts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Children } from "@alloy-js/core";
|
|
1
2
|
import { CommandBase, CommandOption } from "@shell-shock/core/types/command";
|
|
2
3
|
import { Context } from "@shell-shock/core/types/context";
|
|
3
4
|
import { ThemePluginResolvedConfig } from "@shell-shock/plugin-theme/types/plugin";
|
|
@@ -32,9 +33,14 @@ interface CLIPresetOptions extends Omit<ScriptPresetOptions, "defaultOptions"> {
|
|
|
32
33
|
* To disable the addition of these default options, set this property to `false`, or provide a custom set of options/a function that returns them.
|
|
33
34
|
*/
|
|
34
35
|
defaultOptions?: CommandOption[] | ((context: Context, input: CommandBase) => CommandOption[]) | false;
|
|
36
|
+
/**
|
|
37
|
+
* An alloy-js component to render the banner that is displayed when the application starts.
|
|
38
|
+
*/
|
|
39
|
+
banner?: Children;
|
|
35
40
|
}
|
|
36
41
|
type CLIPresetUserConfig = ScriptPresetUserConfig & CLIPresetOptions;
|
|
37
42
|
type CLIPresetResolvedConfig = ScriptPresetResolvedConfig & Required<Omit<CLIPresetOptions, "theme">> & Pick<ThemePluginResolvedConfig, "theme">;
|
|
38
43
|
type CLIPresetContext<TResolvedConfig extends CLIPresetResolvedConfig = CLIPresetResolvedConfig> = ScriptPresetContext<TResolvedConfig>;
|
|
39
44
|
//#endregion
|
|
40
|
-
export { CLIPresetContext, CLIPresetOptions, CLIPresetResolvedConfig, CLIPresetUserConfig };
|
|
45
|
+
export { CLIPresetContext, CLIPresetOptions, CLIPresetResolvedConfig, CLIPresetUserConfig };
|
|
46
|
+
//# sourceMappingURL=plugin.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/types/plugin.ts"],"sourcesContent":[],"mappings":";;;;;;;UAgCiB,gBAAA,SAAyB,KACxC;;AADF;;;;;;;;;AA0CA;EAEY,WAAA,CAAA,EAAA,OAAA,GAAA,OAAuB;EAAG;;;;;;;AAItC;;;;;;;mBAhBM,6BACW,gBAAgB,gBAAgB;;;;WAMtC;;KAGC,mBAAA,GAAsB,yBAAyB;KAE/C,uBAAA,GAA0B,6BACpC,SAAS,KAAK,8BACd,KAAK;KAEK,yCACc,0BAA0B,2BAChD,oBAAoB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shell-shock/preset-cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A package containing a Shell Shock plugin to generate source code given a list design tokens.",
|
|
6
6
|
"repository": {
|
|
@@ -38,124 +38,82 @@
|
|
|
38
38
|
},
|
|
39
39
|
"license": "Apache-2.0",
|
|
40
40
|
"private": false,
|
|
41
|
-
"main": "dist/index.cjs",
|
|
42
|
-
"module": "dist/index.mjs",
|
|
43
|
-
"typings": "dist/index.d.mts",
|
|
41
|
+
"main": "./dist/index.cjs",
|
|
42
|
+
"module": "./dist/index.mjs",
|
|
44
43
|
"exports": {
|
|
45
|
-
"./package.json": "./package.json",
|
|
46
44
|
".": {
|
|
47
|
-
"import": {
|
|
48
|
-
"types": "./dist/index.d.mts",
|
|
49
|
-
"default": "./dist/index.mjs"
|
|
50
|
-
},
|
|
51
45
|
"require": {
|
|
52
46
|
"types": "./dist/index.d.cts",
|
|
53
47
|
"default": "./dist/index.cjs"
|
|
54
48
|
},
|
|
55
|
-
"default": {
|
|
56
|
-
"types": "./dist/index.d.mts",
|
|
57
|
-
"default": "./dist/index.mjs"
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
"./index": {
|
|
61
49
|
"import": {
|
|
62
50
|
"types": "./dist/index.d.mts",
|
|
63
51
|
"default": "./dist/index.mjs"
|
|
64
52
|
},
|
|
65
|
-
"require": {
|
|
66
|
-
"types": "./dist/index.d.cts",
|
|
67
|
-
"default": "./dist/index.cjs"
|
|
68
|
-
},
|
|
69
53
|
"default": {
|
|
70
54
|
"types": "./dist/index.d.mts",
|
|
71
55
|
"default": "./dist/index.mjs"
|
|
72
56
|
}
|
|
73
57
|
},
|
|
74
|
-
"./
|
|
75
|
-
"import": {
|
|
76
|
-
"types": "./dist/types/index.d.mts",
|
|
77
|
-
"default": "./dist/types/index.mjs"
|
|
78
|
-
},
|
|
79
|
-
"require": {
|
|
80
|
-
"types": "./dist/types/index.d.cts",
|
|
81
|
-
"default": "./dist/types/index.cjs"
|
|
82
|
-
},
|
|
83
|
-
"default": {
|
|
84
|
-
"types": "./dist/types/index.d.mts",
|
|
85
|
-
"default": "./dist/types/index.mjs"
|
|
86
|
-
}
|
|
87
|
-
},
|
|
88
|
-
"./types/*": {
|
|
89
|
-
"import": {
|
|
90
|
-
"types": "./dist/types/*.d.mts",
|
|
91
|
-
"default": "./dist/types/*.mjs"
|
|
92
|
-
},
|
|
58
|
+
"./components": {
|
|
93
59
|
"require": {
|
|
94
|
-
"types": "./dist/
|
|
95
|
-
"default": "./dist/
|
|
60
|
+
"types": "./dist/components/index.d.cts",
|
|
61
|
+
"default": "./dist/components/index.cjs"
|
|
96
62
|
},
|
|
97
|
-
"default": {
|
|
98
|
-
"types": "./dist/types/*.d.mts",
|
|
99
|
-
"default": "./dist/types/*.mjs"
|
|
100
|
-
}
|
|
101
|
-
},
|
|
102
|
-
"./components": {
|
|
103
63
|
"import": {
|
|
104
64
|
"types": "./dist/components/index.d.mts",
|
|
105
65
|
"default": "./dist/components/index.mjs"
|
|
106
66
|
},
|
|
107
|
-
"require": {
|
|
108
|
-
"types": "./dist/components/index.d.cts",
|
|
109
|
-
"default": "./dist/components/index.cjs"
|
|
110
|
-
},
|
|
111
67
|
"default": {
|
|
112
68
|
"types": "./dist/components/index.d.mts",
|
|
113
69
|
"default": "./dist/components/index.mjs"
|
|
114
70
|
}
|
|
115
71
|
},
|
|
116
|
-
"./components
|
|
117
|
-
"import": {
|
|
118
|
-
"types": "./dist/components/*.d.mts",
|
|
119
|
-
"default": "./dist/components/*.mjs"
|
|
120
|
-
},
|
|
72
|
+
"./components/banner": {
|
|
121
73
|
"require": {
|
|
122
|
-
"types": "./dist/components
|
|
123
|
-
"default": "./dist/components
|
|
74
|
+
"types": "./dist/components/banner.d.cts",
|
|
75
|
+
"default": "./dist/components/banner.cjs"
|
|
76
|
+
},
|
|
77
|
+
"import": {
|
|
78
|
+
"types": "./dist/components/banner.d.mts",
|
|
79
|
+
"default": "./dist/components/banner.mjs"
|
|
124
80
|
},
|
|
125
81
|
"default": {
|
|
126
|
-
"types": "./dist/components
|
|
127
|
-
"default": "./dist/components
|
|
82
|
+
"types": "./dist/components/banner.d.mts",
|
|
83
|
+
"default": "./dist/components/banner.mjs"
|
|
128
84
|
}
|
|
129
85
|
},
|
|
130
|
-
"./
|
|
131
|
-
|
|
132
|
-
"types": "./dist/components/entry/index.d.mts",
|
|
133
|
-
"default": "./dist/components/entry/index.mjs"
|
|
134
|
-
},
|
|
86
|
+
"./package.json": "./package.json",
|
|
87
|
+
"./types": {
|
|
135
88
|
"require": {
|
|
136
|
-
"types": "./dist/
|
|
137
|
-
"default": "./dist/
|
|
89
|
+
"types": "./dist/types/index.d.cts",
|
|
90
|
+
"default": "./dist/types/index.cjs"
|
|
91
|
+
},
|
|
92
|
+
"import": {
|
|
93
|
+
"types": "./dist/types/index.d.mts",
|
|
94
|
+
"default": "./dist/types/index.mjs"
|
|
138
95
|
},
|
|
139
96
|
"default": {
|
|
140
|
-
"types": "./dist/
|
|
141
|
-
"default": "./dist/
|
|
97
|
+
"types": "./dist/types/index.d.mts",
|
|
98
|
+
"default": "./dist/types/index.mjs"
|
|
142
99
|
}
|
|
143
100
|
},
|
|
144
|
-
"./
|
|
145
|
-
"import": {
|
|
146
|
-
"types": "./dist/components/entry/*.d.mts",
|
|
147
|
-
"default": "./dist/components/entry/*.mjs"
|
|
148
|
-
},
|
|
101
|
+
"./types/plugin": {
|
|
149
102
|
"require": {
|
|
150
|
-
"types": "./dist/
|
|
151
|
-
"default": "./dist/
|
|
103
|
+
"types": "./dist/types/plugin.d.cts",
|
|
104
|
+
"default": "./dist/types/plugin.cjs"
|
|
105
|
+
},
|
|
106
|
+
"import": {
|
|
107
|
+
"types": "./dist/types/plugin.d.mts",
|
|
108
|
+
"default": "./dist/types/plugin.mjs"
|
|
152
109
|
},
|
|
153
110
|
"default": {
|
|
154
|
-
"types": "./dist/
|
|
155
|
-
"default": "./dist/
|
|
111
|
+
"types": "./dist/types/plugin.d.mts",
|
|
112
|
+
"default": "./dist/types/plugin.mjs"
|
|
156
113
|
}
|
|
157
114
|
}
|
|
158
115
|
},
|
|
116
|
+
"typings": "dist/index.d.mts",
|
|
159
117
|
"files": ["dist/**/*"],
|
|
160
118
|
"keywords": [
|
|
161
119
|
"shell-shock",
|
|
@@ -164,21 +122,46 @@
|
|
|
164
122
|
"storm-software"
|
|
165
123
|
],
|
|
166
124
|
"dependencies": {
|
|
167
|
-
"@alloy-js/core": "
|
|
125
|
+
"@alloy-js/core": "0.22.0",
|
|
168
126
|
"@alloy-js/typescript": "^0.22.0",
|
|
169
|
-
"@powerlines/deepkit": "^0.
|
|
170
|
-
"@powerlines/plugin-alloy": "^0.
|
|
171
|
-
"@powerlines/plugin-plugin": "^0.12.
|
|
172
|
-
"@shell-shock/core": "^0.
|
|
173
|
-
"@shell-shock/plugin-theme": "^0.0.
|
|
174
|
-
"@shell-shock/preset-script": "^0.1.
|
|
175
|
-
"
|
|
127
|
+
"@powerlines/deepkit": "^0.6.37",
|
|
128
|
+
"@powerlines/plugin-alloy": "^0.19.37",
|
|
129
|
+
"@powerlines/plugin-plugin": "^0.12.208",
|
|
130
|
+
"@shell-shock/core": "^0.3.0",
|
|
131
|
+
"@shell-shock/plugin-theme": "^0.0.7",
|
|
132
|
+
"@shell-shock/preset-script": "^0.1.2",
|
|
133
|
+
"@stryke/string-format": "^0.13.7",
|
|
134
|
+
"cfonts": "^3.3.1",
|
|
135
|
+
"powerlines": "^0.38.24"
|
|
176
136
|
},
|
|
177
137
|
"devDependencies": {
|
|
178
|
-
"@babel/core": "^7.28.
|
|
179
|
-
"@types/node": "^22.19.
|
|
180
|
-
"@types/react": "^19.2.
|
|
138
|
+
"@babel/core": "^7.28.6",
|
|
139
|
+
"@types/node": "^22.19.7",
|
|
140
|
+
"@types/react": "^19.2.10"
|
|
141
|
+
},
|
|
142
|
+
"publishConfig": {
|
|
143
|
+
"access": "public",
|
|
144
|
+
"exports": {
|
|
145
|
+
".": { "require": "./dist/index.cjs", "import": "./dist/index.mjs" },
|
|
146
|
+
"./components": {
|
|
147
|
+
"require": "./dist/components/index.cjs",
|
|
148
|
+
"import": "./dist/components/index.mjs"
|
|
149
|
+
},
|
|
150
|
+
"./components/banner": {
|
|
151
|
+
"require": "./dist/components/banner.cjs",
|
|
152
|
+
"import": "./dist/components/banner.mjs"
|
|
153
|
+
},
|
|
154
|
+
"./types": {
|
|
155
|
+
"require": "./dist/types/index.cjs",
|
|
156
|
+
"import": "./dist/types/index.mjs"
|
|
157
|
+
},
|
|
158
|
+
"./types/plugin": {
|
|
159
|
+
"require": "./dist/types/plugin.cjs",
|
|
160
|
+
"import": "./dist/types/plugin.mjs"
|
|
161
|
+
},
|
|
162
|
+
"./package.json": "./package.json"
|
|
163
|
+
}
|
|
181
164
|
},
|
|
182
|
-
"
|
|
183
|
-
"gitHead": "
|
|
165
|
+
"types": "./dist/index.d.cts",
|
|
166
|
+
"gitHead": "150522912ecb85c5d409659bc146c2c6ae635923"
|
|
184
167
|
}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
const require_rolldown_runtime = require('../../_virtual/rolldown_runtime.cjs');
|
|
2
|
-
let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
3
|
-
let __alloy_js_core = require("@alloy-js/core");
|
|
4
|
-
let __alloy_js_typescript = require("@alloy-js/typescript");
|
|
5
|
-
let __powerlines_plugin_alloy_typescript_components_builtin_file = require("@powerlines/plugin-alloy/typescript/components/builtin-file");
|
|
6
|
-
let __powerlines_plugin_alloy_typescript_components_tsdoc = require("@powerlines/plugin-alloy/typescript/components/tsdoc");
|
|
7
|
-
|
|
8
|
-
//#region src/components/builtin/console.tsx
|
|
9
|
-
/**
|
|
10
|
-
* A built-in console utilities module for Shell Shock.
|
|
11
|
-
*/
|
|
12
|
-
function WriteMessageFunction(props) {
|
|
13
|
-
const { type } = props;
|
|
14
|
-
return [(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDoc, {
|
|
15
|
-
heading: `Write ${type === "error" || type === "info" ? "an" : "a"} ${type ? type === "info" ? "informational" : type : ""} message to the console.`,
|
|
16
|
-
get children() {
|
|
17
|
-
return [
|
|
18
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocRemarks, { children: `This function initializes the Powerlines environment configuration object.` }),
|
|
19
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
|
|
20
|
-
when: !type,
|
|
21
|
-
get children() {
|
|
22
|
-
return (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
|
|
23
|
-
name: "type",
|
|
24
|
-
children: `The type of message to write to the console.`
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
}),
|
|
28
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_tsdoc.TSDocParam, {
|
|
29
|
-
name: "message",
|
|
30
|
-
children: `The message(s) to write to the console.`
|
|
31
|
-
})
|
|
32
|
-
];
|
|
33
|
-
}
|
|
34
|
-
}), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_typescript.FunctionDeclaration, {
|
|
35
|
-
"export": true,
|
|
36
|
-
get name() {
|
|
37
|
-
return `write${type ? type.charAt(0).toUpperCase() + type.slice(1) : "Message"}`;
|
|
38
|
-
},
|
|
39
|
-
get parameters() {
|
|
40
|
-
return [!type && {
|
|
41
|
-
name: "type",
|
|
42
|
-
type: `"success" | "help" | "info" | "warning" | "error" | "fatal"`,
|
|
43
|
-
optional: false
|
|
44
|
-
}, {
|
|
45
|
-
name: "message",
|
|
46
|
-
type: "string",
|
|
47
|
-
optional: false,
|
|
48
|
-
rest: true
|
|
49
|
-
}].filter(Boolean);
|
|
50
|
-
},
|
|
51
|
-
children: __alloy_js_core.code`console.${type === "warning" ? "warn" : type === "error" || type === "fatal" ? "error" : "log"}(...message);`
|
|
52
|
-
})];
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* A built-in console utilities module for Shell Shock.
|
|
56
|
-
*/
|
|
57
|
-
function ConsoleBuiltin() {
|
|
58
|
-
return (0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_builtin_file.BuiltinFile, {
|
|
59
|
-
id: "console",
|
|
60
|
-
description: "A collection of helper utilities to assist in terminal display",
|
|
61
|
-
get children() {
|
|
62
|
-
return [
|
|
63
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(WriteMessageFunction, { type: "success" }),
|
|
64
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(WriteMessageFunction, { type: "help" }),
|
|
65
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(WriteMessageFunction, { type: "info" }),
|
|
66
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(WriteMessageFunction, { type: "warning" }),
|
|
67
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(WriteMessageFunction, { type: "error" }),
|
|
68
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(WriteMessageFunction, { type: "fatal" }),
|
|
69
|
-
(0, __alloy_js_core_jsx_runtime.createComponent)(WriteMessageFunction, {})
|
|
70
|
-
];
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
//#endregion
|
|
76
|
-
exports.ConsoleBuiltin = ConsoleBuiltin;
|
|
77
|
-
exports.WriteMessageFunction = WriteMessageFunction;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
2
|
-
|
|
3
|
-
//#region src/components/builtin/console.d.ts
|
|
4
|
-
interface WriteMessageFunctionProps {
|
|
5
|
-
type?: "success" | "help" | "info" | "warning" | "error" | "fatal";
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* A built-in console utilities module for Shell Shock.
|
|
9
|
-
*/
|
|
10
|
-
declare function WriteMessageFunction(props: WriteMessageFunctionProps): _alloy_js_core0.Children;
|
|
11
|
-
/**
|
|
12
|
-
* A built-in console utilities module for Shell Shock.
|
|
13
|
-
*/
|
|
14
|
-
declare function ConsoleBuiltin(): _alloy_js_core0.Children;
|
|
15
|
-
//#endregion
|
|
16
|
-
export { ConsoleBuiltin, WriteMessageFunction, WriteMessageFunctionProps };
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import * as _alloy_js_core0 from "@alloy-js/core";
|
|
2
|
-
|
|
3
|
-
//#region src/components/builtin/console.d.ts
|
|
4
|
-
interface WriteMessageFunctionProps {
|
|
5
|
-
type?: "success" | "help" | "info" | "warning" | "error" | "fatal";
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* A built-in console utilities module for Shell Shock.
|
|
9
|
-
*/
|
|
10
|
-
declare function WriteMessageFunction(props: WriteMessageFunctionProps): _alloy_js_core0.Children;
|
|
11
|
-
/**
|
|
12
|
-
* A built-in console utilities module for Shell Shock.
|
|
13
|
-
*/
|
|
14
|
-
declare function ConsoleBuiltin(): _alloy_js_core0.Children;
|
|
15
|
-
//#endregion
|
|
16
|
-
export { ConsoleBuiltin, WriteMessageFunction, WriteMessageFunctionProps };
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import { createComponent } from "@alloy-js/core/jsx-runtime";
|
|
2
|
-
import { Show, code } from "@alloy-js/core";
|
|
3
|
-
import { FunctionDeclaration } from "@alloy-js/typescript";
|
|
4
|
-
import { BuiltinFile } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
|
|
5
|
-
import { TSDoc, TSDocParam, TSDocRemarks } from "@powerlines/plugin-alloy/typescript/components/tsdoc";
|
|
6
|
-
|
|
7
|
-
//#region src/components/builtin/console.tsx
|
|
8
|
-
/**
|
|
9
|
-
* A built-in console utilities module for Shell Shock.
|
|
10
|
-
*/
|
|
11
|
-
function WriteMessageFunction(props) {
|
|
12
|
-
const { type } = props;
|
|
13
|
-
return [createComponent(TSDoc, {
|
|
14
|
-
heading: `Write ${type === "error" || type === "info" ? "an" : "a"} ${type ? type === "info" ? "informational" : type : ""} message to the console.`,
|
|
15
|
-
get children() {
|
|
16
|
-
return [
|
|
17
|
-
createComponent(TSDocRemarks, { children: `This function initializes the Powerlines environment configuration object.` }),
|
|
18
|
-
createComponent(Show, {
|
|
19
|
-
when: !type,
|
|
20
|
-
get children() {
|
|
21
|
-
return createComponent(TSDocParam, {
|
|
22
|
-
name: "type",
|
|
23
|
-
children: `The type of message to write to the console.`
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
}),
|
|
27
|
-
createComponent(TSDocParam, {
|
|
28
|
-
name: "message",
|
|
29
|
-
children: `The message(s) to write to the console.`
|
|
30
|
-
})
|
|
31
|
-
];
|
|
32
|
-
}
|
|
33
|
-
}), createComponent(FunctionDeclaration, {
|
|
34
|
-
"export": true,
|
|
35
|
-
get name() {
|
|
36
|
-
return `write${type ? type.charAt(0).toUpperCase() + type.slice(1) : "Message"}`;
|
|
37
|
-
},
|
|
38
|
-
get parameters() {
|
|
39
|
-
return [!type && {
|
|
40
|
-
name: "type",
|
|
41
|
-
type: `"success" | "help" | "info" | "warning" | "error" | "fatal"`,
|
|
42
|
-
optional: false
|
|
43
|
-
}, {
|
|
44
|
-
name: "message",
|
|
45
|
-
type: "string",
|
|
46
|
-
optional: false,
|
|
47
|
-
rest: true
|
|
48
|
-
}].filter(Boolean);
|
|
49
|
-
},
|
|
50
|
-
children: code`console.${type === "warning" ? "warn" : type === "error" || type === "fatal" ? "error" : "log"}(...message);`
|
|
51
|
-
})];
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* A built-in console utilities module for Shell Shock.
|
|
55
|
-
*/
|
|
56
|
-
function ConsoleBuiltin() {
|
|
57
|
-
return createComponent(BuiltinFile, {
|
|
58
|
-
id: "console",
|
|
59
|
-
description: "A collection of helper utilities to assist in terminal display",
|
|
60
|
-
get children() {
|
|
61
|
-
return [
|
|
62
|
-
createComponent(WriteMessageFunction, { type: "success" }),
|
|
63
|
-
createComponent(WriteMessageFunction, { type: "help" }),
|
|
64
|
-
createComponent(WriteMessageFunction, { type: "info" }),
|
|
65
|
-
createComponent(WriteMessageFunction, { type: "warning" }),
|
|
66
|
-
createComponent(WriteMessageFunction, { type: "error" }),
|
|
67
|
-
createComponent(WriteMessageFunction, { type: "fatal" }),
|
|
68
|
-
createComponent(WriteMessageFunction, {})
|
|
69
|
-
];
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
//#endregion
|
|
75
|
-
export { ConsoleBuiltin, WriteMessageFunction };
|