@shell-shock/core 0.12.2 → 0.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_virtual/{rolldown_runtime.cjs → _rolldown/runtime.cjs} +1 -1
- package/dist/_virtual/_rolldown/runtime.mjs +3 -0
- package/dist/api.cjs +3 -2
- package/dist/api.cjs.map +1 -1
- package/dist/api.d.cts +0 -1
- package/dist/api.d.cts.map +1 -1
- package/dist/api.d.mts +0 -1
- package/dist/api.d.mts.map +1 -1
- package/dist/api.mjs +1 -1
- package/dist/api.mjs.map +1 -1
- package/dist/components/command-validation-logic.cjs +54 -53
- package/dist/components/command-validation-logic.cjs.map +1 -1
- package/dist/components/command-validation-logic.d.cts +2 -3
- package/dist/components/command-validation-logic.d.cts.map +1 -1
- package/dist/components/command-validation-logic.d.mts +2 -3
- package/dist/components/command-validation-logic.d.mts.map +1 -1
- package/dist/components/command-validation-logic.mjs +1 -1
- package/dist/components/command-validation-logic.mjs.map +1 -1
- package/dist/components/docs.cjs +45 -44
- package/dist/components/docs.cjs.map +1 -1
- package/dist/components/docs.d.cts +5 -5
- package/dist/components/docs.d.cts.map +1 -1
- package/dist/components/docs.d.mts +5 -5
- package/dist/components/docs.d.mts.map +1 -1
- package/dist/components/docs.mjs.map +1 -1
- package/dist/components/helpers.cjs +16 -15
- package/dist/components/helpers.cjs.map +1 -1
- package/dist/components/helpers.d.cts +7 -8
- package/dist/components/helpers.d.cts.map +1 -1
- package/dist/components/helpers.d.mts +7 -8
- package/dist/components/helpers.d.mts.map +1 -1
- package/dist/components/helpers.mjs.map +1 -1
- package/dist/components/index.cjs +1 -0
- package/dist/components/options-parser-logic.cjs +187 -186
- package/dist/components/options-parser-logic.cjs.map +1 -1
- package/dist/components/options-parser-logic.d.cts +9 -9
- package/dist/components/options-parser-logic.d.cts.map +1 -1
- package/dist/components/options-parser-logic.d.mts +9 -9
- package/dist/components/options-parser-logic.d.mts.map +1 -1
- package/dist/components/options-parser-logic.mjs.map +1 -1
- package/dist/components/usage.cjs +21 -20
- package/dist/components/usage.cjs.map +1 -1
- package/dist/components/usage.d.cts +2 -2
- package/dist/components/usage.d.cts.map +1 -1
- package/dist/components/usage.d.mts.map +1 -1
- package/dist/components/usage.mjs.map +1 -1
- package/dist/components/utils-builtin.cjs +128 -127
- package/dist/components/utils-builtin.cjs.map +1 -1
- package/dist/components/utils-builtin.d.cts.map +1 -1
- package/dist/components/utils-builtin.d.mts.map +1 -1
- package/dist/components/utils-builtin.mjs +4 -4
- package/dist/components/utils-builtin.mjs.map +1 -1
- package/dist/config.cjs +1 -0
- package/dist/config.cjs.map +1 -1
- package/dist/config.d.cts +0 -1
- package/dist/config.d.cts.map +1 -1
- package/dist/config.d.mts +0 -1
- package/dist/config.d.mts.map +1 -1
- package/dist/config.mjs.map +1 -1
- package/dist/contexts/command.cjs +5 -4
- package/dist/contexts/command.cjs.map +1 -1
- package/dist/contexts/command.d.cts +0 -1
- package/dist/contexts/command.d.cts.map +1 -1
- package/dist/contexts/command.d.mts +0 -1
- package/dist/contexts/command.d.mts.map +1 -1
- package/dist/contexts/index.cjs +1 -0
- package/dist/contexts/options.cjs +12 -11
- package/dist/contexts/options.cjs.map +1 -1
- package/dist/contexts/options.d.cts +0 -1
- package/dist/contexts/options.d.cts.map +1 -1
- package/dist/contexts/options.d.mts +0 -1
- package/dist/contexts/options.d.mts.map +1 -1
- package/dist/contexts/options.mjs +3 -3
- package/dist/contexts/options.mjs.map +1 -1
- package/dist/helpers/automd.cjs +16 -16
- package/dist/helpers/automd.cjs.map +1 -1
- package/dist/helpers/automd.mjs.map +1 -1
- package/dist/helpers/docs-helpers.cjs +3 -3
- package/dist/helpers/docs-helpers.cjs.map +1 -1
- package/dist/helpers/docs-helpers.mjs.map +1 -1
- package/dist/helpers/paths.cjs +26 -26
- package/dist/helpers/paths.cjs.map +1 -1
- package/dist/helpers/paths.mjs +1 -1
- package/dist/helpers/paths.mjs.map +1 -1
- package/dist/helpers/persistence.cjs +3 -3
- package/dist/helpers/persistence.cjs.map +1 -1
- package/dist/helpers/persistence.mjs.map +1 -1
- package/dist/helpers/update-package-json.cjs +16 -16
- package/dist/helpers/update-package-json.cjs.map +1 -1
- package/dist/helpers/update-package-json.mjs.map +1 -1
- package/dist/helpers/utilities.cjs +9 -9
- package/dist/helpers/utilities.cjs.map +1 -1
- package/dist/helpers/utilities.mjs.map +1 -1
- package/dist/helpers/validations.cjs.map +1 -1
- package/dist/helpers/validations.mjs.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +0 -1
- package/dist/index.d.mts +0 -1
- package/dist/plugin-utils/context-helpers.cjs +10 -10
- package/dist/plugin-utils/context-helpers.cjs.map +1 -1
- package/dist/plugin-utils/context-helpers.d.cts +0 -3
- package/dist/plugin-utils/context-helpers.d.cts.map +1 -1
- package/dist/plugin-utils/context-helpers.d.mts +0 -3
- package/dist/plugin-utils/context-helpers.d.mts.map +1 -1
- package/dist/plugin-utils/context-helpers.mjs +1 -1
- package/dist/plugin-utils/context-helpers.mjs.map +1 -1
- package/dist/plugin-utils/deepkit.cjs +18 -18
- package/dist/plugin-utils/deepkit.cjs.map +1 -1
- package/dist/plugin-utils/deepkit.d.cts +0 -1
- package/dist/plugin-utils/deepkit.d.cts.map +1 -1
- package/dist/plugin-utils/deepkit.d.mts +0 -1
- package/dist/plugin-utils/deepkit.d.mts.map +1 -1
- package/dist/plugin-utils/deepkit.mjs.map +1 -1
- package/dist/plugin-utils/description-helpers.cjs.map +1 -1
- package/dist/plugin-utils/description-helpers.d.cts.map +1 -1
- package/dist/plugin-utils/description-helpers.d.mts.map +1 -1
- package/dist/plugin-utils/description-helpers.mjs.map +1 -1
- package/dist/plugin-utils/get-command-tree.cjs.map +1 -1
- package/dist/plugin-utils/get-command-tree.d.cts +0 -1
- package/dist/plugin-utils/get-command-tree.d.cts.map +1 -1
- package/dist/plugin-utils/get-command-tree.d.mts +0 -1
- package/dist/plugin-utils/get-command-tree.d.mts.map +1 -1
- package/dist/plugin-utils/get-command-tree.mjs.map +1 -1
- package/dist/plugin-utils/index.cjs +1 -0
- package/dist/plugin-utils/reflect.cjs.map +1 -1
- package/dist/plugin-utils/reflect.d.cts +0 -1
- package/dist/plugin-utils/reflect.d.cts.map +1 -1
- package/dist/plugin-utils/reflect.d.mts +0 -1
- package/dist/plugin-utils/reflect.d.mts.map +1 -1
- package/dist/plugin-utils/reflect.mjs.map +1 -1
- package/dist/plugin-utils/traverse-command-tree.cjs.map +1 -1
- package/dist/plugin-utils/traverse-command-tree.d.cts +0 -1
- package/dist/plugin-utils/traverse-command-tree.d.cts.map +1 -1
- package/dist/plugin-utils/traverse-command-tree.d.mts +0 -1
- package/dist/plugin-utils/traverse-command-tree.d.mts.map +1 -1
- package/dist/plugin-utils/traverse-command-tree.mjs.map +1 -1
- package/dist/plugin-utils/type-checks.cjs +7 -7
- package/dist/plugin-utils/type-checks.cjs.map +1 -1
- package/dist/plugin-utils/type-checks.d.cts +0 -1
- package/dist/plugin-utils/type-checks.d.cts.map +1 -1
- package/dist/plugin-utils/type-checks.d.mts +0 -1
- package/dist/plugin-utils/type-checks.d.mts.map +1 -1
- package/dist/plugin-utils/type-checks.mjs +1 -1
- package/dist/plugin-utils/type-checks.mjs.map +1 -1
- package/dist/plugin.cjs +68 -75
- package/dist/plugin.cjs.map +1 -1
- package/dist/plugin.d.cts +0 -1
- package/dist/plugin.d.cts.map +1 -1
- package/dist/plugin.d.mts +0 -1
- package/dist/plugin.d.mts.map +1 -1
- package/dist/plugin.mjs +23 -30
- package/dist/plugin.mjs.map +1 -1
- package/dist/resolver/deepkit.cjs +29 -29
- package/dist/resolver/deepkit.cjs.map +1 -1
- package/dist/resolver/deepkit.mjs.map +1 -1
- package/dist/resolver/helpers.cjs +17 -17
- package/dist/resolver/helpers.cjs.map +1 -1
- package/dist/resolver/helpers.mjs.map +1 -1
- package/dist/resolver/module.cjs +29 -29
- package/dist/resolver/module.cjs.map +1 -1
- package/dist/resolver/module.mjs +1 -1
- package/dist/resolver/module.mjs.map +1 -1
- package/dist/resolver/resolve.cjs +17 -17
- package/dist/resolver/resolve.cjs.map +1 -1
- package/dist/resolver/resolve.mjs +3 -3
- package/dist/resolver/resolve.mjs.map +1 -1
- package/dist/types/command.cjs +1 -0
- package/dist/types/command.cjs.map +1 -1
- package/dist/types/command.d.cts.map +1 -1
- package/dist/types/command.d.mts.map +1 -1
- package/dist/types/command.mjs.map +1 -1
- package/dist/types/config.cjs +1 -0
- package/dist/types/config.cjs.map +1 -1
- package/dist/types/config.d.cts.map +1 -1
- package/dist/types/config.d.mts.map +1 -1
- package/dist/types/config.mjs.map +1 -1
- package/dist/types/context.cjs +1 -0
- package/dist/types/context.cjs.map +1 -1
- package/dist/types/context.d.cts.map +1 -1
- package/dist/types/context.d.mts.map +1 -1
- package/dist/types/env.cjs +1 -0
- package/dist/types/env.d.cts.map +1 -1
- package/dist/types/env.d.mts.map +1 -1
- package/dist/types/index.cjs +1 -0
- package/dist/types/options.cjs +1 -0
- package/dist/types/options.d.cts.map +1 -1
- package/dist/types/options.d.mts.map +1 -1
- package/dist/types/runtime.cjs +1 -0
- package/dist/types/runtime.d.cts.map +1 -1
- package/dist/types/runtime.d.mts.map +1 -1
- package/package.json +23 -23
package/dist/config.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.cjs","names":[],"sources":["../src/config.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 { UserConfig } from \"./types/config\";\n\n/**\n * A utility function to define a Shell Shock user configuration.\n *\n * @remarks\n * This function is used to create a user configuration object for Shell Shock projects. It ensures that the configuration adheres to the expected structure.\n *\n * @param config - A partial user configuration object.\n * @returns A complete user configuration object.\n */\nexport function defineConfig(config: Partial<UserConfig>): UserConfig {\n return config;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.cjs","names":[],"sources":["../src/config.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 { UserConfig } from \"./types/config\";\n\n/**\n * A utility function to define a Shell Shock user configuration.\n *\n * @remarks\n * This function is used to create a user configuration object for Shell Shock projects. It ensures that the configuration adheres to the expected structure.\n *\n * @param config - A partial user configuration object.\n * @returns A complete user configuration object.\n */\nexport function defineConfig(config: Partial<UserConfig>): UserConfig {\n return config;\n}\n"],"mappings":";;;AAAA,MAAM,aAAa;CAAC;CAAK;CAAW;CAA2B;;;;;;;;;;AAU/D,SAAgB,aAAW,QAAQ;AAClC,QAAA"}
|
package/dist/config.d.cts
CHANGED
package/dist/config.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.cts","names":[],"sources":["../src/config.ts"],"
|
|
1
|
+
{"version":3,"file":"config.d.cts","names":[],"sources":["../src/config.ts"],"mappings":";;;;;AA6BA;;;;;;;iBAAgB,YAAA,CAAa,MAAA,EAAQ,OAAA,CAAQ,UAAA,IAAc,UAAA"}
|
package/dist/config.d.mts
CHANGED
package/dist/config.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.mts","names":[],"sources":["../src/config.ts"],"
|
|
1
|
+
{"version":3,"file":"config.d.mts","names":[],"sources":["../src/config.ts"],"mappings":";;;;;AA6BA;;;;;;;iBAAgB,YAAA,CAAa,MAAA,EAAQ,OAAA,CAAQ,UAAA,IAAc,UAAA"}
|
package/dist/config.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.mjs","names":[],"sources":["../src/config.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 { UserConfig } from \"./types/config\";\n\n/**\n * A utility function to define a Shell Shock user configuration.\n *\n * @remarks\n * This function is used to create a user configuration object for Shell Shock projects. It ensures that the configuration adheres to the expected structure.\n *\n * @param config - A partial user configuration object.\n * @returns A complete user configuration object.\n */\nexport function defineConfig(config: Partial<UserConfig>): UserConfig {\n return config;\n}\n"],"mappings":";AAAA,MAAM,aAAa;CAAC;CAAK;CAAW;CAA2B;;;;;;;;;;AAU/D,SAAgB,
|
|
1
|
+
{"version":3,"file":"config.mjs","names":[],"sources":["../src/config.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 { UserConfig } from \"./types/config\";\n\n/**\n * A utility function to define a Shell Shock user configuration.\n *\n * @remarks\n * This function is used to create a user configuration object for Shell Shock projects. It ensures that the configuration adheres to the expected structure.\n *\n * @param config - A partial user configuration object.\n * @returns A complete user configuration object.\n */\nexport function defineConfig(config: Partial<UserConfig>): UserConfig {\n return config;\n}\n"],"mappings":";AAAA,MAAM,aAAa;CAAC;CAAK;CAAW;CAA2B;;;;;;;;;;AAU/D,SAAgB,aAAW,QAAQ;AAClC,QAAA"}
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
3
|
+
let _alloy_js_core = require("@alloy-js/core");
|
|
3
4
|
|
|
4
5
|
//#region src/contexts/command.ts
|
|
5
6
|
/**
|
|
6
7
|
* The reflection parameter context used in template rendering.
|
|
7
8
|
*/
|
|
8
|
-
const CommandContext = (
|
|
9
|
+
const CommandContext = (_alloy_js_core.createNamedContext.Ω = [["CommandTree", "P\"w!-J"]], (0, _alloy_js_core.createNamedContext)("Command"));
|
|
9
10
|
/**
|
|
10
11
|
* Hook to access the Command context.
|
|
11
12
|
*
|
|
12
13
|
* @returns A reactive version of the current reflection.
|
|
13
14
|
*/
|
|
14
15
|
function useCommand() {
|
|
15
|
-
return
|
|
16
|
+
return _alloy_js_core.useContext.Ω = [["CommandTree", "P\"w!-J"]], (0, _alloy_js_core.useContext)(CommandContext);
|
|
16
17
|
}
|
|
17
18
|
useCommand.__type = ["useCommand", "P\"/!"];
|
|
18
19
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.cjs","names":[],"sources":["../../src/contexts/command.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 { ComponentContext } from \"@alloy-js/core\";\nimport { createNamedContext, useContext } from \"@alloy-js/core\";\nimport type { CommandTree } from \"../types/command\";\n\n/**\n * The reflection parameter context used in template rendering.\n */\nexport const CommandContext: ComponentContext<CommandTree | undefined> =\n createNamedContext<CommandTree | undefined>(\"Command\");\n\n/**\n * Hook to access the Command context.\n *\n * @returns A reactive version of the current reflection.\n */\nexport function useCommand() {\n return useContext<CommandTree | undefined>(CommandContext)!;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"command.cjs","names":[],"sources":["../../src/contexts/command.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 { ComponentContext } from \"@alloy-js/core\";\nimport { createNamedContext, useContext } from \"@alloy-js/core\";\nimport type { CommandTree } from \"../types/command\";\n\n/**\n * The reflection parameter context used in template rendering.\n */\nexport const CommandContext: ComponentContext<CommandTree | undefined> =\n createNamedContext<CommandTree | undefined>(\"Command\");\n\n/**\n * Hook to access the Command context.\n *\n * @returns A reactive version of the current reflection.\n */\nexport function useCommand() {\n return useContext<CommandTree | undefined>(CommandContext)!;\n}\n"],"mappings":";;;;;;;;;;;;;;;AA4BE,QAAA,0BAAA,IAAA,CAAA,CAAA,eAAA,UAAA,CAAA,iCAAA,eAAA;;AAEF,WAAC,SAAA,CAAA,cAAA,QAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.cts","names":[],"sources":["../../src/contexts/command.ts"],"
|
|
1
|
+
{"version":3,"file":"command.d.cts","names":[],"sources":["../../src/contexts/command.ts"],"mappings":";;;;;;AAyBA;cAAa,cAAA,EAAgB,gBAAA,CAAiB,WAAA;;;;AAQ9C;;iBAAgB,UAAA,CAAA,GAAU,WAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.d.mts","names":[],"sources":["../../src/contexts/command.ts"],"
|
|
1
|
+
{"version":3,"file":"command.d.mts","names":[],"sources":["../../src/contexts/command.ts"],"mappings":";;;;;;AAyBA;cAAa,cAAA,EAAgB,gBAAA,CAAiB,WAAA;;;;AAQ9C;;iBAAgB,UAAA,CAAA,GAAU,WAAA"}
|
package/dist/contexts/index.cjs
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
2
3
|
const require_types_command = require('../types/command.cjs');
|
|
3
|
-
let
|
|
4
|
-
let
|
|
4
|
+
let _stryke_string_format_camel_case = require("@stryke/string-format/camel-case");
|
|
5
|
+
let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
5
6
|
let defu = require("defu");
|
|
6
|
-
defu =
|
|
7
|
-
let
|
|
7
|
+
defu = require_runtime.__toESM(defu);
|
|
8
|
+
let _alloy_js_core = require("@alloy-js/core");
|
|
8
9
|
|
|
9
10
|
//#region src/contexts/options.ts
|
|
10
11
|
function __assignType(fn, args) {
|
|
@@ -14,7 +15,7 @@ function __assignType(fn, args) {
|
|
|
14
15
|
/**
|
|
15
16
|
* The reflection parameter context used in template rendering.
|
|
16
17
|
*/
|
|
17
|
-
const ExistingOptionsContext = (
|
|
18
|
+
const ExistingOptionsContext = (_alloy_js_core.createNamedContext.Ω = [["&F"]], (0, _alloy_js_core.createNamedContext)("ExistingOptions", []));
|
|
18
19
|
/**
|
|
19
20
|
* Hook to access the ExistingOptions context.
|
|
20
21
|
*
|
|
@@ -24,17 +25,17 @@ const ExistingOptionsContext = (__alloy_js_core.createNamedContext.Ω = [["&F"]]
|
|
|
24
25
|
* @returns A reactive version of the current reflection.
|
|
25
26
|
*/
|
|
26
27
|
function useExistingOptions() {
|
|
27
|
-
return
|
|
28
|
+
return _alloy_js_core.useContext.Ω = [["&F"]], (0, _alloy_js_core.useContext)(ExistingOptionsContext);
|
|
28
29
|
}
|
|
29
30
|
useExistingOptions.__type = ["useExistingOptions", "P\"/!"];
|
|
30
31
|
function computedOptions(command) {
|
|
31
32
|
return Object.entries(command.options).reduce(__assignType((ret, [name, option]) => {
|
|
32
|
-
ret[(0,
|
|
33
|
-
if (option.kind === require_types_command.CommandParameterKinds.boolean && option.isNegativeOf) ret[(0,
|
|
33
|
+
ret[(0, _stryke_string_format_camel_case.camelCase)(name)] ??= (0, defu.default)({ name: (0, _stryke_string_format_camel_case.camelCase)(name) }, ret[name] ?? {}, option);
|
|
34
|
+
if (option.kind === require_types_command.CommandParameterKinds.boolean && option.isNegativeOf) ret[(0, _stryke_string_format_camel_case.camelCase)(option.isNegativeOf)] = (0, defu.default)({ name: (0, _stryke_string_format_camel_case.camelCase)(option.isNegativeOf) }, ret[option.isNegativeOf] ?? {}, {
|
|
34
35
|
...option,
|
|
35
|
-
env: (0,
|
|
36
|
+
env: (0, _stryke_type_checks_is_set_string.isSetString)(option.env) ? `NO_${option.env}` : false,
|
|
36
37
|
description: `${option.description.replace(/\.+$/, "")}. This property is the negative form of ${name}.`,
|
|
37
|
-
isNegativeOf: (0,
|
|
38
|
+
isNegativeOf: (0, _stryke_string_format_camel_case.camelCase)(name),
|
|
38
39
|
default: !option.default
|
|
39
40
|
});
|
|
40
41
|
return ret;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.cjs","names":[],"sources":["../../src/contexts/options.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { ComponentContext } from \"@alloy-js/core\";\nimport { createNamedContext, useContext } from \"@alloy-js/core\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport defu from \"defu\";\nimport type {\n BooleanCommandOption,\n CommandOption,\n CommandTree\n} from \"../types/command\";\nimport { CommandParameterKinds } from \"../types/command\";\n\n/**\n * The reflection parameter context used in template rendering.\n */\nexport const ExistingOptionsContext: ComponentContext<string[]> =\n createNamedContext<string[]>(\"ExistingOptions\", []);\n\n/**\n * Hook to access the ExistingOptions context.\n *\n * @remarks\n * This context provides a list of option names that already exist on the interface definition.\n *\n * @returns A reactive version of the current reflection.\n */\nexport function useExistingOptions() {\n return useContext<string[]>(ExistingOptionsContext)!;\n}\n\nexport function computedOptions(command: CommandTree) {\n return Object.entries(command.options).reduce(\n (ret, [name, option]) => {\n ret[camelCase(name)] ??= defu(\n {\n name: camelCase(name)\n },\n ret[name] ?? {},\n option\n ) as CommandOption;\n\n if (\n option.kind === CommandParameterKinds.boolean &&\n option.isNegativeOf\n ) {\n ret[camelCase(option.isNegativeOf)] = defu(\n {\n name: camelCase(option.isNegativeOf)\n },\n ret[option.isNegativeOf] ?? {},\n {\n ...option,\n env: isSetString(option.env) ? `NO_${option.env}` : false,\n description: `${option.description.replace(\n /\\.+$/,\n \"\"\n )}. This property is the negative form of ${name}.`,\n isNegativeOf: camelCase(name),\n default: !option.default\n }\n ) as BooleanCommandOption;\n }\n\n return ret;\n },\n {} as Record<string, CommandOption>\n );\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"file":"options.cjs","names":[],"sources":["../../src/contexts/options.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { ComponentContext } from \"@alloy-js/core\";\nimport { createNamedContext, useContext } from \"@alloy-js/core\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport defu from \"defu\";\nimport type {\n BooleanCommandOption,\n CommandOption,\n CommandTree\n} from \"../types/command\";\nimport { CommandParameterKinds } from \"../types/command\";\n\n/**\n * The reflection parameter context used in template rendering.\n */\nexport const ExistingOptionsContext: ComponentContext<string[]> =\n createNamedContext<string[]>(\"ExistingOptions\", []);\n\n/**\n * Hook to access the ExistingOptions context.\n *\n * @remarks\n * This context provides a list of option names that already exist on the interface definition.\n *\n * @returns A reactive version of the current reflection.\n */\nexport function useExistingOptions() {\n return useContext<string[]>(ExistingOptionsContext)!;\n}\n\nexport function computedOptions(command: CommandTree) {\n return Object.entries(command.options).reduce(\n (ret, [name, option]) => {\n ret[camelCase(name)] ??= defu(\n {\n name: camelCase(name)\n },\n ret[name] ?? {},\n option\n ) as CommandOption;\n\n if (\n option.kind === CommandParameterKinds.boolean &&\n option.isNegativeOf\n ) {\n ret[camelCase(option.isNegativeOf)] = defu(\n {\n name: camelCase(option.isNegativeOf)\n },\n ret[option.isNegativeOf] ?? {},\n {\n ...option,\n env: isSetString(option.env) ? `NO_${option.env}` : false,\n description: `${option.description.replace(\n /\\.+$/,\n \"\"\n )}. This property is the negative form of ${name}.`,\n isNegativeOf: camelCase(name),\n default: !option.default\n }\n ) as BooleanCommandOption;\n }\n\n return ret;\n },\n {} as Record<string, CommandOption>\n );\n}\n"],"mappings":";;;;;;;;;;AAAA,SAAS,aAAa,IAAI,MAAM;;AAE5B,QAAO;;;;;AAUX,MAAa,0BAAsB,kCAAkB,IAAA,CAAA,CAAA,KAAA,CAAA,yCAAA,mBAAA,EAAA,CAAA;;;;;;;;;AASrD,SAAS,qBAA4B;AACrC,QAAY,0BAAW,IAAA,CAAA,CAAA,KAAA,CAAA,iCAAA,uBAAA;;AAEvB,mBAAE,SAAoB,CAAA,sBAAA,QAAA;AACtB,SAAe,gBAAA,SAAA;AACb,QAAA,OAAA,QAAA,QAAA,QAAA,CAAA,OAAA,cAAA,KAAA,CAAA,MAAA,YAAA;AACM,sDAAS,KAAQ,wBAAA,EAChB,sDAAA,KAAwB;AAE/B,MAAA,OAAA,SAAA,4CAAA,WACK,OAAW,aAChB,qDAAA,OAAA,aAAA,sBAAA,EACW,sDAAA,OAAwB,aAAA,EACnC,EAAA,IAAA,OAAmB,iBAAW,EAAA,EAAe;;GAE7C,wDAAA,OAAA,IAAA,GAAA,MAAA,OAAA,QAAA;GACS,aAAW,GAAA,OAAgB,YAAO,QAAA,QAAA,GAAA,CAAA,0CAAA,KAAA;GAC5C,8DAAA,KAAA;GACG,SAAA,CAAA,OAAA;GACI,CAAA;AAEJ,SAAU;IACZ;EAAA;EAAA;EAAA;EAAA;EAAA,CAAA,EAAA,EAAA,CAAA;;AAEF,gBAAS,SAAW;CAAM;CAAI;CAAsB;CAAE;CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.d.cts","names":[],"sources":["../../src/contexts/options.ts"],"
|
|
1
|
+
{"version":3,"file":"options.d.cts","names":[],"sources":["../../src/contexts/options.ts"],"mappings":";;;;;;AAiCA;cAAa,sBAAA,EAAwB,gBAAA;;;;AAWrC;;;;;iBAAgB,kBAAA,CAAA;AAAA,iBAIA,eAAA,CAAgB,OAAA,EAAS,WAAA,GAAW,MAAA,SAAA,aAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.d.mts","names":[],"sources":["../../src/contexts/options.ts"],"
|
|
1
|
+
{"version":3,"file":"options.d.mts","names":[],"sources":["../../src/contexts/options.ts"],"mappings":";;;;;;AAiCA;cAAa,sBAAA,EAAwB,gBAAA;;;;AAWrC;;;;;iBAAgB,kBAAA,CAAA;AAAA,iBAIA,eAAA,CAAgB,OAAA,EAAS,WAAA,GAAW,MAAA,SAAA,aAAA"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { CommandParameterKinds } from "../types/command.mjs";
|
|
2
2
|
import { camelCase } from "@stryke/string-format/camel-case";
|
|
3
3
|
import { isSetString } from "@stryke/type-checks/is-set-string";
|
|
4
|
-
import defu from "defu";
|
|
4
|
+
import defu$1 from "defu";
|
|
5
5
|
import { createNamedContext, useContext } from "@alloy-js/core";
|
|
6
6
|
|
|
7
7
|
//#region src/contexts/options.ts
|
|
@@ -27,8 +27,8 @@ function useExistingOptions() {
|
|
|
27
27
|
useExistingOptions.__type = ["useExistingOptions", "P\"/!"];
|
|
28
28
|
function computedOptions(command) {
|
|
29
29
|
return Object.entries(command.options).reduce(__assignType((ret, [name, option]) => {
|
|
30
|
-
ret[camelCase(name)] ??= defu({ name: camelCase(name) }, ret[name] ?? {}, option);
|
|
31
|
-
if (option.kind === CommandParameterKinds.boolean && option.isNegativeOf) ret[camelCase(option.isNegativeOf)] = defu({ name: camelCase(option.isNegativeOf) }, ret[option.isNegativeOf] ?? {}, {
|
|
30
|
+
ret[camelCase(name)] ??= defu$1({ name: camelCase(name) }, ret[name] ?? {}, option);
|
|
31
|
+
if (option.kind === CommandParameterKinds.boolean && option.isNegativeOf) ret[camelCase(option.isNegativeOf)] = defu$1({ name: camelCase(option.isNegativeOf) }, ret[option.isNegativeOf] ?? {}, {
|
|
32
32
|
...option,
|
|
33
33
|
env: isSetString(option.env) ? `NO_${option.env}` : false,
|
|
34
34
|
description: `${option.description.replace(/\.+$/, "")}. This property is the negative form of ${name}.`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"options.mjs","names":[],"sources":["../../src/contexts/options.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { ComponentContext } from \"@alloy-js/core\";\nimport { createNamedContext, useContext } from \"@alloy-js/core\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport defu from \"defu\";\nimport type {\n BooleanCommandOption,\n CommandOption,\n CommandTree\n} from \"../types/command\";\nimport { CommandParameterKinds } from \"../types/command\";\n\n/**\n * The reflection parameter context used in template rendering.\n */\nexport const ExistingOptionsContext: ComponentContext<string[]> =\n createNamedContext<string[]>(\"ExistingOptions\", []);\n\n/**\n * Hook to access the ExistingOptions context.\n *\n * @remarks\n * This context provides a list of option names that already exist on the interface definition.\n *\n * @returns A reactive version of the current reflection.\n */\nexport function useExistingOptions() {\n return useContext<string[]>(ExistingOptionsContext)!;\n}\n\nexport function computedOptions(command: CommandTree) {\n return Object.entries(command.options).reduce(\n (ret, [name, option]) => {\n ret[camelCase(name)] ??= defu(\n {\n name: camelCase(name)\n },\n ret[name] ?? {},\n option\n ) as CommandOption;\n\n if (\n option.kind === CommandParameterKinds.boolean &&\n option.isNegativeOf\n ) {\n ret[camelCase(option.isNegativeOf)] = defu(\n {\n name: camelCase(option.isNegativeOf)\n },\n ret[option.isNegativeOf] ?? {},\n {\n ...option,\n env: isSetString(option.env) ? `NO_${option.env}` : false,\n description: `${option.description.replace(\n /\\.+$/,\n \"\"\n )}. This property is the negative form of ${name}.`,\n isNegativeOf: camelCase(name),\n default: !option.default\n }\n ) as BooleanCommandOption;\n }\n\n return ret;\n },\n {} as Record<string, CommandOption>\n );\n}\n"],"mappings":";;;;;;;AAAA,SAAS,aAAa,IAAI,MAAM;;AAE5B,QAAO;;;;;AAUX,MAAa,
|
|
1
|
+
{"version":3,"file":"options.mjs","names":[],"sources":["../../src/contexts/options.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport type { ComponentContext } from \"@alloy-js/core\";\nimport { createNamedContext, useContext } from \"@alloy-js/core\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport defu from \"defu\";\nimport type {\n BooleanCommandOption,\n CommandOption,\n CommandTree\n} from \"../types/command\";\nimport { CommandParameterKinds } from \"../types/command\";\n\n/**\n * The reflection parameter context used in template rendering.\n */\nexport const ExistingOptionsContext: ComponentContext<string[]> =\n createNamedContext<string[]>(\"ExistingOptions\", []);\n\n/**\n * Hook to access the ExistingOptions context.\n *\n * @remarks\n * This context provides a list of option names that already exist on the interface definition.\n *\n * @returns A reactive version of the current reflection.\n */\nexport function useExistingOptions() {\n return useContext<string[]>(ExistingOptionsContext)!;\n}\n\nexport function computedOptions(command: CommandTree) {\n return Object.entries(command.options).reduce(\n (ret, [name, option]) => {\n ret[camelCase(name)] ??= defu(\n {\n name: camelCase(name)\n },\n ret[name] ?? {},\n option\n ) as CommandOption;\n\n if (\n option.kind === CommandParameterKinds.boolean &&\n option.isNegativeOf\n ) {\n ret[camelCase(option.isNegativeOf)] = defu(\n {\n name: camelCase(option.isNegativeOf)\n },\n ret[option.isNegativeOf] ?? {},\n {\n ...option,\n env: isSetString(option.env) ? `NO_${option.env}` : false,\n description: `${option.description.replace(\n /\\.+$/,\n \"\"\n )}. This property is the negative form of ${name}.`,\n isNegativeOf: camelCase(name),\n default: !option.default\n }\n ) as BooleanCommandOption;\n }\n\n return ret;\n },\n {} as Record<string, CommandOption>\n );\n}\n"],"mappings":";;;;;;;AAAA,SAAS,aAAa,IAAI,MAAM;;AAE5B,QAAO;;;;;AAUX,MAAa,0BAAsB,mBAAkB,IAAA,CAAA,CAAA,KAAA,CAAA,EAAA,mBAAA,mBAAA,EAAA,CAAA;;;;;;;;;AASrD,SAAS,qBAA4B;AACrC,QAAY,WAAW,IAAA,CAAA,CAAA,KAAA,CAAA,EAAA,WAAA,uBAAA;;AAEvB,mBAAE,SAAoB,CAAA,sBAAA,QAAA;AACtB,SAAe,gBAAA,SAAA;AACb,QAAA,OAAA,QAAA,QAAA,QAAA,CAAA,OAAA,cAAA,KAAA,CAAA,MAAA,YAAA;AACM,MAAG,UAAM,KAAQ,MAAA,OAAA,EAChB,MAAA,UAAA,KAAwB;AAE/B,MAAA,OAAA,SAAA,sBAAA,WACK,OAAW,aAChB,KAAA,UAAA,OAAA,aAAA,IAAA,OAAA,EACW,MAAA,UAAA,OAAwB,aAAA,EACnC,EAAA,IAAA,OAAmB,iBAAW,EAAA,EAAe;;GAE7C,KAAA,YAAA,OAAA,IAAA,GAAA,MAAA,OAAA,QAAA;GACS,aAAW,GAAA,OAAgB,YAAO,QAAA,QAAA,GAAA,CAAA,0CAAA,KAAA;GAC5C,cAAA,UAAA,KAAA;GACG,SAAA,CAAA,OAAA;GACI,CAAA;AAEJ,SAAU;IACZ;EAAA;EAAA;EAAA;EAAA;EAAA,CAAA,EAAA,EAAA,CAAA;;AAEF,gBAAS,SAAW;CAAM;CAAI;CAAsB;CAAE;CAAA"}
|
package/dist/helpers/automd.cjs
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
2
2
|
const require_context_helpers = require('../plugin-utils/context-helpers.cjs');
|
|
3
3
|
const require_components_docs = require('../components/docs.cjs');
|
|
4
4
|
require('../plugin-utils/index.cjs');
|
|
5
|
-
let
|
|
6
|
-
let
|
|
7
|
-
let
|
|
8
|
-
let
|
|
9
|
-
let
|
|
10
|
-
let
|
|
5
|
+
let _alloy_js_core_jsx_runtime = require("@alloy-js/core/jsx-runtime");
|
|
6
|
+
let _alloy_js_core_components = require("@alloy-js/core/components");
|
|
7
|
+
let _powerlines_plugin_alloy_render = require("@powerlines/plugin-alloy/render");
|
|
8
|
+
let _alloy_js_core = require("@alloy-js/core");
|
|
9
|
+
let _alloy_js_markdown = require("@alloy-js/markdown");
|
|
10
|
+
let _powerlines_plugin_alloy_core_components_spacing = require("@powerlines/plugin-alloy/core/components/spacing");
|
|
11
11
|
let automd = require("automd");
|
|
12
12
|
|
|
13
13
|
//#region src/helpers/automd.tsx
|
|
@@ -22,32 +22,32 @@ let automd = require("automd");
|
|
|
22
22
|
const commands = (context) => (0, automd.defineGenerator)({
|
|
23
23
|
name: "commands",
|
|
24
24
|
async generate() {
|
|
25
|
-
return { contents: (0,
|
|
26
|
-
(0,
|
|
25
|
+
return { contents: (0, _powerlines_plugin_alloy_render.renderString)(context, [
|
|
26
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_markdown.Heading, {
|
|
27
27
|
level: 2,
|
|
28
28
|
children: "Commands"
|
|
29
29
|
}),
|
|
30
|
-
(0,
|
|
31
|
-
(0,
|
|
32
|
-
(0,
|
|
33
|
-
(0,
|
|
30
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
31
|
+
(0, _alloy_js_core_jsx_runtime.memo)(() => _alloy_js_core.code`The following commands are available in the ${require_context_helpers.getAppTitle(context, true)} command-line interface application:`),
|
|
32
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {}),
|
|
33
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core_components.For, {
|
|
34
34
|
get each() {
|
|
35
35
|
return Object.values(context.commands);
|
|
36
36
|
},
|
|
37
37
|
doubleHardline: true,
|
|
38
|
-
children: (child) => (0,
|
|
38
|
+
children: (child) => (0, _alloy_js_core_jsx_runtime.createComponent)(_alloy_js_core_components.Show, {
|
|
39
39
|
get when() {
|
|
40
40
|
return !child.isVirtual;
|
|
41
41
|
},
|
|
42
42
|
get children() {
|
|
43
|
-
return (0,
|
|
43
|
+
return (0, _alloy_js_core_jsx_runtime.createComponent)(require_components_docs.CommandDocs, {
|
|
44
44
|
command: child,
|
|
45
45
|
levelOffset: 2
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
48
|
})
|
|
49
49
|
}),
|
|
50
|
-
(0,
|
|
50
|
+
(0, _alloy_js_core_jsx_runtime.createComponent)(_powerlines_plugin_alloy_core_components_spacing.Spacing, {})
|
|
51
51
|
]) };
|
|
52
52
|
}
|
|
53
53
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"automd.cjs","names":[
|
|
1
|
+
{"version":3,"file":"automd.cjs","names":[],"sources":["../../src/helpers/automd.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code } from \"@alloy-js/core\";\nimport { For, Show } from \"@alloy-js/core/components\";\nimport { Heading } from \"@alloy-js/markdown\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { renderString } from \"@powerlines/plugin-alloy/render\";\nimport { defineGenerator } from \"automd\";\nimport { CommandDocs } from \"../components/docs\";\nimport { getAppTitle } from \"../plugin-utils\";\nimport type { Context } from \"../types/context\";\n\n/**\n * AutoMD generator to generate CLI command documentation\n *\n * @see https://automd.unjs.io/\n *\n * @param context - The generator context.\n * @returns The generated documentation content.\n */\nexport const commands = (context: Context) =>\n defineGenerator({\n name: \"commands\",\n async generate() {\n return {\n contents: renderString(\n context,\n <>\n <Heading level={2}>Commands</Heading>\n <Spacing />\n {code`The following commands are available in the ${getAppTitle(\n context,\n true\n )} command-line interface application:`}\n <Spacing />\n <For each={Object.values(context.commands)} doubleHardline>\n {child => (\n <Show when={!child.isVirtual}>\n <CommandDocs command={child} levelOffset={2} />\n </Show>\n )}\n </For>\n <Spacing />\n </>\n )\n };\n }\n });\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAqCA,MAAE,YAAgB,wCAAA;CAChB,MAAM;CACN,MAAE,WAAe;AACf,SAAE,EACA,4DAAY,SAAY;mDAAA,4BAAA;IACtB,OAAE;IACF,UAAG;IACJ,CAAC;mDAAoB,0DAAG,EAAQ,CAAC;8CAAQ,mBAAA,+CAAA,oCAAA,SAAA,KAAA,CAAA,sCAAA;mDAAA,0DAAA,EAAA,CAAA;mDAAA,+BAAA;IACxC,IAAI,OAAC;AACH,YAAO,OAAK,OAAS,QAAC,SAAa;;IAErC,gBAAM;IACN,WAAO,0DAAuB,gCAAa;KACzC,IAAG,OAAQ;AACT,aAAK,CAAA,MAAM;;KAEb,IAAI,WAAQ;AACV,6DAAmB,qCAAgB;OACjC,SAAQ;OACR,aAAC;OACF,CAAC;;KAEL,CAAC;IACH,CAAC;mDAAA,0DAAA,EAAA,CAAA;GAAA,CAAA,EACH;;CAEJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"automd.mjs","names":[
|
|
1
|
+
{"version":3,"file":"automd.mjs","names":[],"sources":["../../src/helpers/automd.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code } from \"@alloy-js/core\";\nimport { For, Show } from \"@alloy-js/core/components\";\nimport { Heading } from \"@alloy-js/markdown\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { renderString } from \"@powerlines/plugin-alloy/render\";\nimport { defineGenerator } from \"automd\";\nimport { CommandDocs } from \"../components/docs\";\nimport { getAppTitle } from \"../plugin-utils\";\nimport type { Context } from \"../types/context\";\n\n/**\n * AutoMD generator to generate CLI command documentation\n *\n * @see https://automd.unjs.io/\n *\n * @param context - The generator context.\n * @returns The generated documentation content.\n */\nexport const commands = (context: Context) =>\n defineGenerator({\n name: \"commands\",\n async generate() {\n return {\n contents: renderString(\n context,\n <>\n <Heading level={2}>Commands</Heading>\n <Spacing />\n {code`The following commands are available in the ${getAppTitle(\n context,\n true\n )} command-line interface application:`}\n <Spacing />\n <For each={Object.values(context.commands)} doubleHardline>\n {child => (\n <Show when={!child.isVirtual}>\n <CommandDocs command={child} levelOffset={2} />\n </Show>\n )}\n </For>\n <Spacing />\n </>\n )\n };\n }\n });\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAqCA,MAAE,YAAgB,YAAA,gBAAA;CAChB,MAAM;CACN,MAAE,WAAe;AACf,SAAE,EACA,UAAU,aAAE,SAAY;GAAA,gBAAA,SAAA;IACtB,OAAE;IACF,UAAG;IACJ,CAAC;GAAE,gBAAkB,SAAG,EAAQ,CAAC;GAAC,WAAO,IAAA,+CAAA,YAAA,SAAA,KAAA,CAAA,sCAAA;GAAA,gBAAA,SAAA,EAAA,CAAA;GAAA,gBAAA,KAAA;IACxC,IAAI,OAAC;AACH,YAAO,OAAK,OAAS,QAAC,SAAa;;IAErC,gBAAM;IACN,WAAO,UAAY,gBAAW,MAAa;KACzC,IAAG,OAAQ;AACT,aAAK,CAAA,MAAM;;KAEb,IAAI,WAAQ;AACV,aAAO,gBAAY,aAAgB;OACjC,SAAQ;OACR,aAAC;OACF,CAAC;;KAEL,CAAC;IACH,CAAC;GAAA,gBAAA,SAAA,EAAA,CAAA;GAAA,CAAA,EACH;;CAEJ,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const
|
|
2
|
-
let
|
|
1
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
2
|
+
let _stryke_path_join = require("@stryke/path/join");
|
|
3
3
|
|
|
4
4
|
//#region src/helpers/docs-helpers.ts
|
|
5
5
|
/**
|
|
@@ -9,7 +9,7 @@ let __stryke_path_join = require("@stryke/path/join");
|
|
|
9
9
|
* @returns The output path for the generated documentation.
|
|
10
10
|
*/
|
|
11
11
|
function getDocsOutputPath(context) {
|
|
12
|
-
return (0,
|
|
12
|
+
return (0, _stryke_path_join.joinPaths)(context.config.root, "docs", "generated");
|
|
13
13
|
}
|
|
14
14
|
getDocsOutputPath.__type = [
|
|
15
15
|
"Context",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs-helpers.cjs","names":[],"sources":["../../src/helpers/docs-helpers.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 { joinPaths } from \"@stryke/path/join\";\nimport type { Context } from \"../types/context\";\n\n/**\n * Gets the output path for the generated documentation.\n *\n * @param context - The Shell Shock context.\n * @returns The output path for the generated documentation.\n */\nexport function getDocsOutputPath(context: Context): string {\n return joinPaths(context.config.root, \"docs\", \"generated\");\n}\n"],"mappings":";;;;;;;;;;AAwBA,
|
|
1
|
+
{"version":3,"file":"docs-helpers.cjs","names":[],"sources":["../../src/helpers/docs-helpers.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 { joinPaths } from \"@stryke/path/join\";\nimport type { Context } from \"../types/context\";\n\n/**\n * Gets the output path for the generated documentation.\n *\n * @param context - The Shell Shock context.\n * @returns The output path for the generated documentation.\n */\nexport function getDocsOutputPath(context: Context): string {\n return joinPaths(context.config.root, \"docs\", \"generated\");\n}\n"],"mappings":";;;;;;;;;;AAwBA,SAAU,kBAAoB,SAAa;AACvC,yCAAY,QAAY,OAAQ,MAAA,QAAU,YAAa;;AAE3D,kBAAgB,SAAA;CAAA;CAAkB;CAAgB;CAAU;CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs-helpers.mjs","names":[],"sources":["../../src/helpers/docs-helpers.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 { joinPaths } from \"@stryke/path/join\";\nimport type { Context } from \"../types/context\";\n\n/**\n * Gets the output path for the generated documentation.\n *\n * @param context - The Shell Shock context.\n * @returns The output path for the generated documentation.\n */\nexport function getDocsOutputPath(context: Context): string {\n return joinPaths(context.config.root, \"docs\", \"generated\");\n}\n"],"mappings":";;;;;;;;;AAwBA,
|
|
1
|
+
{"version":3,"file":"docs-helpers.mjs","names":[],"sources":["../../src/helpers/docs-helpers.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 { joinPaths } from \"@stryke/path/join\";\nimport type { Context } from \"../types/context\";\n\n/**\n * Gets the output path for the generated documentation.\n *\n * @param context - The Shell Shock context.\n * @returns The output path for the generated documentation.\n */\nexport function getDocsOutputPath(context: Context): string {\n return joinPaths(context.config.root, \"docs\", \"generated\");\n}\n"],"mappings":";;;;;;;;;AAwBA,SAAU,kBAAoB,SAAa;AACvC,QAAO,UAAK,QAAY,OAAQ,MAAA,QAAU,YAAa;;AAE3D,kBAAgB,SAAA;CAAA;CAAkB;CAAgB;CAAU;CAAA"}
|
package/dist/helpers/paths.cjs
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
const
|
|
1
|
+
const require_runtime = require('../_virtual/_rolldown/runtime.cjs');
|
|
2
2
|
const require_context_helpers = require('../plugin-utils/context-helpers.cjs');
|
|
3
|
-
let
|
|
4
|
-
let
|
|
5
|
-
let
|
|
6
|
-
let
|
|
7
|
-
let
|
|
8
|
-
let
|
|
9
|
-
let __stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
3
|
+
let _stryke_path_append = require("@stryke/path/append");
|
|
4
|
+
let _stryke_path_file_path_fns = require("@stryke/path/file-path-fns");
|
|
5
|
+
let _stryke_path_join_paths = require("@stryke/path/join-paths");
|
|
6
|
+
let _stryke_path_replace = require("@stryke/path/replace");
|
|
7
|
+
let _stryke_path_resolve_parent_path = require("@stryke/path/resolve-parent-path");
|
|
8
|
+
let _stryke_type_checks_is_set_string = require("@stryke/type-checks/is-set-string");
|
|
10
9
|
let powerlines_utils = require("powerlines/utils");
|
|
11
|
-
let
|
|
12
|
-
let
|
|
10
|
+
let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
|
|
11
|
+
let _stryke_path_common = require("@stryke/path/common");
|
|
12
|
+
let _stryke_path_normalize = require("@stryke/path/normalize");
|
|
13
13
|
let node_fs = require("node:fs");
|
|
14
14
|
|
|
15
15
|
//#region src/helpers/paths.ts
|
|
@@ -18,7 +18,7 @@ function __assignType(fn, args) {
|
|
|
18
18
|
return fn;
|
|
19
19
|
}
|
|
20
20
|
function resolveCommandId(context, file) {
|
|
21
|
-
return (0,
|
|
21
|
+
return (0, _stryke_path_replace.replacePath)((0, _stryke_path_file_path_fns.findFilePath)(file), context.commandsPath).split("/").filter(__assignType((p) => Boolean(p) && !require_context_helpers.isDynamicPathSegment(p), [
|
|
22
22
|
"p",
|
|
23
23
|
"",
|
|
24
24
|
"P\"2!\"/\""
|
|
@@ -38,11 +38,11 @@ resolveCommandId.__type = [
|
|
|
38
38
|
* @returns The command name.
|
|
39
39
|
*/
|
|
40
40
|
function resolveCommandName(file) {
|
|
41
|
-
let path = (0,
|
|
42
|
-
let name = (0,
|
|
41
|
+
let path = (0, _stryke_path_file_path_fns.findFilePath)(file);
|
|
42
|
+
let name = (0, _stryke_path_file_path_fns.findFolderName)(file, { requireExtension: true });
|
|
43
43
|
while (require_context_helpers.isDynamicPathSegment(name)) {
|
|
44
|
-
path = (0,
|
|
45
|
-
name = (0,
|
|
44
|
+
path = (0, _stryke_path_resolve_parent_path.resolveParentPath)(path);
|
|
45
|
+
name = (0, _stryke_path_file_path_fns.findFolderName)(path, { requireExtension: true });
|
|
46
46
|
}
|
|
47
47
|
return name;
|
|
48
48
|
}
|
|
@@ -52,7 +52,7 @@ resolveCommandName.__type = [
|
|
|
52
52
|
"P&2!\"/\""
|
|
53
53
|
];
|
|
54
54
|
function resolveCommandPath(context, file) {
|
|
55
|
-
return (0,
|
|
55
|
+
return (0, _stryke_path_replace.replacePath)((0, _stryke_path_file_path_fns.findFilePath)(file), context.commandsPath).replaceAll(/^\/+/g, "").replaceAll(/\/+$/g, "").split("/").filter(__assignType((path) => path && !require_context_helpers.isPathSegmentGroup(path), [
|
|
56
56
|
"path",
|
|
57
57
|
"",
|
|
58
58
|
"P\"2!\"/\""
|
|
@@ -66,7 +66,7 @@ resolveCommandPath.__type = [
|
|
|
66
66
|
"P\"w!2\"&2#&/$"
|
|
67
67
|
];
|
|
68
68
|
function resolveCommandDynamicPathSegments(context, file) {
|
|
69
|
-
return (0,
|
|
69
|
+
return (0, _stryke_path_replace.replacePath)((0, _stryke_path_file_path_fns.findFilePath)(file), context.commandsPath).split("/").filter(__assignType((path) => Boolean(path) && require_context_helpers.isDynamicPathSegment(path), [
|
|
70
70
|
"path",
|
|
71
71
|
"",
|
|
72
72
|
"P\"2!\"/\""
|
|
@@ -84,31 +84,31 @@ resolveCommandDynamicPathSegments.__type = [
|
|
|
84
84
|
"P\"w!2\"&2#&F/$"
|
|
85
85
|
];
|
|
86
86
|
function findCommandsRoot(context) {
|
|
87
|
-
if ((0,
|
|
88
|
-
else if ((0, powerlines_utils.isTypeDefinition)(context.config.input)) return (0,
|
|
89
|
-
else if (Array.isArray(context.config.input) && context.config.input.length > 0) return (0,
|
|
87
|
+
if ((0, _stryke_type_checks_is_set_string.isSetString)(context.config.input)) return (0, _stryke_path_append.appendPath)((0, _stryke_path_append.appendPath)((0, _stryke_path_normalize.stripStars)(context.config.input), context.config.root), context.workspaceConfig.workspaceRoot);
|
|
88
|
+
else if ((0, powerlines_utils.isTypeDefinition)(context.config.input)) return (0, _stryke_path_append.appendPath)((0, _stryke_path_append.appendPath)((0, _stryke_path_normalize.stripStars)(context.config.input.file), context.config.root), context.workspaceConfig.workspaceRoot);
|
|
89
|
+
else if (Array.isArray(context.config.input) && context.config.input.length > 0) return (0, _stryke_path_common.commonPath)(context.config.input.map(__assignType((input) => (0, _stryke_path_append.appendPath)((0, _stryke_path_append.appendPath)((0, _stryke_path_normalize.stripStars)((0, _stryke_type_checks_is_set_string.isSetString)(input) ? input : input.file), context.config.root), context.workspaceConfig.workspaceRoot), [
|
|
90
90
|
"input",
|
|
91
91
|
"",
|
|
92
92
|
"P\"2!\"/\""
|
|
93
93
|
])));
|
|
94
|
-
else if ((0,
|
|
94
|
+
else if ((0, _stryke_type_checks_is_set_object.isSetObject)(context.config.input)) return (0, _stryke_path_common.commonPath)(Object.values(context.config.input).map(__assignType((input) => Array.isArray(input) ? (0, _stryke_path_common.commonPath)(input.map(__assignType((i) => (0, _stryke_path_append.appendPath)((0, _stryke_path_append.appendPath)((0, _stryke_path_normalize.stripStars)((0, _stryke_type_checks_is_set_string.isSetString)(i) ? i : i.file), context.config.root), context.workspaceConfig.workspaceRoot), [
|
|
95
95
|
"i",
|
|
96
96
|
"",
|
|
97
97
|
"P\"2!\"/\""
|
|
98
|
-
]))) : (0,
|
|
98
|
+
]))) : (0, _stryke_path_append.appendPath)((0, _stryke_path_append.appendPath)((0, _stryke_path_normalize.stripStars)((0, _stryke_type_checks_is_set_string.isSetString)(input) ? input : input.file), context.config.root), context.workspaceConfig.workspaceRoot), [
|
|
99
99
|
"input",
|
|
100
100
|
"",
|
|
101
101
|
"P\"2!\"/\""
|
|
102
102
|
])));
|
|
103
|
-
let commandsPath = (0,
|
|
103
|
+
let commandsPath = (0, _stryke_path_join_paths.joinPaths)(context.config.root, "src/commands");
|
|
104
104
|
if (!(0, node_fs.existsSync)(commandsPath)) {
|
|
105
|
-
commandsPath = (0,
|
|
105
|
+
commandsPath = (0, _stryke_path_join_paths.joinPaths)(context.config.root, "commands");
|
|
106
106
|
if (!(0, node_fs.existsSync)(commandsPath)) {
|
|
107
|
-
commandsPath = (0,
|
|
107
|
+
commandsPath = (0, _stryke_path_join_paths.joinPaths)(context.config.root, "src");
|
|
108
108
|
if (!(0, node_fs.existsSync)(commandsPath)) commandsPath = context.config.root;
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
|
-
return (0,
|
|
111
|
+
return (0, _stryke_path_append.appendPath)(commandsPath, context.workspaceConfig.workspaceRoot);
|
|
112
112
|
}
|
|
113
113
|
findCommandsRoot.__type = [
|
|
114
114
|
"Context",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paths.cjs","names":[],"sources":["../../src/helpers/paths.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 { appendPath } from \"@stryke/path/append\";\nimport { commonPath } from \"@stryke/path/common\";\nimport { findFilePath, findFolderName } from \"@stryke/path/file-path-fns\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { stripStars } from \"@stryke/path/normalize\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { resolveParentPath } from \"@stryke/path/resolve-parent-path\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { existsSync } from \"node:fs\";\nimport { isTypeDefinition } from \"powerlines/utils\";\nimport {\n getDynamicPathSegmentName,\n isDynamicPathSegment,\n isPathSegmentGroup\n} from \"../plugin-utils/context-helpers\";\nimport type { Context } from \"../types/context\";\n\nexport function resolveCommandId(context: Context, file: string): string {\n return replacePath(findFilePath(file), context.commandsPath)\n .split(\"/\")\n .filter(p => Boolean(p) && !isDynamicPathSegment(p))\n .join(\"/\")\n .replaceAll(/^\\/+/g, \"\")\n .replaceAll(/\\/+$/g, \"\")\n .replaceAll(\"/\", \"-\");\n}\n\n/**\n * Finds the command name from the given file path.\n *\n * @param file - The file path to extract the command name from.\n * @returns The command name.\n */\nexport function resolveCommandName(file: string) {\n let path = findFilePath(file);\n let name = findFolderName(file, {\n requireExtension: true\n });\n\n while (isDynamicPathSegment(name)) {\n path = resolveParentPath(path);\n name = findFolderName(path, {\n requireExtension: true\n });\n }\n\n return name;\n}\n\nexport function resolveCommandPath(context: Context, file: string): string {\n return replacePath(findFilePath(file), context.commandsPath)\n .replaceAll(/^\\/+/g, \"\")\n .replaceAll(/\\/+$/g, \"\")\n .split(\"/\")\n .filter(path => path && !isPathSegmentGroup(path))\n .join(\"/\");\n}\n\nexport function resolveCommandDynamicPathSegments(\n context: Context,\n file: string\n): string[] {\n return replacePath(findFilePath(file), context.commandsPath)\n .split(\"/\")\n .filter(path => Boolean(path) && isDynamicPathSegment(path))\n .map(path => getDynamicPathSegmentName(path));\n}\n\nexport function findCommandsRoot(context: Context): string {\n if (isSetString(context.config.input)) {\n return appendPath(\n appendPath(stripStars(context.config.input), context.config.root),\n context.workspaceConfig.workspaceRoot\n );\n } else if (isTypeDefinition(context.config.input)) {\n return appendPath(\n appendPath(stripStars(context.config.input.file), context.config.root),\n context.workspaceConfig.workspaceRoot\n );\n } else if (\n Array.isArray(context.config.input) &&\n context.config.input.length > 0\n ) {\n return commonPath(\n context.config.input.map(input =>\n appendPath(\n appendPath(\n stripStars(isSetString(input) ? input : input.file),\n context.config.root\n ),\n context.workspaceConfig.workspaceRoot\n )\n )\n );\n } else if (isSetObject(context.config.input)) {\n return commonPath(\n Object.values(context.config.input).map(input =>\n Array.isArray(input)\n ? commonPath(\n input.map(i =>\n appendPath(\n appendPath(\n stripStars(isSetString(i) ? i : i.file),\n context.config.root\n ),\n context.workspaceConfig.workspaceRoot\n )\n )\n )\n : appendPath(\n appendPath(\n stripStars(isSetString(input) ? input : input.file),\n context.config.root\n ),\n context.workspaceConfig.workspaceRoot\n )\n )\n );\n }\n\n let commandsPath = joinPaths(context.config.root, \"src/commands\");\n if (!existsSync(commandsPath)) {\n commandsPath = joinPaths(context.config.root, \"commands\");\n if (!existsSync(commandsPath)) {\n commandsPath = joinPaths(context.config.root, \"src\");\n if (!existsSync(commandsPath)) {\n commandsPath = context.config.root;\n }\n }\n }\n\n return appendPath(commandsPath, context.workspaceConfig.workspaceRoot);\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAA,SAAS,aAAa,IAAI,MAAM;;AAE5B,QAAO;;AA+BX,
|
|
1
|
+
{"version":3,"file":"paths.cjs","names":[],"sources":["../../src/helpers/paths.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 { appendPath } from \"@stryke/path/append\";\nimport { commonPath } from \"@stryke/path/common\";\nimport { findFilePath, findFolderName } from \"@stryke/path/file-path-fns\";\nimport { joinPaths } from \"@stryke/path/join-paths\";\nimport { stripStars } from \"@stryke/path/normalize\";\nimport { replacePath } from \"@stryke/path/replace\";\nimport { resolveParentPath } from \"@stryke/path/resolve-parent-path\";\nimport { isSetObject } from \"@stryke/type-checks/is-set-object\";\nimport { isSetString } from \"@stryke/type-checks/is-set-string\";\nimport { existsSync } from \"node:fs\";\nimport { isTypeDefinition } from \"powerlines/utils\";\nimport {\n getDynamicPathSegmentName,\n isDynamicPathSegment,\n isPathSegmentGroup\n} from \"../plugin-utils/context-helpers\";\nimport type { Context } from \"../types/context\";\n\nexport function resolveCommandId(context: Context, file: string): string {\n return replacePath(findFilePath(file), context.commandsPath)\n .split(\"/\")\n .filter(p => Boolean(p) && !isDynamicPathSegment(p))\n .join(\"/\")\n .replaceAll(/^\\/+/g, \"\")\n .replaceAll(/\\/+$/g, \"\")\n .replaceAll(\"/\", \"-\");\n}\n\n/**\n * Finds the command name from the given file path.\n *\n * @param file - The file path to extract the command name from.\n * @returns The command name.\n */\nexport function resolveCommandName(file: string) {\n let path = findFilePath(file);\n let name = findFolderName(file, {\n requireExtension: true\n });\n\n while (isDynamicPathSegment(name)) {\n path = resolveParentPath(path);\n name = findFolderName(path, {\n requireExtension: true\n });\n }\n\n return name;\n}\n\nexport function resolveCommandPath(context: Context, file: string): string {\n return replacePath(findFilePath(file), context.commandsPath)\n .replaceAll(/^\\/+/g, \"\")\n .replaceAll(/\\/+$/g, \"\")\n .split(\"/\")\n .filter(path => path && !isPathSegmentGroup(path))\n .join(\"/\");\n}\n\nexport function resolveCommandDynamicPathSegments(\n context: Context,\n file: string\n): string[] {\n return replacePath(findFilePath(file), context.commandsPath)\n .split(\"/\")\n .filter(path => Boolean(path) && isDynamicPathSegment(path))\n .map(path => getDynamicPathSegmentName(path));\n}\n\nexport function findCommandsRoot(context: Context): string {\n if (isSetString(context.config.input)) {\n return appendPath(\n appendPath(stripStars(context.config.input), context.config.root),\n context.workspaceConfig.workspaceRoot\n );\n } else if (isTypeDefinition(context.config.input)) {\n return appendPath(\n appendPath(stripStars(context.config.input.file), context.config.root),\n context.workspaceConfig.workspaceRoot\n );\n } else if (\n Array.isArray(context.config.input) &&\n context.config.input.length > 0\n ) {\n return commonPath(\n context.config.input.map(input =>\n appendPath(\n appendPath(\n stripStars(isSetString(input) ? input : input.file),\n context.config.root\n ),\n context.workspaceConfig.workspaceRoot\n )\n )\n );\n } else if (isSetObject(context.config.input)) {\n return commonPath(\n Object.values(context.config.input).map(input =>\n Array.isArray(input)\n ? commonPath(\n input.map(i =>\n appendPath(\n appendPath(\n stripStars(isSetString(i) ? i : i.file),\n context.config.root\n ),\n context.workspaceConfig.workspaceRoot\n )\n )\n )\n : appendPath(\n appendPath(\n stripStars(isSetString(input) ? input : input.file),\n context.config.root\n ),\n context.workspaceConfig.workspaceRoot\n )\n )\n );\n }\n\n let commandsPath = joinPaths(context.config.root, \"src/commands\");\n if (!existsSync(commandsPath)) {\n commandsPath = joinPaths(context.config.root, \"commands\");\n if (!existsSync(commandsPath)) {\n commandsPath = joinPaths(context.config.root, \"src\");\n if (!existsSync(commandsPath)) {\n commandsPath = context.config.root;\n }\n }\n }\n\n return appendPath(commandsPath, context.workspaceConfig.workspaceRoot);\n}\n"],"mappings":";;;;;;;;;;;;;;;AAAA,SAAS,aAAa,IAAI,MAAM;;AAE5B,QAAO;;AA+BX,SAAW,iBAAqB,SAAQ,MAAA;AACxC,2FAAiC,KAAM,EAAA,QAAQ,aAAA,YAExC,OAAS,cAAA,MAAiB,QAAS,EAAA,IAAA,CAAO,6CAAiB,EAAM,EAAC;EAAA;EAAA;EAAA;EAAA,CAAA,CAAA,CAChE,KAAA,IAAA,CACJ,WAAS,SAAA,GAAA,CACT,WAAY,SAAY,GAAG,CACvB,WAAI,KAAA,IAAA;;AAEb,iBAAiB,SAAS;CAAC;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;AAO3B,SAAgB,mBAAkB,MAAO;CACrC,IAAA,oDAAwB,KAAA;CAC1B,IAAA,sDAAA,MAAA,EACK,kBAAS,MACX,CAAC;AACJ,QAAS,6CAAqB,KAAE,EAAA;AAC9B,iEAAkB,KAAA;AAClB,wDAAA,MAAA,0BAEK,CAAA;;AAEL,QAAO;;AAEX,mBAAM,SAAA;CAAA;CAAA;CAAA;CAAA;AACN,SAAE,mBAAA,SAAA,MAAA;wHAEO,WAAI,SAAA,GAAA,CACb,WAAA,SAAA,GAAA,YAEO,OAAS,cAAA,SAAmB,QAAS,CAAA,2CAAqB,KAAG,EAAA;EAAA;EAAO;EAAA;EAAA,CAAA,CAAA,CAClE,KAAA,IAAA;;AAET,mBAAmB,SAAQ;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;AAC3B,SAAc,kCAAA,SAAA,MAAA;AACV,2FAAyB,KAAA,EAAA,QAAmB,aAAK,CAC5C,MAAK,IAAA,CACd,OAAA,cAAA,SAAA,QAAA,KAAA,IAAA,6CAAA,KAAA,EAAA;EAAA;EAAA;EAAA;EAAA,CAAA,CAAA;;;;;;AAGA,kCAAkB,SAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;AAClB,SAAQ,iBAAA,SAAA;AACL,wDAAS,QAAA,OAAA,MAAA,CACJ,uHAAwC,QAAC,OAAY,MAAA,EAAA,QAAA,OAAA,KAAA,EAAA,QAAA,gBAAA,cAAA;iDAEjC,QAAS,OAAA,MAAA,CAC7B,uHAAwC,QAAC,OAAA,MAAA,KAAA,EAAA,QAAA,OAAA,KAAA,EAAA,QAAA,gBAAA,cAAA;iDAG1C,QAAS,OAAA,MAAA,SAAiB,EAC3B,4CAAoB,QAAO,OAAQ,MAAA,IAAA,cAAA,4KAAA,MAAA,GAAA,QAAA,MAAA,KAAA,EAAA,QAAA,OAAA,KAAA,EAAA,QAAA,gBAAA,cAAA,EAAA;EAAA;EAAA;EAAA;EAAA,CAAA,CAAA,CAAA;6DAExB,QAAW,OAAQ,MAAO,CACrC,4CAAQ,OAAgB,OAAA,QAAA,OAAA,MAAA,CAAA,IAAA,cAAA,UAAA,MAAA,QAAA,MAAA,uCACzB,MAAA,IAAA,cAAA,wKAAA,EAAA,GAAA,IAAA,EAAA,KAAA,EAAA,QAAA,OAAA,KAAA,EAAA,QAAA,gBAAA,cAAA,EAAA;EAAA;EAAA;EAAA;EAAA,CAAA,CAAA,CAAA,qKACgD,MAAA,GAAA,QAAA,MAAA,KAAA,EAAA,QAAA,OAAA,KAAA,EAAA,QAAA,gBAAA,cAAA,EAAA;EAAA;EAAA;EAAA;EAAA,CAAA,CAAA,CAAA;CAEjD,IAAE,sDAAsB,QAAQ,OAAY,MAAM,eAAU;AAC5D,KAAE,yBAAQ,aAAgB,EAAA;AACzB,wDAAA,QAAA,OAAA,MAAA,WAAA;AACG,MAAI,yBAAA,aAAA,EAAA;AACF,yDAAuB,QAAQ,OAAA,MAAA,MAAA;AAC7B,OAAA,yBAAa,aAAS,CAC9B,gBAAA,QAAA,OAAA;;;AAIA,4CAAgB,cAAA,QAAA,gBAAA,cAAA;;AAEpB,iBAAY,SAAc;CAAC;CAAA;CAAA;CAAA;CAAA"}
|