@kubb/core 3.0.0-alpha.6 → 3.0.0-alpha.8

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 (72) hide show
  1. package/dist/{FileManager-wyXRkgIk.d.cts → FileManager-B0GJlthB.d.cts} +30 -16
  2. package/dist/{FileManager-Ceski1W9.d.ts → FileManager-BFycBDqG.d.ts} +30 -16
  3. package/dist/chunk-27CPVXAT.js +945 -0
  4. package/dist/chunk-27CPVXAT.js.map +1 -0
  5. package/dist/{chunk-34BPAXR2.cjs → chunk-5E2I6KH4.cjs} +7 -7
  6. package/dist/{chunk-34BPAXR2.cjs.map → chunk-5E2I6KH4.cjs.map} +1 -1
  7. package/dist/chunk-5IGANEGE.cjs +1564 -0
  8. package/dist/chunk-5IGANEGE.cjs.map +1 -0
  9. package/dist/{chunk-67C6RBGQ.cjs → chunk-A6PCLWEY.cjs} +5 -5
  10. package/dist/{chunk-67C6RBGQ.cjs.map → chunk-A6PCLWEY.cjs.map} +1 -1
  11. package/dist/{chunk-5HN4LW3R.cjs → chunk-DID47EQD.cjs} +3 -3
  12. package/dist/{chunk-5HN4LW3R.cjs.map → chunk-DID47EQD.cjs.map} +1 -1
  13. package/dist/{chunk-25NKJ3DV.js → chunk-HBQM723K.js} +6 -6
  14. package/dist/{chunk-LOLEBOMW.cjs → chunk-IPZQXBA2.cjs} +16 -21
  15. package/dist/chunk-IPZQXBA2.cjs.map +1 -0
  16. package/dist/{chunk-76UEJFFE.js → chunk-SCR3LUXT.js} +9 -16
  17. package/dist/{chunk-76UEJFFE.js.map → chunk-SCR3LUXT.js.map} +1 -1
  18. package/dist/{chunk-XCPFG6DO.cjs → chunk-SEH6NUCX.cjs} +4 -28
  19. package/dist/chunk-SEH6NUCX.cjs.map +1 -0
  20. package/dist/index.cjs +380 -378
  21. package/dist/index.cjs.map +1 -1
  22. package/dist/index.d.cts +2 -2
  23. package/dist/index.d.ts +2 -2
  24. package/dist/index.js +325 -319
  25. package/dist/index.js.map +1 -1
  26. package/dist/logger.cjs +4 -4
  27. package/dist/logger.js +2 -3
  28. package/dist/mocks.cjs +20 -15
  29. package/dist/mocks.cjs.map +1 -1
  30. package/dist/mocks.d.cts +6 -5
  31. package/dist/mocks.d.ts +6 -5
  32. package/dist/mocks.js +15 -11
  33. package/dist/mocks.js.map +1 -1
  34. package/dist/{prompt-6FWP747F.cjs → prompt-DVQN7JTN.cjs} +61 -61
  35. package/dist/{prompt-6FWP747F.cjs.map → prompt-DVQN7JTN.cjs.map} +1 -1
  36. package/dist/{prompt-HK3MWREM.js → prompt-WQQUN22Z.js} +5 -6
  37. package/dist/{prompt-HK3MWREM.js.map → prompt-WQQUN22Z.js.map} +1 -1
  38. package/dist/transformers.cjs +19 -19
  39. package/dist/transformers.js +0 -1
  40. package/dist/transformers.js.map +1 -1
  41. package/dist/utils.cjs +8 -4
  42. package/dist/utils.cjs.map +1 -1
  43. package/dist/utils.d.cts +25 -24
  44. package/dist/utils.d.ts +25 -24
  45. package/dist/utils.js +5 -2
  46. package/package.json +7 -7
  47. package/src/BarrelManager.ts +90 -40
  48. package/src/FileManager.ts +89 -109
  49. package/src/PluginManager.ts +2 -1
  50. package/src/__snapshots__/barrel.json +91 -0
  51. package/src/__snapshots__/grouped.json +114 -0
  52. package/src/__snapshots__/ordered.json +62 -0
  53. package/src/build.ts +60 -23
  54. package/src/plugin.ts +2 -2
  55. package/src/types.ts +22 -2
  56. package/src/utils/TreeNode.ts +43 -1
  57. package/src/utils/index.ts +1 -1
  58. package/src/utils/parser.ts +128 -67
  59. package/dist/chunk-AWAZR3D5.js +0 -360
  60. package/dist/chunk-AWAZR3D5.js.map +0 -1
  61. package/dist/chunk-DCZQYCCO.cjs +0 -1155
  62. package/dist/chunk-DCZQYCCO.cjs.map +0 -1
  63. package/dist/chunk-HMLY7DHA.js +0 -16
  64. package/dist/chunk-HMLY7DHA.js.map +0 -1
  65. package/dist/chunk-L3JJLZ5Q.cjs +0 -371
  66. package/dist/chunk-L3JJLZ5Q.cjs.map +0 -1
  67. package/dist/chunk-LOLEBOMW.cjs.map +0 -1
  68. package/dist/chunk-RIEGCND2.js +0 -525
  69. package/dist/chunk-RIEGCND2.js.map +0 -1
  70. package/dist/chunk-XCPFG6DO.cjs.map +0 -1
  71. package/schema.json +0 -86
  72. /package/dist/{chunk-25NKJ3DV.js.map → chunk-HBQM723K.js.map} +0 -0
package/dist/index.cjs CHANGED
@@ -1,46 +1,37 @@
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}); 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; } var _class;
2
2
 
3
- var _chunk5HN4LW3Rcjs = require('./chunk-5HN4LW3R.cjs');
3
+ var _chunkDID47EQDcjs = require('./chunk-DID47EQD.cjs');
4
4
 
5
5
 
6
6
 
7
+ var _chunkIPZQXBA2cjs = require('./chunk-IPZQXBA2.cjs');
7
8
 
8
- var _chunkLOLEBOMWcjs = require('./chunk-LOLEBOMW.cjs');
9
9
 
10
10
 
11
11
 
12
- var _chunkDCZQYCCOcjs = require('./chunk-DCZQYCCO.cjs');
13
12
 
13
+ var _chunk5IGANEGEcjs = require('./chunk-5IGANEGE.cjs');
14
+ require('./chunk-A6PCLWEY.cjs');
15
+ require('./chunk-5E2I6KH4.cjs');
14
16
 
15
17
 
16
- var _chunkL3JJLZ5Qcjs = require('./chunk-L3JJLZ5Q.cjs');
17
- require('./chunk-67C6RBGQ.cjs');
18
- require('./chunk-34BPAXR2.cjs');
19
-
20
-
21
-
22
-
23
-
24
-
25
-
26
-
27
- var _chunkXCPFG6DOcjs = require('./chunk-XCPFG6DO.cjs');
18
+ var _chunkSEH6NUCXcjs = require('./chunk-SEH6NUCX.cjs');
28
19
 
29
20
  // src/index.ts
30
- _chunkXCPFG6DOcjs.init_cjs_shims.call(void 0, );
21
+ _chunkSEH6NUCXcjs.init_cjs_shims.call(void 0, );
31
22
 
32
23
  // src/build.ts
33
- _chunkXCPFG6DOcjs.init_cjs_shims.call(void 0, );
24
+ _chunkSEH6NUCXcjs.init_cjs_shims.call(void 0, );
34
25
  var _fs = require('@kubb/fs');
35
26
 
36
27
  // src/PluginManager.ts
37
- _chunkXCPFG6DOcjs.init_cjs_shims.call(void 0, );
28
+ _chunkSEH6NUCXcjs.init_cjs_shims.call(void 0, );
38
29
 
39
30
  // src/PromiseManager.ts
40
- _chunkXCPFG6DOcjs.init_cjs_shims.call(void 0, );
31
+ _chunkSEH6NUCXcjs.init_cjs_shims.call(void 0, );
41
32
 
42
33
  // src/utils/executeStrategies.ts
43
- _chunkXCPFG6DOcjs.init_cjs_shims.call(void 0, );
34
+ _chunkSEH6NUCXcjs.init_cjs_shims.call(void 0, );
44
35
  function hookSeq(promises) {
45
36
  return promises.filter(Boolean).reduce(
46
37
  (promise, func) => {
@@ -75,11 +66,10 @@ function hookParallel(promises) {
75
66
  }
76
67
 
77
68
  // src/PromiseManager.ts
78
- var _options;
79
69
  var PromiseManager = class {
70
+ #options = {};
80
71
  constructor(options = {}) {
81
- _chunkXCPFG6DOcjs.__privateAdd.call(void 0, this, _options, {});
82
- _chunkXCPFG6DOcjs.__privateSet.call(void 0, this, _options, options);
72
+ this.#options = options;
83
73
  return this;
84
74
  }
85
75
  run(strategy, promises) {
@@ -87,7 +77,7 @@ var PromiseManager = class {
87
77
  return hookSeq(promises);
88
78
  }
89
79
  if (strategy === "first") {
90
- return hookFirst(promises, _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _options).nullCheck);
80
+ return hookFirst(promises, this.#options.nullCheck);
91
81
  }
92
82
  if (strategy === "parallel") {
93
83
  return hookParallel(promises);
@@ -95,25 +85,24 @@ var PromiseManager = class {
95
85
  throw new Error(`${strategy} not implemented`);
96
86
  }
97
87
  };
98
- _options = new WeakMap();
99
88
  function isPromise(result) {
100
- return !!result && typeof _optionalChain([result, 'optionalAccess', _2 => _2.then]) === "function";
89
+ return !!result && typeof _optionalChain([result, 'optionalAccess', _ => _.then]) === "function";
101
90
  }
102
91
  function isPromiseRejectedResult(result) {
103
92
  return result.status === "rejected";
104
93
  }
105
94
 
106
95
  // src/errors.ts
107
- _chunkXCPFG6DOcjs.init_cjs_shims.call(void 0, );
96
+ _chunkSEH6NUCXcjs.init_cjs_shims.call(void 0, );
108
97
  var ValidationPluginError = class extends Error {
109
98
  };
110
99
 
111
100
  // src/plugin.ts
112
- _chunkXCPFG6DOcjs.init_cjs_shims.call(void 0, );
101
+ _chunkSEH6NUCXcjs.init_cjs_shims.call(void 0, );
113
102
  var _path = require('path'); var _path2 = _interopRequireDefault(_path);
114
103
 
115
104
  // src/utils/cache.ts
116
- _chunkXCPFG6DOcjs.init_cjs_shims.call(void 0, );
105
+ _chunkSEH6NUCXcjs.init_cjs_shims.call(void 0, );
117
106
  function createPluginCache(Store = /* @__PURE__ */ Object.create(null)) {
118
107
  return {
119
108
  set(id, value) {
@@ -180,7 +169,7 @@ var pluginCore = createPlugin((options) => {
180
169
  };
181
170
  },
182
171
  resolvePath(baseName) {
183
- const root = _path2.default.resolve(this.config.root, this.config.output.path);
172
+ const root = _path2.default.resolve(options.config.root, options.config.output.path);
184
173
  return _path2.default.resolve(root, baseName);
185
174
  },
186
175
  resolveName(name) {
@@ -190,75 +179,25 @@ var pluginCore = createPlugin((options) => {
190
179
  });
191
180
 
192
181
  // src/PluginManager.ts
193
- var _core, _usedPluginNames, _promiseManager, _PluginManager_instances, getSortedPlugins_fn, addExecutedToCallStack_fn, execute_fn, executeSync_fn, catcher_fn, parse_fn;
194
- var PluginManager = class {
195
- constructor(config, options) {
196
- _chunkXCPFG6DOcjs.__privateAdd.call(void 0, this, _PluginManager_instances);
197
- this.events = new (0, _chunkLOLEBOMWcjs.EventEmitter)();
198
- this.executed = [];
199
- _chunkXCPFG6DOcjs.__privateAdd.call(void 0, this, _core);
200
- _chunkXCPFG6DOcjs.__privateAdd.call(void 0, this, _usedPluginNames, {});
201
- _chunkXCPFG6DOcjs.__privateAdd.call(void 0, this, _promiseManager);
202
- this.resolvePath = (params) => {
203
- if (params.pluginKey) {
204
- const paths = this.hookForPluginSync({
205
- pluginKey: params.pluginKey,
206
- hookName: "resolvePath",
207
- parameters: [params.baseName, params.mode, params.options]
208
- });
209
- if (paths && _optionalChain([paths, 'optionalAccess', _3 => _3.length]) > 1) {
210
- this.logger.emit("debug", {
211
- logs: [
212
- `Cannot return a path where the 'pluginKey' ${params.pluginKey ? JSON.stringify(params.pluginKey) : '"'} is not unique enough
213
-
214
- Paths: ${JSON.stringify(paths, void 0, 2)}
215
-
216
- Falling back on the first item.
217
- `
218
- ]
219
- });
220
- }
221
- return _optionalChain([paths, 'optionalAccess', _4 => _4.at, 'call', _5 => _5(0)]);
222
- }
223
- return this.hookFirstSync({
224
- hookName: "resolvePath",
225
- parameters: [params.baseName, params.mode, params.options]
226
- }).result;
227
- };
228
- this.resolveName = (params) => {
229
- if (params.pluginKey) {
230
- const names = this.hookForPluginSync({
231
- pluginKey: params.pluginKey,
232
- hookName: "resolveName",
233
- parameters: [params.name, params.type]
234
- });
235
- if (names && _optionalChain([names, 'optionalAccess', _6 => _6.length]) > 1) {
236
- this.logger.emit("debug", {
237
- logs: [
238
- `Cannot return a name where the 'pluginKey' ${params.pluginKey ? JSON.stringify(params.pluginKey) : '"'} is not unique enough
239
-
240
- Names: ${JSON.stringify(names, void 0, 2)}
241
-
242
- Falling back on the first item.
243
- `
244
- ]
245
- });
246
- }
247
- return _chunk5HN4LW3Rcjs.transformReservedWord.call(void 0, _optionalChain([names, 'optionalAccess', _7 => _7.at, 'call', _8 => _8(0)]) || params.name);
248
- }
249
- const name = this.hookFirstSync({
250
- hookName: "resolveName",
251
- parameters: [params.name, params.type]
252
- }).result;
253
- return _chunk5HN4LW3Rcjs.transformReservedWord.call(void 0, name);
254
- };
182
+ var PluginManager = (_class = class {
183
+
184
+
185
+ __init() {this.events = new (0, _chunkIPZQXBA2cjs.EventEmitter)()}
186
+
187
+ __init2() {this.executed = []}
188
+
189
+
190
+ #core;
191
+ #usedPluginNames = {};
192
+ #promiseManager;
193
+ constructor(config, options) {;_class.prototype.__init.call(this);_class.prototype.__init2.call(this);_class.prototype.__init3.call(this);_class.prototype.__init4.call(this);
255
194
  this.config = config;
256
195
  this.options = options;
257
196
  this.logger = options.logger;
258
- this.fileManager = new (0, _chunkDCZQYCCOcjs.FileManager)();
259
- _chunkXCPFG6DOcjs.__privateSet.call(void 0, this, _promiseManager, new PromiseManager({
260
- nullCheck: (state) => !!_optionalChain([state, 'optionalAccess', _9 => _9.result])
261
- }));
197
+ this.fileManager = new (0, _chunk5IGANEGEcjs.FileManager)();
198
+ this.#promiseManager = new PromiseManager({
199
+ nullCheck: (state) => !!_optionalChain([state, 'optionalAccess', _8 => _8.result])
200
+ });
262
201
  const plugins = config.plugins || [];
263
202
  const core = pluginCore({
264
203
  config,
@@ -267,11 +206,11 @@ Falling back on the first item.
267
206
  fileManager: this.fileManager,
268
207
  resolvePath: this.resolvePath.bind(this),
269
208
  resolveName: this.resolveName.bind(this),
270
- getPlugins: _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, getSortedPlugins_fn).bind(this)
209
+ getPlugins: this.#getSortedPlugins.bind(this)
271
210
  });
272
- _chunkXCPFG6DOcjs.__privateSet.call(void 0, this, _core, _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, parse_fn).call(this, core, this, core.context.call(null)));
273
- this.plugins = [_chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _core), ...plugins].map((plugin) => {
274
- return _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, parse_fn).call(this, plugin, this, _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _core).context);
211
+ this.#core = this.#parse(core, this, core.context.call(null));
212
+ this.plugins = [this.#core, ...plugins].map((plugin) => {
213
+ return this.#parse(plugin, this, this.#core.context);
275
214
  });
276
215
  return this;
277
216
  }
@@ -290,6 +229,60 @@ Falling back on the first item.
290
229
  sources: []
291
230
  };
292
231
  }
232
+ __init3() {this.resolvePath = (params) => {
233
+ if (params.pluginKey) {
234
+ const paths = this.hookForPluginSync({
235
+ pluginKey: params.pluginKey,
236
+ hookName: "resolvePath",
237
+ parameters: [params.baseName, params.mode, params.options]
238
+ });
239
+ if (paths && _optionalChain([paths, 'optionalAccess', _9 => _9.length]) > 1) {
240
+ this.logger.emit("debug", {
241
+ logs: [
242
+ `Cannot return a path where the 'pluginKey' ${params.pluginKey ? JSON.stringify(params.pluginKey) : '"'} is not unique enough
243
+
244
+ Paths: ${JSON.stringify(paths, void 0, 2)}
245
+
246
+ Falling back on the first item.
247
+ `
248
+ ]
249
+ });
250
+ }
251
+ return _optionalChain([paths, 'optionalAccess', _10 => _10.at, 'call', _11 => _11(0)]);
252
+ }
253
+ return this.hookFirstSync({
254
+ hookName: "resolvePath",
255
+ parameters: [params.baseName, params.mode, params.options]
256
+ }).result;
257
+ }}
258
+ //TODO refactor by using the order of plugins and the cache of the fileManager instead of guessing and recreating the name/path
259
+ __init4() {this.resolveName = (params) => {
260
+ if (params.pluginKey) {
261
+ const names = this.hookForPluginSync({
262
+ pluginKey: params.pluginKey,
263
+ hookName: "resolveName",
264
+ parameters: [params.name, params.type]
265
+ });
266
+ if (names && _optionalChain([names, 'optionalAccess', _12 => _12.length]) > 1) {
267
+ this.logger.emit("debug", {
268
+ logs: [
269
+ `Cannot return a name where the 'pluginKey' ${params.pluginKey ? JSON.stringify(params.pluginKey) : '"'} is not unique enough
270
+
271
+ Names: ${JSON.stringify(names, void 0, 2)}
272
+
273
+ Falling back on the first item.
274
+ `
275
+ ]
276
+ });
277
+ }
278
+ return _chunkDID47EQDcjs.transformReservedWord.call(void 0, _optionalChain([names, 'optionalAccess', _13 => _13.at, 'call', _14 => _14(0)]) || params.name);
279
+ }
280
+ const name = this.hookFirstSync({
281
+ hookName: "resolveName",
282
+ parameters: [params.name, params.type]
283
+ }).result;
284
+ return _chunkDID47EQDcjs.transformReservedWord.call(void 0, name);
285
+ }}
293
286
  /**
294
287
  * Instead of calling `pluginManager.events.on` you can use `pluginManager.on`. This one also has better types.
295
288
  */
@@ -307,7 +300,7 @@ Falling back on the first item.
307
300
  const plugins = this.getPluginsByKey(hookName, pluginKey);
308
301
  this.logger.emit("progress_start", { id: hookName, size: plugins.length });
309
302
  const promises = plugins.map((plugin) => {
310
- return _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, execute_fn).call(this, {
303
+ return this.#execute({
311
304
  strategy: "hookFirst",
312
305
  hookName,
313
306
  parameters,
@@ -328,7 +321,7 @@ Falling back on the first item.
328
321
  }) {
329
322
  const plugins = this.getPluginsByKey(hookName, pluginKey);
330
323
  const result = plugins.map((plugin) => {
331
- return _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, executeSync_fn).call(this, {
324
+ return this.#executeSync({
332
325
  strategy: "hookFirst",
333
326
  hookName,
334
327
  parameters,
@@ -345,13 +338,13 @@ Falling back on the first item.
345
338
  parameters,
346
339
  skipped
347
340
  }) {
348
- const plugins = _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, getSortedPlugins_fn).call(this, hookName).filter((plugin) => {
341
+ const plugins = this.#getSortedPlugins(hookName).filter((plugin) => {
349
342
  return skipped ? skipped.has(plugin) : true;
350
343
  });
351
344
  this.logger.emit("progress_start", { id: hookName, size: plugins.length });
352
345
  const promises = plugins.map((plugin) => {
353
346
  return async () => {
354
- const value = await _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, execute_fn).call(this, {
347
+ const value = await this.#execute({
355
348
  strategy: "hookFirst",
356
349
  hookName,
357
350
  parameters,
@@ -363,7 +356,7 @@ Falling back on the first item.
363
356
  });
364
357
  };
365
358
  });
366
- const result = await _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _promiseManager).run("first", promises);
359
+ const result = await this.#promiseManager.run("first", promises);
367
360
  this.logger.emit("progress_stop", { id: hookName });
368
361
  return result;
369
362
  }
@@ -376,12 +369,12 @@ Falling back on the first item.
376
369
  skipped
377
370
  }) {
378
371
  let parseResult = null;
379
- const plugins = _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, getSortedPlugins_fn).call(this, hookName).filter((plugin) => {
372
+ const plugins = this.#getSortedPlugins(hookName).filter((plugin) => {
380
373
  return skipped ? skipped.has(plugin) : true;
381
374
  });
382
375
  for (const plugin of plugins) {
383
376
  parseResult = {
384
- result: _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, executeSync_fn).call(this, {
377
+ result: this.#executeSync({
385
378
  strategy: "hookFirst",
386
379
  hookName,
387
380
  parameters,
@@ -389,7 +382,7 @@ Falling back on the first item.
389
382
  }),
390
383
  plugin
391
384
  };
392
- if (_optionalChain([parseResult, 'optionalAccess', _10 => _10.result]) != null) {
385
+ if (_optionalChain([parseResult, 'optionalAccess', _15 => _15.result]) != null) {
393
386
  break;
394
387
  }
395
388
  }
@@ -402,21 +395,21 @@ Falling back on the first item.
402
395
  hookName,
403
396
  parameters
404
397
  }) {
405
- const plugins = _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, getSortedPlugins_fn).call(this, hookName);
398
+ const plugins = this.#getSortedPlugins(hookName);
406
399
  this.logger.emit("progress_start", { id: hookName, size: plugins.length });
407
400
  const promises = plugins.map((plugin) => {
408
- return () => _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, execute_fn).call(this, {
401
+ return () => this.#execute({
409
402
  strategy: "hookParallel",
410
403
  hookName,
411
404
  parameters,
412
405
  plugin
413
406
  });
414
407
  });
415
- const results = await _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _promiseManager).run("parallel", promises);
408
+ const results = await this.#promiseManager.run("parallel", promises);
416
409
  results.forEach((result, index) => {
417
410
  if (isPromiseRejectedResult(result)) {
418
- const plugin = _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, getSortedPlugins_fn).call(this, hookName)[index];
419
- _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, catcher_fn).call(this, result.reason, plugin, hookName);
411
+ const plugin = this.#getSortedPlugins(hookName)[index];
412
+ this.#catcher(result.reason, plugin, hookName);
420
413
  }
421
414
  });
422
415
  this.logger.emit("progress_stop", { id: hookName });
@@ -431,18 +424,18 @@ Falling back on the first item.
431
424
  reduce
432
425
  }) {
433
426
  const [argument0, ...rest] = parameters;
434
- const plugins = _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, getSortedPlugins_fn).call(this, hookName);
427
+ const plugins = this.#getSortedPlugins(hookName);
435
428
  let promise = Promise.resolve(argument0);
436
429
  for (const plugin of plugins) {
437
430
  promise = promise.then((arg0) => {
438
- const value = _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, execute_fn).call(this, {
431
+ const value = this.#execute({
439
432
  strategy: "hookReduceArg0",
440
433
  hookName,
441
434
  parameters: [arg0, ...rest],
442
435
  plugin
443
436
  });
444
437
  return value;
445
- }).then((result) => reduce.call(_chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _core).context, argument0, result, plugin));
438
+ }).then((result) => reduce.call(this.#core.context, argument0, result, plugin));
446
439
  }
447
440
  return promise;
448
441
  }
@@ -450,32 +443,59 @@ Falling back on the first item.
450
443
  * Chains plugins
451
444
  */
452
445
  async hookSeq({ hookName, parameters }) {
453
- const plugins = _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, getSortedPlugins_fn).call(this, hookName);
446
+ const plugins = this.#getSortedPlugins(hookName);
454
447
  this.logger.emit("progress_start", { id: hookName, size: plugins.length });
455
448
  const promises = plugins.map((plugin) => {
456
- return () => _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, execute_fn).call(this, {
449
+ return () => this.#execute({
457
450
  strategy: "hookSeq",
458
451
  hookName,
459
452
  parameters,
460
453
  plugin
461
454
  });
462
455
  });
463
- await _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _promiseManager).run("seq", promises);
456
+ await this.#promiseManager.run("seq", promises);
464
457
  this.logger.emit("progress_stop", { id: hookName });
465
458
  }
459
+ #getSortedPlugins(hookName) {
460
+ const plugins = [...this.plugins].filter((plugin) => plugin.name !== "core");
461
+ if (hookName) {
462
+ const containsHookName = plugins.some((item) => item[hookName]);
463
+ if (!containsHookName) {
464
+ this.logger.emit("debug", { logs: [`No hook ${hookName} found`] });
465
+ }
466
+ return plugins.filter((item) => item[hookName]);
467
+ }
468
+ return plugins.map((plugin) => {
469
+ if (plugin.pre) {
470
+ const isValid = plugin.pre.every((pluginName) => plugins.find((pluginToFind) => pluginToFind.name === pluginName));
471
+ if (!isValid) {
472
+ throw new ValidationPluginError(`This plugin has a pre set that is not valid(${JSON.stringify(plugin.pre, void 0, 2)})`);
473
+ }
474
+ }
475
+ return plugin;
476
+ }).sort((a, b) => {
477
+ if (_optionalChain([b, 'access', _16 => _16.pre, 'optionalAccess', _17 => _17.includes, 'call', _18 => _18(a.name)])) {
478
+ return 1;
479
+ }
480
+ if (_optionalChain([b, 'access', _19 => _19.post, 'optionalAccess', _20 => _20.includes, 'call', _21 => _21(a.name)])) {
481
+ return -1;
482
+ }
483
+ return 0;
484
+ });
485
+ }
466
486
  getPluginsByKey(hookName, pluginKey) {
467
487
  const plugins = [...this.plugins];
468
488
  const [searchPluginName, searchIdentifier] = pluginKey;
469
489
  const pluginByPluginName = plugins.filter((plugin) => plugin[hookName]).filter((item) => {
470
490
  const [name, identifier] = item.key;
471
- const identifierCheck = _optionalChain([identifier, 'optionalAccess', _11 => _11.toString, 'call', _12 => _12()]) === _optionalChain([searchIdentifier, 'optionalAccess', _13 => _13.toString, 'call', _14 => _14()]);
491
+ const identifierCheck = _optionalChain([identifier, 'optionalAccess', _22 => _22.toString, 'call', _23 => _23()]) === _optionalChain([searchIdentifier, 'optionalAccess', _24 => _24.toString, 'call', _25 => _25()]);
472
492
  const nameCheck = name === searchPluginName;
473
493
  if (searchIdentifier) {
474
494
  return identifierCheck && nameCheck;
475
495
  }
476
496
  return nameCheck;
477
497
  });
478
- if (!_optionalChain([pluginByPluginName, 'optionalAccess', _15 => _15.length])) {
498
+ if (!_optionalChain([pluginByPluginName, 'optionalAccess', _26 => _26.length])) {
479
499
  const corePlugin = plugins.find((plugin) => plugin.name === "core" && plugin[hookName]);
480
500
  if (corePlugin) {
481
501
  this.logger.emit("debug", {
@@ -490,6 +510,120 @@ Falling back on the first item.
490
510
  }
491
511
  return pluginByPluginName;
492
512
  }
513
+ #addExecutedToCallStack(executer) {
514
+ if (executer) {
515
+ this.events.emit("executed", executer);
516
+ this.executed.push(executer);
517
+ this.logger.emit("progress", { id: executer.hookName, data: `${executer.plugin.name} ${_optionalChain([executer, 'access', _27 => _27.parameters, 'optionalAccess', _28 => _28.join, 'call', _29 => _29(", ")]) || ""}` });
518
+ }
519
+ }
520
+ /**
521
+ * Run an async plugin hook and return the result.
522
+ * @param hookName Name of the plugin hook. Must be either in `PluginHooks` or `OutputPluginValueHooks`.
523
+ * @param args Arguments passed to the plugin hook.
524
+ * @param plugin The actual pluginObject to run.
525
+ */
526
+ // Implementation signature
527
+ #execute({
528
+ strategy,
529
+ hookName,
530
+ parameters,
531
+ plugin
532
+ }) {
533
+ const hook = plugin[hookName];
534
+ let output;
535
+ if (!hook) {
536
+ return null;
537
+ }
538
+ this.events.emit("execute", { strategy, hookName, parameters, plugin });
539
+ const promise = new Promise((resolve2) => {
540
+ resolve2(void 0);
541
+ });
542
+ const task = promise.then(() => {
543
+ if (typeof hook === "function") {
544
+ const possiblePromiseResult = hook.apply({ ...this.#core.context, plugin }, parameters);
545
+ if (isPromise(possiblePromiseResult)) {
546
+ return Promise.resolve(possiblePromiseResult);
547
+ }
548
+ return possiblePromiseResult;
549
+ }
550
+ return hook;
551
+ }).then((result) => {
552
+ output = result;
553
+ this.#addExecutedToCallStack({
554
+ parameters,
555
+ output,
556
+ strategy,
557
+ hookName,
558
+ plugin
559
+ });
560
+ return result;
561
+ }).catch((e) => {
562
+ this.#catcher(e, plugin, hookName);
563
+ return null;
564
+ });
565
+ return task;
566
+ }
567
+ /**
568
+ * Run a sync plugin hook and return the result.
569
+ * @param hookName Name of the plugin hook. Must be in `PluginHooks`.
570
+ * @param args Arguments passed to the plugin hook.
571
+ * @param plugin The acutal plugin
572
+ * @param replaceContext When passed, the plugin context can be overridden.
573
+ */
574
+ #executeSync({
575
+ strategy,
576
+ hookName,
577
+ parameters,
578
+ plugin
579
+ }) {
580
+ const hook = plugin[hookName];
581
+ let output;
582
+ if (!hook) {
583
+ return null;
584
+ }
585
+ this.events.emit("execute", { strategy, hookName, parameters, plugin });
586
+ try {
587
+ if (typeof hook === "function") {
588
+ const fn = hook.apply({ ...this.#core.context, plugin }, parameters);
589
+ output = fn;
590
+ return fn;
591
+ }
592
+ output = hook;
593
+ this.#addExecutedToCallStack({
594
+ parameters,
595
+ output,
596
+ strategy,
597
+ hookName,
598
+ plugin
599
+ });
600
+ return hook;
601
+ } catch (e) {
602
+ this.#catcher(e, plugin, hookName);
603
+ return null;
604
+ }
605
+ }
606
+ #catcher(cause, plugin, hookName) {
607
+ const text = `${cause.message} (plugin: ${_optionalChain([plugin, 'optionalAccess', _30 => _30.name]) || "unknown"}, hook: ${hookName || "unknown"})`;
608
+ this.logger.emit("error", text, cause);
609
+ this.events.emit("error", cause);
610
+ }
611
+ #parse(plugin, pluginManager, context) {
612
+ const usedPluginNames = pluginManager.#usedPluginNames;
613
+ _chunk5IGANEGEcjs.setUniqueName.call(void 0, plugin.name, usedPluginNames);
614
+ const key = [plugin.name, usedPluginNames[plugin.name]].filter(Boolean);
615
+ if (plugin.context && typeof plugin.context === "function") {
616
+ return {
617
+ ...plugin,
618
+ key,
619
+ context: plugin.context.call(context)
620
+ };
621
+ }
622
+ return {
623
+ ...plugin,
624
+ key
625
+ };
626
+ }
493
627
  static getDependedPlugins(plugins, dependedPluginNames) {
494
628
  let pluginNames = [];
495
629
  if (typeof dependedPluginNames === "string") {
@@ -508,155 +642,10 @@ Falling back on the first item.
508
642
  static get hooks() {
509
643
  return ["buildStart", "resolvePath", "resolveName", "buildEnd"];
510
644
  }
511
- };
512
- _core = new WeakMap();
513
- _usedPluginNames = new WeakMap();
514
- _promiseManager = new WeakMap();
515
- _PluginManager_instances = new WeakSet();
516
- getSortedPlugins_fn = function(hookName) {
517
- const plugins = [...this.plugins].filter((plugin) => plugin.name !== "core");
518
- if (hookName) {
519
- const containsHookName = plugins.some((item) => item[hookName]);
520
- if (!containsHookName) {
521
- this.logger.emit("debug", { logs: [`No hook ${hookName} found`] });
522
- }
523
- return plugins.filter((item) => item[hookName]);
524
- }
525
- return plugins.map((plugin) => {
526
- if (plugin.pre) {
527
- const isValid = plugin.pre.every((pluginName) => plugins.find((pluginToFind) => pluginToFind.name === pluginName));
528
- if (!isValid) {
529
- throw new ValidationPluginError(`This plugin has a pre set that is not valid(${JSON.stringify(plugin.pre, void 0, 2)})`);
530
- }
531
- }
532
- return plugin;
533
- }).sort((a, b) => {
534
- if (_optionalChain([b, 'access', _16 => _16.pre, 'optionalAccess', _17 => _17.includes, 'call', _18 => _18(a.name)])) {
535
- return 1;
536
- }
537
- if (_optionalChain([b, 'access', _19 => _19.post, 'optionalAccess', _20 => _20.includes, 'call', _21 => _21(a.name)])) {
538
- return -1;
539
- }
540
- return 0;
541
- });
542
- };
543
- addExecutedToCallStack_fn = function(executer) {
544
- if (executer) {
545
- this.events.emit("executed", executer);
546
- this.executed.push(executer);
547
- this.logger.emit("progress", { id: executer.hookName, data: `${executer.plugin.name}` });
548
- }
549
- };
550
- /**
551
- * Run an async plugin hook and return the result.
552
- * @param hookName Name of the plugin hook. Must be either in `PluginHooks` or `OutputPluginValueHooks`.
553
- * @param args Arguments passed to the plugin hook.
554
- * @param plugin The actual pluginObject to run.
555
- */
556
- // Implementation signature
557
- execute_fn = function({
558
- strategy,
559
- hookName,
560
- parameters,
561
- plugin
562
- }) {
563
- const hook = plugin[hookName];
564
- let output;
565
- if (!hook) {
566
- return null;
567
- }
568
- this.events.emit("execute", { strategy, hookName, parameters, plugin });
569
- const promise = new Promise((resolve) => {
570
- resolve(void 0);
571
- });
572
- const task = promise.then(() => {
573
- if (typeof hook === "function") {
574
- const possiblePromiseResult = hook.apply({ ..._chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _core).context, plugin }, parameters);
575
- if (isPromise(possiblePromiseResult)) {
576
- return Promise.resolve(possiblePromiseResult);
577
- }
578
- return possiblePromiseResult;
579
- }
580
- return hook;
581
- }).then((result) => {
582
- output = result;
583
- _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, addExecutedToCallStack_fn).call(this, {
584
- parameters,
585
- output,
586
- strategy,
587
- hookName,
588
- plugin
589
- });
590
- return result;
591
- }).catch((e) => {
592
- _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, catcher_fn).call(this, e, plugin, hookName);
593
- return null;
594
- });
595
- return task;
596
- };
597
- /**
598
- * Run a sync plugin hook and return the result.
599
- * @param hookName Name of the plugin hook. Must be in `PluginHooks`.
600
- * @param args Arguments passed to the plugin hook.
601
- * @param plugin The acutal plugin
602
- * @param replaceContext When passed, the plugin context can be overridden.
603
- */
604
- executeSync_fn = function({
605
- strategy,
606
- hookName,
607
- parameters,
608
- plugin
609
- }) {
610
- const hook = plugin[hookName];
611
- let output;
612
- if (!hook) {
613
- return null;
614
- }
615
- this.events.emit("execute", { strategy, hookName, parameters, plugin });
616
- try {
617
- if (typeof hook === "function") {
618
- const fn = hook.apply({ ..._chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _core).context, plugin }, parameters);
619
- output = fn;
620
- return fn;
621
- }
622
- output = hook;
623
- _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, addExecutedToCallStack_fn).call(this, {
624
- parameters,
625
- output,
626
- strategy,
627
- hookName,
628
- plugin
629
- });
630
- return hook;
631
- } catch (e) {
632
- _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PluginManager_instances, catcher_fn).call(this, e, plugin, hookName);
633
- return null;
634
- }
635
- };
636
- catcher_fn = function(cause, plugin, hookName) {
637
- const text = `${cause.message} (plugin: ${_optionalChain([plugin, 'optionalAccess', _22 => _22.name]) || "unknown"}, hook: ${hookName || "unknown"})`;
638
- this.logger.emit("error", text, cause);
639
- this.events.emit("error", cause);
640
- };
641
- parse_fn = function(plugin, pluginManager, context) {
642
- const usedPluginNames = _chunkXCPFG6DOcjs.__privateGet.call(void 0, pluginManager, _usedPluginNames);
643
- _chunkL3JJLZ5Qcjs.setUniqueName.call(void 0, plugin.name, usedPluginNames);
644
- const key = [plugin.name, usedPluginNames[plugin.name]].filter(Boolean);
645
- if (plugin.context && typeof plugin.context === "function") {
646
- return {
647
- ...plugin,
648
- key,
649
- context: plugin.context.call(context)
650
- };
651
- }
652
- return {
653
- ...plugin,
654
- key
655
- };
656
- };
645
+ }, _class);
657
646
 
658
647
  // src/config.ts
659
- _chunkXCPFG6DOcjs.init_cjs_shims.call(void 0, );
648
+ _chunkSEH6NUCXcjs.init_cjs_shims.call(void 0, );
660
649
  function defineConfig(options) {
661
650
  return options;
662
651
  }
@@ -665,20 +654,19 @@ function isInputPath(result) {
665
654
  }
666
655
 
667
656
  // src/build.ts
657
+
658
+
668
659
  async function setup(options) {
669
- const { config, logger = _chunkLOLEBOMWcjs.createLogger.call(void 0, ) } = options;
660
+ const { config, logger = _chunkIPZQXBA2cjs.createLogger.call(void 0, ) } = options;
670
661
  try {
671
- if (isInputPath(config) && !new (0, _chunkL3JJLZ5Qcjs.URLPath)(config.input.path).isURL) {
662
+ if (isInputPath(config) && !new (0, _chunk5IGANEGEcjs.URLPath)(config.input.path).isURL) {
672
663
  await _fs.read.call(void 0, config.input.path);
673
664
  }
674
665
  } catch (e) {
675
666
  if (isInputPath(config)) {
676
- throw new Error(
677
- `Cannot read file/URL defined in \`input.path\` or set with \`kubb generate PATH\` in the CLI of your Kubb config ${_chunkLOLEBOMWcjs.p.dim(config.input.path)}`,
678
- {
679
- cause: e
680
- }
681
- );
667
+ throw new Error(`Cannot read file/URL defined in \`input.path\` or set with \`kubb generate PATH\` in the CLI of your Kubb config ${config.input.path}`, {
668
+ cause: e
669
+ });
682
670
  }
683
671
  }
684
672
  if (config.output.clean) {
@@ -687,21 +675,12 @@ async function setup(options) {
687
675
  return new PluginManager(config, { logger });
688
676
  }
689
677
  async function build(options) {
690
- const pluginManager = await setup(options);
691
- await pluginManager.hookParallel({
692
- hookName: "buildStart",
693
- parameters: [options.config]
694
- });
695
- const files = await _chunkDCZQYCCOcjs.processFiles.call(void 0, {
696
- config: options.config,
697
- dryRun: !options.config.output.write,
698
- files: pluginManager.fileManager.files,
699
- logger: pluginManager.logger
700
- });
701
- await pluginManager.hookParallel({ hookName: "buildEnd" });
678
+ const { files, pluginManager, error } = await safeBuild(options);
679
+ if (error) throw error;
702
680
  return {
703
681
  files,
704
- pluginManager
682
+ pluginManager,
683
+ error
705
684
  };
706
685
  }
707
686
  async function safeBuild(options) {
@@ -712,13 +691,50 @@ async function safeBuild(options) {
712
691
  hookName: "buildStart",
713
692
  parameters: [options.config]
714
693
  });
715
- files = await _chunkDCZQYCCOcjs.processFiles.call(void 0, {
694
+ const root = _path.resolve.call(void 0, options.config.root);
695
+ const rootPath = _path.resolve.call(void 0, root, options.config.output.path, "index.ts");
696
+ const barrelFiles = pluginManager.fileManager.files.filter((file) => {
697
+ return file.sources.some((source) => source.isIndexable);
698
+ });
699
+ const rootFile = {
700
+ path: rootPath,
701
+ baseName: "index.ts",
702
+ exports: barrelFiles.flatMap((file) => {
703
+ return _optionalChain([file, 'access', _31 => _31.sources, 'optionalAccess', _32 => _32.map, 'call', _33 => _33((source) => {
704
+ if (!file.path || !source.isIndexable) {
705
+ return void 0;
706
+ }
707
+ const plugin = pluginManager.plugins.find((item) => {
708
+ const meta = file.meta;
709
+ return item.name === _optionalChain([meta, 'optionalAccess', _34 => _34.pluginKey, 'optionalAccess', _35 => _35[0]]);
710
+ });
711
+ if (_optionalChain([plugin, 'optionalAccess', _36 => _36.output, 'optionalAccess', _37 => _37.exportType]) === false) {
712
+ return void 0;
713
+ }
714
+ if (_chunk5IGANEGEcjs.FileManager.getMode(_optionalChain([plugin, 'optionalAccess', _38 => _38.output, 'optionalAccess', _39 => _39.path])) === "single") {
715
+ return void 0;
716
+ }
717
+ return {
718
+ name: options.config.output.exportType === "barrel" ? void 0 : [source.name],
719
+ path: _fs.getRelativePath.call(void 0, rootPath, file.path),
720
+ isTypeOnly: source.isTypeOnly
721
+ };
722
+ }), 'access', _40 => _40.filter, 'call', _41 => _41(Boolean)]);
723
+ }).filter(Boolean),
724
+ sources: [],
725
+ meta: {}
726
+ };
727
+ if (options.config.output.exportType) {
728
+ await pluginManager.fileManager.add(rootFile);
729
+ }
730
+ files = await _chunk5IGANEGEcjs.processFiles.call(void 0, {
716
731
  config: options.config,
717
732
  dryRun: !options.config.output.write,
718
733
  files: pluginManager.fileManager.files,
719
734
  logger: pluginManager.logger
720
735
  });
721
736
  await pluginManager.hookParallel({ hookName: "buildEnd" });
737
+ pluginManager.fileManager.clear();
722
738
  } catch (e) {
723
739
  return {
724
740
  files: [],
@@ -733,112 +749,105 @@ async function safeBuild(options) {
733
749
  }
734
750
 
735
751
  // src/Generator.ts
736
- _chunkXCPFG6DOcjs.init_cjs_shims.call(void 0, );
737
- var _options2, _context;
752
+ _chunkSEH6NUCXcjs.init_cjs_shims.call(void 0, );
738
753
  var Generator = class {
754
+ #options = {};
755
+ #context = {};
739
756
  constructor(options, context) {
740
- _chunkXCPFG6DOcjs.__privateAdd.call(void 0, this, _options2, {});
741
- _chunkXCPFG6DOcjs.__privateAdd.call(void 0, this, _context, {});
742
757
  if (context) {
743
- _chunkXCPFG6DOcjs.__privateSet.call(void 0, this, _context, context);
758
+ this.#context = context;
744
759
  }
745
760
  if (options) {
746
- _chunkXCPFG6DOcjs.__privateSet.call(void 0, this, _options2, options);
761
+ this.#options = options;
747
762
  }
748
763
  return this;
749
764
  }
750
765
  get options() {
751
- return _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _options2);
766
+ return this.#options;
752
767
  }
753
768
  get context() {
754
- return _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _context);
769
+ return this.#context;
755
770
  }
756
771
  set options(options) {
757
- _chunkXCPFG6DOcjs.__privateSet.call(void 0, this, _options2, { ..._chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _options2), ...options });
772
+ this.#options = { ...this.#options, ...options };
758
773
  }
759
774
  };
760
- _options2 = new WeakMap();
761
- _context = new WeakMap();
762
775
 
763
776
  // src/PackageManager.ts
764
- _chunkXCPFG6DOcjs.init_cjs_shims.call(void 0, );
777
+ _chunkSEH6NUCXcjs.init_cjs_shims.call(void 0, );
765
778
  var _module = require('module'); var _module2 = _interopRequireDefault(_module);
766
779
  var _os = require('os'); var _os2 = _interopRequireDefault(_os);
767
780
  var _url = require('url');
768
781
 
769
782
  // ../../node_modules/.pnpm/find-up@7.0.0/node_modules/find-up/index.js
770
- _chunkXCPFG6DOcjs.init_cjs_shims.call(void 0, );
783
+ _chunkSEH6NUCXcjs.init_cjs_shims.call(void 0, );
771
784
 
772
785
 
773
786
  // ../../node_modules/.pnpm/locate-path@7.2.0/node_modules/locate-path/index.js
774
- _chunkXCPFG6DOcjs.init_cjs_shims.call(void 0, );
787
+ _chunkSEH6NUCXcjs.init_cjs_shims.call(void 0, );
775
788
  var _process = require('process'); var _process2 = _interopRequireDefault(_process);
776
789
 
777
790
  var _fs3 = require('fs'); var _fs4 = _interopRequireDefault(_fs3);
778
791
 
779
792
 
780
793
  // ../../node_modules/.pnpm/p-locate@6.0.0/node_modules/p-locate/index.js
781
- _chunkXCPFG6DOcjs.init_cjs_shims.call(void 0, );
794
+ _chunkSEH6NUCXcjs.init_cjs_shims.call(void 0, );
782
795
 
783
796
  // ../../node_modules/.pnpm/p-limit@4.0.0/node_modules/p-limit/index.js
784
- _chunkXCPFG6DOcjs.init_cjs_shims.call(void 0, );
797
+ _chunkSEH6NUCXcjs.init_cjs_shims.call(void 0, );
785
798
 
786
799
  // ../../node_modules/.pnpm/yocto-queue@1.0.0/node_modules/yocto-queue/index.js
787
- _chunkXCPFG6DOcjs.init_cjs_shims.call(void 0, );
800
+ _chunkSEH6NUCXcjs.init_cjs_shims.call(void 0, );
788
801
  var Node = class {
802
+
803
+
789
804
  constructor(value) {
790
- _chunkXCPFG6DOcjs.__publicField.call(void 0, this, "value");
791
- _chunkXCPFG6DOcjs.__publicField.call(void 0, this, "next");
792
805
  this.value = value;
793
806
  }
794
807
  };
795
- var _head, _tail, _size;
796
808
  var Queue = class {
809
+ #head;
810
+ #tail;
811
+ #size;
797
812
  constructor() {
798
- _chunkXCPFG6DOcjs.__privateAdd.call(void 0, this, _head);
799
- _chunkXCPFG6DOcjs.__privateAdd.call(void 0, this, _tail);
800
- _chunkXCPFG6DOcjs.__privateAdd.call(void 0, this, _size);
801
813
  this.clear();
802
814
  }
803
815
  enqueue(value) {
804
816
  const node = new Node(value);
805
- if (_chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _head)) {
806
- _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _tail).next = node;
807
- _chunkXCPFG6DOcjs.__privateSet.call(void 0, this, _tail, node);
817
+ if (this.#head) {
818
+ this.#tail.next = node;
819
+ this.#tail = node;
808
820
  } else {
809
- _chunkXCPFG6DOcjs.__privateSet.call(void 0, this, _head, node);
810
- _chunkXCPFG6DOcjs.__privateSet.call(void 0, this, _tail, node);
821
+ this.#head = node;
822
+ this.#tail = node;
811
823
  }
812
- _chunkXCPFG6DOcjs.__privateWrapper.call(void 0, this, _size)._++;
824
+ this.#size++;
813
825
  }
814
826
  dequeue() {
815
- const current = _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _head);
827
+ const current = this.#head;
816
828
  if (!current) {
817
829
  return;
818
830
  }
819
- _chunkXCPFG6DOcjs.__privateSet.call(void 0, this, _head, _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _head).next);
820
- _chunkXCPFG6DOcjs.__privateWrapper.call(void 0, this, _size)._--;
831
+ this.#head = this.#head.next;
832
+ this.#size--;
821
833
  return current.value;
822
834
  }
823
835
  clear() {
824
- _chunkXCPFG6DOcjs.__privateSet.call(void 0, this, _head, void 0);
825
- _chunkXCPFG6DOcjs.__privateSet.call(void 0, this, _tail, void 0);
826
- _chunkXCPFG6DOcjs.__privateSet.call(void 0, this, _size, 0);
836
+ this.#head = void 0;
837
+ this.#tail = void 0;
838
+ this.#size = 0;
827
839
  }
828
840
  get size() {
829
- return _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _size);
841
+ return this.#size;
830
842
  }
831
843
  *[Symbol.iterator]() {
832
- let current = _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _head);
844
+ let current = this.#head;
833
845
  while (current) {
834
846
  yield current.value;
835
847
  current = current.next;
836
848
  }
837
849
  }
838
850
  };
839
- _head = new WeakMap();
840
- _tail = new WeakMap();
841
- _size = new WeakMap();
842
851
 
843
852
  // ../../node_modules/.pnpm/p-limit@4.0.0/node_modules/p-limit/index.js
844
853
  function pLimit(concurrency) {
@@ -853,18 +862,18 @@ function pLimit(concurrency) {
853
862
  queue.dequeue()();
854
863
  }
855
864
  };
856
- const run = async (fn, resolve, args) => {
865
+ const run = async (fn, resolve2, args) => {
857
866
  activeCount++;
858
867
  const result = (async () => fn(...args))();
859
- resolve(result);
868
+ resolve2(result);
860
869
  try {
861
870
  await result;
862
871
  } catch (e2) {
863
872
  }
864
873
  next();
865
874
  };
866
- const enqueue = (fn, resolve, args) => {
867
- queue.enqueue(run.bind(void 0, fn, resolve, args));
875
+ const enqueue = (fn, resolve2, args) => {
876
+ queue.enqueue(run.bind(void 0, fn, resolve2, args));
868
877
  (async () => {
869
878
  await Promise.resolve();
870
879
  if (activeCount < concurrency && queue.size > 0) {
@@ -872,8 +881,8 @@ function pLimit(concurrency) {
872
881
  }
873
882
  })();
874
883
  };
875
- const generator = (fn, ...args) => new Promise((resolve) => {
876
- enqueue(fn, resolve, args);
884
+ const generator = (fn, ...args) => new Promise((resolve2) => {
885
+ enqueue(fn, resolve2, args);
877
886
  });
878
887
  Object.defineProperties(generator, {
879
888
  activeCount: {
@@ -980,14 +989,14 @@ function locatePathSync(paths, {
980
989
  }
981
990
 
982
991
  // ../../node_modules/.pnpm/unicorn-magic@0.1.0/node_modules/unicorn-magic/node.js
983
- _chunkXCPFG6DOcjs.init_cjs_shims.call(void 0, );
992
+ _chunkSEH6NUCXcjs.init_cjs_shims.call(void 0, );
984
993
 
985
994
  function toPath2(urlOrPath) {
986
995
  return urlOrPath instanceof URL ? _url.fileURLToPath.call(void 0, urlOrPath) : urlOrPath;
987
996
  }
988
997
 
989
998
  // ../../node_modules/.pnpm/path-exists@5.0.0/node_modules/path-exists/index.js
990
- _chunkXCPFG6DOcjs.init_cjs_shims.call(void 0, );
999
+ _chunkSEH6NUCXcjs.init_cjs_shims.call(void 0, );
991
1000
 
992
1001
 
993
1002
  // ../../node_modules/.pnpm/find-up@7.0.0/node_modules/find-up/index.js
@@ -1068,33 +1077,32 @@ function findUpSync(name, options = {}) {
1068
1077
  // src/PackageManager.ts
1069
1078
  var _semver = require('semver');
1070
1079
 
1071
- var _cache, _cwd, _SLASHES, _PackageManager_instances, match_fn;
1072
- var _PackageManager = class _PackageManager {
1080
+ var PackageManager = class _PackageManager {
1081
+ static #cache = {};
1082
+ #cwd;
1083
+ #SLASHES = /* @__PURE__ */ new Set(["/", "\\"]);
1073
1084
  constructor(workspace) {
1074
- _chunkXCPFG6DOcjs.__privateAdd.call(void 0, this, _PackageManager_instances);
1075
- _chunkXCPFG6DOcjs.__privateAdd.call(void 0, this, _cwd);
1076
- _chunkXCPFG6DOcjs.__privateAdd.call(void 0, this, _SLASHES, /* @__PURE__ */ new Set(["/", "\\"]));
1077
1085
  if (workspace) {
1078
- _chunkXCPFG6DOcjs.__privateSet.call(void 0, this, _cwd, workspace);
1086
+ this.#cwd = workspace;
1079
1087
  }
1080
1088
  return this;
1081
1089
  }
1082
1090
  set workspace(workspace) {
1083
- _chunkXCPFG6DOcjs.__privateSet.call(void 0, this, _cwd, workspace);
1091
+ this.#cwd = workspace;
1084
1092
  }
1085
1093
  get workspace() {
1086
- return _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _cwd);
1094
+ return this.#cwd;
1087
1095
  }
1088
1096
  normalizeDirectory(directory) {
1089
- if (!_chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _SLASHES).has(directory[directory.length - 1])) {
1097
+ if (!this.#SLASHES.has(directory[directory.length - 1])) {
1090
1098
  return `${directory}/`;
1091
1099
  }
1092
1100
  return directory;
1093
1101
  }
1094
1102
  getLocation(path4) {
1095
1103
  let location = path4;
1096
- if (_chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _cwd)) {
1097
- const require2 = _module2.default.createRequire(this.normalizeDirectory(_chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _cwd)));
1104
+ if (this.#cwd) {
1105
+ const require2 = _module2.default.createRequire(this.normalizeDirectory(this.#cwd));
1098
1106
  location = require2.resolve(path4);
1099
1107
  }
1100
1108
  return location;
@@ -1106,7 +1114,7 @@ var _PackageManager = class _PackageManager {
1106
1114
  location = _url.pathToFileURL.call(void 0, location).href;
1107
1115
  }
1108
1116
  const module = await Promise.resolve().then(() => _interopRequireWildcard(require(location)));
1109
- return _nullishCoalesce(_optionalChain([module, 'optionalAccess', _23 => _23.default]), () => ( module));
1117
+ return _nullishCoalesce(_optionalChain([module, 'optionalAccess', _42 => _42.default]), () => ( module));
1110
1118
  } catch (e) {
1111
1119
  console.error(e);
1112
1120
  return void 0;
@@ -1114,7 +1122,7 @@ var _PackageManager = class _PackageManager {
1114
1122
  }
1115
1123
  async getPackageJSON() {
1116
1124
  const pkgPath = await findUp(["package.json"], {
1117
- cwd: _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _cwd)
1125
+ cwd: this.#cwd
1118
1126
  });
1119
1127
  if (!pkgPath) {
1120
1128
  return void 0;
@@ -1124,7 +1132,7 @@ var _PackageManager = class _PackageManager {
1124
1132
  }
1125
1133
  getPackageJSONSync() {
1126
1134
  const pkgPath = findUpSync(["package.json"], {
1127
- cwd: _chunkXCPFG6DOcjs.__privateGet.call(void 0, this, _cwd)
1135
+ cwd: this.#cwd
1128
1136
  });
1129
1137
  if (!pkgPath) {
1130
1138
  return void 0;
@@ -1133,27 +1141,38 @@ var _PackageManager = class _PackageManager {
1133
1141
  return JSON.parse(json);
1134
1142
  }
1135
1143
  static setVersion(dependency, version) {
1136
- _chunkXCPFG6DOcjs.__privateGet.call(void 0, _PackageManager, _cache)[dependency] = version;
1144
+ _PackageManager.#cache[dependency] = version;
1145
+ }
1146
+ #match(packageJSON, dependency) {
1147
+ const dependencies = {
1148
+ ...packageJSON["dependencies"] || {},
1149
+ ...packageJSON["devDependencies"] || {}
1150
+ };
1151
+ if (typeof dependency === "string" && dependencies[dependency]) {
1152
+ return dependencies[dependency];
1153
+ }
1154
+ const matchedDependency = Object.keys(dependencies).find((dep) => dep.match(dependency));
1155
+ return matchedDependency ? dependencies[matchedDependency] : void 0;
1137
1156
  }
1138
1157
  async getVersion(dependency) {
1139
- if (typeof dependency === "string" && _chunkXCPFG6DOcjs.__privateGet.call(void 0, _PackageManager, _cache)[dependency]) {
1140
- return _chunkXCPFG6DOcjs.__privateGet.call(void 0, _PackageManager, _cache)[dependency];
1158
+ if (typeof dependency === "string" && _PackageManager.#cache[dependency]) {
1159
+ return _PackageManager.#cache[dependency];
1141
1160
  }
1142
1161
  const packageJSON = await this.getPackageJSON();
1143
1162
  if (!packageJSON) {
1144
1163
  return void 0;
1145
1164
  }
1146
- return _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PackageManager_instances, match_fn).call(this, packageJSON, dependency);
1165
+ return this.#match(packageJSON, dependency);
1147
1166
  }
1148
1167
  getVersionSync(dependency) {
1149
- if (typeof dependency === "string" && _chunkXCPFG6DOcjs.__privateGet.call(void 0, _PackageManager, _cache)[dependency]) {
1150
- return _chunkXCPFG6DOcjs.__privateGet.call(void 0, _PackageManager, _cache)[dependency];
1168
+ if (typeof dependency === "string" && _PackageManager.#cache[dependency]) {
1169
+ return _PackageManager.#cache[dependency];
1151
1170
  }
1152
1171
  const packageJSON = this.getPackageJSONSync();
1153
1172
  if (!packageJSON) {
1154
1173
  return void 0;
1155
1174
  }
1156
- return _chunkXCPFG6DOcjs.__privateMethod.call(void 0, this, _PackageManager_instances, match_fn).call(this, packageJSON, dependency);
1175
+ return this.#match(packageJSON, dependency);
1157
1176
  }
1158
1177
  async isValid(dependency, version) {
1159
1178
  const packageVersion = await this.getVersion(dependency);
@@ -1181,23 +1200,6 @@ var _PackageManager = class _PackageManager {
1181
1200
  return _semver.satisfies.call(void 0, semVer, version);
1182
1201
  }
1183
1202
  };
1184
- _cache = new WeakMap();
1185
- _cwd = new WeakMap();
1186
- _SLASHES = new WeakMap();
1187
- _PackageManager_instances = new WeakSet();
1188
- match_fn = function(packageJSON, dependency) {
1189
- const dependencies = {
1190
- ...packageJSON["dependencies"] || {},
1191
- ...packageJSON["devDependencies"] || {}
1192
- };
1193
- if (typeof dependency === "string" && dependencies[dependency]) {
1194
- return dependencies[dependency];
1195
- }
1196
- const matchedDependency = Object.keys(dependencies).find((dep) => dep.match(dependency));
1197
- return matchedDependency ? dependencies[matchedDependency] : void 0;
1198
- };
1199
- _chunkXCPFG6DOcjs.__privateAdd.call(void 0, _PackageManager, _cache, {});
1200
- var PackageManager = _PackageManager;
1201
1203
 
1202
1204
 
1203
1205
 
@@ -1210,5 +1212,5 @@ var PackageManager = _PackageManager;
1210
1212
 
1211
1213
 
1212
1214
 
1213
- exports.FileManager = _chunkDCZQYCCOcjs.FileManager; exports.Generator = Generator; exports.PackageManager = PackageManager; exports.PluginManager = PluginManager; exports.PromiseManager = PromiseManager; exports.build = build; exports.createPlugin = createPlugin; exports.default = build; exports.defineConfig = defineConfig; exports.isInputPath = isInputPath; exports.safeBuild = safeBuild;
1215
+ exports.FileManager = _chunk5IGANEGEcjs.FileManager; exports.Generator = Generator; exports.PackageManager = PackageManager; exports.PluginManager = PluginManager; exports.PromiseManager = PromiseManager; exports.build = build; exports.createPlugin = createPlugin; exports.default = build; exports.defineConfig = defineConfig; exports.isInputPath = isInputPath; exports.safeBuild = safeBuild;
1214
1216
  //# sourceMappingURL=index.cjs.map