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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,25 +1,31 @@
1
1
  import mod, { createRequire } from 'module';
2
- import pc3 from 'picocolors';
3
- import fs2, { remove } from 'fs-extra';
4
- import seedrandom from 'seedrandom';
5
- import path, { resolve, dirname, extname, relative, basename } from 'path';
2
+ import pc2 from 'picocolors';
3
+ import path4, { resolve, dirname, extname, relative, basename } from 'path';
6
4
  import { switcher } from 'js-runtime';
7
5
  import { camelCase as camelCase$1, camelCaseTransformMerge, pascalCase as pascalCase$1, pascalCaseTransformMerge } from 'change-case';
8
6
  import crypto2 from 'crypto';
9
7
  import { print } from '@kubb/parser';
10
8
  import * as factory from '@kubb/parser/factory';
11
- import isEqual from 'lodash.isequal';
12
9
  import { orderBy } from 'natural-orderby';
13
10
  import dirTree from 'directory-tree';
11
+ import seedrandom from 'seedrandom';
14
12
  import { EventEmitter as EventEmitter$1 } from 'events';
15
13
  import { performance } from 'perf_hooks';
16
14
  import os from 'os';
17
- import { pathToFileURL } from 'url';
18
- import { findUp, findUpSync } from 'find-up';
15
+ import { pathToFileURL, fileURLToPath } from 'url';
16
+ import process2 from 'process';
17
+ import fs3, { promises } from 'fs';
19
18
  import { coerce, satisfies } from 'semver';
20
19
 
21
20
  const require = createRequire(import.meta.url);
22
21
 
22
+ var __create = Object.create;
23
+ var __defProp = Object.defineProperty;
24
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
25
+ var __getOwnPropNames = Object.getOwnPropertyNames;
26
+ var __getProtoOf = Object.getPrototypeOf;
27
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
28
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
23
29
  var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
24
30
  get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
25
31
  }) : x)(function(x) {
@@ -27,6 +33,32 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
27
33
  return require.apply(this, arguments);
28
34
  throw Error('Dynamic require of "' + x + '" is not supported');
29
35
  });
36
+ var __esm = (fn, res) => function __init() {
37
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
38
+ };
39
+ var __commonJS = (cb, mod2) => function __require2() {
40
+ return mod2 || (0, cb[__getOwnPropNames(cb)[0]])((mod2 = { exports: {} }).exports, mod2), mod2.exports;
41
+ };
42
+ var __copyProps = (to, from, except, desc) => {
43
+ if (from && typeof from === "object" || typeof from === "function") {
44
+ for (let key of __getOwnPropNames(from))
45
+ if (!__hasOwnProp.call(to, key) && key !== except)
46
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
47
+ }
48
+ return to;
49
+ };
50
+ var __toESM = (mod2, isNodeMode, target) => (target = mod2 != null ? __create(__getProtoOf(mod2)) : {}, __copyProps(
51
+ // If the importer is in node compatibility mode or this is not an ESM
52
+ // file that has been converted to a CommonJS file using a Babel-
53
+ // compatible transform (i.e. "__esModule" has not been set), then set
54
+ // "default" to the CommonJS "module.exports" for node compatibility.
55
+ isNodeMode || !mod2 || !mod2.__esModule ? __defProp(target, "default", { value: mod2, enumerable: true }) : target,
56
+ mod2
57
+ ));
58
+ var __publicField = (obj, key, value) => {
59
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
60
+ return value;
61
+ };
30
62
  var __accessCheck = (obj, member, msg) => {
31
63
  if (!member.has(obj))
32
64
  throw TypeError("Cannot " + msg);
@@ -57,83 +89,2941 @@ var __privateMethod = (obj, member, method) => {
57
89
  __accessCheck(obj, member, "access private method");
58
90
  return method;
59
91
  };
60
- async function clean(path3) {
61
- return remove(path3);
62
- }
63
- var LogLevel = {
64
- silent: "silent",
65
- info: "info",
66
- debug: "debug"
67
- };
68
- function createLogger({ logLevel, name, spinner }) {
69
- const logs = [];
70
- const log = (message) => {
71
- if (message && spinner) {
72
- spinner.text = message;
73
- logs.push(message);
92
+
93
+ // ../../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
94
+ var init_esm_shims = __esm({
95
+ "../../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"() {
96
+ }
97
+ });
98
+
99
+ // ../../node_modules/.pnpm/universalify@2.0.1/node_modules/universalify/index.js
100
+ var require_universalify = __commonJS({
101
+ "../../node_modules/.pnpm/universalify@2.0.1/node_modules/universalify/index.js"(exports) {
102
+ init_esm_shims();
103
+ exports.fromCallback = function(fn) {
104
+ return Object.defineProperty(function(...args) {
105
+ if (typeof args[args.length - 1] === "function")
106
+ fn.apply(this, args);
107
+ else {
108
+ return new Promise((resolve3, reject) => {
109
+ args.push((err, res) => err != null ? reject(err) : resolve3(res));
110
+ fn.apply(this, args);
111
+ });
112
+ }
113
+ }, "name", { value: fn.name });
114
+ };
115
+ exports.fromPromise = function(fn) {
116
+ return Object.defineProperty(function(...args) {
117
+ const cb = args[args.length - 1];
118
+ if (typeof cb !== "function")
119
+ return fn.apply(this, args);
120
+ else {
121
+ args.pop();
122
+ fn.apply(this, args).then((r) => cb(null, r), cb);
123
+ }
124
+ }, "name", { value: fn.name });
125
+ };
126
+ }
127
+ });
128
+
129
+ // ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/polyfills.js
130
+ var require_polyfills = __commonJS({
131
+ "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/polyfills.js"(exports, module) {
132
+ init_esm_shims();
133
+ var constants = __require("constants");
134
+ var origCwd = process.cwd;
135
+ var cwd = null;
136
+ var platform = process.env.GRACEFUL_FS_PLATFORM || process.platform;
137
+ process.cwd = function() {
138
+ if (!cwd)
139
+ cwd = origCwd.call(process);
140
+ return cwd;
141
+ };
142
+ try {
143
+ process.cwd();
144
+ } catch (er) {
74
145
  }
75
- };
76
- const error = (message) => {
77
- if (message) {
78
- throw new Error(message || "Something went wrong");
146
+ if (typeof process.chdir === "function") {
147
+ chdir = process.chdir;
148
+ process.chdir = function(d) {
149
+ cwd = null;
150
+ chdir.call(process, d);
151
+ };
152
+ if (Object.setPrototypeOf)
153
+ Object.setPrototypeOf(process.chdir, chdir);
154
+ }
155
+ var chdir;
156
+ module.exports = patch;
157
+ function patch(fs4) {
158
+ if (constants.hasOwnProperty("O_SYMLINK") && process.version.match(/^v0\.6\.[0-2]|^v0\.5\./)) {
159
+ patchLchmod(fs4);
160
+ }
161
+ if (!fs4.lutimes) {
162
+ patchLutimes(fs4);
163
+ }
164
+ fs4.chown = chownFix(fs4.chown);
165
+ fs4.fchown = chownFix(fs4.fchown);
166
+ fs4.lchown = chownFix(fs4.lchown);
167
+ fs4.chmod = chmodFix(fs4.chmod);
168
+ fs4.fchmod = chmodFix(fs4.fchmod);
169
+ fs4.lchmod = chmodFix(fs4.lchmod);
170
+ fs4.chownSync = chownFixSync(fs4.chownSync);
171
+ fs4.fchownSync = chownFixSync(fs4.fchownSync);
172
+ fs4.lchownSync = chownFixSync(fs4.lchownSync);
173
+ fs4.chmodSync = chmodFixSync(fs4.chmodSync);
174
+ fs4.fchmodSync = chmodFixSync(fs4.fchmodSync);
175
+ fs4.lchmodSync = chmodFixSync(fs4.lchmodSync);
176
+ fs4.stat = statFix(fs4.stat);
177
+ fs4.fstat = statFix(fs4.fstat);
178
+ fs4.lstat = statFix(fs4.lstat);
179
+ fs4.statSync = statFixSync(fs4.statSync);
180
+ fs4.fstatSync = statFixSync(fs4.fstatSync);
181
+ fs4.lstatSync = statFixSync(fs4.lstatSync);
182
+ if (fs4.chmod && !fs4.lchmod) {
183
+ fs4.lchmod = function(path5, mode, cb) {
184
+ if (cb)
185
+ process.nextTick(cb);
186
+ };
187
+ fs4.lchmodSync = function() {
188
+ };
189
+ }
190
+ if (fs4.chown && !fs4.lchown) {
191
+ fs4.lchown = function(path5, uid, gid, cb) {
192
+ if (cb)
193
+ process.nextTick(cb);
194
+ };
195
+ fs4.lchownSync = function() {
196
+ };
197
+ }
198
+ if (platform === "win32") {
199
+ fs4.rename = typeof fs4.rename !== "function" ? fs4.rename : function(fs$rename) {
200
+ function rename(from, to, cb) {
201
+ var start = Date.now();
202
+ var backoff = 0;
203
+ fs$rename(from, to, function CB(er) {
204
+ if (er && (er.code === "EACCES" || er.code === "EPERM" || er.code === "EBUSY") && Date.now() - start < 6e4) {
205
+ setTimeout(function() {
206
+ fs4.stat(to, function(stater, st) {
207
+ if (stater && stater.code === "ENOENT")
208
+ fs$rename(from, to, CB);
209
+ else
210
+ cb(er);
211
+ });
212
+ }, backoff);
213
+ if (backoff < 100)
214
+ backoff += 10;
215
+ return;
216
+ }
217
+ if (cb)
218
+ cb(er);
219
+ });
220
+ }
221
+ if (Object.setPrototypeOf)
222
+ Object.setPrototypeOf(rename, fs$rename);
223
+ return rename;
224
+ }(fs4.rename);
225
+ }
226
+ fs4.read = typeof fs4.read !== "function" ? fs4.read : function(fs$read) {
227
+ function read2(fd, buffer, offset, length, position, callback_) {
228
+ var callback;
229
+ if (callback_ && typeof callback_ === "function") {
230
+ var eagCounter = 0;
231
+ callback = function(er, _, __) {
232
+ if (er && er.code === "EAGAIN" && eagCounter < 10) {
233
+ eagCounter++;
234
+ return fs$read.call(fs4, fd, buffer, offset, length, position, callback);
235
+ }
236
+ callback_.apply(this, arguments);
237
+ };
238
+ }
239
+ return fs$read.call(fs4, fd, buffer, offset, length, position, callback);
240
+ }
241
+ if (Object.setPrototypeOf)
242
+ Object.setPrototypeOf(read2, fs$read);
243
+ return read2;
244
+ }(fs4.read);
245
+ fs4.readSync = typeof fs4.readSync !== "function" ? fs4.readSync : /* @__PURE__ */ function(fs$readSync) {
246
+ return function(fd, buffer, offset, length, position) {
247
+ var eagCounter = 0;
248
+ while (true) {
249
+ try {
250
+ return fs$readSync.call(fs4, fd, buffer, offset, length, position);
251
+ } catch (er) {
252
+ if (er.code === "EAGAIN" && eagCounter < 10) {
253
+ eagCounter++;
254
+ continue;
255
+ }
256
+ throw er;
257
+ }
258
+ }
259
+ };
260
+ }(fs4.readSync);
261
+ function patchLchmod(fs5) {
262
+ fs5.lchmod = function(path5, mode, callback) {
263
+ fs5.open(
264
+ path5,
265
+ constants.O_WRONLY | constants.O_SYMLINK,
266
+ mode,
267
+ function(err, fd) {
268
+ if (err) {
269
+ if (callback)
270
+ callback(err);
271
+ return;
272
+ }
273
+ fs5.fchmod(fd, mode, function(err2) {
274
+ fs5.close(fd, function(err22) {
275
+ if (callback)
276
+ callback(err2 || err22);
277
+ });
278
+ });
279
+ }
280
+ );
281
+ };
282
+ fs5.lchmodSync = function(path5, mode) {
283
+ var fd = fs5.openSync(path5, constants.O_WRONLY | constants.O_SYMLINK, mode);
284
+ var threw = true;
285
+ var ret;
286
+ try {
287
+ ret = fs5.fchmodSync(fd, mode);
288
+ threw = false;
289
+ } finally {
290
+ if (threw) {
291
+ try {
292
+ fs5.closeSync(fd);
293
+ } catch (er) {
294
+ }
295
+ } else {
296
+ fs5.closeSync(fd);
297
+ }
298
+ }
299
+ return ret;
300
+ };
301
+ }
302
+ function patchLutimes(fs5) {
303
+ if (constants.hasOwnProperty("O_SYMLINK") && fs5.futimes) {
304
+ fs5.lutimes = function(path5, at, mt, cb) {
305
+ fs5.open(path5, constants.O_SYMLINK, function(er, fd) {
306
+ if (er) {
307
+ if (cb)
308
+ cb(er);
309
+ return;
310
+ }
311
+ fs5.futimes(fd, at, mt, function(er2) {
312
+ fs5.close(fd, function(er22) {
313
+ if (cb)
314
+ cb(er2 || er22);
315
+ });
316
+ });
317
+ });
318
+ };
319
+ fs5.lutimesSync = function(path5, at, mt) {
320
+ var fd = fs5.openSync(path5, constants.O_SYMLINK);
321
+ var ret;
322
+ var threw = true;
323
+ try {
324
+ ret = fs5.futimesSync(fd, at, mt);
325
+ threw = false;
326
+ } finally {
327
+ if (threw) {
328
+ try {
329
+ fs5.closeSync(fd);
330
+ } catch (er) {
331
+ }
332
+ } else {
333
+ fs5.closeSync(fd);
334
+ }
335
+ }
336
+ return ret;
337
+ };
338
+ } else if (fs5.futimes) {
339
+ fs5.lutimes = function(_a, _b, _c, cb) {
340
+ if (cb)
341
+ process.nextTick(cb);
342
+ };
343
+ fs5.lutimesSync = function() {
344
+ };
345
+ }
346
+ }
347
+ function chmodFix(orig) {
348
+ if (!orig)
349
+ return orig;
350
+ return function(target, mode, cb) {
351
+ return orig.call(fs4, target, mode, function(er) {
352
+ if (chownErOk(er))
353
+ er = null;
354
+ if (cb)
355
+ cb.apply(this, arguments);
356
+ });
357
+ };
358
+ }
359
+ function chmodFixSync(orig) {
360
+ if (!orig)
361
+ return orig;
362
+ return function(target, mode) {
363
+ try {
364
+ return orig.call(fs4, target, mode);
365
+ } catch (er) {
366
+ if (!chownErOk(er))
367
+ throw er;
368
+ }
369
+ };
370
+ }
371
+ function chownFix(orig) {
372
+ if (!orig)
373
+ return orig;
374
+ return function(target, uid, gid, cb) {
375
+ return orig.call(fs4, target, uid, gid, function(er) {
376
+ if (chownErOk(er))
377
+ er = null;
378
+ if (cb)
379
+ cb.apply(this, arguments);
380
+ });
381
+ };
382
+ }
383
+ function chownFixSync(orig) {
384
+ if (!orig)
385
+ return orig;
386
+ return function(target, uid, gid) {
387
+ try {
388
+ return orig.call(fs4, target, uid, gid);
389
+ } catch (er) {
390
+ if (!chownErOk(er))
391
+ throw er;
392
+ }
393
+ };
394
+ }
395
+ function statFix(orig) {
396
+ if (!orig)
397
+ return orig;
398
+ return function(target, options, cb) {
399
+ if (typeof options === "function") {
400
+ cb = options;
401
+ options = null;
402
+ }
403
+ function callback(er, stats) {
404
+ if (stats) {
405
+ if (stats.uid < 0)
406
+ stats.uid += 4294967296;
407
+ if (stats.gid < 0)
408
+ stats.gid += 4294967296;
409
+ }
410
+ if (cb)
411
+ cb.apply(this, arguments);
412
+ }
413
+ return options ? orig.call(fs4, target, options, callback) : orig.call(fs4, target, callback);
414
+ };
415
+ }
416
+ function statFixSync(orig) {
417
+ if (!orig)
418
+ return orig;
419
+ return function(target, options) {
420
+ var stats = options ? orig.call(fs4, target, options) : orig.call(fs4, target);
421
+ if (stats) {
422
+ if (stats.uid < 0)
423
+ stats.uid += 4294967296;
424
+ if (stats.gid < 0)
425
+ stats.gid += 4294967296;
426
+ }
427
+ return stats;
428
+ };
429
+ }
430
+ function chownErOk(er) {
431
+ if (!er)
432
+ return true;
433
+ if (er.code === "ENOSYS")
434
+ return true;
435
+ var nonroot = !process.getuid || process.getuid() !== 0;
436
+ if (nonroot) {
437
+ if (er.code === "EINVAL" || er.code === "EPERM")
438
+ return true;
439
+ }
440
+ return false;
441
+ }
442
+ }
443
+ }
444
+ });
445
+
446
+ // ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/legacy-streams.js
447
+ var require_legacy_streams = __commonJS({
448
+ "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/legacy-streams.js"(exports, module) {
449
+ init_esm_shims();
450
+ var Stream = __require("stream").Stream;
451
+ module.exports = legacy;
452
+ function legacy(fs4) {
453
+ return {
454
+ ReadStream,
455
+ WriteStream
456
+ };
457
+ function ReadStream(path5, options) {
458
+ if (!(this instanceof ReadStream))
459
+ return new ReadStream(path5, options);
460
+ Stream.call(this);
461
+ var self2 = this;
462
+ this.path = path5;
463
+ this.fd = null;
464
+ this.readable = true;
465
+ this.paused = false;
466
+ this.flags = "r";
467
+ this.mode = 438;
468
+ this.bufferSize = 64 * 1024;
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.encoding)
476
+ this.setEncoding(this.encoding);
477
+ if (this.start !== void 0) {
478
+ if ("number" !== typeof this.start) {
479
+ throw TypeError("start must be a Number");
480
+ }
481
+ if (this.end === void 0) {
482
+ this.end = Infinity;
483
+ } else if ("number" !== typeof this.end) {
484
+ throw TypeError("end must be a Number");
485
+ }
486
+ if (this.start > this.end) {
487
+ throw new Error("start must be <= end");
488
+ }
489
+ this.pos = this.start;
490
+ }
491
+ if (this.fd !== null) {
492
+ process.nextTick(function() {
493
+ self2._read();
494
+ });
495
+ return;
496
+ }
497
+ fs4.open(this.path, this.flags, this.mode, function(err, fd) {
498
+ if (err) {
499
+ self2.emit("error", err);
500
+ self2.readable = false;
501
+ return;
502
+ }
503
+ self2.fd = fd;
504
+ self2.emit("open", fd);
505
+ self2._read();
506
+ });
507
+ }
508
+ function WriteStream(path5, options) {
509
+ if (!(this instanceof WriteStream))
510
+ return new WriteStream(path5, options);
511
+ Stream.call(this);
512
+ this.path = path5;
513
+ this.fd = null;
514
+ this.writable = true;
515
+ this.flags = "w";
516
+ this.encoding = "binary";
517
+ this.mode = 438;
518
+ this.bytesWritten = 0;
519
+ options = options || {};
520
+ var keys = Object.keys(options);
521
+ for (var index = 0, length = keys.length; index < length; index++) {
522
+ var key = keys[index];
523
+ this[key] = options[key];
524
+ }
525
+ if (this.start !== void 0) {
526
+ if ("number" !== typeof this.start) {
527
+ throw TypeError("start must be a Number");
528
+ }
529
+ if (this.start < 0) {
530
+ throw new Error("start must be >= zero");
531
+ }
532
+ this.pos = this.start;
533
+ }
534
+ this.busy = false;
535
+ this._queue = [];
536
+ if (this.fd === null) {
537
+ this._open = fs4.open;
538
+ this._queue.push([this._open, this.path, this.flags, this.mode, void 0]);
539
+ this.flush();
540
+ }
541
+ }
542
+ }
543
+ }
544
+ });
545
+
546
+ // ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/clone.js
547
+ var require_clone = __commonJS({
548
+ "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/clone.js"(exports, module) {
549
+ init_esm_shims();
550
+ module.exports = clone;
551
+ var getPrototypeOf = Object.getPrototypeOf || function(obj) {
552
+ return obj.__proto__;
553
+ };
554
+ function clone(obj) {
555
+ if (obj === null || typeof obj !== "object")
556
+ return obj;
557
+ if (obj instanceof Object)
558
+ var copy = { __proto__: getPrototypeOf(obj) };
559
+ else
560
+ var copy = /* @__PURE__ */ Object.create(null);
561
+ Object.getOwnPropertyNames(obj).forEach(function(key) {
562
+ Object.defineProperty(copy, key, Object.getOwnPropertyDescriptor(obj, key));
563
+ });
564
+ return copy;
565
+ }
566
+ }
567
+ });
568
+
569
+ // ../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js
570
+ var require_graceful_fs = __commonJS({
571
+ "../../node_modules/.pnpm/graceful-fs@4.2.11/node_modules/graceful-fs/graceful-fs.js"(exports, module) {
572
+ init_esm_shims();
573
+ var fs4 = __require("fs");
574
+ var polyfills = require_polyfills();
575
+ var legacy = require_legacy_streams();
576
+ var clone = require_clone();
577
+ var util = __require("util");
578
+ var gracefulQueue;
579
+ var previousSymbol;
580
+ if (typeof Symbol === "function" && typeof Symbol.for === "function") {
581
+ gracefulQueue = Symbol.for("graceful-fs.queue");
582
+ previousSymbol = Symbol.for("graceful-fs.previous");
583
+ } else {
584
+ gracefulQueue = "___graceful-fs.queue";
585
+ previousSymbol = "___graceful-fs.previous";
586
+ }
587
+ function noop() {
588
+ }
589
+ function publishQueue(context, queue2) {
590
+ Object.defineProperty(context, gracefulQueue, {
591
+ get: function() {
592
+ return queue2;
593
+ }
594
+ });
595
+ }
596
+ var debug = noop;
597
+ if (util.debuglog)
598
+ debug = util.debuglog("gfs4");
599
+ else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ""))
600
+ debug = function() {
601
+ var m = util.format.apply(util, arguments);
602
+ m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
603
+ console.error(m);
604
+ };
605
+ if (!fs4[gracefulQueue]) {
606
+ queue = global[gracefulQueue] || [];
607
+ publishQueue(fs4, queue);
608
+ fs4.close = function(fs$close) {
609
+ function close(fd, cb) {
610
+ return fs$close.call(fs4, fd, function(err) {
611
+ if (!err) {
612
+ resetQueue();
613
+ }
614
+ if (typeof cb === "function")
615
+ cb.apply(this, arguments);
616
+ });
617
+ }
618
+ Object.defineProperty(close, previousSymbol, {
619
+ value: fs$close
620
+ });
621
+ return close;
622
+ }(fs4.close);
623
+ fs4.closeSync = function(fs$closeSync) {
624
+ function closeSync(fd) {
625
+ fs$closeSync.apply(fs4, arguments);
626
+ resetQueue();
627
+ }
628
+ Object.defineProperty(closeSync, previousSymbol, {
629
+ value: fs$closeSync
630
+ });
631
+ return closeSync;
632
+ }(fs4.closeSync);
633
+ if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || "")) {
634
+ process.on("exit", function() {
635
+ debug(fs4[gracefulQueue]);
636
+ __require("assert").equal(fs4[gracefulQueue].length, 0);
637
+ });
638
+ }
639
+ }
640
+ var queue;
641
+ if (!global[gracefulQueue]) {
642
+ publishQueue(global, fs4[gracefulQueue]);
643
+ }
644
+ module.exports = patch(clone(fs4));
645
+ if (process.env.TEST_GRACEFUL_FS_GLOBAL_PATCH && !fs4.__patched) {
646
+ module.exports = patch(fs4);
647
+ fs4.__patched = true;
648
+ }
649
+ function patch(fs5) {
650
+ polyfills(fs5);
651
+ fs5.gracefulify = patch;
652
+ fs5.createReadStream = createReadStream;
653
+ fs5.createWriteStream = createWriteStream;
654
+ var fs$readFile = fs5.readFile;
655
+ fs5.readFile = readFile;
656
+ function readFile(path5, options, cb) {
657
+ if (typeof options === "function")
658
+ cb = options, options = null;
659
+ return go$readFile(path5, options, cb);
660
+ function go$readFile(path6, options2, cb2, startTime) {
661
+ return fs$readFile(path6, options2, function(err) {
662
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
663
+ enqueue([go$readFile, [path6, options2, cb2], err, startTime || Date.now(), Date.now()]);
664
+ else {
665
+ if (typeof cb2 === "function")
666
+ cb2.apply(this, arguments);
667
+ }
668
+ });
669
+ }
670
+ }
671
+ var fs$writeFile = fs5.writeFile;
672
+ fs5.writeFile = writeFile;
673
+ function writeFile(path5, data, options, cb) {
674
+ if (typeof options === "function")
675
+ cb = options, options = null;
676
+ return go$writeFile(path5, data, options, cb);
677
+ function go$writeFile(path6, data2, options2, cb2, startTime) {
678
+ return fs$writeFile(path6, data2, options2, function(err) {
679
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
680
+ enqueue([go$writeFile, [path6, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
681
+ else {
682
+ if (typeof cb2 === "function")
683
+ cb2.apply(this, arguments);
684
+ }
685
+ });
686
+ }
687
+ }
688
+ var fs$appendFile = fs5.appendFile;
689
+ if (fs$appendFile)
690
+ fs5.appendFile = appendFile;
691
+ function appendFile(path5, data, options, cb) {
692
+ if (typeof options === "function")
693
+ cb = options, options = null;
694
+ return go$appendFile(path5, data, options, cb);
695
+ function go$appendFile(path6, data2, options2, cb2, startTime) {
696
+ return fs$appendFile(path6, data2, options2, function(err) {
697
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
698
+ enqueue([go$appendFile, [path6, data2, options2, cb2], err, startTime || Date.now(), Date.now()]);
699
+ else {
700
+ if (typeof cb2 === "function")
701
+ cb2.apply(this, arguments);
702
+ }
703
+ });
704
+ }
705
+ }
706
+ var fs$copyFile = fs5.copyFile;
707
+ if (fs$copyFile)
708
+ fs5.copyFile = copyFile;
709
+ function copyFile(src, dest, flags, cb) {
710
+ if (typeof flags === "function") {
711
+ cb = flags;
712
+ flags = 0;
713
+ }
714
+ return go$copyFile(src, dest, flags, cb);
715
+ function go$copyFile(src2, dest2, flags2, cb2, startTime) {
716
+ return fs$copyFile(src2, dest2, flags2, function(err) {
717
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
718
+ enqueue([go$copyFile, [src2, dest2, flags2, cb2], err, startTime || Date.now(), Date.now()]);
719
+ else {
720
+ if (typeof cb2 === "function")
721
+ cb2.apply(this, arguments);
722
+ }
723
+ });
724
+ }
725
+ }
726
+ var fs$readdir = fs5.readdir;
727
+ fs5.readdir = readdir;
728
+ var noReaddirOptionVersions = /^v[0-5]\./;
729
+ function readdir(path5, options, cb) {
730
+ if (typeof options === "function")
731
+ cb = options, options = null;
732
+ var go$readdir = noReaddirOptionVersions.test(process.version) ? function go$readdir2(path6, options2, cb2, startTime) {
733
+ return fs$readdir(path6, fs$readdirCallback(
734
+ path6,
735
+ options2,
736
+ cb2,
737
+ startTime
738
+ ));
739
+ } : function go$readdir2(path6, options2, cb2, startTime) {
740
+ return fs$readdir(path6, options2, fs$readdirCallback(
741
+ path6,
742
+ options2,
743
+ cb2,
744
+ startTime
745
+ ));
746
+ };
747
+ return go$readdir(path5, options, cb);
748
+ function fs$readdirCallback(path6, options2, cb2, startTime) {
749
+ return function(err, files) {
750
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
751
+ enqueue([
752
+ go$readdir,
753
+ [path6, options2, cb2],
754
+ err,
755
+ startTime || Date.now(),
756
+ Date.now()
757
+ ]);
758
+ else {
759
+ if (files && files.sort)
760
+ files.sort();
761
+ if (typeof cb2 === "function")
762
+ cb2.call(this, err, files);
763
+ }
764
+ };
765
+ }
766
+ }
767
+ if (process.version.substr(0, 4) === "v0.8") {
768
+ var legStreams = legacy(fs5);
769
+ ReadStream = legStreams.ReadStream;
770
+ WriteStream = legStreams.WriteStream;
771
+ }
772
+ var fs$ReadStream = fs5.ReadStream;
773
+ if (fs$ReadStream) {
774
+ ReadStream.prototype = Object.create(fs$ReadStream.prototype);
775
+ ReadStream.prototype.open = ReadStream$open;
776
+ }
777
+ var fs$WriteStream = fs5.WriteStream;
778
+ if (fs$WriteStream) {
779
+ WriteStream.prototype = Object.create(fs$WriteStream.prototype);
780
+ WriteStream.prototype.open = WriteStream$open;
781
+ }
782
+ Object.defineProperty(fs5, "ReadStream", {
783
+ get: function() {
784
+ return ReadStream;
785
+ },
786
+ set: function(val) {
787
+ ReadStream = val;
788
+ },
789
+ enumerable: true,
790
+ configurable: true
791
+ });
792
+ Object.defineProperty(fs5, "WriteStream", {
793
+ get: function() {
794
+ return WriteStream;
795
+ },
796
+ set: function(val) {
797
+ WriteStream = val;
798
+ },
799
+ enumerable: true,
800
+ configurable: true
801
+ });
802
+ var FileReadStream = ReadStream;
803
+ Object.defineProperty(fs5, "FileReadStream", {
804
+ get: function() {
805
+ return FileReadStream;
806
+ },
807
+ set: function(val) {
808
+ FileReadStream = val;
809
+ },
810
+ enumerable: true,
811
+ configurable: true
812
+ });
813
+ var FileWriteStream = WriteStream;
814
+ Object.defineProperty(fs5, "FileWriteStream", {
815
+ get: function() {
816
+ return FileWriteStream;
817
+ },
818
+ set: function(val) {
819
+ FileWriteStream = val;
820
+ },
821
+ enumerable: true,
822
+ configurable: true
823
+ });
824
+ function ReadStream(path5, options) {
825
+ if (this instanceof ReadStream)
826
+ return fs$ReadStream.apply(this, arguments), this;
827
+ else
828
+ return ReadStream.apply(Object.create(ReadStream.prototype), arguments);
829
+ }
830
+ function ReadStream$open() {
831
+ var that = this;
832
+ open(that.path, that.flags, that.mode, function(err, fd) {
833
+ if (err) {
834
+ if (that.autoClose)
835
+ that.destroy();
836
+ that.emit("error", err);
837
+ } else {
838
+ that.fd = fd;
839
+ that.emit("open", fd);
840
+ that.read();
841
+ }
842
+ });
843
+ }
844
+ function WriteStream(path5, options) {
845
+ if (this instanceof WriteStream)
846
+ return fs$WriteStream.apply(this, arguments), this;
847
+ else
848
+ return WriteStream.apply(Object.create(WriteStream.prototype), arguments);
849
+ }
850
+ function WriteStream$open() {
851
+ var that = this;
852
+ open(that.path, that.flags, that.mode, function(err, fd) {
853
+ if (err) {
854
+ that.destroy();
855
+ that.emit("error", err);
856
+ } else {
857
+ that.fd = fd;
858
+ that.emit("open", fd);
859
+ }
860
+ });
861
+ }
862
+ function createReadStream(path5, options) {
863
+ return new fs5.ReadStream(path5, options);
864
+ }
865
+ function createWriteStream(path5, options) {
866
+ return new fs5.WriteStream(path5, options);
867
+ }
868
+ var fs$open = fs5.open;
869
+ fs5.open = open;
870
+ function open(path5, flags, mode, cb) {
871
+ if (typeof mode === "function")
872
+ cb = mode, mode = null;
873
+ return go$open(path5, flags, mode, cb);
874
+ function go$open(path6, flags2, mode2, cb2, startTime) {
875
+ return fs$open(path6, flags2, mode2, function(err, fd) {
876
+ if (err && (err.code === "EMFILE" || err.code === "ENFILE"))
877
+ enqueue([go$open, [path6, flags2, mode2, cb2], err, startTime || Date.now(), Date.now()]);
878
+ else {
879
+ if (typeof cb2 === "function")
880
+ cb2.apply(this, arguments);
881
+ }
882
+ });
883
+ }
884
+ }
885
+ return fs5;
886
+ }
887
+ function enqueue(elem) {
888
+ debug("ENQUEUE", elem[0].name, elem[1]);
889
+ fs4[gracefulQueue].push(elem);
890
+ retry();
891
+ }
892
+ var retryTimer;
893
+ function resetQueue() {
894
+ var now = Date.now();
895
+ for (var i = 0; i < fs4[gracefulQueue].length; ++i) {
896
+ if (fs4[gracefulQueue][i].length > 2) {
897
+ fs4[gracefulQueue][i][3] = now;
898
+ fs4[gracefulQueue][i][4] = now;
899
+ }
900
+ }
901
+ retry();
902
+ }
903
+ function retry() {
904
+ clearTimeout(retryTimer);
905
+ retryTimer = void 0;
906
+ if (fs4[gracefulQueue].length === 0)
907
+ return;
908
+ var elem = fs4[gracefulQueue].shift();
909
+ var fn = elem[0];
910
+ var args = elem[1];
911
+ var err = elem[2];
912
+ var startTime = elem[3];
913
+ var lastTime = elem[4];
914
+ if (startTime === void 0) {
915
+ debug("RETRY", fn.name, args);
916
+ fn.apply(null, args);
917
+ } else if (Date.now() - startTime >= 6e4) {
918
+ debug("TIMEOUT", fn.name, args);
919
+ var cb = args.pop();
920
+ if (typeof cb === "function")
921
+ cb.call(null, err);
922
+ } else {
923
+ var sinceAttempt = Date.now() - lastTime;
924
+ var sinceStart = Math.max(lastTime - startTime, 1);
925
+ var desiredDelay = Math.min(sinceStart * 1.2, 100);
926
+ if (sinceAttempt >= desiredDelay) {
927
+ debug("RETRY", fn.name, args);
928
+ fn.apply(null, args.concat([startTime]));
929
+ } else {
930
+ fs4[gracefulQueue].push(elem);
931
+ }
932
+ }
933
+ if (retryTimer === void 0) {
934
+ retryTimer = setTimeout(retry, 0);
935
+ }
936
+ }
937
+ }
938
+ });
939
+
940
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/fs/index.js
941
+ var require_fs = __commonJS({
942
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/fs/index.js"(exports) {
943
+ init_esm_shims();
944
+ var u = require_universalify().fromCallback;
945
+ var fs4 = require_graceful_fs();
946
+ var api = [
947
+ "access",
948
+ "appendFile",
949
+ "chmod",
950
+ "chown",
951
+ "close",
952
+ "copyFile",
953
+ "fchmod",
954
+ "fchown",
955
+ "fdatasync",
956
+ "fstat",
957
+ "fsync",
958
+ "ftruncate",
959
+ "futimes",
960
+ "lchmod",
961
+ "lchown",
962
+ "link",
963
+ "lstat",
964
+ "mkdir",
965
+ "mkdtemp",
966
+ "open",
967
+ "opendir",
968
+ "readdir",
969
+ "readFile",
970
+ "readlink",
971
+ "realpath",
972
+ "rename",
973
+ "rm",
974
+ "rmdir",
975
+ "stat",
976
+ "symlink",
977
+ "truncate",
978
+ "unlink",
979
+ "utimes",
980
+ "writeFile"
981
+ ].filter((key) => {
982
+ return typeof fs4[key] === "function";
983
+ });
984
+ Object.assign(exports, fs4);
985
+ api.forEach((method) => {
986
+ exports[method] = u(fs4[method]);
987
+ });
988
+ exports.exists = function(filename, callback) {
989
+ if (typeof callback === "function") {
990
+ return fs4.exists(filename, callback);
991
+ }
992
+ return new Promise((resolve3) => {
993
+ return fs4.exists(filename, resolve3);
994
+ });
995
+ };
996
+ exports.read = function(fd, buffer, offset, length, position, callback) {
997
+ if (typeof callback === "function") {
998
+ return fs4.read(fd, buffer, offset, length, position, callback);
999
+ }
1000
+ return new Promise((resolve3, reject) => {
1001
+ fs4.read(fd, buffer, offset, length, position, (err, bytesRead, buffer2) => {
1002
+ if (err)
1003
+ return reject(err);
1004
+ resolve3({ bytesRead, buffer: buffer2 });
1005
+ });
1006
+ });
1007
+ };
1008
+ exports.write = function(fd, buffer, ...args) {
1009
+ if (typeof args[args.length - 1] === "function") {
1010
+ return fs4.write(fd, buffer, ...args);
1011
+ }
1012
+ return new Promise((resolve3, reject) => {
1013
+ fs4.write(fd, buffer, ...args, (err, bytesWritten, buffer2) => {
1014
+ if (err)
1015
+ return reject(err);
1016
+ resolve3({ bytesWritten, buffer: buffer2 });
1017
+ });
1018
+ });
1019
+ };
1020
+ exports.readv = function(fd, buffers, ...args) {
1021
+ if (typeof args[args.length - 1] === "function") {
1022
+ return fs4.readv(fd, buffers, ...args);
1023
+ }
1024
+ return new Promise((resolve3, reject) => {
1025
+ fs4.readv(fd, buffers, ...args, (err, bytesRead, buffers2) => {
1026
+ if (err)
1027
+ return reject(err);
1028
+ resolve3({ bytesRead, buffers: buffers2 });
1029
+ });
1030
+ });
1031
+ };
1032
+ exports.writev = function(fd, buffers, ...args) {
1033
+ if (typeof args[args.length - 1] === "function") {
1034
+ return fs4.writev(fd, buffers, ...args);
1035
+ }
1036
+ return new Promise((resolve3, reject) => {
1037
+ fs4.writev(fd, buffers, ...args, (err, bytesWritten, buffers2) => {
1038
+ if (err)
1039
+ return reject(err);
1040
+ resolve3({ bytesWritten, buffers: buffers2 });
1041
+ });
1042
+ });
1043
+ };
1044
+ if (typeof fs4.realpath.native === "function") {
1045
+ exports.realpath.native = u(fs4.realpath.native);
1046
+ } else {
1047
+ process.emitWarning(
1048
+ "fs.realpath.native is not a function. Is fs being monkey-patched?",
1049
+ "Warning",
1050
+ "fs-extra-WARN0003"
1051
+ );
1052
+ }
1053
+ }
1054
+ });
1055
+
1056
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/mkdirs/utils.js
1057
+ var require_utils = __commonJS({
1058
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/mkdirs/utils.js"(exports, module) {
1059
+ init_esm_shims();
1060
+ var path5 = __require("path");
1061
+ module.exports.checkPath = function checkPath(pth) {
1062
+ if (process.platform === "win32") {
1063
+ const pathHasInvalidWinCharacters = /[<>:"|?*]/.test(pth.replace(path5.parse(pth).root, ""));
1064
+ if (pathHasInvalidWinCharacters) {
1065
+ const error = new Error(`Path contains invalid characters: ${pth}`);
1066
+ error.code = "EINVAL";
1067
+ throw error;
1068
+ }
1069
+ }
1070
+ };
1071
+ }
1072
+ });
1073
+
1074
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/mkdirs/make-dir.js
1075
+ var require_make_dir = __commonJS({
1076
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/mkdirs/make-dir.js"(exports, module) {
1077
+ init_esm_shims();
1078
+ var fs4 = require_fs();
1079
+ var { checkPath } = require_utils();
1080
+ var getMode = (options) => {
1081
+ const defaults = { mode: 511 };
1082
+ if (typeof options === "number")
1083
+ return options;
1084
+ return { ...defaults, ...options }.mode;
1085
+ };
1086
+ module.exports.makeDir = async (dir, options) => {
1087
+ checkPath(dir);
1088
+ return fs4.mkdir(dir, {
1089
+ mode: getMode(options),
1090
+ recursive: true
1091
+ });
1092
+ };
1093
+ module.exports.makeDirSync = (dir, options) => {
1094
+ checkPath(dir);
1095
+ return fs4.mkdirSync(dir, {
1096
+ mode: getMode(options),
1097
+ recursive: true
1098
+ });
1099
+ };
1100
+ }
1101
+ });
1102
+
1103
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/mkdirs/index.js
1104
+ var require_mkdirs = __commonJS({
1105
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/mkdirs/index.js"(exports, module) {
1106
+ init_esm_shims();
1107
+ var u = require_universalify().fromPromise;
1108
+ var { makeDir: _makeDir, makeDirSync } = require_make_dir();
1109
+ var makeDir = u(_makeDir);
1110
+ module.exports = {
1111
+ mkdirs: makeDir,
1112
+ mkdirsSync: makeDirSync,
1113
+ // alias
1114
+ mkdirp: makeDir,
1115
+ mkdirpSync: makeDirSync,
1116
+ ensureDir: makeDir,
1117
+ ensureDirSync: makeDirSync
1118
+ };
1119
+ }
1120
+ });
1121
+
1122
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/path-exists/index.js
1123
+ var require_path_exists = __commonJS({
1124
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/path-exists/index.js"(exports, module) {
1125
+ init_esm_shims();
1126
+ var u = require_universalify().fromPromise;
1127
+ var fs4 = require_fs();
1128
+ function pathExists2(path5) {
1129
+ return fs4.access(path5).then(() => true).catch(() => false);
1130
+ }
1131
+ module.exports = {
1132
+ pathExists: u(pathExists2),
1133
+ pathExistsSync: fs4.existsSync
1134
+ };
1135
+ }
1136
+ });
1137
+
1138
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/util/utimes.js
1139
+ var require_utimes = __commonJS({
1140
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/util/utimes.js"(exports, module) {
1141
+ init_esm_shims();
1142
+ var fs4 = require_fs();
1143
+ var u = require_universalify().fromPromise;
1144
+ async function utimesMillis(path5, atime, mtime) {
1145
+ const fd = await fs4.open(path5, "r+");
1146
+ let closeErr = null;
1147
+ try {
1148
+ await fs4.futimes(fd, atime, mtime);
1149
+ } finally {
1150
+ try {
1151
+ await fs4.close(fd);
1152
+ } catch (e) {
1153
+ closeErr = e;
1154
+ }
1155
+ }
1156
+ if (closeErr) {
1157
+ throw closeErr;
1158
+ }
1159
+ }
1160
+ function utimesMillisSync(path5, atime, mtime) {
1161
+ const fd = fs4.openSync(path5, "r+");
1162
+ fs4.futimesSync(fd, atime, mtime);
1163
+ return fs4.closeSync(fd);
1164
+ }
1165
+ module.exports = {
1166
+ utimesMillis: u(utimesMillis),
1167
+ utimesMillisSync
1168
+ };
1169
+ }
1170
+ });
1171
+
1172
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/util/stat.js
1173
+ var require_stat = __commonJS({
1174
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/util/stat.js"(exports, module) {
1175
+ init_esm_shims();
1176
+ var fs4 = require_fs();
1177
+ var path5 = __require("path");
1178
+ var u = require_universalify().fromPromise;
1179
+ function getStats(src, dest, opts) {
1180
+ const statFunc = opts.dereference ? (file) => fs4.stat(file, { bigint: true }) : (file) => fs4.lstat(file, { bigint: true });
1181
+ return Promise.all([
1182
+ statFunc(src),
1183
+ statFunc(dest).catch((err) => {
1184
+ if (err.code === "ENOENT")
1185
+ return null;
1186
+ throw err;
1187
+ })
1188
+ ]).then(([srcStat, destStat]) => ({ srcStat, destStat }));
1189
+ }
1190
+ function getStatsSync(src, dest, opts) {
1191
+ let destStat;
1192
+ const statFunc = opts.dereference ? (file) => fs4.statSync(file, { bigint: true }) : (file) => fs4.lstatSync(file, { bigint: true });
1193
+ const srcStat = statFunc(src);
1194
+ try {
1195
+ destStat = statFunc(dest);
1196
+ } catch (err) {
1197
+ if (err.code === "ENOENT")
1198
+ return { srcStat, destStat: null };
1199
+ throw err;
1200
+ }
1201
+ return { srcStat, destStat };
1202
+ }
1203
+ async function checkPaths(src, dest, funcName, opts) {
1204
+ const { srcStat, destStat } = await getStats(src, dest, opts);
1205
+ if (destStat) {
1206
+ if (areIdentical(srcStat, destStat)) {
1207
+ const srcBaseName = path5.basename(src);
1208
+ const destBaseName = path5.basename(dest);
1209
+ if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
1210
+ return { srcStat, destStat, isChangingCase: true };
1211
+ }
1212
+ throw new Error("Source and destination must not be the same.");
1213
+ }
1214
+ if (srcStat.isDirectory() && !destStat.isDirectory()) {
1215
+ throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`);
1216
+ }
1217
+ if (!srcStat.isDirectory() && destStat.isDirectory()) {
1218
+ throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`);
1219
+ }
1220
+ }
1221
+ if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
1222
+ throw new Error(errMsg(src, dest, funcName));
1223
+ }
1224
+ return { srcStat, destStat };
1225
+ }
1226
+ function checkPathsSync(src, dest, funcName, opts) {
1227
+ const { srcStat, destStat } = getStatsSync(src, dest, opts);
1228
+ if (destStat) {
1229
+ if (areIdentical(srcStat, destStat)) {
1230
+ const srcBaseName = path5.basename(src);
1231
+ const destBaseName = path5.basename(dest);
1232
+ if (funcName === "move" && srcBaseName !== destBaseName && srcBaseName.toLowerCase() === destBaseName.toLowerCase()) {
1233
+ return { srcStat, destStat, isChangingCase: true };
1234
+ }
1235
+ throw new Error("Source and destination must not be the same.");
1236
+ }
1237
+ if (srcStat.isDirectory() && !destStat.isDirectory()) {
1238
+ throw new Error(`Cannot overwrite non-directory '${dest}' with directory '${src}'.`);
1239
+ }
1240
+ if (!srcStat.isDirectory() && destStat.isDirectory()) {
1241
+ throw new Error(`Cannot overwrite directory '${dest}' with non-directory '${src}'.`);
1242
+ }
1243
+ }
1244
+ if (srcStat.isDirectory() && isSrcSubdir(src, dest)) {
1245
+ throw new Error(errMsg(src, dest, funcName));
1246
+ }
1247
+ return { srcStat, destStat };
1248
+ }
1249
+ async function checkParentPaths(src, srcStat, dest, funcName) {
1250
+ const srcParent = path5.resolve(path5.dirname(src));
1251
+ const destParent = path5.resolve(path5.dirname(dest));
1252
+ if (destParent === srcParent || destParent === path5.parse(destParent).root)
1253
+ return;
1254
+ let destStat;
1255
+ try {
1256
+ destStat = await fs4.stat(destParent, { bigint: true });
1257
+ } catch (err) {
1258
+ if (err.code === "ENOENT")
1259
+ return;
1260
+ throw err;
1261
+ }
1262
+ if (areIdentical(srcStat, destStat)) {
1263
+ throw new Error(errMsg(src, dest, funcName));
1264
+ }
1265
+ return checkParentPaths(src, srcStat, destParent, funcName);
1266
+ }
1267
+ function checkParentPathsSync(src, srcStat, dest, funcName) {
1268
+ const srcParent = path5.resolve(path5.dirname(src));
1269
+ const destParent = path5.resolve(path5.dirname(dest));
1270
+ if (destParent === srcParent || destParent === path5.parse(destParent).root)
1271
+ return;
1272
+ let destStat;
1273
+ try {
1274
+ destStat = fs4.statSync(destParent, { bigint: true });
1275
+ } catch (err) {
1276
+ if (err.code === "ENOENT")
1277
+ return;
1278
+ throw err;
1279
+ }
1280
+ if (areIdentical(srcStat, destStat)) {
1281
+ throw new Error(errMsg(src, dest, funcName));
1282
+ }
1283
+ return checkParentPathsSync(src, srcStat, destParent, funcName);
1284
+ }
1285
+ function areIdentical(srcStat, destStat) {
1286
+ return destStat.ino && destStat.dev && destStat.ino === srcStat.ino && destStat.dev === srcStat.dev;
1287
+ }
1288
+ function isSrcSubdir(src, dest) {
1289
+ const srcArr = path5.resolve(src).split(path5.sep).filter((i) => i);
1290
+ const destArr = path5.resolve(dest).split(path5.sep).filter((i) => i);
1291
+ return srcArr.every((cur, i) => destArr[i] === cur);
1292
+ }
1293
+ function errMsg(src, dest, funcName) {
1294
+ return `Cannot ${funcName} '${src}' to a subdirectory of itself, '${dest}'.`;
1295
+ }
1296
+ module.exports = {
1297
+ // checkPaths
1298
+ checkPaths: u(checkPaths),
1299
+ checkPathsSync,
1300
+ // checkParent
1301
+ checkParentPaths: u(checkParentPaths),
1302
+ checkParentPathsSync,
1303
+ // Misc
1304
+ isSrcSubdir,
1305
+ areIdentical
1306
+ };
1307
+ }
1308
+ });
1309
+
1310
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/copy/copy.js
1311
+ var require_copy = __commonJS({
1312
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/copy/copy.js"(exports, module) {
1313
+ init_esm_shims();
1314
+ var fs4 = require_fs();
1315
+ var path5 = __require("path");
1316
+ var { mkdirs } = require_mkdirs();
1317
+ var { pathExists: pathExists2 } = require_path_exists();
1318
+ var { utimesMillis } = require_utimes();
1319
+ var stat = require_stat();
1320
+ async function copy(src, dest, opts = {}) {
1321
+ if (typeof opts === "function") {
1322
+ opts = { filter: opts };
1323
+ }
1324
+ opts.clobber = "clobber" in opts ? !!opts.clobber : true;
1325
+ opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber;
1326
+ if (opts.preserveTimestamps && process.arch === "ia32") {
1327
+ process.emitWarning(
1328
+ "Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269",
1329
+ "Warning",
1330
+ "fs-extra-WARN0001"
1331
+ );
1332
+ }
1333
+ const { srcStat, destStat } = await stat.checkPaths(src, dest, "copy", opts);
1334
+ await stat.checkParentPaths(src, srcStat, dest, "copy");
1335
+ const include = await runFilter(src, dest, opts);
1336
+ if (!include)
1337
+ return;
1338
+ const destParent = path5.dirname(dest);
1339
+ const dirExists = await pathExists2(destParent);
1340
+ if (!dirExists) {
1341
+ await mkdirs(destParent);
1342
+ }
1343
+ await getStatsAndPerformCopy(destStat, src, dest, opts);
1344
+ }
1345
+ async function runFilter(src, dest, opts) {
1346
+ if (!opts.filter)
1347
+ return true;
1348
+ return opts.filter(src, dest);
1349
+ }
1350
+ async function getStatsAndPerformCopy(destStat, src, dest, opts) {
1351
+ const statFn = opts.dereference ? fs4.stat : fs4.lstat;
1352
+ const srcStat = await statFn(src);
1353
+ if (srcStat.isDirectory())
1354
+ return onDir(srcStat, destStat, src, dest, opts);
1355
+ if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice())
1356
+ return onFile(srcStat, destStat, src, dest, opts);
1357
+ if (srcStat.isSymbolicLink())
1358
+ return onLink(destStat, src, dest, opts);
1359
+ if (srcStat.isSocket())
1360
+ throw new Error(`Cannot copy a socket file: ${src}`);
1361
+ if (srcStat.isFIFO())
1362
+ throw new Error(`Cannot copy a FIFO pipe: ${src}`);
1363
+ throw new Error(`Unknown file: ${src}`);
1364
+ }
1365
+ async function onFile(srcStat, destStat, src, dest, opts) {
1366
+ if (!destStat)
1367
+ return copyFile(srcStat, src, dest, opts);
1368
+ if (opts.overwrite) {
1369
+ await fs4.unlink(dest);
1370
+ return copyFile(srcStat, src, dest, opts);
1371
+ }
1372
+ if (opts.errorOnExist) {
1373
+ throw new Error(`'${dest}' already exists`);
1374
+ }
1375
+ }
1376
+ async function copyFile(srcStat, src, dest, opts) {
1377
+ await fs4.copyFile(src, dest);
1378
+ if (opts.preserveTimestamps) {
1379
+ if (fileIsNotWritable(srcStat.mode)) {
1380
+ await makeFileWritable(dest, srcStat.mode);
1381
+ }
1382
+ const updatedSrcStat = await fs4.stat(src);
1383
+ await utimesMillis(dest, updatedSrcStat.atime, updatedSrcStat.mtime);
1384
+ }
1385
+ return fs4.chmod(dest, srcStat.mode);
1386
+ }
1387
+ function fileIsNotWritable(srcMode) {
1388
+ return (srcMode & 128) === 0;
1389
+ }
1390
+ function makeFileWritable(dest, srcMode) {
1391
+ return fs4.chmod(dest, srcMode | 128);
1392
+ }
1393
+ async function onDir(srcStat, destStat, src, dest, opts) {
1394
+ if (!destStat) {
1395
+ await fs4.mkdir(dest);
1396
+ }
1397
+ const items = await fs4.readdir(src);
1398
+ await Promise.all(items.map(async (item) => {
1399
+ const srcItem = path5.join(src, item);
1400
+ const destItem = path5.join(dest, item);
1401
+ const include = await runFilter(srcItem, destItem, opts);
1402
+ if (!include)
1403
+ return;
1404
+ const { destStat: destStat2 } = await stat.checkPaths(srcItem, destItem, "copy", opts);
1405
+ return getStatsAndPerformCopy(destStat2, srcItem, destItem, opts);
1406
+ }));
1407
+ if (!destStat) {
1408
+ await fs4.chmod(dest, srcStat.mode);
1409
+ }
1410
+ }
1411
+ async function onLink(destStat, src, dest, opts) {
1412
+ let resolvedSrc = await fs4.readlink(src);
1413
+ if (opts.dereference) {
1414
+ resolvedSrc = path5.resolve(process.cwd(), resolvedSrc);
1415
+ }
1416
+ if (!destStat) {
1417
+ return fs4.symlink(resolvedSrc, dest);
1418
+ }
1419
+ let resolvedDest = null;
1420
+ try {
1421
+ resolvedDest = await fs4.readlink(dest);
1422
+ } catch (e) {
1423
+ if (e.code === "EINVAL" || e.code === "UNKNOWN")
1424
+ return fs4.symlink(resolvedSrc, dest);
1425
+ throw e;
1426
+ }
1427
+ if (opts.dereference) {
1428
+ resolvedDest = path5.resolve(process.cwd(), resolvedDest);
1429
+ }
1430
+ if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
1431
+ throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`);
1432
+ }
1433
+ if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
1434
+ throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`);
1435
+ }
1436
+ await fs4.unlink(dest);
1437
+ return fs4.symlink(resolvedSrc, dest);
1438
+ }
1439
+ module.exports = copy;
1440
+ }
1441
+ });
1442
+
1443
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/copy/copy-sync.js
1444
+ var require_copy_sync = __commonJS({
1445
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/copy/copy-sync.js"(exports, module) {
1446
+ init_esm_shims();
1447
+ var fs4 = require_graceful_fs();
1448
+ var path5 = __require("path");
1449
+ var mkdirsSync = require_mkdirs().mkdirsSync;
1450
+ var utimesMillisSync = require_utimes().utimesMillisSync;
1451
+ var stat = require_stat();
1452
+ function copySync(src, dest, opts) {
1453
+ if (typeof opts === "function") {
1454
+ opts = { filter: opts };
1455
+ }
1456
+ opts = opts || {};
1457
+ opts.clobber = "clobber" in opts ? !!opts.clobber : true;
1458
+ opts.overwrite = "overwrite" in opts ? !!opts.overwrite : opts.clobber;
1459
+ if (opts.preserveTimestamps && process.arch === "ia32") {
1460
+ process.emitWarning(
1461
+ "Using the preserveTimestamps option in 32-bit node is not recommended;\n\n see https://github.com/jprichardson/node-fs-extra/issues/269",
1462
+ "Warning",
1463
+ "fs-extra-WARN0002"
1464
+ );
1465
+ }
1466
+ const { srcStat, destStat } = stat.checkPathsSync(src, dest, "copy", opts);
1467
+ stat.checkParentPathsSync(src, srcStat, dest, "copy");
1468
+ if (opts.filter && !opts.filter(src, dest))
1469
+ return;
1470
+ const destParent = path5.dirname(dest);
1471
+ if (!fs4.existsSync(destParent))
1472
+ mkdirsSync(destParent);
1473
+ return getStats(destStat, src, dest, opts);
1474
+ }
1475
+ function getStats(destStat, src, dest, opts) {
1476
+ const statSync = opts.dereference ? fs4.statSync : fs4.lstatSync;
1477
+ const srcStat = statSync(src);
1478
+ if (srcStat.isDirectory())
1479
+ return onDir(srcStat, destStat, src, dest, opts);
1480
+ else if (srcStat.isFile() || srcStat.isCharacterDevice() || srcStat.isBlockDevice())
1481
+ return onFile(srcStat, destStat, src, dest, opts);
1482
+ else if (srcStat.isSymbolicLink())
1483
+ return onLink(destStat, src, dest, opts);
1484
+ else if (srcStat.isSocket())
1485
+ throw new Error(`Cannot copy a socket file: ${src}`);
1486
+ else if (srcStat.isFIFO())
1487
+ throw new Error(`Cannot copy a FIFO pipe: ${src}`);
1488
+ throw new Error(`Unknown file: ${src}`);
1489
+ }
1490
+ function onFile(srcStat, destStat, src, dest, opts) {
1491
+ if (!destStat)
1492
+ return copyFile(srcStat, src, dest, opts);
1493
+ return mayCopyFile(srcStat, src, dest, opts);
1494
+ }
1495
+ function mayCopyFile(srcStat, src, dest, opts) {
1496
+ if (opts.overwrite) {
1497
+ fs4.unlinkSync(dest);
1498
+ return copyFile(srcStat, src, dest, opts);
1499
+ } else if (opts.errorOnExist) {
1500
+ throw new Error(`'${dest}' already exists`);
1501
+ }
1502
+ }
1503
+ function copyFile(srcStat, src, dest, opts) {
1504
+ fs4.copyFileSync(src, dest);
1505
+ if (opts.preserveTimestamps)
1506
+ handleTimestamps(srcStat.mode, src, dest);
1507
+ return setDestMode(dest, srcStat.mode);
1508
+ }
1509
+ function handleTimestamps(srcMode, src, dest) {
1510
+ if (fileIsNotWritable(srcMode))
1511
+ makeFileWritable(dest, srcMode);
1512
+ return setDestTimestamps(src, dest);
1513
+ }
1514
+ function fileIsNotWritable(srcMode) {
1515
+ return (srcMode & 128) === 0;
1516
+ }
1517
+ function makeFileWritable(dest, srcMode) {
1518
+ return setDestMode(dest, srcMode | 128);
1519
+ }
1520
+ function setDestMode(dest, srcMode) {
1521
+ return fs4.chmodSync(dest, srcMode);
1522
+ }
1523
+ function setDestTimestamps(src, dest) {
1524
+ const updatedSrcStat = fs4.statSync(src);
1525
+ return utimesMillisSync(dest, updatedSrcStat.atime, updatedSrcStat.mtime);
1526
+ }
1527
+ function onDir(srcStat, destStat, src, dest, opts) {
1528
+ if (!destStat)
1529
+ return mkDirAndCopy(srcStat.mode, src, dest, opts);
1530
+ return copyDir(src, dest, opts);
1531
+ }
1532
+ function mkDirAndCopy(srcMode, src, dest, opts) {
1533
+ fs4.mkdirSync(dest);
1534
+ copyDir(src, dest, opts);
1535
+ return setDestMode(dest, srcMode);
1536
+ }
1537
+ function copyDir(src, dest, opts) {
1538
+ fs4.readdirSync(src).forEach((item) => copyDirItem(item, src, dest, opts));
1539
+ }
1540
+ function copyDirItem(item, src, dest, opts) {
1541
+ const srcItem = path5.join(src, item);
1542
+ const destItem = path5.join(dest, item);
1543
+ if (opts.filter && !opts.filter(srcItem, destItem))
1544
+ return;
1545
+ const { destStat } = stat.checkPathsSync(srcItem, destItem, "copy", opts);
1546
+ return getStats(destStat, srcItem, destItem, opts);
1547
+ }
1548
+ function onLink(destStat, src, dest, opts) {
1549
+ let resolvedSrc = fs4.readlinkSync(src);
1550
+ if (opts.dereference) {
1551
+ resolvedSrc = path5.resolve(process.cwd(), resolvedSrc);
1552
+ }
1553
+ if (!destStat) {
1554
+ return fs4.symlinkSync(resolvedSrc, dest);
1555
+ } else {
1556
+ let resolvedDest;
1557
+ try {
1558
+ resolvedDest = fs4.readlinkSync(dest);
1559
+ } catch (err) {
1560
+ if (err.code === "EINVAL" || err.code === "UNKNOWN")
1561
+ return fs4.symlinkSync(resolvedSrc, dest);
1562
+ throw err;
1563
+ }
1564
+ if (opts.dereference) {
1565
+ resolvedDest = path5.resolve(process.cwd(), resolvedDest);
1566
+ }
1567
+ if (stat.isSrcSubdir(resolvedSrc, resolvedDest)) {
1568
+ throw new Error(`Cannot copy '${resolvedSrc}' to a subdirectory of itself, '${resolvedDest}'.`);
1569
+ }
1570
+ if (stat.isSrcSubdir(resolvedDest, resolvedSrc)) {
1571
+ throw new Error(`Cannot overwrite '${resolvedDest}' with '${resolvedSrc}'.`);
1572
+ }
1573
+ return copyLink(resolvedSrc, dest);
1574
+ }
1575
+ }
1576
+ function copyLink(resolvedSrc, dest) {
1577
+ fs4.unlinkSync(dest);
1578
+ return fs4.symlinkSync(resolvedSrc, dest);
1579
+ }
1580
+ module.exports = copySync;
1581
+ }
1582
+ });
1583
+
1584
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/copy/index.js
1585
+ var require_copy2 = __commonJS({
1586
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/copy/index.js"(exports, module) {
1587
+ init_esm_shims();
1588
+ var u = require_universalify().fromPromise;
1589
+ module.exports = {
1590
+ copy: u(require_copy()),
1591
+ copySync: require_copy_sync()
1592
+ };
1593
+ }
1594
+ });
1595
+
1596
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/remove/index.js
1597
+ var require_remove = __commonJS({
1598
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/remove/index.js"(exports, module) {
1599
+ init_esm_shims();
1600
+ var fs4 = require_graceful_fs();
1601
+ var u = require_universalify().fromCallback;
1602
+ function remove2(path5, callback) {
1603
+ fs4.rm(path5, { recursive: true, force: true }, callback);
1604
+ }
1605
+ function removeSync(path5) {
1606
+ fs4.rmSync(path5, { recursive: true, force: true });
1607
+ }
1608
+ module.exports = {
1609
+ remove: u(remove2),
1610
+ removeSync
1611
+ };
1612
+ }
1613
+ });
1614
+
1615
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/empty/index.js
1616
+ var require_empty = __commonJS({
1617
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/empty/index.js"(exports, module) {
1618
+ init_esm_shims();
1619
+ var u = require_universalify().fromPromise;
1620
+ var fs4 = require_fs();
1621
+ var path5 = __require("path");
1622
+ var mkdir = require_mkdirs();
1623
+ var remove2 = require_remove();
1624
+ var emptyDir = u(async function emptyDir2(dir) {
1625
+ let items;
1626
+ try {
1627
+ items = await fs4.readdir(dir);
1628
+ } catch {
1629
+ return mkdir.mkdirs(dir);
1630
+ }
1631
+ return Promise.all(items.map((item) => remove2.remove(path5.join(dir, item))));
1632
+ });
1633
+ function emptyDirSync(dir) {
1634
+ let items;
1635
+ try {
1636
+ items = fs4.readdirSync(dir);
1637
+ } catch {
1638
+ return mkdir.mkdirsSync(dir);
1639
+ }
1640
+ items.forEach((item) => {
1641
+ item = path5.join(dir, item);
1642
+ remove2.removeSync(item);
1643
+ });
1644
+ }
1645
+ module.exports = {
1646
+ emptyDirSync,
1647
+ emptydirSync: emptyDirSync,
1648
+ emptyDir,
1649
+ emptydir: emptyDir
1650
+ };
1651
+ }
1652
+ });
1653
+
1654
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/file.js
1655
+ var require_file = __commonJS({
1656
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/file.js"(exports, module) {
1657
+ init_esm_shims();
1658
+ var u = require_universalify().fromPromise;
1659
+ var path5 = __require("path");
1660
+ var fs4 = require_fs();
1661
+ var mkdir = require_mkdirs();
1662
+ async function createFile(file) {
1663
+ let stats;
1664
+ try {
1665
+ stats = await fs4.stat(file);
1666
+ } catch {
1667
+ }
1668
+ if (stats && stats.isFile())
1669
+ return;
1670
+ const dir = path5.dirname(file);
1671
+ let dirStats = null;
1672
+ try {
1673
+ dirStats = await fs4.stat(dir);
1674
+ } catch (err) {
1675
+ if (err.code === "ENOENT") {
1676
+ await mkdir.mkdirs(dir);
1677
+ await fs4.writeFile(file, "");
1678
+ return;
1679
+ } else {
1680
+ throw err;
1681
+ }
1682
+ }
1683
+ if (dirStats.isDirectory()) {
1684
+ await fs4.writeFile(file, "");
1685
+ } else {
1686
+ await fs4.readdir(dir);
1687
+ }
1688
+ }
1689
+ function createFileSync(file) {
1690
+ let stats;
1691
+ try {
1692
+ stats = fs4.statSync(file);
1693
+ } catch {
1694
+ }
1695
+ if (stats && stats.isFile())
1696
+ return;
1697
+ const dir = path5.dirname(file);
1698
+ try {
1699
+ if (!fs4.statSync(dir).isDirectory()) {
1700
+ fs4.readdirSync(dir);
1701
+ }
1702
+ } catch (err) {
1703
+ if (err && err.code === "ENOENT")
1704
+ mkdir.mkdirsSync(dir);
1705
+ else
1706
+ throw err;
1707
+ }
1708
+ fs4.writeFileSync(file, "");
1709
+ }
1710
+ module.exports = {
1711
+ createFile: u(createFile),
1712
+ createFileSync
1713
+ };
1714
+ }
1715
+ });
1716
+
1717
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/link.js
1718
+ var require_link = __commonJS({
1719
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/link.js"(exports, module) {
1720
+ init_esm_shims();
1721
+ var u = require_universalify().fromPromise;
1722
+ var path5 = __require("path");
1723
+ var fs4 = require_fs();
1724
+ var mkdir = require_mkdirs();
1725
+ var { pathExists: pathExists2 } = require_path_exists();
1726
+ var { areIdentical } = require_stat();
1727
+ async function createLink(srcpath, dstpath) {
1728
+ let dstStat;
1729
+ try {
1730
+ dstStat = await fs4.lstat(dstpath);
1731
+ } catch {
1732
+ }
1733
+ let srcStat;
1734
+ try {
1735
+ srcStat = await fs4.lstat(srcpath);
1736
+ } catch (err) {
1737
+ err.message = err.message.replace("lstat", "ensureLink");
1738
+ throw err;
1739
+ }
1740
+ if (dstStat && areIdentical(srcStat, dstStat))
1741
+ return;
1742
+ const dir = path5.dirname(dstpath);
1743
+ const dirExists = await pathExists2(dir);
1744
+ if (!dirExists) {
1745
+ await mkdir.mkdirs(dir);
1746
+ }
1747
+ await fs4.link(srcpath, dstpath);
1748
+ }
1749
+ function createLinkSync(srcpath, dstpath) {
1750
+ let dstStat;
1751
+ try {
1752
+ dstStat = fs4.lstatSync(dstpath);
1753
+ } catch {
1754
+ }
1755
+ try {
1756
+ const srcStat = fs4.lstatSync(srcpath);
1757
+ if (dstStat && areIdentical(srcStat, dstStat))
1758
+ return;
1759
+ } catch (err) {
1760
+ err.message = err.message.replace("lstat", "ensureLink");
1761
+ throw err;
1762
+ }
1763
+ const dir = path5.dirname(dstpath);
1764
+ const dirExists = fs4.existsSync(dir);
1765
+ if (dirExists)
1766
+ return fs4.linkSync(srcpath, dstpath);
1767
+ mkdir.mkdirsSync(dir);
1768
+ return fs4.linkSync(srcpath, dstpath);
1769
+ }
1770
+ module.exports = {
1771
+ createLink: u(createLink),
1772
+ createLinkSync
1773
+ };
1774
+ }
1775
+ });
1776
+
1777
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/symlink-paths.js
1778
+ var require_symlink_paths = __commonJS({
1779
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/symlink-paths.js"(exports, module) {
1780
+ init_esm_shims();
1781
+ var path5 = __require("path");
1782
+ var fs4 = require_fs();
1783
+ var { pathExists: pathExists2 } = require_path_exists();
1784
+ var u = require_universalify().fromPromise;
1785
+ async function symlinkPaths(srcpath, dstpath) {
1786
+ if (path5.isAbsolute(srcpath)) {
1787
+ try {
1788
+ await fs4.lstat(srcpath);
1789
+ } catch (err) {
1790
+ err.message = err.message.replace("lstat", "ensureSymlink");
1791
+ throw err;
1792
+ }
1793
+ return {
1794
+ toCwd: srcpath,
1795
+ toDst: srcpath
1796
+ };
1797
+ }
1798
+ const dstdir = path5.dirname(dstpath);
1799
+ const relativeToDst = path5.join(dstdir, srcpath);
1800
+ const exists = await pathExists2(relativeToDst);
1801
+ if (exists) {
1802
+ return {
1803
+ toCwd: relativeToDst,
1804
+ toDst: srcpath
1805
+ };
1806
+ }
1807
+ try {
1808
+ await fs4.lstat(srcpath);
1809
+ } catch (err) {
1810
+ err.message = err.message.replace("lstat", "ensureSymlink");
1811
+ throw err;
1812
+ }
1813
+ return {
1814
+ toCwd: srcpath,
1815
+ toDst: path5.relative(dstdir, srcpath)
1816
+ };
1817
+ }
1818
+ function symlinkPathsSync(srcpath, dstpath) {
1819
+ if (path5.isAbsolute(srcpath)) {
1820
+ const exists2 = fs4.existsSync(srcpath);
1821
+ if (!exists2)
1822
+ throw new Error("absolute srcpath does not exist");
1823
+ return {
1824
+ toCwd: srcpath,
1825
+ toDst: srcpath
1826
+ };
1827
+ }
1828
+ const dstdir = path5.dirname(dstpath);
1829
+ const relativeToDst = path5.join(dstdir, srcpath);
1830
+ const exists = fs4.existsSync(relativeToDst);
1831
+ if (exists) {
1832
+ return {
1833
+ toCwd: relativeToDst,
1834
+ toDst: srcpath
1835
+ };
1836
+ }
1837
+ const srcExists = fs4.existsSync(srcpath);
1838
+ if (!srcExists)
1839
+ throw new Error("relative srcpath does not exist");
1840
+ return {
1841
+ toCwd: srcpath,
1842
+ toDst: path5.relative(dstdir, srcpath)
1843
+ };
1844
+ }
1845
+ module.exports = {
1846
+ symlinkPaths: u(symlinkPaths),
1847
+ symlinkPathsSync
1848
+ };
1849
+ }
1850
+ });
1851
+
1852
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/symlink-type.js
1853
+ var require_symlink_type = __commonJS({
1854
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/symlink-type.js"(exports, module) {
1855
+ init_esm_shims();
1856
+ var fs4 = require_fs();
1857
+ var u = require_universalify().fromPromise;
1858
+ async function symlinkType(srcpath, type) {
1859
+ if (type)
1860
+ return type;
1861
+ let stats;
1862
+ try {
1863
+ stats = await fs4.lstat(srcpath);
1864
+ } catch {
1865
+ return "file";
1866
+ }
1867
+ return stats && stats.isDirectory() ? "dir" : "file";
1868
+ }
1869
+ function symlinkTypeSync(srcpath, type) {
1870
+ if (type)
1871
+ return type;
1872
+ let stats;
1873
+ try {
1874
+ stats = fs4.lstatSync(srcpath);
1875
+ } catch {
1876
+ return "file";
1877
+ }
1878
+ return stats && stats.isDirectory() ? "dir" : "file";
1879
+ }
1880
+ module.exports = {
1881
+ symlinkType: u(symlinkType),
1882
+ symlinkTypeSync
1883
+ };
1884
+ }
1885
+ });
1886
+
1887
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/symlink.js
1888
+ var require_symlink = __commonJS({
1889
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/symlink.js"(exports, module) {
1890
+ init_esm_shims();
1891
+ var u = require_universalify().fromPromise;
1892
+ var path5 = __require("path");
1893
+ var fs4 = require_fs();
1894
+ var { mkdirs, mkdirsSync } = require_mkdirs();
1895
+ var { symlinkPaths, symlinkPathsSync } = require_symlink_paths();
1896
+ var { symlinkType, symlinkTypeSync } = require_symlink_type();
1897
+ var { pathExists: pathExists2 } = require_path_exists();
1898
+ var { areIdentical } = require_stat();
1899
+ async function createSymlink(srcpath, dstpath, type) {
1900
+ let stats;
1901
+ try {
1902
+ stats = await fs4.lstat(dstpath);
1903
+ } catch {
1904
+ }
1905
+ if (stats && stats.isSymbolicLink()) {
1906
+ const [srcStat, dstStat] = await Promise.all([
1907
+ fs4.stat(srcpath),
1908
+ fs4.stat(dstpath)
1909
+ ]);
1910
+ if (areIdentical(srcStat, dstStat))
1911
+ return;
1912
+ }
1913
+ const relative2 = await symlinkPaths(srcpath, dstpath);
1914
+ srcpath = relative2.toDst;
1915
+ const toType = await symlinkType(relative2.toCwd, type);
1916
+ const dir = path5.dirname(dstpath);
1917
+ if (!await pathExists2(dir)) {
1918
+ await mkdirs(dir);
1919
+ }
1920
+ return fs4.symlink(srcpath, dstpath, toType);
1921
+ }
1922
+ function createSymlinkSync(srcpath, dstpath, type) {
1923
+ let stats;
1924
+ try {
1925
+ stats = fs4.lstatSync(dstpath);
1926
+ } catch {
1927
+ }
1928
+ if (stats && stats.isSymbolicLink()) {
1929
+ const srcStat = fs4.statSync(srcpath);
1930
+ const dstStat = fs4.statSync(dstpath);
1931
+ if (areIdentical(srcStat, dstStat))
1932
+ return;
1933
+ }
1934
+ const relative2 = symlinkPathsSync(srcpath, dstpath);
1935
+ srcpath = relative2.toDst;
1936
+ type = symlinkTypeSync(relative2.toCwd, type);
1937
+ const dir = path5.dirname(dstpath);
1938
+ const exists = fs4.existsSync(dir);
1939
+ if (exists)
1940
+ return fs4.symlinkSync(srcpath, dstpath, type);
1941
+ mkdirsSync(dir);
1942
+ return fs4.symlinkSync(srcpath, dstpath, type);
1943
+ }
1944
+ module.exports = {
1945
+ createSymlink: u(createSymlink),
1946
+ createSymlinkSync
1947
+ };
1948
+ }
1949
+ });
1950
+
1951
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/index.js
1952
+ var require_ensure = __commonJS({
1953
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/ensure/index.js"(exports, module) {
1954
+ init_esm_shims();
1955
+ var { createFile, createFileSync } = require_file();
1956
+ var { createLink, createLinkSync } = require_link();
1957
+ var { createSymlink, createSymlinkSync } = require_symlink();
1958
+ module.exports = {
1959
+ // file
1960
+ createFile,
1961
+ createFileSync,
1962
+ ensureFile: createFile,
1963
+ ensureFileSync: createFileSync,
1964
+ // link
1965
+ createLink,
1966
+ createLinkSync,
1967
+ ensureLink: createLink,
1968
+ ensureLinkSync: createLinkSync,
1969
+ // symlink
1970
+ createSymlink,
1971
+ createSymlinkSync,
1972
+ ensureSymlink: createSymlink,
1973
+ ensureSymlinkSync: createSymlinkSync
1974
+ };
1975
+ }
1976
+ });
1977
+
1978
+ // ../../node_modules/.pnpm/jsonfile@6.1.0/node_modules/jsonfile/utils.js
1979
+ var require_utils2 = __commonJS({
1980
+ "../../node_modules/.pnpm/jsonfile@6.1.0/node_modules/jsonfile/utils.js"(exports, module) {
1981
+ init_esm_shims();
1982
+ function stringify(obj, { EOL = "\n", finalEOL = true, replacer = null, spaces } = {}) {
1983
+ const EOF = finalEOL ? EOL : "";
1984
+ const str = JSON.stringify(obj, replacer, spaces);
1985
+ return str.replace(/\n/g, EOL) + EOF;
1986
+ }
1987
+ function stripBom(content) {
1988
+ if (Buffer.isBuffer(content))
1989
+ content = content.toString("utf8");
1990
+ return content.replace(/^\uFEFF/, "");
1991
+ }
1992
+ module.exports = { stringify, stripBom };
1993
+ }
1994
+ });
1995
+
1996
+ // ../../node_modules/.pnpm/jsonfile@6.1.0/node_modules/jsonfile/index.js
1997
+ var require_jsonfile = __commonJS({
1998
+ "../../node_modules/.pnpm/jsonfile@6.1.0/node_modules/jsonfile/index.js"(exports, module) {
1999
+ init_esm_shims();
2000
+ var _fs;
2001
+ try {
2002
+ _fs = require_graceful_fs();
2003
+ } catch (_) {
2004
+ _fs = __require("fs");
2005
+ }
2006
+ var universalify = require_universalify();
2007
+ var { stringify, stripBom } = require_utils2();
2008
+ async function _readFile(file, options = {}) {
2009
+ if (typeof options === "string") {
2010
+ options = { encoding: options };
2011
+ }
2012
+ const fs4 = options.fs || _fs;
2013
+ const shouldThrow = "throws" in options ? options.throws : true;
2014
+ let data = await universalify.fromCallback(fs4.readFile)(file, options);
2015
+ data = stripBom(data);
2016
+ let obj;
2017
+ try {
2018
+ obj = JSON.parse(data, options ? options.reviver : null);
2019
+ } catch (err) {
2020
+ if (shouldThrow) {
2021
+ err.message = `${file}: ${err.message}`;
2022
+ throw err;
2023
+ } else {
2024
+ return null;
2025
+ }
2026
+ }
2027
+ return obj;
2028
+ }
2029
+ var readFile = universalify.fromPromise(_readFile);
2030
+ function readFileSync(file, options = {}) {
2031
+ if (typeof options === "string") {
2032
+ options = { encoding: options };
2033
+ }
2034
+ const fs4 = options.fs || _fs;
2035
+ const shouldThrow = "throws" in options ? options.throws : true;
2036
+ try {
2037
+ let content = fs4.readFileSync(file, options);
2038
+ content = stripBom(content);
2039
+ return JSON.parse(content, options.reviver);
2040
+ } catch (err) {
2041
+ if (shouldThrow) {
2042
+ err.message = `${file}: ${err.message}`;
2043
+ throw err;
2044
+ } else {
2045
+ return null;
2046
+ }
2047
+ }
2048
+ }
2049
+ async function _writeFile(file, obj, options = {}) {
2050
+ const fs4 = options.fs || _fs;
2051
+ const str = stringify(obj, options);
2052
+ await universalify.fromCallback(fs4.writeFile)(file, str, options);
2053
+ }
2054
+ var writeFile = universalify.fromPromise(_writeFile);
2055
+ function writeFileSync(file, obj, options = {}) {
2056
+ const fs4 = options.fs || _fs;
2057
+ const str = stringify(obj, options);
2058
+ return fs4.writeFileSync(file, str, options);
2059
+ }
2060
+ var jsonfile = {
2061
+ readFile,
2062
+ readFileSync,
2063
+ writeFile,
2064
+ writeFileSync
2065
+ };
2066
+ module.exports = jsonfile;
2067
+ }
2068
+ });
2069
+
2070
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/json/jsonfile.js
2071
+ var require_jsonfile2 = __commonJS({
2072
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/json/jsonfile.js"(exports, module) {
2073
+ init_esm_shims();
2074
+ var jsonFile = require_jsonfile();
2075
+ module.exports = {
2076
+ // jsonfile exports
2077
+ readJson: jsonFile.readFile,
2078
+ readJsonSync: jsonFile.readFileSync,
2079
+ writeJson: jsonFile.writeFile,
2080
+ writeJsonSync: jsonFile.writeFileSync
2081
+ };
2082
+ }
2083
+ });
2084
+
2085
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/output-file/index.js
2086
+ var require_output_file = __commonJS({
2087
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/output-file/index.js"(exports, module) {
2088
+ init_esm_shims();
2089
+ var u = require_universalify().fromPromise;
2090
+ var fs4 = require_fs();
2091
+ var path5 = __require("path");
2092
+ var mkdir = require_mkdirs();
2093
+ var pathExists2 = require_path_exists().pathExists;
2094
+ async function outputFile(file, data, encoding = "utf-8") {
2095
+ const dir = path5.dirname(file);
2096
+ if (!await pathExists2(dir)) {
2097
+ await mkdir.mkdirs(dir);
2098
+ }
2099
+ return fs4.writeFile(file, data, encoding);
2100
+ }
2101
+ function outputFileSync(file, ...args) {
2102
+ const dir = path5.dirname(file);
2103
+ if (!fs4.existsSync(dir)) {
2104
+ mkdir.mkdirsSync(dir);
2105
+ }
2106
+ fs4.writeFileSync(file, ...args);
2107
+ }
2108
+ module.exports = {
2109
+ outputFile: u(outputFile),
2110
+ outputFileSync
2111
+ };
2112
+ }
2113
+ });
2114
+
2115
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/json/output-json.js
2116
+ var require_output_json = __commonJS({
2117
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/json/output-json.js"(exports, module) {
2118
+ init_esm_shims();
2119
+ var { stringify } = require_utils2();
2120
+ var { outputFile } = require_output_file();
2121
+ async function outputJson(file, data, options = {}) {
2122
+ const str = stringify(data, options);
2123
+ await outputFile(file, str, options);
2124
+ }
2125
+ module.exports = outputJson;
2126
+ }
2127
+ });
2128
+
2129
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/json/output-json-sync.js
2130
+ var require_output_json_sync = __commonJS({
2131
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/json/output-json-sync.js"(exports, module) {
2132
+ init_esm_shims();
2133
+ var { stringify } = require_utils2();
2134
+ var { outputFileSync } = require_output_file();
2135
+ function outputJsonSync(file, data, options) {
2136
+ const str = stringify(data, options);
2137
+ outputFileSync(file, str, options);
2138
+ }
2139
+ module.exports = outputJsonSync;
2140
+ }
2141
+ });
2142
+
2143
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/json/index.js
2144
+ var require_json = __commonJS({
2145
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/json/index.js"(exports, module) {
2146
+ init_esm_shims();
2147
+ var u = require_universalify().fromPromise;
2148
+ var jsonFile = require_jsonfile2();
2149
+ jsonFile.outputJson = u(require_output_json());
2150
+ jsonFile.outputJsonSync = require_output_json_sync();
2151
+ jsonFile.outputJSON = jsonFile.outputJson;
2152
+ jsonFile.outputJSONSync = jsonFile.outputJsonSync;
2153
+ jsonFile.writeJSON = jsonFile.writeJson;
2154
+ jsonFile.writeJSONSync = jsonFile.writeJsonSync;
2155
+ jsonFile.readJSON = jsonFile.readJson;
2156
+ jsonFile.readJSONSync = jsonFile.readJsonSync;
2157
+ module.exports = jsonFile;
2158
+ }
2159
+ });
2160
+
2161
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/move/move.js
2162
+ var require_move = __commonJS({
2163
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/move/move.js"(exports, module) {
2164
+ init_esm_shims();
2165
+ var fs4 = require_fs();
2166
+ var path5 = __require("path");
2167
+ var { copy } = require_copy2();
2168
+ var { remove: remove2 } = require_remove();
2169
+ var { mkdirp } = require_mkdirs();
2170
+ var { pathExists: pathExists2 } = require_path_exists();
2171
+ var stat = require_stat();
2172
+ async function move(src, dest, opts = {}) {
2173
+ const overwrite = opts.overwrite || opts.clobber || false;
2174
+ const { srcStat, isChangingCase = false } = await stat.checkPaths(src, dest, "move", opts);
2175
+ await stat.checkParentPaths(src, srcStat, dest, "move");
2176
+ const destParent = path5.dirname(dest);
2177
+ const parsedParentPath = path5.parse(destParent);
2178
+ if (parsedParentPath.root !== destParent) {
2179
+ await mkdirp(destParent);
2180
+ }
2181
+ return doRename(src, dest, overwrite, isChangingCase);
2182
+ }
2183
+ async function doRename(src, dest, overwrite, isChangingCase) {
2184
+ if (!isChangingCase) {
2185
+ if (overwrite) {
2186
+ await remove2(dest);
2187
+ } else if (await pathExists2(dest)) {
2188
+ throw new Error("dest already exists.");
2189
+ }
2190
+ }
2191
+ try {
2192
+ await fs4.rename(src, dest);
2193
+ } catch (err) {
2194
+ if (err.code !== "EXDEV") {
2195
+ throw err;
2196
+ }
2197
+ await moveAcrossDevice(src, dest, overwrite);
2198
+ }
2199
+ }
2200
+ async function moveAcrossDevice(src, dest, overwrite) {
2201
+ const opts = {
2202
+ overwrite,
2203
+ errorOnExist: true,
2204
+ preserveTimestamps: true
2205
+ };
2206
+ await copy(src, dest, opts);
2207
+ return remove2(src);
2208
+ }
2209
+ module.exports = move;
2210
+ }
2211
+ });
2212
+
2213
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/move/move-sync.js
2214
+ var require_move_sync = __commonJS({
2215
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/move/move-sync.js"(exports, module) {
2216
+ init_esm_shims();
2217
+ var fs4 = require_graceful_fs();
2218
+ var path5 = __require("path");
2219
+ var copySync = require_copy2().copySync;
2220
+ var removeSync = require_remove().removeSync;
2221
+ var mkdirpSync = require_mkdirs().mkdirpSync;
2222
+ var stat = require_stat();
2223
+ function moveSync(src, dest, opts) {
2224
+ opts = opts || {};
2225
+ const overwrite = opts.overwrite || opts.clobber || false;
2226
+ const { srcStat, isChangingCase = false } = stat.checkPathsSync(src, dest, "move", opts);
2227
+ stat.checkParentPathsSync(src, srcStat, dest, "move");
2228
+ if (!isParentRoot(dest))
2229
+ mkdirpSync(path5.dirname(dest));
2230
+ return doRename(src, dest, overwrite, isChangingCase);
2231
+ }
2232
+ function isParentRoot(dest) {
2233
+ const parent = path5.dirname(dest);
2234
+ const parsedPath = path5.parse(parent);
2235
+ return parsedPath.root === parent;
2236
+ }
2237
+ function doRename(src, dest, overwrite, isChangingCase) {
2238
+ if (isChangingCase)
2239
+ return rename(src, dest, overwrite);
2240
+ if (overwrite) {
2241
+ removeSync(dest);
2242
+ return rename(src, dest, overwrite);
2243
+ }
2244
+ if (fs4.existsSync(dest))
2245
+ throw new Error("dest already exists.");
2246
+ return rename(src, dest, overwrite);
2247
+ }
2248
+ function rename(src, dest, overwrite) {
2249
+ try {
2250
+ fs4.renameSync(src, dest);
2251
+ } catch (err) {
2252
+ if (err.code !== "EXDEV")
2253
+ throw err;
2254
+ return moveAcrossDevice(src, dest, overwrite);
2255
+ }
2256
+ }
2257
+ function moveAcrossDevice(src, dest, overwrite) {
2258
+ const opts = {
2259
+ overwrite,
2260
+ errorOnExist: true,
2261
+ preserveTimestamps: true
2262
+ };
2263
+ copySync(src, dest, opts);
2264
+ return removeSync(src);
2265
+ }
2266
+ module.exports = moveSync;
2267
+ }
2268
+ });
2269
+
2270
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/move/index.js
2271
+ var require_move2 = __commonJS({
2272
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/move/index.js"(exports, module) {
2273
+ init_esm_shims();
2274
+ var u = require_universalify().fromPromise;
2275
+ module.exports = {
2276
+ move: u(require_move()),
2277
+ moveSync: require_move_sync()
2278
+ };
2279
+ }
2280
+ });
2281
+
2282
+ // ../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/index.js
2283
+ var require_lib = __commonJS({
2284
+ "../../node_modules/.pnpm/fs-extra@11.2.0/node_modules/fs-extra/lib/index.js"(exports, module) {
2285
+ init_esm_shims();
2286
+ module.exports = {
2287
+ // Export promiseified graceful-fs:
2288
+ ...require_fs(),
2289
+ // Export extra methods:
2290
+ ...require_copy2(),
2291
+ ...require_empty(),
2292
+ ...require_ensure(),
2293
+ ...require_json(),
2294
+ ...require_mkdirs(),
2295
+ ...require_move2(),
2296
+ ...require_output_file(),
2297
+ ...require_path_exists(),
2298
+ ...require_remove()
2299
+ };
2300
+ }
2301
+ });
2302
+
2303
+ // ../../node_modules/.pnpm/lodash.isequal@4.5.0/node_modules/lodash.isequal/index.js
2304
+ var require_lodash = __commonJS({
2305
+ "../../node_modules/.pnpm/lodash.isequal@4.5.0/node_modules/lodash.isequal/index.js"(exports, module) {
2306
+ init_esm_shims();
2307
+ var LARGE_ARRAY_SIZE = 200;
2308
+ var HASH_UNDEFINED = "__lodash_hash_undefined__";
2309
+ var COMPARE_PARTIAL_FLAG = 1;
2310
+ var COMPARE_UNORDERED_FLAG = 2;
2311
+ var MAX_SAFE_INTEGER = 9007199254740991;
2312
+ var argsTag = "[object Arguments]";
2313
+ var arrayTag = "[object Array]";
2314
+ var asyncTag = "[object AsyncFunction]";
2315
+ var boolTag = "[object Boolean]";
2316
+ var dateTag = "[object Date]";
2317
+ var errorTag = "[object Error]";
2318
+ var funcTag = "[object Function]";
2319
+ var genTag = "[object GeneratorFunction]";
2320
+ var mapTag = "[object Map]";
2321
+ var numberTag = "[object Number]";
2322
+ var nullTag = "[object Null]";
2323
+ var objectTag = "[object Object]";
2324
+ var promiseTag = "[object Promise]";
2325
+ var proxyTag = "[object Proxy]";
2326
+ var regexpTag = "[object RegExp]";
2327
+ var setTag = "[object Set]";
2328
+ var stringTag = "[object String]";
2329
+ var symbolTag = "[object Symbol]";
2330
+ var undefinedTag = "[object Undefined]";
2331
+ var weakMapTag = "[object WeakMap]";
2332
+ var arrayBufferTag = "[object ArrayBuffer]";
2333
+ var dataViewTag = "[object DataView]";
2334
+ var float32Tag = "[object Float32Array]";
2335
+ var float64Tag = "[object Float64Array]";
2336
+ var int8Tag = "[object Int8Array]";
2337
+ var int16Tag = "[object Int16Array]";
2338
+ var int32Tag = "[object Int32Array]";
2339
+ var uint8Tag = "[object Uint8Array]";
2340
+ var uint8ClampedTag = "[object Uint8ClampedArray]";
2341
+ var uint16Tag = "[object Uint16Array]";
2342
+ var uint32Tag = "[object Uint32Array]";
2343
+ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
2344
+ var reIsHostCtor = /^\[object .+?Constructor\]$/;
2345
+ var reIsUint = /^(?:0|[1-9]\d*)$/;
2346
+ var typedArrayTags = {};
2347
+ typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
2348
+ typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false;
2349
+ var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
2350
+ var freeSelf = typeof self == "object" && self && self.Object === Object && self;
2351
+ var root = freeGlobal || freeSelf || Function("return this")();
2352
+ var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
2353
+ var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
2354
+ var moduleExports = freeModule && freeModule.exports === freeExports;
2355
+ var freeProcess = moduleExports && freeGlobal.process;
2356
+ var nodeUtil = function() {
2357
+ try {
2358
+ return freeProcess && freeProcess.binding && freeProcess.binding("util");
2359
+ } catch (e) {
2360
+ }
2361
+ }();
2362
+ var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
2363
+ function arrayFilter(array, predicate) {
2364
+ var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
2365
+ while (++index < length) {
2366
+ var value = array[index];
2367
+ if (predicate(value, index, array)) {
2368
+ result[resIndex++] = value;
2369
+ }
2370
+ }
2371
+ return result;
2372
+ }
2373
+ function arrayPush(array, values) {
2374
+ var index = -1, length = values.length, offset = array.length;
2375
+ while (++index < length) {
2376
+ array[offset + index] = values[index];
2377
+ }
2378
+ return array;
2379
+ }
2380
+ function arraySome(array, predicate) {
2381
+ var index = -1, length = array == null ? 0 : array.length;
2382
+ while (++index < length) {
2383
+ if (predicate(array[index], index, array)) {
2384
+ return true;
2385
+ }
2386
+ }
2387
+ return false;
2388
+ }
2389
+ function baseTimes(n, iteratee) {
2390
+ var index = -1, result = Array(n);
2391
+ while (++index < n) {
2392
+ result[index] = iteratee(index);
2393
+ }
2394
+ return result;
2395
+ }
2396
+ function baseUnary(func) {
2397
+ return function(value) {
2398
+ return func(value);
2399
+ };
2400
+ }
2401
+ function cacheHas(cache, key) {
2402
+ return cache.has(key);
2403
+ }
2404
+ function getValue(object, key) {
2405
+ return object == null ? void 0 : object[key];
2406
+ }
2407
+ function mapToArray(map) {
2408
+ var index = -1, result = Array(map.size);
2409
+ map.forEach(function(value, key) {
2410
+ result[++index] = [key, value];
2411
+ });
2412
+ return result;
2413
+ }
2414
+ function overArg(func, transform) {
2415
+ return function(arg) {
2416
+ return func(transform(arg));
2417
+ };
2418
+ }
2419
+ function setToArray(set) {
2420
+ var index = -1, result = Array(set.size);
2421
+ set.forEach(function(value) {
2422
+ result[++index] = value;
2423
+ });
2424
+ return result;
2425
+ }
2426
+ var arrayProto = Array.prototype;
2427
+ var funcProto = Function.prototype;
2428
+ var objectProto = Object.prototype;
2429
+ var coreJsData = root["__core-js_shared__"];
2430
+ var funcToString = funcProto.toString;
2431
+ var hasOwnProperty = objectProto.hasOwnProperty;
2432
+ var maskSrcKey = function() {
2433
+ var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
2434
+ return uid ? "Symbol(src)_1." + uid : "";
2435
+ }();
2436
+ var nativeObjectToString = objectProto.toString;
2437
+ var reIsNative = RegExp(
2438
+ "^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
2439
+ );
2440
+ var Buffer2 = moduleExports ? root.Buffer : void 0;
2441
+ var Symbol2 = root.Symbol;
2442
+ var Uint8Array2 = root.Uint8Array;
2443
+ var propertyIsEnumerable = objectProto.propertyIsEnumerable;
2444
+ var splice = arrayProto.splice;
2445
+ var symToStringTag = Symbol2 ? Symbol2.toStringTag : void 0;
2446
+ var nativeGetSymbols = Object.getOwnPropertySymbols;
2447
+ var nativeIsBuffer = Buffer2 ? Buffer2.isBuffer : void 0;
2448
+ var nativeKeys = overArg(Object.keys, Object);
2449
+ var DataView = getNative(root, "DataView");
2450
+ var Map2 = getNative(root, "Map");
2451
+ var Promise2 = getNative(root, "Promise");
2452
+ var Set2 = getNative(root, "Set");
2453
+ var WeakMap2 = getNative(root, "WeakMap");
2454
+ var nativeCreate = getNative(Object, "create");
2455
+ var dataViewCtorString = toSource(DataView);
2456
+ var mapCtorString = toSource(Map2);
2457
+ var promiseCtorString = toSource(Promise2);
2458
+ var setCtorString = toSource(Set2);
2459
+ var weakMapCtorString = toSource(WeakMap2);
2460
+ var symbolProto = Symbol2 ? Symbol2.prototype : void 0;
2461
+ var symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
2462
+ function Hash(entries) {
2463
+ var index = -1, length = entries == null ? 0 : entries.length;
2464
+ this.clear();
2465
+ while (++index < length) {
2466
+ var entry = entries[index];
2467
+ this.set(entry[0], entry[1]);
2468
+ }
2469
+ }
2470
+ function hashClear() {
2471
+ this.__data__ = nativeCreate ? nativeCreate(null) : {};
2472
+ this.size = 0;
2473
+ }
2474
+ function hashDelete(key) {
2475
+ var result = this.has(key) && delete this.__data__[key];
2476
+ this.size -= result ? 1 : 0;
2477
+ return result;
2478
+ }
2479
+ function hashGet(key) {
2480
+ var data = this.__data__;
2481
+ if (nativeCreate) {
2482
+ var result = data[key];
2483
+ return result === HASH_UNDEFINED ? void 0 : result;
2484
+ }
2485
+ return hasOwnProperty.call(data, key) ? data[key] : void 0;
2486
+ }
2487
+ function hashHas(key) {
2488
+ var data = this.__data__;
2489
+ return nativeCreate ? data[key] !== void 0 : hasOwnProperty.call(data, key);
2490
+ }
2491
+ function hashSet(key, value) {
2492
+ var data = this.__data__;
2493
+ this.size += this.has(key) ? 0 : 1;
2494
+ data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED : value;
2495
+ return this;
2496
+ }
2497
+ Hash.prototype.clear = hashClear;
2498
+ Hash.prototype["delete"] = hashDelete;
2499
+ Hash.prototype.get = hashGet;
2500
+ Hash.prototype.has = hashHas;
2501
+ Hash.prototype.set = hashSet;
2502
+ function ListCache(entries) {
2503
+ var index = -1, length = entries == null ? 0 : entries.length;
2504
+ this.clear();
2505
+ while (++index < length) {
2506
+ var entry = entries[index];
2507
+ this.set(entry[0], entry[1]);
2508
+ }
2509
+ }
2510
+ function listCacheClear() {
2511
+ this.__data__ = [];
2512
+ this.size = 0;
2513
+ }
2514
+ function listCacheDelete(key) {
2515
+ var data = this.__data__, index = assocIndexOf(data, key);
2516
+ if (index < 0) {
2517
+ return false;
2518
+ }
2519
+ var lastIndex = data.length - 1;
2520
+ if (index == lastIndex) {
2521
+ data.pop();
2522
+ } else {
2523
+ splice.call(data, index, 1);
2524
+ }
2525
+ --this.size;
2526
+ return true;
2527
+ }
2528
+ function listCacheGet(key) {
2529
+ var data = this.__data__, index = assocIndexOf(data, key);
2530
+ return index < 0 ? void 0 : data[index][1];
2531
+ }
2532
+ function listCacheHas(key) {
2533
+ return assocIndexOf(this.__data__, key) > -1;
2534
+ }
2535
+ function listCacheSet(key, value) {
2536
+ var data = this.__data__, index = assocIndexOf(data, key);
2537
+ if (index < 0) {
2538
+ ++this.size;
2539
+ data.push([key, value]);
2540
+ } else {
2541
+ data[index][1] = value;
2542
+ }
2543
+ return this;
2544
+ }
2545
+ ListCache.prototype.clear = listCacheClear;
2546
+ ListCache.prototype["delete"] = listCacheDelete;
2547
+ ListCache.prototype.get = listCacheGet;
2548
+ ListCache.prototype.has = listCacheHas;
2549
+ ListCache.prototype.set = listCacheSet;
2550
+ function MapCache(entries) {
2551
+ var index = -1, length = entries == null ? 0 : entries.length;
2552
+ this.clear();
2553
+ while (++index < length) {
2554
+ var entry = entries[index];
2555
+ this.set(entry[0], entry[1]);
2556
+ }
2557
+ }
2558
+ function mapCacheClear() {
2559
+ this.size = 0;
2560
+ this.__data__ = {
2561
+ "hash": new Hash(),
2562
+ "map": new (Map2 || ListCache)(),
2563
+ "string": new Hash()
2564
+ };
2565
+ }
2566
+ function mapCacheDelete(key) {
2567
+ var result = getMapData(this, key)["delete"](key);
2568
+ this.size -= result ? 1 : 0;
2569
+ return result;
2570
+ }
2571
+ function mapCacheGet(key) {
2572
+ return getMapData(this, key).get(key);
2573
+ }
2574
+ function mapCacheHas(key) {
2575
+ return getMapData(this, key).has(key);
2576
+ }
2577
+ function mapCacheSet(key, value) {
2578
+ var data = getMapData(this, key), size = data.size;
2579
+ data.set(key, value);
2580
+ this.size += data.size == size ? 0 : 1;
2581
+ return this;
2582
+ }
2583
+ MapCache.prototype.clear = mapCacheClear;
2584
+ MapCache.prototype["delete"] = mapCacheDelete;
2585
+ MapCache.prototype.get = mapCacheGet;
2586
+ MapCache.prototype.has = mapCacheHas;
2587
+ MapCache.prototype.set = mapCacheSet;
2588
+ function SetCache(values) {
2589
+ var index = -1, length = values == null ? 0 : values.length;
2590
+ this.__data__ = new MapCache();
2591
+ while (++index < length) {
2592
+ this.add(values[index]);
2593
+ }
2594
+ }
2595
+ function setCacheAdd(value) {
2596
+ this.__data__.set(value, HASH_UNDEFINED);
2597
+ return this;
2598
+ }
2599
+ function setCacheHas(value) {
2600
+ return this.__data__.has(value);
2601
+ }
2602
+ SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
2603
+ SetCache.prototype.has = setCacheHas;
2604
+ function Stack(entries) {
2605
+ var data = this.__data__ = new ListCache(entries);
2606
+ this.size = data.size;
2607
+ }
2608
+ function stackClear() {
2609
+ this.__data__ = new ListCache();
2610
+ this.size = 0;
2611
+ }
2612
+ function stackDelete(key) {
2613
+ var data = this.__data__, result = data["delete"](key);
2614
+ this.size = data.size;
2615
+ return result;
2616
+ }
2617
+ function stackGet(key) {
2618
+ return this.__data__.get(key);
2619
+ }
2620
+ function stackHas(key) {
2621
+ return this.__data__.has(key);
2622
+ }
2623
+ function stackSet(key, value) {
2624
+ var data = this.__data__;
2625
+ if (data instanceof ListCache) {
2626
+ var pairs = data.__data__;
2627
+ if (!Map2 || pairs.length < LARGE_ARRAY_SIZE - 1) {
2628
+ pairs.push([key, value]);
2629
+ this.size = ++data.size;
2630
+ return this;
2631
+ }
2632
+ data = this.__data__ = new MapCache(pairs);
2633
+ }
2634
+ data.set(key, value);
2635
+ this.size = data.size;
2636
+ return this;
2637
+ }
2638
+ Stack.prototype.clear = stackClear;
2639
+ Stack.prototype["delete"] = stackDelete;
2640
+ Stack.prototype.get = stackGet;
2641
+ Stack.prototype.has = stackHas;
2642
+ Stack.prototype.set = stackSet;
2643
+ function arrayLikeKeys(value, inherited) {
2644
+ var isArr = isArray(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length;
2645
+ for (var key in value) {
2646
+ if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
2647
+ (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
2648
+ isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
2649
+ isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
2650
+ isIndex(key, length)))) {
2651
+ result.push(key);
2652
+ }
2653
+ }
2654
+ return result;
2655
+ }
2656
+ function assocIndexOf(array, key) {
2657
+ var length = array.length;
2658
+ while (length--) {
2659
+ if (eq(array[length][0], key)) {
2660
+ return length;
2661
+ }
2662
+ }
2663
+ return -1;
2664
+ }
2665
+ function baseGetAllKeys(object, keysFunc, symbolsFunc) {
2666
+ var result = keysFunc(object);
2667
+ return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
2668
+ }
2669
+ function baseGetTag(value) {
2670
+ if (value == null) {
2671
+ return value === void 0 ? undefinedTag : nullTag;
2672
+ }
2673
+ return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
2674
+ }
2675
+ function baseIsArguments(value) {
2676
+ return isObjectLike(value) && baseGetTag(value) == argsTag;
2677
+ }
2678
+ function baseIsEqual(value, other, bitmask, customizer, stack) {
2679
+ if (value === other) {
2680
+ return true;
2681
+ }
2682
+ if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) {
2683
+ return value !== value && other !== other;
2684
+ }
2685
+ return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
2686
+ }
2687
+ function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
2688
+ var objIsArr = isArray(object), othIsArr = isArray(other), objTag = objIsArr ? arrayTag : getTag(object), othTag = othIsArr ? arrayTag : getTag(other);
2689
+ objTag = objTag == argsTag ? objectTag : objTag;
2690
+ othTag = othTag == argsTag ? objectTag : othTag;
2691
+ var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
2692
+ if (isSameTag && isBuffer(object)) {
2693
+ if (!isBuffer(other)) {
2694
+ return false;
2695
+ }
2696
+ objIsArr = true;
2697
+ objIsObj = false;
2698
+ }
2699
+ if (isSameTag && !objIsObj) {
2700
+ stack || (stack = new Stack());
2701
+ return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
2702
+ }
2703
+ if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
2704
+ var objIsWrapped = objIsObj && hasOwnProperty.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty.call(other, "__wrapped__");
2705
+ if (objIsWrapped || othIsWrapped) {
2706
+ var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
2707
+ stack || (stack = new Stack());
2708
+ return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
2709
+ }
2710
+ }
2711
+ if (!isSameTag) {
2712
+ return false;
2713
+ }
2714
+ stack || (stack = new Stack());
2715
+ return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
2716
+ }
2717
+ function baseIsNative(value) {
2718
+ if (!isObject(value) || isMasked(value)) {
2719
+ return false;
2720
+ }
2721
+ var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
2722
+ return pattern.test(toSource(value));
2723
+ }
2724
+ function baseIsTypedArray(value) {
2725
+ return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
2726
+ }
2727
+ function baseKeys(object) {
2728
+ if (!isPrototype(object)) {
2729
+ return nativeKeys(object);
2730
+ }
2731
+ var result = [];
2732
+ for (var key in Object(object)) {
2733
+ if (hasOwnProperty.call(object, key) && key != "constructor") {
2734
+ result.push(key);
2735
+ }
2736
+ }
2737
+ return result;
2738
+ }
2739
+ function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
2740
+ var isPartial = bitmask & COMPARE_PARTIAL_FLAG, arrLength = array.length, othLength = other.length;
2741
+ if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
2742
+ return false;
2743
+ }
2744
+ var stacked = stack.get(array);
2745
+ if (stacked && stack.get(other)) {
2746
+ return stacked == other;
2747
+ }
2748
+ var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache() : void 0;
2749
+ stack.set(array, other);
2750
+ stack.set(other, array);
2751
+ while (++index < arrLength) {
2752
+ var arrValue = array[index], othValue = other[index];
2753
+ if (customizer) {
2754
+ var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack);
2755
+ }
2756
+ if (compared !== void 0) {
2757
+ if (compared) {
2758
+ continue;
2759
+ }
2760
+ result = false;
2761
+ break;
2762
+ }
2763
+ if (seen) {
2764
+ if (!arraySome(other, function(othValue2, othIndex) {
2765
+ if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
2766
+ return seen.push(othIndex);
2767
+ }
2768
+ })) {
2769
+ result = false;
2770
+ break;
2771
+ }
2772
+ } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
2773
+ result = false;
2774
+ break;
2775
+ }
2776
+ }
2777
+ stack["delete"](array);
2778
+ stack["delete"](other);
2779
+ return result;
2780
+ }
2781
+ function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
2782
+ switch (tag) {
2783
+ case dataViewTag:
2784
+ if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
2785
+ return false;
2786
+ }
2787
+ object = object.buffer;
2788
+ other = other.buffer;
2789
+ case arrayBufferTag:
2790
+ if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array2(object), new Uint8Array2(other))) {
2791
+ return false;
2792
+ }
2793
+ return true;
2794
+ case boolTag:
2795
+ case dateTag:
2796
+ case numberTag:
2797
+ return eq(+object, +other);
2798
+ case errorTag:
2799
+ return object.name == other.name && object.message == other.message;
2800
+ case regexpTag:
2801
+ case stringTag:
2802
+ return object == other + "";
2803
+ case mapTag:
2804
+ var convert = mapToArray;
2805
+ case setTag:
2806
+ var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
2807
+ convert || (convert = setToArray);
2808
+ if (object.size != other.size && !isPartial) {
2809
+ return false;
2810
+ }
2811
+ var stacked = stack.get(object);
2812
+ if (stacked) {
2813
+ return stacked == other;
2814
+ }
2815
+ bitmask |= COMPARE_UNORDERED_FLAG;
2816
+ stack.set(object, other);
2817
+ var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
2818
+ stack["delete"](object);
2819
+ return result;
2820
+ case symbolTag:
2821
+ if (symbolValueOf) {
2822
+ return symbolValueOf.call(object) == symbolValueOf.call(other);
2823
+ }
2824
+ }
2825
+ return false;
2826
+ }
2827
+ function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
2828
+ var isPartial = bitmask & COMPARE_PARTIAL_FLAG, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length;
2829
+ if (objLength != othLength && !isPartial) {
2830
+ return false;
2831
+ }
2832
+ var index = objLength;
2833
+ while (index--) {
2834
+ var key = objProps[index];
2835
+ if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
2836
+ return false;
2837
+ }
2838
+ }
2839
+ var stacked = stack.get(object);
2840
+ if (stacked && stack.get(other)) {
2841
+ return stacked == other;
2842
+ }
2843
+ var result = true;
2844
+ stack.set(object, other);
2845
+ stack.set(other, object);
2846
+ var skipCtor = isPartial;
2847
+ while (++index < objLength) {
2848
+ key = objProps[index];
2849
+ var objValue = object[key], othValue = other[key];
2850
+ if (customizer) {
2851
+ var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
2852
+ }
2853
+ if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
2854
+ result = false;
2855
+ break;
2856
+ }
2857
+ skipCtor || (skipCtor = key == "constructor");
2858
+ }
2859
+ if (result && !skipCtor) {
2860
+ var objCtor = object.constructor, othCtor = other.constructor;
2861
+ if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
2862
+ result = false;
2863
+ }
2864
+ }
2865
+ stack["delete"](object);
2866
+ stack["delete"](other);
2867
+ return result;
2868
+ }
2869
+ function getAllKeys(object) {
2870
+ return baseGetAllKeys(object, keys, getSymbols);
2871
+ }
2872
+ function getMapData(map, key) {
2873
+ var data = map.__data__;
2874
+ return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
2875
+ }
2876
+ function getNative(object, key) {
2877
+ var value = getValue(object, key);
2878
+ return baseIsNative(value) ? value : void 0;
2879
+ }
2880
+ function getRawTag(value) {
2881
+ var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag];
2882
+ try {
2883
+ value[symToStringTag] = void 0;
2884
+ var unmasked = true;
2885
+ } catch (e) {
2886
+ }
2887
+ var result = nativeObjectToString.call(value);
2888
+ if (unmasked) {
2889
+ if (isOwn) {
2890
+ value[symToStringTag] = tag;
2891
+ } else {
2892
+ delete value[symToStringTag];
2893
+ }
2894
+ }
2895
+ return result;
2896
+ }
2897
+ var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
2898
+ if (object == null) {
2899
+ return [];
2900
+ }
2901
+ object = Object(object);
2902
+ return arrayFilter(nativeGetSymbols(object), function(symbol) {
2903
+ return propertyIsEnumerable.call(object, symbol);
2904
+ });
2905
+ };
2906
+ var getTag = baseGetTag;
2907
+ if (DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag || Map2 && getTag(new Map2()) != mapTag || Promise2 && getTag(Promise2.resolve()) != promiseTag || Set2 && getTag(new Set2()) != setTag || WeakMap2 && getTag(new WeakMap2()) != weakMapTag) {
2908
+ getTag = function(value) {
2909
+ var result = baseGetTag(value), Ctor = result == objectTag ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
2910
+ if (ctorString) {
2911
+ switch (ctorString) {
2912
+ case dataViewCtorString:
2913
+ return dataViewTag;
2914
+ case mapCtorString:
2915
+ return mapTag;
2916
+ case promiseCtorString:
2917
+ return promiseTag;
2918
+ case setCtorString:
2919
+ return setTag;
2920
+ case weakMapCtorString:
2921
+ return weakMapTag;
2922
+ }
2923
+ }
2924
+ return result;
2925
+ };
2926
+ }
2927
+ function isIndex(value, length) {
2928
+ length = length == null ? MAX_SAFE_INTEGER : length;
2929
+ return !!length && (typeof value == "number" || reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
2930
+ }
2931
+ function isKeyable(value) {
2932
+ var type = typeof value;
2933
+ return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
2934
+ }
2935
+ function isMasked(func) {
2936
+ return !!maskSrcKey && maskSrcKey in func;
2937
+ }
2938
+ function isPrototype(value) {
2939
+ var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto;
2940
+ return value === proto;
2941
+ }
2942
+ function objectToString(value) {
2943
+ return nativeObjectToString.call(value);
2944
+ }
2945
+ function toSource(func) {
2946
+ if (func != null) {
2947
+ try {
2948
+ return funcToString.call(func);
2949
+ } catch (e) {
2950
+ }
2951
+ try {
2952
+ return func + "";
2953
+ } catch (e) {
2954
+ }
2955
+ }
2956
+ return "";
2957
+ }
2958
+ function eq(value, other) {
2959
+ return value === other || value !== value && other !== other;
2960
+ }
2961
+ var isArguments = baseIsArguments(/* @__PURE__ */ function() {
2962
+ return arguments;
2963
+ }()) ? baseIsArguments : function(value) {
2964
+ return isObjectLike(value) && hasOwnProperty.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
2965
+ };
2966
+ var isArray = Array.isArray;
2967
+ function isArrayLike(value) {
2968
+ return value != null && isLength(value.length) && !isFunction(value);
2969
+ }
2970
+ var isBuffer = nativeIsBuffer || stubFalse;
2971
+ function isEqual2(value, other) {
2972
+ return baseIsEqual(value, other);
2973
+ }
2974
+ function isFunction(value) {
2975
+ if (!isObject(value)) {
2976
+ return false;
2977
+ }
2978
+ var tag = baseGetTag(value);
2979
+ return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
2980
+ }
2981
+ function isLength(value) {
2982
+ return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
2983
+ }
2984
+ function isObject(value) {
2985
+ var type = typeof value;
2986
+ return value != null && (type == "object" || type == "function");
2987
+ }
2988
+ function isObjectLike(value) {
2989
+ return value != null && typeof value == "object";
2990
+ }
2991
+ var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
2992
+ function keys(object) {
2993
+ return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
79
2994
  }
80
- };
81
- const warn = (message) => {
82
- if (message && spinner) {
83
- spinner.warn(pc3.yellow(message));
84
- logs.push(message);
2995
+ function stubArray() {
2996
+ return [];
85
2997
  }
86
- };
87
- const info = (message) => {
88
- if (message && spinner && logLevel !== LogLevel.silent) {
89
- spinner.info(message);
90
- logs.push(message);
2998
+ function stubFalse() {
2999
+ return false;
91
3000
  }
92
- };
93
- const logger = {
94
- name,
95
- logLevel,
96
- log,
97
- error,
98
- warn,
99
- info,
100
- spinner,
101
- logs
102
- };
103
- return logger;
104
- }
105
- var defaultColours = ["black", "blue", "darkBlue", "cyan", "gray", "green", "darkGreen", "magenta", "red", "darkRed", "yellow", "darkYellow"];
106
- function randomColour(text, colours = defaultColours) {
107
- if (!text) {
108
- return "white";
109
- }
110
- const random = seedrandom(text);
111
- const colour = colours.at(Math.floor(random() * colours.length)) || "white";
112
- return colour;
113
- }
114
- function randomPicoColour(text, colors = defaultColours) {
115
- const colours = pc3.createColors(true);
116
- if (!text) {
117
- return colours.white(text);
118
- }
119
- const colour = randomColour(text, colors);
120
- const isDark = colour.includes("dark");
121
- const key = colour.replace("dark", "").toLowerCase();
122
- const formatter = colours[key];
123
- if (isDark) {
124
- return pc3.bold(formatter(text));
125
- }
126
- if (typeof formatter !== "function") {
127
- throw new Error("Formatter for picoColor is not of type function/Formatter");
3001
+ module.exports = isEqual2;
128
3002
  }
129
- return formatter(text);
3003
+ });
3004
+
3005
+ // src/index.ts
3006
+ init_esm_shims();
3007
+
3008
+ // src/build.ts
3009
+ init_esm_shims();
3010
+
3011
+ // src/fs/clean.ts
3012
+ init_esm_shims();
3013
+ var import_fs_extra = __toESM(require_lib(), 1);
3014
+ async function clean(path5) {
3015
+ return (0, import_fs_extra.remove)(path5);
130
3016
  }
131
- function slash(path3, platform = "linux") {
132
- const isWindowsPath = /^\\\\\?\\/.test(path3);
3017
+
3018
+ // src/fs/read.ts
3019
+ init_esm_shims();
3020
+ var import_fs_extra2 = __toESM(require_lib(), 1);
3021
+ function slash(path5, platform = "linux") {
3022
+ const isWindowsPath = /^\\\\\?\\/.test(path5);
133
3023
  if (["linux", "mac"].includes(platform) && !isWindowsPath) {
134
- return path3.replaceAll(/\\/g, "/").replace("../", "").trimEnd();
3024
+ return path5.replaceAll(/\\/g, "/").replace("../", "").trimEnd();
135
3025
  }
136
- return path3.replaceAll(/\\/g, "/").replace("../", "").trimEnd();
3026
+ return path5.replaceAll(/\\/g, "/").replace("../", "").trimEnd();
137
3027
  }
138
3028
  function getRelativePath(rootDir, filePath, platform = "linux") {
139
3029
  if (!rootDir || !filePath) {
@@ -148,11 +3038,11 @@ function getRelativePath(rootDir, filePath, platform = "linux") {
148
3038
  }
149
3039
  var reader = switcher(
150
3040
  {
151
- node: async (path3) => {
152
- return fs2.readFile(path3, { encoding: "utf8" });
3041
+ node: async (path5) => {
3042
+ return import_fs_extra2.default.readFile(path5, { encoding: "utf8" });
153
3043
  },
154
- bun: async (path3) => {
155
- const file = Bun.file(path3);
3044
+ bun: async (path5) => {
3045
+ const file = Bun.file(path5);
156
3046
  return file.text();
157
3047
  }
158
3048
  },
@@ -160,8 +3050,8 @@ var reader = switcher(
160
3050
  );
161
3051
  switcher(
162
3052
  {
163
- node: (path3) => {
164
- return fs2.readFileSync(path3, { encoding: "utf8" });
3053
+ node: (path5) => {
3054
+ return import_fs_extra2.default.readFileSync(path5, { encoding: "utf8" });
165
3055
  },
166
3056
  bun: () => {
167
3057
  throw new Error("Bun cannot read sync");
@@ -169,9 +3059,18 @@ switcher(
169
3059
  },
170
3060
  "node"
171
3061
  );
172
- async function read(path3) {
173
- return reader(path3);
3062
+ async function read(path5) {
3063
+ return reader(path5);
174
3064
  }
3065
+
3066
+ // src/utils/URLPath.ts
3067
+ init_esm_shims();
3068
+
3069
+ // src/transformers/index.ts
3070
+ init_esm_shims();
3071
+
3072
+ // src/transformers/casing.ts
3073
+ init_esm_shims();
175
3074
  function camelCase(text) {
176
3075
  return camelCase$1(text, { delimiter: "", stripRegexp: /[^A-Z0-9$]/gi, transform: camelCaseTransformMerge });
177
3076
  }
@@ -180,11 +3079,13 @@ function pascalCase(text) {
180
3079
  }
181
3080
 
182
3081
  // src/transformers/combineCodes.ts
3082
+ init_esm_shims();
183
3083
  function combineCodes(codes) {
184
3084
  return codes.join("\n");
185
3085
  }
186
3086
 
187
3087
  // src/transformers/createJSDocBlockText.ts
3088
+ init_esm_shims();
188
3089
  function createJSDocBlockText({ comments }) {
189
3090
  const filteredComments = comments.filter(Boolean);
190
3091
  if (!filteredComments.length) {
@@ -196,6 +3097,7 @@ function createJSDocBlockText({ comments }) {
196
3097
  }
197
3098
 
198
3099
  // src/transformers/escape.ts
3100
+ init_esm_shims();
199
3101
  function escape(text) {
200
3102
  return text ? text.replaceAll("`", "\\`") : "";
201
3103
  }
@@ -221,11 +3123,13 @@ function jsStringEscape(input) {
221
3123
  }
222
3124
 
223
3125
  // src/transformers/indent.ts
3126
+ init_esm_shims();
224
3127
  function createIndent(size) {
225
3128
  return Array.from({ length: size + 1 }).join(" ");
226
3129
  }
227
3130
 
228
3131
  // src/transformers/nameSorter.ts
3132
+ init_esm_shims();
229
3133
  function nameSorter(a, b) {
230
3134
  if (a.name < b.name) {
231
3135
  return -1;
@@ -237,6 +3141,7 @@ function nameSorter(a, b) {
237
3141
  }
238
3142
 
239
3143
  // src/transformers/searchAndReplace.ts
3144
+ init_esm_shims();
240
3145
  function searchAndReplace(options) {
241
3146
  const { text, replaceBy, prefix = "", key } = options;
242
3147
  const searchValues = options.searchValues?.(prefix, key) || [
@@ -254,6 +3159,7 @@ function searchAndReplace(options) {
254
3159
  }
255
3160
 
256
3161
  // src/transformers/transformReservedWord.ts
3162
+ init_esm_shims();
257
3163
  var reservedWords = [
258
3164
  "abstract",
259
3165
  "arguments",
@@ -347,6 +3253,7 @@ function transformReservedWord(word) {
347
3253
  }
348
3254
 
349
3255
  // src/transformers/trim.ts
3256
+ init_esm_shims();
350
3257
  function trim(text) {
351
3258
  return text.replaceAll(/\n/g, "").trim();
352
3259
  }
@@ -374,8 +3281,8 @@ var transformers_default = {
374
3281
 
375
3282
  // src/utils/URLPath.ts
376
3283
  var URLPath = class {
377
- constructor(path3) {
378
- this.path = path3;
3284
+ constructor(path5) {
3285
+ this.path = path5;
379
3286
  return this;
380
3287
  }
381
3288
  /**
@@ -470,6 +3377,7 @@ var URLPath = class {
470
3377
  };
471
3378
 
472
3379
  // src/config.ts
3380
+ init_esm_shims();
473
3381
  function defineConfig(options) {
474
3382
  return options;
475
3383
  }
@@ -477,34 +3385,33 @@ function isInputPath(result) {
477
3385
  return !!result && "path" in result;
478
3386
  }
479
3387
 
480
- // src/utils/timeout.ts
481
- async function timeout(ms) {
482
- return new Promise((resolve3) => {
483
- setTimeout(() => {
484
- resolve3(true);
485
- }, ms);
486
- });
487
- }
488
- async function saveCreateDirectory(path3) {
489
- const passedPath = dirname(resolve(path3));
490
- await fs2.mkdir(passedPath, { recursive: true });
3388
+ // src/FileManager.ts
3389
+ init_esm_shims();
3390
+ var import_lodash = __toESM(require_lodash(), 1);
3391
+
3392
+ // src/fs/write.ts
3393
+ init_esm_shims();
3394
+ var import_fs_extra3 = __toESM(require_lib(), 1);
3395
+ async function saveCreateDirectory(path5) {
3396
+ const passedPath = dirname(resolve(path5));
3397
+ await import_fs_extra3.default.mkdir(passedPath, { recursive: true });
491
3398
  }
492
3399
  var writer = switcher(
493
3400
  {
494
- node: async (path3, data) => {
3401
+ node: async (path5, data) => {
495
3402
  try {
496
- await fs2.stat(resolve(path3));
497
- const oldContent = await fs2.readFile(resolve(path3), { encoding: "utf-8" });
3403
+ await import_fs_extra3.default.stat(resolve(path5));
3404
+ const oldContent = await import_fs_extra3.default.readFile(resolve(path5), { encoding: "utf-8" });
498
3405
  if (oldContent?.toString() === data?.toString()) {
499
3406
  return;
500
3407
  }
501
3408
  } catch (_err) {
502
3409
  }
503
- await saveCreateDirectory(path3);
504
- await fs2.writeFile(resolve(path3), data, { encoding: "utf-8" });
505
- const savedData = await fs2.readFile(resolve(path3), { encoding: "utf-8" });
3410
+ await saveCreateDirectory(path5);
3411
+ await import_fs_extra3.default.writeFile(resolve(path5), data, { encoding: "utf-8" });
3412
+ const savedData = await import_fs_extra3.default.readFile(resolve(path5), { encoding: "utf-8" });
506
3413
  if (savedData?.toString() !== data?.toString()) {
507
- throw new Error(`Sanity check failed for ${path3}
3414
+ throw new Error(`Sanity check failed for ${path5}
508
3415
 
509
3416
  Data[${data.length}]:
510
3417
  ${data}
@@ -515,14 +3422,14 @@ ${savedData}
515
3422
  }
516
3423
  return savedData;
517
3424
  },
518
- bun: async (path3, data) => {
3425
+ bun: async (path5, data) => {
519
3426
  try {
520
- await saveCreateDirectory(path3);
521
- await Bun.write(resolve(path3), data);
522
- const file = Bun.file(resolve(path3));
3427
+ await saveCreateDirectory(path5);
3428
+ await Bun.write(resolve(path5), data);
3429
+ const file = Bun.file(resolve(path5));
523
3430
  const savedData = await file.text();
524
3431
  if (savedData?.toString() !== data?.toString()) {
525
- throw new Error(`Sanity check failed for ${path3}
3432
+ throw new Error(`Sanity check failed for ${path5}
526
3433
 
527
3434
  Data[${data.length}]:
528
3435
  ${data}
@@ -533,18 +3440,34 @@ ${savedData}
533
3440
  }
534
3441
  return savedData;
535
3442
  } catch (e) {
536
- console.log(e, resolve(path3));
3443
+ console.log(e, resolve(path5));
537
3444
  }
538
3445
  }
539
3446
  },
540
3447
  "node"
541
3448
  );
542
- async function write(data, path3) {
3449
+ async function write(data, path5) {
543
3450
  if (data.trim() === "") {
544
3451
  return void 0;
545
3452
  }
546
- return writer(path3, data.trim());
3453
+ return writer(path5, data.trim());
3454
+ }
3455
+
3456
+ // src/utils/timeout.ts
3457
+ init_esm_shims();
3458
+ async function timeout(ms) {
3459
+ return new Promise((resolve3) => {
3460
+ setTimeout(() => {
3461
+ resolve3(true);
3462
+ }, ms);
3463
+ });
547
3464
  }
3465
+
3466
+ // src/BarrelManager.ts
3467
+ init_esm_shims();
3468
+
3469
+ // src/utils/TreeNode.ts
3470
+ init_esm_shims();
548
3471
  var TreeNode = class _TreeNode {
549
3472
  constructor(data, parent) {
550
3473
  this.children = [];
@@ -607,10 +3530,10 @@ var TreeNode = class _TreeNode {
607
3530
  }
608
3531
  return this;
609
3532
  }
610
- static build(path3, options = {}) {
3533
+ static build(path5, options = {}) {
611
3534
  try {
612
3535
  const exclude = Array.isArray(options.exclude) ? options.exclude : [options.exclude].filter(Boolean);
613
- const filteredTree = dirTree(path3, { extensions: options.extensions, exclude: [/node_modules/, ...exclude] });
3536
+ const filteredTree = dirTree(path5, { extensions: options.extensions, exclude: [/node_modules/, ...exclude] });
614
3537
  if (!filteredTree) {
615
3538
  return null;
616
3539
  }
@@ -650,7 +3573,7 @@ var BarrelManager = class {
650
3573
  return [];
651
3574
  }
652
3575
  if (treeNode2.children.length > 1) {
653
- const indexPath = path.resolve(treeNode2.data.path, "index.ts");
3576
+ const indexPath = path4.resolve(treeNode2.data.path, "index.ts");
654
3577
  const exports = treeNode2.children.filter(Boolean).map((file) => {
655
3578
  const importPath = file.data.type === "directory" ? `./${file.data.name}/index` : `./${transformers_default.trimExtName(file.data.name)}`;
656
3579
  if (importPath.endsWith("index") && file.data.type === "file") {
@@ -672,7 +3595,7 @@ var BarrelManager = class {
672
3595
  });
673
3596
  } else if (treeNode2.children.length === 1) {
674
3597
  const [treeNodeChild] = treeNode2.children;
675
- const indexPath = path.resolve(treeNode2.data.path, "index.ts");
3598
+ const indexPath = path4.resolve(treeNode2.data.path, "index.ts");
676
3599
  const importPath = treeNodeChild.data.type === "directory" ? `./${treeNodeChild.data.name}/index` : `./${transformers_default.trimExtName(treeNodeChild.data.name)}`;
677
3600
  const exports = [
678
3601
  {
@@ -795,15 +3718,15 @@ var _FileManager = class _FileManager {
795
3718
  });
796
3719
  return cache;
797
3720
  }
798
- get(path3) {
799
- return __privateGet(this, _cache).get(path3);
3721
+ get(path5) {
3722
+ return __privateGet(this, _cache).get(path5);
800
3723
  }
801
- remove(path3) {
802
- const cacheItem = this.get(path3);
3724
+ remove(path5) {
3725
+ const cacheItem = this.get(path5);
803
3726
  if (!cacheItem) {
804
3727
  return;
805
3728
  }
806
- __privateGet(this, _cache).delete(path3);
3729
+ __privateGet(this, _cache).delete(path5);
807
3730
  }
808
3731
  async write(...params) {
809
3732
  if (!__privateGet(this, _isWriting)) {
@@ -820,63 +3743,13 @@ var _FileManager = class _FileManager {
820
3743
  }
821
3744
  // statics
822
3745
  static getSource(file) {
823
- if (!_FileManager.isExtensionAllowed(file.baseName)) {
824
- return file.source;
825
- }
826
- const exports = file.exports ? combineExports(file.exports) : [];
827
- const imports = file.imports ? combineImports(file.imports, exports, file.source) : [];
828
- const importNodes = imports.filter((item) => {
829
- return item.path !== transformers_default.trimExtName(file.path);
830
- }).map((item) => {
831
- return factory.createImportDeclaration({
832
- name: item.name,
833
- path: item.root ? getRelativePath(item.root, item.path) : item.path,
834
- isTypeOnly: item.isTypeOnly
835
- });
836
- });
837
- const exportNodes = exports.map(
838
- (item) => factory.createExportDeclaration({
839
- name: item.name,
840
- path: item.path,
841
- isTypeOnly: item.isTypeOnly,
842
- asAlias: item.asAlias
843
- })
844
- );
845
- return [print([...importNodes, ...exportNodes]), getEnvSource(file.source, file.env)].join("\n");
846
- }
847
- static combineFiles(files) {
848
- return files.filter(Boolean).reduce((acc, file) => {
849
- const prevIndex = acc.findIndex((item) => item.path === file.path);
850
- if (prevIndex === -1) {
851
- return [...acc, file];
852
- }
853
- const prev = acc[prevIndex];
854
- if (prev && file.override) {
855
- acc[prevIndex] = {
856
- imports: [],
857
- exports: [],
858
- ...file
859
- };
860
- return acc;
861
- }
862
- if (prev) {
863
- acc[prevIndex] = {
864
- ...file,
865
- source: prev.source && file.source ? `${prev.source}
866
- ${file.source}` : "",
867
- imports: [...prev.imports || [], ...file.imports || []],
868
- exports: [...prev.exports || [], ...file.exports || []],
869
- env: { ...prev.env || {}, ...file.env || {} }
870
- };
871
- }
872
- return acc;
873
- }, []);
3746
+ return getSource(file);
874
3747
  }
875
- static getMode(path3) {
876
- if (!path3) {
3748
+ static getMode(path5) {
3749
+ if (!path5) {
877
3750
  return "directory";
878
3751
  }
879
- return extname(path3) ? "file" : "directory";
3752
+ return extname(path5) ? "file" : "directory";
880
3753
  }
881
3754
  static get extensions() {
882
3755
  return [".js", ".ts", ".tsx"];
@@ -925,16 +3798,41 @@ ${file.source}` : "",
925
3798
  return __privateMethod(this, _add, add_fn).call(this, file);
926
3799
  };
927
3800
  var FileManager = _FileManager;
3801
+ function getSource(file) {
3802
+ if (!FileManager.isExtensionAllowed(file.baseName)) {
3803
+ return file.source;
3804
+ }
3805
+ const exports = file.exports ? combineExports(file.exports) : [];
3806
+ const imports = file.imports ? combineImports(file.imports, exports, file.source) : [];
3807
+ const importNodes = imports.filter((item) => {
3808
+ return item.path !== transformers_default.trimExtName(file.path);
3809
+ }).map((item) => {
3810
+ return factory.createImportDeclaration({
3811
+ name: item.name,
3812
+ path: item.root ? getRelativePath(item.root, item.path) : item.path,
3813
+ isTypeOnly: item.isTypeOnly
3814
+ });
3815
+ });
3816
+ const exportNodes = exports.map(
3817
+ (item) => factory.createExportDeclaration({
3818
+ name: item.name,
3819
+ path: item.path,
3820
+ isTypeOnly: item.isTypeOnly,
3821
+ asAlias: item.asAlias
3822
+ })
3823
+ );
3824
+ return [print([...importNodes, ...exportNodes]), getEnvSource(file.source, file.env)].join("\n");
3825
+ }
928
3826
  function combineExports(exports) {
929
3827
  const combinedExports = orderBy(exports, [(v) => !v.isTypeOnly], ["asc"]).reduce((prev, curr) => {
930
3828
  const name = curr.name;
931
3829
  const prevByPath = prev.findLast((imp) => imp.path === curr.path);
932
- const prevByPathAndIsTypeOnly = prev.findLast((imp) => imp.path === curr.path && isEqual(imp.name, name) && imp.isTypeOnly);
3830
+ const prevByPathAndIsTypeOnly = prev.findLast((imp) => imp.path === curr.path && (0, import_lodash.default)(imp.name, name) && imp.isTypeOnly);
933
3831
  if (prevByPathAndIsTypeOnly) {
934
3832
  return prev;
935
3833
  }
936
3834
  const uniquePrev = prev.findLast(
937
- (imp) => imp.path === curr.path && isEqual(imp.name, name) && imp.isTypeOnly === curr.isTypeOnly && imp.asAlias === curr.asAlias
3835
+ (imp) => imp.path === curr.path && (0, import_lodash.default)(imp.name, name) && imp.isTypeOnly === curr.isTypeOnly && imp.asAlias === curr.asAlias
938
3836
  );
939
3837
  if (uniquePrev || Array.isArray(name) && !name.length || prevByPath?.asAlias && !curr.asAlias) {
940
3838
  return prev;
@@ -970,8 +3868,8 @@ function combineImports(imports, exports, source) {
970
3868
  name = name.filter((item) => typeof item === "string" ? hasImportInSource(item) : hasImportInSource(item.propertyName));
971
3869
  }
972
3870
  const prevByPath = prev.findLast((imp) => imp.path === curr.path && imp.isTypeOnly === curr.isTypeOnly);
973
- const uniquePrev = prev.findLast((imp) => imp.path === curr.path && isEqual(imp.name, name) && imp.isTypeOnly === curr.isTypeOnly);
974
- const prevByPathNameAndIsTypeOnly = prev.findLast((imp) => imp.path === curr.path && isEqual(imp.name, name) && imp.isTypeOnly);
3871
+ const uniquePrev = prev.findLast((imp) => imp.path === curr.path && (0, import_lodash.default)(imp.name, name) && imp.isTypeOnly === curr.isTypeOnly);
3872
+ const prevByPathNameAndIsTypeOnly = prev.findLast((imp) => imp.path === curr.path && (0, import_lodash.default)(imp.name, name) && imp.isTypeOnly);
975
3873
  if (prevByPathNameAndIsTypeOnly) {
976
3874
  return prev;
977
3875
  }
@@ -1020,6 +3918,83 @@ function getEnvSource(source, env) {
1020
3918
  return prev;
1021
3919
  }, source);
1022
3920
  }
3921
+
3922
+ // src/logger.ts
3923
+ init_esm_shims();
3924
+ var LogLevel = {
3925
+ silent: "silent",
3926
+ info: "info",
3927
+ debug: "debug"
3928
+ };
3929
+ function createLogger({ logLevel, name, spinner }) {
3930
+ const logs = [];
3931
+ const log = (message) => {
3932
+ if (message && spinner) {
3933
+ spinner.text = message;
3934
+ logs.push(message);
3935
+ }
3936
+ };
3937
+ const error = (message) => {
3938
+ if (message) {
3939
+ throw new Error(message || "Something went wrong");
3940
+ }
3941
+ };
3942
+ const warn = (message) => {
3943
+ if (message && spinner) {
3944
+ spinner.warn(pc2.yellow(message));
3945
+ logs.push(message);
3946
+ }
3947
+ };
3948
+ const info = (message) => {
3949
+ if (message && spinner && logLevel !== LogLevel.silent) {
3950
+ spinner.info(message);
3951
+ logs.push(message);
3952
+ }
3953
+ };
3954
+ const logger = {
3955
+ name,
3956
+ logLevel,
3957
+ log,
3958
+ error,
3959
+ warn,
3960
+ info,
3961
+ spinner,
3962
+ logs
3963
+ };
3964
+ return logger;
3965
+ }
3966
+ var defaultColours = ["black", "blue", "darkBlue", "cyan", "gray", "green", "darkGreen", "magenta", "red", "darkRed", "yellow", "darkYellow"];
3967
+ function randomColour(text, colours = defaultColours) {
3968
+ if (!text) {
3969
+ return "white";
3970
+ }
3971
+ const random = seedrandom(text);
3972
+ const colour = colours.at(Math.floor(random() * colours.length)) || "white";
3973
+ return colour;
3974
+ }
3975
+ function randomPicoColour(text, colors = defaultColours) {
3976
+ const colours = pc2.createColors(true);
3977
+ if (!text) {
3978
+ return colours.white(text);
3979
+ }
3980
+ const colour = randomColour(text, colors);
3981
+ const isDark = colour.includes("dark");
3982
+ const key = colour.replace("dark", "").toLowerCase();
3983
+ const formatter = colours[key];
3984
+ if (isDark) {
3985
+ return pc2.bold(formatter(text));
3986
+ }
3987
+ if (typeof formatter !== "function") {
3988
+ throw new Error("Formatter for picoColor is not of type function/Formatter");
3989
+ }
3990
+ return formatter(text);
3991
+ }
3992
+
3993
+ // src/PluginManager.ts
3994
+ init_esm_shims();
3995
+
3996
+ // src/utils/EventEmitter.ts
3997
+ init_esm_shims();
1023
3998
  var _emitter;
1024
3999
  var EventEmitter = class {
1025
4000
  constructor() {
@@ -1040,6 +4015,9 @@ var EventEmitter = class {
1040
4015
  }
1041
4016
  };
1042
4017
  _emitter = new WeakMap();
4018
+
4019
+ // src/utils/Queue.ts
4020
+ init_esm_shims();
1043
4021
  var _queue2, _workerCount, _maxParallel, _debug, _work, work_fn;
1044
4022
  var Queue = class {
1045
4023
  constructor(maxParallel, debug = false) {
@@ -1112,6 +4090,7 @@ work_fn = function() {
1112
4090
  };
1113
4091
 
1114
4092
  // src/utils/uniqueName.ts
4093
+ init_esm_shims();
1115
4094
  function setUniqueName(originalName, data) {
1116
4095
  let used = data[originalName] || 0;
1117
4096
  if (used) {
@@ -1123,6 +4102,7 @@ function setUniqueName(originalName, data) {
1123
4102
  }
1124
4103
 
1125
4104
  // src/errors.ts
4105
+ init_esm_shims();
1126
4106
  var Warning = class extends Error {
1127
4107
  constructor(message, options) {
1128
4108
  super(message, { cause: options?.cause });
@@ -1132,7 +4112,11 @@ var Warning = class extends Error {
1132
4112
  var ValidationPluginError = class extends Error {
1133
4113
  };
1134
4114
 
4115
+ // src/plugin.ts
4116
+ init_esm_shims();
4117
+
1135
4118
  // src/utils/cache.ts
4119
+ init_esm_shims();
1136
4120
  function createPluginCache(Store = /* @__PURE__ */ Object.create(null)) {
1137
4121
  return {
1138
4122
  set(id, value) {
@@ -1200,8 +4184,8 @@ var definePlugin = createPlugin((options) => {
1200
4184
  };
1201
4185
  },
1202
4186
  resolvePath(baseName) {
1203
- const root = path.resolve(this.config.root, this.config.output.path);
1204
- return path.resolve(root, baseName);
4187
+ const root = path4.resolve(this.config.root, this.config.output.path);
4188
+ return path4.resolve(root, baseName);
1205
4189
  },
1206
4190
  resolveName(name) {
1207
4191
  return name;
@@ -1209,7 +4193,11 @@ var definePlugin = createPlugin((options) => {
1209
4193
  };
1210
4194
  });
1211
4195
 
4196
+ // src/PromiseManager.ts
4197
+ init_esm_shims();
4198
+
1212
4199
  // src/utils/executeStrategies.ts
4200
+ init_esm_shims();
1213
4201
  function hookSeq(promises) {
1214
4202
  return promises.filter(Boolean).reduce(
1215
4203
  (promise, func) => {
@@ -1296,7 +4284,7 @@ var PluginManager = class {
1296
4284
  __privateAdd(this, _executeSync);
1297
4285
  __privateAdd(this, _catcher);
1298
4286
  __privateAdd(this, _parse);
1299
- this.eventEmitter = new EventEmitter();
4287
+ this.events = new EventEmitter();
1300
4288
  this.executed = [];
1301
4289
  __privateAdd(this, _core, void 0);
1302
4290
  __privateAdd(this, _usedPluginNames, {});
@@ -1371,11 +4359,14 @@ Falling back on the first item.
1371
4359
  });
1372
4360
  return this;
1373
4361
  }
4362
+ /**
4363
+ * Instead of calling `pluginManager.events.on` you can use `pluginManager.on`. This one also has better types.
4364
+ */
1374
4365
  on(eventName, handler) {
1375
- this.eventEmitter.on(eventName, handler);
4366
+ this.events.on(eventName, handler);
1376
4367
  }
1377
4368
  /**
1378
- * Run only hook for a specific plugin name
4369
+ * Run a specific hookName for plugin x.
1379
4370
  */
1380
4371
  hookForPlugin({
1381
4372
  pluginKey,
@@ -1393,6 +4384,9 @@ Falling back on the first item.
1393
4384
  }).filter(Boolean);
1394
4385
  return Promise.all(promises);
1395
4386
  }
4387
+ /**
4388
+ * Run a specific hookName for plugin x.
4389
+ */
1396
4390
  hookForPluginSync({
1397
4391
  pluginKey,
1398
4392
  hookName,
@@ -1409,7 +4403,7 @@ Falling back on the first item.
1409
4403
  }).filter(Boolean);
1410
4404
  }
1411
4405
  /**
1412
- * Chains, first non-null result stops and returns
4406
+ * First non-null result stops and will return it's value.
1413
4407
  */
1414
4408
  async hookFirst({
1415
4409
  hookName,
@@ -1437,7 +4431,7 @@ Falling back on the first item.
1437
4431
  return __privateGet(this, _promiseManager).run("first", promises);
1438
4432
  }
1439
4433
  /**
1440
- * Chains, first non-null result stops and returns
4434
+ * First non-null result stops and will return it's value.
1441
4435
  */
1442
4436
  hookFirstSync({
1443
4437
  hookName,
@@ -1465,7 +4459,7 @@ Falling back on the first item.
1465
4459
  return parseResult;
1466
4460
  }
1467
4461
  /**
1468
- * Parallel, runs all plugins
4462
+ * Run all plugins in parallel(order will be based on `this.plugin` and if `pre` or `post` is set).
1469
4463
  */
1470
4464
  async hookParallel({
1471
4465
  hookName,
@@ -1484,7 +4478,7 @@ Falling back on the first item.
1484
4478
  return results.filter((result) => result.status === "fulfilled").map((result) => result.value);
1485
4479
  }
1486
4480
  /**
1487
- * Chains, reduces returned value, handling the reduced value as the first hook argument
4481
+ * Chain all plugins, `reduce` can be passed through to handle every returned value. The return value of the first plugin will be used as the first parameter for the plugin after that.
1488
4482
  */
1489
4483
  hookReduceArg0({
1490
4484
  hookName,
@@ -1601,7 +4595,7 @@ getSortedPlugins_fn = function(hookName) {
1601
4595
  _addExecutedToCallStack = new WeakSet();
1602
4596
  addExecutedToCallStack_fn = function(executer) {
1603
4597
  if (executer) {
1604
- this.eventEmitter.emit("executed", executer);
4598
+ this.events.emit("executed", executer);
1605
4599
  this.executed.push(executer);
1606
4600
  }
1607
4601
  };
@@ -1617,7 +4611,7 @@ execute_fn = function({
1617
4611
  if (!hook) {
1618
4612
  return null;
1619
4613
  }
1620
- this.eventEmitter.emit("execute", { strategy, hookName, parameters, plugin });
4614
+ this.events.emit("execute", { strategy, hookName, parameters, plugin });
1621
4615
  const task = Promise.resolve().then(() => {
1622
4616
  if (typeof hook === "function") {
1623
4617
  const possiblePromiseResult = hook.apply({ ...__privateGet(this, _core).api, plugin }, parameters);
@@ -1655,7 +4649,7 @@ executeSync_fn = function({
1655
4649
  if (!hook) {
1656
4650
  return null;
1657
4651
  }
1658
- this.eventEmitter.emit("execute", { strategy, hookName, parameters, plugin });
4652
+ this.events.emit("execute", { strategy, hookName, parameters, plugin });
1659
4653
  try {
1660
4654
  if (typeof hook === "function") {
1661
4655
  const fn = hook.apply({ ...__privateGet(this, _core).api, plugin }, parameters);
@@ -1681,7 +4675,7 @@ catcher_fn = function(e, plugin, hookName) {
1681
4675
  const text = `${e.message} (plugin: ${plugin?.name || "unknown"}, hook: ${hookName || "unknown"})
1682
4676
  `;
1683
4677
  this.logger.error(text);
1684
- this.eventEmitter.emit("error", e);
4678
+ this.events.emit("error", e);
1685
4679
  };
1686
4680
  _parse = new WeakSet();
1687
4681
  parse_fn = function(plugin, pluginManager, context) {
@@ -1723,7 +4717,7 @@ async function setup(options) {
1723
4717
  } catch (e) {
1724
4718
  if (isInputPath(config)) {
1725
4719
  throw new Error(
1726
- "Cannot read file/URL defined in `input.path` or set with `kubb generate PATH` in the CLI of your Kubb config " + pc3.dim(config.input.path),
4720
+ "Cannot read file/URL defined in `input.path` or set with `kubb generate PATH` in the CLI of your Kubb config " + pc2.dim(config.input.path),
1727
4721
  {
1728
4722
  cause: e
1729
4723
  }
@@ -1734,11 +4728,11 @@ async function setup(options) {
1734
4728
  await clean(config.output.path);
1735
4729
  }
1736
4730
  const queueTask = async (file) => {
1737
- const { path: path3 } = file;
4731
+ const { path: path5 } = file;
1738
4732
  let code = FileManager.getSource(file);
1739
4733
  const { result: loadedResult } = await pluginManager.hookFirst({
1740
4734
  hookName: "load",
1741
- parameters: [path3]
4735
+ parameters: [path5]
1742
4736
  });
1743
4737
  if (loadedResult && isPromise(loadedResult)) {
1744
4738
  code = await loadedResult;
@@ -1749,7 +4743,7 @@ async function setup(options) {
1749
4743
  if (code) {
1750
4744
  const transformedCode = await pluginManager.hookReduceArg0({
1751
4745
  hookName: "transform",
1752
- parameters: [code, path3],
4746
+ parameters: [code, path5],
1753
4747
  reduce: transformReducer
1754
4748
  });
1755
4749
  if (config.output.write || config.output.write === void 0) {
@@ -1757,12 +4751,12 @@ async function setup(options) {
1757
4751
  return pluginManager.hookForPlugin({
1758
4752
  pluginKey: file.meta?.pluginKey,
1759
4753
  hookName: "writeFile",
1760
- parameters: [transformedCode, path3]
4754
+ parameters: [transformedCode, path5]
1761
4755
  });
1762
4756
  }
1763
4757
  return pluginManager.hookFirst({
1764
4758
  hookName: "writeFile",
1765
- parameters: [transformedCode, path3]
4759
+ parameters: [transformedCode, path5]
1766
4760
  });
1767
4761
  }
1768
4762
  }
@@ -1776,7 +4770,7 @@ async function setup(options) {
1776
4770
  logger.spinner.start(`\u{1F4BE} Writing`);
1777
4771
  }
1778
4772
  if (logger.logLevel === LogLevel.debug) {
1779
- logger.info(`PluginKey ${pc3.dim(JSON.stringify(plugin.key))}
4773
+ logger.info(`PluginKey ${pc2.dim(JSON.stringify(plugin.key))}
1780
4774
  with source
1781
4775
 
1782
4776
  ${code}`);
@@ -1788,8 +4782,8 @@ ${code}`);
1788
4782
  const messsage = `${randomPicoColour(plugin.name)} Executing ${hookName}`;
1789
4783
  if (logger.logLevel === LogLevel.info && logger.spinner) {
1790
4784
  if (hookName === "writeFile") {
1791
- const [_code, path3] = parameters;
1792
- logger.spinner.suffixText = pc3.dim(path3);
4785
+ const [_code, path5] = parameters;
4786
+ logger.spinner.suffixText = pc2.dim(path5);
1793
4787
  } else {
1794
4788
  logger.spinner.suffixText = messsage;
1795
4789
  }
@@ -1797,9 +4791,9 @@ ${code}`);
1797
4791
  if (logger.logLevel === LogLevel.debug) {
1798
4792
  logger.info(messsage);
1799
4793
  const logs = [
1800
- parameters && `${pc3.bgWhite(`Parameters`)} ${randomPicoColour(plugin.name)} ${hookName}`,
4794
+ parameters && `${pc2.bgWhite(`Parameters`)} ${randomPicoColour(plugin.name)} ${hookName}`,
1801
4795
  JSON.stringify(parameters, void 0, 2),
1802
- output && `${pc3.bgWhite("Output")} ${randomPicoColour(plugin.name)} ${hookName}`,
4796
+ output && `${pc2.bgWhite("Output")} ${randomPicoColour(plugin.name)} ${hookName}`,
1803
4797
  output
1804
4798
  ].filter(Boolean);
1805
4799
  console.log(logs.join("\n"));
@@ -1841,6 +4835,7 @@ async function safeBuild(options) {
1841
4835
  }
1842
4836
 
1843
4837
  // src/Generator.ts
4838
+ init_esm_shims();
1844
4839
  var _options3, _context;
1845
4840
  var Generator = class {
1846
4841
  constructor(options, context) {
@@ -1866,6 +4861,296 @@ var Generator = class {
1866
4861
  };
1867
4862
  _options3 = new WeakMap();
1868
4863
  _context = new WeakMap();
4864
+
4865
+ // src/PackageManager.ts
4866
+ init_esm_shims();
4867
+
4868
+ // ../../node_modules/.pnpm/find-up@6.3.0/node_modules/find-up/index.js
4869
+ init_esm_shims();
4870
+
4871
+ // ../../node_modules/.pnpm/locate-path@7.2.0/node_modules/locate-path/index.js
4872
+ init_esm_shims();
4873
+
4874
+ // ../../node_modules/.pnpm/p-locate@6.0.0/node_modules/p-locate/index.js
4875
+ init_esm_shims();
4876
+
4877
+ // ../../node_modules/.pnpm/p-limit@4.0.0/node_modules/p-limit/index.js
4878
+ init_esm_shims();
4879
+
4880
+ // ../../node_modules/.pnpm/yocto-queue@1.0.0/node_modules/yocto-queue/index.js
4881
+ init_esm_shims();
4882
+ var Node = class {
4883
+ constructor(value) {
4884
+ __publicField(this, "value");
4885
+ __publicField(this, "next");
4886
+ this.value = value;
4887
+ }
4888
+ };
4889
+ var _head, _tail, _size;
4890
+ var Queue2 = class {
4891
+ constructor() {
4892
+ __privateAdd(this, _head, void 0);
4893
+ __privateAdd(this, _tail, void 0);
4894
+ __privateAdd(this, _size, void 0);
4895
+ this.clear();
4896
+ }
4897
+ enqueue(value) {
4898
+ const node = new Node(value);
4899
+ if (__privateGet(this, _head)) {
4900
+ __privateGet(this, _tail).next = node;
4901
+ __privateSet(this, _tail, node);
4902
+ } else {
4903
+ __privateSet(this, _head, node);
4904
+ __privateSet(this, _tail, node);
4905
+ }
4906
+ __privateWrapper(this, _size)._++;
4907
+ }
4908
+ dequeue() {
4909
+ const current = __privateGet(this, _head);
4910
+ if (!current) {
4911
+ return;
4912
+ }
4913
+ __privateSet(this, _head, __privateGet(this, _head).next);
4914
+ __privateWrapper(this, _size)._--;
4915
+ return current.value;
4916
+ }
4917
+ clear() {
4918
+ __privateSet(this, _head, void 0);
4919
+ __privateSet(this, _tail, void 0);
4920
+ __privateSet(this, _size, 0);
4921
+ }
4922
+ get size() {
4923
+ return __privateGet(this, _size);
4924
+ }
4925
+ *[Symbol.iterator]() {
4926
+ let current = __privateGet(this, _head);
4927
+ while (current) {
4928
+ yield current.value;
4929
+ current = current.next;
4930
+ }
4931
+ }
4932
+ };
4933
+ _head = new WeakMap();
4934
+ _tail = new WeakMap();
4935
+ _size = new WeakMap();
4936
+
4937
+ // ../../node_modules/.pnpm/p-limit@4.0.0/node_modules/p-limit/index.js
4938
+ function pLimit(concurrency) {
4939
+ if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {
4940
+ throw new TypeError("Expected `concurrency` to be a number from 1 and up");
4941
+ }
4942
+ const queue = new Queue2();
4943
+ let activeCount = 0;
4944
+ const next = () => {
4945
+ activeCount--;
4946
+ if (queue.size > 0) {
4947
+ queue.dequeue()();
4948
+ }
4949
+ };
4950
+ const run = async (fn, resolve3, args) => {
4951
+ activeCount++;
4952
+ const result = (async () => fn(...args))();
4953
+ resolve3(result);
4954
+ try {
4955
+ await result;
4956
+ } catch {
4957
+ }
4958
+ next();
4959
+ };
4960
+ const enqueue = (fn, resolve3, args) => {
4961
+ queue.enqueue(run.bind(void 0, fn, resolve3, args));
4962
+ (async () => {
4963
+ await Promise.resolve();
4964
+ if (activeCount < concurrency && queue.size > 0) {
4965
+ queue.dequeue()();
4966
+ }
4967
+ })();
4968
+ };
4969
+ const generator = (fn, ...args) => new Promise((resolve3) => {
4970
+ enqueue(fn, resolve3, args);
4971
+ });
4972
+ Object.defineProperties(generator, {
4973
+ activeCount: {
4974
+ get: () => activeCount
4975
+ },
4976
+ pendingCount: {
4977
+ get: () => queue.size
4978
+ },
4979
+ clearQueue: {
4980
+ value: () => {
4981
+ queue.clear();
4982
+ }
4983
+ }
4984
+ });
4985
+ return generator;
4986
+ }
4987
+
4988
+ // ../../node_modules/.pnpm/p-locate@6.0.0/node_modules/p-locate/index.js
4989
+ var EndError = class extends Error {
4990
+ constructor(value) {
4991
+ super();
4992
+ this.value = value;
4993
+ }
4994
+ };
4995
+ var testElement = async (element, tester) => tester(await element);
4996
+ var finder = async (element) => {
4997
+ const values = await Promise.all(element);
4998
+ if (values[1] === true) {
4999
+ throw new EndError(values[0]);
5000
+ }
5001
+ return false;
5002
+ };
5003
+ async function pLocate(iterable, tester, {
5004
+ concurrency = Number.POSITIVE_INFINITY,
5005
+ preserveOrder = true
5006
+ } = {}) {
5007
+ const limit = pLimit(concurrency);
5008
+ const items = [...iterable].map((element) => [element, limit(testElement, element, tester)]);
5009
+ const checkLimit = pLimit(preserveOrder ? 1 : Number.POSITIVE_INFINITY);
5010
+ try {
5011
+ await Promise.all(items.map((element) => checkLimit(finder, element)));
5012
+ } catch (error) {
5013
+ if (error instanceof EndError) {
5014
+ return error.value;
5015
+ }
5016
+ throw error;
5017
+ }
5018
+ }
5019
+
5020
+ // ../../node_modules/.pnpm/locate-path@7.2.0/node_modules/locate-path/index.js
5021
+ var typeMappings = {
5022
+ directory: "isDirectory",
5023
+ file: "isFile"
5024
+ };
5025
+ function checkType(type) {
5026
+ if (Object.hasOwnProperty.call(typeMappings, type)) {
5027
+ return;
5028
+ }
5029
+ throw new Error(`Invalid type specified: ${type}`);
5030
+ }
5031
+ var matchType = (type, stat) => stat[typeMappings[type]]();
5032
+ var toPath = (urlOrPath) => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
5033
+ async function locatePath(paths, {
5034
+ cwd = process2.cwd(),
5035
+ type = "file",
5036
+ allowSymlinks = true,
5037
+ concurrency,
5038
+ preserveOrder
5039
+ } = {}) {
5040
+ checkType(type);
5041
+ cwd = toPath(cwd);
5042
+ const statFunction = allowSymlinks ? promises.stat : promises.lstat;
5043
+ return pLocate(paths, async (path_) => {
5044
+ try {
5045
+ const stat = await statFunction(path4.resolve(cwd, path_));
5046
+ return matchType(type, stat);
5047
+ } catch {
5048
+ return false;
5049
+ }
5050
+ }, { concurrency, preserveOrder });
5051
+ }
5052
+ function locatePathSync(paths, {
5053
+ cwd = process2.cwd(),
5054
+ type = "file",
5055
+ allowSymlinks = true
5056
+ } = {}) {
5057
+ checkType(type);
5058
+ cwd = toPath(cwd);
5059
+ const statFunction = allowSymlinks ? fs3.statSync : fs3.lstatSync;
5060
+ for (const path_ of paths) {
5061
+ try {
5062
+ const stat = statFunction(path4.resolve(cwd, path_), {
5063
+ throwIfNoEntry: false
5064
+ });
5065
+ if (!stat) {
5066
+ continue;
5067
+ }
5068
+ if (matchType(type, stat)) {
5069
+ return path_;
5070
+ }
5071
+ } catch {
5072
+ }
5073
+ }
5074
+ }
5075
+
5076
+ // ../../node_modules/.pnpm/path-exists@5.0.0/node_modules/path-exists/index.js
5077
+ init_esm_shims();
5078
+
5079
+ // ../../node_modules/.pnpm/find-up@6.3.0/node_modules/find-up/index.js
5080
+ var toPath2 = (urlOrPath) => urlOrPath instanceof URL ? fileURLToPath(urlOrPath) : urlOrPath;
5081
+ var findUpStop = Symbol("findUpStop");
5082
+ async function findUpMultiple(name, options = {}) {
5083
+ let directory = path4.resolve(toPath2(options.cwd) || "");
5084
+ const { root } = path4.parse(directory);
5085
+ const stopAt = path4.resolve(directory, options.stopAt || root);
5086
+ const limit = options.limit || Number.POSITIVE_INFINITY;
5087
+ const paths = [name].flat();
5088
+ const runMatcher = async (locateOptions) => {
5089
+ if (typeof name !== "function") {
5090
+ return locatePath(paths, locateOptions);
5091
+ }
5092
+ const foundPath = await name(locateOptions.cwd);
5093
+ if (typeof foundPath === "string") {
5094
+ return locatePath([foundPath], locateOptions);
5095
+ }
5096
+ return foundPath;
5097
+ };
5098
+ const matches = [];
5099
+ while (true) {
5100
+ const foundPath = await runMatcher({ ...options, cwd: directory });
5101
+ if (foundPath === findUpStop) {
5102
+ break;
5103
+ }
5104
+ if (foundPath) {
5105
+ matches.push(path4.resolve(directory, foundPath));
5106
+ }
5107
+ if (directory === stopAt || matches.length >= limit) {
5108
+ break;
5109
+ }
5110
+ directory = path4.dirname(directory);
5111
+ }
5112
+ return matches;
5113
+ }
5114
+ function findUpMultipleSync(name, options = {}) {
5115
+ let directory = path4.resolve(toPath2(options.cwd) || "");
5116
+ const { root } = path4.parse(directory);
5117
+ const stopAt = options.stopAt || root;
5118
+ const limit = options.limit || Number.POSITIVE_INFINITY;
5119
+ const paths = [name].flat();
5120
+ const runMatcher = (locateOptions) => {
5121
+ if (typeof name !== "function") {
5122
+ return locatePathSync(paths, locateOptions);
5123
+ }
5124
+ const foundPath = name(locateOptions.cwd);
5125
+ if (typeof foundPath === "string") {
5126
+ return locatePathSync([foundPath], locateOptions);
5127
+ }
5128
+ return foundPath;
5129
+ };
5130
+ const matches = [];
5131
+ while (true) {
5132
+ const foundPath = runMatcher({ ...options, cwd: directory });
5133
+ if (foundPath === findUpStop) {
5134
+ break;
5135
+ }
5136
+ if (foundPath) {
5137
+ matches.push(path4.resolve(directory, foundPath));
5138
+ }
5139
+ if (directory === stopAt || matches.length >= limit) {
5140
+ break;
5141
+ }
5142
+ directory = path4.dirname(directory);
5143
+ }
5144
+ return matches;
5145
+ }
5146
+ async function findUp(name, options = {}) {
5147
+ const matches = await findUpMultiple(name, { ...options, limit: 1 });
5148
+ return matches[0];
5149
+ }
5150
+ function findUpSync(name, options = {}) {
5151
+ const matches = findUpMultipleSync(name, { ...options, limit: 1 });
5152
+ return matches[0];
5153
+ }
1869
5154
  var _cache2, _cwd, _SLASHES, _match, match_fn;
1870
5155
  var _PackageManager = class _PackageManager {
1871
5156
  constructor(workspace) {
@@ -1889,17 +5174,17 @@ var _PackageManager = class _PackageManager {
1889
5174
  }
1890
5175
  return directory;
1891
5176
  }
1892
- getLocation(path3) {
1893
- let location = path3;
5177
+ getLocation(path5) {
5178
+ let location = path5;
1894
5179
  if (__privateGet(this, _cwd)) {
1895
5180
  const require2 = mod.createRequire(this.normalizeDirectory(__privateGet(this, _cwd)));
1896
- location = require2.resolve(path3);
5181
+ location = require2.resolve(path5);
1897
5182
  }
1898
5183
  return location;
1899
5184
  }
1900
- async import(path3) {
5185
+ async import(path5) {
1901
5186
  try {
1902
- let location = this.getLocation(path3);
5187
+ let location = this.getLocation(path5);
1903
5188
  if (os.platform() == "win32") {
1904
5189
  location = pathToFileURL(location).href;
1905
5190
  }
@@ -1998,6 +5283,6 @@ var PackageManager = _PackageManager;
1998
5283
  // src/index.ts
1999
5284
  var src_default = build;
2000
5285
 
2001
- export { FileManager, Generator, KubbFile, PackageManager, PluginManager, PromiseManager, ValidationPluginError, Warning, build, combineExports, combineImports, createPlugin, src_default as default, defineConfig, isInputPath, pluginName as name, pluginName, safeBuild };
5286
+ export { FileManager, Generator, KubbFile, PackageManager, PluginManager, PromiseManager, Warning, build, createPlugin, src_default as default, defineConfig, isInputPath, pluginName as name, pluginName, safeBuild };
2002
5287
  //# sourceMappingURL=out.js.map
2003
5288
  //# sourceMappingURL=index.js.map