@kubb/core 2.0.0-beta.11 → 2.0.0-beta.13

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