@shell-shock/core 0.9.1 → 0.9.3

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.
@@ -1,5 +1,5 @@
1
1
  import { CommandTree } from "../types/command.cjs";
2
- import * as _alloy_js_core12 from "@alloy-js/core";
2
+ import * as _alloy_js_core20 from "@alloy-js/core";
3
3
  import { MarkdownFileProps } from "@powerlines/plugin-alloy/markdown/components/markdown-file";
4
4
 
5
5
  //#region src/components/docs.d.ts
@@ -12,7 +12,7 @@ interface CommandOptionsDocsProps {
12
12
  /**
13
13
  * Generates the options markdown documentation for a command.
14
14
  */
15
- declare function CommandOptionsDocs(props: CommandOptionsDocsProps): _alloy_js_core12.Children;
15
+ declare function CommandOptionsDocs(props: CommandOptionsDocsProps): _alloy_js_core20.Children;
16
16
  interface CommandDocsUsageExampleProps {
17
17
  /**
18
18
  * The package manager to generate the usage example for.
@@ -31,7 +31,7 @@ interface CommandDocsUsageExampleProps {
31
31
  /**
32
32
  * Generates the markdown documentation for a command.
33
33
  */
34
- declare function CommandDocsUsageExample(props: CommandDocsUsageExampleProps): _alloy_js_core12.Children;
34
+ declare function CommandDocsUsageExample(props: CommandDocsUsageExampleProps): _alloy_js_core20.Children;
35
35
  interface CommandDocsProps {
36
36
  /**
37
37
  * The heading level offset to apply to the generated documentation.
@@ -56,7 +56,7 @@ interface CommandDocsProps {
56
56
  /**
57
57
  * Generates the markdown documentation for a command.
58
58
  */
59
- declare function CommandDocs(props: CommandDocsProps): _alloy_js_core12.Children;
59
+ declare function CommandDocs(props: CommandDocsProps): _alloy_js_core20.Children;
60
60
  interface CommandDocsFileProps extends Partial<MarkdownFileProps> {
61
61
  /**
62
62
  * The heading level offset to apply to the generated documentation.
@@ -75,7 +75,7 @@ interface CommandDocsFileProps extends Partial<MarkdownFileProps> {
75
75
  /**
76
76
  * Generates the markdown documentation file for a command.
77
77
  */
78
- declare function CommandDocsFile(props: CommandDocsFileProps): _alloy_js_core12.Children;
78
+ declare function CommandDocsFile(props: CommandDocsFileProps): _alloy_js_core20.Children;
79
79
  //#endregion
80
80
  export { CommandDocs, CommandDocsFile, CommandDocsFileProps, CommandDocsProps, CommandDocsUsageExample, CommandDocsUsageExampleProps, CommandOptionsDocs, CommandOptionsDocsProps };
81
81
  //# sourceMappingURL=docs.d.cts.map
@@ -1,4 +1,4 @@
1
- import * as _alloy_js_core7 from "@alloy-js/core";
1
+ import * as _alloy_js_core0 from "@alloy-js/core";
2
2
 
3
3
  //#region src/components/helpers.d.ts
4
4
  interface BooleanInputParserLogicProps {
@@ -7,29 +7,29 @@ interface BooleanInputParserLogicProps {
7
7
  /**
8
8
  * Parses a string input into a boolean value, interpreting common truthy and falsy string representations.
9
9
  */
10
- declare function BooleanInputParserLogic(props: BooleanInputParserLogicProps): _alloy_js_core7.Children;
10
+ declare function BooleanInputParserLogic(props: BooleanInputParserLogicProps): _alloy_js_core0.Children;
11
11
  /**
12
12
  * Write the logic to determine if the application is running in debug mode.
13
13
  *
14
14
  * @remarks
15
15
  * 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.
16
16
  */
17
- declare function IsDebug(): _alloy_js_core7.Children;
17
+ declare function IsDebug(): _alloy_js_core0.Children;
18
18
  /**
19
19
  * Write the logic to determine if the application is **not** running in debug mode.
20
20
  */
21
- declare function IsNotDebug(): _alloy_js_core7.Children;
21
+ declare function IsNotDebug(): _alloy_js_core0.Children;
22
22
  /**
23
23
  * Write the logic to determine if the application is running in verbose mode.
24
24
  *
25
25
  * @remarks
26
26
  * 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.
27
27
  */
28
- declare function IsVerbose(): _alloy_js_core7.Children;
28
+ declare function IsVerbose(): _alloy_js_core0.Children;
29
29
  /**
30
30
  * Write the logic to determine if the application is **not** running in verbose mode.
31
31
  */
32
- declare function IsNotVerbose(): _alloy_js_core7.Children;
32
+ declare function IsNotVerbose(): _alloy_js_core0.Children;
33
33
  //#endregion
34
34
  export { BooleanInputParserLogic, BooleanInputParserLogicProps, IsDebug, IsNotDebug, IsNotVerbose, IsVerbose };
35
35
  //# sourceMappingURL=helpers.d.cts.map
@@ -1,4 +1,4 @@
1
- import * as _alloy_js_core7 from "@alloy-js/core";
1
+ import * as _alloy_js_core15 from "@alloy-js/core";
2
2
 
3
3
  //#region src/components/helpers.d.ts
4
4
  interface BooleanInputParserLogicProps {
@@ -7,29 +7,29 @@ interface BooleanInputParserLogicProps {
7
7
  /**
8
8
  * Parses a string input into a boolean value, interpreting common truthy and falsy string representations.
9
9
  */
10
- declare function BooleanInputParserLogic(props: BooleanInputParserLogicProps): _alloy_js_core7.Children;
10
+ declare function BooleanInputParserLogic(props: BooleanInputParserLogicProps): _alloy_js_core15.Children;
11
11
  /**
12
12
  * Write the logic to determine if the application is running in debug mode.
13
13
  *
14
14
  * @remarks
15
15
  * 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.
16
16
  */
17
- declare function IsDebug(): _alloy_js_core7.Children;
17
+ declare function IsDebug(): _alloy_js_core15.Children;
18
18
  /**
19
19
  * Write the logic to determine if the application is **not** running in debug mode.
20
20
  */
21
- declare function IsNotDebug(): _alloy_js_core7.Children;
21
+ declare function IsNotDebug(): _alloy_js_core15.Children;
22
22
  /**
23
23
  * Write the logic to determine if the application is running in verbose mode.
24
24
  *
25
25
  * @remarks
26
26
  * 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.
27
27
  */
28
- declare function IsVerbose(): _alloy_js_core7.Children;
28
+ declare function IsVerbose(): _alloy_js_core15.Children;
29
29
  /**
30
30
  * Write the logic to determine if the application is **not** running in verbose mode.
31
31
  */
32
- declare function IsNotVerbose(): _alloy_js_core7.Children;
32
+ declare function IsNotVerbose(): _alloy_js_core15.Children;
33
33
  //#endregion
34
34
  export { BooleanInputParserLogic, BooleanInputParserLogicProps, IsDebug, IsNotDebug, IsNotVerbose, IsVerbose };
35
35
  //# sourceMappingURL=helpers.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"helpers.d.mts","names":[],"sources":["../../src/components/helpers.tsx"],"sourcesContent":[],"mappings":";;;UAoBiB,4BAAA;;;AAAjB;AAOA;AA0BA;AAOgB,iBAjCA,uBAAA,CAiCU,KAAA,EAjCqB,4BAiCrB,CAAA,EAjCiD,eAAA,CAAA,QAiCjD;AAgB1B;AAaA;;;;;iBApCgB,OAAA,CAAA,GAAO,eAAA,CAAA;;;;iBAOP,UAAA,CAAA,GAAU,eAAA,CAAA;;;;;;;iBAgBV,SAAA,CAAA,GAAS,eAAA,CAAA;;;;iBAaT,YAAA,CAAA,GAAY,eAAA,CAAA"}
1
+ {"version":3,"file":"helpers.d.mts","names":[],"sources":["../../src/components/helpers.tsx"],"sourcesContent":[],"mappings":";;;UAoBiB,4BAAA;;;AAAjB;AAOA;AA0BA;AAOgB,iBAjCA,uBAAA,CAiCU,KAAA,EAjCqB,4BAiCrB,CAAA,EAjCiD,gBAAA,CAAA,QAiCjD;AAgB1B;AAaA;;;;;iBApCgB,OAAA,CAAA,GAAO,gBAAA,CAAA;;;;iBAOP,UAAA,CAAA,GAAU,gBAAA,CAAA;;;;;;;iBAgBV,SAAA,CAAA,GAAS,gBAAA,CAAA;;;;iBAaT,YAAA,CAAA,GAAY,gBAAA,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import { CommandOption, CommandTree } from "../types/command.cjs";
2
- import * as _alloy_js_core0 from "@alloy-js/core";
2
+ import * as _alloy_js_core12 from "@alloy-js/core";
3
3
 
4
4
  //#region src/components/options-parser-logic.d.ts
5
5
  interface DynamicSegmentsParserLogicProps {
@@ -12,7 +12,7 @@ interface DynamicSegmentsParserLogicProps {
12
12
  */
13
13
  isCaseSensitive: boolean;
14
14
  }
15
- declare function DynamicSegmentsParserLogic(props: DynamicSegmentsParserLogicProps): _alloy_js_core0.Children;
15
+ declare function DynamicSegmentsParserLogic(props: DynamicSegmentsParserLogicProps): _alloy_js_core12.Children;
16
16
  interface ArgumentsParserLogicProps {
17
17
  /**
18
18
  * The command to generate the positional parameters parser logic for.
@@ -27,7 +27,7 @@ interface ArgumentsParserLogicProps {
27
27
  */
28
28
  isCaseSensitive: boolean;
29
29
  }
30
- declare function ArgumentsParserLogic(props: ArgumentsParserLogicProps): _alloy_js_core0.Children;
30
+ declare function ArgumentsParserLogic(props: ArgumentsParserLogicProps): _alloy_js_core12.Children;
31
31
  /**
32
32
  * The command option interface property.
33
33
  */
@@ -35,7 +35,7 @@ declare function OptionsMember({
35
35
  option
36
36
  }: {
37
37
  option: CommandOption;
38
- }): _alloy_js_core0.Children;
38
+ }): _alloy_js_core12.Children;
39
39
  interface OptionsMemberParserLogicProps {
40
40
  /**
41
41
  * The option name to generate the parser logic for.
@@ -55,7 +55,7 @@ interface OptionsMemberParserLogicProps {
55
55
  /**
56
56
  * The command option property parser logic.
57
57
  */
58
- declare function OptionsMemberParserLogic(props: OptionsMemberParserLogicProps): _alloy_js_core0.Children;
58
+ declare function OptionsMemberParserLogic(props: OptionsMemberParserLogicProps): _alloy_js_core12.Children;
59
59
  interface OptionsMemberParserConditionProps {
60
60
  /**
61
61
  * The option name to generate the parser logic for.
@@ -72,10 +72,10 @@ interface OptionsMemberParserConditionProps {
72
72
  */
73
73
  isCaseSensitive: boolean;
74
74
  }
75
- declare function OptionsMemberParserCondition(props: OptionsMemberParserConditionProps): _alloy_js_core0.Children;
75
+ declare function OptionsMemberParserCondition(props: OptionsMemberParserConditionProps): _alloy_js_core12.Children;
76
76
  declare function OptionsInterfaceDeclaration(props: {
77
77
  command: CommandTree;
78
- }): _alloy_js_core0.Children;
78
+ }): _alloy_js_core12.Children;
79
79
  interface OptionsParserLogicProps {
80
80
  /**
81
81
  * The command to generate the options parser logic for.
@@ -95,7 +95,7 @@ interface OptionsParserLogicProps {
95
95
  /**
96
96
  * The command options parser logic.
97
97
  */
98
- declare function OptionsParserLogic(props: OptionsParserLogicProps): _alloy_js_core0.Children;
98
+ declare function OptionsParserLogic(props: OptionsParserLogicProps): _alloy_js_core12.Children;
99
99
  interface CommandParserLogicProps {
100
100
  /**
101
101
  * The command to generate the parser logic for.
@@ -115,7 +115,7 @@ interface CommandParserLogicProps {
115
115
  /**
116
116
  * The command parser logic, which includes parsing dynamic path segments, positional parameters, and options.
117
117
  */
118
- declare function CommandParserLogic(props: CommandParserLogicProps): _alloy_js_core0.Children;
118
+ declare function CommandParserLogic(props: CommandParserLogicProps): _alloy_js_core12.Children;
119
119
  //#endregion
120
120
  export { ArgumentsParserLogic, ArgumentsParserLogicProps, CommandParserLogic, CommandParserLogicProps, DynamicSegmentsParserLogic, DynamicSegmentsParserLogicProps, OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserCondition, OptionsMemberParserConditionProps, OptionsMemberParserLogic, OptionsMemberParserLogicProps, OptionsParserLogic, OptionsParserLogicProps };
121
121
  //# sourceMappingURL=options-parser-logic.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"options-parser-logic.d.cts","names":[],"sources":["../../src/components/options-parser-logic.tsx"],"sourcesContent":[],"mappings":";;;;UA+CiB,+BAAA;;;AAAjB;EAYgB,OAAA,EARL,WAQK;EA6BC;AAiBjB;AAyKA;EAAgC,eAAA,EAAA,OAAA;;AAAiC,iBAvNjD,0BAAA,CAuNmD,KAAA,EAtN1D,+BAsN0D,CAAA,EAtN3B,eAAA,CAAA,QAsN2B;AAAA,UA1LlD,yBAAA,CA0LkD;EAuClD;AAsBjB;AAuKA;EAmBgB,OAAA,EA7aL,WA6aK;EAmEA;AAchB;AAsBA;EA4HiB,SAAA,EAAA,MAAA;EAsBD;;;;;iBAzpBA,oBAAA,QAA4B,4BAAyB,eAAA,CAAA;;;;iBAyKrD,aAAA;;;UAAoC;IAAa,eAAA,CAAE;UAuClD,6BAAA;;;;;;;;UASP;;;;;;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-1,5 +1,5 @@
1
1
  import { CommandOption, CommandTree } from "../types/command.mjs";
2
- import * as _alloy_js_core12 from "@alloy-js/core";
2
+ import * as _alloy_js_core7 from "@alloy-js/core";
3
3
 
4
4
  //#region src/components/options-parser-logic.d.ts
5
5
  interface DynamicSegmentsParserLogicProps {
@@ -12,7 +12,7 @@ interface DynamicSegmentsParserLogicProps {
12
12
  */
13
13
  isCaseSensitive: boolean;
14
14
  }
15
- declare function DynamicSegmentsParserLogic(props: DynamicSegmentsParserLogicProps): _alloy_js_core12.Children;
15
+ declare function DynamicSegmentsParserLogic(props: DynamicSegmentsParserLogicProps): _alloy_js_core7.Children;
16
16
  interface ArgumentsParserLogicProps {
17
17
  /**
18
18
  * The command to generate the positional parameters parser logic for.
@@ -27,7 +27,7 @@ interface ArgumentsParserLogicProps {
27
27
  */
28
28
  isCaseSensitive: boolean;
29
29
  }
30
- declare function ArgumentsParserLogic(props: ArgumentsParserLogicProps): _alloy_js_core12.Children;
30
+ declare function ArgumentsParserLogic(props: ArgumentsParserLogicProps): _alloy_js_core7.Children;
31
31
  /**
32
32
  * The command option interface property.
33
33
  */
@@ -35,7 +35,7 @@ declare function OptionsMember({
35
35
  option
36
36
  }: {
37
37
  option: CommandOption;
38
- }): _alloy_js_core12.Children;
38
+ }): _alloy_js_core7.Children;
39
39
  interface OptionsMemberParserLogicProps {
40
40
  /**
41
41
  * The option name to generate the parser logic for.
@@ -55,7 +55,7 @@ interface OptionsMemberParserLogicProps {
55
55
  /**
56
56
  * The command option property parser logic.
57
57
  */
58
- declare function OptionsMemberParserLogic(props: OptionsMemberParserLogicProps): _alloy_js_core12.Children;
58
+ declare function OptionsMemberParserLogic(props: OptionsMemberParserLogicProps): _alloy_js_core7.Children;
59
59
  interface OptionsMemberParserConditionProps {
60
60
  /**
61
61
  * The option name to generate the parser logic for.
@@ -72,10 +72,10 @@ interface OptionsMemberParserConditionProps {
72
72
  */
73
73
  isCaseSensitive: boolean;
74
74
  }
75
- declare function OptionsMemberParserCondition(props: OptionsMemberParserConditionProps): _alloy_js_core12.Children;
75
+ declare function OptionsMemberParserCondition(props: OptionsMemberParserConditionProps): _alloy_js_core7.Children;
76
76
  declare function OptionsInterfaceDeclaration(props: {
77
77
  command: CommandTree;
78
- }): _alloy_js_core12.Children;
78
+ }): _alloy_js_core7.Children;
79
79
  interface OptionsParserLogicProps {
80
80
  /**
81
81
  * The command to generate the options parser logic for.
@@ -95,7 +95,7 @@ interface OptionsParserLogicProps {
95
95
  /**
96
96
  * The command options parser logic.
97
97
  */
98
- declare function OptionsParserLogic(props: OptionsParserLogicProps): _alloy_js_core12.Children;
98
+ declare function OptionsParserLogic(props: OptionsParserLogicProps): _alloy_js_core7.Children;
99
99
  interface CommandParserLogicProps {
100
100
  /**
101
101
  * The command to generate the parser logic for.
@@ -115,7 +115,7 @@ interface CommandParserLogicProps {
115
115
  /**
116
116
  * The command parser logic, which includes parsing dynamic path segments, positional parameters, and options.
117
117
  */
118
- declare function CommandParserLogic(props: CommandParserLogicProps): _alloy_js_core12.Children;
118
+ declare function CommandParserLogic(props: CommandParserLogicProps): _alloy_js_core7.Children;
119
119
  //#endregion
120
120
  export { ArgumentsParserLogic, ArgumentsParserLogicProps, CommandParserLogic, CommandParserLogicProps, DynamicSegmentsParserLogic, DynamicSegmentsParserLogicProps, OptionsInterfaceDeclaration, OptionsMember, OptionsMemberParserCondition, OptionsMemberParserConditionProps, OptionsMemberParserLogic, OptionsMemberParserLogicProps, OptionsParserLogic, OptionsParserLogicProps };
121
121
  //# sourceMappingURL=options-parser-logic.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"options-parser-logic.d.mts","names":[],"sources":["../../src/components/options-parser-logic.tsx"],"sourcesContent":[],"mappings":";;;;UA+CiB,+BAAA;;;AAAjB;EAYgB,OAAA,EARL,WAQK;EA6BC;AAiBjB;AAyKA;EAAgC,eAAA,EAAA,OAAA;;AAAiC,iBAvNjD,0BAAA,CAuNmD,KAAA,EAtN1D,+BAsN0D,CA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CAAA;UAuK5D,iCAAA;;;;;;;;;;;;;;;;iBAmBD,4BAAA,QACP,oCAAiC,eAAA,CAAA;iBAkE1B,2BAAA;WAA8C;IAAW,eAAA,CAAE;UAc1D,uBAAA;;;;WAIN;;;;;;;;;;;;;;;iBAkBK,kBAAA,QAA0B,0BAAuB,eAAA,CAAA;UA4HhD,uBAAA;;;;WAIN;;;;;;;;;;;;;;;iBAkBK,kBAAA,QAA0B,0BAAuB,eAAA,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import { CommandTree } from "../types/command.cjs";
2
- import * as _alloy_js_core23 from "@alloy-js/core";
2
+ import * as _alloy_js_core11 from "@alloy-js/core";
3
3
 
4
4
  //#region src/components/usage.d.ts
5
5
  interface UsageProps {
@@ -22,7 +22,7 @@ interface UsageProps {
22
22
  /**
23
23
  * A component that generates the usage display for a command.
24
24
  */
25
- declare function Usage(props: UsageProps): _alloy_js_core23.Children;
25
+ declare function Usage(props: UsageProps): _alloy_js_core11.Children;
26
26
  //#endregion
27
27
  export { Usage, UsageProps };
28
28
  //# sourceMappingURL=usage.d.cts.map
@@ -635,7 +635,7 @@ function SpawnFunctionDeclaration() {
635
635
 
636
636
  try {
637
637
  const fd = openSync(normalized.file, "r");
638
- await read(fd, buffer, 0, 150, 0);
638
+ await promisify(read)(fd, buffer, 0, 150, 0);
639
639
  closeSync(fd);
640
640
  } catch (err) {
641
641
  // Do nothing
@@ -850,8 +850,13 @@ function UtilsBuiltin(props) {
850
850
  "posix",
851
851
  "sep"
852
852
  ],
853
- "node:fs": ["openSync", "closeSync"],
854
- "node:fs/promises": ["stat", "read"],
853
+ "node:fs": [
854
+ "openSync",
855
+ "closeSync",
856
+ "read"
857
+ ],
858
+ "node:fs/promises": ["stat"],
859
+ "node:util": ["promisify"],
855
860
  "node:child_process": [{
856
861
  name: "spawn",
857
862
  alias: "_spawn"
@@ -1 +1 @@
1
- {"version":3,"file":"utils-builtin.cjs","names":["code","Show","splitProps","FunctionDeclaration","InterfaceDeclaration","InterfaceMember","TypeDeclaration","VarDeclaration","Spacing","BuiltinFile","TSDoc","TSDocInternal","TSDocLink","TSDocParam","TSDocRemarks","TSDocReturns","defu","EnvSupportUtilities","_$createComponent","name","doc","initializer","ColorSupportUtilities","children","type","heading","parameters","default","HyperlinkSupportUtilities","returnType","ArgsUtilities","_$createIntrinsic","SpawnFunctionDeclaration","async","optional","ContextUtilities","UtilsBuiltin","props","rest","_$mergeProps","id","description","imports","alias","builtinImports","console","env","when","Boolean"],"sources":["../../src/components/utils-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 TypeDeclaration,\n VarDeclaration\n} from \"@alloy-js/typescript\";\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 TSDocInternal,\n TSDocLink,\n TSDocParam,\n TSDocRemarks,\n TSDocReturns\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport defu from \"defu\";\n\nexport interface UtilsBuiltinProps extends Omit<\n BuiltinFileProps,\n \"id\" | \"description\"\n> {}\n\n/**\n * Generates utilities for detecting terminal color support.\n */\nexport function EnvSupportUtilities() {\n return (\n <>\n <VarDeclaration\n export\n const\n name=\"isTTY\"\n doc=\"Detect if stdout.TTY is available\"\n initializer={code`Boolean(process.stdout && process.stdout.isTTY);`}\n />\n <Spacing />\n <VarDeclaration\n export\n const\n name=\"isMinimal\"\n doc=\"Detect if the current environment is minimal (CI, non-TTY, etc.)\"\n initializer={code` env.MINIMAL || isCI || isTest || !isTTY; `}\n />\n <Spacing />\n <VarDeclaration\n export\n const\n name=\"isInteractive\"\n doc=\"Detect if the current environment is interactive\"\n initializer={code` !isMinimal && process.stdin?.isTTY && env.TERM !== \"dumb\" && !hasFlag([\"no-interactive\", \"non-interactive\", \"no-interact\"]); `}\n />\n </>\n );\n}\n\n/**\n * Generates utilities for detecting terminal color support.\n */\nexport function ColorSupportUtilities() {\n return (\n <>\n <InterfaceDeclaration\n export\n name=\"GetColorSupportLevelOptions\"\n doc=\"Options for the getColorSupportLevel function\">\n <InterfaceMember\n name=\"ignoreFlags\"\n type=\"boolean\"\n doc=\"Indicates if the function should skip checking command-line flags for color support\"\n />\n </InterfaceDeclaration>\n <Spacing />\n <TSDoc heading=\"Checks if a specific flag is present in the command-line arguments.\">\n <TSDocLink>\n {\"https://github.com/sindresorhus/has-flag/blob/main/index.js\"}\n </TSDocLink>\n <TSDocParam name=\"flag\">\n {'The flag to check for, e.g., \"color\", \"no-color\".'}\n </TSDocParam>\n <TSDocParam name=\"argv\">\n {\n \"The command-line arguments to check against. Defaults to global Deno args or process args.\"\n }\n </TSDocParam>\n <TSDocReturns>\n {\"True if the flag is present, false otherwise.\"}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"getColorSupportLevel\"\n parameters={[\n { name: \"stream\", type: \"NodeJS.WriteStream & { fd: 1 | 2; }\" },\n {\n name: \"options\",\n type: \"GetColorSupportLevelOptions\",\n default: \"{ ignoreFlags: false }\"\n }\n ]}>\n {code`const { ignoreFlags } = options;\n\n let forceColor: number | undefined;\n if (env.FORCE_COLOR !== undefined) {\n forceColor = !env.FORCE_COLOR\n ? 0\n : typeof env.FORCE_COLOR === \"boolean\"\n ? 1\n : typeof env.FORCE_COLOR === \"number\" &&\n [0, 1, 2, 3].includes(Math.min(env.FORCE_COLOR as number, 3))\n ? Math.min(env.FORCE_COLOR as number, 3)\n : undefined;\n }\n\n if (ignoreFlags !== true && forceColor === undefined) {\n if (\n hasFlag(\"no-color\") ||\n hasFlag(\"no-colors\") ||\n hasFlag(\"color=false\") ||\n hasFlag(\"color=never\")\n ) {\n return 0;\n }\n\n if (\n hasFlag(\"color=16m\") ||\n hasFlag(\"color=full\") ||\n hasFlag(\"color=truecolor\")\n ) {\n return 3;\n }\n\n if (hasFlag(\"color=256\")) {\n return 2;\n }\n\n if (\n hasFlag(\"color\") ||\n hasFlag(\"colors\") ||\n hasFlag(\"color=true\") ||\n hasFlag(\"color=always\")\n ) {\n forceColor = 1;\n }\n }\n\n const level = Boolean(env.TF_BUILD) || Boolean(env.AGENT_NAME)\n ? 1\n : stream &&\n !(isTTY || (stream && stream.isTTY)) &&\n forceColor === undefined\n ? 0\n : env.TERM === \"dumb\"\n ? forceColor || 0\n : isWindows\n ? Number(os.release().split(\".\")[0]) >= 10 &&\n Number(os.release().split(\".\")[2]) >= 10_586\n ? Number(os.release().split(\".\")[2]) >= 14_931\n ? 3\n : 2\n : 1\n : isCI\n ? Boolean(env.GITHUB_ACTIONS) ||\n Boolean(env.GITEA_ACTIONS) ||\n Boolean(env.CIRCLECI)\n ? 3\n : Boolean(env.TRAVIS) ||\n Boolean(env.APPVEYOR) ||\n Boolean(env.GITLAB_CI) ||\n Boolean(env.BUILDKITE) ||\n Boolean(env.DRONE) ||\n env.CI_NAME === \"codeship\"\n ? 1\n : forceColor || 0\n : Boolean(env.TEAMCITY_VERSION)\n ? /^(?:9\\.0*[1-9]\\d*\\.|\\d{2,}\\.)/.test(String(env.TEAMCITY_VERSION) || \"\")\n ? 1\n : 0\n : String(env.COLORTERM) === \"truecolor\" ||\n env.TERM === \"xterm-kitty\"\n ? 3\n : Boolean(env.TERM_PROGRAM)\n ? env.TERM_PROGRAM === \"iTerm.app\"\n ? Number.parseInt(\n (env.TERM_PROGRAM_VERSION || \"\").split(\".\")[0] as string,\n 10\n ) >= 3\n ? 3\n : 2\n : env.TERM_PROGRAM === \"Apple_Terminal\"\n ? 2\n : 0\n : /-256(?:color)?$/i.test(env.TERM || \"\")\n ? 2\n : /^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(\n env.TERM || \"\"\n )\n ? 1\n : Boolean(env.COLORTERM);\n\n return typeof level === \"boolean\" || level === 0\n ? false\n : {\n level,\n hasBasic: true,\n has256: level >= 2,\n has16m: level >= 3,\n };\n\n `}\n </FunctionDeclaration>\n <Spacing />\n <VarDeclaration\n export\n const\n name=\"colorSupportLevels\"\n doc=\"Detect the terminal color support level in the current environment\"\n initializer={code` {\n stdout: getColorSupportLevel(process.stdout),\n stderr: getColorSupportLevel(process.stderr),\n }; `}\n />\n <Spacing />\n <VarDeclaration\n export\n const\n name=\"isColorSupported\"\n doc=\"Detect if terminal color is supported in the current environment\"\n initializer={code` Boolean(colorSupportLevels.stdout); `}\n />\n <Spacing />\n <VarDeclaration\n export\n const\n name=\"isUnicodeSupported\"\n doc=\"Detect if Unicode characters are supported in the current environment\"\n initializer={code` !isWindows\n ? env.TERM !== \"linux\"\n : Boolean(env.WT_SESSION) ||\n Boolean(env.TERMINUS_SUBLIME) ||\n env.ConEmuTask === \"{cmd::Cmder}\" ||\n env.TERM_PROGRAM === \"Terminus-Sublime\" ||\n env.TERM_PROGRAM === \"vscode\" ||\n env.TERM === \"xterm-256color\" ||\n env.TERM === \"alacritty\" ||\n env.TERM === \"rxvt-unicode\" ||\n env.TERM === \"rxvt-unicode-256color\" ||\n env.TERMINAL_EMULATOR === \"JetBrains-JediTerm\"; `}\n />\n </>\n );\n}\n\n/**\n * Generates utilities for detecting terminal color support.\n */\n\nexport function HyperlinkSupportUtilities() {\n return (\n <>\n <FunctionDeclaration\n name=\"parseVersion\"\n parameters={[{ name: \"version\", type: \"string\", default: '\"\"' }]}>\n {code`if (/^\\d{3,4}$/.test(version)) {\n const match = /(\\d{1,2})(\\d{2})/.exec(version) ?? [];\n\n return {\n major: 0,\n minor: Number.parseInt(match[1]!, 10),\n patch: Number.parseInt(match[2]!, 10)\n };\n }\n\n const versionParts = (version ?? \"\")\n .split(\".\")\n .map(n => Number.parseInt(n, 10));\n\n return {\n major: versionParts[0],\n minor: versionParts[1],\n patch: versionParts[2]\n }; `}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc heading=\"Check if the current environment/terminal supports hyperlinks in the terminal.\">\n <TSDocReturns>\n {\"True if the current environment/terminal supports hyperlinks.\"}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"isHyperlinkSupported\"\n returnType=\"boolean\">\n {code`if (Boolean(env.FORCE_HYPERLINK)) {\n return true;\n }\n\n if (Boolean(env.NETLIFY)) {\n return true;\n } else if (isColorSupported || isTTY) {\n return false;\n } else if (Boolean(env.WT_SESSION)) {\n return true;\n } else if (isWindows || isMinimal || Boolean(env.TEAMCITY_VERSION)) {\n return false;\n } else if (Boolean(env.TERM_PROGRAM)) {\n const version = parseVersion(env.TERM_PROGRAM_VERSION);\n\n switch (String(env.TERM_PROGRAM)) {\n case \"iTerm.app\": {\n if (version.major === 3) {\n return version.minor !== undefined && version.minor >= 1;\n }\n\n return version.major !== undefined && version.major > 3;\n }\n case \"WezTerm\": {\n return version.major !== undefined && version.major >= 20_200_620;\n }\n\n case \"vscode\": {\n if (Boolean(env.CURSOR_TRACE_ID)) {\n return true;\n }\n\n return (\n version.minor !== undefined &&\n version.major !== undefined &&\n (version.major > 1 || (version.major === 1 && version.minor >= 72))\n );\n }\n\n case \"ghostty\": {\n return true;\n }\n }\n }\n\n if (Boolean(env.VTE_VERSION)) {\n if (env.VTE_VERSION === \"0.50.0\") {\n return false;\n }\n\n const version = parseVersion(env.VTE_VERSION);\n return (\n (version.major !== undefined && version.major > 0) ||\n (version.minor !== undefined && version.minor >= 50)\n );\n }\n\n if (String(env.TERM) === \"alacritty\") {\n return true;\n }\n\n return false; `}\n </FunctionDeclaration>\n </>\n );\n}\n\n/**\n * Generates utilities for detecting terminal color support.\n */\nexport function ArgsUtilities() {\n return (\n <>\n <TSDoc heading=\"Retrieves the command-line arguments from Deno or Node.js environments.\">\n <TSDocRemarks>\n {\n \"This function is only intended for internal use. Please use `useArgs()` instead.\"\n }\n </TSDocRemarks>\n <hbr />\n <hbr />\n <TSDocInternal />\n <hbr />\n <hbr />\n <TSDocReturns>\n {\n \"An array of command-line arguments from Deno or Node.js environments.\"\n }\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration export name=\"getArgs\" returnType=\"string[]\">\n {code`return ((globalThis as { Deno?: { args: string[] } })?.Deno?.args ?? process.argv ?? []) as string[];`}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc heading=\"Checks if a specific flag is present in the command-line arguments.\">\n <TSDocLink>\n {\"https://github.com/sindresorhus/has-flag/blob/main/index.js\"}\n </TSDocLink>\n <TSDocParam name=\"flag\">\n {\n 'The flag (or an array of flags/aliases) to check for, e.g., \"color\", \"no-color\".'\n }\n </TSDocParam>\n <TSDocParam name=\"argv\">\n {\n \"The command-line arguments to check against. Defaults to global Deno args or process args.\"\n }\n </TSDocParam>\n <TSDocReturns>\n {\"True if the flag is present, false otherwise.\"}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"hasFlag\"\n parameters={[\n { name: \"flag\", type: \"string | string[]\" },\n {\n name: \"argv\",\n type: \"string[]\",\n default: \"useArgs()\"\n }\n ]}>\n <VarDeclaration\n const\n name=\"position\"\n type=\"number\"\n initializer={code`(Array.isArray(flag) ? flag : [flag]).reduce((ret, f) => {\n const pos = argv.findIndex(arg => (f.startsWith(\"-\") ? \"\" : (f.length === 1 ? \"-\" : \"--\") + f)?.toLowerCase() === arg?.toLowerCase() || arg?.toLowerCase().startsWith((f.length === 1 ? \"-\" : \"--\") + f + \"=\"));\n return pos !== -1 ? pos : ret;\n }, -1);`}\n />\n <hbr />\n {code`return position !== -1 && argv.indexOf(\"--\") === -1 || position < argv.indexOf(\"--\");`}\n </FunctionDeclaration>\n <Spacing />\n <VarDeclaration\n export\n name=\"isHelp\"\n type=\"boolean\"\n initializer={code` !isCI && hasFlag([\"help\", \"h\", \"?\"]); `}\n />\n </>\n );\n}\n\n/**\n * Generates the `spawn` function declaration, which is a cross-platform utility for spawning child processes with proper color support and environment variable handling.\n */\nexport function SpawnFunctionDeclaration() {\n return (\n <>\n <FunctionDeclaration\n async\n name=\"resolveCommand\"\n parameters={[\n {\n name: \"command\",\n type: \"string\"\n },\n {\n name: \"options\",\n type: \"Record<string, any>\",\n default: \"{}\"\n },\n {\n name: \"pathExt\",\n type: \"string\",\n default:\n 'process.env.PATHEXT || [\".EXE\", \".CMD\", \".BAT\", \".COM\"].join(delimiter)'\n }\n ]}>\n {code`const env = options.env || process.env;\n const cwd = process.cwd();\n if (!!options.cwd && process.chdir !== undefined && !(process.chdir as any).disabled) {\n try {\n process.chdir(options.cwd);\n } catch (err) {\n // Do nothing\n }\n }\n\n let resolved;\n try {\n let extensions = [\"\"];\n if (isWindows) {\n extensions = pathExt.split(delimiter).flatMap((item) => [item, item.toLowerCase()]);\n if (command.includes(\".\") && extensions[0] !== \"\") {\n extensions.unshift(\"\");\n }\n }\n\n for (const envPart of (command.match(new RegExp(\\`[\\${posix.sep}\\${sep === posix.sep ? \"\" : sep}]\\`.replace(/(\\\\\\\\)/g, \"\\\\\\\\$1\"))))\n ? [...(isWindows ? [process.cwd()] : []), ...(process.env.PATH || \"\").split(delimiter)]\n : [\"\"]\n ) {\n const part = \\`\\${!(/^\".*\"$/.test(envPart) ? envPart.slice(1, -1) : envPart) && new RegExp(\\`^\\\\.\\${new RegExp(\\`[\\${posix.sep}\\${sep === posix.sep ? \"\" : sep}]\\`.replace(/(\\\\\\\\)/g, \"\\\\\\\\$1\")).source}\\`).test(command) ? command.slice(0, 2) : \"\"}\\${join(/^\".*\"$/.test(envPart) ? envPart.slice(1, -1) : envPart, command)}\\`;\n for (const extension of extensions) {\n if (isWindows) {\n const filePath = part + extension;\n if ((await stat(filePath)).isFile() && extensions.some((ext) => filePath.substring(filePath.length - ext.length).toLowerCase() === ext.toLowerCase())) {\n resolved = filePath;\n break;\n }\n } else {\n const file = await stat(part + extension);\n if (file.isFile() && (file.mode & 0o111) !== 0) {\n resolved = part + extension;\n break;\n }\n }\n }\n }\n } catch (err) {\n // Do nothing\n } finally {\n if (!!options.cwd && process.chdir !== undefined && !(process.chdir as any).disabled) {\n process.chdir(cwd);\n }\n }\n\n\n if (resolved) {\n resolved = resolve(\n options.cwd ? options.cwd : \"\",\n resolved\n );\n }\n\n return resolved; `}\n </FunctionDeclaration>\n <Spacing />\n <InterfaceDeclaration\n name=\"SpawnBaseOptions\"\n doc=\"Options for the `spawn` handler function.\">\n <InterfaceMember\n name=\"stdout\"\n optional\n type=\"(data: string) => void\"\n doc=\"The writable stream to use for prompt output, defaults to process.stdout\"\n />\n <hbr />\n <InterfaceMember\n name=\"stderr\"\n optional\n type=\"(data: string) => void\"\n doc=\"The writable stream to use for prompt error output, defaults to process.stderr\"\n />\n <hbr />\n <InterfaceMember\n name=\"rejectOnError\"\n optional\n type=\"boolean\"\n doc=\"Whether to reject the promise on error. Defaults to false.\"\n />\n <hbr />\n <InterfaceMember\n name=\"file\"\n optional\n type=\"string\"\n doc=\"The file to execute.\"\n />\n <hbr />\n <InterfaceMember\n name=\"shell\"\n optional\n type=\"boolean | string\"\n doc=\"If true, runs command inside of a shell. Uses '/bin/sh' on UNIX, and process.env.ComSpec on Windows. If a string is provided, it specifies the shell to use.\"\n />\n <hbr />\n <InterfaceMember\n name=\"forceShell\"\n optional\n type=\"boolean\"\n doc=\"If true, forces the command to run inside of a shell, even if the command is a file.\"\n />\n </InterfaceDeclaration>\n <Spacing />\n <TypeDeclaration export name=\"SpawnOptions\">\n {code`SpawnBaseOptions & Parameters<typeof _spawn>[1]`}\n </TypeDeclaration>\n <Spacing />\n <TSDoc heading=\"A function to spawn child processes with proper color support and environment variable handling.\">\n <TSDocParam name=\"command\">{`The command to execute.`}</TSDocParam>\n <TSDocParam name=\"args\">\n {`The command-line arguments to pass to the command. Defaults to an empty array.`}\n </TSDocParam>\n <TSDocParam name=\"options\">\n {`Additional options for spawning the process, such as the current working directory (\\`cwd\\`).`}\n </TSDocParam>\n <TSDocReturns>{`The result of the spawned process.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n async\n name=\"spawn\"\n parameters={[\n { name: \"command\", type: \"string\" },\n {\n name: \"args\",\n type: \"string[] | SpawnOptions\",\n default: \"{} as SpawnOptions\"\n },\n {\n name: \"options\",\n type: \"SpawnOptions\",\n default: \"{} as SpawnOptions\"\n }\n ]}>\n {code`const normalized = {\n command,\n args: [] as string[],\n options: options as SpawnOptions | any,\n file: undefined as string | undefined,\n original: {\n command,\n args,\n },\n };\n\n if (args) {\n if (Array.isArray(args)) {\n if (args.length > 0) {\n normalized.args = args.slice(0);\n }\n } else {\n normalized.options = { ...args } as SpawnOptions | any;\n normalized.args = [];\n }\n }\n\n if (!normalized.options.shell && isWindows) {\n normalized.file = (await resolveCommand(normalized.command, normalized.options)) || (await resolveCommand(normalized.command, normalized.options, delimiter));\n\n let commandFile = normalized.file;\n if (normalized.file) {\n let shebang: string | undefined;\n const buffer = Buffer.alloc(150);\n\n try {\n const fd = openSync(normalized.file, \"r\");\n await read(fd, buffer, 0, 150, 0);\n closeSync(fd);\n } catch (err) {\n // Do nothing\n }\n\n const matched = buffer.toString().match(/^#!(.*)/);\n if (matched) {\n const [path, argument] = matched[0].replace(/#! ?/, \"\").split(\" \");\n\t const binary = path.split(\"/\").pop();\n if (binary === \"env\") {\n shebang = argument;\n } else {\n shebang = argument ? \\`\\${binary} \\${argument}\\` : binary;\n }\n }\n\n if (shebang) {\n normalized.args.unshift(normalized.file);\n normalized.command = shebang;\n\n commandFile = await resolveCommand(normalized.command, normalized.options);\n }\n }\n\n if (commandFile && (normalized.options.forceShell || /\\\\.(?:com|exe)$/i.test(commandFile))) {\n normalized.command = normalize(normalized.command).replace(/([()\\\\][%!^\"\\`<>&|;, *?])/g, \"^$1\");\n\n normalized.args = [\"/d\", \"/s\", \"/c\", \\`\"\\${normalized.command} \\${normalized.args.map(arg =>\n \\`\\${arg}\\`.replace(/(?=(\\\\\\\\+?)?)\\\\1\"/g, \"$1$1\\\\\"\").replace(/(?=(\\\\\\\\+?)?)\\\\1$/, \"$1$1\")\n ).map(arg =>\n \\`\"\\${arg}\"\\`.replace(/([()\\\\][%!^\"\\`<>&|;, *?])/g, \"^$1\")\n ).map(arg =>\n /node_modules[\\\\\\\\/].bin[\\\\\\\\/][^\\\\\\\\/]+\\\\.cmd$/i.test(commandFile) ? arg.replace(/([()\\\\][%!^\"\\`<>&|;, *?])/g, \"^$1\") : arg\n ).join(\" \")}\"\\`];\n normalized.command = process.env.comspec || \"cmd.exe\";\n normalized.options.windowsVerbatimArguments = true;\n }\n }\n\n let stdout = \"\";\n let stderr = \"\";\n\n const child = _spawn(normalized.command, normalized.args, {\n cwd: process.cwd(),\n env: {\n ...process.env,\n FORCE_COLOR: isColorSupported ? \"1\" : \"0\",\n },\n ...normalized.options,\n }) as ReturnType<typeof _spawn>;\n\n if (isWindows) {\n const emit = child.emit;\n child.emit = (eventName: string | symbol, ...eventArgs: any[]) => {\n if (eventName === \"exit\") {\n let err: Error | null = null;\n if (eventArgs[0] === 1 && !normalized.file) {\n err = Object.assign(new Error(\\`spawn \\${normalized.original.command} ENOENT\\`), {\n code: \"ENOENT\",\n errno: \"ENOENT\",\n syscall: \\`spawn \\${normalized.original.command}\\`,\n path: normalized.original.command,\n spawnargs: normalized.original.args,\n });\n }\n\n if (err) {\n return emit.call(child, \"error\", err);\n }\n }\n\n return emit.apply(child, [eventName, ...eventArgs]);\n };\n }\n\n return new Promise((resolve, reject) => {\n if (normalized.options.stdin !== undefined) {\n child.stdin?.write(normalized.options.stdin);\n }\n\n child.stdin?.end();\n\n child.stdout?.on(\"data\", data => {\n stdout += data;\n if (normalized.options.stdout) {\n normalized.options.stdout(data);\n }\n });\n\n child.stderr?.on(\"data\", data => {\n stderr += data;\n if (normalized.options.stderr) {\n normalized.options.stderr(data);\n }\n });\n\n if (normalized.options.rejectOnError) {\n child.addListener(\"error\", reject);\n }\n\n child.on(\"close\", code => {\n if (code !== 0 && normalized.options.rejectOnError) {\n reject(stderr);\n } else {\n resolve({ stdout, stderr });\n }\n });\n }); `}\n </FunctionDeclaration>\n </>\n );\n}\n\nexport function ContextUtilities() {\n return code`\n /**\n * The global Shell Shock - Application context instance.\n *\n * @internal\n */\n export let internal_appContext = new AsyncLocalStorage<Map<string, any>>();\n\n /**\n * Get the Shell Shock - Application context for the current application.\n *\n * @param options - The options to use when getting the context.\n * @returns The Shell Shock - Application context for the current application or undefined if the context is not available.\n */\n export function useApp(): Map<string, any> | undefined {\n return internal_appContext.getStore();\n }\n\n /**\n * A utility hook function to get the command line arguments from the application context.\n *\n * @returns An array of command-line arguments from the application context.\n * @throws If the application context is not available.\n */\n export function useArgs(): string[] {\n return useApp()?.get(\"args\") ?? getArgs();\n }\n\n /**\n * The context object for the current command execution, containing the command path and segments.\n */\n export interface CommandContext {\n path: string;\n segments: string[];\n }\n\n /**\n * The global Shell Shock - Command context instance.\n *\n * @internal\n */\n export let internal_commandContext = new AsyncLocalStorage<CommandContext>();\n\n /**\n * Get the Shell Shock - Command context for the current application.\n *\n * @param options - The options to use when getting the context.\n * @returns The Shell Shock - Command context for the current application.\n * @throws If the Shell Shock - Command context is not available.\n */\n export function useCommand(): CommandContext {\n const result = internal_commandContext.getStore();\n if (!result) {\n throw new Error(\n \\`The Shell Shock - Command context is not available. Make sure to call useCommand() within a valid context scope.\\`\n );\n }\n return result;\n }\n\n /**\n * A utility hook function to get the individual segments of the current command path.\n *\n * @returns An array of command path segments.\n * @throws If the command context is not available.\n */\n export function useSegments(): string[] {\n return useCommand().segments;\n }\n\n /**\n * A utility hook function to get the full command path as a string.\n *\n * @returns The full command path as a string.\n * @throws If the command context is not available.\n */\n export function usePath(): string {\n return useCommand().path;\n }\n `;\n}\n\n/**\n * A built-in utilities module for Shell Shock.\n */\nexport function UtilsBuiltin(props: UtilsBuiltinProps) {\n const [{ children }, rest] = splitProps(props, [\"children\"]);\n\n return (\n <BuiltinFile\n id=\"utils\"\n description=\"A collection of helper utilities that ease command-line application development.\"\n {...rest}\n imports={defu(rest.imports ?? {}, {\n \"node:os\": \"os\",\n \"node:process\": \"process\",\n \"node:path\": [\n \"resolve\",\n \"delimiter\",\n \"normalize\",\n \"join\",\n \"posix\",\n \"sep\"\n ],\n \"node:fs\": [\"openSync\", \"closeSync\"],\n \"node:fs/promises\": [\"stat\", \"read\"],\n \"node:child_process\": [{ name: \"spawn\", alias: \"_spawn\" }],\n \"node:async_hooks\": [\"AsyncLocalStorage\"]\n })}\n builtinImports={defu(rest.builtinImports ?? {}, {\n console: [\"error\", \"verbose\", \"writeLine\"],\n env: [\"env\", \"isCI\", \"isTest\", \"isWindows\", \"isDevelopment\", \"isDebug\"]\n })}>\n <Spacing />\n <ContextUtilities />\n <Spacing />\n <ArgsUtilities />\n <Spacing />\n <EnvSupportUtilities />\n <Spacing />\n <HyperlinkSupportUtilities />\n <Spacing />\n <ColorSupportUtilities />\n <Spacing />\n <SpawnFunctionDeclaration />\n <Spacing />\n <Show when={Boolean(children)}>{children}</Show>\n </BuiltinFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AA+CA,SAAgBiB,sBAAsB;AACpC,QAAA;mDAEKV,sCAAc;GAAA,UAAA;GAAA,SAAA;GAGbY,MAAI;GACJC,KAAG;GACHC,aAAarB,oBAAI;GAAkD,CAAA;mDAEpEQ,2DAAO,EAAA,CAAA;mDACPD,sCAAc;GAAA,UAAA;GAAA,SAAA;GAGbY,MAAI;GACJC,KAAG;GACHC,aAAarB,oBAAI;GAA4C,CAAA;mDAE9DQ,2DAAO,EAAA,CAAA;mDACPD,sCAAc;GAAA,UA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,CAAA"}
1
+ {"version":3,"file":"utils-builtin.cjs","names":["code","Show","splitProps","FunctionDeclaration","InterfaceDeclaration","InterfaceMember","TypeDeclaration","VarDeclaration","Spacing","BuiltinFile","TSDoc","TSDocInternal","TSDocLink","TSDocParam","TSDocRemarks","TSDocReturns","defu","EnvSupportUtilities","_$createComponent","name","doc","initializer","ColorSupportUtilities","children","type","heading","parameters","default","HyperlinkSupportUtilities","returnType","ArgsUtilities","_$createIntrinsic","SpawnFunctionDeclaration","async","optional","ContextUtilities","UtilsBuiltin","props","rest","_$mergeProps","id","description","imports","alias","builtinImports","console","env","when","Boolean"],"sources":["../../src/components/utils-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 TypeDeclaration,\n VarDeclaration\n} from \"@alloy-js/typescript\";\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 TSDocInternal,\n TSDocLink,\n TSDocParam,\n TSDocRemarks,\n TSDocReturns\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport defu from \"defu\";\n\nexport interface UtilsBuiltinProps extends Omit<\n BuiltinFileProps,\n \"id\" | \"description\"\n> {}\n\n/**\n * Generates utilities for detecting terminal color support.\n */\nexport function EnvSupportUtilities() {\n return (\n <>\n <VarDeclaration\n export\n const\n name=\"isTTY\"\n doc=\"Detect if stdout.TTY is available\"\n initializer={code`Boolean(process.stdout && process.stdout.isTTY);`}\n />\n <Spacing />\n <VarDeclaration\n export\n const\n name=\"isMinimal\"\n doc=\"Detect if the current environment is minimal (CI, non-TTY, etc.)\"\n initializer={code` env.MINIMAL || isCI || isTest || !isTTY; `}\n />\n <Spacing />\n <VarDeclaration\n export\n const\n name=\"isInteractive\"\n doc=\"Detect if the current environment is interactive\"\n initializer={code` !isMinimal && process.stdin?.isTTY && env.TERM !== \"dumb\" && !hasFlag([\"no-interactive\", \"non-interactive\", \"no-interact\"]); `}\n />\n </>\n );\n}\n\n/**\n * Generates utilities for detecting terminal color support.\n */\nexport function ColorSupportUtilities() {\n return (\n <>\n <InterfaceDeclaration\n export\n name=\"GetColorSupportLevelOptions\"\n doc=\"Options for the getColorSupportLevel function\">\n <InterfaceMember\n name=\"ignoreFlags\"\n type=\"boolean\"\n doc=\"Indicates if the function should skip checking command-line flags for color support\"\n />\n </InterfaceDeclaration>\n <Spacing />\n <TSDoc heading=\"Checks if a specific flag is present in the command-line arguments.\">\n <TSDocLink>\n {\"https://github.com/sindresorhus/has-flag/blob/main/index.js\"}\n </TSDocLink>\n <TSDocParam name=\"flag\">\n {'The flag to check for, e.g., \"color\", \"no-color\".'}\n </TSDocParam>\n <TSDocParam name=\"argv\">\n {\n \"The command-line arguments to check against. Defaults to global Deno args or process args.\"\n }\n </TSDocParam>\n <TSDocReturns>\n {\"True if the flag is present, false otherwise.\"}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"getColorSupportLevel\"\n parameters={[\n { name: \"stream\", type: \"NodeJS.WriteStream & { fd: 1 | 2; }\" },\n {\n name: \"options\",\n type: \"GetColorSupportLevelOptions\",\n default: \"{ ignoreFlags: false }\"\n }\n ]}>\n {code`const { ignoreFlags } = options;\n\n let forceColor: number | undefined;\n if (env.FORCE_COLOR !== undefined) {\n forceColor = !env.FORCE_COLOR\n ? 0\n : typeof env.FORCE_COLOR === \"boolean\"\n ? 1\n : typeof env.FORCE_COLOR === \"number\" &&\n [0, 1, 2, 3].includes(Math.min(env.FORCE_COLOR as number, 3))\n ? Math.min(env.FORCE_COLOR as number, 3)\n : undefined;\n }\n\n if (ignoreFlags !== true && forceColor === undefined) {\n if (\n hasFlag(\"no-color\") ||\n hasFlag(\"no-colors\") ||\n hasFlag(\"color=false\") ||\n hasFlag(\"color=never\")\n ) {\n return 0;\n }\n\n if (\n hasFlag(\"color=16m\") ||\n hasFlag(\"color=full\") ||\n hasFlag(\"color=truecolor\")\n ) {\n return 3;\n }\n\n if (hasFlag(\"color=256\")) {\n return 2;\n }\n\n if (\n hasFlag(\"color\") ||\n hasFlag(\"colors\") ||\n hasFlag(\"color=true\") ||\n hasFlag(\"color=always\")\n ) {\n forceColor = 1;\n }\n }\n\n const level = Boolean(env.TF_BUILD) || Boolean(env.AGENT_NAME)\n ? 1\n : stream &&\n !(isTTY || (stream && stream.isTTY)) &&\n forceColor === undefined\n ? 0\n : env.TERM === \"dumb\"\n ? forceColor || 0\n : isWindows\n ? Number(os.release().split(\".\")[0]) >= 10 &&\n Number(os.release().split(\".\")[2]) >= 10_586\n ? Number(os.release().split(\".\")[2]) >= 14_931\n ? 3\n : 2\n : 1\n : isCI\n ? Boolean(env.GITHUB_ACTIONS) ||\n Boolean(env.GITEA_ACTIONS) ||\n Boolean(env.CIRCLECI)\n ? 3\n : Boolean(env.TRAVIS) ||\n Boolean(env.APPVEYOR) ||\n Boolean(env.GITLAB_CI) ||\n Boolean(env.BUILDKITE) ||\n Boolean(env.DRONE) ||\n env.CI_NAME === \"codeship\"\n ? 1\n : forceColor || 0\n : Boolean(env.TEAMCITY_VERSION)\n ? /^(?:9\\.0*[1-9]\\d*\\.|\\d{2,}\\.)/.test(String(env.TEAMCITY_VERSION) || \"\")\n ? 1\n : 0\n : String(env.COLORTERM) === \"truecolor\" ||\n env.TERM === \"xterm-kitty\"\n ? 3\n : Boolean(env.TERM_PROGRAM)\n ? env.TERM_PROGRAM === \"iTerm.app\"\n ? Number.parseInt(\n (env.TERM_PROGRAM_VERSION || \"\").split(\".\")[0] as string,\n 10\n ) >= 3\n ? 3\n : 2\n : env.TERM_PROGRAM === \"Apple_Terminal\"\n ? 2\n : 0\n : /-256(?:color)?$/i.test(env.TERM || \"\")\n ? 2\n : /^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(\n env.TERM || \"\"\n )\n ? 1\n : Boolean(env.COLORTERM);\n\n return typeof level === \"boolean\" || level === 0\n ? false\n : {\n level,\n hasBasic: true,\n has256: level >= 2,\n has16m: level >= 3,\n };\n\n `}\n </FunctionDeclaration>\n <Spacing />\n <VarDeclaration\n export\n const\n name=\"colorSupportLevels\"\n doc=\"Detect the terminal color support level in the current environment\"\n initializer={code` {\n stdout: getColorSupportLevel(process.stdout),\n stderr: getColorSupportLevel(process.stderr),\n }; `}\n />\n <Spacing />\n <VarDeclaration\n export\n const\n name=\"isColorSupported\"\n doc=\"Detect if terminal color is supported in the current environment\"\n initializer={code` Boolean(colorSupportLevels.stdout); `}\n />\n <Spacing />\n <VarDeclaration\n export\n const\n name=\"isUnicodeSupported\"\n doc=\"Detect if Unicode characters are supported in the current environment\"\n initializer={code` !isWindows\n ? env.TERM !== \"linux\"\n : Boolean(env.WT_SESSION) ||\n Boolean(env.TERMINUS_SUBLIME) ||\n env.ConEmuTask === \"{cmd::Cmder}\" ||\n env.TERM_PROGRAM === \"Terminus-Sublime\" ||\n env.TERM_PROGRAM === \"vscode\" ||\n env.TERM === \"xterm-256color\" ||\n env.TERM === \"alacritty\" ||\n env.TERM === \"rxvt-unicode\" ||\n env.TERM === \"rxvt-unicode-256color\" ||\n env.TERMINAL_EMULATOR === \"JetBrains-JediTerm\"; `}\n />\n </>\n );\n}\n\n/**\n * Generates utilities for detecting terminal color support.\n */\n\nexport function HyperlinkSupportUtilities() {\n return (\n <>\n <FunctionDeclaration\n name=\"parseVersion\"\n parameters={[{ name: \"version\", type: \"string\", default: '\"\"' }]}>\n {code`if (/^\\d{3,4}$/.test(version)) {\n const match = /(\\d{1,2})(\\d{2})/.exec(version) ?? [];\n\n return {\n major: 0,\n minor: Number.parseInt(match[1]!, 10),\n patch: Number.parseInt(match[2]!, 10)\n };\n }\n\n const versionParts = (version ?? \"\")\n .split(\".\")\n .map(n => Number.parseInt(n, 10));\n\n return {\n major: versionParts[0],\n minor: versionParts[1],\n patch: versionParts[2]\n }; `}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc heading=\"Check if the current environment/terminal supports hyperlinks in the terminal.\">\n <TSDocReturns>\n {\"True if the current environment/terminal supports hyperlinks.\"}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"isHyperlinkSupported\"\n returnType=\"boolean\">\n {code`if (Boolean(env.FORCE_HYPERLINK)) {\n return true;\n }\n\n if (Boolean(env.NETLIFY)) {\n return true;\n } else if (isColorSupported || isTTY) {\n return false;\n } else if (Boolean(env.WT_SESSION)) {\n return true;\n } else if (isWindows || isMinimal || Boolean(env.TEAMCITY_VERSION)) {\n return false;\n } else if (Boolean(env.TERM_PROGRAM)) {\n const version = parseVersion(env.TERM_PROGRAM_VERSION);\n\n switch (String(env.TERM_PROGRAM)) {\n case \"iTerm.app\": {\n if (version.major === 3) {\n return version.minor !== undefined && version.minor >= 1;\n }\n\n return version.major !== undefined && version.major > 3;\n }\n case \"WezTerm\": {\n return version.major !== undefined && version.major >= 20_200_620;\n }\n\n case \"vscode\": {\n if (Boolean(env.CURSOR_TRACE_ID)) {\n return true;\n }\n\n return (\n version.minor !== undefined &&\n version.major !== undefined &&\n (version.major > 1 || (version.major === 1 && version.minor >= 72))\n );\n }\n\n case \"ghostty\": {\n return true;\n }\n }\n }\n\n if (Boolean(env.VTE_VERSION)) {\n if (env.VTE_VERSION === \"0.50.0\") {\n return false;\n }\n\n const version = parseVersion(env.VTE_VERSION);\n return (\n (version.major !== undefined && version.major > 0) ||\n (version.minor !== undefined && version.minor >= 50)\n );\n }\n\n if (String(env.TERM) === \"alacritty\") {\n return true;\n }\n\n return false; `}\n </FunctionDeclaration>\n </>\n );\n}\n\n/**\n * Generates utilities for detecting terminal color support.\n */\nexport function ArgsUtilities() {\n return (\n <>\n <TSDoc heading=\"Retrieves the command-line arguments from Deno or Node.js environments.\">\n <TSDocRemarks>\n {\n \"This function is only intended for internal use. Please use `useArgs()` instead.\"\n }\n </TSDocRemarks>\n <hbr />\n <hbr />\n <TSDocInternal />\n <hbr />\n <hbr />\n <TSDocReturns>\n {\n \"An array of command-line arguments from Deno or Node.js environments.\"\n }\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration export name=\"getArgs\" returnType=\"string[]\">\n {code`return ((globalThis as { Deno?: { args: string[] } })?.Deno?.args ?? process.argv ?? []) as string[];`}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc heading=\"Checks if a specific flag is present in the command-line arguments.\">\n <TSDocLink>\n {\"https://github.com/sindresorhus/has-flag/blob/main/index.js\"}\n </TSDocLink>\n <TSDocParam name=\"flag\">\n {\n 'The flag (or an array of flags/aliases) to check for, e.g., \"color\", \"no-color\".'\n }\n </TSDocParam>\n <TSDocParam name=\"argv\">\n {\n \"The command-line arguments to check against. Defaults to global Deno args or process args.\"\n }\n </TSDocParam>\n <TSDocReturns>\n {\"True if the flag is present, false otherwise.\"}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"hasFlag\"\n parameters={[\n { name: \"flag\", type: \"string | string[]\" },\n {\n name: \"argv\",\n type: \"string[]\",\n default: \"useArgs()\"\n }\n ]}>\n <VarDeclaration\n const\n name=\"position\"\n type=\"number\"\n initializer={code`(Array.isArray(flag) ? flag : [flag]).reduce((ret, f) => {\n const pos = argv.findIndex(arg => (f.startsWith(\"-\") ? \"\" : (f.length === 1 ? \"-\" : \"--\") + f)?.toLowerCase() === arg?.toLowerCase() || arg?.toLowerCase().startsWith((f.length === 1 ? \"-\" : \"--\") + f + \"=\"));\n return pos !== -1 ? pos : ret;\n }, -1);`}\n />\n <hbr />\n {code`return position !== -1 && argv.indexOf(\"--\") === -1 || position < argv.indexOf(\"--\");`}\n </FunctionDeclaration>\n <Spacing />\n <VarDeclaration\n export\n name=\"isHelp\"\n type=\"boolean\"\n initializer={code` !isCI && hasFlag([\"help\", \"h\", \"?\"]); `}\n />\n </>\n );\n}\n\n/**\n * Generates the `spawn` function declaration, which is a cross-platform utility for spawning child processes with proper color support and environment variable handling.\n */\nexport function SpawnFunctionDeclaration() {\n return (\n <>\n <FunctionDeclaration\n async\n name=\"resolveCommand\"\n parameters={[\n {\n name: \"command\",\n type: \"string\"\n },\n {\n name: \"options\",\n type: \"Record<string, any>\",\n default: \"{}\"\n },\n {\n name: \"pathExt\",\n type: \"string\",\n default:\n 'process.env.PATHEXT || [\".EXE\", \".CMD\", \".BAT\", \".COM\"].join(delimiter)'\n }\n ]}>\n {code`const env = options.env || process.env;\n const cwd = process.cwd();\n if (!!options.cwd && process.chdir !== undefined && !(process.chdir as any).disabled) {\n try {\n process.chdir(options.cwd);\n } catch (err) {\n // Do nothing\n }\n }\n\n let resolved;\n try {\n let extensions = [\"\"];\n if (isWindows) {\n extensions = pathExt.split(delimiter).flatMap((item) => [item, item.toLowerCase()]);\n if (command.includes(\".\") && extensions[0] !== \"\") {\n extensions.unshift(\"\");\n }\n }\n\n for (const envPart of (command.match(new RegExp(\\`[\\${posix.sep}\\${sep === posix.sep ? \"\" : sep}]\\`.replace(/(\\\\\\\\)/g, \"\\\\\\\\$1\"))))\n ? [...(isWindows ? [process.cwd()] : []), ...(process.env.PATH || \"\").split(delimiter)]\n : [\"\"]\n ) {\n const part = \\`\\${!(/^\".*\"$/.test(envPart) ? envPart.slice(1, -1) : envPart) && new RegExp(\\`^\\\\.\\${new RegExp(\\`[\\${posix.sep}\\${sep === posix.sep ? \"\" : sep}]\\`.replace(/(\\\\\\\\)/g, \"\\\\\\\\$1\")).source}\\`).test(command) ? command.slice(0, 2) : \"\"}\\${join(/^\".*\"$/.test(envPart) ? envPart.slice(1, -1) : envPart, command)}\\`;\n for (const extension of extensions) {\n if (isWindows) {\n const filePath = part + extension;\n if ((await stat(filePath)).isFile() && extensions.some((ext) => filePath.substring(filePath.length - ext.length).toLowerCase() === ext.toLowerCase())) {\n resolved = filePath;\n break;\n }\n } else {\n const file = await stat(part + extension);\n if (file.isFile() && (file.mode & 0o111) !== 0) {\n resolved = part + extension;\n break;\n }\n }\n }\n }\n } catch (err) {\n // Do nothing\n } finally {\n if (!!options.cwd && process.chdir !== undefined && !(process.chdir as any).disabled) {\n process.chdir(cwd);\n }\n }\n\n\n if (resolved) {\n resolved = resolve(\n options.cwd ? options.cwd : \"\",\n resolved\n );\n }\n\n return resolved; `}\n </FunctionDeclaration>\n <Spacing />\n <InterfaceDeclaration\n name=\"SpawnBaseOptions\"\n doc=\"Options for the `spawn` handler function.\">\n <InterfaceMember\n name=\"stdout\"\n optional\n type=\"(data: string) => void\"\n doc=\"The writable stream to use for prompt output, defaults to process.stdout\"\n />\n <hbr />\n <InterfaceMember\n name=\"stderr\"\n optional\n type=\"(data: string) => void\"\n doc=\"The writable stream to use for prompt error output, defaults to process.stderr\"\n />\n <hbr />\n <InterfaceMember\n name=\"rejectOnError\"\n optional\n type=\"boolean\"\n doc=\"Whether to reject the promise on error. Defaults to false.\"\n />\n <hbr />\n <InterfaceMember\n name=\"file\"\n optional\n type=\"string\"\n doc=\"The file to execute.\"\n />\n <hbr />\n <InterfaceMember\n name=\"shell\"\n optional\n type=\"boolean | string\"\n doc=\"If true, runs command inside of a shell. Uses '/bin/sh' on UNIX, and process.env.ComSpec on Windows. If a string is provided, it specifies the shell to use.\"\n />\n <hbr />\n <InterfaceMember\n name=\"forceShell\"\n optional\n type=\"boolean\"\n doc=\"If true, forces the command to run inside of a shell, even if the command is a file.\"\n />\n </InterfaceDeclaration>\n <Spacing />\n <TypeDeclaration export name=\"SpawnOptions\">\n {code`SpawnBaseOptions & Parameters<typeof _spawn>[1]`}\n </TypeDeclaration>\n <Spacing />\n <TSDoc heading=\"A function to spawn child processes with proper color support and environment variable handling.\">\n <TSDocParam name=\"command\">{`The command to execute.`}</TSDocParam>\n <TSDocParam name=\"args\">\n {`The command-line arguments to pass to the command. Defaults to an empty array.`}\n </TSDocParam>\n <TSDocParam name=\"options\">\n {`Additional options for spawning the process, such as the current working directory (\\`cwd\\`).`}\n </TSDocParam>\n <TSDocReturns>{`The result of the spawned process.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n async\n name=\"spawn\"\n parameters={[\n { name: \"command\", type: \"string\" },\n {\n name: \"args\",\n type: \"string[] | SpawnOptions\",\n default: \"{} as SpawnOptions\"\n },\n {\n name: \"options\",\n type: \"SpawnOptions\",\n default: \"{} as SpawnOptions\"\n }\n ]}>\n {code`const normalized = {\n command,\n args: [] as string[],\n options: options as SpawnOptions | any,\n file: undefined as string | undefined,\n original: {\n command,\n args,\n },\n };\n\n if (args) {\n if (Array.isArray(args)) {\n if (args.length > 0) {\n normalized.args = args.slice(0);\n }\n } else {\n normalized.options = { ...args } as SpawnOptions | any;\n normalized.args = [];\n }\n }\n\n if (!normalized.options.shell && isWindows) {\n normalized.file = (await resolveCommand(normalized.command, normalized.options)) || (await resolveCommand(normalized.command, normalized.options, delimiter));\n\n let commandFile = normalized.file;\n if (normalized.file) {\n let shebang: string | undefined;\n const buffer = Buffer.alloc(150);\n\n try {\n const fd = openSync(normalized.file, \"r\");\n await promisify(read)(fd, buffer, 0, 150, 0);\n closeSync(fd);\n } catch (err) {\n // Do nothing\n }\n\n const matched = buffer.toString().match(/^#!(.*)/);\n if (matched) {\n const [path, argument] = matched[0].replace(/#! ?/, \"\").split(\" \");\n\t const binary = path.split(\"/\").pop();\n if (binary === \"env\") {\n shebang = argument;\n } else {\n shebang = argument ? \\`\\${binary} \\${argument}\\` : binary;\n }\n }\n\n if (shebang) {\n normalized.args.unshift(normalized.file);\n normalized.command = shebang;\n\n commandFile = await resolveCommand(normalized.command, normalized.options);\n }\n }\n\n if (commandFile && (normalized.options.forceShell || /\\\\.(?:com|exe)$/i.test(commandFile))) {\n normalized.command = normalize(normalized.command).replace(/([()\\\\][%!^\"\\`<>&|;, *?])/g, \"^$1\");\n\n normalized.args = [\"/d\", \"/s\", \"/c\", \\`\"\\${normalized.command} \\${normalized.args.map(arg =>\n \\`\\${arg}\\`.replace(/(?=(\\\\\\\\+?)?)\\\\1\"/g, \"$1$1\\\\\"\").replace(/(?=(\\\\\\\\+?)?)\\\\1$/, \"$1$1\")\n ).map(arg =>\n \\`\"\\${arg}\"\\`.replace(/([()\\\\][%!^\"\\`<>&|;, *?])/g, \"^$1\")\n ).map(arg =>\n /node_modules[\\\\\\\\/].bin[\\\\\\\\/][^\\\\\\\\/]+\\\\.cmd$/i.test(commandFile) ? arg.replace(/([()\\\\][%!^\"\\`<>&|;, *?])/g, \"^$1\") : arg\n ).join(\" \")}\"\\`];\n normalized.command = process.env.comspec || \"cmd.exe\";\n normalized.options.windowsVerbatimArguments = true;\n }\n }\n\n let stdout = \"\";\n let stderr = \"\";\n\n const child = _spawn(normalized.command, normalized.args, {\n cwd: process.cwd(),\n env: {\n ...process.env,\n FORCE_COLOR: isColorSupported ? \"1\" : \"0\",\n },\n ...normalized.options,\n }) as ReturnType<typeof _spawn>;\n\n if (isWindows) {\n const emit = child.emit;\n child.emit = (eventName: string | symbol, ...eventArgs: any[]) => {\n if (eventName === \"exit\") {\n let err: Error | null = null;\n if (eventArgs[0] === 1 && !normalized.file) {\n err = Object.assign(new Error(\\`spawn \\${normalized.original.command} ENOENT\\`), {\n code: \"ENOENT\",\n errno: \"ENOENT\",\n syscall: \\`spawn \\${normalized.original.command}\\`,\n path: normalized.original.command,\n spawnargs: normalized.original.args,\n });\n }\n\n if (err) {\n return emit.call(child, \"error\", err);\n }\n }\n\n return emit.apply(child, [eventName, ...eventArgs]);\n };\n }\n\n return new Promise((resolve, reject) => {\n if (normalized.options.stdin !== undefined) {\n child.stdin?.write(normalized.options.stdin);\n }\n\n child.stdin?.end();\n\n child.stdout?.on(\"data\", data => {\n stdout += data;\n if (normalized.options.stdout) {\n normalized.options.stdout(data);\n }\n });\n\n child.stderr?.on(\"data\", data => {\n stderr += data;\n if (normalized.options.stderr) {\n normalized.options.stderr(data);\n }\n });\n\n if (normalized.options.rejectOnError) {\n child.addListener(\"error\", reject);\n }\n\n child.on(\"close\", code => {\n if (code !== 0 && normalized.options.rejectOnError) {\n reject(stderr);\n } else {\n resolve({ stdout, stderr });\n }\n });\n }); `}\n </FunctionDeclaration>\n </>\n );\n}\n\nexport function ContextUtilities() {\n return code`\n /**\n * The global Shell Shock - Application context instance.\n *\n * @internal\n */\n export let internal_appContext = new AsyncLocalStorage<Map<string, any>>();\n\n /**\n * Get the Shell Shock - Application context for the current application.\n *\n * @param options - The options to use when getting the context.\n * @returns The Shell Shock - Application context for the current application or undefined if the context is not available.\n */\n export function useApp(): Map<string, any> | undefined {\n return internal_appContext.getStore();\n }\n\n /**\n * A utility hook function to get the command line arguments from the application context.\n *\n * @returns An array of command-line arguments from the application context.\n * @throws If the application context is not available.\n */\n export function useArgs(): string[] {\n return useApp()?.get(\"args\") ?? getArgs();\n }\n\n /**\n * The context object for the current command execution, containing the command path and segments.\n */\n export interface CommandContext {\n path: string;\n segments: string[];\n }\n\n /**\n * The global Shell Shock - Command context instance.\n *\n * @internal\n */\n export let internal_commandContext = new AsyncLocalStorage<CommandContext>();\n\n /**\n * Get the Shell Shock - Command context for the current application.\n *\n * @param options - The options to use when getting the context.\n * @returns The Shell Shock - Command context for the current application.\n * @throws If the Shell Shock - Command context is not available.\n */\n export function useCommand(): CommandContext {\n const result = internal_commandContext.getStore();\n if (!result) {\n throw new Error(\n \\`The Shell Shock - Command context is not available. Make sure to call useCommand() within a valid context scope.\\`\n );\n }\n return result;\n }\n\n /**\n * A utility hook function to get the individual segments of the current command path.\n *\n * @returns An array of command path segments.\n * @throws If the command context is not available.\n */\n export function useSegments(): string[] {\n return useCommand().segments;\n }\n\n /**\n * A utility hook function to get the full command path as a string.\n *\n * @returns The full command path as a string.\n * @throws If the command context is not available.\n */\n export function usePath(): string {\n return useCommand().path;\n }\n `;\n}\n\n/**\n * A built-in utilities module for Shell Shock.\n */\nexport function UtilsBuiltin(props: UtilsBuiltinProps) {\n const [{ children }, rest] = splitProps(props, [\"children\"]);\n\n return (\n <BuiltinFile\n id=\"utils\"\n description=\"A collection of helper utilities that ease command-line application development.\"\n {...rest}\n imports={defu(rest.imports ?? {}, {\n \"node:os\": \"os\",\n \"node:process\": \"process\",\n \"node:path\": [\n \"resolve\",\n \"delimiter\",\n \"normalize\",\n \"join\",\n \"posix\",\n \"sep\"\n ],\n \"node:fs\": [\"openSync\", \"closeSync\", \"read\"],\n \"node:fs/promises\": [\"stat\"],\n \"node:util\": [\"promisify\"],\n \"node:child_process\": [{ name: \"spawn\", alias: \"_spawn\" }],\n \"node:async_hooks\": [\"AsyncLocalStorage\"]\n })}\n builtinImports={defu(rest.builtinImports ?? {}, {\n console: [\"error\", \"verbose\", \"writeLine\"],\n env: [\"env\", \"isCI\", \"isTest\", \"isWindows\", \"isDevelopment\", \"isDebug\"]\n })}>\n <Spacing />\n <ContextUtilities />\n <Spacing />\n <ArgsUtilities />\n <Spacing />\n <EnvSupportUtilities />\n <Spacing />\n <HyperlinkSupportUtilities />\n <Spacing />\n <ColorSupportUtilities />\n <Spacing />\n <SpawnFunctionDeclaration />\n <Spacing />\n <Show when={Boolean(children)}>{children}</Show>\n </BuiltinFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;AA+CA,SAAgBiB,sBAAsB;AACpC,QAAA;mDAEKV,sCAAc;GAAA,UAAA;GAAA,SAAA;GAGbY,MAAI;GACJC,KAAG;GACHC,aAAarB,oBAAI;GAAkD,CAAA;mDAEpEQ,2DAAO,EAAA,CAAA;mDACPD,sCAAc;GAAA,UAAA;GAAA,SAAA;GAGbY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;qDACxBxB,2DAAO,EAAA,CAAA;qDACPP,sBAAI;KAAA,IAAC8C,OAAI;AAAA,aAAEC,QAAQzB,SAAS;;KAAGA;KAAQ,CAAA;IAAA;;EAAA,CAAA,CAAA"}
@@ -1,4 +1,4 @@
1
- import * as _alloy_js_core16 from "@alloy-js/core";
1
+ import * as _alloy_js_core4 from "@alloy-js/core";
2
2
  import { BuiltinFileProps } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
3
3
 
4
4
  //#region src/components/utils-builtin.d.ts
@@ -6,28 +6,28 @@ interface UtilsBuiltinProps extends Omit<BuiltinFileProps, "id" | "description">
6
6
  /**
7
7
  * Generates utilities for detecting terminal color support.
8
8
  */
9
- declare function EnvSupportUtilities(): _alloy_js_core16.Children;
9
+ declare function EnvSupportUtilities(): _alloy_js_core4.Children;
10
10
  /**
11
11
  * Generates utilities for detecting terminal color support.
12
12
  */
13
- declare function ColorSupportUtilities(): _alloy_js_core16.Children;
13
+ declare function ColorSupportUtilities(): _alloy_js_core4.Children;
14
14
  /**
15
15
  * Generates utilities for detecting terminal color support.
16
16
  */
17
- declare function HyperlinkSupportUtilities(): _alloy_js_core16.Children;
17
+ declare function HyperlinkSupportUtilities(): _alloy_js_core4.Children;
18
18
  /**
19
19
  * Generates utilities for detecting terminal color support.
20
20
  */
21
- declare function ArgsUtilities(): _alloy_js_core16.Children;
21
+ declare function ArgsUtilities(): _alloy_js_core4.Children;
22
22
  /**
23
23
  * Generates the `spawn` function declaration, which is a cross-platform utility for spawning child processes with proper color support and environment variable handling.
24
24
  */
25
- declare function SpawnFunctionDeclaration(): _alloy_js_core16.Children;
26
- declare function ContextUtilities(): _alloy_js_core16.Children;
25
+ declare function SpawnFunctionDeclaration(): _alloy_js_core4.Children;
26
+ declare function ContextUtilities(): _alloy_js_core4.Children;
27
27
  /**
28
28
  * A built-in utilities module for Shell Shock.
29
29
  */
30
- declare function UtilsBuiltin(props: UtilsBuiltinProps): _alloy_js_core16.Children;
30
+ declare function UtilsBuiltin(props: UtilsBuiltinProps): _alloy_js_core4.Children;
31
31
  //#endregion
32
32
  export { ArgsUtilities, ColorSupportUtilities, ContextUtilities, EnvSupportUtilities, HyperlinkSupportUtilities, SpawnFunctionDeclaration, UtilsBuiltin, UtilsBuiltinProps };
33
33
  //# sourceMappingURL=utils-builtin.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"utils-builtin.d.cts","names":[],"sources":["../../src/components/utils-builtin.tsx"],"sourcesContent":[],"mappings":";;;;UAuCiB,iBAAA,SAA0B,KACzC;;AADF;AAQA;AAiCgB,iBAjCA,mBAAA,CAAA,CAiCqB,EAjCF,gBAAA,CAAA,QAiCE;AAsMrC;AA0GA;AA+EA;AAkTgB,iBAjrBA,qBAAA,CAAA,CAirBgB,EAjrBK,gBAAA,CAAA,QAirBL;AAsFhC;;;iBAjkBgB,yBAAA,CAAA,GAAyB,gBAAA,CAAA;;;;iBA0GzB,aAAA,CAAA,GAAa,gBAAA,CAAA;;;;iBA+Eb,wBAAA,CAAA,GAAwB,gBAAA,CAAA;iBAkTxB,gBAAA,CAAA,GAAgB,gBAAA,CAAA;;;;iBAsFhB,YAAA,QAAoB,oBAAiB,gBAAA,CAAA"}
1
+ {"version":3,"file":"utils-builtin.d.cts","names":[],"sources":["../../src/components/utils-builtin.tsx"],"sourcesContent":[],"mappings":";;;;UAuCiB,iBAAA,SAA0B,KACzC;;AADF;AAQA;AAiCgB,iBAjCA,mBAAA,CAAA,CAiCqB,EAjCF,eAAA,CAAA,QAiCE;AAsMrC;AA0GA;AA+EA;AAkTgB,iBAjrBA,qBAAA,CAAA,CAirBgB,EAjrBK,eAAA,CAAA,QAirBL;AAsFhC;;;iBAjkBgB,yBAAA,CAAA,GAAyB,eAAA,CAAA;;;;iBA0GzB,aAAA,CAAA,GAAa,eAAA,CAAA;;;;iBA+Eb,wBAAA,CAAA,GAAwB,eAAA,CAAA;iBAkTxB,gBAAA,CAAA,GAAgB,eAAA,CAAA;;;;iBAsFhB,YAAA,QAAoB,oBAAiB,eAAA,CAAA"}
@@ -633,7 +633,7 @@ function SpawnFunctionDeclaration() {
633
633
 
634
634
  try {
635
635
  const fd = openSync(normalized.file, "r");
636
- await read(fd, buffer, 0, 150, 0);
636
+ await promisify(read)(fd, buffer, 0, 150, 0);
637
637
  closeSync(fd);
638
638
  } catch (err) {
639
639
  // Do nothing
@@ -848,8 +848,13 @@ function UtilsBuiltin(props) {
848
848
  "posix",
849
849
  "sep"
850
850
  ],
851
- "node:fs": ["openSync", "closeSync"],
852
- "node:fs/promises": ["stat", "read"],
851
+ "node:fs": [
852
+ "openSync",
853
+ "closeSync",
854
+ "read"
855
+ ],
856
+ "node:fs/promises": ["stat"],
857
+ "node:util": ["promisify"],
853
858
  "node:child_process": [{
854
859
  name: "spawn",
855
860
  alias: "_spawn"
@@ -1 +1 @@
1
- {"version":3,"file":"utils-builtin.mjs","names":["code","Show","splitProps","FunctionDeclaration","InterfaceDeclaration","InterfaceMember","TypeDeclaration","VarDeclaration","Spacing","BuiltinFile","TSDoc","TSDocInternal","TSDocLink","TSDocParam","TSDocRemarks","TSDocReturns","defu","EnvSupportUtilities","_$createComponent","name","doc","initializer","ColorSupportUtilities","children","type","heading","parameters","default","HyperlinkSupportUtilities","returnType","ArgsUtilities","_$createIntrinsic","SpawnFunctionDeclaration","async","optional","ContextUtilities","UtilsBuiltin","props","rest","_$mergeProps","id","description","imports","alias","builtinImports","console","env","when","Boolean"],"sources":["../../src/components/utils-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 TypeDeclaration,\n VarDeclaration\n} from \"@alloy-js/typescript\";\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 TSDocInternal,\n TSDocLink,\n TSDocParam,\n TSDocRemarks,\n TSDocReturns\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport defu from \"defu\";\n\nexport interface UtilsBuiltinProps extends Omit<\n BuiltinFileProps,\n \"id\" | \"description\"\n> {}\n\n/**\n * Generates utilities for detecting terminal color support.\n */\nexport function EnvSupportUtilities() {\n return (\n <>\n <VarDeclaration\n export\n const\n name=\"isTTY\"\n doc=\"Detect if stdout.TTY is available\"\n initializer={code`Boolean(process.stdout && process.stdout.isTTY);`}\n />\n <Spacing />\n <VarDeclaration\n export\n const\n name=\"isMinimal\"\n doc=\"Detect if the current environment is minimal (CI, non-TTY, etc.)\"\n initializer={code` env.MINIMAL || isCI || isTest || !isTTY; `}\n />\n <Spacing />\n <VarDeclaration\n export\n const\n name=\"isInteractive\"\n doc=\"Detect if the current environment is interactive\"\n initializer={code` !isMinimal && process.stdin?.isTTY && env.TERM !== \"dumb\" && !hasFlag([\"no-interactive\", \"non-interactive\", \"no-interact\"]); `}\n />\n </>\n );\n}\n\n/**\n * Generates utilities for detecting terminal color support.\n */\nexport function ColorSupportUtilities() {\n return (\n <>\n <InterfaceDeclaration\n export\n name=\"GetColorSupportLevelOptions\"\n doc=\"Options for the getColorSupportLevel function\">\n <InterfaceMember\n name=\"ignoreFlags\"\n type=\"boolean\"\n doc=\"Indicates if the function should skip checking command-line flags for color support\"\n />\n </InterfaceDeclaration>\n <Spacing />\n <TSDoc heading=\"Checks if a specific flag is present in the command-line arguments.\">\n <TSDocLink>\n {\"https://github.com/sindresorhus/has-flag/blob/main/index.js\"}\n </TSDocLink>\n <TSDocParam name=\"flag\">\n {'The flag to check for, e.g., \"color\", \"no-color\".'}\n </TSDocParam>\n <TSDocParam name=\"argv\">\n {\n \"The command-line arguments to check against. Defaults to global Deno args or process args.\"\n }\n </TSDocParam>\n <TSDocReturns>\n {\"True if the flag is present, false otherwise.\"}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"getColorSupportLevel\"\n parameters={[\n { name: \"stream\", type: \"NodeJS.WriteStream & { fd: 1 | 2; }\" },\n {\n name: \"options\",\n type: \"GetColorSupportLevelOptions\",\n default: \"{ ignoreFlags: false }\"\n }\n ]}>\n {code`const { ignoreFlags } = options;\n\n let forceColor: number | undefined;\n if (env.FORCE_COLOR !== undefined) {\n forceColor = !env.FORCE_COLOR\n ? 0\n : typeof env.FORCE_COLOR === \"boolean\"\n ? 1\n : typeof env.FORCE_COLOR === \"number\" &&\n [0, 1, 2, 3].includes(Math.min(env.FORCE_COLOR as number, 3))\n ? Math.min(env.FORCE_COLOR as number, 3)\n : undefined;\n }\n\n if (ignoreFlags !== true && forceColor === undefined) {\n if (\n hasFlag(\"no-color\") ||\n hasFlag(\"no-colors\") ||\n hasFlag(\"color=false\") ||\n hasFlag(\"color=never\")\n ) {\n return 0;\n }\n\n if (\n hasFlag(\"color=16m\") ||\n hasFlag(\"color=full\") ||\n hasFlag(\"color=truecolor\")\n ) {\n return 3;\n }\n\n if (hasFlag(\"color=256\")) {\n return 2;\n }\n\n if (\n hasFlag(\"color\") ||\n hasFlag(\"colors\") ||\n hasFlag(\"color=true\") ||\n hasFlag(\"color=always\")\n ) {\n forceColor = 1;\n }\n }\n\n const level = Boolean(env.TF_BUILD) || Boolean(env.AGENT_NAME)\n ? 1\n : stream &&\n !(isTTY || (stream && stream.isTTY)) &&\n forceColor === undefined\n ? 0\n : env.TERM === \"dumb\"\n ? forceColor || 0\n : isWindows\n ? Number(os.release().split(\".\")[0]) >= 10 &&\n Number(os.release().split(\".\")[2]) >= 10_586\n ? Number(os.release().split(\".\")[2]) >= 14_931\n ? 3\n : 2\n : 1\n : isCI\n ? Boolean(env.GITHUB_ACTIONS) ||\n Boolean(env.GITEA_ACTIONS) ||\n Boolean(env.CIRCLECI)\n ? 3\n : Boolean(env.TRAVIS) ||\n Boolean(env.APPVEYOR) ||\n Boolean(env.GITLAB_CI) ||\n Boolean(env.BUILDKITE) ||\n Boolean(env.DRONE) ||\n env.CI_NAME === \"codeship\"\n ? 1\n : forceColor || 0\n : Boolean(env.TEAMCITY_VERSION)\n ? /^(?:9\\.0*[1-9]\\d*\\.|\\d{2,}\\.)/.test(String(env.TEAMCITY_VERSION) || \"\")\n ? 1\n : 0\n : String(env.COLORTERM) === \"truecolor\" ||\n env.TERM === \"xterm-kitty\"\n ? 3\n : Boolean(env.TERM_PROGRAM)\n ? env.TERM_PROGRAM === \"iTerm.app\"\n ? Number.parseInt(\n (env.TERM_PROGRAM_VERSION || \"\").split(\".\")[0] as string,\n 10\n ) >= 3\n ? 3\n : 2\n : env.TERM_PROGRAM === \"Apple_Terminal\"\n ? 2\n : 0\n : /-256(?:color)?$/i.test(env.TERM || \"\")\n ? 2\n : /^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(\n env.TERM || \"\"\n )\n ? 1\n : Boolean(env.COLORTERM);\n\n return typeof level === \"boolean\" || level === 0\n ? false\n : {\n level,\n hasBasic: true,\n has256: level >= 2,\n has16m: level >= 3,\n };\n\n `}\n </FunctionDeclaration>\n <Spacing />\n <VarDeclaration\n export\n const\n name=\"colorSupportLevels\"\n doc=\"Detect the terminal color support level in the current environment\"\n initializer={code` {\n stdout: getColorSupportLevel(process.stdout),\n stderr: getColorSupportLevel(process.stderr),\n }; `}\n />\n <Spacing />\n <VarDeclaration\n export\n const\n name=\"isColorSupported\"\n doc=\"Detect if terminal color is supported in the current environment\"\n initializer={code` Boolean(colorSupportLevels.stdout); `}\n />\n <Spacing />\n <VarDeclaration\n export\n const\n name=\"isUnicodeSupported\"\n doc=\"Detect if Unicode characters are supported in the current environment\"\n initializer={code` !isWindows\n ? env.TERM !== \"linux\"\n : Boolean(env.WT_SESSION) ||\n Boolean(env.TERMINUS_SUBLIME) ||\n env.ConEmuTask === \"{cmd::Cmder}\" ||\n env.TERM_PROGRAM === \"Terminus-Sublime\" ||\n env.TERM_PROGRAM === \"vscode\" ||\n env.TERM === \"xterm-256color\" ||\n env.TERM === \"alacritty\" ||\n env.TERM === \"rxvt-unicode\" ||\n env.TERM === \"rxvt-unicode-256color\" ||\n env.TERMINAL_EMULATOR === \"JetBrains-JediTerm\"; `}\n />\n </>\n );\n}\n\n/**\n * Generates utilities for detecting terminal color support.\n */\n\nexport function HyperlinkSupportUtilities() {\n return (\n <>\n <FunctionDeclaration\n name=\"parseVersion\"\n parameters={[{ name: \"version\", type: \"string\", default: '\"\"' }]}>\n {code`if (/^\\d{3,4}$/.test(version)) {\n const match = /(\\d{1,2})(\\d{2})/.exec(version) ?? [];\n\n return {\n major: 0,\n minor: Number.parseInt(match[1]!, 10),\n patch: Number.parseInt(match[2]!, 10)\n };\n }\n\n const versionParts = (version ?? \"\")\n .split(\".\")\n .map(n => Number.parseInt(n, 10));\n\n return {\n major: versionParts[0],\n minor: versionParts[1],\n patch: versionParts[2]\n }; `}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc heading=\"Check if the current environment/terminal supports hyperlinks in the terminal.\">\n <TSDocReturns>\n {\"True if the current environment/terminal supports hyperlinks.\"}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"isHyperlinkSupported\"\n returnType=\"boolean\">\n {code`if (Boolean(env.FORCE_HYPERLINK)) {\n return true;\n }\n\n if (Boolean(env.NETLIFY)) {\n return true;\n } else if (isColorSupported || isTTY) {\n return false;\n } else if (Boolean(env.WT_SESSION)) {\n return true;\n } else if (isWindows || isMinimal || Boolean(env.TEAMCITY_VERSION)) {\n return false;\n } else if (Boolean(env.TERM_PROGRAM)) {\n const version = parseVersion(env.TERM_PROGRAM_VERSION);\n\n switch (String(env.TERM_PROGRAM)) {\n case \"iTerm.app\": {\n if (version.major === 3) {\n return version.minor !== undefined && version.minor >= 1;\n }\n\n return version.major !== undefined && version.major > 3;\n }\n case \"WezTerm\": {\n return version.major !== undefined && version.major >= 20_200_620;\n }\n\n case \"vscode\": {\n if (Boolean(env.CURSOR_TRACE_ID)) {\n return true;\n }\n\n return (\n version.minor !== undefined &&\n version.major !== undefined &&\n (version.major > 1 || (version.major === 1 && version.minor >= 72))\n );\n }\n\n case \"ghostty\": {\n return true;\n }\n }\n }\n\n if (Boolean(env.VTE_VERSION)) {\n if (env.VTE_VERSION === \"0.50.0\") {\n return false;\n }\n\n const version = parseVersion(env.VTE_VERSION);\n return (\n (version.major !== undefined && version.major > 0) ||\n (version.minor !== undefined && version.minor >= 50)\n );\n }\n\n if (String(env.TERM) === \"alacritty\") {\n return true;\n }\n\n return false; `}\n </FunctionDeclaration>\n </>\n );\n}\n\n/**\n * Generates utilities for detecting terminal color support.\n */\nexport function ArgsUtilities() {\n return (\n <>\n <TSDoc heading=\"Retrieves the command-line arguments from Deno or Node.js environments.\">\n <TSDocRemarks>\n {\n \"This function is only intended for internal use. Please use `useArgs()` instead.\"\n }\n </TSDocRemarks>\n <hbr />\n <hbr />\n <TSDocInternal />\n <hbr />\n <hbr />\n <TSDocReturns>\n {\n \"An array of command-line arguments from Deno or Node.js environments.\"\n }\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration export name=\"getArgs\" returnType=\"string[]\">\n {code`return ((globalThis as { Deno?: { args: string[] } })?.Deno?.args ?? process.argv ?? []) as string[];`}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc heading=\"Checks if a specific flag is present in the command-line arguments.\">\n <TSDocLink>\n {\"https://github.com/sindresorhus/has-flag/blob/main/index.js\"}\n </TSDocLink>\n <TSDocParam name=\"flag\">\n {\n 'The flag (or an array of flags/aliases) to check for, e.g., \"color\", \"no-color\".'\n }\n </TSDocParam>\n <TSDocParam name=\"argv\">\n {\n \"The command-line arguments to check against. Defaults to global Deno args or process args.\"\n }\n </TSDocParam>\n <TSDocReturns>\n {\"True if the flag is present, false otherwise.\"}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"hasFlag\"\n parameters={[\n { name: \"flag\", type: \"string | string[]\" },\n {\n name: \"argv\",\n type: \"string[]\",\n default: \"useArgs()\"\n }\n ]}>\n <VarDeclaration\n const\n name=\"position\"\n type=\"number\"\n initializer={code`(Array.isArray(flag) ? flag : [flag]).reduce((ret, f) => {\n const pos = argv.findIndex(arg => (f.startsWith(\"-\") ? \"\" : (f.length === 1 ? \"-\" : \"--\") + f)?.toLowerCase() === arg?.toLowerCase() || arg?.toLowerCase().startsWith((f.length === 1 ? \"-\" : \"--\") + f + \"=\"));\n return pos !== -1 ? pos : ret;\n }, -1);`}\n />\n <hbr />\n {code`return position !== -1 && argv.indexOf(\"--\") === -1 || position < argv.indexOf(\"--\");`}\n </FunctionDeclaration>\n <Spacing />\n <VarDeclaration\n export\n name=\"isHelp\"\n type=\"boolean\"\n initializer={code` !isCI && hasFlag([\"help\", \"h\", \"?\"]); `}\n />\n </>\n );\n}\n\n/**\n * Generates the `spawn` function declaration, which is a cross-platform utility for spawning child processes with proper color support and environment variable handling.\n */\nexport function SpawnFunctionDeclaration() {\n return (\n <>\n <FunctionDeclaration\n async\n name=\"resolveCommand\"\n parameters={[\n {\n name: \"command\",\n type: \"string\"\n },\n {\n name: \"options\",\n type: \"Record<string, any>\",\n default: \"{}\"\n },\n {\n name: \"pathExt\",\n type: \"string\",\n default:\n 'process.env.PATHEXT || [\".EXE\", \".CMD\", \".BAT\", \".COM\"].join(delimiter)'\n }\n ]}>\n {code`const env = options.env || process.env;\n const cwd = process.cwd();\n if (!!options.cwd && process.chdir !== undefined && !(process.chdir as any).disabled) {\n try {\n process.chdir(options.cwd);\n } catch (err) {\n // Do nothing\n }\n }\n\n let resolved;\n try {\n let extensions = [\"\"];\n if (isWindows) {\n extensions = pathExt.split(delimiter).flatMap((item) => [item, item.toLowerCase()]);\n if (command.includes(\".\") && extensions[0] !== \"\") {\n extensions.unshift(\"\");\n }\n }\n\n for (const envPart of (command.match(new RegExp(\\`[\\${posix.sep}\\${sep === posix.sep ? \"\" : sep}]\\`.replace(/(\\\\\\\\)/g, \"\\\\\\\\$1\"))))\n ? [...(isWindows ? [process.cwd()] : []), ...(process.env.PATH || \"\").split(delimiter)]\n : [\"\"]\n ) {\n const part = \\`\\${!(/^\".*\"$/.test(envPart) ? envPart.slice(1, -1) : envPart) && new RegExp(\\`^\\\\.\\${new RegExp(\\`[\\${posix.sep}\\${sep === posix.sep ? \"\" : sep}]\\`.replace(/(\\\\\\\\)/g, \"\\\\\\\\$1\")).source}\\`).test(command) ? command.slice(0, 2) : \"\"}\\${join(/^\".*\"$/.test(envPart) ? envPart.slice(1, -1) : envPart, command)}\\`;\n for (const extension of extensions) {\n if (isWindows) {\n const filePath = part + extension;\n if ((await stat(filePath)).isFile() && extensions.some((ext) => filePath.substring(filePath.length - ext.length).toLowerCase() === ext.toLowerCase())) {\n resolved = filePath;\n break;\n }\n } else {\n const file = await stat(part + extension);\n if (file.isFile() && (file.mode & 0o111) !== 0) {\n resolved = part + extension;\n break;\n }\n }\n }\n }\n } catch (err) {\n // Do nothing\n } finally {\n if (!!options.cwd && process.chdir !== undefined && !(process.chdir as any).disabled) {\n process.chdir(cwd);\n }\n }\n\n\n if (resolved) {\n resolved = resolve(\n options.cwd ? options.cwd : \"\",\n resolved\n );\n }\n\n return resolved; `}\n </FunctionDeclaration>\n <Spacing />\n <InterfaceDeclaration\n name=\"SpawnBaseOptions\"\n doc=\"Options for the `spawn` handler function.\">\n <InterfaceMember\n name=\"stdout\"\n optional\n type=\"(data: string) => void\"\n doc=\"The writable stream to use for prompt output, defaults to process.stdout\"\n />\n <hbr />\n <InterfaceMember\n name=\"stderr\"\n optional\n type=\"(data: string) => void\"\n doc=\"The writable stream to use for prompt error output, defaults to process.stderr\"\n />\n <hbr />\n <InterfaceMember\n name=\"rejectOnError\"\n optional\n type=\"boolean\"\n doc=\"Whether to reject the promise on error. Defaults to false.\"\n />\n <hbr />\n <InterfaceMember\n name=\"file\"\n optional\n type=\"string\"\n doc=\"The file to execute.\"\n />\n <hbr />\n <InterfaceMember\n name=\"shell\"\n optional\n type=\"boolean | string\"\n doc=\"If true, runs command inside of a shell. Uses '/bin/sh' on UNIX, and process.env.ComSpec on Windows. If a string is provided, it specifies the shell to use.\"\n />\n <hbr />\n <InterfaceMember\n name=\"forceShell\"\n optional\n type=\"boolean\"\n doc=\"If true, forces the command to run inside of a shell, even if the command is a file.\"\n />\n </InterfaceDeclaration>\n <Spacing />\n <TypeDeclaration export name=\"SpawnOptions\">\n {code`SpawnBaseOptions & Parameters<typeof _spawn>[1]`}\n </TypeDeclaration>\n <Spacing />\n <TSDoc heading=\"A function to spawn child processes with proper color support and environment variable handling.\">\n <TSDocParam name=\"command\">{`The command to execute.`}</TSDocParam>\n <TSDocParam name=\"args\">\n {`The command-line arguments to pass to the command. Defaults to an empty array.`}\n </TSDocParam>\n <TSDocParam name=\"options\">\n {`Additional options for spawning the process, such as the current working directory (\\`cwd\\`).`}\n </TSDocParam>\n <TSDocReturns>{`The result of the spawned process.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n async\n name=\"spawn\"\n parameters={[\n { name: \"command\", type: \"string\" },\n {\n name: \"args\",\n type: \"string[] | SpawnOptions\",\n default: \"{} as SpawnOptions\"\n },\n {\n name: \"options\",\n type: \"SpawnOptions\",\n default: \"{} as SpawnOptions\"\n }\n ]}>\n {code`const normalized = {\n command,\n args: [] as string[],\n options: options as SpawnOptions | any,\n file: undefined as string | undefined,\n original: {\n command,\n args,\n },\n };\n\n if (args) {\n if (Array.isArray(args)) {\n if (args.length > 0) {\n normalized.args = args.slice(0);\n }\n } else {\n normalized.options = { ...args } as SpawnOptions | any;\n normalized.args = [];\n }\n }\n\n if (!normalized.options.shell && isWindows) {\n normalized.file = (await resolveCommand(normalized.command, normalized.options)) || (await resolveCommand(normalized.command, normalized.options, delimiter));\n\n let commandFile = normalized.file;\n if (normalized.file) {\n let shebang: string | undefined;\n const buffer = Buffer.alloc(150);\n\n try {\n const fd = openSync(normalized.file, \"r\");\n await read(fd, buffer, 0, 150, 0);\n closeSync(fd);\n } catch (err) {\n // Do nothing\n }\n\n const matched = buffer.toString().match(/^#!(.*)/);\n if (matched) {\n const [path, argument] = matched[0].replace(/#! ?/, \"\").split(\" \");\n\t const binary = path.split(\"/\").pop();\n if (binary === \"env\") {\n shebang = argument;\n } else {\n shebang = argument ? \\`\\${binary} \\${argument}\\` : binary;\n }\n }\n\n if (shebang) {\n normalized.args.unshift(normalized.file);\n normalized.command = shebang;\n\n commandFile = await resolveCommand(normalized.command, normalized.options);\n }\n }\n\n if (commandFile && (normalized.options.forceShell || /\\\\.(?:com|exe)$/i.test(commandFile))) {\n normalized.command = normalize(normalized.command).replace(/([()\\\\][%!^\"\\`<>&|;, *?])/g, \"^$1\");\n\n normalized.args = [\"/d\", \"/s\", \"/c\", \\`\"\\${normalized.command} \\${normalized.args.map(arg =>\n \\`\\${arg}\\`.replace(/(?=(\\\\\\\\+?)?)\\\\1\"/g, \"$1$1\\\\\"\").replace(/(?=(\\\\\\\\+?)?)\\\\1$/, \"$1$1\")\n ).map(arg =>\n \\`\"\\${arg}\"\\`.replace(/([()\\\\][%!^\"\\`<>&|;, *?])/g, \"^$1\")\n ).map(arg =>\n /node_modules[\\\\\\\\/].bin[\\\\\\\\/][^\\\\\\\\/]+\\\\.cmd$/i.test(commandFile) ? arg.replace(/([()\\\\][%!^\"\\`<>&|;, *?])/g, \"^$1\") : arg\n ).join(\" \")}\"\\`];\n normalized.command = process.env.comspec || \"cmd.exe\";\n normalized.options.windowsVerbatimArguments = true;\n }\n }\n\n let stdout = \"\";\n let stderr = \"\";\n\n const child = _spawn(normalized.command, normalized.args, {\n cwd: process.cwd(),\n env: {\n ...process.env,\n FORCE_COLOR: isColorSupported ? \"1\" : \"0\",\n },\n ...normalized.options,\n }) as ReturnType<typeof _spawn>;\n\n if (isWindows) {\n const emit = child.emit;\n child.emit = (eventName: string | symbol, ...eventArgs: any[]) => {\n if (eventName === \"exit\") {\n let err: Error | null = null;\n if (eventArgs[0] === 1 && !normalized.file) {\n err = Object.assign(new Error(\\`spawn \\${normalized.original.command} ENOENT\\`), {\n code: \"ENOENT\",\n errno: \"ENOENT\",\n syscall: \\`spawn \\${normalized.original.command}\\`,\n path: normalized.original.command,\n spawnargs: normalized.original.args,\n });\n }\n\n if (err) {\n return emit.call(child, \"error\", err);\n }\n }\n\n return emit.apply(child, [eventName, ...eventArgs]);\n };\n }\n\n return new Promise((resolve, reject) => {\n if (normalized.options.stdin !== undefined) {\n child.stdin?.write(normalized.options.stdin);\n }\n\n child.stdin?.end();\n\n child.stdout?.on(\"data\", data => {\n stdout += data;\n if (normalized.options.stdout) {\n normalized.options.stdout(data);\n }\n });\n\n child.stderr?.on(\"data\", data => {\n stderr += data;\n if (normalized.options.stderr) {\n normalized.options.stderr(data);\n }\n });\n\n if (normalized.options.rejectOnError) {\n child.addListener(\"error\", reject);\n }\n\n child.on(\"close\", code => {\n if (code !== 0 && normalized.options.rejectOnError) {\n reject(stderr);\n } else {\n resolve({ stdout, stderr });\n }\n });\n }); `}\n </FunctionDeclaration>\n </>\n );\n}\n\nexport function ContextUtilities() {\n return code`\n /**\n * The global Shell Shock - Application context instance.\n *\n * @internal\n */\n export let internal_appContext = new AsyncLocalStorage<Map<string, any>>();\n\n /**\n * Get the Shell Shock - Application context for the current application.\n *\n * @param options - The options to use when getting the context.\n * @returns The Shell Shock - Application context for the current application or undefined if the context is not available.\n */\n export function useApp(): Map<string, any> | undefined {\n return internal_appContext.getStore();\n }\n\n /**\n * A utility hook function to get the command line arguments from the application context.\n *\n * @returns An array of command-line arguments from the application context.\n * @throws If the application context is not available.\n */\n export function useArgs(): string[] {\n return useApp()?.get(\"args\") ?? getArgs();\n }\n\n /**\n * The context object for the current command execution, containing the command path and segments.\n */\n export interface CommandContext {\n path: string;\n segments: string[];\n }\n\n /**\n * The global Shell Shock - Command context instance.\n *\n * @internal\n */\n export let internal_commandContext = new AsyncLocalStorage<CommandContext>();\n\n /**\n * Get the Shell Shock - Command context for the current application.\n *\n * @param options - The options to use when getting the context.\n * @returns The Shell Shock - Command context for the current application.\n * @throws If the Shell Shock - Command context is not available.\n */\n export function useCommand(): CommandContext {\n const result = internal_commandContext.getStore();\n if (!result) {\n throw new Error(\n \\`The Shell Shock - Command context is not available. Make sure to call useCommand() within a valid context scope.\\`\n );\n }\n return result;\n }\n\n /**\n * A utility hook function to get the individual segments of the current command path.\n *\n * @returns An array of command path segments.\n * @throws If the command context is not available.\n */\n export function useSegments(): string[] {\n return useCommand().segments;\n }\n\n /**\n * A utility hook function to get the full command path as a string.\n *\n * @returns The full command path as a string.\n * @throws If the command context is not available.\n */\n export function usePath(): string {\n return useCommand().path;\n }\n `;\n}\n\n/**\n * A built-in utilities module for Shell Shock.\n */\nexport function UtilsBuiltin(props: UtilsBuiltinProps) {\n const [{ children }, rest] = splitProps(props, [\"children\"]);\n\n return (\n <BuiltinFile\n id=\"utils\"\n description=\"A collection of helper utilities that ease command-line application development.\"\n {...rest}\n imports={defu(rest.imports ?? {}, {\n \"node:os\": \"os\",\n \"node:process\": \"process\",\n \"node:path\": [\n \"resolve\",\n \"delimiter\",\n \"normalize\",\n \"join\",\n \"posix\",\n \"sep\"\n ],\n \"node:fs\": [\"openSync\", \"closeSync\"],\n \"node:fs/promises\": [\"stat\", \"read\"],\n \"node:child_process\": [{ name: \"spawn\", alias: \"_spawn\" }],\n \"node:async_hooks\": [\"AsyncLocalStorage\"]\n })}\n builtinImports={defu(rest.builtinImports ?? {}, {\n console: [\"error\", \"verbose\", \"writeLine\"],\n env: [\"env\", \"isCI\", \"isTest\", \"isWindows\", \"isDevelopment\", \"isDebug\"]\n })}>\n <Spacing />\n <ContextUtilities />\n <Spacing />\n <ArgsUtilities />\n <Spacing />\n <EnvSupportUtilities />\n <Spacing />\n <HyperlinkSupportUtilities />\n <Spacing />\n <ColorSupportUtilities />\n <Spacing />\n <SpawnFunctionDeclaration />\n <Spacing />\n <Show when={Boolean(children)}>{children}</Show>\n </BuiltinFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;AA+CA,SAAgBiB,sBAAsB;AACpC,QAAA;EAAAC,gBAEKX,gBAAc;GAAA,UAAA;GAAA,SAAA;GAGbY,MAAI;GACJC,KAAG;GACHC,aAAarB,IAAI;GAAkD,CAAA;EAAAkB,gBAEpEV,SAAO,EAAA,CAAA;EAAAU,gBACPX,gBAAc;GAAA,UAAA;GAAA,SAAA;GAGbY,MAAI;GACJC,KAAG;GACHC,aAAarB,IAAI;GAA4C,CAAA;EAAAkB,gBAE9DV,SAAO,EAAA,CAAA;EAAAU,gBACPX,gBAAc;GAAA,UAAA;GAAA,SAAA;GAGbY,MAAI;GACJC,KAAG;GACHC,aAAarB,IAAI;GAAgI,CAAA;EAAA;;;;;AASzJ,SAAgBsB,wBAAwB;AACtC,QAAA;EAAAJ,gBAEKd,sBAAoB;GAAA,UAAA;GAEnBe,MAAI;GACJC,KAAG;GAAA,IAAAG,WAAA;AAAA,WAAAL,gBACFb,iBAAe;KACdc,MAAI;KACJK,MAAI;KACJJ,KAAG;KAAA,CAAA;;GAAA,CAAA;EAAAF,gBAGNV,SAAO,EAAA,CAAA;EAAAU,gBACPR,OAAK;GAACe,SAAO;GAAA,IAAAF,WAAA;AAAA,WAAA;KAAAL,gBACXN,WAAS,EAAAW,UACP,+DAA6D,CAAA;KAAAL,gBAE/DL,YAAU;MAACM,MAAI;MAAAI,UACb;MAAmD,CAAA;KAAAL,gBAErDL,YAAU;MAACM,MAAI;MAAAI,UAEZ;MAA4F,CAAA;KAAAL,gBAG/FH,cAAY,EAAAQ,UACV,iDAA+C,CAAA;KAAA;;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T,aAAW8B,WAAA;EACVC,IAAE;EACFC,aAAW;EAAA,EACPH,MAAI;EAAA,IACRI,UAAO;AAAA,UAAE1B,OAAKsB,KAAKI,WAAW,EAAE,EAAE;IAChC,WAAW;IACX,gBAAgB;IAChB,aAAa;KACX;KACA;KACA;KACA;KACA;KACA;KACD;IACD,WAAW,CAAC,YAAY,YAAY;IACpC,oBAAoB,CAAC,QAAQ,OAAO;IACpC,sBAAsB,CAAC;KAAEvB,MAAM;KAASwB,OAAO;KAAU,CAAC;IAC1D,oBAAoB,CAAC,oBAAmB;IACzC,CAAC;;EAAA,IACFC,iBAAc;AAAA,UAAE5B,OAAKsB,KAAKM,kBAAkB,EAAE,EAAE;IAC9CC,SAAS;KAAC;KAAS;KAAW;KAAY;IAC1CC,KAAK;KAAC;KAAO;KAAQ;KAAU;KAAa;KAAiB;KAAS;IACvE,CAAC;;EAAA,IAAAvB,WAAA;AAAA,UAAA;IAAAL,gBACDV,SAAO,EAAA,CAAA;IAAAU,gBACPiB,kBAAgB,EAAA,CAAA;IAAAjB,gBAChBV,SAAO,EAAA,CAAA;IAAAU,gBACPY,eAAa,EAAA,CAAA;IAAAZ,gBACbV,SAAO,EAAA,CAAA;IAAAU,gBACPD,qBAAmB,EAAA,CAAA;IAAAC,gBACnBV,SAAO,EAAA,CAAA;IAAAU,gBACPU,2BAAyB,EAAA,CAAA;IAAAV,gBACzBV,SAAO,EAAA,CAAA;IAAAU,gBACPI,uBAAqB,EAAA,CAAA;IAAAJ,gBACrBV,SAAO,EAAA,CAAA;IAAAU,gBACPc,0BAAwB,EAAA,CAAA;IAAAd,gBACxBV,SAAO,EAAA,CAAA;IAAAU,gBACPjB,MAAI;KAAA,IAAC8C,OAAI;AAAA,aAAEC,QAAQzB,SAAS;;KAAGA;KAAQ,CAAA;IAAA;;EAAA,CAAA,CAAA"}
1
+ {"version":3,"file":"utils-builtin.mjs","names":["code","Show","splitProps","FunctionDeclaration","InterfaceDeclaration","InterfaceMember","TypeDeclaration","VarDeclaration","Spacing","BuiltinFile","TSDoc","TSDocInternal","TSDocLink","TSDocParam","TSDocRemarks","TSDocReturns","defu","EnvSupportUtilities","_$createComponent","name","doc","initializer","ColorSupportUtilities","children","type","heading","parameters","default","HyperlinkSupportUtilities","returnType","ArgsUtilities","_$createIntrinsic","SpawnFunctionDeclaration","async","optional","ContextUtilities","UtilsBuiltin","props","rest","_$mergeProps","id","description","imports","alias","builtinImports","console","env","when","Boolean"],"sources":["../../src/components/utils-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 TypeDeclaration,\n VarDeclaration\n} from \"@alloy-js/typescript\";\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 TSDocInternal,\n TSDocLink,\n TSDocParam,\n TSDocRemarks,\n TSDocReturns\n} from \"@powerlines/plugin-alloy/typescript/components/tsdoc\";\nimport defu from \"defu\";\n\nexport interface UtilsBuiltinProps extends Omit<\n BuiltinFileProps,\n \"id\" | \"description\"\n> {}\n\n/**\n * Generates utilities for detecting terminal color support.\n */\nexport function EnvSupportUtilities() {\n return (\n <>\n <VarDeclaration\n export\n const\n name=\"isTTY\"\n doc=\"Detect if stdout.TTY is available\"\n initializer={code`Boolean(process.stdout && process.stdout.isTTY);`}\n />\n <Spacing />\n <VarDeclaration\n export\n const\n name=\"isMinimal\"\n doc=\"Detect if the current environment is minimal (CI, non-TTY, etc.)\"\n initializer={code` env.MINIMAL || isCI || isTest || !isTTY; `}\n />\n <Spacing />\n <VarDeclaration\n export\n const\n name=\"isInteractive\"\n doc=\"Detect if the current environment is interactive\"\n initializer={code` !isMinimal && process.stdin?.isTTY && env.TERM !== \"dumb\" && !hasFlag([\"no-interactive\", \"non-interactive\", \"no-interact\"]); `}\n />\n </>\n );\n}\n\n/**\n * Generates utilities for detecting terminal color support.\n */\nexport function ColorSupportUtilities() {\n return (\n <>\n <InterfaceDeclaration\n export\n name=\"GetColorSupportLevelOptions\"\n doc=\"Options for the getColorSupportLevel function\">\n <InterfaceMember\n name=\"ignoreFlags\"\n type=\"boolean\"\n doc=\"Indicates if the function should skip checking command-line flags for color support\"\n />\n </InterfaceDeclaration>\n <Spacing />\n <TSDoc heading=\"Checks if a specific flag is present in the command-line arguments.\">\n <TSDocLink>\n {\"https://github.com/sindresorhus/has-flag/blob/main/index.js\"}\n </TSDocLink>\n <TSDocParam name=\"flag\">\n {'The flag to check for, e.g., \"color\", \"no-color\".'}\n </TSDocParam>\n <TSDocParam name=\"argv\">\n {\n \"The command-line arguments to check against. Defaults to global Deno args or process args.\"\n }\n </TSDocParam>\n <TSDocReturns>\n {\"True if the flag is present, false otherwise.\"}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"getColorSupportLevel\"\n parameters={[\n { name: \"stream\", type: \"NodeJS.WriteStream & { fd: 1 | 2; }\" },\n {\n name: \"options\",\n type: \"GetColorSupportLevelOptions\",\n default: \"{ ignoreFlags: false }\"\n }\n ]}>\n {code`const { ignoreFlags } = options;\n\n let forceColor: number | undefined;\n if (env.FORCE_COLOR !== undefined) {\n forceColor = !env.FORCE_COLOR\n ? 0\n : typeof env.FORCE_COLOR === \"boolean\"\n ? 1\n : typeof env.FORCE_COLOR === \"number\" &&\n [0, 1, 2, 3].includes(Math.min(env.FORCE_COLOR as number, 3))\n ? Math.min(env.FORCE_COLOR as number, 3)\n : undefined;\n }\n\n if (ignoreFlags !== true && forceColor === undefined) {\n if (\n hasFlag(\"no-color\") ||\n hasFlag(\"no-colors\") ||\n hasFlag(\"color=false\") ||\n hasFlag(\"color=never\")\n ) {\n return 0;\n }\n\n if (\n hasFlag(\"color=16m\") ||\n hasFlag(\"color=full\") ||\n hasFlag(\"color=truecolor\")\n ) {\n return 3;\n }\n\n if (hasFlag(\"color=256\")) {\n return 2;\n }\n\n if (\n hasFlag(\"color\") ||\n hasFlag(\"colors\") ||\n hasFlag(\"color=true\") ||\n hasFlag(\"color=always\")\n ) {\n forceColor = 1;\n }\n }\n\n const level = Boolean(env.TF_BUILD) || Boolean(env.AGENT_NAME)\n ? 1\n : stream &&\n !(isTTY || (stream && stream.isTTY)) &&\n forceColor === undefined\n ? 0\n : env.TERM === \"dumb\"\n ? forceColor || 0\n : isWindows\n ? Number(os.release().split(\".\")[0]) >= 10 &&\n Number(os.release().split(\".\")[2]) >= 10_586\n ? Number(os.release().split(\".\")[2]) >= 14_931\n ? 3\n : 2\n : 1\n : isCI\n ? Boolean(env.GITHUB_ACTIONS) ||\n Boolean(env.GITEA_ACTIONS) ||\n Boolean(env.CIRCLECI)\n ? 3\n : Boolean(env.TRAVIS) ||\n Boolean(env.APPVEYOR) ||\n Boolean(env.GITLAB_CI) ||\n Boolean(env.BUILDKITE) ||\n Boolean(env.DRONE) ||\n env.CI_NAME === \"codeship\"\n ? 1\n : forceColor || 0\n : Boolean(env.TEAMCITY_VERSION)\n ? /^(?:9\\.0*[1-9]\\d*\\.|\\d{2,}\\.)/.test(String(env.TEAMCITY_VERSION) || \"\")\n ? 1\n : 0\n : String(env.COLORTERM) === \"truecolor\" ||\n env.TERM === \"xterm-kitty\"\n ? 3\n : Boolean(env.TERM_PROGRAM)\n ? env.TERM_PROGRAM === \"iTerm.app\"\n ? Number.parseInt(\n (env.TERM_PROGRAM_VERSION || \"\").split(\".\")[0] as string,\n 10\n ) >= 3\n ? 3\n : 2\n : env.TERM_PROGRAM === \"Apple_Terminal\"\n ? 2\n : 0\n : /-256(?:color)?$/i.test(env.TERM || \"\")\n ? 2\n : /^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(\n env.TERM || \"\"\n )\n ? 1\n : Boolean(env.COLORTERM);\n\n return typeof level === \"boolean\" || level === 0\n ? false\n : {\n level,\n hasBasic: true,\n has256: level >= 2,\n has16m: level >= 3,\n };\n\n `}\n </FunctionDeclaration>\n <Spacing />\n <VarDeclaration\n export\n const\n name=\"colorSupportLevels\"\n doc=\"Detect the terminal color support level in the current environment\"\n initializer={code` {\n stdout: getColorSupportLevel(process.stdout),\n stderr: getColorSupportLevel(process.stderr),\n }; `}\n />\n <Spacing />\n <VarDeclaration\n export\n const\n name=\"isColorSupported\"\n doc=\"Detect if terminal color is supported in the current environment\"\n initializer={code` Boolean(colorSupportLevels.stdout); `}\n />\n <Spacing />\n <VarDeclaration\n export\n const\n name=\"isUnicodeSupported\"\n doc=\"Detect if Unicode characters are supported in the current environment\"\n initializer={code` !isWindows\n ? env.TERM !== \"linux\"\n : Boolean(env.WT_SESSION) ||\n Boolean(env.TERMINUS_SUBLIME) ||\n env.ConEmuTask === \"{cmd::Cmder}\" ||\n env.TERM_PROGRAM === \"Terminus-Sublime\" ||\n env.TERM_PROGRAM === \"vscode\" ||\n env.TERM === \"xterm-256color\" ||\n env.TERM === \"alacritty\" ||\n env.TERM === \"rxvt-unicode\" ||\n env.TERM === \"rxvt-unicode-256color\" ||\n env.TERMINAL_EMULATOR === \"JetBrains-JediTerm\"; `}\n />\n </>\n );\n}\n\n/**\n * Generates utilities for detecting terminal color support.\n */\n\nexport function HyperlinkSupportUtilities() {\n return (\n <>\n <FunctionDeclaration\n name=\"parseVersion\"\n parameters={[{ name: \"version\", type: \"string\", default: '\"\"' }]}>\n {code`if (/^\\d{3,4}$/.test(version)) {\n const match = /(\\d{1,2})(\\d{2})/.exec(version) ?? [];\n\n return {\n major: 0,\n minor: Number.parseInt(match[1]!, 10),\n patch: Number.parseInt(match[2]!, 10)\n };\n }\n\n const versionParts = (version ?? \"\")\n .split(\".\")\n .map(n => Number.parseInt(n, 10));\n\n return {\n major: versionParts[0],\n minor: versionParts[1],\n patch: versionParts[2]\n }; `}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc heading=\"Check if the current environment/terminal supports hyperlinks in the terminal.\">\n <TSDocReturns>\n {\"True if the current environment/terminal supports hyperlinks.\"}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"isHyperlinkSupported\"\n returnType=\"boolean\">\n {code`if (Boolean(env.FORCE_HYPERLINK)) {\n return true;\n }\n\n if (Boolean(env.NETLIFY)) {\n return true;\n } else if (isColorSupported || isTTY) {\n return false;\n } else if (Boolean(env.WT_SESSION)) {\n return true;\n } else if (isWindows || isMinimal || Boolean(env.TEAMCITY_VERSION)) {\n return false;\n } else if (Boolean(env.TERM_PROGRAM)) {\n const version = parseVersion(env.TERM_PROGRAM_VERSION);\n\n switch (String(env.TERM_PROGRAM)) {\n case \"iTerm.app\": {\n if (version.major === 3) {\n return version.minor !== undefined && version.minor >= 1;\n }\n\n return version.major !== undefined && version.major > 3;\n }\n case \"WezTerm\": {\n return version.major !== undefined && version.major >= 20_200_620;\n }\n\n case \"vscode\": {\n if (Boolean(env.CURSOR_TRACE_ID)) {\n return true;\n }\n\n return (\n version.minor !== undefined &&\n version.major !== undefined &&\n (version.major > 1 || (version.major === 1 && version.minor >= 72))\n );\n }\n\n case \"ghostty\": {\n return true;\n }\n }\n }\n\n if (Boolean(env.VTE_VERSION)) {\n if (env.VTE_VERSION === \"0.50.0\") {\n return false;\n }\n\n const version = parseVersion(env.VTE_VERSION);\n return (\n (version.major !== undefined && version.major > 0) ||\n (version.minor !== undefined && version.minor >= 50)\n );\n }\n\n if (String(env.TERM) === \"alacritty\") {\n return true;\n }\n\n return false; `}\n </FunctionDeclaration>\n </>\n );\n}\n\n/**\n * Generates utilities for detecting terminal color support.\n */\nexport function ArgsUtilities() {\n return (\n <>\n <TSDoc heading=\"Retrieves the command-line arguments from Deno or Node.js environments.\">\n <TSDocRemarks>\n {\n \"This function is only intended for internal use. Please use `useArgs()` instead.\"\n }\n </TSDocRemarks>\n <hbr />\n <hbr />\n <TSDocInternal />\n <hbr />\n <hbr />\n <TSDocReturns>\n {\n \"An array of command-line arguments from Deno or Node.js environments.\"\n }\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration export name=\"getArgs\" returnType=\"string[]\">\n {code`return ((globalThis as { Deno?: { args: string[] } })?.Deno?.args ?? process.argv ?? []) as string[];`}\n </FunctionDeclaration>\n <Spacing />\n <TSDoc heading=\"Checks if a specific flag is present in the command-line arguments.\">\n <TSDocLink>\n {\"https://github.com/sindresorhus/has-flag/blob/main/index.js\"}\n </TSDocLink>\n <TSDocParam name=\"flag\">\n {\n 'The flag (or an array of flags/aliases) to check for, e.g., \"color\", \"no-color\".'\n }\n </TSDocParam>\n <TSDocParam name=\"argv\">\n {\n \"The command-line arguments to check against. Defaults to global Deno args or process args.\"\n }\n </TSDocParam>\n <TSDocReturns>\n {\"True if the flag is present, false otherwise.\"}\n </TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n name=\"hasFlag\"\n parameters={[\n { name: \"flag\", type: \"string | string[]\" },\n {\n name: \"argv\",\n type: \"string[]\",\n default: \"useArgs()\"\n }\n ]}>\n <VarDeclaration\n const\n name=\"position\"\n type=\"number\"\n initializer={code`(Array.isArray(flag) ? flag : [flag]).reduce((ret, f) => {\n const pos = argv.findIndex(arg => (f.startsWith(\"-\") ? \"\" : (f.length === 1 ? \"-\" : \"--\") + f)?.toLowerCase() === arg?.toLowerCase() || arg?.toLowerCase().startsWith((f.length === 1 ? \"-\" : \"--\") + f + \"=\"));\n return pos !== -1 ? pos : ret;\n }, -1);`}\n />\n <hbr />\n {code`return position !== -1 && argv.indexOf(\"--\") === -1 || position < argv.indexOf(\"--\");`}\n </FunctionDeclaration>\n <Spacing />\n <VarDeclaration\n export\n name=\"isHelp\"\n type=\"boolean\"\n initializer={code` !isCI && hasFlag([\"help\", \"h\", \"?\"]); `}\n />\n </>\n );\n}\n\n/**\n * Generates the `spawn` function declaration, which is a cross-platform utility for spawning child processes with proper color support and environment variable handling.\n */\nexport function SpawnFunctionDeclaration() {\n return (\n <>\n <FunctionDeclaration\n async\n name=\"resolveCommand\"\n parameters={[\n {\n name: \"command\",\n type: \"string\"\n },\n {\n name: \"options\",\n type: \"Record<string, any>\",\n default: \"{}\"\n },\n {\n name: \"pathExt\",\n type: \"string\",\n default:\n 'process.env.PATHEXT || [\".EXE\", \".CMD\", \".BAT\", \".COM\"].join(delimiter)'\n }\n ]}>\n {code`const env = options.env || process.env;\n const cwd = process.cwd();\n if (!!options.cwd && process.chdir !== undefined && !(process.chdir as any).disabled) {\n try {\n process.chdir(options.cwd);\n } catch (err) {\n // Do nothing\n }\n }\n\n let resolved;\n try {\n let extensions = [\"\"];\n if (isWindows) {\n extensions = pathExt.split(delimiter).flatMap((item) => [item, item.toLowerCase()]);\n if (command.includes(\".\") && extensions[0] !== \"\") {\n extensions.unshift(\"\");\n }\n }\n\n for (const envPart of (command.match(new RegExp(\\`[\\${posix.sep}\\${sep === posix.sep ? \"\" : sep}]\\`.replace(/(\\\\\\\\)/g, \"\\\\\\\\$1\"))))\n ? [...(isWindows ? [process.cwd()] : []), ...(process.env.PATH || \"\").split(delimiter)]\n : [\"\"]\n ) {\n const part = \\`\\${!(/^\".*\"$/.test(envPart) ? envPart.slice(1, -1) : envPart) && new RegExp(\\`^\\\\.\\${new RegExp(\\`[\\${posix.sep}\\${sep === posix.sep ? \"\" : sep}]\\`.replace(/(\\\\\\\\)/g, \"\\\\\\\\$1\")).source}\\`).test(command) ? command.slice(0, 2) : \"\"}\\${join(/^\".*\"$/.test(envPart) ? envPart.slice(1, -1) : envPart, command)}\\`;\n for (const extension of extensions) {\n if (isWindows) {\n const filePath = part + extension;\n if ((await stat(filePath)).isFile() && extensions.some((ext) => filePath.substring(filePath.length - ext.length).toLowerCase() === ext.toLowerCase())) {\n resolved = filePath;\n break;\n }\n } else {\n const file = await stat(part + extension);\n if (file.isFile() && (file.mode & 0o111) !== 0) {\n resolved = part + extension;\n break;\n }\n }\n }\n }\n } catch (err) {\n // Do nothing\n } finally {\n if (!!options.cwd && process.chdir !== undefined && !(process.chdir as any).disabled) {\n process.chdir(cwd);\n }\n }\n\n\n if (resolved) {\n resolved = resolve(\n options.cwd ? options.cwd : \"\",\n resolved\n );\n }\n\n return resolved; `}\n </FunctionDeclaration>\n <Spacing />\n <InterfaceDeclaration\n name=\"SpawnBaseOptions\"\n doc=\"Options for the `spawn` handler function.\">\n <InterfaceMember\n name=\"stdout\"\n optional\n type=\"(data: string) => void\"\n doc=\"The writable stream to use for prompt output, defaults to process.stdout\"\n />\n <hbr />\n <InterfaceMember\n name=\"stderr\"\n optional\n type=\"(data: string) => void\"\n doc=\"The writable stream to use for prompt error output, defaults to process.stderr\"\n />\n <hbr />\n <InterfaceMember\n name=\"rejectOnError\"\n optional\n type=\"boolean\"\n doc=\"Whether to reject the promise on error. Defaults to false.\"\n />\n <hbr />\n <InterfaceMember\n name=\"file\"\n optional\n type=\"string\"\n doc=\"The file to execute.\"\n />\n <hbr />\n <InterfaceMember\n name=\"shell\"\n optional\n type=\"boolean | string\"\n doc=\"If true, runs command inside of a shell. Uses '/bin/sh' on UNIX, and process.env.ComSpec on Windows. If a string is provided, it specifies the shell to use.\"\n />\n <hbr />\n <InterfaceMember\n name=\"forceShell\"\n optional\n type=\"boolean\"\n doc=\"If true, forces the command to run inside of a shell, even if the command is a file.\"\n />\n </InterfaceDeclaration>\n <Spacing />\n <TypeDeclaration export name=\"SpawnOptions\">\n {code`SpawnBaseOptions & Parameters<typeof _spawn>[1]`}\n </TypeDeclaration>\n <Spacing />\n <TSDoc heading=\"A function to spawn child processes with proper color support and environment variable handling.\">\n <TSDocParam name=\"command\">{`The command to execute.`}</TSDocParam>\n <TSDocParam name=\"args\">\n {`The command-line arguments to pass to the command. Defaults to an empty array.`}\n </TSDocParam>\n <TSDocParam name=\"options\">\n {`Additional options for spawning the process, such as the current working directory (\\`cwd\\`).`}\n </TSDocParam>\n <TSDocReturns>{`The result of the spawned process.`}</TSDocReturns>\n </TSDoc>\n <FunctionDeclaration\n export\n async\n name=\"spawn\"\n parameters={[\n { name: \"command\", type: \"string\" },\n {\n name: \"args\",\n type: \"string[] | SpawnOptions\",\n default: \"{} as SpawnOptions\"\n },\n {\n name: \"options\",\n type: \"SpawnOptions\",\n default: \"{} as SpawnOptions\"\n }\n ]}>\n {code`const normalized = {\n command,\n args: [] as string[],\n options: options as SpawnOptions | any,\n file: undefined as string | undefined,\n original: {\n command,\n args,\n },\n };\n\n if (args) {\n if (Array.isArray(args)) {\n if (args.length > 0) {\n normalized.args = args.slice(0);\n }\n } else {\n normalized.options = { ...args } as SpawnOptions | any;\n normalized.args = [];\n }\n }\n\n if (!normalized.options.shell && isWindows) {\n normalized.file = (await resolveCommand(normalized.command, normalized.options)) || (await resolveCommand(normalized.command, normalized.options, delimiter));\n\n let commandFile = normalized.file;\n if (normalized.file) {\n let shebang: string | undefined;\n const buffer = Buffer.alloc(150);\n\n try {\n const fd = openSync(normalized.file, \"r\");\n await promisify(read)(fd, buffer, 0, 150, 0);\n closeSync(fd);\n } catch (err) {\n // Do nothing\n }\n\n const matched = buffer.toString().match(/^#!(.*)/);\n if (matched) {\n const [path, argument] = matched[0].replace(/#! ?/, \"\").split(\" \");\n\t const binary = path.split(\"/\").pop();\n if (binary === \"env\") {\n shebang = argument;\n } else {\n shebang = argument ? \\`\\${binary} \\${argument}\\` : binary;\n }\n }\n\n if (shebang) {\n normalized.args.unshift(normalized.file);\n normalized.command = shebang;\n\n commandFile = await resolveCommand(normalized.command, normalized.options);\n }\n }\n\n if (commandFile && (normalized.options.forceShell || /\\\\.(?:com|exe)$/i.test(commandFile))) {\n normalized.command = normalize(normalized.command).replace(/([()\\\\][%!^\"\\`<>&|;, *?])/g, \"^$1\");\n\n normalized.args = [\"/d\", \"/s\", \"/c\", \\`\"\\${normalized.command} \\${normalized.args.map(arg =>\n \\`\\${arg}\\`.replace(/(?=(\\\\\\\\+?)?)\\\\1\"/g, \"$1$1\\\\\"\").replace(/(?=(\\\\\\\\+?)?)\\\\1$/, \"$1$1\")\n ).map(arg =>\n \\`\"\\${arg}\"\\`.replace(/([()\\\\][%!^\"\\`<>&|;, *?])/g, \"^$1\")\n ).map(arg =>\n /node_modules[\\\\\\\\/].bin[\\\\\\\\/][^\\\\\\\\/]+\\\\.cmd$/i.test(commandFile) ? arg.replace(/([()\\\\][%!^\"\\`<>&|;, *?])/g, \"^$1\") : arg\n ).join(\" \")}\"\\`];\n normalized.command = process.env.comspec || \"cmd.exe\";\n normalized.options.windowsVerbatimArguments = true;\n }\n }\n\n let stdout = \"\";\n let stderr = \"\";\n\n const child = _spawn(normalized.command, normalized.args, {\n cwd: process.cwd(),\n env: {\n ...process.env,\n FORCE_COLOR: isColorSupported ? \"1\" : \"0\",\n },\n ...normalized.options,\n }) as ReturnType<typeof _spawn>;\n\n if (isWindows) {\n const emit = child.emit;\n child.emit = (eventName: string | symbol, ...eventArgs: any[]) => {\n if (eventName === \"exit\") {\n let err: Error | null = null;\n if (eventArgs[0] === 1 && !normalized.file) {\n err = Object.assign(new Error(\\`spawn \\${normalized.original.command} ENOENT\\`), {\n code: \"ENOENT\",\n errno: \"ENOENT\",\n syscall: \\`spawn \\${normalized.original.command}\\`,\n path: normalized.original.command,\n spawnargs: normalized.original.args,\n });\n }\n\n if (err) {\n return emit.call(child, \"error\", err);\n }\n }\n\n return emit.apply(child, [eventName, ...eventArgs]);\n };\n }\n\n return new Promise((resolve, reject) => {\n if (normalized.options.stdin !== undefined) {\n child.stdin?.write(normalized.options.stdin);\n }\n\n child.stdin?.end();\n\n child.stdout?.on(\"data\", data => {\n stdout += data;\n if (normalized.options.stdout) {\n normalized.options.stdout(data);\n }\n });\n\n child.stderr?.on(\"data\", data => {\n stderr += data;\n if (normalized.options.stderr) {\n normalized.options.stderr(data);\n }\n });\n\n if (normalized.options.rejectOnError) {\n child.addListener(\"error\", reject);\n }\n\n child.on(\"close\", code => {\n if (code !== 0 && normalized.options.rejectOnError) {\n reject(stderr);\n } else {\n resolve({ stdout, stderr });\n }\n });\n }); `}\n </FunctionDeclaration>\n </>\n );\n}\n\nexport function ContextUtilities() {\n return code`\n /**\n * The global Shell Shock - Application context instance.\n *\n * @internal\n */\n export let internal_appContext = new AsyncLocalStorage<Map<string, any>>();\n\n /**\n * Get the Shell Shock - Application context for the current application.\n *\n * @param options - The options to use when getting the context.\n * @returns The Shell Shock - Application context for the current application or undefined if the context is not available.\n */\n export function useApp(): Map<string, any> | undefined {\n return internal_appContext.getStore();\n }\n\n /**\n * A utility hook function to get the command line arguments from the application context.\n *\n * @returns An array of command-line arguments from the application context.\n * @throws If the application context is not available.\n */\n export function useArgs(): string[] {\n return useApp()?.get(\"args\") ?? getArgs();\n }\n\n /**\n * The context object for the current command execution, containing the command path and segments.\n */\n export interface CommandContext {\n path: string;\n segments: string[];\n }\n\n /**\n * The global Shell Shock - Command context instance.\n *\n * @internal\n */\n export let internal_commandContext = new AsyncLocalStorage<CommandContext>();\n\n /**\n * Get the Shell Shock - Command context for the current application.\n *\n * @param options - The options to use when getting the context.\n * @returns The Shell Shock - Command context for the current application.\n * @throws If the Shell Shock - Command context is not available.\n */\n export function useCommand(): CommandContext {\n const result = internal_commandContext.getStore();\n if (!result) {\n throw new Error(\n \\`The Shell Shock - Command context is not available. Make sure to call useCommand() within a valid context scope.\\`\n );\n }\n return result;\n }\n\n /**\n * A utility hook function to get the individual segments of the current command path.\n *\n * @returns An array of command path segments.\n * @throws If the command context is not available.\n */\n export function useSegments(): string[] {\n return useCommand().segments;\n }\n\n /**\n * A utility hook function to get the full command path as a string.\n *\n * @returns The full command path as a string.\n * @throws If the command context is not available.\n */\n export function usePath(): string {\n return useCommand().path;\n }\n `;\n}\n\n/**\n * A built-in utilities module for Shell Shock.\n */\nexport function UtilsBuiltin(props: UtilsBuiltinProps) {\n const [{ children }, rest] = splitProps(props, [\"children\"]);\n\n return (\n <BuiltinFile\n id=\"utils\"\n description=\"A collection of helper utilities that ease command-line application development.\"\n {...rest}\n imports={defu(rest.imports ?? {}, {\n \"node:os\": \"os\",\n \"node:process\": \"process\",\n \"node:path\": [\n \"resolve\",\n \"delimiter\",\n \"normalize\",\n \"join\",\n \"posix\",\n \"sep\"\n ],\n \"node:fs\": [\"openSync\", \"closeSync\", \"read\"],\n \"node:fs/promises\": [\"stat\"],\n \"node:util\": [\"promisify\"],\n \"node:child_process\": [{ name: \"spawn\", alias: \"_spawn\" }],\n \"node:async_hooks\": [\"AsyncLocalStorage\"]\n })}\n builtinImports={defu(rest.builtinImports ?? {}, {\n console: [\"error\", \"verbose\", \"writeLine\"],\n env: [\"env\", \"isCI\", \"isTest\", \"isWindows\", \"isDevelopment\", \"isDebug\"]\n })}>\n <Spacing />\n <ContextUtilities />\n <Spacing />\n <ArgsUtilities />\n <Spacing />\n <EnvSupportUtilities />\n <Spacing />\n <HyperlinkSupportUtilities />\n <Spacing />\n <ColorSupportUtilities />\n <Spacing />\n <SpawnFunctionDeclaration />\n <Spacing />\n <Show when={Boolean(children)}>{children}</Show>\n </BuiltinFile>\n );\n}\n"],"mappings":";;;;;;;;;;;;AA+CA,SAAgBiB,sBAAsB;AACpC,QAAA;EAAAC,gBAEKX,gBAAc;GAAA,UAAA;GAAA,SAAA;GAGbY,MAAI;GACJC,KAAG;GACHC,aAAarB,IAAI;GAAkD,CAAA;EAAAkB,gBAEpEV,SAAO,EAAA,CAAA;EAAAU,gBACPX,gBAAc;GAAA,UAAA;GAAA,SAAA;GAGbY,MAAI;GACJC,KAAG;GACHC,aAAarB,IAAI;GAA4C,CAAA;EAAAkB,gBAE9DV,SAAO,EAAA,CAA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B,WAAA;AAAA,UAAA;IAAAL,gBACDV,SAAO,EAAA,CAAA;IAAAU,gBACPiB,kBAAgB,EAAA,CAAA;IAAAjB,gBAChBV,SAAO,EAAA,CAAA;IAAAU,gBACPY,eAAa,EAAA,CAAA;IAAAZ,gBACbV,SAAO,EAAA,CAAA;IAAAU,gBACPD,qBAAmB,EAAA,CAAA;IAAAC,gBACnBV,SAAO,EAAA,CAAA;IAAAU,gBACPU,2BAAyB,EAAA,CAAA;IAAAV,gBACzBV,SAAO,EAAA,CAAA;IAAAU,gBACPI,uBAAqB,EAAA,CAAA;IAAAJ,gBACrBV,SAAO,EAAA,CAAA;IAAAU,gBACPc,0BAAwB,EAAA,CAAA;IAAAd,gBACxBV,SAAO,EAAA,CAAA;IAAAU,gBACPjB,MAAI;KAAA,IAAC8C,OAAI;AAAA,aAAEC,QAAQzB,SAAS;;KAAGA;KAAQ,CAAA;IAAA;;EAAA,CAAA,CAAA"}
@@ -73,8 +73,9 @@ const __ΩBaseOptions = [
73
73
  ];
74
74
  const __ΩOptions = [
75
75
  () => __ΩBaseOptions,
76
+ () => __ΩPartial,
76
77
  "Options",
77
- "Pn!!Kw\"y"
78
+ "Pn!!o\"\"Kw#y"
78
79
  ];
79
80
  const __ΩOutputConfig = [
80
81
  () => __ΩPick,
@@ -88,10 +89,11 @@ const __ΩOutputConfig = [
88
89
  ];
89
90
  const __ΩUserConfig = [
90
91
  () => __ΩBaseOptions,
92
+ () => __ΩPartial,
91
93
  () => __ΩOutputConfig,
92
94
  "output",
93
95
  "UserConfig",
94
- "Pn!!Pn\"4#8MKw$y"
96
+ "Pn!!o\"\"Pn#4$8MKw%y"
95
97
  ];
96
98
  const __ΩResolvedConfig = [
97
99
  () => __ΩRequired,
@@ -1 +1 @@
1
- {"version":3,"file":"config.cjs","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/types/plugin\";\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/types/config\";\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 | \"entry\"\n | \"plugins\"\n | \"tsconfig\"\n | \"tsconfigRaw\"\n>;\n\ntype BaseOptions = Partial<BuildOptions> & {\n /**\n * A set of default command options to apply to each command.\n *\n * @remarks\n * To disable the addition of these default options, set this property to `false`, or provide a custom set of options/a function that returns them.\n */\n defaultOptions?:\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 * An application specific prefix to check for environment variables.\n *\n * @remarks\n * If not provided, Shell Shock will convert {@link Options.name | name} to {@link https://stringcase.org/cases/constant/ | constant case} format and append an underscore (`_`). If the provided {@link Options.name | name} is `\"my-app\"`, environment variables starting with `\"MY_APP_\"` will be used - for example: `\"MY_APP_CONFIG_NAME\"`. If a trailing underscore already exists in the user provided value, it will result in two consecutive underscores - for example: `\"MY_APP__CONFIG_NAME\"` (this was done intentionally so that users who specifically want multiple underscores have a way to do so).\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 envPrefix?: string;\n};\n\n/**\n * The plugin options for Shell Shock.\n */\nexport type Options = BaseOptions & NodeJsPluginOptions;\n\n/**\n * The output configuration options for Shell Shock.\n */\nexport type OutputConfig = Pick<\n PowerlinesOutputConfig,\n \"outputPath\" | \"assets\" | \"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 NodeJsPluginUserConfig & {\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\">> & {\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 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;CAAC;CAAK;CAAY;CAAS;;;;;;;;;AAE/C,MAAM,YAAY;CAAC;CAAK;CAAK;CAAU;CAAyB;AAChE,MAAM,aAAa;CAAC;CAAK;CAAK;CAAW;CAA2B;AACpE,MAAM,kBAAkB;OAAO;CAAS;CAAQ;CAAQ;CAAS;CAAM;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;AACvE,MAAM,iBAAiB;OAAO;OAAkB;CAAiB;CAAa;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;AAG9E,MAAM,kBAAkB;OAAO;CAAS;CAAc;CAAU;CAAO;CAAA;CAAA;CAAA;CAAA;AAEvE,MAAM,gBAAgB;OAAO;OAAsB;CAAQ;CAAA;CAAA;CAAA;AAE3D,MAAM,oBAAoB;OAAO;OAAG;OAAA;CAAA;OAAA;CAAA;OAAA;CAAA;CAAA;CAAA;CAAA"}
1
+ {"version":3,"file":"config.cjs","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/types/plugin\";\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/types/config\";\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 | \"entry\"\n | \"plugins\"\n | \"tsconfig\"\n | \"tsconfigRaw\"\n>;\n\ntype BaseOptions = Partial<BuildOptions> & {\n /**\n * A set of default command options to apply to each command.\n *\n * @remarks\n * To disable the addition of these default options, set this property to `false`, or provide a custom set of options/a function that returns them.\n */\n defaultOptions?:\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 * An application specific prefix to check for environment variables.\n *\n * @remarks\n * If not provided, Shell Shock will convert {@link Options.name | name} to {@link https://stringcase.org/cases/constant/ | constant case} format and append an underscore (`_`). If the provided {@link Options.name | name} is `\"my-app\"`, environment variables starting with `\"MY_APP_\"` will be used - for example: `\"MY_APP_CONFIG_NAME\"`. If a trailing underscore already exists in the user provided value, it will result in two consecutive underscores - for example: `\"MY_APP__CONFIG_NAME\"` (this was done intentionally so that users who specifically want multiple underscores have a way to do so).\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 envPrefix?: 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 \"outputPath\" | \"assets\" | \"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 /**\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\">> & {\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 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;CAAC;CAAK;CAAY;CAAS;;;;;;;;;AAE/C,MAAM,YAAY;CAAC;CAAK;CAAK;CAAU;CAAyB;AAChE,MAAM,aAAa;CAAC;CAAK;CAAK;CAAW;CAA2B;AACpE,MAAM,kBAAkB;OAAO;CAAS;CAAQ;CAAQ;CAAS;CAAM;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;AACvE,MAAM,iBAAiB;OAAO;OAAkB;CAAiB;CAAa;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;AAG9E,MAAM,kBAAkB;OAAO;CAAS;CAAc;CAAU;CAAO;CAAA;CAAA;CAAA;CAAA;AAEvE,MAAM,gBAAgB;OAAO;OAAsB;OAAQ;CAAA;CAAA;CAAA;CAAA;AAE3D,MAAM,oBAAoB;OAAO;OAAG;OAAA;CAAA;OAAA;CAAA;OAAA;CAAA;CAAA;CAAA;CAAA"}
@@ -46,7 +46,7 @@ type BaseOptions = Partial<BuildOptions> & {
46
46
  /**
47
47
  * The plugin options for Shell Shock.
48
48
  */
49
- type Options = BaseOptions & NodeJsPluginOptions;
49
+ type Options = BaseOptions & Partial<NodeJsPluginOptions>;
50
50
  /**
51
51
  * The output configuration options for Shell Shock.
52
52
  */
@@ -59,7 +59,7 @@ type OutputConfig = Pick<OutputConfig$1, "outputPath" | "assets" | "storage"> &
59
59
  /**
60
60
  * The user configuration options for Shell Shock.
61
61
  */
62
- type UserConfig = BaseOptions & NodeJsPluginUserConfig & {
62
+ type UserConfig = BaseOptions & Partial<NodeJsPluginUserConfig> & {
63
63
  /**
64
64
  * Configuration for the output of the build process
65
65
  */
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.cts","names":[],"sources":["../../src/types/config.ts"],"sourcesContent":[],"mappings":";;;;;;;;KAgCK,YAAA,GAAe,KAClB;KAeG,WAAA,GAAc,QAAQ;EAhBtB;AAAmB;;;;;EAyBS,cAAA,CAAA,EAD3B,aAC2B,EAAA,GAAA,CAAA,CAAA,OAAA,EAAhB,OAAgB,EAAA,KAAA,EAAA,WAAA,EAAA,GAAgB,aAAhB,EAAA,CAAA,GAAA,KAAA;EAAgB;;AAqCjD;AAKA;AAaA;EAAyB,eAAA,CAAA,EAAA,OAAA;EACvB;;;AAUF;;;;;;;EAcS,GAAA,CAAA,EAAA,MAAA,GAAA,MAAA,EAAA;EAKO;;;;;;;;;;;;;;KAhDJ,OAAA,GAAU,cAAc;;;;KAKxB,YAAA,GAAe,KACzB;;;;;;;;;KAYU,UAAA,GAAa,cACvB;;;;WAIW;;;;;KAMD,cAAA,GAAiB,6BAC3B,6BACA,6BACA,SAAS,KAAK;;;;;;;;;;;OAWP;;;;cAKO"}
1
+ {"version":3,"file":"config.d.cts","names":[],"sources":["../../src/types/config.ts"],"sourcesContent":[],"mappings":";;;;;;;;KAgCK,YAAA,GAAe,KAClB;KAeG,WAAA,GAAc,QAAQ;EAhBtB;AAAmB;;;;;EAyBS,cAAA,CAAA,EAD3B,aAC2B,EAAA,GAAA,CAAA,CAAA,OAAA,EAAhB,OAAgB,EAAA,KAAA,EAAA,WAAA,EAAA,GAAgB,aAAhB,EAAA,CAAA,GAAA,KAAA;EAAgB;;AAqCjD;;;EAAoC,eAAA,CAAA,EAAA,OAAA;EAAO;AAK3C;AAaA;;;;;;AAWA;;EACE,GAAA,CAAA,EAAA,MAAA,GAAA,MAAA,EAAA;EACA;;;;;;;;;;;;;;KA/BU,OAAA,GAAU,cAAc,QAAQ;;;;KAKhC,YAAA,GAAe,KACzB;;;;;;;;;KAYU,UAAA,GAAa,cACvB,QAAQ;;;;WAIG;;;;;KAMD,cAAA,GAAiB,6BAC3B,6BACA,6BACA,SAAS,KAAK;;;;;;;;;;;OAWP;;;;cAKO"}
@@ -46,7 +46,7 @@ type BaseOptions = Partial<BuildOptions> & {
46
46
  /**
47
47
  * The plugin options for Shell Shock.
48
48
  */
49
- type Options = BaseOptions & NodeJsPluginOptions;
49
+ type Options = BaseOptions & Partial<NodeJsPluginOptions>;
50
50
  /**
51
51
  * The output configuration options for Shell Shock.
52
52
  */
@@ -59,7 +59,7 @@ type OutputConfig = Pick<OutputConfig$1, "outputPath" | "assets" | "storage"> &
59
59
  /**
60
60
  * The user configuration options for Shell Shock.
61
61
  */
62
- type UserConfig = BaseOptions & NodeJsPluginUserConfig & {
62
+ type UserConfig = BaseOptions & Partial<NodeJsPluginUserConfig> & {
63
63
  /**
64
64
  * Configuration for the output of the build process
65
65
  */
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.mts","names":[],"sources":["../../src/types/config.ts"],"sourcesContent":[],"mappings":";;;;;;;;KAgCK,YAAA,GAAe,KAClB;KAeG,WAAA,GAAc,QAAQ;EAhBtB;AAAmB;;;;;EAyBS,cAAA,CAAA,EAD3B,aAC2B,EAAA,GAAA,CAAA,CAAA,OAAA,EAAhB,OAAgB,EAAA,KAAA,EAAA,WAAA,EAAA,GAAgB,aAAhB,EAAA,CAAA,GAAA,KAAA;EAAgB;;AAqCjD;AAKA;AAaA;EAAyB,eAAA,CAAA,EAAA,OAAA;EACvB;;;AAUF;;;;;;;EAcS,GAAA,CAAA,EAAA,MAAA,GAAA,MAAA,EAAA;EAKO;;;;;;;;;;;;;;KAhDJ,OAAA,GAAU,cAAc;;;;KAKxB,YAAA,GAAe,KACzB;;;;;;;;;KAYU,UAAA,GAAa,cACvB;;;;WAIW;;;;;KAMD,cAAA,GAAiB,6BAC3B,6BACA,6BACA,SAAS,KAAK;;;;;;;;;;;OAWP;;;;cAKO"}
1
+ {"version":3,"file":"config.d.mts","names":[],"sources":["../../src/types/config.ts"],"sourcesContent":[],"mappings":";;;;;;;;KAgCK,YAAA,GAAe,KAClB;KAeG,WAAA,GAAc,QAAQ;EAhBtB;AAAmB;;;;;EAyBS,cAAA,CAAA,EAD3B,aAC2B,EAAA,GAAA,CAAA,CAAA,OAAA,EAAhB,OAAgB,EAAA,KAAA,EAAA,WAAA,EAAA,GAAgB,aAAhB,EAAA,CAAA,GAAA,KAAA;EAAgB;;AAqCjD;;;EAAoC,eAAA,CAAA,EAAA,OAAA;EAAO;AAK3C;AAaA;;;;;;AAWA;;EACE,GAAA,CAAA,EAAA,MAAA,GAAA,MAAA,EAAA;EACA;;;;;;;;;;;;;;KA/BU,OAAA,GAAU,cAAc,QAAQ;;;;KAKhC,YAAA,GAAe,KACzB;;;;;;;;;KAYU,UAAA,GAAa,cACvB,QAAQ;;;;WAIG;;;;;KAMD,cAAA,GAAiB,6BAC3B,6BACA,6BACA,SAAS,KAAK;;;;;;;;;;;OAWP;;;;cAKO"}
@@ -72,8 +72,9 @@ const __ΩBaseOptions = [
72
72
  ];
73
73
  const __ΩOptions = [
74
74
  () => __ΩBaseOptions,
75
+ () => __ΩPartial,
75
76
  "Options",
76
- "Pn!!Kw\"y"
77
+ "Pn!!o\"\"Kw#y"
77
78
  ];
78
79
  const __ΩOutputConfig = [
79
80
  () => __ΩPick,
@@ -87,10 +88,11 @@ const __ΩOutputConfig = [
87
88
  ];
88
89
  const __ΩUserConfig = [
89
90
  () => __ΩBaseOptions,
91
+ () => __ΩPartial,
90
92
  () => __ΩOutputConfig,
91
93
  "output",
92
94
  "UserConfig",
93
- "Pn!!Pn\"4#8MKw$y"
95
+ "Pn!!o\"\"Pn#4$8MKw%y"
94
96
  ];
95
97
  const __ΩResolvedConfig = [
96
98
  () => __ΩRequired,
@@ -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/types/plugin\";\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/types/config\";\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 | \"entry\"\n | \"plugins\"\n | \"tsconfig\"\n | \"tsconfigRaw\"\n>;\n\ntype BaseOptions = Partial<BuildOptions> & {\n /**\n * A set of default command options to apply to each command.\n *\n * @remarks\n * To disable the addition of these default options, set this property to `false`, or provide a custom set of options/a function that returns them.\n */\n defaultOptions?:\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 * An application specific prefix to check for environment variables.\n *\n * @remarks\n * If not provided, Shell Shock will convert {@link Options.name | name} to {@link https://stringcase.org/cases/constant/ | constant case} format and append an underscore (`_`). If the provided {@link Options.name | name} is `\"my-app\"`, environment variables starting with `\"MY_APP_\"` will be used - for example: `\"MY_APP_CONFIG_NAME\"`. If a trailing underscore already exists in the user provided value, it will result in two consecutive underscores - for example: `\"MY_APP__CONFIG_NAME\"` (this was done intentionally so that users who specifically want multiple underscores have a way to do so).\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 envPrefix?: string;\n};\n\n/**\n * The plugin options for Shell Shock.\n */\nexport type Options = BaseOptions & NodeJsPluginOptions;\n\n/**\n * The output configuration options for Shell Shock.\n */\nexport type OutputConfig = Pick<\n PowerlinesOutputConfig,\n \"outputPath\" | \"assets\" | \"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 NodeJsPluginUserConfig & {\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\">> & {\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 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;CAAC;CAAK;CAAY;CAAS;;;;;;;;;AAE/C,MAAM,YAAY;CAAC;CAAK;CAAK;CAAU;CAAyB;AAChE,MAAM,aAAa;CAAC;CAAK;CAAK;CAAW;CAA2B;AACpE,MAAM,kBAAkB;OAAO;CAAS;CAAQ;CAAQ;CAAS;CAAM;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;AACvE,MAAM,iBAAiB;OAAO;OAAkB;CAAiB;CAAa;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;AAG9E,MAAM,kBAAkB;OAAO;CAAS;CAAc;CAAU;CAAO;CAAA;CAAA;CAAA;CAAA;AAEvE,MAAM,gBAAgB;OAAO;OAAsB;CAAQ;CAAA;CAAA;CAAA;AAE3D,MAAM,oBAAoB;OAAO;OAAG;OAAA;CAAA;OAAA;CAAA;OAAA;CAAA;CAAA;CAAA;CAAA"}
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/types/plugin\";\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/types/config\";\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 | \"entry\"\n | \"plugins\"\n | \"tsconfig\"\n | \"tsconfigRaw\"\n>;\n\ntype BaseOptions = Partial<BuildOptions> & {\n /**\n * A set of default command options to apply to each command.\n *\n * @remarks\n * To disable the addition of these default options, set this property to `false`, or provide a custom set of options/a function that returns them.\n */\n defaultOptions?:\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 * An application specific prefix to check for environment variables.\n *\n * @remarks\n * If not provided, Shell Shock will convert {@link Options.name | name} to {@link https://stringcase.org/cases/constant/ | constant case} format and append an underscore (`_`). If the provided {@link Options.name | name} is `\"my-app\"`, environment variables starting with `\"MY_APP_\"` will be used - for example: `\"MY_APP_CONFIG_NAME\"`. If a trailing underscore already exists in the user provided value, it will result in two consecutive underscores - for example: `\"MY_APP__CONFIG_NAME\"` (this was done intentionally so that users who specifically want multiple underscores have a way to do so).\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 envPrefix?: 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 \"outputPath\" | \"assets\" | \"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 /**\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\">> & {\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 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;CAAC;CAAK;CAAY;CAAS;;;;;;;;;AAE/C,MAAM,YAAY;CAAC;CAAK;CAAK;CAAU;CAAyB;AAChE,MAAM,aAAa;CAAC;CAAK;CAAK;CAAW;CAA2B;AACpE,MAAM,kBAAkB;OAAO;CAAS;CAAQ;CAAQ;CAAS;CAAM;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;AACvE,MAAM,iBAAiB;OAAO;OAAkB;CAAiB;CAAa;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;CAAA;;;;;;;AAG9E,MAAM,kBAAkB;OAAO;CAAS;CAAc;CAAU;CAAO;CAAA;CAAA;CAAA;CAAA;AAEvE,MAAM,gBAAgB;OAAO;OAAsB;OAAQ;CAAA;CAAA;CAAA;CAAA;AAE3D,MAAM,oBAAoB;OAAO;OAAG;OAAA;CAAA;OAAA;CAAA;OAAA;CAAA;CAAA;CAAA;CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shell-shock/core",
3
- "version": "0.9.1",
3
+ "version": "0.9.3",
4
4
  "type": "module",
5
5
  "description": "A package containing the core Shell Shock functionality used to build and manage a command-line application.",
6
6
  "repository": {
@@ -392,13 +392,13 @@
392
392
  "@alloy-js/core": "0.23.0-dev.8",
393
393
  "@alloy-js/markdown": "0.23.0-dev.1",
394
394
  "@alloy-js/typescript": "0.23.0-dev.4",
395
- "@powerlines/deepkit": "^0.6.67",
396
- "@powerlines/plugin-alloy": "^0.23.17",
397
- "@powerlines/plugin-automd": "^0.1.287",
398
- "@powerlines/plugin-deepkit": "^0.11.166",
399
- "@powerlines/plugin-nodejs": "^0.1.205",
400
- "@powerlines/plugin-plugin": "^0.12.238",
401
- "@powerlines/plugin-tsdown": "^0.1.240",
395
+ "@powerlines/deepkit": "^0.6.69",
396
+ "@powerlines/plugin-alloy": "^0.23.19",
397
+ "@powerlines/plugin-automd": "^0.1.289",
398
+ "@powerlines/plugin-deepkit": "^0.11.168",
399
+ "@powerlines/plugin-nodejs": "^0.1.207",
400
+ "@powerlines/plugin-plugin": "^0.12.240",
401
+ "@powerlines/plugin-tsdown": "^0.1.242",
402
402
  "@stryke/cli": "^0.13.15",
403
403
  "@stryke/convert": "^0.6.40",
404
404
  "@stryke/fs": "^0.33.43",
@@ -410,10 +410,10 @@
410
410
  "@stryke/types": "^0.10.39",
411
411
  "automd": "^0.4.3",
412
412
  "defu": "6.1.4",
413
- "powerlines": "^0.38.54",
413
+ "powerlines": "^0.38.56",
414
414
  "rolldown": "1.0.0-beta.52"
415
415
  },
416
416
  "devDependencies": { "@types/node": "^25.3.0", "typescript": "^5.9.3" },
417
417
  "publishConfig": { "access": "public" },
418
- "gitHead": "b94dfbfbfd27471351cac0596afe1f550d8dca57"
418
+ "gitHead": "4cf65f37aca1c43ffac57a86bf21e184134437f1"
419
419
  }