@shell-shock/preset-script 0.1.2 → 0.2.0

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 (44) hide show
  1. package/dist/components/args-parser-logic.d.cts +7 -7
  2. package/dist/components/args-parser-logic.d.cts.map +1 -1
  3. package/dist/components/bin-entry.cjs +15 -6
  4. package/dist/components/bin-entry.cjs.map +1 -1
  5. package/dist/components/bin-entry.d.cts +3 -3
  6. package/dist/components/bin-entry.d.cts.map +1 -1
  7. package/dist/components/bin-entry.d.mts +3 -3
  8. package/dist/components/bin-entry.d.mts.map +1 -1
  9. package/dist/components/bin-entry.mjs +15 -6
  10. package/dist/components/bin-entry.mjs.map +1 -1
  11. package/dist/components/command-entry.d.cts +4 -4
  12. package/dist/components/command-router.cjs +63 -38
  13. package/dist/components/command-router.cjs.map +1 -1
  14. package/dist/components/command-router.d.cts.map +1 -1
  15. package/dist/components/command-router.d.mts.map +1 -1
  16. package/dist/components/command-router.mjs +63 -38
  17. package/dist/components/command-router.mjs.map +1 -1
  18. package/dist/components/console-builtin.cjs +9 -6
  19. package/dist/components/console-builtin.cjs.map +1 -1
  20. package/dist/components/console-builtin.d.cts.map +1 -1
  21. package/dist/components/console-builtin.d.mts.map +1 -1
  22. package/dist/components/console-builtin.mjs +9 -6
  23. package/dist/components/console-builtin.mjs.map +1 -1
  24. package/dist/components/help.d.cts +5 -5
  25. package/dist/components/index.cjs +1 -1
  26. package/dist/components/index.d.cts +2 -2
  27. package/dist/components/index.d.mts +2 -2
  28. package/dist/components/index.mjs +2 -2
  29. package/dist/components/utils-builtin.d.cts +7 -7
  30. package/dist/components/virtual-command-entry.cjs +8 -1
  31. package/dist/components/virtual-command-entry.cjs.map +1 -1
  32. package/dist/components/virtual-command-entry.d.cts +3 -3
  33. package/dist/components/virtual-command-entry.d.cts.map +1 -1
  34. package/dist/components/virtual-command-entry.mjs +8 -1
  35. package/dist/components/virtual-command-entry.mjs.map +1 -1
  36. package/dist/index.cjs +3 -0
  37. package/dist/index.cjs.map +1 -1
  38. package/dist/index.d.cts.map +1 -1
  39. package/dist/index.d.mts.map +1 -1
  40. package/dist/index.mjs +3 -0
  41. package/dist/index.mjs.map +1 -1
  42. package/dist/types/plugin.d.cts.map +1 -1
  43. package/dist/types/plugin.d.mts.map +1 -1
  44. package/package.json +10 -10
@@ -1,4 +1,4 @@
1
- import * as _alloy_js_core7 from "@alloy-js/core";
1
+ import * as _alloy_js_core5 from "@alloy-js/core";
2
2
  import { CommandTree } from "@shell-shock/core/types/command";
3
3
 
4
4
  //#region src/components/help.d.ts
@@ -20,19 +20,19 @@ interface HelpUsageProps {
20
20
  /**
21
21
  * A component that generates the usage display for a command.
22
22
  */
23
- declare function HelpUsage(props: HelpUsageProps): _alloy_js_core7.Children;
23
+ declare function HelpUsage(props: HelpUsageProps): _alloy_js_core5.Children;
24
24
  /**
25
25
  * A component that generates the options table display for a command.
26
26
  */
27
27
  declare function HelpOptions(props: {
28
28
  command: CommandTree;
29
- }): _alloy_js_core7.Children;
29
+ }): _alloy_js_core5.Children;
30
30
  /**
31
31
  * A component that generates the commands table display for a command.
32
32
  */
33
33
  declare function HelpCommands(props: {
34
34
  command: CommandTree;
35
- }): _alloy_js_core7.Children;
35
+ }): _alloy_js_core5.Children;
36
36
  interface HelpProps {
37
37
  /**
38
38
  * The command to generate help for.
@@ -51,7 +51,7 @@ interface HelpProps {
51
51
  /**
52
52
  * A component that generates the `help` function declaration for a command.
53
53
  */
54
- declare function Help(props: HelpProps): _alloy_js_core7.Children;
54
+ declare function Help(props: HelpProps): _alloy_js_core5.Children;
55
55
  //#endregion
56
56
  export { Help, HelpCommands, HelpOptions, HelpProps, HelpUsage, HelpUsageProps };
57
57
  //# sourceMappingURL=help.d.cts.map
@@ -20,7 +20,6 @@ exports.ConsoleBuiltin = require_components_console_builtin.ConsoleBuiltin;
20
20
  exports.DividerFunctionDeclaration = require_components_console_builtin.DividerFunctionDeclaration;
21
21
  exports.EnvSupportUtilities = require_components_utils_builtin.EnvSupportUtilities;
22
22
  exports.ExitFunctionDeclaration = require_components_utils_builtin.ExitFunctionDeclaration;
23
- exports.ExitFunctionUsage = require_components_bin_entry.ExitFunctionUsage;
24
23
  exports.Help = require_components_help.Help;
25
24
  exports.HelpCommands = require_components_help.HelpCommands;
26
25
  exports.HelpOptions = require_components_help.HelpOptions;
@@ -33,6 +32,7 @@ exports.OptionsMember = require_components_args_parser_logic.OptionsMember;
33
32
  exports.OptionsMemberParserLogic = require_components_args_parser_logic.OptionsMemberParserLogic;
34
33
  exports.OptionsParserLogic = require_components_args_parser_logic.OptionsParserLogic;
35
34
  exports.ParamsParserLogic = require_components_args_parser_logic.ParamsParserLogic;
35
+ exports.RunApplication = require_components_bin_entry.RunApplication;
36
36
  exports.StripAnsiFunctionDeclaration = require_components_console_builtin.StripAnsiFunctionDeclaration;
37
37
  exports.TableFunctionDeclaration = require_components_console_builtin.TableFunctionDeclaration;
38
38
  exports.UtilsBuiltin = require_components_utils_builtin.UtilsBuiltin;
@@ -1,9 +1,9 @@
1
1
  import { OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserLogic, OptionsParserLogic, ParamsParserLogic, VariablePathsParserLogic } from "./args-parser-logic.cjs";
2
- import { BinEntry, BinEntryProps, ExitFunctionUsage } from "./bin-entry.cjs";
2
+ import { BinEntry, BinEntryProps, RunApplication } from "./bin-entry.cjs";
3
3
  import { CommandEntry, CommandEntryProps, CommandHandlerDeclaration, CommandInvocation } from "./command-entry.cjs";
4
4
  import { CommandRouter, CommandRouterProps, CommandRouterRoute } from "./command-router.cjs";
5
5
  import { ColorsDeclaration, ConsoleBuiltin, DividerFunctionDeclaration, LinkFunctionDeclaration, MessageFunctionDeclaration, MessageFunctionDeclarationProps, StripAnsiFunctionDeclaration, TableFunctionDeclaration, TableFunctionDeclarationProps, WrapAnsiFunction, WriteLineFunctionDeclaration } from "./console-builtin.cjs";
6
6
  import { Help, HelpCommands, HelpOptions, HelpProps, HelpUsage, HelpUsageProps } from "./help.cjs";
7
7
  import { ArgsUtilities, ColorSupportUtilities, EnvSupportUtilities, ExitFunctionDeclaration, HyperlinkSupportUtilities, UtilsBuiltin, UtilsBuiltinProps } from "./utils-builtin.cjs";
8
8
  import { VirtualCommandEntry, VirtualCommandEntryProps, VirtualCommandHandlerDeclaration } from "./virtual-command-entry.cjs";
9
- export { ArgsUtilities, BinEntry, BinEntryProps, ColorSupportUtilities, ColorsDeclaration, CommandEntry, CommandEntryProps, CommandHandlerDeclaration, CommandInvocation, CommandRouter, CommandRouterProps, CommandRouterRoute, ConsoleBuiltin, DividerFunctionDeclaration, EnvSupportUtilities, ExitFunctionDeclaration, ExitFunctionUsage, Help, HelpCommands, HelpOptions, HelpProps, HelpUsage, HelpUsageProps, HyperlinkSupportUtilities, LinkFunctionDeclaration, MessageFunctionDeclaration, MessageFunctionDeclarationProps, OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserLogic, OptionsParserLogic, ParamsParserLogic, StripAnsiFunctionDeclaration, TableFunctionDeclaration, TableFunctionDeclarationProps, UtilsBuiltin, UtilsBuiltinProps, VariablePathsParserLogic, VirtualCommandEntry, VirtualCommandEntryProps, VirtualCommandHandlerDeclaration, WrapAnsiFunction, WriteLineFunctionDeclaration };
9
+ export { ArgsUtilities, BinEntry, BinEntryProps, ColorSupportUtilities, ColorsDeclaration, CommandEntry, CommandEntryProps, CommandHandlerDeclaration, CommandInvocation, CommandRouter, CommandRouterProps, CommandRouterRoute, ConsoleBuiltin, DividerFunctionDeclaration, EnvSupportUtilities, ExitFunctionDeclaration, Help, HelpCommands, HelpOptions, HelpProps, HelpUsage, HelpUsageProps, HyperlinkSupportUtilities, LinkFunctionDeclaration, MessageFunctionDeclaration, MessageFunctionDeclarationProps, OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserLogic, OptionsParserLogic, ParamsParserLogic, RunApplication, StripAnsiFunctionDeclaration, TableFunctionDeclaration, TableFunctionDeclarationProps, UtilsBuiltin, UtilsBuiltinProps, VariablePathsParserLogic, VirtualCommandEntry, VirtualCommandEntryProps, VirtualCommandHandlerDeclaration, WrapAnsiFunction, WriteLineFunctionDeclaration };
@@ -1,9 +1,9 @@
1
1
  import { OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserLogic, OptionsParserLogic, ParamsParserLogic, VariablePathsParserLogic } from "./args-parser-logic.mjs";
2
- import { BinEntry, BinEntryProps, ExitFunctionUsage } from "./bin-entry.mjs";
2
+ import { BinEntry, BinEntryProps, RunApplication } from "./bin-entry.mjs";
3
3
  import { CommandEntry, CommandEntryProps, CommandHandlerDeclaration, CommandInvocation } from "./command-entry.mjs";
4
4
  import { CommandRouter, CommandRouterProps, CommandRouterRoute } from "./command-router.mjs";
5
5
  import { ColorsDeclaration, ConsoleBuiltin, DividerFunctionDeclaration, LinkFunctionDeclaration, MessageFunctionDeclaration, MessageFunctionDeclarationProps, StripAnsiFunctionDeclaration, TableFunctionDeclaration, TableFunctionDeclarationProps, WrapAnsiFunction, WriteLineFunctionDeclaration } from "./console-builtin.mjs";
6
6
  import { Help, HelpCommands, HelpOptions, HelpProps, HelpUsage, HelpUsageProps } from "./help.mjs";
7
7
  import { ArgsUtilities, ColorSupportUtilities, EnvSupportUtilities, ExitFunctionDeclaration, HyperlinkSupportUtilities, UtilsBuiltin, UtilsBuiltinProps } from "./utils-builtin.mjs";
8
8
  import { VirtualCommandEntry, VirtualCommandEntryProps, VirtualCommandHandlerDeclaration } from "./virtual-command-entry.mjs";
9
- export { ArgsUtilities, BinEntry, BinEntryProps, ColorSupportUtilities, ColorsDeclaration, CommandEntry, CommandEntryProps, CommandHandlerDeclaration, CommandInvocation, CommandRouter, CommandRouterProps, CommandRouterRoute, ConsoleBuiltin, DividerFunctionDeclaration, EnvSupportUtilities, ExitFunctionDeclaration, ExitFunctionUsage, Help, HelpCommands, HelpOptions, HelpProps, HelpUsage, HelpUsageProps, HyperlinkSupportUtilities, LinkFunctionDeclaration, MessageFunctionDeclaration, MessageFunctionDeclarationProps, OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserLogic, OptionsParserLogic, ParamsParserLogic, StripAnsiFunctionDeclaration, TableFunctionDeclaration, TableFunctionDeclarationProps, UtilsBuiltin, UtilsBuiltinProps, VariablePathsParserLogic, VirtualCommandEntry, VirtualCommandEntryProps, VirtualCommandHandlerDeclaration, WrapAnsiFunction, WriteLineFunctionDeclaration };
9
+ export { ArgsUtilities, BinEntry, BinEntryProps, ColorSupportUtilities, ColorsDeclaration, CommandEntry, CommandEntryProps, CommandHandlerDeclaration, CommandInvocation, CommandRouter, CommandRouterProps, CommandRouterRoute, ConsoleBuiltin, DividerFunctionDeclaration, EnvSupportUtilities, ExitFunctionDeclaration, Help, HelpCommands, HelpOptions, HelpProps, HelpUsage, HelpUsageProps, HyperlinkSupportUtilities, LinkFunctionDeclaration, MessageFunctionDeclaration, MessageFunctionDeclarationProps, OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserLogic, OptionsParserLogic, ParamsParserLogic, RunApplication, StripAnsiFunctionDeclaration, TableFunctionDeclaration, TableFunctionDeclarationProps, UtilsBuiltin, UtilsBuiltinProps, VariablePathsParserLogic, VirtualCommandEntry, VirtualCommandEntryProps, VirtualCommandHandlerDeclaration, WrapAnsiFunction, WriteLineFunctionDeclaration };
@@ -1,4 +1,4 @@
1
- import { BinEntry, ExitFunctionUsage } from "./bin-entry.mjs";
1
+ import { BinEntry, RunApplication } from "./bin-entry.mjs";
2
2
  import { OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserLogic, OptionsParserLogic, ParamsParserLogic, VariablePathsParserLogic } from "./args-parser-logic.mjs";
3
3
  import { Help, HelpCommands, HelpOptions, HelpUsage } from "./help.mjs";
4
4
  import { CommandRouter, CommandRouterRoute } from "./command-router.mjs";
@@ -7,4 +7,4 @@ import { CommandEntry, CommandHandlerDeclaration, CommandInvocation } from "./co
7
7
  import { ColorsDeclaration, ConsoleBuiltin, DividerFunctionDeclaration, LinkFunctionDeclaration, MessageFunctionDeclaration, StripAnsiFunctionDeclaration, TableFunctionDeclaration, WrapAnsiFunction, WriteLineFunctionDeclaration } from "./console-builtin.mjs";
8
8
  import { ArgsUtilities, ColorSupportUtilities, EnvSupportUtilities, ExitFunctionDeclaration, HyperlinkSupportUtilities, UtilsBuiltin } from "./utils-builtin.mjs";
9
9
 
10
- export { ArgsUtilities, BinEntry, ColorSupportUtilities, ColorsDeclaration, CommandEntry, CommandHandlerDeclaration, CommandInvocation, CommandRouter, CommandRouterRoute, ConsoleBuiltin, DividerFunctionDeclaration, EnvSupportUtilities, ExitFunctionDeclaration, ExitFunctionUsage, Help, HelpCommands, HelpOptions, HelpUsage, HyperlinkSupportUtilities, LinkFunctionDeclaration, MessageFunctionDeclaration, OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserLogic, OptionsParserLogic, ParamsParserLogic, StripAnsiFunctionDeclaration, TableFunctionDeclaration, UtilsBuiltin, VariablePathsParserLogic, VirtualCommandEntry, VirtualCommandHandlerDeclaration, WrapAnsiFunction, WriteLineFunctionDeclaration };
10
+ export { ArgsUtilities, BinEntry, ColorSupportUtilities, ColorsDeclaration, CommandEntry, CommandHandlerDeclaration, CommandInvocation, CommandRouter, CommandRouterRoute, ConsoleBuiltin, DividerFunctionDeclaration, EnvSupportUtilities, ExitFunctionDeclaration, Help, HelpCommands, HelpOptions, HelpUsage, HyperlinkSupportUtilities, LinkFunctionDeclaration, MessageFunctionDeclaration, OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserLogic, OptionsParserLogic, ParamsParserLogic, RunApplication, StripAnsiFunctionDeclaration, TableFunctionDeclaration, UtilsBuiltin, VariablePathsParserLogic, VirtualCommandEntry, VirtualCommandHandlerDeclaration, WrapAnsiFunction, WriteLineFunctionDeclaration };
@@ -1,4 +1,4 @@
1
- import * as _alloy_js_core1 from "@alloy-js/core";
1
+ import * as _alloy_js_core0 from "@alloy-js/core";
2
2
  import { BuiltinFileProps } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
3
3
 
4
4
  //#region src/components/utils-builtin.d.ts
@@ -6,27 +6,27 @@ interface UtilsBuiltinProps extends Omit<BuiltinFileProps, "id" | "description">
6
6
  /**
7
7
  * Generates utilities for detecting terminal color support.
8
8
  */
9
- declare function EnvSupportUtilities(): _alloy_js_core1.Children;
9
+ declare function EnvSupportUtilities(): _alloy_js_core0.Children;
10
10
  /**
11
11
  * Generates utilities for detecting terminal color support.
12
12
  */
13
- declare function ColorSupportUtilities(): _alloy_js_core1.Children;
13
+ declare function ColorSupportUtilities(): _alloy_js_core0.Children;
14
14
  /**
15
15
  * Generates utilities for detecting terminal color support.
16
16
  */
17
- declare function HyperlinkSupportUtilities(): _alloy_js_core1.Children;
17
+ declare function HyperlinkSupportUtilities(): _alloy_js_core0.Children;
18
18
  /**
19
19
  * Generates utilities for detecting terminal color support.
20
20
  */
21
- declare function ArgsUtilities(): _alloy_js_core1.Children;
21
+ declare function ArgsUtilities(): _alloy_js_core0.Children;
22
22
  /**
23
23
  * The `exit` handler function declaration code for the Shell Shock project.
24
24
  */
25
- declare function ExitFunctionDeclaration(): _alloy_js_core1.Children;
25
+ declare function ExitFunctionDeclaration(): _alloy_js_core0.Children;
26
26
  /**
27
27
  * A built-in utilities module for Shell Shock.
28
28
  */
29
- declare function UtilsBuiltin(props: UtilsBuiltinProps): _alloy_js_core1.Children;
29
+ declare function UtilsBuiltin(props: UtilsBuiltinProps): _alloy_js_core0.Children;
30
30
  //#endregion
31
31
  export { ArgsUtilities, ColorSupportUtilities, EnvSupportUtilities, ExitFunctionDeclaration, HyperlinkSupportUtilities, UtilsBuiltin, UtilsBuiltinProps };
32
32
  //# sourceMappingURL=utils-builtin.d.cts.map
@@ -86,7 +86,14 @@ function VirtualCommandEntry(props) {
86
86
  return filePath.value;
87
87
  },
88
88
  get imports() {
89
- return (0, defu.default)(imports ?? {}, Object.entries(command.children).filter(([, child]) => child.isVirtual).reduce((ret, [name, child]) => {
89
+ return (0, defu.default)({ didyoumean2: [
90
+ {
91
+ name: "didYouMean",
92
+ default: true
93
+ },
94
+ { name: "ReturnTypeEnums" },
95
+ { name: "ThresholdTypeEnums" }
96
+ ] }, imports ?? {}, Object.entries(command.children).filter(([, child]) => child.isVirtual).reduce((ret, [name, child]) => {
90
97
  ret[`./${child.name}`] = [{
91
98
  name: "handler",
92
99
  alias: `handle${(0, __stryke_string_format_pascal_case.pascalCase)(name)}`
@@ -1 +1 @@
1
- {"version":3,"file":"virtual-command-entry.cjs","names":["code","computed","For","Show","FunctionDeclaration","usePowerlines","TSDoc","TSDocParam","TSDocRemarks","TSDocTitle","TypescriptFile","getAppBin","getAppTitle","getVariableCommandPathName","isVariableCommandPath","joinPaths","constantCase","pascalCase","defu","CommandEntry","CommandRouter","Help","VirtualCommandHandlerDeclaration","props","command","context","_$createComponent","heading","title","path","segments","map","segment","join","children","description","replace","_$createIntrinsic","name","async","parameters","type","default","commands","_$memo","VirtualCommandEntry","imports","builtinImports","rest","filePath","entryPath","filter","_$mergeProps","value","Object","entries","child","isVirtual","reduce","ret","alias","console","utils","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 { code, computed, For, Show } from \"@alloy-js/core\";\nimport { FunctionDeclaration } from \"@alloy-js/typescript\";\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 {\n TSDoc,\n TSDocParam,\n TSDocRemarks,\n TSDocTitle\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { TypescriptFile } from \"@powerlines/plugin-alloy/typescript/components/typescript-file\";\nimport {\n getAppBin,\n getAppTitle,\n getVariableCommandPathName,\n isVariableCommandPath\n} from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport type { CommandTree } from \"@shell-shock/core/types/command\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { constantCase } from \"@stryke/string-format/constant-case\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport defu from \"defu\";\nimport type { ScriptPresetContext } from \"../types/plugin\";\nimport { CommandEntry } from \"./command-entry\";\nimport { CommandRouter } from \"./command-router\";\nimport { Help } from \"./help\";\n\n/**\n * A component that generates the `handler` function declaration for a command.\n */\nexport function VirtualCommandHandlerDeclaration(props: {\n command: CommandTree;\n}) {\n const { command } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n\n return (\n <>\n <TSDoc\n heading={`The ${command.title} (${getAppBin(context)} ${command.path.segments\n .map(segment =>\n isVariableCommandPath(segment)\n ? `[${constantCase(getVariableCommandPathName(segment))}]`\n : segment\n )\n .join(\" \")}) virtual command.`}>\n <TSDocRemarks>{`${command.description.replace(/\\.+$/, \"\")}.`}</TSDocRemarks>\n <hbr />\n <TSDocTitle>{command.title}</TSDocTitle>\n <TSDocParam name=\"args\">{`The command-line arguments passed to the command.`}</TSDocParam>\n </TSDoc>\n <FunctionDeclaration\n export\n async\n name=\"handler\"\n parameters={[{ name: \"args\", type: \"string[]\", default: \"getArgs()\" }]}>\n <CommandRouter\n path={command.path.segments}\n commands={command.children}\n />\n <hbr />\n <hbr />\n {code`\n writeLine(\"\");\n writeLine(colors.text.heading.primary(\"${getAppTitle(context)} - ${\n command.title\n }\"));\n writeLine(\"\");\n writeLine(colors.text.body.primary(\"${command.description.replace(/\\.+$/, \"\")}.\"));\n writeLine(\"\");`}\n <hbr />\n <Help command={command} />\n </FunctionDeclaration>\n </>\n );\n}\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<ScriptPresetContext>();\n const filePath = computed(() =>\n joinPaths(\n context.entryPath,\n command.path.segments\n .filter(segment => !isVariableCommandPath(segment))\n .join(\"/\"),\n \"index.ts\"\n )\n );\n\n return (\n <>\n <TypescriptFile\n {...rest}\n path={filePath.value}\n imports={defu(\n imports ?? {},\n Object.entries(command.children)\n .filter(([, child]) => child.isVirtual)\n .reduce((ret, [name, child]) => {\n ret[`./${child.name}`] = [\n { name: \"handler\", alias: `handle${pascalCase(name)}` }\n ];\n\n return ret;\n }, {} as TypescriptFileImports)\n )}\n builtinImports={defu(builtinImports ?? {}, {\n console: [\"warn\", \"error\", \"table\", \"colors\", \"writeLine\"],\n utils: [\"getArgs\"]\n })}>\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":";;;;;;;;;;;;;;;;;;;;;AAiDA,SAAgBsB,iCAAiCC,OAE9C;CACD,MAAM,EAAEC,YAAYD;CAEpB,MAAME,8EAA8C;AAEpD,QAAA,kDAEKnB,6DAAK;EAAA,IACJqB,UAAO;AAAA,UAAE,OAAOH,QAAQI,MAAK,mEAAeH,QAAQ,CAAA,GAAID,QAAQK,KAAKC,SAClEC,KAAIC,uFACmBA,QAAQ,GAC1B,2IAA4CA,QAAQ,CAAC,CAAA,KACrDA,QACL,CACAC,KAAK,IAAI,CAAA;;EAAoB,IAAAC,WAAA;AAAA,UAAA;qDAC/B1B,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AC7BiB,QAAQ,GAAGK,WAAWA,MAAMC,UAAU,CACtCC,QAAQC,KAAK,CAACrB,MAAMkB,WAAW;AAC9BG,QAAI,KAAKH,MAAMlB,UAAU,CACvB;KAAEA,MAAM;KAAWsB,OAAO,4DAAoBtB,KAAK;KAAI,CACxD;AAED,WAAOqB;MACN,EAA2B,CAClC,CAAC;;EAAA,IACDZ,iBAAc;AAAA,4BAAOA,kBAAkB,EAAE,EAAE;IACzCc,SAAS;KAAC;KAAQ;KAAS;KAAS;KAAU;KAAY;IAC1DC,OAAO,CAAC,UAAS;IAClB,CAAC;;EAAA,IAAA5B,WAAA;AAAA,2DACDZ,kCAAgC,EAAUE,SAAO,CAAA;;EAAA,CAAA,CAAA,mDAEnDtB,qBAAG;EAAA,IAAC6D,OAAI;AAAA,UAAET,OAAOU,OAAOxC,QAAQU,SAAS;;EAAAA,WACvCsB,2DACErD,sBAAI;GAAA,IACH8D,OAAI;AAAA,WAAET,MAAMC;;GAAS,IACrBS,WAAQ;AAAA,4DAAG/C,+CAAY,EAACK,SAASgC,OAAK,CAAA;;GAAA,IAAAtB,WAAA;AAAA,4DACrCW,qBAAmB,EAACrB,SAASgC,OAAK,CAAA;;GAAA,CAAA;EAEtC,CAAA,CAAA"}
1
+ {"version":3,"file":"virtual-command-entry.cjs","names":["code","computed","For","Show","FunctionDeclaration","usePowerlines","TSDoc","TSDocParam","TSDocRemarks","TSDocTitle","TypescriptFile","getAppBin","getAppTitle","getVariableCommandPathName","isVariableCommandPath","joinPaths","constantCase","pascalCase","defu","CommandEntry","CommandRouter","Help","VirtualCommandHandlerDeclaration","props","command","context","_$createComponent","heading","title","path","segments","map","segment","join","children","description","replace","_$createIntrinsic","name","async","parameters","type","default","commands","_$memo","VirtualCommandEntry","imports","builtinImports","rest","filePath","entryPath","filter","_$mergeProps","value","didyoumean2","Object","entries","child","isVirtual","reduce","ret","alias","console","utils","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 { code, computed, For, Show } from \"@alloy-js/core\";\nimport { FunctionDeclaration } from \"@alloy-js/typescript\";\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 {\n TSDoc,\n TSDocParam,\n TSDocRemarks,\n TSDocTitle\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { TypescriptFile } from \"@powerlines/plugin-alloy/typescript/components/typescript-file\";\nimport {\n getAppBin,\n getAppTitle,\n getVariableCommandPathName,\n isVariableCommandPath\n} from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport type { CommandTree } from \"@shell-shock/core/types/command\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { constantCase } from \"@stryke/string-format/constant-case\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport defu from \"defu\";\nimport type { ScriptPresetContext } from \"../types/plugin\";\nimport { CommandEntry } from \"./command-entry\";\nimport { CommandRouter } from \"./command-router\";\nimport { Help } from \"./help\";\n\n/**\n * A component that generates the `handler` function declaration for a command.\n */\nexport function VirtualCommandHandlerDeclaration(props: {\n command: CommandTree;\n}) {\n const { command } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n\n return (\n <>\n <TSDoc\n heading={`The ${command.title} (${getAppBin(context)} ${command.path.segments\n .map(segment =>\n isVariableCommandPath(segment)\n ? `[${constantCase(getVariableCommandPathName(segment))}]`\n : segment\n )\n .join(\" \")}) virtual command.`}>\n <TSDocRemarks>{`${command.description.replace(/\\.+$/, \"\")}.`}</TSDocRemarks>\n <hbr />\n <TSDocTitle>{command.title}</TSDocTitle>\n <TSDocParam name=\"args\">{`The command-line arguments passed to the command.`}</TSDocParam>\n </TSDoc>\n <FunctionDeclaration\n export\n async\n name=\"handler\"\n parameters={[{ name: \"args\", type: \"string[]\", default: \"getArgs()\" }]}>\n <CommandRouter\n path={command.path.segments}\n commands={command.children}\n />\n <hbr />\n <hbr />\n {code`\n writeLine(\"\");\n writeLine(colors.text.heading.primary(\"${getAppTitle(context)} - ${\n command.title\n }\"));\n writeLine(\"\");\n writeLine(colors.text.body.primary(\"${command.description.replace(/\\.+$/, \"\")}.\"));\n writeLine(\"\");`}\n <hbr />\n <Help command={command} />\n </FunctionDeclaration>\n </>\n );\n}\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<ScriptPresetContext>();\n const filePath = computed(() =>\n joinPaths(\n context.entryPath,\n command.path.segments\n .filter(segment => !isVariableCommandPath(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\"]\n })}>\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":";;;;;;;;;;;;;;;;;;;;;AAiDA,SAAgBsB,iCAAiCC,OAE9C;CACD,MAAM,EAAEC,YAAYD;CAEpB,MAAME,8EAA8C;AAEpD,QAAA,kDAEKnB,6DAAK;EAAA,IACJqB,UAAO;AAAA,UAAE,OAAOH,QAAQI,MAAK,mEAAeH,QAAQ,CAAA,GAAID,QAAQK,KAAKC,SAClEC,KAAIC,uFACmBA,QAAQ,GAC1B,2IAA4CA,QAAQ,CAAC,CAAA,KACrDA,QACL,CACAC,KAAK,IAAI,CAAA;;EAAoB,IAAAC,WAAA;AAAA,UAAA;qDAC/B1B,oEAAY,EAAA,IAAA0B,WAAA;AAAA,YAAE,GAAGV,QAAQW,YAAYC,QAAQ,QAAQ,GAAG,CAAA;OAAG,CAAA;qDAAA,OAAA,EAAA,CAAA;qDAE3D3B,kEAAU,EAAA,IAAAyB,WAAA;AAAA,YAAEV,QAAQI;OAAK,CAAA;qDACzBrB,kEAAU;KAAC+B,MAAI;KAAAJ,UAAS;KAAmD,CAAA;IAAA;;EAAA,CAAA,mDAE7E9B,2CAAmB;EAAA,UAAA;EAElBmC,OAAK;EACLD,MAAI;EACJE,YAAY,CAAC;GAAEF,MAAM;GAAQG,MAAM;GAAYC,SAAS;GAAa,CAAC;EAAA,IAAAR,WAAA;AAAA,UAAA;qDACrEd,iDAAa;KAAA,IACZS,OAAI;AAAA,aAAEL,QAAQK,KAAKC;;KAAQ,IAC3Ba,WAAQ;AAAA,aAAEnB,QAAQU;;KAAQ,CAAA;qDAAA,OAAA,EAAA,CAAA;qDAAA,OAAA,EAAA,CAAA;gDAI3BlC,o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,UAAET,OAAOU,OAAOzC,QAAQU,SAAS;;EAAAA,WACvCuB,2DACEtD,sBAAI;GAAA,IACH+D,OAAI;AAAA,WAAET,MAAMC;;GAAS,IACrBS,WAAQ;AAAA,4DAAGhD,+CAAY,EAACK,SAASiC,OAAK,CAAA;;GAAA,IAAAvB,WAAA;AAAA,4DACrCW,qBAAmB,EAACrB,SAASiC,OAAK,CAAA;;GAAA,CAAA;EAEtC,CAAA,CAAA"}
@@ -1,4 +1,4 @@
1
- import * as _alloy_js_core0 from "@alloy-js/core";
1
+ import * as _alloy_js_core18 from "@alloy-js/core";
2
2
  import { CommandTree } from "@shell-shock/core/types/command";
3
3
  import { EntryFileProps } from "@powerlines/plugin-alloy/typescript/components/entry-file";
4
4
 
@@ -8,14 +8,14 @@ import { EntryFileProps } from "@powerlines/plugin-alloy/typescript/components/e
8
8
  */
9
9
  declare function VirtualCommandHandlerDeclaration(props: {
10
10
  command: CommandTree;
11
- }): _alloy_js_core0.Children;
11
+ }): _alloy_js_core18.Children;
12
12
  interface VirtualCommandEntryProps extends Omit<EntryFileProps, "path" | "typeDefinition"> {
13
13
  command: CommandTree;
14
14
  }
15
15
  /**
16
16
  * The virtual command entry point for the Shell Shock project.
17
17
  */
18
- declare function VirtualCommandEntry(props: VirtualCommandEntryProps): _alloy_js_core0.Children;
18
+ declare function VirtualCommandEntry(props: VirtualCommandEntryProps): _alloy_js_core18.Children;
19
19
  //#endregion
20
20
  export { VirtualCommandEntry, VirtualCommandEntryProps, VirtualCommandHandlerDeclaration };
21
21
  //# sourceMappingURL=virtual-command-entry.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"virtual-command-entry.d.cts","names":[],"sources":["../../src/components/virtual-command-entry.tsx"],"sourcesContent":[],"mappings":";;;;;;;;AAiDgB,iBAAA,gCAAA,CACL,KAAA,EAAW;EA+CL,OAAA,EA/CN,WA+CM;CACf,CAAA,EAhDoB,eAAA,CACrB,QA+CC;AAGS,UAJM,wBAAA,SAAiC,IAIvC,CAHT,cAGS,EAAA,MAAA,GAAA,gBAAA,CAAA,CAAA;EAJuC,OAAA,EAIvC,WAJuC;;AAUlD;;;iBAAgB,mBAAA,QAA2B,2BAAwB,eAAA,CAAA"}
1
+ {"version":3,"file":"virtual-command-entry.d.cts","names":[],"sources":["../../src/components/virtual-command-entry.tsx"],"sourcesContent":[],"mappings":";;;;;;;;AAiDgB,iBAAA,gCAAA,CACL,KAAA,EAAW;EA+CL,OAAA,EA/CN,WA+CM;CACf,CAAA,EAhDoB,gBAAA,CACrB,QA+CC;AAGS,UAJM,wBAAA,SAAiC,IAIvC,CAHT,cAGS,EAAA,MAAA,GAAA,gBAAA,CAAA,CAAA;EAJuC,OAAA,EAIvC,WAJuC;;AAUlD;;;iBAAgB,mBAAA,QAA2B,2BAAwB,gBAAA,CAAA"}
@@ -84,7 +84,14 @@ function VirtualCommandEntry(props) {
84
84
  return filePath.value;
85
85
  },
86
86
  get imports() {
87
- return defu(imports ?? {}, Object.entries(command.children).filter(([, child]) => child.isVirtual).reduce((ret, [name, child]) => {
87
+ return defu({ didyoumean2: [
88
+ {
89
+ name: "didYouMean",
90
+ default: true
91
+ },
92
+ { name: "ReturnTypeEnums" },
93
+ { name: "ThresholdTypeEnums" }
94
+ ] }, imports ?? {}, Object.entries(command.children).filter(([, child]) => child.isVirtual).reduce((ret, [name, child]) => {
88
95
  ret[`./${child.name}`] = [{
89
96
  name: "handler",
90
97
  alias: `handle${pascalCase(name)}`
@@ -1 +1 @@
1
- {"version":3,"file":"virtual-command-entry.mjs","names":["code","computed","For","Show","FunctionDeclaration","usePowerlines","TSDoc","TSDocParam","TSDocRemarks","TSDocTitle","TypescriptFile","getAppBin","getAppTitle","getVariableCommandPathName","isVariableCommandPath","joinPaths","constantCase","pascalCase","defu","CommandEntry","CommandRouter","Help","VirtualCommandHandlerDeclaration","props","command","context","_$createComponent","heading","title","path","segments","map","segment","join","children","description","replace","_$createIntrinsic","name","async","parameters","type","default","commands","_$memo","VirtualCommandEntry","imports","builtinImports","rest","filePath","entryPath","filter","_$mergeProps","value","Object","entries","child","isVirtual","reduce","ret","alias","console","utils","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 { code, computed, For, Show } from \"@alloy-js/core\";\nimport { FunctionDeclaration } from \"@alloy-js/typescript\";\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 {\n TSDoc,\n TSDocParam,\n TSDocRemarks,\n TSDocTitle\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { TypescriptFile } from \"@powerlines/plugin-alloy/typescript/components/typescript-file\";\nimport {\n getAppBin,\n getAppTitle,\n getVariableCommandPathName,\n isVariableCommandPath\n} from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport type { CommandTree } from \"@shell-shock/core/types/command\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { constantCase } from \"@stryke/string-format/constant-case\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport defu from \"defu\";\nimport type { ScriptPresetContext } from \"../types/plugin\";\nimport { CommandEntry } from \"./command-entry\";\nimport { CommandRouter } from \"./command-router\";\nimport { Help } from \"./help\";\n\n/**\n * A component that generates the `handler` function declaration for a command.\n */\nexport function VirtualCommandHandlerDeclaration(props: {\n command: CommandTree;\n}) {\n const { command } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n\n return (\n <>\n <TSDoc\n heading={`The ${command.title} (${getAppBin(context)} ${command.path.segments\n .map(segment =>\n isVariableCommandPath(segment)\n ? `[${constantCase(getVariableCommandPathName(segment))}]`\n : segment\n )\n .join(\" \")}) virtual command.`}>\n <TSDocRemarks>{`${command.description.replace(/\\.+$/, \"\")}.`}</TSDocRemarks>\n <hbr />\n <TSDocTitle>{command.title}</TSDocTitle>\n <TSDocParam name=\"args\">{`The command-line arguments passed to the command.`}</TSDocParam>\n </TSDoc>\n <FunctionDeclaration\n export\n async\n name=\"handler\"\n parameters={[{ name: \"args\", type: \"string[]\", default: \"getArgs()\" }]}>\n <CommandRouter\n path={command.path.segments}\n commands={command.children}\n />\n <hbr />\n <hbr />\n {code`\n writeLine(\"\");\n writeLine(colors.text.heading.primary(\"${getAppTitle(context)} - ${\n command.title\n }\"));\n writeLine(\"\");\n writeLine(colors.text.body.primary(\"${command.description.replace(/\\.+$/, \"\")}.\"));\n writeLine(\"\");`}\n <hbr />\n <Help command={command} />\n </FunctionDeclaration>\n </>\n );\n}\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<ScriptPresetContext>();\n const filePath = computed(() =>\n joinPaths(\n context.entryPath,\n command.path.segments\n .filter(segment => !isVariableCommandPath(segment))\n .join(\"/\"),\n \"index.ts\"\n )\n );\n\n return (\n <>\n <TypescriptFile\n {...rest}\n path={filePath.value}\n imports={defu(\n imports ?? {},\n Object.entries(command.children)\n .filter(([, child]) => child.isVirtual)\n .reduce((ret, [name, child]) => {\n ret[`./${child.name}`] = [\n { name: \"handler\", alias: `handle${pascalCase(name)}` }\n ];\n\n return ret;\n }, {} as TypescriptFileImports)\n )}\n builtinImports={defu(builtinImports ?? {}, {\n console: [\"warn\", \"error\", \"table\", \"colors\", \"writeLine\"],\n utils: [\"getArgs\"]\n })}>\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":";;;;;;;;;;;;;;;;;;;AAiDA,SAAgBsB,iCAAiCC,OAE9C;CACD,MAAM,EAAEC,YAAYD;CAEpB,MAAME,UAAUpB,eAAoC;AAEpD,QAAA,CAAAqB,gBAEKpB,OAAK;EAAA,IACJqB,UAAO;AAAA,UAAE,OAAOH,QAAQI,MAAK,IAAKjB,UAAUc,QAAQ,CAAA,GAAID,QAAQK,KAAKC,SAClEC,KAAIC,YACHlB,sBAAsBkB,QAAQ,GAC1B,IAAIhB,aAAaH,2BAA2BmB,QAAQ,CAAC,CAAA,KACrDA,QACL,CACAC,KAAK,IAAI,CAAA;;EAAoB,IAAAC,WAAA;AAAA,UAAA;IAAAR,gBAC/BlB,cAAY,EAAA,IAAA0B,WAAA;AAAA,YAAE,GAAGV,QAAQW,YAAYC,QAAQ,QAAQ,GAAG,CAAA;OAAG,CAAA;IAAAC,gBAAA,OAAA,EAAA,CAAA;IAAAX,gBAE3DjB,YAAU,EAAA,IAAAyB,WAAA;AAAA,YAAEV,QAAQI;OAAK,CAAA;IAAAF,gBACzBnB,YAAU;KAAC+B,MAAI;KAAAJ,UAAS;KAAmD,CAAA;IAAA;;EAAA,CAAA,EAAAR,gBAE7EtB,qBAAmB;EAAA,UAAA;EAElBmC,OAAK;EACLD,MAAI;EACJE,YAAY,CAAC;GAAEF,MAAM;GAAQG,MAAM;GAAYC,SAAS;GAAa,CAAC;EAAA,IAAAR,WAAA;AAAA,UAAA;IAAAR,gBACrEN,eAAa;KAAA,IACZS,OAAI;AAAA,aAAEL,QAAQK,KAAKC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AAA,UAAAR,gBACDJ,kCAAgC,EAAUE,SAAO,CAAA;;EAAA,CAAA,CAAA,EAAAE,gBAEnDxB,KAAG;EAAA,IAAC6D,OAAI;AAAA,UAAET,OAAOU,OAAOxC,QAAQU,SAAS;;EAAAA,WACvCsB,UAAK9B,gBACHvB,MAAI;GAAA,IACH8D,OAAI;AAAA,WAAET,MAAMC;;GAAS,IACrBS,WAAQ;AAAA,WAAAxC,gBAAGP,cAAY,EAACK,SAASgC,OAAK,CAAA;;GAAA,IAAAtB,WAAA;AAAA,WAAAR,gBACrCmB,qBAAmB,EAACrB,SAASgC,OAAK,CAAA;;GAAA,CAAA;EAEtC,CAAA,CAAA"}
1
+ {"version":3,"file":"virtual-command-entry.mjs","names":["code","computed","For","Show","FunctionDeclaration","usePowerlines","TSDoc","TSDocParam","TSDocRemarks","TSDocTitle","TypescriptFile","getAppBin","getAppTitle","getVariableCommandPathName","isVariableCommandPath","joinPaths","constantCase","pascalCase","defu","CommandEntry","CommandRouter","Help","VirtualCommandHandlerDeclaration","props","command","context","_$createComponent","heading","title","path","segments","map","segment","join","children","description","replace","_$createIntrinsic","name","async","parameters","type","default","commands","_$memo","VirtualCommandEntry","imports","builtinImports","rest","filePath","entryPath","filter","_$mergeProps","value","didyoumean2","Object","entries","child","isVirtual","reduce","ret","alias","console","utils","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 { code, computed, For, Show } from \"@alloy-js/core\";\nimport { FunctionDeclaration } from \"@alloy-js/typescript\";\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 {\n TSDoc,\n TSDocParam,\n TSDocRemarks,\n TSDocTitle\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport { TypescriptFile } from \"@powerlines/plugin-alloy/typescript/components/typescript-file\";\nimport {\n getAppBin,\n getAppTitle,\n getVariableCommandPathName,\n isVariableCommandPath\n} from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport type { CommandTree } from \"@shell-shock/core/types/command\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { constantCase } from \"@stryke/string-format/constant-case\";\nimport { pascalCase } from \"@stryke/string-format/pascal-case\";\nimport defu from \"defu\";\nimport type { ScriptPresetContext } from \"../types/plugin\";\nimport { CommandEntry } from \"./command-entry\";\nimport { CommandRouter } from \"./command-router\";\nimport { Help } from \"./help\";\n\n/**\n * A component that generates the `handler` function declaration for a command.\n */\nexport function VirtualCommandHandlerDeclaration(props: {\n command: CommandTree;\n}) {\n const { command } = props;\n\n const context = usePowerlines<ScriptPresetContext>();\n\n return (\n <>\n <TSDoc\n heading={`The ${command.title} (${getAppBin(context)} ${command.path.segments\n .map(segment =>\n isVariableCommandPath(segment)\n ? `[${constantCase(getVariableCommandPathName(segment))}]`\n : segment\n )\n .join(\" \")}) virtual command.`}>\n <TSDocRemarks>{`${command.description.replace(/\\.+$/, \"\")}.`}</TSDocRemarks>\n <hbr />\n <TSDocTitle>{command.title}</TSDocTitle>\n <TSDocParam name=\"args\">{`The command-line arguments passed to the command.`}</TSDocParam>\n </TSDoc>\n <FunctionDeclaration\n export\n async\n name=\"handler\"\n parameters={[{ name: \"args\", type: \"string[]\", default: \"getArgs()\" }]}>\n <CommandRouter\n path={command.path.segments}\n commands={command.children}\n />\n <hbr />\n <hbr />\n {code`\n writeLine(\"\");\n writeLine(colors.text.heading.primary(\"${getAppTitle(context)} - ${\n command.title\n }\"));\n writeLine(\"\");\n writeLine(colors.text.body.primary(\"${command.description.replace(/\\.+$/, \"\")}.\"));\n writeLine(\"\");`}\n <hbr />\n <Help command={command} />\n </FunctionDeclaration>\n </>\n );\n}\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<ScriptPresetContext>();\n const filePath = computed(() =>\n joinPaths(\n context.entryPath,\n command.path.segments\n .filter(segment => !isVariableCommandPath(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\"]\n })}>\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":";;;;;;;;;;;;;;;;;;;AAiDA,SAAgBsB,iCAAiCC,OAE9C;CACD,MAAM,EAAEC,YAAYD;CAEpB,MAAME,UAAUpB,eAAoC;AAEpD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AGP,cAAY,EAACK,SAASiC,OAAK,CAAA;;GAAA,IAAAvB,WAAA;AAAA,WAAAR,gBACrCmB,qBAAmB,EAACrB,SAASiC,OAAK,CAAA;;GAAA,CAAA;EAEtC,CAAA,CAAA"}
package/dist/index.cjs CHANGED
@@ -34,6 +34,9 @@ const plugin = (options = {}) => {
34
34
  ...options
35
35
  };
36
36
  },
37
+ configResolved() {
38
+ this.dependencies.didyoumean2 = "^7.0.4";
39
+ },
37
40
  async prepare() {
38
41
  this.debug("Rendering built-in modules for the Shell Shock `script` preset.");
39
42
  return (0, __powerlines_plugin_alloy_render.render)(this, [(0, __alloy_js_core_jsx_runtime.createComponent)(require_components_utils_builtin.UtilsBuiltin, {}), (0, __alloy_js_core_jsx_runtime.createComponent)(require_components_console_builtin.ConsoleBuiltin, {})]);
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["code","For","Show","VarDeclaration","render","getCommandTree","getAppDescription","getAppTitle","theme","BinEntry","CommandEntry","CommandRouter","ConsoleBuiltin","Help","UtilsBuiltin","VirtualCommandEntry","getDefaultOptions","plugin","options","name","config","debug","defaultOptions","isCaseSensitive","prepare","_$createComponent","order","handler","_self$","commands","inputs","map","input","path","segments","filter","Boolean","builtinImports","console","utils","children","when","_$memo","Object","keys","length","type","initializer","_$createIntrinsic","test","toLowerCase","packageJson","version","each","values","doubleHardline","joiner","child","title","description","command","indent","isVirtual","fallback"],"sources":["../src/index.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, For, Show } from \"@alloy-js/core\";\nimport { VarDeclaration } from \"@alloy-js/typescript\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport { getCommandTree } from \"@shell-shock/core/plugin-utils\";\nimport {\n getAppDescription,\n getAppTitle\n} from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport type { CommandTree } from \"@shell-shock/core/types/command\";\nimport theme from \"@shell-shock/plugin-theme\";\nimport type { Plugin } from \"powerlines/types/plugin\";\nimport { BinEntry } from \"./components/bin-entry\";\nimport { CommandEntry } from \"./components/command-entry\";\nimport { CommandRouter } from \"./components/command-router\";\nimport { ConsoleBuiltin } from \"./components/console-builtin\";\nimport { Help } from \"./components/help\";\nimport { UtilsBuiltin } from \"./components/utils-builtin\";\nimport { VirtualCommandEntry } from \"./components/virtual-command-entry\";\nimport { getDefaultOptions } from \"./helpers/get-default-options\";\nimport type { ScriptPresetContext, ScriptPresetOptions } from \"./types/plugin\";\n\n/**\n * The Shell Shock base plugin.\n */\nexport const plugin = <\n TContext extends ScriptPresetContext = ScriptPresetContext\n>(\n options: ScriptPresetOptions = {}\n) => {\n return [\n theme({\n theme: options.theme\n }),\n {\n name: \"shell-shock:script-preset\",\n config() {\n this.debug(\n \"Providing default configuration for the Shell Shock `script` preset.\"\n );\n\n return {\n defaultOptions: getDefaultOptions,\n isCaseSensitive: false,\n ...options\n };\n },\n async prepare() {\n this.debug(\n \"Rendering built-in modules for the Shell Shock `script` preset.\"\n );\n\n return render(\n this,\n <>\n <UtilsBuiltin />\n <ConsoleBuiltin />\n </>\n );\n }\n },\n {\n name: \"shell-shock:script-preset:generate-entrypoint\",\n prepare: {\n order: \"post\",\n async handler() {\n this.debug(\n \"Rendering entrypoint modules for the Shell Shock `script` preset.\"\n );\n\n const commands = this.inputs\n .map(input => getCommandTree(this, input.path.segments))\n .filter(Boolean) as CommandTree[];\n\n return render(\n this,\n <>\n <BinEntry\n builtinImports={{\n console: [\"divider\", \"writeLine\", \"colors\"],\n utils: [\"getArgs\"]\n }}>\n <Show\n when={this.commands && Object.keys(this.commands).length > 0}>\n <VarDeclaration\n const\n name=\"args\"\n type=\"string[]\"\n initializer={code`getArgs();`}\n />\n <hbr />\n <CommandRouter path={[]} commands={this.commands ?? {}} />\n <hbr />\n <hbr />\n {code`\n writeLine(\"\");\n writeLine(colors.text.heading.primary(\"${\n /(?:cli|command-line|command line)\\s+(?:application|app)?$/.test(\n getAppTitle(this).toLowerCase()\n )\n ? getAppTitle(this)\n : `${getAppTitle(this)} Command-Line Application`\n } v${this.packageJson.version}\"));\n writeLine(\"\");\n writeLine(colors.text.body.primary(\"${getAppDescription(\n this\n )}\"));\n writeLine(\"\");\n divider({ style: \"primary\" });\n writeLine(\"\");\n writeLine(\"\");`}\n <hbr />\n <hbr />\n <For\n each={Object.values(commands)}\n doubleHardline\n joiner={code`\n writeLine(\"\");\n divider({ style: \"secondary\" });\n writeLine(\"\");\n writeLine(\"\");\n `}>\n {child => (\n <>\n {code`\n writeLine(\"\");\n writeLine(colors.text.heading.secondary(\"${child.title}\"));\n writeLine(\"\");\n writeLine(colors.text.body.secondary(\"${child.description}\"));\n writeLine(\"\");\n writeLine(\"\");\n `}\n <hbr />\n <Help command={child} indent={2} />\n </>\n )}\n </For>\n </Show>\n </BinEntry>\n <For each={Object.values(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 </>\n );\n }\n }\n }\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA0CA,MAAaiB,UAGXC,UAA+B,EAAE,KAC9B;AACH,QAAO;0CACC,EACJV,OAAOU,QAAQV,OAChB,CAAC;EACF;GACEW,MAAM;GACNC,SAAS;AACP,SAAKC,MACH,uEACD;AAED,WAAO;KACLC,gBAAgBN;KAChBO,iBAAiB;KACjB,GAAGL;KACJ;;GAEH,MAAMM,UAAU;AACd,SAAKH,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D,oBAAI;;;;;;WAKfwC,WACIiB,UAAK;wDAEDzD,oBAAI;;2DAE8ByD,MAAMC,MAAK;;wDAEdD,MAAME,YAAW;;;kBAGxD;6DAAA,OAAA,EAAA,CAAA;6DAEQ9C,8BAAI;aAAC+C,SAASH;aAAOI,QAAQ;aAAC,CAAA;YAAA;WAElC,CAAA;UAAA;;QAAA,CAAA;;MAAA,CAAA,mDAIN5D,qBAAG;MAAA,IAACoD,OAAI;AAAA,cAAEV,OAAOW,OAAOzB,SAAS;;MAAE0B,gBAAc;MAAAf,WAC/CiB,2DACEvD,sBAAI;OAAA,IACHuC,OAAI;AAAA,eAAEgB,MAAMK;;OAAS,IACrBC,WAAQ;AAAA,gEAAGrD,+CAAY,EAACkD,SAASH,OAAK,CAAA;;OAAA,IAAAjB,WAAA;AAAA,gEACrCzB,8DAAmB,EAAC6C,SAASH,OAAK,CAAA;;OAAA,CAAA;MAEtC,CAAA,CAGP,CAAC;;IAEL;GACD;EACF;;AAGH,kBAAexC"}
1
+ {"version":3,"file":"index.cjs","names":["code","For","Show","VarDeclaration","render","getCommandTree","getAppDescription","getAppTitle","theme","BinEntry","CommandEntry","CommandRouter","ConsoleBuiltin","Help","UtilsBuiltin","VirtualCommandEntry","getDefaultOptions","plugin","options","name","config","debug","defaultOptions","isCaseSensitive","configResolved","dependencies","didyoumean2","prepare","_$createComponent","order","handler","_self$","commands","inputs","map","input","path","segments","filter","Boolean","builtinImports","console","utils","children","when","_$memo","Object","keys","length","type","initializer","_$createIntrinsic","test","toLowerCase","packageJson","version","each","values","doubleHardline","joiner","child","title","description","command","indent","isVirtual","fallback"],"sources":["../src/index.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, For, Show } from \"@alloy-js/core\";\nimport { VarDeclaration } from \"@alloy-js/typescript\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport { getCommandTree } from \"@shell-shock/core/plugin-utils\";\nimport {\n getAppDescription,\n getAppTitle\n} from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport type { CommandTree } from \"@shell-shock/core/types/command\";\nimport theme from \"@shell-shock/plugin-theme\";\nimport type { Plugin } from \"powerlines/types/plugin\";\nimport { BinEntry } from \"./components/bin-entry\";\nimport { CommandEntry } from \"./components/command-entry\";\nimport { CommandRouter } from \"./components/command-router\";\nimport { ConsoleBuiltin } from \"./components/console-builtin\";\nimport { Help } from \"./components/help\";\nimport { UtilsBuiltin } from \"./components/utils-builtin\";\nimport { VirtualCommandEntry } from \"./components/virtual-command-entry\";\nimport { getDefaultOptions } from \"./helpers/get-default-options\";\nimport type { ScriptPresetContext, ScriptPresetOptions } from \"./types/plugin\";\n\n/**\n * The Shell Shock base plugin.\n */\nexport const plugin = <\n TContext extends ScriptPresetContext = ScriptPresetContext\n>(\n options: ScriptPresetOptions = {}\n) => {\n return [\n theme({\n theme: options.theme\n }),\n {\n name: \"shell-shock:script-preset\",\n config() {\n this.debug(\n \"Providing default configuration for the Shell Shock `script` 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 `script` preset.\"\n );\n\n return render(\n this,\n <>\n <UtilsBuiltin />\n <ConsoleBuiltin />\n </>\n );\n }\n },\n {\n name: \"shell-shock:script-preset:generate-entrypoint\",\n prepare: {\n order: \"post\",\n async handler() {\n this.debug(\n \"Rendering entrypoint modules for the Shell Shock `script` preset.\"\n );\n\n const commands = this.inputs\n .map(input => getCommandTree(this, input.path.segments))\n .filter(Boolean) as CommandTree[];\n\n return render(\n this,\n <>\n <BinEntry\n builtinImports={{\n console: [\"divider\", \"writeLine\", \"colors\"],\n utils: [\"getArgs\"]\n }}>\n <Show\n when={this.commands && Object.keys(this.commands).length > 0}>\n <VarDeclaration\n const\n name=\"args\"\n type=\"string[]\"\n initializer={code`getArgs();`}\n />\n <hbr />\n <CommandRouter path={[]} commands={this.commands ?? {}} />\n <hbr />\n <hbr />\n {code`\n writeLine(\"\");\n writeLine(colors.text.heading.primary(\"${\n /(?:cli|command-line|command line)\\s+(?:application|app)?$/.test(\n getAppTitle(this).toLowerCase()\n )\n ? getAppTitle(this)\n : `${getAppTitle(this)} Command-Line Application`\n } v${this.packageJson.version}\"));\n writeLine(\"\");\n writeLine(colors.text.body.primary(\"${getAppDescription(\n this\n )}\"));\n writeLine(\"\");\n divider({ style: \"primary\" });\n writeLine(\"\");\n writeLine(\"\");`}\n <hbr />\n <hbr />\n <For\n each={Object.values(commands)}\n doubleHardline\n joiner={code`\n writeLine(\"\");\n divider({ style: \"secondary\" });\n writeLine(\"\");\n writeLine(\"\");\n `}>\n {child => (\n <>\n {code`\n writeLine(\"\");\n writeLine(colors.text.heading.secondary(\"${child.title}\"));\n writeLine(\"\");\n writeLine(colors.text.body.secondary(\"${child.description}\"));\n writeLine(\"\");\n writeLine(\"\");\n `}\n <hbr />\n <Help command={child} indent={2} />\n </>\n )}\n </For>\n </Show>\n </BinEntry>\n <For each={Object.values(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 </>\n );\n }\n }\n }\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA0CA,MAAaiB,UAGXC,UAA+B,EAAE,KAC9B;AACH,QAAO;0CACC,EACJV,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,OAAKuB,YAAYC,QAAO;;6HAE0BxB,OAEtD,CAAA;;;;gCAIc;2DAAA,OAAA,EAAA,CAAA;2DAAA,OAAA,EAAA,CAAA;2DAGZ9B,qBAAG;WAAA,IACFuD,OAAI;AAAA,mBAAEV,OAAOW,OAAOzB,SAAS;;WAC7B0B,gBAAc;WACdC,QAAQ3D,oBAAI;;;;;;WAKf2C,WACIiB,UAAK;wDAED5D,oBAAI;;2DAE8B4D,MAAMC,MAAK;;wDAEdD,MAAME,YAAW;;;kBAGxD;6DAAA,OAAA,EAAA,CAAA;6DAEQjD,8BAAI;aAACkD,SAASH;aAAOI,QAAQ;aAAC,CAAA;YAAA;WAElC,CAAA;UAAA;;QAAA,CAAA;;MAAA,CAAA,mDAIN/D,qBAAG;MAAA,IAACuD,OAAI;AAAA,cAAEV,OAAOW,OAAOzB,SAAS;;MAAE0B,gBAAc;MAAAf,WAC/CiB,2DACE1D,sBAAI;OAAA,IACH0C,OAAI;AAAA,eAAEgB,MAAMK;;OAAS,IACrBC,WAAQ;AAAA,gEAAGxD,+CAAY,EAACqD,SAASH,OAAK,CAAA;;OAAA,IAAAjB,WAAA;AAAA,gEACrC5B,8DAAmB,EAACgD,SAASH,OAAK,CAAA;;OAAA,CAAA;MAEtC,CAAA,CAGP,CAAC;;IAEL;GACD;EACF;;AAGH,kBAAe3C"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"sourcesContent":[],"mappings":";;;;;;;AA0CA;AACmB,cADN,MACM,EAAA,CAAA,iBAAA,mBAAA,GAAsB,mBAAtB,CAAA,CAAA,OAAA,CAAA,EAER,mBAFQ,EAAA,GA+HZ,MA/HY,CA+HL,QA/HK,CAAA,EAAA"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../src/index.tsx"],"sourcesContent":[],"mappings":";;;;;;;AA0CA;AACmB,cADN,MACM,EAAA,CAAA,iBAAA,mBAAA,GAAsB,mBAAtB,CAAA,CAAA,OAAA,CAAA,EAER,mBAFQ,EAAA,GAkIZ,MAlIY,CAkIL,QAlIK,CAAA,EAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"sourcesContent":[],"mappings":";;;;;;;AA0CA;AACmB,cADN,MACM,EAAA,CAAA,iBAAA,mBAAA,GAAsB,mBAAtB,CAAA,CAAA,OAAA,CAAA,EAER,mBAFQ,EAAA,GA+HZ,MA/HY,CA+HL,QA/HK,CAAA,EAAA"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.tsx"],"sourcesContent":[],"mappings":";;;;;;;AA0CA;AACmB,cADN,MACM,EAAA,CAAA,iBAAA,mBAAA,GAAsB,mBAAtB,CAAA,CAAA,OAAA,CAAA,EAER,mBAFQ,EAAA,GAkIZ,MAlIY,CAkIL,QAlIK,CAAA,EAAA"}
package/dist/index.mjs CHANGED
@@ -31,6 +31,9 @@ const plugin = (options = {}) => {
31
31
  ...options
32
32
  };
33
33
  },
34
+ configResolved() {
35
+ this.dependencies.didyoumean2 = "^7.0.4";
36
+ },
34
37
  async prepare() {
35
38
  this.debug("Rendering built-in modules for the Shell Shock `script` preset.");
36
39
  return render(this, [createComponent(UtilsBuiltin, {}), createComponent(ConsoleBuiltin, {})]);
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","names":["code","For","Show","VarDeclaration","render","getCommandTree","getAppDescription","getAppTitle","theme","BinEntry","CommandEntry","CommandRouter","ConsoleBuiltin","Help","UtilsBuiltin","VirtualCommandEntry","getDefaultOptions","plugin","options","name","config","debug","defaultOptions","isCaseSensitive","prepare","_$createComponent","order","handler","_self$","commands","inputs","map","input","path","segments","filter","Boolean","builtinImports","console","utils","children","when","_$memo","Object","keys","length","type","initializer","_$createIntrinsic","test","toLowerCase","packageJson","version","each","values","doubleHardline","joiner","child","title","description","command","indent","isVirtual","fallback"],"sources":["../src/index.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, For, Show } from \"@alloy-js/core\";\nimport { VarDeclaration } from \"@alloy-js/typescript\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport { getCommandTree } from \"@shell-shock/core/plugin-utils\";\nimport {\n getAppDescription,\n getAppTitle\n} from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport type { CommandTree } from \"@shell-shock/core/types/command\";\nimport theme from \"@shell-shock/plugin-theme\";\nimport type { Plugin } from \"powerlines/types/plugin\";\nimport { BinEntry } from \"./components/bin-entry\";\nimport { CommandEntry } from \"./components/command-entry\";\nimport { CommandRouter } from \"./components/command-router\";\nimport { ConsoleBuiltin } from \"./components/console-builtin\";\nimport { Help } from \"./components/help\";\nimport { UtilsBuiltin } from \"./components/utils-builtin\";\nimport { VirtualCommandEntry } from \"./components/virtual-command-entry\";\nimport { getDefaultOptions } from \"./helpers/get-default-options\";\nimport type { ScriptPresetContext, ScriptPresetOptions } from \"./types/plugin\";\n\n/**\n * The Shell Shock base plugin.\n */\nexport const plugin = <\n TContext extends ScriptPresetContext = ScriptPresetContext\n>(\n options: ScriptPresetOptions = {}\n) => {\n return [\n theme({\n theme: options.theme\n }),\n {\n name: \"shell-shock:script-preset\",\n config() {\n this.debug(\n \"Providing default configuration for the Shell Shock `script` preset.\"\n );\n\n return {\n defaultOptions: getDefaultOptions,\n isCaseSensitive: false,\n ...options\n };\n },\n async prepare() {\n this.debug(\n \"Rendering built-in modules for the Shell Shock `script` preset.\"\n );\n\n return render(\n this,\n <>\n <UtilsBuiltin />\n <ConsoleBuiltin />\n </>\n );\n }\n },\n {\n name: \"shell-shock:script-preset:generate-entrypoint\",\n prepare: {\n order: \"post\",\n async handler() {\n this.debug(\n \"Rendering entrypoint modules for the Shell Shock `script` preset.\"\n );\n\n const commands = this.inputs\n .map(input => getCommandTree(this, input.path.segments))\n .filter(Boolean) as CommandTree[];\n\n return render(\n this,\n <>\n <BinEntry\n builtinImports={{\n console: [\"divider\", \"writeLine\", \"colors\"],\n utils: [\"getArgs\"]\n }}>\n <Show\n when={this.commands && Object.keys(this.commands).length > 0}>\n <VarDeclaration\n const\n name=\"args\"\n type=\"string[]\"\n initializer={code`getArgs();`}\n />\n <hbr />\n <CommandRouter path={[]} commands={this.commands ?? {}} />\n <hbr />\n <hbr />\n {code`\n writeLine(\"\");\n writeLine(colors.text.heading.primary(\"${\n /(?:cli|command-line|command line)\\s+(?:application|app)?$/.test(\n getAppTitle(this).toLowerCase()\n )\n ? getAppTitle(this)\n : `${getAppTitle(this)} Command-Line Application`\n } v${this.packageJson.version}\"));\n writeLine(\"\");\n writeLine(colors.text.body.primary(\"${getAppDescription(\n this\n )}\"));\n writeLine(\"\");\n divider({ style: \"primary\" });\n writeLine(\"\");\n writeLine(\"\");`}\n <hbr />\n <hbr />\n <For\n each={Object.values(commands)}\n doubleHardline\n joiner={code`\n writeLine(\"\");\n divider({ style: \"secondary\" });\n writeLine(\"\");\n writeLine(\"\");\n `}>\n {child => (\n <>\n {code`\n writeLine(\"\");\n writeLine(colors.text.heading.secondary(\"${child.title}\"));\n writeLine(\"\");\n writeLine(colors.text.body.secondary(\"${child.description}\"));\n writeLine(\"\");\n writeLine(\"\");\n `}\n <hbr />\n <Help command={child} indent={2} />\n </>\n )}\n </For>\n </Show>\n </BinEntry>\n <For each={Object.values(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 </>\n );\n }\n }\n }\n ] as Plugin<TContext>[];\n};\n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,EAAA,CAAA;UAAAA,gBAAA,OAAA,EAAA,CAAA;UAAAN,WAGrD1C,IAAI;;yDAGL,4DAA4DiD,KAC1D1C,YAAWqB,OAAM,CAACsB,aACpB,CAAC,GACG3C,YAAWqB,OAAM,GACjB,GAAGrB,YAAWqB,OAAM,CAAA,2BAA2B,IAChDA,OAAKuB,YAAYC,QAAO;;sDAES9C,kBAAiBsB,OAEtD,CAAA;;;;gCAIc;UAAAoB,gBAAA,OAAA,EAAA,CAAA;UAAAA,gBAAA,OAAA,EAAA,CAAA;UAAAvB,gBAGZxB,KAAG;WAAA,IACFoD,OAAI;AAAA,mBAAEV,OAAOW,OAAOzB,SAAS;;WAC7B0B,gBAAc;WACdC,QAAQxD,IAAI;;;;;;WAKfwC,WACIiB,UAAK;YAAAf,WAED1C,IAAI;;2DAE8ByD,MAAMC,MAAK;;wDAEdD,MAAME,YAAW;;;kBAGxD;YAAAX,gBAAA,OAAA,EAAA,CAAA;YAAAvB,gBAEQZ,MAAI;aAAC+C,SAASH;aAAOI,QAAQ;aAAC,CAAA;YAAA;WAElC,CAAA;UAAA;;QAAA,CAAA;;MAAA,CAAA,EAAApC,gBAINxB,KAAG;MAAA,IAACoD,OAAI;AAAA,cAAEV,OAAOW,OAAOzB,SAAS;;MAAE0B,gBAAc;MAAAf,WAC/CiB,UAAKhC,gBACHvB,MAAI;OAAA,IACHuC,OAAI;AAAA,eAAEgB,MAAMK;;OAAS,IACrBC,WAAQ;AAAA,eAAAtC,gBAAGf,cAAY,EAACkD,SAASH,OAAK,CAAA;;OAAA,IAAAjB,WAAA;AAAA,eAAAf,gBACrCV,qBAAmB,EAAC6C,SAASH,OAAK,CAAA;;OAAA,CAAA;MAEtC,CAAA,CAGP,CAAC;;IAEL;GACD;EACF;;AAGH,kBAAexC"}
1
+ {"version":3,"file":"index.mjs","names":["code","For","Show","VarDeclaration","render","getCommandTree","getAppDescription","getAppTitle","theme","BinEntry","CommandEntry","CommandRouter","ConsoleBuiltin","Help","UtilsBuiltin","VirtualCommandEntry","getDefaultOptions","plugin","options","name","config","debug","defaultOptions","isCaseSensitive","configResolved","dependencies","didyoumean2","prepare","_$createComponent","order","handler","_self$","commands","inputs","map","input","path","segments","filter","Boolean","builtinImports","console","utils","children","when","_$memo","Object","keys","length","type","initializer","_$createIntrinsic","test","toLowerCase","packageJson","version","each","values","doubleHardline","joiner","child","title","description","command","indent","isVirtual","fallback"],"sources":["../src/index.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, For, Show } from \"@alloy-js/core\";\nimport { VarDeclaration } from \"@alloy-js/typescript\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport { getCommandTree } from \"@shell-shock/core/plugin-utils\";\nimport {\n getAppDescription,\n getAppTitle\n} from \"@shell-shock/core/plugin-utils/context-helpers\";\nimport type { CommandTree } from \"@shell-shock/core/types/command\";\nimport theme from \"@shell-shock/plugin-theme\";\nimport type { Plugin } from \"powerlines/types/plugin\";\nimport { BinEntry } from \"./components/bin-entry\";\nimport { CommandEntry } from \"./components/command-entry\";\nimport { CommandRouter } from \"./components/command-router\";\nimport { ConsoleBuiltin } from \"./components/console-builtin\";\nimport { Help } from \"./components/help\";\nimport { UtilsBuiltin } from \"./components/utils-builtin\";\nimport { VirtualCommandEntry } from \"./components/virtual-command-entry\";\nimport { getDefaultOptions } from \"./helpers/get-default-options\";\nimport type { ScriptPresetContext, ScriptPresetOptions } from \"./types/plugin\";\n\n/**\n * The Shell Shock base plugin.\n */\nexport const plugin = <\n TContext extends ScriptPresetContext = ScriptPresetContext\n>(\n options: ScriptPresetOptions = {}\n) => {\n return [\n theme({\n theme: options.theme\n }),\n {\n name: \"shell-shock:script-preset\",\n config() {\n this.debug(\n \"Providing default configuration for the Shell Shock `script` 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 `script` preset.\"\n );\n\n return render(\n this,\n <>\n <UtilsBuiltin />\n <ConsoleBuiltin />\n </>\n );\n }\n },\n {\n name: \"shell-shock:script-preset:generate-entrypoint\",\n prepare: {\n order: \"post\",\n async handler() {\n this.debug(\n \"Rendering entrypoint modules for the Shell Shock `script` preset.\"\n );\n\n const commands = this.inputs\n .map(input => getCommandTree(this, input.path.segments))\n .filter(Boolean) as CommandTree[];\n\n return render(\n this,\n <>\n <BinEntry\n builtinImports={{\n console: [\"divider\", \"writeLine\", \"colors\"],\n utils: [\"getArgs\"]\n }}>\n <Show\n when={this.commands && Object.keys(this.commands).length > 0}>\n <VarDeclaration\n const\n name=\"args\"\n type=\"string[]\"\n initializer={code`getArgs();`}\n />\n <hbr />\n <CommandRouter path={[]} commands={this.commands ?? {}} />\n <hbr />\n <hbr />\n {code`\n writeLine(\"\");\n writeLine(colors.text.heading.primary(\"${\n /(?:cli|command-line|command line)\\s+(?:application|app)?$/.test(\n getAppTitle(this).toLowerCase()\n )\n ? getAppTitle(this)\n : `${getAppTitle(this)} Command-Line Application`\n } v${this.packageJson.version}\"));\n writeLine(\"\");\n writeLine(colors.text.body.primary(\"${getAppDescription(\n this\n )}\"));\n writeLine(\"\");\n divider({ style: \"primary\" });\n writeLine(\"\");\n writeLine(\"\");`}\n <hbr />\n <hbr />\n <For\n each={Object.values(commands)}\n doubleHardline\n joiner={code`\n writeLine(\"\");\n divider({ style: \"secondary\" });\n writeLine(\"\");\n writeLine(\"\");\n `}>\n {child => (\n <>\n {code`\n writeLine(\"\");\n writeLine(colors.text.heading.secondary(\"${child.title}\"));\n writeLine(\"\");\n writeLine(colors.text.body.secondary(\"${child.description}\"));\n writeLine(\"\");\n writeLine(\"\");\n `}\n <hbr />\n <Help command={child} indent={2} />\n </>\n )}\n </For>\n </Show>\n </BinEntry>\n <For each={Object.values(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 </>\n );\n }\n }\n }\n ] as Plugin<TContext>[];\n};\n\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AA0CA,MAAaiB,UAGXC,UAA+B,EAAE,KAC9B;AACH,QAAO;EACLV,MAAM,EACJA,OAAOU,QAAQV,OAChB,CAAC;EACF;GACEW,MAAM;GACNC,SAAS;AACP,SAAKC,MACH,uEACD;AAED,WAAO;KACLC,gBAAgBN;KAChBO,iBAAiB;KACjB,GAAGL;KACJ;;GAEHM,iBAAiB;AACf,SAAKC,aAAaC,cAAc;;GAElC,MAAMC,UAAU;AACd,SAAKN,MACH,kEACD;AAED,WAAOjB,OACL,MAAI,CAAAwB,gBAEDd,cAAY,EAAA,CAAA,EAAAc,gBACZhB,gBAAc,EAAA,CAAA,CAEnB,CAAC;;GAEJ;EACD;GACEO,MAAM;GACNQ,SAAS;IACPE,OAAO;IACP,MAAMC,UAAU;KAAA,MAAAC,SAAA;AACd,UAAKV,MACH,oEACD;KAED,MAAMW,WAAW,KAAKC,OACnBC,KAAIC,UAAS9B,eAAe,MAAM8B,MAAMC,KAAKC,SAAS,CAAC,CACvDC,OAAOC,QAAyB;AAEnC,YAAOnC,OACL,MAAI,CAAAwB,gBAEDnB,UAAQ;MACP+B,gBAAgB;OACdC,SAAS;QAAC;QAAW;QAAa;QAAS;OAC3CC,OAAO,CAAC,UAAS;OAClB;MAAA,IAAAC,WAAA;AAAA,cAAAf,gBACA1B,MAAI;QAAA,IAC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KhC,gBACH1B,MAAI;OAAA,IACH0C,OAAI;AAAA,eAAEgB,MAAMK;;OAAS,IACrBC,WAAQ;AAAA,eAAAtC,gBAAGlB,cAAY,EAACqD,SAASH,OAAK,CAAA;;OAAA,IAAAjB,WAAA;AAAA,eAAAf,gBACrCb,qBAAmB,EAACgD,SAASH,OAAK,CAAA;;OAAA,CAAA;MAEtC,CAAA,CAGP,CAAC;;IAEL;GACD;EACF;;AAGH,kBAAe3C"}
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/types/plugin.ts"],"sourcesContent":[],"mappings":";;;;;;;UAmCiB,mBAAA,SACP,KAAK,4BAA4B,QAAQ;;AADnD;;;;;;;;;;EAmBY,cAAA,CAAA,EALN,aAK4B,EAAA,GAAA,CAAA,CAAG,OAAA,EAJpB,OAIiC,EAAA,KAAA,EAJjB,WAIoC,EAAA,GAJpB,aAIoB,EAAA,CAAA,GAAA,KAAA;AAErE;AAAyC,KAF7B,sBAAA,GAAyB,UAEI,GAFS,mBAET;AACzB,KADJ,0BAAA,GAA6B,cACzB,GAAd,QAAc,CAAL,IAAK,CAAA,mBAAA,EAAA,OAAA,CAAA,CAAA,GACd,yBADc;AAAL,KAGC,mBAHD,CAAA,wBAIe,0BAJf,GAKP,0BALO,CAAA,GAMP,kBANO,CAMY,eANZ,CAAA,GAOT,kBAPS,CAOU,eAPV,CAAA,GAQT,OARS,CAQD,eARC,CAAA"}
1
+ {"version":3,"file":"plugin.d.cts","names":[],"sources":["../../src/types/plugin.ts"],"sourcesContent":[],"mappings":";;;;;;;UAmCiB,mBAAA,SACP,KAAK,4BAA4B,QAAQ;;AADnD;;;;;;;;;;EAmBY,cAAA,CAAA,EALN,aAK4B,EAAA,GAAA,CAAG,CAAA,OAAA,EAJpB,OAIiC,EAAA,KAAA,EAJjB,WAIoC,EAAA,GAJpB,aAIoB,EAAA,CAAA,GAAA,KAAA;AAErE;AAAyC,KAF7B,sBAAA,GAAyB,UAEI,GAFS,mBAET;AACzB,KADJ,0BAAA,GAA6B,cACzB,GAAd,QAAc,CAAL,IAAK,CAAA,mBAAA,EAAA,OAAA,CAAA,CAAA,GACd,yBADc;AAAL,KAGC,mBAHD,CAAA,wBAIe,0BAJf,GAKP,0BALO,CAAA,GAMP,kBANO,CAMY,eANZ,CAAA,GAOT,kBAPS,CAOU,eAPV,CAAA,GAQT,OARS,CAQD,eARC,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/types/plugin.ts"],"sourcesContent":[],"mappings":";;;;;;;UAmCiB,mBAAA,SACP,KAAK,4BAA4B,QAAQ;;AADnD;;;;;;;;;;EAmBY,cAAA,CAAA,EALN,aAK4B,EAAA,GAAA,CAAG,CAAA,OAAA,EAJpB,OAIiC,EAAA,KAAA,EAJjB,WAIoC,EAAA,GAJpB,aAIoB,EAAA,CAAA,GAAA,KAAA;AAErE;AAAyC,KAF7B,sBAAA,GAAyB,UAEI,GAFS,mBAET;AACzB,KADJ,0BAAA,GAA6B,cACzB,GAAd,QAAc,CAAL,IAAK,CAAA,mBAAA,EAAA,OAAA,CAAA,CAAA,GACd,yBADc;AAAL,KAGC,mBAHD,CAAA,wBAIe,0BAJf,GAKP,0BALO,CAAA,GAMP,kBANO,CAMY,eANZ,CAAA,GAOT,kBAPS,CAOU,eAPV,CAAA,GAQT,OARS,CAQD,eARC,CAAA"}
1
+ {"version":3,"file":"plugin.d.mts","names":[],"sources":["../../src/types/plugin.ts"],"sourcesContent":[],"mappings":";;;;;;;UAmCiB,mBAAA,SACP,KAAK,4BAA4B,QAAQ;;AADnD;;;;;;;;;;EAmBY,cAAA,CAAA,EALN,aAK4B,EAAA,GAAA,CAAA,CAAG,OAAA,EAJpB,OAIiC,EAAA,KAAA,EAJjB,WAIoC,EAAA,GAJpB,aAIoB,EAAA,CAAA,GAAA,KAAA;AAErE;AAAyC,KAF7B,sBAAA,GAAyB,UAEI,GAFS,mBAET;AACzB,KADJ,0BAAA,GAA6B,cACzB,GAAd,QAAc,CAAL,IAAK,CAAA,mBAAA,EAAA,OAAA,CAAA,CAAA,GACd,yBADc;AAAL,KAGC,mBAHD,CAAA,wBAIe,0BAJf,GAKP,0BALO,CAAA,GAMP,kBANO,CAMY,eANZ,CAAA,GAOT,kBAPS,CAOU,eAPV,CAAA,GAQT,OARS,CAQD,eARC,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shell-shock/preset-script",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "type": "module",
5
5
  "description": "A Shell Shock preset that generates a fully-featured script application.",
6
6
  "repository": {
@@ -251,23 +251,23 @@
251
251
  "dependencies": {
252
252
  "@alloy-js/core": "0.22.0",
253
253
  "@alloy-js/typescript": "^0.22.0",
254
- "@powerlines/deepkit": "^0.6.37",
255
- "@powerlines/plugin-alloy": "^0.19.37",
256
- "@powerlines/plugin-plugin": "^0.12.208",
257
- "@shell-shock/core": "^0.3.0",
258
- "@shell-shock/plugin-theme": "^0.0.7",
254
+ "@powerlines/deepkit": "^0.6.43",
255
+ "@powerlines/plugin-alloy": "^0.20.6",
256
+ "@powerlines/plugin-plugin": "^0.12.214",
257
+ "@shell-shock/core": "^0.4.0",
258
+ "@shell-shock/plugin-theme": "^0.0.8",
259
259
  "@stryke/path": "^0.26.4",
260
260
  "@stryke/string-format": "^0.13.7",
261
261
  "@stryke/type-checks": "^0.5.23",
262
262
  "defu": "^6.1.4",
263
- "powerlines": "^0.38.24",
263
+ "powerlines": "^0.38.30",
264
264
  "@stryke/helpers": "0.9.40"
265
265
  },
266
266
  "devDependencies": {
267
- "@babel/core": "^7.28.6",
268
- "@powerlines/plugin-alloy": "^0.19.37",
267
+ "@babel/core": "^7.29.0",
268
+ "@powerlines/plugin-alloy": "^0.20.6",
269
269
  "@types/node": "^22.19.7"
270
270
  },
271
271
  "publishConfig": { "access": "public" },
272
- "gitHead": "150522912ecb85c5d409659bc146c2c6ae635923"
272
+ "gitHead": "ad8f1104e63a42de787eb5c5ec5c57e27f8a682e"
273
273
  }