@shell-shock/core 0.15.1 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. package/dist/api.cjs +10 -7
  2. package/dist/api.cjs.map +1 -1
  3. package/dist/api.d.cts +1 -1
  4. package/dist/api.d.cts.map +1 -1
  5. package/dist/api.d.mts +1 -1
  6. package/dist/api.d.mts.map +1 -1
  7. package/dist/api.mjs +11 -8
  8. package/dist/api.mjs.map +1 -1
  9. package/dist/components/helpers.cjs +1 -1
  10. package/dist/components/helpers.cjs.map +1 -1
  11. package/dist/components/helpers.mjs +1 -1
  12. package/dist/components/helpers.mjs.map +1 -1
  13. package/dist/components/index.cjs +8 -4
  14. package/dist/components/index.d.cts +4 -2
  15. package/dist/components/index.d.mts +4 -2
  16. package/dist/components/index.mjs +4 -2
  17. package/dist/components/options-parser-logic.cjs +68 -48
  18. package/dist/components/options-parser-logic.cjs.map +1 -1
  19. package/dist/components/options-parser-logic.d.cts.map +1 -1
  20. package/dist/components/options-parser-logic.d.mts.map +1 -1
  21. package/dist/components/options-parser-logic.mjs +68 -48
  22. package/dist/components/options-parser-logic.mjs.map +1 -1
  23. package/dist/components/spawn-builtin.cjs +656 -0
  24. package/dist/components/spawn-builtin.cjs.map +1 -0
  25. package/dist/components/spawn-builtin.d.cts +12 -0
  26. package/dist/components/spawn-builtin.d.cts.map +1 -0
  27. package/dist/components/spawn-builtin.d.mts +12 -0
  28. package/dist/components/spawn-builtin.d.mts.map +1 -0
  29. package/dist/components/spawn-builtin.mjs +653 -0
  30. package/dist/components/spawn-builtin.mjs.map +1 -0
  31. package/dist/components/state-builtin.cjs +545 -0
  32. package/dist/components/state-builtin.cjs.map +1 -0
  33. package/dist/components/state-builtin.d.cts +18 -0
  34. package/dist/components/state-builtin.d.cts.map +1 -0
  35. package/dist/components/state-builtin.d.mts +18 -0
  36. package/dist/components/state-builtin.d.mts.map +1 -0
  37. package/dist/components/state-builtin.mjs +539 -0
  38. package/dist/components/state-builtin.mjs.map +1 -0
  39. package/dist/components/utils-builtin.cjs +15 -509
  40. package/dist/components/utils-builtin.cjs.map +1 -1
  41. package/dist/components/utils-builtin.d.cts +1 -10
  42. package/dist/components/utils-builtin.d.cts.map +1 -1
  43. package/dist/components/utils-builtin.d.mts +1 -10
  44. package/dist/components/utils-builtin.d.mts.map +1 -1
  45. package/dist/components/utils-builtin.mjs +17 -508
  46. package/dist/components/utils-builtin.mjs.map +1 -1
  47. package/dist/config.cjs.map +1 -1
  48. package/dist/config.mjs.map +1 -1
  49. package/dist/contexts/options.cjs +9 -9
  50. package/dist/contexts/options.cjs.map +1 -1
  51. package/dist/contexts/options.d.cts +2 -2
  52. package/dist/contexts/options.d.cts.map +1 -1
  53. package/dist/contexts/options.d.mts +2 -2
  54. package/dist/contexts/options.d.mts.map +1 -1
  55. package/dist/contexts/options.mjs +9 -9
  56. package/dist/contexts/options.mjs.map +1 -1
  57. package/dist/index.cjs +2 -10
  58. package/dist/index.d.cts +1 -2
  59. package/dist/index.d.mts +1 -2
  60. package/dist/index.mjs +1 -7
  61. package/dist/plugin.cjs +17 -32
  62. package/dist/plugin.cjs.map +1 -1
  63. package/dist/plugin.d.cts +1 -1
  64. package/dist/plugin.d.cts.map +1 -1
  65. package/dist/plugin.d.mts +1 -1
  66. package/dist/plugin.d.mts.map +1 -1
  67. package/dist/plugin.mjs +16 -30
  68. package/dist/plugin.mjs.map +1 -1
  69. package/dist/resolver/resolve.cjs +1 -1
  70. package/dist/resolver/resolve.cjs.map +1 -1
  71. package/dist/resolver/resolve.mjs +1 -1
  72. package/dist/resolver/resolve.mjs.map +1 -1
  73. package/dist/types/config.cjs +3 -1
  74. package/dist/types/config.cjs.map +1 -1
  75. package/dist/types/config.d.cts +1 -1
  76. package/dist/types/config.d.cts.map +1 -1
  77. package/dist/types/config.d.mts +1 -1
  78. package/dist/types/config.d.mts.map +1 -1
  79. package/dist/types/config.mjs +3 -1
  80. package/dist/types/config.mjs.map +1 -1
  81. package/dist/types/env.cjs +2 -1
  82. package/dist/types/env.cjs.map +1 -1
  83. package/dist/types/env.d.cts +15 -0
  84. package/dist/types/env.d.cts.map +1 -1
  85. package/dist/types/env.d.mts +15 -0
  86. package/dist/types/env.d.mts.map +1 -1
  87. package/dist/types/env.mjs +2 -1
  88. package/dist/types/env.mjs.map +1 -1
  89. package/dist/types/index.cjs +0 -2
  90. package/dist/types/index.d.cts +1 -2
  91. package/dist/types/index.d.mts +1 -2
  92. package/dist/types/index.mjs +1 -2
  93. package/package.json +49 -35
  94. package/dist/index.cjs.map +0 -1
  95. package/dist/index.mjs.map +0 -1
  96. package/dist/types/runtime.cjs +0 -13
  97. package/dist/types/runtime.cjs.map +0 -1
  98. package/dist/types/runtime.d.cts +0 -14
  99. package/dist/types/runtime.d.cts.map +0 -1
  100. package/dist/types/runtime.d.mts +0 -14
  101. package/dist/types/runtime.d.mts.map +0 -1
  102. package/dist/types/runtime.mjs +0 -11
  103. package/dist/types/runtime.mjs.map +0 -1
@@ -3,7 +3,7 @@ import defu$1 from "defu";
3
3
  import { Show, code, splitProps } from "@alloy-js/core";
4
4
  import { Spacing } from "@powerlines/plugin-alloy/core/components/spacing";
5
5
  import { usePowerlines } from "@powerlines/plugin-alloy/core/contexts/context";
6
- import { FunctionDeclaration, InterfaceDeclaration, InterfaceMember, TypeDeclaration, VarDeclaration } from "@alloy-js/typescript";
6
+ import { FunctionDeclaration, InterfaceDeclaration, InterfaceMember, VarDeclaration } from "@alloy-js/typescript";
7
7
  import { BuiltinFile } from "@powerlines/plugin-alloy/typescript/components/builtin-file";
8
8
  import { TSDoc, TSDocInternal, TSDocLink, TSDocParam, TSDocRemarks, TSDocReturns } from "@powerlines/plugin-alloy/typescript/components/tsdoc";
9
9
 
@@ -542,407 +542,6 @@ function HyperlinkSupportUtilities() {
542
542
  ];
543
543
  }
544
544
  /**
545
- * Generates utilities for detecting terminal color support.
546
- */
547
- function ArgsUtilities() {
548
- return [
549
- createComponent(TSDoc, {
550
- heading: "Retrieves the command-line arguments from Deno or Node.js environments.",
551
- get children() {
552
- return [
553
- createComponent(TSDocRemarks, { children: "This function is only intended for internal use. Please use `useArgs()` instead." }),
554
- createComponent(Spacing, {}),
555
- createComponent(TSDocInternal, {}),
556
- createComponent(Spacing, {}),
557
- createComponent(TSDocReturns, { children: "An array of command-line arguments from Deno or Node.js environments." })
558
- ];
559
- }
560
- }),
561
- createComponent(FunctionDeclaration, {
562
- "export": true,
563
- name: "getArgs",
564
- returnType: "string[]",
565
- children: code`return ((globalThis as { Deno?: { args: string[] } })?.Deno?.args ?? process.argv ?? []) as string[];`
566
- }),
567
- createComponent(Spacing, {}),
568
- createComponent(TSDoc, {
569
- heading: "Checks if a specific flag is present in the command-line arguments.",
570
- get children() {
571
- return [
572
- createComponent(TSDocLink, { children: "https://github.com/sindresorhus/has-flag/blob/main/index.js" }),
573
- createComponent(TSDocParam, {
574
- name: "flag",
575
- children: "The flag (or an array of flags/aliases) to check for, e.g., \"color\", \"no-color\"."
576
- }),
577
- createComponent(TSDocParam, {
578
- name: "argv",
579
- children: "The command-line arguments to check against. Defaults to global Deno args or process args."
580
- }),
581
- createComponent(TSDocReturns, { children: "True if the flag is present, false otherwise." })
582
- ];
583
- }
584
- }),
585
- createComponent(FunctionDeclaration, {
586
- "export": true,
587
- name: "hasFlag",
588
- parameters: [{
589
- name: "flag",
590
- type: "string | string[]"
591
- }, {
592
- name: "argv",
593
- type: "string[]",
594
- default: "useArgs()"
595
- }],
596
- get children() {
597
- return [
598
- createComponent(VarDeclaration, {
599
- "const": true,
600
- name: "position",
601
- type: "number",
602
- initializer: code`(Array.isArray(flag) ? flag : [flag]).reduce((ret, f) => {
603
- const pos = argv.findIndex(arg => (f.startsWith("-") ? "" : (f.length === 1 ? "-" : "--") + f)?.toLowerCase() === arg?.toLowerCase() || arg?.toLowerCase().startsWith((f.length === 1 ? "-" : "--") + f + "="));
604
- return pos !== -1 ? pos : ret;
605
- }, -1);`
606
- }),
607
- createIntrinsic("hbr", {}),
608
- code`return position !== -1 && argv.indexOf("--") === -1 || position < argv.indexOf("--");`
609
- ];
610
- }
611
- }),
612
- createComponent(Spacing, {}),
613
- createComponent(VarDeclaration, {
614
- "export": true,
615
- name: "isHelp",
616
- type: "boolean",
617
- initializer: code` !isCI && hasFlag(["help", "h", "?"]); `
618
- })
619
- ];
620
- }
621
- /**
622
- * Generates the `spawn` function declaration, which is a cross-platform utility for spawning child processes with proper color support and environment variable handling.
623
- */
624
- function SpawnFunctionDeclaration() {
625
- return [
626
- createComponent(FunctionDeclaration, {
627
- async: true,
628
- name: "resolveCommand",
629
- parameters: [
630
- {
631
- name: "command",
632
- type: "string"
633
- },
634
- {
635
- name: "options",
636
- type: "Record<string, any>",
637
- default: "{}"
638
- },
639
- {
640
- name: "pathExt",
641
- type: "string",
642
- default: "process.env.PATHEXT || [\".EXE\", \".CMD\", \".BAT\", \".COM\"].join(delimiter)"
643
- }
644
- ],
645
- children: code`const env = options.env || process.env;
646
- const cwd = process.cwd();
647
- if (!!options.cwd && process.chdir !== undefined && !(process.chdir as any).disabled) {
648
- try {
649
- process.chdir(options.cwd);
650
- } catch (err) {
651
- // Do nothing
652
- }
653
- }
654
-
655
- let resolved;
656
- try {
657
- let extensions = [""];
658
- if (isWindows) {
659
- extensions = pathExt.split(delimiter).flatMap((item) => [item, item.toLowerCase()]);
660
- if (command.includes(".") && extensions[0] !== "") {
661
- extensions.unshift("");
662
- }
663
- }
664
-
665
- for (const envPart of (command.match(new RegExp(\`[\${posix.sep}\${sep === posix.sep ? "" : sep}]\`.replace(/(\\\\)/g, "\\\\$1"))))
666
- ? [...(isWindows ? [process.cwd()] : []), ...(process.env.PATH || "").split(delimiter)]
667
- : [""]
668
- ) {
669
- 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)}\`;
670
- for (const extension of extensions) {
671
- if (isWindows) {
672
- const filePath = part + extension;
673
- if ((await stat(filePath)).isFile() && extensions.some((ext) => filePath.substring(filePath.length - ext.length).toLowerCase() === ext.toLowerCase())) {
674
- resolved = filePath;
675
- break;
676
- }
677
- } else {
678
- const file = await stat(part + extension);
679
- if (file.isFile() && (file.mode & 0o111) !== 0) {
680
- resolved = part + extension;
681
- break;
682
- }
683
- }
684
- }
685
- }
686
- } catch (err) {
687
- // Do nothing
688
- } finally {
689
- if (!!options.cwd && process.chdir !== undefined && !(process.chdir as any).disabled) {
690
- process.chdir(cwd);
691
- }
692
- }
693
-
694
-
695
- if (resolved) {
696
- resolved = resolve(
697
- options.cwd ? options.cwd : "",
698
- resolved
699
- );
700
- }
701
-
702
- return resolved; `
703
- }),
704
- createComponent(Spacing, {}),
705
- createComponent(InterfaceDeclaration, {
706
- name: "SpawnBaseOptions",
707
- doc: "Options for the `spawn` handler function.",
708
- get children() {
709
- return [
710
- createComponent(InterfaceMember, {
711
- name: "stdout",
712
- optional: true,
713
- type: "(data: string) => void",
714
- doc: "The writable stream to use for prompt output, defaults to process.stdout"
715
- }),
716
- createIntrinsic("hbr", {}),
717
- createComponent(InterfaceMember, {
718
- name: "stderr",
719
- optional: true,
720
- type: "(data: string) => void",
721
- doc: "The writable stream to use for prompt error output, defaults to process.stderr"
722
- }),
723
- createIntrinsic("hbr", {}),
724
- createComponent(InterfaceMember, {
725
- name: "rejectOnError",
726
- optional: true,
727
- type: "boolean",
728
- doc: "Whether to reject the promise on error. Defaults to false."
729
- }),
730
- createIntrinsic("hbr", {}),
731
- createComponent(InterfaceMember, {
732
- name: "file",
733
- optional: true,
734
- type: "string",
735
- doc: "The file to execute."
736
- }),
737
- createIntrinsic("hbr", {}),
738
- createComponent(InterfaceMember, {
739
- name: "shell",
740
- optional: true,
741
- type: "boolean | string",
742
- 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."
743
- }),
744
- createIntrinsic("hbr", {}),
745
- createComponent(InterfaceMember, {
746
- name: "forceShell",
747
- optional: true,
748
- type: "boolean",
749
- doc: "If true, forces the command to run inside of a shell, even if the command is a file."
750
- })
751
- ];
752
- }
753
- }),
754
- createComponent(Spacing, {}),
755
- createComponent(TypeDeclaration, {
756
- "export": true,
757
- name: "SpawnOptions",
758
- children: code`SpawnBaseOptions & Parameters<typeof _spawn>[1]`
759
- }),
760
- createComponent(Spacing, {}),
761
- createComponent(TSDoc, {
762
- heading: "A function to spawn child processes with proper color support and environment variable handling.",
763
- get children() {
764
- return [
765
- createComponent(TSDocParam, {
766
- name: "command",
767
- children: `The command to execute.`
768
- }),
769
- createComponent(TSDocParam, {
770
- name: "args",
771
- children: `The command-line arguments to pass to the command. Defaults to an empty array.`
772
- }),
773
- createComponent(TSDocParam, {
774
- name: "options",
775
- children: `Additional options for spawning the process, such as the current working directory (\`cwd\`).`
776
- }),
777
- createComponent(TSDocReturns, { children: `The result of the spawned process.` })
778
- ];
779
- }
780
- }),
781
- createComponent(FunctionDeclaration, {
782
- "export": true,
783
- async: true,
784
- name: "spawn",
785
- parameters: [
786
- {
787
- name: "command",
788
- type: "string"
789
- },
790
- {
791
- name: "args",
792
- type: "string[] | SpawnOptions",
793
- default: "{} as SpawnOptions"
794
- },
795
- {
796
- name: "options",
797
- type: "SpawnOptions",
798
- default: "{} as SpawnOptions"
799
- }
800
- ],
801
- children: code`const normalized = {
802
- command,
803
- args: [] as string[],
804
- options: options as SpawnOptions | any,
805
- file: undefined as string | undefined,
806
- original: {
807
- command,
808
- args,
809
- },
810
- };
811
-
812
- if (args) {
813
- if (Array.isArray(args)) {
814
- if (args.length > 0) {
815
- normalized.args = args.slice(0);
816
- }
817
- } else {
818
- normalized.options = { ...args } as SpawnOptions | any;
819
- normalized.args = [];
820
- }
821
- }
822
-
823
- if (!normalized.options.shell && isWindows) {
824
- normalized.file = (await resolveCommand(normalized.command, normalized.options)) || (await resolveCommand(normalized.command, normalized.options, delimiter));
825
-
826
- let commandFile = normalized.file;
827
- if (normalized.file) {
828
- let shebang: string | undefined;
829
- const buffer = Buffer.alloc(150);
830
-
831
- try {
832
- const fd = openSync(normalized.file, "r");
833
- await promisify(read)(fd, buffer, 0, 150, 0);
834
- closeSync(fd);
835
- } catch (err) {
836
- // Do nothing
837
- }
838
-
839
- const matched = buffer.toString().match(/^#!(.*)/);
840
- if (matched) {
841
- const [path, argument] = matched[0].replace(/#! ?/, "").split(" ");
842
- const binary = path.split("/").pop();
843
- if (binary === "env") {
844
- shebang = argument;
845
- } else {
846
- shebang = argument ? \`\${binary} \${argument}\` : binary;
847
- }
848
- }
849
-
850
- if (shebang) {
851
- normalized.args.unshift(normalized.file);
852
- normalized.command = shebang;
853
-
854
- commandFile = await resolveCommand(normalized.command, normalized.options);
855
- }
856
- }
857
-
858
- if (commandFile && (normalized.options.forceShell || /\\.(?:com|exe)$/i.test(commandFile))) {
859
- normalized.command = normalize(normalized.command).replace(/([()\\][%!^"\`<>&|;, *?])/g, "^$1");
860
-
861
- normalized.args = ["/d", "/s", "/c", \`"\${normalized.command} \${normalized.args.map(arg =>
862
- \`\${arg}\`.replace(/(?=(\\\\+?)?)\\1"/g, "$1$1\\"").replace(/(?=(\\\\+?)?)\\1$/, "$1$1")
863
- ).map(arg =>
864
- \`"\${arg}"\`.replace(/([()\\][%!^"\`<>&|;, *?])/g, "^$1")
865
- ).map(arg =>
866
- /node_modules[\\\\/].bin[\\\\/][^\\\\/]+\\.cmd$/i.test(commandFile) ? arg.replace(/([()\\][%!^"\`<>&|;, *?])/g, "^$1") : arg
867
- ).join(" ")}"\`];
868
- normalized.command = process.env.comspec || "cmd.exe";
869
- normalized.options.windowsVerbatimArguments = true;
870
- }
871
- }
872
-
873
- let stdout = "";
874
- let stderr = "";
875
-
876
- const child = _spawn(normalized.command, normalized.args, {
877
- cwd: process.cwd(),
878
- env: {
879
- ...process.env,
880
- FORCE_COLOR: isColorSupported ? "1" : "0",
881
- },
882
- ...normalized.options,
883
- }) as ReturnType<typeof _spawn>;
884
-
885
- if (isWindows) {
886
- const emit = child.emit;
887
- child.emit = (eventName: string | symbol, ...eventArgs: any[]) => {
888
- if (eventName === "exit") {
889
- let err: Error | null = null;
890
- if (eventArgs[0] === 1 && !normalized.file) {
891
- err = Object.assign(new Error(\`spawn \${normalized.original.command} ENOENT\`), {
892
- code: "ENOENT",
893
- errno: "ENOENT",
894
- syscall: \`spawn \${normalized.original.command}\`,
895
- path: normalized.original.command,
896
- spawnargs: normalized.original.args,
897
- });
898
- }
899
-
900
- if (err) {
901
- return emit.call(child, "error", err);
902
- }
903
- }
904
-
905
- return emit.apply(child, [eventName, ...eventArgs]);
906
- };
907
- }
908
-
909
- return new Promise((resolve, reject) => {
910
- if (normalized.options.stdin !== undefined) {
911
- child.stdin?.write(normalized.options.stdin);
912
- }
913
-
914
- child.stdin?.end();
915
-
916
- child.stdout?.on("data", data => {
917
- stdout += data;
918
- if (normalized.options.stdout) {
919
- normalized.options.stdout(data);
920
- }
921
- });
922
-
923
- child.stderr?.on("data", data => {
924
- stderr += data;
925
- if (normalized.options.stderr) {
926
- normalized.options.stderr(data);
927
- }
928
- });
929
-
930
- if (normalized.options.rejectOnError) {
931
- child.addListener("error", reject);
932
- }
933
-
934
- child.on("close", code => {
935
- if (code !== 0 && normalized.options.rejectOnError) {
936
- reject(stderr);
937
- } else {
938
- resolve({ stdout, stderr });
939
- }
940
- });
941
- }); `
942
- })
943
- ];
944
- }
945
- /**
946
545
  * Generates the `resolveModule` function declaration, which is a utility for resolving file paths across different platforms.
947
546
  */
948
547
  function ResolveModuleFunctionDeclaration() {
@@ -1503,7 +1102,7 @@ function ResolveModuleFunctionDeclaration() {
1503
1102
 
1504
1103
  if (!validPackageName) {
1505
1104
  const err = new Error(
1506
- \`Invalid module "\${specifier}" is not a valid package name imported from \${fileURLToPath(base)}\`
1105
+ \`Invalid module \\\`\${specifier}\\\` is not a valid package name imported from \${fileURLToPath(base)}\`
1507
1106
  );
1508
1107
  (err as any).code = "ERR_INVALID_MODULE_SPECIFIER";
1509
1108
  throw err;
@@ -1604,10 +1203,9 @@ function ResolveModuleFunctionDeclaration() {
1604
1203
  return new URL(packageSubpath, packageJsonUrl);
1605
1204
  } while (packageJsonPath.length !== lastPath!.length);
1606
1205
 
1607
- const err = new Error(
1608
- \`Cannot find package '\${packageName}' imported from \${fileURLToPath(base)}\`
1609
- );
1206
+ const err = new Error(\`Cannot find package \\\`\${packageName}\\\`\`);
1610
1207
  (err as any).code = "ERR_MODULE_NOT_FOUND";
1208
+
1611
1209
  throw err;`
1612
1210
  }),
1613
1211
  createComponent(Spacing, {}),
@@ -1623,9 +1221,10 @@ function ResolveModuleFunctionDeclaration() {
1623
1221
  returnType: "URL",
1624
1222
  children: code`if (/%2f|%5c/i.test(resolved.pathname)) {
1625
1223
  const err = new Error(
1626
- \`Invalid module "\${resolved.pathname}" must not include encoded "/" or "\\\\" characters imported from \${fileURLToPath(base)}\`
1224
+ \`Invalid module \\\`\${resolved.pathname}\\\` must not include encoded "/" or "\\\\" characters imported from \${fileURLToPath(base)}\`
1627
1225
  );
1628
1226
  (err as any).code = "ERR_INVALID_MODULE_SPECIFIER";
1227
+
1629
1228
  throw err;
1630
1229
  }
1631
1230
 
@@ -1638,7 +1237,7 @@ function ResolveModuleFunctionDeclaration() {
1638
1237
 
1639
1238
  if (stat && stat.isDirectory()) {
1640
1239
  const err = new Error(
1641
- \`Directory import '\${filePath}' is not supported resolving ES modules imported from \${fileURLToPath(base)}\`
1240
+ \`Directory import \\\`\${filePath}\\\` is not supported resolving ES modules imported from \${fileURLToPath(base)}\`
1642
1241
  );
1643
1242
  (err as any).code = "ERR_UNSUPPORTED_DIR_IMPORT";
1644
1243
  throw err;
@@ -1646,7 +1245,7 @@ function ResolveModuleFunctionDeclaration() {
1646
1245
 
1647
1246
  if (!stat || !stat.isFile()) {
1648
1247
  const err = new Error(
1649
- \`Cannot find module '\${filePath}' imported from \${fileURLToPath(base)}\`
1248
+ \`Cannot find module \\\`\${filePath}\\\` imported from \${fileURLToPath(base)}\`
1650
1249
  );
1651
1250
  (err as any).code = "ERR_MODULE_NOT_FOUND";
1652
1251
  throw err;
@@ -1691,7 +1290,7 @@ function ResolveModuleFunctionDeclaration() {
1691
1290
  resolved = new URL(specifier, base);
1692
1291
  } catch (error_: any) {
1693
1292
  const err = new Error(
1694
- \`Failed to resolve module specifier "\${specifier}" from "\${base}": Invalid relative URL or base scheme is not hierarchical.\`
1293
+ \`Failed to resolve module specifier \\\`\${specifier}\\\` from "\${base}": Invalid relative URL or base scheme is not hierarchical.\`
1695
1294
  );
1696
1295
  err.cause = error_;
1697
1296
  throw err;
@@ -1750,7 +1349,7 @@ function ResolveModuleFunctionDeclaration() {
1750
1349
 
1751
1350
  if (!resolved) {
1752
1351
  const err = new Error(
1753
- \`Package import specifier "\${specifier}" is not defined in package imported from \${fileURLToPath(base)}\`
1352
+ \`Package import specifier \\\`\${specifier}\\\` is not defined in package imported from \${fileURLToPath(base)}\`
1754
1353
  );
1755
1354
  (err as any).code = "ERR_PACKAGE_IMPORT_NOT_DEFINED";
1756
1355
  throw err;
@@ -1822,6 +1421,7 @@ function ResolveModuleFunctionDeclaration() {
1822
1421
  }),
1823
1422
  createComponent(FunctionDeclaration, {
1824
1423
  async: true,
1424
+ "export": true,
1825
1425
  name: "resolveModule",
1826
1426
  parameters: [{
1827
1427
  name: "specifier",
@@ -1922,9 +1522,10 @@ function ResolveModuleFunctionDeclaration() {
1922
1522
 
1923
1523
  if (!resolved) {
1924
1524
  const err = new Error(
1925
- \`Cannot find module \${specifier} imported from \${base.href}\`
1525
+ \`Cannot find module \\\`\${specifier}\\\`\`
1926
1526
  );
1927
1527
  (err as any).code = "ERR_MODULE_NOT_FOUND";
1528
+
1928
1529
  throw err;
1929
1530
  }
1930
1531
 
@@ -1934,88 +1535,6 @@ function ResolveModuleFunctionDeclaration() {
1934
1535
  })
1935
1536
  ];
1936
1537
  }
1937
- function ContextUtilities() {
1938
- return code`
1939
- /**
1940
- * The global Shell Shock - Application context instance.
1941
- *
1942
- * @internal
1943
- */
1944
- export let internal_appContext = new AsyncLocalStorage<Map<string, any>>();
1945
-
1946
- /**
1947
- * Get the Shell Shock - Application context for the current application.
1948
- *
1949
- * @param options - The options to use when getting the context.
1950
- * @returns The Shell Shock - Application context for the current application or undefined if the context is not available.
1951
- */
1952
- export function useApp(): Map<string, any> | undefined {
1953
- return internal_appContext.getStore();
1954
- }
1955
-
1956
- /**
1957
- * A utility hook function to get the command-line arguments from the application context.
1958
- *
1959
- * @returns An array of command-line arguments from the application context.
1960
- * @throws If the application context is not available.
1961
- */
1962
- export function useArgs(): string[] {
1963
- return useApp()?.get("args") ?? getArgs();
1964
- }
1965
-
1966
- /**
1967
- * The context object for the current command execution, containing the command path and segments.
1968
- */
1969
- export interface CommandContext {
1970
- path: string;
1971
- segments: string[];
1972
- }
1973
-
1974
- /**
1975
- * The global Shell Shock - Command context instance.
1976
- *
1977
- * @internal
1978
- */
1979
- export let internal_commandContext = new AsyncLocalStorage<CommandContext>();
1980
-
1981
- /**
1982
- * Get the Shell Shock - Command context for the current application.
1983
- *
1984
- * @param options - The options to use when getting the context.
1985
- * @returns The Shell Shock - Command context for the current application.
1986
- * @throws If the Shell Shock - Command context is not available.
1987
- */
1988
- export function useCommand(): CommandContext {
1989
- const result = internal_commandContext.getStore();
1990
- if (!result) {
1991
- throw new Error(
1992
- \`The Shell Shock - Command context is not available. Make sure to call useCommand() within a valid context scope.\`
1993
- );
1994
- }
1995
- return result;
1996
- }
1997
-
1998
- /**
1999
- * A utility hook function to get the individual segments of the current command path.
2000
- *
2001
- * @returns An array of command path segments.
2002
- * @throws If the command context is not available.
2003
- */
2004
- export function useSegments(): string[] {
2005
- return useCommand().segments;
2006
- }
2007
-
2008
- /**
2009
- * A utility hook function to get the full command path as a string.
2010
- *
2011
- * @returns The full command path as a string.
2012
- * @throws If the command context is not available.
2013
- */
2014
- export function usePath(): string {
2015
- return useCommand().path;
2016
- }
2017
- `;
2018
- }
2019
1538
  /**
2020
1539
  * A built-in utilities module for Shell Shock.
2021
1540
  */
@@ -2050,12 +1569,7 @@ function UtilsBuiltin(props) {
2050
1569
  "node:fs/promises": ["stat"],
2051
1570
  "node:util": ["promisify"],
2052
1571
  "node:url": ["fileURLToPath", "pathToFileURL"],
2053
- "node:module": ["builtinModules"],
2054
- "node:child_process": [{
2055
- name: "spawn",
2056
- alias: "_spawn"
2057
- }],
2058
- "node:async_hooks": ["AsyncLocalStorage"]
1572
+ "node:module": ["builtinModules"]
2059
1573
  });
2060
1574
  },
2061
1575
  get builtinImports() {
@@ -2072,7 +1586,8 @@ function UtilsBuiltin(props) {
2072
1586
  "isWindows",
2073
1587
  "isDevelopment",
2074
1588
  "isDebug"
2075
- ]
1589
+ ],
1590
+ state: ["hasFlag"]
2076
1591
  });
2077
1592
  },
2078
1593
  get children() {
@@ -2097,18 +1612,12 @@ function UtilsBuiltin(props) {
2097
1612
  children: code`return new Promise((resolve) => setTimeout(resolve, durationMs)); `
2098
1613
  }),
2099
1614
  createComponent(Spacing, {}),
2100
- createComponent(ContextUtilities, {}),
2101
- createComponent(Spacing, {}),
2102
- createComponent(ArgsUtilities, {}),
2103
- createComponent(Spacing, {}),
2104
1615
  createComponent(EnvSupportUtilities, {}),
2105
1616
  createComponent(Spacing, {}),
2106
1617
  createComponent(HyperlinkSupportUtilities, {}),
2107
1618
  createComponent(Spacing, {}),
2108
1619
  createComponent(ColorSupportUtilities, {}),
2109
1620
  createComponent(Spacing, {}),
2110
- createComponent(SpawnFunctionDeclaration, {}),
2111
- createComponent(Spacing, {}),
2112
1621
  createComponent(ResolveModuleFunctionDeclaration, {}),
2113
1622
  createComponent(Spacing, {}),
2114
1623
  createComponent(FindSuggestionsDeclaration, {}),
@@ -2125,5 +1634,5 @@ function UtilsBuiltin(props) {
2125
1634
  }
2126
1635
 
2127
1636
  //#endregion
2128
- export { ArgsUtilities, ColorSupportUtilities, ContextUtilities, EnvSupportUtilities, FindSuggestionsDeclaration, HyperlinkSupportUtilities, ResolveModuleFunctionDeclaration, SpawnFunctionDeclaration, UtilsBuiltin };
1637
+ export { ColorSupportUtilities, EnvSupportUtilities, FindSuggestionsDeclaration, HyperlinkSupportUtilities, ResolveModuleFunctionDeclaration, UtilsBuiltin };
2129
1638
  //# sourceMappingURL=utils-builtin.mjs.map