@shell-shock/preset-cli 0.1.1 → 0.1.2

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.
Files changed (31) hide show
  1. package/dist/components/banner-function-declaration.cjs +21 -36
  2. package/dist/components/banner-function-declaration.d.cts +4 -9
  3. package/dist/components/banner-function-declaration.d.cts.map +1 -1
  4. package/dist/components/banner-function-declaration.d.mts +4 -9
  5. package/dist/components/banner-function-declaration.d.mts.map +1 -1
  6. package/dist/components/banner-function-declaration.mjs +21 -36
  7. package/dist/components/banner-function-declaration.mjs.map +1 -1
  8. package/dist/components/command-entry.cjs +90 -0
  9. package/dist/components/command-entry.d.cts +15 -0
  10. package/dist/components/command-entry.d.cts.map +1 -0
  11. package/dist/components/command-entry.d.mts +15 -0
  12. package/dist/components/command-entry.d.mts.map +1 -0
  13. package/dist/components/command-entry.mjs +89 -0
  14. package/dist/components/command-entry.mjs.map +1 -0
  15. package/dist/components/index.cjs +5 -1
  16. package/dist/components/index.d.cts +4 -2
  17. package/dist/components/index.d.mts +4 -2
  18. package/dist/components/index.mjs +3 -1
  19. package/dist/components/virtual-command-entry.cjs +86 -0
  20. package/dist/components/virtual-command-entry.d.cts +15 -0
  21. package/dist/components/virtual-command-entry.d.cts.map +1 -0
  22. package/dist/components/virtual-command-entry.d.mts +15 -0
  23. package/dist/components/virtual-command-entry.d.mts.map +1 -0
  24. package/dist/components/virtual-command-entry.mjs +85 -0
  25. package/dist/components/virtual-command-entry.mjs.map +1 -0
  26. package/dist/index.cjs +9 -6
  27. package/dist/index.d.cts.map +1 -1
  28. package/dist/index.d.mts.map +1 -1
  29. package/dist/index.mjs +8 -5
  30. package/dist/index.mjs.map +1 -1
  31. package/package.json +37 -6
@@ -3,8 +3,8 @@ let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
3
3
  let __alloy_js_core = require("@alloy-js/core");
4
4
  let __alloy_js_typescript = require("@alloy-js/typescript");
5
5
  let __powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
6
- let __shell_shock_core_contexts_command = require("@shell-shock/core/contexts/command");
7
6
  let __shell_shock_core_plugin_utils_context_helpers = require("@shell-shock/core/plugin-utils/context-helpers");
7
+ let __shell_shock_preset_script_components_banner_function_declaration = require("@shell-shock/preset-script/components/banner-function-declaration");
8
8
  let __shell_shock_preset_script_contexts_theme = require("@shell-shock/preset-script/contexts/theme");
9
9
  let cfonts = require("cfonts");
10
10
 
@@ -13,19 +13,17 @@ let cfonts = require("cfonts");
13
13
  * A component to generate the `banner` function in the `shell-shock:console` builtin module.
14
14
  */
15
15
  function BannerFunctionDeclaration(props) {
16
- const { consoleFnName = "log", variant = "primary", title: titleProp } = props;
16
+ const { consoleFnName = "log", variant = "primary", command } = props;
17
17
  const theme = (0, __shell_shock_preset_script_contexts_theme.useTheme)();
18
18
  const context = (0, __powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
19
- const command = (0, __shell_shock_core_contexts_command.useCommand)();
20
19
  const header = (0, __alloy_js_core.computed)(() => `${theme.labels.banner.header[variant] || (0, __shell_shock_core_plugin_utils_context_helpers.getAppTitle)(context)} v${context.packageJson.version || "1.0.0"}`);
21
20
  const description = (0, __alloy_js_core.computed)(() => command?.description || (0, __shell_shock_core_plugin_utils_context_helpers.getAppDescription)(context));
22
21
  const footer = (0, __alloy_js_core.computed)(() => theme.labels.banner.footer[variant]);
23
- const title = (0, __alloy_js_core.computed)(() => titleProp || /(?:cli|command-line|command line)\s+(?:application|app)?$/.test(header.value.toLowerCase()) ? header.value.replace(`v${context.packageJson.version || "1.0.0"}`, "").trim() : `${header.value.replace(`v${context.packageJson.version || "1.0.0"}`, "").trim()} Command-Line Application`);
22
+ const title = (0, __alloy_js_core.computed)(() => (0, __shell_shock_core_plugin_utils_context_helpers.getAppTitle)(context) || /(?:cli|command-line|command line)\s+(?:application|app)?$/.test(header.value.toLowerCase()) ? header.value.replace(`v${context.packageJson.version || "1.0.0"}`, "").trim() : `${header.value.replace(`v${context.packageJson.version || "1.0.0"}`, "").trim()} Command-Line Application`);
24
23
  const titleLines = (0, __alloy_js_core.computed)(() => {
25
24
  const result = (0, cfonts.render)((0, __shell_shock_core_plugin_utils_context_helpers.getAppTitle)(context), {
26
25
  font: "tiny",
27
26
  align: "left",
28
- colors: ["system"],
29
27
  background: "transparent",
30
28
  letterSpacing: 1,
31
29
  lineHeight: 1,
@@ -44,37 +42,24 @@ function BannerFunctionDeclaration(props) {
44
42
  return `Write the ${(0, __shell_shock_core_plugin_utils_context_helpers.getAppTitle)(context)} application banner ${command ? `for the ${command.title} command ` : ""}to the console.`;
45
43
  },
46
44
  get children() {
47
- return __alloy_js_core.code`
48
- if (hasFlag("no-banner") || hasFlag("hide-banner") || isCI || isMinimal) {
49
- return;
50
- }
51
-
52
- const titleLines = [${titleLines.value.map((line) => JSON.stringify(line)).join(", ")}];
53
- const title = Math.max(...titleLines.map(line => stripAnsi(line).trim().length)) > Math.max(process.stdout.columns - ${totalPadding.value}, 0)
54
- ? ["${title.value}"]
55
- : titleLines;
56
-
57
- writeLine(colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].topLeft}") + ${theme.icons.banner.header[variant] ? `colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].top}".repeat(4)) + " " + ${theme.icons.banner.header[variant] ? `colors.text.banner.header.${variant}("${theme.icons.banner.header[variant]}") + " " + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].top}") + " " +` : ""} colors.bold(colors.text.banner.header.${variant}("${header.value}")) + " " + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].top}".repeat(Math.max(process.stdout.columns - ${4 + (theme.icons.banner.header[variant] ? theme.icons.banner.header[variant].length + 3 : 0) + (header.value ? header.value.length + 2 : 0) + bannerPadding.value}, 0)))` : `colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].top}".repeat(Math.max(process.stdout.columns - ${bannerPadding.value}, 0)))`} + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].topRight}"), { consoleFn: console.${consoleFnName} });
58
-
59
- writeLine(colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].left}") + " ".repeat(Math.max(process.stdout.columns - ${bannerPadding.value})) + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].right}"), { consoleFn: console.${consoleFnName} });
60
-
61
- title.map(line => line.trim()).forEach((line) => {
62
- writeLine(colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].left}") + " ".repeat(Math.max(Math.floor((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + colors.text.banner.title.${variant}(line) + " ".repeat(Math.max(Math.ceil((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].right}"), { consoleFn: console.${consoleFnName} });
63
- });
64
-
65
- writeLine(colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].left}") + " ".repeat(Math.max(process.stdout.columns - ${bannerPadding.value})) + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].right}"), { consoleFn: console.${consoleFnName} });
66
-
67
- ${command?.title ? `writeLine(colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].left}") + " ".repeat(Math.max(Math.floor((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + colors.bold(colors.text.banner.command.${variant}("${command.title}")) + " ".repeat(Math.max(Math.ceil((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].right}"), { consoleFn: console.${consoleFnName} }); ` : ""}
68
-
69
- splitText(
70
- ${command?.title ? "colors.text.banner.description" : "colors.text.banner.command"}.${variant}("${description.value.replace(/"/g, "\\\"")}"),
71
- Math.max(process.stdout.columns - ${totalPadding.value}, 0)
72
- ).forEach((line) => {
73
- writeLine(colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].left}") + " ".repeat(Math.max(Math.floor((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + colors.text.banner.description.${variant}(line) + " ".repeat(Math.max(Math.ceil((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].right}"), { consoleFn: console.${consoleFnName} });
74
- });
75
-
76
- writeLine(colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].bottomLeft}") + ${footer.value ? `colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].bottom}".repeat(Math.max(process.stdout.columns - ${6 + (footer.value ? footer.value.length : 0) + bannerPadding.value}, 0))) + " " + ${footer.value ? `colors.bold(colors.text.banner.footer.${variant}("${footer.value}"))` : ""} + " " + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].bottom}".repeat(4))` : `colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].bottom}".repeat(Math.max(process.stdout.columns - ${bannerPadding.value}, 0)))`} + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].bottomRight}"), { consoleFn: console.${consoleFnName} });
77
- `;
45
+ return (0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_banner_function_declaration.BannerFunctionBodyDeclaration, {
46
+ get header() {
47
+ return header.value;
48
+ },
49
+ get description() {
50
+ return description.value;
51
+ },
52
+ get footer() {
53
+ return footer.value;
54
+ },
55
+ variant,
56
+ consoleFnName,
57
+ command,
58
+ get children() {
59
+ return __alloy_js_core.code`const titleLines = [${titleLines.value.map((line) => JSON.stringify(line.trim())).join(", ")}];
60
+ const title = Math.max(...titleLines.map(line => stripAnsi(line).length)) > Math.max(process.stdout.columns - ${totalPadding.value}, 0) ? "${title.value}" : \`\\n\${titleLines.join("\\n")}\\n\`; `;
61
+ }
62
+ });
78
63
  }
79
64
  })];
80
65
  }
@@ -1,16 +1,11 @@
1
- import * as _alloy_js_core0 from "@alloy-js/core";
2
- import { ThemeColorVariant } from "@shell-shock/plugin-theme/types/theme";
1
+ import * as _alloy_js_core1 from "@alloy-js/core";
2
+ import { BannerFunctionDeclarationProps } from "@shell-shock/preset-script/components/banner-function-declaration";
3
3
 
4
4
  //#region src/components/banner-function-declaration.d.ts
5
- interface BannerFunctionDeclarationProps {
6
- variant?: ThemeColorVariant;
7
- consoleFnName?: "log" | "info" | "warn" | "error" | "debug";
8
- title?: string;
9
- }
10
5
  /**
11
6
  * A component to generate the `banner` function in the `shell-shock:console` builtin module.
12
7
  */
13
- declare function BannerFunctionDeclaration(props: BannerFunctionDeclarationProps): _alloy_js_core0.Children;
8
+ declare function BannerFunctionDeclaration(props: BannerFunctionDeclarationProps): _alloy_js_core1.Children;
14
9
  //#endregion
15
- export { BannerFunctionDeclaration, BannerFunctionDeclarationProps };
10
+ export { BannerFunctionDeclaration };
16
11
  //# sourceMappingURL=banner-function-declaration.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"banner-function-declaration.d.cts","names":[],"sources":["../../src/components/banner-function-declaration.tsx"],"sourcesContent":[],"mappings":";;;;UA+BiB,8BAAA;YACL;;EADK,KAAA,CAAA,EAAA,MAAA;AASjB;;;;iBAAgB,yBAAA,QACP,iCAA8B,eAAA,CAAA"}
1
+ {"version":3,"file":"banner-function-declaration.d.cts","names":[],"sources":["../../src/components/banner-function-declaration.tsx"],"sourcesContent":[],"mappings":";;;;;;;AAkCgB,iBAAA,yBAAA,CACP,KAAA,EAAA,8BAA8B,CAAA,EAAA,eAAA,CAAA,QAAA"}
@@ -1,16 +1,11 @@
1
- import * as _alloy_js_core0 from "@alloy-js/core";
2
- import { ThemeColorVariant } from "@shell-shock/plugin-theme/types/theme";
1
+ import * as _alloy_js_core1 from "@alloy-js/core";
2
+ import { BannerFunctionDeclarationProps } from "@shell-shock/preset-script/components/banner-function-declaration";
3
3
 
4
4
  //#region src/components/banner-function-declaration.d.ts
5
- interface BannerFunctionDeclarationProps {
6
- variant?: ThemeColorVariant;
7
- consoleFnName?: "log" | "info" | "warn" | "error" | "debug";
8
- title?: string;
9
- }
10
5
  /**
11
6
  * A component to generate the `banner` function in the `shell-shock:console` builtin module.
12
7
  */
13
- declare function BannerFunctionDeclaration(props: BannerFunctionDeclarationProps): _alloy_js_core0.Children;
8
+ declare function BannerFunctionDeclaration(props: BannerFunctionDeclarationProps): _alloy_js_core1.Children;
14
9
  //#endregion
15
- export { BannerFunctionDeclaration, BannerFunctionDeclarationProps };
10
+ export { BannerFunctionDeclaration };
16
11
  //# sourceMappingURL=banner-function-declaration.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"banner-function-declaration.d.mts","names":[],"sources":["../../src/components/banner-function-declaration.tsx"],"sourcesContent":[],"mappings":";;;;UA+BiB,8BAAA;YACL;;EADK,KAAA,CAAA,EAAA,MAAA;AASjB;;;;iBAAgB,yBAAA,QACP,iCAA8B,eAAA,CAAA"}
1
+ {"version":3,"file":"banner-function-declaration.d.mts","names":[],"sources":["../../src/components/banner-function-declaration.tsx"],"sourcesContent":[],"mappings":";;;;;;;AAkCgB,iBAAA,yBAAA,CACP,KAAA,EAAA,8BAA8B,CAAA,EAAA,eAAA,CAAA,QAAA"}
@@ -2,8 +2,8 @@ import { createComponent } from "@alloy-js/core/jsx-runtime";
2
2
  import { code, computed } from "@alloy-js/core";
3
3
  import { FunctionDeclaration } from "@alloy-js/typescript";
4
4
  import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
5
- import { useCommand } from "@shell-shock/core/contexts/command";
6
5
  import { getAppDescription, getAppTitle } from "@shell-shock/core/plugin-utils/context-helpers";
6
+ import { BannerFunctionBodyDeclaration } from "@shell-shock/preset-script/components/banner-function-declaration";
7
7
  import { useTheme } from "@shell-shock/preset-script/contexts/theme";
8
8
  import { render } from "cfonts";
9
9
 
@@ -12,19 +12,17 @@ import { render } from "cfonts";
12
12
  * A component to generate the `banner` function in the `shell-shock:console` builtin module.
13
13
  */
14
14
  function BannerFunctionDeclaration(props) {
15
- const { consoleFnName = "log", variant = "primary", title: titleProp } = props;
15
+ const { consoleFnName = "log", variant = "primary", command } = props;
16
16
  const theme = useTheme();
17
17
  const context = usePowerlines();
18
- const command = useCommand();
19
18
  const header = computed(() => `${theme.labels.banner.header[variant] || getAppTitle(context)} v${context.packageJson.version || "1.0.0"}`);
20
19
  const description = computed(() => command?.description || getAppDescription(context));
21
20
  const footer = computed(() => theme.labels.banner.footer[variant]);
22
- const title = computed(() => titleProp || /(?:cli|command-line|command line)\s+(?:application|app)?$/.test(header.value.toLowerCase()) ? header.value.replace(`v${context.packageJson.version || "1.0.0"}`, "").trim() : `${header.value.replace(`v${context.packageJson.version || "1.0.0"}`, "").trim()} Command-Line Application`);
21
+ const title = computed(() => getAppTitle(context) || /(?:cli|command-line|command line)\s+(?:application|app)?$/.test(header.value.toLowerCase()) ? header.value.replace(`v${context.packageJson.version || "1.0.0"}`, "").trim() : `${header.value.replace(`v${context.packageJson.version || "1.0.0"}`, "").trim()} Command-Line Application`);
23
22
  const titleLines = computed(() => {
24
23
  const result = render(getAppTitle(context), {
25
24
  font: "tiny",
26
25
  align: "left",
27
- colors: ["system"],
28
26
  background: "transparent",
29
27
  letterSpacing: 1,
30
28
  lineHeight: 1,
@@ -43,37 +41,24 @@ function BannerFunctionDeclaration(props) {
43
41
  return `Write the ${getAppTitle(context)} application banner ${command ? `for the ${command.title} command ` : ""}to the console.`;
44
42
  },
45
43
  get children() {
46
- return code`
47
- if (hasFlag("no-banner") || hasFlag("hide-banner") || isCI || isMinimal) {
48
- return;
49
- }
50
-
51
- const titleLines = [${titleLines.value.map((line) => JSON.stringify(line)).join(", ")}];
52
- const title = Math.max(...titleLines.map(line => stripAnsi(line).trim().length)) > Math.max(process.stdout.columns - ${totalPadding.value}, 0)
53
- ? ["${title.value}"]
54
- : titleLines;
55
-
56
- writeLine(colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].topLeft}") + ${theme.icons.banner.header[variant] ? `colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].top}".repeat(4)) + " " + ${theme.icons.banner.header[variant] ? `colors.text.banner.header.${variant}("${theme.icons.banner.header[variant]}") + " " + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].top}") + " " +` : ""} colors.bold(colors.text.banner.header.${variant}("${header.value}")) + " " + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].top}".repeat(Math.max(process.stdout.columns - ${4 + (theme.icons.banner.header[variant] ? theme.icons.banner.header[variant].length + 3 : 0) + (header.value ? header.value.length + 2 : 0) + bannerPadding.value}, 0)))` : `colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].top}".repeat(Math.max(process.stdout.columns - ${bannerPadding.value}, 0)))`} + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].topRight}"), { consoleFn: console.${consoleFnName} });
57
-
58
- writeLine(colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].left}") + " ".repeat(Math.max(process.stdout.columns - ${bannerPadding.value})) + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].right}"), { consoleFn: console.${consoleFnName} });
59
-
60
- title.map(line => line.trim()).forEach((line) => {
61
- writeLine(colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].left}") + " ".repeat(Math.max(Math.floor((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + colors.text.banner.title.${variant}(line) + " ".repeat(Math.max(Math.ceil((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].right}"), { consoleFn: console.${consoleFnName} });
62
- });
63
-
64
- writeLine(colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].left}") + " ".repeat(Math.max(process.stdout.columns - ${bannerPadding.value})) + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].right}"), { consoleFn: console.${consoleFnName} });
65
-
66
- ${command?.title ? `writeLine(colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].left}") + " ".repeat(Math.max(Math.floor((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + colors.bold(colors.text.banner.command.${variant}("${command.title}")) + " ".repeat(Math.max(Math.ceil((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].right}"), { consoleFn: console.${consoleFnName} }); ` : ""}
67
-
68
- splitText(
69
- ${command?.title ? "colors.text.banner.description" : "colors.text.banner.command"}.${variant}("${description.value.replace(/"/g, "\\\"")}"),
70
- Math.max(process.stdout.columns - ${totalPadding.value}, 0)
71
- ).forEach((line) => {
72
- writeLine(colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].left}") + " ".repeat(Math.max(Math.floor((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + colors.text.banner.description.${variant}(line) + " ".repeat(Math.max(Math.ceil((process.stdout.columns - (stripAnsi(line).length + ${bannerPadding.value})) / 2), 0)) + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].right}"), { consoleFn: console.${consoleFnName} });
73
- });
74
-
75
- writeLine(colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].bottomLeft}") + ${footer.value ? `colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].bottom}".repeat(Math.max(process.stdout.columns - ${6 + (footer.value ? footer.value.length : 0) + bannerPadding.value}, 0))) + " " + ${footer.value ? `colors.bold(colors.text.banner.footer.${variant}("${footer.value}"))` : ""} + " " + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].bottom}".repeat(4))` : `colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].bottom}".repeat(Math.max(process.stdout.columns - ${bannerPadding.value}, 0)))`} + colors.border.banner.outline.${variant}("${theme.borderStyles.banner.outline[variant].bottomRight}"), { consoleFn: console.${consoleFnName} });
76
- `;
44
+ return createComponent(BannerFunctionBodyDeclaration, {
45
+ get header() {
46
+ return header.value;
47
+ },
48
+ get description() {
49
+ return description.value;
50
+ },
51
+ get footer() {
52
+ return footer.value;
53
+ },
54
+ variant,
55
+ consoleFnName,
56
+ command,
57
+ get children() {
58
+ return code`const titleLines = [${titleLines.value.map((line) => JSON.stringify(line.trim())).join(", ")}];
59
+ const title = Math.max(...titleLines.map(line => stripAnsi(line).length)) > Math.max(process.stdout.columns - ${totalPadding.value}, 0) ? "${title.value}" : \`\\n\${titleLines.join("\\n")}\\n\`; `;
60
+ }
61
+ });
77
62
  }
78
63
  })];
79
64
  }
@@ -1 +1 @@
1
- {"version":3,"file":"banner-function-declaration.mjs","names":["code","computed","FunctionDeclaration","usePowerlines","useCommand","getAppDescription","getAppTitle","useTheme","render","BannerFunctionDeclaration","props","consoleFnName","variant","title","titleProp","theme","context","command","header","labels","banner","packageJson","version","description","footer","test","value","toLowerCase","replace","trim","titleLines","result","font","align","colors","background","letterSpacing","lineHeight","gradient","transitionGradient","env","array","bannerPadding","Math","max","padding","app","borderStyles","outline","left","length","right","totalPadding","_$createComponent","name","doc","children","map","line","JSON","stringify","join","topLeft","icons","top","topRight","bottomLeft","bottom","bottomRight"],"sources":["../../src/components/banner-function-declaration.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, computed } from \"@alloy-js/core\";\nimport { FunctionDeclaration } from \"@alloy-js/typescript\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport { useCommand } from \"@shell-shock/core/contexts/command\";\nimport {\n getAppDescription,\n getAppTitle\n} from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport type { ThemeColorVariant } from \"@shell-shock/plugin-theme/types/theme\";\nimport { useTheme } from \"@shell-shock/preset-script/contexts/theme\";\nimport { render } from \"cfonts\";\nimport type { CLIPresetContext } from \"../types/plugin\";\n\nexport interface BannerFunctionDeclarationProps {\n variant?: ThemeColorVariant;\n consoleFnName?: \"log\" | \"info\" | \"warn\" | \"error\" | \"debug\";\n title?: string;\n}\n\n/**\n * A component to generate the `banner` function in the `shell-shock:console` builtin module.\n */\nexport function BannerFunctionDeclaration(\n props: BannerFunctionDeclarationProps\n) {\n const {\n consoleFnName = \"log\",\n variant = \"primary\",\n title: titleProp\n } = props;\n\n const theme = useTheme();\n\n const context = usePowerlines<CLIPresetContext>();\n const command = useCommand();\n\n const header = computed(\n () =>\n `${theme.labels.banner.header[variant] || getAppTitle(context)} v${context.packageJson.version || \"1.0.0\"}`\n );\n const description = computed(\n () => command?.description || getAppDescription(context)\n );\n const footer = computed(() => theme.labels.banner.footer[variant]);\n\n const title = computed(() =>\n titleProp ||\n /(?:cli|command-line|command line)\\s+(?:application|app)?$/.test(\n header.value.toLowerCase()\n )\n ? header.value\n .replace(`v${context.packageJson.version || \"1.0.0\"}`, \"\")\n .trim()\n : `${header.value\n .replace(`v${context.packageJson.version || \"1.0.0\"}`, \"\")\n .trim()} Command-Line Application`\n );\n\n const titleLines = computed(() => {\n const result = render(getAppTitle(context), {\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 if (!result) {\n return [getAppTitle(context)];\n }\n\n return result.array;\n });\n\n const bannerPadding = computed(\n () =>\n Math.max(theme.padding.app, 0) * 2 +\n theme.borderStyles.banner.outline[variant].left.length +\n theme.borderStyles.banner.outline[variant].right.length\n );\n const totalPadding = computed(\n () => Math.max(theme.padding.banner, 0) * 2 + bannerPadding.value\n );\n\n return (\n <>\n <FunctionDeclaration\n name=\"banner\"\n doc={`Write the ${getAppTitle(context)} application banner ${\n command ? `for the ${command.title} command ` : \"\"\n }to the console.`}>\n {code`\n if (hasFlag(\"no-banner\") || hasFlag(\"hide-banner\") || isCI || isMinimal) {\n return;\n }\n\n const titleLines = [${titleLines.value\n .map(line => JSON.stringify(line))\n .join(\", \")}];\n const title = Math.max(...titleLines.map(line => stripAnsi(line).trim().length)) > Math.max(process.stdout.columns - ${\n totalPadding.value\n }, 0)\n ? [\"${title.value}\"]\n : titleLines;\n\n writeLine(colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].topLeft\n }\") + ${\n theme.icons.banner.header[variant]\n ? `colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].top\n }\".repeat(4)) + \" \" + ${\n theme.icons.banner.header[variant]\n ? `colors.text.banner.header.${variant}(\"${\n theme.icons.banner.header[variant]\n }\") + \" \" + colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].top\n }\") + \" \" +`\n : \"\"\n } colors.bold(colors.text.banner.header.${variant}(\"${\n header.value\n }\")) + \" \" + colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].top\n }\".repeat(Math.max(process.stdout.columns - ${\n 4 +\n (theme.icons.banner.header[variant]\n ? theme.icons.banner.header[variant].length + 3\n : 0) +\n (header.value ? header.value.length + 2 : 0) +\n bannerPadding.value\n }, 0)))`\n : `colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].top\n }\".repeat(Math.max(process.stdout.columns - ${\n bannerPadding.value\n }, 0)))`\n } + colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].topRight\n }\"), { consoleFn: console.${consoleFnName} });\n\n writeLine(colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].left\n }\") + \" \".repeat(Math.max(process.stdout.columns - ${\n bannerPadding.value\n })) + colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].right\n }\"), { consoleFn: console.${consoleFnName} });\n\n title.map(line => line.trim()).forEach((line) => {\n writeLine(colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].left\n }\") + \" \".repeat(Math.max(Math.floor((process.stdout.columns - (stripAnsi(line).length + ${\n bannerPadding.value\n })) / 2), 0)) + colors.text.banner.title.${\n variant\n }(line) + \" \".repeat(Math.max(Math.ceil((process.stdout.columns - (stripAnsi(line).length + ${\n bannerPadding.value\n })) / 2), 0)) + colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].right\n }\"), { consoleFn: console.${consoleFnName} });\n });\n\n writeLine(colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].left\n }\") + \" \".repeat(Math.max(process.stdout.columns - ${\n bannerPadding.value\n })) + colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].right\n }\"), { consoleFn: console.${consoleFnName} });\n\n ${\n command?.title\n ? `writeLine(colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].left\n }\") + \" \".repeat(Math.max(Math.floor((process.stdout.columns - (stripAnsi(line).length + ${\n bannerPadding.value\n })) / 2), 0)) + colors.bold(colors.text.banner.command.${\n variant\n }(\"${command.title}\")) + \" \".repeat(Math.max(Math.ceil((process.stdout.columns - (stripAnsi(line).length + ${\n bannerPadding.value\n })) / 2), 0)) + colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].right\n }\"), { consoleFn: console.${consoleFnName} }); `\n : \"\"\n }\n\n splitText(\n ${\n command?.title\n ? \"colors.text.banner.description\"\n : \"colors.text.banner.command\"\n }.${variant}(\"${description.value.replace(/\"/g, '\\\\\"')}\"),\n Math.max(process.stdout.columns - ${totalPadding.value}, 0)\n ).forEach((line) => {\n writeLine(colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].left\n }\") + \" \".repeat(Math.max(Math.floor((process.stdout.columns - (stripAnsi(line).length + ${\n bannerPadding.value\n })) / 2), 0)) + colors.text.banner.description.${variant}(line) + \" \".repeat(Math.max(Math.ceil((process.stdout.columns - (stripAnsi(line).length + ${\n bannerPadding.value\n })) / 2), 0)) + colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].right\n }\"), { consoleFn: console.${consoleFnName} });\n });\n\n writeLine(colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].bottomLeft\n }\") + ${\n footer.value\n ? `colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].bottom\n }\".repeat(Math.max(process.stdout.columns - ${\n 6 +\n (footer.value ? footer.value.length : 0) +\n bannerPadding.value\n }, 0))) + \" \" + ${\n footer.value\n ? `colors.bold(colors.text.banner.footer.${variant}(\"${footer.value}\"))`\n : \"\"\n } + \" \" + colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].bottom\n }\".repeat(4))`\n : `colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].bottom\n }\".repeat(Math.max(process.stdout.columns - ${\n bannerPadding.value\n }, 0)))`\n } + colors.border.banner.outline.${variant}(\"${\n theme.borderStyles.banner.outline[variant].bottomRight\n }\"), { consoleFn: console.${consoleFnName} });\n`}\n </FunctionDeclaration>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAwCA,SAAgBS,0BACdC,OACA;CACA,MAAM,EACJC,gBAAgB,OAChBC,UAAU,WACVC,OAAOC,cACLJ;CAEJ,MAAMK,QAAQR,UAAU;CAExB,MAAMS,UAAUb,eAAiC;CACjD,MAAMc,UAAUb,YAAY;CAE5B,MAAMc,SAASjB,eAEX,GAAGc,MAAMI,OAAOC,OAAOF,OAAON,YAAYN,YAAYU,QAAQ,CAAA,IAAKA,Q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AE,wCACiCd,QAAO,IAC9CG,MAAMgC,aAAa3B,OAAO4B,QAAQpC,SAASuD,OAAM,gBAEnD,gCAAgCvD,QAAO,IACrCG,MAAMgC,aAAa3B,OAAO4B,QAAQpC,SAASuD,OAAM,6CAEjDzB,cAAchB,MAAK,QACb,kCACqBd,QAAO,IACxCG,MAAMgC,aAAa3B,OAAO4B,QAAQpC,SAASwD,YAAW,2BAC5BzD,cAAa;;;EAChD,CAAA,CAAA"}
1
+ {"version":3,"file":"banner-function-declaration.mjs","names":["code","computed","FunctionDeclaration","usePowerlines","getAppDescription","getAppTitle","BannerFunctionBodyDeclaration","useTheme","render","BannerFunctionDeclaration","props","consoleFnName","variant","command","theme","context","header","labels","banner","packageJson","version","description","footer","title","test","value","toLowerCase","replace","trim","titleLines","result","font","align","background","letterSpacing","lineHeight","gradient","transitionGradient","env","array","bannerPadding","Math","max","padding","app","borderStyles","outline","left","length","right","totalPadding","_$createComponent","name","doc","children","map","line","JSON","stringify","join"],"sources":["../../src/components/banner-function-declaration.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, computed } from \"@alloy-js/core\";\nimport { FunctionDeclaration } from \"@alloy-js/typescript\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport {\n getAppDescription,\n getAppTitle\n} from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport type { BannerFunctionDeclarationProps } from \"@shell-shock/preset-script/components/banner-function-declaration\";\nimport { BannerFunctionBodyDeclaration } from \"@shell-shock/preset-script/components/banner-function-declaration\";\nimport { useTheme } from \"@shell-shock/preset-script/contexts/theme\";\nimport { render } from \"cfonts\";\nimport type { CLIPresetContext } from \"../types/plugin\";\n\n/**\n * A component to generate the `banner` function in the `shell-shock:console` builtin module.\n */\nexport function BannerFunctionDeclaration(\n props: BannerFunctionDeclarationProps\n) {\n const { consoleFnName = \"log\", variant = \"primary\", command } = props;\n\n const theme = useTheme();\n\n const context = usePowerlines<CLIPresetContext>();\n\n const header = computed(\n () =>\n `${theme.labels.banner.header[variant] || getAppTitle(context)} v${context.packageJson.version || \"1.0.0\"}`\n );\n const description = computed(\n () => command?.description || getAppDescription(context)\n );\n const footer = computed(() => theme.labels.banner.footer[variant]);\n\n const title = computed(() =>\n getAppTitle(context) ||\n /(?:cli|command-line|command line)\\s+(?:application|app)?$/.test(\n header.value.toLowerCase()\n )\n ? header.value\n .replace(`v${context.packageJson.version || \"1.0.0\"}`, \"\")\n .trim()\n : `${header.value\n .replace(`v${context.packageJson.version || \"1.0.0\"}`, \"\")\n .trim()} Command-Line Application`\n );\n\n const titleLines = computed(() => {\n const result = render(getAppTitle(context), {\n font: \"tiny\",\n align: \"left\",\n background: \"transparent\",\n letterSpacing: 1,\n lineHeight: 1,\n gradient: false,\n transitionGradient: false,\n env: \"node\"\n });\n if (!result) {\n return [getAppTitle(context)];\n }\n\n return result.array;\n });\n\n const bannerPadding = computed(\n () =>\n Math.max(theme.padding.app, 0) * 2 +\n theme.borderStyles.banner.outline[variant].left.length +\n theme.borderStyles.banner.outline[variant].right.length\n );\n const totalPadding = computed(\n () => Math.max(theme.padding.banner, 0) * 2 + bannerPadding.value\n );\n\n return (\n <>\n <FunctionDeclaration\n name=\"banner\"\n doc={`Write the ${getAppTitle(context)} application banner ${\n command ? `for the ${command.title} command ` : \"\"\n }to the console.`}>\n <BannerFunctionBodyDeclaration\n header={header.value}\n description={description.value}\n footer={footer.value}\n variant={variant}\n consoleFnName={consoleFnName}\n command={command}>\n {code`const titleLines = [${titleLines.value\n .map(line => JSON.stringify(line.trim()))\n .join(\", \")}];\n const title = Math.max(...titleLines.map(line => stripAnsi(line).length)) > Math.max(process.stdout.columns - ${\n totalPadding.value\n }, 0) ? \"${title.value}\" : \\`\\\\n\\${titleLines.join(\"\\\\n\")}\\\\n\\`; `}\n </BannerFunctionBodyDeclaration>\n </FunctionDeclaration>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAkCA,SAAgBS,0BACdC,OACA;CACA,MAAM,EAAEC,gBAAgB,OAAOC,UAAU,WAAWC,YAAYH;CAEhE,MAAMI,QAAQP,UAAU;CAExB,MAAMQ,UAAUZ,eAAiC;CAEjD,MAAMa,SAASf,eAEX,GAAGa,MAAMG,OAAOC,OAAOF,OAAOJ,YAAYP,YAAYU,QAAQ,CAAA,IAAKA,QAAQI,YAAYC,WAAW,UACrG;CACD,MAAMC,cAAcpB,eACZY,SAASQ,eAAejB,kBAAkBW,QAClD,CAAC;CACD,MAAMO,SAASrB,eAAea,MAAMG,OAAOC,OAAOI,OAAOV,SAAS;CAElE,MAAMW,QAAQtB,eACZI,YAAYU,QAAQ,IACpB,4DAA4DS,KAC1DR,OAAOS,MAAMC,aACf,CAAC,GACGV,OAAOS,MACJE,QAAQ,IAAIZ,QAAQI,YAAYC,WAAW,WAAW,GAAG,CACzDQ,MAAM,GACT,GAAGZ,OAAOS,MACPE,QAAQ,IAAIZ,QAAQI,YAAYC,WAAW,WAAW,GAAG,CACzDQ,MAAM,CAAA,2BACd;CAED,MAAMC,aAAa5B,eAAe;EAChC,MAAM6B,SAAStB,OAAOH,YAAYU,QAAQ,EAAE;GAC1CgB,MAAM;GACNC,OAAO;GACPC,YAAY;GACZC,eAAe;GACfC,YAAY;GACZC,UAAU;GACVC,oBAAoB;GACpBC,KAAK;GACN,CAAC;AACF,MAAI,CAACR,OACH,QAAO,CAACzB,YAAYU,QAAQ,CAAC;AAG/B,SAAOe,OAAOS;GACd;CAEF,MAAMC,gBAAgBvC,eAElBwC,KAAKC,IAAI5B,MAAM6B,QAAQC,KAAK,EAAE,GAAG,IACjC9B,MAAM+B,aAAa3B,OAAO4B,QAAQlC,SAASmC,KAAKC,SAChDlC,MAAM+B,aAAa3B,OAAO4B,QAAQlC,SAASqC,MAAMD,OACpD;CACD,MAAME,eAAejD,eACbwC,KAAKC,IAAI5B,MAAM6B,QAAQzB,QAAQ,EAAE,GAAG,IAAIsB,cAAcf,MAC7D;AAED,QAAA,CAAA0B,gBAEKjD,qBAAmB;EAClBkD,MAAI;EAAA,IACJC,MAAG;AAAA,UAAE,aAAahD,YAAYU,QAAQ,CAAA,sBACpCF,UAAU,WAAWA,QAAQU,MAAK,aAAc,GAAE;;EACnC,IAAA+B,WAAA;AAAA,UAAAH,gBAChB7C,+BAA6B;IAAA,IAC5BU,SAAM;AAAA,YAAEA,OAAOS;;IAAK,IACpBJ,cAAW;AAAA,YAAEA,YAAYI;;IAAK,IAC9BH,SAAM;AAAA,YAAEA,OAAOG;;IACNb;IACMD;IACNE;IAAO,IAAAyC,WAAA;AAAA,YACftD,IAAI,uBAAuB6B,WAAWJ,MACpC8B,KAAIC,SAAQC,KAAKC,UAAUF,KAAK5B,MAAM,CAAC,CAAC,CACxC+B,KAAK,KAAK,CAAA;wHAEbT,aAAazB,MAAK,UACTF,MAAME,MAAK;;IAA4C,CAAA;;EAAA,CAAA,CAAA"}
@@ -0,0 +1,90 @@
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ const require_components_banner_function_declaration = require('./banner-function-declaration.cjs');
3
+ const require_components_virtual_command_entry = require('./virtual-command-entry.cjs');
4
+ let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
5
+ let __alloy_js_core = require("@alloy-js/core");
6
+ let __powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
7
+ let __shell_shock_core_plugin_utils_context_helpers = require("@shell-shock/core/plugin-utils/context-helpers");
8
+ let __powerlines_plugin_alloy_typescript_components_entry_file = require("@powerlines/plugin-alloy/typescript/components/entry-file");
9
+ let __shell_shock_core_components_options_parser_logic = require("@shell-shock/core/components/options-parser-logic");
10
+ let __shell_shock_preset_script_components_command_entry = require("@shell-shock/preset-script/components/command-entry");
11
+ let __stryke_path_find = require("@stryke/path/find");
12
+ let __stryke_path_join = require("@stryke/path/join");
13
+ let __stryke_path_replace = require("@stryke/path/replace");
14
+ let __stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
15
+ let defu = require("defu");
16
+ defu = require_rolldown_runtime.__toESM(defu);
17
+
18
+ //#region src/components/command-entry.tsx
19
+ /**
20
+ * The command entry point for the Shell Shock project.
21
+ */
22
+ function CommandEntry(props) {
23
+ const { command, imports, builtinImports, ...rest } = props;
24
+ const context = (0, __powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
25
+ const filePath = (0, __alloy_js_core.computed)(() => (0, __stryke_path_join.joinPaths)(command.path.segments.filter((segment) => !(0, __shell_shock_core_plugin_utils_context_helpers.isPositionalCommandOption)(segment)).join("/"), "index.ts"));
26
+ const commandSourcePath = (0, __alloy_js_core.computed)(() => (0, __stryke_path_replace.replaceExtension)((0, __stryke_path_find.relativePath)((0, __stryke_path_join.joinPaths)(context.entryPath, (0, __stryke_path_find.findFilePath)(filePath.value)), command.entry.input?.file || command.entry.file)));
27
+ const typeDefinition = (0, __alloy_js_core.computed)(() => ({
28
+ ...command.entry,
29
+ output: command.id
30
+ }));
31
+ return [(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_entry_file.EntryFile, (0, __alloy_js_core_jsx_runtime.mergeProps)(rest, {
32
+ get path() {
33
+ return filePath.value;
34
+ },
35
+ get typeDefinition() {
36
+ return typeDefinition.value;
37
+ },
38
+ get imports() {
39
+ return (0, defu.default)(imports ?? {}, { [commandSourcePath.value]: `handle${(0, __stryke_string_format_pascal_case.pascalCase)(command.name)}` });
40
+ },
41
+ get builtinImports() {
42
+ return (0, defu.default)(builtinImports ?? {}, {
43
+ env: ["env", "isCI"],
44
+ console: [
45
+ "warn",
46
+ "error",
47
+ "table",
48
+ "colors",
49
+ "stripAnsi",
50
+ "writeLine",
51
+ "splitText"
52
+ ],
53
+ utils: [
54
+ "getArgs",
55
+ "hasFlag",
56
+ "isMinimal"
57
+ ]
58
+ });
59
+ },
60
+ get children() {
61
+ return [
62
+ (0, __alloy_js_core_jsx_runtime.createComponent)(require_components_banner_function_declaration.BannerFunctionDeclaration, { command }),
63
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
64
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
65
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_core_components_options_parser_logic.OptionsInterfaceDeclaration, { command }),
66
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
67
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
68
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_command_entry.CommandHandlerDeclaration, { command })
69
+ ];
70
+ }
71
+ })), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
72
+ get each() {
73
+ return Object.values(command.children);
74
+ },
75
+ children: (child) => (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
76
+ get when() {
77
+ return child.isVirtual;
78
+ },
79
+ get fallback() {
80
+ return (0, __alloy_js_core_jsx_runtime.createComponent)(CommandEntry, { command: child });
81
+ },
82
+ get children() {
83
+ return (0, __alloy_js_core_jsx_runtime.createComponent)(require_components_virtual_command_entry.VirtualCommandEntry, { command: child });
84
+ }
85
+ })
86
+ })];
87
+ }
88
+
89
+ //#endregion
90
+ exports.CommandEntry = CommandEntry;
@@ -0,0 +1,15 @@
1
+ import * as _alloy_js_core0 from "@alloy-js/core";
2
+ import { EntryFileProps } from "@powerlines/plugin-alloy/typescript/components/entry-file";
3
+ import { CommandTree } from "@shell-shock/core/types/command";
4
+
5
+ //#region src/components/command-entry.d.ts
6
+ interface CommandEntryProps extends Omit<EntryFileProps, "path" | "typeDefinition"> {
7
+ command: CommandTree;
8
+ }
9
+ /**
10
+ * The command entry point for the Shell Shock project.
11
+ */
12
+ declare function CommandEntry(props: CommandEntryProps): _alloy_js_core0.Children;
13
+ //#endregion
14
+ export { CommandEntry, CommandEntryProps };
15
+ //# sourceMappingURL=command-entry.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command-entry.d.cts","names":[],"sources":["../../src/components/command-entry.tsx"],"sourcesContent":[],"mappings":";;;;;UAmCiB,iBAAA,SAA0B,KACzC;WAGS;;AAJX;;;AAA2C,iBAU3B,YAAA,CAV2B,KAAA,EAUP,iBAVO,CAAA,EAUU,eAAA,CAAA,QAVV"}
@@ -0,0 +1,15 @@
1
+ import * as _alloy_js_core0 from "@alloy-js/core";
2
+ import { EntryFileProps } from "@powerlines/plugin-alloy/typescript/components/entry-file";
3
+ import { CommandTree } from "@shell-shock/core/types/command";
4
+
5
+ //#region src/components/command-entry.d.ts
6
+ interface CommandEntryProps extends Omit<EntryFileProps, "path" | "typeDefinition"> {
7
+ command: CommandTree;
8
+ }
9
+ /**
10
+ * The command entry point for the Shell Shock project.
11
+ */
12
+ declare function CommandEntry(props: CommandEntryProps): _alloy_js_core0.Children;
13
+ //#endregion
14
+ export { CommandEntry, CommandEntryProps };
15
+ //# sourceMappingURL=command-entry.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command-entry.d.mts","names":[],"sources":["../../src/components/command-entry.tsx"],"sourcesContent":[],"mappings":";;;;;UAmCiB,iBAAA,SAA0B,KACzC;WAGS;;AAJX;;;AAA2C,iBAU3B,YAAA,CAV2B,KAAA,EAUP,iBAVO,CAAA,EAUU,eAAA,CAAA,QAVV"}
@@ -0,0 +1,89 @@
1
+ import { BannerFunctionDeclaration } from "./banner-function-declaration.mjs";
2
+ import { VirtualCommandEntry } from "./virtual-command-entry.mjs";
3
+ import { createComponent, createIntrinsic, mergeProps } from "@alloy-js/core/jsx-runtime";
4
+ import { For, Show, computed } from "@alloy-js/core";
5
+ import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
6
+ import { isPositionalCommandOption } from "@shell-shock/core/plugin-utils/context-helpers";
7
+ import { EntryFile } from "@powerlines/plugin-alloy/typescript/components/entry-file";
8
+ import { OptionsInterfaceDeclaration } from "@shell-shock/core/components/options-parser-logic";
9
+ import { CommandHandlerDeclaration } from "@shell-shock/preset-script/components/command-entry";
10
+ import { findFilePath, relativePath } from "@stryke/path/find";
11
+ import { joinPaths } from "@stryke/path/join";
12
+ import { replaceExtension } from "@stryke/path/replace";
13
+ import { pascalCase } from "@stryke/string-format/pascal-case";
14
+ import defu from "defu";
15
+
16
+ //#region src/components/command-entry.tsx
17
+ /**
18
+ * The command entry point for the Shell Shock project.
19
+ */
20
+ function CommandEntry(props) {
21
+ const { command, imports, builtinImports, ...rest } = props;
22
+ const context = usePowerlines();
23
+ const filePath = computed(() => joinPaths(command.path.segments.filter((segment) => !isPositionalCommandOption(segment)).join("/"), "index.ts"));
24
+ const commandSourcePath = computed(() => replaceExtension(relativePath(joinPaths(context.entryPath, findFilePath(filePath.value)), command.entry.input?.file || command.entry.file)));
25
+ const typeDefinition = computed(() => ({
26
+ ...command.entry,
27
+ output: command.id
28
+ }));
29
+ return [createComponent(EntryFile, mergeProps(rest, {
30
+ get path() {
31
+ return filePath.value;
32
+ },
33
+ get typeDefinition() {
34
+ return typeDefinition.value;
35
+ },
36
+ get imports() {
37
+ return defu(imports ?? {}, { [commandSourcePath.value]: `handle${pascalCase(command.name)}` });
38
+ },
39
+ get builtinImports() {
40
+ return defu(builtinImports ?? {}, {
41
+ env: ["env", "isCI"],
42
+ console: [
43
+ "warn",
44
+ "error",
45
+ "table",
46
+ "colors",
47
+ "stripAnsi",
48
+ "writeLine",
49
+ "splitText"
50
+ ],
51
+ utils: [
52
+ "getArgs",
53
+ "hasFlag",
54
+ "isMinimal"
55
+ ]
56
+ });
57
+ },
58
+ get children() {
59
+ return [
60
+ createComponent(BannerFunctionDeclaration, { command }),
61
+ createIntrinsic("hbr", {}),
62
+ createIntrinsic("hbr", {}),
63
+ createComponent(OptionsInterfaceDeclaration, { command }),
64
+ createIntrinsic("hbr", {}),
65
+ createIntrinsic("hbr", {}),
66
+ createComponent(CommandHandlerDeclaration, { command })
67
+ ];
68
+ }
69
+ })), createComponent(For, {
70
+ get each() {
71
+ return Object.values(command.children);
72
+ },
73
+ children: (child) => createComponent(Show, {
74
+ get when() {
75
+ return child.isVirtual;
76
+ },
77
+ get fallback() {
78
+ return createComponent(CommandEntry, { command: child });
79
+ },
80
+ get children() {
81
+ return createComponent(VirtualCommandEntry, { command: child });
82
+ }
83
+ })
84
+ })];
85
+ }
86
+
87
+ //#endregion
88
+ export { CommandEntry };
89
+ //# sourceMappingURL=command-entry.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command-entry.mjs","names":["computed","For","Show","usePowerlines","EntryFile","OptionsInterfaceDeclaration","isPositionalCommandOption","CommandHandlerDeclaration","findFilePath","relativePath","joinPaths","replaceExtension","pascalCase","defu","BannerFunctionDeclaration","VirtualCommandEntry","CommandEntry","props","command","imports","builtinImports","rest","context","filePath","path","segments","filter","segment","join","commandSourcePath","entryPath","value","entry","input","file","typeDefinition","output","id","_$createComponent","_$mergeProps","name","env","console","utils","children","_$createIntrinsic","each","Object","values","child","when","isVirtual","fallback"],"sources":["../../src/components/command-entry.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { computed, For, Show } from \"@alloy-js/core\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport type { EntryFileProps } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport { EntryFile } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport { OptionsInterfaceDeclaration } from \"@shell-shock/core/components/options-parser-logic\";\nimport { isPositionalCommandOption } from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport type { CommandTree } from \"@shell-shock/core/types/command\";\nimport { CommandHandlerDeclaration } from \"@shell-shock/preset-script/components/command-entry\";\nimport { findFilePath, relativePath } from \"@stryke/path/find\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { replaceExtension } from \"@stryke/path/replace\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport defu from \"defu\";\nimport type { CLIPresetContext } from \"../types/plugin\";\nimport { BannerFunctionDeclaration } from \"./banner-function-declaration\";\nimport { VirtualCommandEntry } from \"./virtual-command-entry\";\n\nexport interface CommandEntryProps extends Omit<\n EntryFileProps,\n \"path\" | \"typeDefinition\"\n> {\n command: CommandTree;\n}\n\n/**\n * The command entry point for the Shell Shock project.\n */\nexport function CommandEntry(props: CommandEntryProps) {\n const { command, imports, builtinImports, ...rest } = props;\n\n const context = usePowerlines<CLIPresetContext>();\n const filePath = computed(() =>\n joinPaths(\n command.path.segments\n .filter(segment => !isPositionalCommandOption(segment))\n .join(\"/\"),\n \"index.ts\"\n )\n );\n const commandSourcePath = computed(() =>\n replaceExtension(\n relativePath(\n joinPaths(context.entryPath, findFilePath(filePath.value)),\n command.entry.input?.file || command.entry.file\n )\n )\n );\n const typeDefinition = computed(() => ({\n ...command.entry,\n output: command.id\n }));\n\n return (\n <>\n <EntryFile\n {...rest}\n path={filePath.value}\n typeDefinition={typeDefinition.value}\n imports={defu(imports ?? {}, {\n [commandSourcePath.value]: `handle${pascalCase(command.name)}`\n })}\n builtinImports={defu(builtinImports ?? {}, {\n env: [\"env\", \"isCI\"],\n console: [\n \"warn\",\n \"error\",\n \"table\",\n \"colors\",\n \"stripAnsi\",\n \"writeLine\",\n \"splitText\"\n ],\n utils: [\"getArgs\", \"hasFlag\", \"isMinimal\"]\n })}>\n <BannerFunctionDeclaration command={command} />\n <hbr />\n <hbr />\n <OptionsInterfaceDeclaration command={command} />\n <hbr />\n <hbr />\n <CommandHandlerDeclaration command={command} />\n </EntryFile>\n <For each={Object.values(command.children)}>\n {child => (\n <Show\n when={child.isVirtual}\n fallback={<CommandEntry command={child} />}>\n <VirtualCommandEntry command={child} />\n </Show>\n )}\n </For>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA6CA,SAAgBgB,aAAaC,OAA0B;CACrD,MAAM,EAAEC,SAASC,SAASC,gBAAgB,GAAGC,SAASJ;CAEtD,MAAMK,UAAUnB,eAAiC;CACjD,MAAMoB,WAAWvB,eACfU,UACEQ,QAAQM,KAAKC,SACVC,QAAOC,YAAW,CAACrB,0BAA0BqB,QAAQ,CAAC,CACtDC,KAAK,IAAI,EACZ,WAEJ,CAAC;CACD,MAAMC,oBAAoB7B,eACxBW,iBACEF,aACEC,UAAUY,QAAQQ,WAAWtB,aAAae,SAASQ,MAAM,CAAC,EAC1Db,QAAQc,MAAMC,OAAOC,QAAQhB,QAAQc,MAAME,KAE/C,CACF,CAAC;CACD,MAAMC,iBAAiBnC,gBAAgB;EACrC,GAAGkB,QAAQc;EACXI,QAAQlB,QAAQmB;EACjB,EAAE;AAEH,QAAA,CAAAC,gBAEKlC,WAASmC,WACJlB,MAAI;EAAA,IACRG,OAAI;AAAA,UAAED,SAASQ;;EAAK,IACpBI,iBAAc;AAAA,UAAEA,eAAeJ;;EAAK,IACpCZ,UAAO;AAAA,UAAEN,KAAKM,WAAW,EAAE,EAAE,GAC1BU,kBAAkBE,QAAQ,SAASnB,WAAWM,QAAQsB,KAAK,IAC7D,CAAC;;EAAA,IACFpB,iBAAc;AAAA,UAAEP,KAAKO,kBAAkB,EAAE,EAAE;IACzCqB,KAAK,CAAC,OAAO,OAAO;IACpBC,SAAS;KACP;KACA;KACA;KACA;KACA;KACA;KACA;KACD;IACDC,OAAO;KAAC;KAAW;KAAW;KAAW;IAC1C,CAAC;;EAAA,IAAAC,WAAA;AAAA,UAAA;IAAAN,gBACDxB,2BAAyB,EAAUI,SAAO,CAAA;IAAA2B,gBAAA,OAAA,EAAA,CAAA;IAAAA,gBAAA,OAAA,EAAA,CAAA;IAAAP,gBAG1CjC,6BAA2B,EAAUa,SAAO,CAAA;IAAA2B,gBAAA,OAAA,EAAA,CAAA;IAAAA,gBAAA,OAAA,EAAA,CAAA;IAAAP,gBAG5C/B,2BAAyB,EAAUW,SAAO,CAAA;IAAA;;EAAA,CAAA,CAAA,EAAAoB,gBAE5CrC,KAAG;EAAA,IAAC6C,OAAI;AAAA,UAAEC,OAAOC,OAAO9B,QAAQ0B,SAAS;;EAAAA,WACvCK,UAAKX,gBACHpC,MAAI;GAAA,IACHgD,OAAI;AAAA,WAAED,MAAME;;GAAS,IACrBC,WAAQ;AAAA,WAAAd,gBAAGtB,cAAY,EAACE,SAAS+B,OAAK,CAAA;;GAAA,IAAAL,WAAA;AAAA,WAAAN,gBACrCvB,qBAAmB,EAACG,SAAS+B,OAAK,CAAA;;GAAA,CAAA;EAEtC,CAAA,CAAA"}
@@ -1,3 +1,7 @@
1
1
  const require_components_banner_function_declaration = require('./banner-function-declaration.cjs');
2
+ const require_components_virtual_command_entry = require('./virtual-command-entry.cjs');
3
+ const require_components_command_entry = require('./command-entry.cjs');
2
4
 
3
- exports.BannerFunctionDeclaration = require_components_banner_function_declaration.BannerFunctionDeclaration;
5
+ exports.BannerFunctionDeclaration = require_components_banner_function_declaration.BannerFunctionDeclaration;
6
+ exports.CommandEntry = require_components_command_entry.CommandEntry;
7
+ exports.VirtualCommandEntry = require_components_virtual_command_entry.VirtualCommandEntry;
@@ -1,2 +1,4 @@
1
- import { BannerFunctionDeclaration, BannerFunctionDeclarationProps } from "./banner-function-declaration.cjs";
2
- export { BannerFunctionDeclaration, BannerFunctionDeclarationProps };
1
+ import { BannerFunctionDeclaration } from "./banner-function-declaration.cjs";
2
+ import { CommandEntry, CommandEntryProps } from "./command-entry.cjs";
3
+ import { VirtualCommandEntry, VirtualCommandEntryProps } from "./virtual-command-entry.cjs";
4
+ export { BannerFunctionDeclaration, CommandEntry, CommandEntryProps, VirtualCommandEntry, VirtualCommandEntryProps };
@@ -1,2 +1,4 @@
1
- import { BannerFunctionDeclaration, BannerFunctionDeclarationProps } from "./banner-function-declaration.mjs";
2
- export { BannerFunctionDeclaration, BannerFunctionDeclarationProps };
1
+ import { BannerFunctionDeclaration } from "./banner-function-declaration.mjs";
2
+ import { CommandEntry, CommandEntryProps } from "./command-entry.mjs";
3
+ import { VirtualCommandEntry, VirtualCommandEntryProps } from "./virtual-command-entry.mjs";
4
+ export { BannerFunctionDeclaration, CommandEntry, CommandEntryProps, VirtualCommandEntry, VirtualCommandEntryProps };
@@ -1,3 +1,5 @@
1
1
  import { BannerFunctionDeclaration } from "./banner-function-declaration.mjs";
2
+ import { VirtualCommandEntry } from "./virtual-command-entry.mjs";
3
+ import { CommandEntry } from "./command-entry.mjs";
2
4
 
3
- export { BannerFunctionDeclaration };
5
+ export { BannerFunctionDeclaration, CommandEntry, VirtualCommandEntry };
@@ -0,0 +1,86 @@
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ const require_components_banner_function_declaration = require('./banner-function-declaration.cjs');
3
+ const require_components_command_entry = require('./command-entry.cjs');
4
+ let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
5
+ let __alloy_js_core = require("@alloy-js/core");
6
+ let __powerlines_plugin_alloy_core_contexts_context = require("@powerlines/plugin-alloy/core/contexts/context");
7
+ let __shell_shock_core_plugin_utils_context_helpers = require("@shell-shock/core/plugin-utils/context-helpers");
8
+ let __stryke_path_join = require("@stryke/path/join");
9
+ let __stryke_string_format_pascal_case = require("@stryke/string-format/pascal-case");
10
+ let defu = require("defu");
11
+ defu = require_rolldown_runtime.__toESM(defu);
12
+ let __powerlines_plugin_alloy_typescript_components_typescript_file = require("@powerlines/plugin-alloy/typescript/components/typescript-file");
13
+ let __shell_shock_preset_script_components_virtual_command_entry = require("@shell-shock/preset-script/components/virtual-command-entry");
14
+
15
+ //#region src/components/virtual-command-entry.tsx
16
+ /**
17
+ * The virtual command entry point for the Shell Shock project.
18
+ */
19
+ function VirtualCommandEntry(props) {
20
+ const { command, imports, builtinImports, ...rest } = props;
21
+ const context = (0, __powerlines_plugin_alloy_core_contexts_context.usePowerlines)();
22
+ const filePath = (0, __alloy_js_core.computed)(() => (0, __stryke_path_join.joinPaths)(context.entryPath, command.path.segments.filter((segment) => !(0, __shell_shock_core_plugin_utils_context_helpers.isPositionalCommandOption)(segment)).join("/"), "index.ts"));
23
+ return [(0, __alloy_js_core_jsx_runtime.createComponent)(__powerlines_plugin_alloy_typescript_components_typescript_file.TypescriptFile, (0, __alloy_js_core_jsx_runtime.mergeProps)(rest, {
24
+ get path() {
25
+ return filePath.value;
26
+ },
27
+ get imports() {
28
+ return (0, defu.default)({ didyoumean2: [
29
+ {
30
+ name: "didYouMean",
31
+ default: true
32
+ },
33
+ { name: "ReturnTypeEnums" },
34
+ { name: "ThresholdTypeEnums" }
35
+ ] }, imports ?? {}, Object.entries(command.children).filter(([, child]) => child.isVirtual).reduce((ret, [name, child]) => {
36
+ ret[`./${child.name}`] = [{
37
+ name: "handler",
38
+ alias: `handle${(0, __stryke_string_format_pascal_case.pascalCase)(name)}`
39
+ }];
40
+ return ret;
41
+ }, {}));
42
+ },
43
+ get builtinImports() {
44
+ return (0, defu.default)(builtinImports ?? {}, {
45
+ console: [
46
+ "warn",
47
+ "error",
48
+ "table",
49
+ "colors",
50
+ "writeLine"
51
+ ],
52
+ utils: [
53
+ "getArgs",
54
+ "hasFlag",
55
+ "isMinimal"
56
+ ]
57
+ });
58
+ },
59
+ get children() {
60
+ return [
61
+ (0, __alloy_js_core_jsx_runtime.createComponent)(require_components_banner_function_declaration.BannerFunctionDeclaration, { command }),
62
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
63
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
64
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_virtual_command_entry.VirtualCommandHandlerDeclaration, { command })
65
+ ];
66
+ }
67
+ })), (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.For, {
68
+ get each() {
69
+ return Object.values(command.children);
70
+ },
71
+ children: (child) => (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core.Show, {
72
+ get when() {
73
+ return child.isVirtual;
74
+ },
75
+ get fallback() {
76
+ return (0, __alloy_js_core_jsx_runtime.createComponent)(require_components_command_entry.CommandEntry, { command: child });
77
+ },
78
+ get children() {
79
+ return (0, __alloy_js_core_jsx_runtime.createComponent)(VirtualCommandEntry, { command: child });
80
+ }
81
+ })
82
+ })];
83
+ }
84
+
85
+ //#endregion
86
+ exports.VirtualCommandEntry = VirtualCommandEntry;
@@ -0,0 +1,15 @@
1
+ import * as _alloy_js_core0 from "@alloy-js/core";
2
+ import { EntryFileProps } from "@powerlines/plugin-alloy/typescript/components/entry-file";
3
+ import { CommandTree } from "@shell-shock/core/types/command";
4
+
5
+ //#region src/components/virtual-command-entry.d.ts
6
+ interface VirtualCommandEntryProps extends Omit<EntryFileProps, "path" | "typeDefinition"> {
7
+ command: CommandTree;
8
+ }
9
+ /**
10
+ * The virtual command entry point for the Shell Shock project.
11
+ */
12
+ declare function VirtualCommandEntry(props: VirtualCommandEntryProps): _alloy_js_core0.Children;
13
+ //#endregion
14
+ export { VirtualCommandEntry, VirtualCommandEntryProps };
15
+ //# sourceMappingURL=virtual-command-entry.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"virtual-command-entry.d.cts","names":[],"sources":["../../src/components/virtual-command-entry.tsx"],"sourcesContent":[],"mappings":";;;;;UAiCiB,wBAAA,SAAiC,KAChD;WAGS;;AAJX;;;AAAkD,iBAUlC,mBAAA,CAVkC,KAAA,EAUP,wBAVO,CAAA,EAUiB,eAAA,CAAA,QAVjB"}
@@ -0,0 +1,15 @@
1
+ import * as _alloy_js_core0 from "@alloy-js/core";
2
+ import { EntryFileProps } from "@powerlines/plugin-alloy/typescript/components/entry-file";
3
+ import { CommandTree } from "@shell-shock/core/types/command";
4
+
5
+ //#region src/components/virtual-command-entry.d.ts
6
+ interface VirtualCommandEntryProps extends Omit<EntryFileProps, "path" | "typeDefinition"> {
7
+ command: CommandTree;
8
+ }
9
+ /**
10
+ * The virtual command entry point for the Shell Shock project.
11
+ */
12
+ declare function VirtualCommandEntry(props: VirtualCommandEntryProps): _alloy_js_core0.Children;
13
+ //#endregion
14
+ export { VirtualCommandEntry, VirtualCommandEntryProps };
15
+ //# sourceMappingURL=virtual-command-entry.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"virtual-command-entry.d.mts","names":[],"sources":["../../src/components/virtual-command-entry.tsx"],"sourcesContent":[],"mappings":";;;;;UAiCiB,wBAAA,SAAiC,KAChD;WAGS;;AAJX;;;AAAkD,iBAUlC,mBAAA,CAVkC,KAAA,EAUP,wBAVO,CAAA,EAUiB,eAAA,CAAA,QAVjB"}
@@ -0,0 +1,85 @@
1
+ import { BannerFunctionDeclaration } from "./banner-function-declaration.mjs";
2
+ import { CommandEntry } from "./command-entry.mjs";
3
+ import { createComponent, createIntrinsic, mergeProps } from "@alloy-js/core/jsx-runtime";
4
+ import { For, Show, computed } from "@alloy-js/core";
5
+ import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
6
+ import { isPositionalCommandOption } from "@shell-shock/core/plugin-utils/context-helpers";
7
+ import { joinPaths } from "@stryke/path/join";
8
+ import { pascalCase } from "@stryke/string-format/pascal-case";
9
+ import defu from "defu";
10
+ import { TypescriptFile } from "@powerlines/plugin-alloy/typescript/components/typescript-file";
11
+ import { VirtualCommandHandlerDeclaration } from "@shell-shock/preset-script/components/virtual-command-entry";
12
+
13
+ //#region src/components/virtual-command-entry.tsx
14
+ /**
15
+ * The virtual command entry point for the Shell Shock project.
16
+ */
17
+ function VirtualCommandEntry(props) {
18
+ const { command, imports, builtinImports, ...rest } = props;
19
+ const context = usePowerlines();
20
+ const filePath = computed(() => joinPaths(context.entryPath, command.path.segments.filter((segment) => !isPositionalCommandOption(segment)).join("/"), "index.ts"));
21
+ return [createComponent(TypescriptFile, mergeProps(rest, {
22
+ get path() {
23
+ return filePath.value;
24
+ },
25
+ get imports() {
26
+ return defu({ didyoumean2: [
27
+ {
28
+ name: "didYouMean",
29
+ default: true
30
+ },
31
+ { name: "ReturnTypeEnums" },
32
+ { name: "ThresholdTypeEnums" }
33
+ ] }, imports ?? {}, Object.entries(command.children).filter(([, child]) => child.isVirtual).reduce((ret, [name, child]) => {
34
+ ret[`./${child.name}`] = [{
35
+ name: "handler",
36
+ alias: `handle${pascalCase(name)}`
37
+ }];
38
+ return ret;
39
+ }, {}));
40
+ },
41
+ get builtinImports() {
42
+ return defu(builtinImports ?? {}, {
43
+ console: [
44
+ "warn",
45
+ "error",
46
+ "table",
47
+ "colors",
48
+ "writeLine"
49
+ ],
50
+ utils: [
51
+ "getArgs",
52
+ "hasFlag",
53
+ "isMinimal"
54
+ ]
55
+ });
56
+ },
57
+ get children() {
58
+ return [
59
+ createComponent(BannerFunctionDeclaration, { command }),
60
+ createIntrinsic("hbr", {}),
61
+ createIntrinsic("hbr", {}),
62
+ createComponent(VirtualCommandHandlerDeclaration, { command })
63
+ ];
64
+ }
65
+ })), createComponent(For, {
66
+ get each() {
67
+ return Object.values(command.children);
68
+ },
69
+ children: (child) => createComponent(Show, {
70
+ get when() {
71
+ return child.isVirtual;
72
+ },
73
+ get fallback() {
74
+ return createComponent(CommandEntry, { command: child });
75
+ },
76
+ get children() {
77
+ return createComponent(VirtualCommandEntry, { command: child });
78
+ }
79
+ })
80
+ })];
81
+ }
82
+
83
+ //#endregion
84
+ export { VirtualCommandEntry };
85
+ //# sourceMappingURL=virtual-command-entry.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"virtual-command-entry.mjs","names":["computed","For","Show","usePowerlines","TypescriptFile","isPositionalCommandOption","VirtualCommandHandlerDeclaration","joinPaths","pascalCase","defu","BannerFunctionDeclaration","CommandEntry","VirtualCommandEntry","props","command","imports","builtinImports","rest","context","filePath","entryPath","path","segments","filter","segment","join","_$createComponent","_$mergeProps","value","didyoumean2","name","default","Object","entries","children","child","isVirtual","reduce","ret","alias","console","utils","_$createIntrinsic","each","values","when","fallback"],"sources":["../../src/components/virtual-command-entry.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { computed, For, Show } from \"@alloy-js/core\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport type { TypescriptFileImports } from \"@powerlines/plugin-alloy/types/components\";\nimport type { EntryFileProps } from \"@powerlines/plugin-alloy/typescript/components/entry-file\";\nimport { TypescriptFile } from \"@powerlines/plugin-alloy/typescript/components/typescript-file\";\nimport { isPositionalCommandOption } from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport type { CommandTree } from \"@shell-shock/core/types/command\";\nimport { VirtualCommandHandlerDeclaration } from \"@shell-shock/preset-script/components/virtual-command-entry\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport defu from \"defu\";\nimport type { CLIPresetContext } from \"../types/plugin\";\nimport { BannerFunctionDeclaration } from \"./banner-function-declaration\";\nimport { CommandEntry } from \"./command-entry\";\n\nexport interface VirtualCommandEntryProps extends Omit<\n EntryFileProps,\n \"path\" | \"typeDefinition\"\n> {\n command: CommandTree;\n}\n\n/**\n * The virtual command entry point for the Shell Shock project.\n */\nexport function VirtualCommandEntry(props: VirtualCommandEntryProps) {\n const { command, imports, builtinImports, ...rest } = props;\n\n const context = usePowerlines<CLIPresetContext>();\n const filePath = computed(() =>\n joinPaths(\n context.entryPath,\n command.path.segments\n .filter(segment => !isPositionalCommandOption(segment))\n .join(\"/\"),\n \"index.ts\"\n )\n );\n\n return (\n <>\n <TypescriptFile\n {...rest}\n path={filePath.value}\n imports={defu(\n {\n didyoumean2: [\n { name: \"didYouMean\", default: true },\n { name: \"ReturnTypeEnums\" },\n { name: \"ThresholdTypeEnums\" }\n ]\n },\n imports ?? {},\n Object.entries(command.children)\n .filter(([, child]) => child.isVirtual)\n .reduce((ret, [name, child]) => {\n ret[`./${child.name}`] = [\n { name: \"handler\", alias: `handle${pascalCase(name)}` }\n ];\n\n return ret;\n }, {} as TypescriptFileImports)\n )}\n builtinImports={defu(builtinImports ?? {}, {\n console: [\"warn\", \"error\", \"table\", \"colors\", \"writeLine\"],\n utils: [\"getArgs\", \"hasFlag\", \"isMinimal\"]\n })}>\n <BannerFunctionDeclaration command={command} />\n <hbr />\n <hbr />\n <VirtualCommandHandlerDeclaration command={command} />\n </TypescriptFile>\n <For each={Object.values(command.children)}>\n {child => (\n <Show\n when={child.isVirtual}\n fallback={<CommandEntry command={child} />}>\n <VirtualCommandEntry command={child} />\n </Show>\n )}\n </For>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AA2CA,SAAgBY,oBAAoBC,OAAiC;CACnE,MAAM,EAAEC,SAASC,SAASC,gBAAgB,GAAGC,SAASJ;CAEtD,MAAMK,UAAUf,eAAiC;CACjD,MAAMgB,WAAWnB,eACfO,UACEW,QAAQE,WACRN,QAAQO,KAAK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;;GAAA,IAAAD,WAAA;AAAA,WAAAR,gBACrCd,qBAAmB,EAACE,SAASqB,OAAK,CAAA;;GAAA,CAAA;EAEtC,CAAA,CAAA"}
package/dist/index.cjs CHANGED
@@ -1,7 +1,8 @@
1
1
  Object.defineProperty(exports, '__esModule', { value: true });
2
2
  const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
3
3
  const require_components_banner_function_declaration = require('./components/banner-function-declaration.cjs');
4
- require('./components/index.cjs');
4
+ const require_components_virtual_command_entry = require('./components/virtual-command-entry.cjs');
5
+ const require_components_command_entry = require('./components/command-entry.cjs');
5
6
  const require_get_default_options = require('./helpers/get-default-options.cjs');
6
7
  let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
7
8
  let __alloy_js_core = require("@alloy-js/core");
@@ -10,12 +11,10 @@ let __powerlines_plugin_alloy_render = require("@powerlines/plugin-alloy/render"
10
11
  let __shell_shock_plugin_theme = require("@shell-shock/plugin-theme");
11
12
  __shell_shock_plugin_theme = require_rolldown_runtime.__toESM(__shell_shock_plugin_theme);
12
13
  let __shell_shock_preset_script_components_bin_entry = require("@shell-shock/preset-script/components/bin-entry");
13
- let __shell_shock_preset_script_components_command_entry = require("@shell-shock/preset-script/components/command-entry");
14
14
  let __shell_shock_preset_script_components_command_router = require("@shell-shock/preset-script/components/command-router");
15
15
  let __shell_shock_preset_script_components_console_builtin = require("@shell-shock/preset-script/components/console-builtin");
16
16
  let __shell_shock_preset_script_components_help = require("@shell-shock/preset-script/components/help");
17
17
  let __shell_shock_preset_script_components_utils_builtin = require("@shell-shock/preset-script/components/utils-builtin");
18
- let __shell_shock_preset_script_components_virtual_command_entry = require("@shell-shock/preset-script/components/virtual-command-entry");
19
18
 
20
19
  //#region src/index.tsx
21
20
  /**
@@ -95,7 +94,11 @@ const plugin = (options = {}) => {
95
94
  }
96
95
  }),
97
96
  (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
98
- (0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_help.HelpInvoke, {
97
+ __alloy_js_core.code`writeLine("");
98
+ banner();`,
99
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
100
+ (0, __alloy_js_core_jsx_runtime.createIntrinsic)("hbr", {}),
101
+ (0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_help.VirtualHelp, {
99
102
  get options() {
100
103
  return _self$.options;
101
104
  },
@@ -120,10 +123,10 @@ const plugin = (options = {}) => {
120
123
  return child.isVirtual;
121
124
  },
122
125
  get fallback() {
123
- return (0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_command_entry.CommandEntry, { command: child });
126
+ return (0, __alloy_js_core_jsx_runtime.createComponent)(require_components_command_entry.CommandEntry, { command: child });
124
127
  },
125
128
  get children() {
126
- return (0, __alloy_js_core_jsx_runtime.createComponent)(__shell_shock_preset_script_components_virtual_command_entry.VirtualCommandEntry, { command: child });
129
+ return (0, __alloy_js_core_jsx_runtime.createComponent)(require_components_virtual_command_entry.VirtualCommandEntry, { command: child });
127
130
  }
128
131
  })
129
132
  });
@@ -1 +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,GAsGjC,MAtGiC,CAsG1B,QAtG0B,CAAA,EAAA"}
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,GA0GjC,MA1GiC,CA0G1B,QA1G0B,CAAA,EAAA"}
@@ -1 +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,GAsGjC,MAtGiC,CAsG1B,QAtG0B,CAAA,EAAA"}
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,GA0GjC,MA1GiC,CA0G1B,QA1G0B,CAAA,EAAA"}
package/dist/index.mjs CHANGED
@@ -1,5 +1,6 @@
1
1
  import { BannerFunctionDeclaration } from "./components/banner-function-declaration.mjs";
2
- import "./components/index.mjs";
2
+ import { VirtualCommandEntry } from "./components/virtual-command-entry.mjs";
3
+ import { CommandEntry } from "./components/command-entry.mjs";
3
4
  import { getDefaultOptions } from "./helpers/get-default-options.mjs";
4
5
  import { createComponent, createIntrinsic } from "@alloy-js/core/jsx-runtime";
5
6
  import { For, Show, code } from "@alloy-js/core";
@@ -7,12 +8,10 @@ import { VarDeclaration } from "@alloy-js/typescript";
7
8
  import { render } from "@powerlines/plugin-alloy/render";
8
9
  import theme from "@shell-shock/plugin-theme";
9
10
  import { BinEntry } from "@shell-shock/preset-script/components/bin-entry";
10
- import { CommandEntry } from "@shell-shock/preset-script/components/command-entry";
11
11
  import { CommandRouter } from "@shell-shock/preset-script/components/command-router";
12
12
  import { ConsoleBuiltin } from "@shell-shock/preset-script/components/console-builtin";
13
- import { HelpInvoke } from "@shell-shock/preset-script/components/help";
13
+ import { VirtualHelp } from "@shell-shock/preset-script/components/help";
14
14
  import { UtilsBuiltin } from "@shell-shock/preset-script/components/utils-builtin";
15
- import { VirtualCommandEntry } from "@shell-shock/preset-script/components/virtual-command-entry";
16
15
 
17
16
  //#region src/index.tsx
18
17
  /**
@@ -92,7 +91,11 @@ const plugin = (options = {}) => {
92
91
  }
93
92
  }),
94
93
  createIntrinsic("hbr", {}),
95
- createComponent(HelpInvoke, {
94
+ code`writeLine("");
95
+ banner();`,
96
+ createIntrinsic("hbr", {}),
97
+ createIntrinsic("hbr", {}),
98
+ createComponent(VirtualHelp, {
96
99
  get options() {
97
100
  return _self$.options;
98
101
  },
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["code","For","Show","VarDeclaration","render","theme","BinEntry","CommandEntry","CommandRouter","ConsoleBuiltin","HelpInvoke","UtilsBuiltin","VirtualCommandEntry","BannerFunctionDeclaration","getDefaultOptions","plugin","options","name","config","debug","defaultOptions","isCaseSensitive","configResolved","dependencies","didyoumean2","prepare","_$createComponent","order","handler","_self$","builtinImports","console","utils","env","prefix","_$createIntrinsic","children","when","Object","keys","commands","length","type","initializer","path","values","each","doubleHardline","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 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 { HelpInvoke } from \"@shell-shock/preset-script/components/help\";\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 { BannerFunctionDeclaration } from \"./components\";\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.\"\n );\n\n return {\n defaultOptions: getDefaultOptions,\n isCaseSensitive: false,\n ...options\n };\n },\n configResolved() {\n this.dependencies.didyoumean2 = \"^7.0.4\";\n },\n async prepare() {\n this.debug(\n \"Rendering built-in modules for the Shell Shock `cli` preset.\"\n );\n\n return render(\n this,\n <>\n <UtilsBuiltin />\n <ConsoleBuiltin />\n </>\n );\n }\n },\n {\n name: \"shell-shock:cli-preset:generate-entrypoint\",\n prepare: {\n order: \"post\",\n async handler() {\n this.debug(\n \"Rendering entrypoint modules for the Shell Shock `cli` preset.\"\n );\n\n return render(\n this,\n <>\n <BinEntry\n builtinImports={{\n console: [\n \"divider\",\n \"stripAnsi\",\n \"writeLine\",\n \"splitText\",\n \"colors\",\n \"help\"\n ],\n utils: [\"getArgs\", \"isMinimal\"],\n env: [\"isCI\"]\n }}\n prefix={\n <>\n <BannerFunctionDeclaration />\n <hbr />\n <hbr />\n </>\n }>\n <Show when={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 <hbr />\n </Show>\n <hbr />\n <HelpInvoke\n options={this.options}\n commands={this.commands ?? {}}\n />\n </BinEntry>\n <Show when={Object.values(this.commands).length > 0}>\n <For each={Object.values(this.commands)} doubleHardline>\n {child => (\n <Show\n when={child.isVirtual}\n fallback={<CommandEntry command={child} />}>\n <VirtualCommandEntry command={child} />\n </Show>\n )}\n </For>\n </Show>\n </>\n );\n }\n }\n }\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAqCA,MAAae,UACXC,UAA4B,EAAE,KAC3B;AACH,QAAO;EACLX,MAAM,EACJA,OAAOW,QAAQX,OAChB,CAAC;EACF;GACEY,MAAM;GACNC,SAAS;AACP,SAAKC,MACH,oEACD;AAED,WAAO;KACLC,gBAAgBN;KAChBO,iBAAiB;KACjB,GAAGL;KACJ;;GAEHM,iBAAiB;AACf,SAAKC,aAAaC,cAAc;;GAElC,MAAMC,UAAU;AACd,SAAKN,MACH,+DACD;AAED,WAAOf,OACL,MAAI,CAAAsB,gBAEDf,cAAY,EAAA,CAAA,EAAAe,gBACZjB,gBAAc,EAAA,CAAA,CAEnB,CAAC;;GAEJ;EACD;GACEQ,MAAM;GACNQ,SAAS;IACPE,OAAO;IACP,MAAMC,UAAU;KAAA,MAAAC,SAAA;AACd,UAAKV,MACH,iEACD;AAED,YAAOf,OACL,MAAI,CAAAsB,gBAEDpB,UAAQ;MACPwB,gBAAgB;OACdC,SAAS;QACP;QACA;QACA;QACA;QACA;QACA;QACD;OACDC,OAAO,CAAC,WAAW,YAAY;OAC/BC,KAAK,CAAC,OAAM;OACb;MAAA,IACDC,SAAM;AAAA,cAAA;QAAAR,gBAEDb,2BAAyB,EAAA,CAAA;QAAAsB,gBAAA,OAAA,EAAA,CAAA;QAAAA,gBAAA,OAAA,EAAA,CAAA;QAAA;;MAAA,IAAAC,WAAA;AAAA,cAAA;QAAAV,gBAK7BxB,MAAI;SAAA,IAACmC,OAAI;AAAA,iBAAEC,OAAOC,KAAKV,OAAKW,SAAS,CAACC,SAAS;;SAAC,IAAAL,WAAA;AAAA,iBAAA;WAAAV,gBAC9CvB,gBAAc;YAAA,SAAA;YAEbc,MAAI;YACJyB,MAAI;YACJC,aAAa3C,IAAI;YAAY,CAAA;WAAAmC,gBAAA,OAAA,EAAA,CAAA;WAAAT,gBAG9BlB,eAAa;YAACoC,MAAM,EAAE;YAAA,IAAEJ,WAAQ;AAAA,oBAAEX,OAAKW,YAAY,EAAE;;YAAA,CAAA;WAAAL,gBAAA,OAAA,EAAA,CAAA;WAAA;;SAAA,CAAA;QAAAA,gBAAA,OAAA,EAAA,CAAA;QAAAT,gBAIvDhB,YAAU;SAAA,IACTM,UAAO;AAAA,iBAAEa,OAAKb;;SAAO,IACrBwB,WAAQ;AAAA,iBAAEX,OAAKW,YAAY,EAAE;;SAAA,CAAA;QAAA;;MAAA,CAAA,EAAAd,gBAGhCxB,MAAI;MAAA,IAACmC,OAAI;AAAA,cAAEC,OAAOO,OAAOhB,OAAKW,SAAS,CAACC,SAAS;;MAAC,IAAAL,WAAA;AAAA,cAAAV,gBAChDzB,KAAG;QAAA,IAAC6C,OAAI;AAAA,gBAAER,OAAOO,OAAOhB,OAAKW,SAAS;;QAAEO,gBAAc;QAAAX,WACpDY,UAAKtB,gBACHxB,MAAI;SAAA,IACHmC,OAAI;AAAA,iBAAEW,MAAMC;;SAAS,IACrBC,WAAQ;AAAA,iBAAAxB,gBAAGnB,cAAY,EAAC4C,SAASH,OAAK,CAAA;;SAAA,IAAAZ,WAAA;AAAA,iBAAAV,gBACrCd,qBAAmB,EAACuC,SAASH,OAAK,CAAA;;SAAA,CAAA;QAEtC,CAAA;;MAAA,CAAA,CAIT,CAAC;;IAEL;GACD;EACF;;AAGH,kBAAejC"}
1
+ {"version":3,"file":"index.mjs","names":["code","For","Show","VarDeclaration","render","theme","BinEntry","CommandRouter","ConsoleBuiltin","VirtualHelp","UtilsBuiltin","BannerFunctionDeclaration","CommandEntry","VirtualCommandEntry","getDefaultOptions","plugin","options","name","config","debug","defaultOptions","isCaseSensitive","configResolved","dependencies","didyoumean2","prepare","_$createComponent","order","handler","_self$","builtinImports","console","utils","env","prefix","_$createIntrinsic","children","when","Object","keys","commands","length","type","initializer","path","values","each","doubleHardline","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 theme from \"@shell-shock/plugin-theme\";\nimport { BinEntry } from \"@shell-shock/preset-script/components/bin-entry\";\nimport { CommandRouter } from \"@shell-shock/preset-script/components/command-router\";\nimport { ConsoleBuiltin } from \"@shell-shock/preset-script/components/console-builtin\";\nimport { VirtualHelp } from \"@shell-shock/preset-script/components/help\";\nimport { UtilsBuiltin } from \"@shell-shock/preset-script/components/utils-builtin\";\nimport type { Plugin } from \"powerlines/types/plugin\";\nimport { BannerFunctionDeclaration } from \"./components/banner-function-declaration\";\nimport { CommandEntry } from \"./components/command-entry\";\nimport { VirtualCommandEntry } from \"./components/virtual-command-entry\";\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.\"\n );\n\n return {\n defaultOptions: getDefaultOptions,\n isCaseSensitive: false,\n ...options\n };\n },\n configResolved() {\n this.dependencies.didyoumean2 = \"^7.0.4\";\n },\n async prepare() {\n this.debug(\n \"Rendering built-in modules for the Shell Shock `cli` preset.\"\n );\n\n return render(\n this,\n <>\n <UtilsBuiltin />\n <ConsoleBuiltin />\n </>\n );\n }\n },\n {\n name: \"shell-shock:cli-preset:generate-entrypoint\",\n prepare: {\n order: \"post\",\n async handler() {\n this.debug(\n \"Rendering entrypoint modules for the Shell Shock `cli` preset.\"\n );\n\n return render(\n this,\n <>\n <BinEntry\n builtinImports={{\n console: [\n \"divider\",\n \"stripAnsi\",\n \"writeLine\",\n \"splitText\",\n \"colors\",\n \"help\"\n ],\n utils: [\"getArgs\", \"isMinimal\"],\n env: [\"isCI\"]\n }}\n prefix={\n <>\n <BannerFunctionDeclaration />\n <hbr />\n <hbr />\n </>\n }>\n <Show when={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 <hbr />\n </Show>\n <hbr />\n {code`writeLine(\"\");\n banner();`}\n <hbr />\n <hbr />\n <VirtualHelp\n options={this.options}\n commands={this.commands ?? {}}\n />\n </BinEntry>\n <Show when={Object.values(this.commands).length > 0}>\n <For each={Object.values(this.commands)} doubleHardline>\n {child => (\n <Show\n when={child.isVirtual}\n fallback={<CommandEntry command={child} />}>\n <VirtualCommandEntry command={child} />\n </Show>\n )}\n </For>\n </Show>\n </>\n );\n }\n }\n }\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAqCA,MAAae,UACXC,UAA4B,EAAE,KAC3B;AACH,QAAO;EACLX,MAAM,EACJA,OAAOW,QAAQX,OAChB,CAAC;EACF;GACEY,MAAM;GACNC,SAAS;AACP,SAAKC,MACH,oEACD;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,EAAA,CAAA;QAAAT,gBAGTjB,aAAW;SAAA,IACVO,UAAO;AAAA,iBAAEa,OAAKb;;SAAO,IACrBwB,WAAQ;AAAA,iBAAEX,OAAKW,YAAY,EAAE;;SAAA,CAAA;QAAA;;MAAA,CAAA,EAAAd,gBAGhCxB,MAAI;MAAA,IAACmC,OAAI;AAAA,cAAEC,OAAOO,OAAOhB,OAAKW,SAAS,CAACC,SAAS;;MAAC,IAAAL,WAAA;AAAA,cAAAV,gBAChDzB,KAAG;QAAA,IAAC6C,OAAI;AAAA,gBAAER,OAAOO,OAAOhB,OAAKW,SAAS;;QAAEO,gBAAc;QAAAX,WACpDY,UAAKtB,gBACHxB,MAAI;SAAA,IACHmC,OAAI;AAAA,iBAAEW,MAAMC;;SAAS,IACrBC,WAAQ;AAAA,iBAAAxB,gBAAGd,cAAY,EAACuC,SAASH,OAAK,CAAA;;SAAA,IAAAZ,WAAA;AAAA,iBAAAV,gBACrCb,qBAAmB,EAACsC,SAASH,OAAK,CAAA;;SAAA,CAAA;QAEtC,CAAA;;MAAA,CAAA,CAIT,CAAC;;IAEL;GACD;EACF;;AAGH,kBAAejC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shell-shock/preset-cli",
3
- "version": "0.1.1",
3
+ "version": "0.1.2",
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": {
@@ -83,6 +83,34 @@
83
83
  "default": "./dist/components/banner-function-declaration.mjs"
84
84
  }
85
85
  },
86
+ "./components/command-entry": {
87
+ "require": {
88
+ "types": "./dist/components/command-entry.d.cts",
89
+ "default": "./dist/components/command-entry.cjs"
90
+ },
91
+ "import": {
92
+ "types": "./dist/components/command-entry.d.mts",
93
+ "default": "./dist/components/command-entry.mjs"
94
+ },
95
+ "default": {
96
+ "types": "./dist/components/command-entry.d.mts",
97
+ "default": "./dist/components/command-entry.mjs"
98
+ }
99
+ },
100
+ "./components/virtual-command-entry": {
101
+ "require": {
102
+ "types": "./dist/components/virtual-command-entry.d.cts",
103
+ "default": "./dist/components/virtual-command-entry.cjs"
104
+ },
105
+ "import": {
106
+ "types": "./dist/components/virtual-command-entry.d.mts",
107
+ "default": "./dist/components/virtual-command-entry.mjs"
108
+ },
109
+ "default": {
110
+ "types": "./dist/components/virtual-command-entry.d.mts",
111
+ "default": "./dist/components/virtual-command-entry.mjs"
112
+ }
113
+ },
86
114
  "./package.json": "./package.json",
87
115
  "./types": {
88
116
  "require": {
@@ -113,6 +141,7 @@
113
141
  }
114
142
  }
115
143
  },
144
+ "types": "./dist/index.d.cts",
116
145
  "typings": "dist/index.d.mts",
117
146
  "files": ["dist/**/*"],
118
147
  "keywords": [
@@ -127,10 +156,13 @@
127
156
  "@powerlines/deepkit": "^0.6.50",
128
157
  "@powerlines/plugin-alloy": "^0.20.14",
129
158
  "@powerlines/plugin-plugin": "^0.12.221",
130
- "@shell-shock/core": "^0.5.0",
131
- "@shell-shock/plugin-theme": "^0.0.13",
132
- "@shell-shock/preset-script": "^0.3.3",
159
+ "@shell-shock/core": "^0.5.1",
160
+ "@shell-shock/plugin-theme": "^0.0.14",
161
+ "@shell-shock/preset-script": "^0.4.0",
162
+ "@stryke/path": "0.26.4",
163
+ "@stryke/string-format": "0.13.7",
133
164
  "cfonts": "^3.3.1",
165
+ "defu": "6.1.4",
134
166
  "powerlines": "^0.38.37"
135
167
  },
136
168
  "devDependencies": {
@@ -161,6 +193,5 @@
161
193
  "./package.json": "./package.json"
162
194
  }
163
195
  },
164
- "types": "./dist/index.d.cts",
165
- "gitHead": "533bcb80b1bcd7b3419e062287bedf4afed8a449"
196
+ "gitHead": "b2c853aae1d2d29bd12900d7850f8742382816ed"
166
197
  }