buddy-agent-harness 0.8.0 → 0.9.1
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.
- package/.claude-plugin/plugin.json +1 -1
- package/.codex-plugin/plugin.json +1 -1
- package/.cursor-plugin/plugin.json +1 -1
- package/dist/cli.mjs +19029 -1
- package/dist/dist-ktNZ1sJo.mjs +2966 -0
- package/dist/esm-BMqwcD7W.mjs +87 -0
- package/dist/esm-CVacKtt6.mjs +64 -0
- package/dist/index.d.mts +15 -2
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +2727 -1
- package/dist/index.mjs.map +1 -0
- package/dist/skill-scripts/doctor.mjs +300 -0
- package/dist/skill-scripts/init.mjs +300 -0
- package/package.json +3 -2
- package/plugin.json +1 -1
- package/skills/doctor/SKILL.md +1 -1
- package/skills/doctor/scripts/doctor.mjs +299 -13
- package/skills/enhance/SKILL.md +54 -10
- package/skills/enhance/references/delegation.history.md +15 -0
- package/skills/enhance/references/delegation.md +63 -0
- package/skills/init/SKILL.md +1 -1
- package/skills/init/scripts/doctor.mjs +299 -13
- package/skills/init/scripts/init.mjs +299 -13
- package/skills/repair/SKILL.md +1 -1
- package/skills/repair/scripts/doctor.mjs +299 -13
- package/src/cli.ts +10 -2
- package/src/diagnose-bridges/doctor-guidance.ts +45 -26
- package/src/skill-scripts/doctor.ts +11 -0
- package/src/skill-scripts/init.ts +10 -0
- package/src/skill-scripts/launchers.ts +15 -0
- package/dist/cli-4ekejn5W.mjs +0 -2735
- package/dist/cli-4ekejn5W.mjs.map +0 -1
- package/dist/cli.d.mts +0 -15
- package/dist/cli.d.mts.map +0 -1
|
@@ -0,0 +1,2966 @@
|
|
|
1
|
+
import { a as __toESM, i as __require, n as unpartial, r as __commonJSMin } from "./esm-CVacKtt6.mjs";
|
|
2
|
+
import { createRequire } from "node:module";
|
|
3
|
+
import fs from "node:fs";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
//#region ../../node_modules/.pnpm/fs.realpath@1.0.0/node_modules/fs.realpath/old.js
|
|
6
|
+
var require_old = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
7
|
+
var pathModule = __require("path");
|
|
8
|
+
var isWindows = process.platform === "win32";
|
|
9
|
+
var fs$6 = __require("fs");
|
|
10
|
+
var DEBUG = process.env.NODE_DEBUG && /fs/.test(process.env.NODE_DEBUG);
|
|
11
|
+
function rethrow() {
|
|
12
|
+
var callback;
|
|
13
|
+
if (DEBUG) {
|
|
14
|
+
var backtrace = /* @__PURE__ */ new Error();
|
|
15
|
+
callback = debugCallback;
|
|
16
|
+
} else callback = missingCallback;
|
|
17
|
+
return callback;
|
|
18
|
+
function debugCallback(err) {
|
|
19
|
+
if (err) {
|
|
20
|
+
backtrace.message = err.message;
|
|
21
|
+
err = backtrace;
|
|
22
|
+
missingCallback(err);
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
function missingCallback(err) {
|
|
26
|
+
if (err) {
|
|
27
|
+
if (process.throwDeprecation) throw err;
|
|
28
|
+
else if (!process.noDeprecation) {
|
|
29
|
+
var msg = "fs: missing callback " + (err.stack || err.message);
|
|
30
|
+
if (process.traceDeprecation) console.trace(msg);
|
|
31
|
+
else console.error(msg);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
function maybeCallback(cb) {
|
|
37
|
+
return typeof cb === "function" ? cb : rethrow();
|
|
38
|
+
}
|
|
39
|
+
pathModule.normalize;
|
|
40
|
+
if (isWindows) var nextPartRe = /(.*?)(?:[\/\\]+|$)/g;
|
|
41
|
+
else var nextPartRe = /(.*?)(?:[\/]+|$)/g;
|
|
42
|
+
if (isWindows) var splitRootRe = /^(?:[a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/][^\\\/]+)?[\\\/]*/;
|
|
43
|
+
else var splitRootRe = /^[\/]*/;
|
|
44
|
+
exports.realpathSync = function realpathSync(p, cache) {
|
|
45
|
+
p = pathModule.resolve(p);
|
|
46
|
+
if (cache && Object.prototype.hasOwnProperty.call(cache, p)) return cache[p];
|
|
47
|
+
var original = p, seenLinks = {}, knownHard = {};
|
|
48
|
+
var pos;
|
|
49
|
+
var current;
|
|
50
|
+
var base;
|
|
51
|
+
var previous;
|
|
52
|
+
start();
|
|
53
|
+
function start() {
|
|
54
|
+
var m = splitRootRe.exec(p);
|
|
55
|
+
pos = m[0].length;
|
|
56
|
+
current = m[0];
|
|
57
|
+
base = m[0];
|
|
58
|
+
previous = "";
|
|
59
|
+
if (isWindows && !knownHard[base]) {
|
|
60
|
+
fs$6.lstatSync(base);
|
|
61
|
+
knownHard[base] = true;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
while (pos < p.length) {
|
|
65
|
+
nextPartRe.lastIndex = pos;
|
|
66
|
+
var result = nextPartRe.exec(p);
|
|
67
|
+
previous = current;
|
|
68
|
+
current += result[0];
|
|
69
|
+
base = previous + result[1];
|
|
70
|
+
pos = nextPartRe.lastIndex;
|
|
71
|
+
if (knownHard[base] || cache && cache[base] === base) continue;
|
|
72
|
+
var resolvedLink;
|
|
73
|
+
if (cache && Object.prototype.hasOwnProperty.call(cache, base)) resolvedLink = cache[base];
|
|
74
|
+
else {
|
|
75
|
+
var stat = fs$6.lstatSync(base);
|
|
76
|
+
if (!stat.isSymbolicLink()) {
|
|
77
|
+
knownHard[base] = true;
|
|
78
|
+
if (cache) cache[base] = base;
|
|
79
|
+
continue;
|
|
80
|
+
}
|
|
81
|
+
var linkTarget = null;
|
|
82
|
+
if (!isWindows) {
|
|
83
|
+
var id = stat.dev.toString(32) + ":" + stat.ino.toString(32);
|
|
84
|
+
if (seenLinks.hasOwnProperty(id)) linkTarget = seenLinks[id];
|
|
85
|
+
}
|
|
86
|
+
if (linkTarget === null) {
|
|
87
|
+
fs$6.statSync(base);
|
|
88
|
+
linkTarget = fs$6.readlinkSync(base);
|
|
89
|
+
}
|
|
90
|
+
resolvedLink = pathModule.resolve(previous, linkTarget);
|
|
91
|
+
if (cache) cache[base] = resolvedLink;
|
|
92
|
+
if (!isWindows) seenLinks[id] = linkTarget;
|
|
93
|
+
}
|
|
94
|
+
p = pathModule.resolve(resolvedLink, p.slice(pos));
|
|
95
|
+
start();
|
|
96
|
+
}
|
|
97
|
+
if (cache) cache[original] = p;
|
|
98
|
+
return p;
|
|
99
|
+
};
|
|
100
|
+
exports.realpath = function realpath(p, cache, cb) {
|
|
101
|
+
if (typeof cb !== "function") {
|
|
102
|
+
cb = maybeCallback(cache);
|
|
103
|
+
cache = null;
|
|
104
|
+
}
|
|
105
|
+
p = pathModule.resolve(p);
|
|
106
|
+
if (cache && Object.prototype.hasOwnProperty.call(cache, p)) return process.nextTick(cb.bind(null, null, cache[p]));
|
|
107
|
+
var original = p, seenLinks = {}, knownHard = {};
|
|
108
|
+
var pos;
|
|
109
|
+
var current;
|
|
110
|
+
var base;
|
|
111
|
+
var previous;
|
|
112
|
+
start();
|
|
113
|
+
function start() {
|
|
114
|
+
var m = splitRootRe.exec(p);
|
|
115
|
+
pos = m[0].length;
|
|
116
|
+
current = m[0];
|
|
117
|
+
base = m[0];
|
|
118
|
+
previous = "";
|
|
119
|
+
if (isWindows && !knownHard[base]) fs$6.lstat(base, function(err) {
|
|
120
|
+
if (err) return cb(err);
|
|
121
|
+
knownHard[base] = true;
|
|
122
|
+
LOOP();
|
|
123
|
+
});
|
|
124
|
+
else process.nextTick(LOOP);
|
|
125
|
+
}
|
|
126
|
+
function LOOP() {
|
|
127
|
+
if (pos >= p.length) {
|
|
128
|
+
if (cache) cache[original] = p;
|
|
129
|
+
return cb(null, p);
|
|
130
|
+
}
|
|
131
|
+
nextPartRe.lastIndex = pos;
|
|
132
|
+
var result = nextPartRe.exec(p);
|
|
133
|
+
previous = current;
|
|
134
|
+
current += result[0];
|
|
135
|
+
base = previous + result[1];
|
|
136
|
+
pos = nextPartRe.lastIndex;
|
|
137
|
+
if (knownHard[base] || cache && cache[base] === base) return process.nextTick(LOOP);
|
|
138
|
+
if (cache && Object.prototype.hasOwnProperty.call(cache, base)) return gotResolvedLink(cache[base]);
|
|
139
|
+
return fs$6.lstat(base, gotStat);
|
|
140
|
+
}
|
|
141
|
+
function gotStat(err, stat) {
|
|
142
|
+
if (err) return cb(err);
|
|
143
|
+
if (!stat.isSymbolicLink()) {
|
|
144
|
+
knownHard[base] = true;
|
|
145
|
+
if (cache) cache[base] = base;
|
|
146
|
+
return process.nextTick(LOOP);
|
|
147
|
+
}
|
|
148
|
+
if (!isWindows) {
|
|
149
|
+
var id = stat.dev.toString(32) + ":" + stat.ino.toString(32);
|
|
150
|
+
if (seenLinks.hasOwnProperty(id)) return gotTarget(null, seenLinks[id], base);
|
|
151
|
+
}
|
|
152
|
+
fs$6.stat(base, function(err) {
|
|
153
|
+
if (err) return cb(err);
|
|
154
|
+
fs$6.readlink(base, function(err, target) {
|
|
155
|
+
if (!isWindows) seenLinks[id] = target;
|
|
156
|
+
gotTarget(err, target);
|
|
157
|
+
});
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
function gotTarget(err, target, base) {
|
|
161
|
+
if (err) return cb(err);
|
|
162
|
+
var resolvedLink = pathModule.resolve(previous, target);
|
|
163
|
+
if (cache) cache[base] = resolvedLink;
|
|
164
|
+
gotResolvedLink(resolvedLink);
|
|
165
|
+
}
|
|
166
|
+
function gotResolvedLink(resolvedLink) {
|
|
167
|
+
p = pathModule.resolve(resolvedLink, p.slice(pos));
|
|
168
|
+
start();
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
}));
|
|
172
|
+
//#endregion
|
|
173
|
+
//#region ../../node_modules/.pnpm/fs.realpath@1.0.0/node_modules/fs.realpath/index.js
|
|
174
|
+
var require_fs_realpath = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
175
|
+
module.exports = realpath;
|
|
176
|
+
realpath.realpath = realpath;
|
|
177
|
+
realpath.sync = realpathSync;
|
|
178
|
+
realpath.realpathSync = realpathSync;
|
|
179
|
+
realpath.monkeypatch = monkeypatch;
|
|
180
|
+
realpath.unmonkeypatch = unmonkeypatch;
|
|
181
|
+
var fs$5 = __require("fs");
|
|
182
|
+
var origRealpath = fs$5.realpath;
|
|
183
|
+
var origRealpathSync = fs$5.realpathSync;
|
|
184
|
+
var version = process.version;
|
|
185
|
+
var ok = /^v[0-5]\./.test(version);
|
|
186
|
+
var old = require_old();
|
|
187
|
+
function newError(er) {
|
|
188
|
+
return er && er.syscall === "realpath" && (er.code === "ELOOP" || er.code === "ENOMEM" || er.code === "ENAMETOOLONG");
|
|
189
|
+
}
|
|
190
|
+
function realpath(p, cache, cb) {
|
|
191
|
+
if (ok) return origRealpath(p, cache, cb);
|
|
192
|
+
if (typeof cache === "function") {
|
|
193
|
+
cb = cache;
|
|
194
|
+
cache = null;
|
|
195
|
+
}
|
|
196
|
+
origRealpath(p, cache, function(er, result) {
|
|
197
|
+
if (newError(er)) old.realpath(p, cache, cb);
|
|
198
|
+
else cb(er, result);
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
function realpathSync(p, cache) {
|
|
202
|
+
if (ok) return origRealpathSync(p, cache);
|
|
203
|
+
try {
|
|
204
|
+
return origRealpathSync(p, cache);
|
|
205
|
+
} catch (er) {
|
|
206
|
+
if (newError(er)) return old.realpathSync(p, cache);
|
|
207
|
+
else throw er;
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
function monkeypatch() {
|
|
211
|
+
fs$5.realpath = realpath;
|
|
212
|
+
fs$5.realpathSync = realpathSync;
|
|
213
|
+
}
|
|
214
|
+
function unmonkeypatch() {
|
|
215
|
+
fs$5.realpath = origRealpath;
|
|
216
|
+
fs$5.realpathSync = origRealpathSync;
|
|
217
|
+
}
|
|
218
|
+
}));
|
|
219
|
+
//#endregion
|
|
220
|
+
//#region ../../node_modules/.pnpm/concat-map@0.0.1/node_modules/concat-map/index.js
|
|
221
|
+
var require_concat_map = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
222
|
+
module.exports = function(xs, fn) {
|
|
223
|
+
var res = [];
|
|
224
|
+
for (var i = 0; i < xs.length; i++) {
|
|
225
|
+
var x = fn(xs[i], i);
|
|
226
|
+
if (isArray(x)) res.push.apply(res, x);
|
|
227
|
+
else res.push(x);
|
|
228
|
+
}
|
|
229
|
+
return res;
|
|
230
|
+
};
|
|
231
|
+
var isArray = Array.isArray || function(xs) {
|
|
232
|
+
return Object.prototype.toString.call(xs) === "[object Array]";
|
|
233
|
+
};
|
|
234
|
+
}));
|
|
235
|
+
//#endregion
|
|
236
|
+
//#region ../../node_modules/.pnpm/balanced-match@1.0.2/node_modules/balanced-match/index.js
|
|
237
|
+
var require_balanced_match = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
238
|
+
module.exports = balanced;
|
|
239
|
+
function balanced(a, b, str) {
|
|
240
|
+
if (a instanceof RegExp) a = maybeMatch(a, str);
|
|
241
|
+
if (b instanceof RegExp) b = maybeMatch(b, str);
|
|
242
|
+
var r = range(a, b, str);
|
|
243
|
+
return r && {
|
|
244
|
+
start: r[0],
|
|
245
|
+
end: r[1],
|
|
246
|
+
pre: str.slice(0, r[0]),
|
|
247
|
+
body: str.slice(r[0] + a.length, r[1]),
|
|
248
|
+
post: str.slice(r[1] + b.length)
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
function maybeMatch(reg, str) {
|
|
252
|
+
var m = str.match(reg);
|
|
253
|
+
return m ? m[0] : null;
|
|
254
|
+
}
|
|
255
|
+
balanced.range = range;
|
|
256
|
+
function range(a, b, str) {
|
|
257
|
+
var begs, beg, left, right, result;
|
|
258
|
+
var ai = str.indexOf(a);
|
|
259
|
+
var bi = str.indexOf(b, ai + 1);
|
|
260
|
+
var i = ai;
|
|
261
|
+
if (ai >= 0 && bi > 0) {
|
|
262
|
+
if (a === b) return [ai, bi];
|
|
263
|
+
begs = [];
|
|
264
|
+
left = str.length;
|
|
265
|
+
while (i >= 0 && !result) {
|
|
266
|
+
if (i == ai) {
|
|
267
|
+
begs.push(i);
|
|
268
|
+
ai = str.indexOf(a, i + 1);
|
|
269
|
+
} else if (begs.length == 1) result = [begs.pop(), bi];
|
|
270
|
+
else {
|
|
271
|
+
beg = begs.pop();
|
|
272
|
+
if (beg < left) {
|
|
273
|
+
left = beg;
|
|
274
|
+
right = bi;
|
|
275
|
+
}
|
|
276
|
+
bi = str.indexOf(b, i + 1);
|
|
277
|
+
}
|
|
278
|
+
i = ai < bi && ai >= 0 ? ai : bi;
|
|
279
|
+
}
|
|
280
|
+
if (begs.length) result = [left, right];
|
|
281
|
+
}
|
|
282
|
+
return result;
|
|
283
|
+
}
|
|
284
|
+
}));
|
|
285
|
+
//#endregion
|
|
286
|
+
//#region ../../node_modules/.pnpm/brace-expansion@1.1.18/node_modules/brace-expansion/index.js
|
|
287
|
+
var require_brace_expansion = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
288
|
+
require_concat_map();
|
|
289
|
+
var balanced = require_balanced_match();
|
|
290
|
+
module.exports = expandTop;
|
|
291
|
+
var escSlash = "\0SLASH" + Math.random() + "\0";
|
|
292
|
+
var escOpen = "\0OPEN" + Math.random() + "\0";
|
|
293
|
+
var escClose = "\0CLOSE" + Math.random() + "\0";
|
|
294
|
+
var escComma = "\0COMMA" + Math.random() + "\0";
|
|
295
|
+
var escPeriod = "\0PERIOD" + Math.random() + "\0";
|
|
296
|
+
var EXPANSION_MAX = 1e5;
|
|
297
|
+
var EXPANSION_MAX_LENGTH = 4e6;
|
|
298
|
+
function numeric(str) {
|
|
299
|
+
return parseInt(str, 10) == str ? parseInt(str, 10) : str.charCodeAt(0);
|
|
300
|
+
}
|
|
301
|
+
function escapeBraces(str) {
|
|
302
|
+
return str.split("\\\\").join(escSlash).split("\\{").join(escOpen).split("\\}").join(escClose).split("\\,").join(escComma).split("\\.").join(escPeriod);
|
|
303
|
+
}
|
|
304
|
+
function unescapeBraces(str) {
|
|
305
|
+
return str.split(escSlash).join("\\").split(escOpen).join("{").split(escClose).join("}").split(escComma).join(",").split(escPeriod).join(".");
|
|
306
|
+
}
|
|
307
|
+
function parseCommaParts(str) {
|
|
308
|
+
if (!str) return [""];
|
|
309
|
+
var parts = [];
|
|
310
|
+
var m = balanced("{", "}", str);
|
|
311
|
+
if (!m) return str.split(",");
|
|
312
|
+
var pre = m.pre;
|
|
313
|
+
var body = m.body;
|
|
314
|
+
var post = m.post;
|
|
315
|
+
var p = pre.split(",");
|
|
316
|
+
p[p.length - 1] += "{" + body + "}";
|
|
317
|
+
var postParts = parseCommaParts(post);
|
|
318
|
+
if (post.length) {
|
|
319
|
+
p[p.length - 1] += postParts.shift();
|
|
320
|
+
p.push.apply(p, postParts);
|
|
321
|
+
}
|
|
322
|
+
parts.push.apply(parts, p);
|
|
323
|
+
return parts;
|
|
324
|
+
}
|
|
325
|
+
function expandTop(str, options) {
|
|
326
|
+
if (!str) return [];
|
|
327
|
+
options = options || {};
|
|
328
|
+
var max = options.max == null ? EXPANSION_MAX : options.max;
|
|
329
|
+
var maxLength = options.maxLength == null ? EXPANSION_MAX_LENGTH : options.maxLength;
|
|
330
|
+
if (str.substr(0, 2) === "{}") str = "\\{\\}" + str.substr(2);
|
|
331
|
+
return expand(escapeBraces(str), max, maxLength, true).map(unescapeBraces);
|
|
332
|
+
}
|
|
333
|
+
function embrace(str) {
|
|
334
|
+
return "{" + str + "}";
|
|
335
|
+
}
|
|
336
|
+
function isPadded(el) {
|
|
337
|
+
return /^-?0\d/.test(el);
|
|
338
|
+
}
|
|
339
|
+
function lte(i, y) {
|
|
340
|
+
return i <= y;
|
|
341
|
+
}
|
|
342
|
+
function gte(i, y) {
|
|
343
|
+
return i >= y;
|
|
344
|
+
}
|
|
345
|
+
function combine(acc, base, pre, values, max, maxLength, dropEmpties, outBase) {
|
|
346
|
+
var out = [];
|
|
347
|
+
var length = 0;
|
|
348
|
+
for (var a = 0; a < acc.length; a++) for (var v = 0; v < values.length; v++) {
|
|
349
|
+
if (out.length >= max) return out;
|
|
350
|
+
var expansion = acc[a] + pre + values[v];
|
|
351
|
+
if (dropEmpties && expansion.length === base[a]) continue;
|
|
352
|
+
if (length + expansion.length > maxLength) return out;
|
|
353
|
+
out.push(expansion);
|
|
354
|
+
outBase.push(base[a]);
|
|
355
|
+
length += expansion.length;
|
|
356
|
+
}
|
|
357
|
+
return out;
|
|
358
|
+
}
|
|
359
|
+
function expandSequence(body, isAlphaSequence, max, maxLength) {
|
|
360
|
+
var n = body.split(/\.\./);
|
|
361
|
+
var N = [];
|
|
362
|
+
/* c8 ignore start */
|
|
363
|
+
if (n[0] === void 0 || n[1] === void 0) return N;
|
|
364
|
+
/* c8 ignore stop */
|
|
365
|
+
var x = numeric(n[0]);
|
|
366
|
+
var y = numeric(n[1]);
|
|
367
|
+
var width = Math.max(n[0].length, n[1].length);
|
|
368
|
+
var incr = n.length === 3 && n[2] !== void 0 ? Math.max(Math.abs(numeric(n[2])), 1) : 1;
|
|
369
|
+
var test = lte;
|
|
370
|
+
if (y < x) {
|
|
371
|
+
incr *= -1;
|
|
372
|
+
test = gte;
|
|
373
|
+
}
|
|
374
|
+
var pad = n.some(isPadded);
|
|
375
|
+
var length = 0;
|
|
376
|
+
for (var i = x; test(i, y) && N.length < max; i += incr) {
|
|
377
|
+
var c;
|
|
378
|
+
if (isAlphaSequence) {
|
|
379
|
+
c = String.fromCharCode(i);
|
|
380
|
+
if (c === "\\") c = "";
|
|
381
|
+
} else {
|
|
382
|
+
c = String(i);
|
|
383
|
+
if (pad) {
|
|
384
|
+
var need = width - c.length;
|
|
385
|
+
if (need > 0) {
|
|
386
|
+
var z = new Array(need + 1).join("0");
|
|
387
|
+
if (i < 0) c = "-" + z + c.slice(1);
|
|
388
|
+
else c = z + c;
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
if (length + c.length > maxLength) break;
|
|
393
|
+
N.push(c);
|
|
394
|
+
length += c.length;
|
|
395
|
+
}
|
|
396
|
+
return N;
|
|
397
|
+
}
|
|
398
|
+
function expand(str, max, maxLength, isTop) {
|
|
399
|
+
var acc = [""];
|
|
400
|
+
var accBase = [0];
|
|
401
|
+
var dropEmpties = false;
|
|
402
|
+
var firstGroup = true;
|
|
403
|
+
var nextBase;
|
|
404
|
+
for (;;) {
|
|
405
|
+
var m = balanced("{", "}", str);
|
|
406
|
+
if (!m) return combine(acc, accBase, str, [""], max, maxLength, dropEmpties, []);
|
|
407
|
+
var pre = m.pre;
|
|
408
|
+
if (/\$$/.test(pre)) return combine(acc, accBase, str, [""], max, maxLength, dropEmpties, []);
|
|
409
|
+
var isNumericSequence = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(m.body);
|
|
410
|
+
var isAlphaSequence = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(m.body);
|
|
411
|
+
var isSequence = isNumericSequence || isAlphaSequence;
|
|
412
|
+
var isOptions = m.body.indexOf(",") >= 0;
|
|
413
|
+
if (!isSequence && !isOptions) {
|
|
414
|
+
if (m.post.match(/,(?!,).*\}/)) {
|
|
415
|
+
str = m.pre + "{" + m.body + escClose + m.post;
|
|
416
|
+
isTop = true;
|
|
417
|
+
firstGroup = true;
|
|
418
|
+
dropEmpties = false;
|
|
419
|
+
accBase = [];
|
|
420
|
+
for (var b = 0; b < acc.length; b++) accBase.push(acc[b].length);
|
|
421
|
+
continue;
|
|
422
|
+
}
|
|
423
|
+
return combine(acc, accBase, pre + "{" + m.body + "}" + m.post, [""], max, maxLength, dropEmpties, []);
|
|
424
|
+
}
|
|
425
|
+
if (firstGroup) {
|
|
426
|
+
dropEmpties = isTop && !isSequence;
|
|
427
|
+
firstGroup = false;
|
|
428
|
+
}
|
|
429
|
+
var values;
|
|
430
|
+
if (isSequence) values = expandSequence(m.body, isAlphaSequence, max, maxLength);
|
|
431
|
+
else {
|
|
432
|
+
var n = parseCommaParts(m.body);
|
|
433
|
+
if (n.length === 1 && n[0] !== void 0) {
|
|
434
|
+
n = expand(n[0], max, maxLength, false).map(embrace);
|
|
435
|
+
/* c8 ignore start */
|
|
436
|
+
if (n.length === 1) {
|
|
437
|
+
nextBase = [];
|
|
438
|
+
acc = combine(acc, accBase, pre + n[0], [""], max, maxLength, dropEmpties && !m.post.length, nextBase);
|
|
439
|
+
accBase = nextBase;
|
|
440
|
+
if (!m.post.length) break;
|
|
441
|
+
str = m.post;
|
|
442
|
+
continue;
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
var dropsEmpties = dropEmpties && !m.post.length && !pre;
|
|
446
|
+
for (var d = 0; dropsEmpties && d < acc.length; d++) if (acc[d].length !== accBase[d]) dropsEmpties = false;
|
|
447
|
+
values = [];
|
|
448
|
+
var valuesLength = 0;
|
|
449
|
+
outer: for (var j = 0; j < n.length; j++) {
|
|
450
|
+
var expanded = expand(n[j], max, maxLength, false);
|
|
451
|
+
for (var k = 0; k < expanded.length; k++) {
|
|
452
|
+
var v = expanded[k];
|
|
453
|
+
if (dropsEmpties && !v) continue;
|
|
454
|
+
if (values.length >= max || valuesLength + v.length > maxLength) break outer;
|
|
455
|
+
values.push(v);
|
|
456
|
+
valuesLength += v.length;
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
nextBase = [];
|
|
461
|
+
acc = combine(acc, accBase, pre, values, max, maxLength, dropEmpties && !m.post.length, nextBase);
|
|
462
|
+
accBase = nextBase;
|
|
463
|
+
if (!m.post.length) break;
|
|
464
|
+
str = m.post;
|
|
465
|
+
}
|
|
466
|
+
return acc;
|
|
467
|
+
}
|
|
468
|
+
}));
|
|
469
|
+
//#endregion
|
|
470
|
+
//#region ../../node_modules/.pnpm/minimatch@3.1.5/node_modules/minimatch/minimatch.js
|
|
471
|
+
var require_minimatch = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
472
|
+
module.exports = minimatch;
|
|
473
|
+
minimatch.Minimatch = Minimatch;
|
|
474
|
+
var path$7 = function() {
|
|
475
|
+
try {
|
|
476
|
+
return __require("path");
|
|
477
|
+
} catch (e) {}
|
|
478
|
+
}() || { sep: "/" };
|
|
479
|
+
minimatch.sep = path$7.sep;
|
|
480
|
+
var GLOBSTAR = minimatch.GLOBSTAR = Minimatch.GLOBSTAR = {};
|
|
481
|
+
var expand = require_brace_expansion();
|
|
482
|
+
var plTypes = {
|
|
483
|
+
"!": {
|
|
484
|
+
open: "(?:(?!(?:",
|
|
485
|
+
close: "))[^/]*?)"
|
|
486
|
+
},
|
|
487
|
+
"?": {
|
|
488
|
+
open: "(?:",
|
|
489
|
+
close: ")?"
|
|
490
|
+
},
|
|
491
|
+
"+": {
|
|
492
|
+
open: "(?:",
|
|
493
|
+
close: ")+"
|
|
494
|
+
},
|
|
495
|
+
"*": {
|
|
496
|
+
open: "(?:",
|
|
497
|
+
close: ")*"
|
|
498
|
+
},
|
|
499
|
+
"@": {
|
|
500
|
+
open: "(?:",
|
|
501
|
+
close: ")"
|
|
502
|
+
}
|
|
503
|
+
};
|
|
504
|
+
var qmark = "[^/]";
|
|
505
|
+
var star = qmark + "*?";
|
|
506
|
+
var twoStarDot = "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?";
|
|
507
|
+
var twoStarNoDot = "(?:(?!(?:\\/|^)\\.).)*?";
|
|
508
|
+
var reSpecials = charSet("().*{}+?[]^$\\!");
|
|
509
|
+
function charSet(s) {
|
|
510
|
+
return s.split("").reduce(function(set, c) {
|
|
511
|
+
set[c] = true;
|
|
512
|
+
return set;
|
|
513
|
+
}, {});
|
|
514
|
+
}
|
|
515
|
+
var slashSplit = /\/+/;
|
|
516
|
+
minimatch.filter = filter;
|
|
517
|
+
function filter(pattern, options) {
|
|
518
|
+
options = options || {};
|
|
519
|
+
return function(p, i, list) {
|
|
520
|
+
return minimatch(p, pattern, options);
|
|
521
|
+
};
|
|
522
|
+
}
|
|
523
|
+
function ext(a, b) {
|
|
524
|
+
b = b || {};
|
|
525
|
+
var t = {};
|
|
526
|
+
Object.keys(a).forEach(function(k) {
|
|
527
|
+
t[k] = a[k];
|
|
528
|
+
});
|
|
529
|
+
Object.keys(b).forEach(function(k) {
|
|
530
|
+
t[k] = b[k];
|
|
531
|
+
});
|
|
532
|
+
return t;
|
|
533
|
+
}
|
|
534
|
+
minimatch.defaults = function(def) {
|
|
535
|
+
if (!def || typeof def !== "object" || !Object.keys(def).length) return minimatch;
|
|
536
|
+
var orig = minimatch;
|
|
537
|
+
var m = function minimatch(p, pattern, options) {
|
|
538
|
+
return orig(p, pattern, ext(def, options));
|
|
539
|
+
};
|
|
540
|
+
m.Minimatch = function Minimatch(pattern, options) {
|
|
541
|
+
return new orig.Minimatch(pattern, ext(def, options));
|
|
542
|
+
};
|
|
543
|
+
m.Minimatch.defaults = function defaults(options) {
|
|
544
|
+
return orig.defaults(ext(def, options)).Minimatch;
|
|
545
|
+
};
|
|
546
|
+
m.filter = function filter(pattern, options) {
|
|
547
|
+
return orig.filter(pattern, ext(def, options));
|
|
548
|
+
};
|
|
549
|
+
m.defaults = function defaults(options) {
|
|
550
|
+
return orig.defaults(ext(def, options));
|
|
551
|
+
};
|
|
552
|
+
m.makeRe = function makeRe(pattern, options) {
|
|
553
|
+
return orig.makeRe(pattern, ext(def, options));
|
|
554
|
+
};
|
|
555
|
+
m.braceExpand = function braceExpand(pattern, options) {
|
|
556
|
+
return orig.braceExpand(pattern, ext(def, options));
|
|
557
|
+
};
|
|
558
|
+
m.match = function(list, pattern, options) {
|
|
559
|
+
return orig.match(list, pattern, ext(def, options));
|
|
560
|
+
};
|
|
561
|
+
return m;
|
|
562
|
+
};
|
|
563
|
+
Minimatch.defaults = function(def) {
|
|
564
|
+
return minimatch.defaults(def).Minimatch;
|
|
565
|
+
};
|
|
566
|
+
function minimatch(p, pattern, options) {
|
|
567
|
+
assertValidPattern(pattern);
|
|
568
|
+
if (!options) options = {};
|
|
569
|
+
if (!options.nocomment && pattern.charAt(0) === "#") return false;
|
|
570
|
+
return new Minimatch(pattern, options).match(p);
|
|
571
|
+
}
|
|
572
|
+
function Minimatch(pattern, options) {
|
|
573
|
+
if (!(this instanceof Minimatch)) return new Minimatch(pattern, options);
|
|
574
|
+
assertValidPattern(pattern);
|
|
575
|
+
if (!options) options = {};
|
|
576
|
+
pattern = pattern.trim();
|
|
577
|
+
if (!options.allowWindowsEscape && path$7.sep !== "/") pattern = pattern.split(path$7.sep).join("/");
|
|
578
|
+
this.options = options;
|
|
579
|
+
this.maxGlobstarRecursion = options.maxGlobstarRecursion !== void 0 ? options.maxGlobstarRecursion : 200;
|
|
580
|
+
this.set = [];
|
|
581
|
+
this.pattern = pattern;
|
|
582
|
+
this.regexp = null;
|
|
583
|
+
this.negate = false;
|
|
584
|
+
this.comment = false;
|
|
585
|
+
this.empty = false;
|
|
586
|
+
this.partial = !!options.partial;
|
|
587
|
+
this.make();
|
|
588
|
+
}
|
|
589
|
+
Minimatch.prototype.debug = function() {};
|
|
590
|
+
Minimatch.prototype.make = make;
|
|
591
|
+
function make() {
|
|
592
|
+
var pattern = this.pattern;
|
|
593
|
+
var options = this.options;
|
|
594
|
+
if (!options.nocomment && pattern.charAt(0) === "#") {
|
|
595
|
+
this.comment = true;
|
|
596
|
+
return;
|
|
597
|
+
}
|
|
598
|
+
if (!pattern) {
|
|
599
|
+
this.empty = true;
|
|
600
|
+
return;
|
|
601
|
+
}
|
|
602
|
+
this.parseNegate();
|
|
603
|
+
var set = this.globSet = this.braceExpand();
|
|
604
|
+
if (options.debug) this.debug = function debug() {
|
|
605
|
+
console.error.apply(console, arguments);
|
|
606
|
+
};
|
|
607
|
+
this.debug(this.pattern, set);
|
|
608
|
+
set = this.globParts = set.map(function(s) {
|
|
609
|
+
return s.split(slashSplit);
|
|
610
|
+
});
|
|
611
|
+
this.debug(this.pattern, set);
|
|
612
|
+
set = set.map(function(s, si, set) {
|
|
613
|
+
return s.map(this.parse, this);
|
|
614
|
+
}, this);
|
|
615
|
+
this.debug(this.pattern, set);
|
|
616
|
+
set = set.filter(function(s) {
|
|
617
|
+
return s.indexOf(false) === -1;
|
|
618
|
+
});
|
|
619
|
+
this.debug(this.pattern, set);
|
|
620
|
+
this.set = set;
|
|
621
|
+
}
|
|
622
|
+
Minimatch.prototype.parseNegate = parseNegate;
|
|
623
|
+
function parseNegate() {
|
|
624
|
+
var pattern = this.pattern;
|
|
625
|
+
var negate = false;
|
|
626
|
+
var options = this.options;
|
|
627
|
+
var negateOffset = 0;
|
|
628
|
+
if (options.nonegate) return;
|
|
629
|
+
for (var i = 0, l = pattern.length; i < l && pattern.charAt(i) === "!"; i++) {
|
|
630
|
+
negate = !negate;
|
|
631
|
+
negateOffset++;
|
|
632
|
+
}
|
|
633
|
+
if (negateOffset) this.pattern = pattern.substr(negateOffset);
|
|
634
|
+
this.negate = negate;
|
|
635
|
+
}
|
|
636
|
+
minimatch.braceExpand = function(pattern, options) {
|
|
637
|
+
return braceExpand(pattern, options);
|
|
638
|
+
};
|
|
639
|
+
Minimatch.prototype.braceExpand = braceExpand;
|
|
640
|
+
function braceExpand(pattern, options) {
|
|
641
|
+
if (!options) {
|
|
642
|
+
if (this instanceof Minimatch) options = this.options;
|
|
643
|
+
else options = {};
|
|
644
|
+
}
|
|
645
|
+
pattern = typeof pattern === "undefined" ? this.pattern : pattern;
|
|
646
|
+
assertValidPattern(pattern);
|
|
647
|
+
if (options.nobrace || !/\{(?:(?!\{).)*\}/.test(pattern)) return [pattern];
|
|
648
|
+
return expand(pattern);
|
|
649
|
+
}
|
|
650
|
+
var MAX_PATTERN_LENGTH = 65536;
|
|
651
|
+
var assertValidPattern = function(pattern) {
|
|
652
|
+
if (typeof pattern !== "string") throw new TypeError("invalid pattern");
|
|
653
|
+
if (pattern.length > MAX_PATTERN_LENGTH) throw new TypeError("pattern is too long");
|
|
654
|
+
};
|
|
655
|
+
Minimatch.prototype.parse = parse;
|
|
656
|
+
var SUBPARSE = {};
|
|
657
|
+
function parse(pattern, isSub) {
|
|
658
|
+
assertValidPattern(pattern);
|
|
659
|
+
var options = this.options;
|
|
660
|
+
if (pattern === "**") {
|
|
661
|
+
if (!options.noglobstar) return GLOBSTAR;
|
|
662
|
+
else pattern = "*";
|
|
663
|
+
}
|
|
664
|
+
if (pattern === "") return "";
|
|
665
|
+
var re = "";
|
|
666
|
+
var hasMagic = !!options.nocase;
|
|
667
|
+
var escaping = false;
|
|
668
|
+
var patternListStack = [];
|
|
669
|
+
var negativeLists = [];
|
|
670
|
+
var stateChar;
|
|
671
|
+
var inClass = false;
|
|
672
|
+
var reClassStart = -1;
|
|
673
|
+
var classStart = -1;
|
|
674
|
+
var patternStart = pattern.charAt(0) === "." ? "" : options.dot ? "(?!(?:^|\\/)\\.{1,2}(?:$|\\/))" : "(?!\\.)";
|
|
675
|
+
var self = this;
|
|
676
|
+
function clearStateChar() {
|
|
677
|
+
if (stateChar) {
|
|
678
|
+
switch (stateChar) {
|
|
679
|
+
case "*":
|
|
680
|
+
re += star;
|
|
681
|
+
hasMagic = true;
|
|
682
|
+
break;
|
|
683
|
+
case "?":
|
|
684
|
+
re += qmark;
|
|
685
|
+
hasMagic = true;
|
|
686
|
+
break;
|
|
687
|
+
default: re += "\\" + stateChar;
|
|
688
|
+
}
|
|
689
|
+
self.debug("clearStateChar %j %j", stateChar, re);
|
|
690
|
+
stateChar = false;
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
for (var i = 0, len = pattern.length, c; i < len && (c = pattern.charAt(i)); i++) {
|
|
694
|
+
this.debug("%s %s %s %j", pattern, i, re, c);
|
|
695
|
+
if (escaping && reSpecials[c]) {
|
|
696
|
+
re += "\\" + c;
|
|
697
|
+
escaping = false;
|
|
698
|
+
continue;
|
|
699
|
+
}
|
|
700
|
+
switch (c) {
|
|
701
|
+
/* istanbul ignore next */
|
|
702
|
+
case "/": return false;
|
|
703
|
+
case "\\":
|
|
704
|
+
clearStateChar();
|
|
705
|
+
escaping = true;
|
|
706
|
+
continue;
|
|
707
|
+
case "?":
|
|
708
|
+
case "*":
|
|
709
|
+
case "+":
|
|
710
|
+
case "@":
|
|
711
|
+
case "!":
|
|
712
|
+
this.debug("%s %s %s %j <-- stateChar", pattern, i, re, c);
|
|
713
|
+
if (inClass) {
|
|
714
|
+
this.debug(" in class");
|
|
715
|
+
if (c === "!" && i === classStart + 1) c = "^";
|
|
716
|
+
re += c;
|
|
717
|
+
continue;
|
|
718
|
+
}
|
|
719
|
+
if (c === "*" && stateChar === "*") continue;
|
|
720
|
+
self.debug("call clearStateChar %j", stateChar);
|
|
721
|
+
clearStateChar();
|
|
722
|
+
stateChar = c;
|
|
723
|
+
if (options.noext) clearStateChar();
|
|
724
|
+
continue;
|
|
725
|
+
case "(":
|
|
726
|
+
if (inClass) {
|
|
727
|
+
re += "(";
|
|
728
|
+
continue;
|
|
729
|
+
}
|
|
730
|
+
if (!stateChar) {
|
|
731
|
+
re += "\\(";
|
|
732
|
+
continue;
|
|
733
|
+
}
|
|
734
|
+
patternListStack.push({
|
|
735
|
+
type: stateChar,
|
|
736
|
+
start: i - 1,
|
|
737
|
+
reStart: re.length,
|
|
738
|
+
open: plTypes[stateChar].open,
|
|
739
|
+
close: plTypes[stateChar].close
|
|
740
|
+
});
|
|
741
|
+
re += stateChar === "!" ? "(?:(?!(?:" : "(?:";
|
|
742
|
+
this.debug("plType %j %j", stateChar, re);
|
|
743
|
+
stateChar = false;
|
|
744
|
+
continue;
|
|
745
|
+
case ")":
|
|
746
|
+
if (inClass || !patternListStack.length) {
|
|
747
|
+
re += "\\)";
|
|
748
|
+
continue;
|
|
749
|
+
}
|
|
750
|
+
clearStateChar();
|
|
751
|
+
hasMagic = true;
|
|
752
|
+
var pl = patternListStack.pop();
|
|
753
|
+
re += pl.close;
|
|
754
|
+
if (pl.type === "!") negativeLists.push(pl);
|
|
755
|
+
pl.reEnd = re.length;
|
|
756
|
+
continue;
|
|
757
|
+
case "|":
|
|
758
|
+
if (inClass || !patternListStack.length || escaping) {
|
|
759
|
+
re += "\\|";
|
|
760
|
+
escaping = false;
|
|
761
|
+
continue;
|
|
762
|
+
}
|
|
763
|
+
clearStateChar();
|
|
764
|
+
re += "|";
|
|
765
|
+
continue;
|
|
766
|
+
case "[":
|
|
767
|
+
clearStateChar();
|
|
768
|
+
if (inClass) {
|
|
769
|
+
re += "\\" + c;
|
|
770
|
+
continue;
|
|
771
|
+
}
|
|
772
|
+
inClass = true;
|
|
773
|
+
classStart = i;
|
|
774
|
+
reClassStart = re.length;
|
|
775
|
+
re += c;
|
|
776
|
+
continue;
|
|
777
|
+
case "]":
|
|
778
|
+
if (i === classStart + 1 || !inClass) {
|
|
779
|
+
re += "\\" + c;
|
|
780
|
+
escaping = false;
|
|
781
|
+
continue;
|
|
782
|
+
}
|
|
783
|
+
var cs = pattern.substring(classStart + 1, i);
|
|
784
|
+
try {
|
|
785
|
+
RegExp("[" + cs + "]");
|
|
786
|
+
} catch (er) {
|
|
787
|
+
var sp = this.parse(cs, SUBPARSE);
|
|
788
|
+
re = re.substr(0, reClassStart) + "\\[" + sp[0] + "\\]";
|
|
789
|
+
hasMagic = hasMagic || sp[1];
|
|
790
|
+
inClass = false;
|
|
791
|
+
continue;
|
|
792
|
+
}
|
|
793
|
+
hasMagic = true;
|
|
794
|
+
inClass = false;
|
|
795
|
+
re += c;
|
|
796
|
+
continue;
|
|
797
|
+
default:
|
|
798
|
+
clearStateChar();
|
|
799
|
+
if (escaping) escaping = false;
|
|
800
|
+
else if (reSpecials[c] && !(c === "^" && inClass)) re += "\\";
|
|
801
|
+
re += c;
|
|
802
|
+
}
|
|
803
|
+
}
|
|
804
|
+
if (inClass) {
|
|
805
|
+
cs = pattern.substr(classStart + 1);
|
|
806
|
+
sp = this.parse(cs, SUBPARSE);
|
|
807
|
+
re = re.substr(0, reClassStart) + "\\[" + sp[0];
|
|
808
|
+
hasMagic = hasMagic || sp[1];
|
|
809
|
+
}
|
|
810
|
+
for (pl = patternListStack.pop(); pl; pl = patternListStack.pop()) {
|
|
811
|
+
var tail = re.slice(pl.reStart + pl.open.length);
|
|
812
|
+
this.debug("setting tail", re, pl);
|
|
813
|
+
tail = tail.replace(/((?:\\{2}){0,64})(\\?)\|/g, function(_, $1, $2) {
|
|
814
|
+
if (!$2) $2 = "\\";
|
|
815
|
+
return $1 + $1 + $2 + "|";
|
|
816
|
+
});
|
|
817
|
+
this.debug("tail=%j\n %s", tail, tail, pl, re);
|
|
818
|
+
var t = pl.type === "*" ? star : pl.type === "?" ? qmark : "\\" + pl.type;
|
|
819
|
+
hasMagic = true;
|
|
820
|
+
re = re.slice(0, pl.reStart) + t + "\\(" + tail;
|
|
821
|
+
}
|
|
822
|
+
clearStateChar();
|
|
823
|
+
if (escaping) re += "\\\\";
|
|
824
|
+
var addPatternStart = false;
|
|
825
|
+
switch (re.charAt(0)) {
|
|
826
|
+
case "[":
|
|
827
|
+
case ".":
|
|
828
|
+
case "(": addPatternStart = true;
|
|
829
|
+
}
|
|
830
|
+
for (var n = negativeLists.length - 1; n > -1; n--) {
|
|
831
|
+
var nl = negativeLists[n];
|
|
832
|
+
var nlBefore = re.slice(0, nl.reStart);
|
|
833
|
+
var nlFirst = re.slice(nl.reStart, nl.reEnd - 8);
|
|
834
|
+
var nlLast = re.slice(nl.reEnd - 8, nl.reEnd);
|
|
835
|
+
var nlAfter = re.slice(nl.reEnd);
|
|
836
|
+
nlLast += nlAfter;
|
|
837
|
+
var openParensBefore = nlBefore.split("(").length - 1;
|
|
838
|
+
var cleanAfter = nlAfter;
|
|
839
|
+
for (i = 0; i < openParensBefore; i++) cleanAfter = cleanAfter.replace(/\)[+*?]?/, "");
|
|
840
|
+
nlAfter = cleanAfter;
|
|
841
|
+
var dollar = "";
|
|
842
|
+
if (nlAfter === "" && isSub !== SUBPARSE) dollar = "$";
|
|
843
|
+
re = nlBefore + nlFirst + nlAfter + dollar + nlLast;
|
|
844
|
+
}
|
|
845
|
+
if (re !== "" && hasMagic) re = "(?=.)" + re;
|
|
846
|
+
if (addPatternStart) re = patternStart + re;
|
|
847
|
+
if (isSub === SUBPARSE) return [re, hasMagic];
|
|
848
|
+
if (!hasMagic) return globUnescape(pattern);
|
|
849
|
+
var flags = options.nocase ? "i" : "";
|
|
850
|
+
try {
|
|
851
|
+
var regExp = new RegExp("^" + re + "$", flags);
|
|
852
|
+
} catch (er) /* istanbul ignore next - should be impossible */ {
|
|
853
|
+
return /* @__PURE__ */ new RegExp("$.");
|
|
854
|
+
}
|
|
855
|
+
regExp._glob = pattern;
|
|
856
|
+
regExp._src = re;
|
|
857
|
+
return regExp;
|
|
858
|
+
}
|
|
859
|
+
minimatch.makeRe = function(pattern, options) {
|
|
860
|
+
return new Minimatch(pattern, options || {}).makeRe();
|
|
861
|
+
};
|
|
862
|
+
Minimatch.prototype.makeRe = makeRe;
|
|
863
|
+
function makeRe() {
|
|
864
|
+
if (this.regexp || this.regexp === false) return this.regexp;
|
|
865
|
+
var set = this.set;
|
|
866
|
+
if (!set.length) {
|
|
867
|
+
this.regexp = false;
|
|
868
|
+
return this.regexp;
|
|
869
|
+
}
|
|
870
|
+
var options = this.options;
|
|
871
|
+
var twoStar = options.noglobstar ? star : options.dot ? twoStarDot : twoStarNoDot;
|
|
872
|
+
var flags = options.nocase ? "i" : "";
|
|
873
|
+
var re = set.map(function(pattern) {
|
|
874
|
+
return pattern.map(function(p) {
|
|
875
|
+
return p === GLOBSTAR ? twoStar : typeof p === "string" ? regExpEscape(p) : p._src;
|
|
876
|
+
}).join("\\/");
|
|
877
|
+
}).join("|");
|
|
878
|
+
re = "^(?:" + re + ")$";
|
|
879
|
+
if (this.negate) re = "^(?!" + re + ").*$";
|
|
880
|
+
try {
|
|
881
|
+
this.regexp = new RegExp(re, flags);
|
|
882
|
+
} catch (ex) /* istanbul ignore next - should be impossible */ {
|
|
883
|
+
this.regexp = false;
|
|
884
|
+
}
|
|
885
|
+
return this.regexp;
|
|
886
|
+
}
|
|
887
|
+
minimatch.match = function(list, pattern, options) {
|
|
888
|
+
options = options || {};
|
|
889
|
+
var mm = new Minimatch(pattern, options);
|
|
890
|
+
list = list.filter(function(f) {
|
|
891
|
+
return mm.match(f);
|
|
892
|
+
});
|
|
893
|
+
if (mm.options.nonull && !list.length) list.push(pattern);
|
|
894
|
+
return list;
|
|
895
|
+
};
|
|
896
|
+
Minimatch.prototype.match = function match(f, partial) {
|
|
897
|
+
if (typeof partial === "undefined") partial = this.partial;
|
|
898
|
+
this.debug("match", f, this.pattern);
|
|
899
|
+
if (this.comment) return false;
|
|
900
|
+
if (this.empty) return f === "";
|
|
901
|
+
if (f === "/" && partial) return true;
|
|
902
|
+
var options = this.options;
|
|
903
|
+
if (path$7.sep !== "/") f = f.split(path$7.sep).join("/");
|
|
904
|
+
f = f.split(slashSplit);
|
|
905
|
+
this.debug(this.pattern, "split", f);
|
|
906
|
+
var set = this.set;
|
|
907
|
+
this.debug(this.pattern, "set", set);
|
|
908
|
+
var filename;
|
|
909
|
+
var i = f.length - 1;
|
|
910
|
+
for (; i >= 0; i--) {
|
|
911
|
+
filename = f[i];
|
|
912
|
+
if (filename) break;
|
|
913
|
+
}
|
|
914
|
+
for (i = 0; i < set.length; i++) {
|
|
915
|
+
var pattern = set[i];
|
|
916
|
+
var file = f;
|
|
917
|
+
if (options.matchBase && pattern.length === 1) file = [filename];
|
|
918
|
+
if (this.matchOne(file, pattern, partial)) {
|
|
919
|
+
if (options.flipNegate) return true;
|
|
920
|
+
return !this.negate;
|
|
921
|
+
}
|
|
922
|
+
}
|
|
923
|
+
if (options.flipNegate) return false;
|
|
924
|
+
return this.negate;
|
|
925
|
+
};
|
|
926
|
+
Minimatch.prototype.matchOne = function(file, pattern, partial) {
|
|
927
|
+
if (pattern.indexOf(GLOBSTAR) !== -1) return this._matchGlobstar(file, pattern, partial, 0, 0);
|
|
928
|
+
return this._matchOne(file, pattern, partial, 0, 0);
|
|
929
|
+
};
|
|
930
|
+
Minimatch.prototype._matchGlobstar = function(file, pattern, partial, fileIndex, patternIndex) {
|
|
931
|
+
var i;
|
|
932
|
+
var firstgs = -1;
|
|
933
|
+
for (i = patternIndex; i < pattern.length; i++) if (pattern[i] === GLOBSTAR) {
|
|
934
|
+
firstgs = i;
|
|
935
|
+
break;
|
|
936
|
+
}
|
|
937
|
+
var lastgs = -1;
|
|
938
|
+
for (i = pattern.length - 1; i >= 0; i--) if (pattern[i] === GLOBSTAR) {
|
|
939
|
+
lastgs = i;
|
|
940
|
+
break;
|
|
941
|
+
}
|
|
942
|
+
var head = pattern.slice(patternIndex, firstgs);
|
|
943
|
+
var body = partial ? pattern.slice(firstgs + 1) : pattern.slice(firstgs + 1, lastgs);
|
|
944
|
+
var tail = partial ? [] : pattern.slice(lastgs + 1);
|
|
945
|
+
if (head.length) {
|
|
946
|
+
var fileHead = file.slice(fileIndex, fileIndex + head.length);
|
|
947
|
+
if (!this._matchOne(fileHead, head, partial, 0, 0)) return false;
|
|
948
|
+
fileIndex += head.length;
|
|
949
|
+
}
|
|
950
|
+
var fileTailMatch = 0;
|
|
951
|
+
if (tail.length) {
|
|
952
|
+
if (tail.length + fileIndex > file.length) return false;
|
|
953
|
+
var tailStart = file.length - tail.length;
|
|
954
|
+
if (this._matchOne(file, tail, partial, tailStart, 0)) fileTailMatch = tail.length;
|
|
955
|
+
else {
|
|
956
|
+
if (file[file.length - 1] !== "" || fileIndex + tail.length === file.length) return false;
|
|
957
|
+
tailStart--;
|
|
958
|
+
if (!this._matchOne(file, tail, partial, tailStart, 0)) return false;
|
|
959
|
+
fileTailMatch = tail.length + 1;
|
|
960
|
+
}
|
|
961
|
+
}
|
|
962
|
+
if (!body.length) {
|
|
963
|
+
var sawSome = !!fileTailMatch;
|
|
964
|
+
for (i = fileIndex; i < file.length - fileTailMatch; i++) {
|
|
965
|
+
var f = String(file[i]);
|
|
966
|
+
sawSome = true;
|
|
967
|
+
if (f === "." || f === ".." || !this.options.dot && f.charAt(0) === ".") return false;
|
|
968
|
+
}
|
|
969
|
+
return partial || sawSome;
|
|
970
|
+
}
|
|
971
|
+
var bodySegments = [[[], 0]];
|
|
972
|
+
var currentBody = bodySegments[0];
|
|
973
|
+
var nonGsParts = 0;
|
|
974
|
+
var nonGsPartsSums = [0];
|
|
975
|
+
for (var bi = 0; bi < body.length; bi++) {
|
|
976
|
+
var b = body[bi];
|
|
977
|
+
if (b === GLOBSTAR) {
|
|
978
|
+
nonGsPartsSums.push(nonGsParts);
|
|
979
|
+
currentBody = [[], 0];
|
|
980
|
+
bodySegments.push(currentBody);
|
|
981
|
+
} else {
|
|
982
|
+
currentBody[0].push(b);
|
|
983
|
+
nonGsParts++;
|
|
984
|
+
}
|
|
985
|
+
}
|
|
986
|
+
var idx = bodySegments.length - 1;
|
|
987
|
+
var fileLength = file.length - fileTailMatch;
|
|
988
|
+
for (var si = 0; si < bodySegments.length; si++) bodySegments[si][1] = fileLength - (nonGsPartsSums[idx--] + bodySegments[si][0].length);
|
|
989
|
+
return !!this._matchGlobStarBodySections(file, bodySegments, fileIndex, 0, partial, 0, !!fileTailMatch);
|
|
990
|
+
};
|
|
991
|
+
Minimatch.prototype._matchGlobStarBodySections = function(file, bodySegments, fileIndex, bodyIndex, partial, globStarDepth, sawTail) {
|
|
992
|
+
var bs = bodySegments[bodyIndex];
|
|
993
|
+
if (!bs) {
|
|
994
|
+
for (var i = fileIndex; i < file.length; i++) {
|
|
995
|
+
sawTail = true;
|
|
996
|
+
var f = file[i];
|
|
997
|
+
if (f === "." || f === ".." || !this.options.dot && f.charAt(0) === ".") return false;
|
|
998
|
+
}
|
|
999
|
+
return sawTail;
|
|
1000
|
+
}
|
|
1001
|
+
var body = bs[0];
|
|
1002
|
+
var after = bs[1];
|
|
1003
|
+
while (fileIndex <= after) {
|
|
1004
|
+
if (this._matchOne(file.slice(0, fileIndex + body.length), body, partial, fileIndex, 0) && globStarDepth < this.maxGlobstarRecursion) {
|
|
1005
|
+
var sub = this._matchGlobStarBodySections(file, bodySegments, fileIndex + body.length, bodyIndex + 1, partial, globStarDepth + 1, sawTail);
|
|
1006
|
+
if (sub !== false) return sub;
|
|
1007
|
+
}
|
|
1008
|
+
var f = file[fileIndex];
|
|
1009
|
+
if (f === "." || f === ".." || !this.options.dot && f.charAt(0) === ".") return false;
|
|
1010
|
+
fileIndex++;
|
|
1011
|
+
}
|
|
1012
|
+
return partial || null;
|
|
1013
|
+
};
|
|
1014
|
+
Minimatch.prototype._matchOne = function(file, pattern, partial, fileIndex, patternIndex) {
|
|
1015
|
+
var fi = fileIndex, pi = patternIndex, fl = file.length, pl = pattern.length;
|
|
1016
|
+
for (; fi < fl && pi < pl; fi++, pi++) {
|
|
1017
|
+
this.debug("matchOne loop");
|
|
1018
|
+
var p = pattern[pi];
|
|
1019
|
+
var f = file[fi];
|
|
1020
|
+
this.debug(pattern, p, f);
|
|
1021
|
+
/* istanbul ignore if */
|
|
1022
|
+
if (p === false || p === GLOBSTAR) return false;
|
|
1023
|
+
var hit;
|
|
1024
|
+
if (typeof p === "string") {
|
|
1025
|
+
hit = f === p;
|
|
1026
|
+
this.debug("string match", p, f, hit);
|
|
1027
|
+
} else {
|
|
1028
|
+
hit = f.match(p);
|
|
1029
|
+
this.debug("pattern match", p, f, hit);
|
|
1030
|
+
}
|
|
1031
|
+
if (!hit) return false;
|
|
1032
|
+
}
|
|
1033
|
+
if (fi === fl && pi === pl) return true;
|
|
1034
|
+
else if (fi === fl) return partial;
|
|
1035
|
+
else if (pi === pl) return fi === fl - 1 && file[fi] === "";
|
|
1036
|
+
/* istanbul ignore next */
|
|
1037
|
+
throw new Error("wtf?");
|
|
1038
|
+
};
|
|
1039
|
+
function globUnescape(s) {
|
|
1040
|
+
return s.replace(/\\(.)/g, "$1");
|
|
1041
|
+
}
|
|
1042
|
+
function regExpEscape(s) {
|
|
1043
|
+
return s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
|
|
1044
|
+
}
|
|
1045
|
+
}));
|
|
1046
|
+
//#endregion
|
|
1047
|
+
//#region ../../node_modules/.pnpm/inherits@2.0.4/node_modules/inherits/inherits_browser.js
|
|
1048
|
+
var require_inherits_browser = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1049
|
+
if (typeof Object.create === "function") module.exports = function inherits(ctor, superCtor) {
|
|
1050
|
+
if (superCtor) {
|
|
1051
|
+
ctor.super_ = superCtor;
|
|
1052
|
+
ctor.prototype = Object.create(superCtor.prototype, { constructor: {
|
|
1053
|
+
value: ctor,
|
|
1054
|
+
enumerable: false,
|
|
1055
|
+
writable: true,
|
|
1056
|
+
configurable: true
|
|
1057
|
+
} });
|
|
1058
|
+
}
|
|
1059
|
+
};
|
|
1060
|
+
else module.exports = function inherits(ctor, superCtor) {
|
|
1061
|
+
if (superCtor) {
|
|
1062
|
+
ctor.super_ = superCtor;
|
|
1063
|
+
var TempCtor = function() {};
|
|
1064
|
+
TempCtor.prototype = superCtor.prototype;
|
|
1065
|
+
ctor.prototype = new TempCtor();
|
|
1066
|
+
ctor.prototype.constructor = ctor;
|
|
1067
|
+
}
|
|
1068
|
+
};
|
|
1069
|
+
}));
|
|
1070
|
+
//#endregion
|
|
1071
|
+
//#region ../../node_modules/.pnpm/inherits@2.0.4/node_modules/inherits/inherits.js
|
|
1072
|
+
var require_inherits = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1073
|
+
try {
|
|
1074
|
+
var util = __require("util");
|
|
1075
|
+
/* istanbul ignore next */
|
|
1076
|
+
if (typeof util.inherits !== "function") throw "";
|
|
1077
|
+
module.exports = util.inherits;
|
|
1078
|
+
} catch (e) {
|
|
1079
|
+
/* istanbul ignore next */
|
|
1080
|
+
module.exports = require_inherits_browser();
|
|
1081
|
+
}
|
|
1082
|
+
}));
|
|
1083
|
+
//#endregion
|
|
1084
|
+
//#region ../../node_modules/.pnpm/path-is-absolute@1.0.1/node_modules/path-is-absolute/index.js
|
|
1085
|
+
var require_path_is_absolute = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1086
|
+
function posix(path) {
|
|
1087
|
+
return path.charAt(0) === "/";
|
|
1088
|
+
}
|
|
1089
|
+
function win32(path) {
|
|
1090
|
+
var result = /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?([\s\S]*?)$/.exec(path);
|
|
1091
|
+
var device = result[1] || "";
|
|
1092
|
+
var isUnc = Boolean(device && device.charAt(1) !== ":");
|
|
1093
|
+
return Boolean(result[2] || isUnc);
|
|
1094
|
+
}
|
|
1095
|
+
module.exports = process.platform === "win32" ? win32 : posix;
|
|
1096
|
+
module.exports.posix = posix;
|
|
1097
|
+
module.exports.win32 = win32;
|
|
1098
|
+
}));
|
|
1099
|
+
//#endregion
|
|
1100
|
+
//#region ../../node_modules/.pnpm/glob@7.2.3/node_modules/glob/common.js
|
|
1101
|
+
var require_common = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1102
|
+
exports.setopts = setopts;
|
|
1103
|
+
exports.ownProp = ownProp;
|
|
1104
|
+
exports.makeAbs = makeAbs;
|
|
1105
|
+
exports.finish = finish;
|
|
1106
|
+
exports.mark = mark;
|
|
1107
|
+
exports.isIgnored = isIgnored;
|
|
1108
|
+
exports.childrenIgnored = childrenIgnored;
|
|
1109
|
+
function ownProp(obj, field) {
|
|
1110
|
+
return Object.prototype.hasOwnProperty.call(obj, field);
|
|
1111
|
+
}
|
|
1112
|
+
var fs$4 = __require("fs");
|
|
1113
|
+
var path$6 = __require("path");
|
|
1114
|
+
var minimatch = require_minimatch();
|
|
1115
|
+
var isAbsolute = require_path_is_absolute();
|
|
1116
|
+
var Minimatch = minimatch.Minimatch;
|
|
1117
|
+
function alphasort(a, b) {
|
|
1118
|
+
return a.localeCompare(b, "en");
|
|
1119
|
+
}
|
|
1120
|
+
function setupIgnores(self, options) {
|
|
1121
|
+
self.ignore = options.ignore || [];
|
|
1122
|
+
if (!Array.isArray(self.ignore)) self.ignore = [self.ignore];
|
|
1123
|
+
if (self.ignore.length) self.ignore = self.ignore.map(ignoreMap);
|
|
1124
|
+
}
|
|
1125
|
+
function ignoreMap(pattern) {
|
|
1126
|
+
var gmatcher = null;
|
|
1127
|
+
if (pattern.slice(-3) === "/**") gmatcher = new Minimatch(pattern.replace(/(\/\*\*)+$/, ""), { dot: true });
|
|
1128
|
+
return {
|
|
1129
|
+
matcher: new Minimatch(pattern, { dot: true }),
|
|
1130
|
+
gmatcher
|
|
1131
|
+
};
|
|
1132
|
+
}
|
|
1133
|
+
function setopts(self, pattern, options) {
|
|
1134
|
+
if (!options) options = {};
|
|
1135
|
+
if (options.matchBase && -1 === pattern.indexOf("/")) {
|
|
1136
|
+
if (options.noglobstar) throw new Error("base matching requires globstar");
|
|
1137
|
+
pattern = "**/" + pattern;
|
|
1138
|
+
}
|
|
1139
|
+
self.silent = !!options.silent;
|
|
1140
|
+
self.pattern = pattern;
|
|
1141
|
+
self.strict = options.strict !== false;
|
|
1142
|
+
self.realpath = !!options.realpath;
|
|
1143
|
+
self.realpathCache = options.realpathCache || Object.create(null);
|
|
1144
|
+
self.follow = !!options.follow;
|
|
1145
|
+
self.dot = !!options.dot;
|
|
1146
|
+
self.mark = !!options.mark;
|
|
1147
|
+
self.nodir = !!options.nodir;
|
|
1148
|
+
if (self.nodir) self.mark = true;
|
|
1149
|
+
self.sync = !!options.sync;
|
|
1150
|
+
self.nounique = !!options.nounique;
|
|
1151
|
+
self.nonull = !!options.nonull;
|
|
1152
|
+
self.nosort = !!options.nosort;
|
|
1153
|
+
self.nocase = !!options.nocase;
|
|
1154
|
+
self.stat = !!options.stat;
|
|
1155
|
+
self.noprocess = !!options.noprocess;
|
|
1156
|
+
self.absolute = !!options.absolute;
|
|
1157
|
+
self.fs = options.fs || fs$4;
|
|
1158
|
+
self.maxLength = options.maxLength || Infinity;
|
|
1159
|
+
self.cache = options.cache || Object.create(null);
|
|
1160
|
+
self.statCache = options.statCache || Object.create(null);
|
|
1161
|
+
self.symlinks = options.symlinks || Object.create(null);
|
|
1162
|
+
setupIgnores(self, options);
|
|
1163
|
+
self.changedCwd = false;
|
|
1164
|
+
var cwd = process.cwd();
|
|
1165
|
+
if (!ownProp(options, "cwd")) self.cwd = cwd;
|
|
1166
|
+
else {
|
|
1167
|
+
self.cwd = path$6.resolve(options.cwd);
|
|
1168
|
+
self.changedCwd = self.cwd !== cwd;
|
|
1169
|
+
}
|
|
1170
|
+
self.root = options.root || path$6.resolve(self.cwd, "/");
|
|
1171
|
+
self.root = path$6.resolve(self.root);
|
|
1172
|
+
if (process.platform === "win32") self.root = self.root.replace(/\\/g, "/");
|
|
1173
|
+
self.cwdAbs = isAbsolute(self.cwd) ? self.cwd : makeAbs(self, self.cwd);
|
|
1174
|
+
if (process.platform === "win32") self.cwdAbs = self.cwdAbs.replace(/\\/g, "/");
|
|
1175
|
+
self.nomount = !!options.nomount;
|
|
1176
|
+
options.nonegate = true;
|
|
1177
|
+
options.nocomment = true;
|
|
1178
|
+
options.allowWindowsEscape = false;
|
|
1179
|
+
self.minimatch = new Minimatch(pattern, options);
|
|
1180
|
+
self.options = self.minimatch.options;
|
|
1181
|
+
}
|
|
1182
|
+
function finish(self) {
|
|
1183
|
+
var nou = self.nounique;
|
|
1184
|
+
var all = nou ? [] : Object.create(null);
|
|
1185
|
+
for (var i = 0, l = self.matches.length; i < l; i++) {
|
|
1186
|
+
var matches = self.matches[i];
|
|
1187
|
+
if (!matches || Object.keys(matches).length === 0) {
|
|
1188
|
+
if (self.nonull) {
|
|
1189
|
+
var literal = self.minimatch.globSet[i];
|
|
1190
|
+
if (nou) all.push(literal);
|
|
1191
|
+
else all[literal] = true;
|
|
1192
|
+
}
|
|
1193
|
+
} else {
|
|
1194
|
+
var m = Object.keys(matches);
|
|
1195
|
+
if (nou) all.push.apply(all, m);
|
|
1196
|
+
else m.forEach(function(m) {
|
|
1197
|
+
all[m] = true;
|
|
1198
|
+
});
|
|
1199
|
+
}
|
|
1200
|
+
}
|
|
1201
|
+
if (!nou) all = Object.keys(all);
|
|
1202
|
+
if (!self.nosort) all = all.sort(alphasort);
|
|
1203
|
+
if (self.mark) {
|
|
1204
|
+
for (var i = 0; i < all.length; i++) all[i] = self._mark(all[i]);
|
|
1205
|
+
if (self.nodir) all = all.filter(function(e) {
|
|
1206
|
+
var notDir = !/\/$/.test(e);
|
|
1207
|
+
var c = self.cache[e] || self.cache[makeAbs(self, e)];
|
|
1208
|
+
if (notDir && c) notDir = c !== "DIR" && !Array.isArray(c);
|
|
1209
|
+
return notDir;
|
|
1210
|
+
});
|
|
1211
|
+
}
|
|
1212
|
+
if (self.ignore.length) all = all.filter(function(m) {
|
|
1213
|
+
return !isIgnored(self, m);
|
|
1214
|
+
});
|
|
1215
|
+
self.found = all;
|
|
1216
|
+
}
|
|
1217
|
+
function mark(self, p) {
|
|
1218
|
+
var abs = makeAbs(self, p);
|
|
1219
|
+
var c = self.cache[abs];
|
|
1220
|
+
var m = p;
|
|
1221
|
+
if (c) {
|
|
1222
|
+
var isDir = c === "DIR" || Array.isArray(c);
|
|
1223
|
+
var slash = p.slice(-1) === "/";
|
|
1224
|
+
if (isDir && !slash) m += "/";
|
|
1225
|
+
else if (!isDir && slash) m = m.slice(0, -1);
|
|
1226
|
+
if (m !== p) {
|
|
1227
|
+
var mabs = makeAbs(self, m);
|
|
1228
|
+
self.statCache[mabs] = self.statCache[abs];
|
|
1229
|
+
self.cache[mabs] = self.cache[abs];
|
|
1230
|
+
}
|
|
1231
|
+
}
|
|
1232
|
+
return m;
|
|
1233
|
+
}
|
|
1234
|
+
function makeAbs(self, f) {
|
|
1235
|
+
var abs = f;
|
|
1236
|
+
if (f.charAt(0) === "/") abs = path$6.join(self.root, f);
|
|
1237
|
+
else if (isAbsolute(f) || f === "") abs = f;
|
|
1238
|
+
else if (self.changedCwd) abs = path$6.resolve(self.cwd, f);
|
|
1239
|
+
else abs = path$6.resolve(f);
|
|
1240
|
+
if (process.platform === "win32") abs = abs.replace(/\\/g, "/");
|
|
1241
|
+
return abs;
|
|
1242
|
+
}
|
|
1243
|
+
function isIgnored(self, path) {
|
|
1244
|
+
if (!self.ignore.length) return false;
|
|
1245
|
+
return self.ignore.some(function(item) {
|
|
1246
|
+
return item.matcher.match(path) || !!(item.gmatcher && item.gmatcher.match(path));
|
|
1247
|
+
});
|
|
1248
|
+
}
|
|
1249
|
+
function childrenIgnored(self, path) {
|
|
1250
|
+
if (!self.ignore.length) return false;
|
|
1251
|
+
return self.ignore.some(function(item) {
|
|
1252
|
+
return !!(item.gmatcher && item.gmatcher.match(path));
|
|
1253
|
+
});
|
|
1254
|
+
}
|
|
1255
|
+
}));
|
|
1256
|
+
//#endregion
|
|
1257
|
+
//#region ../../node_modules/.pnpm/glob@7.2.3/node_modules/glob/sync.js
|
|
1258
|
+
var require_sync = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1259
|
+
module.exports = globSync;
|
|
1260
|
+
globSync.GlobSync = GlobSync;
|
|
1261
|
+
var rp = require_fs_realpath();
|
|
1262
|
+
var minimatch = require_minimatch();
|
|
1263
|
+
minimatch.Minimatch;
|
|
1264
|
+
require_glob().Glob;
|
|
1265
|
+
__require("util");
|
|
1266
|
+
var path$5 = __require("path");
|
|
1267
|
+
var assert$2 = __require("assert");
|
|
1268
|
+
var isAbsolute = require_path_is_absolute();
|
|
1269
|
+
var common = require_common();
|
|
1270
|
+
var setopts = common.setopts;
|
|
1271
|
+
var ownProp = common.ownProp;
|
|
1272
|
+
var childrenIgnored = common.childrenIgnored;
|
|
1273
|
+
var isIgnored = common.isIgnored;
|
|
1274
|
+
function globSync(pattern, options) {
|
|
1275
|
+
if (typeof options === "function" || arguments.length === 3) throw new TypeError("callback provided to sync glob\nSee: https://github.com/isaacs/node-glob/issues/167");
|
|
1276
|
+
return new GlobSync(pattern, options).found;
|
|
1277
|
+
}
|
|
1278
|
+
function GlobSync(pattern, options) {
|
|
1279
|
+
if (!pattern) throw new Error("must provide pattern");
|
|
1280
|
+
if (typeof options === "function" || arguments.length === 3) throw new TypeError("callback provided to sync glob\nSee: https://github.com/isaacs/node-glob/issues/167");
|
|
1281
|
+
if (!(this instanceof GlobSync)) return new GlobSync(pattern, options);
|
|
1282
|
+
setopts(this, pattern, options);
|
|
1283
|
+
if (this.noprocess) return this;
|
|
1284
|
+
var n = this.minimatch.set.length;
|
|
1285
|
+
this.matches = new Array(n);
|
|
1286
|
+
for (var i = 0; i < n; i++) this._process(this.minimatch.set[i], i, false);
|
|
1287
|
+
this._finish();
|
|
1288
|
+
}
|
|
1289
|
+
GlobSync.prototype._finish = function() {
|
|
1290
|
+
assert$2.ok(this instanceof GlobSync);
|
|
1291
|
+
if (this.realpath) {
|
|
1292
|
+
var self = this;
|
|
1293
|
+
this.matches.forEach(function(matchset, index) {
|
|
1294
|
+
var set = self.matches[index] = Object.create(null);
|
|
1295
|
+
for (var p in matchset) try {
|
|
1296
|
+
p = self._makeAbs(p);
|
|
1297
|
+
var real = rp.realpathSync(p, self.realpathCache);
|
|
1298
|
+
set[real] = true;
|
|
1299
|
+
} catch (er) {
|
|
1300
|
+
if (er.syscall === "stat") set[self._makeAbs(p)] = true;
|
|
1301
|
+
else throw er;
|
|
1302
|
+
}
|
|
1303
|
+
});
|
|
1304
|
+
}
|
|
1305
|
+
common.finish(this);
|
|
1306
|
+
};
|
|
1307
|
+
GlobSync.prototype._process = function(pattern, index, inGlobStar) {
|
|
1308
|
+
assert$2.ok(this instanceof GlobSync);
|
|
1309
|
+
var n = 0;
|
|
1310
|
+
while (typeof pattern[n] === "string") n++;
|
|
1311
|
+
var prefix;
|
|
1312
|
+
switch (n) {
|
|
1313
|
+
case pattern.length:
|
|
1314
|
+
this._processSimple(pattern.join("/"), index);
|
|
1315
|
+
return;
|
|
1316
|
+
case 0:
|
|
1317
|
+
prefix = null;
|
|
1318
|
+
break;
|
|
1319
|
+
default: prefix = pattern.slice(0, n).join("/");
|
|
1320
|
+
}
|
|
1321
|
+
var remain = pattern.slice(n);
|
|
1322
|
+
var read;
|
|
1323
|
+
if (prefix === null) read = ".";
|
|
1324
|
+
else if (isAbsolute(prefix) || isAbsolute(pattern.map(function(p) {
|
|
1325
|
+
return typeof p === "string" ? p : "[*]";
|
|
1326
|
+
}).join("/"))) {
|
|
1327
|
+
if (!prefix || !isAbsolute(prefix)) prefix = "/" + prefix;
|
|
1328
|
+
read = prefix;
|
|
1329
|
+
} else read = prefix;
|
|
1330
|
+
var abs = this._makeAbs(read);
|
|
1331
|
+
if (childrenIgnored(this, read)) return;
|
|
1332
|
+
if (remain[0] === minimatch.GLOBSTAR) this._processGlobStar(prefix, read, abs, remain, index, inGlobStar);
|
|
1333
|
+
else this._processReaddir(prefix, read, abs, remain, index, inGlobStar);
|
|
1334
|
+
};
|
|
1335
|
+
GlobSync.prototype._processReaddir = function(prefix, read, abs, remain, index, inGlobStar) {
|
|
1336
|
+
var entries = this._readdir(abs, inGlobStar);
|
|
1337
|
+
if (!entries) return;
|
|
1338
|
+
var pn = remain[0];
|
|
1339
|
+
var negate = !!this.minimatch.negate;
|
|
1340
|
+
var rawGlob = pn._glob;
|
|
1341
|
+
var dotOk = this.dot || rawGlob.charAt(0) === ".";
|
|
1342
|
+
var matchedEntries = [];
|
|
1343
|
+
for (var i = 0; i < entries.length; i++) {
|
|
1344
|
+
var e = entries[i];
|
|
1345
|
+
if (e.charAt(0) !== "." || dotOk) {
|
|
1346
|
+
var m;
|
|
1347
|
+
if (negate && !prefix) m = !e.match(pn);
|
|
1348
|
+
else m = e.match(pn);
|
|
1349
|
+
if (m) matchedEntries.push(e);
|
|
1350
|
+
}
|
|
1351
|
+
}
|
|
1352
|
+
var len = matchedEntries.length;
|
|
1353
|
+
if (len === 0) return;
|
|
1354
|
+
if (remain.length === 1 && !this.mark && !this.stat) {
|
|
1355
|
+
if (!this.matches[index]) this.matches[index] = Object.create(null);
|
|
1356
|
+
for (var i = 0; i < len; i++) {
|
|
1357
|
+
var e = matchedEntries[i];
|
|
1358
|
+
if (prefix) {
|
|
1359
|
+
if (prefix.slice(-1) !== "/") e = prefix + "/" + e;
|
|
1360
|
+
else e = prefix + e;
|
|
1361
|
+
}
|
|
1362
|
+
if (e.charAt(0) === "/" && !this.nomount) e = path$5.join(this.root, e);
|
|
1363
|
+
this._emitMatch(index, e);
|
|
1364
|
+
}
|
|
1365
|
+
return;
|
|
1366
|
+
}
|
|
1367
|
+
remain.shift();
|
|
1368
|
+
for (var i = 0; i < len; i++) {
|
|
1369
|
+
var e = matchedEntries[i];
|
|
1370
|
+
var newPattern;
|
|
1371
|
+
if (prefix) newPattern = [prefix, e];
|
|
1372
|
+
else newPattern = [e];
|
|
1373
|
+
this._process(newPattern.concat(remain), index, inGlobStar);
|
|
1374
|
+
}
|
|
1375
|
+
};
|
|
1376
|
+
GlobSync.prototype._emitMatch = function(index, e) {
|
|
1377
|
+
if (isIgnored(this, e)) return;
|
|
1378
|
+
var abs = this._makeAbs(e);
|
|
1379
|
+
if (this.mark) e = this._mark(e);
|
|
1380
|
+
if (this.absolute) e = abs;
|
|
1381
|
+
if (this.matches[index][e]) return;
|
|
1382
|
+
if (this.nodir) {
|
|
1383
|
+
var c = this.cache[abs];
|
|
1384
|
+
if (c === "DIR" || Array.isArray(c)) return;
|
|
1385
|
+
}
|
|
1386
|
+
this.matches[index][e] = true;
|
|
1387
|
+
if (this.stat) this._stat(e);
|
|
1388
|
+
};
|
|
1389
|
+
GlobSync.prototype._readdirInGlobStar = function(abs) {
|
|
1390
|
+
if (this.follow) return this._readdir(abs, false);
|
|
1391
|
+
var entries;
|
|
1392
|
+
var lstat;
|
|
1393
|
+
try {
|
|
1394
|
+
lstat = this.fs.lstatSync(abs);
|
|
1395
|
+
} catch (er) {
|
|
1396
|
+
if (er.code === "ENOENT") return null;
|
|
1397
|
+
}
|
|
1398
|
+
var isSym = lstat && lstat.isSymbolicLink();
|
|
1399
|
+
this.symlinks[abs] = isSym;
|
|
1400
|
+
if (!isSym && lstat && !lstat.isDirectory()) this.cache[abs] = "FILE";
|
|
1401
|
+
else entries = this._readdir(abs, false);
|
|
1402
|
+
return entries;
|
|
1403
|
+
};
|
|
1404
|
+
GlobSync.prototype._readdir = function(abs, inGlobStar) {
|
|
1405
|
+
if (inGlobStar && !ownProp(this.symlinks, abs)) return this._readdirInGlobStar(abs);
|
|
1406
|
+
if (ownProp(this.cache, abs)) {
|
|
1407
|
+
var c = this.cache[abs];
|
|
1408
|
+
if (!c || c === "FILE") return null;
|
|
1409
|
+
if (Array.isArray(c)) return c;
|
|
1410
|
+
}
|
|
1411
|
+
try {
|
|
1412
|
+
return this._readdirEntries(abs, this.fs.readdirSync(abs));
|
|
1413
|
+
} catch (er) {
|
|
1414
|
+
this._readdirError(abs, er);
|
|
1415
|
+
return null;
|
|
1416
|
+
}
|
|
1417
|
+
};
|
|
1418
|
+
GlobSync.prototype._readdirEntries = function(abs, entries) {
|
|
1419
|
+
if (!this.mark && !this.stat) for (var i = 0; i < entries.length; i++) {
|
|
1420
|
+
var e = entries[i];
|
|
1421
|
+
if (abs === "/") e = abs + e;
|
|
1422
|
+
else e = abs + "/" + e;
|
|
1423
|
+
this.cache[e] = true;
|
|
1424
|
+
}
|
|
1425
|
+
this.cache[abs] = entries;
|
|
1426
|
+
return entries;
|
|
1427
|
+
};
|
|
1428
|
+
GlobSync.prototype._readdirError = function(f, er) {
|
|
1429
|
+
switch (er.code) {
|
|
1430
|
+
case "ENOTSUP":
|
|
1431
|
+
case "ENOTDIR":
|
|
1432
|
+
var abs = this._makeAbs(f);
|
|
1433
|
+
this.cache[abs] = "FILE";
|
|
1434
|
+
if (abs === this.cwdAbs) {
|
|
1435
|
+
var error = /* @__PURE__ */ new Error(er.code + " invalid cwd " + this.cwd);
|
|
1436
|
+
error.path = this.cwd;
|
|
1437
|
+
error.code = er.code;
|
|
1438
|
+
throw error;
|
|
1439
|
+
}
|
|
1440
|
+
break;
|
|
1441
|
+
case "ENOENT":
|
|
1442
|
+
case "ELOOP":
|
|
1443
|
+
case "ENAMETOOLONG":
|
|
1444
|
+
case "UNKNOWN":
|
|
1445
|
+
this.cache[this._makeAbs(f)] = false;
|
|
1446
|
+
break;
|
|
1447
|
+
default:
|
|
1448
|
+
this.cache[this._makeAbs(f)] = false;
|
|
1449
|
+
if (this.strict) throw er;
|
|
1450
|
+
if (!this.silent) console.error("glob error", er);
|
|
1451
|
+
}
|
|
1452
|
+
};
|
|
1453
|
+
GlobSync.prototype._processGlobStar = function(prefix, read, abs, remain, index, inGlobStar) {
|
|
1454
|
+
var entries = this._readdir(abs, inGlobStar);
|
|
1455
|
+
if (!entries) return;
|
|
1456
|
+
var remainWithoutGlobStar = remain.slice(1);
|
|
1457
|
+
var gspref = prefix ? [prefix] : [];
|
|
1458
|
+
var noGlobStar = gspref.concat(remainWithoutGlobStar);
|
|
1459
|
+
this._process(noGlobStar, index, false);
|
|
1460
|
+
var len = entries.length;
|
|
1461
|
+
if (this.symlinks[abs] && inGlobStar) return;
|
|
1462
|
+
for (var i = 0; i < len; i++) {
|
|
1463
|
+
if (entries[i].charAt(0) === "." && !this.dot) continue;
|
|
1464
|
+
var instead = gspref.concat(entries[i], remainWithoutGlobStar);
|
|
1465
|
+
this._process(instead, index, true);
|
|
1466
|
+
var below = gspref.concat(entries[i], remain);
|
|
1467
|
+
this._process(below, index, true);
|
|
1468
|
+
}
|
|
1469
|
+
};
|
|
1470
|
+
GlobSync.prototype._processSimple = function(prefix, index) {
|
|
1471
|
+
var exists = this._stat(prefix);
|
|
1472
|
+
if (!this.matches[index]) this.matches[index] = Object.create(null);
|
|
1473
|
+
if (!exists) return;
|
|
1474
|
+
if (prefix && isAbsolute(prefix) && !this.nomount) {
|
|
1475
|
+
var trail = /[\/\\]$/.test(prefix);
|
|
1476
|
+
if (prefix.charAt(0) === "/") prefix = path$5.join(this.root, prefix);
|
|
1477
|
+
else {
|
|
1478
|
+
prefix = path$5.resolve(this.root, prefix);
|
|
1479
|
+
if (trail) prefix += "/";
|
|
1480
|
+
}
|
|
1481
|
+
}
|
|
1482
|
+
if (process.platform === "win32") prefix = prefix.replace(/\\/g, "/");
|
|
1483
|
+
this._emitMatch(index, prefix);
|
|
1484
|
+
};
|
|
1485
|
+
GlobSync.prototype._stat = function(f) {
|
|
1486
|
+
var abs = this._makeAbs(f);
|
|
1487
|
+
var needDir = f.slice(-1) === "/";
|
|
1488
|
+
if (f.length > this.maxLength) return false;
|
|
1489
|
+
if (!this.stat && ownProp(this.cache, abs)) {
|
|
1490
|
+
var c = this.cache[abs];
|
|
1491
|
+
if (Array.isArray(c)) c = "DIR";
|
|
1492
|
+
if (!needDir || c === "DIR") return c;
|
|
1493
|
+
if (needDir && c === "FILE") return false;
|
|
1494
|
+
}
|
|
1495
|
+
var stat = this.statCache[abs];
|
|
1496
|
+
if (!stat) {
|
|
1497
|
+
var lstat;
|
|
1498
|
+
try {
|
|
1499
|
+
lstat = this.fs.lstatSync(abs);
|
|
1500
|
+
} catch (er) {
|
|
1501
|
+
if (er && (er.code === "ENOENT" || er.code === "ENOTDIR")) {
|
|
1502
|
+
this.statCache[abs] = false;
|
|
1503
|
+
return false;
|
|
1504
|
+
}
|
|
1505
|
+
}
|
|
1506
|
+
if (lstat && lstat.isSymbolicLink()) try {
|
|
1507
|
+
stat = this.fs.statSync(abs);
|
|
1508
|
+
} catch (er) {
|
|
1509
|
+
stat = lstat;
|
|
1510
|
+
}
|
|
1511
|
+
else stat = lstat;
|
|
1512
|
+
}
|
|
1513
|
+
this.statCache[abs] = stat;
|
|
1514
|
+
var c = true;
|
|
1515
|
+
if (stat) c = stat.isDirectory() ? "DIR" : "FILE";
|
|
1516
|
+
this.cache[abs] = this.cache[abs] || c;
|
|
1517
|
+
if (needDir && c === "FILE") return false;
|
|
1518
|
+
return c;
|
|
1519
|
+
};
|
|
1520
|
+
GlobSync.prototype._mark = function(p) {
|
|
1521
|
+
return common.mark(this, p);
|
|
1522
|
+
};
|
|
1523
|
+
GlobSync.prototype._makeAbs = function(f) {
|
|
1524
|
+
return common.makeAbs(this, f);
|
|
1525
|
+
};
|
|
1526
|
+
}));
|
|
1527
|
+
//#endregion
|
|
1528
|
+
//#region ../../node_modules/.pnpm/wrappy@1.0.2/node_modules/wrappy/wrappy.js
|
|
1529
|
+
var require_wrappy = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1530
|
+
module.exports = wrappy;
|
|
1531
|
+
function wrappy(fn, cb) {
|
|
1532
|
+
if (fn && cb) return wrappy(fn)(cb);
|
|
1533
|
+
if (typeof fn !== "function") throw new TypeError("need wrapper function");
|
|
1534
|
+
Object.keys(fn).forEach(function(k) {
|
|
1535
|
+
wrapper[k] = fn[k];
|
|
1536
|
+
});
|
|
1537
|
+
return wrapper;
|
|
1538
|
+
function wrapper() {
|
|
1539
|
+
var args = new Array(arguments.length);
|
|
1540
|
+
for (var i = 0; i < args.length; i++) args[i] = arguments[i];
|
|
1541
|
+
var ret = fn.apply(this, args);
|
|
1542
|
+
var cb = args[args.length - 1];
|
|
1543
|
+
if (typeof ret === "function" && ret !== cb) Object.keys(cb).forEach(function(k) {
|
|
1544
|
+
ret[k] = cb[k];
|
|
1545
|
+
});
|
|
1546
|
+
return ret;
|
|
1547
|
+
}
|
|
1548
|
+
}
|
|
1549
|
+
}));
|
|
1550
|
+
//#endregion
|
|
1551
|
+
//#region ../../node_modules/.pnpm/once@1.4.0/node_modules/once/once.js
|
|
1552
|
+
var require_once = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1553
|
+
var wrappy = require_wrappy();
|
|
1554
|
+
module.exports = wrappy(once);
|
|
1555
|
+
module.exports.strict = wrappy(onceStrict);
|
|
1556
|
+
once.proto = once(function() {
|
|
1557
|
+
Object.defineProperty(Function.prototype, "once", {
|
|
1558
|
+
value: function() {
|
|
1559
|
+
return once(this);
|
|
1560
|
+
},
|
|
1561
|
+
configurable: true
|
|
1562
|
+
});
|
|
1563
|
+
Object.defineProperty(Function.prototype, "onceStrict", {
|
|
1564
|
+
value: function() {
|
|
1565
|
+
return onceStrict(this);
|
|
1566
|
+
},
|
|
1567
|
+
configurable: true
|
|
1568
|
+
});
|
|
1569
|
+
});
|
|
1570
|
+
function once(fn) {
|
|
1571
|
+
var f = function() {
|
|
1572
|
+
if (f.called) return f.value;
|
|
1573
|
+
f.called = true;
|
|
1574
|
+
return f.value = fn.apply(this, arguments);
|
|
1575
|
+
};
|
|
1576
|
+
f.called = false;
|
|
1577
|
+
return f;
|
|
1578
|
+
}
|
|
1579
|
+
function onceStrict(fn) {
|
|
1580
|
+
var f = function() {
|
|
1581
|
+
if (f.called) throw new Error(f.onceError);
|
|
1582
|
+
f.called = true;
|
|
1583
|
+
return f.value = fn.apply(this, arguments);
|
|
1584
|
+
};
|
|
1585
|
+
f.onceError = (fn.name || "Function wrapped with `once`") + " shouldn't be called more than once";
|
|
1586
|
+
f.called = false;
|
|
1587
|
+
return f;
|
|
1588
|
+
}
|
|
1589
|
+
}));
|
|
1590
|
+
//#endregion
|
|
1591
|
+
//#region ../../node_modules/.pnpm/inflight@1.0.6/node_modules/inflight/inflight.js
|
|
1592
|
+
var require_inflight = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1593
|
+
var wrappy = require_wrappy();
|
|
1594
|
+
var reqs = Object.create(null);
|
|
1595
|
+
var once = require_once();
|
|
1596
|
+
module.exports = wrappy(inflight);
|
|
1597
|
+
function inflight(key, cb) {
|
|
1598
|
+
if (reqs[key]) {
|
|
1599
|
+
reqs[key].push(cb);
|
|
1600
|
+
return null;
|
|
1601
|
+
} else {
|
|
1602
|
+
reqs[key] = [cb];
|
|
1603
|
+
return makeres(key);
|
|
1604
|
+
}
|
|
1605
|
+
}
|
|
1606
|
+
function makeres(key) {
|
|
1607
|
+
return once(function RES() {
|
|
1608
|
+
var cbs = reqs[key];
|
|
1609
|
+
var len = cbs.length;
|
|
1610
|
+
var args = slice(arguments);
|
|
1611
|
+
try {
|
|
1612
|
+
for (var i = 0; i < len; i++) cbs[i].apply(null, args);
|
|
1613
|
+
} finally {
|
|
1614
|
+
if (cbs.length > len) {
|
|
1615
|
+
cbs.splice(0, len);
|
|
1616
|
+
process.nextTick(function() {
|
|
1617
|
+
RES.apply(null, args);
|
|
1618
|
+
});
|
|
1619
|
+
} else delete reqs[key];
|
|
1620
|
+
}
|
|
1621
|
+
});
|
|
1622
|
+
}
|
|
1623
|
+
function slice(args) {
|
|
1624
|
+
var length = args.length;
|
|
1625
|
+
var array = [];
|
|
1626
|
+
for (var i = 0; i < length; i++) array[i] = args[i];
|
|
1627
|
+
return array;
|
|
1628
|
+
}
|
|
1629
|
+
}));
|
|
1630
|
+
//#endregion
|
|
1631
|
+
//#region ../../node_modules/.pnpm/glob@7.2.3/node_modules/glob/glob.js
|
|
1632
|
+
var require_glob = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
1633
|
+
module.exports = glob;
|
|
1634
|
+
var rp = require_fs_realpath();
|
|
1635
|
+
var minimatch = require_minimatch();
|
|
1636
|
+
minimatch.Minimatch;
|
|
1637
|
+
var inherits = require_inherits();
|
|
1638
|
+
var EE = __require("events").EventEmitter;
|
|
1639
|
+
var path$4 = __require("path");
|
|
1640
|
+
var assert$1 = __require("assert");
|
|
1641
|
+
var isAbsolute = require_path_is_absolute();
|
|
1642
|
+
var globSync = require_sync();
|
|
1643
|
+
var common = require_common();
|
|
1644
|
+
var setopts = common.setopts;
|
|
1645
|
+
var ownProp = common.ownProp;
|
|
1646
|
+
var inflight = require_inflight();
|
|
1647
|
+
__require("util");
|
|
1648
|
+
var childrenIgnored = common.childrenIgnored;
|
|
1649
|
+
var isIgnored = common.isIgnored;
|
|
1650
|
+
var once = require_once();
|
|
1651
|
+
function glob(pattern, options, cb) {
|
|
1652
|
+
if (typeof options === "function") cb = options, options = {};
|
|
1653
|
+
if (!options) options = {};
|
|
1654
|
+
if (options.sync) {
|
|
1655
|
+
if (cb) throw new TypeError("callback provided to sync glob");
|
|
1656
|
+
return globSync(pattern, options);
|
|
1657
|
+
}
|
|
1658
|
+
return new Glob(pattern, options, cb);
|
|
1659
|
+
}
|
|
1660
|
+
glob.sync = globSync;
|
|
1661
|
+
var GlobSync = glob.GlobSync = globSync.GlobSync;
|
|
1662
|
+
glob.glob = glob;
|
|
1663
|
+
function extend(origin, add) {
|
|
1664
|
+
if (add === null || typeof add !== "object") return origin;
|
|
1665
|
+
var keys = Object.keys(add);
|
|
1666
|
+
var i = keys.length;
|
|
1667
|
+
while (i--) origin[keys[i]] = add[keys[i]];
|
|
1668
|
+
return origin;
|
|
1669
|
+
}
|
|
1670
|
+
glob.hasMagic = function(pattern, options_) {
|
|
1671
|
+
var options = extend({}, options_);
|
|
1672
|
+
options.noprocess = true;
|
|
1673
|
+
var set = new Glob(pattern, options).minimatch.set;
|
|
1674
|
+
if (!pattern) return false;
|
|
1675
|
+
if (set.length > 1) return true;
|
|
1676
|
+
for (var j = 0; j < set[0].length; j++) if (typeof set[0][j] !== "string") return true;
|
|
1677
|
+
return false;
|
|
1678
|
+
};
|
|
1679
|
+
glob.Glob = Glob;
|
|
1680
|
+
inherits(Glob, EE);
|
|
1681
|
+
function Glob(pattern, options, cb) {
|
|
1682
|
+
if (typeof options === "function") {
|
|
1683
|
+
cb = options;
|
|
1684
|
+
options = null;
|
|
1685
|
+
}
|
|
1686
|
+
if (options && options.sync) {
|
|
1687
|
+
if (cb) throw new TypeError("callback provided to sync glob");
|
|
1688
|
+
return new GlobSync(pattern, options);
|
|
1689
|
+
}
|
|
1690
|
+
if (!(this instanceof Glob)) return new Glob(pattern, options, cb);
|
|
1691
|
+
setopts(this, pattern, options);
|
|
1692
|
+
this._didRealPath = false;
|
|
1693
|
+
var n = this.minimatch.set.length;
|
|
1694
|
+
this.matches = new Array(n);
|
|
1695
|
+
if (typeof cb === "function") {
|
|
1696
|
+
cb = once(cb);
|
|
1697
|
+
this.on("error", cb);
|
|
1698
|
+
this.on("end", function(matches) {
|
|
1699
|
+
cb(null, matches);
|
|
1700
|
+
});
|
|
1701
|
+
}
|
|
1702
|
+
var self = this;
|
|
1703
|
+
this._processing = 0;
|
|
1704
|
+
this._emitQueue = [];
|
|
1705
|
+
this._processQueue = [];
|
|
1706
|
+
this.paused = false;
|
|
1707
|
+
if (this.noprocess) return this;
|
|
1708
|
+
if (n === 0) return done();
|
|
1709
|
+
var sync = true;
|
|
1710
|
+
for (var i = 0; i < n; i++) this._process(this.minimatch.set[i], i, false, done);
|
|
1711
|
+
sync = false;
|
|
1712
|
+
function done() {
|
|
1713
|
+
--self._processing;
|
|
1714
|
+
if (self._processing <= 0) {
|
|
1715
|
+
if (sync) process.nextTick(function() {
|
|
1716
|
+
self._finish();
|
|
1717
|
+
});
|
|
1718
|
+
else self._finish();
|
|
1719
|
+
}
|
|
1720
|
+
}
|
|
1721
|
+
}
|
|
1722
|
+
Glob.prototype._finish = function() {
|
|
1723
|
+
assert$1(this instanceof Glob);
|
|
1724
|
+
if (this.aborted) return;
|
|
1725
|
+
if (this.realpath && !this._didRealpath) return this._realpath();
|
|
1726
|
+
common.finish(this);
|
|
1727
|
+
this.emit("end", this.found);
|
|
1728
|
+
};
|
|
1729
|
+
Glob.prototype._realpath = function() {
|
|
1730
|
+
if (this._didRealpath) return;
|
|
1731
|
+
this._didRealpath = true;
|
|
1732
|
+
var n = this.matches.length;
|
|
1733
|
+
if (n === 0) return this._finish();
|
|
1734
|
+
var self = this;
|
|
1735
|
+
for (var i = 0; i < this.matches.length; i++) this._realpathSet(i, next);
|
|
1736
|
+
function next() {
|
|
1737
|
+
if (--n === 0) self._finish();
|
|
1738
|
+
}
|
|
1739
|
+
};
|
|
1740
|
+
Glob.prototype._realpathSet = function(index, cb) {
|
|
1741
|
+
var matchset = this.matches[index];
|
|
1742
|
+
if (!matchset) return cb();
|
|
1743
|
+
var found = Object.keys(matchset);
|
|
1744
|
+
var self = this;
|
|
1745
|
+
var n = found.length;
|
|
1746
|
+
if (n === 0) return cb();
|
|
1747
|
+
var set = this.matches[index] = Object.create(null);
|
|
1748
|
+
found.forEach(function(p, i) {
|
|
1749
|
+
p = self._makeAbs(p);
|
|
1750
|
+
rp.realpath(p, self.realpathCache, function(er, real) {
|
|
1751
|
+
if (!er) set[real] = true;
|
|
1752
|
+
else if (er.syscall === "stat") set[p] = true;
|
|
1753
|
+
else self.emit("error", er);
|
|
1754
|
+
if (--n === 0) {
|
|
1755
|
+
self.matches[index] = set;
|
|
1756
|
+
cb();
|
|
1757
|
+
}
|
|
1758
|
+
});
|
|
1759
|
+
});
|
|
1760
|
+
};
|
|
1761
|
+
Glob.prototype._mark = function(p) {
|
|
1762
|
+
return common.mark(this, p);
|
|
1763
|
+
};
|
|
1764
|
+
Glob.prototype._makeAbs = function(f) {
|
|
1765
|
+
return common.makeAbs(this, f);
|
|
1766
|
+
};
|
|
1767
|
+
Glob.prototype.abort = function() {
|
|
1768
|
+
this.aborted = true;
|
|
1769
|
+
this.emit("abort");
|
|
1770
|
+
};
|
|
1771
|
+
Glob.prototype.pause = function() {
|
|
1772
|
+
if (!this.paused) {
|
|
1773
|
+
this.paused = true;
|
|
1774
|
+
this.emit("pause");
|
|
1775
|
+
}
|
|
1776
|
+
};
|
|
1777
|
+
Glob.prototype.resume = function() {
|
|
1778
|
+
if (this.paused) {
|
|
1779
|
+
this.emit("resume");
|
|
1780
|
+
this.paused = false;
|
|
1781
|
+
if (this._emitQueue.length) {
|
|
1782
|
+
var eq = this._emitQueue.slice(0);
|
|
1783
|
+
this._emitQueue.length = 0;
|
|
1784
|
+
for (var i = 0; i < eq.length; i++) {
|
|
1785
|
+
var e = eq[i];
|
|
1786
|
+
this._emitMatch(e[0], e[1]);
|
|
1787
|
+
}
|
|
1788
|
+
}
|
|
1789
|
+
if (this._processQueue.length) {
|
|
1790
|
+
var pq = this._processQueue.slice(0);
|
|
1791
|
+
this._processQueue.length = 0;
|
|
1792
|
+
for (var i = 0; i < pq.length; i++) {
|
|
1793
|
+
var p = pq[i];
|
|
1794
|
+
this._processing--;
|
|
1795
|
+
this._process(p[0], p[1], p[2], p[3]);
|
|
1796
|
+
}
|
|
1797
|
+
}
|
|
1798
|
+
}
|
|
1799
|
+
};
|
|
1800
|
+
Glob.prototype._process = function(pattern, index, inGlobStar, cb) {
|
|
1801
|
+
assert$1(this instanceof Glob);
|
|
1802
|
+
assert$1(typeof cb === "function");
|
|
1803
|
+
if (this.aborted) return;
|
|
1804
|
+
this._processing++;
|
|
1805
|
+
if (this.paused) {
|
|
1806
|
+
this._processQueue.push([
|
|
1807
|
+
pattern,
|
|
1808
|
+
index,
|
|
1809
|
+
inGlobStar,
|
|
1810
|
+
cb
|
|
1811
|
+
]);
|
|
1812
|
+
return;
|
|
1813
|
+
}
|
|
1814
|
+
var n = 0;
|
|
1815
|
+
while (typeof pattern[n] === "string") n++;
|
|
1816
|
+
var prefix;
|
|
1817
|
+
switch (n) {
|
|
1818
|
+
case pattern.length:
|
|
1819
|
+
this._processSimple(pattern.join("/"), index, cb);
|
|
1820
|
+
return;
|
|
1821
|
+
case 0:
|
|
1822
|
+
prefix = null;
|
|
1823
|
+
break;
|
|
1824
|
+
default: prefix = pattern.slice(0, n).join("/");
|
|
1825
|
+
}
|
|
1826
|
+
var remain = pattern.slice(n);
|
|
1827
|
+
var read;
|
|
1828
|
+
if (prefix === null) read = ".";
|
|
1829
|
+
else if (isAbsolute(prefix) || isAbsolute(pattern.map(function(p) {
|
|
1830
|
+
return typeof p === "string" ? p : "[*]";
|
|
1831
|
+
}).join("/"))) {
|
|
1832
|
+
if (!prefix || !isAbsolute(prefix)) prefix = "/" + prefix;
|
|
1833
|
+
read = prefix;
|
|
1834
|
+
} else read = prefix;
|
|
1835
|
+
var abs = this._makeAbs(read);
|
|
1836
|
+
if (childrenIgnored(this, read)) return cb();
|
|
1837
|
+
if (remain[0] === minimatch.GLOBSTAR) this._processGlobStar(prefix, read, abs, remain, index, inGlobStar, cb);
|
|
1838
|
+
else this._processReaddir(prefix, read, abs, remain, index, inGlobStar, cb);
|
|
1839
|
+
};
|
|
1840
|
+
Glob.prototype._processReaddir = function(prefix, read, abs, remain, index, inGlobStar, cb) {
|
|
1841
|
+
var self = this;
|
|
1842
|
+
this._readdir(abs, inGlobStar, function(er, entries) {
|
|
1843
|
+
return self._processReaddir2(prefix, read, abs, remain, index, inGlobStar, entries, cb);
|
|
1844
|
+
});
|
|
1845
|
+
};
|
|
1846
|
+
Glob.prototype._processReaddir2 = function(prefix, read, abs, remain, index, inGlobStar, entries, cb) {
|
|
1847
|
+
if (!entries) return cb();
|
|
1848
|
+
var pn = remain[0];
|
|
1849
|
+
var negate = !!this.minimatch.negate;
|
|
1850
|
+
var rawGlob = pn._glob;
|
|
1851
|
+
var dotOk = this.dot || rawGlob.charAt(0) === ".";
|
|
1852
|
+
var matchedEntries = [];
|
|
1853
|
+
for (var i = 0; i < entries.length; i++) {
|
|
1854
|
+
var e = entries[i];
|
|
1855
|
+
if (e.charAt(0) !== "." || dotOk) {
|
|
1856
|
+
var m;
|
|
1857
|
+
if (negate && !prefix) m = !e.match(pn);
|
|
1858
|
+
else m = e.match(pn);
|
|
1859
|
+
if (m) matchedEntries.push(e);
|
|
1860
|
+
}
|
|
1861
|
+
}
|
|
1862
|
+
var len = matchedEntries.length;
|
|
1863
|
+
if (len === 0) return cb();
|
|
1864
|
+
if (remain.length === 1 && !this.mark && !this.stat) {
|
|
1865
|
+
if (!this.matches[index]) this.matches[index] = Object.create(null);
|
|
1866
|
+
for (var i = 0; i < len; i++) {
|
|
1867
|
+
var e = matchedEntries[i];
|
|
1868
|
+
if (prefix) {
|
|
1869
|
+
if (prefix !== "/") e = prefix + "/" + e;
|
|
1870
|
+
else e = prefix + e;
|
|
1871
|
+
}
|
|
1872
|
+
if (e.charAt(0) === "/" && !this.nomount) e = path$4.join(this.root, e);
|
|
1873
|
+
this._emitMatch(index, e);
|
|
1874
|
+
}
|
|
1875
|
+
return cb();
|
|
1876
|
+
}
|
|
1877
|
+
remain.shift();
|
|
1878
|
+
for (var i = 0; i < len; i++) {
|
|
1879
|
+
var e = matchedEntries[i];
|
|
1880
|
+
if (prefix) {
|
|
1881
|
+
if (prefix !== "/") e = prefix + "/" + e;
|
|
1882
|
+
else e = prefix + e;
|
|
1883
|
+
}
|
|
1884
|
+
this._process([e].concat(remain), index, inGlobStar, cb);
|
|
1885
|
+
}
|
|
1886
|
+
cb();
|
|
1887
|
+
};
|
|
1888
|
+
Glob.prototype._emitMatch = function(index, e) {
|
|
1889
|
+
if (this.aborted) return;
|
|
1890
|
+
if (isIgnored(this, e)) return;
|
|
1891
|
+
if (this.paused) {
|
|
1892
|
+
this._emitQueue.push([index, e]);
|
|
1893
|
+
return;
|
|
1894
|
+
}
|
|
1895
|
+
var abs = isAbsolute(e) ? e : this._makeAbs(e);
|
|
1896
|
+
if (this.mark) e = this._mark(e);
|
|
1897
|
+
if (this.absolute) e = abs;
|
|
1898
|
+
if (this.matches[index][e]) return;
|
|
1899
|
+
if (this.nodir) {
|
|
1900
|
+
var c = this.cache[abs];
|
|
1901
|
+
if (c === "DIR" || Array.isArray(c)) return;
|
|
1902
|
+
}
|
|
1903
|
+
this.matches[index][e] = true;
|
|
1904
|
+
var st = this.statCache[abs];
|
|
1905
|
+
if (st) this.emit("stat", e, st);
|
|
1906
|
+
this.emit("match", e);
|
|
1907
|
+
};
|
|
1908
|
+
Glob.prototype._readdirInGlobStar = function(abs, cb) {
|
|
1909
|
+
if (this.aborted) return;
|
|
1910
|
+
if (this.follow) return this._readdir(abs, false, cb);
|
|
1911
|
+
var lstatkey = "lstat\0" + abs;
|
|
1912
|
+
var self = this;
|
|
1913
|
+
var lstatcb = inflight(lstatkey, lstatcb_);
|
|
1914
|
+
if (lstatcb) self.fs.lstat(abs, lstatcb);
|
|
1915
|
+
function lstatcb_(er, lstat) {
|
|
1916
|
+
if (er && er.code === "ENOENT") return cb();
|
|
1917
|
+
var isSym = lstat && lstat.isSymbolicLink();
|
|
1918
|
+
self.symlinks[abs] = isSym;
|
|
1919
|
+
if (!isSym && lstat && !lstat.isDirectory()) {
|
|
1920
|
+
self.cache[abs] = "FILE";
|
|
1921
|
+
cb();
|
|
1922
|
+
} else self._readdir(abs, false, cb);
|
|
1923
|
+
}
|
|
1924
|
+
};
|
|
1925
|
+
Glob.prototype._readdir = function(abs, inGlobStar, cb) {
|
|
1926
|
+
if (this.aborted) return;
|
|
1927
|
+
cb = inflight("readdir\0" + abs + "\0" + inGlobStar, cb);
|
|
1928
|
+
if (!cb) return;
|
|
1929
|
+
if (inGlobStar && !ownProp(this.symlinks, abs)) return this._readdirInGlobStar(abs, cb);
|
|
1930
|
+
if (ownProp(this.cache, abs)) {
|
|
1931
|
+
var c = this.cache[abs];
|
|
1932
|
+
if (!c || c === "FILE") return cb();
|
|
1933
|
+
if (Array.isArray(c)) return cb(null, c);
|
|
1934
|
+
}
|
|
1935
|
+
this.fs.readdir(abs, readdirCb(this, abs, cb));
|
|
1936
|
+
};
|
|
1937
|
+
function readdirCb(self, abs, cb) {
|
|
1938
|
+
return function(er, entries) {
|
|
1939
|
+
if (er) self._readdirError(abs, er, cb);
|
|
1940
|
+
else self._readdirEntries(abs, entries, cb);
|
|
1941
|
+
};
|
|
1942
|
+
}
|
|
1943
|
+
Glob.prototype._readdirEntries = function(abs, entries, cb) {
|
|
1944
|
+
if (this.aborted) return;
|
|
1945
|
+
if (!this.mark && !this.stat) for (var i = 0; i < entries.length; i++) {
|
|
1946
|
+
var e = entries[i];
|
|
1947
|
+
if (abs === "/") e = abs + e;
|
|
1948
|
+
else e = abs + "/" + e;
|
|
1949
|
+
this.cache[e] = true;
|
|
1950
|
+
}
|
|
1951
|
+
this.cache[abs] = entries;
|
|
1952
|
+
return cb(null, entries);
|
|
1953
|
+
};
|
|
1954
|
+
Glob.prototype._readdirError = function(f, er, cb) {
|
|
1955
|
+
if (this.aborted) return;
|
|
1956
|
+
switch (er.code) {
|
|
1957
|
+
case "ENOTSUP":
|
|
1958
|
+
case "ENOTDIR":
|
|
1959
|
+
var abs = this._makeAbs(f);
|
|
1960
|
+
this.cache[abs] = "FILE";
|
|
1961
|
+
if (abs === this.cwdAbs) {
|
|
1962
|
+
var error = /* @__PURE__ */ new Error(er.code + " invalid cwd " + this.cwd);
|
|
1963
|
+
error.path = this.cwd;
|
|
1964
|
+
error.code = er.code;
|
|
1965
|
+
this.emit("error", error);
|
|
1966
|
+
this.abort();
|
|
1967
|
+
}
|
|
1968
|
+
break;
|
|
1969
|
+
case "ENOENT":
|
|
1970
|
+
case "ELOOP":
|
|
1971
|
+
case "ENAMETOOLONG":
|
|
1972
|
+
case "UNKNOWN":
|
|
1973
|
+
this.cache[this._makeAbs(f)] = false;
|
|
1974
|
+
break;
|
|
1975
|
+
default:
|
|
1976
|
+
this.cache[this._makeAbs(f)] = false;
|
|
1977
|
+
if (this.strict) {
|
|
1978
|
+
this.emit("error", er);
|
|
1979
|
+
this.abort();
|
|
1980
|
+
}
|
|
1981
|
+
if (!this.silent) console.error("glob error", er);
|
|
1982
|
+
}
|
|
1983
|
+
return cb();
|
|
1984
|
+
};
|
|
1985
|
+
Glob.prototype._processGlobStar = function(prefix, read, abs, remain, index, inGlobStar, cb) {
|
|
1986
|
+
var self = this;
|
|
1987
|
+
this._readdir(abs, inGlobStar, function(er, entries) {
|
|
1988
|
+
self._processGlobStar2(prefix, read, abs, remain, index, inGlobStar, entries, cb);
|
|
1989
|
+
});
|
|
1990
|
+
};
|
|
1991
|
+
Glob.prototype._processGlobStar2 = function(prefix, read, abs, remain, index, inGlobStar, entries, cb) {
|
|
1992
|
+
if (!entries) return cb();
|
|
1993
|
+
var remainWithoutGlobStar = remain.slice(1);
|
|
1994
|
+
var gspref = prefix ? [prefix] : [];
|
|
1995
|
+
var noGlobStar = gspref.concat(remainWithoutGlobStar);
|
|
1996
|
+
this._process(noGlobStar, index, false, cb);
|
|
1997
|
+
var isSym = this.symlinks[abs];
|
|
1998
|
+
var len = entries.length;
|
|
1999
|
+
if (isSym && inGlobStar) return cb();
|
|
2000
|
+
for (var i = 0; i < len; i++) {
|
|
2001
|
+
if (entries[i].charAt(0) === "." && !this.dot) continue;
|
|
2002
|
+
var instead = gspref.concat(entries[i], remainWithoutGlobStar);
|
|
2003
|
+
this._process(instead, index, true, cb);
|
|
2004
|
+
var below = gspref.concat(entries[i], remain);
|
|
2005
|
+
this._process(below, index, true, cb);
|
|
2006
|
+
}
|
|
2007
|
+
cb();
|
|
2008
|
+
};
|
|
2009
|
+
Glob.prototype._processSimple = function(prefix, index, cb) {
|
|
2010
|
+
var self = this;
|
|
2011
|
+
this._stat(prefix, function(er, exists) {
|
|
2012
|
+
self._processSimple2(prefix, index, er, exists, cb);
|
|
2013
|
+
});
|
|
2014
|
+
};
|
|
2015
|
+
Glob.prototype._processSimple2 = function(prefix, index, er, exists, cb) {
|
|
2016
|
+
if (!this.matches[index]) this.matches[index] = Object.create(null);
|
|
2017
|
+
if (!exists) return cb();
|
|
2018
|
+
if (prefix && isAbsolute(prefix) && !this.nomount) {
|
|
2019
|
+
var trail = /[\/\\]$/.test(prefix);
|
|
2020
|
+
if (prefix.charAt(0) === "/") prefix = path$4.join(this.root, prefix);
|
|
2021
|
+
else {
|
|
2022
|
+
prefix = path$4.resolve(this.root, prefix);
|
|
2023
|
+
if (trail) prefix += "/";
|
|
2024
|
+
}
|
|
2025
|
+
}
|
|
2026
|
+
if (process.platform === "win32") prefix = prefix.replace(/\\/g, "/");
|
|
2027
|
+
this._emitMatch(index, prefix);
|
|
2028
|
+
cb();
|
|
2029
|
+
};
|
|
2030
|
+
Glob.prototype._stat = function(f, cb) {
|
|
2031
|
+
var abs = this._makeAbs(f);
|
|
2032
|
+
var needDir = f.slice(-1) === "/";
|
|
2033
|
+
if (f.length > this.maxLength) return cb();
|
|
2034
|
+
if (!this.stat && ownProp(this.cache, abs)) {
|
|
2035
|
+
var c = this.cache[abs];
|
|
2036
|
+
if (Array.isArray(c)) c = "DIR";
|
|
2037
|
+
if (!needDir || c === "DIR") return cb(null, c);
|
|
2038
|
+
if (needDir && c === "FILE") return cb();
|
|
2039
|
+
}
|
|
2040
|
+
var stat = this.statCache[abs];
|
|
2041
|
+
if (stat !== void 0) {
|
|
2042
|
+
if (stat === false) return cb(null, stat);
|
|
2043
|
+
else {
|
|
2044
|
+
var type = stat.isDirectory() ? "DIR" : "FILE";
|
|
2045
|
+
if (needDir && type === "FILE") return cb();
|
|
2046
|
+
else return cb(null, type, stat);
|
|
2047
|
+
}
|
|
2048
|
+
}
|
|
2049
|
+
var self = this;
|
|
2050
|
+
var statcb = inflight("stat\0" + abs, lstatcb_);
|
|
2051
|
+
if (statcb) self.fs.lstat(abs, statcb);
|
|
2052
|
+
function lstatcb_(er, lstat) {
|
|
2053
|
+
if (lstat && lstat.isSymbolicLink()) return self.fs.stat(abs, function(er, stat) {
|
|
2054
|
+
if (er) self._stat2(f, abs, null, lstat, cb);
|
|
2055
|
+
else self._stat2(f, abs, er, stat, cb);
|
|
2056
|
+
});
|
|
2057
|
+
else self._stat2(f, abs, er, lstat, cb);
|
|
2058
|
+
}
|
|
2059
|
+
};
|
|
2060
|
+
Glob.prototype._stat2 = function(f, abs, er, stat, cb) {
|
|
2061
|
+
if (er && (er.code === "ENOENT" || er.code === "ENOTDIR")) {
|
|
2062
|
+
this.statCache[abs] = false;
|
|
2063
|
+
return cb();
|
|
2064
|
+
}
|
|
2065
|
+
var needDir = f.slice(-1) === "/";
|
|
2066
|
+
this.statCache[abs] = stat;
|
|
2067
|
+
if (abs.slice(-1) === "/" && stat && !stat.isDirectory()) return cb(null, false, stat);
|
|
2068
|
+
var c = true;
|
|
2069
|
+
if (stat) c = stat.isDirectory() ? "DIR" : "FILE";
|
|
2070
|
+
this.cache[abs] = this.cache[abs] || c;
|
|
2071
|
+
if (needDir && c === "FILE") return cb();
|
|
2072
|
+
return cb(null, c, stat);
|
|
2073
|
+
};
|
|
2074
|
+
}));
|
|
2075
|
+
//#endregion
|
|
2076
|
+
//#region ../../node_modules/.pnpm/rimraf@2.6.3/node_modules/rimraf/rimraf.js
|
|
2077
|
+
var require_rimraf = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2078
|
+
module.exports = rimraf;
|
|
2079
|
+
rimraf.sync = rimrafSync;
|
|
2080
|
+
var assert = __require("assert");
|
|
2081
|
+
var path$3 = __require("path");
|
|
2082
|
+
var fs$3 = __require("fs");
|
|
2083
|
+
var glob = require_glob();
|
|
2084
|
+
var _0666 = parseInt("666", 8);
|
|
2085
|
+
var defaultGlobOpts = {
|
|
2086
|
+
nosort: true,
|
|
2087
|
+
silent: true
|
|
2088
|
+
};
|
|
2089
|
+
var timeout = 0;
|
|
2090
|
+
var isWindows = process.platform === "win32";
|
|
2091
|
+
function defaults(options) {
|
|
2092
|
+
[
|
|
2093
|
+
"unlink",
|
|
2094
|
+
"chmod",
|
|
2095
|
+
"stat",
|
|
2096
|
+
"lstat",
|
|
2097
|
+
"rmdir",
|
|
2098
|
+
"readdir"
|
|
2099
|
+
].forEach(function(m) {
|
|
2100
|
+
options[m] = options[m] || fs$3[m];
|
|
2101
|
+
m = m + "Sync";
|
|
2102
|
+
options[m] = options[m] || fs$3[m];
|
|
2103
|
+
});
|
|
2104
|
+
options.maxBusyTries = options.maxBusyTries || 3;
|
|
2105
|
+
options.emfileWait = options.emfileWait || 1e3;
|
|
2106
|
+
if (options.glob === false) options.disableGlob = true;
|
|
2107
|
+
options.disableGlob = options.disableGlob || false;
|
|
2108
|
+
options.glob = options.glob || defaultGlobOpts;
|
|
2109
|
+
}
|
|
2110
|
+
function rimraf(p, options, cb) {
|
|
2111
|
+
if (typeof options === "function") {
|
|
2112
|
+
cb = options;
|
|
2113
|
+
options = {};
|
|
2114
|
+
}
|
|
2115
|
+
assert(p, "rimraf: missing path");
|
|
2116
|
+
assert.equal(typeof p, "string", "rimraf: path should be a string");
|
|
2117
|
+
assert.equal(typeof cb, "function", "rimraf: callback function required");
|
|
2118
|
+
assert(options, "rimraf: invalid options argument provided");
|
|
2119
|
+
assert.equal(typeof options, "object", "rimraf: options should be object");
|
|
2120
|
+
defaults(options);
|
|
2121
|
+
var busyTries = 0;
|
|
2122
|
+
var errState = null;
|
|
2123
|
+
var n = 0;
|
|
2124
|
+
if (options.disableGlob || !glob.hasMagic(p)) return afterGlob(null, [p]);
|
|
2125
|
+
options.lstat(p, function(er, stat) {
|
|
2126
|
+
if (!er) return afterGlob(null, [p]);
|
|
2127
|
+
glob(p, options.glob, afterGlob);
|
|
2128
|
+
});
|
|
2129
|
+
function next(er) {
|
|
2130
|
+
errState = errState || er;
|
|
2131
|
+
if (--n === 0) cb(errState);
|
|
2132
|
+
}
|
|
2133
|
+
function afterGlob(er, results) {
|
|
2134
|
+
if (er) return cb(er);
|
|
2135
|
+
n = results.length;
|
|
2136
|
+
if (n === 0) return cb();
|
|
2137
|
+
results.forEach(function(p) {
|
|
2138
|
+
rimraf_(p, options, function CB(er) {
|
|
2139
|
+
if (er) {
|
|
2140
|
+
if ((er.code === "EBUSY" || er.code === "ENOTEMPTY" || er.code === "EPERM") && busyTries < options.maxBusyTries) {
|
|
2141
|
+
busyTries++;
|
|
2142
|
+
var time = busyTries * 100;
|
|
2143
|
+
return setTimeout(function() {
|
|
2144
|
+
rimraf_(p, options, CB);
|
|
2145
|
+
}, time);
|
|
2146
|
+
}
|
|
2147
|
+
if (er.code === "EMFILE" && timeout < options.emfileWait) return setTimeout(function() {
|
|
2148
|
+
rimraf_(p, options, CB);
|
|
2149
|
+
}, timeout++);
|
|
2150
|
+
if (er.code === "ENOENT") er = null;
|
|
2151
|
+
}
|
|
2152
|
+
timeout = 0;
|
|
2153
|
+
next(er);
|
|
2154
|
+
});
|
|
2155
|
+
});
|
|
2156
|
+
}
|
|
2157
|
+
}
|
|
2158
|
+
function rimraf_(p, options, cb) {
|
|
2159
|
+
assert(p);
|
|
2160
|
+
assert(options);
|
|
2161
|
+
assert(typeof cb === "function");
|
|
2162
|
+
options.lstat(p, function(er, st) {
|
|
2163
|
+
if (er && er.code === "ENOENT") return cb(null);
|
|
2164
|
+
if (er && er.code === "EPERM" && isWindows) fixWinEPERM(p, options, er, cb);
|
|
2165
|
+
if (st && st.isDirectory()) return rmdir(p, options, er, cb);
|
|
2166
|
+
options.unlink(p, function(er) {
|
|
2167
|
+
if (er) {
|
|
2168
|
+
if (er.code === "ENOENT") return cb(null);
|
|
2169
|
+
if (er.code === "EPERM") return isWindows ? fixWinEPERM(p, options, er, cb) : rmdir(p, options, er, cb);
|
|
2170
|
+
if (er.code === "EISDIR") return rmdir(p, options, er, cb);
|
|
2171
|
+
}
|
|
2172
|
+
return cb(er);
|
|
2173
|
+
});
|
|
2174
|
+
});
|
|
2175
|
+
}
|
|
2176
|
+
function fixWinEPERM(p, options, er, cb) {
|
|
2177
|
+
assert(p);
|
|
2178
|
+
assert(options);
|
|
2179
|
+
assert(typeof cb === "function");
|
|
2180
|
+
if (er) assert(er instanceof Error);
|
|
2181
|
+
options.chmod(p, _0666, function(er2) {
|
|
2182
|
+
if (er2) cb(er2.code === "ENOENT" ? null : er);
|
|
2183
|
+
else options.stat(p, function(er3, stats) {
|
|
2184
|
+
if (er3) cb(er3.code === "ENOENT" ? null : er);
|
|
2185
|
+
else if (stats.isDirectory()) rmdir(p, options, er, cb);
|
|
2186
|
+
else options.unlink(p, cb);
|
|
2187
|
+
});
|
|
2188
|
+
});
|
|
2189
|
+
}
|
|
2190
|
+
function fixWinEPERMSync(p, options, er) {
|
|
2191
|
+
assert(p);
|
|
2192
|
+
assert(options);
|
|
2193
|
+
if (er) assert(er instanceof Error);
|
|
2194
|
+
try {
|
|
2195
|
+
options.chmodSync(p, _0666);
|
|
2196
|
+
} catch (er2) {
|
|
2197
|
+
if (er2.code === "ENOENT") return;
|
|
2198
|
+
else throw er;
|
|
2199
|
+
}
|
|
2200
|
+
try {
|
|
2201
|
+
var stats = options.statSync(p);
|
|
2202
|
+
} catch (er3) {
|
|
2203
|
+
if (er3.code === "ENOENT") return;
|
|
2204
|
+
else throw er;
|
|
2205
|
+
}
|
|
2206
|
+
if (stats.isDirectory()) rmdirSync(p, options, er);
|
|
2207
|
+
else options.unlinkSync(p);
|
|
2208
|
+
}
|
|
2209
|
+
function rmdir(p, options, originalEr, cb) {
|
|
2210
|
+
assert(p);
|
|
2211
|
+
assert(options);
|
|
2212
|
+
if (originalEr) assert(originalEr instanceof Error);
|
|
2213
|
+
assert(typeof cb === "function");
|
|
2214
|
+
options.rmdir(p, function(er) {
|
|
2215
|
+
if (er && (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM")) rmkids(p, options, cb);
|
|
2216
|
+
else if (er && er.code === "ENOTDIR") cb(originalEr);
|
|
2217
|
+
else cb(er);
|
|
2218
|
+
});
|
|
2219
|
+
}
|
|
2220
|
+
function rmkids(p, options, cb) {
|
|
2221
|
+
assert(p);
|
|
2222
|
+
assert(options);
|
|
2223
|
+
assert(typeof cb === "function");
|
|
2224
|
+
options.readdir(p, function(er, files) {
|
|
2225
|
+
if (er) return cb(er);
|
|
2226
|
+
var n = files.length;
|
|
2227
|
+
if (n === 0) return options.rmdir(p, cb);
|
|
2228
|
+
var errState;
|
|
2229
|
+
files.forEach(function(f) {
|
|
2230
|
+
rimraf(path$3.join(p, f), options, function(er) {
|
|
2231
|
+
if (errState) return;
|
|
2232
|
+
if (er) return cb(errState = er);
|
|
2233
|
+
if (--n === 0) options.rmdir(p, cb);
|
|
2234
|
+
});
|
|
2235
|
+
});
|
|
2236
|
+
});
|
|
2237
|
+
}
|
|
2238
|
+
function rimrafSync(p, options) {
|
|
2239
|
+
options = options || {};
|
|
2240
|
+
defaults(options);
|
|
2241
|
+
assert(p, "rimraf: missing path");
|
|
2242
|
+
assert.equal(typeof p, "string", "rimraf: path should be a string");
|
|
2243
|
+
assert(options, "rimraf: missing options");
|
|
2244
|
+
assert.equal(typeof options, "object", "rimraf: options should be object");
|
|
2245
|
+
var results;
|
|
2246
|
+
if (options.disableGlob || !glob.hasMagic(p)) results = [p];
|
|
2247
|
+
else try {
|
|
2248
|
+
options.lstatSync(p);
|
|
2249
|
+
results = [p];
|
|
2250
|
+
} catch (er) {
|
|
2251
|
+
results = glob.sync(p, options.glob);
|
|
2252
|
+
}
|
|
2253
|
+
if (!results.length) return;
|
|
2254
|
+
for (var i = 0; i < results.length; i++) {
|
|
2255
|
+
var p = results[i];
|
|
2256
|
+
try {
|
|
2257
|
+
var st = options.lstatSync(p);
|
|
2258
|
+
} catch (er) {
|
|
2259
|
+
if (er.code === "ENOENT") return;
|
|
2260
|
+
if (er.code === "EPERM" && isWindows) fixWinEPERMSync(p, options, er);
|
|
2261
|
+
}
|
|
2262
|
+
try {
|
|
2263
|
+
if (st && st.isDirectory()) rmdirSync(p, options, null);
|
|
2264
|
+
else options.unlinkSync(p);
|
|
2265
|
+
} catch (er) {
|
|
2266
|
+
if (er.code === "ENOENT") return;
|
|
2267
|
+
if (er.code === "EPERM") return isWindows ? fixWinEPERMSync(p, options, er) : rmdirSync(p, options, er);
|
|
2268
|
+
if (er.code !== "EISDIR") throw er;
|
|
2269
|
+
rmdirSync(p, options, er);
|
|
2270
|
+
}
|
|
2271
|
+
}
|
|
2272
|
+
}
|
|
2273
|
+
function rmdirSync(p, options, originalEr) {
|
|
2274
|
+
assert(p);
|
|
2275
|
+
assert(options);
|
|
2276
|
+
if (originalEr) assert(originalEr instanceof Error);
|
|
2277
|
+
try {
|
|
2278
|
+
options.rmdirSync(p);
|
|
2279
|
+
} catch (er) {
|
|
2280
|
+
if (er.code === "ENOENT") return;
|
|
2281
|
+
if (er.code === "ENOTDIR") throw originalEr;
|
|
2282
|
+
if (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM") rmkidsSync(p, options);
|
|
2283
|
+
}
|
|
2284
|
+
}
|
|
2285
|
+
function rmkidsSync(p, options) {
|
|
2286
|
+
assert(p);
|
|
2287
|
+
assert(options);
|
|
2288
|
+
options.readdirSync(p).forEach(function(f) {
|
|
2289
|
+
rimrafSync(path$3.join(p, f), options);
|
|
2290
|
+
});
|
|
2291
|
+
var retries = isWindows ? 100 : 1;
|
|
2292
|
+
var i = 0;
|
|
2293
|
+
do {
|
|
2294
|
+
var threw = true;
|
|
2295
|
+
try {
|
|
2296
|
+
var ret = options.rmdirSync(p, options);
|
|
2297
|
+
threw = false;
|
|
2298
|
+
return ret;
|
|
2299
|
+
} finally {
|
|
2300
|
+
if (++i < retries && threw) continue;
|
|
2301
|
+
}
|
|
2302
|
+
} while (true);
|
|
2303
|
+
}
|
|
2304
|
+
}));
|
|
2305
|
+
//#endregion
|
|
2306
|
+
//#region ../../node_modules/.pnpm/mkdirp@0.5.6/node_modules/mkdirp/index.js
|
|
2307
|
+
var require_mkdirp = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2308
|
+
var path$2 = __require("path");
|
|
2309
|
+
var fs$2 = __require("fs");
|
|
2310
|
+
var _0777 = parseInt("0777", 8);
|
|
2311
|
+
module.exports = mkdirP.mkdirp = mkdirP.mkdirP = mkdirP;
|
|
2312
|
+
function mkdirP(p, opts, f, made) {
|
|
2313
|
+
if (typeof opts === "function") {
|
|
2314
|
+
f = opts;
|
|
2315
|
+
opts = {};
|
|
2316
|
+
} else if (!opts || typeof opts !== "object") opts = { mode: opts };
|
|
2317
|
+
var mode = opts.mode;
|
|
2318
|
+
var xfs = opts.fs || fs$2;
|
|
2319
|
+
if (mode === void 0) mode = _0777;
|
|
2320
|
+
if (!made) made = null;
|
|
2321
|
+
var cb = f || /* istanbul ignore next */ function() {};
|
|
2322
|
+
p = path$2.resolve(p);
|
|
2323
|
+
xfs.mkdir(p, mode, function(er) {
|
|
2324
|
+
if (!er) {
|
|
2325
|
+
made = made || p;
|
|
2326
|
+
return cb(null, made);
|
|
2327
|
+
}
|
|
2328
|
+
switch (er.code) {
|
|
2329
|
+
case "ENOENT":
|
|
2330
|
+
/* istanbul ignore if */
|
|
2331
|
+
if (path$2.dirname(p) === p) return cb(er);
|
|
2332
|
+
mkdirP(path$2.dirname(p), opts, function(er, made) {
|
|
2333
|
+
/* istanbul ignore if */
|
|
2334
|
+
if (er) cb(er, made);
|
|
2335
|
+
else mkdirP(p, opts, cb, made);
|
|
2336
|
+
});
|
|
2337
|
+
break;
|
|
2338
|
+
default: xfs.stat(p, function(er2, stat) {
|
|
2339
|
+
if (er2 || !stat.isDirectory()) cb(er, made);
|
|
2340
|
+
else cb(null, made);
|
|
2341
|
+
});
|
|
2342
|
+
}
|
|
2343
|
+
});
|
|
2344
|
+
}
|
|
2345
|
+
mkdirP.sync = function sync(p, opts, made) {
|
|
2346
|
+
if (!opts || typeof opts !== "object") opts = { mode: opts };
|
|
2347
|
+
var mode = opts.mode;
|
|
2348
|
+
var xfs = opts.fs || fs$2;
|
|
2349
|
+
if (mode === void 0) mode = _0777;
|
|
2350
|
+
if (!made) made = null;
|
|
2351
|
+
p = path$2.resolve(p);
|
|
2352
|
+
try {
|
|
2353
|
+
xfs.mkdirSync(p, mode);
|
|
2354
|
+
made = made || p;
|
|
2355
|
+
} catch (err0) {
|
|
2356
|
+
switch (err0.code) {
|
|
2357
|
+
case "ENOENT":
|
|
2358
|
+
made = sync(path$2.dirname(p), opts, made);
|
|
2359
|
+
sync(p, opts, made);
|
|
2360
|
+
break;
|
|
2361
|
+
default:
|
|
2362
|
+
var stat;
|
|
2363
|
+
try {
|
|
2364
|
+
stat = xfs.statSync(p);
|
|
2365
|
+
} catch (err1) /* istanbul ignore next */ {
|
|
2366
|
+
throw err0;
|
|
2367
|
+
}
|
|
2368
|
+
/* istanbul ignore if */
|
|
2369
|
+
if (!stat.isDirectory()) throw err0;
|
|
2370
|
+
}
|
|
2371
|
+
}
|
|
2372
|
+
return made;
|
|
2373
|
+
};
|
|
2374
|
+
}));
|
|
2375
|
+
//#endregion
|
|
2376
|
+
//#region ../../node_modules/.pnpm/package-manager-detector@1.8.0/node_modules/package-manager-detector/dist/constants.mjs
|
|
2377
|
+
var import_temp = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
2378
|
+
let fs$1 = __require("fs");
|
|
2379
|
+
let path$1 = __require("path");
|
|
2380
|
+
let cnst = __require("constants");
|
|
2381
|
+
let os = __require("os");
|
|
2382
|
+
let rimraf = require_rimraf();
|
|
2383
|
+
let mkdirp = require_mkdirp();
|
|
2384
|
+
__require("os").tmpdir();
|
|
2385
|
+
const rimrafSync = rimraf.sync;
|
|
2386
|
+
let dir = path$1.resolve(os.tmpdir());
|
|
2387
|
+
let RDWR_EXCL = cnst.O_CREAT | cnst.O_TRUNC | cnst.O_RDWR | cnst.O_EXCL;
|
|
2388
|
+
let promisify = function(callback) {
|
|
2389
|
+
if (typeof callback === "function") return [void 0, callback];
|
|
2390
|
+
var promiseCallback;
|
|
2391
|
+
return [new Promise(function(resolve, reject) {
|
|
2392
|
+
promiseCallback = function() {
|
|
2393
|
+
var args = Array.from(arguments);
|
|
2394
|
+
var err = args.shift();
|
|
2395
|
+
process.nextTick(function() {
|
|
2396
|
+
if (err) reject(err);
|
|
2397
|
+
else if (args.length === 1) resolve(args[0]);
|
|
2398
|
+
else resolve(args);
|
|
2399
|
+
});
|
|
2400
|
+
};
|
|
2401
|
+
}), promiseCallback];
|
|
2402
|
+
};
|
|
2403
|
+
var generateName = function(rawAffixes, defaultPrefix) {
|
|
2404
|
+
var affixes = parseAffixes(rawAffixes, defaultPrefix);
|
|
2405
|
+
var now = /* @__PURE__ */ new Date();
|
|
2406
|
+
var name = [
|
|
2407
|
+
affixes.prefix,
|
|
2408
|
+
now.getFullYear(),
|
|
2409
|
+
now.getMonth(),
|
|
2410
|
+
now.getDate(),
|
|
2411
|
+
"-",
|
|
2412
|
+
process.pid,
|
|
2413
|
+
"-",
|
|
2414
|
+
(Math.random() * 4294967296 + 1).toString(36),
|
|
2415
|
+
affixes.suffix
|
|
2416
|
+
].join("");
|
|
2417
|
+
return path$1.join(affixes.dir || dir, name);
|
|
2418
|
+
};
|
|
2419
|
+
var parseAffixes = function(rawAffixes, defaultPrefix) {
|
|
2420
|
+
var affixes = {
|
|
2421
|
+
prefix: null,
|
|
2422
|
+
suffix: null
|
|
2423
|
+
};
|
|
2424
|
+
if (rawAffixes) switch (typeof rawAffixes) {
|
|
2425
|
+
case "string":
|
|
2426
|
+
affixes.prefix = rawAffixes;
|
|
2427
|
+
break;
|
|
2428
|
+
case "object":
|
|
2429
|
+
affixes = rawAffixes;
|
|
2430
|
+
break;
|
|
2431
|
+
default: throw new Error("Unknown affix declaration: " + affixes);
|
|
2432
|
+
}
|
|
2433
|
+
else affixes.prefix = defaultPrefix;
|
|
2434
|
+
return affixes;
|
|
2435
|
+
};
|
|
2436
|
+
var tracking = false;
|
|
2437
|
+
var track = function(value) {
|
|
2438
|
+
tracking = value !== false;
|
|
2439
|
+
return module.exports;
|
|
2440
|
+
};
|
|
2441
|
+
var exitListenerAttached = false;
|
|
2442
|
+
var filesToDelete = [];
|
|
2443
|
+
var dirsToDelete = [];
|
|
2444
|
+
function deleteFileOnExit(filePath) {
|
|
2445
|
+
if (!tracking) return false;
|
|
2446
|
+
attachExitListener();
|
|
2447
|
+
filesToDelete.push(filePath);
|
|
2448
|
+
}
|
|
2449
|
+
function deleteDirOnExit(dirPath) {
|
|
2450
|
+
if (!tracking) return false;
|
|
2451
|
+
attachExitListener();
|
|
2452
|
+
dirsToDelete.push(dirPath);
|
|
2453
|
+
}
|
|
2454
|
+
function attachExitListener() {
|
|
2455
|
+
if (!tracking) return false;
|
|
2456
|
+
if (!exitListenerAttached) {
|
|
2457
|
+
process.addListener("exit", function() {
|
|
2458
|
+
try {
|
|
2459
|
+
cleanupSync();
|
|
2460
|
+
} catch (err) {
|
|
2461
|
+
console.warn("Fail to clean temporary files on exit : ", err);
|
|
2462
|
+
throw err;
|
|
2463
|
+
}
|
|
2464
|
+
});
|
|
2465
|
+
exitListenerAttached = true;
|
|
2466
|
+
}
|
|
2467
|
+
}
|
|
2468
|
+
function cleanupFilesSync() {
|
|
2469
|
+
if (!tracking) return false;
|
|
2470
|
+
var count = 0;
|
|
2471
|
+
var toDelete;
|
|
2472
|
+
while ((toDelete = filesToDelete.shift()) !== void 0) {
|
|
2473
|
+
rimrafSync(toDelete, { maxBusyTries: 6 });
|
|
2474
|
+
count++;
|
|
2475
|
+
}
|
|
2476
|
+
return count;
|
|
2477
|
+
}
|
|
2478
|
+
function cleanupFiles(callback) {
|
|
2479
|
+
var p = promisify(callback);
|
|
2480
|
+
var promise = p[0];
|
|
2481
|
+
callback = p[1];
|
|
2482
|
+
if (!tracking) {
|
|
2483
|
+
callback(/* @__PURE__ */ new Error("not tracking"));
|
|
2484
|
+
return promise;
|
|
2485
|
+
}
|
|
2486
|
+
var count = 0;
|
|
2487
|
+
var left = filesToDelete.length;
|
|
2488
|
+
if (!left) {
|
|
2489
|
+
callback(null, count);
|
|
2490
|
+
return promise;
|
|
2491
|
+
}
|
|
2492
|
+
var toDelete;
|
|
2493
|
+
var rimrafCallback = function(err) {
|
|
2494
|
+
if (!left) return;
|
|
2495
|
+
if (err) {
|
|
2496
|
+
callback(err);
|
|
2497
|
+
left = 0;
|
|
2498
|
+
return;
|
|
2499
|
+
} else count++;
|
|
2500
|
+
left--;
|
|
2501
|
+
if (!left) callback(null, count);
|
|
2502
|
+
};
|
|
2503
|
+
while ((toDelete = filesToDelete.shift()) !== void 0) rimraf(toDelete, { maxBusyTries: 6 }, rimrafCallback);
|
|
2504
|
+
return promise;
|
|
2505
|
+
}
|
|
2506
|
+
function cleanupDirsSync() {
|
|
2507
|
+
if (!tracking) return false;
|
|
2508
|
+
var count = 0;
|
|
2509
|
+
var toDelete;
|
|
2510
|
+
while ((toDelete = dirsToDelete.shift()) !== void 0) {
|
|
2511
|
+
rimrafSync(toDelete, { maxBusyTries: 6 });
|
|
2512
|
+
count++;
|
|
2513
|
+
}
|
|
2514
|
+
return count;
|
|
2515
|
+
}
|
|
2516
|
+
function cleanupDirs(callback) {
|
|
2517
|
+
var p = promisify(callback);
|
|
2518
|
+
var promise = p[0];
|
|
2519
|
+
callback = p[1];
|
|
2520
|
+
if (!tracking) {
|
|
2521
|
+
callback(/* @__PURE__ */ new Error("not tracking"));
|
|
2522
|
+
return promise;
|
|
2523
|
+
}
|
|
2524
|
+
var count = 0;
|
|
2525
|
+
var left = dirsToDelete.length;
|
|
2526
|
+
if (!left) {
|
|
2527
|
+
callback(null, count);
|
|
2528
|
+
return promise;
|
|
2529
|
+
}
|
|
2530
|
+
var toDelete;
|
|
2531
|
+
var rimrafCallback = function(err) {
|
|
2532
|
+
if (!left) return;
|
|
2533
|
+
if (err) {
|
|
2534
|
+
callback(err, count);
|
|
2535
|
+
left = 0;
|
|
2536
|
+
return;
|
|
2537
|
+
} else count++;
|
|
2538
|
+
left--;
|
|
2539
|
+
if (!left) callback(null, count);
|
|
2540
|
+
};
|
|
2541
|
+
while ((toDelete = dirsToDelete.shift()) !== void 0) rimraf(toDelete, { maxBusyTries: 6 }, rimrafCallback);
|
|
2542
|
+
return promise;
|
|
2543
|
+
}
|
|
2544
|
+
function cleanupSync() {
|
|
2545
|
+
if (!tracking) return false;
|
|
2546
|
+
return {
|
|
2547
|
+
files: cleanupFilesSync(),
|
|
2548
|
+
dirs: cleanupDirsSync()
|
|
2549
|
+
};
|
|
2550
|
+
}
|
|
2551
|
+
function cleanup(callback) {
|
|
2552
|
+
var p = promisify(callback);
|
|
2553
|
+
var promise = p[0];
|
|
2554
|
+
callback = p[1];
|
|
2555
|
+
if (!tracking) {
|
|
2556
|
+
callback(/* @__PURE__ */ new Error("not tracking"));
|
|
2557
|
+
return promise;
|
|
2558
|
+
}
|
|
2559
|
+
cleanupFiles(function(fileErr, fileCount) {
|
|
2560
|
+
if (fileErr) callback(fileErr, { files: fileCount });
|
|
2561
|
+
else cleanupDirs(function(dirErr, dirCount) {
|
|
2562
|
+
callback(dirErr, {
|
|
2563
|
+
files: fileCount,
|
|
2564
|
+
dirs: dirCount
|
|
2565
|
+
});
|
|
2566
|
+
});
|
|
2567
|
+
});
|
|
2568
|
+
return promise;
|
|
2569
|
+
}
|
|
2570
|
+
const mkdir = (affixes, callback) => {
|
|
2571
|
+
const p = promisify(callback);
|
|
2572
|
+
const promise = p[0];
|
|
2573
|
+
callback = p[1];
|
|
2574
|
+
let dirPath = generateName(affixes, "d-");
|
|
2575
|
+
mkdirp(dirPath, 448, (err) => {
|
|
2576
|
+
if (!err) deleteDirOnExit(dirPath);
|
|
2577
|
+
callback(err, dirPath);
|
|
2578
|
+
});
|
|
2579
|
+
return promise;
|
|
2580
|
+
};
|
|
2581
|
+
const mkdirSync = (affixes) => {
|
|
2582
|
+
let dirPath = generateName(affixes, "d-");
|
|
2583
|
+
mkdirp.sync(dirPath, 448);
|
|
2584
|
+
deleteDirOnExit(dirPath);
|
|
2585
|
+
return dirPath;
|
|
2586
|
+
};
|
|
2587
|
+
const open = (affixes, callback) => {
|
|
2588
|
+
const p = promisify(callback);
|
|
2589
|
+
const promise = p[0];
|
|
2590
|
+
callback = p[1];
|
|
2591
|
+
const path = generateName(affixes, "f-");
|
|
2592
|
+
fs$1.open(path, RDWR_EXCL, 384, (err, fd) => {
|
|
2593
|
+
if (!err) deleteFileOnExit(path);
|
|
2594
|
+
callback(err, {
|
|
2595
|
+
path,
|
|
2596
|
+
fd
|
|
2597
|
+
});
|
|
2598
|
+
});
|
|
2599
|
+
return promise;
|
|
2600
|
+
};
|
|
2601
|
+
const openSync = (affixes) => {
|
|
2602
|
+
const path = generateName(affixes, "f-");
|
|
2603
|
+
let fd = fs$1.openSync(path, RDWR_EXCL, 384);
|
|
2604
|
+
deleteFileOnExit(path);
|
|
2605
|
+
return {
|
|
2606
|
+
path,
|
|
2607
|
+
fd
|
|
2608
|
+
};
|
|
2609
|
+
};
|
|
2610
|
+
const createWriteStream = (affixes) => {
|
|
2611
|
+
const path = generateName(affixes, "s-");
|
|
2612
|
+
let stream = fs$1.createWriteStream(path, {
|
|
2613
|
+
flags: RDWR_EXCL,
|
|
2614
|
+
mode: 384
|
|
2615
|
+
});
|
|
2616
|
+
deleteFileOnExit(path);
|
|
2617
|
+
return stream;
|
|
2618
|
+
};
|
|
2619
|
+
exports.dir = dir;
|
|
2620
|
+
exports.track = track;
|
|
2621
|
+
exports.mkdir = mkdir;
|
|
2622
|
+
exports.mkdirSync = mkdirSync;
|
|
2623
|
+
exports.open = open;
|
|
2624
|
+
exports.openSync = openSync;
|
|
2625
|
+
exports.path = generateName;
|
|
2626
|
+
exports.cleanup = cleanup;
|
|
2627
|
+
exports.cleanupSync = cleanupSync;
|
|
2628
|
+
exports.createWriteStream = createWriteStream;
|
|
2629
|
+
})))(), 1);
|
|
2630
|
+
const LOCKS = {
|
|
2631
|
+
"aube-lock.yaml": "aube",
|
|
2632
|
+
"aube-workspace.yaml": "aube",
|
|
2633
|
+
"bun.lock": "bun",
|
|
2634
|
+
"bun.lockb": "bun",
|
|
2635
|
+
"deno.lock": "deno",
|
|
2636
|
+
"nub.lock": "nub",
|
|
2637
|
+
"pnpm-lock.yaml": "pnpm",
|
|
2638
|
+
"pnpm-workspace.yaml": "pnpm",
|
|
2639
|
+
"yarn.lock": "yarn",
|
|
2640
|
+
"package-lock.json": "npm",
|
|
2641
|
+
"npm-shrinkwrap.json": "npm"
|
|
2642
|
+
};
|
|
2643
|
+
//#endregion
|
|
2644
|
+
//#region ../../node_modules/.pnpm/find-installed-packages@4.0.0/node_modules/find-installed-packages/dist/index.mjs
|
|
2645
|
+
const CACHE_FILE = ".find-installed-packages.cache";
|
|
2646
|
+
function getCacheFilepath() {
|
|
2647
|
+
return path.join(import_temp.dir, CACHE_FILE);
|
|
2648
|
+
}
|
|
2649
|
+
let memoryCache;
|
|
2650
|
+
function getCacheKey(keywords, cwd) {
|
|
2651
|
+
return JSON.stringify({
|
|
2652
|
+
cwd: path.resolve(cwd),
|
|
2653
|
+
keywords: [...keywords].sort()
|
|
2654
|
+
});
|
|
2655
|
+
}
|
|
2656
|
+
function getCachedPackages(key, fingerprint) {
|
|
2657
|
+
const cache = loadCache();
|
|
2658
|
+
const entry = cache[key];
|
|
2659
|
+
if (entry) {
|
|
2660
|
+
if (typeof entry.fingerprint !== "number" || entry.fingerprint < fingerprint) {
|
|
2661
|
+
delete cache[key];
|
|
2662
|
+
saveCache(cache);
|
|
2663
|
+
return;
|
|
2664
|
+
}
|
|
2665
|
+
return entry.packages;
|
|
2666
|
+
}
|
|
2667
|
+
}
|
|
2668
|
+
function setCachedPackages(key, fingerprint, packages) {
|
|
2669
|
+
const cache = loadCache();
|
|
2670
|
+
cache[key] = {
|
|
2671
|
+
fingerprint,
|
|
2672
|
+
packages
|
|
2673
|
+
};
|
|
2674
|
+
saveCache(cache);
|
|
2675
|
+
}
|
|
2676
|
+
// istanbul ignore next
|
|
2677
|
+
function loadCache() {
|
|
2678
|
+
if (memoryCache) return memoryCache;
|
|
2679
|
+
const filepath = getCacheFilepath();
|
|
2680
|
+
if (!fs.existsSync(filepath)) {
|
|
2681
|
+
memoryCache = {};
|
|
2682
|
+
return memoryCache;
|
|
2683
|
+
}
|
|
2684
|
+
try {
|
|
2685
|
+
memoryCache = JSON.parse(fs.readFileSync(filepath, { encoding: "utf-8" }));
|
|
2686
|
+
return memoryCache;
|
|
2687
|
+
} catch (_e) {
|
|
2688
|
+
memoryCache = {};
|
|
2689
|
+
return memoryCache;
|
|
2690
|
+
}
|
|
2691
|
+
}
|
|
2692
|
+
// istanbul ignore next
|
|
2693
|
+
function saveCache(cache) {
|
|
2694
|
+
memoryCache = cache;
|
|
2695
|
+
const filepath = getCacheFilepath();
|
|
2696
|
+
fs.writeFileSync(filepath, JSON.stringify(cache));
|
|
2697
|
+
}
|
|
2698
|
+
async function findPackagesInfo(cwd) {
|
|
2699
|
+
try {
|
|
2700
|
+
await fs.promises.access(cwd);
|
|
2701
|
+
} catch {
|
|
2702
|
+
return [];
|
|
2703
|
+
}
|
|
2704
|
+
return recurseFind(cwd, {});
|
|
2705
|
+
}
|
|
2706
|
+
async function recurseFind(cwd, walked) {
|
|
2707
|
+
const nodeModulesDir = path.join(cwd, "node_modules");
|
|
2708
|
+
if (walked[nodeModulesDir]) return [];
|
|
2709
|
+
walked[nodeModulesDir] = true;
|
|
2710
|
+
try {
|
|
2711
|
+
await fs.promises.access(nodeModulesDir);
|
|
2712
|
+
} catch {
|
|
2713
|
+
return [];
|
|
2714
|
+
}
|
|
2715
|
+
const dirs = await fs.promises.readdir(nodeModulesDir);
|
|
2716
|
+
const results = [];
|
|
2717
|
+
await Promise.all(dirs.map(async (dir) => {
|
|
2718
|
+
const packagePath = path.join(nodeModulesDir, dir);
|
|
2719
|
+
const stat = await tryStatAsync(packagePath);
|
|
2720
|
+
if (!stat) return;
|
|
2721
|
+
if (!stat.isDirectory()) return;
|
|
2722
|
+
walked[packagePath] = true;
|
|
2723
|
+
if (dir.startsWith("@")) {
|
|
2724
|
+
if (dir === "@types") return;
|
|
2725
|
+
const subDirs = await fs.promises.readdir(packagePath);
|
|
2726
|
+
await Promise.all(subDirs.map(async (sd) => {
|
|
2727
|
+
const subPackagePath = path.join(nodeModulesDir, dir, sd);
|
|
2728
|
+
if (walked[subPackagePath]) return;
|
|
2729
|
+
const subStat = await tryStatAsync(subPackagePath);
|
|
2730
|
+
// istanbul ignore next
|
|
2731
|
+
if (!subStat) return;
|
|
2732
|
+
// istanbul ignore next
|
|
2733
|
+
if (!subStat.isDirectory()) return;
|
|
2734
|
+
walked[subPackagePath] = true;
|
|
2735
|
+
results.push({
|
|
2736
|
+
name: `${dir}/${sd}`,
|
|
2737
|
+
ctimeMs: subStat.ctimeMs,
|
|
2738
|
+
path: subPackagePath
|
|
2739
|
+
});
|
|
2740
|
+
const nested = await recurseFind(subPackagePath, walked);
|
|
2741
|
+
results.push(...nested);
|
|
2742
|
+
}));
|
|
2743
|
+
} else {
|
|
2744
|
+
results.push({
|
|
2745
|
+
name: dir,
|
|
2746
|
+
ctimeMs: stat.ctimeMs,
|
|
2747
|
+
path: packagePath
|
|
2748
|
+
});
|
|
2749
|
+
const nested = await recurseFind(packagePath, walked);
|
|
2750
|
+
results.push(...nested);
|
|
2751
|
+
}
|
|
2752
|
+
}));
|
|
2753
|
+
return results;
|
|
2754
|
+
}
|
|
2755
|
+
async function tryStatAsync(filePath) {
|
|
2756
|
+
try {
|
|
2757
|
+
return await fs.promises.stat(filePath);
|
|
2758
|
+
} catch {
|
|
2759
|
+
// istanbul ignore next
|
|
2760
|
+
return;
|
|
2761
|
+
}
|
|
2762
|
+
}
|
|
2763
|
+
/**
|
|
2764
|
+
* Files that change whenever the installed tree changes.
|
|
2765
|
+
*
|
|
2766
|
+
* The lockfile names come from `package-manager-detector` rather than a list of
|
|
2767
|
+
* our own, so new package managers arrive with a dependency bump instead of a
|
|
2768
|
+
* bug report.
|
|
2769
|
+
*/
|
|
2770
|
+
const LOCKFILES = Object.keys(LOCKS).concat([".pnp.cjs", ".pnp.data.json"]);
|
|
2771
|
+
/**
|
|
2772
|
+
* A cheap number that changes when the installed tree changes.
|
|
2773
|
+
*
|
|
2774
|
+
* Used as the cache stamp. Unlike stat-ing every installed package, this is a
|
|
2775
|
+
* handful of `stat` calls, so the cache can short-circuit the whole walk rather
|
|
2776
|
+
* than only the manifest reads.
|
|
2777
|
+
*
|
|
2778
|
+
* The lockfile is looked up from `cwd` upwards, because in a workspace it lives
|
|
2779
|
+
* at the repo root rather than next to the project.
|
|
2780
|
+
*/
|
|
2781
|
+
async function getFingerprint(cwd) {
|
|
2782
|
+
const root = path.resolve(cwd);
|
|
2783
|
+
let fingerprint = 0;
|
|
2784
|
+
const bump = (stat) => {
|
|
2785
|
+
if (stat && stat.mtimeMs > fingerprint) fingerprint = stat.mtimeMs;
|
|
2786
|
+
};
|
|
2787
|
+
bump(await statSafe(path.join(root, "package.json")));
|
|
2788
|
+
bump(await statSafe(path.join(root, "node_modules")));
|
|
2789
|
+
let dir = root;
|
|
2790
|
+
for (;;) {
|
|
2791
|
+
const found = (await Promise.all(LOCKFILES.map((name) => statSafe(path.join(dir, name))))).filter((stat) => !!stat);
|
|
2792
|
+
if (found.length > 0) {
|
|
2793
|
+
found.forEach(bump);
|
|
2794
|
+
break;
|
|
2795
|
+
}
|
|
2796
|
+
const parent = path.dirname(dir);
|
|
2797
|
+
if (parent === dir) break;
|
|
2798
|
+
dir = parent;
|
|
2799
|
+
}
|
|
2800
|
+
return fingerprint;
|
|
2801
|
+
}
|
|
2802
|
+
async function statSafe(filepath) {
|
|
2803
|
+
try {
|
|
2804
|
+
return await fs.promises.stat(filepath);
|
|
2805
|
+
} catch {
|
|
2806
|
+
return;
|
|
2807
|
+
}
|
|
2808
|
+
}
|
|
2809
|
+
function hasAllKeywords(actual, expected) {
|
|
2810
|
+
const set = new Set(actual);
|
|
2811
|
+
return !expected.find((key) => !set.has(key));
|
|
2812
|
+
}
|
|
2813
|
+
/**
|
|
2814
|
+
* Read file and ignore ENOENT.
|
|
2815
|
+
* When the the folder is a link, the link may be invalid.
|
|
2816
|
+
* That will result in ENOENT.
|
|
2817
|
+
* @param path file path.
|
|
2818
|
+
*/
|
|
2819
|
+
async function readFileSafe(path) {
|
|
2820
|
+
try {
|
|
2821
|
+
return await fs.promises.readFile(path, "utf8");
|
|
2822
|
+
} catch (err) {
|
|
2823
|
+
// istanbul ignore next
|
|
2824
|
+
if (err.code === "ENOENT") return void 0;
|
|
2825
|
+
// istanbul ignore next
|
|
2826
|
+
throw err;
|
|
2827
|
+
}
|
|
2828
|
+
}
|
|
2829
|
+
/**
|
|
2830
|
+
* Read and parse the `package.json` of a package folder.
|
|
2831
|
+
* Returns `undefined` when it is missing, unreadable, or malformed.
|
|
2832
|
+
*/
|
|
2833
|
+
async function readManifest(dir) {
|
|
2834
|
+
try {
|
|
2835
|
+
const content = await readFileSafe(path.resolve(dir, "package.json"));
|
|
2836
|
+
if (!content) return void 0;
|
|
2837
|
+
const manifest = JSON.parse(content);
|
|
2838
|
+
return manifest && typeof manifest === "object" ? manifest : void 0;
|
|
2839
|
+
} catch {
|
|
2840
|
+
return;
|
|
2841
|
+
}
|
|
2842
|
+
}
|
|
2843
|
+
/**
|
|
2844
|
+
* Names of the dependencies to traverse from a manifest.
|
|
2845
|
+
*
|
|
2846
|
+
* `devDependencies` are only installed for the project itself,
|
|
2847
|
+
* so they are included at the root and skipped for everything below it.
|
|
2848
|
+
*/
|
|
2849
|
+
function dependencyNames(manifest, includeDev) {
|
|
2850
|
+
const names = [
|
|
2851
|
+
...keysOf(manifest.dependencies),
|
|
2852
|
+
...keysOf(manifest.optionalDependencies),
|
|
2853
|
+
...keysOf(manifest.peerDependencies),
|
|
2854
|
+
...includeDev ? keysOf(manifest.devDependencies) : []
|
|
2855
|
+
];
|
|
2856
|
+
return Array.from(new Set(names));
|
|
2857
|
+
}
|
|
2858
|
+
function keysOf(value) {
|
|
2859
|
+
return value && typeof value === "object" && !Array.isArray(value) ? Object.keys(value) : [];
|
|
2860
|
+
}
|
|
2861
|
+
/**
|
|
2862
|
+
* Walk the declared dependency graph starting at `cwd`, using the host runtime's
|
|
2863
|
+
* module resolver to locate each package.
|
|
2864
|
+
*
|
|
2865
|
+
* Asking the resolver instead of walking `node_modules` keeps this correct across
|
|
2866
|
+
* hoisted layouts (npm, yarn, bun), isolated ones (pnpm, `bun --linker=isolated`),
|
|
2867
|
+
* workspaces (where the tree lives at the repo root), and Yarn PnP (where there is
|
|
2868
|
+
* no `node_modules` at all).
|
|
2869
|
+
*
|
|
2870
|
+
* Returns `undefined` when there is nothing to resolve from — no readable
|
|
2871
|
+
* `package.json` at `cwd`, or one that declares no dependencies — so the caller
|
|
2872
|
+
* can fall back to scanning.
|
|
2873
|
+
*/
|
|
2874
|
+
async function resolvePackagesInfo(cwd) {
|
|
2875
|
+
const root = path.resolve(cwd);
|
|
2876
|
+
const manifest = await readManifest(root);
|
|
2877
|
+
if (!manifest) return void 0;
|
|
2878
|
+
const deps = dependencyNames(manifest, true);
|
|
2879
|
+
if (deps.length === 0) return void 0;
|
|
2880
|
+
const results = [];
|
|
2881
|
+
await walk(root, deps, /* @__PURE__ */ new Set([root]), results);
|
|
2882
|
+
return results;
|
|
2883
|
+
}
|
|
2884
|
+
async function walk(from, deps, walked, results) {
|
|
2885
|
+
await Promise.all(deps.map(async (name) => {
|
|
2886
|
+
if (name.indexOf("@types/") === 0) return;
|
|
2887
|
+
const dir = resolvePackageDir(name, from);
|
|
2888
|
+
if (!dir || walked.has(dir)) return;
|
|
2889
|
+
walked.add(dir);
|
|
2890
|
+
const manifest = await readManifest(dir);
|
|
2891
|
+
if (!manifest) return;
|
|
2892
|
+
if (manifest.name) results.push({
|
|
2893
|
+
name: manifest.name,
|
|
2894
|
+
path: dir,
|
|
2895
|
+
manifest
|
|
2896
|
+
});
|
|
2897
|
+
await walk(dir, dependencyNames(manifest, false), walked, results);
|
|
2898
|
+
}));
|
|
2899
|
+
}
|
|
2900
|
+
/**
|
|
2901
|
+
* Locate the folder of `name` as resolved from `fromDir`.
|
|
2902
|
+
*
|
|
2903
|
+
* Three strategies, most faithful first, because no single one covers every case.
|
|
2904
|
+
*
|
|
2905
|
+
* Note on coverage: Bun's resolver serves `<pkg>/package.json` even when `exports`
|
|
2906
|
+
* does not list it, so strategy 1 always wins under `bun test` and the fallbacks
|
|
2907
|
+
* report as uncovered. They are not dead code — under Node they carry real cases:
|
|
2908
|
+
* strategy 2 covers an `exports`-restricted package in a `node_modules` tree, and
|
|
2909
|
+
* strategy 3 covers one under Yarn PnP, where `resolve.paths` is not PnP-aware.
|
|
2910
|
+
*/
|
|
2911
|
+
function resolvePackageDir(name, fromDir) {
|
|
2912
|
+
const require = createRequire(path.join(fromDir, "package.json"));
|
|
2913
|
+
try {
|
|
2914
|
+
return path.dirname(require.resolve(`${name}/package.json`));
|
|
2915
|
+
} catch {}
|
|
2916
|
+
try {
|
|
2917
|
+
const lookups = require.resolve.paths(name);
|
|
2918
|
+
if (lookups) for (const lookup of lookups) {
|
|
2919
|
+
const candidate = path.join(lookup, name);
|
|
2920
|
+
if (fs.existsSync(path.join(candidate, "package.json"))) return candidate;
|
|
2921
|
+
}
|
|
2922
|
+
} catch {}
|
|
2923
|
+
try {
|
|
2924
|
+
let dir = path.dirname(require.resolve(name));
|
|
2925
|
+
for (;;) {
|
|
2926
|
+
if (readNameSync(dir) === name) return dir;
|
|
2927
|
+
const parent = path.dirname(dir);
|
|
2928
|
+
if (parent === dir) return void 0;
|
|
2929
|
+
dir = parent;
|
|
2930
|
+
}
|
|
2931
|
+
} catch {}
|
|
2932
|
+
}
|
|
2933
|
+
function readNameSync(dir) {
|
|
2934
|
+
try {
|
|
2935
|
+
return JSON.parse(fs.readFileSync(path.join(dir, "package.json"), "utf8")).name;
|
|
2936
|
+
} catch {
|
|
2937
|
+
return;
|
|
2938
|
+
}
|
|
2939
|
+
}
|
|
2940
|
+
async function findByKeywords(keywords, options) {
|
|
2941
|
+
const { cwd } = unpartial({ cwd: "." }, options);
|
|
2942
|
+
return getPackages(keywords, cwd);
|
|
2943
|
+
}
|
|
2944
|
+
async function getPackages(keywords, cwd) {
|
|
2945
|
+
const cacheKey = getCacheKey(keywords, cwd);
|
|
2946
|
+
const fingerprint = await getFingerprint(cwd);
|
|
2947
|
+
const cache = getCachedPackages(cacheKey, fingerprint);
|
|
2948
|
+
if (cache) return cache;
|
|
2949
|
+
const names = (await collectManifests(cwd)).filter((manifest) => manifest.name && hasAllKeywords(manifest.keywords, keywords)).map((manifest) => manifest.name);
|
|
2950
|
+
const packages = Array.from(new Set(names));
|
|
2951
|
+
setCachedPackages(cacheKey, fingerprint, packages);
|
|
2952
|
+
return packages;
|
|
2953
|
+
}
|
|
2954
|
+
/**
|
|
2955
|
+
* Prefer the dependency graph as the runtime resolves it.
|
|
2956
|
+
* Fall back to scanning `node_modules` when there is nothing to resolve from —
|
|
2957
|
+
* no readable manifest at `cwd`, or one without dependencies.
|
|
2958
|
+
*/
|
|
2959
|
+
async function collectManifests(cwd) {
|
|
2960
|
+
const resolved = await resolvePackagesInfo(cwd);
|
|
2961
|
+
if (resolved) return resolved.map((pkg) => pkg.manifest);
|
|
2962
|
+
const infos = await findPackagesInfo(cwd);
|
|
2963
|
+
return (await Promise.all(infos.map((info) => readManifest(info.path)))).filter((manifest) => !!manifest);
|
|
2964
|
+
}
|
|
2965
|
+
//#endregion
|
|
2966
|
+
export { findByKeywords };
|