@kubb/core 2.11.1 → 2.12.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. package/dist/{chunk-4GE2JRAA.cjs → chunk-33S7A7ZE.cjs} +28 -5
  2. package/dist/chunk-33S7A7ZE.cjs.map +1 -0
  3. package/dist/{chunk-CH2676BL.js → chunk-4BZD7YTT.js} +2 -2
  4. package/dist/{chunk-G7EQ47A4.js → chunk-ALE7CO7I.js} +26 -3
  5. package/dist/chunk-ALE7CO7I.js.map +1 -0
  6. package/dist/{chunk-WAIHMG76.cjs → chunk-F4TSJHGA.cjs} +3 -3
  7. package/dist/chunk-FOWWV3PP.js +41 -0
  8. package/dist/chunk-FOWWV3PP.js.map +1 -0
  9. package/dist/{chunk-XZZ2F3LK.cjs → chunk-IBUMXAET.cjs} +3 -3
  10. package/dist/{chunk-WXV3UNEP.js → chunk-IP732R22.js} +1 -29
  11. package/dist/chunk-IP732R22.js.map +1 -0
  12. package/dist/chunk-KPXUT3DG.cjs +143 -0
  13. package/dist/chunk-KPXUT3DG.cjs.map +1 -0
  14. package/dist/{chunk-UYADU5OY.js → chunk-L2OHRGUS.js} +7 -3
  15. package/dist/chunk-L2OHRGUS.js.map +1 -0
  16. package/dist/{chunk-JDIEEDDB.cjs → chunk-OMX2RMAX.cjs} +3 -3
  17. package/dist/{chunk-TJHTFTXA.cjs → chunk-OVLOS3IJ.cjs} +267 -347
  18. package/dist/chunk-OVLOS3IJ.cjs.map +1 -0
  19. package/dist/{chunk-KOQSM5X7.cjs → chunk-VHRZO2NC.cjs} +20 -20
  20. package/dist/chunk-VHRZO2NC.cjs.map +1 -0
  21. package/dist/chunk-YYCT7ZB7.cjs +94 -0
  22. package/dist/chunk-YYCT7ZB7.cjs.map +1 -0
  23. package/dist/{chunk-H7U5WQ3I.js → chunk-Z5N655B7.js} +20 -20
  24. package/dist/chunk-Z5N655B7.js.map +1 -0
  25. package/dist/{chunk-DOELQNBO.cjs → chunk-ZS3YTJ2L.cjs} +3 -133
  26. package/dist/chunk-ZS3YTJ2L.cjs.map +1 -0
  27. package/dist/fs.cjs +5 -4
  28. package/dist/fs.cjs.map +1 -1
  29. package/dist/fs.js +3 -3
  30. package/dist/index.cjs +2672 -83
  31. package/dist/index.cjs.map +1 -1
  32. package/dist/index.d.cts +6 -1
  33. package/dist/index.d.ts +6 -1
  34. package/dist/index.js +1981 -52
  35. package/dist/index.js.map +1 -1
  36. package/dist/logger.cjs +4 -3
  37. package/dist/logger.js +2 -2
  38. package/dist/mocks.cjs +6 -10
  39. package/dist/mocks.cjs.map +1 -1
  40. package/dist/mocks.js +1 -6
  41. package/dist/mocks.js.map +1 -1
  42. package/dist/transformers.cjs +34 -21
  43. package/dist/transformers.cjs.map +1 -1
  44. package/dist/transformers.d.cts +4 -2
  45. package/dist/transformers.d.ts +4 -2
  46. package/dist/transformers.js +24 -11
  47. package/dist/transformers.js.map +1 -1
  48. package/dist/utils.cjs +32 -27
  49. package/dist/utils.cjs.map +1 -1
  50. package/dist/utils.js +33 -28
  51. package/dist/utils.js.map +1 -1
  52. package/package.json +4 -3
  53. package/src/BarrelManager.ts +33 -31
  54. package/src/FileManager.ts +176 -137
  55. package/src/PackageManager.ts +4 -4
  56. package/src/PluginManager.ts +62 -52
  57. package/src/build.ts +28 -9
  58. package/src/config.ts +3 -3
  59. package/src/fs/write.ts +6 -2
  60. package/src/index.ts +1 -1
  61. package/src/transformers/casing.ts +11 -5
  62. package/src/transformers/escape.ts +2 -4
  63. package/src/transformers/index.ts +3 -2
  64. package/src/transformers/stringify.ts +19 -3
  65. package/src/transformers/toNumber.ts +1 -1
  66. package/src/transformers/toRegExp.ts +1 -5
  67. package/src/types.ts +67 -71
  68. package/src/utils/FunctionParams.ts +28 -24
  69. package/src/utils/TreeNode.ts +15 -4
  70. package/src/utils/URLPath.ts +2 -6
  71. package/src/utils/executeStrategies.ts +7 -7
  72. package/src/utils/index.ts +5 -1
  73. package/dist/chunk-4GE2JRAA.cjs.map +0 -1
  74. package/dist/chunk-B7DTFNR4.js +0 -30
  75. package/dist/chunk-B7DTFNR4.js.map +0 -1
  76. package/dist/chunk-DOELQNBO.cjs.map +0 -1
  77. package/dist/chunk-G7EQ47A4.js.map +0 -1
  78. package/dist/chunk-H7U5WQ3I.js.map +0 -1
  79. package/dist/chunk-KOQSM5X7.cjs.map +0 -1
  80. package/dist/chunk-TJHTFTXA.cjs.map +0 -1
  81. package/dist/chunk-UIWHEBZA.cjs +0 -2549
  82. package/dist/chunk-UIWHEBZA.cjs.map +0 -1
  83. package/dist/chunk-UUBXTHJG.cjs +0 -30
  84. package/dist/chunk-UUBXTHJG.cjs.map +0 -1
  85. package/dist/chunk-UYADU5OY.js.map +0 -1
  86. package/dist/chunk-WXV3UNEP.js.map +0 -1
  87. package/dist/chunk-ZNYG4U5D.js +0 -1888
  88. package/dist/chunk-ZNYG4U5D.js.map +0 -1
  89. /package/dist/{chunk-CH2676BL.js.map → chunk-4BZD7YTT.js.map} +0 -0
  90. /package/dist/{chunk-WAIHMG76.cjs.map → chunk-F4TSJHGA.cjs.map} +0 -0
  91. /package/dist/{chunk-XZZ2F3LK.cjs.map → chunk-IBUMXAET.cjs.map} +0 -0
  92. /package/dist/{chunk-JDIEEDDB.cjs.map → chunk-OMX2RMAX.cjs.map} +0 -0
package/dist/index.cjs CHANGED
@@ -1,33 +1,37 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunk4GE2JRAAcjs = require('./chunk-4GE2JRAA.cjs');
4
3
 
5
4
 
6
- var _chunkXZZ2F3LKcjs = require('./chunk-XZZ2F3LK.cjs');
5
+ var _chunkVHRZO2NCcjs = require('./chunk-VHRZO2NC.cjs');
7
6
 
8
7
 
9
8
 
9
+ var _chunk33S7A7ZEcjs = require('./chunk-33S7A7ZE.cjs');
10
10
 
11
11
 
12
+ var _chunkZS3YTJ2Lcjs = require('./chunk-ZS3YTJ2L.cjs');
12
13
 
13
14
 
14
15
 
15
16
 
16
- var _chunkUIWHEBZAcjs = require('./chunk-UIWHEBZA.cjs');
17
- require('./chunk-KOQSM5X7.cjs');
18
- require('./chunk-UUBXTHJG.cjs');
19
- require('./chunk-DOELQNBO.cjs');
20
17
 
21
18
 
19
+ var _chunkOMX2RMAXcjs = require('./chunk-OMX2RMAX.cjs');
22
20
 
23
21
 
22
+ var _chunkIBUMXAETcjs = require('./chunk-IBUMXAET.cjs');
24
23
 
25
- var _chunkJDIEEDDBcjs = require('./chunk-JDIEEDDB.cjs');
26
24
 
25
+ var _chunkYYCT7ZB7cjs = require('./chunk-YYCT7ZB7.cjs');
26
+ require('./chunk-KPXUT3DG.cjs');
27
+
28
+
29
+
30
+
31
+ var _chunkF4TSJHGAcjs = require('./chunk-F4TSJHGA.cjs');
32
+ require('./chunk-OVLOS3IJ.cjs');
27
33
 
28
34
 
29
- var _chunkWAIHMG76cjs = require('./chunk-WAIHMG76.cjs');
30
- require('./chunk-TJHTFTXA.cjs');
31
35
 
32
36
 
33
37
 
@@ -38,36 +42,2603 @@ require('./chunk-TJHTFTXA.cjs');
38
42
 
39
43
  var _chunk4TB6NGOCcjs = require('./chunk-4TB6NGOC.cjs');
40
44
 
41
- // src/index.ts
45
+ // ../../node_modules/.pnpm/lodash.isequal@4.5.0/node_modules/lodash.isequal/index.js
46
+ var require_lodash = _chunk4TB6NGOCcjs.__commonJS.call(void 0, {
47
+ "../../node_modules/.pnpm/lodash.isequal@4.5.0/node_modules/lodash.isequal/index.js"(exports, module) {
48
+ "use strict";
49
+ _chunk4TB6NGOCcjs.init_cjs_shims.call(void 0, );
50
+ var LARGE_ARRAY_SIZE = 200;
51
+ var HASH_UNDEFINED = "__lodash_hash_undefined__";
52
+ var COMPARE_PARTIAL_FLAG = 1;
53
+ var COMPARE_UNORDERED_FLAG = 2;
54
+ var MAX_SAFE_INTEGER = 9007199254740991;
55
+ var argsTag = "[object Arguments]";
56
+ var arrayTag = "[object Array]";
57
+ var asyncTag = "[object AsyncFunction]";
58
+ var boolTag = "[object Boolean]";
59
+ var dateTag = "[object Date]";
60
+ var errorTag = "[object Error]";
61
+ var funcTag = "[object Function]";
62
+ var genTag = "[object GeneratorFunction]";
63
+ var mapTag = "[object Map]";
64
+ var numberTag = "[object Number]";
65
+ var nullTag = "[object Null]";
66
+ var objectTag = "[object Object]";
67
+ var promiseTag = "[object Promise]";
68
+ var proxyTag = "[object Proxy]";
69
+ var regexpTag = "[object RegExp]";
70
+ var setTag = "[object Set]";
71
+ var stringTag = "[object String]";
72
+ var symbolTag = "[object Symbol]";
73
+ var undefinedTag = "[object Undefined]";
74
+ var weakMapTag = "[object WeakMap]";
75
+ var arrayBufferTag = "[object ArrayBuffer]";
76
+ var dataViewTag = "[object DataView]";
77
+ var float32Tag = "[object Float32Array]";
78
+ var float64Tag = "[object Float64Array]";
79
+ var int8Tag = "[object Int8Array]";
80
+ var int16Tag = "[object Int16Array]";
81
+ var int32Tag = "[object Int32Array]";
82
+ var uint8Tag = "[object Uint8Array]";
83
+ var uint8ClampedTag = "[object Uint8ClampedArray]";
84
+ var uint16Tag = "[object Uint16Array]";
85
+ var uint32Tag = "[object Uint32Array]";
86
+ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
87
+ var reIsHostCtor = /^\[object .+?Constructor\]$/;
88
+ var reIsUint = /^(?:0|[1-9]\d*)$/;
89
+ var typedArrayTags = {};
90
+ typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
91
+ 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;
92
+ var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
93
+ var freeSelf = typeof self == "object" && self && self.Object === Object && self;
94
+ var root = freeGlobal || freeSelf || Function("return this")();
95
+ var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
96
+ var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
97
+ var moduleExports = freeModule && freeModule.exports === freeExports;
98
+ var freeProcess = moduleExports && freeGlobal.process;
99
+ var nodeUtil = function() {
100
+ try {
101
+ return freeProcess && freeProcess.binding && freeProcess.binding("util");
102
+ } catch (e) {
103
+ }
104
+ }();
105
+ var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
106
+ function arrayFilter(array, predicate) {
107
+ var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
108
+ while (++index < length) {
109
+ var value = array[index];
110
+ if (predicate(value, index, array)) {
111
+ result[resIndex++] = value;
112
+ }
113
+ }
114
+ return result;
115
+ }
116
+ function arrayPush(array, values) {
117
+ var index = -1, length = values.length, offset = array.length;
118
+ while (++index < length) {
119
+ array[offset + index] = values[index];
120
+ }
121
+ return array;
122
+ }
123
+ function arraySome(array, predicate) {
124
+ var index = -1, length = array == null ? 0 : array.length;
125
+ while (++index < length) {
126
+ if (predicate(array[index], index, array)) {
127
+ return true;
128
+ }
129
+ }
130
+ return false;
131
+ }
132
+ function baseTimes(n, iteratee) {
133
+ var index = -1, result = Array(n);
134
+ while (++index < n) {
135
+ result[index] = iteratee(index);
136
+ }
137
+ return result;
138
+ }
139
+ function baseUnary(func) {
140
+ return function(value) {
141
+ return func(value);
142
+ };
143
+ }
144
+ function cacheHas(cache, key) {
145
+ return cache.has(key);
146
+ }
147
+ function getValue(object, key) {
148
+ return object == null ? void 0 : object[key];
149
+ }
150
+ function mapToArray(map) {
151
+ var index = -1, result = Array(map.size);
152
+ map.forEach(function(value, key) {
153
+ result[++index] = [key, value];
154
+ });
155
+ return result;
156
+ }
157
+ function overArg(func, transform) {
158
+ return function(arg) {
159
+ return func(transform(arg));
160
+ };
161
+ }
162
+ function setToArray(set) {
163
+ var index = -1, result = Array(set.size);
164
+ set.forEach(function(value) {
165
+ result[++index] = value;
166
+ });
167
+ return result;
168
+ }
169
+ var arrayProto = Array.prototype;
170
+ var funcProto = Function.prototype;
171
+ var objectProto = Object.prototype;
172
+ var coreJsData = root["__core-js_shared__"];
173
+ var funcToString = funcProto.toString;
174
+ var hasOwnProperty = objectProto.hasOwnProperty;
175
+ var maskSrcKey = function() {
176
+ var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
177
+ return uid ? "Symbol(src)_1." + uid : "";
178
+ }();
179
+ var nativeObjectToString = objectProto.toString;
180
+ var reIsNative = RegExp(
181
+ "^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
182
+ );
183
+ var Buffer = moduleExports ? root.Buffer : void 0;
184
+ var Symbol2 = root.Symbol;
185
+ var Uint8Array = root.Uint8Array;
186
+ var propertyIsEnumerable = objectProto.propertyIsEnumerable;
187
+ var splice = arrayProto.splice;
188
+ var symToStringTag = Symbol2 ? Symbol2.toStringTag : void 0;
189
+ var nativeGetSymbols = Object.getOwnPropertySymbols;
190
+ var nativeIsBuffer = Buffer ? Buffer.isBuffer : void 0;
191
+ var nativeKeys = overArg(Object.keys, Object);
192
+ var DataView = getNative(root, "DataView");
193
+ var Map2 = getNative(root, "Map");
194
+ var Promise2 = getNative(root, "Promise");
195
+ var Set2 = getNative(root, "Set");
196
+ var WeakMap2 = getNative(root, "WeakMap");
197
+ var nativeCreate = getNative(Object, "create");
198
+ var dataViewCtorString = toSource(DataView);
199
+ var mapCtorString = toSource(Map2);
200
+ var promiseCtorString = toSource(Promise2);
201
+ var setCtorString = toSource(Set2);
202
+ var weakMapCtorString = toSource(WeakMap2);
203
+ var symbolProto = Symbol2 ? Symbol2.prototype : void 0;
204
+ var symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
205
+ function Hash(entries) {
206
+ var index = -1, length = entries == null ? 0 : entries.length;
207
+ this.clear();
208
+ while (++index < length) {
209
+ var entry = entries[index];
210
+ this.set(entry[0], entry[1]);
211
+ }
212
+ }
213
+ function hashClear() {
214
+ this.__data__ = nativeCreate ? nativeCreate(null) : {};
215
+ this.size = 0;
216
+ }
217
+ function hashDelete(key) {
218
+ var result = this.has(key) && delete this.__data__[key];
219
+ this.size -= result ? 1 : 0;
220
+ return result;
221
+ }
222
+ function hashGet(key) {
223
+ var data = this.__data__;
224
+ if (nativeCreate) {
225
+ var result = data[key];
226
+ return result === HASH_UNDEFINED ? void 0 : result;
227
+ }
228
+ return hasOwnProperty.call(data, key) ? data[key] : void 0;
229
+ }
230
+ function hashHas(key) {
231
+ var data = this.__data__;
232
+ return nativeCreate ? data[key] !== void 0 : hasOwnProperty.call(data, key);
233
+ }
234
+ function hashSet(key, value) {
235
+ var data = this.__data__;
236
+ this.size += this.has(key) ? 0 : 1;
237
+ data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED : value;
238
+ return this;
239
+ }
240
+ Hash.prototype.clear = hashClear;
241
+ Hash.prototype["delete"] = hashDelete;
242
+ Hash.prototype.get = hashGet;
243
+ Hash.prototype.has = hashHas;
244
+ Hash.prototype.set = hashSet;
245
+ function ListCache(entries) {
246
+ var index = -1, length = entries == null ? 0 : entries.length;
247
+ this.clear();
248
+ while (++index < length) {
249
+ var entry = entries[index];
250
+ this.set(entry[0], entry[1]);
251
+ }
252
+ }
253
+ function listCacheClear() {
254
+ this.__data__ = [];
255
+ this.size = 0;
256
+ }
257
+ function listCacheDelete(key) {
258
+ var data = this.__data__, index = assocIndexOf(data, key);
259
+ if (index < 0) {
260
+ return false;
261
+ }
262
+ var lastIndex = data.length - 1;
263
+ if (index == lastIndex) {
264
+ data.pop();
265
+ } else {
266
+ splice.call(data, index, 1);
267
+ }
268
+ --this.size;
269
+ return true;
270
+ }
271
+ function listCacheGet(key) {
272
+ var data = this.__data__, index = assocIndexOf(data, key);
273
+ return index < 0 ? void 0 : data[index][1];
274
+ }
275
+ function listCacheHas(key) {
276
+ return assocIndexOf(this.__data__, key) > -1;
277
+ }
278
+ function listCacheSet(key, value) {
279
+ var data = this.__data__, index = assocIndexOf(data, key);
280
+ if (index < 0) {
281
+ ++this.size;
282
+ data.push([key, value]);
283
+ } else {
284
+ data[index][1] = value;
285
+ }
286
+ return this;
287
+ }
288
+ ListCache.prototype.clear = listCacheClear;
289
+ ListCache.prototype["delete"] = listCacheDelete;
290
+ ListCache.prototype.get = listCacheGet;
291
+ ListCache.prototype.has = listCacheHas;
292
+ ListCache.prototype.set = listCacheSet;
293
+ function MapCache(entries) {
294
+ var index = -1, length = entries == null ? 0 : entries.length;
295
+ this.clear();
296
+ while (++index < length) {
297
+ var entry = entries[index];
298
+ this.set(entry[0], entry[1]);
299
+ }
300
+ }
301
+ function mapCacheClear() {
302
+ this.size = 0;
303
+ this.__data__ = {
304
+ "hash": new Hash(),
305
+ "map": new (Map2 || ListCache)(),
306
+ "string": new Hash()
307
+ };
308
+ }
309
+ function mapCacheDelete(key) {
310
+ var result = getMapData(this, key)["delete"](key);
311
+ this.size -= result ? 1 : 0;
312
+ return result;
313
+ }
314
+ function mapCacheGet(key) {
315
+ return getMapData(this, key).get(key);
316
+ }
317
+ function mapCacheHas(key) {
318
+ return getMapData(this, key).has(key);
319
+ }
320
+ function mapCacheSet(key, value) {
321
+ var data = getMapData(this, key), size = data.size;
322
+ data.set(key, value);
323
+ this.size += data.size == size ? 0 : 1;
324
+ return this;
325
+ }
326
+ MapCache.prototype.clear = mapCacheClear;
327
+ MapCache.prototype["delete"] = mapCacheDelete;
328
+ MapCache.prototype.get = mapCacheGet;
329
+ MapCache.prototype.has = mapCacheHas;
330
+ MapCache.prototype.set = mapCacheSet;
331
+ function SetCache(values) {
332
+ var index = -1, length = values == null ? 0 : values.length;
333
+ this.__data__ = new MapCache();
334
+ while (++index < length) {
335
+ this.add(values[index]);
336
+ }
337
+ }
338
+ function setCacheAdd(value) {
339
+ this.__data__.set(value, HASH_UNDEFINED);
340
+ return this;
341
+ }
342
+ function setCacheHas(value) {
343
+ return this.__data__.has(value);
344
+ }
345
+ SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
346
+ SetCache.prototype.has = setCacheHas;
347
+ function Stack(entries) {
348
+ var data = this.__data__ = new ListCache(entries);
349
+ this.size = data.size;
350
+ }
351
+ function stackClear() {
352
+ this.__data__ = new ListCache();
353
+ this.size = 0;
354
+ }
355
+ function stackDelete(key) {
356
+ var data = this.__data__, result = data["delete"](key);
357
+ this.size = data.size;
358
+ return result;
359
+ }
360
+ function stackGet(key) {
361
+ return this.__data__.get(key);
362
+ }
363
+ function stackHas(key) {
364
+ return this.__data__.has(key);
365
+ }
366
+ function stackSet(key, value) {
367
+ var data = this.__data__;
368
+ if (data instanceof ListCache) {
369
+ var pairs = data.__data__;
370
+ if (!Map2 || pairs.length < LARGE_ARRAY_SIZE - 1) {
371
+ pairs.push([key, value]);
372
+ this.size = ++data.size;
373
+ return this;
374
+ }
375
+ data = this.__data__ = new MapCache(pairs);
376
+ }
377
+ data.set(key, value);
378
+ this.size = data.size;
379
+ return this;
380
+ }
381
+ Stack.prototype.clear = stackClear;
382
+ Stack.prototype["delete"] = stackDelete;
383
+ Stack.prototype.get = stackGet;
384
+ Stack.prototype.has = stackHas;
385
+ Stack.prototype.set = stackSet;
386
+ function arrayLikeKeys(value, inherited) {
387
+ 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;
388
+ for (var key in value) {
389
+ if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
390
+ (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
391
+ isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
392
+ isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
393
+ isIndex(key, length)))) {
394
+ result.push(key);
395
+ }
396
+ }
397
+ return result;
398
+ }
399
+ function assocIndexOf(array, key) {
400
+ var length = array.length;
401
+ while (length--) {
402
+ if (eq(array[length][0], key)) {
403
+ return length;
404
+ }
405
+ }
406
+ return -1;
407
+ }
408
+ function baseGetAllKeys(object, keysFunc, symbolsFunc) {
409
+ var result = keysFunc(object);
410
+ return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
411
+ }
412
+ function baseGetTag(value) {
413
+ if (value == null) {
414
+ return value === void 0 ? undefinedTag : nullTag;
415
+ }
416
+ return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
417
+ }
418
+ function baseIsArguments(value) {
419
+ return isObjectLike(value) && baseGetTag(value) == argsTag;
420
+ }
421
+ function baseIsEqual(value, other, bitmask, customizer, stack) {
422
+ if (value === other) {
423
+ return true;
424
+ }
425
+ if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) {
426
+ return value !== value && other !== other;
427
+ }
428
+ return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
429
+ }
430
+ function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
431
+ var objIsArr = isArray(object), othIsArr = isArray(other), objTag = objIsArr ? arrayTag : getTag(object), othTag = othIsArr ? arrayTag : getTag(other);
432
+ objTag = objTag == argsTag ? objectTag : objTag;
433
+ othTag = othTag == argsTag ? objectTag : othTag;
434
+ var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
435
+ if (isSameTag && isBuffer(object)) {
436
+ if (!isBuffer(other)) {
437
+ return false;
438
+ }
439
+ objIsArr = true;
440
+ objIsObj = false;
441
+ }
442
+ if (isSameTag && !objIsObj) {
443
+ stack || (stack = new Stack());
444
+ return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
445
+ }
446
+ if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
447
+ var objIsWrapped = objIsObj && hasOwnProperty.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty.call(other, "__wrapped__");
448
+ if (objIsWrapped || othIsWrapped) {
449
+ var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
450
+ stack || (stack = new Stack());
451
+ return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
452
+ }
453
+ }
454
+ if (!isSameTag) {
455
+ return false;
456
+ }
457
+ stack || (stack = new Stack());
458
+ return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
459
+ }
460
+ function baseIsNative(value) {
461
+ if (!isObject(value) || isMasked(value)) {
462
+ return false;
463
+ }
464
+ var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
465
+ return pattern.test(toSource(value));
466
+ }
467
+ function baseIsTypedArray(value) {
468
+ return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
469
+ }
470
+ function baseKeys(object) {
471
+ if (!isPrototype(object)) {
472
+ return nativeKeys(object);
473
+ }
474
+ var result = [];
475
+ for (var key in Object(object)) {
476
+ if (hasOwnProperty.call(object, key) && key != "constructor") {
477
+ result.push(key);
478
+ }
479
+ }
480
+ return result;
481
+ }
482
+ function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
483
+ var isPartial = bitmask & COMPARE_PARTIAL_FLAG, arrLength = array.length, othLength = other.length;
484
+ if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
485
+ return false;
486
+ }
487
+ var stacked = stack.get(array);
488
+ if (stacked && stack.get(other)) {
489
+ return stacked == other;
490
+ }
491
+ var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache() : void 0;
492
+ stack.set(array, other);
493
+ stack.set(other, array);
494
+ while (++index < arrLength) {
495
+ var arrValue = array[index], othValue = other[index];
496
+ if (customizer) {
497
+ var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack);
498
+ }
499
+ if (compared !== void 0) {
500
+ if (compared) {
501
+ continue;
502
+ }
503
+ result = false;
504
+ break;
505
+ }
506
+ if (seen) {
507
+ if (!arraySome(other, function(othValue2, othIndex) {
508
+ if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
509
+ return seen.push(othIndex);
510
+ }
511
+ })) {
512
+ result = false;
513
+ break;
514
+ }
515
+ } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
516
+ result = false;
517
+ break;
518
+ }
519
+ }
520
+ stack["delete"](array);
521
+ stack["delete"](other);
522
+ return result;
523
+ }
524
+ function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
525
+ switch (tag) {
526
+ case dataViewTag:
527
+ if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
528
+ return false;
529
+ }
530
+ object = object.buffer;
531
+ other = other.buffer;
532
+ case arrayBufferTag:
533
+ if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
534
+ return false;
535
+ }
536
+ return true;
537
+ case boolTag:
538
+ case dateTag:
539
+ case numberTag:
540
+ return eq(+object, +other);
541
+ case errorTag:
542
+ return object.name == other.name && object.message == other.message;
543
+ case regexpTag:
544
+ case stringTag:
545
+ return object == other + "";
546
+ case mapTag:
547
+ var convert = mapToArray;
548
+ case setTag:
549
+ var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
550
+ convert || (convert = setToArray);
551
+ if (object.size != other.size && !isPartial) {
552
+ return false;
553
+ }
554
+ var stacked = stack.get(object);
555
+ if (stacked) {
556
+ return stacked == other;
557
+ }
558
+ bitmask |= COMPARE_UNORDERED_FLAG;
559
+ stack.set(object, other);
560
+ var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
561
+ stack["delete"](object);
562
+ return result;
563
+ case symbolTag:
564
+ if (symbolValueOf) {
565
+ return symbolValueOf.call(object) == symbolValueOf.call(other);
566
+ }
567
+ }
568
+ return false;
569
+ }
570
+ function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
571
+ var isPartial = bitmask & COMPARE_PARTIAL_FLAG, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length;
572
+ if (objLength != othLength && !isPartial) {
573
+ return false;
574
+ }
575
+ var index = objLength;
576
+ while (index--) {
577
+ var key = objProps[index];
578
+ if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
579
+ return false;
580
+ }
581
+ }
582
+ var stacked = stack.get(object);
583
+ if (stacked && stack.get(other)) {
584
+ return stacked == other;
585
+ }
586
+ var result = true;
587
+ stack.set(object, other);
588
+ stack.set(other, object);
589
+ var skipCtor = isPartial;
590
+ while (++index < objLength) {
591
+ key = objProps[index];
592
+ var objValue = object[key], othValue = other[key];
593
+ if (customizer) {
594
+ var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
595
+ }
596
+ if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
597
+ result = false;
598
+ break;
599
+ }
600
+ skipCtor || (skipCtor = key == "constructor");
601
+ }
602
+ if (result && !skipCtor) {
603
+ var objCtor = object.constructor, othCtor = other.constructor;
604
+ if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
605
+ result = false;
606
+ }
607
+ }
608
+ stack["delete"](object);
609
+ stack["delete"](other);
610
+ return result;
611
+ }
612
+ function getAllKeys(object) {
613
+ return baseGetAllKeys(object, keys, getSymbols);
614
+ }
615
+ function getMapData(map, key) {
616
+ var data = map.__data__;
617
+ return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
618
+ }
619
+ function getNative(object, key) {
620
+ var value = getValue(object, key);
621
+ return baseIsNative(value) ? value : void 0;
622
+ }
623
+ function getRawTag(value) {
624
+ var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag];
625
+ try {
626
+ value[symToStringTag] = void 0;
627
+ var unmasked = true;
628
+ } catch (e) {
629
+ }
630
+ var result = nativeObjectToString.call(value);
631
+ if (unmasked) {
632
+ if (isOwn) {
633
+ value[symToStringTag] = tag;
634
+ } else {
635
+ delete value[symToStringTag];
636
+ }
637
+ }
638
+ return result;
639
+ }
640
+ var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
641
+ if (object == null) {
642
+ return [];
643
+ }
644
+ object = Object(object);
645
+ return arrayFilter(nativeGetSymbols(object), function(symbol) {
646
+ return propertyIsEnumerable.call(object, symbol);
647
+ });
648
+ };
649
+ var getTag = baseGetTag;
650
+ 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) {
651
+ getTag = function(value) {
652
+ var result = baseGetTag(value), Ctor = result == objectTag ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
653
+ if (ctorString) {
654
+ switch (ctorString) {
655
+ case dataViewCtorString:
656
+ return dataViewTag;
657
+ case mapCtorString:
658
+ return mapTag;
659
+ case promiseCtorString:
660
+ return promiseTag;
661
+ case setCtorString:
662
+ return setTag;
663
+ case weakMapCtorString:
664
+ return weakMapTag;
665
+ }
666
+ }
667
+ return result;
668
+ };
669
+ }
670
+ function isIndex(value, length) {
671
+ length = length == null ? MAX_SAFE_INTEGER : length;
672
+ return !!length && (typeof value == "number" || reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
673
+ }
674
+ function isKeyable(value) {
675
+ var type = typeof value;
676
+ return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
677
+ }
678
+ function isMasked(func) {
679
+ return !!maskSrcKey && maskSrcKey in func;
680
+ }
681
+ function isPrototype(value) {
682
+ var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto;
683
+ return value === proto;
684
+ }
685
+ function objectToString(value) {
686
+ return nativeObjectToString.call(value);
687
+ }
688
+ function toSource(func) {
689
+ if (func != null) {
690
+ try {
691
+ return funcToString.call(func);
692
+ } catch (e) {
693
+ }
694
+ try {
695
+ return func + "";
696
+ } catch (e) {
697
+ }
698
+ }
699
+ return "";
700
+ }
701
+ function eq(value, other) {
702
+ return value === other || value !== value && other !== other;
703
+ }
704
+ var isArguments = baseIsArguments(/* @__PURE__ */ function() {
705
+ return arguments;
706
+ }()) ? baseIsArguments : function(value) {
707
+ return isObjectLike(value) && hasOwnProperty.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
708
+ };
709
+ var isArray = Array.isArray;
710
+ function isArrayLike(value) {
711
+ return value != null && isLength(value.length) && !isFunction(value);
712
+ }
713
+ var isBuffer = nativeIsBuffer || stubFalse;
714
+ function isEqual2(value, other) {
715
+ return baseIsEqual(value, other);
716
+ }
717
+ function isFunction(value) {
718
+ if (!isObject(value)) {
719
+ return false;
720
+ }
721
+ var tag = baseGetTag(value);
722
+ return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
723
+ }
724
+ function isLength(value) {
725
+ return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
726
+ }
727
+ function isObject(value) {
728
+ var type = typeof value;
729
+ return value != null && (type == "object" || type == "function");
730
+ }
731
+ function isObjectLike(value) {
732
+ return value != null && typeof value == "object";
733
+ }
734
+ var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
735
+ function keys(object) {
736
+ return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
737
+ }
738
+ function stubArray() {
739
+ return [];
740
+ }
741
+ function stubFalse() {
742
+ return false;
743
+ }
744
+ module.exports = isEqual2;
745
+ }
746
+ });
747
+
748
+ // ../../node_modules/.pnpm/eventemitter3@5.0.1/node_modules/eventemitter3/index.js
749
+ var require_eventemitter3 = _chunk4TB6NGOCcjs.__commonJS.call(void 0, {
750
+ "../../node_modules/.pnpm/eventemitter3@5.0.1/node_modules/eventemitter3/index.js"(exports, module) {
751
+ "use strict";
752
+ _chunk4TB6NGOCcjs.init_cjs_shims.call(void 0, );
753
+ var has = Object.prototype.hasOwnProperty;
754
+ var prefix = "~";
755
+ function Events() {
756
+ }
757
+ if (Object.create) {
758
+ Events.prototype = /* @__PURE__ */ Object.create(null);
759
+ if (!new Events().__proto__)
760
+ prefix = false;
761
+ }
762
+ function EE(fn, context, once) {
763
+ this.fn = fn;
764
+ this.context = context;
765
+ this.once = once || false;
766
+ }
767
+ function addListener(emitter, event, fn, context, once) {
768
+ if (typeof fn !== "function") {
769
+ throw new TypeError("The listener must be a function");
770
+ }
771
+ var listener = new EE(fn, context || emitter, once), evt = prefix ? prefix + event : event;
772
+ if (!emitter._events[evt])
773
+ emitter._events[evt] = listener, emitter._eventsCount++;
774
+ else if (!emitter._events[evt].fn)
775
+ emitter._events[evt].push(listener);
776
+ else
777
+ emitter._events[evt] = [emitter._events[evt], listener];
778
+ return emitter;
779
+ }
780
+ function clearEvent(emitter, evt) {
781
+ if (--emitter._eventsCount === 0)
782
+ emitter._events = new Events();
783
+ else
784
+ delete emitter._events[evt];
785
+ }
786
+ function EventEmitter3() {
787
+ this._events = new Events();
788
+ this._eventsCount = 0;
789
+ }
790
+ EventEmitter3.prototype.eventNames = function eventNames() {
791
+ var names = [], events, name;
792
+ if (this._eventsCount === 0)
793
+ return names;
794
+ for (name in events = this._events) {
795
+ if (has.call(events, name))
796
+ names.push(prefix ? name.slice(1) : name);
797
+ }
798
+ if (Object.getOwnPropertySymbols) {
799
+ return names.concat(Object.getOwnPropertySymbols(events));
800
+ }
801
+ return names;
802
+ };
803
+ EventEmitter3.prototype.listeners = function listeners(event) {
804
+ var evt = prefix ? prefix + event : event, handlers = this._events[evt];
805
+ if (!handlers)
806
+ return [];
807
+ if (handlers.fn)
808
+ return [handlers.fn];
809
+ for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {
810
+ ee[i] = handlers[i].fn;
811
+ }
812
+ return ee;
813
+ };
814
+ EventEmitter3.prototype.listenerCount = function listenerCount(event) {
815
+ var evt = prefix ? prefix + event : event, listeners = this._events[evt];
816
+ if (!listeners)
817
+ return 0;
818
+ if (listeners.fn)
819
+ return 1;
820
+ return listeners.length;
821
+ };
822
+ EventEmitter3.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
823
+ var evt = prefix ? prefix + event : event;
824
+ if (!this._events[evt])
825
+ return false;
826
+ var listeners = this._events[evt], len = arguments.length, args, i;
827
+ if (listeners.fn) {
828
+ if (listeners.once)
829
+ this.removeListener(event, listeners.fn, void 0, true);
830
+ switch (len) {
831
+ case 1:
832
+ return listeners.fn.call(listeners.context), true;
833
+ case 2:
834
+ return listeners.fn.call(listeners.context, a1), true;
835
+ case 3:
836
+ return listeners.fn.call(listeners.context, a1, a2), true;
837
+ case 4:
838
+ return listeners.fn.call(listeners.context, a1, a2, a3), true;
839
+ case 5:
840
+ return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
841
+ case 6:
842
+ return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
843
+ }
844
+ for (i = 1, args = new Array(len - 1); i < len; i++) {
845
+ args[i - 1] = arguments[i];
846
+ }
847
+ listeners.fn.apply(listeners.context, args);
848
+ } else {
849
+ var length = listeners.length, j;
850
+ for (i = 0; i < length; i++) {
851
+ if (listeners[i].once)
852
+ this.removeListener(event, listeners[i].fn, void 0, true);
853
+ switch (len) {
854
+ case 1:
855
+ listeners[i].fn.call(listeners[i].context);
856
+ break;
857
+ case 2:
858
+ listeners[i].fn.call(listeners[i].context, a1);
859
+ break;
860
+ case 3:
861
+ listeners[i].fn.call(listeners[i].context, a1, a2);
862
+ break;
863
+ case 4:
864
+ listeners[i].fn.call(listeners[i].context, a1, a2, a3);
865
+ break;
866
+ default:
867
+ if (!args)
868
+ for (j = 1, args = new Array(len - 1); j < len; j++) {
869
+ args[j - 1] = arguments[j];
870
+ }
871
+ listeners[i].fn.apply(listeners[i].context, args);
872
+ }
873
+ }
874
+ }
875
+ return true;
876
+ };
877
+ EventEmitter3.prototype.on = function on(event, fn, context) {
878
+ return addListener(this, event, fn, context, false);
879
+ };
880
+ EventEmitter3.prototype.once = function once(event, fn, context) {
881
+ return addListener(this, event, fn, context, true);
882
+ };
883
+ EventEmitter3.prototype.removeListener = function removeListener(event, fn, context, once) {
884
+ var evt = prefix ? prefix + event : event;
885
+ if (!this._events[evt])
886
+ return this;
887
+ if (!fn) {
888
+ clearEvent(this, evt);
889
+ return this;
890
+ }
891
+ var listeners = this._events[evt];
892
+ if (listeners.fn) {
893
+ if (listeners.fn === fn && (!once || listeners.once) && (!context || listeners.context === context)) {
894
+ clearEvent(this, evt);
895
+ }
896
+ } else {
897
+ for (var i = 0, events = [], length = listeners.length; i < length; i++) {
898
+ if (listeners[i].fn !== fn || once && !listeners[i].once || context && listeners[i].context !== context) {
899
+ events.push(listeners[i]);
900
+ }
901
+ }
902
+ if (events.length)
903
+ this._events[evt] = events.length === 1 ? events[0] : events;
904
+ else
905
+ clearEvent(this, evt);
906
+ }
907
+ return this;
908
+ };
909
+ EventEmitter3.prototype.removeAllListeners = function removeAllListeners(event) {
910
+ var evt;
911
+ if (event) {
912
+ evt = prefix ? prefix + event : event;
913
+ if (this._events[evt])
914
+ clearEvent(this, evt);
915
+ } else {
916
+ this._events = new Events();
917
+ this._eventsCount = 0;
918
+ }
919
+ return this;
920
+ };
921
+ EventEmitter3.prototype.off = EventEmitter3.prototype.removeListener;
922
+ EventEmitter3.prototype.addListener = EventEmitter3.prototype.on;
923
+ EventEmitter3.prefixed = prefix;
924
+ EventEmitter3.EventEmitter = EventEmitter3;
925
+ if ("undefined" !== typeof module) {
926
+ module.exports = EventEmitter3;
927
+ }
928
+ }
929
+ });
930
+
931
+ // src/index.ts
932
+ _chunk4TB6NGOCcjs.init_cjs_shims.call(void 0, );
933
+
934
+ // src/build.ts
935
+ _chunk4TB6NGOCcjs.init_cjs_shims.call(void 0, );
936
+
937
+ // src/config.ts
938
+ _chunk4TB6NGOCcjs.init_cjs_shims.call(void 0, );
939
+ function defineConfig(options) {
940
+ return options;
941
+ }
942
+ function isInputPath(result) {
943
+ return !!result && "path" in result;
944
+ }
945
+
946
+ // src/FileManager.ts
947
+ _chunk4TB6NGOCcjs.init_cjs_shims.call(void 0, );
948
+ var import_lodash = _chunk4TB6NGOCcjs.__toESM.call(void 0, require_lodash(), 1);
949
+ var _crypto = require('crypto'); var _crypto2 = _interopRequireDefault(_crypto);
950
+ var _path = require('path'); var _path2 = _interopRequireDefault(_path);
951
+ var _parser = require('@kubb/parser');
952
+ var _factory = require('@kubb/parser/factory'); var factory = _interopRequireWildcard(_factory);
953
+
954
+ // ../../node_modules/.pnpm/p-queue@8.0.1/node_modules/p-queue/dist/index.js
955
+ _chunk4TB6NGOCcjs.init_cjs_shims.call(void 0, );
956
+
957
+ // ../../node_modules/.pnpm/eventemitter3@5.0.1/node_modules/eventemitter3/index.mjs
958
+ _chunk4TB6NGOCcjs.init_cjs_shims.call(void 0, );
959
+ var import_index = _chunk4TB6NGOCcjs.__toESM.call(void 0, require_eventemitter3(), 1);
960
+
961
+ // ../../node_modules/.pnpm/p-timeout@6.1.2/node_modules/p-timeout/index.js
962
+ _chunk4TB6NGOCcjs.init_cjs_shims.call(void 0, );
963
+ var TimeoutError = class extends Error {
964
+ constructor(message) {
965
+ super(message);
966
+ this.name = "TimeoutError";
967
+ }
968
+ };
969
+ var AbortError = class extends Error {
970
+ constructor(message) {
971
+ super();
972
+ this.name = "AbortError";
973
+ this.message = message;
974
+ }
975
+ };
976
+ var getDOMException = (errorMessage) => globalThis.DOMException === void 0 ? new AbortError(errorMessage) : new DOMException(errorMessage);
977
+ var getAbortedReason = (signal) => {
978
+ const reason = signal.reason === void 0 ? getDOMException("This operation was aborted.") : signal.reason;
979
+ return reason instanceof Error ? reason : getDOMException(reason);
980
+ };
981
+ function pTimeout(promise, options) {
982
+ const {
983
+ milliseconds,
984
+ fallback,
985
+ message,
986
+ customTimers = { setTimeout, clearTimeout }
987
+ } = options;
988
+ let timer;
989
+ const wrappedPromise = new Promise((resolve2, reject) => {
990
+ if (typeof milliseconds !== "number" || Math.sign(milliseconds) !== 1) {
991
+ throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${milliseconds}\``);
992
+ }
993
+ if (options.signal) {
994
+ const { signal } = options;
995
+ if (signal.aborted) {
996
+ reject(getAbortedReason(signal));
997
+ }
998
+ signal.addEventListener("abort", () => {
999
+ reject(getAbortedReason(signal));
1000
+ });
1001
+ }
1002
+ if (milliseconds === Number.POSITIVE_INFINITY) {
1003
+ promise.then(resolve2, reject);
1004
+ return;
1005
+ }
1006
+ const timeoutError = new TimeoutError();
1007
+ timer = customTimers.setTimeout.call(void 0, () => {
1008
+ if (fallback) {
1009
+ try {
1010
+ resolve2(fallback());
1011
+ } catch (error) {
1012
+ reject(error);
1013
+ }
1014
+ return;
1015
+ }
1016
+ if (typeof promise.cancel === "function") {
1017
+ promise.cancel();
1018
+ }
1019
+ if (message === false) {
1020
+ resolve2();
1021
+ } else if (message instanceof Error) {
1022
+ reject(message);
1023
+ } else {
1024
+ timeoutError.message = _nullishCoalesce(message, () => ( `Promise timed out after ${milliseconds} milliseconds`));
1025
+ reject(timeoutError);
1026
+ }
1027
+ }, milliseconds);
1028
+ (async () => {
1029
+ try {
1030
+ resolve2(await promise);
1031
+ } catch (error) {
1032
+ reject(error);
1033
+ }
1034
+ })();
1035
+ });
1036
+ const cancelablePromise = wrappedPromise.finally(() => {
1037
+ cancelablePromise.clear();
1038
+ });
1039
+ cancelablePromise.clear = () => {
1040
+ customTimers.clearTimeout.call(void 0, timer);
1041
+ timer = void 0;
1042
+ };
1043
+ return cancelablePromise;
1044
+ }
1045
+
1046
+ // ../../node_modules/.pnpm/p-queue@8.0.1/node_modules/p-queue/dist/priority-queue.js
1047
+ _chunk4TB6NGOCcjs.init_cjs_shims.call(void 0, );
1048
+
1049
+ // ../../node_modules/.pnpm/p-queue@8.0.1/node_modules/p-queue/dist/lower-bound.js
1050
+ _chunk4TB6NGOCcjs.init_cjs_shims.call(void 0, );
1051
+ function lowerBound(array, value, comparator) {
1052
+ let first = 0;
1053
+ let count = array.length;
1054
+ while (count > 0) {
1055
+ const step = Math.trunc(count / 2);
1056
+ let it = first + step;
1057
+ if (comparator(array[it], value) <= 0) {
1058
+ first = ++it;
1059
+ count -= step + 1;
1060
+ } else {
1061
+ count = step;
1062
+ }
1063
+ }
1064
+ return first;
1065
+ }
1066
+
1067
+ // ../../node_modules/.pnpm/p-queue@8.0.1/node_modules/p-queue/dist/priority-queue.js
1068
+ var _queue;
1069
+ var PriorityQueue = class {
1070
+ constructor() {
1071
+ _chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _queue, []);
1072
+ }
1073
+ enqueue(run, options) {
1074
+ options = {
1075
+ priority: 0,
1076
+ ...options
1077
+ };
1078
+ const element = {
1079
+ priority: options.priority,
1080
+ run
1081
+ };
1082
+ if (this.size && _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _queue)[this.size - 1].priority >= options.priority) {
1083
+ _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _queue).push(element);
1084
+ return;
1085
+ }
1086
+ const index = lowerBound(_chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _queue), element, (a, b) => b.priority - a.priority);
1087
+ _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _queue).splice(index, 0, element);
1088
+ }
1089
+ dequeue() {
1090
+ const item = _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _queue).shift();
1091
+ return _optionalChain([item, 'optionalAccess', _2 => _2.run]);
1092
+ }
1093
+ filter(options) {
1094
+ return _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _queue).filter((element) => element.priority === options.priority).map((element) => element.run);
1095
+ }
1096
+ get size() {
1097
+ return _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _queue).length;
1098
+ }
1099
+ };
1100
+ _queue = new WeakMap();
1101
+
1102
+ // ../../node_modules/.pnpm/p-queue@8.0.1/node_modules/p-queue/dist/index.js
1103
+ var _carryoverConcurrencyCount, _isIntervalIgnored, _intervalCount, _intervalCap, _interval, _intervalEnd, _intervalId, _timeoutId, _queue2, _queueClass, _pending, _concurrency, _isPaused, _throwOnTimeout, _doesIntervalAllowAnother, doesIntervalAllowAnother_get, _doesConcurrentAllowAnother, doesConcurrentAllowAnother_get, _next, next_fn, _onResumeInterval, onResumeInterval_fn, _isIntervalPaused, isIntervalPaused_get, _tryToStartAnother, tryToStartAnother_fn, _initializeIntervalIfNeeded, initializeIntervalIfNeeded_fn, _onInterval, onInterval_fn, _processQueue, processQueue_fn, _throwOnAbort, throwOnAbort_fn, _onEvent, onEvent_fn;
1104
+ var PQueue = class extends import_index.default {
1105
+ // TODO: The `throwOnTimeout` option should affect the return types of `add()` and `addAll()`
1106
+ constructor(options) {
1107
+ super();
1108
+ _chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _doesIntervalAllowAnother);
1109
+ _chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _doesConcurrentAllowAnother);
1110
+ _chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _next);
1111
+ _chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _onResumeInterval);
1112
+ _chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _isIntervalPaused);
1113
+ _chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _tryToStartAnother);
1114
+ _chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _initializeIntervalIfNeeded);
1115
+ _chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _onInterval);
1116
+ /**
1117
+ Executes all queued functions until it reaches the limit.
1118
+ */
1119
+ _chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _processQueue);
1120
+ _chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _throwOnAbort);
1121
+ _chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _onEvent);
1122
+ _chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _carryoverConcurrencyCount, void 0);
1123
+ _chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _isIntervalIgnored, void 0);
1124
+ _chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _intervalCount, 0);
1125
+ _chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _intervalCap, void 0);
1126
+ _chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _interval, void 0);
1127
+ _chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _intervalEnd, 0);
1128
+ _chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _intervalId, void 0);
1129
+ _chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _timeoutId, void 0);
1130
+ _chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _queue2, void 0);
1131
+ _chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _queueClass, void 0);
1132
+ _chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _pending, 0);
1133
+ // The `!` is needed because of https://github.com/microsoft/TypeScript/issues/32194
1134
+ _chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _concurrency, void 0);
1135
+ _chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _isPaused, void 0);
1136
+ _chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _throwOnTimeout, void 0);
1137
+ /**
1138
+ Per-operation timeout in milliseconds. Operations fulfill once `timeout` elapses if they haven't already.
1139
+
1140
+ Applies to each future operation.
1141
+ */
1142
+ _chunk4TB6NGOCcjs.__publicField.call(void 0, this, "timeout");
1143
+ options = {
1144
+ carryoverConcurrencyCount: false,
1145
+ intervalCap: Number.POSITIVE_INFINITY,
1146
+ interval: 0,
1147
+ concurrency: Number.POSITIVE_INFINITY,
1148
+ autoStart: true,
1149
+ queueClass: PriorityQueue,
1150
+ ...options
1151
+ };
1152
+ if (!(typeof options.intervalCap === "number" && options.intervalCap >= 1)) {
1153
+ throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${_nullishCoalesce(_optionalChain([options, 'access', _3 => _3.intervalCap, 'optionalAccess', _4 => _4.toString, 'call', _5 => _5()]), () => ( ""))}\` (${typeof options.intervalCap})`);
1154
+ }
1155
+ if (options.interval === void 0 || !(Number.isFinite(options.interval) && options.interval >= 0)) {
1156
+ throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${_nullishCoalesce(_optionalChain([options, 'access', _6 => _6.interval, 'optionalAccess', _7 => _7.toString, 'call', _8 => _8()]), () => ( ""))}\` (${typeof options.interval})`);
1157
+ }
1158
+ _chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _carryoverConcurrencyCount, options.carryoverConcurrencyCount);
1159
+ _chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _isIntervalIgnored, options.intervalCap === Number.POSITIVE_INFINITY || options.interval === 0);
1160
+ _chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _intervalCap, options.intervalCap);
1161
+ _chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _interval, options.interval);
1162
+ _chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _queue2, new options.queueClass());
1163
+ _chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _queueClass, options.queueClass);
1164
+ this.concurrency = options.concurrency;
1165
+ this.timeout = options.timeout;
1166
+ _chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _throwOnTimeout, options.throwOnTimeout === true);
1167
+ _chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _isPaused, options.autoStart === false);
1168
+ }
1169
+ get concurrency() {
1170
+ return _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _concurrency);
1171
+ }
1172
+ set concurrency(newConcurrency) {
1173
+ if (!(typeof newConcurrency === "number" && newConcurrency >= 1)) {
1174
+ throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${newConcurrency}\` (${typeof newConcurrency})`);
1175
+ }
1176
+ _chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _concurrency, newConcurrency);
1177
+ _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _processQueue, processQueue_fn).call(this);
1178
+ }
1179
+ async add(function_, options = {}) {
1180
+ options = {
1181
+ timeout: this.timeout,
1182
+ throwOnTimeout: _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _throwOnTimeout),
1183
+ ...options
1184
+ };
1185
+ return new Promise((resolve2, reject) => {
1186
+ _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _queue2).enqueue(async () => {
1187
+ _chunk4TB6NGOCcjs.__privateWrapper.call(void 0, this, _pending)._++;
1188
+ _chunk4TB6NGOCcjs.__privateWrapper.call(void 0, this, _intervalCount)._++;
1189
+ try {
1190
+ _optionalChain([options, 'access', _9 => _9.signal, 'optionalAccess', _10 => _10.throwIfAborted, 'call', _11 => _11()]);
1191
+ let operation = function_({ signal: options.signal });
1192
+ if (options.timeout) {
1193
+ operation = pTimeout(Promise.resolve(operation), { milliseconds: options.timeout });
1194
+ }
1195
+ if (options.signal) {
1196
+ operation = Promise.race([operation, _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _throwOnAbort, throwOnAbort_fn).call(this, options.signal)]);
1197
+ }
1198
+ const result = await operation;
1199
+ resolve2(result);
1200
+ this.emit("completed", result);
1201
+ } catch (error) {
1202
+ if (error instanceof TimeoutError && !options.throwOnTimeout) {
1203
+ resolve2();
1204
+ return;
1205
+ }
1206
+ reject(error);
1207
+ this.emit("error", error);
1208
+ } finally {
1209
+ _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _next, next_fn).call(this);
1210
+ }
1211
+ }, options);
1212
+ this.emit("add");
1213
+ _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _tryToStartAnother, tryToStartAnother_fn).call(this);
1214
+ });
1215
+ }
1216
+ async addAll(functions, options) {
1217
+ return Promise.all(functions.map(async (function_) => this.add(function_, options)));
1218
+ }
1219
+ /**
1220
+ Start (or resume) executing enqueued tasks within concurrency limit. No need to call this if queue is not paused (via `options.autoStart = false` or by `.pause()` method.)
1221
+ */
1222
+ start() {
1223
+ if (!_chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _isPaused)) {
1224
+ return this;
1225
+ }
1226
+ _chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _isPaused, false);
1227
+ _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _processQueue, processQueue_fn).call(this);
1228
+ return this;
1229
+ }
1230
+ /**
1231
+ Put queue execution on hold.
1232
+ */
1233
+ pause() {
1234
+ _chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _isPaused, true);
1235
+ }
1236
+ /**
1237
+ Clear the queue.
1238
+ */
1239
+ clear() {
1240
+ _chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _queue2, new (_chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _queueClass))());
1241
+ }
1242
+ /**
1243
+ Can be called multiple times. Useful if you for example add additional items at a later time.
1244
+
1245
+ @returns A promise that settles when the queue becomes empty.
1246
+ */
1247
+ async onEmpty() {
1248
+ if (_chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _queue2).size === 0) {
1249
+ return;
1250
+ }
1251
+ await _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _onEvent, onEvent_fn).call(this, "empty");
1252
+ }
1253
+ /**
1254
+ @returns A promise that settles when the queue size is less than the given limit: `queue.size < limit`.
1255
+
1256
+ If you want to avoid having the queue grow beyond a certain size you can `await queue.onSizeLessThan()` before adding a new item.
1257
+
1258
+ Note that this only limits the number of items waiting to start. There could still be up to `concurrency` jobs already running that this call does not include in its calculation.
1259
+ */
1260
+ async onSizeLessThan(limit) {
1261
+ if (_chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _queue2).size < limit) {
1262
+ return;
1263
+ }
1264
+ await _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _onEvent, onEvent_fn).call(this, "next", () => _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _queue2).size < limit);
1265
+ }
1266
+ /**
1267
+ The difference with `.onEmpty` is that `.onIdle` guarantees that all work from the queue has finished. `.onEmpty` merely signals that the queue is empty, but it could mean that some promises haven't completed yet.
1268
+
1269
+ @returns A promise that settles when the queue becomes empty, and all promises have completed; `queue.size === 0 && queue.pending === 0`.
1270
+ */
1271
+ async onIdle() {
1272
+ if (_chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _pending) === 0 && _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _queue2).size === 0) {
1273
+ return;
1274
+ }
1275
+ await _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _onEvent, onEvent_fn).call(this, "idle");
1276
+ }
1277
+ /**
1278
+ Size of the queue, the number of queued items waiting to run.
1279
+ */
1280
+ get size() {
1281
+ return _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _queue2).size;
1282
+ }
1283
+ /**
1284
+ Size of the queue, filtered by the given options.
1285
+
1286
+ For example, this can be used to find the number of items remaining in the queue with a specific priority level.
1287
+ */
1288
+ sizeBy(options) {
1289
+ return _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _queue2).filter(options).length;
1290
+ }
1291
+ /**
1292
+ Number of running items (no longer in the queue).
1293
+ */
1294
+ get pending() {
1295
+ return _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _pending);
1296
+ }
1297
+ /**
1298
+ Whether the queue is currently paused.
1299
+ */
1300
+ get isPaused() {
1301
+ return _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _isPaused);
1302
+ }
1303
+ };
1304
+ _carryoverConcurrencyCount = new WeakMap();
1305
+ _isIntervalIgnored = new WeakMap();
1306
+ _intervalCount = new WeakMap();
1307
+ _intervalCap = new WeakMap();
1308
+ _interval = new WeakMap();
1309
+ _intervalEnd = new WeakMap();
1310
+ _intervalId = new WeakMap();
1311
+ _timeoutId = new WeakMap();
1312
+ _queue2 = new WeakMap();
1313
+ _queueClass = new WeakMap();
1314
+ _pending = new WeakMap();
1315
+ _concurrency = new WeakMap();
1316
+ _isPaused = new WeakMap();
1317
+ _throwOnTimeout = new WeakMap();
1318
+ _doesIntervalAllowAnother = new WeakSet();
1319
+ doesIntervalAllowAnother_get = function() {
1320
+ return _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _isIntervalIgnored) || _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _intervalCount) < _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _intervalCap);
1321
+ };
1322
+ _doesConcurrentAllowAnother = new WeakSet();
1323
+ doesConcurrentAllowAnother_get = function() {
1324
+ return _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _pending) < _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _concurrency);
1325
+ };
1326
+ _next = new WeakSet();
1327
+ next_fn = function() {
1328
+ _chunk4TB6NGOCcjs.__privateWrapper.call(void 0, this, _pending)._--;
1329
+ _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _tryToStartAnother, tryToStartAnother_fn).call(this);
1330
+ this.emit("next");
1331
+ };
1332
+ _onResumeInterval = new WeakSet();
1333
+ onResumeInterval_fn = function() {
1334
+ _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _onInterval, onInterval_fn).call(this);
1335
+ _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _initializeIntervalIfNeeded, initializeIntervalIfNeeded_fn).call(this);
1336
+ _chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _timeoutId, void 0);
1337
+ };
1338
+ _isIntervalPaused = new WeakSet();
1339
+ isIntervalPaused_get = function() {
1340
+ const now = Date.now();
1341
+ if (_chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _intervalId) === void 0) {
1342
+ const delay = _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _intervalEnd) - now;
1343
+ if (delay < 0) {
1344
+ _chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _intervalCount, _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _carryoverConcurrencyCount) ? _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _pending) : 0);
1345
+ } else {
1346
+ if (_chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _timeoutId) === void 0) {
1347
+ _chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _timeoutId, setTimeout(() => {
1348
+ _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _onResumeInterval, onResumeInterval_fn).call(this);
1349
+ }, delay));
1350
+ }
1351
+ return true;
1352
+ }
1353
+ }
1354
+ return false;
1355
+ };
1356
+ _tryToStartAnother = new WeakSet();
1357
+ tryToStartAnother_fn = function() {
1358
+ if (_chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _queue2).size === 0) {
1359
+ if (_chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _intervalId)) {
1360
+ clearInterval(_chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _intervalId));
1361
+ }
1362
+ _chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _intervalId, void 0);
1363
+ this.emit("empty");
1364
+ if (_chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _pending) === 0) {
1365
+ this.emit("idle");
1366
+ }
1367
+ return false;
1368
+ }
1369
+ if (!_chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _isPaused)) {
1370
+ const canInitializeInterval = !_chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _isIntervalPaused, isIntervalPaused_get);
1371
+ if (_chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _doesIntervalAllowAnother, doesIntervalAllowAnother_get) && _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _doesConcurrentAllowAnother, doesConcurrentAllowAnother_get)) {
1372
+ const job = _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _queue2).dequeue();
1373
+ if (!job) {
1374
+ return false;
1375
+ }
1376
+ this.emit("active");
1377
+ job();
1378
+ if (canInitializeInterval) {
1379
+ _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _initializeIntervalIfNeeded, initializeIntervalIfNeeded_fn).call(this);
1380
+ }
1381
+ return true;
1382
+ }
1383
+ }
1384
+ return false;
1385
+ };
1386
+ _initializeIntervalIfNeeded = new WeakSet();
1387
+ initializeIntervalIfNeeded_fn = function() {
1388
+ if (_chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _isIntervalIgnored) || _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _intervalId) !== void 0) {
1389
+ return;
1390
+ }
1391
+ _chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _intervalId, setInterval(() => {
1392
+ _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _onInterval, onInterval_fn).call(this);
1393
+ }, _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _interval)));
1394
+ _chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _intervalEnd, Date.now() + _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _interval));
1395
+ };
1396
+ _onInterval = new WeakSet();
1397
+ onInterval_fn = function() {
1398
+ if (_chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _intervalCount) === 0 && _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _pending) === 0 && _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _intervalId)) {
1399
+ clearInterval(_chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _intervalId));
1400
+ _chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _intervalId, void 0);
1401
+ }
1402
+ _chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _intervalCount, _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _carryoverConcurrencyCount) ? _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _pending) : 0);
1403
+ _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _processQueue, processQueue_fn).call(this);
1404
+ };
1405
+ _processQueue = new WeakSet();
1406
+ processQueue_fn = function() {
1407
+ while (_chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _tryToStartAnother, tryToStartAnother_fn).call(this)) {
1408
+ }
1409
+ };
1410
+ _throwOnAbort = new WeakSet();
1411
+ throwOnAbort_fn = async function(signal) {
1412
+ return new Promise((_resolve, reject) => {
1413
+ signal.addEventListener("abort", () => {
1414
+ reject(signal.reason);
1415
+ }, { once: true });
1416
+ });
1417
+ };
1418
+ _onEvent = new WeakSet();
1419
+ onEvent_fn = async function(event, filter) {
1420
+ return new Promise((resolve2) => {
1421
+ const listener = () => {
1422
+ if (filter && !filter()) {
1423
+ return;
1424
+ }
1425
+ this.off(event, listener);
1426
+ resolve2();
1427
+ };
1428
+ this.on(event, listener);
1429
+ });
1430
+ };
1431
+
1432
+ // src/BarrelManager.ts
1433
+ _chunk4TB6NGOCcjs.init_cjs_shims.call(void 0, );
1434
+
1435
+
1436
+
1437
+ // src/utils/TreeNode.ts
1438
+ _chunk4TB6NGOCcjs.init_cjs_shims.call(void 0, );
1439
+ var _directorytree = require('directory-tree'); var _directorytree2 = _interopRequireDefault(_directorytree);
1440
+ var TreeNode = class _TreeNode {
1441
+ constructor(data, parent) {
1442
+ this.children = [];
1443
+ this.data = data;
1444
+ this.parent = parent;
1445
+ return this;
1446
+ }
1447
+ addChild(data) {
1448
+ const child = new _TreeNode(data, this);
1449
+ if (!this.children) {
1450
+ this.children = [];
1451
+ }
1452
+ this.children.push(child);
1453
+ return child;
1454
+ }
1455
+ find(data) {
1456
+ if (!data) {
1457
+ return null;
1458
+ }
1459
+ if (data === this.data) {
1460
+ return this;
1461
+ }
1462
+ if (_optionalChain([this, 'access', _12 => _12.children, 'optionalAccess', _13 => _13.length])) {
1463
+ for (let i = 0, { length } = this.children, target = null; i < length; i++) {
1464
+ target = this.children[i].find(data);
1465
+ if (target) {
1466
+ return target;
1467
+ }
1468
+ }
1469
+ }
1470
+ return null;
1471
+ }
1472
+ get leaves() {
1473
+ if (!this.children || this.children.length === 0) {
1474
+ return [this];
1475
+ }
1476
+ const leaves = [];
1477
+ if (this.children) {
1478
+ for (let i = 0, { length } = this.children; i < length; i++) {
1479
+ leaves.push.apply(leaves, this.children[i].leaves);
1480
+ }
1481
+ }
1482
+ return leaves;
1483
+ }
1484
+ get root() {
1485
+ if (!this.parent) {
1486
+ return this;
1487
+ }
1488
+ return this.parent.root;
1489
+ }
1490
+ forEach(callback) {
1491
+ if (typeof callback !== "function") {
1492
+ throw new TypeError("forEach() callback must be a function");
1493
+ }
1494
+ callback(this);
1495
+ if (this.children) {
1496
+ for (let i = 0, { length } = this.children; i < length; i++) {
1497
+ _optionalChain([this, 'access', _14 => _14.children, 'access', _15 => _15[i], 'optionalAccess', _16 => _16.forEach, 'call', _17 => _17(callback)]);
1498
+ }
1499
+ }
1500
+ return this;
1501
+ }
1502
+ static build(path5, options = {}) {
1503
+ try {
1504
+ const exclude = Array.isArray(options.exclude) ? options.exclude : [options.exclude].filter(Boolean);
1505
+ const filteredTree = _directorytree2.default.call(void 0, path5, {
1506
+ extensions: options.extensions,
1507
+ exclude: [/node_modules/, ...exclude]
1508
+ });
1509
+ if (!filteredTree) {
1510
+ return null;
1511
+ }
1512
+ const treeNode = new _TreeNode({
1513
+ name: filteredTree.name,
1514
+ path: filteredTree.path,
1515
+ type: filteredTree.type || FileManager.getMode(filteredTree.path)
1516
+ });
1517
+ const recurse = (node, item) => {
1518
+ const subNode = node.addChild({
1519
+ name: item.name,
1520
+ path: item.path,
1521
+ type: item.type || FileManager.getMode(item.path)
1522
+ });
1523
+ if (_optionalChain([item, 'access', _18 => _18.children, 'optionalAccess', _19 => _19.length])) {
1524
+ _optionalChain([item, 'access', _20 => _20.children, 'optionalAccess', _21 => _21.forEach, 'call', _22 => _22((child) => {
1525
+ recurse(subNode, child);
1526
+ })]);
1527
+ }
1528
+ };
1529
+ _optionalChain([filteredTree, 'access', _23 => _23.children, 'optionalAccess', _24 => _24.forEach, 'call', _25 => _25((child) => recurse(treeNode, child))]);
1530
+ return treeNode;
1531
+ } catch (e) {
1532
+ throw new Error("Something went wrong with creating index files with the TreehNode class", { cause: e });
1533
+ }
1534
+ }
1535
+ };
1536
+
1537
+ // src/BarrelManager.ts
1538
+ var _options;
1539
+ var BarrelManager = class {
1540
+ constructor(options = {}) {
1541
+ _chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _options, void 0);
1542
+ _chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _options, options);
1543
+ return this;
1544
+ }
1545
+ getNamedExport(root, item) {
1546
+ const exportedNames = _parser.getExports.call(void 0, _path2.default.resolve(root, item.path));
1547
+ if (!exportedNames) {
1548
+ return [item];
1549
+ }
1550
+ return exportedNames.reduce(
1551
+ (prev, curr) => {
1552
+ if (!_optionalChain([prev, 'access', _26 => _26[0], 'optionalAccess', _27 => _27.name]) || !_optionalChain([prev, 'access', _28 => _28[1], 'optionalAccess', _29 => _29.name])) {
1553
+ return prev;
1554
+ }
1555
+ if (curr.isTypeOnly) {
1556
+ prev[1] = { ...prev[1], name: [...prev[1].name, curr.name] };
1557
+ } else {
1558
+ prev[0] = { ...prev[0], name: [...prev[0].name, curr.name] };
1559
+ }
1560
+ return prev;
1561
+ },
1562
+ [
1563
+ {
1564
+ ...item,
1565
+ name: [],
1566
+ isTypeOnly: false
1567
+ },
1568
+ {
1569
+ ...item,
1570
+ name: [],
1571
+ isTypeOnly: true
1572
+ }
1573
+ ]
1574
+ );
1575
+ }
1576
+ getNamedExports(root, exports) {
1577
+ return _optionalChain([exports, 'optionalAccess', _30 => _30.flatMap, 'call', _31 => _31((item) => {
1578
+ return this.getNamedExport(root, item);
1579
+ })]);
1580
+ }
1581
+ getIndexes(root) {
1582
+ const { treeNode = {}, isTypeOnly, extName } = _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _options);
1583
+ const tree = TreeNode.build(root, treeNode);
1584
+ if (!tree) {
1585
+ return null;
1586
+ }
1587
+ const fileReducer = (files, treeNode2) => {
1588
+ if (!treeNode2.children) {
1589
+ return [];
1590
+ }
1591
+ if (treeNode2.children.length > 1) {
1592
+ const indexPath = _path2.default.resolve(treeNode2.data.path, "index.ts");
1593
+ const exports = treeNode2.children.filter(Boolean).map((file) => {
1594
+ const importPath = file.data.type === "directory" ? `./${file.data.name}/index` : `./${_chunkVHRZO2NCcjs.trimExtName.call(void 0, file.data.name)}`;
1595
+ if (importPath.endsWith("index") && file.data.type === "file") {
1596
+ return void 0;
1597
+ }
1598
+ return {
1599
+ path: extName ? `${importPath}${extName}` : importPath,
1600
+ isTypeOnly
1601
+ };
1602
+ }).filter(Boolean);
1603
+ files.push({
1604
+ path: indexPath,
1605
+ baseName: "index.ts",
1606
+ source: "",
1607
+ exports,
1608
+ exportable: true
1609
+ });
1610
+ } else if (treeNode2.children.length === 1) {
1611
+ const [treeNodeChild] = treeNode2.children;
1612
+ const indexPath = _path2.default.resolve(treeNode2.data.path, "index.ts");
1613
+ const importPath = treeNodeChild.data.type === "directory" ? `./${treeNodeChild.data.name}/index` : `./${_chunkVHRZO2NCcjs.trimExtName.call(void 0, treeNodeChild.data.name)}`;
1614
+ const exports = [
1615
+ {
1616
+ path: extName ? `${importPath}${extName}` : importPath,
1617
+ isTypeOnly
1618
+ }
1619
+ ];
1620
+ files.push({
1621
+ path: indexPath,
1622
+ baseName: "index.ts",
1623
+ source: "",
1624
+ exports,
1625
+ exportable: true
1626
+ });
1627
+ }
1628
+ treeNode2.children.forEach((childItem) => {
1629
+ fileReducer(files, childItem);
1630
+ });
1631
+ return files;
1632
+ };
1633
+ return fileReducer([], tree).reverse();
1634
+ }
1635
+ };
1636
+ _options = new WeakMap();
1637
+
1638
+ // src/FileManager.ts
1639
+ var KubbFile;
1640
+ ((KubbFile2) => {
1641
+ })(KubbFile || (KubbFile = exports.KubbFile = {}));
1642
+ var _cache, _task, _queue3, _add, add_fn, _addOrAppend, addOrAppend_fn;
1643
+ var _FileManager = class _FileManager {
1644
+ constructor({ task = async (file) => file, queue = new PQueue() } = {}) {
1645
+ _chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _add);
1646
+ _chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _addOrAppend);
1647
+ _chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _cache, /* @__PURE__ */ new Map());
1648
+ _chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _task, void 0);
1649
+ _chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _queue3, void 0);
1650
+ _chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _task, task);
1651
+ _chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _queue3, queue);
1652
+ return this;
1653
+ }
1654
+ get files() {
1655
+ const files = [];
1656
+ _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _cache).forEach((item) => {
1657
+ files.push(...item.flat(1));
1658
+ });
1659
+ return files;
1660
+ }
1661
+ get isExecuting() {
1662
+ return _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _queue3).size !== 0 && _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _queue3).pending !== 0;
1663
+ }
1664
+ async add(...files) {
1665
+ const promises = combineFiles(files).map((file) => {
1666
+ if (file.override) {
1667
+ return _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _add, add_fn).call(this, file);
1668
+ }
1669
+ return _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _addOrAppend, addOrAppend_fn).call(this, file);
1670
+ });
1671
+ const resolvedFiles = await Promise.all(promises);
1672
+ if (files.length > 1) {
1673
+ return resolvedFiles;
1674
+ }
1675
+ return resolvedFiles[0];
1676
+ }
1677
+ async addIndexes({ root, output, meta, options = {} }) {
1678
+ const { exportType = "barrel" } = output;
1679
+ if (exportType === false) {
1680
+ return void 0;
1681
+ }
1682
+ const pathToBuildFrom = _path.resolve.call(void 0, root, output.path);
1683
+ const exportPath = output.path.startsWith("./") ? _chunkVHRZO2NCcjs.trimExtName.call(void 0, output.path) : `./${_chunkVHRZO2NCcjs.trimExtName.call(void 0, output.path)}`;
1684
+ const mode = _FileManager.getMode(output.path);
1685
+ const barrelManager = new BarrelManager({
1686
+ extName: output.extName,
1687
+ ...options
1688
+ });
1689
+ let files = barrelManager.getIndexes(pathToBuildFrom);
1690
+ if (!files) {
1691
+ return void 0;
1692
+ }
1693
+ if (exportType === "barrelNamed") {
1694
+ files = files.map((file) => {
1695
+ if (file.exports) {
1696
+ return {
1697
+ ...file,
1698
+ exports: barrelManager.getNamedExports(pathToBuildFrom, file.exports)
1699
+ };
1700
+ }
1701
+ return file;
1702
+ });
1703
+ }
1704
+ await Promise.all(
1705
+ files.map((file) => {
1706
+ return _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _addOrAppend, addOrAppend_fn).call(this, {
1707
+ ...file,
1708
+ meta: meta ? meta : file.meta
1709
+ });
1710
+ })
1711
+ );
1712
+ const rootPath = mode === "directory" ? `${exportPath}/index${output.extName || ""}` : `${exportPath}${output.extName || ""}`;
1713
+ const rootFile = {
1714
+ path: _path.resolve.call(void 0, root, "index.ts"),
1715
+ baseName: "index.ts",
1716
+ source: "",
1717
+ exports: [
1718
+ output.exportAs ? {
1719
+ name: output.exportAs,
1720
+ asAlias: true,
1721
+ path: rootPath,
1722
+ isTypeOnly: options.isTypeOnly
1723
+ } : {
1724
+ path: rootPath,
1725
+ isTypeOnly: options.isTypeOnly
1726
+ }
1727
+ ],
1728
+ exportable: true
1729
+ };
1730
+ if (exportType === "barrelNamed" && !output.exportAs && _optionalChain([rootFile, 'access', _32 => _32.exports, 'optionalAccess', _33 => _33[0]])) {
1731
+ rootFile.exports = barrelManager.getNamedExport(root, rootFile.exports[0]);
1732
+ }
1733
+ await _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _addOrAppend, addOrAppend_fn).call(this, {
1734
+ ...rootFile,
1735
+ meta: meta ? meta : rootFile.meta
1736
+ });
1737
+ }
1738
+ getCacheByUUID(UUID) {
1739
+ let cache;
1740
+ _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _cache).forEach((files) => {
1741
+ cache = files.find((item) => item.id === UUID);
1742
+ });
1743
+ return cache;
1744
+ }
1745
+ get(path5) {
1746
+ return _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _cache).get(path5);
1747
+ }
1748
+ remove(path5) {
1749
+ const cacheItem = this.get(path5);
1750
+ if (!cacheItem) {
1751
+ return;
1752
+ }
1753
+ _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _cache).delete(path5);
1754
+ }
1755
+ async write(...params) {
1756
+ return _chunkYYCT7ZB7cjs.write.call(void 0, ...params);
1757
+ }
1758
+ async read(...params) {
1759
+ return _chunkF4TSJHGAcjs.read.call(void 0, ...params);
1760
+ }
1761
+ // statics
1762
+ static getSource(file) {
1763
+ return getSource(file);
1764
+ }
1765
+ static combineFiles(files) {
1766
+ return combineFiles(files);
1767
+ }
1768
+ static getMode(path5) {
1769
+ if (!path5) {
1770
+ return "directory";
1771
+ }
1772
+ return _path.extname.call(void 0, path5) ? "file" : "directory";
1773
+ }
1774
+ static get extensions() {
1775
+ return [".js", ".ts", ".tsx"];
1776
+ }
1777
+ static isJavascript(baseName) {
1778
+ return _FileManager.extensions.some((extension) => baseName.endsWith(extension));
1779
+ }
1780
+ };
1781
+ _cache = new WeakMap();
1782
+ _task = new WeakMap();
1783
+ _queue3 = new WeakMap();
1784
+ _add = new WeakSet();
1785
+ add_fn = async function(file) {
1786
+ const controller = new AbortController();
1787
+ const resolvedFile = {
1788
+ id: _crypto2.default.randomUUID(),
1789
+ name: _chunkVHRZO2NCcjs.trimExtName.call(void 0, file.baseName),
1790
+ ...file
1791
+ };
1792
+ if (_optionalChain([resolvedFile, 'access', _34 => _34.exports, 'optionalAccess', _35 => _35.length])) {
1793
+ const folder = resolvedFile.path.replace(resolvedFile.baseName, "");
1794
+ resolvedFile.exports = resolvedFile.exports.filter((exportItem) => {
1795
+ const exportedFile = this.files.find((file2) => file2.path.includes(_path.resolve.call(void 0, folder, exportItem.path)));
1796
+ if (exportedFile) {
1797
+ return exportedFile.exportable;
1798
+ }
1799
+ return true;
1800
+ });
1801
+ }
1802
+ _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _cache).set(resolvedFile.path, [{ cancel: () => controller.abort(), ...resolvedFile }]);
1803
+ return _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _queue3).add(
1804
+ async () => {
1805
+ var _a;
1806
+ return (_a = _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _task)) == null ? void 0 : _a.call(this, resolvedFile);
1807
+ },
1808
+ { signal: controller.signal }
1809
+ );
1810
+ };
1811
+ _addOrAppend = new WeakSet();
1812
+ addOrAppend_fn = async function(file) {
1813
+ const previousCaches = _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _cache).get(file.path);
1814
+ const previousCache = previousCaches ? previousCaches.at(previousCaches.length - 1) : void 0;
1815
+ if (previousCache) {
1816
+ _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _cache).delete(previousCache.path);
1817
+ return _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _add, add_fn).call(this, {
1818
+ ...file,
1819
+ source: previousCache.source && file.source ? `${previousCache.source}
1820
+ ${file.source}` : "",
1821
+ imports: [...previousCache.imports || [], ...file.imports || []],
1822
+ exports: [...previousCache.exports || [], ...file.exports || []],
1823
+ env: { ...previousCache.env || {}, ...file.env || {} }
1824
+ });
1825
+ }
1826
+ return _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _add, add_fn).call(this, file);
1827
+ };
1828
+ var FileManager = _FileManager;
1829
+ function combineFiles(files) {
1830
+ return files.filter(Boolean).reduce(
1831
+ (acc, file) => {
1832
+ const prevIndex = acc.findIndex((item) => item.path === file.path);
1833
+ if (prevIndex === -1) {
1834
+ return [...acc, file];
1835
+ }
1836
+ const prev = acc[prevIndex];
1837
+ if (prev && file.override) {
1838
+ acc[prevIndex] = {
1839
+ imports: [],
1840
+ exports: [],
1841
+ ...file
1842
+ };
1843
+ return acc;
1844
+ }
1845
+ if (prev) {
1846
+ acc[prevIndex] = {
1847
+ ...file,
1848
+ source: prev.source && file.source ? `${prev.source}
1849
+ ${file.source}` : "",
1850
+ imports: [...prev.imports || [], ...file.imports || []],
1851
+ exports: [...prev.exports || [], ...file.exports || []],
1852
+ env: { ...prev.env || {}, ...file.env || {} }
1853
+ };
1854
+ }
1855
+ return acc;
1856
+ },
1857
+ []
1858
+ );
1859
+ }
1860
+ function getSource(file) {
1861
+ if (file.language ? !["typescript", "javascript"].includes(file.language) : !FileManager.isJavascript(file.baseName)) {
1862
+ return file.source;
1863
+ }
1864
+ const exports = file.exports ? combineExports(file.exports) : [];
1865
+ const imports = file.imports && file.source ? combineImports(file.imports, exports, file.source) : [];
1866
+ const importNodes = imports.filter((item) => {
1867
+ return item.path !== _chunkVHRZO2NCcjs.trimExtName.call(void 0, file.path);
1868
+ }).map((item) => {
1869
+ return factory.createImportDeclaration({
1870
+ name: item.name,
1871
+ path: item.root ? _chunkF4TSJHGAcjs.getRelativePath.call(void 0, item.root, item.path) : item.path,
1872
+ isTypeOnly: item.isTypeOnly
1873
+ });
1874
+ });
1875
+ const exportNodes = exports.map(
1876
+ (item) => factory.createExportDeclaration({
1877
+ name: item.name,
1878
+ path: item.path,
1879
+ isTypeOnly: item.isTypeOnly,
1880
+ asAlias: item.asAlias
1881
+ })
1882
+ );
1883
+ const source = [_parser.print.call(void 0, [...importNodes, ...exportNodes]), getEnvSource(file.source, file.env)].join("\n");
1884
+ return _parser.print.call(void 0, [], { source, noEmitHelpers: false });
1885
+ }
1886
+ function combineExports(exports) {
1887
+ const combinedExports = _chunkZS3YTJ2Lcjs.orderBy.call(void 0, exports, [(v) => !v.isTypeOnly], ["asc"]).reduce(
1888
+ (prev, curr) => {
1889
+ const name = curr.name;
1890
+ const prevByPath = prev.findLast((imp) => imp.path === curr.path);
1891
+ const prevByPathAndIsTypeOnly = prev.findLast((imp) => imp.path === curr.path && (0, import_lodash.default)(imp.name, name) && imp.isTypeOnly);
1892
+ if (prevByPathAndIsTypeOnly) {
1893
+ return prev;
1894
+ }
1895
+ const uniquePrev = prev.findLast(
1896
+ (imp) => imp.path === curr.path && (0, import_lodash.default)(imp.name, name) && imp.isTypeOnly === curr.isTypeOnly && imp.asAlias === curr.asAlias
1897
+ );
1898
+ if (uniquePrev || Array.isArray(name) && !name.length || _optionalChain([prevByPath, 'optionalAccess', _36 => _36.asAlias]) && !curr.asAlias) {
1899
+ return prev;
1900
+ }
1901
+ if (!prevByPath) {
1902
+ return [
1903
+ ...prev,
1904
+ {
1905
+ ...curr,
1906
+ name: Array.isArray(name) ? [...new Set(name)] : name
1907
+ }
1908
+ ];
1909
+ }
1910
+ if (prevByPath && Array.isArray(prevByPath.name) && Array.isArray(curr.name) && prevByPath.isTypeOnly === curr.isTypeOnly) {
1911
+ prevByPath.name = [.../* @__PURE__ */ new Set([...prevByPath.name, ...curr.name])];
1912
+ return prev;
1913
+ }
1914
+ return [...prev, curr];
1915
+ },
1916
+ []
1917
+ );
1918
+ return _chunkZS3YTJ2Lcjs.orderBy.call(void 0, combinedExports, [(v) => !v.isTypeOnly, (v) => v.asAlias], ["desc", "desc"]);
1919
+ }
1920
+ function combineImports(imports, exports, source) {
1921
+ const combinedImports = _chunkZS3YTJ2Lcjs.orderBy.call(void 0, imports, [(v) => !v.isTypeOnly], ["asc"]).reduce(
1922
+ (prev, curr) => {
1923
+ let name = Array.isArray(curr.name) ? [...new Set(curr.name)] : curr.name;
1924
+ const hasImportInSource = (importName) => {
1925
+ if (!source) {
1926
+ return true;
1927
+ }
1928
+ const checker = (name2) => name2 && !!source.includes(name2);
1929
+ return checker(importName) || exports.some(({ name: name2 }) => Array.isArray(name2) ? name2.some(checker) : checker(name2));
1930
+ };
1931
+ if (Array.isArray(name)) {
1932
+ name = name.filter((item) => typeof item === "string" ? hasImportInSource(item) : hasImportInSource(item.propertyName));
1933
+ }
1934
+ const prevByPath = prev.findLast((imp) => imp.path === curr.path && imp.isTypeOnly === curr.isTypeOnly);
1935
+ const uniquePrev = prev.findLast((imp) => imp.path === curr.path && (0, import_lodash.default)(imp.name, name) && imp.isTypeOnly === curr.isTypeOnly);
1936
+ const prevByPathNameAndIsTypeOnly = prev.findLast((imp) => imp.path === curr.path && (0, import_lodash.default)(imp.name, name) && imp.isTypeOnly);
1937
+ if (prevByPathNameAndIsTypeOnly) {
1938
+ return prev;
1939
+ }
1940
+ if (uniquePrev || Array.isArray(name) && !name.length) {
1941
+ return prev;
1942
+ }
1943
+ if (!prevByPath) {
1944
+ return [
1945
+ ...prev,
1946
+ {
1947
+ ...curr,
1948
+ name
1949
+ }
1950
+ ];
1951
+ }
1952
+ if (prevByPath && Array.isArray(prevByPath.name) && Array.isArray(name) && prevByPath.isTypeOnly === curr.isTypeOnly) {
1953
+ prevByPath.name = [.../* @__PURE__ */ new Set([...prevByPath.name, ...name])];
1954
+ return prev;
1955
+ }
1956
+ if (!Array.isArray(name) && name && !hasImportInSource(name)) {
1957
+ return prev;
1958
+ }
1959
+ return [...prev, curr];
1960
+ },
1961
+ []
1962
+ );
1963
+ return _chunkZS3YTJ2Lcjs.orderBy.call(void 0, combinedImports, [(v) => !v.isTypeOnly], ["desc"]);
1964
+ }
1965
+ function getEnvSource(source, env) {
1966
+ if (!env) {
1967
+ return source;
1968
+ }
1969
+ const keys = Object.keys(env);
1970
+ if (!keys.length) {
1971
+ return source;
1972
+ }
1973
+ return keys.reduce((prev, key) => {
1974
+ const environmentValue = env[key];
1975
+ const replaceBy = environmentValue ? `'${_optionalChain([environmentValue, 'access', _37 => _37.replaceAll, 'call', _38 => _38('"', ""), 'optionalAccess', _39 => _39.replaceAll, 'call', _40 => _40("'", "")])}'` : "undefined";
1976
+ if (key.toUpperCase() !== key) {
1977
+ throw new TypeError(`Environment should be in upperCase for ${key}`);
1978
+ }
1979
+ if (typeof replaceBy === "string") {
1980
+ prev = _chunkVHRZO2NCcjs.searchAndReplace.call(void 0, {
1981
+ text: prev.replaceAll(`process.env.${key}`, replaceBy),
1982
+ replaceBy,
1983
+ prefix: "process.env",
1984
+ key
1985
+ });
1986
+ prev = _chunkVHRZO2NCcjs.searchAndReplace.call(void 0, {
1987
+ text: prev.replaceAll(/(declare const).*\n/gi, ""),
1988
+ replaceBy,
1989
+ key
1990
+ });
1991
+ }
1992
+ return prev;
1993
+ }, source);
1994
+ }
1995
+
1996
+ // src/PluginManager.ts
42
1997
  _chunk4TB6NGOCcjs.init_cjs_shims.call(void 0, );
43
1998
 
44
- // src/build.ts
1999
+ // src/errors.ts
2000
+ _chunk4TB6NGOCcjs.init_cjs_shims.call(void 0, );
2001
+ var Warning = class extends Error {
2002
+ constructor(message, options) {
2003
+ super(message, { cause: _optionalChain([options, 'optionalAccess', _41 => _41.cause]) });
2004
+ this.name = "Warning";
2005
+ }
2006
+ };
2007
+ var ValidationPluginError = class extends Error {
2008
+ };
2009
+
2010
+ // src/plugin.ts
45
2011
  _chunk4TB6NGOCcjs.init_cjs_shims.call(void 0, );
46
2012
 
47
- // src/config.ts
2013
+
2014
+ // src/utils/cache.ts
48
2015
  _chunk4TB6NGOCcjs.init_cjs_shims.call(void 0, );
49
- function defineConfig(options) {
50
- return options;
2016
+ function createPluginCache(Store = /* @__PURE__ */ Object.create(null)) {
2017
+ return {
2018
+ set(id, value) {
2019
+ Store[id] = [0, value];
2020
+ },
2021
+ get(id) {
2022
+ const item = Store[id];
2023
+ if (!item) {
2024
+ return null;
2025
+ }
2026
+ item[0] = 0;
2027
+ return item[1];
2028
+ },
2029
+ has(id) {
2030
+ const item = Store[id];
2031
+ if (!item) {
2032
+ return false;
2033
+ }
2034
+ item[0] = 0;
2035
+ return true;
2036
+ },
2037
+ delete(id) {
2038
+ return delete Store[id];
2039
+ }
2040
+ };
51
2041
  }
52
- function isInputPath(result) {
53
- return !!result && "path" in result;
2042
+
2043
+ // src/plugin.ts
2044
+ function createPlugin(factory2) {
2045
+ return (options) => {
2046
+ return factory2(options);
2047
+ };
2048
+ }
2049
+ var pluginName = "core";
2050
+ var definePlugin = createPlugin((options) => {
2051
+ const { fileManager, pluginManager, resolvePath, resolveName, logger } = options;
2052
+ return {
2053
+ name: pluginName,
2054
+ options,
2055
+ key: ["core"],
2056
+ api() {
2057
+ return {
2058
+ get config() {
2059
+ return options.config;
2060
+ },
2061
+ get plugins() {
2062
+ return options.getPlugins();
2063
+ },
2064
+ get plugin() {
2065
+ return options.plugin;
2066
+ },
2067
+ logger,
2068
+ fileManager,
2069
+ pluginManager,
2070
+ async addFile(...files) {
2071
+ const resolvedFiles = await fileManager.add(...files);
2072
+ if (!Array.isArray(resolvedFiles)) {
2073
+ return [resolvedFiles];
2074
+ }
2075
+ return resolvedFiles;
2076
+ },
2077
+ resolvePath,
2078
+ resolveName,
2079
+ cache: createPluginCache()
2080
+ };
2081
+ },
2082
+ resolvePath(baseName) {
2083
+ const root = _path2.default.resolve(this.config.root, this.config.output.path);
2084
+ return _path2.default.resolve(root, baseName);
2085
+ },
2086
+ resolveName(name) {
2087
+ return name;
2088
+ }
2089
+ };
2090
+ });
2091
+
2092
+ // src/PromiseManager.ts
2093
+ _chunk4TB6NGOCcjs.init_cjs_shims.call(void 0, );
2094
+
2095
+ // src/utils/executeStrategies.ts
2096
+ _chunk4TB6NGOCcjs.init_cjs_shims.call(void 0, );
2097
+ function hookSeq(promises) {
2098
+ return promises.filter(Boolean).reduce(
2099
+ (promise, func) => {
2100
+ if (typeof func !== "function") {
2101
+ throw new Error("HookSeq needs a function that returns a promise `() => Promise<unknown>`");
2102
+ }
2103
+ return promise.then((state) => {
2104
+ const calledFunc = func(state);
2105
+ if (calledFunc) {
2106
+ return calledFunc.then(Array.prototype.concat.bind(state));
2107
+ }
2108
+ });
2109
+ },
2110
+ Promise.resolve([])
2111
+ );
2112
+ }
2113
+ function hookFirst(promises, nullCheck = (state) => state !== null) {
2114
+ let promise = Promise.resolve(null);
2115
+ for (const func of promises.filter(Boolean)) {
2116
+ promise = promise.then((state) => {
2117
+ if (nullCheck(state)) {
2118
+ return state;
2119
+ }
2120
+ const calledFunc = func(state);
2121
+ return calledFunc;
2122
+ });
2123
+ }
2124
+ return promise;
2125
+ }
2126
+ function hookParallel(promises) {
2127
+ return Promise.allSettled(promises.filter(Boolean).map((promise) => promise()));
2128
+ }
2129
+
2130
+ // src/PromiseManager.ts
2131
+ var _options2;
2132
+ var PromiseManager = class {
2133
+ constructor(options = {}) {
2134
+ _chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _options2, {});
2135
+ _chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _options2, options);
2136
+ return this;
2137
+ }
2138
+ run(strategy, promises) {
2139
+ if (strategy === "seq") {
2140
+ return hookSeq(promises);
2141
+ }
2142
+ if (strategy === "first") {
2143
+ return hookFirst(promises, _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _options2).nullCheck);
2144
+ }
2145
+ if (strategy === "parallel") {
2146
+ return hookParallel(promises);
2147
+ }
2148
+ throw new Error(`${strategy} not implemented`);
2149
+ }
2150
+ };
2151
+ _options2 = new WeakMap();
2152
+ function isPromise(result) {
2153
+ return !!result && typeof _optionalChain([result, 'optionalAccess', _42 => _42.then]) === "function";
2154
+ }
2155
+ function isPromiseRejectedResult(result) {
2156
+ return result.status === "rejected";
54
2157
  }
55
2158
 
2159
+ // src/PluginManager.ts
2160
+ var _core, _usedPluginNames, _promiseManager, _getSortedPlugins, getSortedPlugins_fn, _addExecutedToCallStack, addExecutedToCallStack_fn, _execute, execute_fn, _executeSync, executeSync_fn, _catcher, catcher_fn, _parse, parse_fn;
2161
+ var PluginManager = class {
2162
+ constructor(config, options) {
2163
+ _chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _getSortedPlugins);
2164
+ _chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _addExecutedToCallStack);
2165
+ /**
2166
+ * Run an async plugin hook and return the result.
2167
+ * @param hookName Name of the plugin hook. Must be either in `PluginHooks` or `OutputPluginValueHooks`.
2168
+ * @param args Arguments passed to the plugin hook.
2169
+ * @param plugin The actual pluginObject to run.
2170
+ */
2171
+ // Implementation signature
2172
+ _chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _execute);
2173
+ /**
2174
+ * Run a sync plugin hook and return the result.
2175
+ * @param hookName Name of the plugin hook. Must be in `PluginHooks`.
2176
+ * @param args Arguments passed to the plugin hook.
2177
+ * @param plugin The acutal plugin
2178
+ * @param replaceContext When passed, the plugin context can be overridden.
2179
+ */
2180
+ _chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _executeSync);
2181
+ _chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _catcher);
2182
+ _chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _parse);
2183
+ this.events = new (0, _chunkOMX2RMAXcjs.EventEmitter)();
2184
+ this.executed = [];
2185
+ _chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _core, void 0);
2186
+ _chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _usedPluginNames, {});
2187
+ _chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _promiseManager, void 0);
2188
+ this.resolvePath = (params) => {
2189
+ if (params.pluginKey) {
2190
+ const paths = this.hookForPluginSync({
2191
+ pluginKey: params.pluginKey,
2192
+ hookName: "resolvePath",
2193
+ parameters: [params.baseName, params.mode, params.options]
2194
+ });
2195
+ if (paths && _optionalChain([paths, 'optionalAccess', _43 => _43.length]) > 1 && this.logger.logLevel === _chunkOMX2RMAXcjs.LogLevel.debug) {
2196
+ this.logger.emit("debug", [
2197
+ `Cannot return a path where the 'pluginKey' ${params.pluginKey ? JSON.stringify(params.pluginKey) : '"'} is not unique enough
2198
+
2199
+ Paths: ${JSON.stringify(paths, void 0, 2)}
2200
+
2201
+ Falling back on the first item.
2202
+ `
2203
+ ]);
2204
+ }
2205
+ return _optionalChain([paths, 'optionalAccess', _44 => _44.at, 'call', _45 => _45(0)]);
2206
+ }
2207
+ return this.hookFirstSync({
2208
+ hookName: "resolvePath",
2209
+ parameters: [params.baseName, params.mode, params.options]
2210
+ }).result;
2211
+ };
2212
+ this.resolveName = (params) => {
2213
+ if (params.pluginKey) {
2214
+ const names = this.hookForPluginSync({
2215
+ pluginKey: params.pluginKey,
2216
+ hookName: "resolveName",
2217
+ parameters: [params.name, params.type]
2218
+ });
2219
+ if (names && _optionalChain([names, 'optionalAccess', _46 => _46.length]) > 1 && this.logger.logLevel === _chunkOMX2RMAXcjs.LogLevel.debug) {
2220
+ this.logger.emit("debug", [
2221
+ `Cannot return a name where the 'pluginKey' ${params.pluginKey ? JSON.stringify(params.pluginKey) : '"'} is not unique enough
2222
+
2223
+ Names: ${JSON.stringify(names, void 0, 2)}
2224
+
2225
+ Falling back on the first item.
2226
+ `
2227
+ ]);
2228
+ }
2229
+ return _chunkVHRZO2NCcjs.transformReservedWord.call(void 0, _optionalChain([names, 'optionalAccess', _47 => _47.at, 'call', _48 => _48(0)]) || params.name);
2230
+ }
2231
+ const name = this.hookFirstSync({
2232
+ hookName: "resolveName",
2233
+ parameters: [params.name, params.type]
2234
+ }).result;
2235
+ return _chunkVHRZO2NCcjs.transformReservedWord.call(void 0, name);
2236
+ };
2237
+ this.config = config;
2238
+ this.logger = options.logger;
2239
+ this.queue = new PQueue({ concurrency: 1 });
2240
+ this.fileManager = new FileManager({
2241
+ task: options.task,
2242
+ queue: this.queue
2243
+ });
2244
+ _chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _promiseManager, new PromiseManager({
2245
+ nullCheck: (state) => !!_optionalChain([state, 'optionalAccess', _49 => _49.result])
2246
+ }));
2247
+ const plugins = config.plugins || [];
2248
+ const core = definePlugin({
2249
+ config,
2250
+ logger: this.logger,
2251
+ pluginManager: this,
2252
+ fileManager: this.fileManager,
2253
+ resolvePath: this.resolvePath.bind(this),
2254
+ resolveName: this.resolveName.bind(this),
2255
+ getPlugins: _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _getSortedPlugins, getSortedPlugins_fn).bind(this)
2256
+ });
2257
+ _chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _core, _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _parse, parse_fn).call(this, core, this, core.api.call(null)));
2258
+ this.plugins = [_chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _core), ...plugins].map((plugin) => {
2259
+ return _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _parse, parse_fn).call(this, plugin, this, _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _core).api);
2260
+ });
2261
+ return this;
2262
+ }
2263
+ getFile({ name, mode, extName, pluginKey, options }) {
2264
+ let source = "";
2265
+ const baseName = `${name}${extName}`;
2266
+ const path5 = this.resolvePath({ baseName, mode, pluginKey, options });
2267
+ if (!path5) {
2268
+ throw new Error(`Filepath should be defined for resolvedName "${name}" and pluginKey [${JSON.stringify(pluginKey)}]`);
2269
+ }
2270
+ try {
2271
+ source = _chunkF4TSJHGAcjs.readSync.call(void 0, path5);
2272
+ } catch (_e) {
2273
+ }
2274
+ return {
2275
+ path: path5,
2276
+ baseName,
2277
+ meta: {
2278
+ pluginKey
2279
+ },
2280
+ source
2281
+ };
2282
+ }
2283
+ /**
2284
+ * Instead of calling `pluginManager.events.on` you can use `pluginManager.on`. This one also has better types.
2285
+ */
2286
+ on(eventName, handler) {
2287
+ this.events.on(eventName, handler);
2288
+ }
2289
+ /**
2290
+ * Run a specific hookName for plugin x.
2291
+ */
2292
+ hookForPlugin({
2293
+ pluginKey,
2294
+ hookName,
2295
+ parameters
2296
+ }) {
2297
+ const plugins = this.getPluginsByKey(hookName, pluginKey);
2298
+ const promises = plugins.map((plugin) => {
2299
+ return _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _execute, execute_fn).call(this, {
2300
+ strategy: "hookFirst",
2301
+ hookName,
2302
+ parameters,
2303
+ plugin
2304
+ });
2305
+ }).filter(Boolean);
2306
+ return Promise.all(promises);
2307
+ }
2308
+ /**
2309
+ * Run a specific hookName for plugin x.
2310
+ */
2311
+ hookForPluginSync({
2312
+ pluginKey,
2313
+ hookName,
2314
+ parameters
2315
+ }) {
2316
+ const plugins = this.getPluginsByKey(hookName, pluginKey);
2317
+ return plugins.map((plugin) => {
2318
+ return _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _executeSync, executeSync_fn).call(this, {
2319
+ strategy: "hookFirst",
2320
+ hookName,
2321
+ parameters,
2322
+ plugin
2323
+ });
2324
+ }).filter(Boolean);
2325
+ }
2326
+ /**
2327
+ * First non-null result stops and will return it's value.
2328
+ */
2329
+ async hookFirst({
2330
+ hookName,
2331
+ parameters,
2332
+ skipped
2333
+ }) {
2334
+ const promises = _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _getSortedPlugins, getSortedPlugins_fn).call(this).filter((plugin) => {
2335
+ return skipped ? skipped.has(plugin) : true;
2336
+ }).map((plugin) => {
2337
+ return async () => {
2338
+ const value = await _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _execute, execute_fn).call(this, {
2339
+ strategy: "hookFirst",
2340
+ hookName,
2341
+ parameters,
2342
+ plugin
2343
+ });
2344
+ return Promise.resolve({
2345
+ plugin,
2346
+ result: value
2347
+ });
2348
+ };
2349
+ });
2350
+ return _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _promiseManager).run("first", promises);
2351
+ }
2352
+ /**
2353
+ * First non-null result stops and will return it's value.
2354
+ */
2355
+ hookFirstSync({
2356
+ hookName,
2357
+ parameters,
2358
+ skipped
2359
+ }) {
2360
+ let parseResult = null;
2361
+ for (const plugin of _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _getSortedPlugins, getSortedPlugins_fn).call(this)) {
2362
+ if (_optionalChain([skipped, 'optionalAccess', _50 => _50.has, 'call', _51 => _51(plugin)])) {
2363
+ continue;
2364
+ }
2365
+ parseResult = {
2366
+ result: _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _executeSync, executeSync_fn).call(this, {
2367
+ strategy: "hookFirst",
2368
+ hookName,
2369
+ parameters,
2370
+ plugin
2371
+ }),
2372
+ plugin
2373
+ };
2374
+ if (_optionalChain([parseResult, 'optionalAccess', _52 => _52.result]) != null) {
2375
+ break;
2376
+ }
2377
+ }
2378
+ return parseResult;
2379
+ }
2380
+ /**
2381
+ * Run all plugins in parallel(order will be based on `this.plugin` and if `pre` or `post` is set).
2382
+ */
2383
+ async hookParallel({
2384
+ hookName,
2385
+ parameters
2386
+ }) {
2387
+ const promises = _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _getSortedPlugins, getSortedPlugins_fn).call(this).map((plugin) => {
2388
+ return () => _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _execute, execute_fn).call(this, {
2389
+ strategy: "hookParallel",
2390
+ hookName,
2391
+ parameters,
2392
+ plugin
2393
+ });
2394
+ });
2395
+ const results = await _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _promiseManager).run("parallel", promises);
2396
+ results.forEach((result, index) => {
2397
+ if (isPromiseRejectedResult(result)) {
2398
+ const plugin = _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _getSortedPlugins, getSortedPlugins_fn).call(this)[index];
2399
+ _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _catcher, catcher_fn).call(this, result.reason, plugin, hookName);
2400
+ }
2401
+ });
2402
+ return results.filter((result) => result.status === "fulfilled").map((result) => result.value);
2403
+ }
2404
+ /**
2405
+ * 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.
2406
+ */
2407
+ hookReduceArg0({
2408
+ hookName,
2409
+ parameters,
2410
+ reduce
2411
+ }) {
2412
+ const [argument0, ...rest] = parameters;
2413
+ let promise = Promise.resolve(argument0);
2414
+ for (const plugin of _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _getSortedPlugins, getSortedPlugins_fn).call(this)) {
2415
+ promise = promise.then((arg0) => {
2416
+ const value = _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _execute, execute_fn).call(this, {
2417
+ strategy: "hookReduceArg0",
2418
+ hookName,
2419
+ parameters: [arg0, ...rest],
2420
+ plugin
2421
+ });
2422
+ return value;
2423
+ }).then((result) => reduce.call(_chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _core).api, argument0, result, plugin));
2424
+ }
2425
+ return promise;
2426
+ }
2427
+ /**
2428
+ * Chains plugins
2429
+ */
2430
+ async hookSeq({ hookName, parameters }) {
2431
+ const promises = _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _getSortedPlugins, getSortedPlugins_fn).call(this).map((plugin) => {
2432
+ return () => _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _execute, execute_fn).call(this, {
2433
+ strategy: "hookSeq",
2434
+ hookName,
2435
+ parameters,
2436
+ plugin
2437
+ });
2438
+ });
2439
+ return _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _promiseManager).run("seq", promises);
2440
+ }
2441
+ getPluginsByKey(hookName, pluginKey) {
2442
+ const plugins = [...this.plugins];
2443
+ const [searchPluginName, searchIdentifier] = pluginKey;
2444
+ const pluginByPluginName = plugins.filter((plugin) => plugin[hookName]).filter((item) => {
2445
+ const [name, identifier] = item.key;
2446
+ const identifierCheck = _optionalChain([identifier, 'optionalAccess', _53 => _53.toString, 'call', _54 => _54()]) === _optionalChain([searchIdentifier, 'optionalAccess', _55 => _55.toString, 'call', _56 => _56()]);
2447
+ const nameCheck = name === searchPluginName;
2448
+ if (searchIdentifier) {
2449
+ return identifierCheck && nameCheck;
2450
+ }
2451
+ return nameCheck;
2452
+ });
2453
+ if (!_optionalChain([pluginByPluginName, 'optionalAccess', _57 => _57.length])) {
2454
+ const corePlugin = plugins.find((plugin) => plugin.name === "core" && plugin[hookName]);
2455
+ if (this.logger.logLevel === _chunkOMX2RMAXcjs.LogLevel.debug) {
2456
+ if (corePlugin) {
2457
+ this.logger.emit("debug", [`No hook '${hookName}' for pluginKey '${JSON.stringify(pluginKey)}' found, falling back on the '@kubb/core' plugin`]);
2458
+ } else {
2459
+ this.logger.emit("debug", [`No hook '${hookName}' for pluginKey '${JSON.stringify(pluginKey)}' found, no fallback found in the '@kubb/core' plugin`]);
2460
+ }
2461
+ }
2462
+ return corePlugin ? [corePlugin] : [];
2463
+ }
2464
+ return pluginByPluginName;
2465
+ }
2466
+ static getDependedPlugins(plugins, dependedPluginNames) {
2467
+ let pluginNames = [];
2468
+ if (typeof dependedPluginNames === "string") {
2469
+ pluginNames = [dependedPluginNames];
2470
+ } else {
2471
+ pluginNames = dependedPluginNames;
2472
+ }
2473
+ return pluginNames.map((pluginName2) => {
2474
+ const plugin = plugins.find((plugin2) => plugin2.name === pluginName2);
2475
+ if (!plugin) {
2476
+ throw new ValidationPluginError(`This plugin depends on the ${pluginName2} plugin.`);
2477
+ }
2478
+ return plugin;
2479
+ });
2480
+ }
2481
+ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
2482
+ static get hooks() {
2483
+ return ["buildStart", "resolvePath", "resolveName", "load", "transform", "writeFile", "buildEnd"];
2484
+ }
2485
+ };
2486
+ _core = new WeakMap();
2487
+ _usedPluginNames = new WeakMap();
2488
+ _promiseManager = new WeakMap();
2489
+ _getSortedPlugins = new WeakSet();
2490
+ getSortedPlugins_fn = function(hookName) {
2491
+ const plugins = [...this.plugins].filter((plugin) => plugin.name !== "core");
2492
+ if (hookName) {
2493
+ if (this.logger.logLevel === _chunkOMX2RMAXcjs.LogLevel.info) {
2494
+ const containsHookName = plugins.some((item) => item[hookName]);
2495
+ if (!containsHookName) {
2496
+ this.logger.emit("warning", `No hook ${hookName} found`);
2497
+ }
2498
+ }
2499
+ return plugins.filter((item) => item[hookName]);
2500
+ }
2501
+ return plugins.map((plugin) => {
2502
+ if (plugin.pre) {
2503
+ const isValid = plugin.pre.every((pluginName2) => plugins.find((pluginToFind) => pluginToFind.name === pluginName2));
2504
+ if (!isValid) {
2505
+ throw new ValidationPluginError(`This plugin has a pre set that is not valid(${JSON.stringify(plugin.pre, void 0, 2)})`);
2506
+ }
2507
+ }
2508
+ return plugin;
2509
+ }).sort((a, b) => {
2510
+ if (_optionalChain([b, 'access', _58 => _58.pre, 'optionalAccess', _59 => _59.includes, 'call', _60 => _60(a.name)])) {
2511
+ return 1;
2512
+ }
2513
+ if (_optionalChain([b, 'access', _61 => _61.post, 'optionalAccess', _62 => _62.includes, 'call', _63 => _63(a.name)])) {
2514
+ return -1;
2515
+ }
2516
+ return 0;
2517
+ });
2518
+ };
2519
+ _addExecutedToCallStack = new WeakSet();
2520
+ addExecutedToCallStack_fn = function(executer) {
2521
+ if (executer) {
2522
+ this.events.emit("executed", executer);
2523
+ this.executed.push(executer);
2524
+ }
2525
+ };
2526
+ _execute = new WeakSet();
2527
+ execute_fn = function({
2528
+ strategy,
2529
+ hookName,
2530
+ parameters,
2531
+ plugin
2532
+ }) {
2533
+ const hook = plugin[hookName];
2534
+ let output;
2535
+ if (!hook) {
2536
+ return null;
2537
+ }
2538
+ this.events.emit("execute", { strategy, hookName, parameters, plugin });
2539
+ const task = Promise.resolve().then(() => {
2540
+ if (typeof hook === "function") {
2541
+ const possiblePromiseResult = hook.apply({ ..._chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _core).api, plugin }, parameters);
2542
+ if (isPromise(possiblePromiseResult)) {
2543
+ return Promise.resolve(possiblePromiseResult);
2544
+ }
2545
+ return possiblePromiseResult;
2546
+ }
2547
+ return hook;
2548
+ }).then((result) => {
2549
+ output = result;
2550
+ _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _addExecutedToCallStack, addExecutedToCallStack_fn).call(this, {
2551
+ parameters,
2552
+ output,
2553
+ strategy,
2554
+ hookName,
2555
+ plugin
2556
+ });
2557
+ return result;
2558
+ }).catch((e) => {
2559
+ _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _catcher, catcher_fn).call(this, e, plugin, hookName);
2560
+ return null;
2561
+ });
2562
+ return task;
2563
+ };
2564
+ _executeSync = new WeakSet();
2565
+ executeSync_fn = function({
2566
+ strategy,
2567
+ hookName,
2568
+ parameters,
2569
+ plugin
2570
+ }) {
2571
+ const hook = plugin[hookName];
2572
+ let output;
2573
+ if (!hook) {
2574
+ return null;
2575
+ }
2576
+ this.events.emit("execute", { strategy, hookName, parameters, plugin });
2577
+ try {
2578
+ if (typeof hook === "function") {
2579
+ const fn = hook.apply({ ..._chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _core).api, plugin }, parameters);
2580
+ output = fn;
2581
+ return fn;
2582
+ }
2583
+ output = hook;
2584
+ _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _addExecutedToCallStack, addExecutedToCallStack_fn).call(this, {
2585
+ parameters,
2586
+ output,
2587
+ strategy,
2588
+ hookName,
2589
+ plugin
2590
+ });
2591
+ return hook;
2592
+ } catch (e) {
2593
+ _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _catcher, catcher_fn).call(this, e, plugin, hookName);
2594
+ return null;
2595
+ }
2596
+ };
2597
+ _catcher = new WeakSet();
2598
+ catcher_fn = function(cause, plugin, hookName) {
2599
+ const text = `${cause.message} (plugin: ${_optionalChain([plugin, 'optionalAccess', _64 => _64.name]) || "unknown"}, hook: ${hookName || "unknown"})`;
2600
+ this.logger.emit("error", text, cause);
2601
+ this.events.emit("error", cause);
2602
+ };
2603
+ _parse = new WeakSet();
2604
+ parse_fn = function(plugin, pluginManager, context) {
2605
+ const usedPluginNames = _chunk4TB6NGOCcjs.__privateGet.call(void 0, pluginManager, _usedPluginNames);
2606
+ _chunk33S7A7ZEcjs.setUniqueName.call(void 0, plugin.name, usedPluginNames);
2607
+ const key = [plugin.name, usedPluginNames[plugin.name]].filter(Boolean);
2608
+ if (!plugin.transform) {
2609
+ plugin.transform = function transform(code) {
2610
+ return code;
2611
+ };
2612
+ }
2613
+ if (plugin.api && typeof plugin.api === "function") {
2614
+ const api = plugin.api.call(context);
2615
+ return {
2616
+ ...plugin,
2617
+ key,
2618
+ api
2619
+ };
2620
+ }
2621
+ return {
2622
+ ...plugin,
2623
+ key
2624
+ };
2625
+ };
2626
+
56
2627
  // src/build.ts
57
2628
  async function transformReducer(_previousCode, result, _plugin) {
58
2629
  return result;
59
2630
  }
60
2631
  async function setup(options) {
61
- const { config, logger = _chunkJDIEEDDBcjs.createLogger.call(void 0, { logLevel: _chunkJDIEEDDBcjs.LogLevel.silent }) } = options;
2632
+ const { config, logger = _chunkOMX2RMAXcjs.createLogger.call(void 0, { logLevel: _chunkOMX2RMAXcjs.LogLevel.silent }) } = options;
62
2633
  let count = 0;
63
2634
  try {
64
- if (isInputPath(config) && !new (0, _chunk4GE2JRAAcjs.URLPath)(config.input.path).isURL) {
65
- await _chunkWAIHMG76cjs.read.call(void 0, config.input.path);
2635
+ if (isInputPath(config) && !new (0, _chunk33S7A7ZEcjs.URLPath)(config.input.path).isURL) {
2636
+ await _chunkF4TSJHGAcjs.read.call(void 0, config.input.path);
66
2637
  }
67
2638
  } catch (e) {
68
2639
  if (isInputPath(config)) {
69
2640
  throw new Error(
70
- "Cannot read file/URL defined in `input.path` or set with `kubb generate PATH` in the CLI of your Kubb config " + _chunkJDIEEDDBcjs.p.dim(config.input.path),
2641
+ `Cannot read file/URL defined in \`input.path\` or set with \`kubb generate PATH\` in the CLI of your Kubb config ${_chunkOMX2RMAXcjs.p.dim(config.input.path)}`,
71
2642
  {
72
2643
  cause: e
73
2644
  }
@@ -75,38 +2646,38 @@ async function setup(options) {
75
2646
  }
76
2647
  }
77
2648
  if (config.output.clean) {
78
- await _chunkXZZ2F3LKcjs.clean.call(void 0, config.output.path);
2649
+ await _chunkIBUMXAETcjs.clean.call(void 0, config.output.path);
79
2650
  }
80
2651
  const task = async (file) => {
81
- const { path: path3 } = file;
82
- let source = _chunkUIWHEBZAcjs.FileManager.getSource(file);
2652
+ const { path: path5 } = file;
2653
+ let source = FileManager.getSource(file);
83
2654
  const { result: loadedResult } = await pluginManager.hookFirst({
84
2655
  hookName: "load",
85
- parameters: [path3]
2656
+ parameters: [path5]
86
2657
  });
87
- if (loadedResult && _chunkUIWHEBZAcjs.isPromise.call(void 0, loadedResult)) {
2658
+ if (loadedResult && isPromise(loadedResult)) {
88
2659
  source = await loadedResult;
89
2660
  }
90
- if (loadedResult && !_chunkUIWHEBZAcjs.isPromise.call(void 0, loadedResult)) {
2661
+ if (loadedResult && !isPromise(loadedResult)) {
91
2662
  source = loadedResult;
92
2663
  }
93
2664
  if (source) {
94
2665
  source = await pluginManager.hookReduceArg0({
95
2666
  hookName: "transform",
96
- parameters: [source, path3],
2667
+ parameters: [source, path5],
97
2668
  reduce: transformReducer
98
2669
  });
99
2670
  if (config.output.write || config.output.write === void 0) {
100
- if (_optionalChain([file, 'access', _2 => _2.meta, 'optionalAccess', _3 => _3.pluginKey])) {
2671
+ if (_optionalChain([file, 'access', _65 => _65.meta, 'optionalAccess', _66 => _66.pluginKey])) {
101
2672
  await pluginManager.hookForPlugin({
102
- pluginKey: _optionalChain([file, 'access', _4 => _4.meta, 'optionalAccess', _5 => _5.pluginKey]),
2673
+ pluginKey: _optionalChain([file, 'access', _67 => _67.meta, 'optionalAccess', _68 => _68.pluginKey]),
103
2674
  hookName: "writeFile",
104
- parameters: [source, path3]
2675
+ parameters: [source, path5]
105
2676
  });
106
2677
  }
107
2678
  await pluginManager.hookFirst({
108
2679
  hookName: "writeFile",
109
- parameters: [source, path3]
2680
+ parameters: [source, path5]
110
2681
  });
111
2682
  }
112
2683
  }
@@ -115,13 +2686,13 @@ async function setup(options) {
115
2686
  source: source || ""
116
2687
  };
117
2688
  };
118
- const pluginManager = new (0, _chunkUIWHEBZAcjs.PluginManager)(config, { logger, task });
2689
+ const pluginManager = new PluginManager(config, { logger, task });
119
2690
  pluginManager.on("execute", (executer) => {
120
2691
  const { hookName, parameters, plugin } = executer;
121
2692
  if (hookName === "writeFile") {
122
2693
  const [code] = parameters;
123
- if (logger.logLevel === _chunkJDIEEDDBcjs.LogLevel.debug) {
124
- logger.emit("debug", [`PluginKey ${_chunkJDIEEDDBcjs.p.dim(JSON.stringify(plugin.key))}
2694
+ if (logger.logLevel === _chunkOMX2RMAXcjs.LogLevel.debug) {
2695
+ logger.emit("debug", [`PluginKey ${_chunkOMX2RMAXcjs.p.dim(JSON.stringify(plugin.key))}
125
2696
  with source
126
2697
 
127
2698
  ${code}`]);
@@ -129,41 +2700,40 @@ ${code}`]);
129
2700
  }
130
2701
  });
131
2702
  pluginManager.queue.on("add", () => {
132
- if (logger.logLevel !== _chunkJDIEEDDBcjs.LogLevel.info) {
2703
+ if (logger.logLevel !== _chunkOMX2RMAXcjs.LogLevel.info) {
133
2704
  return;
134
2705
  }
135
2706
  if (count === 0) {
136
- logger.emit("start", `\u{1F4BE} Writing`);
2707
+ logger.emit("start", "\u{1F4BE} Writing");
137
2708
  }
138
2709
  });
139
2710
  pluginManager.queue.on("active", () => {
140
- if (logger.logLevel !== _chunkJDIEEDDBcjs.LogLevel.info) {
2711
+ if (logger.logLevel !== _chunkOMX2RMAXcjs.LogLevel.info) {
141
2712
  return;
142
2713
  }
143
2714
  if (logger.spinner && pluginManager.queue.size > 0) {
144
2715
  const text = `Item: ${count} Size: ${pluginManager.queue.size} Pending: ${pluginManager.queue.pending}`;
145
- logger.spinner.suffixText = _chunkJDIEEDDBcjs.p.dim(text);
2716
+ logger.spinner.suffixText = _chunkOMX2RMAXcjs.p.dim(text);
146
2717
  }
147
- ;
148
2718
  ++count;
149
2719
  });
150
2720
  pluginManager.queue.on("completed", () => {
151
- if (logger.logLevel !== _chunkJDIEEDDBcjs.LogLevel.info) {
2721
+ if (logger.logLevel !== _chunkOMX2RMAXcjs.LogLevel.info) {
152
2722
  return;
153
2723
  }
154
2724
  if (logger.spinner) {
155
2725
  const text = `Item: ${count} Size: ${pluginManager.queue.size} Pending: ${pluginManager.queue.pending}`;
156
- logger.spinner.suffixText = _chunkJDIEEDDBcjs.p.dim(text);
2726
+ logger.spinner.suffixText = _chunkOMX2RMAXcjs.p.dim(text);
157
2727
  }
158
2728
  });
159
2729
  pluginManager.on("executed", (executer) => {
160
2730
  const { hookName, plugin, output, parameters } = executer;
161
- if (logger.logLevel === _chunkJDIEEDDBcjs.LogLevel.debug) {
2731
+ if (logger.logLevel === _chunkOMX2RMAXcjs.LogLevel.debug) {
162
2732
  const logs = [
163
- `${_chunkJDIEEDDBcjs.randomCliColour.call(void 0, plugin.name)} Executing ${hookName}`,
164
- parameters && `${_chunkJDIEEDDBcjs.p.bgWhite(`Parameters`)} ${_chunkJDIEEDDBcjs.randomCliColour.call(void 0, plugin.name)} ${hookName}`,
2733
+ `${_chunkOMX2RMAXcjs.randomCliColour.call(void 0, plugin.name)} Executing ${hookName}`,
2734
+ parameters && `${_chunkOMX2RMAXcjs.p.bgWhite("Parameters")} ${_chunkOMX2RMAXcjs.randomCliColour.call(void 0, plugin.name)} ${hookName}`,
165
2735
  JSON.stringify(parameters, void 0, 2),
166
- output && `${_chunkJDIEEDDBcjs.p.bgWhite("Output")} ${_chunkJDIEEDDBcjs.randomCliColour.call(void 0, plugin.name)} ${hookName}`,
2736
+ output && `${_chunkOMX2RMAXcjs.p.bgWhite("Output")} ${_chunkOMX2RMAXcjs.randomCliColour.call(void 0, plugin.name)} ${hookName}`,
167
2737
  output
168
2738
  ].filter(Boolean);
169
2739
  logger.emit("debug", logs);
@@ -179,10 +2749,16 @@ async function build(options) {
179
2749
  parameters: [options.config]
180
2750
  });
181
2751
  await pluginManager.hookParallel({ hookName: "buildEnd" });
182
- if (logger.logLevel === _chunkJDIEEDDBcjs.LogLevel.info) {
183
- logger.emit("end", `\u{1F4BE} Writing completed`);
2752
+ if (logger.logLevel === _chunkOMX2RMAXcjs.LogLevel.info) {
2753
+ logger.emit("end", "\u{1F4BE} Writing completed");
184
2754
  }
185
- return { files: fileManager.files.map((file) => ({ ...file, source: _chunkUIWHEBZAcjs.FileManager.getSource(file) })), pluginManager };
2755
+ return {
2756
+ files: fileManager.files.map((file) => ({
2757
+ ...file,
2758
+ source: FileManager.getSource(file)
2759
+ })),
2760
+ pluginManager
2761
+ };
186
2762
  }
187
2763
  async function safeBuild(options) {
188
2764
  const pluginManager = await setup(options);
@@ -193,41 +2769,54 @@ async function safeBuild(options) {
193
2769
  parameters: [options.config]
194
2770
  });
195
2771
  await pluginManager.hookParallel({ hookName: "buildEnd" });
196
- if (logger.logLevel === _chunkJDIEEDDBcjs.LogLevel.info) {
197
- logger.emit("end", `\u{1F4BE} Writing completed`);
2772
+ if (logger.logLevel === _chunkOMX2RMAXcjs.LogLevel.info) {
2773
+ logger.emit("end", "\u{1F4BE} Writing completed");
198
2774
  }
199
2775
  } catch (e) {
200
- return { files: fileManager.files.map((file) => ({ ...file, source: _chunkUIWHEBZAcjs.FileManager.getSource(file) })), pluginManager, error: e };
2776
+ return {
2777
+ files: fileManager.files.map((file) => ({
2778
+ ...file,
2779
+ source: FileManager.getSource(file)
2780
+ })),
2781
+ pluginManager,
2782
+ error: e
2783
+ };
201
2784
  }
202
- return { files: fileManager.files.map((file) => ({ ...file, source: _chunkUIWHEBZAcjs.FileManager.getSource(file) })), pluginManager };
2785
+ return {
2786
+ files: fileManager.files.map((file) => ({
2787
+ ...file,
2788
+ source: FileManager.getSource(file)
2789
+ })),
2790
+ pluginManager
2791
+ };
203
2792
  }
204
2793
 
205
2794
  // src/Generator.ts
206
2795
  _chunk4TB6NGOCcjs.init_cjs_shims.call(void 0, );
207
- var _options, _context;
2796
+ var _options3, _context;
208
2797
  var Generator = class {
209
2798
  constructor(options, context) {
210
- _chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _options, {});
2799
+ _chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _options3, {});
211
2800
  _chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _context, {});
212
2801
  if (context) {
213
2802
  _chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _context, context);
214
2803
  }
215
2804
  if (options) {
216
- _chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _options, options);
2805
+ _chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _options3, options);
217
2806
  }
218
2807
  return this;
219
2808
  }
220
2809
  get options() {
221
- return _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _options);
2810
+ return _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _options3);
222
2811
  }
223
2812
  get context() {
224
2813
  return _chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _context);
225
2814
  }
226
2815
  set options(options) {
227
- _chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _options, { ..._chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _options), ...options });
2816
+ _chunk4TB6NGOCcjs.__privateSet.call(void 0, this, _options3, { ..._chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _options3), ...options });
228
2817
  }
229
2818
  };
230
- _options = new WeakMap();
2819
+ _options3 = new WeakMap();
231
2820
  _context = new WeakMap();
232
2821
 
233
2822
  // src/PackageManager.ts
@@ -238,7 +2827,7 @@ var _url = require('url');
238
2827
 
239
2828
  // ../../node_modules/.pnpm/find-up@7.0.0/node_modules/find-up/index.js
240
2829
  _chunk4TB6NGOCcjs.init_cjs_shims.call(void 0, );
241
- var _path = require('path'); var _path2 = _interopRequireDefault(_path);
2830
+
242
2831
 
243
2832
  // ../../node_modules/.pnpm/locate-path@7.2.0/node_modules/locate-path/index.js
244
2833
  _chunk4TB6NGOCcjs.init_cjs_shims.call(void 0, );
@@ -323,18 +2912,18 @@ function pLimit(concurrency) {
323
2912
  queue.dequeue()();
324
2913
  }
325
2914
  };
326
- const run = async (fn, resolve, args) => {
2915
+ const run = async (fn, resolve2, args) => {
327
2916
  activeCount++;
328
2917
  const result = (async () => fn(...args))();
329
- resolve(result);
2918
+ resolve2(result);
330
2919
  try {
331
2920
  await result;
332
2921
  } catch (e2) {
333
2922
  }
334
2923
  next();
335
2924
  };
336
- const enqueue = (fn, resolve, args) => {
337
- queue.enqueue(run.bind(void 0, fn, resolve, args));
2925
+ const enqueue = (fn, resolve2, args) => {
2926
+ queue.enqueue(run.bind(void 0, fn, resolve2, args));
338
2927
  (async () => {
339
2928
  await Promise.resolve();
340
2929
  if (activeCount < concurrency && queue.size > 0) {
@@ -342,8 +2931,8 @@ function pLimit(concurrency) {
342
2931
  }
343
2932
  })();
344
2933
  };
345
- const generator = (fn, ...args) => new Promise((resolve) => {
346
- enqueue(fn, resolve, args);
2934
+ const generator = (fn, ...args) => new Promise((resolve2) => {
2935
+ enqueue(fn, resolve2, args);
347
2936
  });
348
2937
  Object.defineProperties(generator, {
349
2938
  activeCount: {
@@ -537,7 +3126,7 @@ function findUpSync(name, options = {}) {
537
3126
 
538
3127
  // src/PackageManager.ts
539
3128
  var _semver = require('semver');
540
- var _cache, _cwd, _SLASHES, _match, match_fn;
3129
+ var _cache2, _cwd, _SLASHES, _match, match_fn;
541
3130
  var _PackageManager = class _PackageManager {
542
3131
  constructor(workspace) {
543
3132
  _chunk4TB6NGOCcjs.__privateAdd.call(void 0, this, _match);
@@ -560,22 +3149,22 @@ var _PackageManager = class _PackageManager {
560
3149
  }
561
3150
  return directory;
562
3151
  }
563
- getLocation(path3) {
564
- let location = path3;
3152
+ getLocation(path5) {
3153
+ let location = path5;
565
3154
  if (_chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _cwd)) {
566
3155
  const require2 = _module2.default.createRequire(this.normalizeDirectory(_chunk4TB6NGOCcjs.__privateGet.call(void 0, this, _cwd)));
567
- location = require2.resolve(path3);
3156
+ location = require2.resolve(path5);
568
3157
  }
569
3158
  return location;
570
3159
  }
571
- async import(path3) {
3160
+ async import(path5) {
572
3161
  try {
573
- let location = this.getLocation(path3);
574
- if (_os2.default.platform() == "win32") {
3162
+ let location = this.getLocation(path5);
3163
+ if (_os2.default.platform() === "win32") {
575
3164
  location = _url.pathToFileURL.call(void 0, location).href;
576
3165
  }
577
3166
  const module = await Promise.resolve().then(() => _interopRequireWildcard(require(location)));
578
- return _nullishCoalesce(_optionalChain([module, 'optionalAccess', _6 => _6.default]), () => ( module));
3167
+ return _nullishCoalesce(_optionalChain([module, 'optionalAccess', _69 => _69.default]), () => ( module));
579
3168
  } catch (e) {
580
3169
  console.log(e);
581
3170
  return void 0;
@@ -588,7 +3177,7 @@ var _PackageManager = class _PackageManager {
588
3177
  if (!pkgPath) {
589
3178
  return void 0;
590
3179
  }
591
- const json = await _chunkWAIHMG76cjs.read.call(void 0, pkgPath);
3180
+ const json = await _chunkF4TSJHGAcjs.read.call(void 0, pkgPath);
592
3181
  return JSON.parse(json);
593
3182
  }
594
3183
  getPackageJSONSync() {
@@ -598,15 +3187,15 @@ var _PackageManager = class _PackageManager {
598
3187
  if (!pkgPath) {
599
3188
  return void 0;
600
3189
  }
601
- const json = _chunkWAIHMG76cjs.readSync.call(void 0, pkgPath);
3190
+ const json = _chunkF4TSJHGAcjs.readSync.call(void 0, pkgPath);
602
3191
  return JSON.parse(json);
603
3192
  }
604
3193
  static setVersion(dependency, version) {
605
- _chunk4TB6NGOCcjs.__privateGet.call(void 0, _PackageManager, _cache)[dependency] = version;
3194
+ _chunk4TB6NGOCcjs.__privateGet.call(void 0, _PackageManager, _cache2)[dependency] = version;
606
3195
  }
607
3196
  async getVersion(dependency) {
608
- if (typeof dependency === "string" && _chunk4TB6NGOCcjs.__privateGet.call(void 0, _PackageManager, _cache)[dependency]) {
609
- return _chunk4TB6NGOCcjs.__privateGet.call(void 0, _PackageManager, _cache)[dependency];
3197
+ if (typeof dependency === "string" && _chunk4TB6NGOCcjs.__privateGet.call(void 0, _PackageManager, _cache2)[dependency]) {
3198
+ return _chunk4TB6NGOCcjs.__privateGet.call(void 0, _PackageManager, _cache2)[dependency];
610
3199
  }
611
3200
  const packageJSON = await this.getPackageJSON();
612
3201
  if (!packageJSON) {
@@ -615,8 +3204,8 @@ var _PackageManager = class _PackageManager {
615
3204
  return _chunk4TB6NGOCcjs.__privateMethod.call(void 0, this, _match, match_fn).call(this, packageJSON, dependency);
616
3205
  }
617
3206
  getVersionSync(dependency) {
618
- if (typeof dependency === "string" && _chunk4TB6NGOCcjs.__privateGet.call(void 0, _PackageManager, _cache)[dependency]) {
619
- return _chunk4TB6NGOCcjs.__privateGet.call(void 0, _PackageManager, _cache)[dependency];
3207
+ if (typeof dependency === "string" && _chunk4TB6NGOCcjs.__privateGet.call(void 0, _PackageManager, _cache2)[dependency]) {
3208
+ return _chunk4TB6NGOCcjs.__privateGet.call(void 0, _PackageManager, _cache2)[dependency];
620
3209
  }
621
3210
  const packageJSON = this.getPackageJSONSync();
622
3211
  if (!packageJSON) {
@@ -650,7 +3239,7 @@ var _PackageManager = class _PackageManager {
650
3239
  return _semver.satisfies.call(void 0, semVer, version);
651
3240
  }
652
3241
  };
653
- _cache = new WeakMap();
3242
+ _cache2 = new WeakMap();
654
3243
  _cwd = new WeakMap();
655
3244
  _SLASHES = new WeakMap();
656
3245
  _match = new WeakSet();
@@ -665,7 +3254,7 @@ match_fn = function(packageJSON, dependency) {
665
3254
  const matchedDependency = Object.keys(dependencies).find((dep) => dep.match(dependency));
666
3255
  return matchedDependency ? dependencies[matchedDependency] : void 0;
667
3256
  };
668
- _chunk4TB6NGOCcjs.__privateAdd.call(void 0, _PackageManager, _cache, {});
3257
+ _chunk4TB6NGOCcjs.__privateAdd.call(void 0, _PackageManager, _cache2, {});
669
3258
  var PackageManager = _PackageManager;
670
3259
 
671
3260
  // src/kubb.ts
@@ -688,5 +3277,5 @@ _chunk4TB6NGOCcjs.init_cjs_shims.call(void 0, );
688
3277
 
689
3278
 
690
3279
 
691
- exports.FileManager = _chunkUIWHEBZAcjs.FileManager; exports.Generator = Generator; exports.Kubb = kubb_exports; exports.KubbFile = _chunkUIWHEBZAcjs.KubbFile; exports.PackageManager = PackageManager; exports.PluginManager = _chunkUIWHEBZAcjs.PluginManager; exports.PromiseManager = _chunkUIWHEBZAcjs.PromiseManager; exports.Warning = _chunkUIWHEBZAcjs.Warning; exports.build = build; exports.createPlugin = _chunkUIWHEBZAcjs.createPlugin; exports.default = build; exports.defineConfig = defineConfig; exports.isInputPath = isInputPath; exports.name = _chunkUIWHEBZAcjs.pluginName; exports.pluginName = _chunkUIWHEBZAcjs.pluginName; exports.safeBuild = safeBuild;
3280
+ exports.FileManager = FileManager; exports.Generator = Generator; exports.Kubb = kubb_exports; exports.KubbFile = KubbFile; exports.PackageManager = PackageManager; exports.PluginManager = PluginManager; exports.PromiseManager = PromiseManager; exports.Warning = Warning; exports.build = build; exports.createPlugin = createPlugin; exports.default = build; exports.defineConfig = defineConfig; exports.isInputPath = isInputPath; exports.name = pluginName; exports.pluginName = pluginName; exports.safeBuild = safeBuild;
692
3281
  //# sourceMappingURL=index.cjs.map