@prisma/fetch-engine 6.3.0-integration-simpler-typeinfo-query.1 → 6.3.0-integration-studio-ux-refinements.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.
@@ -1,2457 +0,0 @@
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 __export = (target, all) => {
9
- for (var name in all)
10
- __defProp(target, name, { get: all[name], enumerable: true });
11
- };
12
- var __copyProps = (to, from, except, desc) => {
13
- if (from && typeof from === "object" || typeof from === "function") {
14
- for (let key of __getOwnPropNames(from))
15
- if (!__hasOwnProp.call(to, key) && key !== except)
16
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
- }
18
- return to;
19
- };
20
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
- // If the importer is in node compatibility mode or this is not an ESM
22
- // file that has been converted to a CommonJS file using a Babel-
23
- // compatible transform (i.e. "__esModule" has not been set), then set
24
- // "default" to the CommonJS "module.exports" for node compatibility.
25
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
- mod
27
- ));
28
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
- var chunk_FQ2BOR66_exports = {};
30
- __export(chunk_FQ2BOR66_exports, {
31
- getCacheDir: () => getCacheDir,
32
- getDownloadUrl: () => getDownloadUrl,
33
- getRootCacheDir: () => getRootCacheDir,
34
- overwriteFile: () => overwriteFile,
35
- require_graceful_fs: () => require_graceful_fs,
36
- require_lib: () => require_lib
37
- });
38
- module.exports = __toCommonJS(chunk_FQ2BOR66_exports);
39
- var import_chunk_AH6QHEOA = require("./chunk-AH6QHEOA.js");
40
- var import_debug = __toESM(require("@prisma/debug"));
41
- var import_get_platform = require("@prisma/get-platform");
42
- var import_process = __toESM(require("process"));
43
- var import_path = __toESM(require("path"));
44
- var import_fs = __toESM(require("fs"));
45
- var import_path2 = __toESM(require("path"));
46
- var import_path3 = __toESM(require("path"));
47
- var import_url = require("url");
48
- var import_process2 = __toESM(require("process"));
49
- var import_path4 = __toESM(require("path"));
50
- var import_fs2 = __toESM(require("fs"));
51
- var import_url2 = require("url");
52
- var import_fs3 = __toESM(require("fs"));
53
- var import_os = __toESM(require("os"));
54
- var import_path5 = __toESM(require("path"));
55
- var require_common_path_prefix = (0, import_chunk_AH6QHEOA.__commonJS)({
56
- "../../node_modules/.pnpm/common-path-prefix@3.0.0/node_modules/common-path-prefix/index.js"(exports, module2) {
57
- "use strict";
58
- var { sep: DEFAULT_SEPARATOR } = (0, import_chunk_AH6QHEOA.__require)("path");
59
- var determineSeparator = (paths) => {
60
- for (const path6 of paths) {
61
- const match = /(\/|\\)/.exec(path6);
62
- if (match !== null) return match[0];
63
- }
64
- return DEFAULT_SEPARATOR;
65
- };
66
- module2.exports = function commonPathPrefix2(paths, sep = determineSeparator(paths)) {
67
- const [first = "", ...remaining] = paths;
68
- if (first === "" || remaining.length === 0) return "";
69
- const parts = first.split(sep);
70
- let endOfPrefix = parts.length;
71
- for (const path6 of remaining) {
72
- const compare = path6.split(sep);
73
- for (let i = 0; i < endOfPrefix; i++) {
74
- if (compare[i] !== parts[i]) {
75
- endOfPrefix = i;
76
- }
77
- }
78
- if (endOfPrefix === 0) return "";
79
- }
80
- const prefix = parts.slice(0, endOfPrefix).join(sep);
81
- return prefix.endsWith(sep) ? prefix : prefix + sep;
82
- };
83
- }
84
- });
85
- var require_universalify = (0, import_chunk_AH6QHEOA.__commonJS)({
86
- "../../node_modules/.pnpm/universalify@2.0.0/node_modules/universalify/index.js"(exports) {
87
- "use strict";
88
- exports.fromCallback = function(fn) {
89
- return Object.defineProperty(function(...args) {
90
- if (typeof args[args.length - 1] === "function") fn.apply(this, args);
91
- else {
92
- return new Promise((resolve, reject) => {
93
- fn.call(
94
- this,
95
- ...args,
96
- (err, res) => err != null ? reject(err) : resolve(res)
97
- );
98
- });
99
- }
100
- }, "name", { value: fn.name });
101
- };
102
- exports.fromPromise = function(fn) {
103
- return Object.defineProperty(function(...args) {
104
- const cb = args[args.length - 1];
105
- if (typeof cb !== "function") return fn.apply(this, args);
106
- else fn.apply(this, args.slice(0, -1)).then((r) => cb(null, r), cb);
107
- }, "name", { value: fn.name });
108
- };
109
- }
110
- });
111
- var require_polyfills = (0, import_chunk_AH6QHEOA.__commonJS)({
112
- "../../node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/polyfills.js"(exports, module2) {
113
- "use strict";
114
- var constants = (0, import_chunk_AH6QHEOA.__require)("constants");
115
- var origCwd = process.cwd;
116
- var cwd2 = null;
117
- var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
118
- process.cwd = function() {
119
- if (!cwd2)
120
- cwd2 = origCwd.call(process);
121
- return cwd2;
122
- };
123
- try {
124
- process.cwd();
125
- } catch (er) {
126
- }
127
- if (typeof process.chdir === "function") {
128
- chdir = process.chdir;
129
- process.chdir = function(d) {
130
- cwd2 = null;
131
- chdir.call(process, d);
132
- };
133
- if (Object.setPrototypeOf) Object.setPrototypeOf(process.chdir, chdir);
134
- }
135
- var chdir;
136
- module2.exports = patch;
137
- function patch(fs4) {
138
- if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
139
- patchLchmod(fs4);
140
- }
141
- if (!fs4.lutimes) {
142
- patchLutimes(fs4);
143
- }
144
- fs4.chown = chownFix(fs4.chown);
145
- fs4.fchown = chownFix(fs4.fchown);
146
- fs4.lchown = chownFix(fs4.lchown);
147
- fs4.chmod = chmodFix(fs4.chmod);
148
- fs4.fchmod = chmodFix(fs4.fchmod);
149
- fs4.lchmod = chmodFix(fs4.lchmod);
150
- fs4.chownSync = chownFixSync(fs4.chownSync);
151
- fs4.fchownSync = chownFixSync(fs4.fchownSync);
152
- fs4.lchownSync = chownFixSync(fs4.lchownSync);
153
- fs4.chmodSync = chmodFixSync(fs4.chmodSync);
154
- fs4.fchmodSync = chmodFixSync(fs4.fchmodSync);
155
- fs4.lchmodSync = chmodFixSync(fs4.lchmodSync);
156
- fs4.stat = statFix(fs4.stat);
157
- fs4.fstat = statFix(fs4.fstat);
158
- fs4.lstat = statFix(fs4.lstat);
159
- fs4.statSync = statFixSync(fs4.statSync);
160
- fs4.fstatSync = statFixSync(fs4.fstatSync);
161
- fs4.lstatSync = statFixSync(fs4.lstatSync);
162
- if (fs4.chmod && !fs4.lchmod) {
163
- fs4.lchmod = function(path6, mode, cb) {
164
- if (cb) process.nextTick(cb);
165
- };
166
- fs4.lchmodSync = function() {
167
- };
168
- }
169
- if (fs4.chown && !fs4.lchown) {
170
- fs4.lchown = function(path6, uid, gid, cb) {
171
- if (cb) process.nextTick(cb);
172
- };
173
- fs4.lchownSync = function() {
174
- };
175
- }
176
- if (platform === "win32") {
177
- fs4.rename = typeof fs4.rename !== "function" ? fs4.rename : function(fs$rename) {
178
- function rename(from, to, cb) {
179
- var start = Date.now();
180
- var backoff = 0;
181
- fs$rename(from, to, function CB(er) {
182
- if (er && (er.code === "EACCES" || er.code === "EPERM") && Date.now() - start < 6e4) {
183
- setTimeout(function() {
184
- fs4.stat(to, function(stater, st) {
185
- if (stater && stater.code === "ENOENT")
186
- fs$rename(from, to, CB);
187
- else
188
- cb(er);
189
- });
190
- }, backoff);
191
- if (backoff < 100)
192
- backoff += 10;
193
- return;
194
- }
195
- if (cb) cb(er);
196
- });
197
- }
198
- if (Object.setPrototypeOf) Object.setPrototypeOf(rename, fs$rename);
199
- return rename;
200
- }(fs4.rename);
201
- }
202
- fs4.read = typeof fs4.read !== "function" ? fs4.read : function(fs$read) {
203
- function read(fd, buffer, offset, length, position, callback_) {
204
- var callback;
205
- if (callback_ && typeof callback_ === "function") {
206
- var eagCounter = 0;
207
- callback = function(er, _, __) {
208
- if (er && er.code === "EAGAIN" && eagCounter < 10) {
209
- eagCounter++;
210
- return fs$read.call(fs4, fd, buffer, offset, length, position, callback);
211
- }
212
- callback_.apply(this, arguments);
213
- };
214
- }
215
- return fs$read.call(fs4, fd, buffer, offset, length, position, callback);
216
- }
217
- if (Object.setPrototypeOf) Object.setPrototypeOf(read, fs$read);
218
- return read;
219
- }(fs4.read);
220
- fs4.readSync = typeof fs4.readSync !== "function" ? fs4.readSync : /* @__PURE__ */ function(fs$readSync) {
221
- return function(fd, buffer, offset, length, position) {
222
- var eagCounter = 0;
223
- while (true) {
224
- try {
225
- return fs$readSync.call(fs4, fd, buffer, offset, length, position);
226
- } catch (er) {
227
- if (er.code === "EAGAIN" && eagCounter < 10) {
228
- eagCounter++;
229
- continue;
230
- }
231
- throw er;
232
- }
233
- }
234
- };
235
- }(fs4.readSync);
236
- function patchLchmod(fs5) {
237
- fs5.lchmod = function(path6, mode, callback) {
238
- fs5.open(
239
- path6,
240
- constants.O_WRONLY | constants.O_SYMLINK,
241
- mode,
242
- function(err, fd) {
243
- if (err) {
244
- if (callback) callback(err);
245
- return;
246
- }
247
- fs5.fchmod(fd, mode, function(err2) {
248
- fs5.close(fd, function(err22) {
249
- if (callback) callback(err2 || err22);
250
- });
251
- });
252
- }
253
- );
254
- };
255
- fs5.lchmodSync = function(path6, mode) {
256
- var fd = fs5.openSync(path6, constants.O_WRONLY | constants.O_SYMLINK, mode);
257
- var threw = true;
258
- var ret;
259
- try {
260
- ret = fs5.fchmodSync(fd, mode);
261
- threw = false;
262
- } finally {
263
- if (threw) {
264
- try {
265
- fs5.closeSync(fd);
266
- } catch (er) {
267
- }
268
- } else {
269
- fs5.closeSync(fd);
270
- }
271
- }
272
- return ret;
273
- };
274
- }
275
- function patchLutimes(fs5) {
276
- if (constants.hasOwnProperty("O_SYMLINK") && fs5.futimes) {
277
- fs5.lutimes = function(path6, at, mt, cb) {
278
- fs5.open(path6, constants.O_SYMLINK, function(er, fd) {
279
- if (er) {
280
- if (cb) cb(er);
281
- return;
282
- }
283
- fs5.futimes(fd, at, mt, function(er2) {
284
- fs5.close(fd, function(er22) {
285
- if (cb) cb(er2 || er22);
286
- });
287
- });
288
- });
289
- };
290
- fs5.lutimesSync = function(path6, at, mt) {
291
- var fd = fs5.openSync(path6, constants.O_SYMLINK);
292
- var ret;
293
- var threw = true;
294
- try {
295
- ret = fs5.futimesSync(fd, at, mt);
296
- threw = false;
297
- } finally {
298
- if (threw) {
299
- try {
300
- fs5.closeSync(fd);
301
- } catch (er) {
302
- }
303
- } else {
304
- fs5.closeSync(fd);
305
- }
306
- }
307
- return ret;
308
- };
309
- } else if (fs5.futimes) {
310
- fs5.lutimes = function(_a, _b, _c, cb) {
311
- if (cb) process.nextTick(cb);
312
- };
313
- fs5.lutimesSync = function() {
314
- };
315
- }
316
- }
317
- function chmodFix(orig) {
318
- if (!orig) return orig;
319
- return function(target, mode, cb) {
320
- return orig.call(fs4, target, mode, function(er) {
321
- if (chownErOk(er)) er = null;
322
- if (cb) cb.apply(this, arguments);
323
- });
324
- };
325
- }
326
- function chmodFixSync(orig) {
327
- if (!orig) return orig;
328
- return function(target, mode) {
329
- try {
330
- return orig.call(fs4, target, mode);
331
- } catch (er) {
332
- if (!chownErOk(er)) throw er;
333
- }
334
- };
335
- }
336
- function chownFix(orig) {
337
- if (!orig) return orig;
338
- return function(target, uid, gid, cb) {
339
- return orig.call(fs4, target, uid, gid, function(er) {
340
- if (chownErOk(er)) er = null;
341
- if (cb) cb.apply(this, arguments);
342
- });
343
- };
344
- }
345
- function chownFixSync(orig) {
346
- if (!orig) return orig;
347
- return function(target, uid, gid) {
348
- try {
349
- return orig.call(fs4, target, uid, gid);
350
- } catch (er) {
351
- if (!chownErOk(er)) throw er;
352
- }
353
- };
354
- }
355
- function statFix(orig) {
356
- if (!orig) return orig;
357
- return function(target, options, cb) {
358
- if (typeof options === "function") {
359
- cb = options;
360
- options = null;
361
- }
362
- function callback(er, stats) {
363
- if (stats) {
364
- if (stats.uid < 0) stats.uid += 4294967296;
365
- if (stats.gid < 0) stats.gid += 4294967296;
366
- }
367
- if (cb) cb.apply(this, arguments);
368
- }
369
- return options ? orig.call(fs4, target, options, callback) : orig.call(fs4, target, callback);
370
- };
371
- }
372
- function statFixSync(orig) {
373
- if (!orig) return orig;
374
- return function(target, options) {
375
- var stats = options ? orig.call(fs4, target, options) : orig.call(fs4, target);
376
- if (stats) {
377
- if (stats.uid < 0) stats.uid += 4294967296;
378
- if (stats.gid < 0) stats.gid += 4294967296;
379
- }
380
- return stats;
381
- };
382
- }
383
- function chownErOk(er) {
384
- if (!er)
385
- return true;
386
- if (er.code === "ENOSYS")
387
- return true;
388
- var nonroot = !process.getuid || process.getuid() !== 0;
389
- if (nonroot) {
390
- if (er.code === "EINVAL" || er.code === "EPERM")
391
- return true;
392
- }
393
- return false;
394
- }
395
- }
396
- }
397
- });
398
- var require_legacy_streams = (0, import_chunk_AH6QHEOA.__commonJS)({
399
- "../../node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/legacy-streams.js"(exports, module2) {
400
- "use strict";
401
- var Stream = (0, import_chunk_AH6QHEOA.__require)("stream").Stream;
402
- module2.exports = legacy;
403
- function legacy(fs4) {
404
- return {
405
- ReadStream,
406
- WriteStream
407
- };
408
- function ReadStream(path6, options) {
409
- if (!(this instanceof ReadStream)) return new ReadStream(path6, options);
410
- Stream.call(this);
411
- var self = this;
412
- this.path = path6;
413
- this.fd = null;
414
- this.readable = true;
415
- this.paused = false;
416
- this.flags = "r";
417
- this.mode = 438;
418
- this.bufferSize = 64 * 1024;
419
- options = options || {};
420
- var keys = Object.keys(options);
421
- for (var index = 0, length = keys.length; index < length; index++) {
422
- var key = keys[index];
423
- this[key] = options[key];
424
- }
425
- if (this.encoding) this.setEncoding(this.encoding);
426
- if (this.start !== void 0) {
427
- if ("number" !== typeof this.start) {
428
- throw TypeError("start must be a Number");
429
- }
430
- if (this.end === void 0) {
431
- this.end = Infinity;
432
- } else if ("number" !== typeof this.end) {
433
- throw TypeError("end must be a Number");
434
- }
435
- if (this.start > this.end) {
436
- throw new Error("start must be <= end");
437
- }
438
- this.pos = this.start;
439
- }
440
- if (this.fd !== null) {
441
- process.nextTick(function() {
442
- self._read();
443
- });
444
- return;
445
- }
446
- fs4.open(this.path, this.flags, this.mode, function(err, fd) {
447
- if (err) {
448
- self.emit("error", err);
449
- self.readable = false;
450
- return;
451
- }
452
- self.fd = fd;
453
- self.emit("open", fd);
454
- self._read();
455
- });
456
- }
457
- function WriteStream(path6, options) {
458
- if (!(this instanceof WriteStream)) return new WriteStream(path6, options);
459
- Stream.call(this);
460
- this.path = path6;
461
- this.fd = null;
462
- this.writable = true;
463
- this.flags = "w";
464
- this.encoding = "binary";
465
- this.mode = 438;
466
- this.bytesWritten = 0;
467
- options = options || {};
468
- var keys = Object.keys(options);
469
- for (var index = 0, length = keys.length; index < length; index++) {
470
- var key = keys[index];
471
- this[key] = options[key];
472
- }
473
- if (this.start !== void 0) {
474
- if ("number" !== typeof this.start) {
475
- throw TypeError("start must be a Number");
476
- }
477
- if (this.start < 0) {
478
- throw new Error("start must be >= zero");
479
- }
480
- this.pos = this.start;
481
- }
482
- this.busy = false;
483
- this._queue = [];
484
- if (this.fd === null) {
485
- this._open = fs4.open;
486
- this._queue.push([this._open, this.path, this.flags, this.mode, void 0]);
487
- this.flush();
488
- }
489
- }
490
- }
491
- }
492
- });
493
- var require_clone = (0, import_chunk_AH6QHEOA.__commonJS)({
494
- "../../node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/clone.js"(exports, module2) {
495
- "use strict";
496
- module2.exports = clone;
497
- var getPrototypeOf = Object.getPrototypeOf || function(obj) {
498
- return obj.__proto__;
499
- };
500
- function clone(obj) {
501
- if (obj === null || typeof obj !== "object")
502
- return obj;
503
- if (obj instanceof Object)
504
- var copy = { __proto__: getPrototypeOf(obj) };
505
- else
506
- var copy = /* @__PURE__ */ Object.create(null);
507
- Object.getOwnPropertyNames(obj).forEach(function(key) {
508
- Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key));
509
- });
510
- return copy;
511
- }
512
- }
513
- });
514
- var require_graceful_fs = (0, import_chunk_AH6QHEOA.__commonJS)({
515
- "../../node_modules/.pnpm/graceful-fs@4.2.10/node_modules/graceful-fs/graceful-fs.js"(exports, module2) {
516
- "use strict";
517
- var fs4 = (0, import_chunk_AH6QHEOA.__require)("fs");
518
- var polyfills = require_polyfills();
519
- var legacy = require_legacy_streams();
520
- var clone = require_clone();
521
- var util = (0, import_chunk_AH6QHEOA.__require)("util");
522
- var gracefulQueue;
523
- var previousSymbol;
524
- if (typeof Symbol === "function" && typeof Symbol.for === "function") {
525
- gracefulQueue = Symbol.for("graceful-fs.queue");
526
- previousSymbol = Symbol.for("graceful-fs.previous");
527
- } else {
528
- gracefulQueue = "___graceful-fs.queue";
529
- previousSymbol = "___graceful-fs.previous";
530
- }
531
- function noop() {
532
- }
533
- function publishQueue(context, queue2) {
534
- Object.defineProperty(context, gracefulQueue, {
535
- get: function() {
536
- return queue2;
537
- }
538
- });
539
- }
540
- var debug2 = noop;
541
- if (util.debuglog)
542
- debug2 = util.debuglog("gfs4");
543
- else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ""))
544
- debug2 = function() {
545
- var m = util.format.apply(util, arguments);
546
- m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
547
- console.error(m);
548
- };
549
- if (!fs4[gracefulQueue]) {
550
- queue = global[gracefulQueue] || [];
551
- publishQueue(fs4, queue);
552
- fs4.close = function(fs$close) {
553
- function close(fd, cb) {
554
- return fs$close.call(fs4, fd, function(err) {
555
- if (!err) {
556
- resetQueue();
557
- }
558
- if (typeof cb === "function")
559
- cb.apply(this, arguments);
560
- });
561
- }
562
- Object.defineProperty(close, previousSymbol, {
563
- value: fs$close
564
- });
565
- return close;
566
- }(fs4.close);
567
- fs4.closeSync = function(fs$closeSync) {
568
- function closeSync(fd) {
569
- fs$closeSync.apply(fs4, arguments);
570
- resetQueue();
571
- }
572
- Object.defineProperty(closeSync, previousSymbol, {
573
- value: fs$closeSync
574
- });
575
- return closeSync;
576
- }(fs4.closeSync);
577
- if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
578
- process.on("exit", function() {
579
- debug2(fs4[gracefulQueue]);
580
- (0, import_chunk_AH6QHEOA.__require)("assert").equal(fs4[gracefulQueue].length, 0);
581
- });
582
- }
583
- }
584
- var queue;
585
- if (!global[gracefulQueue]) {
586
- publishQueue(global, fs4[gracefulQueue]);
587
- }
588
- module2.exports = patch(clone(fs4));
589
- if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs4.__patched) {
590
- module2.exports = patch(fs4);
591
- fs4.__patched = true;
592
- }
593
- function patch(fs5) {
594
- polyfills(fs5);
595
- fs5.gracefulify = patch;
596
- fs5.createReadStream = createReadStream;
597
- fs5.createWriteStream = createWriteStream;
598
- var fs$readFile = fs5.readFile;
599
- fs5.readFile = readFile;
600
- function readFile(path6, options, cb) {
601
- if (typeof options === "function")
602
- cb = options, options = null;
603
- return go$readFile(path6, options, cb);
604
- function go$readFile(path7, options2, cb2, startTime) {
605
- return fs$readFile(path7, options2, function(err) {
606
- if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
607
- enqueue([go$readFile, [path7, options2, cb2], err, startTime || Date.now(), Date.now()]);
608
- else {
609
- if (typeof cb2 === "function")
610
- cb2.apply(this, arguments);
611
- }
612
- });
613
- }
614
- }
615
- var fs$writeFile = fs5.writeFile;
616
- fs5.writeFile = writeFile;
617
- function writeFile(path6, data, options, cb) {
618
- if (typeof options === "function")
619
- cb = options, options = null;
620
- return go$writeFile(path6, data, options, cb);
621
- function go$writeFile(path7, data2, options2, cb2, startTime) {
622
- return fs$writeFile(path7, data2, options2, function(err) {
623
- if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
624
- enqueue([go$writeFile, [path7, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
625
- else {
626
- if (typeof cb2 === "function")
627
- cb2.apply(this, arguments);
628
- }
629
- });
630
- }
631
- }
632
- var fs$appendFile = fs5.appendFile;
633
- if (fs$appendFile)
634
- fs5.appendFile = appendFile;
635
- function appendFile(path6, data, options, cb) {
636
- if (typeof options === "function")
637
- cb = options, options = null;
638
- return go$appendFile(path6, data, options, cb);
639
- function go$appendFile(path7, data2, options2, cb2, startTime) {
640
- return fs$appendFile(path7, data2, options2, function(err) {
641
- if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
642
- enqueue([go$appendFile, [path7, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
643
- else {
644
- if (typeof cb2 === "function")
645
- cb2.apply(this, arguments);
646
- }
647
- });
648
- }
649
- }
650
- var fs$copyFile = fs5.copyFile;
651
- if (fs$copyFile)
652
- fs5.copyFile = copyFile;
653
- function copyFile(src, dest, flags, cb) {
654
- if (typeof flags === "function") {
655
- cb = flags;
656
- flags = 0;
657
- }
658
- return go$copyFile(src, dest, flags, cb);
659
- function go$copyFile(src2, dest2, flags2, cb2, startTime) {
660
- return fs$copyFile(src2, dest2, flags2, function(err) {
661
- if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
662
- enqueue([go$copyFile, [src2, dest2, flags2, cb2], err, startTime || Date.now(), Date.now()]);
663
- else {
664
- if (typeof cb2 === "function")
665
- cb2.apply(this, arguments);
666
- }
667
- });
668
- }
669
- }
670
- var fs$readdir = fs5.readdir;
671
- fs5.readdir = readdir;
672
- var noReaddirOptionVersions = /^v[0-5]\./;
673
- function readdir(path6, options, cb) {
674
- if (typeof options === "function")
675
- cb = options, options = null;
676
- var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path7, options2, cb2, startTime) {
677
- return fs$readdir(path7, fs$readdirCallback(
678
- path7,
679
- options2,
680
- cb2,
681
- startTime
682
- ));
683
- } : function go$readdir2(path7, options2, cb2, startTime) {
684
- return fs$readdir(path7, options2, fs$readdirCallback(
685
- path7,
686
- options2,
687
- cb2,
688
- startTime
689
- ));
690
- };
691
- return go$readdir(path6, options, cb);
692
- function fs$readdirCallback(path7, options2, cb2, startTime) {
693
- return function(err, files) {
694
- if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
695
- enqueue([
696
- go$readdir,
697
- [path7, options2, cb2],
698
- err,
699
- startTime || Date.now(),
700
- Date.now()
701
- ]);
702
- else {
703
- if (files && files.sort)
704
- files.sort();
705
- if (typeof cb2 === "function")
706
- cb2.call(this, err, files);
707
- }
708
- };
709
- }
710
- }
711
- if (process.version.substr(0, 4) === "v0.8") {
712
- var legStreams = legacy(fs5);
713
- ReadStream = legStreams.ReadStream;
714
- WriteStream = legStreams.WriteStream;
715
- }
716
- var fs$ReadStream = fs5.ReadStream;
717
- if (fs$ReadStream) {
718
- ReadStream.prototype = Object.create(fs$ReadStream.prototype);
719
- ReadStream.prototype.open = ReadStream$open;
720
- }
721
- var fs$WriteStream = fs5.WriteStream;
722
- if (fs$WriteStream) {
723
- WriteStream.prototype = Object.create(fs$WriteStream.prototype);
724
- WriteStream.prototype.open = WriteStream$open;
725
- }
726
- Object.defineProperty(fs5, "ReadStream", {
727
- get: function() {
728
- return ReadStream;
729
- },
730
- set: function(val) {
731
- ReadStream = val;
732
- },
733
- enumerable: true,
734
- configurable: true
735
- });
736
- Object.defineProperty(fs5, "WriteStream", {
737
- get: function() {
738
- return WriteStream;
739
- },
740
- set: function(val) {
741
- WriteStream = val;
742
- },
743
- enumerable: true,
744
- configurable: true
745
- });
746
- var FileReadStream = ReadStream;
747
- Object.defineProperty(fs5, "FileReadStream", {
748
- get: function() {
749
- return FileReadStream;
750
- },
751
- set: function(val) {
752
- FileReadStream = val;
753
- },
754
- enumerable: true,
755
- configurable: true
756
- });
757
- var FileWriteStream = WriteStream;
758
- Object.defineProperty(fs5, "FileWriteStream", {
759
- get: function() {
760
- return FileWriteStream;
761
- },
762
- set: function(val) {
763
- FileWriteStream = val;
764
- },
765
- enumerable: true,
766
- configurable: true
767
- });
768
- function ReadStream(path6, options) {
769
- if (this instanceof ReadStream)
770
- return fs$ReadStream.apply(this, arguments), this;
771
- else
772
- return ReadStream.apply(Object.create(ReadStream.prototype), arguments);
773
- }
774
- function ReadStream$open() {
775
- var that = this;
776
- open(that.path, that.flags, that.mode, function(err, fd) {
777
- if (err) {
778
- if (that.autoClose)
779
- that.destroy();
780
- that.emit("error", err);
781
- } else {
782
- that.fd = fd;
783
- that.emit("open", fd);
784
- that.read();
785
- }
786
- });
787
- }
788
- function WriteStream(path6, options) {
789
- if (this instanceof WriteStream)
790
- return fs$WriteStream.apply(this, arguments), this;
791
- else
792
- return WriteStream.apply(Object.create(WriteStream.prototype), arguments);
793
- }
794
- function WriteStream$open() {
795
- var that = this;
796
- open(that.path, that.flags, that.mode, function(err, fd) {
797
- if (err) {
798
- that.destroy();
799
- that.emit("error", err);
800
- } else {
801
- that.fd = fd;
802
- that.emit("open", fd);
803
- }
804
- });
805
- }
806
- function createReadStream(path6, options) {
807
- return new fs5.ReadStream(path6, options);
808
- }
809
- function createWriteStream(path6, options) {
810
- return new fs5.WriteStream(path6, options);
811
- }
812
- var fs$open = fs5.open;
813
- fs5.open = open;
814
- function open(path6, flags, mode, cb) {
815
- if (typeof mode === "function")
816
- cb = mode, mode = null;
817
- return go$open(path6, flags, mode, cb);
818
- function go$open(path7, flags2, mode2, cb2, startTime) {
819
- return fs$open(path7, flags2, mode2, function(err, fd) {
820
- if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
821
- enqueue([go$open, [path7, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
822
- else {
823
- if (typeof cb2 === "function")
824
- cb2.apply(this, arguments);
825
- }
826
- });
827
- }
828
- }
829
- return fs5;
830
- }
831
- function enqueue(elem) {
832
- debug2("ENQUEUE", elem[0].name, elem[1]);
833
- fs4[gracefulQueue].push(elem);
834
- retry();
835
- }
836
- var retryTimer;
837
- function resetQueue() {
838
- var now = Date.now();
839
- for (var i = 0; i < fs4[gracefulQueue].length; ++i) {
840
- if (fs4[gracefulQueue][i].length > 2) {
841
- fs4[gracefulQueue][i][3] = now;
842
- fs4[gracefulQueue][i][4] = now;
843
- }
844
- }
845
- retry();
846
- }
847
- function retry() {
848
- clearTimeout(retryTimer);
849
- retryTimer = void 0;
850
- if (fs4[gracefulQueue].length === 0)
851
- return;
852
- var elem = fs4[gracefulQueue].shift();
853
- var fn = elem[0];
854
- var args = elem[1];
855
- var err = elem[2];
856
- var startTime = elem[3];
857
- var lastTime = elem[4];
858
- if (startTime === void 0) {
859
- debug2("RETRY", fn.name, args);
860
- fn.apply(null, args);
861
- } else if (Date.now() - startTime >= 6e4) {
862
- debug2("TIMEOUT", fn.name, args);
863
- var cb = args.pop();
864
- if (typeof cb === "function")
865
- cb.call(null, err);
866
- } else {
867
- var sinceAttempt = Date.now() - lastTime;
868
- var sinceStart = Math.max(lastTime - startTime, 1);
869
- var desiredDelay = Math.min(sinceStart * 1.2, 100);
870
- if (sinceAttempt >= desiredDelay) {
871
- debug2("RETRY", fn.name, args);
872
- fn.apply(null, args.concat([startTime]));
873
- } else {
874
- fs4[gracefulQueue].push(elem);
875
- }
876
- }
877
- if (retryTimer === void 0) {
878
- retryTimer = setTimeout(retry, 0);
879
- }
880
- }
881
- }
882
- });
883
- var require_fs = (0, import_chunk_AH6QHEOA.__commonJS)({
884
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/fs/index.js"(exports) {
885
- "use strict";
886
- var u = require_universalify().fromCallback;
887
- var fs4 = require_graceful_fs();
888
- var api = [
889
- "access",
890
- "appendFile",
891
- "chmod",
892
- "chown",
893
- "close",
894
- "copyFile",
895
- "fchmod",
896
- "fchown",
897
- "fdatasync",
898
- "fstat",
899
- "fsync",
900
- "ftruncate",
901
- "futimes",
902
- "lchmod",
903
- "lchown",
904
- "link",
905
- "lstat",
906
- "mkdir",
907
- "mkdtemp",
908
- "open",
909
- "opendir",
910
- "readdir",
911
- "readFile",
912
- "readlink",
913
- "realpath",
914
- "rename",
915
- "rm",
916
- "rmdir",
917
- "stat",
918
- "symlink",
919
- "truncate",
920
- "unlink",
921
- "utimes",
922
- "writeFile"
923
- ].filter((key) => {
924
- return typeof fs4[key] === "function";
925
- });
926
- Object.assign(exports, fs4);
927
- api.forEach((method) => {
928
- exports[method] = u(fs4[method]);
929
- });
930
- exports.exists = function(filename, callback) {
931
- if (typeof callback === "function") {
932
- return fs4.exists(filename, callback);
933
- }
934
- return new Promise((resolve) => {
935
- return fs4.exists(filename, resolve);
936
- });
937
- };
938
- exports.read = function(fd, buffer, offset, length, position, callback) {
939
- if (typeof callback === "function") {
940
- return fs4.read(fd, buffer, offset, length, position, callback);
941
- }
942
- return new Promise((resolve, reject) => {
943
- fs4.read(fd, buffer, offset, length, position, (err, bytesRead, buffer2) => {
944
- if (err) return reject(err);
945
- resolve({ bytesRead, buffer: buffer2 });
946
- });
947
- });
948
- };
949
- exports.write = function(fd, buffer, ...args) {
950
- if (typeof args[args.length - 1] === "function") {
951
- return fs4.write(fd, buffer, ...args);
952
- }
953
- return new Promise((resolve, reject) => {
954
- fs4.write(fd, buffer, ...args, (err, bytesWritten, buffer2) => {
955
- if (err) return reject(err);
956
- resolve({ bytesWritten, buffer: buffer2 });
957
- });
958
- });
959
- };
960
- exports.readv = function(fd, buffers, ...args) {
961
- if (typeof args[args.length - 1] === "function") {
962
- return fs4.readv(fd, buffers, ...args);
963
- }
964
- return new Promise((resolve, reject) => {
965
- fs4.readv(fd, buffers, ...args, (err, bytesRead, buffers2) => {
966
- if (err) return reject(err);
967
- resolve({ bytesRead, buffers: buffers2 });
968
- });
969
- });
970
- };
971
- exports.writev = function(fd, buffers, ...args) {
972
- if (typeof args[args.length - 1] === "function") {
973
- return fs4.writev(fd, buffers, ...args);
974
- }
975
- return new Promise((resolve, reject) => {
976
- fs4.writev(fd, buffers, ...args, (err, bytesWritten, buffers2) => {
977
- if (err) return reject(err);
978
- resolve({ bytesWritten, buffers: buffers2 });
979
- });
980
- });
981
- };
982
- if (typeof fs4.realpath.native === "function") {
983
- exports.realpath.native = u(fs4.realpath.native);
984
- } else {
985
- process.emitWarning(
986
- "fs.realpath.native is not a function. Is fs being monkey-patched?",
987
- "Warning",
988
- "fs-extra-WARN0003"
989
- );
990
- }
991
- }
992
- });
993
- var require_utils = (0, import_chunk_AH6QHEOA.__commonJS)({
994
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/mkdirs/utils.js"(exports, module2) {
995
- "use strict";
996
- var path6 = (0, import_chunk_AH6QHEOA.__require)("path");
997
- module2.exports.checkPath = function checkPath(pth) {
998
- if (process.platform === "win32") {
999
- const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path6.parse(pth).root, ""));
1000
- if (pathHasInvalidWinCharacters) {
1001
- const error = new Error(`Path contains invalid characters: ${pth}`);
1002
- error.code = "EINVAL";
1003
- throw error;
1004
- }
1005
- }
1006
- };
1007
- }
1008
- });
1009
- var require_make_dir = (0, import_chunk_AH6QHEOA.__commonJS)({
1010
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/mkdirs/make-dir.js"(exports, module2) {
1011
- "use strict";
1012
- var fs4 = require_fs();
1013
- var { checkPath } = require_utils();
1014
- var getMode = (options) => {
1015
- const defaults = { mode: 511 };
1016
- if (typeof options === "number") return options;
1017
- return { ...defaults, ...options }.mode;
1018
- };
1019
- module2.exports.makeDir = async (dir, options) => {
1020
- checkPath(dir);
1021
- return fs4.mkdir(dir, {
1022
- mode: getMode(options),
1023
- recursive: true
1024
- });
1025
- };
1026
- module2.exports.makeDirSync = (dir, options) => {
1027
- checkPath(dir);
1028
- return fs4.mkdirSync(dir, {
1029
- mode: getMode(options),
1030
- recursive: true
1031
- });
1032
- };
1033
- }
1034
- });
1035
- var require_mkdirs = (0, import_chunk_AH6QHEOA.__commonJS)({
1036
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/mkdirs/index.js"(exports, module2) {
1037
- "use strict";
1038
- var u = require_universalify().fromPromise;
1039
- var { makeDir: _makeDir, makeDirSync } = require_make_dir();
1040
- var makeDir = u(_makeDir);
1041
- module2.exports = {
1042
- mkdirs: makeDir,
1043
- mkdirsSync: makeDirSync,
1044
- // alias
1045
- mkdirp: makeDir,
1046
- mkdirpSync: makeDirSync,
1047
- ensureDir: makeDir,
1048
- ensureDirSync: makeDirSync
1049
- };
1050
- }
1051
- });
1052
- var require_path_exists = (0, import_chunk_AH6QHEOA.__commonJS)({
1053
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/path-exists/index.js"(exports, module2) {
1054
- "use strict";
1055
- var u = require_universalify().fromPromise;
1056
- var fs4 = require_fs();
1057
- function pathExists2(path6) {
1058
- return fs4.access(path6).then(() => true).catch(() => false);
1059
- }
1060
- module2.exports = {
1061
- pathExists: u(pathExists2),
1062
- pathExistsSync: fs4.existsSync
1063
- };
1064
- }
1065
- });
1066
- var require_utimes = (0, import_chunk_AH6QHEOA.__commonJS)({
1067
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/util/utimes.js"(exports, module2) {
1068
- "use strict";
1069
- var fs4 = require_graceful_fs();
1070
- function utimesMillis(path6, atime, mtime, callback) {
1071
- fs4.open(path6, "r+", (err, fd) => {
1072
- if (err) return callback(err);
1073
- fs4.futimes(fd, atime, mtime, (futimesErr) => {
1074
- fs4.close(fd, (closeErr) => {
1075
- if (callback) callback(futimesErr || closeErr);
1076
- });
1077
- });
1078
- });
1079
- }
1080
- function utimesMillisSync(path6, atime, mtime) {
1081
- const fd = fs4.openSync(path6, "r+");
1082
- fs4.futimesSync(fd, atime, mtime);
1083
- return fs4.closeSync(fd);
1084
- }
1085
- module2.exports = {
1086
- utimesMillis,
1087
- utimesMillisSync
1088
- };
1089
- }
1090
- });
1091
- var require_stat = (0, import_chunk_AH6QHEOA.__commonJS)({
1092
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/util/stat.js"(exports, module2) {
1093
- "use strict";
1094
- var fs4 = require_fs();
1095
- var path6 = (0, import_chunk_AH6QHEOA.__require)("path");
1096
- var util = (0, import_chunk_AH6QHEOA.__require)("util");
1097
- function getStats(src, dest, opts) {
1098
- const statFunc = opts.dereference ? (file) => fs4.stat(file, { bigint: true }) : (file) => fs4.lstat(file, { bigint: true });
1099
- return Promise.all([
1100
- statFunc(src),
1101
- statFunc(dest).catch((err) => {
1102
- if (err.code === "ENOENT") return null;
1103
- throw err;
1104
- })
1105
- ]).then(([srcStat, destStat]) => ({ srcStat, destStat }));
1106
- }
1107
- function getStatsSync(src, dest, opts) {
1108
- let destStat;
1109
- const statFunc = opts.dereference ? (file) => fs4.statSync(file, { bigint: true }) : (file) => fs4.lstatSync(file, { bigint: true });
1110
- const srcStat = statFunc(src);
1111
- try {
1112
- destStat = statFunc(dest);
1113
- } catch (err) {
1114
- if (err.code === "ENOENT") return { srcStat, destStat: null };
1115
- throw err;
1116
- }
1117
- return { srcStat, destStat };
1118
- }
1119
- function checkPaths(src, dest, funcName, opts, cb) {
1120
- util.callbackify(getStats)(src, dest, opts, (err, stats) => {
1121
- if (err) return cb(err);
1122
- const { srcStat, destStat } = stats;
1123
- if (destStat) {
1124
- if (areIdentical(srcStat, destStat)) {
1125
- const srcBaseName = path6.basename(src);
1126
- const destBaseName = path6.basename(dest);
1127
- if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
1128
- return cb(null, { srcStat, destStat, isChangingCase: true });
1129
- }
1130
- return cb(new Error("Source and destination must not be the same."));
1131
- }
1132
- if (srcStat.isDirectory() && !destStat.isDirectory()) {
1133
- return cb(new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`));
1134
- }
1135
- if (!srcStat.isDirectory() && destStat.isDirectory()) {
1136
- return cb(new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`));
1137
- }
1138
- }
1139
- if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
1140
- return cb(new Error(errMsg(src, dest, funcName)));
1141
- }
1142
- return cb(null, { srcStat, destStat });
1143
- });
1144
- }
1145
- function checkPathsSync(src, dest, funcName, opts) {
1146
- const { srcStat, destStat } = getStatsSync(src, dest, opts);
1147
- if (destStat) {
1148
- if (areIdentical(srcStat, destStat)) {
1149
- const srcBaseName = path6.basename(src);
1150
- const destBaseName = path6.basename(dest);
1151
- if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
1152
- return { srcStat, destStat, isChangingCase: true };
1153
- }
1154
- throw new Error("Source and destination must not be the same.");
1155
- }
1156
- if (srcStat.isDirectory() && !destStat.isDirectory()) {
1157
- throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`);
1158
- }
1159
- if (!srcStat.isDirectory() && destStat.isDirectory()) {
1160
- throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`);
1161
- }
1162
- }
1163
- if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
1164
- throw new Error(errMsg(src, dest, funcName));
1165
- }
1166
- return { srcStat, destStat };
1167
- }
1168
- function checkParentPaths(src, srcStat, dest, funcName, cb) {
1169
- const srcParent = path6.resolve(path6.dirname(src));
1170
- const destParent = path6.resolve(path6.dirname(dest));
1171
- if (destParent === srcParent || destParent === path6.parse(destParent).root) return cb();
1172
- fs4.stat(destParent, { bigint: true }, (err, destStat) => {
1173
- if (err) {
1174
- if (err.code === "ENOENT") return cb();
1175
- return cb(err);
1176
- }
1177
- if (areIdentical(srcStat, destStat)) {
1178
- return cb(new Error(errMsg(src, dest, funcName)));
1179
- }
1180
- return checkParentPaths(src, srcStat, destParent, funcName, cb);
1181
- });
1182
- }
1183
- function checkParentPathsSync(src, srcStat, dest, funcName) {
1184
- const srcParent = path6.resolve(path6.dirname(src));
1185
- const destParent = path6.resolve(path6.dirname(dest));
1186
- if (destParent === srcParent || destParent === path6.parse(destParent).root) return;
1187
- let destStat;
1188
- try {
1189
- destStat = fs4.statSync(destParent, { bigint: true });
1190
- } catch (err) {
1191
- if (err.code === "ENOENT") return;
1192
- throw err;
1193
- }
1194
- if (areIdentical(srcStat, destStat)) {
1195
- throw new Error(errMsg(src, dest, funcName));
1196
- }
1197
- return checkParentPathsSync(src, srcStat, destParent, funcName);
1198
- }
1199
- function areIdentical(srcStat, destStat) {
1200
- return destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev;
1201
- }
1202
- function isSrcSubdir(src, dest) {
1203
- const srcArr = path6.resolve(src).split(path6.sep).filter((i) => i);
1204
- const destArr = path6.resolve(dest).split(path6.sep).filter((i) => i);
1205
- return srcArr.reduce((acc, cur, i) => acc && destArr[i] === cur, true);
1206
- }
1207
- function errMsg(src, dest, funcName) {
1208
- return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`;
1209
- }
1210
- module2.exports = {
1211
- checkPaths,
1212
- checkPathsSync,
1213
- checkParentPaths,
1214
- checkParentPathsSync,
1215
- isSrcSubdir,
1216
- areIdentical
1217
- };
1218
- }
1219
- });
1220
- var require_copy = (0, import_chunk_AH6QHEOA.__commonJS)({
1221
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/copy/copy.js"(exports, module2) {
1222
- "use strict";
1223
- var fs4 = require_graceful_fs();
1224
- var path6 = (0, import_chunk_AH6QHEOA.__require)("path");
1225
- var mkdirs = require_mkdirs().mkdirs;
1226
- var pathExists2 = require_path_exists().pathExists;
1227
- var utimesMillis = require_utimes().utimesMillis;
1228
- var stat = require_stat();
1229
- function copy(src, dest, opts, cb) {
1230
- if (typeof opts === "function" && !cb) {
1231
- cb = opts;
1232
- opts = {};
1233
- } else if (typeof opts === "function") {
1234
- opts = { filter: opts };
1235
- }
1236
- cb = cb || function() {
1237
- };
1238
- opts = opts || {};
1239
- opts.clobber = "clobber" in opts ? !!opts.clobber : true;
1240
- opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber;
1241
- if (opts.preserveTimestamps && process.arch === "ia32") {
1242
- process.emitWarning(
1243
- "Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269",
1244
- "Warning",
1245
- "fs-extra-WARN0001"
1246
- );
1247
- }
1248
- stat.checkPaths(src, dest, "copy", opts, (err, stats) => {
1249
- if (err) return cb(err);
1250
- const { srcStat, destStat } = stats;
1251
- stat.checkParentPaths(src, srcStat, dest, "copy", (err2) => {
1252
- if (err2) return cb(err2);
1253
- runFilter(src, dest, opts, (err3, include) => {
1254
- if (err3) return cb(err3);
1255
- if (!include) return cb();
1256
- checkParentDir(destStat, src, dest, opts, cb);
1257
- });
1258
- });
1259
- });
1260
- }
1261
- function checkParentDir(destStat, src, dest, opts, cb) {
1262
- const destParent = path6.dirname(dest);
1263
- pathExists2(destParent, (err, dirExists) => {
1264
- if (err) return cb(err);
1265
- if (dirExists) return getStats(destStat, src, dest, opts, cb);
1266
- mkdirs(destParent, (err2) => {
1267
- if (err2) return cb(err2);
1268
- return getStats(destStat, src, dest, opts, cb);
1269
- });
1270
- });
1271
- }
1272
- function runFilter(src, dest, opts, cb) {
1273
- if (!opts.filter) return cb(null, true);
1274
- Promise.resolve(opts.filter(src, dest)).then((include) => cb(null, include), (error) => cb(error));
1275
- }
1276
- function getStats(destStat, src, dest, opts, cb) {
1277
- const stat2 = opts.dereference ? fs4.stat : fs4.lstat;
1278
- stat2(src, (err, srcStat) => {
1279
- if (err) return cb(err);
1280
- if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts, cb);
1281
- else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts, cb);
1282
- else if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts, cb);
1283
- else if (srcStat.isSocket()) return cb(new Error(`Cannot copy a socket file: ${src}`));
1284
- else if (srcStat.isFIFO()) return cb(new Error(`Cannot copy a FIFO pipe: ${src}`));
1285
- return cb(new Error(`Unknown file: ${src}`));
1286
- });
1287
- }
1288
- function onFile(srcStat, destStat, src, dest, opts, cb) {
1289
- if (!destStat) return copyFile(srcStat, src, dest, opts, cb);
1290
- return mayCopyFile(srcStat, src, dest, opts, cb);
1291
- }
1292
- function mayCopyFile(srcStat, src, dest, opts, cb) {
1293
- if (opts.overwrite) {
1294
- fs4.unlink(dest, (err) => {
1295
- if (err) return cb(err);
1296
- return copyFile(srcStat, src, dest, opts, cb);
1297
- });
1298
- } else if (opts.errorOnExist) {
1299
- return cb(new Error(`'${dest}' already exists`));
1300
- } else return cb();
1301
- }
1302
- function copyFile(srcStat, src, dest, opts, cb) {
1303
- fs4.copyFile(src, dest, (err) => {
1304
- if (err) return cb(err);
1305
- if (opts.preserveTimestamps) return handleTimestampsAndMode(srcStat.mode, src, dest, cb);
1306
- return setDestMode(dest, srcStat.mode, cb);
1307
- });
1308
- }
1309
- function handleTimestampsAndMode(srcMode, src, dest, cb) {
1310
- if (fileIsNotWritable(srcMode)) {
1311
- return makeFileWritable(dest, srcMode, (err) => {
1312
- if (err) return cb(err);
1313
- return setDestTimestampsAndMode(srcMode, src, dest, cb);
1314
- });
1315
- }
1316
- return setDestTimestampsAndMode(srcMode, src, dest, cb);
1317
- }
1318
- function fileIsNotWritable(srcMode) {
1319
- return (srcMode & 128) === 0;
1320
- }
1321
- function makeFileWritable(dest, srcMode, cb) {
1322
- return setDestMode(dest, srcMode | 128, cb);
1323
- }
1324
- function setDestTimestampsAndMode(srcMode, src, dest, cb) {
1325
- setDestTimestamps(src, dest, (err) => {
1326
- if (err) return cb(err);
1327
- return setDestMode(dest, srcMode, cb);
1328
- });
1329
- }
1330
- function setDestMode(dest, srcMode, cb) {
1331
- return fs4.chmod(dest, srcMode, cb);
1332
- }
1333
- function setDestTimestamps(src, dest, cb) {
1334
- fs4.stat(src, (err, updatedSrcStat) => {
1335
- if (err) return cb(err);
1336
- return utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime, cb);
1337
- });
1338
- }
1339
- function onDir(srcStat, destStat, src, dest, opts, cb) {
1340
- if (!destStat) return mkDirAndCopy(srcStat.mode, src, dest, opts, cb);
1341
- return copyDir(src, dest, opts, cb);
1342
- }
1343
- function mkDirAndCopy(srcMode, src, dest, opts, cb) {
1344
- fs4.mkdir(dest, (err) => {
1345
- if (err) return cb(err);
1346
- copyDir(src, dest, opts, (err2) => {
1347
- if (err2) return cb(err2);
1348
- return setDestMode(dest, srcMode, cb);
1349
- });
1350
- });
1351
- }
1352
- function copyDir(src, dest, opts, cb) {
1353
- fs4.readdir(src, (err, items) => {
1354
- if (err) return cb(err);
1355
- return copyDirItems(items, src, dest, opts, cb);
1356
- });
1357
- }
1358
- function copyDirItems(items, src, dest, opts, cb) {
1359
- const item = items.pop();
1360
- if (!item) return cb();
1361
- return copyDirItem(items, item, src, dest, opts, cb);
1362
- }
1363
- function copyDirItem(items, item, src, dest, opts, cb) {
1364
- const srcItem = path6.join(src, item);
1365
- const destItem = path6.join(dest, item);
1366
- runFilter(srcItem, destItem, opts, (err, include) => {
1367
- if (err) return cb(err);
1368
- if (!include) return copyDirItems(items, src, dest, opts, cb);
1369
- stat.checkPaths(srcItem, destItem, "copy", opts, (err2, stats) => {
1370
- if (err2) return cb(err2);
1371
- const { destStat } = stats;
1372
- getStats(destStat, srcItem, destItem, opts, (err3) => {
1373
- if (err3) return cb(err3);
1374
- return copyDirItems(items, src, dest, opts, cb);
1375
- });
1376
- });
1377
- });
1378
- }
1379
- function onLink(destStat, src, dest, opts, cb) {
1380
- fs4.readlink(src, (err, resolvedSrc) => {
1381
- if (err) return cb(err);
1382
- if (opts.dereference) {
1383
- resolvedSrc = path6.resolve(process.cwd(), resolvedSrc);
1384
- }
1385
- if (!destStat) {
1386
- return fs4.symlink(resolvedSrc, dest, cb);
1387
- } else {
1388
- fs4.readlink(dest, (err2, resolvedDest) => {
1389
- if (err2) {
1390
- if (err2.code === "EINVAL" || err2.code === "UNKNOWN") return fs4.symlink(resolvedSrc, dest, cb);
1391
- return cb(err2);
1392
- }
1393
- if (opts.dereference) {
1394
- resolvedDest = path6.resolve(process.cwd(), resolvedDest);
1395
- }
1396
- if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
1397
- return cb(new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`));
1398
- }
1399
- if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
1400
- return cb(new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`));
1401
- }
1402
- return copyLink(resolvedSrc, dest, cb);
1403
- });
1404
- }
1405
- });
1406
- }
1407
- function copyLink(resolvedSrc, dest, cb) {
1408
- fs4.unlink(dest, (err) => {
1409
- if (err) return cb(err);
1410
- return fs4.symlink(resolvedSrc, dest, cb);
1411
- });
1412
- }
1413
- module2.exports = copy;
1414
- }
1415
- });
1416
- var require_copy_sync = (0, import_chunk_AH6QHEOA.__commonJS)({
1417
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/copy/copy-sync.js"(exports, module2) {
1418
- "use strict";
1419
- var fs4 = require_graceful_fs();
1420
- var path6 = (0, import_chunk_AH6QHEOA.__require)("path");
1421
- var mkdirsSync = require_mkdirs().mkdirsSync;
1422
- var utimesMillisSync = require_utimes().utimesMillisSync;
1423
- var stat = require_stat();
1424
- function copySync(src, dest, opts) {
1425
- if (typeof opts === "function") {
1426
- opts = { filter: opts };
1427
- }
1428
- opts = opts || {};
1429
- opts.clobber = "clobber" in opts ? !!opts.clobber : true;
1430
- opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber;
1431
- if (opts.preserveTimestamps && process.arch === "ia32") {
1432
- process.emitWarning(
1433
- "Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269",
1434
- "Warning",
1435
- "fs-extra-WARN0002"
1436
- );
1437
- }
1438
- const { srcStat, destStat } = stat.checkPathsSync(src, dest, "copy", opts);
1439
- stat.checkParentPathsSync(src, srcStat, dest, "copy");
1440
- if (opts.filter && !opts.filter(src, dest)) return;
1441
- const destParent = path6.dirname(dest);
1442
- if (!fs4.existsSync(destParent)) mkdirsSync(destParent);
1443
- return getStats(destStat, src, dest, opts);
1444
- }
1445
- function getStats(destStat, src, dest, opts) {
1446
- const statSync = opts.dereference ? fs4.statSync : fs4.lstatSync;
1447
- const srcStat = statSync(src);
1448
- if (srcStat.isDirectory()) return onDir(srcStat, destStat, src, dest, opts);
1449
- else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice()) return onFile(srcStat, destStat, src, dest, opts);
1450
- else if (srcStat.isSymbolicLink()) return onLink(destStat, src, dest, opts);
1451
- else if (srcStat.isSocket()) throw new Error(`Cannot copy a socket file: ${src}`);
1452
- else if (srcStat.isFIFO()) throw new Error(`Cannot copy a FIFO pipe: ${src}`);
1453
- throw new Error(`Unknown file: ${src}`);
1454
- }
1455
- function onFile(srcStat, destStat, src, dest, opts) {
1456
- if (!destStat) return copyFile(srcStat, src, dest, opts);
1457
- return mayCopyFile(srcStat, src, dest, opts);
1458
- }
1459
- function mayCopyFile(srcStat, src, dest, opts) {
1460
- if (opts.overwrite) {
1461
- fs4.unlinkSync(dest);
1462
- return copyFile(srcStat, src, dest, opts);
1463
- } else if (opts.errorOnExist) {
1464
- throw new Error(`'${dest}' already exists`);
1465
- }
1466
- }
1467
- function copyFile(srcStat, src, dest, opts) {
1468
- fs4.copyFileSync(src, dest);
1469
- if (opts.preserveTimestamps) handleTimestamps(srcStat.mode, src, dest);
1470
- return setDestMode(dest, srcStat.mode);
1471
- }
1472
- function handleTimestamps(srcMode, src, dest) {
1473
- if (fileIsNotWritable(srcMode)) makeFileWritable(dest, srcMode);
1474
- return setDestTimestamps(src, dest);
1475
- }
1476
- function fileIsNotWritable(srcMode) {
1477
- return (srcMode & 128) === 0;
1478
- }
1479
- function makeFileWritable(dest, srcMode) {
1480
- return setDestMode(dest, srcMode | 128);
1481
- }
1482
- function setDestMode(dest, srcMode) {
1483
- return fs4.chmodSync(dest, srcMode);
1484
- }
1485
- function setDestTimestamps(src, dest) {
1486
- const updatedSrcStat = fs4.statSync(src);
1487
- return utimesMillisSync(dest, updatedSrcStat.atime, updatedSrcStat.mtime);
1488
- }
1489
- function onDir(srcStat, destStat, src, dest, opts) {
1490
- if (!destStat) return mkDirAndCopy(srcStat.mode, src, dest, opts);
1491
- return copyDir(src, dest, opts);
1492
- }
1493
- function mkDirAndCopy(srcMode, src, dest, opts) {
1494
- fs4.mkdirSync(dest);
1495
- copyDir(src, dest, opts);
1496
- return setDestMode(dest, srcMode);
1497
- }
1498
- function copyDir(src, dest, opts) {
1499
- fs4.readdirSync(src).forEach((item) => copyDirItem(item, src, dest, opts));
1500
- }
1501
- function copyDirItem(item, src, dest, opts) {
1502
- const srcItem = path6.join(src, item);
1503
- const destItem = path6.join(dest, item);
1504
- if (opts.filter && !opts.filter(srcItem, destItem)) return;
1505
- const { destStat } = stat.checkPathsSync(srcItem, destItem, "copy", opts);
1506
- return getStats(destStat, srcItem, destItem, opts);
1507
- }
1508
- function onLink(destStat, src, dest, opts) {
1509
- let resolvedSrc = fs4.readlinkSync(src);
1510
- if (opts.dereference) {
1511
- resolvedSrc = path6.resolve(process.cwd(), resolvedSrc);
1512
- }
1513
- if (!destStat) {
1514
- return fs4.symlinkSync(resolvedSrc, dest);
1515
- } else {
1516
- let resolvedDest;
1517
- try {
1518
- resolvedDest = fs4.readlinkSync(dest);
1519
- } catch (err) {
1520
- if (err.code === "EINVAL" || err.code === "UNKNOWN") return fs4.symlinkSync(resolvedSrc, dest);
1521
- throw err;
1522
- }
1523
- if (opts.dereference) {
1524
- resolvedDest = path6.resolve(process.cwd(), resolvedDest);
1525
- }
1526
- if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
1527
- throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`);
1528
- }
1529
- if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
1530
- throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`);
1531
- }
1532
- return copyLink(resolvedSrc, dest);
1533
- }
1534
- }
1535
- function copyLink(resolvedSrc, dest) {
1536
- fs4.unlinkSync(dest);
1537
- return fs4.symlinkSync(resolvedSrc, dest);
1538
- }
1539
- module2.exports = copySync;
1540
- }
1541
- });
1542
- var require_copy2 = (0, import_chunk_AH6QHEOA.__commonJS)({
1543
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/copy/index.js"(exports, module2) {
1544
- "use strict";
1545
- var u = require_universalify().fromCallback;
1546
- module2.exports = {
1547
- copy: u(require_copy()),
1548
- copySync: require_copy_sync()
1549
- };
1550
- }
1551
- });
1552
- var require_remove = (0, import_chunk_AH6QHEOA.__commonJS)({
1553
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/remove/index.js"(exports, module2) {
1554
- "use strict";
1555
- var fs4 = require_graceful_fs();
1556
- var u = require_universalify().fromCallback;
1557
- function remove(path6, callback) {
1558
- fs4.rm(path6, { recursive: true, force: true }, callback);
1559
- }
1560
- function removeSync(path6) {
1561
- fs4.rmSync(path6, { recursive: true, force: true });
1562
- }
1563
- module2.exports = {
1564
- remove: u(remove),
1565
- removeSync
1566
- };
1567
- }
1568
- });
1569
- var require_empty = (0, import_chunk_AH6QHEOA.__commonJS)({
1570
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/empty/index.js"(exports, module2) {
1571
- "use strict";
1572
- var u = require_universalify().fromPromise;
1573
- var fs4 = require_fs();
1574
- var path6 = (0, import_chunk_AH6QHEOA.__require)("path");
1575
- var mkdir = require_mkdirs();
1576
- var remove = require_remove();
1577
- var emptyDir = u(async function emptyDir2(dir) {
1578
- let items;
1579
- try {
1580
- items = await fs4.readdir(dir);
1581
- } catch {
1582
- return mkdir.mkdirs(dir);
1583
- }
1584
- return Promise.all(items.map((item) => remove.remove(path6.join(dir, item))));
1585
- });
1586
- function emptyDirSync(dir) {
1587
- let items;
1588
- try {
1589
- items = fs4.readdirSync(dir);
1590
- } catch {
1591
- return mkdir.mkdirsSync(dir);
1592
- }
1593
- items.forEach((item) => {
1594
- item = path6.join(dir, item);
1595
- remove.removeSync(item);
1596
- });
1597
- }
1598
- module2.exports = {
1599
- emptyDirSync,
1600
- emptydirSync: emptyDirSync,
1601
- emptyDir,
1602
- emptydir: emptyDir
1603
- };
1604
- }
1605
- });
1606
- var require_file = (0, import_chunk_AH6QHEOA.__commonJS)({
1607
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/ensure/file.js"(exports, module2) {
1608
- "use strict";
1609
- var u = require_universalify().fromCallback;
1610
- var path6 = (0, import_chunk_AH6QHEOA.__require)("path");
1611
- var fs4 = require_graceful_fs();
1612
- var mkdir = require_mkdirs();
1613
- function createFile(file, callback) {
1614
- function makeFile() {
1615
- fs4.writeFile(file, "", (err) => {
1616
- if (err) return callback(err);
1617
- callback();
1618
- });
1619
- }
1620
- fs4.stat(file, (err, stats) => {
1621
- if (!err && stats.isFile()) return callback();
1622
- const dir = path6.dirname(file);
1623
- fs4.stat(dir, (err2, stats2) => {
1624
- if (err2) {
1625
- if (err2.code === "ENOENT") {
1626
- return mkdir.mkdirs(dir, (err3) => {
1627
- if (err3) return callback(err3);
1628
- makeFile();
1629
- });
1630
- }
1631
- return callback(err2);
1632
- }
1633
- if (stats2.isDirectory()) makeFile();
1634
- else {
1635
- fs4.readdir(dir, (err3) => {
1636
- if (err3) return callback(err3);
1637
- });
1638
- }
1639
- });
1640
- });
1641
- }
1642
- function createFileSync(file) {
1643
- let stats;
1644
- try {
1645
- stats = fs4.statSync(file);
1646
- } catch {
1647
- }
1648
- if (stats && stats.isFile()) return;
1649
- const dir = path6.dirname(file);
1650
- try {
1651
- if (!fs4.statSync(dir).isDirectory()) {
1652
- fs4.readdirSync(dir);
1653
- }
1654
- } catch (err) {
1655
- if (err && err.code === "ENOENT") mkdir.mkdirsSync(dir);
1656
- else throw err;
1657
- }
1658
- fs4.writeFileSync(file, "");
1659
- }
1660
- module2.exports = {
1661
- createFile: u(createFile),
1662
- createFileSync
1663
- };
1664
- }
1665
- });
1666
- var require_link = (0, import_chunk_AH6QHEOA.__commonJS)({
1667
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/ensure/link.js"(exports, module2) {
1668
- "use strict";
1669
- var u = require_universalify().fromCallback;
1670
- var path6 = (0, import_chunk_AH6QHEOA.__require)("path");
1671
- var fs4 = require_graceful_fs();
1672
- var mkdir = require_mkdirs();
1673
- var pathExists2 = require_path_exists().pathExists;
1674
- var { areIdentical } = require_stat();
1675
- function createLink(srcpath, dstpath, callback) {
1676
- function makeLink(srcpath2, dstpath2) {
1677
- fs4.link(srcpath2, dstpath2, (err) => {
1678
- if (err) return callback(err);
1679
- callback(null);
1680
- });
1681
- }
1682
- fs4.lstat(dstpath, (_, dstStat) => {
1683
- fs4.lstat(srcpath, (err, srcStat) => {
1684
- if (err) {
1685
- err.message = err.message.replace("lstat", "ensureLink");
1686
- return callback(err);
1687
- }
1688
- if (dstStat && areIdentical(srcStat, dstStat)) return callback(null);
1689
- const dir = path6.dirname(dstpath);
1690
- pathExists2(dir, (err2, dirExists) => {
1691
- if (err2) return callback(err2);
1692
- if (dirExists) return makeLink(srcpath, dstpath);
1693
- mkdir.mkdirs(dir, (err3) => {
1694
- if (err3) return callback(err3);
1695
- makeLink(srcpath, dstpath);
1696
- });
1697
- });
1698
- });
1699
- });
1700
- }
1701
- function createLinkSync(srcpath, dstpath) {
1702
- let dstStat;
1703
- try {
1704
- dstStat = fs4.lstatSync(dstpath);
1705
- } catch {
1706
- }
1707
- try {
1708
- const srcStat = fs4.lstatSync(srcpath);
1709
- if (dstStat && areIdentical(srcStat, dstStat)) return;
1710
- } catch (err) {
1711
- err.message = err.message.replace("lstat", "ensureLink");
1712
- throw err;
1713
- }
1714
- const dir = path6.dirname(dstpath);
1715
- const dirExists = fs4.existsSync(dir);
1716
- if (dirExists) return fs4.linkSync(srcpath, dstpath);
1717
- mkdir.mkdirsSync(dir);
1718
- return fs4.linkSync(srcpath, dstpath);
1719
- }
1720
- module2.exports = {
1721
- createLink: u(createLink),
1722
- createLinkSync
1723
- };
1724
- }
1725
- });
1726
- var require_symlink_paths = (0, import_chunk_AH6QHEOA.__commonJS)({
1727
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports, module2) {
1728
- "use strict";
1729
- var path6 = (0, import_chunk_AH6QHEOA.__require)("path");
1730
- var fs4 = require_graceful_fs();
1731
- var pathExists2 = require_path_exists().pathExists;
1732
- function symlinkPaths(srcpath, dstpath, callback) {
1733
- if (path6.isAbsolute(srcpath)) {
1734
- return fs4.lstat(srcpath, (err) => {
1735
- if (err) {
1736
- err.message = err.message.replace("lstat", "ensureSymlink");
1737
- return callback(err);
1738
- }
1739
- return callback(null, {
1740
- toCwd: srcpath,
1741
- toDst: srcpath
1742
- });
1743
- });
1744
- } else {
1745
- const dstdir = path6.dirname(dstpath);
1746
- const relativeToDst = path6.join(dstdir, srcpath);
1747
- return pathExists2(relativeToDst, (err, exists) => {
1748
- if (err) return callback(err);
1749
- if (exists) {
1750
- return callback(null, {
1751
- toCwd: relativeToDst,
1752
- toDst: srcpath
1753
- });
1754
- } else {
1755
- return fs4.lstat(srcpath, (err2) => {
1756
- if (err2) {
1757
- err2.message = err2.message.replace("lstat", "ensureSymlink");
1758
- return callback(err2);
1759
- }
1760
- return callback(null, {
1761
- toCwd: srcpath,
1762
- toDst: path6.relative(dstdir, srcpath)
1763
- });
1764
- });
1765
- }
1766
- });
1767
- }
1768
- }
1769
- function symlinkPathsSync(srcpath, dstpath) {
1770
- let exists;
1771
- if (path6.isAbsolute(srcpath)) {
1772
- exists = fs4.existsSync(srcpath);
1773
- if (!exists) throw new Error("absolute srcpath does not exist");
1774
- return {
1775
- toCwd: srcpath,
1776
- toDst: srcpath
1777
- };
1778
- } else {
1779
- const dstdir = path6.dirname(dstpath);
1780
- const relativeToDst = path6.join(dstdir, srcpath);
1781
- exists = fs4.existsSync(relativeToDst);
1782
- if (exists) {
1783
- return {
1784
- toCwd: relativeToDst,
1785
- toDst: srcpath
1786
- };
1787
- } else {
1788
- exists = fs4.existsSync(srcpath);
1789
- if (!exists) throw new Error("relative srcpath does not exist");
1790
- return {
1791
- toCwd: srcpath,
1792
- toDst: path6.relative(dstdir, srcpath)
1793
- };
1794
- }
1795
- }
1796
- }
1797
- module2.exports = {
1798
- symlinkPaths,
1799
- symlinkPathsSync
1800
- };
1801
- }
1802
- });
1803
- var require_symlink_type = (0, import_chunk_AH6QHEOA.__commonJS)({
1804
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/ensure/symlink-type.js"(exports, module2) {
1805
- "use strict";
1806
- var fs4 = require_graceful_fs();
1807
- function symlinkType(srcpath, type, callback) {
1808
- callback = typeof type === "function" ? type : callback;
1809
- type = typeof type === "function" ? false : type;
1810
- if (type) return callback(null, type);
1811
- fs4.lstat(srcpath, (err, stats) => {
1812
- if (err) return callback(null, "file");
1813
- type = stats && stats.isDirectory() ? "dir" : "file";
1814
- callback(null, type);
1815
- });
1816
- }
1817
- function symlinkTypeSync(srcpath, type) {
1818
- let stats;
1819
- if (type) return type;
1820
- try {
1821
- stats = fs4.lstatSync(srcpath);
1822
- } catch {
1823
- return "file";
1824
- }
1825
- return stats && stats.isDirectory() ? "dir" : "file";
1826
- }
1827
- module2.exports = {
1828
- symlinkType,
1829
- symlinkTypeSync
1830
- };
1831
- }
1832
- });
1833
- var require_symlink = (0, import_chunk_AH6QHEOA.__commonJS)({
1834
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/ensure/symlink.js"(exports, module2) {
1835
- "use strict";
1836
- var u = require_universalify().fromCallback;
1837
- var path6 = (0, import_chunk_AH6QHEOA.__require)("path");
1838
- var fs4 = require_fs();
1839
- var _mkdirs = require_mkdirs();
1840
- var mkdirs = _mkdirs.mkdirs;
1841
- var mkdirsSync = _mkdirs.mkdirsSync;
1842
- var _symlinkPaths = require_symlink_paths();
1843
- var symlinkPaths = _symlinkPaths.symlinkPaths;
1844
- var symlinkPathsSync = _symlinkPaths.symlinkPathsSync;
1845
- var _symlinkType = require_symlink_type();
1846
- var symlinkType = _symlinkType.symlinkType;
1847
- var symlinkTypeSync = _symlinkType.symlinkTypeSync;
1848
- var pathExists2 = require_path_exists().pathExists;
1849
- var { areIdentical } = require_stat();
1850
- function createSymlink(srcpath, dstpath, type, callback) {
1851
- callback = typeof type === "function" ? type : callback;
1852
- type = typeof type === "function" ? false : type;
1853
- fs4.lstat(dstpath, (err, stats) => {
1854
- if (!err && stats.isSymbolicLink()) {
1855
- Promise.all([
1856
- fs4.stat(srcpath),
1857
- fs4.stat(dstpath)
1858
- ]).then(([srcStat, dstStat]) => {
1859
- if (areIdentical(srcStat, dstStat)) return callback(null);
1860
- _createSymlink(srcpath, dstpath, type, callback);
1861
- });
1862
- } else _createSymlink(srcpath, dstpath, type, callback);
1863
- });
1864
- }
1865
- function _createSymlink(srcpath, dstpath, type, callback) {
1866
- symlinkPaths(srcpath, dstpath, (err, relative) => {
1867
- if (err) return callback(err);
1868
- srcpath = relative.toDst;
1869
- symlinkType(relative.toCwd, type, (err2, type2) => {
1870
- if (err2) return callback(err2);
1871
- const dir = path6.dirname(dstpath);
1872
- pathExists2(dir, (err3, dirExists) => {
1873
- if (err3) return callback(err3);
1874
- if (dirExists) return fs4.symlink(srcpath, dstpath, type2, callback);
1875
- mkdirs(dir, (err4) => {
1876
- if (err4) return callback(err4);
1877
- fs4.symlink(srcpath, dstpath, type2, callback);
1878
- });
1879
- });
1880
- });
1881
- });
1882
- }
1883
- function createSymlinkSync(srcpath, dstpath, type) {
1884
- let stats;
1885
- try {
1886
- stats = fs4.lstatSync(dstpath);
1887
- } catch {
1888
- }
1889
- if (stats && stats.isSymbolicLink()) {
1890
- const srcStat = fs4.statSync(srcpath);
1891
- const dstStat = fs4.statSync(dstpath);
1892
- if (areIdentical(srcStat, dstStat)) return;
1893
- }
1894
- const relative = symlinkPathsSync(srcpath, dstpath);
1895
- srcpath = relative.toDst;
1896
- type = symlinkTypeSync(relative.toCwd, type);
1897
- const dir = path6.dirname(dstpath);
1898
- const exists = fs4.existsSync(dir);
1899
- if (exists) return fs4.symlinkSync(srcpath, dstpath, type);
1900
- mkdirsSync(dir);
1901
- return fs4.symlinkSync(srcpath, dstpath, type);
1902
- }
1903
- module2.exports = {
1904
- createSymlink: u(createSymlink),
1905
- createSymlinkSync
1906
- };
1907
- }
1908
- });
1909
- var require_ensure = (0, import_chunk_AH6QHEOA.__commonJS)({
1910
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/ensure/index.js"(exports, module2) {
1911
- "use strict";
1912
- var { createFile, createFileSync } = require_file();
1913
- var { createLink, createLinkSync } = require_link();
1914
- var { createSymlink, createSymlinkSync } = require_symlink();
1915
- module2.exports = {
1916
- // file
1917
- createFile,
1918
- createFileSync,
1919
- ensureFile: createFile,
1920
- ensureFileSync: createFileSync,
1921
- // link
1922
- createLink,
1923
- createLinkSync,
1924
- ensureLink: createLink,
1925
- ensureLinkSync: createLinkSync,
1926
- // symlink
1927
- createSymlink,
1928
- createSymlinkSync,
1929
- ensureSymlink: createSymlink,
1930
- ensureSymlinkSync: createSymlinkSync
1931
- };
1932
- }
1933
- });
1934
- var require_utils2 = (0, import_chunk_AH6QHEOA.__commonJS)({
1935
- "../../node_modules/.pnpm/jsonfile@6.1.0/node_modules/jsonfile/utils.js"(exports, module2) {
1936
- "use strict";
1937
- function stringify(obj, { EOL = "\n", finalEOL = true, replacer = null, spaces } = {}) {
1938
- const EOF = finalEOL ? EOL : "";
1939
- const str = JSON.stringify(obj, replacer, spaces);
1940
- return str.replace(/\n/g, EOL) + EOF;
1941
- }
1942
- function stripBom(content) {
1943
- if (Buffer.isBuffer(content)) content = content.toString("utf8");
1944
- return content.replace(/^\uFEFF/, "");
1945
- }
1946
- module2.exports = { stringify, stripBom };
1947
- }
1948
- });
1949
- var require_jsonfile = (0, import_chunk_AH6QHEOA.__commonJS)({
1950
- "../../node_modules/.pnpm/jsonfile@6.1.0/node_modules/jsonfile/index.js"(exports, module2) {
1951
- "use strict";
1952
- var _fs;
1953
- try {
1954
- _fs = require_graceful_fs();
1955
- } catch (_) {
1956
- _fs = (0, import_chunk_AH6QHEOA.__require)("fs");
1957
- }
1958
- var universalify = require_universalify();
1959
- var { stringify, stripBom } = require_utils2();
1960
- async function _readFile(file, options = {}) {
1961
- if (typeof options === "string") {
1962
- options = { encoding: options };
1963
- }
1964
- const fs4 = options.fs || _fs;
1965
- const shouldThrow = "throws" in options ? options.throws : true;
1966
- let data = await universalify.fromCallback(fs4.readFile)(file, options);
1967
- data = stripBom(data);
1968
- let obj;
1969
- try {
1970
- obj = JSON.parse(data, options ? options.reviver : null);
1971
- } catch (err) {
1972
- if (shouldThrow) {
1973
- err.message = `${file}: ${err.message}`;
1974
- throw err;
1975
- } else {
1976
- return null;
1977
- }
1978
- }
1979
- return obj;
1980
- }
1981
- var readFile = universalify.fromPromise(_readFile);
1982
- function readFileSync(file, options = {}) {
1983
- if (typeof options === "string") {
1984
- options = { encoding: options };
1985
- }
1986
- const fs4 = options.fs || _fs;
1987
- const shouldThrow = "throws" in options ? options.throws : true;
1988
- try {
1989
- let content = fs4.readFileSync(file, options);
1990
- content = stripBom(content);
1991
- return JSON.parse(content, options.reviver);
1992
- } catch (err) {
1993
- if (shouldThrow) {
1994
- err.message = `${file}: ${err.message}`;
1995
- throw err;
1996
- } else {
1997
- return null;
1998
- }
1999
- }
2000
- }
2001
- async function _writeFile(file, obj, options = {}) {
2002
- const fs4 = options.fs || _fs;
2003
- const str = stringify(obj, options);
2004
- await universalify.fromCallback(fs4.writeFile)(file, str, options);
2005
- }
2006
- var writeFile = universalify.fromPromise(_writeFile);
2007
- function writeFileSync(file, obj, options = {}) {
2008
- const fs4 = options.fs || _fs;
2009
- const str = stringify(obj, options);
2010
- return fs4.writeFileSync(file, str, options);
2011
- }
2012
- var jsonfile = {
2013
- readFile,
2014
- readFileSync,
2015
- writeFile,
2016
- writeFileSync
2017
- };
2018
- module2.exports = jsonfile;
2019
- }
2020
- });
2021
- var require_jsonfile2 = (0, import_chunk_AH6QHEOA.__commonJS)({
2022
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/json/jsonfile.js"(exports, module2) {
2023
- "use strict";
2024
- var jsonFile = require_jsonfile();
2025
- module2.exports = {
2026
- // jsonfile exports
2027
- readJson: jsonFile.readFile,
2028
- readJsonSync: jsonFile.readFileSync,
2029
- writeJson: jsonFile.writeFile,
2030
- writeJsonSync: jsonFile.writeFileSync
2031
- };
2032
- }
2033
- });
2034
- var require_output_file = (0, import_chunk_AH6QHEOA.__commonJS)({
2035
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/output-file/index.js"(exports, module2) {
2036
- "use strict";
2037
- var u = require_universalify().fromCallback;
2038
- var fs4 = require_graceful_fs();
2039
- var path6 = (0, import_chunk_AH6QHEOA.__require)("path");
2040
- var mkdir = require_mkdirs();
2041
- var pathExists2 = require_path_exists().pathExists;
2042
- function outputFile(file, data, encoding, callback) {
2043
- if (typeof encoding === "function") {
2044
- callback = encoding;
2045
- encoding = "utf8";
2046
- }
2047
- const dir = path6.dirname(file);
2048
- pathExists2(dir, (err, itDoes) => {
2049
- if (err) return callback(err);
2050
- if (itDoes) return fs4.writeFile(file, data, encoding, callback);
2051
- mkdir.mkdirs(dir, (err2) => {
2052
- if (err2) return callback(err2);
2053
- fs4.writeFile(file, data, encoding, callback);
2054
- });
2055
- });
2056
- }
2057
- function outputFileSync(file, ...args) {
2058
- const dir = path6.dirname(file);
2059
- if (fs4.existsSync(dir)) {
2060
- return fs4.writeFileSync(file, ...args);
2061
- }
2062
- mkdir.mkdirsSync(dir);
2063
- fs4.writeFileSync(file, ...args);
2064
- }
2065
- module2.exports = {
2066
- outputFile: u(outputFile),
2067
- outputFileSync
2068
- };
2069
- }
2070
- });
2071
- var require_output_json = (0, import_chunk_AH6QHEOA.__commonJS)({
2072
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/json/output-json.js"(exports, module2) {
2073
- "use strict";
2074
- var { stringify } = require_utils2();
2075
- var { outputFile } = require_output_file();
2076
- async function outputJson(file, data, options = {}) {
2077
- const str = stringify(data, options);
2078
- await outputFile(file, str, options);
2079
- }
2080
- module2.exports = outputJson;
2081
- }
2082
- });
2083
- var require_output_json_sync = (0, import_chunk_AH6QHEOA.__commonJS)({
2084
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/json/output-json-sync.js"(exports, module2) {
2085
- "use strict";
2086
- var { stringify } = require_utils2();
2087
- var { outputFileSync } = require_output_file();
2088
- function outputJsonSync(file, data, options) {
2089
- const str = stringify(data, options);
2090
- outputFileSync(file, str, options);
2091
- }
2092
- module2.exports = outputJsonSync;
2093
- }
2094
- });
2095
- var require_json = (0, import_chunk_AH6QHEOA.__commonJS)({
2096
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/json/index.js"(exports, module2) {
2097
- "use strict";
2098
- var u = require_universalify().fromPromise;
2099
- var jsonFile = require_jsonfile2();
2100
- jsonFile.outputJson = u(require_output_json());
2101
- jsonFile.outputJsonSync = require_output_json_sync();
2102
- jsonFile.outputJSON = jsonFile.outputJson;
2103
- jsonFile.outputJSONSync = jsonFile.outputJsonSync;
2104
- jsonFile.writeJSON = jsonFile.writeJson;
2105
- jsonFile.writeJSONSync = jsonFile.writeJsonSync;
2106
- jsonFile.readJSON = jsonFile.readJson;
2107
- jsonFile.readJSONSync = jsonFile.readJsonSync;
2108
- module2.exports = jsonFile;
2109
- }
2110
- });
2111
- var require_move = (0, import_chunk_AH6QHEOA.__commonJS)({
2112
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/move/move.js"(exports, module2) {
2113
- "use strict";
2114
- var fs4 = require_graceful_fs();
2115
- var path6 = (0, import_chunk_AH6QHEOA.__require)("path");
2116
- var copy = require_copy2().copy;
2117
- var remove = require_remove().remove;
2118
- var mkdirp = require_mkdirs().mkdirp;
2119
- var pathExists2 = require_path_exists().pathExists;
2120
- var stat = require_stat();
2121
- function move(src, dest, opts, cb) {
2122
- if (typeof opts === "function") {
2123
- cb = opts;
2124
- opts = {};
2125
- }
2126
- opts = opts || {};
2127
- const overwrite = opts.overwrite || opts.clobber || false;
2128
- stat.checkPaths(src, dest, "move", opts, (err, stats) => {
2129
- if (err) return cb(err);
2130
- const { srcStat, isChangingCase = false } = stats;
2131
- stat.checkParentPaths(src, srcStat, dest, "move", (err2) => {
2132
- if (err2) return cb(err2);
2133
- if (isParentRoot(dest)) return doRename(src, dest, overwrite, isChangingCase, cb);
2134
- mkdirp(path6.dirname(dest), (err3) => {
2135
- if (err3) return cb(err3);
2136
- return doRename(src, dest, overwrite, isChangingCase, cb);
2137
- });
2138
- });
2139
- });
2140
- }
2141
- function isParentRoot(dest) {
2142
- const parent = path6.dirname(dest);
2143
- const parsedPath = path6.parse(parent);
2144
- return parsedPath.root === parent;
2145
- }
2146
- function doRename(src, dest, overwrite, isChangingCase, cb) {
2147
- if (isChangingCase) return rename(src, dest, overwrite, cb);
2148
- if (overwrite) {
2149
- return remove(dest, (err) => {
2150
- if (err) return cb(err);
2151
- return rename(src, dest, overwrite, cb);
2152
- });
2153
- }
2154
- pathExists2(dest, (err, destExists) => {
2155
- if (err) return cb(err);
2156
- if (destExists) return cb(new Error("dest already exists."));
2157
- return rename(src, dest, overwrite, cb);
2158
- });
2159
- }
2160
- function rename(src, dest, overwrite, cb) {
2161
- fs4.rename(src, dest, (err) => {
2162
- if (!err) return cb();
2163
- if (err.code !== "EXDEV") return cb(err);
2164
- return moveAcrossDevice(src, dest, overwrite, cb);
2165
- });
2166
- }
2167
- function moveAcrossDevice(src, dest, overwrite, cb) {
2168
- const opts = {
2169
- overwrite,
2170
- errorOnExist: true,
2171
- preserveTimestamps: true
2172
- };
2173
- copy(src, dest, opts, (err) => {
2174
- if (err) return cb(err);
2175
- return remove(src, cb);
2176
- });
2177
- }
2178
- module2.exports = move;
2179
- }
2180
- });
2181
- var require_move_sync = (0, import_chunk_AH6QHEOA.__commonJS)({
2182
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/move/move-sync.js"(exports, module2) {
2183
- "use strict";
2184
- var fs4 = require_graceful_fs();
2185
- var path6 = (0, import_chunk_AH6QHEOA.__require)("path");
2186
- var copySync = require_copy2().copySync;
2187
- var removeSync = require_remove().removeSync;
2188
- var mkdirpSync = require_mkdirs().mkdirpSync;
2189
- var stat = require_stat();
2190
- function moveSync(src, dest, opts) {
2191
- opts = opts || {};
2192
- const overwrite = opts.overwrite || opts.clobber || false;
2193
- const { srcStat, isChangingCase = false } = stat.checkPathsSync(src, dest, "move", opts);
2194
- stat.checkParentPathsSync(src, srcStat, dest, "move");
2195
- if (!isParentRoot(dest)) mkdirpSync(path6.dirname(dest));
2196
- return doRename(src, dest, overwrite, isChangingCase);
2197
- }
2198
- function isParentRoot(dest) {
2199
- const parent = path6.dirname(dest);
2200
- const parsedPath = path6.parse(parent);
2201
- return parsedPath.root === parent;
2202
- }
2203
- function doRename(src, dest, overwrite, isChangingCase) {
2204
- if (isChangingCase) return rename(src, dest, overwrite);
2205
- if (overwrite) {
2206
- removeSync(dest);
2207
- return rename(src, dest, overwrite);
2208
- }
2209
- if (fs4.existsSync(dest)) throw new Error("dest already exists.");
2210
- return rename(src, dest, overwrite);
2211
- }
2212
- function rename(src, dest, overwrite) {
2213
- try {
2214
- fs4.renameSync(src, dest);
2215
- } catch (err) {
2216
- if (err.code !== "EXDEV") throw err;
2217
- return moveAcrossDevice(src, dest, overwrite);
2218
- }
2219
- }
2220
- function moveAcrossDevice(src, dest, overwrite) {
2221
- const opts = {
2222
- overwrite,
2223
- errorOnExist: true,
2224
- preserveTimestamps: true
2225
- };
2226
- copySync(src, dest, opts);
2227
- return removeSync(src);
2228
- }
2229
- module2.exports = moveSync;
2230
- }
2231
- });
2232
- var require_move2 = (0, import_chunk_AH6QHEOA.__commonJS)({
2233
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/move/index.js"(exports, module2) {
2234
- "use strict";
2235
- var u = require_universalify().fromCallback;
2236
- module2.exports = {
2237
- move: u(require_move()),
2238
- moveSync: require_move_sync()
2239
- };
2240
- }
2241
- });
2242
- var require_lib = (0, import_chunk_AH6QHEOA.__commonJS)({
2243
- "../../node_modules/.pnpm/fs-extra@11.1.1/node_modules/fs-extra/lib/index.js"(exports, module2) {
2244
- "use strict";
2245
- module2.exports = {
2246
- // Export promiseified graceful-fs:
2247
- ...require_fs(),
2248
- // Export extra methods:
2249
- ...require_copy2(),
2250
- ...require_empty(),
2251
- ...require_ensure(),
2252
- ...require_json(),
2253
- ...require_mkdirs(),
2254
- ...require_move2(),
2255
- ...require_output_file(),
2256
- ...require_path_exists(),
2257
- ...require_remove()
2258
- };
2259
- }
2260
- });
2261
- var import_common_path_prefix = (0, import_chunk_AH6QHEOA.__toESM)(require_common_path_prefix(), 1);
2262
- var typeMappings = {
2263
- directory: "isDirectory",
2264
- file: "isFile"
2265
- };
2266
- function checkType(type) {
2267
- if (Object.hasOwnProperty.call(typeMappings, type)) {
2268
- return;
2269
- }
2270
- throw new Error(`Invalid type specified: ${type}`);
2271
- }
2272
- var matchType = (type, stat) => stat[typeMappings[type]]();
2273
- var toPath = (urlOrPath) => urlOrPath instanceof URL ? (0, import_url2.fileURLToPath)(urlOrPath) : urlOrPath;
2274
- function locatePathSync(paths, {
2275
- cwd: cwd2 = import_process2.default.cwd(),
2276
- type = "file",
2277
- allowSymlinks = true
2278
- } = {}) {
2279
- checkType(type);
2280
- cwd2 = toPath(cwd2);
2281
- const statFunction = allowSymlinks ? import_fs2.default.statSync : import_fs2.default.lstatSync;
2282
- for (const path_ of paths) {
2283
- try {
2284
- const stat = statFunction(import_path4.default.resolve(cwd2, path_), {
2285
- throwIfNoEntry: false
2286
- });
2287
- if (!stat) {
2288
- continue;
2289
- }
2290
- if (matchType(type, stat)) {
2291
- return path_;
2292
- }
2293
- } catch {
2294
- }
2295
- }
2296
- }
2297
- var toPath2 = (urlOrPath) => urlOrPath instanceof URL ? (0, import_url.fileURLToPath)(urlOrPath) : urlOrPath;
2298
- var findUpStop = Symbol("findUpStop");
2299
- function findUpMultipleSync(name, options = {}) {
2300
- let directory = import_path3.default.resolve(toPath2(options.cwd) || "");
2301
- const { root } = import_path3.default.parse(directory);
2302
- const stopAt = options.stopAt || root;
2303
- const limit = options.limit || Number.POSITIVE_INFINITY;
2304
- const paths = [name].flat();
2305
- const runMatcher = (locateOptions) => {
2306
- if (typeof name !== "function") {
2307
- return locatePathSync(paths, locateOptions);
2308
- }
2309
- const foundPath = name(locateOptions.cwd);
2310
- if (typeof foundPath === "string") {
2311
- return locatePathSync([foundPath], locateOptions);
2312
- }
2313
- return foundPath;
2314
- };
2315
- const matches = [];
2316
- while (true) {
2317
- const foundPath = runMatcher({ ...options, cwd: directory });
2318
- if (foundPath === findUpStop) {
2319
- break;
2320
- }
2321
- if (foundPath) {
2322
- matches.push(import_path3.default.resolve(directory, foundPath));
2323
- }
2324
- if (directory === stopAt || matches.length >= limit) {
2325
- break;
2326
- }
2327
- directory = import_path3.default.dirname(directory);
2328
- }
2329
- return matches;
2330
- }
2331
- function findUpSync(name, options = {}) {
2332
- const matches = findUpMultipleSync(name, { ...options, limit: 1 });
2333
- return matches[0];
2334
- }
2335
- function packageDirectorySync({ cwd: cwd2 } = {}) {
2336
- const filePath = findUpSync("package.json", { cwd: cwd2 });
2337
- return filePath && import_path2.default.dirname(filePath);
2338
- }
2339
- var { env, cwd } = import_process.default;
2340
- var isWritable = (path6) => {
2341
- try {
2342
- import_fs.default.accessSync(path6, import_fs.default.constants.W_OK);
2343
- return true;
2344
- } catch {
2345
- return false;
2346
- }
2347
- };
2348
- function useDirectory(directory, options) {
2349
- if (options.create) {
2350
- import_fs.default.mkdirSync(directory, { recursive: true });
2351
- }
2352
- return directory;
2353
- }
2354
- function getNodeModuleDirectory(directory) {
2355
- const nodeModules = import_path.default.join(directory, "node_modules");
2356
- if (!isWritable(nodeModules) && (import_fs.default.existsSync(nodeModules) || !isWritable(import_path.default.join(directory)))) {
2357
- return;
2358
- }
2359
- return nodeModules;
2360
- }
2361
- function findCacheDirectory(options = {}) {
2362
- if (env.CACHE_DIR && !["true", "false", "1", "0"].includes(env.CACHE_DIR)) {
2363
- return useDirectory(import_path.default.join(env.CACHE_DIR, options.name), options);
2364
- }
2365
- let { cwd: directory = cwd(), files } = options;
2366
- if (files) {
2367
- if (!Array.isArray(files)) {
2368
- throw new TypeError(`Expected \`files\` option to be an array, got \`${typeof files}\`.`);
2369
- }
2370
- directory = (0, import_common_path_prefix.default)(files.map((file) => import_path.default.resolve(directory, file)));
2371
- }
2372
- directory = packageDirectorySync({ cwd: directory });
2373
- if (!directory) {
2374
- return;
2375
- }
2376
- const nodeModules = getNodeModuleDirectory(directory);
2377
- if (!nodeModules) {
2378
- return;
2379
- }
2380
- return useDirectory(import_path.default.join(directory, "node_modules", ".cache", options.name), options);
2381
- }
2382
- var import_fs_extra = (0, import_chunk_AH6QHEOA.__toESM)(require_lib());
2383
- var debug = (0, import_debug.default)("prisma:fetch-engine:cache-dir");
2384
- async function getRootCacheDir() {
2385
- if (import_os.default.platform() === "win32") {
2386
- const cacheDir = findCacheDirectory({ name: "prisma", create: true });
2387
- if (cacheDir) {
2388
- return cacheDir;
2389
- }
2390
- if (process.env.APPDATA) {
2391
- return import_path5.default.join(process.env.APPDATA, "Prisma");
2392
- }
2393
- }
2394
- if (process.env.AWS_LAMBDA_FUNCTION_VERSION) {
2395
- try {
2396
- await (0, import_fs_extra.ensureDir)(`/tmp/prisma-download`);
2397
- return `/tmp/prisma-download`;
2398
- } catch (e) {
2399
- return null;
2400
- }
2401
- }
2402
- return import_path5.default.join(import_os.default.homedir(), ".cache/prisma");
2403
- }
2404
- async function getCacheDir(channel, version, binaryTarget) {
2405
- const rootCacheDir = await getRootCacheDir();
2406
- if (!rootCacheDir) {
2407
- return null;
2408
- }
2409
- const cacheDir = import_path5.default.join(rootCacheDir, channel, version, binaryTarget);
2410
- try {
2411
- if (!import_fs3.default.existsSync(cacheDir)) {
2412
- await (0, import_fs_extra.ensureDir)(cacheDir);
2413
- }
2414
- } catch (e) {
2415
- debug("The following error is being caught and just there for debugging:");
2416
- debug(e);
2417
- return null;
2418
- }
2419
- return cacheDir;
2420
- }
2421
- function getDownloadUrl({
2422
- channel,
2423
- version,
2424
- binaryTarget,
2425
- binaryName,
2426
- extension = ".gz"
2427
- }) {
2428
- const baseUrl = process.env.PRISMA_BINARIES_MIRROR || // TODO: remove this
2429
- process.env.PRISMA_ENGINES_MIRROR || "https://binaries.prisma.sh";
2430
- const finalExtension = (
2431
- // eslint-disable-next-line @typescript-eslint/no-unsafe-enum-comparison
2432
- binaryTarget === "windows" && "libquery-engine" !== binaryName ? `.exe${extension}` : extension
2433
- );
2434
- if (binaryName === "libquery-engine") {
2435
- binaryName = (0, import_get_platform.getNodeAPIName)(binaryTarget, "url");
2436
- }
2437
- return `${baseUrl}/${channel}/${version}/${binaryTarget}/${binaryName}${finalExtension}`;
2438
- }
2439
- async function overwriteFile(sourcePath, targetPath) {
2440
- if (import_os.default.platform() === "darwin") {
2441
- await removeFileIfExists(targetPath);
2442
- await import_fs3.default.promises.copyFile(sourcePath, targetPath);
2443
- } else {
2444
- let tempPath = `${targetPath}.tmp${process.pid}`;
2445
- await import_fs3.default.promises.copyFile(sourcePath, tempPath);
2446
- await import_fs3.default.promises.rename(tempPath, targetPath);
2447
- }
2448
- }
2449
- async function removeFileIfExists(filePath) {
2450
- try {
2451
- await import_fs3.default.promises.unlink(filePath);
2452
- } catch (e) {
2453
- if (e.code !== "ENOENT") {
2454
- throw e;
2455
- }
2456
- }
2457
- }