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