@plasmicapp/nextjs-app-router 1.0.15 → 1.0.17

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) {
@@ -334,17 +443,17 @@ var require_escape = __commonJS({
334
443
  }
335
444
  });
336
445
 
337
- // ../../node_modules/cross-spawn/node_modules/shebang-regex/index.js
446
+ // ../../node_modules/shebang-regex/index.js
338
447
  var require_shebang_regex = __commonJS({
339
- "../../node_modules/cross-spawn/node_modules/shebang-regex/index.js"(exports, module2) {
448
+ "../../node_modules/shebang-regex/index.js"(exports, module2) {
340
449
  "use strict";
341
450
  module2.exports = /^#!(.*)/;
342
451
  }
343
452
  });
344
453
 
345
- // ../../node_modules/cross-spawn/node_modules/shebang-command/index.js
454
+ // ../../node_modules/shebang-command/index.js
346
455
  var require_shebang_command = __commonJS({
347
- "../../node_modules/cross-spawn/node_modules/shebang-command/index.js"(exports, module2) {
456
+ "../../node_modules/shebang-command/index.js"(exports, module2) {
348
457
  "use strict";
349
458
  var shebangRegex = require_shebang_regex();
350
459
  module2.exports = (string = "") => {
@@ -523,2262 +632,8 @@ var require_cross_spawn = __commonJS({
523
632
  }
524
633
  });
525
634
 
526
- // ../../node_modules/kill-port-process/dist/lib/helpers.js
527
- var require_helpers = __commonJS({
528
- "../../node_modules/kill-port-process/dist/lib/helpers.js"(exports) {
529
- "use strict";
530
- Object.defineProperty(exports, "__esModule", { value: true });
531
- exports.mergeOptions = exports.arrayifyInput = exports.isNullOrUndefined = void 0;
532
- function isNullOrUndefined(input) {
533
- if (input === void 0 || input === null) {
534
- return true;
535
- }
536
- return false;
537
- }
538
- exports.isNullOrUndefined = isNullOrUndefined;
539
- function arrayifyInput(input) {
540
- return Array.isArray(input) ? input : [input];
541
- }
542
- exports.arrayifyInput = arrayifyInput;
543
- function mergeOptions(options) {
544
- const defaultOptions = {
545
- signal: "SIGKILL"
546
- };
547
- return Object.assign(Object.assign({}, defaultOptions), options);
548
- }
549
- exports.mergeOptions = mergeOptions;
550
- }
551
- });
552
-
553
- // ../../node_modules/which/which.js
554
- var require_which2 = __commonJS({
555
- "../../node_modules/which/which.js"(exports, module2) {
556
- module2.exports = which;
557
- which.sync = whichSync;
558
- var isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
559
- var path = require("path");
560
- var COLON = isWindows ? ";" : ":";
561
- var isexe = require_isexe();
562
- function getNotFoundError(cmd) {
563
- var er = new Error("not found: " + cmd);
564
- er.code = "ENOENT";
565
- return er;
566
- }
567
- function getPathInfo(cmd, opt) {
568
- var colon = opt.colon || COLON;
569
- var pathEnv = opt.path || process.env.PATH || "";
570
- var pathExt = [""];
571
- pathEnv = pathEnv.split(colon);
572
- var pathExtExe = "";
573
- if (isWindows) {
574
- pathEnv.unshift(process.cwd());
575
- pathExtExe = opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM";
576
- pathExt = pathExtExe.split(colon);
577
- if (cmd.indexOf(".") !== -1 && pathExt[0] !== "")
578
- pathExt.unshift("");
579
- }
580
- if (cmd.match(/\//) || isWindows && cmd.match(/\\/))
581
- pathEnv = [""];
582
- return {
583
- env: pathEnv,
584
- ext: pathExt,
585
- extExe: pathExtExe
586
- };
587
- }
588
- function which(cmd, opt, cb) {
589
- if (typeof opt === "function") {
590
- cb = opt;
591
- opt = {};
592
- }
593
- var info = getPathInfo(cmd, opt);
594
- var pathEnv = info.env;
595
- var pathExt = info.ext;
596
- var pathExtExe = info.extExe;
597
- var found = [];
598
- (function F(i, l) {
599
- if (i === l) {
600
- if (opt.all && found.length)
601
- return cb(null, found);
602
- else
603
- return cb(getNotFoundError(cmd));
604
- }
605
- var pathPart = pathEnv[i];
606
- if (pathPart.charAt(0) === '"' && pathPart.slice(-1) === '"')
607
- pathPart = pathPart.slice(1, -1);
608
- var p = path.join(pathPart, cmd);
609
- if (!pathPart && /^\.[\\\/]/.test(cmd)) {
610
- p = cmd.slice(0, 2) + p;
611
- }
612
- ;
613
- (function E(ii, ll) {
614
- if (ii === ll)
615
- return F(i + 1, l);
616
- var ext = pathExt[ii];
617
- isexe(p + ext, { pathExt: pathExtExe }, function(er, is) {
618
- if (!er && is) {
619
- if (opt.all)
620
- found.push(p + ext);
621
- else
622
- return cb(null, p + ext);
623
- }
624
- return E(ii + 1, ll);
625
- });
626
- })(0, pathExt.length);
627
- })(0, pathEnv.length);
628
- }
629
- function whichSync(cmd, opt) {
630
- opt = opt || {};
631
- var info = getPathInfo(cmd, opt);
632
- var pathEnv = info.env;
633
- var pathExt = info.ext;
634
- var pathExtExe = info.extExe;
635
- var found = [];
636
- for (var i = 0, l = pathEnv.length; i < l; i++) {
637
- var pathPart = pathEnv[i];
638
- if (pathPart.charAt(0) === '"' && pathPart.slice(-1) === '"')
639
- pathPart = pathPart.slice(1, -1);
640
- var p = path.join(pathPart, cmd);
641
- if (!pathPart && /^\.[\\\/]/.test(cmd)) {
642
- p = cmd.slice(0, 2) + p;
643
- }
644
- for (var j = 0, ll = pathExt.length; j < ll; j++) {
645
- var cur = p + pathExt[j];
646
- var is;
647
- try {
648
- is = isexe.sync(cur, { pathExt: pathExtExe });
649
- if (is) {
650
- if (opt.all)
651
- found.push(cur);
652
- else
653
- return cur;
654
- }
655
- } catch (ex) {
656
- }
657
- }
658
- }
659
- if (opt.all && found.length)
660
- return found;
661
- if (opt.nothrow)
662
- return null;
663
- throw getNotFoundError(cmd);
664
- }
665
- }
666
- });
667
-
668
- // ../../node_modules/pseudomap/pseudomap.js
669
- var require_pseudomap = __commonJS({
670
- "../../node_modules/pseudomap/pseudomap.js"(exports, module2) {
671
- var hasOwnProperty = Object.prototype.hasOwnProperty;
672
- module2.exports = PseudoMap;
673
- function PseudoMap(set2) {
674
- if (!(this instanceof PseudoMap))
675
- throw new TypeError("Constructor PseudoMap requires 'new'");
676
- this.clear();
677
- if (set2) {
678
- if (set2 instanceof PseudoMap || typeof Map === "function" && set2 instanceof Map)
679
- set2.forEach(function(value, key) {
680
- this.set(key, value);
681
- }, this);
682
- else if (Array.isArray(set2))
683
- set2.forEach(function(kv) {
684
- this.set(kv[0], kv[1]);
685
- }, this);
686
- else
687
- throw new TypeError("invalid argument");
688
- }
689
- }
690
- PseudoMap.prototype.forEach = function(fn, thisp) {
691
- thisp = thisp || this;
692
- Object.keys(this._data).forEach(function(k) {
693
- if (k !== "size")
694
- fn.call(thisp, this._data[k].value, this._data[k].key);
695
- }, this);
696
- };
697
- PseudoMap.prototype.has = function(k) {
698
- return !!find(this._data, k);
699
- };
700
- PseudoMap.prototype.get = function(k) {
701
- var res = find(this._data, k);
702
- return res && res.value;
703
- };
704
- PseudoMap.prototype.set = function(k, v) {
705
- set(this._data, k, v);
706
- };
707
- PseudoMap.prototype.delete = function(k) {
708
- var res = find(this._data, k);
709
- if (res) {
710
- delete this._data[res._index];
711
- this._data.size--;
712
- }
713
- };
714
- PseudoMap.prototype.clear = function() {
715
- var data = /* @__PURE__ */ Object.create(null);
716
- data.size = 0;
717
- Object.defineProperty(this, "_data", {
718
- value: data,
719
- enumerable: false,
720
- configurable: true,
721
- writable: false
722
- });
723
- };
724
- Object.defineProperty(PseudoMap.prototype, "size", {
725
- get: function() {
726
- return this._data.size;
727
- },
728
- set: function(n) {
729
- },
730
- enumerable: true,
731
- configurable: true
732
- });
733
- PseudoMap.prototype.values = PseudoMap.prototype.keys = PseudoMap.prototype.entries = function() {
734
- throw new Error("iterators are not implemented in this version");
735
- };
736
- function same(a, b) {
737
- return a === b || a !== a && b !== b;
738
- }
739
- function Entry(k, v, i) {
740
- this.key = k;
741
- this.value = v;
742
- this._index = i;
743
- }
744
- function find(data, k) {
745
- for (var i = 0, s = "_" + k, key = s; hasOwnProperty.call(data, key); key = s + i++) {
746
- if (same(data[key].key, k))
747
- return data[key];
748
- }
749
- }
750
- function set(data, k, v) {
751
- for (var i = 0, s = "_" + k, key = s; hasOwnProperty.call(data, key); key = s + i++) {
752
- if (same(data[key].key, k)) {
753
- data[key].value = v;
754
- return;
755
- }
756
- }
757
- data.size++;
758
- data[key] = new Entry(k, v, key);
759
- }
760
- }
761
- });
762
-
763
- // ../../node_modules/pseudomap/map.js
764
- var require_map = __commonJS({
765
- "../../node_modules/pseudomap/map.js"(exports, module2) {
766
- if (process.env.npm_package_name === "pseudomap" && process.env.npm_lifecycle_script === "test")
767
- process.env.TEST_PSEUDOMAP = "true";
768
- if (typeof Map === "function" && !process.env.TEST_PSEUDOMAP) {
769
- module2.exports = Map;
770
- } else {
771
- module2.exports = require_pseudomap();
772
- }
773
- }
774
- });
775
-
776
- // ../../node_modules/pid-from-port/node_modules/yallist/yallist.js
777
- var require_yallist = __commonJS({
778
- "../../node_modules/pid-from-port/node_modules/yallist/yallist.js"(exports, module2) {
779
- module2.exports = Yallist;
780
- Yallist.Node = Node;
781
- Yallist.create = Yallist;
782
- function Yallist(list) {
783
- var self = this;
784
- if (!(self instanceof Yallist)) {
785
- self = new Yallist();
786
- }
787
- self.tail = null;
788
- self.head = null;
789
- self.length = 0;
790
- if (list && typeof list.forEach === "function") {
791
- list.forEach(function(item) {
792
- self.push(item);
793
- });
794
- } else if (arguments.length > 0) {
795
- for (var i = 0, l = arguments.length; i < l; i++) {
796
- self.push(arguments[i]);
797
- }
798
- }
799
- return self;
800
- }
801
- Yallist.prototype.removeNode = function(node) {
802
- if (node.list !== this) {
803
- throw new Error("removing node which does not belong to this list");
804
- }
805
- var next = node.next;
806
- var prev = node.prev;
807
- if (next) {
808
- next.prev = prev;
809
- }
810
- if (prev) {
811
- prev.next = next;
812
- }
813
- if (node === this.head) {
814
- this.head = next;
815
- }
816
- if (node === this.tail) {
817
- this.tail = prev;
818
- }
819
- node.list.length--;
820
- node.next = null;
821
- node.prev = null;
822
- node.list = null;
823
- };
824
- Yallist.prototype.unshiftNode = function(node) {
825
- if (node === this.head) {
826
- return;
827
- }
828
- if (node.list) {
829
- node.list.removeNode(node);
830
- }
831
- var head = this.head;
832
- node.list = this;
833
- node.next = head;
834
- if (head) {
835
- head.prev = node;
836
- }
837
- this.head = node;
838
- if (!this.tail) {
839
- this.tail = node;
840
- }
841
- this.length++;
842
- };
843
- Yallist.prototype.pushNode = function(node) {
844
- if (node === this.tail) {
845
- return;
846
- }
847
- if (node.list) {
848
- node.list.removeNode(node);
849
- }
850
- var tail = this.tail;
851
- node.list = this;
852
- node.prev = tail;
853
- if (tail) {
854
- tail.next = node;
855
- }
856
- this.tail = node;
857
- if (!this.head) {
858
- this.head = node;
859
- }
860
- this.length++;
861
- };
862
- Yallist.prototype.push = function() {
863
- for (var i = 0, l = arguments.length; i < l; i++) {
864
- push(this, arguments[i]);
865
- }
866
- return this.length;
867
- };
868
- Yallist.prototype.unshift = function() {
869
- for (var i = 0, l = arguments.length; i < l; i++) {
870
- unshift(this, arguments[i]);
871
- }
872
- return this.length;
873
- };
874
- Yallist.prototype.pop = function() {
875
- if (!this.tail) {
876
- return void 0;
877
- }
878
- var res = this.tail.value;
879
- this.tail = this.tail.prev;
880
- if (this.tail) {
881
- this.tail.next = null;
882
- } else {
883
- this.head = null;
884
- }
885
- this.length--;
886
- return res;
887
- };
888
- Yallist.prototype.shift = function() {
889
- if (!this.head) {
890
- return void 0;
891
- }
892
- var res = this.head.value;
893
- this.head = this.head.next;
894
- if (this.head) {
895
- this.head.prev = null;
896
- } else {
897
- this.tail = null;
898
- }
899
- this.length--;
900
- return res;
901
- };
902
- Yallist.prototype.forEach = function(fn, thisp) {
903
- thisp = thisp || this;
904
- for (var walker = this.head, i = 0; walker !== null; i++) {
905
- fn.call(thisp, walker.value, i, this);
906
- walker = walker.next;
907
- }
908
- };
909
- Yallist.prototype.forEachReverse = function(fn, thisp) {
910
- thisp = thisp || this;
911
- for (var walker = this.tail, i = this.length - 1; walker !== null; i--) {
912
- fn.call(thisp, walker.value, i, this);
913
- walker = walker.prev;
914
- }
915
- };
916
- Yallist.prototype.get = function(n) {
917
- for (var i = 0, walker = this.head; walker !== null && i < n; i++) {
918
- walker = walker.next;
919
- }
920
- if (i === n && walker !== null) {
921
- return walker.value;
922
- }
923
- };
924
- Yallist.prototype.getReverse = function(n) {
925
- for (var i = 0, walker = this.tail; walker !== null && i < n; i++) {
926
- walker = walker.prev;
927
- }
928
- if (i === n && walker !== null) {
929
- return walker.value;
930
- }
931
- };
932
- Yallist.prototype.map = function(fn, thisp) {
933
- thisp = thisp || this;
934
- var res = new Yallist();
935
- for (var walker = this.head; walker !== null; ) {
936
- res.push(fn.call(thisp, walker.value, this));
937
- walker = walker.next;
938
- }
939
- return res;
940
- };
941
- Yallist.prototype.mapReverse = function(fn, thisp) {
942
- thisp = thisp || this;
943
- var res = new Yallist();
944
- for (var walker = this.tail; walker !== null; ) {
945
- res.push(fn.call(thisp, walker.value, this));
946
- walker = walker.prev;
947
- }
948
- return res;
949
- };
950
- Yallist.prototype.reduce = function(fn, initial) {
951
- var acc;
952
- var walker = this.head;
953
- if (arguments.length > 1) {
954
- acc = initial;
955
- } else if (this.head) {
956
- walker = this.head.next;
957
- acc = this.head.value;
958
- } else {
959
- throw new TypeError("Reduce of empty list with no initial value");
960
- }
961
- for (var i = 0; walker !== null; i++) {
962
- acc = fn(acc, walker.value, i);
963
- walker = walker.next;
964
- }
965
- return acc;
966
- };
967
- Yallist.prototype.reduceReverse = function(fn, initial) {
968
- var acc;
969
- var walker = this.tail;
970
- if (arguments.length > 1) {
971
- acc = initial;
972
- } else if (this.tail) {
973
- walker = this.tail.prev;
974
- acc = this.tail.value;
975
- } else {
976
- throw new TypeError("Reduce of empty list with no initial value");
977
- }
978
- for (var i = this.length - 1; walker !== null; i--) {
979
- acc = fn(acc, walker.value, i);
980
- walker = walker.prev;
981
- }
982
- return acc;
983
- };
984
- Yallist.prototype.toArray = function() {
985
- var arr = new Array(this.length);
986
- for (var i = 0, walker = this.head; walker !== null; i++) {
987
- arr[i] = walker.value;
988
- walker = walker.next;
989
- }
990
- return arr;
991
- };
992
- Yallist.prototype.toArrayReverse = function() {
993
- var arr = new Array(this.length);
994
- for (var i = 0, walker = this.tail; walker !== null; i++) {
995
- arr[i] = walker.value;
996
- walker = walker.prev;
997
- }
998
- return arr;
999
- };
1000
- Yallist.prototype.slice = function(from, to) {
1001
- to = to || this.length;
1002
- if (to < 0) {
1003
- to += this.length;
1004
- }
1005
- from = from || 0;
1006
- if (from < 0) {
1007
- from += this.length;
1008
- }
1009
- var ret = new Yallist();
1010
- if (to < from || to < 0) {
1011
- return ret;
1012
- }
1013
- if (from < 0) {
1014
- from = 0;
1015
- }
1016
- if (to > this.length) {
1017
- to = this.length;
1018
- }
1019
- for (var i = 0, walker = this.head; walker !== null && i < from; i++) {
1020
- walker = walker.next;
1021
- }
1022
- for (; walker !== null && i < to; i++, walker = walker.next) {
1023
- ret.push(walker.value);
1024
- }
1025
- return ret;
1026
- };
1027
- Yallist.prototype.sliceReverse = function(from, to) {
1028
- to = to || this.length;
1029
- if (to < 0) {
1030
- to += this.length;
1031
- }
1032
- from = from || 0;
1033
- if (from < 0) {
1034
- from += this.length;
1035
- }
1036
- var ret = new Yallist();
1037
- if (to < from || to < 0) {
1038
- return ret;
1039
- }
1040
- if (from < 0) {
1041
- from = 0;
1042
- }
1043
- if (to > this.length) {
1044
- to = this.length;
1045
- }
1046
- for (var i = this.length, walker = this.tail; walker !== null && i > to; i--) {
1047
- walker = walker.prev;
1048
- }
1049
- for (; walker !== null && i > from; i--, walker = walker.prev) {
1050
- ret.push(walker.value);
1051
- }
1052
- return ret;
1053
- };
1054
- Yallist.prototype.reverse = function() {
1055
- var head = this.head;
1056
- var tail = this.tail;
1057
- for (var walker = head; walker !== null; walker = walker.prev) {
1058
- var p = walker.prev;
1059
- walker.prev = walker.next;
1060
- walker.next = p;
1061
- }
1062
- this.head = tail;
1063
- this.tail = head;
1064
- return this;
1065
- };
1066
- function push(self, item) {
1067
- self.tail = new Node(item, self.tail, null, self);
1068
- if (!self.head) {
1069
- self.head = self.tail;
1070
- }
1071
- self.length++;
1072
- }
1073
- function unshift(self, item) {
1074
- self.head = new Node(item, null, self.head, self);
1075
- if (!self.tail) {
1076
- self.tail = self.head;
1077
- }
1078
- self.length++;
1079
- }
1080
- function Node(value, prev, next, list) {
1081
- if (!(this instanceof Node)) {
1082
- return new Node(value, prev, next, list);
1083
- }
1084
- this.list = list;
1085
- this.value = value;
1086
- if (prev) {
1087
- prev.next = this;
1088
- this.prev = prev;
1089
- } else {
1090
- this.prev = null;
1091
- }
1092
- if (next) {
1093
- next.prev = this;
1094
- this.next = next;
1095
- } else {
1096
- this.next = null;
1097
- }
1098
- }
1099
- }
1100
- });
1101
-
1102
- // ../../node_modules/pid-from-port/node_modules/lru-cache/index.js
1103
- var require_lru_cache = __commonJS({
1104
- "../../node_modules/pid-from-port/node_modules/lru-cache/index.js"(exports, module2) {
1105
- "use strict";
1106
- module2.exports = LRUCache;
1107
- var Map2 = require_map();
1108
- var util = require("util");
1109
- var Yallist = require_yallist();
1110
- var hasSymbol = typeof Symbol === "function" && process.env._nodeLRUCacheForceNoSymbol !== "1";
1111
- var makeSymbol;
1112
- if (hasSymbol) {
1113
- makeSymbol = function(key) {
1114
- return Symbol(key);
1115
- };
1116
- } else {
1117
- makeSymbol = function(key) {
1118
- return "_" + key;
1119
- };
1120
- }
1121
- var MAX = makeSymbol("max");
1122
- var LENGTH = makeSymbol("length");
1123
- var LENGTH_CALCULATOR = makeSymbol("lengthCalculator");
1124
- var ALLOW_STALE = makeSymbol("allowStale");
1125
- var MAX_AGE = makeSymbol("maxAge");
1126
- var DISPOSE = makeSymbol("dispose");
1127
- var NO_DISPOSE_ON_SET = makeSymbol("noDisposeOnSet");
1128
- var LRU_LIST = makeSymbol("lruList");
1129
- var CACHE = makeSymbol("cache");
1130
- function naiveLength() {
1131
- return 1;
1132
- }
1133
- function LRUCache(options) {
1134
- if (!(this instanceof LRUCache)) {
1135
- return new LRUCache(options);
1136
- }
1137
- if (typeof options === "number") {
1138
- options = { max: options };
1139
- }
1140
- if (!options) {
1141
- options = {};
1142
- }
1143
- var max = this[MAX] = options.max;
1144
- if (!max || !(typeof max === "number") || max <= 0) {
1145
- this[MAX] = Infinity;
1146
- }
1147
- var lc = options.length || naiveLength;
1148
- if (typeof lc !== "function") {
1149
- lc = naiveLength;
1150
- }
1151
- this[LENGTH_CALCULATOR] = lc;
1152
- this[ALLOW_STALE] = options.stale || false;
1153
- this[MAX_AGE] = options.maxAge || 0;
1154
- this[DISPOSE] = options.dispose;
1155
- this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false;
1156
- this.reset();
1157
- }
1158
- Object.defineProperty(LRUCache.prototype, "max", {
1159
- set: function(mL) {
1160
- if (!mL || !(typeof mL === "number") || mL <= 0) {
1161
- mL = Infinity;
1162
- }
1163
- this[MAX] = mL;
1164
- trim(this);
1165
- },
1166
- get: function() {
1167
- return this[MAX];
1168
- },
1169
- enumerable: true
1170
- });
1171
- Object.defineProperty(LRUCache.prototype, "allowStale", {
1172
- set: function(allowStale) {
1173
- this[ALLOW_STALE] = !!allowStale;
1174
- },
1175
- get: function() {
1176
- return this[ALLOW_STALE];
1177
- },
1178
- enumerable: true
1179
- });
1180
- Object.defineProperty(LRUCache.prototype, "maxAge", {
1181
- set: function(mA) {
1182
- if (!mA || !(typeof mA === "number") || mA < 0) {
1183
- mA = 0;
1184
- }
1185
- this[MAX_AGE] = mA;
1186
- trim(this);
1187
- },
1188
- get: function() {
1189
- return this[MAX_AGE];
1190
- },
1191
- enumerable: true
1192
- });
1193
- Object.defineProperty(LRUCache.prototype, "lengthCalculator", {
1194
- set: function(lC) {
1195
- if (typeof lC !== "function") {
1196
- lC = naiveLength;
1197
- }
1198
- if (lC !== this[LENGTH_CALCULATOR]) {
1199
- this[LENGTH_CALCULATOR] = lC;
1200
- this[LENGTH] = 0;
1201
- this[LRU_LIST].forEach(function(hit) {
1202
- hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key);
1203
- this[LENGTH] += hit.length;
1204
- }, this);
1205
- }
1206
- trim(this);
1207
- },
1208
- get: function() {
1209
- return this[LENGTH_CALCULATOR];
1210
- },
1211
- enumerable: true
1212
- });
1213
- Object.defineProperty(LRUCache.prototype, "length", {
1214
- get: function() {
1215
- return this[LENGTH];
1216
- },
1217
- enumerable: true
1218
- });
1219
- Object.defineProperty(LRUCache.prototype, "itemCount", {
1220
- get: function() {
1221
- return this[LRU_LIST].length;
1222
- },
1223
- enumerable: true
1224
- });
1225
- LRUCache.prototype.rforEach = function(fn, thisp) {
1226
- thisp = thisp || this;
1227
- for (var walker = this[LRU_LIST].tail; walker !== null; ) {
1228
- var prev = walker.prev;
1229
- forEachStep(this, fn, walker, thisp);
1230
- walker = prev;
1231
- }
1232
- };
1233
- function forEachStep(self, fn, node, thisp) {
1234
- var hit = node.value;
1235
- if (isStale(self, hit)) {
1236
- del(self, node);
1237
- if (!self[ALLOW_STALE]) {
1238
- hit = void 0;
1239
- }
1240
- }
1241
- if (hit) {
1242
- fn.call(thisp, hit.value, hit.key, self);
1243
- }
1244
- }
1245
- LRUCache.prototype.forEach = function(fn, thisp) {
1246
- thisp = thisp || this;
1247
- for (var walker = this[LRU_LIST].head; walker !== null; ) {
1248
- var next = walker.next;
1249
- forEachStep(this, fn, walker, thisp);
1250
- walker = next;
1251
- }
1252
- };
1253
- LRUCache.prototype.keys = function() {
1254
- return this[LRU_LIST].toArray().map(function(k) {
1255
- return k.key;
1256
- }, this);
1257
- };
1258
- LRUCache.prototype.values = function() {
1259
- return this[LRU_LIST].toArray().map(function(k) {
1260
- return k.value;
1261
- }, this);
1262
- };
1263
- LRUCache.prototype.reset = function() {
1264
- if (this[DISPOSE] && this[LRU_LIST] && this[LRU_LIST].length) {
1265
- this[LRU_LIST].forEach(function(hit) {
1266
- this[DISPOSE](hit.key, hit.value);
1267
- }, this);
1268
- }
1269
- this[CACHE] = new Map2();
1270
- this[LRU_LIST] = new Yallist();
1271
- this[LENGTH] = 0;
1272
- };
1273
- LRUCache.prototype.dump = function() {
1274
- return this[LRU_LIST].map(function(hit) {
1275
- if (!isStale(this, hit)) {
1276
- return {
1277
- k: hit.key,
1278
- v: hit.value,
1279
- e: hit.now + (hit.maxAge || 0)
1280
- };
1281
- }
1282
- }, this).toArray().filter(function(h) {
1283
- return h;
1284
- });
1285
- };
1286
- LRUCache.prototype.dumpLru = function() {
1287
- return this[LRU_LIST];
1288
- };
1289
- LRUCache.prototype.inspect = function(n, opts) {
1290
- var str = "LRUCache {";
1291
- var extras = false;
1292
- var as = this[ALLOW_STALE];
1293
- if (as) {
1294
- str += "\n allowStale: true";
1295
- extras = true;
1296
- }
1297
- var max = this[MAX];
1298
- if (max && max !== Infinity) {
1299
- if (extras) {
1300
- str += ",";
1301
- }
1302
- str += "\n max: " + util.inspect(max, opts);
1303
- extras = true;
1304
- }
1305
- var maxAge = this[MAX_AGE];
1306
- if (maxAge) {
1307
- if (extras) {
1308
- str += ",";
1309
- }
1310
- str += "\n maxAge: " + util.inspect(maxAge, opts);
1311
- extras = true;
1312
- }
1313
- var lc = this[LENGTH_CALCULATOR];
1314
- if (lc && lc !== naiveLength) {
1315
- if (extras) {
1316
- str += ",";
1317
- }
1318
- str += "\n length: " + util.inspect(this[LENGTH], opts);
1319
- extras = true;
1320
- }
1321
- var didFirst = false;
1322
- this[LRU_LIST].forEach(function(item) {
1323
- if (didFirst) {
1324
- str += ",\n ";
1325
- } else {
1326
- if (extras) {
1327
- str += ",\n";
1328
- }
1329
- didFirst = true;
1330
- str += "\n ";
1331
- }
1332
- var key = util.inspect(item.key).split("\n").join("\n ");
1333
- var val = { value: item.value };
1334
- if (item.maxAge !== maxAge) {
1335
- val.maxAge = item.maxAge;
1336
- }
1337
- if (lc !== naiveLength) {
1338
- val.length = item.length;
1339
- }
1340
- if (isStale(this, item)) {
1341
- val.stale = true;
1342
- }
1343
- val = util.inspect(val, opts).split("\n").join("\n ");
1344
- str += key + " => " + val;
1345
- });
1346
- if (didFirst || extras) {
1347
- str += "\n";
1348
- }
1349
- str += "}";
1350
- return str;
1351
- };
1352
- LRUCache.prototype.set = function(key, value, maxAge) {
1353
- maxAge = maxAge || this[MAX_AGE];
1354
- var now = maxAge ? Date.now() : 0;
1355
- var len = this[LENGTH_CALCULATOR](value, key);
1356
- if (this[CACHE].has(key)) {
1357
- if (len > this[MAX]) {
1358
- del(this, this[CACHE].get(key));
1359
- return false;
1360
- }
1361
- var node = this[CACHE].get(key);
1362
- var item = node.value;
1363
- if (this[DISPOSE]) {
1364
- if (!this[NO_DISPOSE_ON_SET]) {
1365
- this[DISPOSE](key, item.value);
1366
- }
1367
- }
1368
- item.now = now;
1369
- item.maxAge = maxAge;
1370
- item.value = value;
1371
- this[LENGTH] += len - item.length;
1372
- item.length = len;
1373
- this.get(key);
1374
- trim(this);
1375
- return true;
1376
- }
1377
- var hit = new Entry(key, value, len, now, maxAge);
1378
- if (hit.length > this[MAX]) {
1379
- if (this[DISPOSE]) {
1380
- this[DISPOSE](key, value);
1381
- }
1382
- return false;
1383
- }
1384
- this[LENGTH] += hit.length;
1385
- this[LRU_LIST].unshift(hit);
1386
- this[CACHE].set(key, this[LRU_LIST].head);
1387
- trim(this);
1388
- return true;
1389
- };
1390
- LRUCache.prototype.has = function(key) {
1391
- if (!this[CACHE].has(key))
1392
- return false;
1393
- var hit = this[CACHE].get(key).value;
1394
- if (isStale(this, hit)) {
1395
- return false;
1396
- }
1397
- return true;
1398
- };
1399
- LRUCache.prototype.get = function(key) {
1400
- return get(this, key, true);
1401
- };
1402
- LRUCache.prototype.peek = function(key) {
1403
- return get(this, key, false);
1404
- };
1405
- LRUCache.prototype.pop = function() {
1406
- var node = this[LRU_LIST].tail;
1407
- if (!node)
1408
- return null;
1409
- del(this, node);
1410
- return node.value;
1411
- };
1412
- LRUCache.prototype.del = function(key) {
1413
- del(this, this[CACHE].get(key));
1414
- };
1415
- LRUCache.prototype.load = function(arr) {
1416
- this.reset();
1417
- var now = Date.now();
1418
- for (var l = arr.length - 1; l >= 0; l--) {
1419
- var hit = arr[l];
1420
- var expiresAt = hit.e || 0;
1421
- if (expiresAt === 0) {
1422
- this.set(hit.k, hit.v);
1423
- } else {
1424
- var maxAge = expiresAt - now;
1425
- if (maxAge > 0) {
1426
- this.set(hit.k, hit.v, maxAge);
1427
- }
1428
- }
1429
- }
1430
- };
1431
- LRUCache.prototype.prune = function() {
1432
- var self = this;
1433
- this[CACHE].forEach(function(value, key) {
1434
- get(self, key, false);
1435
- });
1436
- };
1437
- function get(self, key, doUse) {
1438
- var node = self[CACHE].get(key);
1439
- if (node) {
1440
- var hit = node.value;
1441
- if (isStale(self, hit)) {
1442
- del(self, node);
1443
- if (!self[ALLOW_STALE])
1444
- hit = void 0;
1445
- } else {
1446
- if (doUse) {
1447
- self[LRU_LIST].unshiftNode(node);
1448
- }
1449
- }
1450
- if (hit)
1451
- hit = hit.value;
1452
- }
1453
- return hit;
1454
- }
1455
- function isStale(self, hit) {
1456
- if (!hit || !hit.maxAge && !self[MAX_AGE]) {
1457
- return false;
1458
- }
1459
- var stale = false;
1460
- var diff = Date.now() - hit.now;
1461
- if (hit.maxAge) {
1462
- stale = diff > hit.maxAge;
1463
- } else {
1464
- stale = self[MAX_AGE] && diff > self[MAX_AGE];
1465
- }
1466
- return stale;
1467
- }
1468
- function trim(self) {
1469
- if (self[LENGTH] > self[MAX]) {
1470
- for (var walker = self[LRU_LIST].tail; self[LENGTH] > self[MAX] && walker !== null; ) {
1471
- var prev = walker.prev;
1472
- del(self, walker);
1473
- walker = prev;
1474
- }
1475
- }
1476
- }
1477
- function del(self, node) {
1478
- if (node) {
1479
- var hit = node.value;
1480
- if (self[DISPOSE]) {
1481
- self[DISPOSE](hit.key, hit.value);
1482
- }
1483
- self[LENGTH] -= hit.length;
1484
- self[CACHE].delete(hit.key);
1485
- self[LRU_LIST].removeNode(node);
1486
- }
1487
- }
1488
- function Entry(key, value, length, now, maxAge) {
1489
- this.key = key;
1490
- this.value = value;
1491
- this.length = length;
1492
- this.now = now;
1493
- this.maxAge = maxAge || 0;
1494
- }
1495
- }
1496
- });
1497
-
1498
- // ../../node_modules/pid-from-port/node_modules/cross-spawn/lib/util/resolveCommand.js
1499
- var require_resolveCommand2 = __commonJS({
1500
- "../../node_modules/pid-from-port/node_modules/cross-spawn/lib/util/resolveCommand.js"(exports, module2) {
1501
- "use strict";
1502
- var path = require("path");
1503
- var which = require_which2();
1504
- var LRU = require_lru_cache();
1505
- var commandCache = new LRU({ max: 50, maxAge: 30 * 1e3 });
1506
- function resolveCommand(command2, noExtension) {
1507
- var resolved;
1508
- noExtension = !!noExtension;
1509
- resolved = commandCache.get(command2 + "!" + noExtension);
1510
- if (commandCache.has(command2)) {
1511
- return commandCache.get(command2);
1512
- }
1513
- try {
1514
- resolved = !noExtension ? which.sync(command2) : which.sync(command2, { pathExt: path.delimiter + (process.env.PATHEXT || "") });
1515
- } catch (e) {
1516
- }
1517
- commandCache.set(command2 + "!" + noExtension, resolved);
1518
- return resolved;
1519
- }
1520
- module2.exports = resolveCommand;
1521
- }
1522
- });
1523
-
1524
- // ../../node_modules/pid-from-port/node_modules/cross-spawn/lib/util/hasEmptyArgumentBug.js
1525
- var require_hasEmptyArgumentBug = __commonJS({
1526
- "../../node_modules/pid-from-port/node_modules/cross-spawn/lib/util/hasEmptyArgumentBug.js"(exports, module2) {
1527
- "use strict";
1528
- function hasEmptyArgumentBug() {
1529
- var nodeVer;
1530
- if (process.platform !== "win32") {
1531
- return false;
1532
- }
1533
- nodeVer = process.version.substr(1).split(".").map(function(num) {
1534
- return parseInt(num, 10);
1535
- });
1536
- return nodeVer[0] === 0 && nodeVer[1] < 12;
1537
- }
1538
- module2.exports = hasEmptyArgumentBug();
1539
- }
1540
- });
1541
-
1542
- // ../../node_modules/pid-from-port/node_modules/cross-spawn/lib/util/escapeArgument.js
1543
- var require_escapeArgument = __commonJS({
1544
- "../../node_modules/pid-from-port/node_modules/cross-spawn/lib/util/escapeArgument.js"(exports, module2) {
1545
- "use strict";
1546
- function escapeArgument(arg, quote) {
1547
- arg = "" + arg;
1548
- if (!quote) {
1549
- arg = arg.replace(/([()%!^<>&|;,"'\s])/g, "^$1");
1550
- } else {
1551
- arg = arg.replace(/(\\*)"/g, '$1$1\\"');
1552
- arg = arg.replace(/(\\*)$/, "$1$1");
1553
- arg = '"' + arg + '"';
1554
- }
1555
- return arg;
1556
- }
1557
- module2.exports = escapeArgument;
1558
- }
1559
- });
1560
-
1561
- // ../../node_modules/pid-from-port/node_modules/cross-spawn/lib/util/escapeCommand.js
1562
- var require_escapeCommand = __commonJS({
1563
- "../../node_modules/pid-from-port/node_modules/cross-spawn/lib/util/escapeCommand.js"(exports, module2) {
1564
- "use strict";
1565
- var escapeArgument = require_escapeArgument();
1566
- function escapeCommand(command2) {
1567
- return /^[a-z0-9_-]+$/i.test(command2) ? command2 : escapeArgument(command2, true);
1568
- }
1569
- module2.exports = escapeCommand;
1570
- }
1571
- });
1572
-
1573
- // ../../node_modules/shebang-regex/index.js
1574
- var require_shebang_regex2 = __commonJS({
1575
- "../../node_modules/shebang-regex/index.js"(exports, module2) {
1576
- "use strict";
1577
- module2.exports = /^#!.*/;
1578
- }
1579
- });
1580
-
1581
- // ../../node_modules/shebang-command/index.js
1582
- var require_shebang_command2 = __commonJS({
1583
- "../../node_modules/shebang-command/index.js"(exports, module2) {
1584
- "use strict";
1585
- var shebangRegex = require_shebang_regex2();
1586
- module2.exports = function(str) {
1587
- var match = str.match(shebangRegex);
1588
- if (!match) {
1589
- return null;
1590
- }
1591
- var arr = match[0].replace(/#! ?/, "").split(" ");
1592
- var bin = arr[0].split("/").pop();
1593
- var arg = arr[1];
1594
- return bin === "env" ? arg : bin + (arg ? " " + arg : "");
1595
- };
1596
- }
1597
- });
1598
-
1599
- // ../../node_modules/pid-from-port/node_modules/cross-spawn/lib/util/readShebang.js
1600
- var require_readShebang2 = __commonJS({
1601
- "../../node_modules/pid-from-port/node_modules/cross-spawn/lib/util/readShebang.js"(exports, module2) {
1602
- "use strict";
1603
- var fs = require("fs");
1604
- var LRU = require_lru_cache();
1605
- var shebangCommand = require_shebang_command2();
1606
- var shebangCache = new LRU({ max: 50, maxAge: 30 * 1e3 });
1607
- function readShebang(command2) {
1608
- var buffer;
1609
- var fd;
1610
- var shebang;
1611
- if (shebangCache.has(command2)) {
1612
- return shebangCache.get(command2);
1613
- }
1614
- buffer = new Buffer(150);
1615
- try {
1616
- fd = fs.openSync(command2, "r");
1617
- fs.readSync(fd, buffer, 0, 150, 0);
1618
- fs.closeSync(fd);
1619
- } catch (e) {
1620
- }
1621
- shebang = shebangCommand(buffer.toString());
1622
- shebangCache.set(command2, shebang);
1623
- return shebang;
1624
- }
1625
- module2.exports = readShebang;
1626
- }
1627
- });
1628
-
1629
- // ../../node_modules/pid-from-port/node_modules/cross-spawn/lib/parse.js
1630
- var require_parse2 = __commonJS({
1631
- "../../node_modules/pid-from-port/node_modules/cross-spawn/lib/parse.js"(exports, module2) {
1632
- "use strict";
1633
- var resolveCommand = require_resolveCommand2();
1634
- var hasEmptyArgumentBug = require_hasEmptyArgumentBug();
1635
- var escapeArgument = require_escapeArgument();
1636
- var escapeCommand = require_escapeCommand();
1637
- var readShebang = require_readShebang2();
1638
- var isWin = process.platform === "win32";
1639
- var skipShellRegExp = /\.(?:com|exe)$/i;
1640
- var supportsShellOption = parseInt(process.version.substr(1).split(".")[0], 10) >= 6 || parseInt(process.version.substr(1).split(".")[0], 10) === 4 && parseInt(process.version.substr(1).split(".")[1], 10) >= 8;
1641
- function parseNonShell(parsed) {
1642
- var shebang;
1643
- var needsShell;
1644
- var applyQuotes;
1645
- if (!isWin) {
1646
- return parsed;
1647
- }
1648
- parsed.file = resolveCommand(parsed.command);
1649
- parsed.file = parsed.file || resolveCommand(parsed.command, true);
1650
- shebang = parsed.file && readShebang(parsed.file);
1651
- if (shebang) {
1652
- parsed.args.unshift(parsed.file);
1653
- parsed.command = shebang;
1654
- needsShell = hasEmptyArgumentBug || !skipShellRegExp.test(resolveCommand(shebang) || resolveCommand(shebang, true));
1655
- } else {
1656
- needsShell = hasEmptyArgumentBug || !skipShellRegExp.test(parsed.file);
1657
- }
1658
- if (needsShell) {
1659
- applyQuotes = parsed.command !== "echo";
1660
- parsed.command = escapeCommand(parsed.command);
1661
- parsed.args = parsed.args.map(function(arg) {
1662
- return escapeArgument(arg, applyQuotes);
1663
- });
1664
- parsed.args = ["/d", "/s", "/c", '"' + parsed.command + (parsed.args.length ? " " + parsed.args.join(" ") : "") + '"'];
1665
- parsed.command = process.env.comspec || "cmd.exe";
1666
- parsed.options.windowsVerbatimArguments = true;
1667
- }
1668
- return parsed;
1669
- }
1670
- function parseShell(parsed) {
1671
- var shellCommand;
1672
- if (supportsShellOption) {
1673
- return parsed;
1674
- }
1675
- shellCommand = [parsed.command].concat(parsed.args).join(" ");
1676
- if (isWin) {
1677
- parsed.command = typeof parsed.options.shell === "string" ? parsed.options.shell : process.env.comspec || "cmd.exe";
1678
- parsed.args = ["/d", "/s", "/c", '"' + shellCommand + '"'];
1679
- parsed.options.windowsVerbatimArguments = true;
1680
- } else {
1681
- if (typeof parsed.options.shell === "string") {
1682
- parsed.command = parsed.options.shell;
1683
- } else if (process.platform === "android") {
1684
- parsed.command = "/system/bin/sh";
1685
- } else {
1686
- parsed.command = "/bin/sh";
1687
- }
1688
- parsed.args = ["-c", shellCommand];
1689
- }
1690
- return parsed;
1691
- }
1692
- function parse(command2, args, options) {
1693
- var parsed;
1694
- if (args && !Array.isArray(args)) {
1695
- options = args;
1696
- args = null;
1697
- }
1698
- args = args ? args.slice(0) : [];
1699
- options = options || {};
1700
- parsed = {
1701
- command: command2,
1702
- args,
1703
- options,
1704
- file: void 0,
1705
- original: command2
1706
- };
1707
- return options.shell ? parseShell(parsed) : parseNonShell(parsed);
1708
- }
1709
- module2.exports = parse;
1710
- }
1711
- });
1712
-
1713
- // ../../node_modules/pid-from-port/node_modules/cross-spawn/lib/enoent.js
1714
- var require_enoent2 = __commonJS({
1715
- "../../node_modules/pid-from-port/node_modules/cross-spawn/lib/enoent.js"(exports, module2) {
1716
- "use strict";
1717
- var isWin = process.platform === "win32";
1718
- var resolveCommand = require_resolveCommand2();
1719
- var isNode10 = process.version.indexOf("v0.10.") === 0;
1720
- function notFoundError(command2, syscall) {
1721
- var err;
1722
- err = new Error(syscall + " " + command2 + " ENOENT");
1723
- err.code = err.errno = "ENOENT";
1724
- err.syscall = syscall + " " + command2;
1725
- return err;
1726
- }
1727
- function hookChildProcess(cp, parsed) {
1728
- var originalEmit;
1729
- if (!isWin) {
1730
- return;
1731
- }
1732
- originalEmit = cp.emit;
1733
- cp.emit = function(name, arg1) {
1734
- var err;
1735
- if (name === "exit") {
1736
- err = verifyENOENT(arg1, parsed, "spawn");
1737
- if (err) {
1738
- return originalEmit.call(cp, "error", err);
1739
- }
1740
- }
1741
- return originalEmit.apply(cp, arguments);
1742
- };
1743
- }
1744
- function verifyENOENT(status, parsed) {
1745
- if (isWin && status === 1 && !parsed.file) {
1746
- return notFoundError(parsed.original, "spawn");
1747
- }
1748
- return null;
1749
- }
1750
- function verifyENOENTSync(status, parsed) {
1751
- if (isWin && status === 1 && !parsed.file) {
1752
- return notFoundError(parsed.original, "spawnSync");
1753
- }
1754
- if (isNode10 && status === -1) {
1755
- parsed.file = isWin ? parsed.file : resolveCommand(parsed.original);
1756
- if (!parsed.file) {
1757
- return notFoundError(parsed.original, "spawnSync");
1758
- }
1759
- }
1760
- return null;
1761
- }
1762
- module2.exports.hookChildProcess = hookChildProcess;
1763
- module2.exports.verifyENOENT = verifyENOENT;
1764
- module2.exports.verifyENOENTSync = verifyENOENTSync;
1765
- module2.exports.notFoundError = notFoundError;
1766
- }
1767
- });
1768
-
1769
- // ../../node_modules/pid-from-port/node_modules/cross-spawn/index.js
1770
- var require_cross_spawn2 = __commonJS({
1771
- "../../node_modules/pid-from-port/node_modules/cross-spawn/index.js"(exports, module2) {
1772
- "use strict";
1773
- var cp = require("child_process");
1774
- var parse = require_parse2();
1775
- var enoent = require_enoent2();
1776
- var cpSpawnSync = cp.spawnSync;
1777
- function spawn2(command2, args, options) {
1778
- var parsed;
1779
- var spawned;
1780
- parsed = parse(command2, args, options);
1781
- spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
1782
- enoent.hookChildProcess(spawned, parsed);
1783
- return spawned;
1784
- }
1785
- function spawnSync(command2, args, options) {
1786
- var parsed;
1787
- var result;
1788
- if (!cpSpawnSync) {
1789
- try {
1790
- cpSpawnSync = require("spawn-sync");
1791
- } catch (ex) {
1792
- throw new Error(
1793
- "In order to use spawnSync on node 0.10 or older, you must install spawn-sync:\n\n npm install spawn-sync --save"
1794
- );
1795
- }
1796
- }
1797
- parsed = parse(command2, args, options);
1798
- result = cpSpawnSync(parsed.command, parsed.args, parsed.options);
1799
- result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
1800
- return result;
1801
- }
1802
- module2.exports = spawn2;
1803
- module2.exports.spawn = spawn2;
1804
- module2.exports.sync = spawnSync;
1805
- module2.exports._parse = parse;
1806
- module2.exports._enoent = enoent;
1807
- }
1808
- });
1809
-
1810
- // ../../node_modules/strip-eof/index.js
1811
- var require_strip_eof = __commonJS({
1812
- "../../node_modules/strip-eof/index.js"(exports, module2) {
1813
- "use strict";
1814
- module2.exports = function(x) {
1815
- var lf = typeof x === "string" ? "\n" : "\n".charCodeAt();
1816
- var cr = typeof x === "string" ? "\r" : "\r".charCodeAt();
1817
- if (x[x.length - 1] === lf) {
1818
- x = x.slice(0, x.length - 1);
1819
- }
1820
- if (x[x.length - 1] === cr) {
1821
- x = x.slice(0, x.length - 1);
1822
- }
1823
- return x;
1824
- };
1825
- }
1826
- });
1827
-
1828
- // ../../node_modules/path-key/index.js
1829
- var require_path_key2 = __commonJS({
1830
- "../../node_modules/path-key/index.js"(exports, module2) {
1831
- "use strict";
1832
- module2.exports = (opts) => {
1833
- opts = opts || {};
1834
- const env2 = opts.env || process.env;
1835
- const platform = opts.platform || process.platform;
1836
- if (platform !== "win32") {
1837
- return "PATH";
1838
- }
1839
- return Object.keys(env2).find((x) => x.toUpperCase() === "PATH") || "Path";
1840
- };
1841
- }
1842
- });
1843
-
1844
- // ../../node_modules/pid-from-port/node_modules/npm-run-path/index.js
1845
- var require_npm_run_path = __commonJS({
1846
- "../../node_modules/pid-from-port/node_modules/npm-run-path/index.js"(exports, module2) {
1847
- "use strict";
1848
- var path = require("path");
1849
- var pathKey = require_path_key2();
1850
- module2.exports = (opts) => {
1851
- opts = Object.assign({
1852
- cwd: process.cwd(),
1853
- path: process.env[pathKey()]
1854
- }, opts);
1855
- let prev;
1856
- let pth = path.resolve(opts.cwd);
1857
- const ret = [];
1858
- while (prev !== pth) {
1859
- ret.push(path.join(pth, "node_modules/.bin"));
1860
- prev = pth;
1861
- pth = path.resolve(pth, "..");
1862
- }
1863
- ret.push(path.dirname(process.execPath));
1864
- return ret.concat(opts.path).join(path.delimiter);
1865
- };
1866
- module2.exports.env = (opts) => {
1867
- opts = Object.assign({
1868
- env: process.env
1869
- }, opts);
1870
- const env2 = Object.assign({}, opts.env);
1871
- const path2 = pathKey({ env: env2 });
1872
- opts.path = env2[path2];
1873
- env2[path2] = module2.exports(opts);
1874
- return env2;
1875
- };
1876
- }
1877
- });
1878
-
1879
- // ../../node_modules/pid-from-port/node_modules/is-stream/index.js
1880
- var require_is_stream = __commonJS({
1881
- "../../node_modules/pid-from-port/node_modules/is-stream/index.js"(exports, module2) {
1882
- "use strict";
1883
- var isStream = module2.exports = function(stream) {
1884
- return stream !== null && typeof stream === "object" && typeof stream.pipe === "function";
1885
- };
1886
- isStream.writable = function(stream) {
1887
- return isStream(stream) && stream.writable !== false && typeof stream._write === "function" && typeof stream._writableState === "object";
1888
- };
1889
- isStream.readable = function(stream) {
1890
- return isStream(stream) && stream.readable !== false && typeof stream._read === "function" && typeof stream._readableState === "object";
1891
- };
1892
- isStream.duplex = function(stream) {
1893
- return isStream.writable(stream) && isStream.readable(stream);
1894
- };
1895
- isStream.transform = function(stream) {
1896
- return isStream.duplex(stream) && typeof stream._transform === "function" && typeof stream._transformState === "object";
1897
- };
1898
- }
1899
- });
1900
-
1901
- // ../../node_modules/pid-from-port/node_modules/get-stream/buffer-stream.js
1902
- var require_buffer_stream = __commonJS({
1903
- "../../node_modules/pid-from-port/node_modules/get-stream/buffer-stream.js"(exports, module2) {
1904
- "use strict";
1905
- var PassThrough = require("stream").PassThrough;
1906
- module2.exports = (opts) => {
1907
- opts = Object.assign({}, opts);
1908
- const array = opts.array;
1909
- let encoding = opts.encoding;
1910
- const buffer = encoding === "buffer";
1911
- let objectMode = false;
1912
- if (array) {
1913
- objectMode = !(encoding || buffer);
1914
- } else {
1915
- encoding = encoding || "utf8";
1916
- }
1917
- if (buffer) {
1918
- encoding = null;
1919
- }
1920
- let len = 0;
1921
- const ret = [];
1922
- const stream = new PassThrough({ objectMode });
1923
- if (encoding) {
1924
- stream.setEncoding(encoding);
1925
- }
1926
- stream.on("data", (chunk) => {
1927
- ret.push(chunk);
1928
- if (objectMode) {
1929
- len = ret.length;
1930
- } else {
1931
- len += chunk.length;
1932
- }
1933
- });
1934
- stream.getBufferedValue = () => {
1935
- if (array) {
1936
- return ret;
1937
- }
1938
- return buffer ? Buffer.concat(ret, len) : ret.join("");
1939
- };
1940
- stream.getBufferedLength = () => len;
1941
- return stream;
1942
- };
1943
- }
1944
- });
1945
-
1946
- // ../../node_modules/pid-from-port/node_modules/get-stream/index.js
1947
- var require_get_stream = __commonJS({
1948
- "../../node_modules/pid-from-port/node_modules/get-stream/index.js"(exports, module2) {
1949
- "use strict";
1950
- var bufferStream = require_buffer_stream();
1951
- function getStream(inputStream, opts) {
1952
- if (!inputStream) {
1953
- return Promise.reject(new Error("Expected a stream"));
1954
- }
1955
- opts = Object.assign({ maxBuffer: Infinity }, opts);
1956
- const maxBuffer = opts.maxBuffer;
1957
- let stream;
1958
- let clean;
1959
- const p = new Promise((resolve5, reject) => {
1960
- const error = (err) => {
1961
- if (err) {
1962
- err.bufferedData = stream.getBufferedValue();
1963
- }
1964
- reject(err);
1965
- };
1966
- stream = bufferStream(opts);
1967
- inputStream.once("error", error);
1968
- inputStream.pipe(stream);
1969
- stream.on("data", () => {
1970
- if (stream.getBufferedLength() > maxBuffer) {
1971
- reject(new Error("maxBuffer exceeded"));
1972
- }
1973
- });
1974
- stream.once("error", error);
1975
- stream.on("end", resolve5);
1976
- clean = () => {
1977
- if (inputStream.unpipe) {
1978
- inputStream.unpipe(stream);
1979
- }
1980
- };
1981
- });
1982
- p.then(clean, clean);
1983
- return p.then(() => stream.getBufferedValue());
1984
- }
1985
- module2.exports = getStream;
1986
- module2.exports.buffer = (stream, opts) => getStream(stream, Object.assign({}, opts, { encoding: "buffer" }));
1987
- module2.exports.array = (stream, opts) => getStream(stream, Object.assign({}, opts, { array: true }));
1988
- }
1989
- });
1990
-
1991
- // ../../node_modules/p-finally/index.js
1992
- var require_p_finally = __commonJS({
1993
- "../../node_modules/p-finally/index.js"(exports, module2) {
1994
- "use strict";
1995
- module2.exports = (promise, onFinally) => {
1996
- onFinally = onFinally || (() => {
1997
- });
1998
- return promise.then(
1999
- (val) => new Promise((resolve5) => {
2000
- resolve5(onFinally());
2001
- }).then(() => val),
2002
- (err) => new Promise((resolve5) => {
2003
- resolve5(onFinally());
2004
- }).then(() => {
2005
- throw err;
2006
- })
2007
- );
2008
- };
2009
- }
2010
- });
2011
-
2012
- // ../../node_modules/signal-exit/signals.js
2013
- var require_signals = __commonJS({
2014
- "../../node_modules/signal-exit/signals.js"(exports, module2) {
2015
- module2.exports = [
2016
- "SIGABRT",
2017
- "SIGALRM",
2018
- "SIGHUP",
2019
- "SIGINT",
2020
- "SIGTERM"
2021
- ];
2022
- if (process.platform !== "win32") {
2023
- module2.exports.push(
2024
- "SIGVTALRM",
2025
- "SIGXCPU",
2026
- "SIGXFSZ",
2027
- "SIGUSR2",
2028
- "SIGTRAP",
2029
- "SIGSYS",
2030
- "SIGQUIT",
2031
- "SIGIOT"
2032
- // should detect profiler and enable/disable accordingly.
2033
- // see #21
2034
- // 'SIGPROF'
2035
- );
2036
- }
2037
- if (process.platform === "linux") {
2038
- module2.exports.push(
2039
- "SIGIO",
2040
- "SIGPOLL",
2041
- "SIGPWR",
2042
- "SIGSTKFLT",
2043
- "SIGUNUSED"
2044
- );
2045
- }
2046
- }
2047
- });
2048
-
2049
- // ../../node_modules/signal-exit/index.js
2050
- var require_signal_exit = __commonJS({
2051
- "../../node_modules/signal-exit/index.js"(exports, module2) {
2052
- var process3 = global.process;
2053
- var processOk = function(process4) {
2054
- return process4 && typeof process4 === "object" && typeof process4.removeListener === "function" && typeof process4.emit === "function" && typeof process4.reallyExit === "function" && typeof process4.listeners === "function" && typeof process4.kill === "function" && typeof process4.pid === "number" && typeof process4.on === "function";
2055
- };
2056
- if (!processOk(process3)) {
2057
- module2.exports = function() {
2058
- return function() {
2059
- };
2060
- };
2061
- } else {
2062
- assert = require("assert");
2063
- signals = require_signals();
2064
- isWin = /^win/i.test(process3.platform);
2065
- EE = require("events");
2066
- if (typeof EE !== "function") {
2067
- EE = EE.EventEmitter;
2068
- }
2069
- if (process3.__signal_exit_emitter__) {
2070
- emitter = process3.__signal_exit_emitter__;
2071
- } else {
2072
- emitter = process3.__signal_exit_emitter__ = new EE();
2073
- emitter.count = 0;
2074
- emitter.emitted = {};
2075
- }
2076
- if (!emitter.infinite) {
2077
- emitter.setMaxListeners(Infinity);
2078
- emitter.infinite = true;
2079
- }
2080
- module2.exports = function(cb, opts) {
2081
- if (!processOk(global.process)) {
2082
- return function() {
2083
- };
2084
- }
2085
- assert.equal(typeof cb, "function", "a callback must be provided for exit handler");
2086
- if (loaded === false) {
2087
- load();
2088
- }
2089
- var ev = "exit";
2090
- if (opts && opts.alwaysLast) {
2091
- ev = "afterexit";
2092
- }
2093
- var remove = function() {
2094
- emitter.removeListener(ev, cb);
2095
- if (emitter.listeners("exit").length === 0 && emitter.listeners("afterexit").length === 0) {
2096
- unload();
2097
- }
2098
- };
2099
- emitter.on(ev, cb);
2100
- return remove;
2101
- };
2102
- unload = function unload2() {
2103
- if (!loaded || !processOk(global.process)) {
2104
- return;
2105
- }
2106
- loaded = false;
2107
- signals.forEach(function(sig) {
2108
- try {
2109
- process3.removeListener(sig, sigListeners[sig]);
2110
- } catch (er) {
2111
- }
2112
- });
2113
- process3.emit = originalProcessEmit;
2114
- process3.reallyExit = originalProcessReallyExit;
2115
- emitter.count -= 1;
2116
- };
2117
- module2.exports.unload = unload;
2118
- emit = function emit2(event, code, signal) {
2119
- if (emitter.emitted[event]) {
2120
- return;
2121
- }
2122
- emitter.emitted[event] = true;
2123
- emitter.emit(event, code, signal);
2124
- };
2125
- sigListeners = {};
2126
- signals.forEach(function(sig) {
2127
- sigListeners[sig] = function listener() {
2128
- if (!processOk(global.process)) {
2129
- return;
2130
- }
2131
- var listeners = process3.listeners(sig);
2132
- if (listeners.length === emitter.count) {
2133
- unload();
2134
- emit("exit", null, sig);
2135
- emit("afterexit", null, sig);
2136
- if (isWin && sig === "SIGHUP") {
2137
- sig = "SIGINT";
2138
- }
2139
- process3.kill(process3.pid, sig);
2140
- }
2141
- };
2142
- });
2143
- module2.exports.signals = function() {
2144
- return signals;
2145
- };
2146
- loaded = false;
2147
- load = function load2() {
2148
- if (loaded || !processOk(global.process)) {
2149
- return;
2150
- }
2151
- loaded = true;
2152
- emitter.count += 1;
2153
- signals = signals.filter(function(sig) {
2154
- try {
2155
- process3.on(sig, sigListeners[sig]);
2156
- return true;
2157
- } catch (er) {
2158
- return false;
2159
- }
2160
- });
2161
- process3.emit = processEmit;
2162
- process3.reallyExit = processReallyExit;
2163
- };
2164
- module2.exports.load = load;
2165
- originalProcessReallyExit = process3.reallyExit;
2166
- processReallyExit = function processReallyExit2(code) {
2167
- if (!processOk(global.process)) {
2168
- return;
2169
- }
2170
- process3.exitCode = code || /* istanbul ignore next */
2171
- 0;
2172
- emit("exit", process3.exitCode, null);
2173
- emit("afterexit", process3.exitCode, null);
2174
- originalProcessReallyExit.call(process3, process3.exitCode);
2175
- };
2176
- originalProcessEmit = process3.emit;
2177
- processEmit = function processEmit2(ev, arg) {
2178
- if (ev === "exit" && processOk(global.process)) {
2179
- if (arg !== void 0) {
2180
- process3.exitCode = arg;
2181
- }
2182
- var ret = originalProcessEmit.apply(this, arguments);
2183
- emit("exit", process3.exitCode, null);
2184
- emit("afterexit", process3.exitCode, null);
2185
- return ret;
2186
- } else {
2187
- return originalProcessEmit.apply(this, arguments);
2188
- }
2189
- };
2190
- }
2191
- var assert;
2192
- var signals;
2193
- var isWin;
2194
- var EE;
2195
- var emitter;
2196
- var unload;
2197
- var emit;
2198
- var sigListeners;
2199
- var loaded;
2200
- var load;
2201
- var originalProcessReallyExit;
2202
- var processReallyExit;
2203
- var originalProcessEmit;
2204
- var processEmit;
2205
- }
2206
- });
2207
-
2208
- // ../../node_modules/pid-from-port/node_modules/execa/lib/errname.js
2209
- var require_errname = __commonJS({
2210
- "../../node_modules/pid-from-port/node_modules/execa/lib/errname.js"(exports, module2) {
2211
- "use strict";
2212
- var uv;
2213
- try {
2214
- uv = process.binding("uv");
2215
- if (typeof uv.errname !== "function") {
2216
- throw new TypeError("uv.errname is not a function");
2217
- }
2218
- } catch (err) {
2219
- console.error("execa/lib/errname: unable to establish process.binding('uv')", err);
2220
- uv = null;
2221
- }
2222
- function errname(uv2, code) {
2223
- if (uv2) {
2224
- return uv2.errname(code);
2225
- }
2226
- if (!(code < 0)) {
2227
- throw new Error("err >= 0");
2228
- }
2229
- return `Unknown system error ${code}`;
2230
- }
2231
- module2.exports = (code) => errname(uv, code);
2232
- module2.exports.__test__ = errname;
2233
- }
2234
- });
2235
-
2236
- // ../../node_modules/pid-from-port/node_modules/execa/lib/stdio.js
2237
- var require_stdio = __commonJS({
2238
- "../../node_modules/pid-from-port/node_modules/execa/lib/stdio.js"(exports, module2) {
2239
- "use strict";
2240
- var alias = ["stdin", "stdout", "stderr"];
2241
- var hasAlias = (opts) => alias.some((x) => Boolean(opts[x]));
2242
- module2.exports = (opts) => {
2243
- if (!opts) {
2244
- return null;
2245
- }
2246
- if (opts.stdio && hasAlias(opts)) {
2247
- throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${alias.map((x) => `\`${x}\``).join(", ")}`);
2248
- }
2249
- if (typeof opts.stdio === "string") {
2250
- return opts.stdio;
2251
- }
2252
- const stdio = opts.stdio || [];
2253
- if (!Array.isArray(stdio)) {
2254
- throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${typeof stdio}\``);
2255
- }
2256
- const result = [];
2257
- const len = Math.max(stdio.length, alias.length);
2258
- for (let i = 0; i < len; i++) {
2259
- let value = null;
2260
- if (stdio[i] !== void 0) {
2261
- value = stdio[i];
2262
- } else if (opts[alias[i]] !== void 0) {
2263
- value = opts[alias[i]];
2264
- }
2265
- result[i] = value;
2266
- }
2267
- return result;
2268
- };
2269
- }
2270
- });
2271
-
2272
- // ../../node_modules/pid-from-port/node_modules/execa/index.js
2273
- var require_execa = __commonJS({
2274
- "../../node_modules/pid-from-port/node_modules/execa/index.js"(exports, module2) {
2275
- "use strict";
2276
- var path = require("path");
2277
- var childProcess = require("child_process");
2278
- var util = require("util");
2279
- var crossSpawn = require_cross_spawn2();
2280
- var stripEof = require_strip_eof();
2281
- var npmRunPath = require_npm_run_path();
2282
- var isStream = require_is_stream();
2283
- var _getStream = require_get_stream();
2284
- var pFinally = require_p_finally();
2285
- var onExit = require_signal_exit();
2286
- var errname = require_errname();
2287
- var stdio = require_stdio();
2288
- var TEN_MEGABYTES = 1e3 * 1e3 * 10;
2289
- function handleArgs(cmd, args, opts) {
2290
- let parsed;
2291
- opts = Object.assign({
2292
- extendEnv: true,
2293
- env: {}
2294
- }, opts);
2295
- if (opts.extendEnv) {
2296
- opts.env = Object.assign({}, process.env, opts.env);
2297
- }
2298
- if (opts.__winShell === true) {
2299
- delete opts.__winShell;
2300
- parsed = {
2301
- command: cmd,
2302
- args,
2303
- options: opts,
2304
- file: cmd,
2305
- original: cmd
2306
- };
2307
- } else {
2308
- parsed = crossSpawn._parse(cmd, args, opts);
2309
- }
2310
- opts = Object.assign({
2311
- maxBuffer: TEN_MEGABYTES,
2312
- stripEof: true,
2313
- preferLocal: true,
2314
- localDir: parsed.options.cwd || process.cwd(),
2315
- encoding: "utf8",
2316
- reject: true,
2317
- cleanup: true
2318
- }, parsed.options);
2319
- opts.stdio = stdio(opts);
2320
- if (opts.preferLocal) {
2321
- opts.env = npmRunPath.env(Object.assign({}, opts, { cwd: opts.localDir }));
2322
- }
2323
- if (opts.detached) {
2324
- opts.cleanup = false;
2325
- }
2326
- if (process.platform === "win32" && path.basename(parsed.command) === "cmd.exe") {
2327
- parsed.args.unshift("/q");
2328
- }
2329
- return {
2330
- cmd: parsed.command,
2331
- args: parsed.args,
2332
- opts,
2333
- parsed
2334
- };
2335
- }
2336
- function handleInput(spawned, opts) {
2337
- const input = opts.input;
2338
- if (input === null || input === void 0) {
2339
- return;
2340
- }
2341
- if (isStream(input)) {
2342
- input.pipe(spawned.stdin);
2343
- } else {
2344
- spawned.stdin.end(input);
2345
- }
2346
- }
2347
- function handleOutput(opts, val) {
2348
- if (val && opts.stripEof) {
2349
- val = stripEof(val);
2350
- }
2351
- return val;
2352
- }
2353
- function handleShell(fn, cmd, opts) {
2354
- let file = "/bin/sh";
2355
- let args = ["-c", cmd];
2356
- opts = Object.assign({}, opts);
2357
- if (process.platform === "win32") {
2358
- opts.__winShell = true;
2359
- file = process.env.comspec || "cmd.exe";
2360
- args = ["/s", "/c", `"${cmd}"`];
2361
- opts.windowsVerbatimArguments = true;
2362
- }
2363
- if (opts.shell) {
2364
- file = opts.shell;
2365
- delete opts.shell;
2366
- }
2367
- return fn(file, args, opts);
2368
- }
2369
- function getStream(process3, stream, encoding, maxBuffer) {
2370
- if (!process3[stream]) {
2371
- return null;
2372
- }
2373
- let ret;
2374
- if (encoding) {
2375
- ret = _getStream(process3[stream], {
2376
- encoding,
2377
- maxBuffer
2378
- });
2379
- } else {
2380
- ret = _getStream.buffer(process3[stream], { maxBuffer });
2381
- }
2382
- return ret.catch((err) => {
2383
- err.stream = stream;
2384
- err.message = `${stream} ${err.message}`;
2385
- throw err;
2386
- });
2387
- }
2388
- function makeError(result, options) {
2389
- const stdout = result.stdout;
2390
- const stderr = result.stderr;
2391
- let err = result.error;
2392
- const code = result.code;
2393
- const signal = result.signal;
2394
- const parsed = options.parsed;
2395
- const joinedCmd = options.joinedCmd;
2396
- const timedOut = options.timedOut || false;
2397
- if (!err) {
2398
- let output = "";
2399
- if (Array.isArray(parsed.opts.stdio)) {
2400
- if (parsed.opts.stdio[2] !== "inherit") {
2401
- output += output.length > 0 ? stderr : `
2402
- ${stderr}`;
2403
- }
2404
- if (parsed.opts.stdio[1] !== "inherit") {
2405
- output += `
2406
- ${stdout}`;
2407
- }
2408
- } else if (parsed.opts.stdio !== "inherit") {
2409
- output = `
2410
- ${stderr}${stdout}`;
2411
- }
2412
- err = new Error(`Command failed: ${joinedCmd}${output}`);
2413
- err.code = code < 0 ? errname(code) : code;
2414
- }
2415
- err.stdout = stdout;
2416
- err.stderr = stderr;
2417
- err.failed = true;
2418
- err.signal = signal || null;
2419
- err.cmd = joinedCmd;
2420
- err.timedOut = timedOut;
2421
- return err;
2422
- }
2423
- function joinCmd(cmd, args) {
2424
- let joinedCmd = cmd;
2425
- if (Array.isArray(args) && args.length > 0) {
2426
- joinedCmd += " " + args.join(" ");
2427
- }
2428
- return joinedCmd;
2429
- }
2430
- module2.exports = (cmd, args, opts) => {
2431
- const parsed = handleArgs(cmd, args, opts);
2432
- const encoding = parsed.opts.encoding;
2433
- const maxBuffer = parsed.opts.maxBuffer;
2434
- const joinedCmd = joinCmd(cmd, args);
2435
- let spawned;
2436
- try {
2437
- spawned = childProcess.spawn(parsed.cmd, parsed.args, parsed.opts);
2438
- } catch (err) {
2439
- return Promise.reject(err);
2440
- }
2441
- let removeExitHandler;
2442
- if (parsed.opts.cleanup) {
2443
- removeExitHandler = onExit(() => {
2444
- spawned.kill();
2445
- });
2446
- }
2447
- let timeoutId = null;
2448
- let timedOut = false;
2449
- const cleanupTimeout = () => {
2450
- if (timeoutId) {
2451
- clearTimeout(timeoutId);
2452
- timeoutId = null;
2453
- }
2454
- };
2455
- if (parsed.opts.timeout > 0) {
2456
- timeoutId = setTimeout(() => {
2457
- timeoutId = null;
2458
- timedOut = true;
2459
- spawned.kill(parsed.opts.killSignal);
2460
- }, parsed.opts.timeout);
2461
- }
2462
- const processDone = new Promise((resolve5) => {
2463
- spawned.on("exit", (code, signal) => {
2464
- cleanupTimeout();
2465
- resolve5({ code, signal });
2466
- });
2467
- spawned.on("error", (err) => {
2468
- cleanupTimeout();
2469
- resolve5({ error: err });
2470
- });
2471
- if (spawned.stdin) {
2472
- spawned.stdin.on("error", (err) => {
2473
- cleanupTimeout();
2474
- resolve5({ error: err });
2475
- });
2476
- }
2477
- });
2478
- function destroy() {
2479
- if (spawned.stdout) {
2480
- spawned.stdout.destroy();
2481
- }
2482
- if (spawned.stderr) {
2483
- spawned.stderr.destroy();
2484
- }
2485
- }
2486
- const handlePromise = () => pFinally(Promise.all([
2487
- processDone,
2488
- getStream(spawned, "stdout", encoding, maxBuffer),
2489
- getStream(spawned, "stderr", encoding, maxBuffer)
2490
- ]).then((arr) => {
2491
- const result = arr[0];
2492
- result.stdout = arr[1];
2493
- result.stderr = arr[2];
2494
- if (removeExitHandler) {
2495
- removeExitHandler();
2496
- }
2497
- if (result.error || result.code !== 0 || result.signal !== null) {
2498
- const err = makeError(result, {
2499
- joinedCmd,
2500
- parsed,
2501
- timedOut
2502
- });
2503
- err.killed = err.killed || spawned.killed;
2504
- if (!parsed.opts.reject) {
2505
- return err;
2506
- }
2507
- throw err;
2508
- }
2509
- return {
2510
- stdout: handleOutput(parsed.opts, result.stdout),
2511
- stderr: handleOutput(parsed.opts, result.stderr),
2512
- code: 0,
2513
- failed: false,
2514
- killed: false,
2515
- signal: null,
2516
- cmd: joinedCmd,
2517
- timedOut: false
2518
- };
2519
- }), destroy);
2520
- crossSpawn._enoent.hookChildProcess(spawned, parsed.parsed);
2521
- handleInput(spawned, parsed.opts);
2522
- spawned.then = (onfulfilled, onrejected) => handlePromise().then(onfulfilled, onrejected);
2523
- spawned.catch = (onrejected) => handlePromise().catch(onrejected);
2524
- return spawned;
2525
- };
2526
- module2.exports.stdout = function() {
2527
- return module2.exports.apply(null, arguments).then((x) => x.stdout);
2528
- };
2529
- module2.exports.stderr = function() {
2530
- return module2.exports.apply(null, arguments).then((x) => x.stderr);
2531
- };
2532
- module2.exports.shell = (cmd, opts) => handleShell(module2.exports, cmd, opts);
2533
- module2.exports.sync = (cmd, args, opts) => {
2534
- const parsed = handleArgs(cmd, args, opts);
2535
- const joinedCmd = joinCmd(cmd, args);
2536
- if (isStream(parsed.opts.input)) {
2537
- throw new TypeError("The `input` option cannot be a stream in sync mode");
2538
- }
2539
- const result = childProcess.spawnSync(parsed.cmd, parsed.args, parsed.opts);
2540
- result.code = result.status;
2541
- if (result.error || result.status !== 0 || result.signal !== null) {
2542
- const err = makeError(result, {
2543
- joinedCmd,
2544
- parsed
2545
- });
2546
- if (!parsed.opts.reject) {
2547
- return err;
2548
- }
2549
- throw err;
2550
- }
2551
- return {
2552
- stdout: handleOutput(parsed.opts, result.stdout),
2553
- stderr: handleOutput(parsed.opts, result.stderr),
2554
- code: 0,
2555
- failed: false,
2556
- signal: null,
2557
- cmd: joinedCmd,
2558
- timedOut: false
2559
- };
2560
- };
2561
- module2.exports.shellSync = (cmd, opts) => handleShell(module2.exports.sync, cmd, opts);
2562
- module2.exports.spawn = util.deprecate(module2.exports, "execa.spawn() is deprecated. Use execa() instead.");
2563
- }
2564
- });
2565
-
2566
- // ../../node_modules/pid-from-port/index.js
2567
- var require_pid_from_port = __commonJS({
2568
- "../../node_modules/pid-from-port/index.js"(exports, module2) {
2569
- "use strict";
2570
- var execa = require_execa();
2571
- var macos = () => execa.stdout("netstat", ["-anv", "-p", "tcp"]).then((data) => Promise.all([data, execa.stdout("netstat", ["-anv", "-p", "udp"])])).then((data) => data.join("\n"));
2572
- var linux = () => execa.stdout("ss", ["-tunlp"]);
2573
- var win32 = () => execa.stdout("netstat", ["-ano"]);
2574
- var getListFn = process.platform === "darwin" ? macos : process.platform === "linux" ? linux : win32;
2575
- var cols = process.platform === "darwin" ? [3, 8] : process.platform === "linux" ? [4, 6] : [1, 4];
2576
- var isProtocol = (x) => /^\s*(tcp|udp)/i.test(x);
2577
- var parsePid = (input) => {
2578
- if (typeof input !== "string") {
2579
- return null;
2580
- }
2581
- const match = input.match(/(?:^|",|",pid=)(\d+)/);
2582
- return match ? parseInt(match[1], 10) : null;
2583
- };
2584
- var getPort = (input, list) => {
2585
- const regex = new RegExp(`[.:]${input}$`);
2586
- const port = list.find((x) => regex.test(x[cols[0]]));
2587
- if (!port) {
2588
- throw new Error(`Couldn't find a process with port \`${input}\``);
2589
- }
2590
- return parsePid(port[cols[1]]);
2591
- };
2592
- var getList = () => getListFn().then(
2593
- (list) => list.split("\n").reduce((result, x) => {
2594
- if (isProtocol(x)) {
2595
- result.push(x.match(/\S+/g) || []);
2596
- }
2597
- return result;
2598
- }, [])
2599
- );
2600
- module2.exports = (input) => {
2601
- if (typeof input !== "number") {
2602
- return Promise.reject(new TypeError(`Expected a number, got ${typeof input}`));
2603
- }
2604
- return getList().then((list) => getPort(input, list));
2605
- };
2606
- module2.exports.all = (input) => {
2607
- if (!Array.isArray(input)) {
2608
- return Promise.reject(new TypeError(`Expected an array, got ${typeof input}`));
2609
- }
2610
- return getList().then((list) => Promise.all(input.map((x) => [x, getPort(x, list)]))).then((list) => new Map(list));
2611
- };
2612
- module2.exports.list = () => getList().then((list) => {
2613
- const ret = /* @__PURE__ */ new Map();
2614
- for (const x of list) {
2615
- const match = x[cols[0]].match(/[^]*[.:](\d+)$/);
2616
- if (match) {
2617
- ret.set(parseInt(match[1], 10), parsePid(x[cols[1]]));
2618
- }
2619
- }
2620
- return ret;
2621
- });
2622
- }
2623
- });
2624
-
2625
- // ../../node_modules/kill-port-process/dist/lib/killer.js
2626
- var require_killer = __commonJS({
2627
- "../../node_modules/kill-port-process/dist/lib/killer.js"(exports) {
2628
- "use strict";
2629
- var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
2630
- function adopt(value) {
2631
- return value instanceof P ? value : new P(function(resolve5) {
2632
- resolve5(value);
2633
- });
2634
- }
2635
- return new (P || (P = Promise))(function(resolve5, reject) {
2636
- function fulfilled(value) {
2637
- try {
2638
- step(generator.next(value));
2639
- } catch (e) {
2640
- reject(e);
2641
- }
2642
- }
2643
- function rejected(value) {
2644
- try {
2645
- step(generator["throw"](value));
2646
- } catch (e) {
2647
- reject(e);
2648
- }
2649
- }
2650
- function step(result) {
2651
- result.done ? resolve5(result.value) : adopt(result.value).then(fulfilled, rejected);
2652
- }
2653
- step((generator = generator.apply(thisArg, _arguments || [])).next());
2654
- });
2655
- };
2656
- Object.defineProperty(exports, "__esModule", { value: true });
2657
- exports.Killer = void 0;
2658
- var child_process_1 = require("child_process");
2659
- var os_1 = require("os");
2660
- var pidFromPort = require_pid_from_port();
2661
- var Killer = class {
2662
- constructor(ports) {
2663
- this.ports = ports;
2664
- }
2665
- kill(options) {
2666
- return __awaiter(this, void 0, void 0, function* () {
2667
- const killFunc = (0, os_1.platform)() === "win32" ? this.win32Kill : this.unixKill;
2668
- const promises = this.ports.map((port) => killFunc(port, options.signal));
2669
- return Promise.all(promises);
2670
- });
2671
- }
2672
- win32Kill(port, signal) {
2673
- return __awaiter(this, void 0, void 0, function* () {
2674
- const pid = yield pidFromPort(port).catch((error) => console.error("Failed to get pid of port", port, error));
2675
- if (!pid) {
2676
- return;
2677
- }
2678
- return new Promise((resolve5, reject) => {
2679
- const taskkill = (0, child_process_1.spawn)("TASKKILL", ["/f", "/t", "/pid", pid.toString()]);
2680
- taskkill.stdout.on("data", (data) => console.log(data.toString()));
2681
- taskkill.stderr.on("data", (data) => console.error(data.toString()));
2682
- taskkill.on("close", (code, signal2) => {
2683
- if (code !== 0) {
2684
- return reject(`taskkill process exited with code ${code} and signal ${signal2}`);
2685
- }
2686
- resolve5(void 0);
2687
- });
2688
- taskkill.on("error", (err) => reject(err));
2689
- });
2690
- });
2691
- }
2692
- unixKill(port, signal) {
2693
- return __awaiter(this, void 0, void 0, function* () {
2694
- const killCommand = {
2695
- SIGKILL: "-9",
2696
- SIGTERM: "-15"
2697
- }[signal];
2698
- return new Promise((resolve5, reject) => {
2699
- const lsof = (0, child_process_1.spawn)("lsof", ["-i", `tcp:${port}`]);
2700
- const grep = (0, child_process_1.spawn)("grep", ["LISTEN"]);
2701
- const awk = (0, child_process_1.spawn)("awk", ["{print $2}"]);
2702
- const xargs = (0, child_process_1.spawn)("xargs", ["kill", killCommand]);
2703
- lsof.stdout.pipe(grep.stdin);
2704
- lsof.stderr.on("data", logStderrData("lsof"));
2705
- grep.stdout.pipe(awk.stdin);
2706
- grep.stderr.on("data", logStderrData("grep"));
2707
- awk.stdout.pipe(xargs.stdin);
2708
- awk.stderr.on("data", logStderrData("awk"));
2709
- xargs.stdout.pipe(process.stdin);
2710
- xargs.stderr.on("data", logStderrData("xargs"));
2711
- xargs.on("close", (code) => {
2712
- if (code !== 0) {
2713
- return reject();
2714
- }
2715
- resolve5(void 0);
2716
- });
2717
- function logStderrData(command2) {
2718
- return (data) => console.error(`${command2} - ${data.toString()}`);
2719
- }
2720
- });
2721
- });
2722
- }
2723
- };
2724
- exports.Killer = Killer;
2725
- }
2726
- });
2727
-
2728
- // ../../node_modules/kill-port-process/dist/lib/index.js
2729
- var require_lib = __commonJS({
2730
- "../../node_modules/kill-port-process/dist/lib/index.js"(exports) {
2731
- "use strict";
2732
- var __awaiter = exports && exports.__awaiter || function(thisArg, _arguments, P, generator) {
2733
- function adopt(value) {
2734
- return value instanceof P ? value : new P(function(resolve5) {
2735
- resolve5(value);
2736
- });
2737
- }
2738
- return new (P || (P = Promise))(function(resolve5, reject) {
2739
- function fulfilled(value) {
2740
- try {
2741
- step(generator.next(value));
2742
- } catch (e) {
2743
- reject(e);
2744
- }
2745
- }
2746
- function rejected(value) {
2747
- try {
2748
- step(generator["throw"](value));
2749
- } catch (e) {
2750
- reject(e);
2751
- }
2752
- }
2753
- function step(result) {
2754
- result.done ? resolve5(result.value) : adopt(result.value).then(fulfilled, rejected);
2755
- }
2756
- step((generator = generator.apply(thisArg, _arguments || [])).next());
2757
- });
2758
- };
2759
- Object.defineProperty(exports, "__esModule", { value: true });
2760
- exports.killPortProcess = void 0;
2761
- var helpers_1 = require_helpers();
2762
- var killer_1 = require_killer();
2763
- function killPortProcess2(inputPorts, inputOptions = {}) {
2764
- return __awaiter(this, void 0, void 0, function* () {
2765
- if ((0, helpers_1.isNullOrUndefined)(inputPorts)) {
2766
- throw new Error("No ports found in input");
2767
- }
2768
- const options = (0, helpers_1.mergeOptions)(inputOptions);
2769
- const toNumber = (value) => Number(value);
2770
- const ports = (0, helpers_1.arrayifyInput)(inputPorts).map(toNumber);
2771
- const killer = new killer_1.Killer(ports);
2772
- yield killer.kill({
2773
- signal: options.signal
2774
- });
2775
- });
2776
- }
2777
- exports.killPortProcess = killPortProcess2;
2778
- }
2779
- });
2780
-
2781
635
  // src/with-dev-server.mts
636
+ var import_cross_port_killer = __toESM(require_source(), 1);
2782
637
  var import_cross_spawn = __toESM(require_cross_spawn(), 1);
2783
638
 
2784
639
  // node_modules/get-port/index.js
@@ -2895,7 +750,6 @@ async function getPorts(options) {
2895
750
  }
2896
751
 
2897
752
  // src/with-dev-server.mts
2898
- var import_kill_port_process = __toESM(require_lib(), 1);
2899
753
  var import_process = __toESM(require("process"), 1);
2900
754
 
2901
755
  // node_modules/yargs/lib/platform-shims/esm.mjs
@@ -3213,11 +1067,11 @@ var import_util3 = require("util");
3213
1067
  var import_fs4 = require("fs");
3214
1068
  var import_url = require("url");
3215
1069
 
3216
- // node_modules/yargs-parser/build/lib/index.js
1070
+ // ../../node_modules/yargs-parser/build/lib/index.js
3217
1071
  var import_util = require("util");
3218
1072
  var import_path2 = require("path");
3219
1073
 
3220
- // node_modules/yargs-parser/build/lib/string-utils.js
1074
+ // ../../node_modules/yargs-parser/build/lib/string-utils.js
3221
1075
  function camelCase(str) {
3222
1076
  const isCamelCase = str !== str.toLowerCase() && str !== str.toUpperCase();
3223
1077
  if (!isCamelCase) {
@@ -3271,7 +1125,7 @@ function looksLikeNumber(x) {
3271
1125
  return /^[-]?(?:\d+(?:\.\d*)?|\.\d+)(e[-+]?\d+)?$/.test(x);
3272
1126
  }
3273
1127
 
3274
- // node_modules/yargs-parser/build/lib/tokenize-arg-string.js
1128
+ // ../../node_modules/yargs-parser/build/lib/tokenize-arg-string.js
3275
1129
  function tokenizeArgString(argString) {
3276
1130
  if (Array.isArray(argString)) {
3277
1131
  return argString.map((e) => typeof e !== "string" ? e + "" : e);
@@ -3303,7 +1157,7 @@ function tokenizeArgString(argString) {
3303
1157
  return args;
3304
1158
  }
3305
1159
 
3306
- // node_modules/yargs-parser/build/lib/yargs-parser-types.js
1160
+ // ../../node_modules/yargs-parser/build/lib/yargs-parser-types.js
3307
1161
  var DefaultValuesForTypeKey;
3308
1162
  (function(DefaultValuesForTypeKey2) {
3309
1163
  DefaultValuesForTypeKey2["BOOLEAN"] = "boolean";
@@ -3312,7 +1166,7 @@ var DefaultValuesForTypeKey;
3312
1166
  DefaultValuesForTypeKey2["ARRAY"] = "array";
3313
1167
  })(DefaultValuesForTypeKey || (DefaultValuesForTypeKey = {}));
3314
1168
 
3315
- // node_modules/yargs-parser/build/lib/yargs-parser.js
1169
+ // ../../node_modules/yargs-parser/build/lib/yargs-parser.js
3316
1170
  var mixin2;
3317
1171
  var YargsParser = class {
3318
1172
  constructor(_mixin) {
@@ -4152,7 +2006,7 @@ function stripQuotes(val) {
4152
2006
  return typeof val === "string" && (val[0] === "'" || val[0] === '"') && val[val.length - 1] === val[0] ? val.substring(1, val.length - 1) : val;
4153
2007
  }
4154
2008
 
4155
- // node_modules/yargs-parser/build/lib/index.js
2009
+ // ../../node_modules/yargs-parser/build/lib/index.js
4156
2010
  var import_fs2 = require("fs");
4157
2011
  var _a;
4158
2012
  var _b;
@@ -7808,7 +5662,7 @@ async function main() {
7808
5662
  });
7809
5663
  const killDevServer = () => {
7810
5664
  devProcess.kill("SIGKILL");
7811
- return (0, import_kill_port_process.killPortProcess)([port]).catch((err) => {
5665
+ return (0, import_cross_port_killer.kill)(port).catch((err) => {
7812
5666
  console.error(`Plasmic: Failed to kill dev server: ${err}`);
7813
5667
  });
7814
5668
  };