@kubb/core 2.0.0-canary.20231030T124958 → 2.0.0

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 (100) hide show
  1. package/README.md +1 -1
  2. package/dist/chunk-4A7WG6IA.js +128 -0
  3. package/dist/chunk-4A7WG6IA.js.map +1 -0
  4. package/dist/chunk-54P4AWHI.js +71 -0
  5. package/dist/chunk-54P4AWHI.js.map +1 -0
  6. package/dist/chunk-5TK7TMV6.cjs +131 -0
  7. package/dist/chunk-5TK7TMV6.cjs.map +1 -0
  8. package/dist/chunk-7S67BJXQ.js +85 -0
  9. package/dist/chunk-7S67BJXQ.js.map +1 -0
  10. package/dist/chunk-E3ANGQ5N.cjs +2290 -0
  11. package/dist/chunk-E3ANGQ5N.cjs.map +1 -0
  12. package/dist/chunk-H47IKRXJ.cjs +129 -0
  13. package/dist/chunk-H47IKRXJ.cjs.map +1 -0
  14. package/dist/chunk-HIE46T3F.js +129 -0
  15. package/dist/chunk-HIE46T3F.js.map +1 -0
  16. package/dist/chunk-K2H7BYQB.js +155 -0
  17. package/dist/chunk-K2H7BYQB.js.map +1 -0
  18. package/dist/chunk-NAWI7UXW.js +67 -0
  19. package/dist/chunk-NAWI7UXW.js.map +1 -0
  20. package/dist/chunk-PLVKILIY.cjs +162 -0
  21. package/dist/chunk-PLVKILIY.cjs.map +1 -0
  22. package/dist/chunk-W2FP7ZWW.cjs +71 -0
  23. package/dist/chunk-W2FP7ZWW.cjs.map +1 -0
  24. package/dist/chunk-WZQO3EPM.cjs +91 -0
  25. package/dist/chunk-WZQO3EPM.cjs.map +1 -0
  26. package/dist/chunk-XDHI63G7.cjs +104 -0
  27. package/dist/chunk-XDHI63G7.cjs.map +1 -0
  28. package/dist/chunk-XPOF4D5N.js +18 -0
  29. package/dist/chunk-XPOF4D5N.js.map +1 -0
  30. package/dist/fs.cjs +31 -0
  31. package/dist/fs.cjs.map +1 -0
  32. package/dist/fs.d.cts +5 -0
  33. package/dist/fs.d.ts +5 -0
  34. package/dist/fs.js +11 -0
  35. package/dist/fs.js.map +1 -0
  36. package/dist/index.cjs +1866 -977
  37. package/dist/index.cjs.map +1 -1
  38. package/dist/index.d.cts +302 -319
  39. package/dist/index.d.ts +302 -319
  40. package/dist/index.js +1071 -846
  41. package/dist/index.js.map +1 -1
  42. package/dist/logger.cjs +26 -0
  43. package/dist/logger.cjs.map +1 -0
  44. package/dist/logger.d.cts +32 -0
  45. package/dist/logger.d.ts +32 -0
  46. package/dist/logger.js +8 -0
  47. package/dist/logger.js.map +1 -0
  48. package/dist/transformers.cjs +124 -0
  49. package/dist/transformers.cjs.map +1 -0
  50. package/dist/transformers.d.cts +55 -0
  51. package/dist/transformers.d.ts +55 -0
  52. package/dist/transformers.js +95 -0
  53. package/dist/transformers.js.map +1 -0
  54. package/dist/utils.cjs +23 -1163
  55. package/dist/utils.cjs.map +1 -1
  56. package/dist/utils.d.cts +2 -143
  57. package/dist/utils.d.ts +2 -143
  58. package/dist/utils.js +15 -1118
  59. package/dist/utils.js.map +1 -1
  60. package/dist/write-A6VgHkYA.d.cts +10 -0
  61. package/dist/write-A6VgHkYA.d.ts +10 -0
  62. package/package.json +40 -23
  63. package/src/BarrelManager.ts +113 -0
  64. package/src/FileManager.ts +581 -0
  65. package/src/Generator.ts +34 -0
  66. package/src/PackageManager.ts +178 -0
  67. package/src/PluginManager.ts +645 -0
  68. package/src/PromiseManager.ts +51 -0
  69. package/src/build.ts +221 -0
  70. package/src/config.ts +22 -0
  71. package/src/errors.ts +12 -0
  72. package/src/fs/clean.ts +5 -0
  73. package/src/fs/index.ts +3 -0
  74. package/src/fs/read.ts +68 -0
  75. package/src/fs/write.ts +79 -0
  76. package/src/index.ts +27 -0
  77. package/src/logger.ts +121 -0
  78. package/src/plugin.ts +80 -0
  79. package/src/transformers/casing.ts +9 -0
  80. package/src/transformers/combineCodes.ts +3 -0
  81. package/src/transformers/createJSDocBlockText.ts +9 -0
  82. package/src/transformers/escape.ts +31 -0
  83. package/src/transformers/indent.ts +3 -0
  84. package/src/transformers/index.ts +36 -0
  85. package/src/transformers/nameSorter.ts +9 -0
  86. package/src/transformers/searchAndReplace.ts +25 -0
  87. package/src/transformers/transformReservedWord.ts +97 -0
  88. package/src/transformers/trim.ts +7 -0
  89. package/src/types.ts +334 -0
  90. package/src/utils/EventEmitter.ts +24 -0
  91. package/src/utils/FunctionParams.ts +86 -0
  92. package/src/utils/TreeNode.ts +125 -0
  93. package/src/utils/URLPath.ts +133 -0
  94. package/src/utils/cache.ts +35 -0
  95. package/src/utils/executeStrategies.ts +83 -0
  96. package/src/utils/index.ts +8 -0
  97. package/src/utils/promise.ts +13 -0
  98. package/src/utils/renderTemplate.ts +31 -0
  99. package/src/utils/timeout.ts +7 -0
  100. package/src/utils/uniqueName.ts +20 -0
package/dist/index.cjs CHANGED
@@ -2,25 +2,25 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var pc3 = require('picocolors');
6
- var fs2 = require('fs-extra');
7
- var seedrandom = require('seedrandom');
5
+ var chunk5TK7TMV6_cjs = require('./chunk-5TK7TMV6.cjs');
6
+ var chunkH47IKRXJ_cjs = require('./chunk-H47IKRXJ.cjs');
7
+ require('./chunk-XDHI63G7.cjs');
8
+ var chunkPLVKILIY_cjs = require('./chunk-PLVKILIY.cjs');
9
+ var chunkW2FP7ZWW_cjs = require('./chunk-W2FP7ZWW.cjs');
10
+ var chunkE3ANGQ5N_cjs = require('./chunk-E3ANGQ5N.cjs');
11
+ var chunkWZQO3EPM_cjs = require('./chunk-WZQO3EPM.cjs');
12
+ var crypto = require('crypto');
8
13
  var path4 = require('path');
9
- var jsRuntime = require('js-runtime');
10
- var changeCase = require('change-case');
11
- var crypto2 = require('crypto');
12
14
  var parser = require('@kubb/parser');
13
15
  var factory = require('@kubb/parser/factory');
14
- var isEqual = require('lodash.isequal');
15
16
  var naturalOrderby = require('natural-orderby');
16
17
  var dirTree = require('directory-tree');
17
18
  var events = require('events');
18
- var perf_hooks = require('perf_hooks');
19
19
  var mod = require('module');
20
20
  var os = require('os');
21
21
  var url = require('url');
22
22
  var process = require('process');
23
- var fs3 = require('fs');
23
+ var fs = require('fs');
24
24
  var semver = require('semver');
25
25
 
26
26
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
@@ -43,509 +43,1401 @@ function _interopNamespace(e) {
43
43
  return Object.freeze(n);
44
44
  }
45
45
 
46
- var pc3__default = /*#__PURE__*/_interopDefault(pc3);
47
- var fs2__default = /*#__PURE__*/_interopDefault(fs2);
48
- var seedrandom__default = /*#__PURE__*/_interopDefault(seedrandom);
46
+ var crypto__default = /*#__PURE__*/_interopDefault(crypto);
49
47
  var path4__default = /*#__PURE__*/_interopDefault(path4);
50
- var crypto2__default = /*#__PURE__*/_interopDefault(crypto2);
51
48
  var factory__namespace = /*#__PURE__*/_interopNamespace(factory);
52
- var isEqual__default = /*#__PURE__*/_interopDefault(isEqual);
53
49
  var dirTree__default = /*#__PURE__*/_interopDefault(dirTree);
54
50
  var mod__default = /*#__PURE__*/_interopDefault(mod);
55
51
  var os__default = /*#__PURE__*/_interopDefault(os);
56
52
  var process__default = /*#__PURE__*/_interopDefault(process);
57
- var fs3__default = /*#__PURE__*/_interopDefault(fs3);
53
+ var fs__default = /*#__PURE__*/_interopDefault(fs);
58
54
 
59
- var __defProp = Object.defineProperty;
60
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
61
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
62
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
63
- }) : x)(function(x) {
64
- if (typeof require !== "undefined")
65
- return require.apply(this, arguments);
66
- throw Error('Dynamic require of "' + x + '" is not supported');
55
+ // ../../node_modules/.pnpm/lodash.isequal@4.5.0/node_modules/lodash.isequal/index.js
56
+ var require_lodash = chunkWZQO3EPM_cjs.__commonJS({
57
+ "../../node_modules/.pnpm/lodash.isequal@4.5.0/node_modules/lodash.isequal/index.js"(exports, module) {
58
+ chunkWZQO3EPM_cjs.init_cjs_shims();
59
+ var LARGE_ARRAY_SIZE = 200;
60
+ var HASH_UNDEFINED = "__lodash_hash_undefined__";
61
+ var COMPARE_PARTIAL_FLAG = 1;
62
+ var COMPARE_UNORDERED_FLAG = 2;
63
+ var MAX_SAFE_INTEGER = 9007199254740991;
64
+ var argsTag = "[object Arguments]";
65
+ var arrayTag = "[object Array]";
66
+ var asyncTag = "[object AsyncFunction]";
67
+ var boolTag = "[object Boolean]";
68
+ var dateTag = "[object Date]";
69
+ var errorTag = "[object Error]";
70
+ var funcTag = "[object Function]";
71
+ var genTag = "[object GeneratorFunction]";
72
+ var mapTag = "[object Map]";
73
+ var numberTag = "[object Number]";
74
+ var nullTag = "[object Null]";
75
+ var objectTag = "[object Object]";
76
+ var promiseTag = "[object Promise]";
77
+ var proxyTag = "[object Proxy]";
78
+ var regexpTag = "[object RegExp]";
79
+ var setTag = "[object Set]";
80
+ var stringTag = "[object String]";
81
+ var symbolTag = "[object Symbol]";
82
+ var undefinedTag = "[object Undefined]";
83
+ var weakMapTag = "[object WeakMap]";
84
+ var arrayBufferTag = "[object ArrayBuffer]";
85
+ var dataViewTag = "[object DataView]";
86
+ var float32Tag = "[object Float32Array]";
87
+ var float64Tag = "[object Float64Array]";
88
+ var int8Tag = "[object Int8Array]";
89
+ var int16Tag = "[object Int16Array]";
90
+ var int32Tag = "[object Int32Array]";
91
+ var uint8Tag = "[object Uint8Array]";
92
+ var uint8ClampedTag = "[object Uint8ClampedArray]";
93
+ var uint16Tag = "[object Uint16Array]";
94
+ var uint32Tag = "[object Uint32Array]";
95
+ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
96
+ var reIsHostCtor = /^\[object .+?Constructor\]$/;
97
+ var reIsUint = /^(?:0|[1-9]\d*)$/;
98
+ var typedArrayTags = {};
99
+ typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true;
100
+ 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;
101
+ var freeGlobal = typeof global == "object" && global && global.Object === Object && global;
102
+ var freeSelf = typeof self == "object" && self && self.Object === Object && self;
103
+ var root = freeGlobal || freeSelf || Function("return this")();
104
+ var freeExports = typeof exports == "object" && exports && !exports.nodeType && exports;
105
+ var freeModule = freeExports && typeof module == "object" && module && !module.nodeType && module;
106
+ var moduleExports = freeModule && freeModule.exports === freeExports;
107
+ var freeProcess = moduleExports && freeGlobal.process;
108
+ var nodeUtil = function() {
109
+ try {
110
+ return freeProcess && freeProcess.binding && freeProcess.binding("util");
111
+ } catch (e) {
112
+ }
113
+ }();
114
+ var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray;
115
+ function arrayFilter(array, predicate) {
116
+ var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = [];
117
+ while (++index < length) {
118
+ var value = array[index];
119
+ if (predicate(value, index, array)) {
120
+ result[resIndex++] = value;
121
+ }
122
+ }
123
+ return result;
124
+ }
125
+ function arrayPush(array, values) {
126
+ var index = -1, length = values.length, offset = array.length;
127
+ while (++index < length) {
128
+ array[offset + index] = values[index];
129
+ }
130
+ return array;
131
+ }
132
+ function arraySome(array, predicate) {
133
+ var index = -1, length = array == null ? 0 : array.length;
134
+ while (++index < length) {
135
+ if (predicate(array[index], index, array)) {
136
+ return true;
137
+ }
138
+ }
139
+ return false;
140
+ }
141
+ function baseTimes(n, iteratee) {
142
+ var index = -1, result = Array(n);
143
+ while (++index < n) {
144
+ result[index] = iteratee(index);
145
+ }
146
+ return result;
147
+ }
148
+ function baseUnary(func) {
149
+ return function(value) {
150
+ return func(value);
151
+ };
152
+ }
153
+ function cacheHas(cache, key) {
154
+ return cache.has(key);
155
+ }
156
+ function getValue(object, key) {
157
+ return object == null ? void 0 : object[key];
158
+ }
159
+ function mapToArray(map) {
160
+ var index = -1, result = Array(map.size);
161
+ map.forEach(function(value, key) {
162
+ result[++index] = [key, value];
163
+ });
164
+ return result;
165
+ }
166
+ function overArg(func, transform) {
167
+ return function(arg) {
168
+ return func(transform(arg));
169
+ };
170
+ }
171
+ function setToArray(set) {
172
+ var index = -1, result = Array(set.size);
173
+ set.forEach(function(value) {
174
+ result[++index] = value;
175
+ });
176
+ return result;
177
+ }
178
+ var arrayProto = Array.prototype;
179
+ var funcProto = Function.prototype;
180
+ var objectProto = Object.prototype;
181
+ var coreJsData = root["__core-js_shared__"];
182
+ var funcToString = funcProto.toString;
183
+ var hasOwnProperty = objectProto.hasOwnProperty;
184
+ var maskSrcKey = function() {
185
+ var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
186
+ return uid ? "Symbol(src)_1." + uid : "";
187
+ }();
188
+ var nativeObjectToString = objectProto.toString;
189
+ var reIsNative = RegExp(
190
+ "^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
191
+ );
192
+ var Buffer = moduleExports ? root.Buffer : void 0;
193
+ var Symbol2 = root.Symbol;
194
+ var Uint8Array = root.Uint8Array;
195
+ var propertyIsEnumerable = objectProto.propertyIsEnumerable;
196
+ var splice = arrayProto.splice;
197
+ var symToStringTag = Symbol2 ? Symbol2.toStringTag : void 0;
198
+ var nativeGetSymbols = Object.getOwnPropertySymbols;
199
+ var nativeIsBuffer = Buffer ? Buffer.isBuffer : void 0;
200
+ var nativeKeys = overArg(Object.keys, Object);
201
+ var DataView = getNative(root, "DataView");
202
+ var Map2 = getNative(root, "Map");
203
+ var Promise2 = getNative(root, "Promise");
204
+ var Set2 = getNative(root, "Set");
205
+ var WeakMap2 = getNative(root, "WeakMap");
206
+ var nativeCreate = getNative(Object, "create");
207
+ var dataViewCtorString = toSource(DataView);
208
+ var mapCtorString = toSource(Map2);
209
+ var promiseCtorString = toSource(Promise2);
210
+ var setCtorString = toSource(Set2);
211
+ var weakMapCtorString = toSource(WeakMap2);
212
+ var symbolProto = Symbol2 ? Symbol2.prototype : void 0;
213
+ var symbolValueOf = symbolProto ? symbolProto.valueOf : void 0;
214
+ function Hash(entries) {
215
+ var index = -1, length = entries == null ? 0 : entries.length;
216
+ this.clear();
217
+ while (++index < length) {
218
+ var entry = entries[index];
219
+ this.set(entry[0], entry[1]);
220
+ }
221
+ }
222
+ function hashClear() {
223
+ this.__data__ = nativeCreate ? nativeCreate(null) : {};
224
+ this.size = 0;
225
+ }
226
+ function hashDelete(key) {
227
+ var result = this.has(key) && delete this.__data__[key];
228
+ this.size -= result ? 1 : 0;
229
+ return result;
230
+ }
231
+ function hashGet(key) {
232
+ var data = this.__data__;
233
+ if (nativeCreate) {
234
+ var result = data[key];
235
+ return result === HASH_UNDEFINED ? void 0 : result;
236
+ }
237
+ return hasOwnProperty.call(data, key) ? data[key] : void 0;
238
+ }
239
+ function hashHas(key) {
240
+ var data = this.__data__;
241
+ return nativeCreate ? data[key] !== void 0 : hasOwnProperty.call(data, key);
242
+ }
243
+ function hashSet(key, value) {
244
+ var data = this.__data__;
245
+ this.size += this.has(key) ? 0 : 1;
246
+ data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED : value;
247
+ return this;
248
+ }
249
+ Hash.prototype.clear = hashClear;
250
+ Hash.prototype["delete"] = hashDelete;
251
+ Hash.prototype.get = hashGet;
252
+ Hash.prototype.has = hashHas;
253
+ Hash.prototype.set = hashSet;
254
+ function ListCache(entries) {
255
+ var index = -1, length = entries == null ? 0 : entries.length;
256
+ this.clear();
257
+ while (++index < length) {
258
+ var entry = entries[index];
259
+ this.set(entry[0], entry[1]);
260
+ }
261
+ }
262
+ function listCacheClear() {
263
+ this.__data__ = [];
264
+ this.size = 0;
265
+ }
266
+ function listCacheDelete(key) {
267
+ var data = this.__data__, index = assocIndexOf(data, key);
268
+ if (index < 0) {
269
+ return false;
270
+ }
271
+ var lastIndex = data.length - 1;
272
+ if (index == lastIndex) {
273
+ data.pop();
274
+ } else {
275
+ splice.call(data, index, 1);
276
+ }
277
+ --this.size;
278
+ return true;
279
+ }
280
+ function listCacheGet(key) {
281
+ var data = this.__data__, index = assocIndexOf(data, key);
282
+ return index < 0 ? void 0 : data[index][1];
283
+ }
284
+ function listCacheHas(key) {
285
+ return assocIndexOf(this.__data__, key) > -1;
286
+ }
287
+ function listCacheSet(key, value) {
288
+ var data = this.__data__, index = assocIndexOf(data, key);
289
+ if (index < 0) {
290
+ ++this.size;
291
+ data.push([key, value]);
292
+ } else {
293
+ data[index][1] = value;
294
+ }
295
+ return this;
296
+ }
297
+ ListCache.prototype.clear = listCacheClear;
298
+ ListCache.prototype["delete"] = listCacheDelete;
299
+ ListCache.prototype.get = listCacheGet;
300
+ ListCache.prototype.has = listCacheHas;
301
+ ListCache.prototype.set = listCacheSet;
302
+ function MapCache(entries) {
303
+ var index = -1, length = entries == null ? 0 : entries.length;
304
+ this.clear();
305
+ while (++index < length) {
306
+ var entry = entries[index];
307
+ this.set(entry[0], entry[1]);
308
+ }
309
+ }
310
+ function mapCacheClear() {
311
+ this.size = 0;
312
+ this.__data__ = {
313
+ "hash": new Hash(),
314
+ "map": new (Map2 || ListCache)(),
315
+ "string": new Hash()
316
+ };
317
+ }
318
+ function mapCacheDelete(key) {
319
+ var result = getMapData(this, key)["delete"](key);
320
+ this.size -= result ? 1 : 0;
321
+ return result;
322
+ }
323
+ function mapCacheGet(key) {
324
+ return getMapData(this, key).get(key);
325
+ }
326
+ function mapCacheHas(key) {
327
+ return getMapData(this, key).has(key);
328
+ }
329
+ function mapCacheSet(key, value) {
330
+ var data = getMapData(this, key), size = data.size;
331
+ data.set(key, value);
332
+ this.size += data.size == size ? 0 : 1;
333
+ return this;
334
+ }
335
+ MapCache.prototype.clear = mapCacheClear;
336
+ MapCache.prototype["delete"] = mapCacheDelete;
337
+ MapCache.prototype.get = mapCacheGet;
338
+ MapCache.prototype.has = mapCacheHas;
339
+ MapCache.prototype.set = mapCacheSet;
340
+ function SetCache(values) {
341
+ var index = -1, length = values == null ? 0 : values.length;
342
+ this.__data__ = new MapCache();
343
+ while (++index < length) {
344
+ this.add(values[index]);
345
+ }
346
+ }
347
+ function setCacheAdd(value) {
348
+ this.__data__.set(value, HASH_UNDEFINED);
349
+ return this;
350
+ }
351
+ function setCacheHas(value) {
352
+ return this.__data__.has(value);
353
+ }
354
+ SetCache.prototype.add = SetCache.prototype.push = setCacheAdd;
355
+ SetCache.prototype.has = setCacheHas;
356
+ function Stack(entries) {
357
+ var data = this.__data__ = new ListCache(entries);
358
+ this.size = data.size;
359
+ }
360
+ function stackClear() {
361
+ this.__data__ = new ListCache();
362
+ this.size = 0;
363
+ }
364
+ function stackDelete(key) {
365
+ var data = this.__data__, result = data["delete"](key);
366
+ this.size = data.size;
367
+ return result;
368
+ }
369
+ function stackGet(key) {
370
+ return this.__data__.get(key);
371
+ }
372
+ function stackHas(key) {
373
+ return this.__data__.has(key);
374
+ }
375
+ function stackSet(key, value) {
376
+ var data = this.__data__;
377
+ if (data instanceof ListCache) {
378
+ var pairs = data.__data__;
379
+ if (!Map2 || pairs.length < LARGE_ARRAY_SIZE - 1) {
380
+ pairs.push([key, value]);
381
+ this.size = ++data.size;
382
+ return this;
383
+ }
384
+ data = this.__data__ = new MapCache(pairs);
385
+ }
386
+ data.set(key, value);
387
+ this.size = data.size;
388
+ return this;
389
+ }
390
+ Stack.prototype.clear = stackClear;
391
+ Stack.prototype["delete"] = stackDelete;
392
+ Stack.prototype.get = stackGet;
393
+ Stack.prototype.has = stackHas;
394
+ Stack.prototype.set = stackSet;
395
+ function arrayLikeKeys(value, inherited) {
396
+ 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;
397
+ for (var key in value) {
398
+ if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && // Safari 9 has enumerable `arguments.length` in strict mode.
399
+ (key == "length" || // Node.js 0.10 has enumerable non-index properties on buffers.
400
+ isBuff && (key == "offset" || key == "parent") || // PhantomJS 2 has enumerable non-index properties on typed arrays.
401
+ isType && (key == "buffer" || key == "byteLength" || key == "byteOffset") || // Skip index properties.
402
+ isIndex(key, length)))) {
403
+ result.push(key);
404
+ }
405
+ }
406
+ return result;
407
+ }
408
+ function assocIndexOf(array, key) {
409
+ var length = array.length;
410
+ while (length--) {
411
+ if (eq(array[length][0], key)) {
412
+ return length;
413
+ }
414
+ }
415
+ return -1;
416
+ }
417
+ function baseGetAllKeys(object, keysFunc, symbolsFunc) {
418
+ var result = keysFunc(object);
419
+ return isArray(object) ? result : arrayPush(result, symbolsFunc(object));
420
+ }
421
+ function baseGetTag(value) {
422
+ if (value == null) {
423
+ return value === void 0 ? undefinedTag : nullTag;
424
+ }
425
+ return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
426
+ }
427
+ function baseIsArguments(value) {
428
+ return isObjectLike(value) && baseGetTag(value) == argsTag;
429
+ }
430
+ function baseIsEqual(value, other, bitmask, customizer, stack) {
431
+ if (value === other) {
432
+ return true;
433
+ }
434
+ if (value == null || other == null || !isObjectLike(value) && !isObjectLike(other)) {
435
+ return value !== value && other !== other;
436
+ }
437
+ return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack);
438
+ }
439
+ function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) {
440
+ var objIsArr = isArray(object), othIsArr = isArray(other), objTag = objIsArr ? arrayTag : getTag(object), othTag = othIsArr ? arrayTag : getTag(other);
441
+ objTag = objTag == argsTag ? objectTag : objTag;
442
+ othTag = othTag == argsTag ? objectTag : othTag;
443
+ var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag;
444
+ if (isSameTag && isBuffer(object)) {
445
+ if (!isBuffer(other)) {
446
+ return false;
447
+ }
448
+ objIsArr = true;
449
+ objIsObj = false;
450
+ }
451
+ if (isSameTag && !objIsObj) {
452
+ stack || (stack = new Stack());
453
+ return objIsArr || isTypedArray(object) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack);
454
+ }
455
+ if (!(bitmask & COMPARE_PARTIAL_FLAG)) {
456
+ var objIsWrapped = objIsObj && hasOwnProperty.call(object, "__wrapped__"), othIsWrapped = othIsObj && hasOwnProperty.call(other, "__wrapped__");
457
+ if (objIsWrapped || othIsWrapped) {
458
+ var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other;
459
+ stack || (stack = new Stack());
460
+ return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack);
461
+ }
462
+ }
463
+ if (!isSameTag) {
464
+ return false;
465
+ }
466
+ stack || (stack = new Stack());
467
+ return equalObjects(object, other, bitmask, customizer, equalFunc, stack);
468
+ }
469
+ function baseIsNative(value) {
470
+ if (!isObject(value) || isMasked(value)) {
471
+ return false;
472
+ }
473
+ var pattern = isFunction(value) ? reIsNative : reIsHostCtor;
474
+ return pattern.test(toSource(value));
475
+ }
476
+ function baseIsTypedArray(value) {
477
+ return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)];
478
+ }
479
+ function baseKeys(object) {
480
+ if (!isPrototype(object)) {
481
+ return nativeKeys(object);
482
+ }
483
+ var result = [];
484
+ for (var key in Object(object)) {
485
+ if (hasOwnProperty.call(object, key) && key != "constructor") {
486
+ result.push(key);
487
+ }
488
+ }
489
+ return result;
490
+ }
491
+ function equalArrays(array, other, bitmask, customizer, equalFunc, stack) {
492
+ var isPartial = bitmask & COMPARE_PARTIAL_FLAG, arrLength = array.length, othLength = other.length;
493
+ if (arrLength != othLength && !(isPartial && othLength > arrLength)) {
494
+ return false;
495
+ }
496
+ var stacked = stack.get(array);
497
+ if (stacked && stack.get(other)) {
498
+ return stacked == other;
499
+ }
500
+ var index = -1, result = true, seen = bitmask & COMPARE_UNORDERED_FLAG ? new SetCache() : void 0;
501
+ stack.set(array, other);
502
+ stack.set(other, array);
503
+ while (++index < arrLength) {
504
+ var arrValue = array[index], othValue = other[index];
505
+ if (customizer) {
506
+ var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack);
507
+ }
508
+ if (compared !== void 0) {
509
+ if (compared) {
510
+ continue;
511
+ }
512
+ result = false;
513
+ break;
514
+ }
515
+ if (seen) {
516
+ if (!arraySome(other, function(othValue2, othIndex) {
517
+ if (!cacheHas(seen, othIndex) && (arrValue === othValue2 || equalFunc(arrValue, othValue2, bitmask, customizer, stack))) {
518
+ return seen.push(othIndex);
519
+ }
520
+ })) {
521
+ result = false;
522
+ break;
523
+ }
524
+ } else if (!(arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) {
525
+ result = false;
526
+ break;
527
+ }
528
+ }
529
+ stack["delete"](array);
530
+ stack["delete"](other);
531
+ return result;
532
+ }
533
+ function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) {
534
+ switch (tag) {
535
+ case dataViewTag:
536
+ if (object.byteLength != other.byteLength || object.byteOffset != other.byteOffset) {
537
+ return false;
538
+ }
539
+ object = object.buffer;
540
+ other = other.buffer;
541
+ case arrayBufferTag:
542
+ if (object.byteLength != other.byteLength || !equalFunc(new Uint8Array(object), new Uint8Array(other))) {
543
+ return false;
544
+ }
545
+ return true;
546
+ case boolTag:
547
+ case dateTag:
548
+ case numberTag:
549
+ return eq(+object, +other);
550
+ case errorTag:
551
+ return object.name == other.name && object.message == other.message;
552
+ case regexpTag:
553
+ case stringTag:
554
+ return object == other + "";
555
+ case mapTag:
556
+ var convert = mapToArray;
557
+ case setTag:
558
+ var isPartial = bitmask & COMPARE_PARTIAL_FLAG;
559
+ convert || (convert = setToArray);
560
+ if (object.size != other.size && !isPartial) {
561
+ return false;
562
+ }
563
+ var stacked = stack.get(object);
564
+ if (stacked) {
565
+ return stacked == other;
566
+ }
567
+ bitmask |= COMPARE_UNORDERED_FLAG;
568
+ stack.set(object, other);
569
+ var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack);
570
+ stack["delete"](object);
571
+ return result;
572
+ case symbolTag:
573
+ if (symbolValueOf) {
574
+ return symbolValueOf.call(object) == symbolValueOf.call(other);
575
+ }
576
+ }
577
+ return false;
578
+ }
579
+ function equalObjects(object, other, bitmask, customizer, equalFunc, stack) {
580
+ var isPartial = bitmask & COMPARE_PARTIAL_FLAG, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length;
581
+ if (objLength != othLength && !isPartial) {
582
+ return false;
583
+ }
584
+ var index = objLength;
585
+ while (index--) {
586
+ var key = objProps[index];
587
+ if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) {
588
+ return false;
589
+ }
590
+ }
591
+ var stacked = stack.get(object);
592
+ if (stacked && stack.get(other)) {
593
+ return stacked == other;
594
+ }
595
+ var result = true;
596
+ stack.set(object, other);
597
+ stack.set(other, object);
598
+ var skipCtor = isPartial;
599
+ while (++index < objLength) {
600
+ key = objProps[index];
601
+ var objValue = object[key], othValue = other[key];
602
+ if (customizer) {
603
+ var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack);
604
+ }
605
+ if (!(compared === void 0 ? objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack) : compared)) {
606
+ result = false;
607
+ break;
608
+ }
609
+ skipCtor || (skipCtor = key == "constructor");
610
+ }
611
+ if (result && !skipCtor) {
612
+ var objCtor = object.constructor, othCtor = other.constructor;
613
+ if (objCtor != othCtor && ("constructor" in object && "constructor" in other) && !(typeof objCtor == "function" && objCtor instanceof objCtor && typeof othCtor == "function" && othCtor instanceof othCtor)) {
614
+ result = false;
615
+ }
616
+ }
617
+ stack["delete"](object);
618
+ stack["delete"](other);
619
+ return result;
620
+ }
621
+ function getAllKeys(object) {
622
+ return baseGetAllKeys(object, keys, getSymbols);
623
+ }
624
+ function getMapData(map, key) {
625
+ var data = map.__data__;
626
+ return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
627
+ }
628
+ function getNative(object, key) {
629
+ var value = getValue(object, key);
630
+ return baseIsNative(value) ? value : void 0;
631
+ }
632
+ function getRawTag(value) {
633
+ var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag];
634
+ try {
635
+ value[symToStringTag] = void 0;
636
+ var unmasked = true;
637
+ } catch (e) {
638
+ }
639
+ var result = nativeObjectToString.call(value);
640
+ if (unmasked) {
641
+ if (isOwn) {
642
+ value[symToStringTag] = tag;
643
+ } else {
644
+ delete value[symToStringTag];
645
+ }
646
+ }
647
+ return result;
648
+ }
649
+ var getSymbols = !nativeGetSymbols ? stubArray : function(object) {
650
+ if (object == null) {
651
+ return [];
652
+ }
653
+ object = Object(object);
654
+ return arrayFilter(nativeGetSymbols(object), function(symbol) {
655
+ return propertyIsEnumerable.call(object, symbol);
656
+ });
657
+ };
658
+ var getTag = baseGetTag;
659
+ 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) {
660
+ getTag = function(value) {
661
+ var result = baseGetTag(value), Ctor = result == objectTag ? value.constructor : void 0, ctorString = Ctor ? toSource(Ctor) : "";
662
+ if (ctorString) {
663
+ switch (ctorString) {
664
+ case dataViewCtorString:
665
+ return dataViewTag;
666
+ case mapCtorString:
667
+ return mapTag;
668
+ case promiseCtorString:
669
+ return promiseTag;
670
+ case setCtorString:
671
+ return setTag;
672
+ case weakMapCtorString:
673
+ return weakMapTag;
674
+ }
675
+ }
676
+ return result;
677
+ };
678
+ }
679
+ function isIndex(value, length) {
680
+ length = length == null ? MAX_SAFE_INTEGER : length;
681
+ return !!length && (typeof value == "number" || reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length);
682
+ }
683
+ function isKeyable(value) {
684
+ var type = typeof value;
685
+ return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
686
+ }
687
+ function isMasked(func) {
688
+ return !!maskSrcKey && maskSrcKey in func;
689
+ }
690
+ function isPrototype(value) {
691
+ var Ctor = value && value.constructor, proto = typeof Ctor == "function" && Ctor.prototype || objectProto;
692
+ return value === proto;
693
+ }
694
+ function objectToString(value) {
695
+ return nativeObjectToString.call(value);
696
+ }
697
+ function toSource(func) {
698
+ if (func != null) {
699
+ try {
700
+ return funcToString.call(func);
701
+ } catch (e) {
702
+ }
703
+ try {
704
+ return func + "";
705
+ } catch (e) {
706
+ }
707
+ }
708
+ return "";
709
+ }
710
+ function eq(value, other) {
711
+ return value === other || value !== value && other !== other;
712
+ }
713
+ var isArguments = baseIsArguments(/* @__PURE__ */ function() {
714
+ return arguments;
715
+ }()) ? baseIsArguments : function(value) {
716
+ return isObjectLike(value) && hasOwnProperty.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
717
+ };
718
+ var isArray = Array.isArray;
719
+ function isArrayLike(value) {
720
+ return value != null && isLength(value.length) && !isFunction(value);
721
+ }
722
+ var isBuffer = nativeIsBuffer || stubFalse;
723
+ function isEqual2(value, other) {
724
+ return baseIsEqual(value, other);
725
+ }
726
+ function isFunction(value) {
727
+ if (!isObject(value)) {
728
+ return false;
729
+ }
730
+ var tag = baseGetTag(value);
731
+ return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
732
+ }
733
+ function isLength(value) {
734
+ return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
735
+ }
736
+ function isObject(value) {
737
+ var type = typeof value;
738
+ return value != null && (type == "object" || type == "function");
739
+ }
740
+ function isObjectLike(value) {
741
+ return value != null && typeof value == "object";
742
+ }
743
+ var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray;
744
+ function keys(object) {
745
+ return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object);
746
+ }
747
+ function stubArray() {
748
+ return [];
749
+ }
750
+ function stubFalse() {
751
+ return false;
752
+ }
753
+ module.exports = isEqual2;
754
+ }
67
755
  });
68
- var __publicField = (obj, key, value) => {
69
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
70
- return value;
71
- };
72
- var __accessCheck = (obj, member, msg) => {
73
- if (!member.has(obj))
74
- throw TypeError("Cannot " + msg);
75
- };
76
- var __privateGet = (obj, member, getter) => {
77
- __accessCheck(obj, member, "read from private field");
78
- return getter ? getter.call(obj) : member.get(obj);
79
- };
80
- var __privateAdd = (obj, member, value) => {
81
- if (member.has(obj))
82
- throw TypeError("Cannot add the same private member more than once");
83
- member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
84
- };
85
- var __privateSet = (obj, member, value, setter) => {
86
- __accessCheck(obj, member, "write to private field");
87
- setter ? setter.call(obj, value) : member.set(obj, value);
88
- return value;
89
- };
90
- var __privateWrapper = (obj, member, setter, getter) => ({
91
- set _(value) {
92
- __privateSet(obj, member, value, setter);
93
- },
94
- get _() {
95
- return __privateGet(obj, member, getter);
756
+
757
+ // ../../node_modules/.pnpm/eventemitter3@5.0.1/node_modules/eventemitter3/index.js
758
+ var require_eventemitter3 = chunkWZQO3EPM_cjs.__commonJS({
759
+ "../../node_modules/.pnpm/eventemitter3@5.0.1/node_modules/eventemitter3/index.js"(exports, module) {
760
+ chunkWZQO3EPM_cjs.init_cjs_shims();
761
+ var has = Object.prototype.hasOwnProperty;
762
+ var prefix = "~";
763
+ function Events() {
764
+ }
765
+ if (Object.create) {
766
+ Events.prototype = /* @__PURE__ */ Object.create(null);
767
+ if (!new Events().__proto__)
768
+ prefix = false;
769
+ }
770
+ function EE(fn, context, once) {
771
+ this.fn = fn;
772
+ this.context = context;
773
+ this.once = once || false;
774
+ }
775
+ function addListener(emitter, event, fn, context, once) {
776
+ if (typeof fn !== "function") {
777
+ throw new TypeError("The listener must be a function");
778
+ }
779
+ var listener = new EE(fn, context || emitter, once), evt = prefix ? prefix + event : event;
780
+ if (!emitter._events[evt])
781
+ emitter._events[evt] = listener, emitter._eventsCount++;
782
+ else if (!emitter._events[evt].fn)
783
+ emitter._events[evt].push(listener);
784
+ else
785
+ emitter._events[evt] = [emitter._events[evt], listener];
786
+ return emitter;
787
+ }
788
+ function clearEvent(emitter, evt) {
789
+ if (--emitter._eventsCount === 0)
790
+ emitter._events = new Events();
791
+ else
792
+ delete emitter._events[evt];
793
+ }
794
+ function EventEmitter3() {
795
+ this._events = new Events();
796
+ this._eventsCount = 0;
797
+ }
798
+ EventEmitter3.prototype.eventNames = function eventNames() {
799
+ var names = [], events, name;
800
+ if (this._eventsCount === 0)
801
+ return names;
802
+ for (name in events = this._events) {
803
+ if (has.call(events, name))
804
+ names.push(prefix ? name.slice(1) : name);
805
+ }
806
+ if (Object.getOwnPropertySymbols) {
807
+ return names.concat(Object.getOwnPropertySymbols(events));
808
+ }
809
+ return names;
810
+ };
811
+ EventEmitter3.prototype.listeners = function listeners(event) {
812
+ var evt = prefix ? prefix + event : event, handlers = this._events[evt];
813
+ if (!handlers)
814
+ return [];
815
+ if (handlers.fn)
816
+ return [handlers.fn];
817
+ for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) {
818
+ ee[i] = handlers[i].fn;
819
+ }
820
+ return ee;
821
+ };
822
+ EventEmitter3.prototype.listenerCount = function listenerCount(event) {
823
+ var evt = prefix ? prefix + event : event, listeners = this._events[evt];
824
+ if (!listeners)
825
+ return 0;
826
+ if (listeners.fn)
827
+ return 1;
828
+ return listeners.length;
829
+ };
830
+ EventEmitter3.prototype.emit = function emit(event, a1, a2, a3, a4, a5) {
831
+ var evt = prefix ? prefix + event : event;
832
+ if (!this._events[evt])
833
+ return false;
834
+ var listeners = this._events[evt], len = arguments.length, args, i;
835
+ if (listeners.fn) {
836
+ if (listeners.once)
837
+ this.removeListener(event, listeners.fn, void 0, true);
838
+ switch (len) {
839
+ case 1:
840
+ return listeners.fn.call(listeners.context), true;
841
+ case 2:
842
+ return listeners.fn.call(listeners.context, a1), true;
843
+ case 3:
844
+ return listeners.fn.call(listeners.context, a1, a2), true;
845
+ case 4:
846
+ return listeners.fn.call(listeners.context, a1, a2, a3), true;
847
+ case 5:
848
+ return listeners.fn.call(listeners.context, a1, a2, a3, a4), true;
849
+ case 6:
850
+ return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true;
851
+ }
852
+ for (i = 1, args = new Array(len - 1); i < len; i++) {
853
+ args[i - 1] = arguments[i];
854
+ }
855
+ listeners.fn.apply(listeners.context, args);
856
+ } else {
857
+ var length = listeners.length, j;
858
+ for (i = 0; i < length; i++) {
859
+ if (listeners[i].once)
860
+ this.removeListener(event, listeners[i].fn, void 0, true);
861
+ switch (len) {
862
+ case 1:
863
+ listeners[i].fn.call(listeners[i].context);
864
+ break;
865
+ case 2:
866
+ listeners[i].fn.call(listeners[i].context, a1);
867
+ break;
868
+ case 3:
869
+ listeners[i].fn.call(listeners[i].context, a1, a2);
870
+ break;
871
+ case 4:
872
+ listeners[i].fn.call(listeners[i].context, a1, a2, a3);
873
+ break;
874
+ default:
875
+ if (!args)
876
+ for (j = 1, args = new Array(len - 1); j < len; j++) {
877
+ args[j - 1] = arguments[j];
878
+ }
879
+ listeners[i].fn.apply(listeners[i].context, args);
880
+ }
881
+ }
882
+ }
883
+ return true;
884
+ };
885
+ EventEmitter3.prototype.on = function on(event, fn, context) {
886
+ return addListener(this, event, fn, context, false);
887
+ };
888
+ EventEmitter3.prototype.once = function once(event, fn, context) {
889
+ return addListener(this, event, fn, context, true);
890
+ };
891
+ EventEmitter3.prototype.removeListener = function removeListener(event, fn, context, once) {
892
+ var evt = prefix ? prefix + event : event;
893
+ if (!this._events[evt])
894
+ return this;
895
+ if (!fn) {
896
+ clearEvent(this, evt);
897
+ return this;
898
+ }
899
+ var listeners = this._events[evt];
900
+ if (listeners.fn) {
901
+ if (listeners.fn === fn && (!once || listeners.once) && (!context || listeners.context === context)) {
902
+ clearEvent(this, evt);
903
+ }
904
+ } else {
905
+ for (var i = 0, events = [], length = listeners.length; i < length; i++) {
906
+ if (listeners[i].fn !== fn || once && !listeners[i].once || context && listeners[i].context !== context) {
907
+ events.push(listeners[i]);
908
+ }
909
+ }
910
+ if (events.length)
911
+ this._events[evt] = events.length === 1 ? events[0] : events;
912
+ else
913
+ clearEvent(this, evt);
914
+ }
915
+ return this;
916
+ };
917
+ EventEmitter3.prototype.removeAllListeners = function removeAllListeners(event) {
918
+ var evt;
919
+ if (event) {
920
+ evt = prefix ? prefix + event : event;
921
+ if (this._events[evt])
922
+ clearEvent(this, evt);
923
+ } else {
924
+ this._events = new Events();
925
+ this._eventsCount = 0;
926
+ }
927
+ return this;
928
+ };
929
+ EventEmitter3.prototype.off = EventEmitter3.prototype.removeListener;
930
+ EventEmitter3.prototype.addListener = EventEmitter3.prototype.on;
931
+ EventEmitter3.prefixed = prefix;
932
+ EventEmitter3.EventEmitter = EventEmitter3;
933
+ if ("undefined" !== typeof module) {
934
+ module.exports = EventEmitter3;
935
+ }
96
936
  }
97
937
  });
98
- var __privateMethod = (obj, member, method) => {
99
- __accessCheck(obj, member, "access private method");
100
- return method;
101
- };
102
- async function clean(path5) {
103
- return fs2.remove(path5);
938
+
939
+ // src/index.ts
940
+ chunkWZQO3EPM_cjs.init_cjs_shims();
941
+
942
+ // src/build.ts
943
+ chunkWZQO3EPM_cjs.init_cjs_shims();
944
+
945
+ // src/config.ts
946
+ chunkWZQO3EPM_cjs.init_cjs_shims();
947
+ function defineConfig(options) {
948
+ return options;
104
949
  }
105
- var LogLevel = {
106
- silent: "silent",
107
- info: "info",
108
- debug: "debug"
950
+ function isInputPath(result) {
951
+ return !!result && "path" in result;
952
+ }
953
+
954
+ // src/FileManager.ts
955
+ chunkWZQO3EPM_cjs.init_cjs_shims();
956
+ var import_lodash = chunkWZQO3EPM_cjs.__toESM(require_lodash(), 1);
957
+
958
+ // ../../node_modules/.pnpm/p-queue@8.0.0/node_modules/p-queue/dist/index.js
959
+ chunkWZQO3EPM_cjs.init_cjs_shims();
960
+
961
+ // ../../node_modules/.pnpm/eventemitter3@5.0.1/node_modules/eventemitter3/index.mjs
962
+ chunkWZQO3EPM_cjs.init_cjs_shims();
963
+ var import_index = chunkWZQO3EPM_cjs.__toESM(require_eventemitter3(), 1);
964
+
965
+ // ../../node_modules/.pnpm/p-timeout@6.1.2/node_modules/p-timeout/index.js
966
+ chunkWZQO3EPM_cjs.init_cjs_shims();
967
+ var TimeoutError = class extends Error {
968
+ constructor(message) {
969
+ super(message);
970
+ this.name = "TimeoutError";
971
+ }
109
972
  };
110
- function createLogger({ logLevel, name, spinner }) {
111
- const logs = [];
112
- const log = (message) => {
113
- if (message && spinner) {
114
- spinner.text = message;
115
- logs.push(message);
116
- }
117
- };
118
- const error = (message) => {
119
- if (message) {
120
- throw new Error(message || "Something went wrong");
121
- }
122
- };
123
- const warn = (message) => {
124
- if (message && spinner) {
125
- spinner.warn(pc3__default.default.yellow(message));
126
- logs.push(message);
973
+ var AbortError = class extends Error {
974
+ constructor(message) {
975
+ super();
976
+ this.name = "AbortError";
977
+ this.message = message;
978
+ }
979
+ };
980
+ var getDOMException = (errorMessage) => globalThis.DOMException === void 0 ? new AbortError(errorMessage) : new DOMException(errorMessage);
981
+ var getAbortedReason = (signal) => {
982
+ const reason = signal.reason === void 0 ? getDOMException("This operation was aborted.") : signal.reason;
983
+ return reason instanceof Error ? reason : getDOMException(reason);
984
+ };
985
+ function pTimeout(promise, options) {
986
+ const {
987
+ milliseconds,
988
+ fallback,
989
+ message,
990
+ customTimers = { setTimeout, clearTimeout }
991
+ } = options;
992
+ let timer;
993
+ const wrappedPromise = new Promise((resolve2, reject) => {
994
+ if (typeof milliseconds !== "number" || Math.sign(milliseconds) !== 1) {
995
+ throw new TypeError(`Expected \`milliseconds\` to be a positive number, got \`${milliseconds}\``);
996
+ }
997
+ if (options.signal) {
998
+ const { signal } = options;
999
+ if (signal.aborted) {
1000
+ reject(getAbortedReason(signal));
1001
+ }
1002
+ signal.addEventListener("abort", () => {
1003
+ reject(getAbortedReason(signal));
1004
+ });
127
1005
  }
128
- };
129
- const info = (message) => {
130
- if (message && spinner) {
131
- spinner.info(message);
132
- logs.push(message);
1006
+ if (milliseconds === Number.POSITIVE_INFINITY) {
1007
+ promise.then(resolve2, reject);
1008
+ return;
133
1009
  }
1010
+ const timeoutError = new TimeoutError();
1011
+ timer = customTimers.setTimeout.call(void 0, () => {
1012
+ if (fallback) {
1013
+ try {
1014
+ resolve2(fallback());
1015
+ } catch (error) {
1016
+ reject(error);
1017
+ }
1018
+ return;
1019
+ }
1020
+ if (typeof promise.cancel === "function") {
1021
+ promise.cancel();
1022
+ }
1023
+ if (message === false) {
1024
+ resolve2();
1025
+ } else if (message instanceof Error) {
1026
+ reject(message);
1027
+ } else {
1028
+ timeoutError.message = message ?? `Promise timed out after ${milliseconds} milliseconds`;
1029
+ reject(timeoutError);
1030
+ }
1031
+ }, milliseconds);
1032
+ (async () => {
1033
+ try {
1034
+ resolve2(await promise);
1035
+ } catch (error) {
1036
+ reject(error);
1037
+ }
1038
+ })();
1039
+ });
1040
+ const cancelablePromise = wrappedPromise.finally(() => {
1041
+ cancelablePromise.clear();
1042
+ });
1043
+ cancelablePromise.clear = () => {
1044
+ customTimers.clearTimeout.call(void 0, timer);
1045
+ timer = void 0;
134
1046
  };
135
- const logger = {
136
- name,
137
- logLevel,
138
- log,
139
- error,
140
- warn,
141
- info,
142
- spinner,
143
- logs
144
- };
145
- return logger;
146
- }
147
- var defaultColours = ["black", "blue", "darkBlue", "cyan", "gray", "green", "darkGreen", "magenta", "red", "darkRed", "yellow", "darkYellow"];
148
- function randomColour(text, colours = defaultColours) {
149
- if (!text) {
150
- return "white";
151
- }
152
- const random = seedrandom__default.default(text);
153
- const colour = colours.at(Math.floor(random() * colours.length)) || "white";
154
- return colour;
1047
+ return cancelablePromise;
155
1048
  }
156
- function randomPicoColour(text, colors = defaultColours) {
157
- const colours = pc3__default.default.createColors(true);
158
- if (!text) {
159
- return colours.white(text);
160
- }
161
- const colour = randomColour(text, colors);
162
- const isDark = colour.includes("dark");
163
- const key = colour.replace("dark", "").toLowerCase();
164
- const formatter = colours[key];
165
- if (isDark) {
166
- return pc3__default.default.bold(formatter(text));
167
- }
168
- if (typeof formatter !== "function") {
169
- throw new Error("Formatter for picoColor is not of type function/Formatter");
170
- }
171
- return formatter(text);
172
- }
173
- var reader = jsRuntime.switcher(
174
- {
175
- node: async (path5) => {
176
- return fs2__default.default.readFile(path5, { encoding: "utf8" });
177
- },
178
- bun: async (path5) => {
179
- const file = Bun.file(path5);
180
- return file.text();
181
- }
182
- },
183
- "node"
184
- );
185
- jsRuntime.switcher(
186
- {
187
- node: (path5) => {
188
- return fs2__default.default.readFileSync(path5, { encoding: "utf8" });
189
- },
190
- bun: () => {
191
- throw new Error("Bun cannot read sync");
192
- }
193
- },
194
- "node"
195
- );
196
- async function read(path5) {
197
- return reader(path5);
1049
+
1050
+ // ../../node_modules/.pnpm/p-queue@8.0.0/node_modules/p-queue/dist/priority-queue.js
1051
+ chunkWZQO3EPM_cjs.init_cjs_shims();
1052
+
1053
+ // ../../node_modules/.pnpm/p-queue@8.0.0/node_modules/p-queue/dist/lower-bound.js
1054
+ chunkWZQO3EPM_cjs.init_cjs_shims();
1055
+ function lowerBound(array, value, comparator) {
1056
+ let first = 0;
1057
+ let count = array.length;
1058
+ while (count > 0) {
1059
+ const step = Math.trunc(count / 2);
1060
+ let it = first + step;
1061
+ if (comparator(array[it], value) <= 0) {
1062
+ first = ++it;
1063
+ count -= step + 1;
1064
+ } else {
1065
+ count = step;
1066
+ }
1067
+ }
1068
+ return first;
198
1069
  }
199
- var URLPath = class {
200
- constructor(path5) {
201
- this.path = path5;
1070
+
1071
+ // ../../node_modules/.pnpm/p-queue@8.0.0/node_modules/p-queue/dist/priority-queue.js
1072
+ var _queue;
1073
+ var PriorityQueue = class {
1074
+ constructor() {
1075
+ chunkWZQO3EPM_cjs.__privateAdd(this, _queue, []);
1076
+ }
1077
+ enqueue(run, options) {
1078
+ options = {
1079
+ priority: 0,
1080
+ ...options
1081
+ };
1082
+ const element = {
1083
+ priority: options.priority,
1084
+ run
1085
+ };
1086
+ if (this.size && chunkWZQO3EPM_cjs.__privateGet(this, _queue)[this.size - 1].priority >= options.priority) {
1087
+ chunkWZQO3EPM_cjs.__privateGet(this, _queue).push(element);
1088
+ return;
1089
+ }
1090
+ const index = lowerBound(chunkWZQO3EPM_cjs.__privateGet(this, _queue), element, (a, b) => b.priority - a.priority);
1091
+ chunkWZQO3EPM_cjs.__privateGet(this, _queue).splice(index, 0, element);
1092
+ }
1093
+ dequeue() {
1094
+ const item = chunkWZQO3EPM_cjs.__privateGet(this, _queue).shift();
1095
+ return item?.run;
1096
+ }
1097
+ filter(options) {
1098
+ return chunkWZQO3EPM_cjs.__privateGet(this, _queue).filter((element) => element.priority === options.priority).map((element) => element.run);
1099
+ }
1100
+ get size() {
1101
+ return chunkWZQO3EPM_cjs.__privateGet(this, _queue).length;
1102
+ }
1103
+ };
1104
+ _queue = new WeakMap();
1105
+
1106
+ // ../../node_modules/.pnpm/p-queue@8.0.0/node_modules/p-queue/dist/index.js
1107
+ 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;
1108
+ var PQueue = class extends import_index.default {
1109
+ // TODO: The `throwOnTimeout` option should affect the return types of `add()` and `addAll()`
1110
+ constructor(options) {
1111
+ super();
1112
+ chunkWZQO3EPM_cjs.__privateAdd(this, _doesIntervalAllowAnother);
1113
+ chunkWZQO3EPM_cjs.__privateAdd(this, _doesConcurrentAllowAnother);
1114
+ chunkWZQO3EPM_cjs.__privateAdd(this, _next);
1115
+ chunkWZQO3EPM_cjs.__privateAdd(this, _onResumeInterval);
1116
+ chunkWZQO3EPM_cjs.__privateAdd(this, _isIntervalPaused);
1117
+ chunkWZQO3EPM_cjs.__privateAdd(this, _tryToStartAnother);
1118
+ chunkWZQO3EPM_cjs.__privateAdd(this, _initializeIntervalIfNeeded);
1119
+ chunkWZQO3EPM_cjs.__privateAdd(this, _onInterval);
1120
+ /**
1121
+ Executes all queued functions until it reaches the limit.
1122
+ */
1123
+ chunkWZQO3EPM_cjs.__privateAdd(this, _processQueue);
1124
+ chunkWZQO3EPM_cjs.__privateAdd(this, _throwOnAbort);
1125
+ chunkWZQO3EPM_cjs.__privateAdd(this, _onEvent);
1126
+ chunkWZQO3EPM_cjs.__privateAdd(this, _carryoverConcurrencyCount, void 0);
1127
+ chunkWZQO3EPM_cjs.__privateAdd(this, _isIntervalIgnored, void 0);
1128
+ chunkWZQO3EPM_cjs.__privateAdd(this, _intervalCount, 0);
1129
+ chunkWZQO3EPM_cjs.__privateAdd(this, _intervalCap, void 0);
1130
+ chunkWZQO3EPM_cjs.__privateAdd(this, _interval, void 0);
1131
+ chunkWZQO3EPM_cjs.__privateAdd(this, _intervalEnd, 0);
1132
+ chunkWZQO3EPM_cjs.__privateAdd(this, _intervalId, void 0);
1133
+ chunkWZQO3EPM_cjs.__privateAdd(this, _timeoutId, void 0);
1134
+ chunkWZQO3EPM_cjs.__privateAdd(this, _queue2, void 0);
1135
+ chunkWZQO3EPM_cjs.__privateAdd(this, _queueClass, void 0);
1136
+ chunkWZQO3EPM_cjs.__privateAdd(this, _pending, 0);
1137
+ // The `!` is needed because of https://github.com/microsoft/TypeScript/issues/32194
1138
+ chunkWZQO3EPM_cjs.__privateAdd(this, _concurrency, void 0);
1139
+ chunkWZQO3EPM_cjs.__privateAdd(this, _isPaused, void 0);
1140
+ chunkWZQO3EPM_cjs.__privateAdd(this, _throwOnTimeout, void 0);
1141
+ /**
1142
+ Per-operation timeout in milliseconds. Operations fulfill once `timeout` elapses if they haven't already.
1143
+
1144
+ Applies to each future operation.
1145
+ */
1146
+ chunkWZQO3EPM_cjs.__publicField(this, "timeout");
1147
+ options = {
1148
+ carryoverConcurrencyCount: false,
1149
+ intervalCap: Number.POSITIVE_INFINITY,
1150
+ interval: 0,
1151
+ concurrency: Number.POSITIVE_INFINITY,
1152
+ autoStart: true,
1153
+ queueClass: PriorityQueue,
1154
+ ...options
1155
+ };
1156
+ if (!(typeof options.intervalCap === "number" && options.intervalCap >= 1)) {
1157
+ throw new TypeError(`Expected \`intervalCap\` to be a number from 1 and up, got \`${options.intervalCap?.toString() ?? ""}\` (${typeof options.intervalCap})`);
1158
+ }
1159
+ if (options.interval === void 0 || !(Number.isFinite(options.interval) && options.interval >= 0)) {
1160
+ throw new TypeError(`Expected \`interval\` to be a finite number >= 0, got \`${options.interval?.toString() ?? ""}\` (${typeof options.interval})`);
1161
+ }
1162
+ chunkWZQO3EPM_cjs.__privateSet(this, _carryoverConcurrencyCount, options.carryoverConcurrencyCount);
1163
+ chunkWZQO3EPM_cjs.__privateSet(this, _isIntervalIgnored, options.intervalCap === Number.POSITIVE_INFINITY || options.interval === 0);
1164
+ chunkWZQO3EPM_cjs.__privateSet(this, _intervalCap, options.intervalCap);
1165
+ chunkWZQO3EPM_cjs.__privateSet(this, _interval, options.interval);
1166
+ chunkWZQO3EPM_cjs.__privateSet(this, _queue2, new options.queueClass());
1167
+ chunkWZQO3EPM_cjs.__privateSet(this, _queueClass, options.queueClass);
1168
+ this.concurrency = options.concurrency;
1169
+ this.timeout = options.timeout;
1170
+ chunkWZQO3EPM_cjs.__privateSet(this, _throwOnTimeout, options.throwOnTimeout === true);
1171
+ chunkWZQO3EPM_cjs.__privateSet(this, _isPaused, options.autoStart === false);
1172
+ }
1173
+ get concurrency() {
1174
+ return chunkWZQO3EPM_cjs.__privateGet(this, _concurrency);
1175
+ }
1176
+ set concurrency(newConcurrency) {
1177
+ if (!(typeof newConcurrency === "number" && newConcurrency >= 1)) {
1178
+ throw new TypeError(`Expected \`concurrency\` to be a number from 1 and up, got \`${newConcurrency}\` (${typeof newConcurrency})`);
1179
+ }
1180
+ chunkWZQO3EPM_cjs.__privateSet(this, _concurrency, newConcurrency);
1181
+ chunkWZQO3EPM_cjs.__privateMethod(this, _processQueue, processQueue_fn).call(this);
1182
+ }
1183
+ async add(function_, options = {}) {
1184
+ options = {
1185
+ timeout: this.timeout,
1186
+ throwOnTimeout: chunkWZQO3EPM_cjs.__privateGet(this, _throwOnTimeout),
1187
+ ...options
1188
+ };
1189
+ return new Promise((resolve2, reject) => {
1190
+ chunkWZQO3EPM_cjs.__privateGet(this, _queue2).enqueue(async () => {
1191
+ chunkWZQO3EPM_cjs.__privateWrapper(this, _pending)._++;
1192
+ chunkWZQO3EPM_cjs.__privateWrapper(this, _intervalCount)._++;
1193
+ try {
1194
+ options.signal?.throwIfAborted();
1195
+ let operation = function_({ signal: options.signal });
1196
+ if (options.timeout) {
1197
+ operation = pTimeout(Promise.resolve(operation), { milliseconds: options.timeout });
1198
+ }
1199
+ if (options.signal) {
1200
+ operation = Promise.race([operation, chunkWZQO3EPM_cjs.__privateMethod(this, _throwOnAbort, throwOnAbort_fn).call(this, options.signal)]);
1201
+ }
1202
+ const result = await operation;
1203
+ resolve2(result);
1204
+ this.emit("completed", result);
1205
+ } catch (error) {
1206
+ if (error instanceof TimeoutError && !options.throwOnTimeout) {
1207
+ resolve2();
1208
+ return;
1209
+ }
1210
+ reject(error);
1211
+ this.emit("error", error);
1212
+ } finally {
1213
+ chunkWZQO3EPM_cjs.__privateMethod(this, _next, next_fn).call(this);
1214
+ }
1215
+ }, options);
1216
+ this.emit("add");
1217
+ chunkWZQO3EPM_cjs.__privateMethod(this, _tryToStartAnother, tryToStartAnother_fn).call(this);
1218
+ });
1219
+ }
1220
+ async addAll(functions, options) {
1221
+ return Promise.all(functions.map(async (function_) => this.add(function_, options)));
1222
+ }
1223
+ /**
1224
+ 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.)
1225
+ */
1226
+ start() {
1227
+ if (!chunkWZQO3EPM_cjs.__privateGet(this, _isPaused)) {
1228
+ return this;
1229
+ }
1230
+ chunkWZQO3EPM_cjs.__privateSet(this, _isPaused, false);
1231
+ chunkWZQO3EPM_cjs.__privateMethod(this, _processQueue, processQueue_fn).call(this);
202
1232
  return this;
203
1233
  }
204
1234
  /**
205
- * Convert Swagger path to URLPath(syntax of Express)
206
- * @example /pet/{petId} => /pet/:petId
207
- */
208
- get URL() {
209
- return this.toURLPath();
1235
+ Put queue execution on hold.
1236
+ */
1237
+ pause() {
1238
+ chunkWZQO3EPM_cjs.__privateSet(this, _isPaused, true);
210
1239
  }
211
- get isURL() {
212
- try {
213
- const url = new URL(this.path);
214
- if (url?.href) {
215
- return true;
216
- }
217
- } catch (error) {
218
- return false;
1240
+ /**
1241
+ Clear the queue.
1242
+ */
1243
+ clear() {
1244
+ chunkWZQO3EPM_cjs.__privateSet(this, _queue2, new (chunkWZQO3EPM_cjs.__privateGet(this, _queueClass))());
1245
+ }
1246
+ /**
1247
+ Can be called multiple times. Useful if you for example add additional items at a later time.
1248
+
1249
+ @returns A promise that settles when the queue becomes empty.
1250
+ */
1251
+ async onEmpty() {
1252
+ if (chunkWZQO3EPM_cjs.__privateGet(this, _queue2).size === 0) {
1253
+ return;
219
1254
  }
220
- return false;
1255
+ await chunkWZQO3EPM_cjs.__privateMethod(this, _onEvent, onEvent_fn).call(this, "empty");
221
1256
  }
222
1257
  /**
223
- * Convert Swagger path to template literals/ template strings(camelcase)
224
- * @example /pet/{petId} => `/pet/${petId}`
225
- * @example /account/monetary-accountID => `/account/${monetaryAccountId}`
226
- * @example /account/userID => `/account/${userId}`
227
- */
228
- get template() {
229
- return this.toTemplateString();
1258
+ @returns A promise that settles when the queue size is less than the given limit: `queue.size < limit`.
1259
+
1260
+ If you want to avoid having the queue grow beyond a certain size you can `await queue.onSizeLessThan()` before adding a new item.
1261
+
1262
+ 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.
1263
+ */
1264
+ async onSizeLessThan(limit) {
1265
+ if (chunkWZQO3EPM_cjs.__privateGet(this, _queue2).size < limit) {
1266
+ return;
1267
+ }
1268
+ await chunkWZQO3EPM_cjs.__privateMethod(this, _onEvent, onEvent_fn).call(this, "next", () => chunkWZQO3EPM_cjs.__privateGet(this, _queue2).size < limit);
230
1269
  }
231
- get object() {
232
- return this.toObject();
1270
+ /**
1271
+ 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.
1272
+
1273
+ @returns A promise that settles when the queue becomes empty, and all promises have completed; `queue.size === 0 && queue.pending === 0`.
1274
+ */
1275
+ async onIdle() {
1276
+ if (chunkWZQO3EPM_cjs.__privateGet(this, _pending) === 0 && chunkWZQO3EPM_cjs.__privateGet(this, _queue2).size === 0) {
1277
+ return;
1278
+ }
1279
+ await chunkWZQO3EPM_cjs.__privateMethod(this, _onEvent, onEvent_fn).call(this, "idle");
1280
+ }
1281
+ /**
1282
+ Size of the queue, the number of queued items waiting to run.
1283
+ */
1284
+ get size() {
1285
+ return chunkWZQO3EPM_cjs.__privateGet(this, _queue2).size;
1286
+ }
1287
+ /**
1288
+ Size of the queue, filtered by the given options.
1289
+
1290
+ For example, this can be used to find the number of items remaining in the queue with a specific priority level.
1291
+ */
1292
+ sizeBy(options) {
1293
+ return chunkWZQO3EPM_cjs.__privateGet(this, _queue2).filter(options).length;
1294
+ }
1295
+ /**
1296
+ Number of running items (no longer in the queue).
1297
+ */
1298
+ get pending() {
1299
+ return chunkWZQO3EPM_cjs.__privateGet(this, _pending);
233
1300
  }
234
- get params() {
235
- return this.getParams();
1301
+ /**
1302
+ Whether the queue is currently paused.
1303
+ */
1304
+ get isPaused() {
1305
+ return chunkWZQO3EPM_cjs.__privateGet(this, _isPaused);
236
1306
  }
237
- toObject({ type = "path", replacer, stringify } = {}) {
238
- const object = {
239
- url: type === "path" ? this.toURLPath() : this.toTemplateString(replacer),
240
- params: this.getParams()
241
- };
242
- if (stringify) {
243
- if (type !== "template") {
244
- throw new Error("Type should be `template` when using stringiyf");
1307
+ };
1308
+ _carryoverConcurrencyCount = new WeakMap();
1309
+ _isIntervalIgnored = new WeakMap();
1310
+ _intervalCount = new WeakMap();
1311
+ _intervalCap = new WeakMap();
1312
+ _interval = new WeakMap();
1313
+ _intervalEnd = new WeakMap();
1314
+ _intervalId = new WeakMap();
1315
+ _timeoutId = new WeakMap();
1316
+ _queue2 = new WeakMap();
1317
+ _queueClass = new WeakMap();
1318
+ _pending = new WeakMap();
1319
+ _concurrency = new WeakMap();
1320
+ _isPaused = new WeakMap();
1321
+ _throwOnTimeout = new WeakMap();
1322
+ _doesIntervalAllowAnother = new WeakSet();
1323
+ doesIntervalAllowAnother_get = function() {
1324
+ return chunkWZQO3EPM_cjs.__privateGet(this, _isIntervalIgnored) || chunkWZQO3EPM_cjs.__privateGet(this, _intervalCount) < chunkWZQO3EPM_cjs.__privateGet(this, _intervalCap);
1325
+ };
1326
+ _doesConcurrentAllowAnother = new WeakSet();
1327
+ doesConcurrentAllowAnother_get = function() {
1328
+ return chunkWZQO3EPM_cjs.__privateGet(this, _pending) < chunkWZQO3EPM_cjs.__privateGet(this, _concurrency);
1329
+ };
1330
+ _next = new WeakSet();
1331
+ next_fn = function() {
1332
+ chunkWZQO3EPM_cjs.__privateWrapper(this, _pending)._--;
1333
+ chunkWZQO3EPM_cjs.__privateMethod(this, _tryToStartAnother, tryToStartAnother_fn).call(this);
1334
+ this.emit("next");
1335
+ };
1336
+ _onResumeInterval = new WeakSet();
1337
+ onResumeInterval_fn = function() {
1338
+ chunkWZQO3EPM_cjs.__privateMethod(this, _onInterval, onInterval_fn).call(this);
1339
+ chunkWZQO3EPM_cjs.__privateMethod(this, _initializeIntervalIfNeeded, initializeIntervalIfNeeded_fn).call(this);
1340
+ chunkWZQO3EPM_cjs.__privateSet(this, _timeoutId, void 0);
1341
+ };
1342
+ _isIntervalPaused = new WeakSet();
1343
+ isIntervalPaused_get = function() {
1344
+ const now = Date.now();
1345
+ if (chunkWZQO3EPM_cjs.__privateGet(this, _intervalId) === void 0) {
1346
+ const delay = chunkWZQO3EPM_cjs.__privateGet(this, _intervalEnd) - now;
1347
+ if (delay < 0) {
1348
+ chunkWZQO3EPM_cjs.__privateSet(this, _intervalCount, chunkWZQO3EPM_cjs.__privateGet(this, _carryoverConcurrencyCount) ? chunkWZQO3EPM_cjs.__privateGet(this, _pending) : 0);
1349
+ } else {
1350
+ if (chunkWZQO3EPM_cjs.__privateGet(this, _timeoutId) === void 0) {
1351
+ chunkWZQO3EPM_cjs.__privateSet(this, _timeoutId, setTimeout(() => {
1352
+ chunkWZQO3EPM_cjs.__privateMethod(this, _onResumeInterval, onResumeInterval_fn).call(this);
1353
+ }, delay));
245
1354
  }
246
- return JSON.stringify(object).replaceAll("'", "").replaceAll(`"`, "");
1355
+ return true;
247
1356
  }
248
- return object;
249
1357
  }
250
- /**
251
- * Convert Swagger path to template literals/ template strings(camelcase)
252
- * @example /pet/{petId} => `/pet/${petId}`
253
- * @example /account/monetary-accountID => `/account/${monetaryAccountId}`
254
- * @example /account/userID => `/account/${userId}`
255
- */
256
- toTemplateString(replacer) {
257
- const regex = /{(\w|-)*}/g;
258
- const found = this.path.match(regex);
259
- let newPath = this.path.replaceAll("{", "${");
260
- if (found) {
261
- newPath = found.reduce((prev, curr) => {
262
- const pathParam = replacer ? replacer(changeCase.camelCase(curr, { delimiter: "", transform: changeCase.camelCaseTransformMerge })) : changeCase.camelCase(curr, { delimiter: "", transform: changeCase.camelCaseTransformMerge });
263
- const replacement = `\${${pathParam}}`;
264
- return prev.replace(curr, replacement);
265
- }, this.path);
266
- }
267
- return `\`${newPath}\``;
268
- }
269
- getParams(replacer) {
270
- const regex = /{(\w|-)*}/g;
271
- const found = this.path.match(regex);
272
- if (!found) {
273
- return void 0;
1358
+ return false;
1359
+ };
1360
+ _tryToStartAnother = new WeakSet();
1361
+ tryToStartAnother_fn = function() {
1362
+ if (chunkWZQO3EPM_cjs.__privateGet(this, _queue2).size === 0) {
1363
+ if (chunkWZQO3EPM_cjs.__privateGet(this, _intervalId)) {
1364
+ clearInterval(chunkWZQO3EPM_cjs.__privateGet(this, _intervalId));
274
1365
  }
275
- const params = {};
276
- found.forEach((item) => {
277
- item = item.replaceAll("{", "").replaceAll("}", "");
278
- const pathParam = replacer ? replacer(changeCase.camelCase(item, { delimiter: "", transform: changeCase.camelCaseTransformMerge })) : changeCase.camelCase(item, { delimiter: "", transform: changeCase.camelCaseTransformMerge });
279
- params[pathParam] = pathParam;
280
- }, this.path);
281
- return params;
282
- }
283
- /**
284
- * Convert Swagger path to URLPath(syntax of Express)
285
- * @example /pet/{petId} => /pet/:petId
286
- */
287
- toURLPath() {
288
- return this.path.replaceAll("{", ":").replaceAll("}", "");
1366
+ chunkWZQO3EPM_cjs.__privateSet(this, _intervalId, void 0);
1367
+ this.emit("empty");
1368
+ if (chunkWZQO3EPM_cjs.__privateGet(this, _pending) === 0) {
1369
+ this.emit("idle");
1370
+ }
1371
+ return false;
289
1372
  }
290
- };
291
-
292
- // src/config.ts
293
- function defineConfig(options) {
294
- return options;
295
- }
296
- function isInputPath(result) {
297
- return !!result && "path" in result;
298
- }
299
-
300
- // src/utils/timeout.ts
301
- async function timeout(ms) {
302
- return new Promise((resolve2) => {
303
- setTimeout(() => {
304
- resolve2(true);
305
- }, ms);
306
- });
307
- }
308
-
309
- // src/utils/transformers/combineCodes.ts
310
- function combineCodes(codes) {
311
- return codes.join("\n");
312
- }
313
-
314
- // src/utils/transformers/createJSDocBlockText.ts
315
- function createJSDocBlockText({ comments }) {
316
- const filteredComments = comments.filter(Boolean);
317
- if (!filteredComments.length) {
318
- return "";
319
- }
320
- return `/**
321
- * ${filteredComments.join("\n * ")}
322
- */`;
323
- }
324
-
325
- // src/utils/transformers/escape.ts
326
- function escape(text) {
327
- return text ? text.replaceAll("`", "\\`") : "";
328
- }
329
- function jsStringEscape(input) {
330
- return `${input}`.replace(/["'\\\n\r\u2028\u2029]/g, (character) => {
331
- switch (character) {
332
- case '"':
333
- case "'":
334
- case "\\":
335
- return "\\" + character;
336
- case "\n":
337
- return "\\n";
338
- case "\r":
339
- return "\\r";
340
- case "\u2028":
341
- return "\\u2028";
342
- case "\u2029":
343
- return "\\u2029";
344
- default:
345
- return "";
1373
+ if (!chunkWZQO3EPM_cjs.__privateGet(this, _isPaused)) {
1374
+ const canInitializeInterval = !chunkWZQO3EPM_cjs.__privateGet(this, _isIntervalPaused, isIntervalPaused_get);
1375
+ if (chunkWZQO3EPM_cjs.__privateGet(this, _doesIntervalAllowAnother, doesIntervalAllowAnother_get) && chunkWZQO3EPM_cjs.__privateGet(this, _doesConcurrentAllowAnother, doesConcurrentAllowAnother_get)) {
1376
+ const job = chunkWZQO3EPM_cjs.__privateGet(this, _queue2).dequeue();
1377
+ if (!job) {
1378
+ return false;
1379
+ }
1380
+ this.emit("active");
1381
+ job();
1382
+ if (canInitializeInterval) {
1383
+ chunkWZQO3EPM_cjs.__privateMethod(this, _initializeIntervalIfNeeded, initializeIntervalIfNeeded_fn).call(this);
1384
+ }
1385
+ return true;
346
1386
  }
347
- });
348
- }
349
-
350
- // src/utils/transformers/indent.ts
351
- function createIndent(size) {
352
- return Array.from({ length: size + 1 }).join(" ");
353
- }
354
-
355
- // src/utils/transformers/nameSorter.ts
356
- function nameSorter(a, b) {
357
- if (a.name < b.name) {
358
- return -1;
359
1387
  }
360
- if (a.name > b.name) {
361
- return 1;
1388
+ return false;
1389
+ };
1390
+ _initializeIntervalIfNeeded = new WeakSet();
1391
+ initializeIntervalIfNeeded_fn = function() {
1392
+ if (chunkWZQO3EPM_cjs.__privateGet(this, _isIntervalIgnored) || chunkWZQO3EPM_cjs.__privateGet(this, _intervalId) !== void 0) {
1393
+ return;
362
1394
  }
363
- return 0;
364
- }
365
-
366
- // src/utils/transformers/searchAndReplace.ts
367
- function searchAndReplace(options) {
368
- const { text, replaceBy, prefix = "", key } = options;
369
- const searchValues = options.searchValues?.(prefix, key) || [
370
- `${prefix}["${key}"]`,
371
- `${prefix}['${key}']`,
372
- `${prefix}[\`${key}\`]`,
373
- `${prefix}"${key}"`,
374
- `${prefix}'${key}'`,
375
- `${prefix}\`${key}\``,
376
- new RegExp(`${prefix}${key}`, "g")
377
- ];
378
- return searchValues.reduce((prev, searchValue) => {
379
- return prev.toString().replaceAll(searchValue, replaceBy);
380
- }, text);
381
- }
382
-
383
- // src/utils/transformers/transformReservedWord.ts
384
- var reservedWords = [
385
- "abstract",
386
- "arguments",
387
- "boolean",
388
- "break",
389
- "byte",
390
- "case",
391
- "catch",
392
- "char",
393
- "class",
394
- "const",
395
- "continue",
396
- "debugger",
397
- "default",
398
- "delete",
399
- "do",
400
- "double",
401
- "else",
402
- "enum",
403
- "eval",
404
- "export",
405
- "extends",
406
- "false",
407
- "final",
408
- "finally",
409
- "float",
410
- "for",
411
- "function",
412
- "goto",
413
- "if",
414
- "implements",
415
- "import",
416
- "in",
417
- "instanceof",
418
- "int",
419
- "interface",
420
- "let",
421
- "long",
422
- "native",
423
- "new",
424
- "null",
425
- "package",
426
- "private",
427
- "protected",
428
- "public",
429
- "return",
430
- "short",
431
- "static",
432
- "super",
433
- "switch",
434
- "synchronized",
435
- "this",
436
- "throw",
437
- "throws",
438
- "transient",
439
- "true",
440
- "try",
441
- "typeof",
442
- "var",
443
- "void",
444
- "volatile",
445
- "while",
446
- "with",
447
- "yield",
448
- "Array",
449
- "Date",
450
- "eval",
451
- "function",
452
- "hasOwnProperty",
453
- "Infinity",
454
- "isFinite",
455
- "isNaN",
456
- "isPrototypeOf",
457
- "length",
458
- "Math",
459
- "name",
460
- "NaN",
461
- "Number",
462
- "Object",
463
- "prototype",
464
- "String",
465
- "toString",
466
- "undefined",
467
- "valueOf"
468
- ];
469
- function transformReservedWord(word) {
470
- if (word && reservedWords.includes(word) || word?.match(/^\d/)) {
471
- return `_${word}`;
472
- }
473
- return word;
474
- }
475
-
476
- // src/utils/transformers/index.ts
477
- var transformers = {
478
- combineCodes,
479
- escape,
480
- jsStringEscape,
481
- createIndent,
482
- transformReservedWord,
483
- nameSorter,
484
- searchAndReplace,
485
- JSDoc: {
486
- createJSDocBlockText
1395
+ chunkWZQO3EPM_cjs.__privateSet(this, _intervalId, setInterval(() => {
1396
+ chunkWZQO3EPM_cjs.__privateMethod(this, _onInterval, onInterval_fn).call(this);
1397
+ }, chunkWZQO3EPM_cjs.__privateGet(this, _interval)));
1398
+ chunkWZQO3EPM_cjs.__privateSet(this, _intervalEnd, Date.now() + chunkWZQO3EPM_cjs.__privateGet(this, _interval));
1399
+ };
1400
+ _onInterval = new WeakSet();
1401
+ onInterval_fn = function() {
1402
+ if (chunkWZQO3EPM_cjs.__privateGet(this, _intervalCount) === 0 && chunkWZQO3EPM_cjs.__privateGet(this, _pending) === 0 && chunkWZQO3EPM_cjs.__privateGet(this, _intervalId)) {
1403
+ clearInterval(chunkWZQO3EPM_cjs.__privateGet(this, _intervalId));
1404
+ chunkWZQO3EPM_cjs.__privateSet(this, _intervalId, void 0);
1405
+ }
1406
+ chunkWZQO3EPM_cjs.__privateSet(this, _intervalCount, chunkWZQO3EPM_cjs.__privateGet(this, _carryoverConcurrencyCount) ? chunkWZQO3EPM_cjs.__privateGet(this, _pending) : 0);
1407
+ chunkWZQO3EPM_cjs.__privateMethod(this, _processQueue, processQueue_fn).call(this);
1408
+ };
1409
+ _processQueue = new WeakSet();
1410
+ processQueue_fn = function() {
1411
+ while (chunkWZQO3EPM_cjs.__privateMethod(this, _tryToStartAnother, tryToStartAnother_fn).call(this)) {
487
1412
  }
488
1413
  };
489
- async function saveCreateDirectory(path5) {
490
- const passedPath = path4.dirname(path4.resolve(path5));
491
- await fs2__default.default.mkdir(passedPath, { recursive: true });
492
- }
493
- var writer = jsRuntime.switcher(
494
- {
495
- node: async (path5, data) => {
496
- try {
497
- await fs2__default.default.stat(path4.resolve(path5));
498
- const oldContent = await fs2__default.default.readFile(path4.resolve(path5), { encoding: "utf-8" });
499
- if (oldContent?.toString() === data?.toString()) {
500
- return;
501
- }
502
- } catch (_err) {
503
- }
504
- await saveCreateDirectory(path5);
505
- await fs2__default.default.writeFile(path4.resolve(path5), data, { encoding: "utf-8" });
506
- const savedData = await fs2__default.default.readFile(path4.resolve(path5), { encoding: "utf-8" });
507
- if (savedData?.toString() !== data?.toString()) {
508
- throw new Error(`Sanity check failed for ${path5}
509
-
510
- Data[${data.length}]:
511
- ${data}
512
-
513
- Saved[${savedData.length}]:
514
- ${savedData}
515
- `);
1414
+ _throwOnAbort = new WeakSet();
1415
+ throwOnAbort_fn = async function(signal) {
1416
+ return new Promise((_resolve, reject) => {
1417
+ signal.addEventListener("abort", () => {
1418
+ reject(signal.reason);
1419
+ }, { once: true });
1420
+ });
1421
+ };
1422
+ _onEvent = new WeakSet();
1423
+ onEvent_fn = async function(event, filter) {
1424
+ return new Promise((resolve2) => {
1425
+ const listener = () => {
1426
+ if (filter && !filter()) {
1427
+ return;
516
1428
  }
517
- return savedData;
518
- },
519
- bun: async (path5, data) => {
520
- try {
521
- await saveCreateDirectory(path5);
522
- await Bun.write(path4.resolve(path5), data);
523
- const file = Bun.file(path4.resolve(path5));
524
- const savedData = await file.text();
525
- if (savedData?.toString() !== data?.toString()) {
526
- throw new Error(`Sanity check failed for ${path5}
1429
+ this.off(event, listener);
1430
+ resolve2();
1431
+ };
1432
+ this.on(event, listener);
1433
+ });
1434
+ };
527
1435
 
528
- Data[${data.length}]:
529
- ${data}
1436
+ // src/BarrelManager.ts
1437
+ chunkWZQO3EPM_cjs.init_cjs_shims();
530
1438
 
531
- Saved[${savedData.length}]:
532
- ${savedData}
533
- `);
534
- }
535
- return savedData;
536
- } catch (e) {
537
- console.log(e, path4.resolve(path5));
538
- }
539
- }
540
- },
541
- "node"
542
- );
543
- async function write(data, path5) {
544
- if (data.trim() === "") {
545
- return void 0;
546
- }
547
- return writer(path5, data.trim());
548
- }
1439
+ // src/utils/TreeNode.ts
1440
+ chunkWZQO3EPM_cjs.init_cjs_shims();
549
1441
  var TreeNode = class _TreeNode {
550
1442
  constructor(data, parent) {
551
1443
  this.children = [];
@@ -636,78 +1528,67 @@ var TreeNode = class _TreeNode {
636
1528
  var _options;
637
1529
  var BarrelManager = class {
638
1530
  constructor(options = {}) {
639
- __privateAdd(this, _options, {});
640
- __privateSet(this, _options, options);
1531
+ chunkWZQO3EPM_cjs.__privateAdd(this, _options, void 0);
1532
+ chunkWZQO3EPM_cjs.__privateSet(this, _options, options);
641
1533
  return this;
642
1534
  }
643
- getIndexes(root, extName) {
644
- const { treeNode = {}, isTypeOnly, filter, map, output, includeExt } = __privateGet(this, _options);
645
- const extMapper = {
646
- ".ts": {
647
- extensions: /\.ts/,
648
- exclude: [/schemas/, /json/]
649
- },
650
- ".json": {
651
- extensions: /\.json/,
652
- exclude: []
653
- }
654
- };
655
- const tree = TreeNode.build(root, { ...extMapper[extName] || {}, ...treeNode });
1535
+ getIndexes(pathToBuild) {
1536
+ const { treeNode = {}, isTypeOnly, extName } = chunkWZQO3EPM_cjs.__privateGet(this, _options);
1537
+ const tree = TreeNode.build(pathToBuild, treeNode);
656
1538
  if (!tree) {
657
1539
  return null;
658
1540
  }
659
- const fileReducer = (files2, currentTree) => {
660
- if (!currentTree.children) {
1541
+ const fileReducer = (files, treeNode2) => {
1542
+ if (!treeNode2.children) {
661
1543
  return [];
662
1544
  }
663
- if (currentTree.children?.length > 1) {
664
- const indexPath = path4__default.default.resolve(currentTree.data.path, "index.ts");
665
- const exports = currentTree.children.filter(Boolean).map((file) => {
666
- const importPath = file.data.type === "directory" ? `./${file.data.name}` : `./${file.data.name.replace(/\.[^.]*$/, "")}`;
667
- if (importPath.includes("index") && indexPath.includes("index")) {
1545
+ if (treeNode2.children.length > 1) {
1546
+ const indexPath = path4__default.default.resolve(treeNode2.data.path, "index.ts");
1547
+ const exports = treeNode2.children.filter(Boolean).map((file) => {
1548
+ const importPath = file.data.type === "directory" ? `./${file.data.name}/index` : `./${chunk5TK7TMV6_cjs.trimExtName(file.data.name)}`;
1549
+ if (importPath.endsWith("index") && file.data.type === "file") {
668
1550
  return void 0;
669
1551
  }
670
1552
  return {
671
- path: includeExt ? file.data.type === "directory" ? `${importPath}/index${extName}` : `${importPath}${extName}` : importPath,
1553
+ path: extName ? `${importPath}${extName}` : importPath,
672
1554
  isTypeOnly
673
1555
  };
674
1556
  }).filter(Boolean);
675
- files2.push({
1557
+ files.push({
676
1558
  path: indexPath,
677
1559
  baseName: "index.ts",
678
1560
  source: "",
679
- exports: output ? exports?.filter((item) => {
680
- return item.path.endsWith(output.replace(/\.[^.]*$/, ""));
681
- }) : exports
1561
+ exports,
1562
+ meta: {
1563
+ treeNode: treeNode2
1564
+ }
682
1565
  });
683
- } else {
684
- currentTree.children?.forEach((child) => {
685
- const indexPath = path4__default.default.resolve(currentTree.data.path, "index.ts");
686
- const importPath = child.data.type === "directory" ? `./${child.data.name}` : `./${child.data.name.replace(/\.[^.]*$/, "")}`;
687
- const exports = [
688
- {
689
- path: includeExt ? child.data.type === "directory" ? `${importPath}/index${extName}` : `${importPath}${extName}` : importPath,
690
- isTypeOnly
691
- }
692
- ];
693
- files2.push({
694
- path: indexPath,
695
- baseName: "index.ts",
696
- source: "",
697
- exports: output ? exports?.filter((item) => {
698
- return item.path.endsWith(output.replace(/\.[^.]*$/, ""));
699
- }) : exports
700
- });
1566
+ } else if (treeNode2.children.length === 1) {
1567
+ const [treeNodeChild] = treeNode2.children;
1568
+ const indexPath = path4__default.default.resolve(treeNode2.data.path, "index.ts");
1569
+ const importPath = treeNodeChild.data.type === "directory" ? `./${treeNodeChild.data.name}/index` : `./${chunk5TK7TMV6_cjs.trimExtName(treeNodeChild.data.name)}`;
1570
+ const exports = [
1571
+ {
1572
+ path: extName ? `${importPath}${extName}` : importPath,
1573
+ isTypeOnly
1574
+ }
1575
+ ];
1576
+ files.push({
1577
+ path: indexPath,
1578
+ baseName: "index.ts",
1579
+ source: "",
1580
+ exports,
1581
+ meta: {
1582
+ treeNode: treeNode2
1583
+ }
701
1584
  });
702
1585
  }
703
- currentTree.children.forEach((childItem) => {
704
- fileReducer(files2, childItem);
1586
+ treeNode2.children.forEach((childItem) => {
1587
+ fileReducer(files, childItem);
705
1588
  });
706
- return files2;
1589
+ return files;
707
1590
  };
708
- const files = fileReducer([], tree).reverse();
709
- const filteredFiles = filter ? files.filter(filter) : files;
710
- return map ? filteredFiles.map(map) : filteredFiles;
1591
+ return fileReducer([], tree).reverse();
711
1592
  }
712
1593
  };
713
1594
  _options = new WeakMap();
@@ -716,44 +1597,34 @@ _options = new WeakMap();
716
1597
  exports.KubbFile = void 0;
717
1598
  ((KubbFile2) => {
718
1599
  })(exports.KubbFile || (exports.KubbFile = {}));
719
- var _cache, _task, _isWriting, _timeout, _queue, _validate, validate_fn, _add, add_fn, _addOrAppend, addOrAppend_fn;
1600
+ var _cache, _task, _queue3, _add, add_fn, _addOrAppend, addOrAppend_fn;
720
1601
  var _FileManager = class _FileManager {
721
- constructor(options) {
722
- __privateAdd(this, _validate);
723
- __privateAdd(this, _add);
724
- __privateAdd(this, _addOrAppend);
725
- __privateAdd(this, _cache, /* @__PURE__ */ new Map());
726
- __privateAdd(this, _task, void 0);
727
- __privateAdd(this, _isWriting, false);
728
- /**
729
- * Timeout between writes
730
- */
731
- __privateAdd(this, _timeout, 0);
732
- __privateAdd(this, _queue, void 0);
733
- if (options) {
734
- __privateSet(this, _task, options.task);
735
- __privateSet(this, _queue, options.queue);
736
- __privateSet(this, _timeout, options.timeout || 0);
737
- }
1602
+ constructor({ task = async (file) => file, queue = new PQueue() } = {}) {
1603
+ chunkWZQO3EPM_cjs.__privateAdd(this, _add);
1604
+ chunkWZQO3EPM_cjs.__privateAdd(this, _addOrAppend);
1605
+ chunkWZQO3EPM_cjs.__privateAdd(this, _cache, /* @__PURE__ */ new Map());
1606
+ chunkWZQO3EPM_cjs.__privateAdd(this, _task, void 0);
1607
+ chunkWZQO3EPM_cjs.__privateAdd(this, _queue3, void 0);
1608
+ chunkWZQO3EPM_cjs.__privateSet(this, _task, task);
1609
+ chunkWZQO3EPM_cjs.__privateSet(this, _queue3, queue);
738
1610
  return this;
739
1611
  }
740
1612
  get files() {
741
1613
  const files = [];
742
- __privateGet(this, _cache).forEach((item) => {
1614
+ chunkWZQO3EPM_cjs.__privateGet(this, _cache).forEach((item) => {
743
1615
  files.push(...item.flat(1));
744
1616
  });
745
1617
  return files;
746
1618
  }
747
1619
  get isExecuting() {
748
- return __privateGet(this, _queue)?.hasJobs ?? __privateGet(this, _isWriting) ?? false;
1620
+ return chunkWZQO3EPM_cjs.__privateGet(this, _queue3).size !== 0 && chunkWZQO3EPM_cjs.__privateGet(this, _queue3).pending !== 0;
749
1621
  }
750
1622
  async add(...files) {
751
- const promises = files.map((file) => {
752
- __privateMethod(this, _validate, validate_fn).call(this, file);
1623
+ const promises = combineFiles(files).map((file) => {
753
1624
  if (file.override) {
754
- return __privateMethod(this, _add, add_fn).call(this, file);
1625
+ return chunkWZQO3EPM_cjs.__privateMethod(this, _add, add_fn).call(this, file);
755
1626
  }
756
- return __privateMethod(this, _addOrAppend, addOrAppend_fn).call(this, file);
1627
+ return chunkWZQO3EPM_cjs.__privateMethod(this, _addOrAppend, addOrAppend_fn).call(this, file);
757
1628
  });
758
1629
  const resolvedFiles = await Promise.all(promises);
759
1630
  if (files.length > 1) {
@@ -761,15 +1632,50 @@ var _FileManager = class _FileManager {
761
1632
  }
762
1633
  return resolvedFiles[0];
763
1634
  }
764
- async addIndexes({ root, extName = ".ts", meta, options = {} }) {
765
- const barrelManager = new BarrelManager(options);
766
- const files = barrelManager.getIndexes(root, extName);
1635
+ async addIndexes({ root, output, meta, options = {} }) {
1636
+ const { exportType = "barrel" } = output;
1637
+ if (!exportType) {
1638
+ return void 0;
1639
+ }
1640
+ const exportPath = output.path.startsWith("./") ? chunk5TK7TMV6_cjs.trimExtName(output.path) : `./${chunk5TK7TMV6_cjs.trimExtName(output.path)}`;
1641
+ const mode = _FileManager.getMode(output.path);
1642
+ const barrelManager = new BarrelManager({ extName: output.extName, ...options });
1643
+ const files = barrelManager.getIndexes(path4.resolve(root, output.path));
1644
+ function getPath() {
1645
+ if (output.extName) {
1646
+ if (mode === "directory") {
1647
+ return `${exportPath}/index${output.extName}`;
1648
+ }
1649
+ return `${exportPath}${output.extName}`;
1650
+ }
1651
+ return exportPath;
1652
+ }
767
1653
  if (!files) {
768
1654
  return void 0;
769
1655
  }
1656
+ const rootFile = {
1657
+ path: path4.resolve(root, "index.ts"),
1658
+ baseName: "index.ts",
1659
+ source: "",
1660
+ exports: [
1661
+ output.exportAs ? {
1662
+ name: output.exportAs,
1663
+ asAlias: true,
1664
+ path: getPath(),
1665
+ isTypeOnly: options.isTypeOnly
1666
+ } : {
1667
+ path: getPath(),
1668
+ isTypeOnly: options.isTypeOnly
1669
+ }
1670
+ ]
1671
+ };
1672
+ await chunkWZQO3EPM_cjs.__privateMethod(this, _addOrAppend, addOrAppend_fn).call(this, {
1673
+ ...rootFile,
1674
+ meta: meta ? meta : rootFile.meta
1675
+ });
770
1676
  return await Promise.all(
771
1677
  files.map((file) => {
772
- return __privateMethod(this, _addOrAppend, addOrAppend_fn).call(this, {
1678
+ return chunkWZQO3EPM_cjs.__privateMethod(this, _addOrAppend, addOrAppend_fn).call(this, {
773
1679
  ...file,
774
1680
  meta: meta ? meta : file.meta
775
1681
  });
@@ -778,74 +1684,33 @@ var _FileManager = class _FileManager {
778
1684
  }
779
1685
  getCacheByUUID(UUID) {
780
1686
  let cache;
781
- __privateGet(this, _cache).forEach((files) => {
1687
+ chunkWZQO3EPM_cjs.__privateGet(this, _cache).forEach((files) => {
782
1688
  cache = files.find((item) => item.id === UUID);
783
1689
  });
784
1690
  return cache;
785
1691
  }
786
1692
  get(path5) {
787
- return __privateGet(this, _cache).get(path5);
1693
+ return chunkWZQO3EPM_cjs.__privateGet(this, _cache).get(path5);
788
1694
  }
789
1695
  remove(path5) {
790
1696
  const cacheItem = this.get(path5);
791
1697
  if (!cacheItem) {
792
1698
  return;
793
1699
  }
794
- __privateGet(this, _cache).delete(path5);
1700
+ chunkWZQO3EPM_cjs.__privateGet(this, _cache).delete(path5);
795
1701
  }
796
1702
  async write(...params) {
797
- if (!__privateGet(this, _isWriting)) {
798
- __privateSet(this, _isWriting, true);
799
- const text = await write(...params);
800
- __privateSet(this, _isWriting, false);
801
- return text;
802
- }
803
- await timeout(__privateGet(this, _timeout));
804
- return this.write(...params);
1703
+ return chunkE3ANGQ5N_cjs.write(...params);
805
1704
  }
806
1705
  async read(...params) {
807
- return read(...params);
1706
+ return chunkW2FP7ZWW_cjs.read(...params);
808
1707
  }
809
1708
  // statics
810
1709
  static getSource(file) {
811
- if (!_FileManager.isExtensionAllowed(file.baseName)) {
812
- return file.source;
813
- }
814
- const exports = file.exports ? combineExports(file.exports) : [];
815
- const imports = file.imports ? combineImports(file.imports, exports, file.source) : [];
816
- const importNodes = imports.map((item) => factory__namespace.createImportDeclaration({ name: item.name, path: item.path, isTypeOnly: item.isTypeOnly }));
817
- const exportNodes = exports.map(
818
- (item) => factory__namespace.createExportDeclaration({ name: item.name, path: item.path, isTypeOnly: item.isTypeOnly, asAlias: item.asAlias })
819
- );
820
- return [parser.print([...importNodes, ...exportNodes]), getEnvSource(file.source, file.env)].join("\n");
1710
+ return getSource(file);
821
1711
  }
822
1712
  static combineFiles(files) {
823
- return files.filter(Boolean).reduce((acc, file) => {
824
- const prevIndex = acc.findIndex((item) => item.path === file.path);
825
- if (prevIndex === -1) {
826
- return [...acc, file];
827
- }
828
- const prev = acc[prevIndex];
829
- if (prev && file.override) {
830
- acc[prevIndex] = {
831
- imports: [],
832
- exports: [],
833
- ...file
834
- };
835
- return acc;
836
- }
837
- if (prev) {
838
- acc[prevIndex] = {
839
- ...file,
840
- source: prev.source && file.source ? `${prev.source}
841
- ${file.source}` : "",
842
- imports: [...prev.imports || [], ...file.imports || []],
843
- exports: [...prev.exports || [], ...file.exports || []],
844
- env: { ...prev.env || {}, ...file.env || {} }
845
- };
846
- }
847
- return acc;
848
- }, []);
1713
+ return combineFiles(files);
849
1714
  }
850
1715
  static getMode(path5) {
851
1716
  if (!path5) {
@@ -862,41 +1727,27 @@ ${file.source}` : "",
862
1727
  };
863
1728
  _cache = new WeakMap();
864
1729
  _task = new WeakMap();
865
- _isWriting = new WeakMap();
866
- _timeout = new WeakMap();
867
- _queue = new WeakMap();
868
- _validate = new WeakSet();
869
- validate_fn = function(file) {
870
- if (!file.validate) {
871
- return;
872
- }
873
- if (!file.path.toLowerCase().endsWith(file.baseName.toLowerCase())) {
874
- throw new Error(`${file.path} should end with the baseName ${file.baseName}`);
875
- }
876
- };
1730
+ _queue3 = new WeakMap();
877
1731
  _add = new WeakSet();
878
1732
  add_fn = async function(file) {
879
1733
  const controller = new AbortController();
880
- const resolvedFile = { id: crypto2__default.default.randomUUID(), ...file };
881
- __privateGet(this, _cache).set(resolvedFile.path, [{ cancel: () => controller.abort(), ...resolvedFile }]);
882
- if (__privateGet(this, _queue)) {
883
- await __privateGet(this, _queue).run(
884
- async () => {
885
- var _a;
886
- return (_a = __privateGet(this, _task)) == null ? void 0 : _a.call(this, resolvedFile);
887
- },
888
- { controller }
889
- );
890
- }
891
- return resolvedFile;
1734
+ const resolvedFile = { id: crypto__default.default.randomUUID(), name: chunk5TK7TMV6_cjs.trimExtName(file.baseName), ...file };
1735
+ chunkWZQO3EPM_cjs.__privateGet(this, _cache).set(resolvedFile.path, [{ cancel: () => controller.abort(), ...resolvedFile }]);
1736
+ return chunkWZQO3EPM_cjs.__privateGet(this, _queue3).add(
1737
+ async () => {
1738
+ var _a;
1739
+ return (_a = chunkWZQO3EPM_cjs.__privateGet(this, _task)) == null ? void 0 : _a.call(this, resolvedFile);
1740
+ },
1741
+ { signal: controller.signal }
1742
+ );
892
1743
  };
893
1744
  _addOrAppend = new WeakSet();
894
1745
  addOrAppend_fn = async function(file) {
895
- const previousCaches = __privateGet(this, _cache).get(file.path);
1746
+ const previousCaches = chunkWZQO3EPM_cjs.__privateGet(this, _cache).get(file.path);
896
1747
  const previousCache = previousCaches ? previousCaches.at(previousCaches.length - 1) : void 0;
897
1748
  if (previousCache) {
898
- __privateGet(this, _cache).delete(previousCache.path);
899
- return __privateMethod(this, _add, add_fn).call(this, {
1749
+ chunkWZQO3EPM_cjs.__privateGet(this, _cache).delete(previousCache.path);
1750
+ return chunkWZQO3EPM_cjs.__privateMethod(this, _add, add_fn).call(this, {
900
1751
  ...file,
901
1752
  source: previousCache.source && file.source ? `${previousCache.source}
902
1753
  ${file.source}` : "",
@@ -905,19 +1756,72 @@ ${file.source}` : "",
905
1756
  env: { ...previousCache.env || {}, ...file.env || {} }
906
1757
  });
907
1758
  }
908
- return __privateMethod(this, _add, add_fn).call(this, file);
1759
+ return chunkWZQO3EPM_cjs.__privateMethod(this, _add, add_fn).call(this, file);
909
1760
  };
910
1761
  var FileManager = _FileManager;
1762
+ function combineFiles(files) {
1763
+ return files.filter(Boolean).reduce((acc, file) => {
1764
+ const prevIndex = acc.findIndex((item) => item.path === file.path);
1765
+ if (prevIndex === -1) {
1766
+ return [...acc, file];
1767
+ }
1768
+ const prev = acc[prevIndex];
1769
+ if (prev && file.override) {
1770
+ acc[prevIndex] = {
1771
+ imports: [],
1772
+ exports: [],
1773
+ ...file
1774
+ };
1775
+ return acc;
1776
+ }
1777
+ if (prev) {
1778
+ acc[prevIndex] = {
1779
+ ...file,
1780
+ source: prev.source && file.source ? `${prev.source}
1781
+ ${file.source}` : "",
1782
+ imports: [...prev.imports || [], ...file.imports || []],
1783
+ exports: [...prev.exports || [], ...file.exports || []],
1784
+ env: { ...prev.env || {}, ...file.env || {} }
1785
+ };
1786
+ }
1787
+ return acc;
1788
+ }, []);
1789
+ }
1790
+ function getSource(file) {
1791
+ if (!FileManager.isExtensionAllowed(file.baseName)) {
1792
+ return file.source;
1793
+ }
1794
+ const exports = file.exports ? combineExports(file.exports) : [];
1795
+ const imports = file.imports ? combineImports(file.imports, exports, file.source) : [];
1796
+ const importNodes = imports.filter((item) => {
1797
+ return item.path !== chunk5TK7TMV6_cjs.trimExtName(file.path);
1798
+ }).map((item) => {
1799
+ return factory__namespace.createImportDeclaration({
1800
+ name: item.name,
1801
+ path: item.root ? chunkW2FP7ZWW_cjs.getRelativePath(item.root, item.path) : item.path,
1802
+ isTypeOnly: item.isTypeOnly
1803
+ });
1804
+ });
1805
+ const exportNodes = exports.map(
1806
+ (item) => factory__namespace.createExportDeclaration({
1807
+ name: item.name,
1808
+ path: item.path,
1809
+ isTypeOnly: item.isTypeOnly,
1810
+ asAlias: item.asAlias
1811
+ })
1812
+ );
1813
+ return [parser.print([...importNodes, ...exportNodes]), getEnvSource(file.source, file.env)].join("\n");
1814
+ }
911
1815
  function combineExports(exports) {
912
1816
  const combinedExports = naturalOrderby.orderBy(exports, [(v) => !v.isTypeOnly], ["asc"]).reduce((prev, curr) => {
913
1817
  const name = curr.name;
914
1818
  const prevByPath = prev.findLast((imp) => imp.path === curr.path);
915
- const prevByPathAndIsTypeOnly = prev.findLast((imp) => imp.path === curr.path && isEqual__default.default(imp.name, name) && imp.isTypeOnly);
1819
+ const prevByPathAndIsTypeOnly = prev.findLast((imp) => imp.path === curr.path && (0, import_lodash.default)(imp.name, name) && imp.isTypeOnly);
916
1820
  if (prevByPathAndIsTypeOnly) {
917
1821
  return prev;
918
1822
  }
919
1823
  const uniquePrev = prev.findLast(
920
- (imp) => imp.path === curr.path && isEqual__default.default(imp.name, name) && imp.isTypeOnly === curr.isTypeOnly && imp.asAlias === curr.asAlias
1824
+ (imp) => imp.path === curr.path && (0, import_lodash.default)(imp.name, name) && imp.isTypeOnly === curr.isTypeOnly && imp.asAlias === curr.asAlias
921
1825
  );
922
1826
  if (uniquePrev || Array.isArray(name) && !name.length || prevByPath?.asAlias && !curr.asAlias) {
923
1827
  return prev;
@@ -950,11 +1854,11 @@ function combineImports(imports, exports, source) {
950
1854
  return checker(importName) || exports.some(({ name: name2 }) => Array.isArray(name2) ? name2.some(checker) : checker(name2));
951
1855
  };
952
1856
  if (Array.isArray(name)) {
953
- name = name.filter((item) => hasImportInSource(item));
1857
+ name = name.filter((item) => typeof item === "string" ? hasImportInSource(item) : hasImportInSource(item.propertyName));
954
1858
  }
955
1859
  const prevByPath = prev.findLast((imp) => imp.path === curr.path && imp.isTypeOnly === curr.isTypeOnly);
956
- const uniquePrev = prev.findLast((imp) => imp.path === curr.path && isEqual__default.default(imp.name, name) && imp.isTypeOnly === curr.isTypeOnly);
957
- const prevByPathNameAndIsTypeOnly = prev.findLast((imp) => imp.path === curr.path && isEqual__default.default(imp.name, name) && imp.isTypeOnly);
1860
+ const uniquePrev = prev.findLast((imp) => imp.path === curr.path && (0, import_lodash.default)(imp.name, name) && imp.isTypeOnly === curr.isTypeOnly);
1861
+ const prevByPathNameAndIsTypeOnly = prev.findLast((imp) => imp.path === curr.path && (0, import_lodash.default)(imp.name, name) && imp.isTypeOnly);
958
1862
  if (prevByPathNameAndIsTypeOnly) {
959
1863
  return prev;
960
1864
  }
@@ -996,154 +1900,42 @@ function getEnvSource(source, env) {
996
1900
  throw new TypeError(`Environment should be in upperCase for ${key}`);
997
1901
  }
998
1902
  if (typeof replaceBy === "string") {
999
- prev = transformers.searchAndReplace({ text: prev.replaceAll(`process.env.${key}`, replaceBy), replaceBy, prefix: "process.env", key });
1000
- prev = transformers.searchAndReplace({ text: prev.replaceAll(new RegExp(`(declare const).*
1903
+ prev = chunk5TK7TMV6_cjs.searchAndReplace({ text: prev.replaceAll(`process.env.${key}`, replaceBy), replaceBy, prefix: "process.env", key });
1904
+ prev = chunk5TK7TMV6_cjs.searchAndReplace({ text: prev.replaceAll(new RegExp(`(declare const).*
1001
1905
  `, "ig"), ""), replaceBy, key });
1002
1906
  }
1003
1907
  return prev;
1004
1908
  }, source);
1005
1909
  }
1910
+
1911
+ // src/PluginManager.ts
1912
+ chunkWZQO3EPM_cjs.init_cjs_shims();
1913
+
1914
+ // src/utils/EventEmitter.ts
1915
+ chunkWZQO3EPM_cjs.init_cjs_shims();
1006
1916
  var _emitter;
1007
- var EventEmitter = class {
1917
+ var EventEmitter2 = class {
1008
1918
  constructor() {
1009
- __privateAdd(this, _emitter, new events.EventEmitter());
1010
- __privateGet(this, _emitter).setMaxListeners(100);
1919
+ chunkWZQO3EPM_cjs.__privateAdd(this, _emitter, new events.EventEmitter());
1920
+ chunkWZQO3EPM_cjs.__privateGet(this, _emitter).setMaxListeners(100);
1011
1921
  }
1012
1922
  emit(eventName, ...eventArg) {
1013
- __privateGet(this, _emitter).emit(eventName, ...eventArg);
1923
+ chunkWZQO3EPM_cjs.__privateGet(this, _emitter).emit(eventName, ...eventArg);
1014
1924
  }
1015
1925
  on(eventName, handler) {
1016
- __privateGet(this, _emitter).on(eventName, handler);
1926
+ chunkWZQO3EPM_cjs.__privateGet(this, _emitter).on(eventName, handler);
1017
1927
  }
1018
1928
  off(eventName, handler) {
1019
- __privateGet(this, _emitter).off(eventName, handler);
1929
+ chunkWZQO3EPM_cjs.__privateGet(this, _emitter).off(eventName, handler);
1020
1930
  }
1021
1931
  removeAll() {
1022
- __privateGet(this, _emitter).removeAllListeners();
1932
+ chunkWZQO3EPM_cjs.__privateGet(this, _emitter).removeAllListeners();
1023
1933
  }
1024
1934
  };
1025
1935
  _emitter = new WeakMap();
1026
- var _queue2, _workerCount, _maxParallel, _debug, _work, work_fn;
1027
- var Queue = class {
1028
- constructor(maxParallel, debug = false) {
1029
- __privateAdd(this, _work);
1030
- __privateAdd(this, _queue2, []);
1031
- this.eventEmitter = new EventEmitter();
1032
- __privateAdd(this, _workerCount, 0);
1033
- __privateAdd(this, _maxParallel, void 0);
1034
- __privateAdd(this, _debug, false);
1035
- __privateSet(this, _maxParallel, maxParallel);
1036
- __privateSet(this, _debug, debug);
1037
- }
1038
- run(job, options = { controller: new AbortController(), name: crypto2__default.default.randomUUID(), description: "" }) {
1039
- return new Promise((resolve2, reject) => {
1040
- const item = { reject, resolve: resolve2, job, name: options.name, description: options.description || options.name };
1041
- options.controller?.signal.addEventListener("abort", () => {
1042
- __privateSet(this, _queue2, __privateGet(this, _queue2).filter((queueItem) => queueItem.name === item.name));
1043
- reject("Aborted");
1044
- });
1045
- __privateGet(this, _queue2).push(item);
1046
- __privateMethod(this, _work, work_fn).call(this);
1047
- });
1048
- }
1049
- runSync(job, options = { controller: new AbortController(), name: crypto2__default.default.randomUUID(), description: "" }) {
1050
- new Promise((resolve2, reject) => {
1051
- const item = { reject, resolve: resolve2, job, name: options.name, description: options.description || options.name };
1052
- options.controller?.signal.addEventListener("abort", () => {
1053
- __privateSet(this, _queue2, __privateGet(this, _queue2).filter((queueItem) => queueItem.name === item.name));
1054
- });
1055
- __privateGet(this, _queue2).push(item);
1056
- __privateMethod(this, _work, work_fn).call(this);
1057
- });
1058
- }
1059
- get hasJobs() {
1060
- return __privateGet(this, _workerCount) > 0 || __privateGet(this, _queue2).length > 0;
1061
- }
1062
- get count() {
1063
- return __privateGet(this, _workerCount);
1064
- }
1065
- };
1066
- _queue2 = new WeakMap();
1067
- _workerCount = new WeakMap();
1068
- _maxParallel = new WeakMap();
1069
- _debug = new WeakMap();
1070
- _work = new WeakSet();
1071
- work_fn = function() {
1072
- if (__privateGet(this, _workerCount) >= __privateGet(this, _maxParallel)) {
1073
- return;
1074
- }
1075
- __privateWrapper(this, _workerCount)._++;
1076
- let entry;
1077
- while (entry = __privateGet(this, _queue2).shift()) {
1078
- const { reject, resolve: resolve2, job, name, description } = entry;
1079
- if (__privateGet(this, _debug)) {
1080
- perf_hooks.performance.mark(name + "_start");
1081
- }
1082
- job().then((result) => {
1083
- this.eventEmitter.emit("jobDone", result);
1084
- resolve2(result);
1085
- if (__privateGet(this, _debug)) {
1086
- perf_hooks.performance.mark(name + "_stop");
1087
- perf_hooks.performance.measure(description, name + "_start", name + "_stop");
1088
- }
1089
- }).catch((err) => {
1090
- this.eventEmitter.emit("jobFailed", err);
1091
- reject(err);
1092
- });
1093
- }
1094
- __privateWrapper(this, _workerCount)._--;
1095
- };
1096
-
1097
- // src/utils/uniqueName.ts
1098
- function setUniqueName(originalName, data) {
1099
- let used = data[originalName] || 0;
1100
- if (used) {
1101
- data[originalName] = ++used;
1102
- return originalName;
1103
- }
1104
- data[originalName] = 1;
1105
- return originalName;
1106
- }
1107
1936
 
1108
1937
  // src/errors.ts
1109
- var PluginError = class extends Error {
1110
- constructor(message, options) {
1111
- super(message, { cause: options.cause });
1112
- this.name = "PluginError";
1113
- this.cause = options.cause;
1114
- this.pluginManager = options.pluginManager;
1115
- }
1116
- };
1117
- var ParallelPluginError = class extends Error {
1118
- constructor(message, options) {
1119
- super(message, { cause: options.cause });
1120
- this.errors = [];
1121
- this.name = "ParallelPluginError";
1122
- this.errors = options.errors;
1123
- this.pluginManager = options.pluginManager;
1124
- }
1125
- findError(searchError) {
1126
- if (!searchError) {
1127
- return void 0;
1128
- }
1129
- return this.errors.find((error) => {
1130
- if (error.cause) {
1131
- if (error.cause.name == searchError.name) {
1132
- return true;
1133
- }
1134
- return !!this.findError(error.cause);
1135
- }
1136
- return error.name === searchError.name;
1137
- })?.cause;
1138
- }
1139
- };
1140
- var SummaryError = class extends Error {
1141
- constructor(message, options) {
1142
- super(message, { cause: options.cause });
1143
- this.name = "SummaryError";
1144
- this.summary = options.summary || [];
1145
- }
1146
- };
1938
+ chunkWZQO3EPM_cjs.init_cjs_shims();
1147
1939
  var Warning = class extends Error {
1148
1940
  constructor(message, options) {
1149
1941
  super(message, { cause: options?.cause });
@@ -1153,7 +1945,11 @@ var Warning = class extends Error {
1153
1945
  var ValidationPluginError = class extends Error {
1154
1946
  };
1155
1947
 
1948
+ // src/plugin.ts
1949
+ chunkWZQO3EPM_cjs.init_cjs_shims();
1950
+
1156
1951
  // src/utils/cache.ts
1952
+ chunkWZQO3EPM_cjs.init_cjs_shims();
1157
1953
  function createPluginCache(Store = /* @__PURE__ */ Object.create(null)) {
1158
1954
  return {
1159
1955
  set(id, value) {
@@ -1193,8 +1989,7 @@ var definePlugin = createPlugin((options) => {
1193
1989
  return {
1194
1990
  name: pluginName,
1195
1991
  options,
1196
- key: ["controller", "core"],
1197
- kind: "controller",
1992
+ key: ["core"],
1198
1993
  api() {
1199
1994
  return {
1200
1995
  get config() {
@@ -1231,7 +2026,11 @@ var definePlugin = createPlugin((options) => {
1231
2026
  };
1232
2027
  });
1233
2028
 
2029
+ // src/PromiseManager.ts
2030
+ chunkWZQO3EPM_cjs.init_cjs_shims();
2031
+
1234
2032
  // src/utils/executeStrategies.ts
2033
+ chunkWZQO3EPM_cjs.init_cjs_shims();
1235
2034
  function hookSeq(promises) {
1236
2035
  return promises.filter(Boolean).reduce(
1237
2036
  (promise, func) => {
@@ -1261,13 +2060,16 @@ function hookFirst(promises, nullCheck = (state) => state !== null) {
1261
2060
  }
1262
2061
  return promise;
1263
2062
  }
2063
+ function hookParallel(promises) {
2064
+ return Promise.allSettled(promises.filter(Boolean).map((promise) => promise()));
2065
+ }
1264
2066
 
1265
2067
  // src/PromiseManager.ts
1266
2068
  var _options2;
1267
2069
  var PromiseManager = class {
1268
2070
  constructor(options = {}) {
1269
- __privateAdd(this, _options2, {});
1270
- __privateSet(this, _options2, options);
2071
+ chunkWZQO3EPM_cjs.__privateAdd(this, _options2, {});
2072
+ chunkWZQO3EPM_cjs.__privateSet(this, _options2, options);
1271
2073
  return this;
1272
2074
  }
1273
2075
  run(strategy, promises) {
@@ -1275,7 +2077,10 @@ var PromiseManager = class {
1275
2077
  return hookSeq(promises);
1276
2078
  }
1277
2079
  if (strategy === "first") {
1278
- return hookFirst(promises, __privateGet(this, _options2).nullCheck);
2080
+ return hookFirst(promises, chunkWZQO3EPM_cjs.__privateGet(this, _options2).nullCheck);
2081
+ }
2082
+ if (strategy === "parallel") {
2083
+ return hookParallel(promises);
1279
2084
  }
1280
2085
  throw new Error(`${strategy} not implemented`);
1281
2086
  }
@@ -1292,8 +2097,8 @@ function isPromiseRejectedResult(result) {
1292
2097
  var _core, _usedPluginNames, _promiseManager, _getSortedPlugins, getSortedPlugins_fn, _addExecutedToCallStack, addExecutedToCallStack_fn, _execute, execute_fn, _executeSync, executeSync_fn, _catcher, catcher_fn, _parse, parse_fn;
1293
2098
  var PluginManager = class {
1294
2099
  constructor(config, options) {
1295
- __privateAdd(this, _getSortedPlugins);
1296
- __privateAdd(this, _addExecutedToCallStack);
2100
+ chunkWZQO3EPM_cjs.__privateAdd(this, _getSortedPlugins);
2101
+ chunkWZQO3EPM_cjs.__privateAdd(this, _addExecutedToCallStack);
1297
2102
  /**
1298
2103
  * Run an async plugin hook and return the result.
1299
2104
  * @param hookName Name of the plugin hook. Must be either in `PluginHooks` or `OutputPluginValueHooks`.
@@ -1301,7 +2106,7 @@ var PluginManager = class {
1301
2106
  * @param plugin The actual pluginObject to run.
1302
2107
  */
1303
2108
  // Implementation signature
1304
- __privateAdd(this, _execute);
2109
+ chunkWZQO3EPM_cjs.__privateAdd(this, _execute);
1305
2110
  /**
1306
2111
  * Run a sync plugin hook and return the result.
1307
2112
  * @param hookName Name of the plugin hook. Must be in `PluginHooks`.
@@ -1309,14 +2114,14 @@ var PluginManager = class {
1309
2114
  * @param plugin The acutal plugin
1310
2115
  * @param replaceContext When passed, the plugin context can be overridden.
1311
2116
  */
1312
- __privateAdd(this, _executeSync);
1313
- __privateAdd(this, _catcher);
1314
- __privateAdd(this, _parse);
1315
- this.eventEmitter = new EventEmitter();
2117
+ chunkWZQO3EPM_cjs.__privateAdd(this, _executeSync);
2118
+ chunkWZQO3EPM_cjs.__privateAdd(this, _catcher);
2119
+ chunkWZQO3EPM_cjs.__privateAdd(this, _parse);
2120
+ this.events = new EventEmitter2();
1316
2121
  this.executed = [];
1317
- __privateAdd(this, _core, void 0);
1318
- __privateAdd(this, _usedPluginNames, {});
1319
- __privateAdd(this, _promiseManager, void 0);
2122
+ chunkWZQO3EPM_cjs.__privateAdd(this, _core, void 0);
2123
+ chunkWZQO3EPM_cjs.__privateAdd(this, _usedPluginNames, {});
2124
+ chunkWZQO3EPM_cjs.__privateAdd(this, _promiseManager, void 0);
1320
2125
  this.resolvePath = (params) => {
1321
2126
  if (params.pluginKey) {
1322
2127
  const paths = this.hookForPluginSync({
@@ -1324,11 +2129,14 @@ var PluginManager = class {
1324
2129
  hookName: "resolvePath",
1325
2130
  parameters: [params.baseName, params.directory, params.options]
1326
2131
  });
1327
- if (paths && paths?.length > 1) {
1328
- throw new Error(
2132
+ if (paths && paths?.length > 1 && this.logger.logLevel === chunkPLVKILIY_cjs.LogLevel.debug) {
2133
+ this.logger.debug(
1329
2134
  `Cannot return a path where the 'pluginKey' ${params.pluginKey ? JSON.stringify(params.pluginKey) : '"'} is not unique enough
1330
2135
 
1331
- Paths: ${JSON.stringify(paths, void 0, 2)}`
2136
+ Paths: ${JSON.stringify(paths, void 0, 2)}
2137
+
2138
+ Falling back on the first item.
2139
+ `
1332
2140
  );
1333
2141
  }
1334
2142
  return paths?.at(0);
@@ -1345,25 +2153,29 @@ Paths: ${JSON.stringify(paths, void 0, 2)}`
1345
2153
  hookName: "resolveName",
1346
2154
  parameters: [params.name, params.type]
1347
2155
  });
1348
- if (names && names?.length > 1) {
1349
- throw new Error(
2156
+ if (names && names?.length > 1 && this.logger.logLevel === chunkPLVKILIY_cjs.LogLevel.debug) {
2157
+ this.logger.debug(
1350
2158
  `Cannot return a name where the 'pluginKey' ${params.pluginKey ? JSON.stringify(params.pluginKey) : '"'} is not unique enough
1351
2159
 
1352
- Names: ${JSON.stringify(names, void 0, 2)}`
2160
+ Names: ${JSON.stringify(names, void 0, 2)}
2161
+
2162
+ Falling back on the first item.
2163
+ `
1353
2164
  );
1354
2165
  }
1355
- return transformReservedWord(names?.at(0) || params.name);
2166
+ return chunk5TK7TMV6_cjs.transformReservedWord(names?.at(0) || params.name);
1356
2167
  }
1357
2168
  const name = this.hookFirstSync({
1358
2169
  hookName: "resolveName",
1359
2170
  parameters: [params.name, params.type]
1360
2171
  }).result;
1361
- return transformReservedWord(name);
2172
+ return chunk5TK7TMV6_cjs.transformReservedWord(name);
1362
2173
  };
2174
+ this.config = config;
1363
2175
  this.logger = options.logger;
1364
- this.queue = new Queue(100, this.logger.logLevel === LogLevel.debug);
1365
- this.fileManager = new FileManager({ task: options.task, queue: this.queue, timeout: options.writeTimeout });
1366
- __privateSet(this, _promiseManager, new PromiseManager({ nullCheck: (state) => !!state?.result }));
2176
+ this.queue = new PQueue({ concurrency: 1 });
2177
+ this.fileManager = new FileManager({ task: options.task, queue: this.queue });
2178
+ chunkWZQO3EPM_cjs.__privateSet(this, _promiseManager, new PromiseManager({ nullCheck: (state) => !!state?.result }));
1367
2179
  const plugins = config.plugins || [];
1368
2180
  const core = definePlugin({
1369
2181
  config,
@@ -1372,19 +2184,22 @@ Names: ${JSON.stringify(names, void 0, 2)}`
1372
2184
  fileManager: this.fileManager,
1373
2185
  resolvePath: this.resolvePath.bind(this),
1374
2186
  resolveName: this.resolveName.bind(this),
1375
- getPlugins: __privateMethod(this, _getSortedPlugins, getSortedPlugins_fn).bind(this)
2187
+ getPlugins: chunkWZQO3EPM_cjs.__privateMethod(this, _getSortedPlugins, getSortedPlugins_fn).bind(this)
1376
2188
  });
1377
- __privateSet(this, _core, __privateMethod(this, _parse, parse_fn).call(this, core, this, core.api.call(null)));
1378
- this.plugins = [__privateGet(this, _core), ...plugins].map((plugin) => {
1379
- return __privateMethod(this, _parse, parse_fn).call(this, plugin, this, __privateGet(this, _core).api);
2189
+ chunkWZQO3EPM_cjs.__privateSet(this, _core, chunkWZQO3EPM_cjs.__privateMethod(this, _parse, parse_fn).call(this, core, this, core.api.call(null)));
2190
+ this.plugins = [chunkWZQO3EPM_cjs.__privateGet(this, _core), ...plugins].map((plugin) => {
2191
+ return chunkWZQO3EPM_cjs.__privateMethod(this, _parse, parse_fn).call(this, plugin, this, chunkWZQO3EPM_cjs.__privateGet(this, _core).api);
1380
2192
  });
1381
2193
  return this;
1382
2194
  }
2195
+ /**
2196
+ * Instead of calling `pluginManager.events.on` you can use `pluginManager.on`. This one also has better types.
2197
+ */
1383
2198
  on(eventName, handler) {
1384
- this.eventEmitter.on(eventName, handler);
2199
+ this.events.on(eventName, handler);
1385
2200
  }
1386
2201
  /**
1387
- * Run only hook for a specific plugin name
2202
+ * Run a specific hookName for plugin x.
1388
2203
  */
1389
2204
  hookForPlugin({
1390
2205
  pluginKey,
@@ -1393,7 +2208,7 @@ Names: ${JSON.stringify(names, void 0, 2)}`
1393
2208
  }) {
1394
2209
  const plugins = this.getPluginsByKey(hookName, pluginKey);
1395
2210
  const promises = plugins.map((plugin) => {
1396
- return __privateMethod(this, _execute, execute_fn).call(this, {
2211
+ return chunkWZQO3EPM_cjs.__privateMethod(this, _execute, execute_fn).call(this, {
1397
2212
  strategy: "hookFirst",
1398
2213
  hookName,
1399
2214
  parameters,
@@ -1402,6 +2217,9 @@ Names: ${JSON.stringify(names, void 0, 2)}`
1402
2217
  }).filter(Boolean);
1403
2218
  return Promise.all(promises);
1404
2219
  }
2220
+ /**
2221
+ * Run a specific hookName for plugin x.
2222
+ */
1405
2223
  hookForPluginSync({
1406
2224
  pluginKey,
1407
2225
  hookName,
@@ -1409,7 +2227,7 @@ Names: ${JSON.stringify(names, void 0, 2)}`
1409
2227
  }) {
1410
2228
  const plugins = this.getPluginsByKey(hookName, pluginKey);
1411
2229
  return plugins.map((plugin) => {
1412
- return __privateMethod(this, _executeSync, executeSync_fn).call(this, {
2230
+ return chunkWZQO3EPM_cjs.__privateMethod(this, _executeSync, executeSync_fn).call(this, {
1413
2231
  strategy: "hookFirst",
1414
2232
  hookName,
1415
2233
  parameters,
@@ -1418,18 +2236,18 @@ Names: ${JSON.stringify(names, void 0, 2)}`
1418
2236
  }).filter(Boolean);
1419
2237
  }
1420
2238
  /**
1421
- * Chains, first non-null result stops and returns
2239
+ * First non-null result stops and will return it's value.
1422
2240
  */
1423
2241
  async hookFirst({
1424
2242
  hookName,
1425
2243
  parameters,
1426
2244
  skipped
1427
2245
  }) {
1428
- const promises = __privateMethod(this, _getSortedPlugins, getSortedPlugins_fn).call(this).filter((plugin) => {
2246
+ const promises = chunkWZQO3EPM_cjs.__privateMethod(this, _getSortedPlugins, getSortedPlugins_fn).call(this).filter((plugin) => {
1429
2247
  return skipped ? skipped.has(plugin) : true;
1430
2248
  }).map((plugin) => {
1431
2249
  return async () => {
1432
- const value = await __privateMethod(this, _execute, execute_fn).call(this, {
2250
+ const value = await chunkWZQO3EPM_cjs.__privateMethod(this, _execute, execute_fn).call(this, {
1433
2251
  strategy: "hookFirst",
1434
2252
  hookName,
1435
2253
  parameters,
@@ -1443,10 +2261,10 @@ Names: ${JSON.stringify(names, void 0, 2)}`
1443
2261
  );
1444
2262
  };
1445
2263
  });
1446
- return __privateGet(this, _promiseManager).run("first", promises);
2264
+ return chunkWZQO3EPM_cjs.__privateGet(this, _promiseManager).run("first", promises);
1447
2265
  }
1448
2266
  /**
1449
- * Chains, first non-null result stops and returns
2267
+ * First non-null result stops and will return it's value.
1450
2268
  */
1451
2269
  hookFirstSync({
1452
2270
  hookName,
@@ -1454,12 +2272,12 @@ Names: ${JSON.stringify(names, void 0, 2)}`
1454
2272
  skipped
1455
2273
  }) {
1456
2274
  let parseResult = null;
1457
- for (const plugin of __privateMethod(this, _getSortedPlugins, getSortedPlugins_fn).call(this)) {
2275
+ for (const plugin of chunkWZQO3EPM_cjs.__privateMethod(this, _getSortedPlugins, getSortedPlugins_fn).call(this)) {
1458
2276
  if (skipped && skipped.has(plugin)) {
1459
2277
  continue;
1460
2278
  }
1461
2279
  parseResult = {
1462
- result: __privateMethod(this, _executeSync, executeSync_fn).call(this, {
2280
+ result: chunkWZQO3EPM_cjs.__privateMethod(this, _executeSync, executeSync_fn).call(this, {
1463
2281
  strategy: "hookFirst",
1464
2282
  hookName,
1465
2283
  parameters,
@@ -1474,33 +2292,26 @@ Names: ${JSON.stringify(names, void 0, 2)}`
1474
2292
  return parseResult;
1475
2293
  }
1476
2294
  /**
1477
- * Parallel, runs all plugins
2295
+ * Run all plugins in parallel(order will be based on `this.plugin` and if `pre` or `post` is set).
1478
2296
  */
1479
2297
  async hookParallel({
1480
2298
  hookName,
1481
2299
  parameters
1482
2300
  }) {
1483
- const parallelPromises = [];
1484
- for (const plugin of __privateMethod(this, _getSortedPlugins, getSortedPlugins_fn).call(this)) {
1485
- const promise = __privateMethod(this, _execute, execute_fn).call(this, { strategy: "hookParallel", hookName, parameters, plugin });
1486
- if (promise) {
1487
- parallelPromises.push(promise);
1488
- }
1489
- }
1490
- const results = await Promise.allSettled(parallelPromises);
1491
- const errors = results.map((result) => {
1492
- if (isPromiseRejectedResult(result) && result.reason instanceof PluginError) {
1493
- return result.reason;
2301
+ const promises = chunkWZQO3EPM_cjs.__privateMethod(this, _getSortedPlugins, getSortedPlugins_fn).call(this).map((plugin) => {
2302
+ return () => chunkWZQO3EPM_cjs.__privateMethod(this, _execute, execute_fn).call(this, { strategy: "hookParallel", hookName, parameters, plugin });
2303
+ });
2304
+ const results = await chunkWZQO3EPM_cjs.__privateGet(this, _promiseManager).run("parallel", promises);
2305
+ results.forEach((result, index) => {
2306
+ if (isPromiseRejectedResult(result)) {
2307
+ const plugin = chunkWZQO3EPM_cjs.__privateMethod(this, _getSortedPlugins, getSortedPlugins_fn).call(this)[index];
2308
+ chunkWZQO3EPM_cjs.__privateMethod(this, _catcher, catcher_fn).call(this, result.reason, plugin, hookName);
1494
2309
  }
1495
- return void 0;
1496
- }).filter(Boolean);
1497
- if (errors.length) {
1498
- throw new ParallelPluginError("Error", { errors, pluginManager: this });
1499
- }
2310
+ });
1500
2311
  return results.filter((result) => result.status === "fulfilled").map((result) => result.value);
1501
2312
  }
1502
2313
  /**
1503
- * Chains, reduces returned value, handling the reduced value as the first hook argument
2314
+ * 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.
1504
2315
  */
1505
2316
  hookReduceArg0({
1506
2317
  hookName,
@@ -1509,16 +2320,16 @@ Names: ${JSON.stringify(names, void 0, 2)}`
1509
2320
  }) {
1510
2321
  const [argument0, ...rest] = parameters;
1511
2322
  let promise = Promise.resolve(argument0);
1512
- for (const plugin of __privateMethod(this, _getSortedPlugins, getSortedPlugins_fn).call(this)) {
2323
+ for (const plugin of chunkWZQO3EPM_cjs.__privateMethod(this, _getSortedPlugins, getSortedPlugins_fn).call(this)) {
1513
2324
  promise = promise.then((arg0) => {
1514
- const value = __privateMethod(this, _execute, execute_fn).call(this, {
2325
+ const value = chunkWZQO3EPM_cjs.__privateMethod(this, _execute, execute_fn).call(this, {
1515
2326
  strategy: "hookReduceArg0",
1516
2327
  hookName,
1517
2328
  parameters: [arg0, ...rest],
1518
2329
  plugin
1519
2330
  });
1520
2331
  return value;
1521
- }).then((result) => reduce.call(__privateGet(this, _core).api, argument0, result, plugin));
2332
+ }).then((result) => reduce.call(chunkWZQO3EPM_cjs.__privateGet(this, _core).api, argument0, result, plugin));
1522
2333
  }
1523
2334
  return promise;
1524
2335
  }
@@ -1526,36 +2337,35 @@ Names: ${JSON.stringify(names, void 0, 2)}`
1526
2337
  * Chains plugins
1527
2338
  */
1528
2339
  async hookSeq({ hookName, parameters }) {
1529
- const promises = __privateMethod(this, _getSortedPlugins, getSortedPlugins_fn).call(this).map((plugin) => {
1530
- return () => __privateMethod(this, _execute, execute_fn).call(this, {
2340
+ const promises = chunkWZQO3EPM_cjs.__privateMethod(this, _getSortedPlugins, getSortedPlugins_fn).call(this).map((plugin) => {
2341
+ return () => chunkWZQO3EPM_cjs.__privateMethod(this, _execute, execute_fn).call(this, {
1531
2342
  strategy: "hookSeq",
1532
2343
  hookName,
1533
2344
  parameters,
1534
2345
  plugin
1535
2346
  });
1536
2347
  });
1537
- return __privateGet(this, _promiseManager).run("seq", promises);
2348
+ return chunkWZQO3EPM_cjs.__privateGet(this, _promiseManager).run("seq", promises);
1538
2349
  }
1539
2350
  getPluginsByKey(hookName, pluginKey) {
1540
2351
  const plugins = [...this.plugins];
1541
- const [searchKind, searchPluginName, searchIdentifier] = pluginKey;
2352
+ const [searchPluginName, searchIdentifier] = pluginKey;
1542
2353
  const pluginByPluginName = plugins.filter((plugin) => plugin[hookName]).filter((item) => {
1543
- const [kind, name, identifier] = item.key;
2354
+ const [name, identifier] = item.key;
1544
2355
  const identifierCheck = identifier?.toString() === searchIdentifier?.toString();
1545
- const kindCheck = kind === searchKind;
1546
2356
  const nameCheck = name === searchPluginName;
1547
2357
  if (searchIdentifier) {
1548
- return identifierCheck && kindCheck && nameCheck;
2358
+ return identifierCheck && nameCheck;
1549
2359
  }
1550
- return kindCheck && nameCheck;
2360
+ return nameCheck;
1551
2361
  });
1552
2362
  if (!pluginByPluginName?.length) {
1553
2363
  const corePlugin = plugins.find((plugin) => plugin.name === "core" && plugin[hookName]);
1554
- if (this.logger.logLevel === "info") {
2364
+ if (this.logger.logLevel === chunkPLVKILIY_cjs.LogLevel.debug) {
1555
2365
  if (corePlugin) {
1556
- this.logger.warn(`No hook '${hookName}' for pluginKey '${JSON.stringify(pluginKey)}' found, falling back on the '@kubb/core' plugin`);
2366
+ this.logger.debug(`No hook '${hookName}' for pluginKey '${JSON.stringify(pluginKey)}' found, falling back on the '@kubb/core' plugin`);
1557
2367
  } else {
1558
- this.logger.warn(`No hook '${hookName}' for pluginKey '${JSON.stringify(pluginKey)}' found, no fallback found in the '@kubb/core' plugin`);
2368
+ this.logger.debug(`No hook '${hookName}' for pluginKey '${JSON.stringify(pluginKey)}' found, no fallback found in the '@kubb/core' plugin`);
1559
2369
  }
1560
2370
  }
1561
2371
  return corePlugin ? [corePlugin] : [];
@@ -1579,7 +2389,7 @@ Names: ${JSON.stringify(names, void 0, 2)}`
1579
2389
  }
1580
2390
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
1581
2391
  static get hooks() {
1582
- return ["validate", "buildStart", "resolvePath", "resolveName", "load", "transform", "writeFile", "buildEnd"];
2392
+ return ["buildStart", "resolvePath", "resolveName", "load", "transform", "writeFile", "buildEnd"];
1583
2393
  }
1584
2394
  };
1585
2395
  _core = new WeakMap();
@@ -1589,7 +2399,7 @@ _getSortedPlugins = new WeakSet();
1589
2399
  getSortedPlugins_fn = function(hookName) {
1590
2400
  const plugins = [...this.plugins].filter((plugin) => plugin.name !== "core");
1591
2401
  if (hookName) {
1592
- if (this.logger.logLevel === "info") {
2402
+ if (this.logger.logLevel === chunkPLVKILIY_cjs.LogLevel.info) {
1593
2403
  const containsHookName = plugins.some((item) => item[hookName]);
1594
2404
  if (!containsHookName) {
1595
2405
  this.logger.warn(`No hook ${hookName} found`);
@@ -1597,12 +2407,28 @@ getSortedPlugins_fn = function(hookName) {
1597
2407
  }
1598
2408
  return plugins.filter((item) => item[hookName]);
1599
2409
  }
1600
- return plugins;
2410
+ return plugins.map((plugin) => {
2411
+ if (plugin.pre) {
2412
+ const isValid = plugin.pre.every((pluginName2) => plugins.find((pluginToFind) => pluginToFind.name === pluginName2));
2413
+ if (!isValid) {
2414
+ throw new ValidationPluginError(`This plugin has a pre set that is not valid(${JSON.stringify(plugin.pre, void 0, 2)})`);
2415
+ }
2416
+ }
2417
+ return plugin;
2418
+ }).sort((a, b) => {
2419
+ if (b.pre?.includes(a.name)) {
2420
+ return 1;
2421
+ }
2422
+ if (b.post?.includes(a.name)) {
2423
+ return -1;
2424
+ }
2425
+ return 0;
2426
+ });
1601
2427
  };
1602
2428
  _addExecutedToCallStack = new WeakSet();
1603
2429
  addExecutedToCallStack_fn = function(executer) {
1604
2430
  if (executer) {
1605
- this.eventEmitter.emit("executed", executer);
2431
+ this.events.emit("executed", executer);
1606
2432
  this.executed.push(executer);
1607
2433
  }
1608
2434
  };
@@ -1618,10 +2444,10 @@ execute_fn = function({
1618
2444
  if (!hook) {
1619
2445
  return null;
1620
2446
  }
1621
- this.eventEmitter.emit("execute", { strategy, hookName, parameters, plugin });
2447
+ this.events.emit("execute", { strategy, hookName, parameters, plugin });
1622
2448
  const task = Promise.resolve().then(() => {
1623
2449
  if (typeof hook === "function") {
1624
- const possiblePromiseResult = hook.apply({ ...__privateGet(this, _core).api, plugin }, parameters);
2450
+ const possiblePromiseResult = hook.apply({ ...chunkWZQO3EPM_cjs.__privateGet(this, _core).api, plugin }, parameters);
1625
2451
  if (isPromise(possiblePromiseResult)) {
1626
2452
  return Promise.resolve(possiblePromiseResult);
1627
2453
  }
@@ -1630,18 +2456,17 @@ execute_fn = function({
1630
2456
  return hook;
1631
2457
  }).then((result) => {
1632
2458
  output = result;
1633
- return result;
1634
- }).catch((e) => {
1635
- __privateMethod(this, _catcher, catcher_fn).call(this, e, plugin, hookName);
1636
- return null;
1637
- }).finally(() => {
1638
- __privateMethod(this, _addExecutedToCallStack, addExecutedToCallStack_fn).call(this, {
2459
+ chunkWZQO3EPM_cjs.__privateMethod(this, _addExecutedToCallStack, addExecutedToCallStack_fn).call(this, {
1639
2460
  parameters,
1640
2461
  output,
1641
2462
  strategy,
1642
2463
  hookName,
1643
2464
  plugin
1644
2465
  });
2466
+ return result;
2467
+ }).catch((e) => {
2468
+ chunkWZQO3EPM_cjs.__privateMethod(this, _catcher, catcher_fn).call(this, e, plugin, hookName);
2469
+ return null;
1645
2470
  });
1646
2471
  return task;
1647
2472
  };
@@ -1657,44 +2482,39 @@ executeSync_fn = function({
1657
2482
  if (!hook) {
1658
2483
  return null;
1659
2484
  }
1660
- this.eventEmitter.emit("execute", { strategy, hookName, parameters, plugin });
2485
+ this.events.emit("execute", { strategy, hookName, parameters, plugin });
1661
2486
  try {
1662
2487
  if (typeof hook === "function") {
1663
- const fn = hook.apply({ ...__privateGet(this, _core).api, plugin }, parameters);
2488
+ const fn = hook.apply({ ...chunkWZQO3EPM_cjs.__privateGet(this, _core).api, plugin }, parameters);
1664
2489
  output = fn;
1665
2490
  return fn;
1666
2491
  }
1667
2492
  output = hook;
1668
- return hook;
1669
- } catch (e) {
1670
- __privateMethod(this, _catcher, catcher_fn).call(this, e, plugin, hookName);
1671
- return null;
1672
- } finally {
1673
- __privateMethod(this, _addExecutedToCallStack, addExecutedToCallStack_fn).call(this, {
2493
+ chunkWZQO3EPM_cjs.__privateMethod(this, _addExecutedToCallStack, addExecutedToCallStack_fn).call(this, {
1674
2494
  parameters,
1675
2495
  output,
1676
2496
  strategy,
1677
2497
  hookName,
1678
2498
  plugin
1679
2499
  });
2500
+ return hook;
2501
+ } catch (e) {
2502
+ chunkWZQO3EPM_cjs.__privateMethod(this, _catcher, catcher_fn).call(this, e, plugin, hookName);
2503
+ return null;
1680
2504
  }
1681
2505
  };
1682
2506
  _catcher = new WeakSet();
1683
2507
  catcher_fn = function(e, plugin, hookName) {
1684
- const text = `${e.message} (plugin: ${plugin.name}, hook: ${hookName})
2508
+ const text = `${e.message} (plugin: ${plugin?.name || "unknown"}, hook: ${hookName || "unknown"})
1685
2509
  `;
1686
- const pluginError = new PluginError(text, { cause: e, pluginManager: this });
1687
- this.eventEmitter.emit("error", pluginError);
1688
- throw pluginError;
2510
+ this.logger.error(text);
2511
+ this.events.emit("error", e);
1689
2512
  };
1690
2513
  _parse = new WeakSet();
1691
2514
  parse_fn = function(plugin, pluginManager, context) {
1692
- const usedPluginNames = __privateGet(pluginManager, _usedPluginNames);
1693
- setUniqueName(plugin.name, usedPluginNames);
1694
- const key = plugin.key || [plugin.kind, plugin.name, usedPluginNames[plugin.name]].filter(Boolean);
1695
- if (plugin.name !== "core" && usedPluginNames[plugin.name] >= 2) {
1696
- pluginManager.logger.warn("Using multiple of the same plugin is an experimental feature");
1697
- }
2515
+ const usedPluginNames = chunkWZQO3EPM_cjs.__privateGet(pluginManager, _usedPluginNames);
2516
+ chunkH47IKRXJ_cjs.setUniqueName(plugin.name, usedPluginNames);
2517
+ const key = [plugin.name, usedPluginNames[plugin.name]].filter(Boolean);
1698
2518
  if (!plugin.transform) {
1699
2519
  plugin.transform = function transform(code) {
1700
2520
  return code;
@@ -1718,16 +2538,17 @@ parse_fn = function(plugin, pluginManager, context) {
1718
2538
  async function transformReducer(_previousCode, result, _plugin) {
1719
2539
  return result;
1720
2540
  }
1721
- async function build(options) {
1722
- const { config, logger = createLogger({ logLevel: LogLevel.silent }) } = options;
2541
+ async function setup(options) {
2542
+ const { config, logger = chunkPLVKILIY_cjs.createLogger({ logLevel: chunkPLVKILIY_cjs.LogLevel.silent }) } = options;
2543
+ let count = 0;
1723
2544
  try {
1724
- if (isInputPath(config) && !new URLPath(config.input.path).isURL) {
1725
- await read(config.input.path);
2545
+ if (isInputPath(config) && !new chunkH47IKRXJ_cjs.URLPath(config.input.path).isURL) {
2546
+ await chunkW2FP7ZWW_cjs.read(config.input.path);
1726
2547
  }
1727
2548
  } catch (e) {
1728
2549
  if (isInputPath(config)) {
1729
2550
  throw new Error(
1730
- "Cannot read file/URL defined in `input.path` or set with `kubb generate PATH` in the CLI of your Kubb config " + pc3__default.default.dim(config.input.path),
2551
+ "Cannot read file/URL defined in `input.path` or set with `kubb generate PATH` in the CLI of your Kubb config " + chunkPLVKILIY_cjs.p.dim(config.input.path),
1731
2552
  {
1732
2553
  cause: e
1733
2554
  }
@@ -1735,170 +2556,224 @@ async function build(options) {
1735
2556
  }
1736
2557
  }
1737
2558
  if (config.output.clean) {
1738
- await clean(config.output.path);
2559
+ await chunkW2FP7ZWW_cjs.clean(config.output.path);
1739
2560
  }
1740
- const queueTask = async (file) => {
2561
+ const task = async (file) => {
1741
2562
  const { path: path5 } = file;
1742
- let code = FileManager.getSource(file);
2563
+ let source = FileManager.getSource(file);
1743
2564
  const { result: loadedResult } = await pluginManager.hookFirst({
1744
2565
  hookName: "load",
1745
2566
  parameters: [path5]
1746
2567
  });
1747
2568
  if (loadedResult && isPromise(loadedResult)) {
1748
- code = await loadedResult;
2569
+ source = await loadedResult;
1749
2570
  }
1750
2571
  if (loadedResult && !isPromise(loadedResult)) {
1751
- code = loadedResult;
2572
+ source = loadedResult;
1752
2573
  }
1753
- if (code) {
1754
- const transformedCode = await pluginManager.hookReduceArg0({
2574
+ if (source) {
2575
+ source = await pluginManager.hookReduceArg0({
1755
2576
  hookName: "transform",
1756
- parameters: [code, path5],
2577
+ parameters: [source, path5],
1757
2578
  reduce: transformReducer
1758
2579
  });
1759
2580
  if (config.output.write || config.output.write === void 0) {
1760
2581
  if (file.meta?.pluginKey) {
1761
- return pluginManager.hookForPlugin({
2582
+ await pluginManager.hookForPlugin({
1762
2583
  pluginKey: file.meta?.pluginKey,
1763
2584
  hookName: "writeFile",
1764
- parameters: [transformedCode, path5]
2585
+ parameters: [source, path5]
1765
2586
  });
1766
2587
  }
1767
- return pluginManager.hookFirst({
2588
+ await pluginManager.hookFirst({
1768
2589
  hookName: "writeFile",
1769
- parameters: [transformedCode, path5]
2590
+ parameters: [source, path5]
1770
2591
  });
1771
2592
  }
1772
2593
  }
2594
+ return {
2595
+ ...file,
2596
+ source: source || ""
2597
+ };
1773
2598
  };
1774
- const pluginManager = new PluginManager(config, { logger, task: queueTask, writeTimeout: 0 });
1775
- const { plugins, fileManager } = pluginManager;
2599
+ const pluginManager = new PluginManager(config, { logger, task });
1776
2600
  pluginManager.on("execute", (executer) => {
1777
2601
  const { hookName, parameters, plugin } = executer;
1778
2602
  if (hookName === "writeFile" && logger.spinner) {
1779
2603
  const [code] = parameters;
1780
- if (logger.logLevel === LogLevel.info) {
1781
- logger.spinner.start(`\u{1F4BE} Writing`);
1782
- }
1783
- if (logger.logLevel === "debug") {
1784
- logger.info(`PluginKey ${pc3__default.default.dim(JSON.stringify(plugin.key))}
2604
+ if (logger.logLevel === chunkPLVKILIY_cjs.LogLevel.debug) {
2605
+ logger.debug(`PluginKey ${chunkPLVKILIY_cjs.p.dim(JSON.stringify(plugin.key))}
1785
2606
  with source
1786
2607
 
1787
2608
  ${code}`);
1788
2609
  }
1789
2610
  }
1790
2611
  });
2612
+ pluginManager.queue.on("add", () => {
2613
+ if (logger.logLevel !== chunkPLVKILIY_cjs.LogLevel.info) {
2614
+ return;
2615
+ }
2616
+ if (logger.spinner && count === 0) {
2617
+ logger.spinner?.start(`\u{1F4BE} Writing`);
2618
+ }
2619
+ });
2620
+ pluginManager.queue.on("active", () => {
2621
+ if (logger.logLevel !== chunkPLVKILIY_cjs.LogLevel.info) {
2622
+ return;
2623
+ }
2624
+ if (logger.spinner && pluginManager.queue.size > 0) {
2625
+ const text = `Item: ${count} Size: ${pluginManager.queue.size} Pending: ${pluginManager.queue.pending}`;
2626
+ logger.spinner.suffixText = chunkPLVKILIY_cjs.p.dim(text);
2627
+ }
2628
+ ++count;
2629
+ });
2630
+ pluginManager.queue.on("completed", () => {
2631
+ if (logger.logLevel !== chunkPLVKILIY_cjs.LogLevel.info) {
2632
+ return;
2633
+ }
2634
+ if (logger.spinner) {
2635
+ const text = `Item: ${count} Size: ${pluginManager.queue.size} Pending: ${pluginManager.queue.pending}`;
2636
+ logger.spinner.suffixText = chunkPLVKILIY_cjs.p.dim(text);
2637
+ }
2638
+ });
1791
2639
  pluginManager.on("executed", (executer) => {
1792
2640
  const { hookName, plugin, output, parameters } = executer;
1793
- const messsage = `${randomPicoColour(plugin.name)} Executing ${hookName}`;
1794
- if (logger.logLevel === LogLevel.info && logger.spinner) {
1795
- if (hookName === "writeFile") {
1796
- const [_code, path5] = parameters;
1797
- logger.spinner.suffixText = pc3__default.default.dim(path5);
1798
- } else {
1799
- logger.spinner.suffixText = messsage;
1800
- }
1801
- }
1802
- if (logger.logLevel === LogLevel.debug) {
1803
- logger.info(messsage);
2641
+ if (logger.logLevel === chunkPLVKILIY_cjs.LogLevel.debug) {
1804
2642
  const logs = [
1805
- parameters && `${pc3__default.default.bgWhite(`Parameters`)} ${randomPicoColour(plugin.name)} ${hookName}`,
2643
+ `${chunkPLVKILIY_cjs.randomCliColour(plugin.name)} Executing ${hookName}`,
2644
+ parameters && `${chunkPLVKILIY_cjs.p.bgWhite(`Parameters`)} ${chunkPLVKILIY_cjs.randomCliColour(plugin.name)} ${hookName}`,
1806
2645
  JSON.stringify(parameters, void 0, 2),
1807
- output && `${pc3__default.default.bgWhite("Output")} ${randomPicoColour(plugin.name)} ${hookName}`,
2646
+ output && `${chunkPLVKILIY_cjs.p.bgWhite("Output")} ${chunkPLVKILIY_cjs.randomCliColour(plugin.name)} ${hookName}`,
1808
2647
  output
1809
2648
  ].filter(Boolean);
1810
- console.log(logs.join("\n"));
2649
+ logger.debug(logs.join("\n"));
1811
2650
  }
1812
2651
  });
1813
- await pluginManager.hookParallel({
1814
- hookName: "validate",
1815
- parameters: [plugins]
1816
- });
2652
+ return pluginManager;
2653
+ }
2654
+ async function build(options) {
2655
+ const pluginManager = await setup(options);
2656
+ const { fileManager, logger } = pluginManager;
1817
2657
  await pluginManager.hookParallel({
1818
2658
  hookName: "buildStart",
1819
- parameters: [config]
2659
+ parameters: [options.config]
1820
2660
  });
1821
2661
  await pluginManager.hookParallel({ hookName: "buildEnd" });
1822
- if (!fileManager.isExecuting && logger.spinner) {
2662
+ if (logger.logLevel === chunkPLVKILIY_cjs.LogLevel.info && logger.spinner) {
1823
2663
  logger.spinner.suffixText = "";
1824
2664
  logger.spinner.succeed(`\u{1F4BE} Writing completed`);
1825
2665
  }
1826
2666
  return { files: fileManager.files.map((file) => ({ ...file, source: FileManager.getSource(file) })), pluginManager };
1827
2667
  }
2668
+ async function safeBuild(options) {
2669
+ const pluginManager = await setup(options);
2670
+ const { fileManager, logger } = pluginManager;
2671
+ try {
2672
+ await pluginManager.hookParallel({
2673
+ hookName: "buildStart",
2674
+ parameters: [options.config]
2675
+ });
2676
+ await pluginManager.hookParallel({ hookName: "buildEnd" });
2677
+ if (logger.logLevel === chunkPLVKILIY_cjs.LogLevel.info && logger.spinner) {
2678
+ logger.spinner.suffixText = "";
2679
+ logger.spinner.succeed(`\u{1F4BE} Writing completed`);
2680
+ }
2681
+ } catch (e) {
2682
+ return { files: fileManager.files.map((file) => ({ ...file, source: FileManager.getSource(file) })), pluginManager, error: e };
2683
+ }
2684
+ return { files: fileManager.files.map((file) => ({ ...file, source: FileManager.getSource(file) })), pluginManager };
2685
+ }
1828
2686
 
1829
2687
  // src/Generator.ts
2688
+ chunkWZQO3EPM_cjs.init_cjs_shims();
1830
2689
  var _options3, _context;
1831
2690
  var Generator = class {
1832
2691
  constructor(options, context) {
1833
- __privateAdd(this, _options3, {});
1834
- __privateAdd(this, _context, {});
2692
+ chunkWZQO3EPM_cjs.__privateAdd(this, _options3, {});
2693
+ chunkWZQO3EPM_cjs.__privateAdd(this, _context, {});
1835
2694
  if (context) {
1836
- __privateSet(this, _context, context);
2695
+ chunkWZQO3EPM_cjs.__privateSet(this, _context, context);
1837
2696
  }
1838
2697
  if (options) {
1839
- __privateSet(this, _options3, options);
2698
+ chunkWZQO3EPM_cjs.__privateSet(this, _options3, options);
1840
2699
  }
1841
2700
  return this;
1842
2701
  }
1843
2702
  get options() {
1844
- return __privateGet(this, _options3);
2703
+ return chunkWZQO3EPM_cjs.__privateGet(this, _options3);
1845
2704
  }
1846
2705
  get context() {
1847
- return __privateGet(this, _context);
2706
+ return chunkWZQO3EPM_cjs.__privateGet(this, _context);
1848
2707
  }
1849
2708
  set options(options) {
1850
- __privateSet(this, _options3, { ...__privateGet(this, _options3), ...options });
2709
+ chunkWZQO3EPM_cjs.__privateSet(this, _options3, { ...chunkWZQO3EPM_cjs.__privateGet(this, _options3), ...options });
1851
2710
  }
1852
2711
  };
1853
2712
  _options3 = new WeakMap();
1854
2713
  _context = new WeakMap();
1855
2714
 
2715
+ // src/PackageManager.ts
2716
+ chunkWZQO3EPM_cjs.init_cjs_shims();
2717
+
2718
+ // ../../node_modules/.pnpm/find-up@7.0.0/node_modules/find-up/index.js
2719
+ chunkWZQO3EPM_cjs.init_cjs_shims();
2720
+
2721
+ // ../../node_modules/.pnpm/locate-path@7.2.0/node_modules/locate-path/index.js
2722
+ chunkWZQO3EPM_cjs.init_cjs_shims();
2723
+
2724
+ // ../../node_modules/.pnpm/p-locate@6.0.0/node_modules/p-locate/index.js
2725
+ chunkWZQO3EPM_cjs.init_cjs_shims();
2726
+
2727
+ // ../../node_modules/.pnpm/p-limit@4.0.0/node_modules/p-limit/index.js
2728
+ chunkWZQO3EPM_cjs.init_cjs_shims();
2729
+
1856
2730
  // ../../node_modules/.pnpm/yocto-queue@1.0.0/node_modules/yocto-queue/index.js
2731
+ chunkWZQO3EPM_cjs.init_cjs_shims();
1857
2732
  var Node = class {
1858
2733
  constructor(value) {
1859
- __publicField(this, "value");
1860
- __publicField(this, "next");
2734
+ chunkWZQO3EPM_cjs.__publicField(this, "value");
2735
+ chunkWZQO3EPM_cjs.__publicField(this, "next");
1861
2736
  this.value = value;
1862
2737
  }
1863
2738
  };
1864
2739
  var _head, _tail, _size;
1865
- var Queue2 = class {
2740
+ var Queue = class {
1866
2741
  constructor() {
1867
- __privateAdd(this, _head, void 0);
1868
- __privateAdd(this, _tail, void 0);
1869
- __privateAdd(this, _size, void 0);
2742
+ chunkWZQO3EPM_cjs.__privateAdd(this, _head, void 0);
2743
+ chunkWZQO3EPM_cjs.__privateAdd(this, _tail, void 0);
2744
+ chunkWZQO3EPM_cjs.__privateAdd(this, _size, void 0);
1870
2745
  this.clear();
1871
2746
  }
1872
2747
  enqueue(value) {
1873
2748
  const node = new Node(value);
1874
- if (__privateGet(this, _head)) {
1875
- __privateGet(this, _tail).next = node;
1876
- __privateSet(this, _tail, node);
2749
+ if (chunkWZQO3EPM_cjs.__privateGet(this, _head)) {
2750
+ chunkWZQO3EPM_cjs.__privateGet(this, _tail).next = node;
2751
+ chunkWZQO3EPM_cjs.__privateSet(this, _tail, node);
1877
2752
  } else {
1878
- __privateSet(this, _head, node);
1879
- __privateSet(this, _tail, node);
2753
+ chunkWZQO3EPM_cjs.__privateSet(this, _head, node);
2754
+ chunkWZQO3EPM_cjs.__privateSet(this, _tail, node);
1880
2755
  }
1881
- __privateWrapper(this, _size)._++;
2756
+ chunkWZQO3EPM_cjs.__privateWrapper(this, _size)._++;
1882
2757
  }
1883
2758
  dequeue() {
1884
- const current = __privateGet(this, _head);
2759
+ const current = chunkWZQO3EPM_cjs.__privateGet(this, _head);
1885
2760
  if (!current) {
1886
2761
  return;
1887
2762
  }
1888
- __privateSet(this, _head, __privateGet(this, _head).next);
1889
- __privateWrapper(this, _size)._--;
2763
+ chunkWZQO3EPM_cjs.__privateSet(this, _head, chunkWZQO3EPM_cjs.__privateGet(this, _head).next);
2764
+ chunkWZQO3EPM_cjs.__privateWrapper(this, _size)._--;
1890
2765
  return current.value;
1891
2766
  }
1892
2767
  clear() {
1893
- __privateSet(this, _head, void 0);
1894
- __privateSet(this, _tail, void 0);
1895
- __privateSet(this, _size, 0);
2768
+ chunkWZQO3EPM_cjs.__privateSet(this, _head, void 0);
2769
+ chunkWZQO3EPM_cjs.__privateSet(this, _tail, void 0);
2770
+ chunkWZQO3EPM_cjs.__privateSet(this, _size, 0);
1896
2771
  }
1897
2772
  get size() {
1898
- return __privateGet(this, _size);
2773
+ return chunkWZQO3EPM_cjs.__privateGet(this, _size);
1899
2774
  }
1900
2775
  *[Symbol.iterator]() {
1901
- let current = __privateGet(this, _head);
2776
+ let current = chunkWZQO3EPM_cjs.__privateGet(this, _head);
1902
2777
  while (current) {
1903
2778
  yield current.value;
1904
2779
  current = current.next;
@@ -1914,7 +2789,7 @@ function pLimit(concurrency) {
1914
2789
  if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {
1915
2790
  throw new TypeError("Expected `concurrency` to be a number from 1 and up");
1916
2791
  }
1917
- const queue = new Queue2();
2792
+ const queue = new Queue();
1918
2793
  let activeCount = 0;
1919
2794
  const next = () => {
1920
2795
  activeCount--;
@@ -2014,7 +2889,7 @@ async function locatePath(paths, {
2014
2889
  } = {}) {
2015
2890
  checkType(type);
2016
2891
  cwd = toPath(cwd);
2017
- const statFunction = allowSymlinks ? fs3.promises.stat : fs3.promises.lstat;
2892
+ const statFunction = allowSymlinks ? fs.promises.stat : fs.promises.lstat;
2018
2893
  return pLocate(paths, async (path_) => {
2019
2894
  try {
2020
2895
  const stat = await statFunction(path4__default.default.resolve(cwd, path_));
@@ -2031,7 +2906,7 @@ function locatePathSync(paths, {
2031
2906
  } = {}) {
2032
2907
  checkType(type);
2033
2908
  cwd = toPath(cwd);
2034
- const statFunction = allowSymlinks ? fs3__default.default.statSync : fs3__default.default.lstatSync;
2909
+ const statFunction = allowSymlinks ? fs__default.default.statSync : fs__default.default.lstatSync;
2035
2910
  for (const path_ of paths) {
2036
2911
  try {
2037
2912
  const stat = statFunction(path4__default.default.resolve(cwd, path_), {
@@ -2048,14 +2923,22 @@ function locatePathSync(paths, {
2048
2923
  }
2049
2924
  }
2050
2925
 
2051
- // ../../node_modules/.pnpm/find-up@6.3.0/node_modules/find-up/index.js
2052
- var toPath2 = (urlOrPath) => urlOrPath instanceof URL ? url.fileURLToPath(urlOrPath) : urlOrPath;
2926
+ // ../../node_modules/.pnpm/unicorn-magic@0.1.0/node_modules/unicorn-magic/node.js
2927
+ chunkWZQO3EPM_cjs.init_cjs_shims();
2928
+ function toPath2(urlOrPath) {
2929
+ return urlOrPath instanceof URL ? url.fileURLToPath(urlOrPath) : urlOrPath;
2930
+ }
2931
+
2932
+ // ../../node_modules/.pnpm/path-exists@5.0.0/node_modules/path-exists/index.js
2933
+ chunkWZQO3EPM_cjs.init_cjs_shims();
2934
+
2935
+ // ../../node_modules/.pnpm/find-up@7.0.0/node_modules/find-up/index.js
2053
2936
  var findUpStop = Symbol("findUpStop");
2054
2937
  async function findUpMultiple(name, options = {}) {
2055
- let directory = path4__default.default.resolve(toPath2(options.cwd) || "");
2938
+ let directory = path4__default.default.resolve(toPath2(options.cwd) ?? "");
2056
2939
  const { root } = path4__default.default.parse(directory);
2057
- const stopAt = path4__default.default.resolve(directory, options.stopAt || root);
2058
- const limit = options.limit || Number.POSITIVE_INFINITY;
2940
+ const stopAt = path4__default.default.resolve(directory, toPath2(options.stopAt ?? root));
2941
+ const limit = options.limit ?? Number.POSITIVE_INFINITY;
2059
2942
  const paths = [name].flat();
2060
2943
  const runMatcher = async (locateOptions) => {
2061
2944
  if (typeof name !== "function") {
@@ -2084,10 +2967,10 @@ async function findUpMultiple(name, options = {}) {
2084
2967
  return matches;
2085
2968
  }
2086
2969
  function findUpMultipleSync(name, options = {}) {
2087
- let directory = path4__default.default.resolve(toPath2(options.cwd) || "");
2970
+ let directory = path4__default.default.resolve(toPath2(options.cwd) ?? "");
2088
2971
  const { root } = path4__default.default.parse(directory);
2089
- const stopAt = options.stopAt || root;
2090
- const limit = options.limit || Number.POSITIVE_INFINITY;
2972
+ const stopAt = path4__default.default.resolve(directory, toPath2(options.stopAt) ?? root);
2973
+ const limit = options.limit ?? Number.POSITIVE_INFINITY;
2091
2974
  const paths = [name].flat();
2092
2975
  const runMatcher = (locateOptions) => {
2093
2976
  if (typeof name !== "function") {
@@ -2123,32 +3006,33 @@ function findUpSync(name, options = {}) {
2123
3006
  const matches = findUpMultipleSync(name, { ...options, limit: 1 });
2124
3007
  return matches[0];
2125
3008
  }
2126
- var _cache2, _cwd, _SLASHES;
3009
+ var _cache2, _cwd, _SLASHES, _match, match_fn;
2127
3010
  var _PackageManager = class _PackageManager {
2128
3011
  constructor(workspace) {
2129
- __privateAdd(this, _cwd, void 0);
2130
- __privateAdd(this, _SLASHES, /* @__PURE__ */ new Set(["/", "\\"]));
3012
+ chunkWZQO3EPM_cjs.__privateAdd(this, _match);
3013
+ chunkWZQO3EPM_cjs.__privateAdd(this, _cwd, void 0);
3014
+ chunkWZQO3EPM_cjs.__privateAdd(this, _SLASHES, /* @__PURE__ */ new Set(["/", "\\"]));
2131
3015
  if (workspace) {
2132
- __privateSet(this, _cwd, workspace);
3016
+ chunkWZQO3EPM_cjs.__privateSet(this, _cwd, workspace);
2133
3017
  }
2134
3018
  return this;
2135
3019
  }
2136
3020
  set workspace(workspace) {
2137
- __privateSet(this, _cwd, workspace);
3021
+ chunkWZQO3EPM_cjs.__privateSet(this, _cwd, workspace);
2138
3022
  }
2139
3023
  get workspace() {
2140
- return __privateGet(this, _cwd);
3024
+ return chunkWZQO3EPM_cjs.__privateGet(this, _cwd);
2141
3025
  }
2142
3026
  normalizeDirectory(directory) {
2143
- if (!__privateGet(this, _SLASHES).has(directory[directory.length - 1])) {
3027
+ if (!chunkWZQO3EPM_cjs.__privateGet(this, _SLASHES).has(directory[directory.length - 1])) {
2144
3028
  return `${directory}/`;
2145
3029
  }
2146
3030
  return directory;
2147
3031
  }
2148
3032
  getLocation(path5) {
2149
3033
  let location = path5;
2150
- if (__privateGet(this, _cwd)) {
2151
- const require2 = mod__default.default.createRequire(this.normalizeDirectory(__privateGet(this, _cwd)));
3034
+ if (chunkWZQO3EPM_cjs.__privateGet(this, _cwd)) {
3035
+ const require2 = mod__default.default.createRequire(this.normalizeDirectory(chunkWZQO3EPM_cjs.__privateGet(this, _cwd)));
2152
3036
  location = require2.resolve(path5);
2153
3037
  }
2154
3038
  return location;
@@ -2168,50 +3052,53 @@ var _PackageManager = class _PackageManager {
2168
3052
  }
2169
3053
  async getPackageJSON() {
2170
3054
  const pkgPath = await findUp(["package.json"], {
2171
- cwd: __privateGet(this, _cwd)
3055
+ cwd: chunkWZQO3EPM_cjs.__privateGet(this, _cwd)
2172
3056
  });
2173
3057
  if (!pkgPath) {
2174
3058
  return void 0;
2175
3059
  }
2176
- return __require(pkgPath);
3060
+ return chunkWZQO3EPM_cjs.__require(pkgPath);
2177
3061
  }
2178
3062
  getPackageJSONSync() {
2179
3063
  const pkgPath = findUpSync(["package.json"], {
2180
- cwd: __privateGet(this, _cwd)
3064
+ cwd: chunkWZQO3EPM_cjs.__privateGet(this, _cwd)
2181
3065
  });
2182
3066
  if (!pkgPath) {
2183
3067
  return void 0;
2184
3068
  }
2185
- return __require(pkgPath);
3069
+ return chunkWZQO3EPM_cjs.__require(pkgPath);
2186
3070
  }
2187
3071
  static setVersion(dependency, version) {
2188
- __privateGet(_PackageManager, _cache2)[dependency] = version;
3072
+ chunkWZQO3EPM_cjs.__privateGet(_PackageManager, _cache2)[dependency] = version;
2189
3073
  }
2190
3074
  async getVersion(dependency) {
2191
- if (__privateGet(_PackageManager, _cache2)[dependency]) {
2192
- return __privateGet(_PackageManager, _cache2)[dependency];
3075
+ if (typeof dependency === "string" && chunkWZQO3EPM_cjs.__privateGet(_PackageManager, _cache2)[dependency]) {
3076
+ return chunkWZQO3EPM_cjs.__privateGet(_PackageManager, _cache2)[dependency];
2193
3077
  }
2194
3078
  const packageJSON = await this.getPackageJSON();
2195
3079
  if (!packageJSON) {
2196
3080
  return void 0;
2197
3081
  }
2198
- return packageJSON["dependencies"]?.[dependency] || packageJSON["devDependencies"]?.[dependency];
3082
+ return chunkWZQO3EPM_cjs.__privateMethod(this, _match, match_fn).call(this, packageJSON, dependency);
2199
3083
  }
2200
3084
  getVersionSync(dependency) {
2201
- if (__privateGet(_PackageManager, _cache2)[dependency]) {
2202
- return __privateGet(_PackageManager, _cache2)[dependency];
3085
+ if (typeof dependency === "string" && chunkWZQO3EPM_cjs.__privateGet(_PackageManager, _cache2)[dependency]) {
3086
+ return chunkWZQO3EPM_cjs.__privateGet(_PackageManager, _cache2)[dependency];
2203
3087
  }
2204
3088
  const packageJSON = this.getPackageJSONSync();
2205
3089
  if (!packageJSON) {
2206
3090
  return void 0;
2207
3091
  }
2208
- return packageJSON["dependencies"]?.[dependency] || packageJSON["devDependencies"]?.[dependency];
3092
+ return chunkWZQO3EPM_cjs.__privateMethod(this, _match, match_fn).call(this, packageJSON, dependency);
2209
3093
  }
2210
3094
  async isValid(dependency, version) {
2211
3095
  const packageVersion = await this.getVersion(dependency);
2212
3096
  if (!packageVersion) {
2213
3097
  return false;
2214
3098
  }
3099
+ if (packageVersion === version) {
3100
+ return true;
3101
+ }
2215
3102
  const semVer = semver.coerce(packageVersion);
2216
3103
  if (!semVer) {
2217
3104
  throw new Error(`${packageVersion} is not valid`);
@@ -2233,12 +3120,20 @@ var _PackageManager = class _PackageManager {
2233
3120
  _cache2 = new WeakMap();
2234
3121
  _cwd = new WeakMap();
2235
3122
  _SLASHES = new WeakMap();
2236
- __privateAdd(_PackageManager, _cache2, {});
2237
- var PackageManager = _PackageManager;
2238
-
2239
- // src/SchemaGenerator.ts
2240
- var SchemaGenerator = class extends Generator {
3123
+ _match = new WeakSet();
3124
+ match_fn = function(packageJSON, dependency) {
3125
+ const dependencies = {
3126
+ ...packageJSON["dependencies"] || {},
3127
+ ...packageJSON["devDependencies"] || {}
3128
+ };
3129
+ if (typeof dependency === "string" && dependencies[dependency]) {
3130
+ return dependencies[dependency];
3131
+ }
3132
+ const matchedDependency = Object.keys(dependencies).find((dep) => dep.match(dependency));
3133
+ return matchedDependency ? dependencies[matchedDependency] : void 0;
2241
3134
  };
3135
+ chunkWZQO3EPM_cjs.__privateAdd(_PackageManager, _cache2, {});
3136
+ var PackageManager = _PackageManager;
2242
3137
 
2243
3138
  // src/index.ts
2244
3139
  var src_default = build;
@@ -2246,22 +3141,16 @@ var src_default = build;
2246
3141
  exports.FileManager = FileManager;
2247
3142
  exports.Generator = Generator;
2248
3143
  exports.PackageManager = PackageManager;
2249
- exports.ParallelPluginError = ParallelPluginError;
2250
- exports.PluginError = PluginError;
2251
3144
  exports.PluginManager = PluginManager;
2252
3145
  exports.PromiseManager = PromiseManager;
2253
- exports.SchemaGenerator = SchemaGenerator;
2254
- exports.SummaryError = SummaryError;
2255
- exports.ValidationPluginError = ValidationPluginError;
2256
3146
  exports.Warning = Warning;
2257
3147
  exports.build = build;
2258
- exports.combineExports = combineExports;
2259
- exports.combineImports = combineImports;
2260
3148
  exports.createPlugin = createPlugin;
2261
3149
  exports.default = src_default;
2262
3150
  exports.defineConfig = defineConfig;
2263
3151
  exports.isInputPath = isInputPath;
2264
3152
  exports.name = pluginName;
2265
3153
  exports.pluginName = pluginName;
3154
+ exports.safeBuild = safeBuild;
2266
3155
  //# sourceMappingURL=out.js.map
2267
3156
  //# sourceMappingURL=index.cjs.map