@markw65/monkeyc-optimizer 1.0.1 → 1.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,304 +1,6 @@
1
1
  /******/ (() => { // webpackBootstrap
2
2
  /******/ var __webpack_modules__ = ({
3
3
 
4
- /***/ 5623:
5
- /***/ ((module) => {
6
-
7
- "use strict";
8
-
9
- module.exports = balanced;
10
- function balanced(a, b, str) {
11
- if (a instanceof RegExp) a = maybeMatch(a, str);
12
- if (b instanceof RegExp) b = maybeMatch(b, str);
13
-
14
- var r = range(a, b, str);
15
-
16
- return r && {
17
- start: r[0],
18
- end: r[1],
19
- pre: str.slice(0, r[0]),
20
- body: str.slice(r[0] + a.length, r[1]),
21
- post: str.slice(r[1] + b.length)
22
- };
23
- }
24
-
25
- function maybeMatch(reg, str) {
26
- var m = str.match(reg);
27
- return m ? m[0] : null;
28
- }
29
-
30
- balanced.range = range;
31
- function range(a, b, str) {
32
- var begs, beg, left, right, result;
33
- var ai = str.indexOf(a);
34
- var bi = str.indexOf(b, ai + 1);
35
- var i = ai;
36
-
37
- if (ai >= 0 && bi > 0) {
38
- if(a===b) {
39
- return [ai, bi];
40
- }
41
- begs = [];
42
- left = str.length;
43
-
44
- while (i >= 0 && !result) {
45
- if (i == ai) {
46
- begs.push(i);
47
- ai = str.indexOf(a, i + 1);
48
- } else if (begs.length == 1) {
49
- result = [ begs.pop(), bi ];
50
- } else {
51
- beg = begs.pop();
52
- if (beg < left) {
53
- left = beg;
54
- right = bi;
55
- }
56
-
57
- bi = str.indexOf(b, i + 1);
58
- }
59
-
60
- i = ai < bi && ai >= 0 ? ai : bi;
61
- }
62
-
63
- if (begs.length) {
64
- result = [ left, right ];
65
- }
66
- }
67
-
68
- return result;
69
- }
70
-
71
-
72
- /***/ }),
73
-
74
- /***/ 3644:
75
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
76
-
77
- var concatMap = __webpack_require__(1048);
78
- var balanced = __webpack_require__(5623);
79
-
80
- module.exports = expandTop;
81
-
82
- var escSlash = '\0SLASH'+Math.random()+'\0';
83
- var escOpen = '\0OPEN'+Math.random()+'\0';
84
- var escClose = '\0CLOSE'+Math.random()+'\0';
85
- var escComma = '\0COMMA'+Math.random()+'\0';
86
- var escPeriod = '\0PERIOD'+Math.random()+'\0';
87
-
88
- function numeric(str) {
89
- return parseInt(str, 10) == str
90
- ? parseInt(str, 10)
91
- : str.charCodeAt(0);
92
- }
93
-
94
- function escapeBraces(str) {
95
- return str.split('\\\\').join(escSlash)
96
- .split('\\{').join(escOpen)
97
- .split('\\}').join(escClose)
98
- .split('\\,').join(escComma)
99
- .split('\\.').join(escPeriod);
100
- }
101
-
102
- function unescapeBraces(str) {
103
- return str.split(escSlash).join('\\')
104
- .split(escOpen).join('{')
105
- .split(escClose).join('}')
106
- .split(escComma).join(',')
107
- .split(escPeriod).join('.');
108
- }
109
-
110
-
111
- // Basically just str.split(","), but handling cases
112
- // where we have nested braced sections, which should be
113
- // treated as individual members, like {a,{b,c},d}
114
- function parseCommaParts(str) {
115
- if (!str)
116
- return [''];
117
-
118
- var parts = [];
119
- var m = balanced('{', '}', str);
120
-
121
- if (!m)
122
- return str.split(',');
123
-
124
- var pre = m.pre;
125
- var body = m.body;
126
- var post = m.post;
127
- var p = pre.split(',');
128
-
129
- p[p.length-1] += '{' + body + '}';
130
- var postParts = parseCommaParts(post);
131
- if (post.length) {
132
- p[p.length-1] += postParts.shift();
133
- p.push.apply(p, postParts);
134
- }
135
-
136
- parts.push.apply(parts, p);
137
-
138
- return parts;
139
- }
140
-
141
- function expandTop(str) {
142
- if (!str)
143
- return [];
144
-
145
- // I don't know why Bash 4.3 does this, but it does.
146
- // Anything starting with {} will have the first two bytes preserved
147
- // but *only* at the top level, so {},a}b will not expand to anything,
148
- // but a{},b}c will be expanded to [a}c,abc].
149
- // One could argue that this is a bug in Bash, but since the goal of
150
- // this module is to match Bash's rules, we escape a leading {}
151
- if (str.substr(0, 2) === '{}') {
152
- str = '\\{\\}' + str.substr(2);
153
- }
154
-
155
- return expand(escapeBraces(str), true).map(unescapeBraces);
156
- }
157
-
158
- function identity(e) {
159
- return e;
160
- }
161
-
162
- function embrace(str) {
163
- return '{' + str + '}';
164
- }
165
- function isPadded(el) {
166
- return /^-?0\d/.test(el);
167
- }
168
-
169
- function lte(i, y) {
170
- return i <= y;
171
- }
172
- function gte(i, y) {
173
- return i >= y;
174
- }
175
-
176
- function expand(str, isTop) {
177
- var expansions = [];
178
-
179
- var m = balanced('{', '}', str);
180
- if (!m || /\$$/.test(m.pre)) return [str];
181
-
182
- var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
183
- var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
184
- var isSequence = isNumericSequence || isAlphaSequence;
185
- var isOptions = m.body.indexOf(',') >= 0;
186
- if (!isSequence && !isOptions) {
187
- // {a},b}
188
- if (m.post.match(/,.*\}/)) {
189
- str = m.pre + '{' + m.body + escClose + m.post;
190
- return expand(str);
191
- }
192
- return [str];
193
- }
194
-
195
- var n;
196
- if (isSequence) {
197
- n = m.body.split(/\.\./);
198
- } else {
199
- n = parseCommaParts(m.body);
200
- if (n.length === 1) {
201
- // x{{a,b}}y ==> x{a}y x{b}y
202
- n = expand(n[0], false).map(embrace);
203
- if (n.length === 1) {
204
- var post = m.post.length
205
- ? expand(m.post, false)
206
- : [''];
207
- return post.map(function(p) {
208
- return m.pre + n[0] + p;
209
- });
210
- }
211
- }
212
- }
213
-
214
- // at this point, n is the parts, and we know it's not a comma set
215
- // with a single entry.
216
-
217
- // no need to expand pre, since it is guaranteed to be free of brace-sets
218
- var pre = m.pre;
219
- var post = m.post.length
220
- ? expand(m.post, false)
221
- : [''];
222
-
223
- var N;
224
-
225
- if (isSequence) {
226
- var x = numeric(n[0]);
227
- var y = numeric(n[1]);
228
- var width = Math.max(n[0].length, n[1].length)
229
- var incr = n.length == 3
230
- ? Math.abs(numeric(n[2]))
231
- : 1;
232
- var test = lte;
233
- var reverse = y < x;
234
- if (reverse) {
235
- incr *= -1;
236
- test = gte;
237
- }
238
- var pad = n.some(isPadded);
239
-
240
- N = [];
241
-
242
- for (var i = x; test(i, y); i += incr) {
243
- var c;
244
- if (isAlphaSequence) {
245
- c = String.fromCharCode(i);
246
- if (c === '\\')
247
- c = '';
248
- } else {
249
- c = String(i);
250
- if (pad) {
251
- var need = width - c.length;
252
- if (need > 0) {
253
- var z = new Array(need + 1).join('0');
254
- if (i < 0)
255
- c = '-' + z + c.slice(1);
256
- else
257
- c = z + c;
258
- }
259
- }
260
- }
261
- N.push(c);
262
- }
263
- } else {
264
- N = concatMap(n, function(el) { return expand(el, false) });
265
- }
266
-
267
- for (var j = 0; j < N.length; j++) {
268
- for (var k = 0; k < post.length; k++) {
269
- var expansion = pre + N[j] + post[k];
270
- if (!isTop || isSequence || expansion)
271
- expansions.push(expansion);
272
- }
273
- }
274
-
275
- return expansions;
276
- }
277
-
278
-
279
-
280
- /***/ }),
281
-
282
- /***/ 1048:
283
- /***/ ((module) => {
284
-
285
- module.exports = function (xs, fn) {
286
- var res = [];
287
- for (var i = 0; i < xs.length; i++) {
288
- var x = fn(xs[i], i);
289
- if (isArray(x)) res.push.apply(res, x);
290
- else res.push(x);
291
- }
292
- return res;
293
- };
294
-
295
- var isArray = Array.isArray || function (xs) {
296
- return Object.prototype.toString.call(xs) === '[object Array]';
297
- };
298
-
299
-
300
- /***/ }),
301
-
302
4
  /***/ 7187:
303
5
  /***/ ((module) => {
304
6
 
@@ -765,3078 +467,42 @@ function once(emitter, name) {
765
467
  resolve([].slice.call(arguments));
766
468
  };
767
469
 
768
- eventTargetAgnosticAddListener(emitter, name, resolver, { once: true });
769
- if (name !== 'error') {
770
- addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true });
771
- }
772
- });
773
- }
774
-
775
- function addErrorHandlerIfEventEmitter(emitter, handler, flags) {
776
- if (typeof emitter.on === 'function') {
777
- eventTargetAgnosticAddListener(emitter, 'error', handler, flags);
778
- }
779
- }
780
-
781
- function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
782
- if (typeof emitter.on === 'function') {
783
- if (flags.once) {
784
- emitter.once(name, listener);
785
- } else {
786
- emitter.on(name, listener);
787
- }
788
- } else if (typeof emitter.addEventListener === 'function') {
789
- // EventTarget does not have `error` event semantics like Node
790
- // EventEmitters, we do not listen for `error` events here.
791
- emitter.addEventListener(name, function wrapListener(arg) {
792
- // IE does not have builtin `{ once: true }` support so we
793
- // have to do it manually.
794
- if (flags.once) {
795
- emitter.removeEventListener(name, wrapListener);
796
- }
797
- listener(arg);
798
- });
799
- } else {
800
- throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof emitter);
801
- }
802
- }
803
-
804
-
805
- /***/ }),
806
-
807
- /***/ 7334:
808
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
809
-
810
- module.exports = realpath
811
- realpath.realpath = realpath
812
- realpath.sync = realpathSync
813
- realpath.realpathSync = realpathSync
814
- realpath.monkeypatch = monkeypatch
815
- realpath.unmonkeypatch = unmonkeypatch
816
-
817
- var fs = __webpack_require__(6231)
818
- var origRealpath = fs.realpath
819
- var origRealpathSync = fs.realpathSync
820
-
821
- var version = process.version
822
- var ok = /^v[0-5]\./.test(version)
823
- var old = __webpack_require__(7059)
824
-
825
- function newError (er) {
826
- return er && er.syscall === 'realpath' && (
827
- er.code === 'ELOOP' ||
828
- er.code === 'ENOMEM' ||
829
- er.code === 'ENAMETOOLONG'
830
- )
831
- }
832
-
833
- function realpath (p, cache, cb) {
834
- if (ok) {
835
- return origRealpath(p, cache, cb)
836
- }
837
-
838
- if (typeof cache === 'function') {
839
- cb = cache
840
- cache = null
841
- }
842
- origRealpath(p, cache, function (er, result) {
843
- if (newError(er)) {
844
- old.realpath(p, cache, cb)
845
- } else {
846
- cb(er, result)
847
- }
848
- })
849
- }
850
-
851
- function realpathSync (p, cache) {
852
- if (ok) {
853
- return origRealpathSync(p, cache)
854
- }
855
-
856
- try {
857
- return origRealpathSync(p, cache)
858
- } catch (er) {
859
- if (newError(er)) {
860
- return old.realpathSync(p, cache)
861
- } else {
862
- throw er
863
- }
864
- }
865
- }
866
-
867
- function monkeypatch () {
868
- fs.realpath = realpath
869
- fs.realpathSync = realpathSync
870
- }
871
-
872
- function unmonkeypatch () {
873
- fs.realpath = origRealpath
874
- fs.realpathSync = origRealpathSync
875
- }
876
-
877
-
878
- /***/ }),
879
-
880
- /***/ 7059:
881
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
882
-
883
- // Copyright Joyent, Inc. and other Node contributors.
884
- //
885
- // Permission is hereby granted, free of charge, to any person obtaining a
886
- // copy of this software and associated documentation files (the
887
- // "Software"), to deal in the Software without restriction, including
888
- // without limitation the rights to use, copy, modify, merge, publish,
889
- // distribute, sublicense, and/or sell copies of the Software, and to permit
890
- // persons to whom the Software is furnished to do so, subject to the
891
- // following conditions:
892
- //
893
- // The above copyright notice and this permission notice shall be included
894
- // in all copies or substantial portions of the Software.
895
- //
896
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
897
- // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
898
- // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
899
- // NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
900
- // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
901
- // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
902
- // USE OR OTHER DEALINGS IN THE SOFTWARE.
903
-
904
- var pathModule = __webpack_require__(1423);
905
- var isWindows = process.platform === 'win32';
906
- var fs = __webpack_require__(6231);
907
-
908
- // JavaScript implementation of realpath, ported from node pre-v6
909
-
910
- var DEBUG = process.env.NODE_DEBUG && /fs/.test(process.env.NODE_DEBUG);
911
-
912
- function rethrow() {
913
- // Only enable in debug mode. A backtrace uses ~1000 bytes of heap space and
914
- // is fairly slow to generate.
915
- var callback;
916
- if (DEBUG) {
917
- var backtrace = new Error;
918
- callback = debugCallback;
919
- } else
920
- callback = missingCallback;
921
-
922
- return callback;
923
-
924
- function debugCallback(err) {
925
- if (err) {
926
- backtrace.message = err.message;
927
- err = backtrace;
928
- missingCallback(err);
929
- }
930
- }
931
-
932
- function missingCallback(err) {
933
- if (err) {
934
- if (process.throwDeprecation)
935
- throw err; // Forgot a callback but don't know where? Use NODE_DEBUG=fs
936
- else if (!process.noDeprecation) {
937
- var msg = 'fs: missing callback ' + (err.stack || err.message);
938
- if (process.traceDeprecation)
939
- console.trace(msg);
940
- else
941
- console.error(msg);
942
- }
943
- }
944
- }
945
- }
946
-
947
- function maybeCallback(cb) {
948
- return typeof cb === 'function' ? cb : rethrow();
949
- }
950
-
951
- var normalize = pathModule.normalize;
952
-
953
- // Regexp that finds the next partion of a (partial) path
954
- // result is [base_with_slash, base], e.g. ['somedir/', 'somedir']
955
- if (isWindows) {
956
- var nextPartRe = /(.*?)(?:[\/\\]+|$)/g;
957
- } else {
958
- var nextPartRe = /(.*?)(?:[\/]+|$)/g;
959
- }
960
-
961
- // Regex to find the device root, including trailing slash. E.g. 'c:\\'.
962
- if (isWindows) {
963
- var splitRootRe = /^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/;
964
- } else {
965
- var splitRootRe = /^[\/]*/;
966
- }
967
-
968
- exports.realpathSync = function realpathSync(p, cache) {
969
- // make p is absolute
970
- p = pathModule.resolve(p);
971
-
972
- if (cache && Object.prototype.hasOwnProperty.call(cache, p)) {
973
- return cache[p];
974
- }
975
-
976
- var original = p,
977
- seenLinks = {},
978
- knownHard = {};
979
-
980
- // current character position in p
981
- var pos;
982
- // the partial path so far, including a trailing slash if any
983
- var current;
984
- // the partial path without a trailing slash (except when pointing at a root)
985
- var base;
986
- // the partial path scanned in the previous round, with slash
987
- var previous;
988
-
989
- start();
990
-
991
- function start() {
992
- // Skip over roots
993
- var m = splitRootRe.exec(p);
994
- pos = m[0].length;
995
- current = m[0];
996
- base = m[0];
997
- previous = '';
998
-
999
- // On windows, check that the root exists. On unix there is no need.
1000
- if (isWindows && !knownHard[base]) {
1001
- fs.lstatSync(base);
1002
- knownHard[base] = true;
1003
- }
1004
- }
1005
-
1006
- // walk down the path, swapping out linked pathparts for their real
1007
- // values
1008
- // NB: p.length changes.
1009
- while (pos < p.length) {
1010
- // find the next part
1011
- nextPartRe.lastIndex = pos;
1012
- var result = nextPartRe.exec(p);
1013
- previous = current;
1014
- current += result[0];
1015
- base = previous + result[1];
1016
- pos = nextPartRe.lastIndex;
1017
-
1018
- // continue if not a symlink
1019
- if (knownHard[base] || (cache && cache[base] === base)) {
1020
- continue;
1021
- }
1022
-
1023
- var resolvedLink;
1024
- if (cache && Object.prototype.hasOwnProperty.call(cache, base)) {
1025
- // some known symbolic link. no need to stat again.
1026
- resolvedLink = cache[base];
1027
- } else {
1028
- var stat = fs.lstatSync(base);
1029
- if (!stat.isSymbolicLink()) {
1030
- knownHard[base] = true;
1031
- if (cache) cache[base] = base;
1032
- continue;
1033
- }
1034
-
1035
- // read the link if it wasn't read before
1036
- // dev/ino always return 0 on windows, so skip the check.
1037
- var linkTarget = null;
1038
- if (!isWindows) {
1039
- var id = stat.dev.toString(32) + ':' + stat.ino.toString(32);
1040
- if (seenLinks.hasOwnProperty(id)) {
1041
- linkTarget = seenLinks[id];
1042
- }
1043
- }
1044
- if (linkTarget === null) {
1045
- fs.statSync(base);
1046
- linkTarget = fs.readlinkSync(base);
1047
- }
1048
- resolvedLink = pathModule.resolve(previous, linkTarget);
1049
- // track this, if given a cache.
1050
- if (cache) cache[base] = resolvedLink;
1051
- if (!isWindows) seenLinks[id] = linkTarget;
1052
- }
1053
-
1054
- // resolve the link, then start over
1055
- p = pathModule.resolve(resolvedLink, p.slice(pos));
1056
- start();
1057
- }
1058
-
1059
- if (cache) cache[original] = p;
1060
-
1061
- return p;
1062
- };
1063
-
1064
-
1065
- exports.realpath = function realpath(p, cache, cb) {
1066
- if (typeof cb !== 'function') {
1067
- cb = maybeCallback(cache);
1068
- cache = null;
1069
- }
1070
-
1071
- // make p is absolute
1072
- p = pathModule.resolve(p);
1073
-
1074
- if (cache && Object.prototype.hasOwnProperty.call(cache, p)) {
1075
- return process.nextTick(cb.bind(null, null, cache[p]));
1076
- }
1077
-
1078
- var original = p,
1079
- seenLinks = {},
1080
- knownHard = {};
1081
-
1082
- // current character position in p
1083
- var pos;
1084
- // the partial path so far, including a trailing slash if any
1085
- var current;
1086
- // the partial path without a trailing slash (except when pointing at a root)
1087
- var base;
1088
- // the partial path scanned in the previous round, with slash
1089
- var previous;
1090
-
1091
- start();
1092
-
1093
- function start() {
1094
- // Skip over roots
1095
- var m = splitRootRe.exec(p);
1096
- pos = m[0].length;
1097
- current = m[0];
1098
- base = m[0];
1099
- previous = '';
1100
-
1101
- // On windows, check that the root exists. On unix there is no need.
1102
- if (isWindows && !knownHard[base]) {
1103
- fs.lstat(base, function(err) {
1104
- if (err) return cb(err);
1105
- knownHard[base] = true;
1106
- LOOP();
1107
- });
1108
- } else {
1109
- process.nextTick(LOOP);
1110
- }
1111
- }
1112
-
1113
- // walk down the path, swapping out linked pathparts for their real
1114
- // values
1115
- function LOOP() {
1116
- // stop if scanned past end of path
1117
- if (pos >= p.length) {
1118
- if (cache) cache[original] = p;
1119
- return cb(null, p);
1120
- }
1121
-
1122
- // find the next part
1123
- nextPartRe.lastIndex = pos;
1124
- var result = nextPartRe.exec(p);
1125
- previous = current;
1126
- current += result[0];
1127
- base = previous + result[1];
1128
- pos = nextPartRe.lastIndex;
1129
-
1130
- // continue if not a symlink
1131
- if (knownHard[base] || (cache && cache[base] === base)) {
1132
- return process.nextTick(LOOP);
1133
- }
1134
-
1135
- if (cache && Object.prototype.hasOwnProperty.call(cache, base)) {
1136
- // known symbolic link. no need to stat again.
1137
- return gotResolvedLink(cache[base]);
1138
- }
1139
-
1140
- return fs.lstat(base, gotStat);
1141
- }
1142
-
1143
- function gotStat(err, stat) {
1144
- if (err) return cb(err);
1145
-
1146
- // if not a symlink, skip to the next path part
1147
- if (!stat.isSymbolicLink()) {
1148
- knownHard[base] = true;
1149
- if (cache) cache[base] = base;
1150
- return process.nextTick(LOOP);
1151
- }
1152
-
1153
- // stat & read the link if not read before
1154
- // call gotTarget as soon as the link target is known
1155
- // dev/ino always return 0 on windows, so skip the check.
1156
- if (!isWindows) {
1157
- var id = stat.dev.toString(32) + ':' + stat.ino.toString(32);
1158
- if (seenLinks.hasOwnProperty(id)) {
1159
- return gotTarget(null, seenLinks[id], base);
1160
- }
1161
- }
1162
- fs.stat(base, function(err) {
1163
- if (err) return cb(err);
1164
-
1165
- fs.readlink(base, function(err, target) {
1166
- if (!isWindows) seenLinks[id] = target;
1167
- gotTarget(err, target);
1168
- });
1169
- });
1170
- }
1171
-
1172
- function gotTarget(err, target, base) {
1173
- if (err) return cb(err);
1174
-
1175
- var resolvedLink = pathModule.resolve(previous, target);
1176
- if (cache) cache[base] = resolvedLink;
1177
- gotResolvedLink(resolvedLink);
1178
- }
1179
-
1180
- function gotResolvedLink(resolvedLink) {
1181
- // resolve the link, then start over
1182
- p = pathModule.resolve(resolvedLink, p.slice(pos));
1183
- start();
1184
- }
1185
- };
1186
-
1187
-
1188
- /***/ }),
1189
-
1190
- /***/ 6772:
1191
- /***/ ((__unused_webpack_module, exports, __webpack_require__) => {
1192
-
1193
- exports.setopts = setopts
1194
- exports.ownProp = ownProp
1195
- exports.makeAbs = makeAbs
1196
- exports.finish = finish
1197
- exports.mark = mark
1198
- exports.isIgnored = isIgnored
1199
- exports.childrenIgnored = childrenIgnored
1200
-
1201
- function ownProp (obj, field) {
1202
- return Object.prototype.hasOwnProperty.call(obj, field)
1203
- }
1204
-
1205
- var fs = __webpack_require__(6231)
1206
- var path = __webpack_require__(1423)
1207
- var minimatch = __webpack_require__(1171)
1208
- var isAbsolute = __webpack_require__(4095)
1209
- var Minimatch = minimatch.Minimatch
1210
-
1211
- function alphasort (a, b) {
1212
- return a.localeCompare(b, 'en')
1213
- }
1214
-
1215
- function setupIgnores (self, options) {
1216
- self.ignore = options.ignore || []
1217
-
1218
- if (!Array.isArray(self.ignore))
1219
- self.ignore = [self.ignore]
1220
-
1221
- if (self.ignore.length) {
1222
- self.ignore = self.ignore.map(ignoreMap)
1223
- }
1224
- }
1225
-
1226
- // ignore patterns are always in dot:true mode.
1227
- function ignoreMap (pattern) {
1228
- var gmatcher = null
1229
- if (pattern.slice(-3) === '/**') {
1230
- var gpattern = pattern.replace(/(\/\*\*)+$/, '')
1231
- gmatcher = new Minimatch(gpattern, { dot: true })
1232
- }
1233
-
1234
- return {
1235
- matcher: new Minimatch(pattern, { dot: true }),
1236
- gmatcher: gmatcher
1237
- }
1238
- }
1239
-
1240
- function setopts (self, pattern, options) {
1241
- if (!options)
1242
- options = {}
1243
-
1244
- // base-matching: just use globstar for that.
1245
- if (options.matchBase && -1 === pattern.indexOf("/")) {
1246
- if (options.noglobstar) {
1247
- throw new Error("base matching requires globstar")
1248
- }
1249
- pattern = "**/" + pattern
1250
- }
1251
-
1252
- self.silent = !!options.silent
1253
- self.pattern = pattern
1254
- self.strict = options.strict !== false
1255
- self.realpath = !!options.realpath
1256
- self.realpathCache = options.realpathCache || Object.create(null)
1257
- self.follow = !!options.follow
1258
- self.dot = !!options.dot
1259
- self.mark = !!options.mark
1260
- self.nodir = !!options.nodir
1261
- if (self.nodir)
1262
- self.mark = true
1263
- self.sync = !!options.sync
1264
- self.nounique = !!options.nounique
1265
- self.nonull = !!options.nonull
1266
- self.nosort = !!options.nosort
1267
- self.nocase = !!options.nocase
1268
- self.stat = !!options.stat
1269
- self.noprocess = !!options.noprocess
1270
- self.absolute = !!options.absolute
1271
- self.fs = options.fs || fs
1272
-
1273
- self.maxLength = options.maxLength || Infinity
1274
- self.cache = options.cache || Object.create(null)
1275
- self.statCache = options.statCache || Object.create(null)
1276
- self.symlinks = options.symlinks || Object.create(null)
1277
-
1278
- setupIgnores(self, options)
1279
-
1280
- self.changedCwd = false
1281
- var cwd = process.cwd()
1282
- if (!ownProp(options, "cwd"))
1283
- self.cwd = cwd
1284
- else {
1285
- self.cwd = path.resolve(options.cwd)
1286
- self.changedCwd = self.cwd !== cwd
1287
- }
1288
-
1289
- self.root = options.root || path.resolve(self.cwd, "/")
1290
- self.root = path.resolve(self.root)
1291
- if (process.platform === "win32")
1292
- self.root = self.root.replace(/\\/g, "/")
1293
-
1294
- // TODO: is an absolute `cwd` supposed to be resolved against `root`?
1295
- // e.g. { cwd: '/test', root: __dirname } === path.join(__dirname, '/test')
1296
- self.cwdAbs = isAbsolute(self.cwd) ? self.cwd : makeAbs(self, self.cwd)
1297
- if (process.platform === "win32")
1298
- self.cwdAbs = self.cwdAbs.replace(/\\/g, "/")
1299
- self.nomount = !!options.nomount
1300
-
1301
- // disable comments and negation in Minimatch.
1302
- // Note that they are not supported in Glob itself anyway.
1303
- options.nonegate = true
1304
- options.nocomment = true
1305
-
1306
- self.minimatch = new Minimatch(pattern, options)
1307
- self.options = self.minimatch.options
1308
- }
1309
-
1310
- function finish (self) {
1311
- var nou = self.nounique
1312
- var all = nou ? [] : Object.create(null)
1313
-
1314
- for (var i = 0, l = self.matches.length; i < l; i ++) {
1315
- var matches = self.matches[i]
1316
- if (!matches || Object.keys(matches).length === 0) {
1317
- if (self.nonull) {
1318
- // do like the shell, and spit out the literal glob
1319
- var literal = self.minimatch.globSet[i]
1320
- if (nou)
1321
- all.push(literal)
1322
- else
1323
- all[literal] = true
1324
- }
1325
- } else {
1326
- // had matches
1327
- var m = Object.keys(matches)
1328
- if (nou)
1329
- all.push.apply(all, m)
1330
- else
1331
- m.forEach(function (m) {
1332
- all[m] = true
1333
- })
1334
- }
1335
- }
1336
-
1337
- if (!nou)
1338
- all = Object.keys(all)
1339
-
1340
- if (!self.nosort)
1341
- all = all.sort(alphasort)
1342
-
1343
- // at *some* point we statted all of these
1344
- if (self.mark) {
1345
- for (var i = 0; i < all.length; i++) {
1346
- all[i] = self._mark(all[i])
1347
- }
1348
- if (self.nodir) {
1349
- all = all.filter(function (e) {
1350
- var notDir = !(/\/$/.test(e))
1351
- var c = self.cache[e] || self.cache[makeAbs(self, e)]
1352
- if (notDir && c)
1353
- notDir = c !== 'DIR' && !Array.isArray(c)
1354
- return notDir
1355
- })
1356
- }
1357
- }
1358
-
1359
- if (self.ignore.length)
1360
- all = all.filter(function(m) {
1361
- return !isIgnored(self, m)
1362
- })
1363
-
1364
- self.found = all
1365
- }
1366
-
1367
- function mark (self, p) {
1368
- var abs = makeAbs(self, p)
1369
- var c = self.cache[abs]
1370
- var m = p
1371
- if (c) {
1372
- var isDir = c === 'DIR' || Array.isArray(c)
1373
- var slash = p.slice(-1) === '/'
1374
-
1375
- if (isDir && !slash)
1376
- m += '/'
1377
- else if (!isDir && slash)
1378
- m = m.slice(0, -1)
1379
-
1380
- if (m !== p) {
1381
- var mabs = makeAbs(self, m)
1382
- self.statCache[mabs] = self.statCache[abs]
1383
- self.cache[mabs] = self.cache[abs]
1384
- }
1385
- }
1386
-
1387
- return m
1388
- }
1389
-
1390
- // lotta situps...
1391
- function makeAbs (self, f) {
1392
- var abs = f
1393
- if (f.charAt(0) === '/') {
1394
- abs = path.join(self.root, f)
1395
- } else if (isAbsolute(f) || f === '') {
1396
- abs = f
1397
- } else if (self.changedCwd) {
1398
- abs = path.resolve(self.cwd, f)
1399
- } else {
1400
- abs = path.resolve(f)
1401
- }
1402
-
1403
- if (process.platform === 'win32')
1404
- abs = abs.replace(/\\/g, '/')
1405
-
1406
- return abs
1407
- }
1408
-
1409
-
1410
- // Return true, if pattern ends with globstar '**', for the accompanying parent directory.
1411
- // Ex:- If node_modules/** is the pattern, add 'node_modules' to ignore list along with it's contents
1412
- function isIgnored (self, path) {
1413
- if (!self.ignore.length)
1414
- return false
1415
-
1416
- return self.ignore.some(function(item) {
1417
- return item.matcher.match(path) || !!(item.gmatcher && item.gmatcher.match(path))
1418
- })
1419
- }
1420
-
1421
- function childrenIgnored (self, path) {
1422
- if (!self.ignore.length)
1423
- return false
1424
-
1425
- return self.ignore.some(function(item) {
1426
- return !!(item.gmatcher && item.gmatcher.match(path))
1427
- })
1428
- }
1429
-
1430
-
1431
- /***/ }),
1432
-
1433
- /***/ 2884:
1434
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
1435
-
1436
- // Approach:
1437
- //
1438
- // 1. Get the minimatch set
1439
- // 2. For each pattern in the set, PROCESS(pattern, false)
1440
- // 3. Store matches per-set, then uniq them
1441
- //
1442
- // PROCESS(pattern, inGlobStar)
1443
- // Get the first [n] items from pattern that are all strings
1444
- // Join these together. This is PREFIX.
1445
- // If there is no more remaining, then stat(PREFIX) and
1446
- // add to matches if it succeeds. END.
1447
- //
1448
- // If inGlobStar and PREFIX is symlink and points to dir
1449
- // set ENTRIES = []
1450
- // else readdir(PREFIX) as ENTRIES
1451
- // If fail, END
1452
- //
1453
- // with ENTRIES
1454
- // If pattern[n] is GLOBSTAR
1455
- // // handle the case where the globstar match is empty
1456
- // // by pruning it out, and testing the resulting pattern
1457
- // PROCESS(pattern[0..n] + pattern[n+1 .. $], false)
1458
- // // handle other cases.
1459
- // for ENTRY in ENTRIES (not dotfiles)
1460
- // // attach globstar + tail onto the entry
1461
- // // Mark that this entry is a globstar match
1462
- // PROCESS(pattern[0..n] + ENTRY + pattern[n .. $], true)
1463
- //
1464
- // else // not globstar
1465
- // for ENTRY in ENTRIES (not dotfiles, unless pattern[n] is dot)
1466
- // Test ENTRY against pattern[n]
1467
- // If fails, continue
1468
- // If passes, PROCESS(pattern[0..n] + item + pattern[n+1 .. $])
1469
- //
1470
- // Caveat:
1471
- // Cache all stats and readdirs results to minimize syscall. Since all
1472
- // we ever care about is existence and directory-ness, we can just keep
1473
- // `true` for files, and [children,...] for directories, or `false` for
1474
- // things that don't exist.
1475
-
1476
- module.exports = glob
1477
-
1478
- var rp = __webpack_require__(7334)
1479
- var minimatch = __webpack_require__(1171)
1480
- var Minimatch = minimatch.Minimatch
1481
- var inherits = __webpack_require__(5717)
1482
- var EE = (__webpack_require__(7187).EventEmitter)
1483
- var path = __webpack_require__(1423)
1484
- var assert = __webpack_require__(9084)
1485
- var isAbsolute = __webpack_require__(4095)
1486
- var globSync = __webpack_require__(4751)
1487
- var common = __webpack_require__(6772)
1488
- var setopts = common.setopts
1489
- var ownProp = common.ownProp
1490
- var inflight = __webpack_require__(7844)
1491
- var util = __webpack_require__(6464)
1492
- var childrenIgnored = common.childrenIgnored
1493
- var isIgnored = common.isIgnored
1494
-
1495
- var once = __webpack_require__(778)
1496
-
1497
- function glob (pattern, options, cb) {
1498
- if (typeof options === 'function') cb = options, options = {}
1499
- if (!options) options = {}
1500
-
1501
- if (options.sync) {
1502
- if (cb)
1503
- throw new TypeError('callback provided to sync glob')
1504
- return globSync(pattern, options)
1505
- }
1506
-
1507
- return new Glob(pattern, options, cb)
1508
- }
1509
-
1510
- glob.sync = globSync
1511
- var GlobSync = glob.GlobSync = globSync.GlobSync
1512
-
1513
- // old api surface
1514
- glob.glob = glob
1515
-
1516
- function extend (origin, add) {
1517
- if (add === null || typeof add !== 'object') {
1518
- return origin
1519
- }
1520
-
1521
- var keys = Object.keys(add)
1522
- var i = keys.length
1523
- while (i--) {
1524
- origin[keys[i]] = add[keys[i]]
1525
- }
1526
- return origin
1527
- }
1528
-
1529
- glob.hasMagic = function (pattern, options_) {
1530
- var options = extend({}, options_)
1531
- options.noprocess = true
1532
-
1533
- var g = new Glob(pattern, options)
1534
- var set = g.minimatch.set
1535
-
1536
- if (!pattern)
1537
- return false
1538
-
1539
- if (set.length > 1)
1540
- return true
1541
-
1542
- for (var j = 0; j < set[0].length; j++) {
1543
- if (typeof set[0][j] !== 'string')
1544
- return true
1545
- }
1546
-
1547
- return false
1548
- }
1549
-
1550
- glob.Glob = Glob
1551
- inherits(Glob, EE)
1552
- function Glob (pattern, options, cb) {
1553
- if (typeof options === 'function') {
1554
- cb = options
1555
- options = null
1556
- }
1557
-
1558
- if (options && options.sync) {
1559
- if (cb)
1560
- throw new TypeError('callback provided to sync glob')
1561
- return new GlobSync(pattern, options)
1562
- }
1563
-
1564
- if (!(this instanceof Glob))
1565
- return new Glob(pattern, options, cb)
1566
-
1567
- setopts(this, pattern, options)
1568
- this._didRealPath = false
1569
-
1570
- // process each pattern in the minimatch set
1571
- var n = this.minimatch.set.length
1572
-
1573
- // The matches are stored as {<filename>: true,...} so that
1574
- // duplicates are automagically pruned.
1575
- // Later, we do an Object.keys() on these.
1576
- // Keep them as a list so we can fill in when nonull is set.
1577
- this.matches = new Array(n)
1578
-
1579
- if (typeof cb === 'function') {
1580
- cb = once(cb)
1581
- this.on('error', cb)
1582
- this.on('end', function (matches) {
1583
- cb(null, matches)
1584
- })
1585
- }
1586
-
1587
- var self = this
1588
- this._processing = 0
1589
-
1590
- this._emitQueue = []
1591
- this._processQueue = []
1592
- this.paused = false
1593
-
1594
- if (this.noprocess)
1595
- return this
1596
-
1597
- if (n === 0)
1598
- return done()
1599
-
1600
- var sync = true
1601
- for (var i = 0; i < n; i ++) {
1602
- this._process(this.minimatch.set[i], i, false, done)
1603
- }
1604
- sync = false
1605
-
1606
- function done () {
1607
- --self._processing
1608
- if (self._processing <= 0) {
1609
- if (sync) {
1610
- process.nextTick(function () {
1611
- self._finish()
1612
- })
1613
- } else {
1614
- self._finish()
1615
- }
1616
- }
1617
- }
1618
- }
1619
-
1620
- Glob.prototype._finish = function () {
1621
- assert(this instanceof Glob)
1622
- if (this.aborted)
1623
- return
1624
-
1625
- if (this.realpath && !this._didRealpath)
1626
- return this._realpath()
1627
-
1628
- common.finish(this)
1629
- this.emit('end', this.found)
1630
- }
1631
-
1632
- Glob.prototype._realpath = function () {
1633
- if (this._didRealpath)
1634
- return
1635
-
1636
- this._didRealpath = true
1637
-
1638
- var n = this.matches.length
1639
- if (n === 0)
1640
- return this._finish()
1641
-
1642
- var self = this
1643
- for (var i = 0; i < this.matches.length; i++)
1644
- this._realpathSet(i, next)
1645
-
1646
- function next () {
1647
- if (--n === 0)
1648
- self._finish()
1649
- }
1650
- }
1651
-
1652
- Glob.prototype._realpathSet = function (index, cb) {
1653
- var matchset = this.matches[index]
1654
- if (!matchset)
1655
- return cb()
1656
-
1657
- var found = Object.keys(matchset)
1658
- var self = this
1659
- var n = found.length
1660
-
1661
- if (n === 0)
1662
- return cb()
1663
-
1664
- var set = this.matches[index] = Object.create(null)
1665
- found.forEach(function (p, i) {
1666
- // If there's a problem with the stat, then it means that
1667
- // one or more of the links in the realpath couldn't be
1668
- // resolved. just return the abs value in that case.
1669
- p = self._makeAbs(p)
1670
- rp.realpath(p, self.realpathCache, function (er, real) {
1671
- if (!er)
1672
- set[real] = true
1673
- else if (er.syscall === 'stat')
1674
- set[p] = true
1675
- else
1676
- self.emit('error', er) // srsly wtf right here
1677
-
1678
- if (--n === 0) {
1679
- self.matches[index] = set
1680
- cb()
1681
- }
1682
- })
1683
- })
1684
- }
1685
-
1686
- Glob.prototype._mark = function (p) {
1687
- return common.mark(this, p)
1688
- }
1689
-
1690
- Glob.prototype._makeAbs = function (f) {
1691
- return common.makeAbs(this, f)
1692
- }
1693
-
1694
- Glob.prototype.abort = function () {
1695
- this.aborted = true
1696
- this.emit('abort')
1697
- }
1698
-
1699
- Glob.prototype.pause = function () {
1700
- if (!this.paused) {
1701
- this.paused = true
1702
- this.emit('pause')
1703
- }
1704
- }
1705
-
1706
- Glob.prototype.resume = function () {
1707
- if (this.paused) {
1708
- this.emit('resume')
1709
- this.paused = false
1710
- if (this._emitQueue.length) {
1711
- var eq = this._emitQueue.slice(0)
1712
- this._emitQueue.length = 0
1713
- for (var i = 0; i < eq.length; i ++) {
1714
- var e = eq[i]
1715
- this._emitMatch(e[0], e[1])
1716
- }
1717
- }
1718
- if (this._processQueue.length) {
1719
- var pq = this._processQueue.slice(0)
1720
- this._processQueue.length = 0
1721
- for (var i = 0; i < pq.length; i ++) {
1722
- var p = pq[i]
1723
- this._processing--
1724
- this._process(p[0], p[1], p[2], p[3])
1725
- }
1726
- }
1727
- }
1728
- }
1729
-
1730
- Glob.prototype._process = function (pattern, index, inGlobStar, cb) {
1731
- assert(this instanceof Glob)
1732
- assert(typeof cb === 'function')
1733
-
1734
- if (this.aborted)
1735
- return
1736
-
1737
- this._processing++
1738
- if (this.paused) {
1739
- this._processQueue.push([pattern, index, inGlobStar, cb])
1740
- return
1741
- }
1742
-
1743
- //console.error('PROCESS %d', this._processing, pattern)
1744
-
1745
- // Get the first [n] parts of pattern that are all strings.
1746
- var n = 0
1747
- while (typeof pattern[n] === 'string') {
1748
- n ++
1749
- }
1750
- // now n is the index of the first one that is *not* a string.
1751
-
1752
- // see if there's anything else
1753
- var prefix
1754
- switch (n) {
1755
- // if not, then this is rather simple
1756
- case pattern.length:
1757
- this._processSimple(pattern.join('/'), index, cb)
1758
- return
1759
-
1760
- case 0:
1761
- // pattern *starts* with some non-trivial item.
1762
- // going to readdir(cwd), but not include the prefix in matches.
1763
- prefix = null
1764
- break
1765
-
1766
- default:
1767
- // pattern has some string bits in the front.
1768
- // whatever it starts with, whether that's 'absolute' like /foo/bar,
1769
- // or 'relative' like '../baz'
1770
- prefix = pattern.slice(0, n).join('/')
1771
- break
1772
- }
1773
-
1774
- var remain = pattern.slice(n)
1775
-
1776
- // get the list of entries.
1777
- var read
1778
- if (prefix === null)
1779
- read = '.'
1780
- else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) {
1781
- if (!prefix || !isAbsolute(prefix))
1782
- prefix = '/' + prefix
1783
- read = prefix
1784
- } else
1785
- read = prefix
1786
-
1787
- var abs = this._makeAbs(read)
1788
-
1789
- //if ignored, skip _processing
1790
- if (childrenIgnored(this, read))
1791
- return cb()
1792
-
1793
- var isGlobStar = remain[0] === minimatch.GLOBSTAR
1794
- if (isGlobStar)
1795
- this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb)
1796
- else
1797
- this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb)
1798
- }
1799
-
1800
- Glob.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar, cb) {
1801
- var self = this
1802
- this._readdir(abs, inGlobStar, function (er, entries) {
1803
- return self._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb)
1804
- })
1805
- }
1806
-
1807
- Glob.prototype._processReaddir2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) {
1808
-
1809
- // if the abs isn't a dir, then nothing can match!
1810
- if (!entries)
1811
- return cb()
1812
-
1813
- // It will only match dot entries if it starts with a dot, or if
1814
- // dot is set. Stuff like @(.foo|.bar) isn't allowed.
1815
- var pn = remain[0]
1816
- var negate = !!this.minimatch.negate
1817
- var rawGlob = pn._glob
1818
- var dotOk = this.dot || rawGlob.charAt(0) === '.'
1819
-
1820
- var matchedEntries = []
1821
- for (var i = 0; i < entries.length; i++) {
1822
- var e = entries[i]
1823
- if (e.charAt(0) !== '.' || dotOk) {
1824
- var m
1825
- if (negate && !prefix) {
1826
- m = !e.match(pn)
1827
- } else {
1828
- m = e.match(pn)
1829
- }
1830
- if (m)
1831
- matchedEntries.push(e)
1832
- }
1833
- }
1834
-
1835
- //console.error('prd2', prefix, entries, remain[0]._glob, matchedEntries)
1836
-
1837
- var len = matchedEntries.length
1838
- // If there are no matched entries, then nothing matches.
1839
- if (len === 0)
1840
- return cb()
1841
-
1842
- // if this is the last remaining pattern bit, then no need for
1843
- // an additional stat *unless* the user has specified mark or
1844
- // stat explicitly. We know they exist, since readdir returned
1845
- // them.
1846
-
1847
- if (remain.length === 1 && !this.mark && !this.stat) {
1848
- if (!this.matches[index])
1849
- this.matches[index] = Object.create(null)
1850
-
1851
- for (var i = 0; i < len; i ++) {
1852
- var e = matchedEntries[i]
1853
- if (prefix) {
1854
- if (prefix !== '/')
1855
- e = prefix + '/' + e
1856
- else
1857
- e = prefix + e
1858
- }
1859
-
1860
- if (e.charAt(0) === '/' && !this.nomount) {
1861
- e = path.join(this.root, e)
1862
- }
1863
- this._emitMatch(index, e)
1864
- }
1865
- // This was the last one, and no stats were needed
1866
- return cb()
1867
- }
1868
-
1869
- // now test all matched entries as stand-ins for that part
1870
- // of the pattern.
1871
- remain.shift()
1872
- for (var i = 0; i < len; i ++) {
1873
- var e = matchedEntries[i]
1874
- var newPattern
1875
- if (prefix) {
1876
- if (prefix !== '/')
1877
- e = prefix + '/' + e
1878
- else
1879
- e = prefix + e
1880
- }
1881
- this._process([e].concat(remain), index, inGlobStar, cb)
1882
- }
1883
- cb()
1884
- }
1885
-
1886
- Glob.prototype._emitMatch = function (index, e) {
1887
- if (this.aborted)
1888
- return
1889
-
1890
- if (isIgnored(this, e))
1891
- return
1892
-
1893
- if (this.paused) {
1894
- this._emitQueue.push([index, e])
1895
- return
1896
- }
1897
-
1898
- var abs = isAbsolute(e) ? e : this._makeAbs(e)
1899
-
1900
- if (this.mark)
1901
- e = this._mark(e)
1902
-
1903
- if (this.absolute)
1904
- e = abs
1905
-
1906
- if (this.matches[index][e])
1907
- return
1908
-
1909
- if (this.nodir) {
1910
- var c = this.cache[abs]
1911
- if (c === 'DIR' || Array.isArray(c))
1912
- return
1913
- }
1914
-
1915
- this.matches[index][e] = true
1916
-
1917
- var st = this.statCache[abs]
1918
- if (st)
1919
- this.emit('stat', e, st)
1920
-
1921
- this.emit('match', e)
1922
- }
1923
-
1924
- Glob.prototype._readdirInGlobStar = function (abs, cb) {
1925
- if (this.aborted)
1926
- return
1927
-
1928
- // follow all symlinked directories forever
1929
- // just proceed as if this is a non-globstar situation
1930
- if (this.follow)
1931
- return this._readdir(abs, false, cb)
1932
-
1933
- var lstatkey = 'lstat\0' + abs
1934
- var self = this
1935
- var lstatcb = inflight(lstatkey, lstatcb_)
1936
-
1937
- if (lstatcb)
1938
- self.fs.lstat(abs, lstatcb)
1939
-
1940
- function lstatcb_ (er, lstat) {
1941
- if (er && er.code === 'ENOENT')
1942
- return cb()
1943
-
1944
- var isSym = lstat && lstat.isSymbolicLink()
1945
- self.symlinks[abs] = isSym
1946
-
1947
- // If it's not a symlink or a dir, then it's definitely a regular file.
1948
- // don't bother doing a readdir in that case.
1949
- if (!isSym && lstat && !lstat.isDirectory()) {
1950
- self.cache[abs] = 'FILE'
1951
- cb()
1952
- } else
1953
- self._readdir(abs, false, cb)
1954
- }
1955
- }
1956
-
1957
- Glob.prototype._readdir = function (abs, inGlobStar, cb) {
1958
- if (this.aborted)
1959
- return
1960
-
1961
- cb = inflight('readdir\0'+abs+'\0'+inGlobStar, cb)
1962
- if (!cb)
1963
- return
1964
-
1965
- //console.error('RD %j %j', +inGlobStar, abs)
1966
- if (inGlobStar && !ownProp(this.symlinks, abs))
1967
- return this._readdirInGlobStar(abs, cb)
1968
-
1969
- if (ownProp(this.cache, abs)) {
1970
- var c = this.cache[abs]
1971
- if (!c || c === 'FILE')
1972
- return cb()
1973
-
1974
- if (Array.isArray(c))
1975
- return cb(null, c)
1976
- }
1977
-
1978
- var self = this
1979
- self.fs.readdir(abs, readdirCb(this, abs, cb))
1980
- }
1981
-
1982
- function readdirCb (self, abs, cb) {
1983
- return function (er, entries) {
1984
- if (er)
1985
- self._readdirError(abs, er, cb)
1986
- else
1987
- self._readdirEntries(abs, entries, cb)
1988
- }
1989
- }
1990
-
1991
- Glob.prototype._readdirEntries = function (abs, entries, cb) {
1992
- if (this.aborted)
1993
- return
1994
-
1995
- // if we haven't asked to stat everything, then just
1996
- // assume that everything in there exists, so we can avoid
1997
- // having to stat it a second time.
1998
- if (!this.mark && !this.stat) {
1999
- for (var i = 0; i < entries.length; i ++) {
2000
- var e = entries[i]
2001
- if (abs === '/')
2002
- e = abs + e
2003
- else
2004
- e = abs + '/' + e
2005
- this.cache[e] = true
2006
- }
2007
- }
2008
-
2009
- this.cache[abs] = entries
2010
- return cb(null, entries)
2011
- }
2012
-
2013
- Glob.prototype._readdirError = function (f, er, cb) {
2014
- if (this.aborted)
2015
- return
2016
-
2017
- // handle errors, and cache the information
2018
- switch (er.code) {
2019
- case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205
2020
- case 'ENOTDIR': // totally normal. means it *does* exist.
2021
- var abs = this._makeAbs(f)
2022
- this.cache[abs] = 'FILE'
2023
- if (abs === this.cwdAbs) {
2024
- var error = new Error(er.code + ' invalid cwd ' + this.cwd)
2025
- error.path = this.cwd
2026
- error.code = er.code
2027
- this.emit('error', error)
2028
- this.abort()
2029
- }
2030
- break
2031
-
2032
- case 'ENOENT': // not terribly unusual
2033
- case 'ELOOP':
2034
- case 'ENAMETOOLONG':
2035
- case 'UNKNOWN':
2036
- this.cache[this._makeAbs(f)] = false
2037
- break
2038
-
2039
- default: // some unusual error. Treat as failure.
2040
- this.cache[this._makeAbs(f)] = false
2041
- if (this.strict) {
2042
- this.emit('error', er)
2043
- // If the error is handled, then we abort
2044
- // if not, we threw out of here
2045
- this.abort()
2046
- }
2047
- if (!this.silent)
2048
- console.error('glob error', er)
2049
- break
2050
- }
2051
-
2052
- return cb()
2053
- }
2054
-
2055
- Glob.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar, cb) {
2056
- var self = this
2057
- this._readdir(abs, inGlobStar, function (er, entries) {
2058
- self._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb)
2059
- })
2060
- }
2061
-
2062
-
2063
- Glob.prototype._processGlobStar2 = function (prefix, read, abs, remain, index, inGlobStar, entries, cb) {
2064
- //console.error('pgs2', prefix, remain[0], entries)
2065
-
2066
- // no entries means not a dir, so it can never have matches
2067
- // foo.txt/** doesn't match foo.txt
2068
- if (!entries)
2069
- return cb()
2070
-
2071
- // test without the globstar, and with every child both below
2072
- // and replacing the globstar.
2073
- var remainWithoutGlobStar = remain.slice(1)
2074
- var gspref = prefix ? [ prefix ] : []
2075
- var noGlobStar = gspref.concat(remainWithoutGlobStar)
2076
-
2077
- // the noGlobStar pattern exits the inGlobStar state
2078
- this._process(noGlobStar, index, false, cb)
2079
-
2080
- var isSym = this.symlinks[abs]
2081
- var len = entries.length
2082
-
2083
- // If it's a symlink, and we're in a globstar, then stop
2084
- if (isSym && inGlobStar)
2085
- return cb()
2086
-
2087
- for (var i = 0; i < len; i++) {
2088
- var e = entries[i]
2089
- if (e.charAt(0) === '.' && !this.dot)
2090
- continue
2091
-
2092
- // these two cases enter the inGlobStar state
2093
- var instead = gspref.concat(entries[i], remainWithoutGlobStar)
2094
- this._process(instead, index, true, cb)
2095
-
2096
- var below = gspref.concat(entries[i], remain)
2097
- this._process(below, index, true, cb)
2098
- }
2099
-
2100
- cb()
2101
- }
2102
-
2103
- Glob.prototype._processSimple = function (prefix, index, cb) {
2104
- // XXX review this. Shouldn't it be doing the mounting etc
2105
- // before doing stat? kinda weird?
2106
- var self = this
2107
- this._stat(prefix, function (er, exists) {
2108
- self._processSimple2(prefix, index, er, exists, cb)
2109
- })
2110
- }
2111
- Glob.prototype._processSimple2 = function (prefix, index, er, exists, cb) {
2112
-
2113
- //console.error('ps2', prefix, exists)
2114
-
2115
- if (!this.matches[index])
2116
- this.matches[index] = Object.create(null)
2117
-
2118
- // If it doesn't exist, then just mark the lack of results
2119
- if (!exists)
2120
- return cb()
2121
-
2122
- if (prefix && isAbsolute(prefix) && !this.nomount) {
2123
- var trail = /[\/\\]$/.test(prefix)
2124
- if (prefix.charAt(0) === '/') {
2125
- prefix = path.join(this.root, prefix)
2126
- } else {
2127
- prefix = path.resolve(this.root, prefix)
2128
- if (trail)
2129
- prefix += '/'
2130
- }
2131
- }
2132
-
2133
- if (process.platform === 'win32')
2134
- prefix = prefix.replace(/\\/g, '/')
2135
-
2136
- // Mark this as a match
2137
- this._emitMatch(index, prefix)
2138
- cb()
2139
- }
2140
-
2141
- // Returns either 'DIR', 'FILE', or false
2142
- Glob.prototype._stat = function (f, cb) {
2143
- var abs = this._makeAbs(f)
2144
- var needDir = f.slice(-1) === '/'
2145
-
2146
- if (f.length > this.maxLength)
2147
- return cb()
2148
-
2149
- if (!this.stat && ownProp(this.cache, abs)) {
2150
- var c = this.cache[abs]
2151
-
2152
- if (Array.isArray(c))
2153
- c = 'DIR'
2154
-
2155
- // It exists, but maybe not how we need it
2156
- if (!needDir || c === 'DIR')
2157
- return cb(null, c)
2158
-
2159
- if (needDir && c === 'FILE')
2160
- return cb()
2161
-
2162
- // otherwise we have to stat, because maybe c=true
2163
- // if we know it exists, but not what it is.
2164
- }
2165
-
2166
- var exists
2167
- var stat = this.statCache[abs]
2168
- if (stat !== undefined) {
2169
- if (stat === false)
2170
- return cb(null, stat)
2171
- else {
2172
- var type = stat.isDirectory() ? 'DIR' : 'FILE'
2173
- if (needDir && type === 'FILE')
2174
- return cb()
2175
- else
2176
- return cb(null, type, stat)
2177
- }
2178
- }
2179
-
2180
- var self = this
2181
- var statcb = inflight('stat\0' + abs, lstatcb_)
2182
- if (statcb)
2183
- self.fs.lstat(abs, statcb)
2184
-
2185
- function lstatcb_ (er, lstat) {
2186
- if (lstat && lstat.isSymbolicLink()) {
2187
- // If it's a symlink, then treat it as the target, unless
2188
- // the target does not exist, then treat it as a file.
2189
- return self.fs.stat(abs, function (er, stat) {
2190
- if (er)
2191
- self._stat2(f, abs, null, lstat, cb)
2192
- else
2193
- self._stat2(f, abs, er, stat, cb)
2194
- })
2195
- } else {
2196
- self._stat2(f, abs, er, lstat, cb)
2197
- }
2198
- }
2199
- }
2200
-
2201
- Glob.prototype._stat2 = function (f, abs, er, stat, cb) {
2202
- if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) {
2203
- this.statCache[abs] = false
2204
- return cb()
2205
- }
2206
-
2207
- var needDir = f.slice(-1) === '/'
2208
- this.statCache[abs] = stat
2209
-
2210
- if (abs.slice(-1) === '/' && stat && !stat.isDirectory())
2211
- return cb(null, false, stat)
2212
-
2213
- var c = true
2214
- if (stat)
2215
- c = stat.isDirectory() ? 'DIR' : 'FILE'
2216
- this.cache[abs] = this.cache[abs] || c
2217
-
2218
- if (needDir && c === 'FILE')
2219
- return cb()
2220
-
2221
- return cb(null, c, stat)
2222
- }
2223
-
2224
-
2225
- /***/ }),
2226
-
2227
- /***/ 4751:
2228
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
2229
-
2230
- module.exports = globSync
2231
- globSync.GlobSync = GlobSync
2232
-
2233
- var rp = __webpack_require__(7334)
2234
- var minimatch = __webpack_require__(1171)
2235
- var Minimatch = minimatch.Minimatch
2236
- var Glob = (__webpack_require__(2884).Glob)
2237
- var util = __webpack_require__(6464)
2238
- var path = __webpack_require__(1423)
2239
- var assert = __webpack_require__(9084)
2240
- var isAbsolute = __webpack_require__(4095)
2241
- var common = __webpack_require__(6772)
2242
- var setopts = common.setopts
2243
- var ownProp = common.ownProp
2244
- var childrenIgnored = common.childrenIgnored
2245
- var isIgnored = common.isIgnored
2246
-
2247
- function globSync (pattern, options) {
2248
- if (typeof options === 'function' || arguments.length === 3)
2249
- throw new TypeError('callback provided to sync glob\n'+
2250
- 'See: https://github.com/isaacs/node-glob/issues/167')
2251
-
2252
- return new GlobSync(pattern, options).found
2253
- }
2254
-
2255
- function GlobSync (pattern, options) {
2256
- if (!pattern)
2257
- throw new Error('must provide pattern')
2258
-
2259
- if (typeof options === 'function' || arguments.length === 3)
2260
- throw new TypeError('callback provided to sync glob\n'+
2261
- 'See: https://github.com/isaacs/node-glob/issues/167')
2262
-
2263
- if (!(this instanceof GlobSync))
2264
- return new GlobSync(pattern, options)
2265
-
2266
- setopts(this, pattern, options)
2267
-
2268
- if (this.noprocess)
2269
- return this
2270
-
2271
- var n = this.minimatch.set.length
2272
- this.matches = new Array(n)
2273
- for (var i = 0; i < n; i ++) {
2274
- this._process(this.minimatch.set[i], i, false)
2275
- }
2276
- this._finish()
2277
- }
2278
-
2279
- GlobSync.prototype._finish = function () {
2280
- assert(this instanceof GlobSync)
2281
- if (this.realpath) {
2282
- var self = this
2283
- this.matches.forEach(function (matchset, index) {
2284
- var set = self.matches[index] = Object.create(null)
2285
- for (var p in matchset) {
2286
- try {
2287
- p = self._makeAbs(p)
2288
- var real = rp.realpathSync(p, self.realpathCache)
2289
- set[real] = true
2290
- } catch (er) {
2291
- if (er.syscall === 'stat')
2292
- set[self._makeAbs(p)] = true
2293
- else
2294
- throw er
2295
- }
2296
- }
2297
- })
2298
- }
2299
- common.finish(this)
2300
- }
2301
-
2302
-
2303
- GlobSync.prototype._process = function (pattern, index, inGlobStar) {
2304
- assert(this instanceof GlobSync)
2305
-
2306
- // Get the first [n] parts of pattern that are all strings.
2307
- var n = 0
2308
- while (typeof pattern[n] === 'string') {
2309
- n ++
2310
- }
2311
- // now n is the index of the first one that is *not* a string.
2312
-
2313
- // See if there's anything else
2314
- var prefix
2315
- switch (n) {
2316
- // if not, then this is rather simple
2317
- case pattern.length:
2318
- this._processSimple(pattern.join('/'), index)
2319
- return
2320
-
2321
- case 0:
2322
- // pattern *starts* with some non-trivial item.
2323
- // going to readdir(cwd), but not include the prefix in matches.
2324
- prefix = null
2325
- break
2326
-
2327
- default:
2328
- // pattern has some string bits in the front.
2329
- // whatever it starts with, whether that's 'absolute' like /foo/bar,
2330
- // or 'relative' like '../baz'
2331
- prefix = pattern.slice(0, n).join('/')
2332
- break
2333
- }
2334
-
2335
- var remain = pattern.slice(n)
2336
-
2337
- // get the list of entries.
2338
- var read
2339
- if (prefix === null)
2340
- read = '.'
2341
- else if (isAbsolute(prefix) || isAbsolute(pattern.join('/'))) {
2342
- if (!prefix || !isAbsolute(prefix))
2343
- prefix = '/' + prefix
2344
- read = prefix
2345
- } else
2346
- read = prefix
2347
-
2348
- var abs = this._makeAbs(read)
2349
-
2350
- //if ignored, skip processing
2351
- if (childrenIgnored(this, read))
2352
- return
2353
-
2354
- var isGlobStar = remain[0] === minimatch.GLOBSTAR
2355
- if (isGlobStar)
2356
- this._processGlobStar(prefix, read, abs, remain, index, inGlobStar)
2357
- else
2358
- this._processReaddir(prefix, read, abs, remain, index, inGlobStar)
2359
- }
2360
-
2361
-
2362
- GlobSync.prototype._processReaddir = function (prefix, read, abs, remain, index, inGlobStar) {
2363
- var entries = this._readdir(abs, inGlobStar)
2364
-
2365
- // if the abs isn't a dir, then nothing can match!
2366
- if (!entries)
2367
- return
2368
-
2369
- // It will only match dot entries if it starts with a dot, or if
2370
- // dot is set. Stuff like @(.foo|.bar) isn't allowed.
2371
- var pn = remain[0]
2372
- var negate = !!this.minimatch.negate
2373
- var rawGlob = pn._glob
2374
- var dotOk = this.dot || rawGlob.charAt(0) === '.'
2375
-
2376
- var matchedEntries = []
2377
- for (var i = 0; i < entries.length; i++) {
2378
- var e = entries[i]
2379
- if (e.charAt(0) !== '.' || dotOk) {
2380
- var m
2381
- if (negate && !prefix) {
2382
- m = !e.match(pn)
2383
- } else {
2384
- m = e.match(pn)
2385
- }
2386
- if (m)
2387
- matchedEntries.push(e)
2388
- }
2389
- }
2390
-
2391
- var len = matchedEntries.length
2392
- // If there are no matched entries, then nothing matches.
2393
- if (len === 0)
2394
- return
2395
-
2396
- // if this is the last remaining pattern bit, then no need for
2397
- // an additional stat *unless* the user has specified mark or
2398
- // stat explicitly. We know they exist, since readdir returned
2399
- // them.
2400
-
2401
- if (remain.length === 1 && !this.mark && !this.stat) {
2402
- if (!this.matches[index])
2403
- this.matches[index] = Object.create(null)
2404
-
2405
- for (var i = 0; i < len; i ++) {
2406
- var e = matchedEntries[i]
2407
- if (prefix) {
2408
- if (prefix.slice(-1) !== '/')
2409
- e = prefix + '/' + e
2410
- else
2411
- e = prefix + e
2412
- }
2413
-
2414
- if (e.charAt(0) === '/' && !this.nomount) {
2415
- e = path.join(this.root, e)
2416
- }
2417
- this._emitMatch(index, e)
2418
- }
2419
- // This was the last one, and no stats were needed
2420
- return
2421
- }
2422
-
2423
- // now test all matched entries as stand-ins for that part
2424
- // of the pattern.
2425
- remain.shift()
2426
- for (var i = 0; i < len; i ++) {
2427
- var e = matchedEntries[i]
2428
- var newPattern
2429
- if (prefix)
2430
- newPattern = [prefix, e]
2431
- else
2432
- newPattern = [e]
2433
- this._process(newPattern.concat(remain), index, inGlobStar)
2434
- }
2435
- }
2436
-
2437
-
2438
- GlobSync.prototype._emitMatch = function (index, e) {
2439
- if (isIgnored(this, e))
2440
- return
2441
-
2442
- var abs = this._makeAbs(e)
2443
-
2444
- if (this.mark)
2445
- e = this._mark(e)
2446
-
2447
- if (this.absolute) {
2448
- e = abs
2449
- }
2450
-
2451
- if (this.matches[index][e])
2452
- return
2453
-
2454
- if (this.nodir) {
2455
- var c = this.cache[abs]
2456
- if (c === 'DIR' || Array.isArray(c))
2457
- return
2458
- }
2459
-
2460
- this.matches[index][e] = true
2461
-
2462
- if (this.stat)
2463
- this._stat(e)
2464
- }
2465
-
2466
-
2467
- GlobSync.prototype._readdirInGlobStar = function (abs) {
2468
- // follow all symlinked directories forever
2469
- // just proceed as if this is a non-globstar situation
2470
- if (this.follow)
2471
- return this._readdir(abs, false)
2472
-
2473
- var entries
2474
- var lstat
2475
- var stat
2476
- try {
2477
- lstat = this.fs.lstatSync(abs)
2478
- } catch (er) {
2479
- if (er.code === 'ENOENT') {
2480
- // lstat failed, doesn't exist
2481
- return null
2482
- }
2483
- }
2484
-
2485
- var isSym = lstat && lstat.isSymbolicLink()
2486
- this.symlinks[abs] = isSym
2487
-
2488
- // If it's not a symlink or a dir, then it's definitely a regular file.
2489
- // don't bother doing a readdir in that case.
2490
- if (!isSym && lstat && !lstat.isDirectory())
2491
- this.cache[abs] = 'FILE'
2492
- else
2493
- entries = this._readdir(abs, false)
2494
-
2495
- return entries
2496
- }
2497
-
2498
- GlobSync.prototype._readdir = function (abs, inGlobStar) {
2499
- var entries
2500
-
2501
- if (inGlobStar && !ownProp(this.symlinks, abs))
2502
- return this._readdirInGlobStar(abs)
2503
-
2504
- if (ownProp(this.cache, abs)) {
2505
- var c = this.cache[abs]
2506
- if (!c || c === 'FILE')
2507
- return null
2508
-
2509
- if (Array.isArray(c))
2510
- return c
2511
- }
2512
-
2513
- try {
2514
- return this._readdirEntries(abs, this.fs.readdirSync(abs))
2515
- } catch (er) {
2516
- this._readdirError(abs, er)
2517
- return null
2518
- }
2519
- }
2520
-
2521
- GlobSync.prototype._readdirEntries = function (abs, entries) {
2522
- // if we haven't asked to stat everything, then just
2523
- // assume that everything in there exists, so we can avoid
2524
- // having to stat it a second time.
2525
- if (!this.mark && !this.stat) {
2526
- for (var i = 0; i < entries.length; i ++) {
2527
- var e = entries[i]
2528
- if (abs === '/')
2529
- e = abs + e
2530
- else
2531
- e = abs + '/' + e
2532
- this.cache[e] = true
2533
- }
2534
- }
2535
-
2536
- this.cache[abs] = entries
2537
-
2538
- // mark and cache dir-ness
2539
- return entries
2540
- }
2541
-
2542
- GlobSync.prototype._readdirError = function (f, er) {
2543
- // handle errors, and cache the information
2544
- switch (er.code) {
2545
- case 'ENOTSUP': // https://github.com/isaacs/node-glob/issues/205
2546
- case 'ENOTDIR': // totally normal. means it *does* exist.
2547
- var abs = this._makeAbs(f)
2548
- this.cache[abs] = 'FILE'
2549
- if (abs === this.cwdAbs) {
2550
- var error = new Error(er.code + ' invalid cwd ' + this.cwd)
2551
- error.path = this.cwd
2552
- error.code = er.code
2553
- throw error
2554
- }
2555
- break
2556
-
2557
- case 'ENOENT': // not terribly unusual
2558
- case 'ELOOP':
2559
- case 'ENAMETOOLONG':
2560
- case 'UNKNOWN':
2561
- this.cache[this._makeAbs(f)] = false
2562
- break
2563
-
2564
- default: // some unusual error. Treat as failure.
2565
- this.cache[this._makeAbs(f)] = false
2566
- if (this.strict)
2567
- throw er
2568
- if (!this.silent)
2569
- console.error('glob error', er)
2570
- break
2571
- }
2572
- }
2573
-
2574
- GlobSync.prototype._processGlobStar = function (prefix, read, abs, remain, index, inGlobStar) {
2575
-
2576
- var entries = this._readdir(abs, inGlobStar)
2577
-
2578
- // no entries means not a dir, so it can never have matches
2579
- // foo.txt/** doesn't match foo.txt
2580
- if (!entries)
2581
- return
2582
-
2583
- // test without the globstar, and with every child both below
2584
- // and replacing the globstar.
2585
- var remainWithoutGlobStar = remain.slice(1)
2586
- var gspref = prefix ? [ prefix ] : []
2587
- var noGlobStar = gspref.concat(remainWithoutGlobStar)
2588
-
2589
- // the noGlobStar pattern exits the inGlobStar state
2590
- this._process(noGlobStar, index, false)
2591
-
2592
- var len = entries.length
2593
- var isSym = this.symlinks[abs]
2594
-
2595
- // If it's a symlink, and we're in a globstar, then stop
2596
- if (isSym && inGlobStar)
2597
- return
2598
-
2599
- for (var i = 0; i < len; i++) {
2600
- var e = entries[i]
2601
- if (e.charAt(0) === '.' && !this.dot)
2602
- continue
2603
-
2604
- // these two cases enter the inGlobStar state
2605
- var instead = gspref.concat(entries[i], remainWithoutGlobStar)
2606
- this._process(instead, index, true)
2607
-
2608
- var below = gspref.concat(entries[i], remain)
2609
- this._process(below, index, true)
2610
- }
2611
- }
2612
-
2613
- GlobSync.prototype._processSimple = function (prefix, index) {
2614
- // XXX review this. Shouldn't it be doing the mounting etc
2615
- // before doing stat? kinda weird?
2616
- var exists = this._stat(prefix)
2617
-
2618
- if (!this.matches[index])
2619
- this.matches[index] = Object.create(null)
2620
-
2621
- // If it doesn't exist, then just mark the lack of results
2622
- if (!exists)
2623
- return
2624
-
2625
- if (prefix && isAbsolute(prefix) && !this.nomount) {
2626
- var trail = /[\/\\]$/.test(prefix)
2627
- if (prefix.charAt(0) === '/') {
2628
- prefix = path.join(this.root, prefix)
2629
- } else {
2630
- prefix = path.resolve(this.root, prefix)
2631
- if (trail)
2632
- prefix += '/'
2633
- }
2634
- }
2635
-
2636
- if (process.platform === 'win32')
2637
- prefix = prefix.replace(/\\/g, '/')
2638
-
2639
- // Mark this as a match
2640
- this._emitMatch(index, prefix)
2641
- }
2642
-
2643
- // Returns either 'DIR', 'FILE', or false
2644
- GlobSync.prototype._stat = function (f) {
2645
- var abs = this._makeAbs(f)
2646
- var needDir = f.slice(-1) === '/'
2647
-
2648
- if (f.length > this.maxLength)
2649
- return false
2650
-
2651
- if (!this.stat && ownProp(this.cache, abs)) {
2652
- var c = this.cache[abs]
2653
-
2654
- if (Array.isArray(c))
2655
- c = 'DIR'
2656
-
2657
- // It exists, but maybe not how we need it
2658
- if (!needDir || c === 'DIR')
2659
- return c
2660
-
2661
- if (needDir && c === 'FILE')
2662
- return false
2663
-
2664
- // otherwise we have to stat, because maybe c=true
2665
- // if we know it exists, but not what it is.
2666
- }
2667
-
2668
- var exists
2669
- var stat = this.statCache[abs]
2670
- if (!stat) {
2671
- var lstat
2672
- try {
2673
- lstat = this.fs.lstatSync(abs)
2674
- } catch (er) {
2675
- if (er && (er.code === 'ENOENT' || er.code === 'ENOTDIR')) {
2676
- this.statCache[abs] = false
2677
- return false
2678
- }
2679
- }
2680
-
2681
- if (lstat && lstat.isSymbolicLink()) {
2682
- try {
2683
- stat = this.fs.statSync(abs)
2684
- } catch (er) {
2685
- stat = lstat
2686
- }
2687
- } else {
2688
- stat = lstat
2689
- }
2690
- }
2691
-
2692
- this.statCache[abs] = stat
2693
-
2694
- var c = true
2695
- if (stat)
2696
- c = stat.isDirectory() ? 'DIR' : 'FILE'
2697
-
2698
- this.cache[abs] = this.cache[abs] || c
2699
-
2700
- if (needDir && c === 'FILE')
2701
- return false
2702
-
2703
- return c
2704
- }
2705
-
2706
- GlobSync.prototype._mark = function (p) {
2707
- return common.mark(this, p)
2708
- }
2709
-
2710
- GlobSync.prototype._makeAbs = function (f) {
2711
- return common.makeAbs(this, f)
2712
- }
2713
-
2714
-
2715
- /***/ }),
2716
-
2717
- /***/ 7844:
2718
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
2719
-
2720
- var wrappy = __webpack_require__(2479)
2721
- var reqs = Object.create(null)
2722
- var once = __webpack_require__(778)
2723
-
2724
- module.exports = wrappy(inflight)
2725
-
2726
- function inflight (key, cb) {
2727
- if (reqs[key]) {
2728
- reqs[key].push(cb)
2729
- return null
2730
- } else {
2731
- reqs[key] = [cb]
2732
- return makeres(key)
2733
- }
2734
- }
2735
-
2736
- function makeres (key) {
2737
- return once(function RES () {
2738
- var cbs = reqs[key]
2739
- var len = cbs.length
2740
- var args = slice(arguments)
2741
-
2742
- // XXX It's somewhat ambiguous whether a new callback added in this
2743
- // pass should be queued for later execution if something in the
2744
- // list of callbacks throws, or if it should just be discarded.
2745
- // However, it's such an edge case that it hardly matters, and either
2746
- // choice is likely as surprising as the other.
2747
- // As it happens, we do go ahead and schedule it for later execution.
2748
- try {
2749
- for (var i = 0; i < len; i++) {
2750
- cbs[i].apply(null, args)
2751
- }
2752
- } finally {
2753
- if (cbs.length > len) {
2754
- // added more in the interim.
2755
- // de-zalgo, just in case, but don't call again.
2756
- cbs.splice(0, len)
2757
- process.nextTick(function () {
2758
- RES.apply(null, args)
2759
- })
2760
- } else {
2761
- delete reqs[key]
2762
- }
2763
- }
2764
- })
2765
- }
2766
-
2767
- function slice (args) {
2768
- var length = args.length
2769
- var array = []
2770
-
2771
- for (var i = 0; i < length; i++) array[i] = args[i]
2772
- return array
2773
- }
2774
-
2775
-
2776
- /***/ }),
2777
-
2778
- /***/ 5717:
2779
- /***/ ((module) => {
2780
-
2781
- if (typeof Object.create === 'function') {
2782
- // implementation from standard node.js 'util' module
2783
- module.exports = function inherits(ctor, superCtor) {
2784
- if (superCtor) {
2785
- ctor.super_ = superCtor
2786
- ctor.prototype = Object.create(superCtor.prototype, {
2787
- constructor: {
2788
- value: ctor,
2789
- enumerable: false,
2790
- writable: true,
2791
- configurable: true
2792
- }
2793
- })
2794
- }
2795
- };
2796
- } else {
2797
- // old school shim for old browsers
2798
- module.exports = function inherits(ctor, superCtor) {
2799
- if (superCtor) {
2800
- ctor.super_ = superCtor
2801
- var TempCtor = function () {}
2802
- TempCtor.prototype = superCtor.prototype
2803
- ctor.prototype = new TempCtor()
2804
- ctor.prototype.constructor = ctor
2805
- }
2806
- }
2807
- }
2808
-
2809
-
2810
- /***/ }),
2811
-
2812
- /***/ 1171:
2813
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
2814
-
2815
- module.exports = minimatch
2816
- minimatch.Minimatch = Minimatch
2817
-
2818
- var path = (function () { try { return __webpack_require__(1423) } catch (e) {}}()) || {
2819
- sep: '/'
2820
- }
2821
- minimatch.sep = path.sep
2822
-
2823
- var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {}
2824
- var expand = __webpack_require__(3644)
2825
-
2826
- var plTypes = {
2827
- '!': { open: '(?:(?!(?:', close: '))[^/]*?)'},
2828
- '?': { open: '(?:', close: ')?' },
2829
- '+': { open: '(?:', close: ')+' },
2830
- '*': { open: '(?:', close: ')*' },
2831
- '@': { open: '(?:', close: ')' }
2832
- }
2833
-
2834
- // any single thing other than /
2835
- // don't need to escape / when using new RegExp()
2836
- var qmark = '[^/]'
2837
-
2838
- // * => any number of characters
2839
- var star = qmark + '*?'
2840
-
2841
- // ** when dots are allowed. Anything goes, except .. and .
2842
- // not (^ or / followed by one or two dots followed by $ or /),
2843
- // followed by anything, any number of times.
2844
- var twoStarDot = '(?:(?!(?:\\\/|^)(?:\\.{1,2})($|\\\/)).)*?'
2845
-
2846
- // not a ^ or / followed by a dot,
2847
- // followed by anything, any number of times.
2848
- var twoStarNoDot = '(?:(?!(?:\\\/|^)\\.).)*?'
2849
-
2850
- // characters that need to be escaped in RegExp.
2851
- var reSpecials = charSet('().*{}+?[]^$\\!')
2852
-
2853
- // "abc" -> { a:true, b:true, c:true }
2854
- function charSet (s) {
2855
- return s.split('').reduce(function (set, c) {
2856
- set[c] = true
2857
- return set
2858
- }, {})
2859
- }
2860
-
2861
- // normalizes slashes.
2862
- var slashSplit = /\/+/
2863
-
2864
- minimatch.filter = filter
2865
- function filter (pattern, options) {
2866
- options = options || {}
2867
- return function (p, i, list) {
2868
- return minimatch(p, pattern, options)
2869
- }
2870
- }
2871
-
2872
- function ext (a, b) {
2873
- b = b || {}
2874
- var t = {}
2875
- Object.keys(a).forEach(function (k) {
2876
- t[k] = a[k]
2877
- })
2878
- Object.keys(b).forEach(function (k) {
2879
- t[k] = b[k]
2880
- })
2881
- return t
2882
- }
2883
-
2884
- minimatch.defaults = function (def) {
2885
- if (!def || typeof def !== 'object' || !Object.keys(def).length) {
2886
- return minimatch
2887
- }
2888
-
2889
- var orig = minimatch
2890
-
2891
- var m = function minimatch (p, pattern, options) {
2892
- return orig(p, pattern, ext(def, options))
2893
- }
2894
-
2895
- m.Minimatch = function Minimatch (pattern, options) {
2896
- return new orig.Minimatch(pattern, ext(def, options))
2897
- }
2898
- m.Minimatch.defaults = function defaults (options) {
2899
- return orig.defaults(ext(def, options)).Minimatch
2900
- }
2901
-
2902
- m.filter = function filter (pattern, options) {
2903
- return orig.filter(pattern, ext(def, options))
2904
- }
2905
-
2906
- m.defaults = function defaults (options) {
2907
- return orig.defaults(ext(def, options))
2908
- }
2909
-
2910
- m.makeRe = function makeRe (pattern, options) {
2911
- return orig.makeRe(pattern, ext(def, options))
2912
- }
2913
-
2914
- m.braceExpand = function braceExpand (pattern, options) {
2915
- return orig.braceExpand(pattern, ext(def, options))
2916
- }
2917
-
2918
- m.match = function (list, pattern, options) {
2919
- return orig.match(list, pattern, ext(def, options))
2920
- }
2921
-
2922
- return m
2923
- }
2924
-
2925
- Minimatch.defaults = function (def) {
2926
- return minimatch.defaults(def).Minimatch
2927
- }
2928
-
2929
- function minimatch (p, pattern, options) {
2930
- assertValidPattern(pattern)
2931
-
2932
- if (!options) options = {}
2933
-
2934
- // shortcut: comments match nothing.
2935
- if (!options.nocomment && pattern.charAt(0) === '#') {
2936
- return false
2937
- }
2938
-
2939
- return new Minimatch(pattern, options).match(p)
2940
- }
2941
-
2942
- function Minimatch (pattern, options) {
2943
- if (!(this instanceof Minimatch)) {
2944
- return new Minimatch(pattern, options)
2945
- }
2946
-
2947
- assertValidPattern(pattern)
2948
-
2949
- if (!options) options = {}
2950
-
2951
- pattern = pattern.trim()
2952
-
2953
- // windows support: need to use /, not \
2954
- if (!options.allowWindowsEscape && path.sep !== '/') {
2955
- pattern = pattern.split(path.sep).join('/')
2956
- }
2957
-
2958
- this.options = options
2959
- this.set = []
2960
- this.pattern = pattern
2961
- this.regexp = null
2962
- this.negate = false
2963
- this.comment = false
2964
- this.empty = false
2965
- this.partial = !!options.partial
2966
-
2967
- // make the set of regexps etc.
2968
- this.make()
2969
- }
2970
-
2971
- Minimatch.prototype.debug = function () {}
2972
-
2973
- Minimatch.prototype.make = make
2974
- function make () {
2975
- var pattern = this.pattern
2976
- var options = this.options
2977
-
2978
- // empty patterns and comments match nothing.
2979
- if (!options.nocomment && pattern.charAt(0) === '#') {
2980
- this.comment = true
2981
- return
2982
- }
2983
- if (!pattern) {
2984
- this.empty = true
2985
- return
2986
- }
2987
-
2988
- // step 1: figure out negation, etc.
2989
- this.parseNegate()
2990
-
2991
- // step 2: expand braces
2992
- var set = this.globSet = this.braceExpand()
2993
-
2994
- if (options.debug) this.debug = function debug() { console.error.apply(console, arguments) }
2995
-
2996
- this.debug(this.pattern, set)
2997
-
2998
- // step 3: now we have a set, so turn each one into a series of path-portion
2999
- // matching patterns.
3000
- // These will be regexps, except in the case of "**", which is
3001
- // set to the GLOBSTAR object for globstar behavior,
3002
- // and will not contain any / characters
3003
- set = this.globParts = set.map(function (s) {
3004
- return s.split(slashSplit)
3005
- })
3006
-
3007
- this.debug(this.pattern, set)
3008
-
3009
- // glob --> regexps
3010
- set = set.map(function (s, si, set) {
3011
- return s.map(this.parse, this)
3012
- }, this)
3013
-
3014
- this.debug(this.pattern, set)
3015
-
3016
- // filter out everything that didn't compile properly.
3017
- set = set.filter(function (s) {
3018
- return s.indexOf(false) === -1
3019
- })
3020
-
3021
- this.debug(this.pattern, set)
3022
-
3023
- this.set = set
3024
- }
3025
-
3026
- Minimatch.prototype.parseNegate = parseNegate
3027
- function parseNegate () {
3028
- var pattern = this.pattern
3029
- var negate = false
3030
- var options = this.options
3031
- var negateOffset = 0
3032
-
3033
- if (options.nonegate) return
3034
-
3035
- for (var i = 0, l = pattern.length
3036
- ; i < l && pattern.charAt(i) === '!'
3037
- ; i++) {
3038
- negate = !negate
3039
- negateOffset++
3040
- }
3041
-
3042
- if (negateOffset) this.pattern = pattern.substr(negateOffset)
3043
- this.negate = negate
3044
- }
3045
-
3046
- // Brace expansion:
3047
- // a{b,c}d -> abd acd
3048
- // a{b,}c -> abc ac
3049
- // a{0..3}d -> a0d a1d a2d a3d
3050
- // a{b,c{d,e}f}g -> abg acdfg acefg
3051
- // a{b,c}d{e,f}g -> abdeg acdeg abdeg abdfg
3052
- //
3053
- // Invalid sets are not expanded.
3054
- // a{2..}b -> a{2..}b
3055
- // a{b}c -> a{b}c
3056
- minimatch.braceExpand = function (pattern, options) {
3057
- return braceExpand(pattern, options)
3058
- }
3059
-
3060
- Minimatch.prototype.braceExpand = braceExpand
3061
-
3062
- function braceExpand (pattern, options) {
3063
- if (!options) {
3064
- if (this instanceof Minimatch) {
3065
- options = this.options
3066
- } else {
3067
- options = {}
3068
- }
3069
- }
3070
-
3071
- pattern = typeof pattern === 'undefined'
3072
- ? this.pattern : pattern
3073
-
3074
- assertValidPattern(pattern)
3075
-
3076
- // Thanks to Yeting Li <https://github.com/yetingli> for
3077
- // improving this regexp to avoid a ReDOS vulnerability.
3078
- if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) {
3079
- // shortcut. no need to expand.
3080
- return [pattern]
3081
- }
3082
-
3083
- return expand(pattern)
3084
- }
3085
-
3086
- var MAX_PATTERN_LENGTH = 1024 * 64
3087
- var assertValidPattern = function (pattern) {
3088
- if (typeof pattern !== 'string') {
3089
- throw new TypeError('invalid pattern')
3090
- }
3091
-
3092
- if (pattern.length > MAX_PATTERN_LENGTH) {
3093
- throw new TypeError('pattern is too long')
3094
- }
3095
- }
3096
-
3097
- // parse a component of the expanded set.
3098
- // At this point, no pattern may contain "/" in it
3099
- // so we're going to return a 2d array, where each entry is the full
3100
- // pattern, split on '/', and then turned into a regular expression.
3101
- // A regexp is made at the end which joins each array with an
3102
- // escaped /, and another full one which joins each regexp with |.
3103
- //
3104
- // Following the lead of Bash 4.1, note that "**" only has special meaning
3105
- // when it is the *only* thing in a path portion. Otherwise, any series
3106
- // of * is equivalent to a single *. Globstar behavior is enabled by
3107
- // default, and can be disabled by setting options.noglobstar.
3108
- Minimatch.prototype.parse = parse
3109
- var SUBPARSE = {}
3110
- function parse (pattern, isSub) {
3111
- assertValidPattern(pattern)
3112
-
3113
- var options = this.options
3114
-
3115
- // shortcuts
3116
- if (pattern === '**') {
3117
- if (!options.noglobstar)
3118
- return GLOBSTAR
3119
- else
3120
- pattern = '*'
3121
- }
3122
- if (pattern === '') return ''
3123
-
3124
- var re = ''
3125
- var hasMagic = !!options.nocase
3126
- var escaping = false
3127
- // ? => one single character
3128
- var patternListStack = []
3129
- var negativeLists = []
3130
- var stateChar
3131
- var inClass = false
3132
- var reClassStart = -1
3133
- var classStart = -1
3134
- // . and .. never match anything that doesn't start with .,
3135
- // even when options.dot is set.
3136
- var patternStart = pattern.charAt(0) === '.' ? '' // anything
3137
- // not (start or / followed by . or .. followed by / or end)
3138
- : options.dot ? '(?!(?:^|\\\/)\\.{1,2}(?:$|\\\/))'
3139
- : '(?!\\.)'
3140
- var self = this
3141
-
3142
- function clearStateChar () {
3143
- if (stateChar) {
3144
- // we had some state-tracking character
3145
- // that wasn't consumed by this pass.
3146
- switch (stateChar) {
3147
- case '*':
3148
- re += star
3149
- hasMagic = true
3150
- break
3151
- case '?':
3152
- re += qmark
3153
- hasMagic = true
3154
- break
3155
- default:
3156
- re += '\\' + stateChar
3157
- break
3158
- }
3159
- self.debug('clearStateChar %j %j', stateChar, re)
3160
- stateChar = false
3161
- }
3162
- }
3163
-
3164
- for (var i = 0, len = pattern.length, c
3165
- ; (i < len) && (c = pattern.charAt(i))
3166
- ; i++) {
3167
- this.debug('%s\t%s %s %j', pattern, i, re, c)
3168
-
3169
- // skip over any that are escaped.
3170
- if (escaping && reSpecials[c]) {
3171
- re += '\\' + c
3172
- escaping = false
3173
- continue
3174
- }
3175
-
3176
- switch (c) {
3177
- /* istanbul ignore next */
3178
- case '/': {
3179
- // completely not allowed, even escaped.
3180
- // Should already be path-split by now.
3181
- return false
3182
- }
3183
-
3184
- case '\\':
3185
- clearStateChar()
3186
- escaping = true
3187
- continue
3188
-
3189
- // the various stateChar values
3190
- // for the "extglob" stuff.
3191
- case '?':
3192
- case '*':
3193
- case '+':
3194
- case '@':
3195
- case '!':
3196
- this.debug('%s\t%s %s %j <-- stateChar', pattern, i, re, c)
3197
-
3198
- // all of those are literals inside a class, except that
3199
- // the glob [!a] means [^a] in regexp
3200
- if (inClass) {
3201
- this.debug(' in class')
3202
- if (c === '!' && i === classStart + 1) c = '^'
3203
- re += c
3204
- continue
3205
- }
3206
-
3207
- // if we already have a stateChar, then it means
3208
- // that there was something like ** or +? in there.
3209
- // Handle the stateChar, then proceed with this one.
3210
- self.debug('call clearStateChar %j', stateChar)
3211
- clearStateChar()
3212
- stateChar = c
3213
- // if extglob is disabled, then +(asdf|foo) isn't a thing.
3214
- // just clear the statechar *now*, rather than even diving into
3215
- // the patternList stuff.
3216
- if (options.noext) clearStateChar()
3217
- continue
3218
-
3219
- case '(':
3220
- if (inClass) {
3221
- re += '('
3222
- continue
3223
- }
3224
-
3225
- if (!stateChar) {
3226
- re += '\\('
3227
- continue
3228
- }
3229
-
3230
- patternListStack.push({
3231
- type: stateChar,
3232
- start: i - 1,
3233
- reStart: re.length,
3234
- open: plTypes[stateChar].open,
3235
- close: plTypes[stateChar].close
3236
- })
3237
- // negation is (?:(?!js)[^/]*)
3238
- re += stateChar === '!' ? '(?:(?!(?:' : '(?:'
3239
- this.debug('plType %j %j', stateChar, re)
3240
- stateChar = false
3241
- continue
3242
-
3243
- case ')':
3244
- if (inClass || !patternListStack.length) {
3245
- re += '\\)'
3246
- continue
3247
- }
3248
-
3249
- clearStateChar()
3250
- hasMagic = true
3251
- var pl = patternListStack.pop()
3252
- // negation is (?:(?!js)[^/]*)
3253
- // The others are (?:<pattern>)<type>
3254
- re += pl.close
3255
- if (pl.type === '!') {
3256
- negativeLists.push(pl)
3257
- }
3258
- pl.reEnd = re.length
3259
- continue
3260
-
3261
- case '|':
3262
- if (inClass || !patternListStack.length || escaping) {
3263
- re += '\\|'
3264
- escaping = false
3265
- continue
3266
- }
3267
-
3268
- clearStateChar()
3269
- re += '|'
3270
- continue
3271
-
3272
- // these are mostly the same in regexp and glob
3273
- case '[':
3274
- // swallow any state-tracking char before the [
3275
- clearStateChar()
3276
-
3277
- if (inClass) {
3278
- re += '\\' + c
3279
- continue
3280
- }
3281
-
3282
- inClass = true
3283
- classStart = i
3284
- reClassStart = re.length
3285
- re += c
3286
- continue
3287
-
3288
- case ']':
3289
- // a right bracket shall lose its special
3290
- // meaning and represent itself in
3291
- // a bracket expression if it occurs
3292
- // first in the list. -- POSIX.2 2.8.3.2
3293
- if (i === classStart + 1 || !inClass) {
3294
- re += '\\' + c
3295
- escaping = false
3296
- continue
3297
- }
3298
-
3299
- // handle the case where we left a class open.
3300
- // "[z-a]" is valid, equivalent to "\[z-a\]"
3301
- // split where the last [ was, make sure we don't have
3302
- // an invalid re. if so, re-walk the contents of the
3303
- // would-be class to re-translate any characters that
3304
- // were passed through as-is
3305
- // TODO: It would probably be faster to determine this
3306
- // without a try/catch and a new RegExp, but it's tricky
3307
- // to do safely. For now, this is safe and works.
3308
- var cs = pattern.substring(classStart + 1, i)
3309
- try {
3310
- RegExp('[' + cs + ']')
3311
- } catch (er) {
3312
- // not a valid class!
3313
- var sp = this.parse(cs, SUBPARSE)
3314
- re = re.substr(0, reClassStart) + '\\[' + sp[0] + '\\]'
3315
- hasMagic = hasMagic || sp[1]
3316
- inClass = false
3317
- continue
3318
- }
3319
-
3320
- // finish up the class.
3321
- hasMagic = true
3322
- inClass = false
3323
- re += c
3324
- continue
3325
-
3326
- default:
3327
- // swallow any state char that wasn't consumed
3328
- clearStateChar()
3329
-
3330
- if (escaping) {
3331
- // no need
3332
- escaping = false
3333
- } else if (reSpecials[c]
3334
- && !(c === '^' && inClass)) {
3335
- re += '\\'
3336
- }
3337
-
3338
- re += c
3339
-
3340
- } // switch
3341
- } // for
3342
-
3343
- // handle the case where we left a class open.
3344
- // "[abc" is valid, equivalent to "\[abc"
3345
- if (inClass) {
3346
- // split where the last [ was, and escape it
3347
- // this is a huge pita. We now have to re-walk
3348
- // the contents of the would-be class to re-translate
3349
- // any characters that were passed through as-is
3350
- cs = pattern.substr(classStart + 1)
3351
- sp = this.parse(cs, SUBPARSE)
3352
- re = re.substr(0, reClassStart) + '\\[' + sp[0]
3353
- hasMagic = hasMagic || sp[1]
3354
- }
3355
-
3356
- // handle the case where we had a +( thing at the *end*
3357
- // of the pattern.
3358
- // each pattern list stack adds 3 chars, and we need to go through
3359
- // and escape any | chars that were passed through as-is for the regexp.
3360
- // Go through and escape them, taking care not to double-escape any
3361
- // | chars that were already escaped.
3362
- for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
3363
- var tail = re.slice(pl.reStart + pl.open.length)
3364
- this.debug('setting tail', re, pl)
3365
- // maybe some even number of \, then maybe 1 \, followed by a |
3366
- tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function (_, $1, $2) {
3367
- if (!$2) {
3368
- // the | isn't already escaped, so escape it.
3369
- $2 = '\\'
3370
- }
3371
-
3372
- // need to escape all those slashes *again*, without escaping the
3373
- // one that we need for escaping the | character. As it works out,
3374
- // escaping an even number of slashes can be done by simply repeating
3375
- // it exactly after itself. That's why this trick works.
3376
- //
3377
- // I am sorry that you have to see this.
3378
- return $1 + $1 + $2 + '|'
3379
- })
3380
-
3381
- this.debug('tail=%j\n %s', tail, tail, pl, re)
3382
- var t = pl.type === '*' ? star
3383
- : pl.type === '?' ? qmark
3384
- : '\\' + pl.type
3385
-
3386
- hasMagic = true
3387
- re = re.slice(0, pl.reStart) + t + '\\(' + tail
3388
- }
3389
-
3390
- // handle trailing things that only matter at the very end.
3391
- clearStateChar()
3392
- if (escaping) {
3393
- // trailing \\
3394
- re += '\\\\'
3395
- }
3396
-
3397
- // only need to apply the nodot start if the re starts with
3398
- // something that could conceivably capture a dot
3399
- var addPatternStart = false
3400
- switch (re.charAt(0)) {
3401
- case '[': case '.': case '(': addPatternStart = true
3402
- }
3403
-
3404
- // Hack to work around lack of negative lookbehind in JS
3405
- // A pattern like: *.!(x).!(y|z) needs to ensure that a name
3406
- // like 'a.xyz.yz' doesn't match. So, the first negative
3407
- // lookahead, has to look ALL the way ahead, to the end of
3408
- // the pattern.
3409
- for (var n = negativeLists.length - 1; n > -1; n--) {
3410
- var nl = negativeLists[n]
3411
-
3412
- var nlBefore = re.slice(0, nl.reStart)
3413
- var nlFirst = re.slice(nl.reStart, nl.reEnd - 8)
3414
- var nlLast = re.slice(nl.reEnd - 8, nl.reEnd)
3415
- var nlAfter = re.slice(nl.reEnd)
3416
-
3417
- nlLast += nlAfter
3418
-
3419
- // Handle nested stuff like *(*.js|!(*.json)), where open parens
3420
- // mean that we should *not* include the ) in the bit that is considered
3421
- // "after" the negated section.
3422
- var openParensBefore = nlBefore.split('(').length - 1
3423
- var cleanAfter = nlAfter
3424
- for (i = 0; i < openParensBefore; i++) {
3425
- cleanAfter = cleanAfter.replace(/\)[+*?]?/, '')
3426
- }
3427
- nlAfter = cleanAfter
3428
-
3429
- var dollar = ''
3430
- if (nlAfter === '' && isSub !== SUBPARSE) {
3431
- dollar = '$'
3432
- }
3433
- var newRe = nlBefore + nlFirst + nlAfter + dollar + nlLast
3434
- re = newRe
3435
- }
3436
-
3437
- // if the re is not "" at this point, then we need to make sure
3438
- // it doesn't match against an empty path part.
3439
- // Otherwise a/* will match a/, which it should not.
3440
- if (re !== '' && hasMagic) {
3441
- re = '(?=.)' + re
3442
- }
3443
-
3444
- if (addPatternStart) {
3445
- re = patternStart + re
3446
- }
3447
-
3448
- // parsing just a piece of a larger pattern.
3449
- if (isSub === SUBPARSE) {
3450
- return [re, hasMagic]
3451
- }
3452
-
3453
- // skip the regexp for non-magical patterns
3454
- // unescape anything in it, though, so that it'll be
3455
- // an exact match against a file etc.
3456
- if (!hasMagic) {
3457
- return globUnescape(pattern)
3458
- }
3459
-
3460
- var flags = options.nocase ? 'i' : ''
3461
- try {
3462
- var regExp = new RegExp('^' + re + '$', flags)
3463
- } catch (er) /* istanbul ignore next - should be impossible */ {
3464
- // If it was an invalid regular expression, then it can't match
3465
- // anything. This trick looks for a character after the end of
3466
- // the string, which is of course impossible, except in multi-line
3467
- // mode, but it's not a /m regex.
3468
- return new RegExp('$.')
3469
- }
3470
-
3471
- regExp._glob = pattern
3472
- regExp._src = re
3473
-
3474
- return regExp
3475
- }
3476
-
3477
- minimatch.makeRe = function (pattern, options) {
3478
- return new Minimatch(pattern, options || {}).makeRe()
3479
- }
3480
-
3481
- Minimatch.prototype.makeRe = makeRe
3482
- function makeRe () {
3483
- if (this.regexp || this.regexp === false) return this.regexp
3484
-
3485
- // at this point, this.set is a 2d array of partial
3486
- // pattern strings, or "**".
3487
- //
3488
- // It's better to use .match(). This function shouldn't
3489
- // be used, really, but it's pretty convenient sometimes,
3490
- // when you just want to work with a regex.
3491
- var set = this.set
3492
-
3493
- if (!set.length) {
3494
- this.regexp = false
3495
- return this.regexp
3496
- }
3497
- var options = this.options
3498
-
3499
- var twoStar = options.noglobstar ? star
3500
- : options.dot ? twoStarDot
3501
- : twoStarNoDot
3502
- var flags = options.nocase ? 'i' : ''
3503
-
3504
- var re = set.map(function (pattern) {
3505
- return pattern.map(function (p) {
3506
- return (p === GLOBSTAR) ? twoStar
3507
- : (typeof p === 'string') ? regExpEscape(p)
3508
- : p._src
3509
- }).join('\\\/')
3510
- }).join('|')
3511
-
3512
- // must match entire pattern
3513
- // ending in a * or ** will make it less strict.
3514
- re = '^(?:' + re + ')$'
3515
-
3516
- // can match anything, as long as it's not this.
3517
- if (this.negate) re = '^(?!' + re + ').*$'
3518
-
3519
- try {
3520
- this.regexp = new RegExp(re, flags)
3521
- } catch (ex) /* istanbul ignore next - should be impossible */ {
3522
- this.regexp = false
3523
- }
3524
- return this.regexp
3525
- }
3526
-
3527
- minimatch.match = function (list, pattern, options) {
3528
- options = options || {}
3529
- var mm = new Minimatch(pattern, options)
3530
- list = list.filter(function (f) {
3531
- return mm.match(f)
3532
- })
3533
- if (mm.options.nonull && !list.length) {
3534
- list.push(pattern)
3535
- }
3536
- return list
3537
- }
3538
-
3539
- Minimatch.prototype.match = function match (f, partial) {
3540
- if (typeof partial === 'undefined') partial = this.partial
3541
- this.debug('match', f, this.pattern)
3542
- // short-circuit in the case of busted things.
3543
- // comments, etc.
3544
- if (this.comment) return false
3545
- if (this.empty) return f === ''
3546
-
3547
- if (f === '/' && partial) return true
3548
-
3549
- var options = this.options
3550
-
3551
- // windows: need to use /, not \
3552
- if (path.sep !== '/') {
3553
- f = f.split(path.sep).join('/')
3554
- }
3555
-
3556
- // treat the test path as a set of pathparts.
3557
- f = f.split(slashSplit)
3558
- this.debug(this.pattern, 'split', f)
3559
-
3560
- // just ONE of the pattern sets in this.set needs to match
3561
- // in order for it to be valid. If negating, then just one
3562
- // match means that we have failed.
3563
- // Either way, return on the first hit.
3564
-
3565
- var set = this.set
3566
- this.debug(this.pattern, 'set', set)
3567
-
3568
- // Find the basename of the path by looking for the last non-empty segment
3569
- var filename
3570
- var i
3571
- for (i = f.length - 1; i >= 0; i--) {
3572
- filename = f[i]
3573
- if (filename) break
3574
- }
3575
-
3576
- for (i = 0; i < set.length; i++) {
3577
- var pattern = set[i]
3578
- var file = f
3579
- if (options.matchBase && pattern.length === 1) {
3580
- file = [filename]
3581
- }
3582
- var hit = this.matchOne(file, pattern, partial)
3583
- if (hit) {
3584
- if (options.flipNegate) return true
3585
- return !this.negate
3586
- }
3587
- }
3588
-
3589
- // didn't get any hits. this is success if it's a negative
3590
- // pattern, failure otherwise.
3591
- if (options.flipNegate) return false
3592
- return this.negate
3593
- }
3594
-
3595
- // set partial to true to test if, for example,
3596
- // "/a/b" matches the start of "/*/b/*/d"
3597
- // Partial means, if you run out of file before you run
3598
- // out of pattern, then that's fine, as long as all
3599
- // the parts match.
3600
- Minimatch.prototype.matchOne = function (file, pattern, partial) {
3601
- var options = this.options
3602
-
3603
- this.debug('matchOne',
3604
- { 'this': this, file: file, pattern: pattern })
3605
-
3606
- this.debug('matchOne', file.length, pattern.length)
3607
-
3608
- for (var fi = 0,
3609
- pi = 0,
3610
- fl = file.length,
3611
- pl = pattern.length
3612
- ; (fi < fl) && (pi < pl)
3613
- ; fi++, pi++) {
3614
- this.debug('matchOne loop')
3615
- var p = pattern[pi]
3616
- var f = file[fi]
3617
-
3618
- this.debug(pattern, p, f)
3619
-
3620
- // should be impossible.
3621
- // some invalid regexp stuff in the set.
3622
- /* istanbul ignore if */
3623
- if (p === false) return false
3624
-
3625
- if (p === GLOBSTAR) {
3626
- this.debug('GLOBSTAR', [pattern, p, f])
3627
-
3628
- // "**"
3629
- // a/**/b/**/c would match the following:
3630
- // a/b/x/y/z/c
3631
- // a/x/y/z/b/c
3632
- // a/b/x/b/x/c
3633
- // a/b/c
3634
- // To do this, take the rest of the pattern after
3635
- // the **, and see if it would match the file remainder.
3636
- // If so, return success.
3637
- // If not, the ** "swallows" a segment, and try again.
3638
- // This is recursively awful.
3639
- //
3640
- // a/**/b/**/c matching a/b/x/y/z/c
3641
- // - a matches a
3642
- // - doublestar
3643
- // - matchOne(b/x/y/z/c, b/**/c)
3644
- // - b matches b
3645
- // - doublestar
3646
- // - matchOne(x/y/z/c, c) -> no
3647
- // - matchOne(y/z/c, c) -> no
3648
- // - matchOne(z/c, c) -> no
3649
- // - matchOne(c, c) yes, hit
3650
- var fr = fi
3651
- var pr = pi + 1
3652
- if (pr === pl) {
3653
- this.debug('** at the end')
3654
- // a ** at the end will just swallow the rest.
3655
- // We have found a match.
3656
- // however, it will not swallow /.x, unless
3657
- // options.dot is set.
3658
- // . and .. are *never* matched by **, for explosively
3659
- // exponential reasons.
3660
- for (; fi < fl; fi++) {
3661
- if (file[fi] === '.' || file[fi] === '..' ||
3662
- (!options.dot && file[fi].charAt(0) === '.')) return false
3663
- }
3664
- return true
3665
- }
3666
-
3667
- // ok, let's see if we can swallow whatever we can.
3668
- while (fr < fl) {
3669
- var swallowee = file[fr]
3670
-
3671
- this.debug('\nglobstar while', file, fr, pattern, pr, swallowee)
3672
-
3673
- // XXX remove this slice. Just pass the start index.
3674
- if (this.matchOne(file.slice(fr), pattern.slice(pr), partial)) {
3675
- this.debug('globstar found match!', fr, fl, swallowee)
3676
- // found a match.
3677
- return true
3678
- } else {
3679
- // can't swallow "." or ".." ever.
3680
- // can only swallow ".foo" when explicitly asked.
3681
- if (swallowee === '.' || swallowee === '..' ||
3682
- (!options.dot && swallowee.charAt(0) === '.')) {
3683
- this.debug('dot detected!', file, fr, pattern, pr)
3684
- break
3685
- }
3686
-
3687
- // ** swallows a segment, and continue.
3688
- this.debug('globstar swallow a segment, and continue')
3689
- fr++
3690
- }
3691
- }
3692
-
3693
- // no match was found.
3694
- // However, in partial mode, we can't say this is necessarily over.
3695
- // If there's more *pattern* left, then
3696
- /* istanbul ignore if */
3697
- if (partial) {
3698
- // ran out of file
3699
- this.debug('\n>>> no match, partial?', file, fr, pattern, pr)
3700
- if (fr === fl) return true
3701
- }
3702
- return false
3703
- }
3704
-
3705
- // something other than **
3706
- // non-magic patterns just have to match exactly
3707
- // patterns with magic have been turned into regexps.
3708
- var hit
3709
- if (typeof p === 'string') {
3710
- hit = f === p
3711
- this.debug('string match', p, f, hit)
3712
- } else {
3713
- hit = f.match(p)
3714
- this.debug('pattern match', p, f, hit)
3715
- }
3716
-
3717
- if (!hit) return false
3718
- }
3719
-
3720
- // Note: ending in / means that we'll get a final ""
3721
- // at the end of the pattern. This can only match a
3722
- // corresponding "" at the end of the file.
3723
- // If the file ends in /, then it can only match a
3724
- // a pattern that ends in /, unless the pattern just
3725
- // doesn't have any more for it. But, a/b/ should *not*
3726
- // match "a/b/*", even though "" matches against the
3727
- // [^/]*? pattern, except in partial mode, where it might
3728
- // simply not be reached yet.
3729
- // However, a/b/ should still satisfy a/*
3730
-
3731
- // now either we fell off the end of the pattern, or we're done.
3732
- if (fi === fl && pi === pl) {
3733
- // ran out of pattern and filename at the same time.
3734
- // an exact hit!
3735
- return true
3736
- } else if (fi === fl) {
3737
- // ran out of file, but still had pattern left.
3738
- // this is ok if we're doing the match as part of
3739
- // a glob fs traversal.
3740
- return partial
3741
- } else /* istanbul ignore else */ if (pi === pl) {
3742
- // ran out of pattern, still have file left.
3743
- // this is only acceptable if we're on the very last
3744
- // empty segment of a file with a trailing slash.
3745
- // a/* should match a/b/
3746
- return (fi === fl - 1) && (file[fi] === '')
3747
- }
3748
-
3749
- // should be unreachable.
3750
- /* istanbul ignore next */
3751
- throw new Error('wtf?')
3752
- }
3753
-
3754
- // replace stuff like \* with *
3755
- function globUnescape (s) {
3756
- return s.replace(/\\(.)/g, '$1')
3757
- }
3758
-
3759
- function regExpEscape (s) {
3760
- return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&')
3761
- }
3762
-
3763
-
3764
- /***/ }),
3765
-
3766
- /***/ 778:
3767
- /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
3768
-
3769
- var wrappy = __webpack_require__(2479)
3770
- module.exports = wrappy(once)
3771
- module.exports.strict = wrappy(onceStrict)
3772
-
3773
- once.proto = once(function () {
3774
- Object.defineProperty(Function.prototype, 'once', {
3775
- value: function () {
3776
- return once(this)
3777
- },
3778
- configurable: true
3779
- })
3780
-
3781
- Object.defineProperty(Function.prototype, 'onceStrict', {
3782
- value: function () {
3783
- return onceStrict(this)
3784
- },
3785
- configurable: true
3786
- })
3787
- })
3788
-
3789
- function once (fn) {
3790
- var f = function () {
3791
- if (f.called) return f.value
3792
- f.called = true
3793
- return f.value = fn.apply(this, arguments)
3794
- }
3795
- f.called = false
3796
- return f
470
+ eventTargetAgnosticAddListener(emitter, name, resolver, { once: true });
471
+ if (name !== 'error') {
472
+ addErrorHandlerIfEventEmitter(emitter, errorListener, { once: true });
473
+ }
474
+ });
3797
475
  }
3798
476
 
3799
- function onceStrict (fn) {
3800
- var f = function () {
3801
- if (f.called)
3802
- throw new Error(f.onceError)
3803
- f.called = true
3804
- return f.value = fn.apply(this, arguments)
477
+ function addErrorHandlerIfEventEmitter(emitter, handler, flags) {
478
+ if (typeof emitter.on === 'function') {
479
+ eventTargetAgnosticAddListener(emitter, 'error', handler, flags);
3805
480
  }
3806
- var name = fn.name || 'Function wrapped with `once`'
3807
- f.onceError = name + " shouldn't be called more than once"
3808
- f.called = false
3809
- return f
3810
- }
3811
-
3812
-
3813
- /***/ }),
3814
-
3815
- /***/ 4095:
3816
- /***/ ((module) => {
3817
-
3818
- "use strict";
3819
-
3820
-
3821
- function posix(path) {
3822
- return path.charAt(0) === '/';
3823
481
  }
3824
482
 
3825
- function win32(path) {
3826
- // https://github.com/nodejs/node/blob/b3fcc245fb25539909ef1d5eaa01dbf92e168633/lib/path.js#L56
3827
- var splitDeviceRe = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/;
3828
- var result = splitDeviceRe.exec(path);
3829
- var device = result[1] || '';
3830
- var isUnc = Boolean(device && device.charAt(1) !== ':');
3831
-
3832
- // UNC paths are always absolute
3833
- return Boolean(result[2] || isUnc);
483
+ function eventTargetAgnosticAddListener(emitter, name, listener, flags) {
484
+ if (typeof emitter.on === 'function') {
485
+ if (flags.once) {
486
+ emitter.once(name, listener);
487
+ } else {
488
+ emitter.on(name, listener);
489
+ }
490
+ } else if (typeof emitter.addEventListener === 'function') {
491
+ // EventTarget does not have `error` event semantics like Node
492
+ // EventEmitters, we do not listen for `error` events here.
493
+ emitter.addEventListener(name, function wrapListener(arg) {
494
+ // IE does not have builtin `{ once: true }` support so we
495
+ // have to do it manually.
496
+ if (flags.once) {
497
+ emitter.removeEventListener(name, wrapListener);
498
+ }
499
+ listener(arg);
500
+ });
501
+ } else {
502
+ throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type ' + typeof emitter);
503
+ }
3834
504
  }
3835
505
 
3836
- module.exports = process.platform === 'win32' ? win32 : posix;
3837
- module.exports.posix = posix;
3838
- module.exports.win32 = win32;
3839
-
3840
506
 
3841
507
  /***/ }),
3842
508
 
@@ -5410,46 +2076,6 @@ module.exports.win32 = win32;
5410
2076
  })( false ? 0 : exports)
5411
2077
 
5412
2078
 
5413
- /***/ }),
5414
-
5415
- /***/ 2479:
5416
- /***/ ((module) => {
5417
-
5418
- // Returns a wrapper function that returns a wrapped callback
5419
- // The wrapper function should do some stuff, and return a
5420
- // presumably different callback function.
5421
- // This makes sure that own properties are retained, so that
5422
- // decorations and such are not lost along the way.
5423
- module.exports = wrappy
5424
- function wrappy (fn, cb) {
5425
- if (fn && cb) return wrappy(fn)(cb)
5426
-
5427
- if (typeof fn !== 'function')
5428
- throw new TypeError('need wrapper function')
5429
-
5430
- Object.keys(fn).forEach(function (k) {
5431
- wrapper[k] = fn[k]
5432
- })
5433
-
5434
- return wrapper
5435
-
5436
- function wrapper() {
5437
- var args = new Array(arguments.length)
5438
- for (var i = 0; i < args.length; i++) {
5439
- args[i] = arguments[i]
5440
- }
5441
- var ret = fn.apply(this, args)
5442
- var cb = args[args.length-1]
5443
- if (typeof ret === 'function' && ret !== cb) {
5444
- Object.keys(cb).forEach(function (k) {
5445
- ret[k] = cb[k]
5446
- })
5447
- }
5448
- return ret
5449
- }
5450
- }
5451
-
5452
-
5453
2079
  /***/ }),
5454
2080
 
5455
2081
  /***/ 306:
@@ -10453,30 +7079,6 @@ function wrappy (fn, cb) {
10453
7079
  }).call(this);
10454
7080
 
10455
7081
 
10456
- /***/ }),
10457
-
10458
- /***/ 9084:
10459
- /***/ ((module) => {
10460
-
10461
- "use strict";
10462
- module.exports = require("assert");
10463
-
10464
- /***/ }),
10465
-
10466
- /***/ 6231:
10467
- /***/ ((module) => {
10468
-
10469
- "use strict";
10470
- module.exports = require("fs");
10471
-
10472
- /***/ }),
10473
-
10474
- /***/ 1423:
10475
- /***/ ((module) => {
10476
-
10477
- "use strict";
10478
- module.exports = require("path");
10479
-
10480
7082
  /***/ }),
10481
7083
 
10482
7084
  /***/ 8311:
@@ -10501,14 +7103,6 @@ module.exports = require("string_decoder");
10501
7103
  "use strict";
10502
7104
  module.exports = require("timers");
10503
7105
 
10504
- /***/ }),
10505
-
10506
- /***/ 6464:
10507
- /***/ ((module) => {
10508
-
10509
- "use strict";
10510
- module.exports = require("util");
10511
-
10512
7106
  /***/ })
10513
7107
 
10514
7108
  /******/ });
@@ -10577,7 +7171,7 @@ __webpack_require__.r(__webpack_exports__);
10577
7171
  // EXPORTS
10578
7172
  __webpack_require__.d(__webpack_exports__, {
10579
7173
  "buildOptimizedProject": () => (/* binding */ buildOptimizedProject),
10580
- "copyRecursiveAsNeeded": () => (/* reexport */ copyRecursiveAsNeeded),
7174
+ "copyRecursiveAsNeeded": () => (/* reexport */ external_util_cjs_namespaceObject.copyRecursiveAsNeeded),
10581
7175
  "defaultConfig": () => (/* binding */ defaultConfig),
10582
7176
  "generateApiMirTests": () => (/* binding */ generateApiMirTests),
10583
7177
  "generateOptimizedProject": () => (/* binding */ generateOptimizedProject),
@@ -10586,576 +7180,12 @@ __webpack_require__.d(__webpack_exports__, {
10586
7180
 
10587
7181
  ;// CONCATENATED MODULE: external "fs/promises"
10588
7182
  const promises_namespaceObject = require("fs/promises");
10589
- // EXTERNAL MODULE: external "path"
10590
- var external_path_ = __webpack_require__(1423);
10591
- ;// CONCATENATED MODULE: external "@markw65/prettier-plugin-monkeyc"
10592
- const prettier_plugin_monkeyc_namespaceObject = require("@markw65/prettier-plugin-monkeyc");
10593
- ;// CONCATENATED MODULE: external "prettier/standalone.js"
10594
- const standalone_js_namespaceObject = require("prettier/standalone.js");
10595
- ;// CONCATENATED MODULE: external "child_process"
10596
- const external_child_process_namespaceObject = require("child_process");
10597
- // EXTERNAL MODULE: external "fs"
10598
- var external_fs_ = __webpack_require__(6231);
10599
- // EXTERNAL MODULE: ./node_modules/glob/glob.js
10600
- var glob = __webpack_require__(2884);
10601
- ;// CONCATENATED MODULE: external "readline"
10602
- const external_readline_namespaceObject = require("readline");
10603
- ;// CONCATENATED MODULE: ./src/util.js
10604
-
10605
-
10606
-
10607
-
10608
-
10609
-
10610
-
10611
- const isWin = process.platform == "win32";
10612
-
10613
- const appSupport = isWin
10614
- ? `${process.env.APPDATA}`.replace(/\\/g, "/")
10615
- : `${process.env.HOME}/Library/Application Support`;
10616
-
10617
- const connectiq = `${appSupport}/Garmin/ConnectIQ`;
10618
-
10619
- function getSdkPath() {
10620
- return promises_namespaceObject.readFile(connectiq + "/current-sdk.cfg")
10621
- .then((contents) => contents.toString().replace(/^\s*(.*?)\s*$/s, "$1"));
10622
- }
10623
-
10624
- function globa(pattern, options) {
10625
- return new Promise((resolve, reject) => {
10626
- glob.glob(pattern, options, (er, files) => {
10627
- if (er) {
10628
- reject(files);
10629
- } else {
10630
- resolve(files);
10631
- }
10632
- });
10633
- });
10634
- }
10635
-
10636
- async function modified_times(inputs, missing) {
10637
- return Promise.all(
10638
- inputs.map(async (path) => {
10639
- try {
10640
- const stat = await promises_namespaceObject.stat(path);
10641
- return stat.mtimeMs;
10642
- } catch (e) {
10643
- return missing;
10644
- }
10645
- })
10646
- );
10647
- }
10648
-
10649
- async function last_modified(inputs) {
10650
- return Math.max(...(await modified_times(inputs, Infinity)));
10651
- }
10652
-
10653
- async function first_modified(inputs) {
10654
- return Math.min(...(await modified_times(inputs, 0)));
10655
- }
10656
-
10657
- // return a promise that will process the output of command
10658
- // line-by-line via lineHandlers.
10659
- function spawnByLine(command, args, lineHandlers, options) {
10660
- const [lineHandler, errHandler] = Array.isArray(lineHandlers)
10661
- ? lineHandlers
10662
- : [lineHandlers, (data) => console.error(data.toString())];
10663
- return new Promise((resolve, reject) => {
10664
- const proc = external_child_process_namespaceObject.spawn(command, args, {
10665
- ...(options || {}),
10666
- shell: false,
10667
- });
10668
- const rl = external_readline_namespaceObject.createInterface({
10669
- input: proc.stdout,
10670
- });
10671
- const rle = external_readline_namespaceObject.createInterface({
10672
- input: proc.stderr,
10673
- });
10674
- proc.on("error", reject);
10675
- rle.on("line", errHandler);
10676
- rl.on("line", lineHandler);
10677
- proc.on("close", (code) => {
10678
- if (code == 0) resolve();
10679
- reject(code);
10680
- });
10681
- });
10682
- }
10683
-
10684
- // return a promise that will process file
10685
- // line-by-line via lineHandler.
10686
- function readByLine(file, lineHandler) {
10687
- return fs.open(file, "r").then(
10688
- (fh) =>
10689
- new Promise((resolve, _reject) => {
10690
- const stream = fh.createReadStream();
10691
- const rl = readline.createInterface({
10692
- input: stream,
10693
- });
10694
- rl.on("line", lineHandler);
10695
- stream.on("close", resolve);
10696
- })
10697
- );
10698
- }
10699
-
10700
- async function promiseAll(promises, parallelism) {
10701
- parallelism = parallelism || 4;
10702
- const serializer = [];
10703
- promises.forEach((p, i) => {
10704
- if (serializer.length < parallelism) {
10705
- serializer.push(p);
10706
- } else {
10707
- serializer[i % parallelism].then(() => p);
10708
- }
10709
- });
10710
- return Promise.all(serializer);
10711
- }
10712
-
10713
- async function copyRecursiveAsNeeded(source, target, filter) {
10714
- const fstat = promises_namespaceObject.stat;
10715
- const sstat = await fstat(source);
10716
- if (sstat.isDirectory()) {
10717
- const stat = await fstat(target).catch(() => null);
10718
-
10719
- if (!stat || !stat.isDirectory()) {
10720
- stat && (await promises_namespaceObject.rm(target, { force: true }));
10721
- await promises_namespaceObject.mkdir(target, { recursive: true });
10722
- }
10723
-
10724
- const files = await promises_namespaceObject.readdir(source);
10725
- return Promise.all(
10726
- files.map((file) => {
10727
- var src = external_path_.join(source, file);
10728
- var tgt = external_path_.join(target, file);
10729
- return copyRecursiveAsNeeded(src, tgt, filter);
10730
- })
10731
- );
10732
- } else {
10733
- if (filter && !filter(source, target)) {
10734
- return;
10735
- }
10736
- const tstat = await fstat(target).catch(() => null);
10737
- if (!tstat || tstat.mtimeMs < sstat.mtimeMs) {
10738
- console.log(`Copying ${source} to ${target}...`);
10739
- return promises_namespaceObject.copyFile(source, target, external_fs_.constants.COPYFILE_FICLONE);
10740
- }
10741
- }
10742
- }
10743
-
10744
- ;// CONCATENATED MODULE: ./src/negative-fixups.js
10745
- /*
10746
- * This is strange. It pretty much has to be a bug in the sdk,
10747
- * but its the same in every sdk.
10748
- *
10749
- * ${sdk}/bin/api.mir describes the Toybox api down to every module,
10750
- * class, function, enum and constant, together with the enum
10751
- * and constant values.
10752
- *
10753
- * The problem is that every enum or constant with a negative
10754
- * value, appears with the corresponding positive value in api.mir.
10755
- * So eg Graphics.COLOR_TRANSPARENT should be -1, but instead, it has
10756
- * the value 1.
10757
- *
10758
- * This is a (currently somewhat ad-hoc) list of the negative constants
10759
- * so we can fix them after reading api.mir.
10760
- */
10761
- const negativeFixups = [
10762
- "Toybox.Communications.BLE_CONNECTION_UNAVAILABLE",
10763
- "Toybox.Communications.INVALID_HTTP_BODY_IN_REQUEST",
10764
- "Toybox.Communications.REQUEST_CANCELLED",
10765
- "Toybox.Communications.UNSUPPORTED_CONTENT_TYPE_IN_RESPONSE",
10766
- "Toybox.Communications.UNABLE_TO_PROCESS_IMAGE",
10767
- "Toybox.Communications.NETWORK_RESPONSE_OUT_OF_MEMORY",
10768
- "Toybox.Communications.BLE_REQUEST_CANCELLED",
10769
- "Toybox.Communications.INVALID_HTTP_METHOD_IN_REQUEST",
10770
- "Toybox.Communications.BLE_NO_DATA",
10771
- "Toybox.Communications.INVALID_HTTP_HEADER_FIELDS_IN_REQUEST",
10772
- "Toybox.Communications.BLE_ERROR",
10773
- "Toybox.Communications.NETWORK_RESPONSE_TOO_LARGE",
10774
- "Toybox.Communications.INVALID_HTTP_BODY_IN_NETWORK_RESPONSE",
10775
- "Toybox.Communications.BLE_REQUEST_TOO_LARGE",
10776
- "Toybox.Communications.UNABLE_TO_PROCESS_MEDIA",
10777
- "Toybox.Communications.REQUEST_CONNECTION_DROPPED",
10778
- "Toybox.Communications.BLE_UNKNOWN_SEND_ERROR",
10779
- "Toybox.Communications.BLE_QUEUE_FULL",
10780
- "Toybox.Communications.STORAGE_FULL",
10781
- "Toybox.Communications.BLE_SERVER_TIMEOUT",
10782
- "Toybox.Communications.INVALID_HTTP_HEADER_FIELDS_IN_NETWORK_RESPONSE",
10783
- "Toybox.Communications.SECURE_CONNECTION_REQUIRED",
10784
- "Toybox.Communications.NETWORK_REQUEST_TIMED_OUT",
10785
- "Toybox.Communications.BLE_HOST_TIMEOUT",
10786
- "Toybox.Communications.UNABLE_TO_PROCESS_HLS",
10787
- "Toybox.Graphics.COLOR_TRANSPARENT",
10788
- "Toybox.AntPlus.INVALID_SPEED",
10789
- "Toybox.AntPlus.INVALID_CADENCE",
10790
- "Toybox.WatchUi.LAYOUT_VALIGN_START",
10791
- "Toybox.WatchUi.LAYOUT_VALIGN_TOP",
10792
- "Toybox.WatchUi.LAYOUT_VALIGN_BOTTOM",
10793
- "Toybox.WatchUi.LAYOUT_VALIGN_CENTER",
10794
- "Toybox.WatchUi.LAYOUT_HALIGN_RIGHT",
10795
- "Toybox.WatchUi.LAYOUT_HALIGN_CENTER",
10796
- "Toybox.WatchUi.LAYOUT_HALIGN_START",
10797
- "Toybox.WatchUi.LAYOUT_HALIGN_LEFT",
10798
- ];
10799
-
10800
- ;// CONCATENATED MODULE: ./src/api.js
10801
-
10802
-
10803
-
10804
-
10805
-
10806
-
10807
- const LiteralIntegerRe = /^(0x[0-9a-f]+|\d+)(l)?$/;
10808
- /*
10809
- * This is an unfortunate hack. I want to be able to extract things
10810
- * like the types of all of a Class's variables (in particular the type
10811
- * of each member of Activity.Info), and also map things like enum names
10812
- * to their values (eg to take font names, and color names to their values).
10813
- * The only place I can find this information is in api.mir, which is totally
10814
- * undocumented. The same could be said of compiler.json and simulator.json,
10815
- * but those are at least in a standard format.
10816
- */
10817
-
10818
- // Extract all enum values from api.mir
10819
- async function getApiMapping(state) {
10820
- // get the path to the currently active sdk
10821
- const parser = prettier_plugin_monkeyc_namespaceObject.parsers.monkeyc;
10822
-
10823
- const sdk = await getSdkPath();
10824
-
10825
- const api = (await promises_namespaceObject.readFile(`${sdk}bin/api.mir`))
10826
- .toString()
10827
- .replace(/\r\n/g, "\n")
10828
- .replace(/^\s*\[.*?\]\s*$/gm, "")
10829
- //.replace(/(COLOR_TRANSPARENT|LAYOUT_[HV]ALIGN_\w+) = (\d+)/gm, "$1 = -$2")
10830
- .replace(/^(\s*type)\s/gm, "$1def ");
10831
-
10832
- try {
10833
- const result = collectNamespaces(parser.parse(api, {}), state);
10834
- negativeFixups.forEach((fixup) => {
10835
- const value = fixup.split(".").reduce((state, part) => {
10836
- const decls = state.decls[part];
10837
- if (!Array.isArray(decls) || decls.length != 1 || !decls[0]) {
10838
- throw `Failed to find and fix negative constant ${fixup}`;
10839
- }
10840
- return decls[0];
10841
- }, result);
10842
- if (value.type != "Literal") {
10843
- throw `Negative constant ${fixup} was not a Literal`;
10844
- }
10845
- if (value.value > 0) {
10846
- value.value = -value.value;
10847
- value.raw = "-" + value.raw;
10848
- } else {
10849
- console.log(`Negative fixup ${fixup} was already negative!`);
10850
- }
10851
- });
10852
- return result;
10853
- } catch (e) {
10854
- console.error(e.toString());
10855
- }
10856
- }
10857
-
10858
- function hasProperty(obj, prop) {
10859
- return obj && Object.prototype.hasOwnProperty.call(obj, prop);
10860
- }
10861
-
10862
- function collectNamespaces(ast, state) {
10863
- state = state || {};
10864
- if (!state.index) state.index = {};
10865
- if (!state.stack) {
10866
- state.stack = [{ type: "Program", name: "$", fullName: "$" }];
10867
- }
10868
- const checkOne = (ns, name) => {
10869
- if (hasProperty(ns.decls, name)) {
10870
- return ns.decls[name];
10871
- }
10872
- return null;
10873
- };
10874
- state.lookup = (node, name, stack) => {
10875
- stack || (stack = state.stack);
10876
- switch (node.type) {
10877
- case "MemberExpression": {
10878
- if (node.property.type != "Identifier" || node.computed) break;
10879
- const [, module] = state.lookup(node.object, name, stack);
10880
- if (module && module.length === 1) {
10881
- const result = checkOne(module[0], node.property.name);
10882
- if (result) {
10883
- return [name || node.property.name, result];
10884
- }
10885
- }
10886
- break;
10887
- }
10888
- case "ThisExpression":
10889
- return [name, stack.slice(-1)];
10890
- case "Identifier": {
10891
- if (node.name == "$") {
10892
- return [name || node.name, [stack[0]]];
10893
- }
10894
- for (let i = stack.length; i--; ) {
10895
- const result = checkOne(stack[i], node.name);
10896
- if (result) {
10897
- return [name || node.name, result];
10898
- }
10899
- }
10900
- break;
10901
- }
10902
- }
10903
- return [null, null];
10904
- };
10905
-
10906
- const pushUnique = (arr, value) => {
10907
- if (arr.find((v) => v === value) != null) return;
10908
- arr.push(value);
10909
- };
10910
-
10911
- traverseAst(
10912
- ast,
10913
- (node) => {
10914
- switch (node.type) {
10915
- case "Program":
10916
- if (state.stack.length != 1) {
10917
- throw "Unexpected stack length for Program node";
10918
- }
10919
- break;
10920
- case "BlockStatement": {
10921
- const [parent] = state.stack.slice(-1);
10922
- if (
10923
- parent.type != "FunctionDeclaration" &&
10924
- parent.type != "BlockStatement"
10925
- ) {
10926
- break;
10927
- }
10928
- // fall through
10929
- }
10930
- case "ClassDeclaration":
10931
- case "FunctionDeclaration":
10932
- case "ModuleDeclaration":
10933
- if (node.id || node.type == "BlockStatement") {
10934
- const [parent] = state.stack.slice(-1);
10935
- const elm = {
10936
- type: node.type,
10937
- name: node.id && node.id.name,
10938
- node,
10939
- };
10940
- state.stack.push(elm);
10941
- elm.fullName = state.stack
10942
- .map((e) => e.name)
10943
- .filter((e) => e != null)
10944
- .join(".");
10945
- if (elm.name) {
10946
- if (!parent.decls) parent.decls = {};
10947
- if (hasProperty(parent.decls, elm.name)) {
10948
- const what = node.type == "ModuleDeclaration" ? "type" : "node";
10949
- const e = parent.decls[elm.name].find(
10950
- (d) => d[what] == elm[what]
10951
- );
10952
- if (e != null) {
10953
- e.node = node;
10954
- state.stack.splice(-1, 1, e);
10955
- break;
10956
- }
10957
- } else {
10958
- parent.decls[elm.name] = [];
10959
- }
10960
- parent.decls[elm.name].push(elm);
10961
- }
10962
- }
10963
- break;
10964
- // an EnumDeclaration doesn't create a scope, but
10965
- // it does create a type (if it has a name)
10966
- case "EnumDeclaration": {
10967
- if (!node.id) break;
10968
- const [parent] = state.stack.slice(-1);
10969
- const name = (parent.fullName + "." + node.id.name).replace(
10970
- /^\$\./,
10971
- ""
10972
- );
10973
- node.body.members.forEach((m) => ((m.init || m).enumType = name));
10974
- }
10975
- // fall through
10976
- case "TypedefDeclaration": {
10977
- const [parent] = state.stack.slice(-1);
10978
- if (!parent.decls) parent.decls = {};
10979
- if (!hasProperty(parent.decls, node.id.name)) {
10980
- parent.decls[node.id.name] = [];
10981
- }
10982
- pushUnique(
10983
- parent.decls[node.id.name],
10984
- node.ts ? formatAst(node.ts.argument) : node.id.name
10985
- );
10986
- break;
10987
- }
10988
- case "VariableDeclaration": {
10989
- const [parent] = state.stack.slice(-1);
10990
- if (!parent.decls) parent.decls = {};
10991
- node.declarations.forEach((decl) => {
10992
- if (!hasProperty(parent.decls, decl.id.name)) {
10993
- parent.decls[decl.id.name] = [];
10994
- }
10995
- if (node.kind == "const") {
10996
- pushUnique(parent.decls[decl.id.name], decl.init);
10997
- if (!hasProperty(state.index, decl.id.name)) {
10998
- state.index[decl.id.name] = [];
10999
- }
11000
- pushUnique(state.index[decl.id.name], parent);
11001
- } else if (decl.id.ts) {
11002
- pushUnique(
11003
- parent.decls[decl.id.name],
11004
- formatAst(decl.id.ts.argument)
11005
- );
11006
- }
11007
- });
11008
- break;
11009
- }
11010
- case "EnumStringBody": {
11011
- const [parent] = state.stack.slice(-1);
11012
- const values = parent.decls || (parent.decls = {});
11013
- let prev = -1;
11014
- node.members.forEach((m) => {
11015
- let name, init;
11016
- if (m.type == "EnumStringMember") {
11017
- name = m.id.name;
11018
- init = m.init;
11019
- if (init.type == "Literal" && LiteralIntegerRe.test(init.raw)) {
11020
- prev = init.value;
11021
- }
11022
- } else {
11023
- name = m.name;
11024
- prev += 1;
11025
- if (!state.constants) {
11026
- state.constants = {};
11027
- }
11028
- const key = m.enumType ? `${m.enumType}:${prev}` : prev;
11029
- init = state.constants[key];
11030
- if (!init) {
11031
- init = state.constants[key] = {
11032
- type: "Literal",
11033
- value: prev,
11034
- raw: prev.toString(),
11035
- enumType: m.enumType,
11036
- };
11037
- }
11038
- }
11039
- if (!hasProperty(values, name)) {
11040
- values[name] = [];
11041
- }
11042
- pushUnique(values[name], init);
11043
- if (!hasProperty(state.index, name)) {
11044
- state.index[name] = [];
11045
- }
11046
- pushUnique(state.index[name], parent);
11047
- });
11048
- break;
11049
- }
11050
- case "Using":
11051
- case "ImportModule": {
11052
- const [name, module] = state.lookup(
11053
- node.id,
11054
- node.as && node.as.id.name
11055
- );
11056
- if (name && module) {
11057
- const [parent] = state.stack.slice(-1);
11058
- if (!parent.decls) parent.decls = {};
11059
- if (!hasProperty(parent.decls, name)) parent.decls[name] = [];
11060
- module.forEach((m) => {
11061
- if (m.type == "ModuleDeclaration") {
11062
- pushUnique(parent.decls[name], m);
11063
- }
11064
- });
11065
- }
11066
- break;
11067
- }
11068
- }
11069
- if (state.pre) return state.pre(node);
11070
- },
11071
- (node) => {
11072
- let ret;
11073
- if (state.post) ret = state.post(node);
11074
- if (state.stack.slice(-1).pop().node === node) {
11075
- state.stack.pop();
11076
- }
11077
- return ret;
11078
- }
11079
- );
11080
- if (state.stack.length != 1) {
11081
- throw "Invalid AST!";
11082
- }
11083
- return state.stack[0];
11084
- }
11085
-
11086
- /*
11087
- * Traverse the ast rooted at node, calling pre before
11088
- * visiting each node, and post after.
11089
- *
11090
- * - if pre returns false, the node is not traversed, and
11091
- * post is not called;
11092
- * - if pre returns a list of child nodes, only those will
11093
- * be traversed
11094
- * - otherwise all child nodes are traversed
11095
- *
11096
- * - if post returns false, the node it was called on is
11097
- * removed.
11098
- */
11099
- function traverseAst(node, pre, post) {
11100
- const nodes = pre && pre(node);
11101
- if (nodes === false) return;
11102
- for (const key of nodes || Object.keys(node)) {
11103
- const value = node[key];
11104
- if (!value) continue;
11105
- if (Array.isArray(value)) {
11106
- const deletions = value.reduce((state, obj, i) => {
11107
- const repl = traverseAst(obj, pre, post);
11108
- if (repl === false) {
11109
- if (!state) state = {};
11110
- state[i] = true;
11111
- } else if (repl != null) {
11112
- value[i] = repl;
11113
- }
11114
- return state;
11115
- }, null);
11116
- if (deletions) {
11117
- value.splice(
11118
- 0,
11119
- value.length,
11120
- ...value.filter((obj, i) => deletions[i] !== true)
11121
- );
11122
- }
11123
- } else if (typeof value == "object" && value.type) {
11124
- const repl = traverseAst(value, pre, post);
11125
- if (repl === false) {
11126
- delete node[key];
11127
- } else if (repl != null) {
11128
- node[key] = repl;
11129
- }
11130
- }
11131
- }
11132
- return post && post(node);
11133
- }
11134
-
11135
- function formatAst(node, options) {
11136
- if (!node.monkeyCSource && node.comments) {
11137
- // Prettier inserts comments by using the source location to
11138
- // find the original comment, rather than using the contents
11139
- // of the comment as reported by the comment nodes themselves.
11140
- // If all we've got is the ast, rather than the actual
11141
- // source code, this goes horribly wrong, so just drop all
11142
- // the comments.
11143
- delete node.comments;
11144
- }
11145
- // If we *do* have the original source, pass that in ahead of the
11146
- // json. The parser knows to just treat the last line of the input
11147
- // as the ast itself, and the printers will find what they're
11148
- // looking for in the source.
11149
- const source =
11150
- (node.monkeyCSource ? node.monkeyCSource + "\n" : "") +
11151
- JSON.stringify(node);
11152
- return standalone_js_namespaceObject.format(source, {
11153
- ...(options || {}),
11154
- parser: "monkeyc-json",
11155
- plugins: [prettier_plugin_monkeyc_namespaceObject],
11156
- });
11157
- }
11158
-
7183
+ ;// CONCATENATED MODULE: external "path"
7184
+ const external_path_namespaceObject = require("path");
7185
+ ;// CONCATENATED MODULE: external "./api.cjs"
7186
+ const external_api_cjs_namespaceObject = require("./api.cjs");
7187
+ ;// CONCATENATED MODULE: external "./util.cjs"
7188
+ const external_util_cjs_namespaceObject = require("./util.cjs");
11159
7189
  ;// CONCATENATED MODULE: ./src/build.js
11160
7190
 
11161
7191
 
@@ -11173,7 +7203,7 @@ async function build_project(product, options, lineCallback) {
11173
7203
  typeCheckLevel,
11174
7204
  returnCommand,
11175
7205
  } = options;
11176
- const sdk = await getSdkPath();
7206
+ const sdk = await (0,external_util_cjs_namespaceObject.getSdkPath)();
11177
7207
  let extraArgs = [];
11178
7208
  if (compilerOptions) {
11179
7209
  extraArgs.push(...compilerOptions.split(/\s+/));
@@ -11204,7 +7234,7 @@ async function build_project(product, options, lineCallback) {
11204
7234
  if (product) {
11205
7235
  extraArgs.push("-d", simulatorBuild !== false ? `${product}_sim` : product);
11206
7236
  }
11207
- const exe = external_path_.resolve(sdk, "bin", isWin ? "monkeyc.bat" : "monkeyc");
7237
+ const exe = external_path_namespaceObject.resolve(sdk, "bin", external_util_cjs_namespaceObject.isWin ? "monkeyc.bat" : "monkeyc");
11208
7238
  const args = [
11209
7239
  ["-o", program],
11210
7240
  ["-f", jungleFiles],
@@ -11227,7 +7257,7 @@ async function build_project(product, options, lineCallback) {
11227
7257
  ];
11228
7258
  return returnCommand
11229
7259
  ? { exe, args }
11230
- : spawnByLine(exe, args, handlers, {
7260
+ : (0,external_util_cjs_namespaceObject.spawnByLine)(exe, args, handlers, {
11231
7261
  cwd: workspace,
11232
7262
  });
11233
7263
  }
@@ -11263,7 +7293,7 @@ function process_assignments(assignments, current) {
11263
7293
  return assignments.reduce((state, a) => {
11264
7294
  const { node, dot, dotnames } = a.names.reduce(
11265
7295
  (r, name) => {
11266
- if (!hasProperty(r.node, name)) r.node[name] = {};
7296
+ if (!(0,external_api_cjs_namespaceObject.hasProperty)(r.node, name)) r.node[name] = {};
11267
7297
  r.dotnames.push(name);
11268
7298
  r.node = r.node[name];
11269
7299
  if (r.node["."]) {
@@ -11322,7 +7352,7 @@ function evaluate_locals(assignments) {
11322
7352
  if (
11323
7353
  v.type == "QualifiedName" &&
11324
7354
  v.names.length == 1 &&
11325
- hasProperty(locals, v.names[0])
7355
+ (0,external_api_cjs_namespaceObject.hasProperty)(locals, v.names[0])
11326
7356
  ) {
11327
7357
  values.splice(i, 1, ...locals[v.names[0]]);
11328
7358
  } else if (v.type == "SubList") {
@@ -11346,7 +7376,7 @@ async function parse_one(file) {
11346
7376
  // return a jungle object with all local variables resolved,
11347
7377
  // but all qualifier references left unresolved.
11348
7378
  async function process_jungles(sources) {
11349
- const sdk = await getSdkPath();
7379
+ const sdk = await (0,external_util_cjs_namespaceObject.getSdkPath)();
11350
7380
 
11351
7381
  if (!Array.isArray(sources)) {
11352
7382
  sources = [sources];
@@ -11409,8 +7439,8 @@ function resolve_node(state, node) {
11409
7439
  }
11410
7440
 
11411
7441
  function resolve_filename(literal, default_source) {
11412
- const root = external_path_.dirname(literal.source || default_source);
11413
- return external_path_.resolve(root, literal.value);
7442
+ const root = external_path_namespaceObject.dirname(literal.source || default_source);
7443
+ return external_path_namespaceObject.resolve(root, literal.value);
11414
7444
  }
11415
7445
 
11416
7446
  async function resolve_literals(qualifier, default_source) {
@@ -11425,7 +7455,7 @@ async function resolve_literals(qualifier, default_source) {
11425
7455
  // any mc file under "./". The standard way to express that
11426
7456
  // is "./**/*.mc", which is what glob expects, so translate.
11427
7457
  resolved = resolved.replace(/\/\*\*([^/])/g, "/**/*$1");
11428
- const match = await globa(resolved);
7458
+ const match = await (0,external_util_cjs_namespaceObject.globa)(resolved);
11429
7459
  return match.length ? resolved : null;
11430
7460
  } else {
11431
7461
  const stat = await promises_namespaceObject.stat(resolved).catch(() => null);
@@ -11476,7 +7506,7 @@ function identify_optimizer_groups(targets, options) {
11476
7506
  if (option === "*") {
11477
7507
  return [];
11478
7508
  } else {
11479
- return strs.filter((a) => !hasProperty(option, a));
7509
+ return strs.filter((a) => !(0,external_api_cjs_namespaceObject.hasProperty)(option, a));
11480
7510
  }
11481
7511
  };
11482
7512
  const ignoreRegExpOption = (str) => {
@@ -11501,7 +7531,7 @@ function identify_optimizer_groups(targets, options) {
11501
7531
  target.qualifier.sourcePath.forEach((path) => {
11502
7532
  const m = path.match(ignoredSourcePathsRe);
11503
7533
  const key = m ? "key-" + m.slice(1).join("") : path;
11504
- if (!hasProperty(state.keys, key)) {
7534
+ if (!(0,external_api_cjs_namespaceObject.hasProperty)(state.keys, key)) {
11505
7535
  state.keys[key] = {};
11506
7536
  }
11507
7537
  state.keys[key][path] = true;
@@ -11544,7 +7574,7 @@ function identify_optimizer_groups(targets, options) {
11544
7574
  optimizerConfig,
11545
7575
  Object.keys(optimizerConfig).sort()
11546
7576
  );
11547
- if (!hasProperty(groups, serialized)) {
7577
+ if (!(0,external_api_cjs_namespaceObject.hasProperty)(groups, serialized)) {
11548
7578
  groups[serialized] = {
11549
7579
  key: "group" + key.toString().padStart(3, "0"),
11550
7580
  optimizerConfig,
@@ -11559,10 +7589,10 @@ async function get_jungle(jungles, options) {
11559
7589
  options = options || {};
11560
7590
  jungles = jungles
11561
7591
  .split(";")
11562
- .map((jungle) => external_path_.resolve(options.workspace || "./", jungle));
7592
+ .map((jungle) => external_path_namespaceObject.resolve(options.workspace || "./", jungle));
11563
7593
  const data = await process_jungles(jungles);
11564
7594
  const manifest_node = resolve_node_by_path(data, ["project", "manifest"]);
11565
- if (!manifest_node) throw "No manifest found!";
7595
+ if (!manifest_node) throw new Error("No manifest found!");
11566
7596
  const manifest = resolve_filename(manifest_node[0]);
11567
7597
  const xml = await readManifest(manifest);
11568
7598
  const targets = [];
@@ -11578,25 +7608,46 @@ async function get_jungle(jungles, options) {
11578
7608
  return { manifest, targets };
11579
7609
  }
11580
7610
 
7611
+ ;// CONCATENATED MODULE: external "child_process"
7612
+ const external_child_process_namespaceObject = require("child_process");
11581
7613
  ;// CONCATENATED MODULE: ./src/launch.js
11582
7614
 
11583
7615
 
11584
7616
 
11585
7617
 
11586
7618
  function launchSimulator() {
11587
- return getSdkPath().then((sdk) => {
7619
+ return (0,external_util_cjs_namespaceObject.getSdkPath)().then((sdk) => {
11588
7620
  const child = (0,external_child_process_namespaceObject.execFile)(
11589
- external_path_.resolve(sdk, "bin", isWin ? "simulator" : "connectiq")
7621
+ external_path_namespaceObject.resolve(sdk, "bin", external_util_cjs_namespaceObject.isWin ? "simulator" : "connectiq")
11590
7622
  );
11591
7623
  child.unref();
11592
7624
  });
11593
7625
  }
11594
7626
 
7627
+ ;// CONCATENATED MODULE: external "@markw65/prettier-plugin-monkeyc"
7628
+ const prettier_plugin_monkeyc_namespaceObject = require("@markw65/prettier-plugin-monkeyc");
11595
7629
  ;// CONCATENATED MODULE: ./src/mc-rewrite.js
11596
7630
 
11597
7631
 
11598
7632
 
11599
7633
 
7634
+
7635
+ function processImports(allImports, lookup) {
7636
+ allImports.forEach(({ node, stack }) => {
7637
+ const [name, module] = lookup(node.id, node.as && node.as.id.name, stack);
7638
+ if (name && module) {
7639
+ const [parent] = stack.slice(-1);
7640
+ if (!parent.decls) parent.decls = {};
7641
+ if (!(0,external_api_cjs_namespaceObject.hasProperty)(parent.decls, name)) parent.decls[name] = [];
7642
+ module.forEach((m) => {
7643
+ if (m.type == "ModuleDeclaration") {
7644
+ (0,external_util_cjs_namespaceObject.pushUnique)(parent.decls[name], m);
7645
+ }
7646
+ });
7647
+ }
7648
+ });
7649
+ }
7650
+
11600
7651
  function collectClassInfo(state) {
11601
7652
  state.allClasses.forEach((elm) => {
11602
7653
  if (elm.node.superClass) {
@@ -11614,7 +7665,7 @@ function collectClassInfo(state) {
11614
7665
  scls.forEach((c) => {
11615
7666
  Object.values(c.decls).forEach((f) => {
11616
7667
  if (f.type == "FunctionDeclaration") {
11617
- if (hasProperty(cls.decls, f.name)) {
7668
+ if ((0,external_api_cjs_namespaceObject.hasProperty)(cls.decls, f.name)) {
11618
7669
  f.hasOverride = true;
11619
7670
  }
11620
7671
  }
@@ -11640,13 +7691,14 @@ async function analyze(fileNames, buildConfig) {
11640
7691
  node.attrs.attrs.filter((attr) => {
11641
7692
  if (attr.type != "UnaryExpression") return false;
11642
7693
  if (attr.argument.type != "Identifier") return false;
11643
- return hasProperty(excludeAnnotations, attr.argument.name);
7694
+ return (0,external_api_cjs_namespaceObject.hasProperty)(excludeAnnotations, attr.argument.name);
11644
7695
  }).length
11645
7696
  ) {
11646
7697
  return true;
11647
7698
  }
11648
7699
  }
11649
7700
  };
7701
+ const allImports = [];
11650
7702
  const state = {
11651
7703
  allFunctions: [],
11652
7704
  allClasses: [],
@@ -11671,12 +7723,17 @@ async function analyze(fileNames, buildConfig) {
11671
7723
  ? state.allFunctions
11672
7724
  : state.allClasses
11673
7725
  ).push(scope);
7726
+ return;
11674
7727
  }
7728
+ case "Using":
7729
+ case "ImportModule":
7730
+ allImports.push({ node, stack: state.stack.slice() });
7731
+ return;
11675
7732
  }
11676
7733
  },
11677
7734
  };
11678
7735
 
11679
- await getApiMapping(state);
7736
+ await (0,external_api_cjs_namespaceObject.getApiMapping)(state);
11680
7737
 
11681
7738
  // Mark all functions from api.mir as "special" by
11682
7739
  // setting their bodies to null. In api.mir, they're
@@ -11705,14 +7762,16 @@ async function analyze(fileNames, buildConfig) {
11705
7762
  f.ast = prettier_plugin_monkeyc_namespaceObject.parsers.monkeyc.parse(f.monkeyCSource, {
11706
7763
  grammarSource: f.name,
11707
7764
  });
7765
+ f.ast.source = f.name;
11708
7766
  f.ast.monkeyCSource = f.monkeyCSource;
11709
7767
  delete f.monkeyCSource;
11710
- collectNamespaces(f.ast, state);
7768
+ (0,external_api_cjs_namespaceObject.collectNamespaces)(f.ast, state);
11711
7769
  });
11712
7770
 
11713
7771
  delete state.pre;
11714
7772
  delete state.post;
11715
7773
 
7774
+ processImports(allImports, state.lookup);
11716
7775
  collectClassInfo(state);
11717
7776
 
11718
7777
  return { files, state };
@@ -11777,7 +7836,7 @@ function getNodeValue(node) {
11777
7836
  }
11778
7837
  let type = node.value === null ? "Null" : typeof node.value;
11779
7838
  if (type === "number") {
11780
- const match = LiteralIntegerRe.exec(node.raw);
7839
+ const match = external_api_cjs_namespaceObject.LiteralIntegerRe.exec(node.raw);
11781
7840
  if (match) {
11782
7841
  type = match[2] == "l" ? "Long" : "Number";
11783
7842
  } else if (node.raw.endsWith("d")) {
@@ -11886,7 +7945,7 @@ function evaluateFunction(func, args) {
11886
7945
  let ret = null;
11887
7946
  const body = args ? JSON.parse(JSON.stringify(func.body)) : func.body;
11888
7947
  try {
11889
- traverseAst(
7948
+ (0,external_api_cjs_namespaceObject.traverseAst)(
11890
7949
  body,
11891
7950
  (node) => {
11892
7951
  switch (node.type) {
@@ -11898,7 +7957,7 @@ function evaluateFunction(func, args) {
11898
7957
  case "Identifier":
11899
7958
  return;
11900
7959
  default:
11901
- throw "Bad node type";
7960
+ throw new Error("Bad node type");
11902
7961
  }
11903
7962
  },
11904
7963
  args &&
@@ -11911,14 +7970,14 @@ function evaluateFunction(func, args) {
11911
7970
  case "Literal":
11912
7971
  return;
11913
7972
  case "Identifier":
11914
- if (hasProperty(paramValues, node.name)) {
7973
+ if ((0,external_api_cjs_namespaceObject.hasProperty)(paramValues, node.name)) {
11915
7974
  return paramValues[node.name];
11916
7975
  }
11917
7976
  // fall through;
11918
7977
  default: {
11919
7978
  const repl = optimizeNode(node);
11920
7979
  if (repl && repl.type === "Literal") return repl;
11921
- throw "Didn't optimize";
7980
+ throw new Error("Didn't optimize");
11922
7981
  }
11923
7982
  }
11924
7983
  })
@@ -11969,8 +8028,8 @@ async function optimizeMonkeyC(fileNames, buildConfig) {
11969
8028
  // this is an api.mir function. It can be called
11970
8029
  return true;
11971
8030
  }
11972
- if (hasProperty(state.exposed, func.id.name)) return true;
11973
- if (hasProperty(state.calledFunctions, func.id.name)) {
8031
+ if ((0,external_api_cjs_namespaceObject.hasProperty)(state.exposed, func.id.name)) return true;
8032
+ if ((0,external_api_cjs_namespaceObject.hasProperty)(state.calledFunctions, func.id.name)) {
11974
8033
  return (
11975
8034
  state.calledFunctions[func.id.name].find((f) => f === func) !== null
11976
8035
  );
@@ -11984,7 +8043,7 @@ async function optimizeMonkeyC(fileNames, buildConfig) {
11984
8043
  elm.superClass === true ||
11985
8044
  elm.superClass.some(
11986
8045
  (sc) =>
11987
- (hasProperty(sc.decls, name) &&
8046
+ ((0,external_api_cjs_namespaceObject.hasProperty)(sc.decls, name) &&
11988
8047
  sc.decls[name].some(
11989
8048
  (f) => f.type == "FunctionDeclaration" && maybeCalled(f)
11990
8049
  )) ||
@@ -12013,7 +8072,7 @@ async function optimizeMonkeyC(fileNames, buildConfig) {
12013
8072
  }
12014
8073
  break;
12015
8074
  case "Identifier": {
12016
- if (hasProperty(state.index, node.name)) {
8075
+ if ((0,external_api_cjs_namespaceObject.hasProperty)(state.index, node.name)) {
12017
8076
  if (!lookupAndReplace(node)) {
12018
8077
  state.exposed[node.name] = true;
12019
8078
  }
@@ -12022,7 +8081,7 @@ async function optimizeMonkeyC(fileNames, buildConfig) {
12022
8081
  }
12023
8082
  case "MemberExpression":
12024
8083
  if (node.property.type === "Identifier" && !node.computed) {
12025
- if (hasProperty(state.index, node.property.name)) {
8084
+ if ((0,external_api_cjs_namespaceObject.hasProperty)(state.index, node.property.name)) {
12026
8085
  if (lookupAndReplace(node)) {
12027
8086
  return false;
12028
8087
  } else {
@@ -12041,7 +8100,7 @@ async function optimizeMonkeyC(fileNames, buildConfig) {
12041
8100
  used = checkInherited(parent, node.id.name);
12042
8101
  }
12043
8102
  if (used) {
12044
- if (!hasProperty(state.calledFunctions, node.id.name)) {
8103
+ if (!(0,external_api_cjs_namespaceObject.hasProperty)(state.calledFunctions, node.id.name)) {
12045
8104
  state.calledFunctions[node.id.name] = [];
12046
8105
  }
12047
8106
  state.calledFunctions[node.id.name].push(node);
@@ -12066,7 +8125,7 @@ async function optimizeMonkeyC(fileNames, buildConfig) {
12066
8125
  if (n) {
12067
8126
  state.exposed[n] = true;
12068
8127
  } else {
12069
- throw "What?";
8128
+ throw new Error("What?");
12070
8129
  }
12071
8130
  return;
12072
8131
  }
@@ -12084,25 +8143,25 @@ async function optimizeMonkeyC(fileNames, buildConfig) {
12084
8143
  }
12085
8144
  }
12086
8145
  }
12087
- if (!hasProperty(state.calledFunctions, name)) {
8146
+ if (!(0,external_api_cjs_namespaceObject.hasProperty)(state.calledFunctions, name)) {
12088
8147
  state.calledFunctions[name] = [];
12089
8148
  }
12090
8149
  callees.forEach((c) => state.calledFunctions[name].push(c.node));
12091
8150
  }
12092
8151
  };
12093
8152
  files.forEach((f) => {
12094
- collectNamespaces(f.ast, state);
8153
+ (0,external_api_cjs_namespaceObject.collectNamespaces)(f.ast, state);
12095
8154
  });
12096
8155
  files.forEach((f) => {
12097
- traverseAst(f.ast, null, (node) => {
8156
+ (0,external_api_cjs_namespaceObject.traverseAst)(f.ast, null, (node) => {
12098
8157
  switch (node.type) {
12099
8158
  case "EnumStringBody":
12100
8159
  if (
12101
8160
  node.members.every((m) => {
12102
8161
  const name = m.name || m.id.name;
12103
8162
  return (
12104
- hasProperty(state.index, name) &&
12105
- !hasProperty(state.exposed, name)
8163
+ (0,external_api_cjs_namespaceObject.hasProperty)(state.index, name) &&
8164
+ !(0,external_api_cjs_namespaceObject.hasProperty)(state.exposed, name)
12106
8165
  );
12107
8166
  })
12108
8167
  ) {
@@ -12111,7 +8170,9 @@ async function optimizeMonkeyC(fileNames, buildConfig) {
12111
8170
  node.members.map((m) => {
12112
8171
  if (!m.init) return "Number";
12113
8172
  const [node, type] = getNodeValue(m.init);
12114
- if (!node) throw "Failed to get type for eliminated enum";
8173
+ if (!node) {
8174
+ throw new Error("Failed to get type for eliminated enum");
8175
+ }
12115
8176
  return type;
12116
8177
  })
12117
8178
  ),
@@ -12123,7 +8184,7 @@ async function optimizeMonkeyC(fileNames, buildConfig) {
12123
8184
  if (!node.body.members.length) {
12124
8185
  if (!node.id) return false;
12125
8186
  if (!node.body.enumType) {
12126
- throw "Missing enumType on optimized enum";
8187
+ throw new Error("Missing enumType on optimized enum");
12127
8188
  }
12128
8189
  replace(node, {
12129
8190
  type: "TypedefDeclaration",
@@ -12140,8 +8201,8 @@ async function optimizeMonkeyC(fileNames, buildConfig) {
12140
8201
  case "VariableDeclaration": {
12141
8202
  node.declarations = node.declarations.filter(
12142
8203
  (d) =>
12143
- !hasProperty(state.index, d.id.name) ||
12144
- hasProperty(state.exposed, d.id.name)
8204
+ !(0,external_api_cjs_namespaceObject.hasProperty)(state.index, d.id.name) ||
8205
+ (0,external_api_cjs_namespaceObject.hasProperty)(state.exposed, d.id.name)
12145
8206
  );
12146
8207
  if (!node.declarations.length) {
12147
8208
  return false;
@@ -12204,7 +8265,7 @@ async function getConfig(options) {
12204
8265
  if (config[key]) return;
12205
8266
  if (!promise) {
12206
8267
  promise = Promise.resolve()
12207
- .then(() => getVSCodeSettings(`${appSupport}/Code/User/settings.json`))
8268
+ .then(() => getVSCodeSettings(`${external_util_cjs_namespaceObject.appSupport}/Code/User/settings.json`))
12208
8269
  .then((globals) =>
12209
8270
  getVSCodeSettings(`${config.workspace}/.vscode/settings.json`).then(
12210
8271
  (locals) => ({ ...globals, ...locals })
@@ -12233,16 +8294,16 @@ async function buildOptimizedProject(product, options) {
12233
8294
  let name = `optimized-${program}.prg`;
12234
8295
  if (product) {
12235
8296
  if (config.simulatorBuild === false) {
12236
- bin = external_path_.join(bin, product);
8297
+ bin = external_path_namespaceObject.join(bin, product);
12237
8298
  }
12238
8299
  } else {
12239
- bin = external_path_.join(bin, "exported");
8300
+ bin = external_path_namespaceObject.join(bin, "exported");
12240
8301
  name = `${program}.iq`;
12241
- if (!hasProperty(config, "releaseBuild")) {
8302
+ if (!(0,external_api_cjs_namespaceObject.hasProperty)(config, "releaseBuild")) {
12242
8303
  config.releaseBuild = true;
12243
8304
  }
12244
8305
  }
12245
- config.program = external_path_.join(bin, name);
8306
+ config.program = external_path_namespaceObject.join(bin, name);
12246
8307
  return build_project(product, config);
12247
8308
  }
12248
8309
 
@@ -12253,7 +8314,7 @@ async function generateOptimizedProject(options) {
12253
8314
  const { manifest, targets } = await get_jungle(config.jungleFiles, config);
12254
8315
  const buildConfigs = {};
12255
8316
  targets.forEach((p) => {
12256
- if (!hasProperty(buildConfigs, p.group.key)) {
8317
+ if (!(0,external_api_cjs_namespaceObject.hasProperty)(buildConfigs, p.group.key)) {
12257
8318
  buildConfigs[p.group.key] = null;
12258
8319
  }
12259
8320
  if (!options.products || options.products.includes(p.product)) {
@@ -12263,14 +8324,14 @@ async function generateOptimizedProject(options) {
12263
8324
 
12264
8325
  // console.log(JSON.stringify(targets));
12265
8326
 
12266
- const jungle_dir = external_path_.resolve(workspace, config.outputPath);
8327
+ const jungle_dir = external_path_namespaceObject.resolve(workspace, config.outputPath);
12267
8328
  await promises_namespaceObject.mkdir(jungle_dir, { recursive: true });
12268
8329
 
12269
8330
  const promises = Object.keys(buildConfigs)
12270
8331
  .sort()
12271
8332
  .map((key) => {
12272
8333
  const buildConfig = buildConfigs[key];
12273
- const outputPath = external_path_.join(config.outputPath, key);
8334
+ const outputPath = external_path_namespaceObject.join(config.outputPath, key);
12274
8335
 
12275
8336
  return buildConfig
12276
8337
  ? generateOneConfig({
@@ -12278,13 +8339,13 @@ async function generateOptimizedProject(options) {
12278
8339
  buildConfig,
12279
8340
  outputPath,
12280
8341
  })
12281
- : promises_namespaceObject.rm(external_path_.resolve(workspace, outputPath), {
8342
+ : promises_namespaceObject.rm(external_path_namespaceObject.resolve(workspace, outputPath), {
12282
8343
  recursive: true,
12283
8344
  force: true,
12284
8345
  });
12285
8346
  });
12286
8347
 
12287
- const relative_path = (s) => external_path_.relative(jungle_dir, s);
8348
+ const relative_path = (s) => external_path_namespaceObject.relative(jungle_dir, s);
12288
8349
  const parts = [`project.manifest=${relative_path(manifest)}`];
12289
8350
  const process_field = (prefix, base, name, map) =>
12290
8351
  base[name] &&
@@ -12297,7 +8358,7 @@ async function generateOptimizedProject(options) {
12297
8358
  const { product, qualifier, group } = jungle;
12298
8359
  const prefix = `${product}.`;
12299
8360
  process_field(prefix, qualifier, "sourcePath", (s) =>
12300
- external_path_.join(group.key.toString(), external_path_.relative(workspace, s))
8361
+ external_path_namespaceObject.join(group.key.toString(), external_path_namespaceObject.relative(workspace, s))
12301
8362
  .replace(/(\/\*\*)\/\*/g, "$1")
12302
8363
  );
12303
8364
  process_field(prefix, qualifier, "resourcePath", relative_path);
@@ -12311,20 +8372,20 @@ async function generateOptimizedProject(options) {
12311
8372
  }
12312
8373
  });
12313
8374
 
12314
- const jungleFiles = external_path_.join(jungle_dir, "monkey.jungle");
8375
+ const jungleFiles = external_path_namespaceObject.join(jungle_dir, "monkey.jungle");
12315
8376
  promises.push(promises_namespaceObject.writeFile(jungleFiles, parts.join("\n")));
12316
8377
  await Promise.all(promises);
12317
- return { jungleFiles, program: external_path_.basename(external_path_.dirname(manifest)) };
8378
+ return { jungleFiles, program: external_path_namespaceObject.basename(external_path_namespaceObject.dirname(manifest)) };
12318
8379
  }
12319
8380
 
12320
8381
  async function generateOneConfig(config) {
12321
8382
  const { workspace, buildConfig } = config;
12322
- const output = external_path_.join(workspace, config.outputPath);
8383
+ const output = external_path_namespaceObject.join(workspace, config.outputPath);
12323
8384
 
12324
8385
  const paths = (
12325
8386
  await Promise.all(
12326
8387
  buildConfig.sourcePath.map((pattern) =>
12327
- globa(pattern, { cwd: workspace, mark: true })
8388
+ (0,external_util_cjs_namespaceObject.globa)(pattern, { cwd: workspace, mark: true })
12328
8389
  )
12329
8390
  )
12330
8391
  ).flat();
@@ -12333,24 +8394,24 @@ async function generateOneConfig(config) {
12333
8394
  await Promise.all(
12334
8395
  paths.map((path) =>
12335
8396
  path.endsWith("/")
12336
- ? globa(`${path}**/*.mc`, { cwd: workspace, mark: true })
8397
+ ? (0,external_util_cjs_namespaceObject.globa)(`${path}**/*.mc`, { cwd: workspace, mark: true })
12337
8398
  : path
12338
8399
  )
12339
8400
  )
12340
8401
  )
12341
8402
  .flat()
12342
8403
  .filter((file) => !file.endsWith("/"))
12343
- .map((file) => external_path_.relative(workspace, file))
8404
+ .map((file) => external_path_namespaceObject.relative(workspace, file))
12344
8405
  .filter((file) => !file.startsWith("bin"));
12345
8406
 
12346
8407
  const fnMap = Object.fromEntries(
12347
8408
  files
12348
8409
  .filter((src) => /\.mc$/.test(src))
12349
- .map((file) => [external_path_.join(workspace, file), external_path_.join(output, file)])
8410
+ .map((file) => [external_path_namespaceObject.join(workspace, file), external_path_namespaceObject.join(output, file)])
12350
8411
  );
12351
8412
 
12352
- const source_time = await last_modified(Object.keys(fnMap));
12353
- const opt_time = await first_modified(Object.values(fnMap));
8413
+ const source_time = await (0,external_util_cjs_namespaceObject.last_modified)(Object.keys(fnMap));
8414
+ const opt_time = await (0,external_util_cjs_namespaceObject.first_modified)(Object.values(fnMap));
12354
8415
  if (source_time < opt_time) return;
12355
8416
 
12356
8417
  await promises_namespaceObject.rm(output, { recursive: true, force: true });
@@ -12359,10 +8420,10 @@ async function generateOneConfig(config) {
12359
8420
  return await Promise.all(
12360
8421
  optFiles.map(async (file) => {
12361
8422
  const name = fnMap[file.name];
12362
- const dir = external_path_.dirname(name);
8423
+ const dir = external_path_namespaceObject.dirname(name);
12363
8424
  await promises_namespaceObject.mkdir(dir, { recursive: true });
12364
8425
 
12365
- const opt_source = formatAst(file.ast);
8426
+ const opt_source = (0,external_api_cjs_namespaceObject.formatAst)(file.ast);
12366
8427
  await promises_namespaceObject.writeFile(name, opt_source);
12367
8428
  return name;
12368
8429
  })
@@ -12372,13 +8433,13 @@ async function generateOneConfig(config) {
12372
8433
  async function generateApiMirTests(options) {
12373
8434
  const config = { ...defaultConfig, ...(options || {}) };
12374
8435
  const tests = [];
12375
- const api = await getApiMapping();
8436
+ const api = await (0,external_api_cjs_namespaceObject.getApiMapping)();
12376
8437
  const findConstants = (node) => {
12377
8438
  Object.entries(node.decls).forEach(([key, decl]) => {
12378
8439
  if (decl.length > 1) throw `Bad decl length:${node.fullName}.${key}`;
12379
8440
  if (decl.length != 1) return;
12380
8441
  if (decl[0].type == "Literal") {
12381
- tests.push([`${node.fullName}.${key}`, formatAst(decl[0])]);
8442
+ tests.push([`${node.fullName}.${key}`, (0,external_api_cjs_namespaceObject.formatAst)(decl[0])]);
12382
8443
  } else if (decl[0].decls) {
12383
8444
  findConstants(decl[0]);
12384
8445
  }