@shell-shock/core 0.17.2 → 0.17.4
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/api.cjs +5 -4
- package/dist/api.mjs +4 -2
- package/dist/api.mjs.map +1 -1
- package/dist/components/command-validation-logic.cjs +44 -11
- package/dist/components/command-validation-logic.mjs +44 -10
- package/dist/components/command-validation-logic.mjs.map +1 -1
- package/dist/components/docs.cjs +1 -2
- package/dist/components/exec-builtin.cjs +91 -99
- package/dist/components/exec-builtin.mjs +90 -97
- package/dist/components/exec-builtin.mjs.map +1 -1
- package/dist/components/helpers.cjs +1 -2
- package/dist/components/options-parser-logic.cjs +1 -2
- package/dist/components/state-builtin.cjs +2 -3
- package/dist/components/state-builtin.mjs +2 -2
- package/dist/components/state-builtin.mjs.map +1 -1
- package/dist/components/usage.cjs +1 -2
- package/dist/components/utils-builtin.cjs +2 -17
- package/dist/components/utils-builtin.mjs +1 -15
- package/dist/components/utils-builtin.mjs.map +1 -1
- package/dist/config.cjs +3 -3
- package/dist/config.mjs +2 -1
- package/dist/contexts/command.cjs +6 -3
- package/dist/contexts/command.mjs +5 -1
- package/dist/contexts/command.mjs.map +1 -1
- package/dist/contexts/options.cjs +7 -4
- package/dist/contexts/options.mjs +5 -1
- package/dist/contexts/options.mjs.map +1 -1
- package/dist/helpers/automd.cjs +1 -2
- package/dist/helpers/docs-helpers.cjs +3 -3
- package/dist/helpers/docs-helpers.mjs +2 -1
- package/dist/helpers/docs-helpers.mjs.map +1 -1
- package/dist/helpers/paths.cjs +3 -3
- package/dist/helpers/paths.mjs +2 -1
- package/dist/helpers/paths.mjs.map +1 -1
- package/dist/helpers/persistence.cjs +7 -5
- package/dist/helpers/persistence.mjs +6 -3
- package/dist/helpers/persistence.mjs.map +1 -1
- package/dist/helpers/update-package-json.cjs +1 -2
- package/dist/helpers/utilities.cjs +3 -3
- package/dist/helpers/utilities.mjs +2 -1
- package/dist/helpers/utilities.mjs.map +1 -1
- package/dist/helpers/validations.cjs +1 -2
- package/dist/plugin-utils/context-helpers.cjs +21 -12
- package/dist/plugin-utils/context-helpers.mjs +20 -10
- package/dist/plugin-utils/context-helpers.mjs.map +1 -1
- package/dist/plugin-utils/deepkit.cjs +5 -6
- package/dist/plugin-utils/deepkit.mjs +5 -5
- package/dist/plugin-utils/deepkit.mjs.map +1 -1
- package/dist/plugin-utils/description-helpers.cjs +14 -8
- package/dist/plugin-utils/description-helpers.mjs +13 -6
- package/dist/plugin-utils/description-helpers.mjs.map +1 -1
- package/dist/plugin-utils/get-command-tree.cjs +5 -4
- package/dist/plugin-utils/get-command-tree.mjs +4 -2
- package/dist/plugin-utils/get-command-tree.mjs.map +1 -1
- package/dist/plugin-utils/reflect.cjs +3 -3
- package/dist/plugin-utils/reflect.mjs +2 -1
- package/dist/plugin-utils/traverse-command-tree.cjs +5 -4
- package/dist/plugin-utils/traverse-command-tree.mjs +4 -2
- package/dist/plugin-utils/traverse-command-tree.mjs.map +1 -1
- package/dist/plugin-utils/type-checks.cjs +11 -7
- package/dist/plugin-utils/type-checks.mjs +10 -5
- package/dist/plugin-utils/type-checks.mjs.map +1 -1
- package/dist/plugin.cjs +8 -5
- package/dist/plugin.d.cts.map +1 -1
- package/dist/plugin.d.mts.map +1 -1
- package/dist/plugin.mjs +7 -4
- package/dist/plugin.mjs.map +1 -1
- package/dist/resolver/deepkit.cjs +4 -9
- package/dist/resolver/deepkit.mjs +4 -8
- package/dist/resolver/deepkit.mjs.map +1 -1
- package/dist/resolver/helpers.cjs +5 -4
- package/dist/resolver/helpers.mjs +4 -2
- package/dist/resolver/helpers.mjs.map +1 -1
- package/dist/resolver/module.cjs +1 -2
- package/dist/resolver/resolve.cjs +8 -5
- package/dist/resolver/resolve.mjs +7 -3
- package/dist/resolver/resolve.mjs.map +1 -1
- package/dist/types/command.cjs +65 -12
- package/dist/types/command.d.cts +9 -1
- package/dist/types/command.d.cts.map +1 -1
- package/dist/types/command.d.mts +9 -1
- package/dist/types/command.d.mts.map +1 -1
- package/dist/types/command.mjs +64 -10
- package/dist/types/command.mjs.map +1 -1
- package/dist/types/config.cjs +20 -7
- package/dist/types/config.d.cts +3 -2
- package/dist/types/config.d.cts.map +1 -1
- package/dist/types/config.d.mts +3 -2
- package/dist/types/config.d.mts.map +1 -1
- package/dist/types/config.mjs +19 -5
- package/dist/types/config.mjs.map +1 -1
- package/dist/types/context.cjs +6 -3
- package/dist/types/context.mjs +5 -1
- package/dist/types/env.cjs +38 -3
- package/dist/types/env.d.cts +3 -1
- package/dist/types/env.d.cts.map +1 -1
- package/dist/types/env.d.mts +3 -1
- package/dist/types/env.d.mts.map +1 -1
- package/dist/types/env.mjs +37 -1
- package/dist/types/env.mjs.map +1 -1
- package/dist/types/options.cjs +1 -2
- package/package.json +11 -11
- package/dist/api.cjs.map +0 -1
- package/dist/components/command-validation-logic.cjs.map +0 -1
- package/dist/components/docs.cjs.map +0 -1
- package/dist/components/exec-builtin.cjs.map +0 -1
- package/dist/components/helpers.cjs.map +0 -1
- package/dist/components/options-parser-logic.cjs.map +0 -1
- package/dist/components/state-builtin.cjs.map +0 -1
- package/dist/components/usage.cjs.map +0 -1
- package/dist/components/utils-builtin.cjs.map +0 -1
- package/dist/config.cjs.map +0 -1
- package/dist/contexts/command.cjs.map +0 -1
- package/dist/contexts/options.cjs.map +0 -1
- package/dist/helpers/automd.cjs.map +0 -1
- package/dist/helpers/docs-helpers.cjs.map +0 -1
- package/dist/helpers/paths.cjs.map +0 -1
- package/dist/helpers/persistence.cjs.map +0 -1
- package/dist/helpers/update-package-json.cjs.map +0 -1
- package/dist/helpers/utilities.cjs.map +0 -1
- package/dist/helpers/validations.cjs.map +0 -1
- package/dist/plugin-utils/context-helpers.cjs.map +0 -1
- package/dist/plugin-utils/deepkit.cjs.map +0 -1
- package/dist/plugin-utils/description-helpers.cjs.map +0 -1
- package/dist/plugin-utils/get-command-tree.cjs.map +0 -1
- package/dist/plugin-utils/reflect.cjs.map +0 -1
- package/dist/plugin-utils/traverse-command-tree.cjs.map +0 -1
- package/dist/plugin-utils/type-checks.cjs.map +0 -1
- package/dist/plugin.cjs.map +0 -1
- package/dist/resolver/deepkit.cjs.map +0 -1
- package/dist/resolver/helpers.cjs.map +0 -1
- package/dist/resolver/module.cjs.map +0 -1
- package/dist/resolver/resolve.cjs.map +0 -1
- package/dist/types/command.cjs.map +0 -1
- package/dist/types/config.cjs.map +0 -1
- package/dist/types/context.cjs.map +0 -1
- package/dist/types/env.cjs.map +0 -1
- package/dist/types/options.cjs.map +0 -1
package/dist/types/config.d.mts
CHANGED
|
@@ -2,6 +2,7 @@ import { CommandBase, CommandOption } from "./command.mjs";
|
|
|
2
2
|
import { Context } from "./context.mjs";
|
|
3
3
|
import { OutputConfig as OutputConfig$1 } from "powerlines";
|
|
4
4
|
import { AutoMDPluginResolvedConfig } from "@powerlines/plugin-automd";
|
|
5
|
+
import { DeepkitPluginResolvedConfig, DeepkitPluginUserConfig } from "@powerlines/plugin-deepkit";
|
|
5
6
|
import { NodeJsPluginOptions, NodeJsPluginResolvedConfig, NodeJsPluginUserConfig } from "@powerlines/plugin-nodejs/types/plugin";
|
|
6
7
|
import { TsdownPluginResolvedConfig, TsdownPluginUserConfig } from "@powerlines/plugin-tsdown/types/plugin";
|
|
7
8
|
|
|
@@ -79,7 +80,7 @@ type OutputConfig = Pick<OutputConfig$1, "path" | "copy" | "storage"> & {
|
|
|
79
80
|
/**
|
|
80
81
|
* The user configuration options for Shell Shock.
|
|
81
82
|
*/
|
|
82
|
-
type UserConfig = BaseOptions & Partial<NodeJsPluginUserConfig> & Pick<NodeJsPluginUserConfig, "root"> & {
|
|
83
|
+
type UserConfig = BaseOptions & Partial<NodeJsPluginUserConfig> & Partial<DeepkitPluginUserConfig> & Pick<NodeJsPluginUserConfig, "root"> & {
|
|
83
84
|
/**
|
|
84
85
|
* Configuration for the output of the build process
|
|
85
86
|
*/
|
|
@@ -88,7 +89,7 @@ type UserConfig = BaseOptions & Partial<NodeJsPluginUserConfig> & Pick<NodeJsPlu
|
|
|
88
89
|
/**
|
|
89
90
|
* The resolved configuration options for Shell Shock.
|
|
90
91
|
*/
|
|
91
|
-
type ResolvedConfig = TsdownPluginResolvedConfig & AutoMDPluginResolvedConfig & NodeJsPluginResolvedConfig & Required<Omit<Options, "bin" | "reference">> & {
|
|
92
|
+
type ResolvedConfig = TsdownPluginResolvedConfig & AutoMDPluginResolvedConfig & NodeJsPluginResolvedConfig & DeepkitPluginResolvedConfig & Required<Omit<Options, "bin" | "reference">> & {
|
|
92
93
|
/**
|
|
93
94
|
* The name of the binary (the {@link https://docs.npmjs.com/cli/v11/configuring-npm/package-json#bin | "bin" field} in package.json) that will be used to run the application through NodeJs package managers (e.g., npm, yarn, pnpm).
|
|
94
95
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.mts","names":[],"sources":["../../src/types/config.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"config.d.mts","names":[],"sources":["../../src/types/config.ts"],"mappings":";;;;;;;;;KAoCK,YAAA,GAAe,IAAA,CAClB,sBAAA;AAAA,UAce,gBAAA;EAfZ;;;EAmBH,GAAA;EAlBsB;AAcxB;;;;;EAYE,QAAA;AAAA;AAAA,KAGG,WAAA,GAAc,OAAA,CAAQ,YAAA;EAAA;;;;;;EAOzB,aAAA,GACI,aAAA,OACE,OAAA,EAAS,OAAA,EAAS,KAAA,EAAO,WAAA,KAAgB,aAAA;EAuCnB;;;;;EA/B5B,eAAA;EARe;;;;;;;;;;EAoBf,GAAA;EAmB4B;AAM9B;;;;;;;;EAdE,aAAA;EAckC;;;;AAKpC;;EAXE,SAAA,GAAY,gBAAA;AAAA;;;;KAMF,OAAA,GAAU,WAAA,GAAc,OAAA,CAAQ,mBAAA;;AAkB5C;;KAbY,YAAA,GAAe,IAAA,CACzB,cAAA;EAYuB;;;EANvB,GAAA;AAAA;;;;KAMU,UAAA,GAAa,WAAA,GACvB,OAAA,CAAQ,sBAAA,IACR,OAAA,CAAQ,uBAAA,IACR,IAAA,CAAK,sBAAA;EAIkB;;;EAArB,MAAA,GAAS,YAAA;AAAA;;;;KAMD,cAAA,GAAiB,0BAAA,GAC3B,0BAAA,GACA,0BAAA,GACA,2BAAA,GACA,QAAA,CAAS,IAAA,CAAK,OAAA;EAVH;;;AAMb;;;;;;;EAeI,GAAA,EAAK,MAAA;EAXE;;;EAgBP,SAAA,EAAW,gBAAA;EAUC;;;EALZ,oBAAA;EAxBF;;;EA6BE,UAAA,EAAY,UAAA;AAAA"}
|
package/dist/types/config.mjs
CHANGED
|
@@ -53,9 +53,11 @@ const __ΩBuildOptions = [
|
|
|
53
53
|
];
|
|
54
54
|
const __ΩReferenceOptions = [
|
|
55
55
|
"app",
|
|
56
|
+
"A URL to the application documentation or reference.",
|
|
56
57
|
"commands",
|
|
58
|
+
"A URL to the application command specific documentation or reference.",
|
|
57
59
|
"ReferenceOptions",
|
|
58
|
-
"P&4
|
|
60
|
+
"P&4!?\"&4#8?$Mw%y"
|
|
59
61
|
];
|
|
60
62
|
const __ΩBaseOptions = [
|
|
61
63
|
() => __ΩPartial,
|
|
@@ -68,15 +70,20 @@ const __ΩBaseOptions = [
|
|
|
68
70
|
"",
|
|
69
71
|
false,
|
|
70
72
|
"globalOptions",
|
|
73
|
+
"A set of global command options to apply to each command.",
|
|
71
74
|
"isCaseSensitive",
|
|
72
75
|
true,
|
|
76
|
+
"Determines whether commands and option names are treated as case-sensitive.",
|
|
73
77
|
"bin",
|
|
78
|
+
"The name of the binary (the {@link https://docs.npmjs.com/cli/v11/configuring-npm/package-json#bin | \"bin\" field} in package.json) that will be used to run the application through NodeJs package managers (e.g., npm, yarn, pnpm).",
|
|
74
79
|
true,
|
|
75
80
|
"autoAssignEnv",
|
|
81
|
+
"Should Shell Shock attempt to automatically assign environment variables to manipulate default values for command options based on the option name?",
|
|
76
82
|
() => __ΩReferenceOptions,
|
|
77
83
|
"reference",
|
|
84
|
+
"A URL to the application documentation or reference.",
|
|
78
85
|
"BaseOptions",
|
|
79
|
-
"Pn\"o!\"PP\"w#FP\"w$2%\"w&2'\"w#F/(.)J4*8)4
|
|
86
|
+
"Pn\"o!\"PP\"w#FP\"w$2%\"w&2'\"w#F/(.)J4*8?+)4,8>-?.P&&FJ4/8?0P.1&J428?3Pn4&J458?6MKw7y"
|
|
80
87
|
];
|
|
81
88
|
const __ΩOptions = [
|
|
82
89
|
() => __ΩBaseOptions,
|
|
@@ -91,18 +98,21 @@ const __ΩOutputConfig = [
|
|
|
91
98
|
"storage",
|
|
92
99
|
false,
|
|
93
100
|
"dts",
|
|
101
|
+
"An indicator specifying whether to generate TypeScript declaration files (.d.ts) during the build process.",
|
|
94
102
|
"OutputConfig",
|
|
95
|
-
"P!P.\".#.$Jo!#P.%4&
|
|
103
|
+
"P!P.\".#.$Jo!#P.%4&8?'MKw(y"
|
|
96
104
|
];
|
|
97
105
|
const __ΩUserConfig = [
|
|
98
106
|
() => __ΩBaseOptions,
|
|
99
107
|
() => __ΩPartial,
|
|
108
|
+
() => __ΩPartial,
|
|
100
109
|
() => __ΩPick,
|
|
101
110
|
"root",
|
|
102
111
|
() => __ΩOutputConfig,
|
|
103
112
|
"output",
|
|
113
|
+
"Configuration for the output of the build process",
|
|
104
114
|
"UserConfig",
|
|
105
|
-
"Pn!!o\"\"
|
|
115
|
+
"Pn!!o\"\"!o#\"!.%o$#Pn&4'8?(MKw)y"
|
|
106
116
|
];
|
|
107
117
|
const __ΩResolvedConfig = [
|
|
108
118
|
() => __ΩRequired,
|
|
@@ -112,13 +122,17 @@ const __ΩResolvedConfig = [
|
|
|
112
122
|
"reference",
|
|
113
123
|
() => __ΩRecord,
|
|
114
124
|
"bin",
|
|
125
|
+
"The name of the binary (the {@link https://docs.npmjs.com/cli/v11/configuring-npm/package-json#bin | \"bin\" field} in package.json) that will be used to run the application through NodeJs package managers (e.g., npm, yarn, pnpm).",
|
|
115
126
|
() => __ΩReferenceOptions,
|
|
116
127
|
"reference",
|
|
128
|
+
"The URL(s) to the application documentation or reference.",
|
|
117
129
|
"appSpecificEnvPrefix",
|
|
130
|
+
"The command-line application specific environment variable prefix used for automatically assigning environment variables to command options.",
|
|
118
131
|
() => __ΩUserConfig,
|
|
119
132
|
"userConfig",
|
|
133
|
+
"The user configuration for the Shell Shock process.",
|
|
120
134
|
"ResolvedConfig",
|
|
121
|
-
"P
|
|
135
|
+
"P!!!!n#P.$.%Jo\"#o!\"P&&o'?(n)4*?+&4,?-n.4/?0MKw1y"
|
|
122
136
|
];
|
|
123
137
|
|
|
124
138
|
//#endregion
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.mjs","names":[],"sources":["../../src/types/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 { AutoMDPluginResolvedConfig } from \"@powerlines/plugin-automd\";\nimport type {\n NodeJsPluginOptions,\n NodeJsPluginResolvedConfig,\n NodeJsPluginUserConfig\n} from \"@powerlines/plugin-nodejs/types/plugin\";\nimport type {\n TsdownPluginResolvedConfig,\n TsdownPluginUserConfig\n} from \"@powerlines/plugin-tsdown/types/plugin\";\nimport type { OutputConfig as PowerlinesOutputConfig } from \"powerlines\";\nimport type { CommandBase, CommandOption } from \"./command\";\nimport type { Context } from \"./context\";\n\ntype BuildOptions = Pick<\n TsdownPluginUserConfig,\n | \"root\"\n | \"name\"\n | \"title\"\n | \"description\"\n | \"logLevel\"\n | \"mode\"\n | \"skipCache\"\n | \"autoInstall\"\n | \"plugins\"\n | \"tsconfig\"\n | \"tsconfigRaw\"\n>;\n\nexport interface ReferenceOptions {\n /**\n * A URL to the application documentation or reference.\n */\n app: string;\n\n /**\n * A URL to the application command specific documentation or reference.\n *\n * @remarks\n * This URL is expected to contain the token `{command}`, which will be replaced with the full command path to provide links to command specific documentation. For example, `myapp command subcommand` will be translated to `{reference}/command/subcommand`.\n */\n commands?: string;\n}\n\ntype BaseOptions = Partial<BuildOptions> & {\n /**\n * A set of global command options to apply to each command.\n *\n * @remarks\n * Each command will inherit these global options. To disable the addition of these global options, set this property to `false`, or provide a custom set of options/a function that returns them. A `GlobalOptions` interface will be created by the `shell-shock types` command and added to the generated `shell-shock.d.ts` file.\n */\n globalOptions?:\n | CommandOption[]\n | ((context: Context, input: CommandBase) => CommandOption[])\n | false;\n\n /**\n * Determines whether commands and option names are treated as case-sensitive.\n *\n * @defaultValue `false`\n */\n isCaseSensitive?: boolean;\n\n /**\n * The name of the binary (the {@link https://docs.npmjs.com/cli/v11/configuring-npm/package-json#bin | \"bin\" field} in package.json) that will be used to run the application through NodeJs package managers (e.g., npm, yarn, pnpm).\n *\n * @remarks\n * If an array is provided, each binary will be linked to the same compiled output file. If not provided, the {@link Options.name | name} option will be used.\n *\n * @see https://docs.npmjs.com/cli/v11/configuring-npm/package-json#bin\n * @see https://yarnpkg.com/cli/bin\n * @see https://pnpm.io/package_json#bin\n */\n bin?: string | string[];\n\n /**\n * Should Shell Shock attempt to automatically assign environment variables to manipulate default values for command options based on the option name?\n *\n * @remarks\n * If set to a string, Shell Shock will use the provided string as an application specific environment variable prefix, convert the option name to {@link https://stringcase.org/cases/constant/ | constant case}, and prepend the provided `string` value to determine the corresponding environment variable name. For example, if an option is named `\"configPath\"` and the `autoAssignEnv` is `\"MY_APP_\"`, Shell Shock will look for an environment variable named `\"MY_APP_CONFIG_PATH\"` and assign its value to the option if it exists. If set to `true`, Shell Shock will use a default environment variable prefix derived from the {@link Options.name | application name}.\n *\n * @see https://medium.com/chingu/an-introduction-to-environment-variables-and-how-to-use-them-f602f66d15fa\n * @see https://stringcase.org/cases/constant/\n */\n autoAssignEnv?: true | string;\n\n /**\n * A URL to the application documentation or reference.\n *\n * @remarks\n * This URL can be used in various displays of the user interface and documentation to provide users with a reference for the application. It can also be used by plugins to link to the documentation in relevant contexts. If the token `{command}` is included in the URL, it will be replaced with the full command path to provide links to command specific documentation. For example, `myapp command subcommand` will be translated to `{reference}/command/subcommand`.\n */\n reference?: ReferenceOptions | string;\n};\n\n/**\n * The plugin options for Shell Shock.\n */\nexport type Options = BaseOptions & Partial<NodeJsPluginOptions>;\n\n/**\n * The output configuration options for Shell Shock.\n */\nexport type OutputConfig = Pick<\n PowerlinesOutputConfig,\n \"path\" | \"copy\" | \"storage\"\n> & {\n /**\n * An indicator specifying whether to generate TypeScript declaration files (.d.ts) during the build process.\n */\n dts?: false;\n};\n\n/**\n * The user configuration options for Shell Shock.\n */\nexport type UserConfig = BaseOptions &\n Partial<NodeJsPluginUserConfig> &\n Pick<NodeJsPluginUserConfig, \"root\"> & {\n /**\n * Configuration for the output of the build process\n */\n output?: OutputConfig;\n };\n\n/**\n * The resolved configuration options for Shell Shock.\n */\nexport type ResolvedConfig = TsdownPluginResolvedConfig &\n AutoMDPluginResolvedConfig &\n NodeJsPluginResolvedConfig &\n Required<Omit<Options, \"bin\" | \"reference\">> & {\n /**\n * The name of the binary (the {@link https://docs.npmjs.com/cli/v11/configuring-npm/package-json#bin | \"bin\" field} in package.json) that will be used to run the application through NodeJs package managers (e.g., npm, yarn, pnpm).\n *\n * @remarks\n * If an array is provided, each binary will be linked to the same compiled output file. If not provided, the {@link Options.name | name} option will be used.\n *\n * @see https://docs.npmjs.com/cli/v11/configuring-npm/package-json#bin\n * @see https://yarnpkg.com/cli/bin\n * @see https://pnpm.io/package_json#bin\n */\n bin: Record<string, string>;\n\n /**\n * The URL(s) to the application documentation or reference.\n */\n reference: ReferenceOptions;\n\n /**\n * The command-line application specific environment variable prefix used for automatically assigning environment variables to command options.\n */\n appSpecificEnvPrefix: string;\n\n /**\n * The user configuration for the Shell Shock process.\n */\n userConfig: UserConfig;\n };\n"],"mappings":";AAAA,MAAM,UAAU;CAAC;CAAK;CAAK;CAAQ;CAA4B;;;;;;AAE/D,MAAM,cAAc;CAAA;CAAM;CAAW;CAAM;;;;;;;;;AAE3C,MAAM,YAAS;CAAA;CAAS;CAAG;CAAY;CAAqB;AAC5D,MAAI,aAAc;CAAA;CAAM;CAAA;CAAe;CAA4B;AACnE,MAAM,kBAAkB;OAAC;CAAa;CAAS;CAAA;CAAa;CAAO;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;AACnE,MAAK,sBAAuB;CAAC;CAAE;
|
|
1
|
+
{"version":3,"file":"config.mjs","names":[],"sources":["../../src/types/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 { AutoMDPluginResolvedConfig } from \"@powerlines/plugin-automd\";\nimport type {\n DeepkitPluginResolvedConfig,\n DeepkitPluginUserConfig\n} from \"@powerlines/plugin-deepkit\";\nimport type {\n NodeJsPluginOptions,\n NodeJsPluginResolvedConfig,\n NodeJsPluginUserConfig\n} from \"@powerlines/plugin-nodejs/types/plugin\";\nimport type {\n TsdownPluginResolvedConfig,\n TsdownPluginUserConfig\n} from \"@powerlines/plugin-tsdown/types/plugin\";\nimport type { OutputConfig as PowerlinesOutputConfig } from \"powerlines\";\nimport type { CommandBase, CommandOption } from \"./command\";\nimport type { Context } from \"./context\";\n\ntype BuildOptions = Pick<\n TsdownPluginUserConfig,\n | \"root\"\n | \"name\"\n | \"title\"\n | \"description\"\n | \"logLevel\"\n | \"mode\"\n | \"skipCache\"\n | \"autoInstall\"\n | \"plugins\"\n | \"tsconfig\"\n | \"tsconfigRaw\"\n>;\n\nexport interface ReferenceOptions {\n /**\n * A URL to the application documentation or reference.\n */\n app: string;\n\n /**\n * A URL to the application command specific documentation or reference.\n *\n * @remarks\n * This URL is expected to contain the token `{command}`, which will be replaced with the full command path to provide links to command specific documentation. For example, `myapp command subcommand` will be translated to `{reference}/command/subcommand`.\n */\n commands?: string;\n}\n\ntype BaseOptions = Partial<BuildOptions> & {\n /**\n * A set of global command options to apply to each command.\n *\n * @remarks\n * Each command will inherit these global options. To disable the addition of these global options, set this property to `false`, or provide a custom set of options/a function that returns them. A `GlobalOptions` interface will be created by the `shell-shock types` command and added to the generated `shell-shock.d.ts` file.\n */\n globalOptions?:\n | CommandOption[]\n | ((context: Context, input: CommandBase) => CommandOption[])\n | false;\n\n /**\n * Determines whether commands and option names are treated as case-sensitive.\n *\n * @defaultValue `false`\n */\n isCaseSensitive?: boolean;\n\n /**\n * The name of the binary (the {@link https://docs.npmjs.com/cli/v11/configuring-npm/package-json#bin | \"bin\" field} in package.json) that will be used to run the application through NodeJs package managers (e.g., npm, yarn, pnpm).\n *\n * @remarks\n * If an array is provided, each binary will be linked to the same compiled output file. If not provided, the {@link Options.name | name} option will be used.\n *\n * @see https://docs.npmjs.com/cli/v11/configuring-npm/package-json#bin\n * @see https://yarnpkg.com/cli/bin\n * @see https://pnpm.io/package_json#bin\n */\n bin?: string | string[];\n\n /**\n * Should Shell Shock attempt to automatically assign environment variables to manipulate default values for command options based on the option name?\n *\n * @remarks\n * If set to a string, Shell Shock will use the provided string as an application specific environment variable prefix, convert the option name to {@link https://stringcase.org/cases/constant/ | constant case}, and prepend the provided `string` value to determine the corresponding environment variable name. For example, if an option is named `\"configPath\"` and the `autoAssignEnv` is `\"MY_APP_\"`, Shell Shock will look for an environment variable named `\"MY_APP_CONFIG_PATH\"` and assign its value to the option if it exists. If set to `true`, Shell Shock will use a default environment variable prefix derived from the {@link Options.name | application name}.\n *\n * @see https://medium.com/chingu/an-introduction-to-environment-variables-and-how-to-use-them-f602f66d15fa\n * @see https://stringcase.org/cases/constant/\n */\n autoAssignEnv?: true | string;\n\n /**\n * A URL to the application documentation or reference.\n *\n * @remarks\n * This URL can be used in various displays of the user interface and documentation to provide users with a reference for the application. It can also be used by plugins to link to the documentation in relevant contexts. If the token `{command}` is included in the URL, it will be replaced with the full command path to provide links to command specific documentation. For example, `myapp command subcommand` will be translated to `{reference}/command/subcommand`.\n */\n reference?: ReferenceOptions | string;\n};\n\n/**\n * The plugin options for Shell Shock.\n */\nexport type Options = BaseOptions & Partial<NodeJsPluginOptions>;\n\n/**\n * The output configuration options for Shell Shock.\n */\nexport type OutputConfig = Pick<\n PowerlinesOutputConfig,\n \"path\" | \"copy\" | \"storage\"\n> & {\n /**\n * An indicator specifying whether to generate TypeScript declaration files (.d.ts) during the build process.\n */\n dts?: false;\n};\n\n/**\n * The user configuration options for Shell Shock.\n */\nexport type UserConfig = BaseOptions &\n Partial<NodeJsPluginUserConfig> &\n Partial<DeepkitPluginUserConfig> &\n Pick<NodeJsPluginUserConfig, \"root\"> & {\n /**\n * Configuration for the output of the build process\n */\n output?: OutputConfig;\n };\n\n/**\n * The resolved configuration options for Shell Shock.\n */\nexport type ResolvedConfig = TsdownPluginResolvedConfig &\n AutoMDPluginResolvedConfig &\n NodeJsPluginResolvedConfig &\n DeepkitPluginResolvedConfig &\n Required<Omit<Options, \"bin\" | \"reference\">> & {\n /**\n * The name of the binary (the {@link https://docs.npmjs.com/cli/v11/configuring-npm/package-json#bin | \"bin\" field} in package.json) that will be used to run the application through NodeJs package managers (e.g., npm, yarn, pnpm).\n *\n * @remarks\n * If an array is provided, each binary will be linked to the same compiled output file. If not provided, the {@link Options.name | name} option will be used.\n *\n * @see https://docs.npmjs.com/cli/v11/configuring-npm/package-json#bin\n * @see https://yarnpkg.com/cli/bin\n * @see https://pnpm.io/package_json#bin\n */\n bin: Record<string, string>;\n\n /**\n * The URL(s) to the application documentation or reference.\n */\n reference: ReferenceOptions;\n\n /**\n * The command-line application specific environment variable prefix used for automatically assigning environment variables to command options.\n */\n appSpecificEnvPrefix: string;\n\n /**\n * The user configuration for the Shell Shock process.\n */\n userConfig: UserConfig;\n };\n"],"mappings":";AAAA,MAAM,UAAU;CAAC;CAAK;CAAK;CAAQ;CAA4B;;;;;;AAE/D,MAAM,cAAc;CAAA;CAAM;CAAW;CAAM;;;;;;;;;AAE3C,MAAM,YAAS;CAAA;CAAS;CAAG;CAAY;CAAqB;AAC5D,MAAI,aAAc;CAAA;CAAM;CAAA;CAAe;CAA4B;AACnE,MAAM,kBAAkB;OAAC;CAAa;CAAS;CAAA;CAAa;CAAO;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;AACnE,MAAK,sBAAuB;CAAC;CAAE;CAA+C;CAAA;CAAA;CAAA;CAAA;AAE9E,MAAC,iBAAsB;OAAI;OAAqB;CAAC;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;OAAA;CAAA;CAAA;CAAA;CAAA;CAAA;AACjD,MAAC,aAAkB;OAAO;OAAoB;CAAc;CAAO;CAAA;AAEnE,MAAC,kBAAuB;OAAG;CAAQ;CAAa;CAAK;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;AAErD,MAAM,gBAAQ;OAAa;OAAS;OAAA;OAAA;CAAA;OAAA;CAAA;CAAA;CAAA;CAAA;CAAA;AAEpC,MAAM,oBAAoB;OAAO;OAAmB;OAAe;CAAG;CAAA;OAAA;CAAA;CAAA;OAAA;CAAA;CAAA;CAAA;CAAA;OAAA;CAAA;CAAA;CAAA;CAAA;CAAA"}
|
package/dist/types/context.cjs
CHANGED
|
@@ -11,15 +11,19 @@ const __ΩContext = [
|
|
|
11
11
|
"ResolvedConfig",
|
|
12
12
|
"TResolvedConfig",
|
|
13
13
|
"commandsPath",
|
|
14
|
+
"The root path where commands are located.",
|
|
14
15
|
"CommandOption",
|
|
15
16
|
"options",
|
|
17
|
+
"The default command arguments to apply to all application commands.",
|
|
16
18
|
"CommandConfig",
|
|
17
19
|
"inputs",
|
|
20
|
+
"The list of commands discovered in the project.",
|
|
18
21
|
() => __ΩRecord,
|
|
19
22
|
"CommandTree",
|
|
20
23
|
"commands",
|
|
24
|
+
"The command-line application structure.",
|
|
21
25
|
"Context",
|
|
22
|
-
"\"w!c\"P!!P&4
|
|
26
|
+
"\"w!c\"P!!P&4#?$\"w%F4&?'\"w(F4)?*&\"w,o+#4-?.MKw/y"
|
|
23
27
|
];
|
|
24
28
|
const __ΩUnresolvedContext = [
|
|
25
29
|
"ResolvedConfig",
|
|
@@ -30,5 +34,4 @@ const __ΩUnresolvedContext = [
|
|
|
30
34
|
|
|
31
35
|
//#endregion
|
|
32
36
|
exports.__ΩContext = __ΩContext;
|
|
33
|
-
exports.__ΩUnresolvedContext = __ΩUnresolvedContext;
|
|
34
|
-
//# sourceMappingURL=context.cjs.map
|
|
37
|
+
exports.__ΩUnresolvedContext = __ΩUnresolvedContext;
|
package/dist/types/context.mjs
CHANGED
|
@@ -9,15 +9,19 @@ const __ΩContext = [
|
|
|
9
9
|
"ResolvedConfig",
|
|
10
10
|
"TResolvedConfig",
|
|
11
11
|
"commandsPath",
|
|
12
|
+
"The root path where commands are located.",
|
|
12
13
|
"CommandOption",
|
|
13
14
|
"options",
|
|
15
|
+
"The default command arguments to apply to all application commands.",
|
|
14
16
|
"CommandConfig",
|
|
15
17
|
"inputs",
|
|
18
|
+
"The list of commands discovered in the project.",
|
|
16
19
|
() => __ΩRecord,
|
|
17
20
|
"CommandTree",
|
|
18
21
|
"commands",
|
|
22
|
+
"The command-line application structure.",
|
|
19
23
|
"Context",
|
|
20
|
-
"\"w!c\"P!!P&4
|
|
24
|
+
"\"w!c\"P!!P&4#?$\"w%F4&?'\"w(F4)?*&\"w,o+#4-?.MKw/y"
|
|
21
25
|
];
|
|
22
26
|
const __ΩUnresolvedContext = [
|
|
23
27
|
"ResolvedConfig",
|
package/dist/types/env.cjs
CHANGED
|
@@ -3,15 +3,50 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
3
3
|
//#region src/types/env.ts
|
|
4
4
|
const __ΩShellShockEnv = [
|
|
5
5
|
"PATHEXT",
|
|
6
|
+
"The system PATHEXT variable, used to determine which file extensions are considered executable on Windows.",
|
|
7
|
+
{
|
|
8
|
+
hidden: true,
|
|
9
|
+
internal: true,
|
|
10
|
+
runtime: true
|
|
11
|
+
},
|
|
6
12
|
"PATH",
|
|
13
|
+
"The system PATH variable, used to locate executable files.",
|
|
14
|
+
{
|
|
15
|
+
hidden: true,
|
|
16
|
+
internal: true,
|
|
17
|
+
runtime: true
|
|
18
|
+
},
|
|
7
19
|
"npm_config_user_agent",
|
|
20
|
+
"The npm user agent string, which can be used to detect if the environment is running within an npm script.",
|
|
21
|
+
{
|
|
22
|
+
hidden: true,
|
|
23
|
+
internal: true,
|
|
24
|
+
runtime: true
|
|
25
|
+
},
|
|
8
26
|
"npm_config_fund",
|
|
27
|
+
"The npm_config_fund environment variable, which can be used to control npm's funding behavior.",
|
|
28
|
+
{
|
|
29
|
+
hidden: true,
|
|
30
|
+
internal: true,
|
|
31
|
+
runtime: true
|
|
32
|
+
},
|
|
9
33
|
"npm_execpath",
|
|
34
|
+
"The npm execution path, which can be used to determine the location of the npm executable.",
|
|
35
|
+
{
|
|
36
|
+
hidden: true,
|
|
37
|
+
internal: true,
|
|
38
|
+
runtime: true
|
|
39
|
+
},
|
|
10
40
|
"COMSPEC",
|
|
41
|
+
"The COMSPEC environment variable, which specifies the command-line interpreter to use on Windows.",
|
|
42
|
+
{
|
|
43
|
+
hidden: true,
|
|
44
|
+
internal: true,
|
|
45
|
+
runtime: true
|
|
46
|
+
},
|
|
11
47
|
"ShellShockEnv",
|
|
12
|
-
"P
|
|
48
|
+
"P!&4!8?\"z#&4$8?%z&&4'8?(z)&4*8?+z,&4-8?.z/&408?1z2Mw3y"
|
|
13
49
|
];
|
|
14
50
|
|
|
15
51
|
//#endregion
|
|
16
|
-
exports.__ΩShellShockEnv = __ΩShellShockEnv;
|
|
17
|
-
//# sourceMappingURL=env.cjs.map
|
|
52
|
+
exports.__ΩShellShockEnv = __ΩShellShockEnv;
|
package/dist/types/env.d.cts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { EnvInterface } from "@powerlines/plugin-env/types/runtime";
|
|
2
|
+
|
|
1
3
|
//#region src/types/env.d.ts
|
|
2
|
-
interface ShellShockEnv {
|
|
4
|
+
interface ShellShockEnv extends EnvInterface {
|
|
3
5
|
/**
|
|
4
6
|
* The system PATHEXT variable, used to determine which file extensions are considered executable on Windows.
|
|
5
7
|
*
|
package/dist/types/env.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.d.cts","names":[],"sources":["../../src/types/env.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"env.d.cts","names":[],"sources":["../../src/types/env.ts"],"mappings":";;;UAqBiB,aAAA,SAAsB,YAAA;;AAAvC;;;;;;;;;EAWE,OAAA;EAyDA;;;;;;;EAhDA,IAAA;;;;;;;;;;;EAYA,qBAAA;;;;;;;;;;;EAYA,eAAA;;;;;;;;;;;EAYA,YAAA;;;;;;;;;;;EAYA,OAAA;AAAA"}
|
package/dist/types/env.d.mts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { EnvInterface } from "@powerlines/plugin-env/types/runtime";
|
|
2
|
+
|
|
1
3
|
//#region src/types/env.d.ts
|
|
2
|
-
interface ShellShockEnv {
|
|
4
|
+
interface ShellShockEnv extends EnvInterface {
|
|
3
5
|
/**
|
|
4
6
|
* The system PATHEXT variable, used to determine which file extensions are considered executable on Windows.
|
|
5
7
|
*
|
package/dist/types/env.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.d.mts","names":[],"sources":["../../src/types/env.ts"],"mappings":"
|
|
1
|
+
{"version":3,"file":"env.d.mts","names":[],"sources":["../../src/types/env.ts"],"mappings":";;;UAqBiB,aAAA,SAAsB,YAAA;;AAAvC;;;;;;;;;EAWE,OAAA;EAyDA;;;;;;;EAhDA,IAAA;;;;;;;;;;;EAYA,qBAAA;;;;;;;;;;;EAYA,eAAA;;;;;;;;;;;EAYA,YAAA;;;;;;;;;;;EAYA,OAAA;AAAA"}
|
package/dist/types/env.mjs
CHANGED
|
@@ -1,13 +1,49 @@
|
|
|
1
1
|
//#region src/types/env.ts
|
|
2
2
|
const __ΩShellShockEnv = [
|
|
3
3
|
"PATHEXT",
|
|
4
|
+
"The system PATHEXT variable, used to determine which file extensions are considered executable on Windows.",
|
|
5
|
+
{
|
|
6
|
+
hidden: true,
|
|
7
|
+
internal: true,
|
|
8
|
+
runtime: true
|
|
9
|
+
},
|
|
4
10
|
"PATH",
|
|
11
|
+
"The system PATH variable, used to locate executable files.",
|
|
12
|
+
{
|
|
13
|
+
hidden: true,
|
|
14
|
+
internal: true,
|
|
15
|
+
runtime: true
|
|
16
|
+
},
|
|
5
17
|
"npm_config_user_agent",
|
|
18
|
+
"The npm user agent string, which can be used to detect if the environment is running within an npm script.",
|
|
19
|
+
{
|
|
20
|
+
hidden: true,
|
|
21
|
+
internal: true,
|
|
22
|
+
runtime: true
|
|
23
|
+
},
|
|
6
24
|
"npm_config_fund",
|
|
25
|
+
"The npm_config_fund environment variable, which can be used to control npm's funding behavior.",
|
|
26
|
+
{
|
|
27
|
+
hidden: true,
|
|
28
|
+
internal: true,
|
|
29
|
+
runtime: true
|
|
30
|
+
},
|
|
7
31
|
"npm_execpath",
|
|
32
|
+
"The npm execution path, which can be used to determine the location of the npm executable.",
|
|
33
|
+
{
|
|
34
|
+
hidden: true,
|
|
35
|
+
internal: true,
|
|
36
|
+
runtime: true
|
|
37
|
+
},
|
|
8
38
|
"COMSPEC",
|
|
39
|
+
"The COMSPEC environment variable, which specifies the command-line interpreter to use on Windows.",
|
|
40
|
+
{
|
|
41
|
+
hidden: true,
|
|
42
|
+
internal: true,
|
|
43
|
+
runtime: true
|
|
44
|
+
},
|
|
9
45
|
"ShellShockEnv",
|
|
10
|
-
"P
|
|
46
|
+
"P!&4!8?\"z#&4$8?%z&&4'8?(z)&4*8?+z,&4-8?.z/&408?1z2Mw3y"
|
|
11
47
|
];
|
|
12
48
|
|
|
13
49
|
//#endregion
|
package/dist/types/env.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"env.mjs","names":[],"sources":["../../src/types/env.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\nexport interface ShellShockEnv {\n /**\n * The system PATHEXT variable, used to determine which file extensions are considered executable on Windows.\n *\n * @remarks\n * If not provided, it will default to '.EXE;.CMD;.BAT;.COM' on Windows, and will be ignored on other platforms. This variable is used to locate executable files when running commands, and is only relevant on Windows platforms. On non-Windows platforms, the system's executable file resolution will be used, and this variable will have no effect.\n *\n * @hidden\n * @runtime\n * @internal\n */\n PATHEXT?: string;\n\n /**\n * The system PATH variable, used to locate executable files.\n *\n * @hidden\n * @runtime\n * @internal\n */\n PATH?: string;\n\n /**\n * The npm user agent string, which can be used to detect if the environment is running within an npm script.\n *\n * @remarks\n * This variable is set by npm when running scripts defined in package.json. It can be used to conditionally adjust behavior when running within an npm script context, such as modifying logging output or adjusting command execution. If this variable is not set, it can be assumed that the environment is not running within an npm script.\n *\n * @hidden\n * @runtime\n * @internal\n */\n npm_config_user_agent?: string;\n\n /**\n * The npm_config_fund environment variable, which can be used to control npm's funding behavior.\n *\n * @remarks\n * This variable is set by npm when running scripts defined in package.json, and can be used to control npm's funding behavior. If set to 'false', it will disable npm's funding messages. If not set, npm will use its default funding behavior. This variable is only relevant when running within an npm script context, and has no effect on command execution or behavior outside of that context.\n *\n * @hidden\n * @runtime\n * @internal\n */\n npm_config_fund?: string;\n\n /**\n * The npm execution path, which can be used to determine the location of the npm executable.\n *\n * @remarks\n * This variable is set by npm when running scripts defined in package.json. It provides the absolute path to the npm executable being used to run the script. This can be useful for resolving the location of npm or for debugging purposes. If this variable is not set, it may indicate that the environment is not running within an npm script context, or that npm is not available in the PATH.\n *\n * @hidden\n * @runtime\n * @internal\n */\n npm_execpath?: string;\n\n /**\n * The COMSPEC environment variable, which specifies the command-line interpreter to use on Windows.\n *\n * @remarks\n * This variable is used on Windows platforms to determine which command-line interpreter to use when executing commands. It typically points to cmd.exe, but can be customized by the user. If this variable is not set on Windows, it will default to 'cmd.exe'. On non-Windows platforms, this variable is ignored and has no effect on command execution.\n *\n * @hidden\n * @runtime\n * @internal\n */\n COMSPEC?: string;\n}\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"env.mjs","names":[],"sources":["../../src/types/env.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\n// eslint-disable-next-line ts/consistent-type-imports\nimport { EnvInterface } from \"@powerlines/plugin-env/types/runtime\";\n\nexport interface ShellShockEnv extends EnvInterface {\n /**\n * The system PATHEXT variable, used to determine which file extensions are considered executable on Windows.\n *\n * @remarks\n * If not provided, it will default to '.EXE;.CMD;.BAT;.COM' on Windows, and will be ignored on other platforms. This variable is used to locate executable files when running commands, and is only relevant on Windows platforms. On non-Windows platforms, the system's executable file resolution will be used, and this variable will have no effect.\n *\n * @hidden\n * @runtime\n * @internal\n */\n PATHEXT?: string;\n\n /**\n * The system PATH variable, used to locate executable files.\n *\n * @hidden\n * @runtime\n * @internal\n */\n PATH?: string;\n\n /**\n * The npm user agent string, which can be used to detect if the environment is running within an npm script.\n *\n * @remarks\n * This variable is set by npm when running scripts defined in package.json. It can be used to conditionally adjust behavior when running within an npm script context, such as modifying logging output or adjusting command execution. If this variable is not set, it can be assumed that the environment is not running within an npm script.\n *\n * @hidden\n * @runtime\n * @internal\n */\n npm_config_user_agent?: string;\n\n /**\n * The npm_config_fund environment variable, which can be used to control npm's funding behavior.\n *\n * @remarks\n * This variable is set by npm when running scripts defined in package.json, and can be used to control npm's funding behavior. If set to 'false', it will disable npm's funding messages. If not set, npm will use its default funding behavior. This variable is only relevant when running within an npm script context, and has no effect on command execution or behavior outside of that context.\n *\n * @hidden\n * @runtime\n * @internal\n */\n npm_config_fund?: string;\n\n /**\n * The npm execution path, which can be used to determine the location of the npm executable.\n *\n * @remarks\n * This variable is set by npm when running scripts defined in package.json. It provides the absolute path to the npm executable being used to run the script. This can be useful for resolving the location of npm or for debugging purposes. If this variable is not set, it may indicate that the environment is not running within an npm script context, or that npm is not available in the PATH.\n *\n * @hidden\n * @runtime\n * @internal\n */\n npm_execpath?: string;\n\n /**\n * The COMSPEC environment variable, which specifies the command-line interpreter to use on Windows.\n *\n * @remarks\n * This variable is used on Windows platforms to determine which command-line interpreter to use when executing commands. It typically points to cmd.exe, but can be customized by the user. If this variable is not set on Windows, it will default to 'cmd.exe'. On non-Windows platforms, this variable is ignored and has no effect on command execution.\n *\n * @hidden\n * @runtime\n * @internal\n */\n COMSPEC?: string;\n}\n"],"mappings":""}
|
package/dist/types/options.cjs
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shell-shock/core",
|
|
3
|
-
"version": "0.17.
|
|
3
|
+
"version": "0.17.4",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "A package containing the core Shell Shock functionality used to build and manage a command-line application.",
|
|
6
6
|
"keywords": ["shell-shock", "powerlines", "storm-software"],
|
|
@@ -364,12 +364,12 @@
|
|
|
364
364
|
"@alloy-js/core": "0.23.0-dev.8",
|
|
365
365
|
"@alloy-js/markdown": "0.23.0-dev.1",
|
|
366
366
|
"@alloy-js/typescript": "0.23.0-dev.4",
|
|
367
|
-
"@powerlines/deepkit": "^0.
|
|
368
|
-
"@powerlines/plugin-alloy": "^0.26.
|
|
369
|
-
"@powerlines/plugin-automd": "^0.1.
|
|
370
|
-
"@powerlines/plugin-deepkit": "^0.11.
|
|
371
|
-
"@powerlines/plugin-nodejs": "^0.1.
|
|
372
|
-
"@powerlines/plugin-tsdown": "^0.1.
|
|
367
|
+
"@powerlines/deepkit": "^0.8.1",
|
|
368
|
+
"@powerlines/plugin-alloy": "^0.26.16",
|
|
369
|
+
"@powerlines/plugin-automd": "^0.1.397",
|
|
370
|
+
"@powerlines/plugin-deepkit": "^0.11.278",
|
|
371
|
+
"@powerlines/plugin-nodejs": "^0.1.323",
|
|
372
|
+
"@powerlines/plugin-tsdown": "^0.1.339",
|
|
373
373
|
"@standard-schema/spec": "^1.1.0",
|
|
374
374
|
"@standard-schema/utils": "^0.3.0",
|
|
375
375
|
"@stryke/cli": "^0.13.38",
|
|
@@ -385,18 +385,18 @@
|
|
|
385
385
|
"automd": "^0.4.3",
|
|
386
386
|
"defu": "^6.1.7",
|
|
387
387
|
"json-schema": "^0.4.0",
|
|
388
|
-
"tsdown": "^0.21.
|
|
388
|
+
"tsdown": "^0.21.8"
|
|
389
389
|
},
|
|
390
390
|
"devDependencies": {
|
|
391
|
-
"@powerlines/plugin-plugin": "^0.12.
|
|
391
|
+
"@powerlines/plugin-plugin": "^0.12.348",
|
|
392
392
|
"@types/json-schema": "^7.0.15",
|
|
393
393
|
"@types/node": "^25.6.0",
|
|
394
|
-
"powerlines": "^0.42.
|
|
394
|
+
"powerlines": "^0.42.38",
|
|
395
395
|
"typescript": "^5.9.3",
|
|
396
396
|
"zod": "^4.3.6"
|
|
397
397
|
},
|
|
398
398
|
"peerDependencies": { "powerlines": ">=0.42.10", "zod": "^3.25.0 || ^4.0.0" },
|
|
399
399
|
"peerDependenciesMeta": { "zod": { "optional": true } },
|
|
400
400
|
"publishConfig": { "access": "public" },
|
|
401
|
-
"gitHead": "
|
|
401
|
+
"gitHead": "1364666ac28f03cca26271afb582c71a2fe12ecd"
|
|
402
402
|
}
|
package/dist/api.cjs.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"api.cjs","names":[],"sources":["../src/api.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 {\n BuildInlineConfig,\n CleanInlineConfig,\n DocsInlineConfig,\n LintInlineConfig,\n PluginConfig,\n PrepareInlineConfig\n} from \"powerlines\";\nimport { createPowerlines, PowerlinesAPI } from \"powerlines\";\nimport { plugin } from \"./plugin\";\nimport type { UserConfig } from \"./types/config\";\n\n/**\n * The Shell Shock API class.\n *\n * @remarks\n * This class provides methods to interact with the Shell Shock build system, including cleaning, preparing, linting, building, generating documentation, and finalizing projects.\n */\nexport class ShellShockAPI {\n #powerlines: PowerlinesAPI;\n\n public static async from(\n config: UserConfig,\n workspaceRoot?: string\n ): Promise<ShellShockAPI> {\n const userConfig = {\n framework: \"shell-shock\",\n ...config,\n plugins: [plugin(), ...(config.plugins ?? [])] as PluginConfig<any>[]\n };\n\n const powerlines = await (workspaceRoot\n ? PowerlinesAPI.from(workspaceRoot, userConfig)\n : createPowerlines(userConfig));\n\n return new ShellShockAPI(powerlines);\n }\n\n private constructor(powerlines: PowerlinesAPI) {\n this.#powerlines = powerlines;\n }\n\n public async clean(inlineConfig: CleanInlineConfig): Promise<void> {\n return this.#powerlines.clean(inlineConfig);\n }\n\n public async prepare(inlineConfig: PrepareInlineConfig): Promise<void> {\n return this.#powerlines.prepare(inlineConfig);\n }\n\n public async lint(inlineConfig: LintInlineConfig): Promise<void> {\n return this.#powerlines.lint(inlineConfig);\n }\n\n public async build(inlineConfig: BuildInlineConfig): Promise<void> {\n return this.#powerlines.build(inlineConfig);\n }\n\n public async docs(inlineConfig: DocsInlineConfig): Promise<void> {\n return this.#powerlines.docs(inlineConfig);\n }\n\n public async finalize(): Promise<void> {\n return this.#powerlines.finalize();\n }\n}\n\n/**\n * Creates a new {@link ShellShockAPI} instance.\n *\n * @param options - The user configuration options.\n * @returns A promise that resolves to a {@link ShellShockAPI} instance.\n */\nexport async function createShellShock(\n options: Partial<UserConfig> = {}\n): Promise<ShellShockAPI> {\n return ShellShockAPI.from({ root: process.cwd(), ...options });\n}\n"],"mappings":";;;;;;AAAA,MAAM,aAAa;CAAC;CAAK;CAAW;CAA2B;;;;;;;AAS/D,IAAa,gBAAb,MAAa,cAAc;CAC1B;CACA,aAAgB,KAAK,QAAK,eAAa;EAChC,MAAM,aAAa;;GAErB,GAAQ;;GAEL;AAIP,SAAA,IAAiB,qCAFP,yBAAA,KAAA,eAAA,WAAA,oCACO,WAAA,EACA;;CAEjB,YAAA,cAAgB;AAChB,QAAA,aAAY;;CAEZ,MAAM,MAAA,cAAW;AACX,SAAC,MAAA,WAAkB,MAAA,aAAsB;;CAEjD,MAAO,QAAO,cAAkB;;;CAG7B,MAAI,KAAM,cAAe;AAC3B,SAAA,MAAA,WAAA,KAAA,aAAA;;CAEE,MAAK,MAAM,cAAgB;AAC5B,SAAA,MAAA,WAAA,MAAA,aAAA;;CAEC,MAAA,KAAY,cAAa;;;CAGxB,MAAM,WAAE;AACR,SAAA,MAAgB,WAAA,UAAA;;CAEhB,OAAM,SAAU;EAAC;EAAE;EAAA;EAAA;QAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;EAAA;;;;;;;;AAQvB,eAAQ,iBAA6B,UAAA,EAAA,EAAA;;;;;;AAGrC,iBAAE,SAAA;OAAA;CAAA;CAAA;QAAA,EAAA;OAAA;CAAA;CAAA;CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"command-validation-logic.cjs","names":[],"sources":["../../src/components/command-validation-logic.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, For, Show } from \"@alloy-js/core\";\nimport {\n ElseIfClause,\n IfStatement,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { camelCase } from \"@stryke/string-format/camel-case\";\nimport { list } from \"@stryke/string-format/list\";\nimport type {\n CommandTree,\n NumberCommandParameter,\n StringCommandParameter\n} from \"../types\";\nimport { CommandParameterKinds } from \"../types\";\n\nexport interface CommandValidationLogicProps {\n command: CommandTree;\n}\n\n/**\n * A component that generates command validation logic for required options and arguments.\n */\nexport function CommandValidationLogic(props: CommandValidationLogicProps) {\n const { command } = props;\n\n return (\n <>\n <VarDeclaration name=\"failures\" type=\"string[]\" initializer={code`[];`} />\n <hbr />\n <For each={Object.values(command.options ?? {})} doubleHardline>\n {option => (\n <>\n <Show when={!option.optional}>\n <IfStatement\n condition={code`!options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n }`}>\n {code`failures.push(\"Missing required ${option.name} option\");`}\n </IfStatement>\n <Show\n when={\n (option.kind === CommandParameterKinds.string ||\n option.kind === CommandParameterKinds.number) &&\n option.variadic\n }>\n <ElseIfClause\n condition={code`options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n }.length === 0`}>\n {code`failures.push(\"No values were provided to the required ${\n option.name\n } array option\");`}\n </ElseIfClause>\n </Show>\n </Show>\n <Show when={option.kind === CommandParameterKinds.number}>\n <Show\n when={(option as NumberCommandParameter).variadic}\n fallback={\n <IfStatement\n condition={code`options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n } && Number.isNaN(options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n })`}>\n {code`failures.push(\"Invalid numeric value provided for the ${\n option.name\n } option\");`}\n </IfStatement>\n }>\n <IfStatement\n condition={code`options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n }.some(value => Number.isNaN(value))`}>\n {code`failures.push(\"Invalid numeric value provided in the ${\n option.name\n } array option\");`}\n </IfStatement>\n </Show>\n </Show>\n <Show\n when={\n (option.kind === CommandParameterKinds.string ||\n option.kind === CommandParameterKinds.number) &&\n option.choices &&\n option.choices.length > 0\n }>\n <Show\n when={!option.variadic}\n fallback={\n <ElseIfClause\n condition={code`!options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n }.every(value => [${(\n option as StringCommandParameter | NumberCommandParameter\n ).choices\n ?.map(choice =>\n option.kind === CommandParameterKinds.string\n ? `\"${choice}\"`\n : choice\n )\n .join(\", \")}].includes(value))`}>\n {code`failures.push(\\`Invalid value provided for the ${\n option.name\n } option - valid values include: ${list(\n (\n option as\n | StringCommandParameter\n | NumberCommandParameter\n )?.choices?.map(choice => String(choice)) ?? []\n )}; provided: \\${options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n }}\\`);`}\n </ElseIfClause>\n }>\n <ElseIfClause\n condition={code`![${(\n option as StringCommandParameter | NumberCommandParameter\n ).choices\n ?.map(choice =>\n option.kind === CommandParameterKinds.string\n ? `\"${choice}\"`\n : choice\n )\n .join(\", \")}].includes(options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n })`}>\n {code`failures.push(\\`Invalid value provided for the ${\n option.name\n } option - valid values include: ${list(\n (\n option as StringCommandParameter | NumberCommandParameter\n )?.choices?.map(choice => String(choice)) ?? []\n )}; provided: \\${options${\n option.name.includes(\"?\")\n ? `[\"${option.name}\"]`\n : `.${camelCase(option.name)}`\n }}\\`);`}\n </ElseIfClause>\n </Show>\n </Show>\n </>\n )}\n </For>\n <Spacing />\n <For each={command.args} doubleHardline>\n {argument => (\n <>\n <Show when={!argument.optional}>\n <IfStatement condition={code`!${camelCase(argument.name)}`}>\n {code`failures.push(\"Missing required \\\\\"${\n argument.name\n }\\\\\" positional argument\");`}\n </IfStatement>\n <Show\n when={\n (argument.kind === CommandParameterKinds.string ||\n argument.kind === CommandParameterKinds.number) &&\n argument.variadic\n }>\n <ElseIfClause\n condition={code`${camelCase(argument.name)}.length === 0`}>\n {code`failures.push(\"No values were provided to the required ${\n argument.name\n } array positional argument\");`}\n </ElseIfClause>\n </Show>\n </Show>\n <Show when={argument.kind === CommandParameterKinds.number}>\n <Show\n when={(argument as NumberCommandParameter).variadic}\n fallback={\n <IfStatement\n condition={code`${camelCase(\n argument.name\n )} && Number.isNaN(${camelCase(argument.name)})`}>\n {code`failures.push(\"Invalid numeric value provided for the ${\n argument.name\n } positional argument\");`}\n </IfStatement>\n }>\n <IfStatement\n condition={code`${camelCase(argument.name)}.some(value => Number.isNaN(value))`}>\n {code`failures.push(\"Invalid numeric value provided in the ${\n argument.name\n } array positional argument\");`}\n </IfStatement>\n </Show>\n </Show>\n </>\n )}\n </For>\n </>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;CAkCA,MAAO,EACL,YACF;;;GAEE,MAAA;GACE,MAAC;GACH,aAAA,mBAAA;GACF,CAAA;kDAAgB,OAAA,EAAA,CAAA;kDAA8B,oBAAA;GAC5C,IAAM,OAAE;;;GAGN,gBAAC;GACD,WAAG,WAAe;oDAAqB,qBAAC;KACtC,IAAI,OAAE;AACL,aAAQ,CAAC,OAAO;;KAEjB,IAAI,WAAC;AACH,aAAK,iDAAmB,kCAAS;OAC/B,IAAI,YAAC;AACH,eAAI,mBAAA,WAAiB,OAAQ,KAAA,SAAA,IAAA,GAAA,KAAA,OAAA,KAAA,MAAA,oDAAA,OAAA,KAAA;;OAE/B,IAAI,WAAW;AACb,eAAO,mBAAI,mCAA0B,OAAA,KAAA;;OAExC,CAAC,kDAAoB,qBAAM;OAC1B,IAAI,OAAE;AACJ,gBAAG,OAAA,SAAA,4CAAA,UAAA,OAAA,SAAA,4CAAA,WAAA,OAAA;;OAEL,IAAI,WAAW;AACb,+DAAwB,mCAAA;SACtB,IAAI,YAAO;AACT,iBAAC,mBAAA,UAAA,OAAA,KAAA,SAAA,IAAA,GAAA,KAAA,OAAA,KAAA,MAAA,oDAAA,OAAA,KAAA,GAAA;;SAEH,IAAI,WAAW;AACb,iBAAI,mBAAO,0DAAiB,OAAA,KAAA;;SAE/B,CAAC;;OAEL,CAAC,CAAC;;KAEN,CAAC;oD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O;QAC7B,IAAI,YAAU;AACZ,gBAAM,mBAAA,mDAAA,SAAA,KAAA,CAAA;;QAER,IAAI,WAAS;AACX,gBAAI,mBAAO,0DAA8B,SAAA,KAAA;;QAE5C,CAAC;;MAEL,CAAC,CAAC;;IAEN,CAAC,kDAAoB,qBAAG;IACvB,IAAI,OAAO;AACT,YAAO,SAAS,SAAC,4CAAA;;IAEnB,IAAI,WAAU;AACZ,4DAAU,qBAAA;MACR,IAAE,OAAA;AACH,cAAA,SAAA;;MAEF,IAAO,WAAE;AACL,8DAAoB,kCAAc;QACpC,IAAS,YAAG;AACV,gBAAA,mBAAA,mDAAA,SAAA,KAAA,CAAA,mEAAA,SAAA,KAAA,CAAA;;QAEG,IAAC,WAAY;AACX,gBAAM,mBAAA,yDAAoC,SAAA,KAAA;;QAE7C,CAAC;;MAEJ,IAAI,WAAC;AACH,8DAAS,kCAAA;QACP,IAAI,YAAU;AACZ,gBAAI,mBAAA,mDAAkB,SAAA,KAAA,CAAA;;QAExB,IAAG,WAAA;AACD,gBAAC,mBAAA,wDAAA,SAAA,KAAA;;QAEJ,CAAC;;MAEL,CAAC;;IAEL,CAAC,CAAC;GACJ,CAAC;EAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"docs.cjs","names":[],"sources":["../../src/components/docs.tsx"],"sourcesContent":["/* -------------------------------------------------------------------\n\n ⚡ Storm Software - Shell Shock\n\n This code was released as part of the Shell Shock project. Shell Shock\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/shell-shock.\n\n Website: https://stormsoftware.com\n Repository: https://github.com/storm-software/shell-shock\n Documentation: https://docs.stormsoftware.com/projects/shell-shock\n Contact: https://stormsoftware.com/contact\n\n SPDX-License-Identifier: Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport { code, For, memo, Show } from \"@alloy-js/core\";\nimport { Heading } from \"@alloy-js/markdown\";\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport { usePowerlines } from \"@powerlines/plugin-alloy/core/contexts/context\";\nimport type { MarkdownFileProps } from \"@powerlines/plugin-alloy/markdown/components/markdown-file\";\nimport { MarkdownFile } from \"@powerlines/plugin-alloy/markdown/components/markdown-file\";\nimport { MarkdownTable } from \"@powerlines/plugin-alloy/markdown/components/markdown-table\";\nimport { joinPaths } from \"@stryke/path/join\";\nimport { defu } from \"defu\";\nimport { CommandContext } from \"../contexts/command\";\nimport { getDocsOutputPath } from \"../helpers/docs-helpers\";\nimport { getAppBin } from \"../plugin-utils/context-helpers\";\nimport { sortOptions } from \"../plugin-utils/reflect\";\nimport type { CommandTree } from \"../types/command\";\nimport type { Context } from \"../types/context\";\nimport { Usage } from \"./usage\";\n\nexport interface CommandOptionsDocsProps {\n /**\n * The command to generate options documentation for.\n */\n command: CommandTree;\n}\n\n/**\n * Generates the options markdown documentation for a command.\n */\nexport function CommandOptionsDocs(props: CommandOptionsDocsProps) {\n const { command } = props;\n if (Object.keys(command.options).length === 0) {\n return code`This command does not have any options.`;\n }\n\n return (\n <MarkdownTable\n data={sortOptions(Object.values(command.options)).map(option => {\n return {\n name: option.name.trim(),\n description: option.description.trim(),\n defaultValue: option.default\n ? String(option.default)?.includes('\"')\n ? option.default\n : `\\`${option.default}\\``\n : \"\",\n required: option.optional || option.default ? \"\" : \"✔\"\n };\n })}\n />\n );\n}\n\nexport interface CommandDocsUsageExampleProps {\n /**\n * The package manager to generate the usage example for.\n *\n * @remarks\n * If not specified, examples for all supported package managers will be generated.\n *\n * @defaultValue \"npm\"\n */\n packageManager?: \"npm\" | \"yarn\" | \"pnpm\" | \"bun\";\n\n /**\n * The command to generate the usage example for.\n */\n command: CommandTree;\n}\n\n/**\n * Generates the markdown documentation for a command.\n */\nexport function CommandDocsUsageExample(props: CommandDocsUsageExampleProps) {\n const { packageManager = \"npm\", command } = props;\n\n const context = usePowerlines<Context>();\n\n return (\n <>\n <hbr />\n {code`\\`\\`\\`bash `}\n <hbr />\n <Usage\n command={command}\n bin={getAppBin(context)}\n packageManager={packageManager}\n />\n <hbr />\n {code`\\`\\`\\``}\n <hbr />\n </>\n );\n}\n\nexport interface CommandDocsProps {\n /**\n * The heading level offset to apply to the generated documentation.\n *\n * @remarks\n * This is useful when nesting the documentation within other markdown files.\n *\n * @defaultValue 0\n */\n levelOffset?: number;\n\n /**\n * The command to generate options documentation for.\n */\n command: CommandTree;\n\n /**\n * Optional usage examples to include in the documentation.\n *\n * @defaultValue `[\"npm\"]`\n */\n usageExamples?: Required<CommandDocsUsageExampleProps>[\"packageManager\"][];\n}\n\n/**\n * Generates the markdown documentation for a command.\n */\nexport function CommandDocs(props: CommandDocsProps) {\n const { levelOffset = 0, command, usageExamples } = props;\n\n return (\n <>\n <Heading level={1 + levelOffset}>{command.title}</Heading>\n <Spacing />\n {code`${command.description}`}\n <Spacing />\n <Heading level={2 + levelOffset}>Usage</Heading>\n <Spacing />\n {code`The ${command.name} command can be executed using the following syntax: `}\n <Spacing />\n <Show\n when={usageExamples && usageExamples.length > 0}\n fallback={\n <CommandDocsUsageExample packageManager=\"npm\" command={command} />\n }>\n <For each={usageExamples!} hardline>\n {packageManager => (\n <CommandDocsUsageExample\n packageManager={packageManager}\n command={command}\n />\n )}\n </For>\n </Show>\n <Spacing />\n <Heading level={2 + levelOffset}>Options</Heading>\n <Spacing />\n {code`The following options are available for the ${\n command.name\n } command:`}\n <Spacing />\n <CommandOptionsDocs command={command} />\n <Spacing />\n </>\n );\n}\n\nexport interface CommandDocsFileProps extends Partial<MarkdownFileProps> {\n /**\n * The heading level offset to apply to the generated documentation.\n *\n * @remarks\n * This is useful when nesting the documentation within other markdown files.\n *\n * @defaultValue 0\n */\n levelOffset?: number;\n\n /**\n * The command to generate documentation for.\n */\n command: CommandTree;\n}\n\n/**\n * Generates the markdown documentation file for a command.\n */\nexport function CommandDocsFile(props: CommandDocsFileProps) {\n const { levelOffset = 0, command, frontMatter, ...rest } = props;\n\n const context = usePowerlines<Context>();\n const usageExamples = memo(\n () => [\"npm\", \"yarn\", \"pnpm\", \"bun\"] as CommandDocsProps[\"usageExamples\"]\n );\n\n return (\n <CommandContext.Provider value={command}>\n <MarkdownFile\n path={joinPaths(getDocsOutputPath(context), `${command.path}.md`)}\n {...rest}\n frontMatter={defu(frontMatter ?? {}, {\n id: command.id,\n name: command.name,\n path: command.path,\n reference: command.reference,\n isVirtual: command.isVirtual,\n title: command.title,\n description: command.description,\n tags: command.tags\n })}>\n <CommandDocs\n levelOffset={levelOffset}\n command={command}\n usageExamples={usageExamples()}\n />\n </MarkdownFile>\n </CommandContext.Provider>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AA6CA,SAAgB,mBAAmB,OAAgC;CACjE,MAAM,EACJ,YACA;AACF,KAAA,OAAA,KAAA,QAAA,QAAA,CAAA,WAAA;AAGA,wDAAG,2EAAA,EACD,IAAE,OAAM;AACN,SAAE,4BAAO,OAAA,OAAA,QAAA,QAAA,CAAA,CAAA,KAAA,WAAA;AACP,UAAO;IACL,MAAA,OAAa,KAAA,MAAO;IACpB,aAAa,OAAO,YAAC,MAAA;IACrB,cAAW,OAAO,UAAU,OAAU,OAAE,QAAA,EAAA,SAAA,KAAA,GAAA,OAAA,UAAA,KAAA,OAAA,QAAA,MAAA;IACxC,UAAM,OAAO,YAAA,OAAA,UAAA,KAAA;IACd;IACD;IAEL,CAAC;;;;;;CAuBF,MAAA,EACC,iBAAc,OACf,YACI;CACJ,MAAM,6EAAkC;;;;;;GAElC;;AAEN,WAAO,kCAAA,QAAA;;GAEG;GACT,CAAC;kDAAoB,OAAA,EAAA,CAAA;EAAA,mBAAA;kDAAA,OAAA,EAAA,CAAA;EAAA;;;;;;CA8BtB,MAAE,EACA,cAAU,GACX,SACC,kBACA;AACF,QAAA;kDAAyB,4BAAA;GAC3B,OAAA,IAAA;;AAEE,WAAA,QAAA;;GAEA,CAAA;kDAAA,0DAAA,EAAA,CAAA;6CAAA,mBAAA,G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sources":["../../src/components/exec-builtin.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, Show, splitProps } from \"@alloy-js/core\";\nimport {\n FunctionDeclaration,\n InterfaceDeclaration,\n InterfaceMember,\n VarDeclaration\n} from \"@alloy-js/typescript\";\nimport { ReflectionKind } from \"@powerlines/deepkit/vendor/type\";\n\nimport { Spacing } from \"@powerlines/plugin-alloy/core/components/spacing\";\nimport type { BuiltinFileProps } from \"@powerlines/plugin-alloy/typescript/components/builtin-file\";\nimport { BuiltinFile } from \"@powerlines/plugin-alloy/typescript/components/builtin-file\";\nimport {\n TSDoc,\n TSDocDefaultValue,\n TSDocParam,\n TSDocReturns\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport defu from \"defu\";\n\nexport interface ExecBuiltinProps extends Omit<\n BuiltinFileProps,\n \"id\" | \"description\"\n> {}\n\n/**\n * A built-in module for handling command execution in Shell Shock.\n */\nexport function ExecBuiltin(props: ExecBuiltinProps) {\n const [{ children }, rest] = splitProps(props, [\"children\"]);\n\n return (\n <BuiltinFile\n id=\"exec\"\n description=\"A module to handle command execution in a Shell Shock application.\"\n {...rest}\n imports={defu(rest.imports ?? {}, {\n \"node:path\": [\"basename\", \"extname\", \"dirname\", \"join\"],\n \"node:fs\": [\"existsSync\"],\n \"node:child_process\": [\n { name: \"spawn\", alias: \"_spawn\" },\n \"execFileSync\"\n ],\n \"node:stream\": [{ name: \"Stream\", default: true, type: true }]\n })}\n builtinImports={defu(rest.builtinImports ?? {}, {\n env: [\"isWindows\", \"env\", { name: \"Env\", type: true }]\n })}>\n <FunctionDeclaration\n name=\"resolveCommandEnv\"\n parameters={[\n {\n name: \"params\",\n type: \"{ argv: string[]; env?: NodeJS.ProcessEnv; }\"\n }\n ]}\n returnType=\"NodeJS.ProcessEnv\">\n {code`const argv = params.argv;\nconst shouldSuppressNpmFund = (() => {\n const cmd = basename(argv[0] ?? \"\");\n if (cmd === \"npm\" || cmd === \"npm.cmd\" || cmd === \"npm.exe\") {\n return true;\n }\n if (cmd === \"node\" || cmd === \"node.exe\") {\n const script = argv[1] ?? \"\";\n\n return script.includes(\"npm-cli.js\");\n }\n return false;\n})();\n\nconst result = Object.fromEntries(\n Object.entries({\n ...env,\n ...(params.env ?? {})\n})\n .filter(([, value]) => value !== undefined)\n .map(([key, value]) => [key, String(value)])\n);\nif (shouldSuppressNpmFund) {\n result.NPM_CONFIG_FUND ??= \"false\";\n result.npm_config_fund ??= \"false\";\n}\nreturn result; `}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"isWindowsBatchCommand\"\n parameters={[{ name: \"resolvedCommand\", type: \"string\" }]}\n returnType=\"boolean\">\n {code`if (!isWindows) {\n return false;\n}\nconst ext = extname(resolvedCommand).toLowerCase();\n\nreturn ext === \".cmd\" || ext === \".bat\";`}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"escapeForCmdExe\"\n parameters={[{ name: \"arg\", type: \"string\" }]}\n returnType=\"string\">\n {code`if (/[&|<>^%\\\\\\\\r\\\\\\\\n]/.test(arg)) {\n throw new Error(\n \\`Unsafe Windows cmd.exe argument detected: \\${JSON.stringify(arg)}. \\` +\n \"Pass an explicit shell-wrapper argv at the call site instead.\"\n );\n}\nif (!arg.includes(\" \") && !arg.includes('\"')) {\n return arg;\n}\nreturn \\`\"\\${arg.replace(/\"/g, '\"\"')}\"\\`;`}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"buildCmdExeCommandLine\"\n parameters={[\n { name: \"resolvedCommand\", type: \"string\" },\n { name: \"args\", type: \"string[]\" }\n ]}\n returnType=\"string\">\n {code`return [escapeForCmdExe(resolvedCommand), ...args.map(escapeForCmdExe)].join(\n \" \"\n);`}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"resolveNpmArgvForWindows\"\n doc=\"On Windows, Node 18.20.2+ (CVE-2024-27980) rejects spawning .cmd/.bat directly without shell, causing EINVAL. Resolve npm/npx to node + cli script so we spawn node.exe instead of npm.cmd.\"\n parameters={[{ name: \"argv\", type: \"string[]\" }]}\n returnType=\"string[] | null\">\n {code`if (!isWindows || argv.length === 0) {\n return null;\n}\nconst base = basename(argv[0] ?? \"\")\n .toLowerCase()\n .replace(/\\.(?:cmd|exe|bat)$/, \"\");\nconst cliName =\n base === \"npx\" ? \"npx-cli.js\" : base === \"npm\" ? \"npm-cli.js\" : null;\nif (!cliName) {\n return null;\n}\nconst nodeDir = dirname(process.execPath);\nconst cliPath = join(nodeDir, \"node_modules\", \"npm\", \"bin\", cliName);\nif (!existsSync(cliPath)) {\n const command = argv[0] ?? \"\";\n const ext = extname(command).toLowerCase();\n const shimmedCommand = ext ? command : \\`\\${command}.cmd\\`;\n\n return [shimmedCommand, ...argv.slice(1)];\n}\nreturn [process.execPath, cliPath, ...argv.slice(1)];`}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"resolveCommand\"\n doc=\"Resolves a command for Windows compatibility. On Windows, non-.exe commands (like pnpm, yarn) are resolved to .cmd; npm/npx are handled by resolveNpmArgvForWindows to avoid spawn EINVAL (no direct .cmd).\"\n parameters={[{ name: \"command\", type: \"string\" }]}\n returnType=\"string\">\n {code`if (!isWindows) {\n return command;\n}\nconst base = basename(command).toLowerCase();\nif (extname(base)) {\n return command;\n}\nif ([\"pnpm\", \"yarn\"].includes(base)) {\n return \\`\\${command}.cmd\\`;\n}\nreturn command;`}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"resolveCommandStdio\"\n parameters={[\n {\n name: \"params\",\n type: \"{ hasInput: boolean; preferInherit: boolean; }\"\n }\n ]}\n returnType='[\"pipe\" | \"inherit\" | \"ignore\", \"pipe\", \"pipe\"]'>\n {code`const stdin = params.hasInput\n ? \"pipe\"\n : params.preferInherit\n ? \"inherit\"\n : \"pipe\";\n\nreturn [stdin, \"pipe\", \"pipe\"];`}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"resolveProcessExitCode\"\n parameters={[\n {\n name: \"params\",\n type: \"{ explicitCode: number | null | undefined; childExitCode: number | null | undefined; resolvedSignal: NodeJS.Signals | null; usesWindowsExitCodeShim: boolean; timedOut: boolean; noOutputTimedOut: boolean; killIssuedByTimeout: boolean; }\"\n }\n ]}\n returnType=\"number | null\">\n {code`return (\n params.explicitCode ??\n params.childExitCode ??\n (params.usesWindowsExitCodeShim &&\n params.resolvedSignal == null &&\n !params.timedOut &&\n !params.noOutputTimedOut &&\n !params.killIssuedByTimeout\n ? 0\n : null)\n);`}\n </FunctionDeclaration>\n <Spacing />\n <FunctionDeclaration\n name=\"shouldSpawnWithShell\"\n parameters={[\n {\n name: \"params\",\n type: \"{ resolvedCommand: string; platform: NodeJS.Platform; }\"\n }\n ]}\n returnType=\"boolean\">\n {code`// SECURITY: never enable \\`shell\\` for argv-based execution.\n// \\`shell\\` routes through cmd.exe on Windows, which turns untrusted argv values\n// (like chat prompts passed as CLI args) into command-injection primitives.\n// If you need a shell, use an explicit shell-wrapper argv (e.g. \\`cmd.exe /c ...\\`)\n// and validate/escape at the call site.\nvoid params;\nreturn false;`}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc heading=\"The result of a spawn operation.\" />\n <InterfaceDeclaration export name=\"SpawnResult\">\n <TSDoc heading=\"The PID of the spawned child process, if available.\" />\n <InterfaceMember name=\"pid\" optional type=\"number\" />\n <Spacing />\n <TSDoc heading=\"The standard output produced by the child process.\" />\n <InterfaceMember name=\"stdout\" type=\"string\" />\n <Spacing />\n <TSDoc heading=\"The standard error produced by the child process.\" />\n <InterfaceMember name=\"stderr\" type=\"string\" />\n <Spacing />\n <TSDoc heading=\"The exit code of the child process, if available.\" />\n <InterfaceMember name=\"code\" type=\"number | null\" />\n <Spacing />\n <TSDoc heading=\"The signal that caused the child process to terminate, if it was killed by a signal.\" />\n <InterfaceMember name=\"signal\" type=\"NodeJS.Signals | null\" />\n <Spacing />\n <TSDoc heading=\"Whether the child process was killed.\" />\n <InterfaceMember name=\"killed\" type=\"boolean\" />\n <Spacing />\n <TSDoc heading=\"The reason for the child process termination.\" />\n <InterfaceMember\n name=\"termination\"\n type={code`\"exit\" | \"timeout\" | \"no-output-timeout\" | \"signal\"`}\n />\n <Spacing />\n <TSDoc heading=\"Whether the child process timed out due to no output.\" />\n <InterfaceMember name=\"noOutputTimedOut\" optional type=\"boolean\" />\n </InterfaceDeclaration>\n <Spacing />\n <TSDoc heading=\"Options for spawning a child process.\" />\n <InterfaceDeclaration export name=\"SpawnOptions\">\n <TSDoc heading=\"The timeout in milliseconds for the spawn operation. If the process runs longer than this, it will be killed and the spawn promise will reject. This can also be provided as a number directly to the spawn function for convenience. Providing \\`-1\\` will disable the timeout.\">\n <TSDocDefaultValue\n type={ReflectionKind.number}\n defaultValue=\"300000\"\n />\n </TSDoc>\n <InterfaceMember name=\"timeoutMs\" optional type=\"number\" />\n <Spacing />\n <TSDoc heading=\"The current working directory of the child process.\" />\n <InterfaceMember name=\"cwd\" optional type=\"string\" />\n <Spacing />\n <TSDoc heading=\"The input to be passed to the child process.\" />\n <InterfaceMember name=\"input\" optional type=\"string\" />\n <Spacing />\n <TSDoc heading=\"The environment variables for the child process.\" />\n <InterfaceMember name=\"env\" optional type=\"NodeJS.ProcessEnv\" />\n <Spacing />\n <TSDoc heading=\"Whether to pass arguments to the child process verbatim on Windows.\" />\n <InterfaceMember\n name=\"windowsVerbatimArguments\"\n optional\n type=\"boolean\"\n />\n <Spacing />\n <TSDoc heading=\"The timeout in milliseconds for the child process to produce output on stdout or stderr. If the process produces no output for this duration, it will be killed and the spawn promise will reject with a no-output-timeout termination reason.\" />\n <InterfaceMember name=\"noOutputTimeoutMs\" optional type=\"number\" />\n </InterfaceDeclaration>\n <Spacing />\n <VarDeclaration\n const\n name=\"WINDOWS_CLOSE_STATE_SETTLE_TIMEOUT_MS\"\n initializer={code`250`}\n />\n <Spacing />\n <VarDeclaration\n const\n name=\"WINDOWS_CLOSE_STATE_POLL_MS\"\n initializer={code`10`}\n />\n <Spacing />\n <TSDoc heading=\"Spawns a child process with the given arguments and options, returning a promise that resolves with the result of the spawn operation.\">\n <TSDocParam name=\"argv\">\n {\"The command and its arguments to spawn.\"}\n </TSDocParam>\n <TSDocParam name=\"optionsOrTimeoutMs\">\n {`The options for spawning the command, or a number representing the timeout in milliseconds. This allows for a convenient shorthand when only a timeout is needed. Providing \\`-1\\` will disable the timeout. If no options or timeout are provided, a default timeout of 5 minutes will be used.`}\n </TSDocParam>\n <TSDocReturns>\n {\n \"A promise that resolves with the result of the spawn operation, including stdout, stderr, exit code, signal, and termination reason.\"\n }\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n async\n name=\"spawn\"\n parameters={[\n { name: \"argv\", type: \"string[]\" },\n {\n name: \"optionsOrTimeoutMs\",\n type: \"number | SpawnOptions\",\n default: \"300000\"\n }\n ]}\n returnType=\"Promise<SpawnResult>\">\n {code`const options: SpawnOptions =\n typeof optionsOrTimeoutMs === \"number\"\n ? { timeoutMs: optionsOrTimeoutMs }\n : optionsOrTimeoutMs;\nconst { timeoutMs = 300000, cwd, input, noOutputTimeoutMs } = options;\n\nconst resolvedArgv =\n isWindows\n ? (resolveNpmArgvForWindows(argv) ?? argv)\n : argv;\nconst resolvedCommand =\n resolvedArgv !== argv\n ? (resolvedArgv[0] ?? \"\")\n : resolveCommand(argv[0] ?? \"\");\nconst useCmdWrapper = isWindowsBatchCommand(resolvedCommand);\n\nconst child = _spawn(\n useCmdWrapper\n ? (env.COMSPEC ?? \"cmd.exe\")\n : resolvedCommand,\n useCmdWrapper\n ? [\n \"/d\",\n \"/s\",\n \"/c\",\n buildCmdExeCommandLine(resolvedCommand, resolvedArgv.slice(1))\n ]\n : resolvedArgv.slice(1), {\n stdio: resolveCommandStdio({ hasInput: input !== undefined, preferInherit: true }),\n cwd,\n env: resolveCommandEnv({ argv, env: options.env }),\n windowsHide: true,\n windowsVerbatimArguments: useCmdWrapper\n ? true\n : options.windowsVerbatimArguments,\n ...(shouldSpawnWithShell({\n resolvedCommand: useCmdWrapper\n ? (env.COMSPEC ?? \"cmd.exe\")\n : resolvedCommand,\n platform: process.platform\n })\n ? { shell: true }\n : {})\n});\n\nreturn new Promise((resolve, reject) => {\n let stdout = \"\";\n let stderr = \"\";\n let settled = false;\n let timedOut = false;\n let noOutputTimedOut = false;\n let killIssuedByTimeout = false;\n let childExitState: {\n code: number | null;\n signal: NodeJS.Signals | null;\n } | null = null;\n let closeFallbackTimer: NodeJS.Timeout | null = null;\n let noOutputTimer: NodeJS.Timeout | null = null;\n const shouldTrackOutputTimeout =\n typeof noOutputTimeoutMs === \"number\" &&\n Number.isFinite(noOutputTimeoutMs) &&\n noOutputTimeoutMs > 0;\n\n const clearNoOutputTimer = () => {\n if (!noOutputTimer) {\n return;\n }\n clearTimeout(noOutputTimer);\n noOutputTimer = null;\n };\n\n const clearCloseFallbackTimer = () => {\n if (!closeFallbackTimer) {\n return;\n }\n clearTimeout(closeFallbackTimer);\n closeFallbackTimer = null;\n };\n\n const killChild = () => {\n if (settled || typeof child?.kill !== \"function\") {\n return;\n }\n killIssuedByTimeout = true;\n child.kill(\"SIGKILL\");\n };\n\n const armNoOutputTimer = () => {\n if (!shouldTrackOutputTimeout || settled) {\n return;\n }\n clearNoOutputTimer();\n noOutputTimer = setTimeout(() => {\n if (settled) {\n return;\n }\n noOutputTimedOut = true;\n killChild();\n }, Math.floor(noOutputTimeoutMs));\n };\n\n const timer = setTimeout(() => {\n timedOut = true;\n killChild();\n }, timeoutMs >= 0 ? timeoutMs : Number.POSITIVE_INFINITY);\n armNoOutputTimer();\n\n if (input !== undefined && child.stdin) {\n child.stdin.write(input ?? \"\");\n child.stdin.end();\n }\n\n child.stdout?.on(\"data\", (d: Stream) => {\n stdout += d.toString();\n armNoOutputTimer();\n });\n child.stderr?.on(\"data\", (d: Stream) => {\n stderr += d.toString();\n armNoOutputTimer();\n });\n child.on(\"error\", err => {\n if (settled) {\n return;\n }\n settled = true;\n clearTimeout(timer);\n clearNoOutputTimer();\n clearCloseFallbackTimer();\n reject(err);\n });\n child.on(\"exit\", (code, signal) => {\n childExitState = { code, signal };\n if (settled || closeFallbackTimer) {\n return;\n }\n closeFallbackTimer = setTimeout(() => {\n if (settled) {\n return;\n }\n child.stdout?.destroy();\n child.stderr?.destroy();\n }, 250);\n });\n const resolveFromClose = (\n code: number | null,\n signal: NodeJS.Signals | null\n ) => {\n if (settled) {\n return;\n }\n settled = true;\n clearTimeout(timer);\n clearNoOutputTimer();\n clearCloseFallbackTimer();\n const resolvedSignal =\n childExitState?.signal ?? signal ?? child.signalCode ?? null;\n const resolvedCode = resolveProcessExitCode({\n explicitCode: childExitState?.code ?? code,\n childExitCode: child.exitCode,\n resolvedSignal,\n usesWindowsExitCodeShim: isWindows && (useCmdWrapper || resolvedArgv !== argv),\n timedOut,\n noOutputTimedOut,\n killIssuedByTimeout\n });\n const termination = noOutputTimedOut\n ? \"no-output-timeout\"\n : timedOut\n ? \"timeout\"\n : resolvedSignal != null\n ? \"signal\"\n : \"exit\";\n const normalizedCode =\n termination === \"timeout\" || termination === \"no-output-timeout\"\n ? resolvedCode === 0\n ? 124\n : resolvedCode\n : resolvedCode;\n resolve({\n pid: child.pid ?? undefined,\n stdout,\n stderr,\n code: normalizedCode,\n signal: resolvedSignal,\n killed: child.killed,\n termination,\n noOutputTimedOut\n });\n };\n child.on(\"close\", (code, signal) => {\n if (\n !isWindows ||\n childExitState != null ||\n code != null ||\n signal != null ||\n child.exitCode != null ||\n child.signalCode != null\n ) {\n resolveFromClose(code, signal);\n return;\n }\n\n const startedAt = Date.now();\n const waitForExitState = () => {\n if (settled) {\n return;\n }\n if (\n childExitState != null ||\n child.exitCode != null ||\n child.signalCode != null\n ) {\n resolveFromClose(code, signal);\n return;\n }\n if (Date.now() - startedAt >= WINDOWS_CLOSE_STATE_SETTLE_TIMEOUT_MS) {\n resolveFromClose(code, signal);\n return;\n }\n setTimeout(waitForExitState, WINDOWS_CLOSE_STATE_POLL_MS);\n };\n waitForExitState();\n });\n});`}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc heading=\"A helper function that executes a command and returns its stdout.\">\n <TSDocParam name=\"argv\">\n {`The command and its arguments to spawn. This is passed directly to the spawn function. Remember that on Windows, commands like \\`npm\\` or \\`pnpm\\` will be resolved to their .cmd shims, so you can just pass \\`npm\\` without worrying about the extension.`}\n </TSDocParam>\n <TSDocParam name=\"optionsOrTimeoutMs\">\n {`The options for spawning the command, or a number representing the timeout in milliseconds. This is passed directly to the spawn function. Providing \\`-1\\` will disable the timeout. If no options or timeout are provided, a default timeout of 5 minutes will be used.`}\n </TSDocParam>\n <TSDocReturns>\n {\n \"A promise that resolves with the result of the spawn operation if the command exits with code 0, or rejects with an error if the command exits with a non-zero code or if there is a problem spawning the process.\"\n }\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n async\n name=\"exec\"\n parameters={[\n { name: \"argv\", type: \"string[]\" },\n {\n name: \"optionsOrTimeoutMs\",\n type: \"number | SpawnOptions\",\n default: \"300000\"\n }\n ]}\n returnType=\"Promise<string>\">\n {code`const spawnResult = await spawn(argv, optionsOrTimeoutMs);\n if (spawnResult.code !== 0) {\n throw Object.assign(new Error(\n \\`Command \"\\${argv.join(\" \")}\" exited with code \\${spawnResult.code} and signal \\${spawnResult.signal}\\`\n ), spawnResult);\n }\n\n return spawnResult.stdout.trim(); `}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc heading=\"A helper function that executes a command synchronously and returns its stdout. This is a thin wrapper around \\`child_process.execFileSync\\` with some added Windows compatibility handling.\">\n <TSDocParam name=\"argv\">\n {`The command and its arguments to spawn. This is passed directly to \\`execFileSync\\` after Windows-specific resolution. Remember that on Windows, commands like \\`npm\\` or \\`pnpm\\` will be resolved to their .cmd shims, so you can just pass \\`npm\\` without worrying about the extension.`}\n </TSDocParam>\n <TSDocParam name=\"options\">\n {`The options for spawning the command. This is passed directly to \\`execFileSync\\` after some processing. The timeout option is supported, but note that it will throw an error if the process runs longer than the specified timeout. If no options are provided, a default timeout of 5 minutes will be used.`}\n </TSDocParam>\n <TSDocReturns>\n {\n \"The standard output produced by the command if it exits with code 0. If the command exits with a non-zero code or if there is a problem spawning the process, an error will be thrown.\"\n }\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"execSync\"\n parameters={[\n { name: \"argv\", type: \"string[]\" },\n { name: \"options\", type: \"SpawnOptions\", default: \"{}\" }\n ]}\n returnType=\"string\">\n {code`return execFileSync(argv.length > 0 ? argv[0] : \"\", argv.slice(1), {\n encoding: \"utf8\",\n stdio: [\"ignore\", \"pipe\", \"ignore\"],\n timeout: options.timeoutMs ?? 300000,\n env: resolveCommandEnv({ argv, env: options.env }),\n cwd: options.cwd || process.cwd(),\n windowsHide: true\n }).trim(); `}\n </FunctionDeclaration>\n <Spacing />\n\n <Show when={Boolean(children)}>{children}</Show>\n </BuiltinFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAgCA,SAAE,YAAiB,OAAA;CACjB,MAAA,CAAA,EACA,YACA,uCAAkB,OAAO,CAAK,WAAW,CAAC;AAC5C,wDAAuB,oHAAA;;EAEvB,aAAiB;EACf,EAAA,MAAA;EACC,IAAK,UAAE;AACP,4BAAA,KAAA,WAAA,EAAA,EAAA;;;;;;;IAED,WAAA,CAAA,aAAA;IACG,sBAAoB,CAAA;KACvB,MAAA;KACK,OAAS;KACP,EAAE,eAAY;;KAEd,MAAA;KACJ,SAAA;KACK,MAAI;KACR,CAAA;IACC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,EAAK,CAAA;oDAAqB,4DAAM;KAC1D,SAAE;KACF,IAAE,WAAS;AACT,aAAO;uDAAmB,iEAAU;QACpC,MAAK;QACL,UAAY;QACZ,CAAA;uDAAa,iEAAA;QACZ,MAAO;QACV,UAAA;QACD,CAAA;uDAAS,mEAAA,sMAEL,CAAC;OAAA;;KAET,CAAA;oDAAA,0CAAA;KACH,UAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.cjs","names":[],"sources":["../../src/components/helpers.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 type { CommandParameter } from \"../types\";\nimport { CommandParameterKinds } from \"../types\";\n\nexport interface BooleanInputParserLogicProps {\n name: string;\n}\n\n/**\n * Parses a string input into a boolean value, interpreting common truthy and falsy string representations.\n */\nexport function BooleanInputParserLogic(props: BooleanInputParserLogicProps) {\n const { name } = props;\n\n return (\n <>{code` !!${name} && ${name}.toLowerCase() !== \"false\" && ${\n name\n }.toLowerCase() !== \"f\" && ${name}.toLowerCase() !== \"no\" && ${\n name\n } !== \"n\" && ${name}.toLowerCase() !== \"0\" && ${\n name\n }.toLowerCase() !== \"off\" && ${\n name\n } !== \"disable\" && ${name}.toLowerCase() !== \"disabled\" && ${\n name\n }.toLowerCase() !== \"never\" && (Number.isNaN(Number.parseFloat(${\n name\n })) || Number.parseFloat(${name}) > 0) `}</>\n );\n}\n\n/**\n * Write the logic to determine if the application is running in debug mode.\n *\n * @remarks\n * This is used to conditionally include debug-only logic in the generated application, such as additional logging or development tools. The logic should check for common indicators of debug mode, such as environment variables or the presence of a debugger.\n */\nexport function IsDebug() {\n return code`isDevelopment || isDebug || env.LOG_LEVEL === \"debug\"`;\n}\n\n/**\n * Write the logic to determine if the application is **not** running in debug mode.\n */\nexport function IsNotDebug() {\n return (\n <>\n {code`!(`}\n <IsDebug />\n {code`)`}\n </>\n );\n}\n\n/**\n * Write the logic to determine if the application is running in verbose mode.\n *\n * @remarks\n * This is used to conditionally include verbose-only logic in the generated application, such as additional logging or detailed output. The logic should check for common indicators of verbose mode, such as environment variables or command-line flags.\n */\nexport function IsVerbose() {\n return (\n <>\n {code`( `}\n <IsDebug />\n {code`|| hasFlag([\"verbose\", \"verbose=true\", \"verbose=always\"]))`}\n </>\n );\n}\n\n/**\n * Write the logic to determine if the application is **not** running in verbose mode.\n */\nexport function IsNotVerbose() {\n return (\n <>\n {code`!(`}\n <IsVerbose />\n {code`)`}\n </>\n );\n}\n\n/**\n * Write the type declaration for a command parameter based on its configuration.\n */\nexport function CommandParameterType(props: { parameter: CommandParameter }) {\n const { parameter } = props;\n\n return code`${\n (parameter.kind === CommandParameterKinds.string ||\n parameter.kind === CommandParameterKinds.number) &&\n parameter.choices &&\n parameter.choices.length > 0\n ? parameter.choices\n .map(choice => (typeof choice === \"string\" ? `\"${choice}\"` : choice))\n .join(\" | \")\n : parameter.kind === CommandParameterKinds.boolean\n ? \"boolean\"\n : parameter.kind === CommandParameterKinds.number\n ? \"number\"\n : \"string\"\n }${\n parameter.variadic ? \"[]\" : \"\"\n }${parameter.optional ? \" | undefined\" : \"\"}`;\n}\n"],"mappings":";;;;;;;;;;AA6BA,SAAgB,wBAAwB,OAAqC;CAC3E,MAAM,WAEN;AACA,QAAK,CAAA,mBAAO,MAAG,KAAQ,MAAG,KAAM,gCAA8B,KAAA,4BAAA,KAAA,6BAAA,KAAA,cAAA,KAAA,4BAAA,KAAA,8BAAA,KAAA,oBAAA,KAAA,mCAAA,KAAA,gEAAA,KAAA,0BAAA,KAAA,SAAA;;;;;;;;AAShE,SAAM,UAAA;AACJ,QAAI,mBAAA;;;;;AAMN,SAAE,aAAA;AACA,QAAO;EAAA,mBAAI;kDAAyB,SAAC,EAAA,CAAW;EAAC,mBAAG;EAAA;;;;;;;;AAStD,SAAE,YAAA;AACA,QAAO;EAAA,mBAAI;kDAAyB,SAAC,EAAA,CAAW;EAAC,mBAAK;EAA2B;;;;;AAMnF,SAAgB,eAAA;AACd,QAAK;EAAA,mBAAO;kDAAA,WAAA,EAAA,CAAA;EAAA,mBAAA;EAAA;;;;;AAMd,SAAa,qBAAsB,OAEhC;CACD,MAAM,EACN,cACI;AACJ,QAAO,mBAAA,IAAA,UAAA,SAAA,4CAAA,UAAA,UAAA,SAAA,4CAAA,WAAA,UAAA,WAAA,UAAA,QAAA,SAAA,IAAA,UAAA,QAAA,KAAA,WAAA,OAAA,WAAA,WAAA,IAAA,OAAA,KAAA,OAAA,CAAA,KAAA,MAAA,GAAA,UAAA,SAAA,4CAAA,UAAA,YAAA,UAAA,SAAA,4CAAA,SAAA,WAAA,WAAA,UAAA,WAAA,OAAA,KAAA,UAAA,WAAA,iBAAA"}
|