@plasmicapp/nextjs-app-router 1.0.14 → 1.0.16

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.
@@ -26,6 +26,115 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
26
26
  mod
27
27
  ));
28
28
 
29
+ // ../../node_modules/cross-port-killer/source/port-killer.js
30
+ var require_port_killer = __commonJS({
31
+ "../../node_modules/cross-port-killer/source/port-killer.js"(exports) {
32
+ "use strict";
33
+ Object.defineProperty(exports, "__esModule", { value: true });
34
+ exports.Killer = void 0;
35
+ var child_process_1 = require("child_process");
36
+ var Killer = (
37
+ /** @class */
38
+ function() {
39
+ function Killer2(platform) {
40
+ this.platforms = {
41
+ win32: { command: "Taskkill", args: ["/F", "/PID"] },
42
+ linux: { command: "kill", args: ["-9"] },
43
+ darwin: { command: "kill", args: ["-9"] }
44
+ };
45
+ this.platform = platform;
46
+ }
47
+ Killer2.prototype.kill = function(port) {
48
+ return this[this.platform](port);
49
+ };
50
+ Killer2.prototype.killByPid = function(pid) {
51
+ return this.killByPids([pid]);
52
+ };
53
+ Killer2.prototype.killByPids = function(pids) {
54
+ var _a2 = this.platforms[process.platform], command2 = _a2.command, args = _a2.args;
55
+ var result = pids.filter(function(pid) {
56
+ return (0, child_process_1.spawnSync)(command2, args.concat(pid)).status === 0;
57
+ });
58
+ return Promise.resolve(result);
59
+ };
60
+ Killer2.prototype.darwin = function(port) {
61
+ return this.linux(port);
62
+ };
63
+ Killer2.prototype.linux = function(port) {
64
+ var _this = this;
65
+ var resolver;
66
+ var promise = new Promise(function(resolve5) {
67
+ return resolver = resolve5;
68
+ });
69
+ var lsof = (0, child_process_1.spawn)("lsof", ["-s", "TCP:LISTEN", "-i", ":" + port]);
70
+ var awk = (0, child_process_1.spawn)("awk", ['$8 == "TCP" { print $2 }'], {
71
+ stdio: [lsof.stdout]
72
+ });
73
+ var result = "";
74
+ awk.stdout.on("data", function(data) {
75
+ return result += data;
76
+ });
77
+ awk.on("close", function() {
78
+ return _this.parse(result, resolver);
79
+ });
80
+ if (awk.stdin) {
81
+ awk.stdin.end();
82
+ }
83
+ return promise;
84
+ };
85
+ Killer2.prototype.win32 = function(port) {
86
+ var _this = this;
87
+ var resolver, promise = new Promise(function(resolve5) {
88
+ resolver = resolve5;
89
+ });
90
+ var findstr = (0, child_process_1.spawn)("findstr", [":".concat(port, ".*")], {
91
+ stdio: ["pipe"]
92
+ });
93
+ var netstat = (0, child_process_1.spawn)("netstat", ["-ano"], {
94
+ stdio: ["ignore", findstr.stdin]
95
+ });
96
+ var result = "";
97
+ findstr.stdout.on("data", function(data) {
98
+ return result += data;
99
+ });
100
+ findstr.on("close", function() {
101
+ return _this.parse(result, resolver);
102
+ });
103
+ findstr.stdin.end();
104
+ return promise;
105
+ };
106
+ Killer2.prototype.parse = function(data, resolver) {
107
+ var pids = data.trim().match(/\d+$/gm);
108
+ if (pids && pids.length) {
109
+ return this.killByPids(pids).then(function(killed) {
110
+ return resolver(killed);
111
+ });
112
+ }
113
+ resolver([]);
114
+ };
115
+ return Killer2;
116
+ }()
117
+ );
118
+ exports.Killer = Killer;
119
+ }
120
+ });
121
+
122
+ // ../../node_modules/cross-port-killer/source/index.js
123
+ var require_source = __commonJS({
124
+ "../../node_modules/cross-port-killer/source/index.js"(exports) {
125
+ "use strict";
126
+ Object.defineProperty(exports, "__esModule", { value: true });
127
+ exports.kill = exports.killer = void 0;
128
+ var port_killer_1 = require_port_killer();
129
+ exports.killer = new port_killer_1.Killer(process.platform);
130
+ var kill2 = function(port) {
131
+ return exports.killer.kill(port);
132
+ };
133
+ exports.kill = kill2;
134
+ exports.default = exports.kill;
135
+ }
136
+ });
137
+
29
138
  // ../../node_modules/isexe/windows.js
30
139
  var require_windows = __commonJS({
31
140
  "../../node_modules/isexe/windows.js"(exports, module2) {
@@ -523,2056 +632,10 @@ var require_cross_spawn = __commonJS({
523
632
  }
524
633
  });
525
634
 
526
- // ../../node_modules/strip-final-newline/index.js
527
- var require_strip_final_newline = __commonJS({
528
- "../../node_modules/strip-final-newline/index.js"(exports, module2) {
529
- "use strict";
530
- module2.exports = (input) => {
531
- const LF = typeof input === "string" ? "\n" : "\n".charCodeAt();
532
- const CR = typeof input === "string" ? "\r" : "\r".charCodeAt();
533
- if (input[input.length - 1] === LF) {
534
- input = input.slice(0, input.length - 1);
535
- }
536
- if (input[input.length - 1] === CR) {
537
- input = input.slice(0, input.length - 1);
538
- }
539
- return input;
540
- };
541
- }
542
- });
543
-
544
- // ../../node_modules/npm-run-path/node_modules/path-key/index.js
545
- var require_path_key2 = __commonJS({
546
- "../../node_modules/npm-run-path/node_modules/path-key/index.js"(exports, module2) {
547
- "use strict";
548
- var pathKey = (options = {}) => {
549
- const environment = options.env || process.env;
550
- const platform = options.platform || process.platform;
551
- if (platform !== "win32") {
552
- return "PATH";
553
- }
554
- return Object.keys(environment).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
555
- };
556
- module2.exports = pathKey;
557
- module2.exports.default = pathKey;
558
- }
559
- });
560
-
561
- // ../../node_modules/npm-run-path/index.js
562
- var require_npm_run_path = __commonJS({
563
- "../../node_modules/npm-run-path/index.js"(exports, module2) {
564
- "use strict";
565
- var path = require("path");
566
- var pathKey = require_path_key2();
567
- var npmRunPath = (options) => {
568
- options = {
569
- cwd: process.cwd(),
570
- path: process.env[pathKey()],
571
- execPath: process.execPath,
572
- ...options
573
- };
574
- let previous;
575
- let cwdPath = path.resolve(options.cwd);
576
- const result = [];
577
- while (previous !== cwdPath) {
578
- result.push(path.join(cwdPath, "node_modules/.bin"));
579
- previous = cwdPath;
580
- cwdPath = path.resolve(cwdPath, "..");
581
- }
582
- const execPathDir = path.resolve(options.cwd, options.execPath, "..");
583
- result.push(execPathDir);
584
- return result.concat(options.path).join(path.delimiter);
585
- };
586
- module2.exports = npmRunPath;
587
- module2.exports.default = npmRunPath;
588
- module2.exports.env = (options) => {
589
- options = {
590
- env: process.env,
591
- ...options
592
- };
593
- const env2 = { ...options.env };
594
- const path2 = pathKey({ env: env2 });
595
- options.path = env2[path2];
596
- env2[path2] = module2.exports(options);
597
- return env2;
598
- };
599
- }
600
- });
601
-
602
- // ../../node_modules/mimic-fn/index.js
603
- var require_mimic_fn = __commonJS({
604
- "../../node_modules/mimic-fn/index.js"(exports, module2) {
605
- "use strict";
606
- var mimicFn = (to, from) => {
607
- for (const prop of Reflect.ownKeys(from)) {
608
- Object.defineProperty(to, prop, Object.getOwnPropertyDescriptor(from, prop));
609
- }
610
- return to;
611
- };
612
- module2.exports = mimicFn;
613
- module2.exports.default = mimicFn;
614
- }
615
- });
616
-
617
- // ../../node_modules/onetime/index.js
618
- var require_onetime = __commonJS({
619
- "../../node_modules/onetime/index.js"(exports, module2) {
620
- "use strict";
621
- var mimicFn = require_mimic_fn();
622
- var calledFunctions = /* @__PURE__ */ new WeakMap();
623
- var onetime = (function_, options = {}) => {
624
- if (typeof function_ !== "function") {
625
- throw new TypeError("Expected a function");
626
- }
627
- let returnValue;
628
- let callCount = 0;
629
- const functionName = function_.displayName || function_.name || "<anonymous>";
630
- const onetime2 = function(...arguments_) {
631
- calledFunctions.set(onetime2, ++callCount);
632
- if (callCount === 1) {
633
- returnValue = function_.apply(this, arguments_);
634
- function_ = null;
635
- } else if (options.throw === true) {
636
- throw new Error(`Function \`${functionName}\` can only be called once`);
637
- }
638
- return returnValue;
639
- };
640
- mimicFn(onetime2, function_);
641
- calledFunctions.set(onetime2, callCount);
642
- return onetime2;
643
- };
644
- module2.exports = onetime;
645
- module2.exports.default = onetime;
646
- module2.exports.callCount = (function_) => {
647
- if (!calledFunctions.has(function_)) {
648
- throw new Error(`The given function \`${function_.name}\` is not wrapped by the \`onetime\` package`);
649
- }
650
- return calledFunctions.get(function_);
651
- };
652
- }
653
- });
654
-
655
- // ../../node_modules/execa/node_modules/human-signals/build/src/core.js
656
- var require_core = __commonJS({
657
- "../../node_modules/execa/node_modules/human-signals/build/src/core.js"(exports) {
658
- "use strict";
659
- Object.defineProperty(exports, "__esModule", { value: true });
660
- exports.SIGNALS = void 0;
661
- var SIGNALS = [
662
- {
663
- name: "SIGHUP",
664
- number: 1,
665
- action: "terminate",
666
- description: "Terminal closed",
667
- standard: "posix"
668
- },
669
- {
670
- name: "SIGINT",
671
- number: 2,
672
- action: "terminate",
673
- description: "User interruption with CTRL-C",
674
- standard: "ansi"
675
- },
676
- {
677
- name: "SIGQUIT",
678
- number: 3,
679
- action: "core",
680
- description: "User interruption with CTRL-\\",
681
- standard: "posix"
682
- },
683
- {
684
- name: "SIGILL",
685
- number: 4,
686
- action: "core",
687
- description: "Invalid machine instruction",
688
- standard: "ansi"
689
- },
690
- {
691
- name: "SIGTRAP",
692
- number: 5,
693
- action: "core",
694
- description: "Debugger breakpoint",
695
- standard: "posix"
696
- },
697
- {
698
- name: "SIGABRT",
699
- number: 6,
700
- action: "core",
701
- description: "Aborted",
702
- standard: "ansi"
703
- },
704
- {
705
- name: "SIGIOT",
706
- number: 6,
707
- action: "core",
708
- description: "Aborted",
709
- standard: "bsd"
710
- },
711
- {
712
- name: "SIGBUS",
713
- number: 7,
714
- action: "core",
715
- description: "Bus error due to misaligned, non-existing address or paging error",
716
- standard: "bsd"
717
- },
718
- {
719
- name: "SIGEMT",
720
- number: 7,
721
- action: "terminate",
722
- description: "Command should be emulated but is not implemented",
723
- standard: "other"
724
- },
725
- {
726
- name: "SIGFPE",
727
- number: 8,
728
- action: "core",
729
- description: "Floating point arithmetic error",
730
- standard: "ansi"
731
- },
732
- {
733
- name: "SIGKILL",
734
- number: 9,
735
- action: "terminate",
736
- description: "Forced termination",
737
- standard: "posix",
738
- forced: true
739
- },
740
- {
741
- name: "SIGUSR1",
742
- number: 10,
743
- action: "terminate",
744
- description: "Application-specific signal",
745
- standard: "posix"
746
- },
747
- {
748
- name: "SIGSEGV",
749
- number: 11,
750
- action: "core",
751
- description: "Segmentation fault",
752
- standard: "ansi"
753
- },
754
- {
755
- name: "SIGUSR2",
756
- number: 12,
757
- action: "terminate",
758
- description: "Application-specific signal",
759
- standard: "posix"
760
- },
761
- {
762
- name: "SIGPIPE",
763
- number: 13,
764
- action: "terminate",
765
- description: "Broken pipe or socket",
766
- standard: "posix"
767
- },
768
- {
769
- name: "SIGALRM",
770
- number: 14,
771
- action: "terminate",
772
- description: "Timeout or timer",
773
- standard: "posix"
774
- },
775
- {
776
- name: "SIGTERM",
777
- number: 15,
778
- action: "terminate",
779
- description: "Termination",
780
- standard: "ansi"
781
- },
782
- {
783
- name: "SIGSTKFLT",
784
- number: 16,
785
- action: "terminate",
786
- description: "Stack is empty or overflowed",
787
- standard: "other"
788
- },
789
- {
790
- name: "SIGCHLD",
791
- number: 17,
792
- action: "ignore",
793
- description: "Child process terminated, paused or unpaused",
794
- standard: "posix"
795
- },
796
- {
797
- name: "SIGCLD",
798
- number: 17,
799
- action: "ignore",
800
- description: "Child process terminated, paused or unpaused",
801
- standard: "other"
802
- },
803
- {
804
- name: "SIGCONT",
805
- number: 18,
806
- action: "unpause",
807
- description: "Unpaused",
808
- standard: "posix",
809
- forced: true
810
- },
811
- {
812
- name: "SIGSTOP",
813
- number: 19,
814
- action: "pause",
815
- description: "Paused",
816
- standard: "posix",
817
- forced: true
818
- },
819
- {
820
- name: "SIGTSTP",
821
- number: 20,
822
- action: "pause",
823
- description: 'Paused using CTRL-Z or "suspend"',
824
- standard: "posix"
825
- },
826
- {
827
- name: "SIGTTIN",
828
- number: 21,
829
- action: "pause",
830
- description: "Background process cannot read terminal input",
831
- standard: "posix"
832
- },
833
- {
834
- name: "SIGBREAK",
835
- number: 21,
836
- action: "terminate",
837
- description: "User interruption with CTRL-BREAK",
838
- standard: "other"
839
- },
840
- {
841
- name: "SIGTTOU",
842
- number: 22,
843
- action: "pause",
844
- description: "Background process cannot write to terminal output",
845
- standard: "posix"
846
- },
847
- {
848
- name: "SIGURG",
849
- number: 23,
850
- action: "ignore",
851
- description: "Socket received out-of-band data",
852
- standard: "bsd"
853
- },
854
- {
855
- name: "SIGXCPU",
856
- number: 24,
857
- action: "core",
858
- description: "Process timed out",
859
- standard: "bsd"
860
- },
861
- {
862
- name: "SIGXFSZ",
863
- number: 25,
864
- action: "core",
865
- description: "File too big",
866
- standard: "bsd"
867
- },
868
- {
869
- name: "SIGVTALRM",
870
- number: 26,
871
- action: "terminate",
872
- description: "Timeout or timer",
873
- standard: "bsd"
874
- },
875
- {
876
- name: "SIGPROF",
877
- number: 27,
878
- action: "terminate",
879
- description: "Timeout or timer",
880
- standard: "bsd"
881
- },
882
- {
883
- name: "SIGWINCH",
884
- number: 28,
885
- action: "ignore",
886
- description: "Terminal window size changed",
887
- standard: "bsd"
888
- },
889
- {
890
- name: "SIGIO",
891
- number: 29,
892
- action: "terminate",
893
- description: "I/O is available",
894
- standard: "other"
895
- },
896
- {
897
- name: "SIGPOLL",
898
- number: 29,
899
- action: "terminate",
900
- description: "Watched event",
901
- standard: "other"
902
- },
903
- {
904
- name: "SIGINFO",
905
- number: 29,
906
- action: "ignore",
907
- description: "Request for process information",
908
- standard: "other"
909
- },
910
- {
911
- name: "SIGPWR",
912
- number: 30,
913
- action: "terminate",
914
- description: "Device running out of power",
915
- standard: "systemv"
916
- },
917
- {
918
- name: "SIGSYS",
919
- number: 31,
920
- action: "core",
921
- description: "Invalid system call",
922
- standard: "other"
923
- },
924
- {
925
- name: "SIGUNUSED",
926
- number: 31,
927
- action: "terminate",
928
- description: "Invalid system call",
929
- standard: "other"
930
- }
931
- ];
932
- exports.SIGNALS = SIGNALS;
933
- }
934
- });
935
-
936
- // ../../node_modules/execa/node_modules/human-signals/build/src/realtime.js
937
- var require_realtime = __commonJS({
938
- "../../node_modules/execa/node_modules/human-signals/build/src/realtime.js"(exports) {
939
- "use strict";
940
- Object.defineProperty(exports, "__esModule", { value: true });
941
- exports.SIGRTMAX = exports.getRealtimeSignals = void 0;
942
- var getRealtimeSignals = function() {
943
- const length = SIGRTMAX - SIGRTMIN + 1;
944
- return Array.from({ length }, getRealtimeSignal);
945
- };
946
- exports.getRealtimeSignals = getRealtimeSignals;
947
- var getRealtimeSignal = function(value, index) {
948
- return {
949
- name: `SIGRT${index + 1}`,
950
- number: SIGRTMIN + index,
951
- action: "terminate",
952
- description: "Application-specific signal (realtime)",
953
- standard: "posix"
954
- };
955
- };
956
- var SIGRTMIN = 34;
957
- var SIGRTMAX = 64;
958
- exports.SIGRTMAX = SIGRTMAX;
959
- }
960
- });
961
-
962
- // ../../node_modules/execa/node_modules/human-signals/build/src/signals.js
963
- var require_signals = __commonJS({
964
- "../../node_modules/execa/node_modules/human-signals/build/src/signals.js"(exports) {
965
- "use strict";
966
- Object.defineProperty(exports, "__esModule", { value: true });
967
- exports.getSignals = void 0;
968
- var _os = require("os");
969
- var _core = require_core();
970
- var _realtime = require_realtime();
971
- var getSignals = function() {
972
- const realtimeSignals = (0, _realtime.getRealtimeSignals)();
973
- const signals = [..._core.SIGNALS, ...realtimeSignals].map(normalizeSignal);
974
- return signals;
975
- };
976
- exports.getSignals = getSignals;
977
- var normalizeSignal = function({
978
- name,
979
- number: defaultNumber,
980
- description,
981
- action,
982
- forced = false,
983
- standard
984
- }) {
985
- const {
986
- signals: { [name]: constantSignal }
987
- } = _os.constants;
988
- const supported = constantSignal !== void 0;
989
- const number = supported ? constantSignal : defaultNumber;
990
- return { name, number, description, supported, action, forced, standard };
991
- };
992
- }
993
- });
994
-
995
- // ../../node_modules/execa/node_modules/human-signals/build/src/main.js
996
- var require_main = __commonJS({
997
- "../../node_modules/execa/node_modules/human-signals/build/src/main.js"(exports) {
998
- "use strict";
999
- Object.defineProperty(exports, "__esModule", { value: true });
1000
- exports.signalsByNumber = exports.signalsByName = void 0;
1001
- var _os = require("os");
1002
- var _signals = require_signals();
1003
- var _realtime = require_realtime();
1004
- var getSignalsByName = function() {
1005
- const signals = (0, _signals.getSignals)();
1006
- return signals.reduce(getSignalByName, {});
1007
- };
1008
- var getSignalByName = function(signalByNameMemo, { name, number, description, supported, action, forced, standard }) {
1009
- return {
1010
- ...signalByNameMemo,
1011
- [name]: { name, number, description, supported, action, forced, standard }
1012
- };
1013
- };
1014
- var signalsByName = getSignalsByName();
1015
- exports.signalsByName = signalsByName;
1016
- var getSignalsByNumber = function() {
1017
- const signals = (0, _signals.getSignals)();
1018
- const length = _realtime.SIGRTMAX + 1;
1019
- const signalsA = Array.from({ length }, (value, number) => getSignalByNumber(number, signals));
1020
- return Object.assign({}, ...signalsA);
1021
- };
1022
- var getSignalByNumber = function(number, signals) {
1023
- const signal = findSignalByNumber(number, signals);
1024
- if (signal === void 0) {
1025
- return {};
1026
- }
1027
- const { name, description, supported, action, forced, standard } = signal;
1028
- return {
1029
- [number]: {
1030
- name,
1031
- number,
1032
- description,
1033
- supported,
1034
- action,
1035
- forced,
1036
- standard
1037
- }
1038
- };
1039
- };
1040
- var findSignalByNumber = function(number, signals) {
1041
- const signal = signals.find(({ name }) => _os.constants.signals[name] === number);
1042
- if (signal !== void 0) {
1043
- return signal;
1044
- }
1045
- return signals.find((signalA) => signalA.number === number);
1046
- };
1047
- var signalsByNumber = getSignalsByNumber();
1048
- exports.signalsByNumber = signalsByNumber;
1049
- }
1050
- });
1051
-
1052
- // ../../node_modules/execa/lib/error.js
1053
- var require_error = __commonJS({
1054
- "../../node_modules/execa/lib/error.js"(exports, module2) {
1055
- "use strict";
1056
- var { signalsByName } = require_main();
1057
- var getErrorPrefix = ({ timedOut, timeout: timeout2, errorCode, signal, signalDescription, exitCode, isCanceled }) => {
1058
- if (timedOut) {
1059
- return `timed out after ${timeout2} milliseconds`;
1060
- }
1061
- if (isCanceled) {
1062
- return "was canceled";
1063
- }
1064
- if (errorCode !== void 0) {
1065
- return `failed with ${errorCode}`;
1066
- }
1067
- if (signal !== void 0) {
1068
- return `was killed with ${signal} (${signalDescription})`;
1069
- }
1070
- if (exitCode !== void 0) {
1071
- return `failed with exit code ${exitCode}`;
1072
- }
1073
- return "failed";
1074
- };
1075
- var makeError = ({
1076
- stdout,
1077
- stderr,
1078
- all,
1079
- error,
1080
- signal,
1081
- exitCode,
1082
- command: command2,
1083
- escapedCommand,
1084
- timedOut,
1085
- isCanceled,
1086
- killed,
1087
- parsed: { options: { timeout: timeout2 } }
1088
- }) => {
1089
- exitCode = exitCode === null ? void 0 : exitCode;
1090
- signal = signal === null ? void 0 : signal;
1091
- const signalDescription = signal === void 0 ? void 0 : signalsByName[signal].description;
1092
- const errorCode = error && error.code;
1093
- const prefix = getErrorPrefix({ timedOut, timeout: timeout2, errorCode, signal, signalDescription, exitCode, isCanceled });
1094
- const execaMessage = `Command ${prefix}: ${command2}`;
1095
- const isError = Object.prototype.toString.call(error) === "[object Error]";
1096
- const shortMessage = isError ? `${execaMessage}
1097
- ${error.message}` : execaMessage;
1098
- const message = [shortMessage, stderr, stdout].filter(Boolean).join("\n");
1099
- if (isError) {
1100
- error.originalMessage = error.message;
1101
- error.message = message;
1102
- } else {
1103
- error = new Error(message);
1104
- }
1105
- error.shortMessage = shortMessage;
1106
- error.command = command2;
1107
- error.escapedCommand = escapedCommand;
1108
- error.exitCode = exitCode;
1109
- error.signal = signal;
1110
- error.signalDescription = signalDescription;
1111
- error.stdout = stdout;
1112
- error.stderr = stderr;
1113
- if (all !== void 0) {
1114
- error.all = all;
1115
- }
1116
- if ("bufferedData" in error) {
1117
- delete error.bufferedData;
1118
- }
1119
- error.failed = true;
1120
- error.timedOut = Boolean(timedOut);
1121
- error.isCanceled = isCanceled;
1122
- error.killed = killed && !timedOut;
1123
- return error;
1124
- };
1125
- module2.exports = makeError;
1126
- }
1127
- });
1128
-
1129
- // ../../node_modules/execa/lib/stdio.js
1130
- var require_stdio = __commonJS({
1131
- "../../node_modules/execa/lib/stdio.js"(exports, module2) {
1132
- "use strict";
1133
- var aliases = ["stdin", "stdout", "stderr"];
1134
- var hasAlias = (options) => aliases.some((alias) => options[alias] !== void 0);
1135
- var normalizeStdio = (options) => {
1136
- if (!options) {
1137
- return;
1138
- }
1139
- const { stdio } = options;
1140
- if (stdio === void 0) {
1141
- return aliases.map((alias) => options[alias]);
1142
- }
1143
- if (hasAlias(options)) {
1144
- throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${aliases.map((alias) => `\`${alias}\``).join(", ")}`);
1145
- }
1146
- if (typeof stdio === "string") {
1147
- return stdio;
1148
- }
1149
- if (!Array.isArray(stdio)) {
1150
- throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof stdio}\``);
1151
- }
1152
- const length = Math.max(stdio.length, aliases.length);
1153
- return Array.from({ length }, (value, index) => stdio[index]);
1154
- };
1155
- module2.exports = normalizeStdio;
1156
- module2.exports.node = (options) => {
1157
- const stdio = normalizeStdio(options);
1158
- if (stdio === "ipc") {
1159
- return "ipc";
1160
- }
1161
- if (stdio === void 0 || typeof stdio === "string") {
1162
- return [stdio, stdio, stdio, "ipc"];
1163
- }
1164
- if (stdio.includes("ipc")) {
1165
- return stdio;
1166
- }
1167
- return [...stdio, "ipc"];
1168
- };
1169
- }
1170
- });
1171
-
1172
- // ../../node_modules/signal-exit/signals.js
1173
- var require_signals2 = __commonJS({
1174
- "../../node_modules/signal-exit/signals.js"(exports, module2) {
1175
- module2.exports = [
1176
- "SIGABRT",
1177
- "SIGALRM",
1178
- "SIGHUP",
1179
- "SIGINT",
1180
- "SIGTERM"
1181
- ];
1182
- if (process.platform !== "win32") {
1183
- module2.exports.push(
1184
- "SIGVTALRM",
1185
- "SIGXCPU",
1186
- "SIGXFSZ",
1187
- "SIGUSR2",
1188
- "SIGTRAP",
1189
- "SIGSYS",
1190
- "SIGQUIT",
1191
- "SIGIOT"
1192
- // should detect profiler and enable/disable accordingly.
1193
- // see #21
1194
- // 'SIGPROF'
1195
- );
1196
- }
1197
- if (process.platform === "linux") {
1198
- module2.exports.push(
1199
- "SIGIO",
1200
- "SIGPOLL",
1201
- "SIGPWR",
1202
- "SIGSTKFLT",
1203
- "SIGUNUSED"
1204
- );
1205
- }
1206
- }
1207
- });
1208
-
1209
- // ../../node_modules/signal-exit/index.js
1210
- var require_signal_exit = __commonJS({
1211
- "../../node_modules/signal-exit/index.js"(exports, module2) {
1212
- var process6 = global.process;
1213
- var processOk = function(process7) {
1214
- return process7 && typeof process7 === "object" && typeof process7.removeListener === "function" && typeof process7.emit === "function" && typeof process7.reallyExit === "function" && typeof process7.listeners === "function" && typeof process7.kill === "function" && typeof process7.pid === "number" && typeof process7.on === "function";
1215
- };
1216
- if (!processOk(process6)) {
1217
- module2.exports = function() {
1218
- return function() {
1219
- };
1220
- };
1221
- } else {
1222
- assert = require("assert");
1223
- signals = require_signals2();
1224
- isWin = /^win/i.test(process6.platform);
1225
- EE = require("events");
1226
- if (typeof EE !== "function") {
1227
- EE = EE.EventEmitter;
1228
- }
1229
- if (process6.__signal_exit_emitter__) {
1230
- emitter = process6.__signal_exit_emitter__;
1231
- } else {
1232
- emitter = process6.__signal_exit_emitter__ = new EE();
1233
- emitter.count = 0;
1234
- emitter.emitted = {};
1235
- }
1236
- if (!emitter.infinite) {
1237
- emitter.setMaxListeners(Infinity);
1238
- emitter.infinite = true;
1239
- }
1240
- module2.exports = function(cb, opts) {
1241
- if (!processOk(global.process)) {
1242
- return function() {
1243
- };
1244
- }
1245
- assert.equal(typeof cb, "function", "a callback must be provided for exit handler");
1246
- if (loaded === false) {
1247
- load();
1248
- }
1249
- var ev = "exit";
1250
- if (opts && opts.alwaysLast) {
1251
- ev = "afterexit";
1252
- }
1253
- var remove = function() {
1254
- emitter.removeListener(ev, cb);
1255
- if (emitter.listeners("exit").length === 0 && emitter.listeners("afterexit").length === 0) {
1256
- unload();
1257
- }
1258
- };
1259
- emitter.on(ev, cb);
1260
- return remove;
1261
- };
1262
- unload = function unload2() {
1263
- if (!loaded || !processOk(global.process)) {
1264
- return;
1265
- }
1266
- loaded = false;
1267
- signals.forEach(function(sig) {
1268
- try {
1269
- process6.removeListener(sig, sigListeners[sig]);
1270
- } catch (er) {
1271
- }
1272
- });
1273
- process6.emit = originalProcessEmit;
1274
- process6.reallyExit = originalProcessReallyExit;
1275
- emitter.count -= 1;
1276
- };
1277
- module2.exports.unload = unload;
1278
- emit = function emit2(event, code, signal) {
1279
- if (emitter.emitted[event]) {
1280
- return;
1281
- }
1282
- emitter.emitted[event] = true;
1283
- emitter.emit(event, code, signal);
1284
- };
1285
- sigListeners = {};
1286
- signals.forEach(function(sig) {
1287
- sigListeners[sig] = function listener() {
1288
- if (!processOk(global.process)) {
1289
- return;
1290
- }
1291
- var listeners = process6.listeners(sig);
1292
- if (listeners.length === emitter.count) {
1293
- unload();
1294
- emit("exit", null, sig);
1295
- emit("afterexit", null, sig);
1296
- if (isWin && sig === "SIGHUP") {
1297
- sig = "SIGINT";
1298
- }
1299
- process6.kill(process6.pid, sig);
1300
- }
1301
- };
1302
- });
1303
- module2.exports.signals = function() {
1304
- return signals;
1305
- };
1306
- loaded = false;
1307
- load = function load2() {
1308
- if (loaded || !processOk(global.process)) {
1309
- return;
1310
- }
1311
- loaded = true;
1312
- emitter.count += 1;
1313
- signals = signals.filter(function(sig) {
1314
- try {
1315
- process6.on(sig, sigListeners[sig]);
1316
- return true;
1317
- } catch (er) {
1318
- return false;
1319
- }
1320
- });
1321
- process6.emit = processEmit;
1322
- process6.reallyExit = processReallyExit;
1323
- };
1324
- module2.exports.load = load;
1325
- originalProcessReallyExit = process6.reallyExit;
1326
- processReallyExit = function processReallyExit2(code) {
1327
- if (!processOk(global.process)) {
1328
- return;
1329
- }
1330
- process6.exitCode = code || /* istanbul ignore next */
1331
- 0;
1332
- emit("exit", process6.exitCode, null);
1333
- emit("afterexit", process6.exitCode, null);
1334
- originalProcessReallyExit.call(process6, process6.exitCode);
1335
- };
1336
- originalProcessEmit = process6.emit;
1337
- processEmit = function processEmit2(ev, arg) {
1338
- if (ev === "exit" && processOk(global.process)) {
1339
- if (arg !== void 0) {
1340
- process6.exitCode = arg;
1341
- }
1342
- var ret = originalProcessEmit.apply(this, arguments);
1343
- emit("exit", process6.exitCode, null);
1344
- emit("afterexit", process6.exitCode, null);
1345
- return ret;
1346
- } else {
1347
- return originalProcessEmit.apply(this, arguments);
1348
- }
1349
- };
1350
- }
1351
- var assert;
1352
- var signals;
1353
- var isWin;
1354
- var EE;
1355
- var emitter;
1356
- var unload;
1357
- var emit;
1358
- var sigListeners;
1359
- var loaded;
1360
- var load;
1361
- var originalProcessReallyExit;
1362
- var processReallyExit;
1363
- var originalProcessEmit;
1364
- var processEmit;
1365
- }
1366
- });
1367
-
1368
- // ../../node_modules/execa/lib/kill.js
1369
- var require_kill = __commonJS({
1370
- "../../node_modules/execa/lib/kill.js"(exports, module2) {
1371
- "use strict";
1372
- var os3 = require("os");
1373
- var onExit = require_signal_exit();
1374
- var DEFAULT_FORCE_KILL_TIMEOUT = 1e3 * 5;
1375
- var spawnedKill = (kill2, signal = "SIGTERM", options = {}) => {
1376
- const killResult = kill2(signal);
1377
- setKillTimeout(kill2, signal, options, killResult);
1378
- return killResult;
1379
- };
1380
- var setKillTimeout = (kill2, signal, options, killResult) => {
1381
- if (!shouldForceKill(signal, options, killResult)) {
1382
- return;
1383
- }
1384
- const timeout2 = getForceKillAfterTimeout(options);
1385
- const t = setTimeout(() => {
1386
- kill2("SIGKILL");
1387
- }, timeout2);
1388
- if (t.unref) {
1389
- t.unref();
1390
- }
1391
- };
1392
- var shouldForceKill = (signal, { forceKillAfterTimeout }, killResult) => {
1393
- return isSigterm(signal) && forceKillAfterTimeout !== false && killResult;
1394
- };
1395
- var isSigterm = (signal) => {
1396
- return signal === os3.constants.signals.SIGTERM || typeof signal === "string" && signal.toUpperCase() === "SIGTERM";
1397
- };
1398
- var getForceKillAfterTimeout = ({ forceKillAfterTimeout = true }) => {
1399
- if (forceKillAfterTimeout === true) {
1400
- return DEFAULT_FORCE_KILL_TIMEOUT;
1401
- }
1402
- if (!Number.isFinite(forceKillAfterTimeout) || forceKillAfterTimeout < 0) {
1403
- throw new TypeError(`Expected the \`forceKillAfterTimeout\` option to be a non-negative integer, got \`${forceKillAfterTimeout}\` (${typeof forceKillAfterTimeout})`);
1404
- }
1405
- return forceKillAfterTimeout;
1406
- };
1407
- var spawnedCancel = (spawned, context) => {
1408
- const killResult = spawned.kill();
1409
- if (killResult) {
1410
- context.isCanceled = true;
1411
- }
1412
- };
1413
- var timeoutKill = (spawned, signal, reject) => {
1414
- spawned.kill(signal);
1415
- reject(Object.assign(new Error("Timed out"), { timedOut: true, signal }));
1416
- };
1417
- var setupTimeout = (spawned, { timeout: timeout2, killSignal = "SIGTERM" }, spawnedPromise) => {
1418
- if (timeout2 === 0 || timeout2 === void 0) {
1419
- return spawnedPromise;
1420
- }
1421
- let timeoutId;
1422
- const timeoutPromise = new Promise((resolve5, reject) => {
1423
- timeoutId = setTimeout(() => {
1424
- timeoutKill(spawned, killSignal, reject);
1425
- }, timeout2);
1426
- });
1427
- const safeSpawnedPromise = spawnedPromise.finally(() => {
1428
- clearTimeout(timeoutId);
1429
- });
1430
- return Promise.race([timeoutPromise, safeSpawnedPromise]);
1431
- };
1432
- var validateTimeout = ({ timeout: timeout2 }) => {
1433
- if (timeout2 !== void 0 && (!Number.isFinite(timeout2) || timeout2 < 0)) {
1434
- throw new TypeError(`Expected the \`timeout\` option to be a non-negative integer, got \`${timeout2}\` (${typeof timeout2})`);
1435
- }
1436
- };
1437
- var setExitHandler = async (spawned, { cleanup, detached }, timedPromise) => {
1438
- if (!cleanup || detached) {
1439
- return timedPromise;
1440
- }
1441
- const removeExitHandler = onExit(() => {
1442
- spawned.kill();
1443
- });
1444
- return timedPromise.finally(() => {
1445
- removeExitHandler();
1446
- });
1447
- };
1448
- module2.exports = {
1449
- spawnedKill,
1450
- spawnedCancel,
1451
- setupTimeout,
1452
- validateTimeout,
1453
- setExitHandler
1454
- };
1455
- }
1456
- });
1457
-
1458
- // ../../node_modules/is-stream/index.js
1459
- var require_is_stream = __commonJS({
1460
- "../../node_modules/is-stream/index.js"(exports, module2) {
1461
- "use strict";
1462
- var isStream = (stream) => stream !== null && typeof stream === "object" && typeof stream.pipe === "function";
1463
- isStream.writable = (stream) => isStream(stream) && stream.writable !== false && typeof stream._write === "function" && typeof stream._writableState === "object";
1464
- isStream.readable = (stream) => isStream(stream) && stream.readable !== false && typeof stream._read === "function" && typeof stream._readableState === "object";
1465
- isStream.duplex = (stream) => isStream.writable(stream) && isStream.readable(stream);
1466
- isStream.transform = (stream) => isStream.duplex(stream) && typeof stream._transform === "function";
1467
- module2.exports = isStream;
1468
- }
1469
- });
1470
-
1471
- // ../../node_modules/get-stream/buffer-stream.js
1472
- var require_buffer_stream = __commonJS({
1473
- "../../node_modules/get-stream/buffer-stream.js"(exports, module2) {
1474
- "use strict";
1475
- var { PassThrough: PassThroughStream } = require("stream");
1476
- module2.exports = (options) => {
1477
- options = { ...options };
1478
- const { array } = options;
1479
- let { encoding } = options;
1480
- const isBuffer = encoding === "buffer";
1481
- let objectMode = false;
1482
- if (array) {
1483
- objectMode = !(encoding || isBuffer);
1484
- } else {
1485
- encoding = encoding || "utf8";
1486
- }
1487
- if (isBuffer) {
1488
- encoding = null;
1489
- }
1490
- const stream = new PassThroughStream({ objectMode });
1491
- if (encoding) {
1492
- stream.setEncoding(encoding);
1493
- }
1494
- let length = 0;
1495
- const chunks = [];
1496
- stream.on("data", (chunk) => {
1497
- chunks.push(chunk);
1498
- if (objectMode) {
1499
- length = chunks.length;
1500
- } else {
1501
- length += chunk.length;
1502
- }
1503
- });
1504
- stream.getBufferedValue = () => {
1505
- if (array) {
1506
- return chunks;
1507
- }
1508
- return isBuffer ? Buffer.concat(chunks, length) : chunks.join("");
1509
- };
1510
- stream.getBufferedLength = () => length;
1511
- return stream;
1512
- };
1513
- }
1514
- });
1515
-
1516
- // ../../node_modules/get-stream/index.js
1517
- var require_get_stream = __commonJS({
1518
- "../../node_modules/get-stream/index.js"(exports, module2) {
1519
- "use strict";
1520
- var { constants: BufferConstants } = require("buffer");
1521
- var stream = require("stream");
1522
- var { promisify } = require("util");
1523
- var bufferStream = require_buffer_stream();
1524
- var streamPipelinePromisified = promisify(stream.pipeline);
1525
- var MaxBufferError = class extends Error {
1526
- constructor() {
1527
- super("maxBuffer exceeded");
1528
- this.name = "MaxBufferError";
1529
- }
1530
- };
1531
- async function getStream(inputStream, options) {
1532
- if (!inputStream) {
1533
- throw new Error("Expected a stream");
1534
- }
1535
- options = {
1536
- maxBuffer: Infinity,
1537
- ...options
1538
- };
1539
- const { maxBuffer } = options;
1540
- const stream2 = bufferStream(options);
1541
- await new Promise((resolve5, reject) => {
1542
- const rejectPromise = (error) => {
1543
- if (error && stream2.getBufferedLength() <= BufferConstants.MAX_LENGTH) {
1544
- error.bufferedData = stream2.getBufferedValue();
1545
- }
1546
- reject(error);
1547
- };
1548
- (async () => {
1549
- try {
1550
- await streamPipelinePromisified(inputStream, stream2);
1551
- resolve5();
1552
- } catch (error) {
1553
- rejectPromise(error);
1554
- }
1555
- })();
1556
- stream2.on("data", () => {
1557
- if (stream2.getBufferedLength() > maxBuffer) {
1558
- rejectPromise(new MaxBufferError());
1559
- }
1560
- });
1561
- });
1562
- return stream2.getBufferedValue();
1563
- }
1564
- module2.exports = getStream;
1565
- module2.exports.buffer = (stream2, options) => getStream(stream2, { ...options, encoding: "buffer" });
1566
- module2.exports.array = (stream2, options) => getStream(stream2, { ...options, array: true });
1567
- module2.exports.MaxBufferError = MaxBufferError;
1568
- }
1569
- });
1570
-
1571
- // ../../node_modules/merge-stream/index.js
1572
- var require_merge_stream = __commonJS({
1573
- "../../node_modules/merge-stream/index.js"(exports, module2) {
1574
- "use strict";
1575
- var { PassThrough } = require("stream");
1576
- module2.exports = function() {
1577
- var sources = [];
1578
- var output = new PassThrough({ objectMode: true });
1579
- output.setMaxListeners(0);
1580
- output.add = add;
1581
- output.isEmpty = isEmpty;
1582
- output.on("unpipe", remove);
1583
- Array.prototype.slice.call(arguments).forEach(add);
1584
- return output;
1585
- function add(source) {
1586
- if (Array.isArray(source)) {
1587
- source.forEach(add);
1588
- return this;
1589
- }
1590
- sources.push(source);
1591
- source.once("end", remove.bind(null, source));
1592
- source.once("error", output.emit.bind(output, "error"));
1593
- source.pipe(output, { end: false });
1594
- return this;
1595
- }
1596
- function isEmpty() {
1597
- return sources.length == 0;
1598
- }
1599
- function remove(source) {
1600
- sources = sources.filter(function(it) {
1601
- return it !== source;
1602
- });
1603
- if (!sources.length && output.readable) {
1604
- output.end();
1605
- }
1606
- }
1607
- };
1608
- }
1609
- });
1610
-
1611
- // ../../node_modules/execa/lib/stream.js
1612
- var require_stream = __commonJS({
1613
- "../../node_modules/execa/lib/stream.js"(exports, module2) {
1614
- "use strict";
1615
- var isStream = require_is_stream();
1616
- var getStream = require_get_stream();
1617
- var mergeStream = require_merge_stream();
1618
- var handleInput = (spawned, input) => {
1619
- if (input === void 0 || spawned.stdin === void 0) {
1620
- return;
1621
- }
1622
- if (isStream(input)) {
1623
- input.pipe(spawned.stdin);
1624
- } else {
1625
- spawned.stdin.end(input);
1626
- }
1627
- };
1628
- var makeAllStream = (spawned, { all }) => {
1629
- if (!all || !spawned.stdout && !spawned.stderr) {
1630
- return;
1631
- }
1632
- const mixed = mergeStream();
1633
- if (spawned.stdout) {
1634
- mixed.add(spawned.stdout);
1635
- }
1636
- if (spawned.stderr) {
1637
- mixed.add(spawned.stderr);
1638
- }
1639
- return mixed;
1640
- };
1641
- var getBufferedData = async (stream, streamPromise) => {
1642
- if (!stream) {
1643
- return;
1644
- }
1645
- stream.destroy();
1646
- try {
1647
- return await streamPromise;
1648
- } catch (error) {
1649
- return error.bufferedData;
1650
- }
1651
- };
1652
- var getStreamPromise = (stream, { encoding, buffer, maxBuffer }) => {
1653
- if (!stream || !buffer) {
1654
- return;
1655
- }
1656
- if (encoding) {
1657
- return getStream(stream, { encoding, maxBuffer });
1658
- }
1659
- return getStream.buffer(stream, { maxBuffer });
1660
- };
1661
- var getSpawnedResult = async ({ stdout, stderr, all }, { encoding, buffer, maxBuffer }, processDone) => {
1662
- const stdoutPromise = getStreamPromise(stdout, { encoding, buffer, maxBuffer });
1663
- const stderrPromise = getStreamPromise(stderr, { encoding, buffer, maxBuffer });
1664
- const allPromise = getStreamPromise(all, { encoding, buffer, maxBuffer: maxBuffer * 2 });
1665
- try {
1666
- return await Promise.all([processDone, stdoutPromise, stderrPromise, allPromise]);
1667
- } catch (error) {
1668
- return Promise.all([
1669
- { error, signal: error.signal, timedOut: error.timedOut },
1670
- getBufferedData(stdout, stdoutPromise),
1671
- getBufferedData(stderr, stderrPromise),
1672
- getBufferedData(all, allPromise)
1673
- ]);
1674
- }
1675
- };
1676
- var validateInputSync = ({ input }) => {
1677
- if (isStream(input)) {
1678
- throw new TypeError("The `input` option cannot be a stream in sync mode");
1679
- }
1680
- };
1681
- module2.exports = {
1682
- handleInput,
1683
- makeAllStream,
1684
- getSpawnedResult,
1685
- validateInputSync
1686
- };
1687
- }
1688
- });
1689
-
1690
- // ../../node_modules/execa/lib/promise.js
1691
- var require_promise = __commonJS({
1692
- "../../node_modules/execa/lib/promise.js"(exports, module2) {
1693
- "use strict";
1694
- var nativePromisePrototype = (async () => {
1695
- })().constructor.prototype;
1696
- var descriptors = ["then", "catch", "finally"].map((property) => [
1697
- property,
1698
- Reflect.getOwnPropertyDescriptor(nativePromisePrototype, property)
1699
- ]);
1700
- var mergePromise = (spawned, promise) => {
1701
- for (const [property, descriptor] of descriptors) {
1702
- const value = typeof promise === "function" ? (...args) => Reflect.apply(descriptor.value, promise(), args) : descriptor.value.bind(promise);
1703
- Reflect.defineProperty(spawned, property, { ...descriptor, value });
1704
- }
1705
- return spawned;
1706
- };
1707
- var getSpawnedPromise = (spawned) => {
1708
- return new Promise((resolve5, reject) => {
1709
- spawned.on("exit", (exitCode, signal) => {
1710
- resolve5({ exitCode, signal });
1711
- });
1712
- spawned.on("error", (error) => {
1713
- reject(error);
1714
- });
1715
- if (spawned.stdin) {
1716
- spawned.stdin.on("error", (error) => {
1717
- reject(error);
1718
- });
1719
- }
1720
- });
1721
- };
1722
- module2.exports = {
1723
- mergePromise,
1724
- getSpawnedPromise
1725
- };
1726
- }
1727
- });
1728
-
1729
- // ../../node_modules/execa/lib/command.js
1730
- var require_command = __commonJS({
1731
- "../../node_modules/execa/lib/command.js"(exports, module2) {
1732
- "use strict";
1733
- var normalizeArgs = (file, args = []) => {
1734
- if (!Array.isArray(args)) {
1735
- return [file];
1736
- }
1737
- return [file, ...args];
1738
- };
1739
- var NO_ESCAPE_REGEXP = /^[\w.-]+$/;
1740
- var DOUBLE_QUOTES_REGEXP = /"/g;
1741
- var escapeArg = (arg) => {
1742
- if (typeof arg !== "string" || NO_ESCAPE_REGEXP.test(arg)) {
1743
- return arg;
1744
- }
1745
- return `"${arg.replace(DOUBLE_QUOTES_REGEXP, '\\"')}"`;
1746
- };
1747
- var joinCommand = (file, args) => {
1748
- return normalizeArgs(file, args).join(" ");
1749
- };
1750
- var getEscapedCommand = (file, args) => {
1751
- return normalizeArgs(file, args).map((arg) => escapeArg(arg)).join(" ");
1752
- };
1753
- var SPACES_REGEXP = / +/g;
1754
- var parseCommand2 = (command2) => {
1755
- const tokens = [];
1756
- for (const token of command2.trim().split(SPACES_REGEXP)) {
1757
- const previousToken = tokens[tokens.length - 1];
1758
- if (previousToken && previousToken.endsWith("\\")) {
1759
- tokens[tokens.length - 1] = `${previousToken.slice(0, -1)} ${token}`;
1760
- } else {
1761
- tokens.push(token);
1762
- }
1763
- }
1764
- return tokens;
1765
- };
1766
- module2.exports = {
1767
- joinCommand,
1768
- getEscapedCommand,
1769
- parseCommand: parseCommand2
1770
- };
1771
- }
1772
- });
1773
-
1774
- // ../../node_modules/execa/index.js
1775
- var require_execa = __commonJS({
1776
- "../../node_modules/execa/index.js"(exports, module2) {
1777
- "use strict";
1778
- var path = require("path");
1779
- var childProcess = require("child_process");
1780
- var crossSpawn = require_cross_spawn();
1781
- var stripFinalNewline = require_strip_final_newline();
1782
- var npmRunPath = require_npm_run_path();
1783
- var onetime = require_onetime();
1784
- var makeError = require_error();
1785
- var normalizeStdio = require_stdio();
1786
- var { spawnedKill, spawnedCancel, setupTimeout, validateTimeout, setExitHandler } = require_kill();
1787
- var { handleInput, getSpawnedResult, makeAllStream, validateInputSync } = require_stream();
1788
- var { mergePromise, getSpawnedPromise } = require_promise();
1789
- var { joinCommand, parseCommand: parseCommand2, getEscapedCommand } = require_command();
1790
- var DEFAULT_MAX_BUFFER = 1e3 * 1e3 * 100;
1791
- var getEnv = ({ env: envOption, extendEnv, preferLocal, localDir, execPath }) => {
1792
- const env2 = extendEnv ? { ...process.env, ...envOption } : envOption;
1793
- if (preferLocal) {
1794
- return npmRunPath.env({ env: env2, cwd: localDir, execPath });
1795
- }
1796
- return env2;
1797
- };
1798
- var handleArguments = (file, args, options = {}) => {
1799
- const parsed = crossSpawn._parse(file, args, options);
1800
- file = parsed.command;
1801
- args = parsed.args;
1802
- options = parsed.options;
1803
- options = {
1804
- maxBuffer: DEFAULT_MAX_BUFFER,
1805
- buffer: true,
1806
- stripFinalNewline: true,
1807
- extendEnv: true,
1808
- preferLocal: false,
1809
- localDir: options.cwd || process.cwd(),
1810
- execPath: process.execPath,
1811
- encoding: "utf8",
1812
- reject: true,
1813
- cleanup: true,
1814
- all: false,
1815
- windowsHide: true,
1816
- ...options
1817
- };
1818
- options.env = getEnv(options);
1819
- options.stdio = normalizeStdio(options);
1820
- if (process.platform === "win32" && path.basename(file, ".exe") === "cmd") {
1821
- args.unshift("/q");
1822
- }
1823
- return { file, args, options, parsed };
1824
- };
1825
- var handleOutput = (options, value, error) => {
1826
- if (typeof value !== "string" && !Buffer.isBuffer(value)) {
1827
- return error === void 0 ? void 0 : "";
1828
- }
1829
- if (options.stripFinalNewline) {
1830
- return stripFinalNewline(value);
1831
- }
1832
- return value;
1833
- };
1834
- var execa4 = (file, args, options) => {
1835
- const parsed = handleArguments(file, args, options);
1836
- const command2 = joinCommand(file, args);
1837
- const escapedCommand = getEscapedCommand(file, args);
1838
- validateTimeout(parsed.options);
1839
- let spawned;
1840
- try {
1841
- spawned = childProcess.spawn(parsed.file, parsed.args, parsed.options);
1842
- } catch (error) {
1843
- const dummySpawned = new childProcess.ChildProcess();
1844
- const errorPromise = Promise.reject(makeError({
1845
- error,
1846
- stdout: "",
1847
- stderr: "",
1848
- all: "",
1849
- command: command2,
1850
- escapedCommand,
1851
- parsed,
1852
- timedOut: false,
1853
- isCanceled: false,
1854
- killed: false
1855
- }));
1856
- return mergePromise(dummySpawned, errorPromise);
1857
- }
1858
- const spawnedPromise = getSpawnedPromise(spawned);
1859
- const timedPromise = setupTimeout(spawned, parsed.options, spawnedPromise);
1860
- const processDone = setExitHandler(spawned, parsed.options, timedPromise);
1861
- const context = { isCanceled: false };
1862
- spawned.kill = spawnedKill.bind(null, spawned.kill.bind(spawned));
1863
- spawned.cancel = spawnedCancel.bind(null, spawned, context);
1864
- const handlePromise = async () => {
1865
- const [{ error, exitCode, signal, timedOut }, stdoutResult, stderrResult, allResult] = await getSpawnedResult(spawned, parsed.options, processDone);
1866
- const stdout = handleOutput(parsed.options, stdoutResult);
1867
- const stderr = handleOutput(parsed.options, stderrResult);
1868
- const all = handleOutput(parsed.options, allResult);
1869
- if (error || exitCode !== 0 || signal !== null) {
1870
- const returnedError = makeError({
1871
- error,
1872
- exitCode,
1873
- signal,
1874
- stdout,
1875
- stderr,
1876
- all,
1877
- command: command2,
1878
- escapedCommand,
1879
- parsed,
1880
- timedOut,
1881
- isCanceled: context.isCanceled,
1882
- killed: spawned.killed
1883
- });
1884
- if (!parsed.options.reject) {
1885
- return returnedError;
1886
- }
1887
- throw returnedError;
1888
- }
1889
- return {
1890
- command: command2,
1891
- escapedCommand,
1892
- exitCode: 0,
1893
- stdout,
1894
- stderr,
1895
- all,
1896
- failed: false,
1897
- timedOut: false,
1898
- isCanceled: false,
1899
- killed: false
1900
- };
1901
- };
1902
- const handlePromiseOnce = onetime(handlePromise);
1903
- handleInput(spawned, parsed.options.input);
1904
- spawned.all = makeAllStream(spawned, parsed.options);
1905
- return mergePromise(spawned, handlePromiseOnce);
1906
- };
1907
- module2.exports = execa4;
1908
- module2.exports.sync = (file, args, options) => {
1909
- const parsed = handleArguments(file, args, options);
1910
- const command2 = joinCommand(file, args);
1911
- const escapedCommand = getEscapedCommand(file, args);
1912
- validateInputSync(parsed.options);
1913
- let result;
1914
- try {
1915
- result = childProcess.spawnSync(parsed.file, parsed.args, parsed.options);
1916
- } catch (error) {
1917
- throw makeError({
1918
- error,
1919
- stdout: "",
1920
- stderr: "",
1921
- all: "",
1922
- command: command2,
1923
- escapedCommand,
1924
- parsed,
1925
- timedOut: false,
1926
- isCanceled: false,
1927
- killed: false
1928
- });
1929
- }
1930
- const stdout = handleOutput(parsed.options, result.stdout, result.error);
1931
- const stderr = handleOutput(parsed.options, result.stderr, result.error);
1932
- if (result.error || result.status !== 0 || result.signal !== null) {
1933
- const error = makeError({
1934
- stdout,
1935
- stderr,
1936
- error: result.error,
1937
- signal: result.signal,
1938
- exitCode: result.status,
1939
- command: command2,
1940
- escapedCommand,
1941
- parsed,
1942
- timedOut: result.error && result.error.code === "ETIMEDOUT",
1943
- isCanceled: false,
1944
- killed: result.signal !== null
1945
- });
1946
- if (!parsed.options.reject) {
1947
- return error;
1948
- }
1949
- throw error;
1950
- }
1951
- return {
1952
- command: command2,
1953
- escapedCommand,
1954
- exitCode: 0,
1955
- stdout,
1956
- stderr,
1957
- failed: false,
1958
- timedOut: false,
1959
- isCanceled: false,
1960
- killed: false
1961
- };
1962
- };
1963
- module2.exports.command = (command2, options) => {
1964
- const [file, ...args] = parseCommand2(command2);
1965
- return execa4(file, args, options);
1966
- };
1967
- module2.exports.commandSync = (command2, options) => {
1968
- const [file, ...args] = parseCommand2(command2);
1969
- return execa4.sync(file, args, options);
1970
- };
1971
- module2.exports.node = (scriptPath, args, options = {}) => {
1972
- if (args && !Array.isArray(args) && typeof args === "object") {
1973
- options = args;
1974
- args = [];
1975
- }
1976
- const stdio = normalizeStdio.node(options);
1977
- const defaultExecArgv = process.execArgv.filter((arg) => !arg.startsWith("--inspect"));
1978
- const {
1979
- nodePath = process.execPath,
1980
- nodeOptions = defaultExecArgv
1981
- } = options;
1982
- return execa4(
1983
- nodePath,
1984
- [
1985
- ...nodeOptions,
1986
- scriptPath,
1987
- ...Array.isArray(args) ? args : []
1988
- ],
1989
- {
1990
- ...options,
1991
- stdin: void 0,
1992
- stdout: void 0,
1993
- stderr: void 0,
1994
- stdio,
1995
- shell: false
1996
- }
1997
- );
1998
- };
1999
- }
2000
- });
2001
-
2002
- // ../../node_modules/process-exists/node_modules/ps-list/index.js
2003
- var require_ps_list = __commonJS({
2004
- "../../node_modules/process-exists/node_modules/ps-list/index.js"(exports, module2) {
2005
- "use strict";
2006
- var util = require("util");
2007
- var path = require("path");
2008
- var childProcess = require("child_process");
2009
- var TEN_MEGABYTES = 1e3 * 1e3 * 10;
2010
- var execFile = util.promisify(childProcess.execFile);
2011
- var windows = async () => {
2012
- const bin = path.join(__dirname, "fastlist.exe");
2013
- const { stdout } = await execFile(bin, { maxBuffer: TEN_MEGABYTES });
2014
- return stdout.trim().split("\r\n").map((line) => line.split(" ")).map(([name, pid, ppid]) => ({
2015
- name,
2016
- pid: Number.parseInt(pid, 10),
2017
- ppid: Number.parseInt(ppid, 10)
2018
- }));
2019
- };
2020
- var main2 = async (options = {}) => {
2021
- const flags = (options.all === false ? "" : "a") + "wwxo";
2022
- const ret = {};
2023
- await Promise.all(["comm", "args", "ppid", "uid", "%cpu", "%mem"].map(async (cmd) => {
2024
- const { stdout } = await execFile("ps", [flags, `pid,${cmd}`], { maxBuffer: TEN_MEGABYTES });
2025
- for (let line of stdout.trim().split("\n").slice(1)) {
2026
- line = line.trim();
2027
- const [pid] = line.split(" ", 1);
2028
- const val = line.slice(pid.length + 1).trim();
2029
- if (ret[pid] === void 0) {
2030
- ret[pid] = {};
2031
- }
2032
- ret[pid][cmd] = val;
2033
- }
2034
- }));
2035
- return Object.entries(ret).filter(([, value]) => value.comm && value.args && value.ppid && value.uid && value["%cpu"] && value["%mem"]).map(([key, value]) => ({
2036
- pid: Number.parseInt(key, 10),
2037
- name: path.basename(value.comm),
2038
- cmd: value.args,
2039
- ppid: Number.parseInt(value.ppid, 10),
2040
- uid: Number.parseInt(value.uid, 10),
2041
- cpu: Number.parseFloat(value["%cpu"]),
2042
- memory: Number.parseFloat(value["%mem"])
2043
- }));
2044
- };
2045
- module2.exports = process.platform === "win32" ? windows : main2;
2046
- module2.exports.default = module2.exports;
2047
- }
2048
- });
2049
-
2050
- // ../../node_modules/process-exists/index.js
2051
- var require_process_exists = __commonJS({
2052
- "../../node_modules/process-exists/index.js"(exports, module2) {
2053
- "use strict";
2054
- var psList2 = require_ps_list();
2055
- var linuxProcessMatchesName = (wantedProcessName, process6) => {
2056
- if (typeof wantedProcessName === "string") {
2057
- return process6.name === wantedProcessName || process6.cmd.split(" ")[0] === wantedProcessName;
2058
- }
2059
- return process6.pid === wantedProcessName;
2060
- };
2061
- var nonLinuxProcessMatchesName = (wantedProcessName, process6) => {
2062
- if (typeof wantedProcessName === "string") {
2063
- return process6.name === wantedProcessName;
2064
- }
2065
- return process6.pid === wantedProcessName;
2066
- };
2067
- var processMatchesName = process.platform === "linux" ? linuxProcessMatchesName : nonLinuxProcessMatchesName;
2068
- module2.exports = async (processName) => {
2069
- const processes = await psList2();
2070
- return processes.some((x) => processMatchesName(processName, x));
2071
- };
2072
- module2.exports.all = async (processName) => {
2073
- const processes = await psList2();
2074
- return new Map(processName.map((x) => [x, processes.some((y) => processMatchesName(x, y))]));
2075
- };
2076
- module2.exports.filterExists = async (processNames) => {
2077
- const processes = await psList2();
2078
- return processNames.filter((x) => processes.some((y) => processMatchesName(x, y)));
2079
- };
2080
- }
2081
- });
2082
-
2083
- // ../../node_modules/ps-list/index.js
2084
- var require_ps_list2 = __commonJS({
2085
- "../../node_modules/ps-list/index.js"(exports, module2) {
2086
- "use strict";
2087
- var util = require("util");
2088
- var path = require("path");
2089
- var childProcess = require("child_process");
2090
- var TEN_MEGABYTES = 1e3 * 1e3 * 10;
2091
- var execFile = util.promisify(childProcess.execFile);
2092
- var windows = async () => {
2093
- let bin;
2094
- switch (process.arch) {
2095
- case "x64":
2096
- bin = "fastlist-0.3.0-x64.exe";
2097
- break;
2098
- case "ia32":
2099
- bin = "fastlist-0.3.0-x86.exe";
2100
- break;
2101
- default:
2102
- throw new Error(`Unsupported architecture: ${process.arch}`);
2103
- }
2104
- const binPath = path.join(__dirname, "vendor", bin);
2105
- const { stdout } = await execFile(binPath, {
2106
- maxBuffer: TEN_MEGABYTES,
2107
- windowsHide: true
2108
- });
2109
- return stdout.trim().split("\r\n").map((line) => line.split(" ")).map(([pid, ppid, name]) => ({
2110
- pid: Number.parseInt(pid, 10),
2111
- ppid: Number.parseInt(ppid, 10),
2112
- name
2113
- }));
2114
- };
2115
- var nonWindowsMultipleCalls = async (options = {}) => {
2116
- const flags = (options.all === false ? "" : "a") + "wwxo";
2117
- const ret = {};
2118
- await Promise.all(["comm", "args", "ppid", "uid", "%cpu", "%mem"].map(async (cmd) => {
2119
- const { stdout } = await execFile("ps", [flags, `pid,${cmd}`], { maxBuffer: TEN_MEGABYTES });
2120
- for (let line of stdout.trim().split("\n").slice(1)) {
2121
- line = line.trim();
2122
- const [pid] = line.split(" ", 1);
2123
- const val = line.slice(pid.length + 1).trim();
2124
- if (ret[pid] === void 0) {
2125
- ret[pid] = {};
2126
- }
2127
- ret[pid][cmd] = val;
2128
- }
2129
- }));
2130
- return Object.entries(ret).filter(([, value]) => value.comm && value.args && value.ppid && value.uid && value["%cpu"] && value["%mem"]).map(([key, value]) => ({
2131
- pid: Number.parseInt(key, 10),
2132
- name: path.basename(value.comm),
2133
- cmd: value.args,
2134
- ppid: Number.parseInt(value.ppid, 10),
2135
- uid: Number.parseInt(value.uid, 10),
2136
- cpu: Number.parseFloat(value["%cpu"]),
2137
- memory: Number.parseFloat(value["%mem"])
2138
- }));
2139
- };
2140
- var ERROR_MESSAGE_PARSING_FAILED = "ps output parsing failed";
2141
- var psFields = "pid,ppid,uid,%cpu,%mem,comm,args";
2142
- var psOutputRegex = /^[ \t]*(?<pid>\d+)[ \t]+(?<ppid>\d+)[ \t]+(?<uid>\d+)[ \t]+(?<cpu>\d+\.\d+)[ \t]+(?<memory>\d+\.\d+)[ \t]+/;
2143
- var nonWindowsSingleCall = async (options = {}) => {
2144
- const flags = options.all === false ? "wwxo" : "awwxo";
2145
- const [psPid, stdout] = await new Promise((resolve5, reject) => {
2146
- const child = childProcess.execFile("ps", [flags, psFields], { maxBuffer: TEN_MEGABYTES }, (error, stdout2) => {
2147
- if (error === null) {
2148
- resolve5([child.pid, stdout2]);
2149
- } else {
2150
- reject(error);
2151
- }
2152
- });
2153
- });
2154
- const lines = stdout.trim().split("\n");
2155
- lines.shift();
2156
- let psIndex;
2157
- let commPosition;
2158
- let argsPosition;
2159
- const processes = lines.map((line, index) => {
2160
- const match = psOutputRegex.exec(line);
2161
- if (match === null) {
2162
- throw new Error(ERROR_MESSAGE_PARSING_FAILED);
2163
- }
2164
- const { pid, ppid, uid, cpu, memory } = match.groups;
2165
- const processInfo = {
2166
- pid: Number.parseInt(pid, 10),
2167
- ppid: Number.parseInt(ppid, 10),
2168
- uid: Number.parseInt(uid, 10),
2169
- cpu: Number.parseFloat(cpu),
2170
- memory: Number.parseFloat(memory),
2171
- name: void 0,
2172
- cmd: void 0
2173
- };
2174
- if (processInfo.pid === psPid) {
2175
- psIndex = index;
2176
- commPosition = line.indexOf("ps", match[0].length);
2177
- argsPosition = line.indexOf("ps", commPosition + 2);
2178
- }
2179
- return processInfo;
2180
- });
2181
- if (psIndex === void 0 || commPosition === -1 || argsPosition === -1) {
2182
- throw new Error(ERROR_MESSAGE_PARSING_FAILED);
2183
- }
2184
- const commLength = argsPosition - commPosition;
2185
- for (const [index, line] of lines.entries()) {
2186
- processes[index].name = line.slice(commPosition, commPosition + commLength).trim();
2187
- processes[index].cmd = line.slice(argsPosition).trim();
2188
- }
2189
- processes.splice(psIndex, 1);
2190
- return processes;
2191
- };
2192
- var nonWindows = async (options = {}) => {
2193
- try {
2194
- return await nonWindowsSingleCall(options);
2195
- } catch (_) {
2196
- return nonWindowsMultipleCalls(options);
2197
- }
2198
- };
2199
- module2.exports = process.platform === "win32" ? windows : nonWindows;
2200
- }
2201
- });
2202
-
2203
635
  // src/with-dev-server.mts
636
+ var import_cross_port_killer = __toESM(require_source(), 1);
2204
637
  var import_cross_spawn = __toESM(require_cross_spawn(), 1);
2205
638
 
2206
- // ../../node_modules/fkill/index.js
2207
- var import_node_process3 = __toESM(require("node:process"), 1);
2208
-
2209
- // ../../node_modules/taskkill/index.js
2210
- var import_node_process = __toESM(require("node:process"), 1);
2211
-
2212
- // ../../node_modules/taskkill/node_modules/arrify/index.js
2213
- function arrify(value) {
2214
- if (value === null || value === void 0) {
2215
- return [];
2216
- }
2217
- if (Array.isArray(value)) {
2218
- return value;
2219
- }
2220
- if (typeof value === "string") {
2221
- return [value];
2222
- }
2223
- if (typeof value[Symbol.iterator] === "function") {
2224
- return [...value];
2225
- }
2226
- return [value];
2227
- }
2228
-
2229
- // ../../node_modules/taskkill/index.js
2230
- var import_execa = __toESM(require_execa(), 1);
2231
- async function taskkill(input, options = {}) {
2232
- if (import_node_process.default.platform !== "win32") {
2233
- throw new Error("Windows only");
2234
- }
2235
- input = arrify(input);
2236
- if (input.length === 0) {
2237
- throw new Error("PID or image name required");
2238
- }
2239
- const arguments_ = [];
2240
- if (options.system && options.username && options.password) {
2241
- arguments_.push("/s", options.system, "/u", options.username, "/p", options.password);
2242
- }
2243
- if (options.filter) {
2244
- arguments_.push("/fi", options.filter);
2245
- }
2246
- if (options.force) {
2247
- arguments_.push("/f");
2248
- }
2249
- if (options.tree) {
2250
- arguments_.push("/t");
2251
- }
2252
- for (const element of input) {
2253
- arguments_.push(typeof element === "number" ? "/pid" : "/im", element);
2254
- }
2255
- await (0, import_execa.default)("taskkill", arguments_);
2256
- }
2257
-
2258
- // ../../node_modules/fkill/index.js
2259
- var import_execa3 = __toESM(require_execa(), 1);
2260
-
2261
- // ../../node_modules/fkill/node_modules/indent-string/index.js
2262
- function indentString(string, count = 1, options = {}) {
2263
- const {
2264
- indent = " ",
2265
- includeEmptyLines = false
2266
- } = options;
2267
- if (typeof string !== "string") {
2268
- throw new TypeError(
2269
- `Expected \`input\` to be a \`string\`, got \`${typeof string}\``
2270
- );
2271
- }
2272
- if (typeof count !== "number") {
2273
- throw new TypeError(
2274
- `Expected \`count\` to be a \`number\`, got \`${typeof count}\``
2275
- );
2276
- }
2277
- if (count < 0) {
2278
- throw new RangeError(
2279
- `Expected \`count\` to be at least 0, got \`${count}\``
2280
- );
2281
- }
2282
- if (typeof indent !== "string") {
2283
- throw new TypeError(
2284
- `Expected \`options.indent\` to be a \`string\`, got \`${typeof indent}\``
2285
- );
2286
- }
2287
- if (count === 0) {
2288
- return string;
2289
- }
2290
- const regex = includeEmptyLines ? /^/gm : /^(?!\s*$)/gm;
2291
- return string.replace(regex, indent.repeat(count));
2292
- }
2293
-
2294
- // ../../node_modules/fkill/node_modules/clean-stack/index.js
2295
- var import_os = __toESM(require("os"), 1);
2296
-
2297
- // ../../node_modules/fkill/node_modules/escape-string-regexp/index.js
2298
- function escapeStringRegexp(string) {
2299
- if (typeof string !== "string") {
2300
- throw new TypeError("Expected a string");
2301
- }
2302
- return string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
2303
- }
2304
-
2305
- // ../../node_modules/fkill/node_modules/clean-stack/index.js
2306
- var extractPathRegex = /\s+at.*[(\s](.*)\)?/;
2307
- var pathRegex = /^(?:(?:(?:node|node:[\w/]+|(?:(?:node:)?internal\/[\w/]*|.*node_modules\/(?:babel-polyfill|pirates)\/.*)?\w+)(?:\.js)?:\d+:\d+)|native)/;
2308
- var homeDir = typeof import_os.default.homedir === "undefined" ? "" : import_os.default.homedir().replace(/\\/g, "/");
2309
- function cleanStack(stack, { pretty = false, basePath } = {}) {
2310
- const basePathRegex = basePath && new RegExp(`(at | \\()${escapeStringRegexp(basePath.replace(/\\/g, "/"))}`, "g");
2311
- if (typeof stack !== "string") {
2312
- return void 0;
2313
- }
2314
- return stack.replace(/\\/g, "/").split("\n").filter((line) => {
2315
- const pathMatches = line.match(extractPathRegex);
2316
- if (pathMatches === null || !pathMatches[1]) {
2317
- return true;
2318
- }
2319
- const match = pathMatches[1];
2320
- if (match.includes(".app/Contents/Resources/electron.asar") || match.includes(".app/Contents/Resources/default_app.asar") || match.includes("node_modules/electron/dist/resources/electron.asar") || match.includes("node_modules/electron/dist/resources/default_app.asar")) {
2321
- return false;
2322
- }
2323
- return !pathRegex.test(match);
2324
- }).filter((line) => line.trim() !== "").map((line) => {
2325
- if (basePathRegex) {
2326
- line = line.replace(basePathRegex, "$1");
2327
- }
2328
- if (pretty) {
2329
- line = line.replace(extractPathRegex, (m, p1) => m.replace(p1, p1.replace(homeDir, "~")));
2330
- }
2331
- return line;
2332
- }).join("\n");
2333
- }
2334
-
2335
- // ../../node_modules/fkill/node_modules/aggregate-error/index.js
2336
- var cleanInternalStack = (stack) => stack.replace(/\s+at .*aggregate-error\/index.js:\d+:\d+\)?/g, "");
2337
- var AggregateError = class extends Error {
2338
- #errors;
2339
- name = "AggregateError";
2340
- constructor(errors) {
2341
- if (!Array.isArray(errors)) {
2342
- throw new TypeError(`Expected input to be an Array, got ${typeof errors}`);
2343
- }
2344
- errors = errors.map((error) => {
2345
- if (error instanceof Error) {
2346
- return error;
2347
- }
2348
- if (error !== null && typeof error === "object") {
2349
- return Object.assign(new Error(error.message), error);
2350
- }
2351
- return new Error(error);
2352
- });
2353
- let message = errors.map((error) => {
2354
- return typeof error.stack === "string" && error.stack.length > 0 ? cleanInternalStack(cleanStack(error.stack)) : String(error);
2355
- }).join("\n");
2356
- message = "\n" + indentString(message, 4);
2357
- super(message);
2358
- this.#errors = errors;
2359
- }
2360
- get errors() {
2361
- return this.#errors.slice();
2362
- }
2363
- };
2364
-
2365
- // ../../node_modules/pid-port/index.js
2366
- var import_node_process2 = __toESM(require("node:process"), 1);
2367
- var import_execa2 = __toESM(require_execa(), 1);
2368
- var netstat = async (type) => {
2369
- const { stdout } = await (0, import_execa2.default)("netstat", ["-anv", "-p", type]);
2370
- return stdout;
2371
- };
2372
- var macos = async () => {
2373
- const result = await Promise.all([
2374
- netstat("tcp"),
2375
- netstat("udp")
2376
- ]);
2377
- return result.join("\n");
2378
- };
2379
- var linux = async () => {
2380
- const { stdout } = await (0, import_execa2.default)("ss", ["-tunlp"]);
2381
- return stdout;
2382
- };
2383
- var win32 = async () => {
2384
- const { stdout } = await (0, import_execa2.default)("netstat", ["-ano"]);
2385
- return stdout;
2386
- };
2387
- var getListFunction = import_node_process2.default.platform === "darwin" ? macos : import_node_process2.default.platform === "linux" ? linux : win32;
2388
- var addressColumn = import_node_process2.default.platform === "darwin" ? 3 : import_node_process2.default.platform === "linux" ? 4 : 1;
2389
- var portColumn = import_node_process2.default.platform === "darwin" ? 8 : import_node_process2.default.platform === "linux" ? 6 : 4;
2390
- var isProtocol = (value) => /^\s*(tcp|udp)/i.test(value);
2391
- var parsePid = (pid) => {
2392
- if (typeof pid !== "string") {
2393
- return;
2394
- }
2395
- const { groups } = /(?:^|",|",pid=)(?<pid>\d+)/.exec(pid) || {};
2396
- if (groups) {
2397
- return Number.parseInt(groups.pid, 10);
2398
- }
2399
- };
2400
- var getPort = (port, list) => {
2401
- const regex = new RegExp(`[.:]${port}$`);
2402
- const foundPort = list.find((line) => regex.test(line[addressColumn]));
2403
- if (!foundPort) {
2404
- throw new Error(`Could not find a process that uses port \`${port}\``);
2405
- }
2406
- return parsePid(foundPort[portColumn]);
2407
- };
2408
- var getList = async () => {
2409
- const list = await getListFunction();
2410
- return list.split("\n").filter((line) => isProtocol(line)).map((line) => line.match(/\S+/g) || []);
2411
- };
2412
- async function portToPid(port) {
2413
- if (Array.isArray(port)) {
2414
- const list = await getList();
2415
- const tuples = await Promise.all(port.map((port_) => [port_, getPort(port_, list)]));
2416
- return new Map(tuples);
2417
- }
2418
- if (!Number.isInteger(port)) {
2419
- throw new TypeError(`Expected an integer, got ${typeof port}`);
2420
- }
2421
- return getPort(port, await getList());
2422
- }
2423
-
2424
- // ../../node_modules/fkill/index.js
2425
- var import_process_exists = __toESM(require_process_exists(), 1);
2426
- var import_ps_list = __toESM(require_ps_list2(), 1);
2427
- var ALIVE_CHECK_MIN_INTERVAL = 5;
2428
- var ALIVE_CHECK_MAX_INTERVAL = 1280;
2429
- var TASKKILL_EXIT_CODE_FOR_PROCESS_FILTERING_SIGTERM = 255;
2430
- var delay = (ms) => new Promise((resolve5) => {
2431
- setTimeout(resolve5, ms);
2432
- });
2433
- var missingBinaryError = async (command2, arguments_) => {
2434
- try {
2435
- return await (0, import_execa3.default)(command2, arguments_);
2436
- } catch (error) {
2437
- if (error.code === "ENOENT") {
2438
- const newError = new Error(`\`${command2}\` doesn't seem to be installed and is required by fkill`);
2439
- newError.sourceError = error;
2440
- throw newError;
2441
- }
2442
- throw error;
2443
- }
2444
- };
2445
- var windowsKill = async (input, options) => {
2446
- try {
2447
- return await taskkill(input, {
2448
- force: options.force,
2449
- tree: typeof options.tree === "undefined" ? true : options.tree
2450
- });
2451
- } catch (error) {
2452
- if (error.exitCode === TASKKILL_EXIT_CODE_FOR_PROCESS_FILTERING_SIGTERM && !options.force) {
2453
- return;
2454
- }
2455
- throw error;
2456
- }
2457
- };
2458
- var macosKill = (input, options) => {
2459
- const killByName = typeof input === "string";
2460
- const command2 = killByName ? "pkill" : "kill";
2461
- const arguments_ = [input];
2462
- if (killByName && options.ignoreCase) {
2463
- arguments_.unshift("-i");
2464
- }
2465
- if (killByName) {
2466
- arguments_.unshift("-x");
2467
- }
2468
- if (options.force) {
2469
- if (killByName) {
2470
- arguments_.unshift("-KILL");
2471
- } else {
2472
- arguments_.unshift("-9");
2473
- }
2474
- }
2475
- return missingBinaryError(command2, arguments_);
2476
- };
2477
- var defaultKill = (input, options) => {
2478
- const killByName = typeof input === "string";
2479
- const command2 = killByName ? "killall" : "kill";
2480
- const arguments_ = [input];
2481
- if (options.force) {
2482
- arguments_.unshift("-9");
2483
- }
2484
- if (killByName && options.ignoreCase) {
2485
- arguments_.unshift("-I");
2486
- }
2487
- return missingBinaryError(command2, arguments_);
2488
- };
2489
- var kill = (() => {
2490
- if (import_node_process3.default.platform === "darwin") {
2491
- return macosKill;
2492
- }
2493
- if (import_node_process3.default.platform === "win32") {
2494
- return windowsKill;
2495
- }
2496
- return defaultKill;
2497
- })();
2498
- var parseInput = async (input) => {
2499
- if (typeof input === "string" && input[0] === ":") {
2500
- return portToPid(Number.parseInt(input.slice(1), 10));
2501
- }
2502
- return input;
2503
- };
2504
- var getCurrentProcessParentsPID = (processes) => {
2505
- const processMap = new Map(processes.map((ps) => [ps.pid, ps.ppid]));
2506
- const pids = [];
2507
- let currentId = import_node_process3.default.pid;
2508
- while (currentId) {
2509
- pids.push(currentId);
2510
- currentId = processMap.get(currentId);
2511
- }
2512
- return pids;
2513
- };
2514
- var killWithLimits = async (input, options) => {
2515
- input = await parseInput(input);
2516
- if (input === import_node_process3.default.pid) {
2517
- return;
2518
- }
2519
- if (input === "node" || input === "node.exe") {
2520
- const processes = await (0, import_ps_list.default)();
2521
- const pids = getCurrentProcessParentsPID(processes);
2522
- await Promise.all(processes.map(async (ps) => {
2523
- if ((ps.name === "node" || ps.name === "node.exe") && !pids.includes(ps.pid)) {
2524
- await kill(ps.pid, options);
2525
- }
2526
- }));
2527
- return;
2528
- }
2529
- await kill(input, options);
2530
- };
2531
- async function fkill(inputs, options = {}) {
2532
- inputs = [inputs].flat();
2533
- const exists = await import_process_exists.default.all(inputs);
2534
- const errors = [];
2535
- const handleKill = async (input) => {
2536
- try {
2537
- await killWithLimits(input, options);
2538
- } catch (error) {
2539
- if (!exists.get(input)) {
2540
- errors.push(`Killing process ${input} failed: Process doesn't exist`);
2541
- return;
2542
- }
2543
- errors.push(`Killing process ${input} failed: ${error.message.replace(/.*\n/, "").replace(/kill: \d+: /, "").trim()}`);
2544
- }
2545
- };
2546
- await Promise.all(inputs.map((input) => handleKill(input)));
2547
- if (errors.length > 0 && !options.silent) {
2548
- throw new AggregateError(errors);
2549
- }
2550
- if (options.forceAfterTimeout !== void 0 && !options.force) {
2551
- const endTime = Date.now() + options.forceAfterTimeout;
2552
- let interval = ALIVE_CHECK_MIN_INTERVAL;
2553
- if (interval > options.forceAfterTimeout) {
2554
- interval = options.forceAfterTimeout;
2555
- }
2556
- let alive = inputs;
2557
- do {
2558
- await delay(interval);
2559
- alive = await import_process_exists.default.filterExists(alive);
2560
- interval *= 2;
2561
- if (interval > ALIVE_CHECK_MAX_INTERVAL) {
2562
- interval = ALIVE_CHECK_MAX_INTERVAL;
2563
- }
2564
- } while (Date.now() < endTime && alive.length > 0);
2565
- if (alive.length > 0) {
2566
- await Promise.all(alive.map(async (input) => {
2567
- try {
2568
- await killWithLimits(input, { ...options, force: true });
2569
- } catch {
2570
- }
2571
- }));
2572
- }
2573
- }
2574
- }
2575
-
2576
639
  // node_modules/get-port/index.js
2577
640
  var import_node_net = __toESM(require("node:net"), 1);
2578
641
  var import_node_os = __toESM(require("node:os"), 1);
@@ -3004,11 +1067,11 @@ var import_util3 = require("util");
3004
1067
  var import_fs4 = require("fs");
3005
1068
  var import_url = require("url");
3006
1069
 
3007
- // node_modules/yargs-parser/build/lib/index.js
1070
+ // ../../node_modules/yargs-parser/build/lib/index.js
3008
1071
  var import_util = require("util");
3009
1072
  var import_path2 = require("path");
3010
1073
 
3011
- // node_modules/yargs-parser/build/lib/string-utils.js
1074
+ // ../../node_modules/yargs-parser/build/lib/string-utils.js
3012
1075
  function camelCase(str) {
3013
1076
  const isCamelCase = str !== str.toLowerCase() && str !== str.toUpperCase();
3014
1077
  if (!isCamelCase) {
@@ -3062,7 +1125,7 @@ function looksLikeNumber(x) {
3062
1125
  return /^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);
3063
1126
  }
3064
1127
 
3065
- // node_modules/yargs-parser/build/lib/tokenize-arg-string.js
1128
+ // ../../node_modules/yargs-parser/build/lib/tokenize-arg-string.js
3066
1129
  function tokenizeArgString(argString) {
3067
1130
  if (Array.isArray(argString)) {
3068
1131
  return argString.map((e) => typeof e !== "string" ? e + "" : e);
@@ -3094,7 +1157,7 @@ function tokenizeArgString(argString) {
3094
1157
  return args;
3095
1158
  }
3096
1159
 
3097
- // node_modules/yargs-parser/build/lib/yargs-parser-types.js
1160
+ // ../../node_modules/yargs-parser/build/lib/yargs-parser-types.js
3098
1161
  var DefaultValuesForTypeKey;
3099
1162
  (function(DefaultValuesForTypeKey2) {
3100
1163
  DefaultValuesForTypeKey2["BOOLEAN"] = "boolean";
@@ -3103,7 +1166,7 @@ var DefaultValuesForTypeKey;
3103
1166
  DefaultValuesForTypeKey2["ARRAY"] = "array";
3104
1167
  })(DefaultValuesForTypeKey || (DefaultValuesForTypeKey = {}));
3105
1168
 
3106
- // node_modules/yargs-parser/build/lib/yargs-parser.js
1169
+ // ../../node_modules/yargs-parser/build/lib/yargs-parser.js
3107
1170
  var mixin2;
3108
1171
  var YargsParser = class {
3109
1172
  constructor(_mixin) {
@@ -3943,7 +2006,7 @@ function stripQuotes(val) {
3943
2006
  return typeof val === "string" && (val[0] === "'" || val[0] === '"') && val[val.length - 1] === val[0] ? val.substring(1, val.length - 1) : val;
3944
2007
  }
3945
2008
 
3946
- // node_modules/yargs-parser/build/lib/index.js
2009
+ // ../../node_modules/yargs-parser/build/lib/index.js
3947
2010
  var import_fs2 = require("fs");
3948
2011
  var _a;
3949
2012
  var _b;
@@ -4213,13 +2276,13 @@ var y18n_default = y18n2;
4213
2276
  var import_meta = {};
4214
2277
  var REQUIRE_ERROR = "require is not supported by ESM";
4215
2278
  var REQUIRE_DIRECTORY_ERROR = "loading a directory of commands is not supported yet for ESM";
4216
- var __dirname2;
2279
+ var __dirname;
4217
2280
  try {
4218
- __dirname2 = (0, import_url.fileURLToPath)(import_meta.url);
2281
+ __dirname = (0, import_url.fileURLToPath)(import_meta.url);
4219
2282
  } catch (e) {
4220
- __dirname2 = process.cwd();
2283
+ __dirname = process.cwd();
4221
2284
  }
4222
- var mainFilename = __dirname2.substring(0, __dirname2.lastIndexOf("node_modules"));
2285
+ var mainFilename = __dirname.substring(0, __dirname.lastIndexOf("node_modules"));
4223
2286
  var esm_default = {
4224
2287
  assert: {
4225
2288
  notStrictEqual: import_assert.notStrictEqual,
@@ -4264,7 +2327,7 @@ var esm_default = {
4264
2327
  return [...str].length;
4265
2328
  },
4266
2329
  y18n: y18n_default({
4267
- directory: (0, import_path4.resolve)(__dirname2, "../../../locales"),
2330
+ directory: (0, import_path4.resolve)(__dirname, "../../../locales"),
4268
2331
  updateFiles: false
4269
2332
  })
4270
2333
  };
@@ -7599,7 +5662,7 @@ async function main() {
7599
5662
  });
7600
5663
  const killDevServer = () => {
7601
5664
  devProcess.kill("SIGKILL");
7602
- return fkill(`:${port}`, { force: true }).catch((err) => {
5665
+ return (0, import_cross_port_killer.kill)(port).catch((err) => {
7603
5666
  console.error(`Plasmic: Failed to kill dev server: ${err}`);
7604
5667
  });
7605
5668
  };