eslint-plugin-turbo 0.0.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.
Files changed (4) hide show
  1. package/LICENSE +373 -0
  2. package/README.md +53 -0
  3. package/dist/index.js +3839 -0
  4. package/package.json +35 -0
package/dist/index.js ADDED
@@ -0,0 +1,3839 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __commonJS = (cb, mod) => function __require() {
9
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
+ };
11
+ var __export = (target, all) => {
12
+ for (var name in all)
13
+ __defProp(target, name, { get: all[name], enumerable: true });
14
+ };
15
+ var __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from === "object" || typeof from === "function") {
17
+ for (let key of __getOwnPropNames(from))
18
+ if (!__hasOwnProp.call(to, key) && key !== except)
19
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
20
+ }
21
+ return to;
22
+ };
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target, mod));
24
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
+
26
+ // ../turbo-utils/dist/index.js
27
+ var require_dist = __commonJS({
28
+ "../turbo-utils/dist/index.js"(exports, module2) {
29
+ "use strict";
30
+ var __create2 = Object.create;
31
+ var __defProp2 = Object.defineProperty;
32
+ var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
33
+ var __getOwnPropNames2 = Object.getOwnPropertyNames;
34
+ var __getProtoOf2 = Object.getPrototypeOf;
35
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
36
+ var __esm = (fn, res) => function __init() {
37
+ return fn && (res = (0, fn[__getOwnPropNames2(fn)[0]])(fn = 0)), res;
38
+ };
39
+ var __commonJS2 = (cb, mod) => function __require() {
40
+ return mod || (0, cb[__getOwnPropNames2(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
41
+ };
42
+ var __export2 = (target, all) => {
43
+ for (var name in all)
44
+ __defProp2(target, name, { get: all[name], enumerable: true });
45
+ };
46
+ var __copyProps2 = (to, from, except, desc) => {
47
+ if (from && typeof from === "object" || typeof from === "function") {
48
+ for (let key of __getOwnPropNames2(from))
49
+ if (!__hasOwnProp2.call(to, key) && key !== except)
50
+ __defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
51
+ }
52
+ return to;
53
+ };
54
+ var __toESM2 = (mod, isNodeMode, target) => (target = mod != null ? __create2(__getProtoOf2(mod)) : {}, __copyProps2(isNodeMode || !mod || !mod.__esModule ? __defProp2(target, "default", { value: mod, enumerable: true }) : target, mod));
55
+ var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
56
+ var init_cjs_shims = __esm({
57
+ "../../node_modules/.pnpm/tsup@5.12.9_typescript@4.7.4/node_modules/tsup/assets/cjs_shims.js"() {
58
+ }
59
+ });
60
+ var require_typeof = __commonJS2({
61
+ "../../node_modules/.pnpm/@babel+runtime@7.18.9/node_modules/@babel/runtime/helpers/typeof.js"(exports2, module22) {
62
+ init_cjs_shims();
63
+ function _typeof2(obj) {
64
+ "@babel/helpers - typeof";
65
+ return module22.exports = _typeof2 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
66
+ return typeof obj2;
67
+ } : function(obj2) {
68
+ return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
69
+ }, module22.exports.__esModule = true, module22.exports["default"] = module22.exports, _typeof2(obj);
70
+ }
71
+ module22.exports = _typeof2, module22.exports.__esModule = true, module22.exports["default"] = module22.exports;
72
+ }
73
+ });
74
+ var require_regeneratorRuntime = __commonJS2({
75
+ "../../node_modules/.pnpm/@babel+runtime@7.18.9/node_modules/@babel/runtime/helpers/regeneratorRuntime.js"(exports2, module22) {
76
+ init_cjs_shims();
77
+ var _typeof2 = require_typeof()["default"];
78
+ function _regeneratorRuntime2() {
79
+ "use strict";
80
+ module22.exports = _regeneratorRuntime2 = function _regeneratorRuntime3() {
81
+ return exports22;
82
+ }, module22.exports.__esModule = true, module22.exports["default"] = module22.exports;
83
+ var exports22 = {}, Op = Object.prototype, hasOwn = Op.hasOwnProperty, $Symbol = "function" == typeof Symbol ? Symbol : {}, iteratorSymbol = $Symbol.iterator || "@@iterator", asyncIteratorSymbol = $Symbol.asyncIterator || "@@asyncIterator", toStringTagSymbol = $Symbol.toStringTag || "@@toStringTag";
84
+ function define(obj, key, value) {
85
+ return Object.defineProperty(obj, key, {
86
+ value,
87
+ enumerable: true,
88
+ configurable: true,
89
+ writable: true
90
+ }), obj[key];
91
+ }
92
+ try {
93
+ define({}, "");
94
+ } catch (err) {
95
+ define = function define2(obj, key, value) {
96
+ return obj[key] = value;
97
+ };
98
+ }
99
+ function wrap(innerFn, outerFn, self, tryLocsList) {
100
+ var protoGenerator = outerFn && outerFn.prototype instanceof Generator ? outerFn : Generator, generator = Object.create(protoGenerator.prototype), context = new Context(tryLocsList || []);
101
+ return generator._invoke = function(innerFn2, self2, context2) {
102
+ var state = "suspendedStart";
103
+ return function(method, arg) {
104
+ if ("executing" === state)
105
+ throw new Error("Generator is already running");
106
+ if ("completed" === state) {
107
+ if ("throw" === method)
108
+ throw arg;
109
+ return doneResult();
110
+ }
111
+ for (context2.method = method, context2.arg = arg; ; ) {
112
+ var delegate = context2.delegate;
113
+ if (delegate) {
114
+ var delegateResult = maybeInvokeDelegate(delegate, context2);
115
+ if (delegateResult) {
116
+ if (delegateResult === ContinueSentinel)
117
+ continue;
118
+ return delegateResult;
119
+ }
120
+ }
121
+ if ("next" === context2.method)
122
+ context2.sent = context2._sent = context2.arg;
123
+ else if ("throw" === context2.method) {
124
+ if ("suspendedStart" === state)
125
+ throw state = "completed", context2.arg;
126
+ context2.dispatchException(context2.arg);
127
+ } else
128
+ "return" === context2.method && context2.abrupt("return", context2.arg);
129
+ state = "executing";
130
+ var record = tryCatch(innerFn2, self2, context2);
131
+ if ("normal" === record.type) {
132
+ if (state = context2.done ? "completed" : "suspendedYield", record.arg === ContinueSentinel)
133
+ continue;
134
+ return {
135
+ value: record.arg,
136
+ done: context2.done
137
+ };
138
+ }
139
+ "throw" === record.type && (state = "completed", context2.method = "throw", context2.arg = record.arg);
140
+ }
141
+ };
142
+ }(innerFn, self, context), generator;
143
+ }
144
+ function tryCatch(fn, obj, arg) {
145
+ try {
146
+ return {
147
+ type: "normal",
148
+ arg: fn.call(obj, arg)
149
+ };
150
+ } catch (err) {
151
+ return {
152
+ type: "throw",
153
+ arg: err
154
+ };
155
+ }
156
+ }
157
+ exports22.wrap = wrap;
158
+ var ContinueSentinel = {};
159
+ function Generator() {
160
+ }
161
+ function GeneratorFunction() {
162
+ }
163
+ function GeneratorFunctionPrototype() {
164
+ }
165
+ var IteratorPrototype = {};
166
+ define(IteratorPrototype, iteratorSymbol, function() {
167
+ return this;
168
+ });
169
+ var getProto = Object.getPrototypeOf, NativeIteratorPrototype = getProto && getProto(getProto(values([])));
170
+ NativeIteratorPrototype && NativeIteratorPrototype !== Op && hasOwn.call(NativeIteratorPrototype, iteratorSymbol) && (IteratorPrototype = NativeIteratorPrototype);
171
+ var Gp = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(IteratorPrototype);
172
+ function defineIteratorMethods(prototype) {
173
+ ["next", "throw", "return"].forEach(function(method) {
174
+ define(prototype, method, function(arg) {
175
+ return this._invoke(method, arg);
176
+ });
177
+ });
178
+ }
179
+ function AsyncIterator(generator, PromiseImpl) {
180
+ function invoke(method, arg, resolve, reject) {
181
+ var record = tryCatch(generator[method], generator, arg);
182
+ if ("throw" !== record.type) {
183
+ var result = record.arg, value = result.value;
184
+ return value && "object" == _typeof2(value) && hasOwn.call(value, "__await") ? PromiseImpl.resolve(value.__await).then(function(value2) {
185
+ invoke("next", value2, resolve, reject);
186
+ }, function(err) {
187
+ invoke("throw", err, resolve, reject);
188
+ }) : PromiseImpl.resolve(value).then(function(unwrapped) {
189
+ result.value = unwrapped, resolve(result);
190
+ }, function(error) {
191
+ return invoke("throw", error, resolve, reject);
192
+ });
193
+ }
194
+ reject(record.arg);
195
+ }
196
+ var previousPromise;
197
+ this._invoke = function(method, arg) {
198
+ function callInvokeWithMethodAndArg() {
199
+ return new PromiseImpl(function(resolve, reject) {
200
+ invoke(method, arg, resolve, reject);
201
+ });
202
+ }
203
+ return previousPromise = previousPromise ? previousPromise.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg();
204
+ };
205
+ }
206
+ function maybeInvokeDelegate(delegate, context) {
207
+ var method = delegate.iterator[context.method];
208
+ if (void 0 === method) {
209
+ if (context.delegate = null, "throw" === context.method) {
210
+ if (delegate.iterator["return"] && (context.method = "return", context.arg = void 0, maybeInvokeDelegate(delegate, context), "throw" === context.method))
211
+ return ContinueSentinel;
212
+ context.method = "throw", context.arg = new TypeError("The iterator does not provide a 'throw' method");
213
+ }
214
+ return ContinueSentinel;
215
+ }
216
+ var record = tryCatch(method, delegate.iterator, context.arg);
217
+ if ("throw" === record.type)
218
+ return context.method = "throw", context.arg = record.arg, context.delegate = null, ContinueSentinel;
219
+ var info = record.arg;
220
+ return info ? info.done ? (context[delegate.resultName] = info.value, context.next = delegate.nextLoc, "return" !== context.method && (context.method = "next", context.arg = void 0), context.delegate = null, ContinueSentinel) : info : (context.method = "throw", context.arg = new TypeError("iterator result is not an object"), context.delegate = null, ContinueSentinel);
221
+ }
222
+ function pushTryEntry(locs) {
223
+ var entry = {
224
+ tryLoc: locs[0]
225
+ };
226
+ 1 in locs && (entry.catchLoc = locs[1]), 2 in locs && (entry.finallyLoc = locs[2], entry.afterLoc = locs[3]), this.tryEntries.push(entry);
227
+ }
228
+ function resetTryEntry(entry) {
229
+ var record = entry.completion || {};
230
+ record.type = "normal", delete record.arg, entry.completion = record;
231
+ }
232
+ function Context(tryLocsList) {
233
+ this.tryEntries = [{
234
+ tryLoc: "root"
235
+ }], tryLocsList.forEach(pushTryEntry, this), this.reset(true);
236
+ }
237
+ function values(iterable) {
238
+ if (iterable) {
239
+ var iteratorMethod = iterable[iteratorSymbol];
240
+ if (iteratorMethod)
241
+ return iteratorMethod.call(iterable);
242
+ if ("function" == typeof iterable.next)
243
+ return iterable;
244
+ if (!isNaN(iterable.length)) {
245
+ var i = -1, next = function next2() {
246
+ for (; ++i < iterable.length; ) {
247
+ if (hasOwn.call(iterable, i))
248
+ return next2.value = iterable[i], next2.done = false, next2;
249
+ }
250
+ return next2.value = void 0, next2.done = true, next2;
251
+ };
252
+ return next.next = next;
253
+ }
254
+ }
255
+ return {
256
+ next: doneResult
257
+ };
258
+ }
259
+ function doneResult() {
260
+ return {
261
+ value: void 0,
262
+ done: true
263
+ };
264
+ }
265
+ return GeneratorFunction.prototype = GeneratorFunctionPrototype, define(Gp, "constructor", GeneratorFunctionPrototype), define(GeneratorFunctionPrototype, "constructor", GeneratorFunction), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, toStringTagSymbol, "GeneratorFunction"), exports22.isGeneratorFunction = function(genFun) {
266
+ var ctor = "function" == typeof genFun && genFun.constructor;
267
+ return !!ctor && (ctor === GeneratorFunction || "GeneratorFunction" === (ctor.displayName || ctor.name));
268
+ }, exports22.mark = function(genFun) {
269
+ return Object.setPrototypeOf ? Object.setPrototypeOf(genFun, GeneratorFunctionPrototype) : (genFun.__proto__ = GeneratorFunctionPrototype, define(genFun, toStringTagSymbol, "GeneratorFunction")), genFun.prototype = Object.create(Gp), genFun;
270
+ }, exports22.awrap = function(arg) {
271
+ return {
272
+ __await: arg
273
+ };
274
+ }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, asyncIteratorSymbol, function() {
275
+ return this;
276
+ }), exports22.AsyncIterator = AsyncIterator, exports22.async = function(innerFn, outerFn, self, tryLocsList, PromiseImpl) {
277
+ void 0 === PromiseImpl && (PromiseImpl = Promise);
278
+ var iter = new AsyncIterator(wrap(innerFn, outerFn, self, tryLocsList), PromiseImpl);
279
+ return exports22.isGeneratorFunction(outerFn) ? iter : iter.next().then(function(result) {
280
+ return result.done ? result.value : iter.next();
281
+ });
282
+ }, defineIteratorMethods(Gp), define(Gp, toStringTagSymbol, "Generator"), define(Gp, iteratorSymbol, function() {
283
+ return this;
284
+ }), define(Gp, "toString", function() {
285
+ return "[object Generator]";
286
+ }), exports22.keys = function(object) {
287
+ var keys = [];
288
+ for (var key in object) {
289
+ keys.push(key);
290
+ }
291
+ return keys.reverse(), function next() {
292
+ for (; keys.length; ) {
293
+ var key2 = keys.pop();
294
+ if (key2 in object)
295
+ return next.value = key2, next.done = false, next;
296
+ }
297
+ return next.done = true, next;
298
+ };
299
+ }, exports22.values = values, Context.prototype = {
300
+ constructor: Context,
301
+ reset: function reset(skipTempReset) {
302
+ if (this.prev = 0, this.next = 0, this.sent = this._sent = void 0, this.done = false, this.delegate = null, this.method = "next", this.arg = void 0, this.tryEntries.forEach(resetTryEntry), !skipTempReset)
303
+ for (var name in this) {
304
+ "t" === name.charAt(0) && hasOwn.call(this, name) && !isNaN(+name.slice(1)) && (this[name] = void 0);
305
+ }
306
+ },
307
+ stop: function stop() {
308
+ this.done = true;
309
+ var rootRecord = this.tryEntries[0].completion;
310
+ if ("throw" === rootRecord.type)
311
+ throw rootRecord.arg;
312
+ return this.rval;
313
+ },
314
+ dispatchException: function dispatchException(exception) {
315
+ if (this.done)
316
+ throw exception;
317
+ var context = this;
318
+ function handle(loc, caught) {
319
+ return record.type = "throw", record.arg = exception, context.next = loc, caught && (context.method = "next", context.arg = void 0), !!caught;
320
+ }
321
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
322
+ var entry = this.tryEntries[i], record = entry.completion;
323
+ if ("root" === entry.tryLoc)
324
+ return handle("end");
325
+ if (entry.tryLoc <= this.prev) {
326
+ var hasCatch = hasOwn.call(entry, "catchLoc"), hasFinally = hasOwn.call(entry, "finallyLoc");
327
+ if (hasCatch && hasFinally) {
328
+ if (this.prev < entry.catchLoc)
329
+ return handle(entry.catchLoc, true);
330
+ if (this.prev < entry.finallyLoc)
331
+ return handle(entry.finallyLoc);
332
+ } else if (hasCatch) {
333
+ if (this.prev < entry.catchLoc)
334
+ return handle(entry.catchLoc, true);
335
+ } else {
336
+ if (!hasFinally)
337
+ throw new Error("try statement without catch or finally");
338
+ if (this.prev < entry.finallyLoc)
339
+ return handle(entry.finallyLoc);
340
+ }
341
+ }
342
+ }
343
+ },
344
+ abrupt: function abrupt(type, arg) {
345
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
346
+ var entry = this.tryEntries[i];
347
+ if (entry.tryLoc <= this.prev && hasOwn.call(entry, "finallyLoc") && this.prev < entry.finallyLoc) {
348
+ var finallyEntry = entry;
349
+ break;
350
+ }
351
+ }
352
+ finallyEntry && ("break" === type || "continue" === type) && finallyEntry.tryLoc <= arg && arg <= finallyEntry.finallyLoc && (finallyEntry = null);
353
+ var record = finallyEntry ? finallyEntry.completion : {};
354
+ return record.type = type, record.arg = arg, finallyEntry ? (this.method = "next", this.next = finallyEntry.finallyLoc, ContinueSentinel) : this.complete(record);
355
+ },
356
+ complete: function complete(record, afterLoc) {
357
+ if ("throw" === record.type)
358
+ throw record.arg;
359
+ return "break" === record.type || "continue" === record.type ? this.next = record.arg : "return" === record.type ? (this.rval = this.arg = record.arg, this.method = "return", this.next = "end") : "normal" === record.type && afterLoc && (this.next = afterLoc), ContinueSentinel;
360
+ },
361
+ finish: function finish(finallyLoc) {
362
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
363
+ var entry = this.tryEntries[i];
364
+ if (entry.finallyLoc === finallyLoc)
365
+ return this.complete(entry.completion, entry.afterLoc), resetTryEntry(entry), ContinueSentinel;
366
+ }
367
+ },
368
+ "catch": function _catch(tryLoc) {
369
+ for (var i = this.tryEntries.length - 1; i >= 0; --i) {
370
+ var entry = this.tryEntries[i];
371
+ if (entry.tryLoc === tryLoc) {
372
+ var record = entry.completion;
373
+ if ("throw" === record.type) {
374
+ var thrown = record.arg;
375
+ resetTryEntry(entry);
376
+ }
377
+ return thrown;
378
+ }
379
+ }
380
+ throw new Error("illegal catch attempt");
381
+ },
382
+ delegateYield: function delegateYield(iterable, resultName, nextLoc) {
383
+ return this.delegate = {
384
+ iterator: values(iterable),
385
+ resultName,
386
+ nextLoc
387
+ }, "next" === this.method && (this.arg = void 0), ContinueSentinel;
388
+ }
389
+ }, exports22;
390
+ }
391
+ module22.exports = _regeneratorRuntime2, module22.exports.__esModule = true, module22.exports["default"] = module22.exports;
392
+ }
393
+ });
394
+ var require_regenerator = __commonJS2({
395
+ "../../node_modules/.pnpm/@babel+runtime@7.18.9/node_modules/@babel/runtime/regenerator/index.js"(exports2, module22) {
396
+ init_cjs_shims();
397
+ var runtime = require_regeneratorRuntime()();
398
+ module22.exports = runtime;
399
+ try {
400
+ regeneratorRuntime = runtime;
401
+ } catch (accidentalStrictMode) {
402
+ if (typeof globalThis === "object") {
403
+ globalThis.regeneratorRuntime = runtime;
404
+ } else {
405
+ Function("r", "regeneratorRuntime = r")(runtime);
406
+ }
407
+ }
408
+ }
409
+ });
410
+ var require_p_try = __commonJS2({
411
+ "../../node_modules/.pnpm/p-try@2.2.0/node_modules/p-try/index.js"(exports2, module22) {
412
+ "use strict";
413
+ init_cjs_shims();
414
+ var pTry = (fn, ...arguments_) => new Promise((resolve) => {
415
+ resolve(fn(...arguments_));
416
+ });
417
+ module22.exports = pTry;
418
+ module22.exports.default = pTry;
419
+ }
420
+ });
421
+ var require_p_limit = __commonJS2({
422
+ "../../node_modules/.pnpm/p-limit@2.3.0/node_modules/p-limit/index.js"(exports2, module22) {
423
+ "use strict";
424
+ init_cjs_shims();
425
+ var pTry = require_p_try();
426
+ var pLimit = (concurrency) => {
427
+ if (!((Number.isInteger(concurrency) || concurrency === Infinity) && concurrency > 0)) {
428
+ return Promise.reject(new TypeError("Expected `concurrency` to be a number from 1 and up"));
429
+ }
430
+ const queue = [];
431
+ let activeCount = 0;
432
+ const next = () => {
433
+ activeCount--;
434
+ if (queue.length > 0) {
435
+ queue.shift()();
436
+ }
437
+ };
438
+ const run = (fn, resolve, ...args) => {
439
+ activeCount++;
440
+ const result = pTry(fn, ...args);
441
+ resolve(result);
442
+ result.then(next, next);
443
+ };
444
+ const enqueue = (fn, resolve, ...args) => {
445
+ if (activeCount < concurrency) {
446
+ run(fn, resolve, ...args);
447
+ } else {
448
+ queue.push(run.bind(null, fn, resolve, ...args));
449
+ }
450
+ };
451
+ const generator = (fn, ...args) => new Promise((resolve) => enqueue(fn, resolve, ...args));
452
+ Object.defineProperties(generator, {
453
+ activeCount: {
454
+ get: () => activeCount
455
+ },
456
+ pendingCount: {
457
+ get: () => queue.length
458
+ },
459
+ clearQueue: {
460
+ value: () => {
461
+ queue.length = 0;
462
+ }
463
+ }
464
+ });
465
+ return generator;
466
+ };
467
+ module22.exports = pLimit;
468
+ module22.exports.default = pLimit;
469
+ }
470
+ });
471
+ var require_p_locate = __commonJS2({
472
+ "../../node_modules/.pnpm/p-locate@4.1.0/node_modules/p-locate/index.js"(exports2, module22) {
473
+ "use strict";
474
+ init_cjs_shims();
475
+ var pLimit = require_p_limit();
476
+ var EndError = class extends Error {
477
+ constructor(value) {
478
+ super();
479
+ this.value = value;
480
+ }
481
+ };
482
+ var testElement = async (element, tester) => tester(await element);
483
+ var finder = async (element) => {
484
+ const values = await Promise.all(element);
485
+ if (values[1] === true) {
486
+ throw new EndError(values[0]);
487
+ }
488
+ return false;
489
+ };
490
+ var pLocate = async (iterable, tester, options) => {
491
+ options = {
492
+ concurrency: Infinity,
493
+ preserveOrder: true,
494
+ ...options
495
+ };
496
+ const limit = pLimit(options.concurrency);
497
+ const items = [...iterable].map((element) => [element, limit(testElement, element, tester)]);
498
+ const checkLimit = pLimit(options.preserveOrder ? 1 : Infinity);
499
+ try {
500
+ await Promise.all(items.map((element) => checkLimit(finder, element)));
501
+ } catch (error) {
502
+ if (error instanceof EndError) {
503
+ return error.value;
504
+ }
505
+ throw error;
506
+ }
507
+ };
508
+ module22.exports = pLocate;
509
+ module22.exports.default = pLocate;
510
+ }
511
+ });
512
+ var require_locate_path = __commonJS2({
513
+ "../../node_modules/.pnpm/locate-path@5.0.0/node_modules/locate-path/index.js"(exports2, module22) {
514
+ "use strict";
515
+ init_cjs_shims();
516
+ var path4 = require("path");
517
+ var fs4 = require("fs");
518
+ var { promisify } = require("util");
519
+ var pLocate = require_p_locate();
520
+ var fsStat = promisify(fs4.stat);
521
+ var fsLStat = promisify(fs4.lstat);
522
+ var typeMappings = {
523
+ directory: "isDirectory",
524
+ file: "isFile"
525
+ };
526
+ function checkType({ type }) {
527
+ if (type in typeMappings) {
528
+ return;
529
+ }
530
+ throw new Error(`Invalid type specified: ${type}`);
531
+ }
532
+ var matchType = (type, stat) => type === void 0 || stat[typeMappings[type]]();
533
+ module22.exports = async (paths, options) => {
534
+ options = {
535
+ cwd: process.cwd(),
536
+ type: "file",
537
+ allowSymlinks: true,
538
+ ...options
539
+ };
540
+ checkType(options);
541
+ const statFn = options.allowSymlinks ? fsStat : fsLStat;
542
+ return pLocate(paths, async (path_) => {
543
+ try {
544
+ const stat = await statFn(path4.resolve(options.cwd, path_));
545
+ return matchType(options.type, stat);
546
+ } catch (_) {
547
+ return false;
548
+ }
549
+ }, options);
550
+ };
551
+ module22.exports.sync = (paths, options) => {
552
+ options = {
553
+ cwd: process.cwd(),
554
+ allowSymlinks: true,
555
+ type: "file",
556
+ ...options
557
+ };
558
+ checkType(options);
559
+ const statFn = options.allowSymlinks ? fs4.statSync : fs4.lstatSync;
560
+ for (const path_ of paths) {
561
+ try {
562
+ const stat = statFn(path4.resolve(options.cwd, path_));
563
+ if (matchType(options.type, stat)) {
564
+ return path_;
565
+ }
566
+ } catch (_) {
567
+ }
568
+ }
569
+ };
570
+ }
571
+ });
572
+ var require_path_exists = __commonJS2({
573
+ "../../node_modules/.pnpm/path-exists@4.0.0/node_modules/path-exists/index.js"(exports2, module22) {
574
+ "use strict";
575
+ init_cjs_shims();
576
+ var fs4 = require("fs");
577
+ var { promisify } = require("util");
578
+ var pAccess = promisify(fs4.access);
579
+ module22.exports = async (path4) => {
580
+ try {
581
+ await pAccess(path4);
582
+ return true;
583
+ } catch (_) {
584
+ return false;
585
+ }
586
+ };
587
+ module22.exports.sync = (path4) => {
588
+ try {
589
+ fs4.accessSync(path4);
590
+ return true;
591
+ } catch (_) {
592
+ return false;
593
+ }
594
+ };
595
+ }
596
+ });
597
+ var require_find_up = __commonJS2({
598
+ "../../node_modules/.pnpm/find-up@4.1.0/node_modules/find-up/index.js"(exports2, module22) {
599
+ "use strict";
600
+ init_cjs_shims();
601
+ var path4 = require("path");
602
+ var locatePath = require_locate_path();
603
+ var pathExists = require_path_exists();
604
+ var stop = Symbol("findUp.stop");
605
+ module22.exports = async (name, options = {}) => {
606
+ let directory = path4.resolve(options.cwd || "");
607
+ const { root } = path4.parse(directory);
608
+ const paths = [].concat(name);
609
+ const runMatcher = async (locateOptions) => {
610
+ if (typeof name !== "function") {
611
+ return locatePath(paths, locateOptions);
612
+ }
613
+ const foundPath = await name(locateOptions.cwd);
614
+ if (typeof foundPath === "string") {
615
+ return locatePath([foundPath], locateOptions);
616
+ }
617
+ return foundPath;
618
+ };
619
+ while (true) {
620
+ const foundPath = await runMatcher({ ...options, cwd: directory });
621
+ if (foundPath === stop) {
622
+ return;
623
+ }
624
+ if (foundPath) {
625
+ return path4.resolve(directory, foundPath);
626
+ }
627
+ if (directory === root) {
628
+ return;
629
+ }
630
+ directory = path4.dirname(directory);
631
+ }
632
+ };
633
+ module22.exports.sync = (name, options = {}) => {
634
+ let directory = path4.resolve(options.cwd || "");
635
+ const { root } = path4.parse(directory);
636
+ const paths = [].concat(name);
637
+ const runMatcher = (locateOptions) => {
638
+ if (typeof name !== "function") {
639
+ return locatePath.sync(paths, locateOptions);
640
+ }
641
+ const foundPath = name(locateOptions.cwd);
642
+ if (typeof foundPath === "string") {
643
+ return locatePath.sync([foundPath], locateOptions);
644
+ }
645
+ return foundPath;
646
+ };
647
+ while (true) {
648
+ const foundPath = runMatcher({ ...options, cwd: directory });
649
+ if (foundPath === stop) {
650
+ return;
651
+ }
652
+ if (foundPath) {
653
+ return path4.resolve(directory, foundPath);
654
+ }
655
+ if (directory === root) {
656
+ return;
657
+ }
658
+ directory = path4.dirname(directory);
659
+ }
660
+ };
661
+ module22.exports.exists = pathExists;
662
+ module22.exports.sync.exists = pathExists.sync;
663
+ module22.exports.stop = stop;
664
+ }
665
+ });
666
+ var require_universalify = __commonJS2({
667
+ "../../node_modules/.pnpm/universalify@0.1.2/node_modules/universalify/index.js"(exports2) {
668
+ "use strict";
669
+ init_cjs_shims();
670
+ exports2.fromCallback = function(fn) {
671
+ return Object.defineProperty(function() {
672
+ if (typeof arguments[arguments.length - 1] === "function")
673
+ fn.apply(this, arguments);
674
+ else {
675
+ return new Promise((resolve, reject) => {
676
+ arguments[arguments.length] = (err, res) => {
677
+ if (err)
678
+ return reject(err);
679
+ resolve(res);
680
+ };
681
+ arguments.length++;
682
+ fn.apply(this, arguments);
683
+ });
684
+ }
685
+ }, "name", { value: fn.name });
686
+ };
687
+ exports2.fromPromise = function(fn) {
688
+ return Object.defineProperty(function() {
689
+ const cb = arguments[arguments.length - 1];
690
+ if (typeof cb !== "function")
691
+ return fn.apply(this, arguments);
692
+ else
693
+ fn.apply(this, arguments).then((r) => cb(null, r), cb);
694
+ }, "name", { value: fn.name });
695
+ };
696
+ }
697
+ });
698
+ var require_polyfills = __commonJS2({
699
+ "../../node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/polyfills.js"(exports2, module22) {
700
+ init_cjs_shims();
701
+ var constants = require("constants");
702
+ var origCwd = process.cwd;
703
+ var cwd = null;
704
+ var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
705
+ process.cwd = function() {
706
+ if (!cwd)
707
+ cwd = origCwd.call(process);
708
+ return cwd;
709
+ };
710
+ try {
711
+ process.cwd();
712
+ } catch (er) {
713
+ }
714
+ if (typeof process.chdir === "function") {
715
+ chdir = process.chdir;
716
+ process.chdir = function(d) {
717
+ cwd = null;
718
+ chdir.call(process, d);
719
+ };
720
+ if (Object.setPrototypeOf)
721
+ Object.setPrototypeOf(process.chdir, chdir);
722
+ }
723
+ var chdir;
724
+ module22.exports = patch;
725
+ function patch(fs4) {
726
+ if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
727
+ patchLchmod(fs4);
728
+ }
729
+ if (!fs4.lutimes) {
730
+ patchLutimes(fs4);
731
+ }
732
+ fs4.chown = chownFix(fs4.chown);
733
+ fs4.fchown = chownFix(fs4.fchown);
734
+ fs4.lchown = chownFix(fs4.lchown);
735
+ fs4.chmod = chmodFix(fs4.chmod);
736
+ fs4.fchmod = chmodFix(fs4.fchmod);
737
+ fs4.lchmod = chmodFix(fs4.lchmod);
738
+ fs4.chownSync = chownFixSync(fs4.chownSync);
739
+ fs4.fchownSync = chownFixSync(fs4.fchownSync);
740
+ fs4.lchownSync = chownFixSync(fs4.lchownSync);
741
+ fs4.chmodSync = chmodFixSync(fs4.chmodSync);
742
+ fs4.fchmodSync = chmodFixSync(fs4.fchmodSync);
743
+ fs4.lchmodSync = chmodFixSync(fs4.lchmodSync);
744
+ fs4.stat = statFix(fs4.stat);
745
+ fs4.fstat = statFix(fs4.fstat);
746
+ fs4.lstat = statFix(fs4.lstat);
747
+ fs4.statSync = statFixSync(fs4.statSync);
748
+ fs4.fstatSync = statFixSync(fs4.fstatSync);
749
+ fs4.lstatSync = statFixSync(fs4.lstatSync);
750
+ if (fs4.chmod && !fs4.lchmod) {
751
+ fs4.lchmod = function(path4, mode, cb) {
752
+ if (cb)
753
+ process.nextTick(cb);
754
+ };
755
+ fs4.lchmodSync = function() {
756
+ };
757
+ }
758
+ if (fs4.chown && !fs4.lchown) {
759
+ fs4.lchown = function(path4, uid, gid, cb) {
760
+ if (cb)
761
+ process.nextTick(cb);
762
+ };
763
+ fs4.lchownSync = function() {
764
+ };
765
+ }
766
+ if (platform === "win32") {
767
+ fs4.rename = typeof fs4.rename !== "function" ? fs4.rename : function(fs$rename) {
768
+ function rename(from, to, cb) {
769
+ var start = Date.now();
770
+ var backoff = 0;
771
+ fs$rename(from, to, function CB(er) {
772
+ if (er && (er.code === "EACCES" || er.code === "EPERM") && Date.now() - start < 6e4) {
773
+ setTimeout(function() {
774
+ fs4.stat(to, function(stater, st) {
775
+ if (stater && stater.code === "ENOENT")
776
+ fs$rename(from, to, CB);
777
+ else
778
+ cb(er);
779
+ });
780
+ }, backoff);
781
+ if (backoff < 100)
782
+ backoff += 10;
783
+ return;
784
+ }
785
+ if (cb)
786
+ cb(er);
787
+ });
788
+ }
789
+ if (Object.setPrototypeOf)
790
+ Object.setPrototypeOf(rename, fs$rename);
791
+ return rename;
792
+ }(fs4.rename);
793
+ }
794
+ fs4.read = typeof fs4.read !== "function" ? fs4.read : function(fs$read) {
795
+ function read(fd, buffer, offset, length, position, callback_) {
796
+ var callback;
797
+ if (callback_ && typeof callback_ === "function") {
798
+ var eagCounter = 0;
799
+ callback = function(er, _, __) {
800
+ if (er && er.code === "EAGAIN" && eagCounter < 10) {
801
+ eagCounter++;
802
+ return fs$read.call(fs4, fd, buffer, offset, length, position, callback);
803
+ }
804
+ callback_.apply(this, arguments);
805
+ };
806
+ }
807
+ return fs$read.call(fs4, fd, buffer, offset, length, position, callback);
808
+ }
809
+ if (Object.setPrototypeOf)
810
+ Object.setPrototypeOf(read, fs$read);
811
+ return read;
812
+ }(fs4.read);
813
+ fs4.readSync = typeof fs4.readSync !== "function" ? fs4.readSync : function(fs$readSync) {
814
+ return function(fd, buffer, offset, length, position) {
815
+ var eagCounter = 0;
816
+ while (true) {
817
+ try {
818
+ return fs$readSync.call(fs4, fd, buffer, offset, length, position);
819
+ } catch (er) {
820
+ if (er.code === "EAGAIN" && eagCounter < 10) {
821
+ eagCounter++;
822
+ continue;
823
+ }
824
+ throw er;
825
+ }
826
+ }
827
+ };
828
+ }(fs4.readSync);
829
+ function patchLchmod(fs5) {
830
+ fs5.lchmod = function(path4, mode, callback) {
831
+ fs5.open(path4, constants.O_WRONLY | constants.O_SYMLINK, mode, function(err, fd) {
832
+ if (err) {
833
+ if (callback)
834
+ callback(err);
835
+ return;
836
+ }
837
+ fs5.fchmod(fd, mode, function(err2) {
838
+ fs5.close(fd, function(err22) {
839
+ if (callback)
840
+ callback(err2 || err22);
841
+ });
842
+ });
843
+ });
844
+ };
845
+ fs5.lchmodSync = function(path4, mode) {
846
+ var fd = fs5.openSync(path4, constants.O_WRONLY | constants.O_SYMLINK, mode);
847
+ var threw = true;
848
+ var ret;
849
+ try {
850
+ ret = fs5.fchmodSync(fd, mode);
851
+ threw = false;
852
+ } finally {
853
+ if (threw) {
854
+ try {
855
+ fs5.closeSync(fd);
856
+ } catch (er) {
857
+ }
858
+ } else {
859
+ fs5.closeSync(fd);
860
+ }
861
+ }
862
+ return ret;
863
+ };
864
+ }
865
+ function patchLutimes(fs5) {
866
+ if (constants.hasOwnProperty("O_SYMLINK") && fs5.futimes) {
867
+ fs5.lutimes = function(path4, at, mt, cb) {
868
+ fs5.open(path4, constants.O_SYMLINK, function(er, fd) {
869
+ if (er) {
870
+ if (cb)
871
+ cb(er);
872
+ return;
873
+ }
874
+ fs5.futimes(fd, at, mt, function(er2) {
875
+ fs5.close(fd, function(er22) {
876
+ if (cb)
877
+ cb(er2 || er22);
878
+ });
879
+ });
880
+ });
881
+ };
882
+ fs5.lutimesSync = function(path4, at, mt) {
883
+ var fd = fs5.openSync(path4, constants.O_SYMLINK);
884
+ var ret;
885
+ var threw = true;
886
+ try {
887
+ ret = fs5.futimesSync(fd, at, mt);
888
+ threw = false;
889
+ } finally {
890
+ if (threw) {
891
+ try {
892
+ fs5.closeSync(fd);
893
+ } catch (er) {
894
+ }
895
+ } else {
896
+ fs5.closeSync(fd);
897
+ }
898
+ }
899
+ return ret;
900
+ };
901
+ } else if (fs5.futimes) {
902
+ fs5.lutimes = function(_a, _b, _c, cb) {
903
+ if (cb)
904
+ process.nextTick(cb);
905
+ };
906
+ fs5.lutimesSync = function() {
907
+ };
908
+ }
909
+ }
910
+ function chmodFix(orig) {
911
+ if (!orig)
912
+ return orig;
913
+ return function(target, mode, cb) {
914
+ return orig.call(fs4, target, mode, function(er) {
915
+ if (chownErOk(er))
916
+ er = null;
917
+ if (cb)
918
+ cb.apply(this, arguments);
919
+ });
920
+ };
921
+ }
922
+ function chmodFixSync(orig) {
923
+ if (!orig)
924
+ return orig;
925
+ return function(target, mode) {
926
+ try {
927
+ return orig.call(fs4, target, mode);
928
+ } catch (er) {
929
+ if (!chownErOk(er))
930
+ throw er;
931
+ }
932
+ };
933
+ }
934
+ function chownFix(orig) {
935
+ if (!orig)
936
+ return orig;
937
+ return function(target, uid, gid, cb) {
938
+ return orig.call(fs4, target, uid, gid, function(er) {
939
+ if (chownErOk(er))
940
+ er = null;
941
+ if (cb)
942
+ cb.apply(this, arguments);
943
+ });
944
+ };
945
+ }
946
+ function chownFixSync(orig) {
947
+ if (!orig)
948
+ return orig;
949
+ return function(target, uid, gid) {
950
+ try {
951
+ return orig.call(fs4, target, uid, gid);
952
+ } catch (er) {
953
+ if (!chownErOk(er))
954
+ throw er;
955
+ }
956
+ };
957
+ }
958
+ function statFix(orig) {
959
+ if (!orig)
960
+ return orig;
961
+ return function(target, options, cb) {
962
+ if (typeof options === "function") {
963
+ cb = options;
964
+ options = null;
965
+ }
966
+ function callback(er, stats) {
967
+ if (stats) {
968
+ if (stats.uid < 0)
969
+ stats.uid += 4294967296;
970
+ if (stats.gid < 0)
971
+ stats.gid += 4294967296;
972
+ }
973
+ if (cb)
974
+ cb.apply(this, arguments);
975
+ }
976
+ return options ? orig.call(fs4, target, options, callback) : orig.call(fs4, target, callback);
977
+ };
978
+ }
979
+ function statFixSync(orig) {
980
+ if (!orig)
981
+ return orig;
982
+ return function(target, options) {
983
+ var stats = options ? orig.call(fs4, target, options) : orig.call(fs4, target);
984
+ if (stats) {
985
+ if (stats.uid < 0)
986
+ stats.uid += 4294967296;
987
+ if (stats.gid < 0)
988
+ stats.gid += 4294967296;
989
+ }
990
+ return stats;
991
+ };
992
+ }
993
+ function chownErOk(er) {
994
+ if (!er)
995
+ return true;
996
+ if (er.code === "ENOSYS")
997
+ return true;
998
+ var nonroot = !process.getuid || process.getuid() !== 0;
999
+ if (nonroot) {
1000
+ if (er.code === "EINVAL" || er.code === "EPERM")
1001
+ return true;
1002
+ }
1003
+ return false;
1004
+ }
1005
+ }
1006
+ }
1007
+ });
1008
+ var require_legacy_streams = __commonJS2({
1009
+ "../../node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/legacy-streams.js"(exports2, module22) {
1010
+ init_cjs_shims();
1011
+ var Stream = require("stream").Stream;
1012
+ module22.exports = legacy;
1013
+ function legacy(fs4) {
1014
+ return {
1015
+ ReadStream,
1016
+ WriteStream
1017
+ };
1018
+ function ReadStream(path4, options) {
1019
+ if (!(this instanceof ReadStream))
1020
+ return new ReadStream(path4, options);
1021
+ Stream.call(this);
1022
+ var self = this;
1023
+ this.path = path4;
1024
+ this.fd = null;
1025
+ this.readable = true;
1026
+ this.paused = false;
1027
+ this.flags = "r";
1028
+ this.mode = 438;
1029
+ this.bufferSize = 64 * 1024;
1030
+ options = options || {};
1031
+ var keys = Object.keys(options);
1032
+ for (var index = 0, length = keys.length; index < length; index++) {
1033
+ var key = keys[index];
1034
+ this[key] = options[key];
1035
+ }
1036
+ if (this.encoding)
1037
+ this.setEncoding(this.encoding);
1038
+ if (this.start !== void 0) {
1039
+ if ("number" !== typeof this.start) {
1040
+ throw TypeError("start must be a Number");
1041
+ }
1042
+ if (this.end === void 0) {
1043
+ this.end = Infinity;
1044
+ } else if ("number" !== typeof this.end) {
1045
+ throw TypeError("end must be a Number");
1046
+ }
1047
+ if (this.start > this.end) {
1048
+ throw new Error("start must be <= end");
1049
+ }
1050
+ this.pos = this.start;
1051
+ }
1052
+ if (this.fd !== null) {
1053
+ process.nextTick(function() {
1054
+ self._read();
1055
+ });
1056
+ return;
1057
+ }
1058
+ fs4.open(this.path, this.flags, this.mode, function(err, fd) {
1059
+ if (err) {
1060
+ self.emit("error", err);
1061
+ self.readable = false;
1062
+ return;
1063
+ }
1064
+ self.fd = fd;
1065
+ self.emit("open", fd);
1066
+ self._read();
1067
+ });
1068
+ }
1069
+ function WriteStream(path4, options) {
1070
+ if (!(this instanceof WriteStream))
1071
+ return new WriteStream(path4, options);
1072
+ Stream.call(this);
1073
+ this.path = path4;
1074
+ this.fd = null;
1075
+ this.writable = true;
1076
+ this.flags = "w";
1077
+ this.encoding = "binary";
1078
+ this.mode = 438;
1079
+ this.bytesWritten = 0;
1080
+ options = options || {};
1081
+ var keys = Object.keys(options);
1082
+ for (var index = 0, length = keys.length; index < length; index++) {
1083
+ var key = keys[index];
1084
+ this[key] = options[key];
1085
+ }
1086
+ if (this.start !== void 0) {
1087
+ if ("number" !== typeof this.start) {
1088
+ throw TypeError("start must be a Number");
1089
+ }
1090
+ if (this.start < 0) {
1091
+ throw new Error("start must be >= zero");
1092
+ }
1093
+ this.pos = this.start;
1094
+ }
1095
+ this.busy = false;
1096
+ this._queue = [];
1097
+ if (this.fd === null) {
1098
+ this._open = fs4.open;
1099
+ this._queue.push([this._open, this.path, this.flags, this.mode, void 0]);
1100
+ this.flush();
1101
+ }
1102
+ }
1103
+ }
1104
+ }
1105
+ });
1106
+ var require_clone = __commonJS2({
1107
+ "../../node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/clone.js"(exports2, module22) {
1108
+ "use strict";
1109
+ init_cjs_shims();
1110
+ module22.exports = clone;
1111
+ var getPrototypeOf = Object.getPrototypeOf || function(obj) {
1112
+ return obj.__proto__;
1113
+ };
1114
+ function clone(obj) {
1115
+ if (obj === null || typeof obj !== "object")
1116
+ return obj;
1117
+ if (obj instanceof Object)
1118
+ var copy = { __proto__: getPrototypeOf(obj) };
1119
+ else
1120
+ var copy = /* @__PURE__ */ Object.create(null);
1121
+ Object.getOwnPropertyNames(obj).forEach(function(key) {
1122
+ Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key));
1123
+ });
1124
+ return copy;
1125
+ }
1126
+ }
1127
+ });
1128
+ var require_graceful_fs = __commonJS2({
1129
+ "../../node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/graceful-fs.js"(exports2, module22) {
1130
+ init_cjs_shims();
1131
+ var fs4 = require("fs");
1132
+ var polyfills = require_polyfills();
1133
+ var legacy = require_legacy_streams();
1134
+ var clone = require_clone();
1135
+ var util = require("util");
1136
+ var gracefulQueue;
1137
+ var previousSymbol;
1138
+ if (typeof Symbol === "function" && typeof Symbol.for === "function") {
1139
+ gracefulQueue = Symbol.for("graceful-fs.queue");
1140
+ previousSymbol = Symbol.for("graceful-fs.previous");
1141
+ } else {
1142
+ gracefulQueue = "___graceful-fs.queue";
1143
+ previousSymbol = "___graceful-fs.previous";
1144
+ }
1145
+ function noop() {
1146
+ }
1147
+ function publishQueue(context, queue2) {
1148
+ Object.defineProperty(context, gracefulQueue, {
1149
+ get: function() {
1150
+ return queue2;
1151
+ }
1152
+ });
1153
+ }
1154
+ var debug = noop;
1155
+ if (util.debuglog)
1156
+ debug = util.debuglog("gfs4");
1157
+ else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ""))
1158
+ debug = function() {
1159
+ var m = util.format.apply(util, arguments);
1160
+ m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
1161
+ console.error(m);
1162
+ };
1163
+ if (!fs4[gracefulQueue]) {
1164
+ queue = global[gracefulQueue] || [];
1165
+ publishQueue(fs4, queue);
1166
+ fs4.close = function(fs$close) {
1167
+ function close(fd, cb) {
1168
+ return fs$close.call(fs4, fd, function(err) {
1169
+ if (!err) {
1170
+ resetQueue();
1171
+ }
1172
+ if (typeof cb === "function")
1173
+ cb.apply(this, arguments);
1174
+ });
1175
+ }
1176
+ Object.defineProperty(close, previousSymbol, {
1177
+ value: fs$close
1178
+ });
1179
+ return close;
1180
+ }(fs4.close);
1181
+ fs4.closeSync = function(fs$closeSync) {
1182
+ function closeSync(fd) {
1183
+ fs$closeSync.apply(fs4, arguments);
1184
+ resetQueue();
1185
+ }
1186
+ Object.defineProperty(closeSync, previousSymbol, {
1187
+ value: fs$closeSync
1188
+ });
1189
+ return closeSync;
1190
+ }(fs4.closeSync);
1191
+ if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
1192
+ process.on("exit", function() {
1193
+ debug(fs4[gracefulQueue]);
1194
+ require("assert").equal(fs4[gracefulQueue].length, 0);
1195
+ });
1196
+ }
1197
+ }
1198
+ var queue;
1199
+ if (!global[gracefulQueue]) {
1200
+ publishQueue(global, fs4[gracefulQueue]);
1201
+ }
1202
+ module22.exports = patch(clone(fs4));
1203
+ if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs4.__patched) {
1204
+ module22.exports = patch(fs4);
1205
+ fs4.__patched = true;
1206
+ }
1207
+ function patch(fs5) {
1208
+ polyfills(fs5);
1209
+ fs5.gracefulify = patch;
1210
+ fs5.createReadStream = createReadStream;
1211
+ fs5.createWriteStream = createWriteStream;
1212
+ var fs$readFile = fs5.readFile;
1213
+ fs5.readFile = readFile;
1214
+ function readFile(path4, options, cb) {
1215
+ if (typeof options === "function")
1216
+ cb = options, options = null;
1217
+ return go$readFile(path4, options, cb);
1218
+ function go$readFile(path5, options2, cb2, startTime) {
1219
+ return fs$readFile(path5, options2, function(err) {
1220
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
1221
+ enqueue([go$readFile, [path5, options2, cb2], err, startTime || Date.now(), Date.now()]);
1222
+ else {
1223
+ if (typeof cb2 === "function")
1224
+ cb2.apply(this, arguments);
1225
+ }
1226
+ });
1227
+ }
1228
+ }
1229
+ var fs$writeFile = fs5.writeFile;
1230
+ fs5.writeFile = writeFile;
1231
+ function writeFile(path4, data, options, cb) {
1232
+ if (typeof options === "function")
1233
+ cb = options, options = null;
1234
+ return go$writeFile(path4, data, options, cb);
1235
+ function go$writeFile(path5, data2, options2, cb2, startTime) {
1236
+ return fs$writeFile(path5, data2, options2, function(err) {
1237
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
1238
+ enqueue([go$writeFile, [path5, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
1239
+ else {
1240
+ if (typeof cb2 === "function")
1241
+ cb2.apply(this, arguments);
1242
+ }
1243
+ });
1244
+ }
1245
+ }
1246
+ var fs$appendFile = fs5.appendFile;
1247
+ if (fs$appendFile)
1248
+ fs5.appendFile = appendFile;
1249
+ function appendFile(path4, data, options, cb) {
1250
+ if (typeof options === "function")
1251
+ cb = options, options = null;
1252
+ return go$appendFile(path4, data, options, cb);
1253
+ function go$appendFile(path5, data2, options2, cb2, startTime) {
1254
+ return fs$appendFile(path5, data2, options2, function(err) {
1255
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
1256
+ enqueue([go$appendFile, [path5, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
1257
+ else {
1258
+ if (typeof cb2 === "function")
1259
+ cb2.apply(this, arguments);
1260
+ }
1261
+ });
1262
+ }
1263
+ }
1264
+ var fs$copyFile = fs5.copyFile;
1265
+ if (fs$copyFile)
1266
+ fs5.copyFile = copyFile;
1267
+ function copyFile(src, dest, flags, cb) {
1268
+ if (typeof flags === "function") {
1269
+ cb = flags;
1270
+ flags = 0;
1271
+ }
1272
+ return go$copyFile(src, dest, flags, cb);
1273
+ function go$copyFile(src2, dest2, flags2, cb2, startTime) {
1274
+ return fs$copyFile(src2, dest2, flags2, function(err) {
1275
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
1276
+ enqueue([go$copyFile, [src2, dest2, flags2, cb2], err, startTime || Date.now(), Date.now()]);
1277
+ else {
1278
+ if (typeof cb2 === "function")
1279
+ cb2.apply(this, arguments);
1280
+ }
1281
+ });
1282
+ }
1283
+ }
1284
+ var fs$readdir = fs5.readdir;
1285
+ fs5.readdir = readdir;
1286
+ var noReaddirOptionVersions = /^v[0-5]\./;
1287
+ function readdir(path4, options, cb) {
1288
+ if (typeof options === "function")
1289
+ cb = options, options = null;
1290
+ var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path5, options2, cb2, startTime) {
1291
+ return fs$readdir(path5, fs$readdirCallback(path5, options2, cb2, startTime));
1292
+ } : function go$readdir2(path5, options2, cb2, startTime) {
1293
+ return fs$readdir(path5, options2, fs$readdirCallback(path5, options2, cb2, startTime));
1294
+ };
1295
+ return go$readdir(path4, options, cb);
1296
+ function fs$readdirCallback(path5, options2, cb2, startTime) {
1297
+ return function(err, files) {
1298
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
1299
+ enqueue([
1300
+ go$readdir,
1301
+ [path5, options2, cb2],
1302
+ err,
1303
+ startTime || Date.now(),
1304
+ Date.now()
1305
+ ]);
1306
+ else {
1307
+ if (files && files.sort)
1308
+ files.sort();
1309
+ if (typeof cb2 === "function")
1310
+ cb2.call(this, err, files);
1311
+ }
1312
+ };
1313
+ }
1314
+ }
1315
+ if (process.version.substr(0, 4) === "v0.8") {
1316
+ var legStreams = legacy(fs5);
1317
+ ReadStream = legStreams.ReadStream;
1318
+ WriteStream = legStreams.WriteStream;
1319
+ }
1320
+ var fs$ReadStream = fs5.ReadStream;
1321
+ if (fs$ReadStream) {
1322
+ ReadStream.prototype = Object.create(fs$ReadStream.prototype);
1323
+ ReadStream.prototype.open = ReadStream$open;
1324
+ }
1325
+ var fs$WriteStream = fs5.WriteStream;
1326
+ if (fs$WriteStream) {
1327
+ WriteStream.prototype = Object.create(fs$WriteStream.prototype);
1328
+ WriteStream.prototype.open = WriteStream$open;
1329
+ }
1330
+ Object.defineProperty(fs5, "ReadStream", {
1331
+ get: function() {
1332
+ return ReadStream;
1333
+ },
1334
+ set: function(val) {
1335
+ ReadStream = val;
1336
+ },
1337
+ enumerable: true,
1338
+ configurable: true
1339
+ });
1340
+ Object.defineProperty(fs5, "WriteStream", {
1341
+ get: function() {
1342
+ return WriteStream;
1343
+ },
1344
+ set: function(val) {
1345
+ WriteStream = val;
1346
+ },
1347
+ enumerable: true,
1348
+ configurable: true
1349
+ });
1350
+ var FileReadStream = ReadStream;
1351
+ Object.defineProperty(fs5, "FileReadStream", {
1352
+ get: function() {
1353
+ return FileReadStream;
1354
+ },
1355
+ set: function(val) {
1356
+ FileReadStream = val;
1357
+ },
1358
+ enumerable: true,
1359
+ configurable: true
1360
+ });
1361
+ var FileWriteStream = WriteStream;
1362
+ Object.defineProperty(fs5, "FileWriteStream", {
1363
+ get: function() {
1364
+ return FileWriteStream;
1365
+ },
1366
+ set: function(val) {
1367
+ FileWriteStream = val;
1368
+ },
1369
+ enumerable: true,
1370
+ configurable: true
1371
+ });
1372
+ function ReadStream(path4, options) {
1373
+ if (this instanceof ReadStream)
1374
+ return fs$ReadStream.apply(this, arguments), this;
1375
+ else
1376
+ return ReadStream.apply(Object.create(ReadStream.prototype), arguments);
1377
+ }
1378
+ function ReadStream$open() {
1379
+ var that = this;
1380
+ open(that.path, that.flags, that.mode, function(err, fd) {
1381
+ if (err) {
1382
+ if (that.autoClose)
1383
+ that.destroy();
1384
+ that.emit("error", err);
1385
+ } else {
1386
+ that.fd = fd;
1387
+ that.emit("open", fd);
1388
+ that.read();
1389
+ }
1390
+ });
1391
+ }
1392
+ function WriteStream(path4, options) {
1393
+ if (this instanceof WriteStream)
1394
+ return fs$WriteStream.apply(this, arguments), this;
1395
+ else
1396
+ return WriteStream.apply(Object.create(WriteStream.prototype), arguments);
1397
+ }
1398
+ function WriteStream$open() {
1399
+ var that = this;
1400
+ open(that.path, that.flags, that.mode, function(err, fd) {
1401
+ if (err) {
1402
+ that.destroy();
1403
+ that.emit("error", err);
1404
+ } else {
1405
+ that.fd = fd;
1406
+ that.emit("open", fd);
1407
+ }
1408
+ });
1409
+ }
1410
+ function createReadStream(path4, options) {
1411
+ return new fs5.ReadStream(path4, options);
1412
+ }
1413
+ function createWriteStream(path4, options) {
1414
+ return new fs5.WriteStream(path4, options);
1415
+ }
1416
+ var fs$open = fs5.open;
1417
+ fs5.open = open;
1418
+ function open(path4, flags, mode, cb) {
1419
+ if (typeof mode === "function")
1420
+ cb = mode, mode = null;
1421
+ return go$open(path4, flags, mode, cb);
1422
+ function go$open(path5, flags2, mode2, cb2, startTime) {
1423
+ return fs$open(path5, flags2, mode2, function(err, fd) {
1424
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
1425
+ enqueue([go$open, [path5, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
1426
+ else {
1427
+ if (typeof cb2 === "function")
1428
+ cb2.apply(this, arguments);
1429
+ }
1430
+ });
1431
+ }
1432
+ }
1433
+ return fs5;
1434
+ }
1435
+ function enqueue(elem) {
1436
+ debug("ENQUEUE", elem[0].name, elem[1]);
1437
+ fs4[gracefulQueue].push(elem);
1438
+ retry();
1439
+ }
1440
+ var retryTimer;
1441
+ function resetQueue() {
1442
+ var now = Date.now();
1443
+ for (var i = 0; i < fs4[gracefulQueue].length; ++i) {
1444
+ if (fs4[gracefulQueue][i].length > 2) {
1445
+ fs4[gracefulQueue][i][3] = now;
1446
+ fs4[gracefulQueue][i][4] = now;
1447
+ }
1448
+ }
1449
+ retry();
1450
+ }
1451
+ function retry() {
1452
+ clearTimeout(retryTimer);
1453
+ retryTimer = void 0;
1454
+ if (fs4[gracefulQueue].length === 0)
1455
+ return;
1456
+ var elem = fs4[gracefulQueue].shift();
1457
+ var fn = elem[0];
1458
+ var args = elem[1];
1459
+ var err = elem[2];
1460
+ var startTime = elem[3];
1461
+ var lastTime = elem[4];
1462
+ if (startTime === void 0) {
1463
+ debug("RETRY", fn.name, args);
1464
+ fn.apply(null, args);
1465
+ } else if (Date.now() - startTime >= 6e4) {
1466
+ debug("TIMEOUT", fn.name, args);
1467
+ var cb = args.pop();
1468
+ if (typeof cb === "function")
1469
+ cb.call(null, err);
1470
+ } else {
1471
+ var sinceAttempt = Date.now() - lastTime;
1472
+ var sinceStart = Math.max(lastTime - startTime, 1);
1473
+ var desiredDelay = Math.min(sinceStart * 1.2, 100);
1474
+ if (sinceAttempt >= desiredDelay) {
1475
+ debug("RETRY", fn.name, args);
1476
+ fn.apply(null, args.concat([startTime]));
1477
+ } else {
1478
+ fs4[gracefulQueue].push(elem);
1479
+ }
1480
+ }
1481
+ if (retryTimer === void 0) {
1482
+ retryTimer = setTimeout(retry, 0);
1483
+ }
1484
+ }
1485
+ }
1486
+ });
1487
+ var require_fs = __commonJS2({
1488
+ "../../node_modules/.pnpm/fs-extra@8.1.0/node_modules/fs-extra/lib/fs/index.js"(exports2) {
1489
+ "use strict";
1490
+ init_cjs_shims();
1491
+ var u = require_universalify().fromCallback;
1492
+ var fs4 = require_graceful_fs();
1493
+ var api = [
1494
+ "access",
1495
+ "appendFile",
1496
+ "chmod",
1497
+ "chown",
1498
+ "close",
1499
+ "copyFile",
1500
+ "fchmod",
1501
+ "fchown",
1502
+ "fdatasync",
1503
+ "fstat",
1504
+ "fsync",
1505
+ "ftruncate",
1506
+ "futimes",
1507
+ "lchown",
1508
+ "lchmod",
1509
+ "link",
1510
+ "lstat",
1511
+ "mkdir",
1512
+ "mkdtemp",
1513
+ "open",
1514
+ "readFile",
1515
+ "readdir",
1516
+ "readlink",
1517
+ "realpath",
1518
+ "rename",
1519
+ "rmdir",
1520
+ "stat",
1521
+ "symlink",
1522
+ "truncate",
1523
+ "unlink",
1524
+ "utimes",
1525
+ "writeFile"
1526
+ ].filter((key) => {
1527
+ return typeof fs4[key] === "function";
1528
+ });
1529
+ Object.keys(fs4).forEach((key) => {
1530
+ if (key === "promises") {
1531
+ return;
1532
+ }
1533
+ exports2[key] = fs4[key];
1534
+ });
1535
+ api.forEach((method) => {
1536
+ exports2[method] = u(fs4[method]);
1537
+ });
1538
+ exports2.exists = function(filename, callback) {
1539
+ if (typeof callback === "function") {
1540
+ return fs4.exists(filename, callback);
1541
+ }
1542
+ return new Promise((resolve) => {
1543
+ return fs4.exists(filename, resolve);
1544
+ });
1545
+ };
1546
+ exports2.read = function(fd, buffer, offset, length, position, callback) {
1547
+ if (typeof callback === "function") {
1548
+ return fs4.read(fd, buffer, offset, length, position, callback);
1549
+ }
1550
+ return new Promise((resolve, reject) => {
1551
+ fs4.read(fd, buffer, offset, length, position, (err, bytesRead, buffer2) => {
1552
+ if (err)
1553
+ return reject(err);
1554
+ resolve({ bytesRead, buffer: buffer2 });
1555
+ });
1556
+ });
1557
+ };
1558
+ exports2.write = function(fd, buffer, ...args) {
1559
+ if (typeof args[args.length - 1] === "function") {
1560
+ return fs4.write(fd, buffer, ...args);
1561
+ }
1562
+ return new Promise((resolve, reject) => {
1563
+ fs4.write(fd, buffer, ...args, (err, bytesWritten, buffer2) => {
1564
+ if (err)
1565
+ return reject(err);
1566
+ resolve({ bytesWritten, buffer: buffer2 });
1567
+ });
1568
+ });
1569
+ };
1570
+ if (typeof fs4.realpath.native === "function") {
1571
+ exports2.realpath.native = u(fs4.realpath.native);
1572
+ }
1573
+ }
1574
+ });
1575
+ var require_win32 = __commonJS2({
1576
+ "../../node_modules/.pnpm/fs-extra@8.1.0/node_modules/fs-extra/lib/mkdirs/win32.js"(exports2, module22) {
1577
+ "use strict";
1578
+ init_cjs_shims();
1579
+ var path4 = require("path");
1580
+ function getRootPath(p) {
1581
+ p = path4.normalize(path4.resolve(p)).split(path4.sep);
1582
+ if (p.length > 0)
1583
+ return p[0];
1584
+ return null;
1585
+ }
1586
+ var INVALID_PATH_CHARS = /[<>:"|?*]/;
1587
+ function invalidWin32Path(p) {
1588
+ const rp = getRootPath(p);
1589
+ p = p.replace(rp, "");
1590
+ return INVALID_PATH_CHARS.test(p);
1591
+ }
1592
+ module22.exports = {
1593
+ getRootPath,
1594
+ invalidWin32Path
1595
+ };
1596
+ }
1597
+ });
1598
+ var require_mkdirs = __commonJS2({
1599
+ "../../node_modules/.pnpm/fs-extra@8.1.0/node_modules/fs-extra/lib/mkdirs/mkdirs.js"(exports2, module22) {
1600
+ "use strict";
1601
+ init_cjs_shims();
1602
+ var fs4 = require_graceful_fs();
1603
+ var path4 = require("path");
1604
+ var invalidWin32Path = require_win32().invalidWin32Path;
1605
+ var o777 = parseInt("0777", 8);
1606
+ function mkdirs(p, opts, callback, made) {
1607
+ if (typeof opts === "function") {
1608
+ callback = opts;
1609
+ opts = {};
1610
+ } else if (!opts || typeof opts !== "object") {
1611
+ opts = { mode: opts };
1612
+ }
1613
+ if (process.platform === "win32" && invalidWin32Path(p)) {
1614
+ const errInval = new Error(p + " contains invalid WIN32 path characters.");
1615
+ errInval.code = "EINVAL";
1616
+ return callback(errInval);
1617
+ }
1618
+ let mode = opts.mode;
1619
+ const xfs = opts.fs || fs4;
1620
+ if (mode === void 0) {
1621
+ mode = o777 & ~process.umask();
1622
+ }
1623
+ if (!made)
1624
+ made = null;
1625
+ callback = callback || function() {
1626
+ };
1627
+ p = path4.resolve(p);
1628
+ xfs.mkdir(p, mode, (er) => {
1629
+ if (!er) {
1630
+ made = made || p;
1631
+ return callback(null, made);
1632
+ }
1633
+ switch (er.code) {
1634
+ case "ENOENT":
1635
+ if (path4.dirname(p) === p)
1636
+ return callback(er);
1637
+ mkdirs(path4.dirname(p), opts, (er2, made2) => {
1638
+ if (er2)
1639
+ callback(er2, made2);
1640
+ else
1641
+ mkdirs(p, opts, callback, made2);
1642
+ });
1643
+ break;
1644
+ default:
1645
+ xfs.stat(p, (er2, stat) => {
1646
+ if (er2 || !stat.isDirectory())
1647
+ callback(er, made);
1648
+ else
1649
+ callback(null, made);
1650
+ });
1651
+ break;
1652
+ }
1653
+ });
1654
+ }
1655
+ module22.exports = mkdirs;
1656
+ }
1657
+ });
1658
+ var require_mkdirs_sync = __commonJS2({
1659
+ "../../node_modules/.pnpm/fs-extra@8.1.0/node_modules/fs-extra/lib/mkdirs/mkdirs-sync.js"(exports2, module22) {
1660
+ "use strict";
1661
+ init_cjs_shims();
1662
+ var fs4 = require_graceful_fs();
1663
+ var path4 = require("path");
1664
+ var invalidWin32Path = require_win32().invalidWin32Path;
1665
+ var o777 = parseInt("0777", 8);
1666
+ function mkdirsSync(p, opts, made) {
1667
+ if (!opts || typeof opts !== "object") {
1668
+ opts = { mode: opts };
1669
+ }
1670
+ let mode = opts.mode;
1671
+ const xfs = opts.fs || fs4;
1672
+ if (process.platform === "win32" && invalidWin32Path(p)) {
1673
+ const errInval = new Error(p + " contains invalid WIN32 path characters.");
1674
+ errInval.code = "EINVAL";
1675
+ throw errInval;
1676
+ }
1677
+ if (mode === void 0) {
1678
+ mode = o777 & ~process.umask();
1679
+ }
1680
+ if (!made)
1681
+ made = null;
1682
+ p = path4.resolve(p);
1683
+ try {
1684
+ xfs.mkdirSync(p, mode);
1685
+ made = made || p;
1686
+ } catch (err0) {
1687
+ if (err0.code === "ENOENT") {
1688
+ if (path4.dirname(p) === p)
1689
+ throw err0;
1690
+ made = mkdirsSync(path4.dirname(p), opts, made);
1691
+ mkdirsSync(p, opts, made);
1692
+ } else {
1693
+ let stat;
1694
+ try {
1695
+ stat = xfs.statSync(p);
1696
+ } catch (err1) {
1697
+ throw err0;
1698
+ }
1699
+ if (!stat.isDirectory())
1700
+ throw err0;
1701
+ }
1702
+ }
1703
+ return made;
1704
+ }
1705
+ module22.exports = mkdirsSync;
1706
+ }
1707
+ });
1708
+ var require_mkdirs2 = __commonJS2({
1709
+ "../../node_modules/.pnpm/fs-extra@8.1.0/node_modules/fs-extra/lib/mkdirs/index.js"(exports2, module22) {
1710
+ "use strict";
1711
+ init_cjs_shims();
1712
+ var u = require_universalify().fromCallback;
1713
+ var mkdirs = u(require_mkdirs());
1714
+ var mkdirsSync = require_mkdirs_sync();
1715
+ module22.exports = {
1716
+ mkdirs,
1717
+ mkdirsSync,
1718
+ mkdirp: mkdirs,
1719
+ mkdirpSync: mkdirsSync,
1720
+ ensureDir: mkdirs,
1721
+ ensureDirSync: mkdirsSync
1722
+ };
1723
+ }
1724
+ });
1725
+ var require_utimes = __commonJS2({
1726
+ "../../node_modules/.pnpm/fs-extra@8.1.0/node_modules/fs-extra/lib/util/utimes.js"(exports2, module22) {
1727
+ "use strict";
1728
+ init_cjs_shims();
1729
+ var fs4 = require_graceful_fs();
1730
+ var os = require("os");
1731
+ var path4 = require("path");
1732
+ function hasMillisResSync() {
1733
+ let tmpfile = path4.join("millis-test-sync" + Date.now().toString() + Math.random().toString().slice(2));
1734
+ tmpfile = path4.join(os.tmpdir(), tmpfile);
1735
+ const d = new Date(1435410243862);
1736
+ fs4.writeFileSync(tmpfile, "https://github.com/jprichardson/node-fs-extra/pull/141");
1737
+ const fd = fs4.openSync(tmpfile, "r+");
1738
+ fs4.futimesSync(fd, d, d);
1739
+ fs4.closeSync(fd);
1740
+ return fs4.statSync(tmpfile).mtime > 1435410243e3;
1741
+ }
1742
+ function hasMillisRes(callback) {
1743
+ let tmpfile = path4.join("millis-test" + Date.now().toString() + Math.random().toString().slice(2));
1744
+ tmpfile = path4.join(os.tmpdir(), tmpfile);
1745
+ const d = new Date(1435410243862);
1746
+ fs4.writeFile(tmpfile, "https://github.com/jprichardson/node-fs-extra/pull/141", (err) => {
1747
+ if (err)
1748
+ return callback(err);
1749
+ fs4.open(tmpfile, "r+", (err2, fd) => {
1750
+ if (err2)
1751
+ return callback(err2);
1752
+ fs4.futimes(fd, d, d, (err3) => {
1753
+ if (err3)
1754
+ return callback(err3);
1755
+ fs4.close(fd, (err4) => {
1756
+ if (err4)
1757
+ return callback(err4);
1758
+ fs4.stat(tmpfile, (err5, stats) => {
1759
+ if (err5)
1760
+ return callback(err5);
1761
+ callback(null, stats.mtime > 1435410243e3);
1762
+ });
1763
+ });
1764
+ });
1765
+ });
1766
+ });
1767
+ }
1768
+ function timeRemoveMillis(timestamp) {
1769
+ if (typeof timestamp === "number") {
1770
+ return Math.floor(timestamp / 1e3) * 1e3;
1771
+ } else if (timestamp instanceof Date) {
1772
+ return new Date(Math.floor(timestamp.getTime() / 1e3) * 1e3);
1773
+ } else {
1774
+ throw new Error("fs-extra: timeRemoveMillis() unknown parameter type");
1775
+ }
1776
+ }
1777
+ function utimesMillis(path5, atime, mtime, callback) {
1778
+ fs4.open(path5, "r+", (err, fd) => {
1779
+ if (err)
1780
+ return callback(err);
1781
+ fs4.futimes(fd, atime, mtime, (futimesErr) => {
1782
+ fs4.close(fd, (closeErr) => {
1783
+ if (callback)
1784
+ callback(futimesErr || closeErr);
1785
+ });
1786
+ });
1787
+ });
1788
+ }
1789
+ function utimesMillisSync(path5, atime, mtime) {
1790
+ const fd = fs4.openSync(path5, "r+");
1791
+ fs4.futimesSync(fd, atime, mtime);
1792
+ return fs4.closeSync(fd);
1793
+ }
1794
+ module22.exports = {
1795
+ hasMillisRes,
1796
+ hasMillisResSync,
1797
+ timeRemoveMillis,
1798
+ utimesMillis,
1799
+ utimesMillisSync
1800
+ };
1801
+ }
1802
+ });
1803
+ var require_stat = __commonJS2({
1804
+ "../../node_modules/.pnpm/fs-extra@8.1.0/node_modules/fs-extra/lib/util/stat.js"(exports2, module22) {
1805
+ "use strict";
1806
+ init_cjs_shims();
1807
+ var fs4 = require_graceful_fs();
1808
+ var path4 = require("path");
1809
+ var NODE_VERSION_MAJOR_WITH_BIGINT = 10;
1810
+ var NODE_VERSION_MINOR_WITH_BIGINT = 5;
1811
+ var NODE_VERSION_PATCH_WITH_BIGINT = 0;
1812
+ var nodeVersion = process.versions.node.split(".");
1813
+ var nodeVersionMajor = Number.parseInt(nodeVersion[0], 10);
1814
+ var nodeVersionMinor = Number.parseInt(nodeVersion[1], 10);
1815
+ var nodeVersionPatch = Number.parseInt(nodeVersion[2], 10);
1816
+ function nodeSupportsBigInt() {
1817
+ if (nodeVersionMajor > NODE_VERSION_MAJOR_WITH_BIGINT) {
1818
+ return true;
1819
+ } else if (nodeVersionMajor === NODE_VERSION_MAJOR_WITH_BIGINT) {
1820
+ if (nodeVersionMinor > NODE_VERSION_MINOR_WITH_BIGINT) {
1821
+ return true;
1822
+ } else if (nodeVersionMinor === NODE_VERSION_MINOR_WITH_BIGINT) {
1823
+ if (nodeVersionPatch >= NODE_VERSION_PATCH_WITH_BIGINT) {
1824
+ return true;
1825
+ }
1826
+ }
1827
+ }
1828
+ return false;
1829
+ }
1830
+ function getStats(src, dest, cb) {
1831
+ if (nodeSupportsBigInt()) {
1832
+ fs4.stat(src, { bigint: true }, (err, srcStat) => {
1833
+ if (err)
1834
+ return cb(err);
1835
+ fs4.stat(dest, { bigint: true }, (err2, destStat) => {
1836
+ if (err2) {
1837
+ if (err2.code === "ENOENT")
1838
+ return cb(null, { srcStat, destStat: null });
1839
+ return cb(err2);
1840
+ }
1841
+ return cb(null, { srcStat, destStat });
1842
+ });
1843
+ });
1844
+ } else {
1845
+ fs4.stat(src, (err, srcStat) => {
1846
+ if (err)
1847
+ return cb(err);
1848
+ fs4.stat(dest, (err2, destStat) => {
1849
+ if (err2) {
1850
+ if (err2.code === "ENOENT")
1851
+ return cb(null, { srcStat, destStat: null });
1852
+ return cb(err2);
1853
+ }
1854
+ return cb(null, { srcStat, destStat });
1855
+ });
1856
+ });
1857
+ }
1858
+ }
1859
+ function getStatsSync(src, dest) {
1860
+ let srcStat, destStat;
1861
+ if (nodeSupportsBigInt()) {
1862
+ srcStat = fs4.statSync(src, { bigint: true });
1863
+ } else {
1864
+ srcStat = fs4.statSync(src);
1865
+ }
1866
+ try {
1867
+ if (nodeSupportsBigInt()) {
1868
+ destStat = fs4.statSync(dest, { bigint: true });
1869
+ } else {
1870
+ destStat = fs4.statSync(dest);
1871
+ }
1872
+ } catch (err) {
1873
+ if (err.code === "ENOENT")
1874
+ return { srcStat, destStat: null };
1875
+ throw err;
1876
+ }
1877
+ return { srcStat, destStat };
1878
+ }
1879
+ function checkPaths(src, dest, funcName, cb) {
1880
+ getStats(src, dest, (err, stats) => {
1881
+ if (err)
1882
+ return cb(err);
1883
+ const { srcStat, destStat } = stats;
1884
+ if (destStat && destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev) {
1885
+ return cb(new Error("Source and destination must not be the same."));
1886
+ }
1887
+ if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
1888
+ return cb(new Error(errMsg(src, dest, funcName)));
1889
+ }
1890
+ return cb(null, { srcStat, destStat });
1891
+ });
1892
+ }
1893
+ function checkPathsSync(src, dest, funcName) {
1894
+ const { srcStat, destStat } = getStatsSync(src, dest);
1895
+ if (destStat && destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev) {
1896
+ throw new Error("Source and destination must not be the same.");
1897
+ }
1898
+ if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
1899
+ throw new Error(errMsg(src, dest, funcName));
1900
+ }
1901
+ return { srcStat, destStat };
1902
+ }
1903
+ function checkParentPaths(src, srcStat, dest, funcName, cb) {
1904
+ const srcParent = path4.resolve(path4.dirname(src));
1905
+ const destParent = path4.resolve(path4.dirname(dest));
1906
+ if (destParent === srcParent || destParent === path4.parse(destParent).root)
1907
+ return cb();
1908
+ if (nodeSupportsBigInt()) {
1909
+ fs4.stat(destParent, { bigint: true }, (err, destStat) => {
1910
+ if (err) {
1911
+ if (err.code === "ENOENT")
1912
+ return cb();
1913
+ return cb(err);
1914
+ }
1915
+ if (destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev) {
1916
+ return cb(new Error(errMsg(src, dest, funcName)));
1917
+ }
1918
+ return checkParentPaths(src, srcStat, destParent, funcName, cb);
1919
+ });
1920
+ } else {
1921
+ fs4.stat(destParent, (err, destStat) => {
1922
+ if (err) {
1923
+ if (err.code === "ENOENT")
1924
+ return cb();
1925
+ return cb(err);
1926
+ }
1927
+ if (destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev) {
1928
+ return cb(new Error(errMsg(src, dest, funcName)));
1929
+ }
1930
+ return checkParentPaths(src, srcStat, destParent, funcName, cb);
1931
+ });
1932
+ }
1933
+ }
1934
+ function checkParentPathsSync(src, srcStat, dest, funcName) {
1935
+ const srcParent = path4.resolve(path4.dirname(src));
1936
+ const destParent = path4.resolve(path4.dirname(dest));
1937
+ if (destParent === srcParent || destParent === path4.parse(destParent).root)
1938
+ return;
1939
+ let destStat;
1940
+ try {
1941
+ if (nodeSupportsBigInt()) {
1942
+ destStat = fs4.statSync(destParent, { bigint: true });
1943
+ } else {
1944
+ destStat = fs4.statSync(destParent);
1945
+ }
1946
+ } catch (err) {
1947
+ if (err.code === "ENOENT")
1948
+ return;
1949
+ throw err;
1950
+ }
1951
+ if (destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev) {
1952
+ throw new Error(errMsg(src, dest, funcName));
1953
+ }
1954
+ return checkParentPathsSync(src, srcStat, destParent, funcName);
1955
+ }
1956
+ function isSrcSubdir(src, dest) {
1957
+ const srcArr = path4.resolve(src).split(path4.sep).filter((i) => i);
1958
+ const destArr = path4.resolve(dest).split(path4.sep).filter((i) => i);
1959
+ return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true);
1960
+ }
1961
+ function errMsg(src, dest, funcName) {
1962
+ return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`;
1963
+ }
1964
+ module22.exports = {
1965
+ checkPaths,
1966
+ checkPathsSync,
1967
+ checkParentPaths,
1968
+ checkParentPathsSync,
1969
+ isSrcSubdir
1970
+ };
1971
+ }
1972
+ });
1973
+ var require_buffer = __commonJS2({
1974
+ "../../node_modules/.pnpm/fs-extra@8.1.0/node_modules/fs-extra/lib/util/buffer.js"(exports2, module22) {
1975
+ "use strict";
1976
+ init_cjs_shims();
1977
+ module22.exports = function(size) {
1978
+ if (typeof Buffer.allocUnsafe === "function") {
1979
+ try {
1980
+ return Buffer.allocUnsafe(size);
1981
+ } catch (e) {
1982
+ return new Buffer(size);
1983
+ }
1984
+ }
1985
+ return new Buffer(size);
1986
+ };
1987
+ }
1988
+ });
1989
+ var require_copy_sync = __commonJS2({
1990
+ "../../node_modules/.pnpm/fs-extra@8.1.0/node_modules/fs-extra/lib/copy-sync/copy-sync.js"(exports2, module22) {
1991
+ "use strict";
1992
+ init_cjs_shims();
1993
+ var fs4 = require_graceful_fs();
1994
+ var path4 = require("path");
1995
+ var mkdirpSync = require_mkdirs2().mkdirsSync;
1996
+ var utimesSync = require_utimes().utimesMillisSync;
1997
+ var stat = require_stat();
1998
+ function copySync(src, dest, opts) {
1999
+ if (typeof opts === "function") {
2000
+ opts = { filter: opts };
2001
+ }
2002
+ opts = opts || {};
2003
+ opts.clobber = "clobber" in opts ? !!opts.clobber : true;
2004
+ opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber;
2005
+ if (opts.preserveTimestamps && process.arch === "ia32") {
2006
+ console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;
2007
+
2008
+ see https://github.com/jprichardson/node-fs-extra/issues/269`);
2009
+ }
2010
+ const { srcStat, destStat } = stat.checkPathsSync(src, dest, "copy");
2011
+ stat.checkParentPathsSync(src, srcStat, dest, "copy");
2012
+ return handleFilterAndCopy(destStat, src, dest, opts);
2013
+ }
2014
+ function handleFilterAndCopy(destStat, src, dest, opts) {
2015
+ if (opts.filter && !opts.filter(src, dest))
2016
+ return;
2017
+ const destParent = path4.dirname(dest);
2018
+ if (!fs4.existsSync(destParent))
2019
+ mkdirpSync(destParent);
2020
+ return startCopy(destStat, src, dest, opts);
2021
+ }
2022
+ function startCopy(destStat, src, dest, opts) {
2023
+ if (opts.filter && !opts.filter(src, dest))
2024
+ return;
2025
+ return getStats(destStat, src, dest, opts);
2026
+ }
2027
+ function getStats(destStat, src, dest, opts) {
2028
+ const statSync = opts.dereference ? fs4.statSync : fs4.lstatSync;
2029
+ const srcStat = statSync(src);
2030
+ if (srcStat.isDirectory())
2031
+ return onDir(srcStat, destStat, src, dest, opts);
2032
+ else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice())
2033
+ return onFile(srcStat, destStat, src, dest, opts);
2034
+ else if (srcStat.isSymbolicLink())
2035
+ return onLink(destStat, src, dest, opts);
2036
+ }
2037
+ function onFile(srcStat, destStat, src, dest, opts) {
2038
+ if (!destStat)
2039
+ return copyFile(srcStat, src, dest, opts);
2040
+ return mayCopyFile(srcStat, src, dest, opts);
2041
+ }
2042
+ function mayCopyFile(srcStat, src, dest, opts) {
2043
+ if (opts.overwrite) {
2044
+ fs4.unlinkSync(dest);
2045
+ return copyFile(srcStat, src, dest, opts);
2046
+ } else if (opts.errorOnExist) {
2047
+ throw new Error(`'${dest}' already exists`);
2048
+ }
2049
+ }
2050
+ function copyFile(srcStat, src, dest, opts) {
2051
+ if (typeof fs4.copyFileSync === "function") {
2052
+ fs4.copyFileSync(src, dest);
2053
+ fs4.chmodSync(dest, srcStat.mode);
2054
+ if (opts.preserveTimestamps) {
2055
+ return utimesSync(dest, srcStat.atime, srcStat.mtime);
2056
+ }
2057
+ return;
2058
+ }
2059
+ return copyFileFallback(srcStat, src, dest, opts);
2060
+ }
2061
+ function copyFileFallback(srcStat, src, dest, opts) {
2062
+ const BUF_LENGTH = 64 * 1024;
2063
+ const _buff = require_buffer()(BUF_LENGTH);
2064
+ const fdr = fs4.openSync(src, "r");
2065
+ const fdw = fs4.openSync(dest, "w", srcStat.mode);
2066
+ let pos = 0;
2067
+ while (pos < srcStat.size) {
2068
+ const bytesRead = fs4.readSync(fdr, _buff, 0, BUF_LENGTH, pos);
2069
+ fs4.writeSync(fdw, _buff, 0, bytesRead);
2070
+ pos += bytesRead;
2071
+ }
2072
+ if (opts.preserveTimestamps)
2073
+ fs4.futimesSync(fdw, srcStat.atime, srcStat.mtime);
2074
+ fs4.closeSync(fdr);
2075
+ fs4.closeSync(fdw);
2076
+ }
2077
+ function onDir(srcStat, destStat, src, dest, opts) {
2078
+ if (!destStat)
2079
+ return mkDirAndCopy(srcStat, src, dest, opts);
2080
+ if (destStat && !destStat.isDirectory()) {
2081
+ throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`);
2082
+ }
2083
+ return copyDir(src, dest, opts);
2084
+ }
2085
+ function mkDirAndCopy(srcStat, src, dest, opts) {
2086
+ fs4.mkdirSync(dest);
2087
+ copyDir(src, dest, opts);
2088
+ return fs4.chmodSync(dest, srcStat.mode);
2089
+ }
2090
+ function copyDir(src, dest, opts) {
2091
+ fs4.readdirSync(src).forEach((item) => copyDirItem(item, src, dest, opts));
2092
+ }
2093
+ function copyDirItem(item, src, dest, opts) {
2094
+ const srcItem = path4.join(src, item);
2095
+ const destItem = path4.join(dest, item);
2096
+ const { destStat } = stat.checkPathsSync(srcItem, destItem, "copy");
2097
+ return startCopy(destStat, srcItem, destItem, opts);
2098
+ }
2099
+ function onLink(destStat, src, dest, opts) {
2100
+ let resolvedSrc = fs4.readlinkSync(src);
2101
+ if (opts.dereference) {
2102
+ resolvedSrc = path4.resolve(process.cwd(), resolvedSrc);
2103
+ }
2104
+ if (!destStat) {
2105
+ return fs4.symlinkSync(resolvedSrc, dest);
2106
+ } else {
2107
+ let resolvedDest;
2108
+ try {
2109
+ resolvedDest = fs4.readlinkSync(dest);
2110
+ } catch (err) {
2111
+ if (err.code === "EINVAL" || err.code === "UNKNOWN")
2112
+ return fs4.symlinkSync(resolvedSrc, dest);
2113
+ throw err;
2114
+ }
2115
+ if (opts.dereference) {
2116
+ resolvedDest = path4.resolve(process.cwd(), resolvedDest);
2117
+ }
2118
+ if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
2119
+ throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`);
2120
+ }
2121
+ if (fs4.statSync(dest).isDirectory() && stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
2122
+ throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`);
2123
+ }
2124
+ return copyLink(resolvedSrc, dest);
2125
+ }
2126
+ }
2127
+ function copyLink(resolvedSrc, dest) {
2128
+ fs4.unlinkSync(dest);
2129
+ return fs4.symlinkSync(resolvedSrc, dest);
2130
+ }
2131
+ module22.exports = copySync;
2132
+ }
2133
+ });
2134
+ var require_copy_sync2 = __commonJS2({
2135
+ "../../node_modules/.pnpm/fs-extra@8.1.0/node_modules/fs-extra/lib/copy-sync/index.js"(exports2, module22) {
2136
+ "use strict";
2137
+ init_cjs_shims();
2138
+ module22.exports = {
2139
+ copySync: require_copy_sync()
2140
+ };
2141
+ }
2142
+ });
2143
+ var require_path_exists2 = __commonJS2({
2144
+ "../../node_modules/.pnpm/fs-extra@8.1.0/node_modules/fs-extra/lib/path-exists/index.js"(exports2, module22) {
2145
+ "use strict";
2146
+ init_cjs_shims();
2147
+ var u = require_universalify().fromPromise;
2148
+ var fs4 = require_fs();
2149
+ function pathExists(path4) {
2150
+ return fs4.access(path4).then(() => true).catch(() => false);
2151
+ }
2152
+ module22.exports = {
2153
+ pathExists: u(pathExists),
2154
+ pathExistsSync: fs4.existsSync
2155
+ };
2156
+ }
2157
+ });
2158
+ var require_copy = __commonJS2({
2159
+ "../../node_modules/.pnpm/fs-extra@8.1.0/node_modules/fs-extra/lib/copy/copy.js"(exports2, module22) {
2160
+ "use strict";
2161
+ init_cjs_shims();
2162
+ var fs4 = require_graceful_fs();
2163
+ var path4 = require("path");
2164
+ var mkdirp = require_mkdirs2().mkdirs;
2165
+ var pathExists = require_path_exists2().pathExists;
2166
+ var utimes = require_utimes().utimesMillis;
2167
+ var stat = require_stat();
2168
+ function copy(src, dest, opts, cb) {
2169
+ if (typeof opts === "function" && !cb) {
2170
+ cb = opts;
2171
+ opts = {};
2172
+ } else if (typeof opts === "function") {
2173
+ opts = { filter: opts };
2174
+ }
2175
+ cb = cb || function() {
2176
+ };
2177
+ opts = opts || {};
2178
+ opts.clobber = "clobber" in opts ? !!opts.clobber : true;
2179
+ opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber;
2180
+ if (opts.preserveTimestamps && process.arch === "ia32") {
2181
+ console.warn(`fs-extra: Using the preserveTimestamps option in 32-bit node is not recommended;
2182
+
2183
+ see https://github.com/jprichardson/node-fs-extra/issues/269`);
2184
+ }
2185
+ stat.checkPaths(src, dest, "copy", (err, stats) => {
2186
+ if (err)
2187
+ return cb(err);
2188
+ const { srcStat, destStat } = stats;
2189
+ stat.checkParentPaths(src, srcStat, dest, "copy", (err2) => {
2190
+ if (err2)
2191
+ return cb(err2);
2192
+ if (opts.filter)
2193
+ return handleFilter(checkParentDir, destStat, src, dest, opts, cb);
2194
+ return checkParentDir(destStat, src, dest, opts, cb);
2195
+ });
2196
+ });
2197
+ }
2198
+ function checkParentDir(destStat, src, dest, opts, cb) {
2199
+ const destParent = path4.dirname(dest);
2200
+ pathExists(destParent, (err, dirExists) => {
2201
+ if (err)
2202
+ return cb(err);
2203
+ if (dirExists)
2204
+ return startCopy(destStat, src, dest, opts, cb);
2205
+ mkdirp(destParent, (err2) => {
2206
+ if (err2)
2207
+ return cb(err2);
2208
+ return startCopy(destStat, src, dest, opts, cb);
2209
+ });
2210
+ });
2211
+ }
2212
+ function handleFilter(onInclude, destStat, src, dest, opts, cb) {
2213
+ Promise.resolve(opts.filter(src, dest)).then((include) => {
2214
+ if (include)
2215
+ return onInclude(destStat, src, dest, opts, cb);
2216
+ return cb();
2217
+ }, (error) => cb(error));
2218
+ }
2219
+ function startCopy(destStat, src, dest, opts, cb) {
2220
+ if (opts.filter)
2221
+ return handleFilter(getStats, destStat, src, dest, opts, cb);
2222
+ return getStats(destStat, src, dest, opts, cb);
2223
+ }
2224
+ function getStats(destStat, src, dest, opts, cb) {
2225
+ const stat2 = opts.dereference ? fs4.stat : fs4.lstat;
2226
+ stat2(src, (err, srcStat) => {
2227
+ if (err)
2228
+ return cb(err);
2229
+ if (srcStat.isDirectory())
2230
+ return onDir(srcStat, destStat, src, dest, opts, cb);
2231
+ else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice())
2232
+ return onFile(srcStat, destStat, src, dest, opts, cb);
2233
+ else if (srcStat.isSymbolicLink())
2234
+ return onLink(destStat, src, dest, opts, cb);
2235
+ });
2236
+ }
2237
+ function onFile(srcStat, destStat, src, dest, opts, cb) {
2238
+ if (!destStat)
2239
+ return copyFile(srcStat, src, dest, opts, cb);
2240
+ return mayCopyFile(srcStat, src, dest, opts, cb);
2241
+ }
2242
+ function mayCopyFile(srcStat, src, dest, opts, cb) {
2243
+ if (opts.overwrite) {
2244
+ fs4.unlink(dest, (err) => {
2245
+ if (err)
2246
+ return cb(err);
2247
+ return copyFile(srcStat, src, dest, opts, cb);
2248
+ });
2249
+ } else if (opts.errorOnExist) {
2250
+ return cb(new Error(`'${dest}' already exists`));
2251
+ } else
2252
+ return cb();
2253
+ }
2254
+ function copyFile(srcStat, src, dest, opts, cb) {
2255
+ if (typeof fs4.copyFile === "function") {
2256
+ return fs4.copyFile(src, dest, (err) => {
2257
+ if (err)
2258
+ return cb(err);
2259
+ return setDestModeAndTimestamps(srcStat, dest, opts, cb);
2260
+ });
2261
+ }
2262
+ return copyFileFallback(srcStat, src, dest, opts, cb);
2263
+ }
2264
+ function copyFileFallback(srcStat, src, dest, opts, cb) {
2265
+ const rs = fs4.createReadStream(src);
2266
+ rs.on("error", (err) => cb(err)).once("open", () => {
2267
+ const ws = fs4.createWriteStream(dest, { mode: srcStat.mode });
2268
+ ws.on("error", (err) => cb(err)).on("open", () => rs.pipe(ws)).once("close", () => setDestModeAndTimestamps(srcStat, dest, opts, cb));
2269
+ });
2270
+ }
2271
+ function setDestModeAndTimestamps(srcStat, dest, opts, cb) {
2272
+ fs4.chmod(dest, srcStat.mode, (err) => {
2273
+ if (err)
2274
+ return cb(err);
2275
+ if (opts.preserveTimestamps) {
2276
+ return utimes(dest, srcStat.atime, srcStat.mtime, cb);
2277
+ }
2278
+ return cb();
2279
+ });
2280
+ }
2281
+ function onDir(srcStat, destStat, src, dest, opts, cb) {
2282
+ if (!destStat)
2283
+ return mkDirAndCopy(srcStat, src, dest, opts, cb);
2284
+ if (destStat && !destStat.isDirectory()) {
2285
+ return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`));
2286
+ }
2287
+ return copyDir(src, dest, opts, cb);
2288
+ }
2289
+ function mkDirAndCopy(srcStat, src, dest, opts, cb) {
2290
+ fs4.mkdir(dest, (err) => {
2291
+ if (err)
2292
+ return cb(err);
2293
+ copyDir(src, dest, opts, (err2) => {
2294
+ if (err2)
2295
+ return cb(err2);
2296
+ return fs4.chmod(dest, srcStat.mode, cb);
2297
+ });
2298
+ });
2299
+ }
2300
+ function copyDir(src, dest, opts, cb) {
2301
+ fs4.readdir(src, (err, items) => {
2302
+ if (err)
2303
+ return cb(err);
2304
+ return copyDirItems(items, src, dest, opts, cb);
2305
+ });
2306
+ }
2307
+ function copyDirItems(items, src, dest, opts, cb) {
2308
+ const item = items.pop();
2309
+ if (!item)
2310
+ return cb();
2311
+ return copyDirItem(items, item, src, dest, opts, cb);
2312
+ }
2313
+ function copyDirItem(items, item, src, dest, opts, cb) {
2314
+ const srcItem = path4.join(src, item);
2315
+ const destItem = path4.join(dest, item);
2316
+ stat.checkPaths(srcItem, destItem, "copy", (err, stats) => {
2317
+ if (err)
2318
+ return cb(err);
2319
+ const { destStat } = stats;
2320
+ startCopy(destStat, srcItem, destItem, opts, (err2) => {
2321
+ if (err2)
2322
+ return cb(err2);
2323
+ return copyDirItems(items, src, dest, opts, cb);
2324
+ });
2325
+ });
2326
+ }
2327
+ function onLink(destStat, src, dest, opts, cb) {
2328
+ fs4.readlink(src, (err, resolvedSrc) => {
2329
+ if (err)
2330
+ return cb(err);
2331
+ if (opts.dereference) {
2332
+ resolvedSrc = path4.resolve(process.cwd(), resolvedSrc);
2333
+ }
2334
+ if (!destStat) {
2335
+ return fs4.symlink(resolvedSrc, dest, cb);
2336
+ } else {
2337
+ fs4.readlink(dest, (err2, resolvedDest) => {
2338
+ if (err2) {
2339
+ if (err2.code === "EINVAL" || err2.code === "UNKNOWN")
2340
+ return fs4.symlink(resolvedSrc, dest, cb);
2341
+ return cb(err2);
2342
+ }
2343
+ if (opts.dereference) {
2344
+ resolvedDest = path4.resolve(process.cwd(), resolvedDest);
2345
+ }
2346
+ if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
2347
+ return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`));
2348
+ }
2349
+ if (destStat.isDirectory() && stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
2350
+ return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`));
2351
+ }
2352
+ return copyLink(resolvedSrc, dest, cb);
2353
+ });
2354
+ }
2355
+ });
2356
+ }
2357
+ function copyLink(resolvedSrc, dest, cb) {
2358
+ fs4.unlink(dest, (err) => {
2359
+ if (err)
2360
+ return cb(err);
2361
+ return fs4.symlink(resolvedSrc, dest, cb);
2362
+ });
2363
+ }
2364
+ module22.exports = copy;
2365
+ }
2366
+ });
2367
+ var require_copy2 = __commonJS2({
2368
+ "../../node_modules/.pnpm/fs-extra@8.1.0/node_modules/fs-extra/lib/copy/index.js"(exports2, module22) {
2369
+ "use strict";
2370
+ init_cjs_shims();
2371
+ var u = require_universalify().fromCallback;
2372
+ module22.exports = {
2373
+ copy: u(require_copy())
2374
+ };
2375
+ }
2376
+ });
2377
+ var require_rimraf = __commonJS2({
2378
+ "../../node_modules/.pnpm/fs-extra@8.1.0/node_modules/fs-extra/lib/remove/rimraf.js"(exports2, module22) {
2379
+ "use strict";
2380
+ init_cjs_shims();
2381
+ var fs4 = require_graceful_fs();
2382
+ var path4 = require("path");
2383
+ var assert = require("assert");
2384
+ var isWindows = process.platform === "win32";
2385
+ function defaults(options) {
2386
+ const methods = [
2387
+ "unlink",
2388
+ "chmod",
2389
+ "stat",
2390
+ "lstat",
2391
+ "rmdir",
2392
+ "readdir"
2393
+ ];
2394
+ methods.forEach((m) => {
2395
+ options[m] = options[m] || fs4[m];
2396
+ m = m + "Sync";
2397
+ options[m] = options[m] || fs4[m];
2398
+ });
2399
+ options.maxBusyTries = options.maxBusyTries || 3;
2400
+ }
2401
+ function rimraf(p, options, cb) {
2402
+ let busyTries = 0;
2403
+ if (typeof options === "function") {
2404
+ cb = options;
2405
+ options = {};
2406
+ }
2407
+ assert(p, "rimraf: missing path");
2408
+ assert.strictEqual(typeof p, "string", "rimraf: path should be a string");
2409
+ assert.strictEqual(typeof cb, "function", "rimraf: callback function required");
2410
+ assert(options, "rimraf: invalid options argument provided");
2411
+ assert.strictEqual(typeof options, "object", "rimraf: options should be object");
2412
+ defaults(options);
2413
+ rimraf_(p, options, function CB(er) {
2414
+ if (er) {
2415
+ if ((er.code === "EBUSY" || er.code === "ENOTEMPTY" || er.code === "EPERM") && busyTries < options.maxBusyTries) {
2416
+ busyTries++;
2417
+ const time = busyTries * 100;
2418
+ return setTimeout(() => rimraf_(p, options, CB), time);
2419
+ }
2420
+ if (er.code === "ENOENT")
2421
+ er = null;
2422
+ }
2423
+ cb(er);
2424
+ });
2425
+ }
2426
+ function rimraf_(p, options, cb) {
2427
+ assert(p);
2428
+ assert(options);
2429
+ assert(typeof cb === "function");
2430
+ options.lstat(p, (er, st) => {
2431
+ if (er && er.code === "ENOENT") {
2432
+ return cb(null);
2433
+ }
2434
+ if (er && er.code === "EPERM" && isWindows) {
2435
+ return fixWinEPERM(p, options, er, cb);
2436
+ }
2437
+ if (st && st.isDirectory()) {
2438
+ return rmdir(p, options, er, cb);
2439
+ }
2440
+ options.unlink(p, (er2) => {
2441
+ if (er2) {
2442
+ if (er2.code === "ENOENT") {
2443
+ return cb(null);
2444
+ }
2445
+ if (er2.code === "EPERM") {
2446
+ return isWindows ? fixWinEPERM(p, options, er2, cb) : rmdir(p, options, er2, cb);
2447
+ }
2448
+ if (er2.code === "EISDIR") {
2449
+ return rmdir(p, options, er2, cb);
2450
+ }
2451
+ }
2452
+ return cb(er2);
2453
+ });
2454
+ });
2455
+ }
2456
+ function fixWinEPERM(p, options, er, cb) {
2457
+ assert(p);
2458
+ assert(options);
2459
+ assert(typeof cb === "function");
2460
+ if (er) {
2461
+ assert(er instanceof Error);
2462
+ }
2463
+ options.chmod(p, 438, (er2) => {
2464
+ if (er2) {
2465
+ cb(er2.code === "ENOENT" ? null : er);
2466
+ } else {
2467
+ options.stat(p, (er3, stats) => {
2468
+ if (er3) {
2469
+ cb(er3.code === "ENOENT" ? null : er);
2470
+ } else if (stats.isDirectory()) {
2471
+ rmdir(p, options, er, cb);
2472
+ } else {
2473
+ options.unlink(p, cb);
2474
+ }
2475
+ });
2476
+ }
2477
+ });
2478
+ }
2479
+ function fixWinEPERMSync(p, options, er) {
2480
+ let stats;
2481
+ assert(p);
2482
+ assert(options);
2483
+ if (er) {
2484
+ assert(er instanceof Error);
2485
+ }
2486
+ try {
2487
+ options.chmodSync(p, 438);
2488
+ } catch (er2) {
2489
+ if (er2.code === "ENOENT") {
2490
+ return;
2491
+ } else {
2492
+ throw er;
2493
+ }
2494
+ }
2495
+ try {
2496
+ stats = options.statSync(p);
2497
+ } catch (er3) {
2498
+ if (er3.code === "ENOENT") {
2499
+ return;
2500
+ } else {
2501
+ throw er;
2502
+ }
2503
+ }
2504
+ if (stats.isDirectory()) {
2505
+ rmdirSync(p, options, er);
2506
+ } else {
2507
+ options.unlinkSync(p);
2508
+ }
2509
+ }
2510
+ function rmdir(p, options, originalEr, cb) {
2511
+ assert(p);
2512
+ assert(options);
2513
+ if (originalEr) {
2514
+ assert(originalEr instanceof Error);
2515
+ }
2516
+ assert(typeof cb === "function");
2517
+ options.rmdir(p, (er) => {
2518
+ if (er && (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM")) {
2519
+ rmkids(p, options, cb);
2520
+ } else if (er && er.code === "ENOTDIR") {
2521
+ cb(originalEr);
2522
+ } else {
2523
+ cb(er);
2524
+ }
2525
+ });
2526
+ }
2527
+ function rmkids(p, options, cb) {
2528
+ assert(p);
2529
+ assert(options);
2530
+ assert(typeof cb === "function");
2531
+ options.readdir(p, (er, files) => {
2532
+ if (er)
2533
+ return cb(er);
2534
+ let n = files.length;
2535
+ let errState;
2536
+ if (n === 0)
2537
+ return options.rmdir(p, cb);
2538
+ files.forEach((f) => {
2539
+ rimraf(path4.join(p, f), options, (er2) => {
2540
+ if (errState) {
2541
+ return;
2542
+ }
2543
+ if (er2)
2544
+ return cb(errState = er2);
2545
+ if (--n === 0) {
2546
+ options.rmdir(p, cb);
2547
+ }
2548
+ });
2549
+ });
2550
+ });
2551
+ }
2552
+ function rimrafSync(p, options) {
2553
+ let st;
2554
+ options = options || {};
2555
+ defaults(options);
2556
+ assert(p, "rimraf: missing path");
2557
+ assert.strictEqual(typeof p, "string", "rimraf: path should be a string");
2558
+ assert(options, "rimraf: missing options");
2559
+ assert.strictEqual(typeof options, "object", "rimraf: options should be object");
2560
+ try {
2561
+ st = options.lstatSync(p);
2562
+ } catch (er) {
2563
+ if (er.code === "ENOENT") {
2564
+ return;
2565
+ }
2566
+ if (er.code === "EPERM" && isWindows) {
2567
+ fixWinEPERMSync(p, options, er);
2568
+ }
2569
+ }
2570
+ try {
2571
+ if (st && st.isDirectory()) {
2572
+ rmdirSync(p, options, null);
2573
+ } else {
2574
+ options.unlinkSync(p);
2575
+ }
2576
+ } catch (er) {
2577
+ if (er.code === "ENOENT") {
2578
+ return;
2579
+ } else if (er.code === "EPERM") {
2580
+ return isWindows ? fixWinEPERMSync(p, options, er) : rmdirSync(p, options, er);
2581
+ } else if (er.code !== "EISDIR") {
2582
+ throw er;
2583
+ }
2584
+ rmdirSync(p, options, er);
2585
+ }
2586
+ }
2587
+ function rmdirSync(p, options, originalEr) {
2588
+ assert(p);
2589
+ assert(options);
2590
+ if (originalEr) {
2591
+ assert(originalEr instanceof Error);
2592
+ }
2593
+ try {
2594
+ options.rmdirSync(p);
2595
+ } catch (er) {
2596
+ if (er.code === "ENOTDIR") {
2597
+ throw originalEr;
2598
+ } else if (er.code === "ENOTEMPTY" || er.code === "EEXIST" || er.code === "EPERM") {
2599
+ rmkidsSync(p, options);
2600
+ } else if (er.code !== "ENOENT") {
2601
+ throw er;
2602
+ }
2603
+ }
2604
+ }
2605
+ function rmkidsSync(p, options) {
2606
+ assert(p);
2607
+ assert(options);
2608
+ options.readdirSync(p).forEach((f) => rimrafSync(path4.join(p, f), options));
2609
+ if (isWindows) {
2610
+ const startTime = Date.now();
2611
+ do {
2612
+ try {
2613
+ const ret = options.rmdirSync(p, options);
2614
+ return ret;
2615
+ } catch (er) {
2616
+ }
2617
+ } while (Date.now() - startTime < 500);
2618
+ } else {
2619
+ const ret = options.rmdirSync(p, options);
2620
+ return ret;
2621
+ }
2622
+ }
2623
+ module22.exports = rimraf;
2624
+ rimraf.sync = rimrafSync;
2625
+ }
2626
+ });
2627
+ var require_remove = __commonJS2({
2628
+ "../../node_modules/.pnpm/fs-extra@8.1.0/node_modules/fs-extra/lib/remove/index.js"(exports2, module22) {
2629
+ "use strict";
2630
+ init_cjs_shims();
2631
+ var u = require_universalify().fromCallback;
2632
+ var rimraf = require_rimraf();
2633
+ module22.exports = {
2634
+ remove: u(rimraf),
2635
+ removeSync: rimraf.sync
2636
+ };
2637
+ }
2638
+ });
2639
+ var require_empty = __commonJS2({
2640
+ "../../node_modules/.pnpm/fs-extra@8.1.0/node_modules/fs-extra/lib/empty/index.js"(exports2, module22) {
2641
+ "use strict";
2642
+ init_cjs_shims();
2643
+ var u = require_universalify().fromCallback;
2644
+ var fs4 = require_graceful_fs();
2645
+ var path4 = require("path");
2646
+ var mkdir = require_mkdirs2();
2647
+ var remove = require_remove();
2648
+ var emptyDir = u(function emptyDir2(dir, callback) {
2649
+ callback = callback || function() {
2650
+ };
2651
+ fs4.readdir(dir, (err, items) => {
2652
+ if (err)
2653
+ return mkdir.mkdirs(dir, callback);
2654
+ items = items.map((item) => path4.join(dir, item));
2655
+ deleteItem();
2656
+ function deleteItem() {
2657
+ const item = items.pop();
2658
+ if (!item)
2659
+ return callback();
2660
+ remove.remove(item, (err2) => {
2661
+ if (err2)
2662
+ return callback(err2);
2663
+ deleteItem();
2664
+ });
2665
+ }
2666
+ });
2667
+ });
2668
+ function emptyDirSync(dir) {
2669
+ let items;
2670
+ try {
2671
+ items = fs4.readdirSync(dir);
2672
+ } catch (err) {
2673
+ return mkdir.mkdirsSync(dir);
2674
+ }
2675
+ items.forEach((item) => {
2676
+ item = path4.join(dir, item);
2677
+ remove.removeSync(item);
2678
+ });
2679
+ }
2680
+ module22.exports = {
2681
+ emptyDirSync,
2682
+ emptydirSync: emptyDirSync,
2683
+ emptyDir,
2684
+ emptydir: emptyDir
2685
+ };
2686
+ }
2687
+ });
2688
+ var require_file = __commonJS2({
2689
+ "../../node_modules/.pnpm/fs-extra@8.1.0/node_modules/fs-extra/lib/ensure/file.js"(exports2, module22) {
2690
+ "use strict";
2691
+ init_cjs_shims();
2692
+ var u = require_universalify().fromCallback;
2693
+ var path4 = require("path");
2694
+ var fs4 = require_graceful_fs();
2695
+ var mkdir = require_mkdirs2();
2696
+ var pathExists = require_path_exists2().pathExists;
2697
+ function createFile(file, callback) {
2698
+ function makeFile() {
2699
+ fs4.writeFile(file, "", (err) => {
2700
+ if (err)
2701
+ return callback(err);
2702
+ callback();
2703
+ });
2704
+ }
2705
+ fs4.stat(file, (err, stats) => {
2706
+ if (!err && stats.isFile())
2707
+ return callback();
2708
+ const dir = path4.dirname(file);
2709
+ pathExists(dir, (err2, dirExists) => {
2710
+ if (err2)
2711
+ return callback(err2);
2712
+ if (dirExists)
2713
+ return makeFile();
2714
+ mkdir.mkdirs(dir, (err3) => {
2715
+ if (err3)
2716
+ return callback(err3);
2717
+ makeFile();
2718
+ });
2719
+ });
2720
+ });
2721
+ }
2722
+ function createFileSync(file) {
2723
+ let stats;
2724
+ try {
2725
+ stats = fs4.statSync(file);
2726
+ } catch (e) {
2727
+ }
2728
+ if (stats && stats.isFile())
2729
+ return;
2730
+ const dir = path4.dirname(file);
2731
+ if (!fs4.existsSync(dir)) {
2732
+ mkdir.mkdirsSync(dir);
2733
+ }
2734
+ fs4.writeFileSync(file, "");
2735
+ }
2736
+ module22.exports = {
2737
+ createFile: u(createFile),
2738
+ createFileSync
2739
+ };
2740
+ }
2741
+ });
2742
+ var require_link = __commonJS2({
2743
+ "../../node_modules/.pnpm/fs-extra@8.1.0/node_modules/fs-extra/lib/ensure/link.js"(exports2, module22) {
2744
+ "use strict";
2745
+ init_cjs_shims();
2746
+ var u = require_universalify().fromCallback;
2747
+ var path4 = require("path");
2748
+ var fs4 = require_graceful_fs();
2749
+ var mkdir = require_mkdirs2();
2750
+ var pathExists = require_path_exists2().pathExists;
2751
+ function createLink(srcpath, dstpath, callback) {
2752
+ function makeLink(srcpath2, dstpath2) {
2753
+ fs4.link(srcpath2, dstpath2, (err) => {
2754
+ if (err)
2755
+ return callback(err);
2756
+ callback(null);
2757
+ });
2758
+ }
2759
+ pathExists(dstpath, (err, destinationExists) => {
2760
+ if (err)
2761
+ return callback(err);
2762
+ if (destinationExists)
2763
+ return callback(null);
2764
+ fs4.lstat(srcpath, (err2) => {
2765
+ if (err2) {
2766
+ err2.message = err2.message.replace("lstat", "ensureLink");
2767
+ return callback(err2);
2768
+ }
2769
+ const dir = path4.dirname(dstpath);
2770
+ pathExists(dir, (err3, dirExists) => {
2771
+ if (err3)
2772
+ return callback(err3);
2773
+ if (dirExists)
2774
+ return makeLink(srcpath, dstpath);
2775
+ mkdir.mkdirs(dir, (err4) => {
2776
+ if (err4)
2777
+ return callback(err4);
2778
+ makeLink(srcpath, dstpath);
2779
+ });
2780
+ });
2781
+ });
2782
+ });
2783
+ }
2784
+ function createLinkSync(srcpath, dstpath) {
2785
+ const destinationExists = fs4.existsSync(dstpath);
2786
+ if (destinationExists)
2787
+ return void 0;
2788
+ try {
2789
+ fs4.lstatSync(srcpath);
2790
+ } catch (err) {
2791
+ err.message = err.message.replace("lstat", "ensureLink");
2792
+ throw err;
2793
+ }
2794
+ const dir = path4.dirname(dstpath);
2795
+ const dirExists = fs4.existsSync(dir);
2796
+ if (dirExists)
2797
+ return fs4.linkSync(srcpath, dstpath);
2798
+ mkdir.mkdirsSync(dir);
2799
+ return fs4.linkSync(srcpath, dstpath);
2800
+ }
2801
+ module22.exports = {
2802
+ createLink: u(createLink),
2803
+ createLinkSync
2804
+ };
2805
+ }
2806
+ });
2807
+ var require_symlink_paths = __commonJS2({
2808
+ "../../node_modules/.pnpm/fs-extra@8.1.0/node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports2, module22) {
2809
+ "use strict";
2810
+ init_cjs_shims();
2811
+ var path4 = require("path");
2812
+ var fs4 = require_graceful_fs();
2813
+ var pathExists = require_path_exists2().pathExists;
2814
+ function symlinkPaths(srcpath, dstpath, callback) {
2815
+ if (path4.isAbsolute(srcpath)) {
2816
+ return fs4.lstat(srcpath, (err) => {
2817
+ if (err) {
2818
+ err.message = err.message.replace("lstat", "ensureSymlink");
2819
+ return callback(err);
2820
+ }
2821
+ return callback(null, {
2822
+ "toCwd": srcpath,
2823
+ "toDst": srcpath
2824
+ });
2825
+ });
2826
+ } else {
2827
+ const dstdir = path4.dirname(dstpath);
2828
+ const relativeToDst = path4.join(dstdir, srcpath);
2829
+ return pathExists(relativeToDst, (err, exists) => {
2830
+ if (err)
2831
+ return callback(err);
2832
+ if (exists) {
2833
+ return callback(null, {
2834
+ "toCwd": relativeToDst,
2835
+ "toDst": srcpath
2836
+ });
2837
+ } else {
2838
+ return fs4.lstat(srcpath, (err2) => {
2839
+ if (err2) {
2840
+ err2.message = err2.message.replace("lstat", "ensureSymlink");
2841
+ return callback(err2);
2842
+ }
2843
+ return callback(null, {
2844
+ "toCwd": srcpath,
2845
+ "toDst": path4.relative(dstdir, srcpath)
2846
+ });
2847
+ });
2848
+ }
2849
+ });
2850
+ }
2851
+ }
2852
+ function symlinkPathsSync(srcpath, dstpath) {
2853
+ let exists;
2854
+ if (path4.isAbsolute(srcpath)) {
2855
+ exists = fs4.existsSync(srcpath);
2856
+ if (!exists)
2857
+ throw new Error("absolute srcpath does not exist");
2858
+ return {
2859
+ "toCwd": srcpath,
2860
+ "toDst": srcpath
2861
+ };
2862
+ } else {
2863
+ const dstdir = path4.dirname(dstpath);
2864
+ const relativeToDst = path4.join(dstdir, srcpath);
2865
+ exists = fs4.existsSync(relativeToDst);
2866
+ if (exists) {
2867
+ return {
2868
+ "toCwd": relativeToDst,
2869
+ "toDst": srcpath
2870
+ };
2871
+ } else {
2872
+ exists = fs4.existsSync(srcpath);
2873
+ if (!exists)
2874
+ throw new Error("relative srcpath does not exist");
2875
+ return {
2876
+ "toCwd": srcpath,
2877
+ "toDst": path4.relative(dstdir, srcpath)
2878
+ };
2879
+ }
2880
+ }
2881
+ }
2882
+ module22.exports = {
2883
+ symlinkPaths,
2884
+ symlinkPathsSync
2885
+ };
2886
+ }
2887
+ });
2888
+ var require_symlink_type = __commonJS2({
2889
+ "../../node_modules/.pnpm/fs-extra@8.1.0/node_modules/fs-extra/lib/ensure/symlink-type.js"(exports2, module22) {
2890
+ "use strict";
2891
+ init_cjs_shims();
2892
+ var fs4 = require_graceful_fs();
2893
+ function symlinkType(srcpath, type, callback) {
2894
+ callback = typeof type === "function" ? type : callback;
2895
+ type = typeof type === "function" ? false : type;
2896
+ if (type)
2897
+ return callback(null, type);
2898
+ fs4.lstat(srcpath, (err, stats) => {
2899
+ if (err)
2900
+ return callback(null, "file");
2901
+ type = stats && stats.isDirectory() ? "dir" : "file";
2902
+ callback(null, type);
2903
+ });
2904
+ }
2905
+ function symlinkTypeSync(srcpath, type) {
2906
+ let stats;
2907
+ if (type)
2908
+ return type;
2909
+ try {
2910
+ stats = fs4.lstatSync(srcpath);
2911
+ } catch (e) {
2912
+ return "file";
2913
+ }
2914
+ return stats && stats.isDirectory() ? "dir" : "file";
2915
+ }
2916
+ module22.exports = {
2917
+ symlinkType,
2918
+ symlinkTypeSync
2919
+ };
2920
+ }
2921
+ });
2922
+ var require_symlink = __commonJS2({
2923
+ "../../node_modules/.pnpm/fs-extra@8.1.0/node_modules/fs-extra/lib/ensure/symlink.js"(exports2, module22) {
2924
+ "use strict";
2925
+ init_cjs_shims();
2926
+ var u = require_universalify().fromCallback;
2927
+ var path4 = require("path");
2928
+ var fs4 = require_graceful_fs();
2929
+ var _mkdirs = require_mkdirs2();
2930
+ var mkdirs = _mkdirs.mkdirs;
2931
+ var mkdirsSync = _mkdirs.mkdirsSync;
2932
+ var _symlinkPaths = require_symlink_paths();
2933
+ var symlinkPaths = _symlinkPaths.symlinkPaths;
2934
+ var symlinkPathsSync = _symlinkPaths.symlinkPathsSync;
2935
+ var _symlinkType = require_symlink_type();
2936
+ var symlinkType = _symlinkType.symlinkType;
2937
+ var symlinkTypeSync = _symlinkType.symlinkTypeSync;
2938
+ var pathExists = require_path_exists2().pathExists;
2939
+ function createSymlink(srcpath, dstpath, type, callback) {
2940
+ callback = typeof type === "function" ? type : callback;
2941
+ type = typeof type === "function" ? false : type;
2942
+ pathExists(dstpath, (err, destinationExists) => {
2943
+ if (err)
2944
+ return callback(err);
2945
+ if (destinationExists)
2946
+ return callback(null);
2947
+ symlinkPaths(srcpath, dstpath, (err2, relative) => {
2948
+ if (err2)
2949
+ return callback(err2);
2950
+ srcpath = relative.toDst;
2951
+ symlinkType(relative.toCwd, type, (err3, type2) => {
2952
+ if (err3)
2953
+ return callback(err3);
2954
+ const dir = path4.dirname(dstpath);
2955
+ pathExists(dir, (err4, dirExists) => {
2956
+ if (err4)
2957
+ return callback(err4);
2958
+ if (dirExists)
2959
+ return fs4.symlink(srcpath, dstpath, type2, callback);
2960
+ mkdirs(dir, (err5) => {
2961
+ if (err5)
2962
+ return callback(err5);
2963
+ fs4.symlink(srcpath, dstpath, type2, callback);
2964
+ });
2965
+ });
2966
+ });
2967
+ });
2968
+ });
2969
+ }
2970
+ function createSymlinkSync(srcpath, dstpath, type) {
2971
+ const destinationExists = fs4.existsSync(dstpath);
2972
+ if (destinationExists)
2973
+ return void 0;
2974
+ const relative = symlinkPathsSync(srcpath, dstpath);
2975
+ srcpath = relative.toDst;
2976
+ type = symlinkTypeSync(relative.toCwd, type);
2977
+ const dir = path4.dirname(dstpath);
2978
+ const exists = fs4.existsSync(dir);
2979
+ if (exists)
2980
+ return fs4.symlinkSync(srcpath, dstpath, type);
2981
+ mkdirsSync(dir);
2982
+ return fs4.symlinkSync(srcpath, dstpath, type);
2983
+ }
2984
+ module22.exports = {
2985
+ createSymlink: u(createSymlink),
2986
+ createSymlinkSync
2987
+ };
2988
+ }
2989
+ });
2990
+ var require_ensure = __commonJS2({
2991
+ "../../node_modules/.pnpm/fs-extra@8.1.0/node_modules/fs-extra/lib/ensure/index.js"(exports2, module22) {
2992
+ "use strict";
2993
+ init_cjs_shims();
2994
+ var file = require_file();
2995
+ var link = require_link();
2996
+ var symlink = require_symlink();
2997
+ module22.exports = {
2998
+ createFile: file.createFile,
2999
+ createFileSync: file.createFileSync,
3000
+ ensureFile: file.createFile,
3001
+ ensureFileSync: file.createFileSync,
3002
+ createLink: link.createLink,
3003
+ createLinkSync: link.createLinkSync,
3004
+ ensureLink: link.createLink,
3005
+ ensureLinkSync: link.createLinkSync,
3006
+ createSymlink: symlink.createSymlink,
3007
+ createSymlinkSync: symlink.createSymlinkSync,
3008
+ ensureSymlink: symlink.createSymlink,
3009
+ ensureSymlinkSync: symlink.createSymlinkSync
3010
+ };
3011
+ }
3012
+ });
3013
+ var require_jsonfile = __commonJS2({
3014
+ "../../node_modules/.pnpm/jsonfile@4.0.0/node_modules/jsonfile/index.js"(exports2, module22) {
3015
+ init_cjs_shims();
3016
+ var _fs;
3017
+ try {
3018
+ _fs = require_graceful_fs();
3019
+ } catch (_) {
3020
+ _fs = require("fs");
3021
+ }
3022
+ function readFile(file, options, callback) {
3023
+ if (callback == null) {
3024
+ callback = options;
3025
+ options = {};
3026
+ }
3027
+ if (typeof options === "string") {
3028
+ options = { encoding: options };
3029
+ }
3030
+ options = options || {};
3031
+ var fs4 = options.fs || _fs;
3032
+ var shouldThrow = true;
3033
+ if ("throws" in options) {
3034
+ shouldThrow = options.throws;
3035
+ }
3036
+ fs4.readFile(file, options, function(err, data) {
3037
+ if (err)
3038
+ return callback(err);
3039
+ data = stripBom(data);
3040
+ var obj;
3041
+ try {
3042
+ obj = JSON.parse(data, options ? options.reviver : null);
3043
+ } catch (err2) {
3044
+ if (shouldThrow) {
3045
+ err2.message = file + ": " + err2.message;
3046
+ return callback(err2);
3047
+ } else {
3048
+ return callback(null, null);
3049
+ }
3050
+ }
3051
+ callback(null, obj);
3052
+ });
3053
+ }
3054
+ function readFileSync(file, options) {
3055
+ options = options || {};
3056
+ if (typeof options === "string") {
3057
+ options = { encoding: options };
3058
+ }
3059
+ var fs4 = options.fs || _fs;
3060
+ var shouldThrow = true;
3061
+ if ("throws" in options) {
3062
+ shouldThrow = options.throws;
3063
+ }
3064
+ try {
3065
+ var content = fs4.readFileSync(file, options);
3066
+ content = stripBom(content);
3067
+ return JSON.parse(content, options.reviver);
3068
+ } catch (err) {
3069
+ if (shouldThrow) {
3070
+ err.message = file + ": " + err.message;
3071
+ throw err;
3072
+ } else {
3073
+ return null;
3074
+ }
3075
+ }
3076
+ }
3077
+ function stringify(obj, options) {
3078
+ var spaces;
3079
+ var EOL = "\n";
3080
+ if (typeof options === "object" && options !== null) {
3081
+ if (options.spaces) {
3082
+ spaces = options.spaces;
3083
+ }
3084
+ if (options.EOL) {
3085
+ EOL = options.EOL;
3086
+ }
3087
+ }
3088
+ var str = JSON.stringify(obj, options ? options.replacer : null, spaces);
3089
+ return str.replace(/\n/g, EOL) + EOL;
3090
+ }
3091
+ function writeFile(file, obj, options, callback) {
3092
+ if (callback == null) {
3093
+ callback = options;
3094
+ options = {};
3095
+ }
3096
+ options = options || {};
3097
+ var fs4 = options.fs || _fs;
3098
+ var str = "";
3099
+ try {
3100
+ str = stringify(obj, options);
3101
+ } catch (err) {
3102
+ if (callback)
3103
+ callback(err, null);
3104
+ return;
3105
+ }
3106
+ fs4.writeFile(file, str, options, callback);
3107
+ }
3108
+ function writeFileSync(file, obj, options) {
3109
+ options = options || {};
3110
+ var fs4 = options.fs || _fs;
3111
+ var str = stringify(obj, options);
3112
+ return fs4.writeFileSync(file, str, options);
3113
+ }
3114
+ function stripBom(content) {
3115
+ if (Buffer.isBuffer(content))
3116
+ content = content.toString("utf8");
3117
+ content = content.replace(/^\uFEFF/, "");
3118
+ return content;
3119
+ }
3120
+ var jsonfile = {
3121
+ readFile,
3122
+ readFileSync,
3123
+ writeFile,
3124
+ writeFileSync
3125
+ };
3126
+ module22.exports = jsonfile;
3127
+ }
3128
+ });
3129
+ var require_jsonfile2 = __commonJS2({
3130
+ "../../node_modules/.pnpm/fs-extra@8.1.0/node_modules/fs-extra/lib/json/jsonfile.js"(exports2, module22) {
3131
+ "use strict";
3132
+ init_cjs_shims();
3133
+ var u = require_universalify().fromCallback;
3134
+ var jsonFile = require_jsonfile();
3135
+ module22.exports = {
3136
+ readJson: u(jsonFile.readFile),
3137
+ readJsonSync: jsonFile.readFileSync,
3138
+ writeJson: u(jsonFile.writeFile),
3139
+ writeJsonSync: jsonFile.writeFileSync
3140
+ };
3141
+ }
3142
+ });
3143
+ var require_output_json = __commonJS2({
3144
+ "../../node_modules/.pnpm/fs-extra@8.1.0/node_modules/fs-extra/lib/json/output-json.js"(exports2, module22) {
3145
+ "use strict";
3146
+ init_cjs_shims();
3147
+ var path4 = require("path");
3148
+ var mkdir = require_mkdirs2();
3149
+ var pathExists = require_path_exists2().pathExists;
3150
+ var jsonFile = require_jsonfile2();
3151
+ function outputJson(file, data, options, callback) {
3152
+ if (typeof options === "function") {
3153
+ callback = options;
3154
+ options = {};
3155
+ }
3156
+ const dir = path4.dirname(file);
3157
+ pathExists(dir, (err, itDoes) => {
3158
+ if (err)
3159
+ return callback(err);
3160
+ if (itDoes)
3161
+ return jsonFile.writeJson(file, data, options, callback);
3162
+ mkdir.mkdirs(dir, (err2) => {
3163
+ if (err2)
3164
+ return callback(err2);
3165
+ jsonFile.writeJson(file, data, options, callback);
3166
+ });
3167
+ });
3168
+ }
3169
+ module22.exports = outputJson;
3170
+ }
3171
+ });
3172
+ var require_output_json_sync = __commonJS2({
3173
+ "../../node_modules/.pnpm/fs-extra@8.1.0/node_modules/fs-extra/lib/json/output-json-sync.js"(exports2, module22) {
3174
+ "use strict";
3175
+ init_cjs_shims();
3176
+ var fs4 = require_graceful_fs();
3177
+ var path4 = require("path");
3178
+ var mkdir = require_mkdirs2();
3179
+ var jsonFile = require_jsonfile2();
3180
+ function outputJsonSync(file, data, options) {
3181
+ const dir = path4.dirname(file);
3182
+ if (!fs4.existsSync(dir)) {
3183
+ mkdir.mkdirsSync(dir);
3184
+ }
3185
+ jsonFile.writeJsonSync(file, data, options);
3186
+ }
3187
+ module22.exports = outputJsonSync;
3188
+ }
3189
+ });
3190
+ var require_json = __commonJS2({
3191
+ "../../node_modules/.pnpm/fs-extra@8.1.0/node_modules/fs-extra/lib/json/index.js"(exports2, module22) {
3192
+ "use strict";
3193
+ init_cjs_shims();
3194
+ var u = require_universalify().fromCallback;
3195
+ var jsonFile = require_jsonfile2();
3196
+ jsonFile.outputJson = u(require_output_json());
3197
+ jsonFile.outputJsonSync = require_output_json_sync();
3198
+ jsonFile.outputJSON = jsonFile.outputJson;
3199
+ jsonFile.outputJSONSync = jsonFile.outputJsonSync;
3200
+ jsonFile.writeJSON = jsonFile.writeJson;
3201
+ jsonFile.writeJSONSync = jsonFile.writeJsonSync;
3202
+ jsonFile.readJSON = jsonFile.readJson;
3203
+ jsonFile.readJSONSync = jsonFile.readJsonSync;
3204
+ module22.exports = jsonFile;
3205
+ }
3206
+ });
3207
+ var require_move_sync = __commonJS2({
3208
+ "../../node_modules/.pnpm/fs-extra@8.1.0/node_modules/fs-extra/lib/move-sync/move-sync.js"(exports2, module22) {
3209
+ "use strict";
3210
+ init_cjs_shims();
3211
+ var fs4 = require_graceful_fs();
3212
+ var path4 = require("path");
3213
+ var copySync = require_copy_sync2().copySync;
3214
+ var removeSync = require_remove().removeSync;
3215
+ var mkdirpSync = require_mkdirs2().mkdirpSync;
3216
+ var stat = require_stat();
3217
+ function moveSync(src, dest, opts) {
3218
+ opts = opts || {};
3219
+ const overwrite = opts.overwrite || opts.clobber || false;
3220
+ const { srcStat } = stat.checkPathsSync(src, dest, "move");
3221
+ stat.checkParentPathsSync(src, srcStat, dest, "move");
3222
+ mkdirpSync(path4.dirname(dest));
3223
+ return doRename(src, dest, overwrite);
3224
+ }
3225
+ function doRename(src, dest, overwrite) {
3226
+ if (overwrite) {
3227
+ removeSync(dest);
3228
+ return rename(src, dest, overwrite);
3229
+ }
3230
+ if (fs4.existsSync(dest))
3231
+ throw new Error("dest already exists.");
3232
+ return rename(src, dest, overwrite);
3233
+ }
3234
+ function rename(src, dest, overwrite) {
3235
+ try {
3236
+ fs4.renameSync(src, dest);
3237
+ } catch (err) {
3238
+ if (err.code !== "EXDEV")
3239
+ throw err;
3240
+ return moveAcrossDevice(src, dest, overwrite);
3241
+ }
3242
+ }
3243
+ function moveAcrossDevice(src, dest, overwrite) {
3244
+ const opts = {
3245
+ overwrite,
3246
+ errorOnExist: true
3247
+ };
3248
+ copySync(src, dest, opts);
3249
+ return removeSync(src);
3250
+ }
3251
+ module22.exports = moveSync;
3252
+ }
3253
+ });
3254
+ var require_move_sync2 = __commonJS2({
3255
+ "../../node_modules/.pnpm/fs-extra@8.1.0/node_modules/fs-extra/lib/move-sync/index.js"(exports2, module22) {
3256
+ "use strict";
3257
+ init_cjs_shims();
3258
+ module22.exports = {
3259
+ moveSync: require_move_sync()
3260
+ };
3261
+ }
3262
+ });
3263
+ var require_move = __commonJS2({
3264
+ "../../node_modules/.pnpm/fs-extra@8.1.0/node_modules/fs-extra/lib/move/move.js"(exports2, module22) {
3265
+ "use strict";
3266
+ init_cjs_shims();
3267
+ var fs4 = require_graceful_fs();
3268
+ var path4 = require("path");
3269
+ var copy = require_copy2().copy;
3270
+ var remove = require_remove().remove;
3271
+ var mkdirp = require_mkdirs2().mkdirp;
3272
+ var pathExists = require_path_exists2().pathExists;
3273
+ var stat = require_stat();
3274
+ function move(src, dest, opts, cb) {
3275
+ if (typeof opts === "function") {
3276
+ cb = opts;
3277
+ opts = {};
3278
+ }
3279
+ const overwrite = opts.overwrite || opts.clobber || false;
3280
+ stat.checkPaths(src, dest, "move", (err, stats) => {
3281
+ if (err)
3282
+ return cb(err);
3283
+ const { srcStat } = stats;
3284
+ stat.checkParentPaths(src, srcStat, dest, "move", (err2) => {
3285
+ if (err2)
3286
+ return cb(err2);
3287
+ mkdirp(path4.dirname(dest), (err3) => {
3288
+ if (err3)
3289
+ return cb(err3);
3290
+ return doRename(src, dest, overwrite, cb);
3291
+ });
3292
+ });
3293
+ });
3294
+ }
3295
+ function doRename(src, dest, overwrite, cb) {
3296
+ if (overwrite) {
3297
+ return remove(dest, (err) => {
3298
+ if (err)
3299
+ return cb(err);
3300
+ return rename(src, dest, overwrite, cb);
3301
+ });
3302
+ }
3303
+ pathExists(dest, (err, destExists) => {
3304
+ if (err)
3305
+ return cb(err);
3306
+ if (destExists)
3307
+ return cb(new Error("dest already exists."));
3308
+ return rename(src, dest, overwrite, cb);
3309
+ });
3310
+ }
3311
+ function rename(src, dest, overwrite, cb) {
3312
+ fs4.rename(src, dest, (err) => {
3313
+ if (!err)
3314
+ return cb();
3315
+ if (err.code !== "EXDEV")
3316
+ return cb(err);
3317
+ return moveAcrossDevice(src, dest, overwrite, cb);
3318
+ });
3319
+ }
3320
+ function moveAcrossDevice(src, dest, overwrite, cb) {
3321
+ const opts = {
3322
+ overwrite,
3323
+ errorOnExist: true
3324
+ };
3325
+ copy(src, dest, opts, (err) => {
3326
+ if (err)
3327
+ return cb(err);
3328
+ return remove(src, cb);
3329
+ });
3330
+ }
3331
+ module22.exports = move;
3332
+ }
3333
+ });
3334
+ var require_move2 = __commonJS2({
3335
+ "../../node_modules/.pnpm/fs-extra@8.1.0/node_modules/fs-extra/lib/move/index.js"(exports2, module22) {
3336
+ "use strict";
3337
+ init_cjs_shims();
3338
+ var u = require_universalify().fromCallback;
3339
+ module22.exports = {
3340
+ move: u(require_move())
3341
+ };
3342
+ }
3343
+ });
3344
+ var require_output = __commonJS2({
3345
+ "../../node_modules/.pnpm/fs-extra@8.1.0/node_modules/fs-extra/lib/output/index.js"(exports2, module22) {
3346
+ "use strict";
3347
+ init_cjs_shims();
3348
+ var u = require_universalify().fromCallback;
3349
+ var fs4 = require_graceful_fs();
3350
+ var path4 = require("path");
3351
+ var mkdir = require_mkdirs2();
3352
+ var pathExists = require_path_exists2().pathExists;
3353
+ function outputFile(file, data, encoding, callback) {
3354
+ if (typeof encoding === "function") {
3355
+ callback = encoding;
3356
+ encoding = "utf8";
3357
+ }
3358
+ const dir = path4.dirname(file);
3359
+ pathExists(dir, (err, itDoes) => {
3360
+ if (err)
3361
+ return callback(err);
3362
+ if (itDoes)
3363
+ return fs4.writeFile(file, data, encoding, callback);
3364
+ mkdir.mkdirs(dir, (err2) => {
3365
+ if (err2)
3366
+ return callback(err2);
3367
+ fs4.writeFile(file, data, encoding, callback);
3368
+ });
3369
+ });
3370
+ }
3371
+ function outputFileSync(file, ...args) {
3372
+ const dir = path4.dirname(file);
3373
+ if (fs4.existsSync(dir)) {
3374
+ return fs4.writeFileSync(file, ...args);
3375
+ }
3376
+ mkdir.mkdirsSync(dir);
3377
+ fs4.writeFileSync(file, ...args);
3378
+ }
3379
+ module22.exports = {
3380
+ outputFile: u(outputFile),
3381
+ outputFileSync
3382
+ };
3383
+ }
3384
+ });
3385
+ var require_lib = __commonJS2({
3386
+ "../../node_modules/.pnpm/fs-extra@8.1.0/node_modules/fs-extra/lib/index.js"(exports2, module22) {
3387
+ "use strict";
3388
+ init_cjs_shims();
3389
+ module22.exports = Object.assign({}, require_fs(), require_copy_sync2(), require_copy2(), require_empty(), require_ensure(), require_json(), require_mkdirs2(), require_move_sync2(), require_move2(), require_output(), require_path_exists2(), require_remove());
3390
+ var fs4 = require("fs");
3391
+ if (Object.getOwnPropertyDescriptor(fs4, "promises")) {
3392
+ Object.defineProperty(module22.exports, "promises", {
3393
+ get() {
3394
+ return fs4.promises;
3395
+ }
3396
+ });
3397
+ }
3398
+ }
3399
+ });
3400
+ var src_exports = {};
3401
+ __export2(src_exports, {
3402
+ getScopeFromArgs: () => getScopeFromArgs_default,
3403
+ getScopeFromPath: () => getScopeFromPath_default,
3404
+ getTurboRoot: () => getTurboRoot_default,
3405
+ searchUp: () => searchUp_default
3406
+ });
3407
+ module2.exports = __toCommonJS2(src_exports);
3408
+ init_cjs_shims();
3409
+ init_cjs_shims();
3410
+ function getScopeFromArgs({ args }) {
3411
+ if (args.length && args[0] != null) {
3412
+ return { scope: args[0], context: {} };
3413
+ }
3414
+ return { scope: null, context: {} };
3415
+ }
3416
+ var getScopeFromArgs_default = getScopeFromArgs;
3417
+ init_cjs_shims();
3418
+ var import_fs2 = __toESM2(require("fs"));
3419
+ var import_path = __toESM2(require("path"));
3420
+ function getScopeFromPath({ cwd }) {
3421
+ const packageJsonPath = import_path.default.join(cwd, "package.json");
3422
+ try {
3423
+ const raw = import_fs2.default.readFileSync(packageJsonPath, "utf8");
3424
+ const packageJsonContent = JSON.parse(raw);
3425
+ return {
3426
+ scope: packageJsonContent.name,
3427
+ context: { path: packageJsonPath }
3428
+ };
3429
+ } catch (e) {
3430
+ return { scope: null, context: {} };
3431
+ }
3432
+ }
3433
+ var getScopeFromPath_default = getScopeFromPath;
3434
+ init_cjs_shims();
3435
+ init_cjs_shims();
3436
+ var import_regenerator = __toESM2(require_regenerator());
3437
+ init_cjs_shims();
3438
+ init_cjs_shims();
3439
+ function _classCallCheck(instance, Constructor) {
3440
+ if (!(instance instanceof Constructor)) {
3441
+ throw new TypeError("Cannot call a class as a function");
3442
+ }
3443
+ }
3444
+ init_cjs_shims();
3445
+ init_cjs_shims();
3446
+ function _typeof(obj) {
3447
+ "@babel/helpers - typeof";
3448
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(obj2) {
3449
+ return typeof obj2;
3450
+ } : function(obj2) {
3451
+ return obj2 && "function" == typeof Symbol && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
3452
+ }, _typeof(obj);
3453
+ }
3454
+ init_cjs_shims();
3455
+ function _assertThisInitialized(self) {
3456
+ if (self === void 0) {
3457
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
3458
+ }
3459
+ return self;
3460
+ }
3461
+ function _possibleConstructorReturn(self, call) {
3462
+ if (call && (_typeof(call) === "object" || typeof call === "function")) {
3463
+ return call;
3464
+ } else if (call !== void 0) {
3465
+ throw new TypeError("Derived constructors may only return object or undefined");
3466
+ }
3467
+ return _assertThisInitialized(self);
3468
+ }
3469
+ init_cjs_shims();
3470
+ function _getPrototypeOf(o) {
3471
+ _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf2(o2) {
3472
+ return o2.__proto__ || Object.getPrototypeOf(o2);
3473
+ };
3474
+ return _getPrototypeOf(o);
3475
+ }
3476
+ init_cjs_shims();
3477
+ init_cjs_shims();
3478
+ function _setPrototypeOf(o, p) {
3479
+ _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf2(o2, p2) {
3480
+ o2.__proto__ = p2;
3481
+ return o2;
3482
+ };
3483
+ return _setPrototypeOf(o, p);
3484
+ }
3485
+ function _inherits(subClass, superClass) {
3486
+ if (typeof superClass !== "function" && superClass !== null) {
3487
+ throw new TypeError("Super expression must either be null or a function");
3488
+ }
3489
+ subClass.prototype = Object.create(superClass && superClass.prototype, {
3490
+ constructor: {
3491
+ value: subClass,
3492
+ writable: true,
3493
+ configurable: true
3494
+ }
3495
+ });
3496
+ Object.defineProperty(subClass, "prototype", {
3497
+ writable: false
3498
+ });
3499
+ if (superClass)
3500
+ _setPrototypeOf(subClass, superClass);
3501
+ }
3502
+ init_cjs_shims();
3503
+ init_cjs_shims();
3504
+ function _isNativeFunction(fn) {
3505
+ return Function.toString.call(fn).indexOf("[native code]") !== -1;
3506
+ }
3507
+ init_cjs_shims();
3508
+ init_cjs_shims();
3509
+ function _isNativeReflectConstruct() {
3510
+ if (typeof Reflect === "undefined" || !Reflect.construct)
3511
+ return false;
3512
+ if (Reflect.construct.sham)
3513
+ return false;
3514
+ if (typeof Proxy === "function")
3515
+ return true;
3516
+ try {
3517
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
3518
+ }));
3519
+ return true;
3520
+ } catch (e) {
3521
+ return false;
3522
+ }
3523
+ }
3524
+ function _construct(Parent, args, Class) {
3525
+ if (_isNativeReflectConstruct()) {
3526
+ _construct = Reflect.construct.bind();
3527
+ } else {
3528
+ _construct = function _construct2(Parent2, args2, Class2) {
3529
+ var a = [null];
3530
+ a.push.apply(a, args2);
3531
+ var Constructor = Function.bind.apply(Parent2, a);
3532
+ var instance = new Constructor();
3533
+ if (Class2)
3534
+ _setPrototypeOf(instance, Class2.prototype);
3535
+ return instance;
3536
+ };
3537
+ }
3538
+ return _construct.apply(null, arguments);
3539
+ }
3540
+ function _wrapNativeSuper(Class) {
3541
+ var _cache = typeof Map === "function" ? /* @__PURE__ */ new Map() : void 0;
3542
+ _wrapNativeSuper = function _wrapNativeSuper2(Class2) {
3543
+ if (Class2 === null || !_isNativeFunction(Class2))
3544
+ return Class2;
3545
+ if (typeof Class2 !== "function") {
3546
+ throw new TypeError("Super expression must either be null or a function");
3547
+ }
3548
+ if (typeof _cache !== "undefined") {
3549
+ if (_cache.has(Class2))
3550
+ return _cache.get(Class2);
3551
+ _cache.set(Class2, Wrapper);
3552
+ }
3553
+ function Wrapper() {
3554
+ return _construct(Class2, arguments, _getPrototypeOf(this).constructor);
3555
+ }
3556
+ Wrapper.prototype = Object.create(Class2.prototype, {
3557
+ constructor: {
3558
+ value: Wrapper,
3559
+ enumerable: false,
3560
+ writable: true,
3561
+ configurable: true
3562
+ }
3563
+ });
3564
+ return _setPrototypeOf(Wrapper, Class2);
3565
+ };
3566
+ return _wrapNativeSuper(Class);
3567
+ }
3568
+ var import_find_up = __toESM2(require_find_up());
3569
+ var import_path2 = __toESM2(require("path"));
3570
+ var import_fs_extra = __toESM2(require_lib());
3571
+ var NoPkgJsonFound = /* @__PURE__ */ function(_Error) {
3572
+ _inherits(NoPkgJsonFound2, _Error);
3573
+ function NoPkgJsonFound2(directory) {
3574
+ var _this;
3575
+ _classCallCheck(this, NoPkgJsonFound2);
3576
+ _this = _possibleConstructorReturn(this, _getPrototypeOf(NoPkgJsonFound2).call(this, "No package.json could be found upwards from the directory ".concat(directory)));
3577
+ _this.directory = directory;
3578
+ return _this;
3579
+ }
3580
+ return NoPkgJsonFound2;
3581
+ }(_wrapNativeSuper(Error));
3582
+ function hasWorkspacesConfiguredViaPkgJsonSync(directory, firstPkgJsonDirRef) {
3583
+ try {
3584
+ var pkgJson = import_fs_extra.default.readJsonSync(import_path2.default.join(directory, "package.json"));
3585
+ if (firstPkgJsonDirRef.current === void 0) {
3586
+ firstPkgJsonDirRef.current = directory;
3587
+ }
3588
+ if (pkgJson.workspaces || pkgJson.bolt) {
3589
+ return directory;
3590
+ }
3591
+ } catch (err) {
3592
+ if (err.code !== "ENOENT") {
3593
+ throw err;
3594
+ }
3595
+ }
3596
+ }
3597
+ function hasWorkspacesConfiguredViaLernaSync(directory) {
3598
+ try {
3599
+ var lernaJson = import_fs_extra.default.readJsonSync(import_path2.default.join(directory, "lerna.json"));
3600
+ if (lernaJson.useWorkspaces !== true) {
3601
+ return directory;
3602
+ }
3603
+ } catch (err) {
3604
+ if (err.code !== "ENOENT") {
3605
+ throw err;
3606
+ }
3607
+ }
3608
+ }
3609
+ function hasWorkspacesConfiguredViaPnpmSync(directory) {
3610
+ var pnpmWorkspacesFileExists = import_fs_extra.default.existsSync(import_path2.default.join(directory, "pnpm-workspace.yaml"));
3611
+ if (pnpmWorkspacesFileExists) {
3612
+ return directory;
3613
+ }
3614
+ }
3615
+ function findRootSync(cwd) {
3616
+ var firstPkgJsonDirRef = {
3617
+ current: void 0
3618
+ };
3619
+ var dir = (0, import_find_up.sync)(function(directory) {
3620
+ return [hasWorkspacesConfiguredViaLernaSync(directory), hasWorkspacesConfiguredViaPkgJsonSync(directory, firstPkgJsonDirRef), hasWorkspacesConfiguredViaPnpmSync(directory)].find(function(dir2) {
3621
+ return dir2;
3622
+ });
3623
+ }, {
3624
+ cwd,
3625
+ type: "directory"
3626
+ });
3627
+ if (firstPkgJsonDirRef.current === void 0) {
3628
+ throw new NoPkgJsonFound(cwd);
3629
+ }
3630
+ if (dir === void 0) {
3631
+ return firstPkgJsonDirRef.current;
3632
+ }
3633
+ return dir;
3634
+ }
3635
+ init_cjs_shims();
3636
+ var import_fs22 = __toESM2(require("fs"));
3637
+ var import_path3 = __toESM2(require("path"));
3638
+ function searchUp({
3639
+ target,
3640
+ cwd
3641
+ }) {
3642
+ const root = import_path3.default.parse(cwd).root;
3643
+ let found = false;
3644
+ while (!found && cwd !== root) {
3645
+ if (import_fs22.default.existsSync(import_path3.default.join(cwd, target))) {
3646
+ found = true;
3647
+ break;
3648
+ }
3649
+ cwd = import_path3.default.dirname(cwd);
3650
+ }
3651
+ if (found) {
3652
+ return cwd;
3653
+ }
3654
+ return null;
3655
+ }
3656
+ var searchUp_default = searchUp;
3657
+ function getTurboRoot2(cwd) {
3658
+ let root = searchUp_default({ target: "turbo.json", cwd: cwd || process.cwd() });
3659
+ if (!root) {
3660
+ root = findRootSync(process.cwd());
3661
+ if (!root) {
3662
+ return null;
3663
+ }
3664
+ }
3665
+ return root;
3666
+ }
3667
+ var getTurboRoot_default = getTurboRoot2;
3668
+ }
3669
+ });
3670
+
3671
+ // lib/index.ts
3672
+ var lib_exports = {};
3673
+ __export(lib_exports, {
3674
+ configs: () => configs,
3675
+ rules: () => rules
3676
+ });
3677
+ module.exports = __toCommonJS(lib_exports);
3678
+
3679
+ // lib/constants.ts
3680
+ var RULES = {
3681
+ noUndeclaredEnvVars: `no-undeclared-env-vars`
3682
+ };
3683
+
3684
+ // lib/utils/findTurboConfig.ts
3685
+ var import_fs = __toESM(require("fs"));
3686
+ var import_turbo_utils = __toESM(require_dist());
3687
+ function findTurboConfig({ cwd }) {
3688
+ const turboRoot = (0, import_turbo_utils.getTurboRoot)(cwd);
3689
+ if (turboRoot) {
3690
+ try {
3691
+ const raw = import_fs.default.readFileSync(`${turboRoot}/turbo.json`, "utf8");
3692
+ const turboJsonContent = JSON.parse(raw);
3693
+ return turboJsonContent;
3694
+ } catch (e) {
3695
+ console.error(e);
3696
+ return null;
3697
+ }
3698
+ }
3699
+ return null;
3700
+ }
3701
+ var findTurboConfig_default = findTurboConfig;
3702
+
3703
+ // lib/utils/getEnvVarDependencies.ts
3704
+ function findDependsOnEnvVars({
3705
+ dependencies
3706
+ }) {
3707
+ if (dependencies) {
3708
+ return dependencies.filter((dep) => dep.startsWith("$"));
3709
+ }
3710
+ return [];
3711
+ }
3712
+ function getEnvVarDependencies({
3713
+ cwd,
3714
+ turboConfig
3715
+ }) {
3716
+ const turboJsonContent = turboConfig || findTurboConfig_default({ cwd });
3717
+ if (!turboJsonContent) {
3718
+ return null;
3719
+ }
3720
+ const { globalDependencies, pipeline = {} } = turboJsonContent;
3721
+ const allEnvVars = findDependsOnEnvVars({
3722
+ dependencies: globalDependencies
3723
+ });
3724
+ Object.values(pipeline).forEach(({ dependsOn }) => {
3725
+ if (dependsOn) {
3726
+ allEnvVars.push(...findDependsOnEnvVars({ dependencies: dependsOn }));
3727
+ }
3728
+ });
3729
+ const envVarSet = new Set(allEnvVars.map((envVar) => envVar.slice(1, envVar.length)));
3730
+ return envVarSet;
3731
+ }
3732
+ var getEnvVarDependencies_default = getEnvVarDependencies;
3733
+
3734
+ // lib/rules/no-undeclared-env-vars.ts
3735
+ var meta = {
3736
+ type: "problem",
3737
+ docs: {
3738
+ description: "Do not allow the use of `process.env` without including the env key in turbo.json",
3739
+ category: "Configuration Issues",
3740
+ recommended: true,
3741
+ url: `https://github.com/vercel/turborepo/tree/main/packages/eslint-plugin-turbo/docs/rules/${RULES.noUndeclaredEnvVars}`
3742
+ },
3743
+ schema: [
3744
+ {
3745
+ type: "object",
3746
+ default: {},
3747
+ additionalProperties: false,
3748
+ properties: {
3749
+ turboConfig: {
3750
+ require: false,
3751
+ type: "object"
3752
+ },
3753
+ allowList: {
3754
+ default: [],
3755
+ type: "array",
3756
+ items: {
3757
+ type: "string"
3758
+ }
3759
+ }
3760
+ }
3761
+ }
3762
+ ]
3763
+ };
3764
+ function create(context) {
3765
+ var _a, _b;
3766
+ const { options } = context;
3767
+ const allowList = ((_a = options == null ? void 0 : options[0]) == null ? void 0 : _a.allowList) || [];
3768
+ const regexAllowList = [];
3769
+ allowList.forEach((allowed) => {
3770
+ try {
3771
+ regexAllowList.push(new RegExp(allowed));
3772
+ } catch (err) {
3773
+ console.error(`Unable to convert "${allowed}" to regex`);
3774
+ }
3775
+ });
3776
+ const turboConfig = (_b = options == null ? void 0 : options[0]) == null ? void 0 : _b.turboConfig;
3777
+ const turboVars = getEnvVarDependencies_default({
3778
+ cwd: context.getCwd(),
3779
+ turboConfig
3780
+ });
3781
+ if (!turboVars) {
3782
+ return {};
3783
+ }
3784
+ const checkKey = (node, envKey) => {
3785
+ if (envKey && !turboVars.has(envKey) && !regexAllowList.some((regex) => regex.test(envKey))) {
3786
+ context.report({
3787
+ node,
3788
+ message: "${{ envKey }} is not listed as a dependency in turbo.json",
3789
+ data: { envKey }
3790
+ });
3791
+ }
3792
+ };
3793
+ return {
3794
+ MemberExpression(node) {
3795
+ var _a2, _b2;
3796
+ if ("name" in node.object && "name" in node.property) {
3797
+ const objectName = node.object.name;
3798
+ const propertyName = node.property.name;
3799
+ if (objectName === "process" && propertyName === "env") {
3800
+ if ("id" in node.parent && ((_a2 = node.parent.id) == null ? void 0 : _a2.type) === "ObjectPattern") {
3801
+ const values = node.parent.id.properties.values();
3802
+ Array.from(values).forEach((item) => {
3803
+ if ("key" in item && "name" in item.key) {
3804
+ checkKey(node.parent, item.key.name);
3805
+ }
3806
+ });
3807
+ } else if ("property" in node.parent && "name" in node.parent.property) {
3808
+ checkKey(node.parent, (_b2 = node.parent.property) == null ? void 0 : _b2.name);
3809
+ }
3810
+ }
3811
+ }
3812
+ }
3813
+ };
3814
+ }
3815
+ var rule = { create, meta };
3816
+ var no_undeclared_env_vars_default = rule;
3817
+
3818
+ // lib/configs/recommended.ts
3819
+ var config = {
3820
+ plugins: ["turbo"],
3821
+ rules: {
3822
+ [RULES.noUndeclaredEnvVars]: "error"
3823
+ }
3824
+ };
3825
+ var recommended_default = config;
3826
+
3827
+ // lib/index.ts
3828
+ var rules = {
3829
+ [RULES.noUndeclaredEnvVars]: no_undeclared_env_vars_default
3830
+ };
3831
+ var configs = {
3832
+ recommended: recommended_default
3833
+ };
3834
+ // Annotate the CommonJS export names for ESM import in node:
3835
+ 0 && (module.exports = {
3836
+ configs,
3837
+ rules
3838
+ });
3839
+ /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */