@shell-shock/core 0.2.1 → 0.4.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 (158) hide show
  1. package/README.md +1 -1
  2. package/dist/api.cjs +15 -3
  3. package/dist/api.cjs.map +1 -0
  4. package/dist/api.d.cts +9 -1
  5. package/dist/api.d.cts.map +1 -0
  6. package/dist/api.d.mts +9 -1
  7. package/dist/api.d.mts.map +1 -0
  8. package/dist/api.mjs +14 -3
  9. package/dist/api.mjs.map +1 -0
  10. package/dist/components/docs.cjs +175 -0
  11. package/dist/components/docs.cjs.map +1 -0
  12. package/dist/components/docs.d.cts +81 -0
  13. package/dist/components/docs.d.cts.map +1 -0
  14. package/dist/components/docs.d.mts +81 -0
  15. package/dist/components/docs.d.mts.map +1 -0
  16. package/dist/components/docs.mjs +171 -0
  17. package/dist/components/docs.mjs.map +1 -0
  18. package/dist/components/index.cjs +5 -6
  19. package/dist/components/index.d.cts +2 -2
  20. package/dist/components/index.d.mts +2 -2
  21. package/dist/components/index.mjs +2 -2
  22. package/dist/config.cjs +2 -1
  23. package/dist/config.cjs.map +1 -0
  24. package/dist/config.d.cts +2 -1
  25. package/dist/config.d.cts.map +1 -0
  26. package/dist/config.d.mts +2 -1
  27. package/dist/config.d.mts.map +1 -0
  28. package/dist/config.mjs +2 -1
  29. package/dist/config.mjs.map +1 -0
  30. package/dist/contexts/command.cjs +21 -0
  31. package/dist/contexts/command.cjs.map +1 -0
  32. package/dist/contexts/command.d.cts +18 -0
  33. package/dist/contexts/command.d.cts.map +1 -0
  34. package/dist/contexts/command.d.mts +18 -0
  35. package/dist/contexts/command.d.mts.map +1 -0
  36. package/dist/contexts/command.mjs +19 -0
  37. package/dist/contexts/command.mjs.map +1 -0
  38. package/dist/contexts/index.cjs +4 -0
  39. package/dist/contexts/index.d.cts +2 -0
  40. package/dist/contexts/index.d.mts +2 -0
  41. package/dist/contexts/index.mjs +3 -0
  42. package/dist/helpers/automd.cjs +59 -0
  43. package/dist/helpers/automd.cjs.map +1 -0
  44. package/dist/helpers/automd.mjs +58 -0
  45. package/dist/helpers/automd.mjs.map +1 -0
  46. package/dist/helpers/docs-helpers.cjs +17 -0
  47. package/dist/helpers/docs-helpers.cjs.map +1 -0
  48. package/dist/helpers/docs-helpers.mjs +16 -0
  49. package/dist/helpers/docs-helpers.mjs.map +1 -0
  50. package/dist/helpers/persistence.cjs +2 -1
  51. package/dist/helpers/persistence.cjs.map +1 -0
  52. package/dist/helpers/persistence.mjs +2 -1
  53. package/dist/helpers/persistence.mjs.map +1 -0
  54. package/dist/helpers/resolve-command.cjs +118 -33
  55. package/dist/helpers/resolve-command.cjs.map +1 -0
  56. package/dist/helpers/resolve-command.mjs +116 -32
  57. package/dist/helpers/resolve-command.mjs.map +1 -0
  58. package/dist/helpers/update-package-json.cjs +18 -10
  59. package/dist/helpers/update-package-json.cjs.map +1 -0
  60. package/dist/helpers/update-package-json.mjs +17 -10
  61. package/dist/helpers/update-package-json.mjs.map +1 -0
  62. package/dist/helpers/utilities.cjs +30 -30
  63. package/dist/helpers/utilities.cjs.map +1 -0
  64. package/dist/helpers/utilities.mjs +29 -28
  65. package/dist/helpers/utilities.mjs.map +1 -0
  66. package/dist/helpers/validations.cjs +97 -0
  67. package/dist/helpers/validations.cjs.map +1 -0
  68. package/dist/helpers/validations.mjs +97 -0
  69. package/dist/helpers/validations.mjs.map +1 -0
  70. package/dist/index.cjs +5 -13
  71. package/dist/index.cjs.map +1 -0
  72. package/dist/index.d.cts +6 -17
  73. package/dist/index.d.mts +6 -17
  74. package/dist/index.mjs +4 -13
  75. package/dist/index.mjs.map +1 -0
  76. package/dist/plugin-utils/context-helpers.cjs +86 -0
  77. package/dist/plugin-utils/context-helpers.cjs.map +1 -0
  78. package/dist/plugin-utils/context-helpers.d.cts +58 -0
  79. package/dist/plugin-utils/context-helpers.d.cts.map +1 -0
  80. package/dist/plugin-utils/context-helpers.d.mts +58 -0
  81. package/dist/plugin-utils/context-helpers.d.mts.map +1 -0
  82. package/dist/plugin-utils/context-helpers.mjs +79 -0
  83. package/dist/plugin-utils/context-helpers.mjs.map +1 -0
  84. package/dist/plugin-utils/get-command-tree.cjs +4 -2
  85. package/dist/plugin-utils/get-command-tree.cjs.map +1 -0
  86. package/dist/plugin-utils/get-command-tree.d.cts +2 -1
  87. package/dist/plugin-utils/get-command-tree.d.cts.map +1 -0
  88. package/dist/plugin-utils/get-command-tree.d.mts +2 -1
  89. package/dist/plugin-utils/get-command-tree.d.mts.map +1 -0
  90. package/dist/plugin-utils/get-command-tree.mjs +5 -2
  91. package/dist/plugin-utils/get-command-tree.mjs.map +1 -0
  92. package/dist/plugin-utils/index.cjs +14 -1
  93. package/dist/plugin-utils/index.d.cts +4 -1
  94. package/dist/plugin-utils/index.d.mts +4 -1
  95. package/dist/plugin-utils/index.mjs +4 -1
  96. package/dist/plugin-utils/reflect.cjs +25 -0
  97. package/dist/plugin-utils/reflect.cjs.map +1 -0
  98. package/dist/plugin-utils/reflect.d.cts +14 -0
  99. package/dist/plugin-utils/reflect.d.cts.map +1 -0
  100. package/dist/plugin-utils/reflect.d.mts +14 -0
  101. package/dist/plugin-utils/reflect.d.mts.map +1 -0
  102. package/dist/plugin-utils/reflect.mjs +24 -0
  103. package/dist/plugin-utils/reflect.mjs.map +1 -0
  104. package/dist/plugin-utils/traverse-command-tree.cjs +33 -0
  105. package/dist/plugin-utils/traverse-command-tree.cjs.map +1 -0
  106. package/dist/plugin-utils/traverse-command-tree.d.cts +23 -0
  107. package/dist/plugin-utils/traverse-command-tree.d.cts.map +1 -0
  108. package/dist/plugin-utils/traverse-command-tree.d.mts +23 -0
  109. package/dist/plugin-utils/traverse-command-tree.d.mts.map +1 -0
  110. package/dist/plugin-utils/traverse-command-tree.mjs +31 -0
  111. package/dist/plugin-utils/traverse-command-tree.mjs.map +1 -0
  112. package/dist/plugin.cjs +284 -0
  113. package/dist/plugin.cjs.map +1 -0
  114. package/dist/plugin.d.cts +13 -0
  115. package/dist/plugin.d.cts.map +1 -0
  116. package/dist/plugin.d.mts +13 -0
  117. package/dist/plugin.d.mts.map +1 -0
  118. package/dist/plugin.mjs +276 -0
  119. package/dist/plugin.mjs.map +1 -0
  120. package/dist/types/command.d.cts +14 -4
  121. package/dist/types/command.d.cts.map +1 -0
  122. package/dist/types/command.d.mts +14 -4
  123. package/dist/types/command.d.mts.map +1 -0
  124. package/dist/types/config.d.cts +74 -10
  125. package/dist/types/config.d.cts.map +1 -0
  126. package/dist/types/config.d.mts +74 -10
  127. package/dist/types/config.d.mts.map +1 -0
  128. package/dist/types/context.d.cts +7 -4
  129. package/dist/types/context.d.cts.map +1 -0
  130. package/dist/types/context.d.mts +7 -4
  131. package/dist/types/context.d.mts.map +1 -0
  132. package/dist/types/index.d.cts +4 -4
  133. package/dist/types/index.d.mts +4 -4
  134. package/dist/types/internal.cjs +0 -0
  135. package/dist/types/internal.d.cts +24 -0
  136. package/dist/types/internal.d.cts.map +1 -0
  137. package/dist/types/internal.d.mts +24 -0
  138. package/dist/types/internal.d.mts.map +1 -0
  139. package/dist/types/internal.mjs +1 -0
  140. package/dist/types/options.d.cts +2 -1
  141. package/dist/types/options.d.cts.map +1 -0
  142. package/dist/types/options.d.mts +2 -1
  143. package/dist/types/options.d.mts.map +1 -0
  144. package/dist/types/runtime.cjs +0 -0
  145. package/dist/types/runtime.d.cts +24 -0
  146. package/dist/types/runtime.d.cts.map +1 -0
  147. package/dist/types/runtime.d.mts +24 -0
  148. package/dist/types/runtime.d.mts.map +1 -0
  149. package/dist/types/runtime.mjs +1 -0
  150. package/package.json +223 -91
  151. package/dist/components/utils-builtin.cjs +0 -453
  152. package/dist/components/utils-builtin.d.cts +0 -27
  153. package/dist/components/utils-builtin.d.mts +0 -27
  154. package/dist/components/utils-builtin.mjs +0 -447
  155. package/dist/powerlines.cjs +0 -172
  156. package/dist/powerlines.d.cts +0 -12
  157. package/dist/powerlines.d.mts +0 -12
  158. package/dist/powerlines.mjs +0 -168
@@ -0,0 +1 @@
1
+ {"version":3,"file":"traverse-command-tree.d.cts","names":[],"sources":["../../src/plugin-utils/traverse-command-tree.ts"],"sourcesContent":[],"mappings":";;;;;;;;AA4BA;;;;AAGG,iBAHmB,mBAAA,CAGnB,WAAA,EAFY,WAEZ,EAAA,OAAA,EAAA,CAAA,IAAA,EADe,WACf,EAAA,GAD+B,YAC/B,CAAA,IAAA,CAAA,CAAA,EAAA,OAAA,CAAA,IAAA,CAAA;;AAmBH;;;;;AAGG,iBAHmB,gBAGnB,CAAA,iBAHqD,OAGrD,CAAA,CAAA,OAAA,EAFQ,QAER,EAAA,OAAA,EAAA,CAAA,IAAA,EADe,WACf,EAAA,GAD+B,YAC/B,CAAA,IAAA,CAAA,CAAA,EAAA,OAAA,CAAA,IAAA,CAAA"}
@@ -0,0 +1,23 @@
1
+ import { CommandTree } from "../types/command.mjs";
2
+ import { Context } from "../types/context.mjs";
3
+ import { MaybePromise } from "@stryke/types/base";
4
+
5
+ //#region src/plugin-utils/traverse-command-tree.d.ts
6
+
7
+ /**
8
+ * Traverses a command tree and applies a visitor function to each node.
9
+ *
10
+ * @param commandTree - The command tree to traverse.
11
+ * @param visitor - The visitor function to apply to each node.
12
+ */
13
+ declare function traverseCommandTree(commandTree: CommandTree, visitor: (node: CommandTree) => MaybePromise<void>): Promise<void>;
14
+ /**
15
+ * Traverses all commands in the context and applies a visitor function to each command tree.
16
+ *
17
+ * @param context - The build context containing the command definitions.
18
+ * @param visitor - The visitor function to apply to each command tree.
19
+ */
20
+ declare function traverseCommands<TContext extends Context>(context: TContext, visitor: (node: CommandTree) => MaybePromise<void>): Promise<void>;
21
+ //#endregion
22
+ export { traverseCommandTree, traverseCommands };
23
+ //# sourceMappingURL=traverse-command-tree.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"traverse-command-tree.d.mts","names":[],"sources":["../../src/plugin-utils/traverse-command-tree.ts"],"sourcesContent":[],"mappings":";;;;;;;;AA4BA;;;;AAGG,iBAHmB,mBAAA,CAGnB,WAAA,EAFY,WAEZ,EAAA,OAAA,EAAA,CAAA,IAAA,EADe,WACf,EAAA,GAD+B,YAC/B,CAAA,IAAA,CAAA,CAAA,EAAA,OAAA,CAAA,IAAA,CAAA;;AAmBH;;;;;AAGG,iBAHmB,gBAGnB,CAAA,iBAHqD,OAGrD,CAAA,CAAA,OAAA,EAFQ,QAER,EAAA,OAAA,EAAA,CAAA,IAAA,EADe,WACf,EAAA,GAD+B,YAC/B,CAAA,IAAA,CAAA,CAAA,EAAA,OAAA,CAAA,IAAA,CAAA"}
@@ -0,0 +1,31 @@
1
+ //#region src/plugin-utils/traverse-command-tree.ts
2
+ /**
3
+ * Traverses a command tree and applies a visitor function to each node.
4
+ *
5
+ * @param commandTree - The command tree to traverse.
6
+ * @param visitor - The visitor function to apply to each node.
7
+ */
8
+ async function traverseCommandTree(commandTree, visitor) {
9
+ if (!commandTree.children) return;
10
+ await Promise.all(Object.values(commandTree.children).map(async (childTree) => {
11
+ await Promise.resolve(visitor(childTree));
12
+ await traverseCommandTree(childTree, visitor);
13
+ }));
14
+ }
15
+ /**
16
+ * Traverses all commands in the context and applies a visitor function to each command tree.
17
+ *
18
+ * @param context - The build context containing the command definitions.
19
+ * @param visitor - The visitor function to apply to each command tree.
20
+ */
21
+ async function traverseCommands(context, visitor) {
22
+ if (!context.commands) return;
23
+ await Promise.all(Object.values(context.commands).map(async (childTree) => {
24
+ await Promise.resolve(visitor(childTree));
25
+ await traverseCommandTree(childTree, visitor);
26
+ }));
27
+ }
28
+
29
+ //#endregion
30
+ export { traverseCommandTree, traverseCommands };
31
+ //# sourceMappingURL=traverse-command-tree.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"traverse-command-tree.mjs","names":["traverseCommandTree","commandTree","visitor","children","Promise","all","Object","values","map","childTree","resolve","traverseCommands","context","commands"],"sources":["../../src/plugin-utils/traverse-command-tree.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { MaybePromise } from \"@stryke/types/base\";\nimport type { CommandTree } from \"../types/command\";\nimport type { Context } from \"../types/context\";\n\n/**\n * Traverses a command tree and applies a visitor function to each node.\n *\n * @param commandTree - The command tree to traverse.\n * @param visitor - The visitor function to apply to each node.\n */\nexport async function traverseCommandTree(\n commandTree: CommandTree,\n visitor: (node: CommandTree) => MaybePromise<void>\n): Promise<void> {\n if (!commandTree.children) {\n return;\n }\n\n await Promise.all(\n Object.values(commandTree.children).map(async childTree => {\n await Promise.resolve(visitor(childTree));\n await traverseCommandTree(childTree, visitor);\n })\n );\n}\n\n/**\n * Traverses all commands in the context and applies a visitor function to each command tree.\n *\n * @param context - The build context containing the command definitions.\n * @param visitor - The visitor function to apply to each command tree.\n */\nexport async function traverseCommands<TContext extends Context>(\n context: TContext,\n visitor: (node: CommandTree) => MaybePromise<void>\n): Promise<void> {\n if (!context.commands) {\n return;\n }\n\n await Promise.all(\n Object.values(context.commands).map(async childTree => {\n await Promise.resolve(visitor(childTree));\n await traverseCommandTree(childTree, visitor);\n })\n );\n}\n"],"mappings":";;;;;;;AA4BA,eAAsBA,oBACpBC,aACAC,SACe;AACf,KAAI,CAACD,YAAYE,SACf;AAGF,OAAMC,QAAQC,IACZC,OAAOC,OAAON,YAAYE,SAAS,CAACK,IAAI,OAAMC,cAAa;AACzD,QAAML,QAAQM,QAAQR,QAAQO,UAAU,CAAC;AACzC,QAAMT,oBAAoBS,WAAWP,QAAQ;GAEjD,CAAC;;;;;;;;AASH,eAAsBS,iBACpBC,SACAV,SACe;AACf,KAAI,CAACU,QAAQC,SACX;AAGF,OAAMT,QAAQC,IACZC,OAAOC,OAAOK,QAAQC,SAAS,CAACL,IAAI,OAAMC,cAAa;AACrD,QAAML,QAAQM,QAAQR,QAAQO,UAAU,CAAC;AACzC,QAAMT,oBAAoBS,WAAWP,QAAQ;GAEjD,CAAC"}
@@ -0,0 +1,284 @@
1
+ Object.defineProperty(exports, '__esModule', { value: true });
2
+ const require_rolldown_runtime = require('./_virtual/rolldown_runtime.cjs');
3
+ const require_plugin_utils_context_helpers = require('./plugin-utils/context-helpers.cjs');
4
+ const require_components_docs = require('./components/docs.cjs');
5
+ const require_plugin_utils_get_command_tree = require('./plugin-utils/get-command-tree.cjs');
6
+ const require_plugin_utils_traverse_command_tree = require('./plugin-utils/traverse-command-tree.cjs');
7
+ const require_automd = require('./helpers/automd.cjs');
8
+ const require_persistence = require('./helpers/persistence.cjs');
9
+ const require_utilities = require('./helpers/utilities.cjs');
10
+ const require_resolve_command = require('./helpers/resolve-command.cjs');
11
+ const require_update_package_json = require('./helpers/update-package-json.cjs');
12
+ const require_validations = require('./helpers/validations.cjs');
13
+ let __alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
14
+ let __alloy_js_core_components = require("@alloy-js/core/components");
15
+ let __powerlines_plugin_alloy_render = require("@powerlines/plugin-alloy/render");
16
+ let __powerlines_plugin_automd = require("@powerlines/plugin-automd");
17
+ __powerlines_plugin_automd = require_rolldown_runtime.__toESM(__powerlines_plugin_automd);
18
+ let __powerlines_plugin_deepkit = require("@powerlines/plugin-deepkit");
19
+ __powerlines_plugin_deepkit = require_rolldown_runtime.__toESM(__powerlines_plugin_deepkit);
20
+ let __powerlines_plugin_nodejs = require("@powerlines/plugin-nodejs");
21
+ __powerlines_plugin_nodejs = require_rolldown_runtime.__toESM(__powerlines_plugin_nodejs);
22
+ let __powerlines_plugin_tsdown = require("@powerlines/plugin-tsdown");
23
+ __powerlines_plugin_tsdown = require_rolldown_runtime.__toESM(__powerlines_plugin_tsdown);
24
+ let __stryke_convert_to_array = require("@stryke/convert/to-array");
25
+ let __stryke_fs_chmod_x = require("@stryke/fs/chmod-x");
26
+ let __stryke_path_append = require("@stryke/path/append");
27
+ let __stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
28
+ let __stryke_path_is_parent_path = require("@stryke/path/is-parent-path");
29
+ let __stryke_path_join_paths = require("@stryke/path/join-paths");
30
+ let __stryke_path_replace = require("@stryke/path/replace");
31
+ let __stryke_path_resolve_parent_path = require("@stryke/path/resolve-parent-path");
32
+ let __stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
33
+ let __stryke_string_format_constant_case = require("@stryke/string-format/constant-case");
34
+ let __stryke_string_format_kebab_case = require("@stryke/string-format/kebab-case");
35
+ let __stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
36
+ let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
37
+ let defu = require("defu");
38
+ let powerlines_lib_entry = require("powerlines/lib/entry");
39
+
40
+ //#region src/plugin.tsx
41
+ const MAX_DEPTH = 50;
42
+ /**
43
+ * The core Powerlines plugin to build Shell Shock projects.
44
+ */
45
+ const plugin = (options = {}) => {
46
+ return [
47
+ (0, __powerlines_plugin_tsdown.default)(),
48
+ (0, __powerlines_plugin_deepkit.default)(),
49
+ (0, __powerlines_plugin_automd.default)(),
50
+ {
51
+ name: "shell-shock:config",
52
+ async config() {
53
+ this.debug("Resolving the Shell Shock configuration.");
54
+ await require_update_package_json.updatePackageJsonBinary(this);
55
+ const result = (0, defu.defu)({ output: { buildPath: (0, __stryke_path_join_paths.joinPaths)(this.config.projectRoot, "dist") } }, options, {
56
+ name: require_plugin_utils_context_helpers.getAppName(this),
57
+ title: require_plugin_utils_context_helpers.getAppTitle(this),
58
+ description: require_plugin_utils_context_helpers.getAppDescription(this),
59
+ envPrefix: (0, __stryke_string_format_constant_case.constantCase)(require_plugin_utils_context_helpers.getAppName(this)),
60
+ env: { prefix: [] },
61
+ isCaseSensitive: false,
62
+ output: {
63
+ format: "esm",
64
+ dts: true
65
+ },
66
+ entry: !this.config.entry || Array.isArray(this.config.entry) && this.config.entry.length === 0 ? [(0, __stryke_path_join_paths.joinPaths)(this.config.sourceRoot, "**/*.ts"), (0, __stryke_path_join_paths.joinPaths)(this.config.sourceRoot, "**/*.tsx")] : void 0,
67
+ build: {
68
+ dts: false,
69
+ platform: "node",
70
+ nodeProtocol: true,
71
+ unbundle: false,
72
+ noExternal: ["@powerlines/deepkit"]
73
+ },
74
+ type: "application",
75
+ framework: "shell-shock"
76
+ });
77
+ if (!result.env.prefix.includes(result.envPrefix)) result.env.prefix.push(result.envPrefix);
78
+ return result;
79
+ },
80
+ configResolved: {
81
+ order: "pre",
82
+ async handler() {
83
+ this.debug("Shell Shock configuration has been resolved.");
84
+ this.config.bin = ((0, __stryke_type_checks_is_set_string.isSetString)(this.packageJson.bin) ? { [(0, __stryke_string_format_kebab_case.kebabCase)(this.config.name)]: this.packageJson.bin } : this.packageJson.bin) ?? { [(0, __stryke_string_format_kebab_case.kebabCase)(this.config.name)]: require_update_package_json.formatBinaryPath(this.config.output.format) };
85
+ this.inputs ??= [];
86
+ this.options = Object.values(require_utilities.getDefaultOptions(this, {
87
+ id: null,
88
+ name: this.config.name,
89
+ title: this.config.title,
90
+ description: this.config.description,
91
+ alias: [],
92
+ path: {
93
+ value: null,
94
+ segments: []
95
+ },
96
+ isVirtual: false
97
+ }));
98
+ }
99
+ }
100
+ },
101
+ ...(0, __powerlines_plugin_nodejs.default)(),
102
+ {
103
+ name: "shell-shock:inputs",
104
+ async configResolved() {
105
+ this.debug("Finding command entry point files.");
106
+ this.commandsPath = require_resolve_command.findCommandsRoot(this);
107
+ const entries = await (0, powerlines_lib_entry.resolveEntries)(this, (0, __stryke_convert_to_array.toArray)(this.config.entry || []));
108
+ this.debug(`Found ${entries.length} entry points specified in the configuration options.`);
109
+ this.inputs = entries.reduce((ret, entry) => {
110
+ if (!(0, __stryke_path_is_parent_path.isParentPath)(entry.file, this.commandsPath)) throw new Error(`Command entry point "${entry.file}" is not located within the commands root "${this.commandsPath}". Please ensure that all command entry points are located within the current project.`);
111
+ const id = require_resolve_command.resolveCommandId(this, entry.file);
112
+ if (!ret.some((existing) => existing.id === id)) {
113
+ const path = require_resolve_command.resolveCommandPath(this, entry.file);
114
+ const name = require_resolve_command.resolveCommandName(entry.file);
115
+ ret.push({
116
+ id,
117
+ path: {
118
+ value: path,
119
+ segments: path.split("/").filter(Boolean)
120
+ },
121
+ name,
122
+ alias: [],
123
+ isVirtual: false,
124
+ entry: {
125
+ ...entry,
126
+ file: entry.file,
127
+ input: {
128
+ file: entry.file,
129
+ name: entry.name
130
+ },
131
+ output: name
132
+ }
133
+ });
134
+ }
135
+ return ret;
136
+ }, this.inputs);
137
+ this.debug(`Shell Shock will process ${this.inputs.length} command entry files: \n${this.inputs.map((command) => ` - ${command.id}: ${(0, __stryke_path_replace.replacePath)(command.entry.file, this.commandsPath)}`).join("\n")}`);
138
+ }
139
+ },
140
+ {
141
+ name: "shell-shock:virtual-inputs",
142
+ configResolved: {
143
+ order: "post",
144
+ async handler() {
145
+ if (this.inputs.length === 0) this.warn("No commands were found in the project. Please ensure at least one command exists.");
146
+ else {
147
+ this.debug(`Shell Shock will create an application with the following commands: \n${this.inputs.filter((cmd) => !cmd.isVirtual).map((command) => ` - ${command.id}: ${(0, __stryke_path_replace.replacePath)(command.entry.file, this.commandsPath)}${command.isVirtual ? " (virtual)" : ""}`).join("\n")}`);
148
+ this.debug("Finding and adding virtual command inputs for each command previously found.");
149
+ this.inputs = this.inputs.reduce((ret, command) => {
150
+ let depth = 0;
151
+ let parentPath = (0, __stryke_path_resolve_parent_path.resolveParentPath)((0, __stryke_path_file_path_fns.findFilePath)(command.entry.file));
152
+ while (parentPath !== this.commandsPath) {
153
+ if (depth++ > MAX_DEPTH) throw new Error(`Maximum command virtual parent depth of ${MAX_DEPTH} exceeded while processing command: ${command.name}`);
154
+ if (!ret.some((existing) => (0, __stryke_path_file_path_fns.findFilePath)(existing.entry.file) === parentPath)) {
155
+ const file = (0, __stryke_path_join_paths.joinPaths)(parentPath, "command.ts");
156
+ const id = require_resolve_command.resolveCommandId(this, file);
157
+ if (!ret.some((existing) => existing.id === id)) {
158
+ const name = require_resolve_command.resolveCommandName(file);
159
+ const path = require_resolve_command.resolveCommandPath(this, file);
160
+ ret.push({
161
+ id,
162
+ path: {
163
+ value: path,
164
+ segments: path.split("/").filter(Boolean)
165
+ },
166
+ name,
167
+ alias: [],
168
+ isVirtual: true,
169
+ entry: { file }
170
+ });
171
+ }
172
+ }
173
+ parentPath = (0, __stryke_path_resolve_parent_path.resolveParentPath)(parentPath);
174
+ }
175
+ return ret;
176
+ }, this.inputs).sort((a, b) => a.path.segments.length - b.path.segments.length);
177
+ this.debug(`Final command input list: \n${this.inputs.map((command) => ` - ${command.id}: ${(0, __stryke_path_replace.replacePath)(command.entry.file, this.commandsPath)}${command.isVirtual ? " (virtual)" : ""}`).join("\n")}`);
178
+ }
179
+ }
180
+ }
181
+ },
182
+ {
183
+ name: "shell-shock:reflect-commands",
184
+ prepare: {
185
+ order: "post",
186
+ async handler() {
187
+ this.debug("Initializing the CLI application's command tree.");
188
+ this.commands = {};
189
+ if (this.config.command !== "prepare" && this.config.skipCache !== true && this.persistedMeta?.checksum === this.meta.checksum && this.fs.existsSync(require_persistence.getCommandsPersistencePath(this))) {
190
+ this.debug(`Skipping reflection initialization as the meta checksum has not changed.`);
191
+ await require_persistence.readCommandsPersistence(this);
192
+ } else {
193
+ for (const input of this.inputs.filter((input$1) => input$1.path.segments.filter((segment) => !require_plugin_utils_context_helpers.isVariableCommandPath(segment)).length === 1)) this.commands[input.name] = await require_resolve_command.reflectCommandTree(this, input);
194
+ this.debug("Post-processing commands to ensure proper reflection.");
195
+ this.options = this.options.map((option) => ({
196
+ ...option,
197
+ name: (0, __stryke_string_format_camel_case.camelCase)(option.name),
198
+ alias: option.alias ?? [],
199
+ optional: option.optional ?? false
200
+ }));
201
+ await require_plugin_utils_traverse_command_tree.traverseCommands(this, (command) => {
202
+ command.options = Object.fromEntries(Object.entries(command.options).map(([name, option]) => [(0, __stryke_string_format_camel_case.camelCase)(name), {
203
+ ...option,
204
+ name: (0, __stryke_string_format_camel_case.camelCase)(name),
205
+ alias: option.alias ?? [],
206
+ optional: option.optional ?? false
207
+ }]));
208
+ });
209
+ await require_persistence.writeCommandsPersistence(this);
210
+ }
211
+ this.debug("Validating the CLI applications command tree.");
212
+ let isValid = true;
213
+ await require_plugin_utils_traverse_command_tree.traverseCommands(this, (command) => {
214
+ const failures = require_validations.validateCommand(command);
215
+ if (failures.length > 0) {
216
+ this.error(`Found ${failures.length} issue${failures.length > 1 ? "s" : ""} with the ${command.title} command: \n${failures.map((failure) => ` - ${failure.code}: ${failure.details}`).join("\n")}\n`);
217
+ isValid = false;
218
+ }
219
+ });
220
+ if (!isValid) throw new Error(`One or more commands in the command tree are invalid. Please review the errors above and correct them before proceeding.`);
221
+ this.info(`\nCreating an application with the following command tree: \n${require_utilities.formatCommandTree(this)}\n`);
222
+ }
223
+ }
224
+ },
225
+ {
226
+ name: "shell-shock:chmod+x",
227
+ configResolved() {
228
+ this.config.build.outputOptions ??= {};
229
+ this.config.build.outputOptions.banner = (chunk) => {
230
+ if (chunk.isEntry && (0, __stryke_path_join_paths.joinPaths)(this.entryPath, "bin.ts") === chunk.facadeModuleId) {
231
+ this.debug(`Adding hashbang to binary executable output file: ${chunk.fileName}`);
232
+ return `#!/usr/bin/env ${this.config.mode === "development" ? "-S NODE_OPTIONS=--enable-source-maps" : ""} node\n`;
233
+ }
234
+ return "";
235
+ };
236
+ },
237
+ async buildEnd() {
238
+ if (!(0, __stryke_type_checks_is_set_object.isSetObject)(this.config.bin)) this.warn(`No binaries were found for the ${this.config.name} application. Please ensure the binaries are correctly configured in your Shell Shock configuration or package.json.`);
239
+ else await Promise.all(Object.values(this.config.bin).map(async (bin) => {
240
+ const path = (0, __stryke_path_append.appendPath)(bin, (0, __stryke_path_join_paths.joinPaths)(this.workspaceConfig.workspaceRoot, this.config.projectRoot));
241
+ if (this.fs.existsSync(path)) {
242
+ this.debug(`Adding executable permissions (chmod+x) to binary executable output file: ${path}`);
243
+ await (0, __stryke_fs_chmod_x.chmodX)(path);
244
+ } else this.warn(`Unable to locate the binary executable output file: ${path}. This may indicate either a misconfiguration in the package.json file or an issue with the build process.`);
245
+ }));
246
+ }
247
+ },
248
+ {
249
+ name: "shell-shock:docs",
250
+ configResolved() {
251
+ this.config.automd ??= {};
252
+ this.config.automd.generators = {
253
+ ...this.config.automd.generators ?? {},
254
+ commands: require_automd.commands(this)
255
+ };
256
+ },
257
+ async docs() {
258
+ this.debug("Rendering entrypoint modules for the Shell Shock `script` preset.");
259
+ const commands$1 = this.inputs.map((input) => require_plugin_utils_get_command_tree.getCommandTree(this, input.path.segments)).filter(Boolean);
260
+ return (0, __powerlines_plugin_alloy_render.render)(this, (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core_components.For, {
261
+ get each() {
262
+ return Object.values(commands$1);
263
+ },
264
+ doubleHardline: true,
265
+ children: (child) => (0, __alloy_js_core_jsx_runtime.createComponent)(__alloy_js_core_components.Show, {
266
+ get when() {
267
+ return !child.isVirtual;
268
+ },
269
+ get children() {
270
+ return (0, __alloy_js_core_jsx_runtime.createComponent)(require_components_docs.CommandDocsFile, { command: child });
271
+ }
272
+ })
273
+ }));
274
+ }
275
+ }
276
+ ];
277
+ };
278
+ var plugin_default = plugin;
279
+
280
+ //#endregion
281
+ exports.default = plugin_default;
282
+ exports.plugin = plugin;
283
+ exports.shellShock = plugin;
284
+ //# sourceMappingURL=plugin.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.cjs","names":["For","Show","render","automd","deepkit","nodejs","tsdown","toArray","chmodX","appendPath","findFilePath","isParentPath","joinPaths","replacePath","resolveParentPath","camelCase","constantCase","kebabCase","isSetObject","isSetString","defu","resolveEntries","CommandDocsFile","commands","getCommandsPersistencePath","readCommandsPersistence","writeCommandsPersistence","findCommandsRoot","reflectCommandTree","resolveCommandId","resolveCommandName","resolveCommandPath","formatBinaryPath","updatePackageJsonBinary","formatCommandTree","getDefaultOptions","validateCommand","getAppDescription","getAppName","getAppTitle","isVariableCommandPath","getCommandTree","traverseCommands","MAX_DEPTH","plugin","options","name","config","debug","result","output","buildPath","projectRoot","title","description","envPrefix","env","prefix","isCaseSensitive","format","dts","entry","Array","isArray","length","sourceRoot","undefined","build","platform","nodeProtocol","unbundle","noExternal","type","framework","includes","push","configResolved","order","handler","bin","packageJson","inputs","Object","values","id","alias","path","value","segments","isVirtual","commandsPath","entries","reduce","ret","file","Error","some","existing","split","filter","Boolean","input","map","command","join","warn","cmd","depth","parentPath","sort","a","b","prepare","skipCache","persistedMeta","checksum","meta","fs","existsSync","segment","option","optional","fromEntries","isValid","failures","error","failure","code","details","info","outputOptions","banner","chunk","isEntry","entryPath","facadeModuleId","fileName","mode","buildEnd","Promise","all","workspaceConfig","workspaceRoot","generators","docs","_$createComponent","each","doubleHardline","children","child","when","shellShock"],"sources":["../src/plugin.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 { For, Show } from \"@alloy-js/core/components\";\nimport { render } from \"@powerlines/plugin-alloy/render\";\nimport automd from \"@powerlines/plugin-automd\";\nimport deepkit from \"@powerlines/plugin-deepkit\";\nimport nodejs from \"@powerlines/plugin-nodejs\";\nimport tsdown from \"@powerlines/plugin-tsdown\";\nimport { toArray } from \"@stryke/convert/to-array\";\nimport { chmodX } from \"@stryke/fs/chmod-x\";\nimport { appendPath } from \"@stryke/path/append\";\nimport { findFilePath } from \"@stryke/path/file-path-fns\";\nimport { isParentPath } from \"@stryke/path/is-parent-path\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { resolveParentPath } from \"@stryke/path/resolve-parent-path\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { constantCase } from \"@stryke/string-format/constant-case\";\nimport { kebabCase } from \"@stryke/string-format/kebab-case\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { defu } from \"defu\";\nimport type { Plugin } from \"powerlines\";\nimport { resolveEntries } from \"powerlines/lib/entry\";\nimport type { OutputOptions, RenderedChunk } from \"rolldown\";\nimport { CommandDocsFile } from \"./components/docs\";\nimport { commands } from \"./helpers/automd\";\nimport {\n getCommandsPersistencePath,\n readCommandsPersistence,\n writeCommandsPersistence\n} from \"./helpers/persistence\";\nimport {\n findCommandsRoot,\n reflectCommandTree,\n resolveCommandId,\n resolveCommandName,\n resolveCommandPath\n} from \"./helpers/resolve-command\";\nimport {\n formatBinaryPath,\n updatePackageJsonBinary\n} from \"./helpers/update-package-json\";\nimport { formatCommandTree, getDefaultOptions } from \"./helpers/utilities\";\nimport { validateCommand } from \"./helpers/validations\";\nimport {\n getAppDescription,\n getAppName,\n getAppTitle,\n isVariableCommandPath\n} from \"./plugin-utils/context-helpers\";\nimport { getCommandTree } from \"./plugin-utils/get-command-tree\";\nimport { traverseCommands } from \"./plugin-utils/traverse-command-tree\";\nimport type { CommandOption, CommandTree } from \"./types/command\";\nimport type { Options } from \"./types/config\";\nimport type { Context } from \"./types/context\";\n\nconst MAX_DEPTH = 50;\n\n/**\n * The core Powerlines plugin to build Shell Shock projects.\n */\nexport const plugin = <TContext extends Context = Context>(\n options: Options = {}\n) => {\n return [\n tsdown(),\n deepkit(),\n automd(),\n {\n name: \"shell-shock:config\",\n async config() {\n this.debug(\"Resolving the Shell Shock configuration.\");\n\n await updatePackageJsonBinary(this);\n\n const result = defu(\n {\n output: {\n buildPath: joinPaths(this.config.projectRoot, \"dist\")\n }\n },\n options,\n {\n name: getAppName(this),\n title: getAppTitle(this),\n description: getAppDescription(this),\n envPrefix: constantCase(getAppName(this)),\n env: {\n prefix: [] as string[]\n },\n isCaseSensitive: false,\n output: {\n format: \"esm\",\n dts: true\n },\n entry:\n !this.config.entry ||\n (Array.isArray(this.config.entry) &&\n this.config.entry.length === 0)\n ? [\n joinPaths(this.config.sourceRoot, \"**/*.ts\"),\n joinPaths(this.config.sourceRoot, \"**/*.tsx\")\n ]\n : undefined,\n build: {\n dts: false,\n platform: \"node\",\n nodeProtocol: true,\n unbundle: false,\n noExternal: [\"@powerlines/deepkit\"]\n },\n type: \"application\",\n framework: \"shell-shock\"\n }\n );\n if (!result.env.prefix.includes(result.envPrefix)) {\n result.env.prefix.push(result.envPrefix);\n }\n\n return result;\n },\n configResolved: {\n order: \"pre\",\n async handler() {\n this.debug(\"Shell Shock configuration has been resolved.\");\n\n this.config.bin = (isSetString(this.packageJson.bin)\n ? { [kebabCase(this.config.name)]: this.packageJson.bin }\n : this.packageJson.bin) ?? {\n [kebabCase(this.config.name)]: formatBinaryPath(\n this.config.output.format\n )\n };\n\n this.inputs ??= [];\n this.options = Object.values(\n getDefaultOptions(this, {\n id: null,\n name: this.config.name,\n title: this.config.title,\n description: this.config.description,\n alias: [],\n path: {\n value: null,\n segments: []\n },\n isVirtual: false\n })\n );\n }\n }\n },\n ...nodejs<TContext>(),\n {\n name: \"shell-shock:inputs\",\n async configResolved() {\n this.debug(\"Finding command entry point files.\");\n\n this.commandsPath = findCommandsRoot(this);\n\n const entries = await resolveEntries(\n this,\n toArray(this.config.entry || [])\n );\n this.debug(\n `Found ${\n entries.length\n } entry points specified in the configuration options.`\n );\n\n this.inputs = entries.reduce((ret, entry) => {\n if (!isParentPath(entry.file, this.commandsPath)) {\n throw new Error(\n `Command entry point \"${\n entry.file\n }\" is not located within the commands root \"${\n this.commandsPath\n }\". Please ensure that all command entry points are located within the current project.`\n );\n }\n\n const id = resolveCommandId(this, entry.file);\n if (!ret.some(existing => existing.id === id)) {\n const path = resolveCommandPath(this, entry.file);\n const name = resolveCommandName(entry.file);\n\n ret.push({\n id,\n path: {\n value: path,\n segments: path.split(\"/\").filter(Boolean)\n },\n name,\n alias: [],\n isVirtual: false,\n entry: {\n ...entry,\n file: entry.file,\n input: {\n file: entry.file,\n name: entry.name\n },\n output: name\n }\n });\n }\n\n return ret;\n }, this.inputs);\n\n this.debug(\n `Shell Shock will process ${\n this.inputs.length\n } command entry files: \\n${this.inputs\n .map(\n command =>\n ` - ${command.id}: ${replacePath(\n command.entry.file,\n this.commandsPath\n )}`\n )\n .join(\"\\n\")}`\n );\n }\n },\n {\n name: \"shell-shock:virtual-inputs\",\n configResolved: {\n order: \"post\",\n async handler() {\n if (this.inputs.length === 0) {\n this.warn(\n \"No commands were found in the project. Please ensure at least one command exists.\"\n );\n } else {\n this.debug(\n `Shell Shock will create an application with the following commands: \\n${this.inputs\n .filter(cmd => !cmd.isVirtual)\n .map(\n command =>\n ` - ${command.id}: ${replacePath(\n command.entry.file,\n this.commandsPath\n )}${command.isVirtual ? \" (virtual)\" : \"\"}`\n )\n .join(\"\\n\")}`\n );\n\n this.debug(\n \"Finding and adding virtual command inputs for each command previously found.\"\n );\n\n this.inputs = this.inputs\n .reduce((ret, command) => {\n let depth = 0;\n\n let parentPath = resolveParentPath(\n findFilePath(command.entry.file)\n );\n while (parentPath !== this.commandsPath) {\n if (depth++ > MAX_DEPTH) {\n throw new Error(\n `Maximum command virtual parent depth of ${\n MAX_DEPTH\n } exceeded while processing command: ${command.name}`\n );\n }\n\n if (\n !ret.some(\n existing =>\n findFilePath(existing.entry.file) === parentPath\n )\n ) {\n const file = joinPaths(parentPath, \"command.ts\");\n const id = resolveCommandId(this, file);\n if (!ret.some(existing => existing.id === id)) {\n const name = resolveCommandName(file);\n const path = resolveCommandPath(this, file);\n\n ret.push({\n id,\n path: {\n value: path,\n segments: path.split(\"/\").filter(Boolean)\n },\n name,\n alias: [],\n isVirtual: true,\n entry: {\n file\n }\n });\n }\n }\n\n parentPath = resolveParentPath(parentPath);\n }\n\n return ret;\n }, this.inputs)\n .sort((a, b) => a.path.segments.length - b.path.segments.length);\n\n this.debug(\n `Final command input list: \\n${this.inputs\n .map(\n command =>\n ` - ${command.id}: ${replacePath(\n command.entry.file,\n this.commandsPath\n )}${command.isVirtual ? \" (virtual)\" : \"\"}`\n )\n .join(\"\\n\")}`\n );\n }\n }\n }\n },\n {\n name: \"shell-shock:reflect-commands\",\n prepare: {\n order: \"post\",\n async handler() {\n this.debug(\"Initializing the CLI application's command tree.\");\n this.commands = {};\n\n if (\n this.config.command !== \"prepare\" &&\n this.config.skipCache !== true &&\n this.persistedMeta?.checksum === this.meta.checksum &&\n this.fs.existsSync(getCommandsPersistencePath(this))\n ) {\n this.debug(\n `Skipping reflection initialization as the meta checksum has not changed.`\n );\n\n await readCommandsPersistence(this);\n } else {\n for (const input of this.inputs.filter(\n input =>\n input.path.segments.filter(\n segment => !isVariableCommandPath(segment)\n ).length === 1\n )) {\n this.commands[input.name] = await reflectCommandTree(this, input);\n }\n\n this.debug(\"Post-processing commands to ensure proper reflection.\");\n\n this.options = this.options.map(\n option =>\n ({\n ...option,\n name: camelCase(option.name),\n alias: option.alias ?? [],\n optional: option.optional ?? false\n }) as CommandOption\n );\n\n await traverseCommands(this, command => {\n command.options = Object.fromEntries(\n Object.entries(command.options).map(([name, option]) => [\n camelCase(name),\n {\n ...option,\n name: camelCase(name),\n alias: option.alias ?? [],\n optional: option.optional ?? false\n } as CommandOption\n ])\n );\n });\n\n await writeCommandsPersistence(this);\n }\n\n this.debug(\"Validating the CLI applications command tree.\");\n\n let isValid = true;\n await traverseCommands(this, command => {\n const failures = validateCommand(command);\n if (failures.length > 0) {\n this.error(\n `Found ${failures.length} issue${failures.length > 1 ? \"s\" : \"\"} with the ${\n command.title\n } command: \\n${failures\n .map(failure => ` - ${failure.code}: ${failure.details}`)\n .join(\"\\n\")}\\n`\n );\n isValid = false;\n }\n });\n if (!isValid) {\n throw new Error(\n `One or more commands in the command tree are invalid. Please review the errors above and correct them before proceeding.`\n );\n }\n\n this.info(\n `\\nCreating an application with the following command tree: \\n${formatCommandTree(\n this\n )}\\n`\n );\n }\n }\n },\n {\n name: \"shell-shock:chmod+x\",\n configResolved() {\n this.config.build.outputOptions ??= {} as OutputOptions;\n (this.config.build.outputOptions as OutputOptions).banner = (\n chunk: RenderedChunk\n ) => {\n if (\n chunk.isEntry &&\n joinPaths(this.entryPath, \"bin.ts\") === chunk.facadeModuleId\n ) {\n this.debug(\n `Adding hashbang to binary executable output file: ${chunk.fileName}`\n );\n\n return `#!/usr/bin/env ${\n this.config.mode === \"development\"\n ? \"-S NODE_OPTIONS=--enable-source-maps\"\n : \"\"\n } node\\n`;\n }\n return \"\";\n };\n },\n async buildEnd() {\n if (!isSetObject(this.config.bin)) {\n this.warn(\n `No binaries were found for the ${\n this.config.name\n } application. Please ensure the binaries are correctly configured in your Shell Shock configuration or package.json.`\n );\n } else {\n await Promise.all(\n Object.values(this.config.bin).map(async bin => {\n const path = appendPath(\n bin,\n joinPaths(\n this.workspaceConfig.workspaceRoot,\n this.config.projectRoot\n )\n );\n\n if (this.fs.existsSync(path)) {\n this.debug(\n `Adding executable permissions (chmod+x) to binary executable output file: ${path}`\n );\n\n await chmodX(path);\n } else {\n this.warn(\n `Unable to locate the binary executable output file: ${path}. This may indicate either a misconfiguration in the package.json file or an issue with the build process.`\n );\n }\n })\n );\n }\n }\n },\n {\n name: \"shell-shock:docs\",\n configResolved() {\n this.config.automd ??= {};\n this.config.automd.generators = {\n ...(this.config.automd.generators ?? {}),\n commands: commands(this)\n };\n },\n async docs() {\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 <For each={Object.values(commands)} doubleHardline>\n {child => (\n <Show when={!child.isVirtual}>\n <CommandDocsFile command={child} />\n </Show>\n )}\n </For>\n );\n }\n }\n ] as Plugin<TContext>[];\n};\n\nexport { plugin as shellShock };\nexport default plugin;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyEA,MAAM2C,YAAY;;;;AAKlB,MAAaC,UACXC,UAAmB,EAAE,KAClB;AACH,QAAO;2CACG;4CACC;2CACD;EACR;GACEC,MAAM;GACN,MAAMC,SAAS;AACb,SAAKC,MAAM,2CAA2C;AAEtD,UAAMf,oDAAwB,KAAK;IAEnC,MAAMgB,wBACJ,EACEC,QAAQ,EACNC,mDAAqB,KAAKJ,OAAOK,aAAa,OAAM,EACtD,EACD,EACDP,SACA;KACEC,MAAMR,gDAAW,KAAK;KACtBe,OAAOd,iDAAY,KAAK;KACxBe,aAAajB,uDAAkB,KAAK;KACpCkB,kEAAwBjB,gDAAW,KAAK,CAAC;KACzCkB,KAAK,EACHC,QAAQ,EAAA,EACT;KACDC,iBAAiB;KACjBR,QAAQ;MACNS,QAAQ;MACRC,KAAK;MACN;KACDC,OACE,CAAC,KAAKd,OAAOc,SACZC,MAAMC,QAAQ,KAAKhB,OAAOc,MAAM,IAC/B,KAAKd,OAAOc,MAAMG,WAAW,IAC3B,yCACY,KAAKjB,OAAOkB,YAAY,UAAU,0CAClC,KAAKlB,OAAOkB,YAAY,WAAW,CAC9C,GACDC;KACNC,OAAO;MACLP,KAAK;MACLQ,UAAU;MACVC,cAAc;MACdC,UAAU;MACVC,YAAY,CAAC,sBAAqB;MACnC;KACDC,MAAM;KACNC,WAAW;KAEf,CAAC;AACD,QAAI,CAACxB,OAAOO,IAAIC,OAAOiB,SAASzB,OAAOM,UAAU,CAC/CN,QAAOO,IAAIC,OAAOkB,KAAK1B,OAAOM,UAAU;AAG1C,WAAON;;GAET2B,gBAA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AC;;GAEJ;EACF;;AAIH,qBAAezG"}
@@ -0,0 +1,13 @@
1
+ import { Context } from "./types/context.cjs";
2
+ import { Options } from "./types/config.cjs";
3
+ import { Plugin } from "powerlines";
4
+
5
+ //#region src/plugin.d.ts
6
+
7
+ /**
8
+ * The core Powerlines plugin to build Shell Shock projects.
9
+ */
10
+ declare const plugin: <TContext extends Context = Context>(options?: Options) => Plugin<TContext>[];
11
+ //#endregion
12
+ export { plugin as default, plugin, plugin as shellShock };
13
+ //# sourceMappingURL=plugin.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.cts","names":[],"sources":["../src/plugin.tsx"],"sourcesContent":[],"mappings":";;;;;;;;AA8EA;AAAwC,cAA3B,MAA2B,EAAA,CAAA,iBAAA,OAAA,GAAU,OAAV,CAAA,CAAA,OAAA,CAAA,EAC7B,OAD6B,EAAA,GAibjC,MAjbiC,CAib1B,QAjb0B,CAAA,EAAA"}
@@ -0,0 +1,13 @@
1
+ import { Context } from "./types/context.mjs";
2
+ import { Options } from "./types/config.mjs";
3
+ import { Plugin } from "powerlines";
4
+
5
+ //#region src/plugin.d.ts
6
+
7
+ /**
8
+ * The core Powerlines plugin to build Shell Shock projects.
9
+ */
10
+ declare const plugin: <TContext extends Context = Context>(options?: Options) => Plugin<TContext>[];
11
+ //#endregion
12
+ export { plugin as default, plugin, plugin as shellShock };
13
+ //# sourceMappingURL=plugin.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"plugin.d.mts","names":[],"sources":["../src/plugin.tsx"],"sourcesContent":[],"mappings":";;;;;;;;AA8EA;AAAwC,cAA3B,MAA2B,EAAA,CAAA,iBAAA,OAAA,GAAU,OAAV,CAAA,CAAA,OAAA,CAAA,EAC7B,OAD6B,EAAA,GAibjC,MAjbiC,CAib1B,QAjb0B,CAAA,EAAA"}