@kubb/core 3.0.0-alpha.9 → 3.0.0-beta.2

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 (91) hide show
  1. package/README.md +14 -5
  2. package/dist/{FileManager-B0GJlthB.d.cts → FileManager-C9aZTwst.d.ts} +94 -77
  3. package/dist/{FileManager-BFycBDqG.d.ts → FileManager-ibNoWwHN.d.cts} +94 -77
  4. package/dist/chunk-2EU7DMPM.js +2 -3
  5. package/dist/chunk-2EU7DMPM.js.map +1 -1
  6. package/dist/{chunk-DID47EQD.cjs → chunk-2TOEDZ2U.cjs} +6 -7
  7. package/dist/chunk-2TOEDZ2U.cjs.map +1 -0
  8. package/dist/{chunk-A6PCLWEY.cjs → chunk-4GJEWGQN.cjs} +30 -31
  9. package/dist/chunk-4GJEWGQN.cjs.map +1 -0
  10. package/dist/{chunk-SEH6NUCX.cjs → chunk-72BWXKV4.cjs} +10 -10
  11. package/dist/chunk-72BWXKV4.cjs.map +1 -0
  12. package/dist/{chunk-4X5FFJPJ.js → chunk-BQXM32UO.js} +11 -16
  13. package/dist/chunk-BQXM32UO.js.map +1 -0
  14. package/dist/{chunk-27CPVXAT.js → chunk-DXGMSPTW.js} +174 -231
  15. package/dist/chunk-DXGMSPTW.js.map +1 -0
  16. package/dist/{chunk-SCR3LUXT.js → chunk-E6CN2CZC.js} +38 -27
  17. package/dist/chunk-E6CN2CZC.js.map +1 -0
  18. package/dist/chunk-HBQM723K.js +12 -26
  19. package/dist/chunk-HBQM723K.js.map +1 -1
  20. package/dist/{chunk-5E2I6KH4.cjs → chunk-KXT7F2WS.cjs} +54 -37
  21. package/dist/chunk-KXT7F2WS.cjs.map +1 -0
  22. package/dist/{chunk-IPZQXBA2.cjs → chunk-MVWRVN66.cjs} +57 -34
  23. package/dist/chunk-MVWRVN66.cjs.map +1 -0
  24. package/dist/{chunk-5IGANEGE.cjs → chunk-SQBOUPF4.cjs} +268 -301
  25. package/dist/chunk-SQBOUPF4.cjs.map +1 -0
  26. package/dist/index.cjs +223 -241
  27. package/dist/index.cjs.map +1 -1
  28. package/dist/index.d.cts +4 -6
  29. package/dist/index.d.ts +4 -6
  30. package/dist/index.js +106 -148
  31. package/dist/index.js.map +1 -1
  32. package/dist/{logger-BWFeedRk.d.cts → logger-DvbHXjIO.d.cts} +10 -8
  33. package/dist/{logger-BWFeedRk.d.ts → logger-DvbHXjIO.d.ts} +10 -8
  34. package/dist/logger.cjs +25 -14
  35. package/dist/logger.cjs.map +1 -1
  36. package/dist/logger.d.cts +1 -1
  37. package/dist/logger.d.ts +1 -1
  38. package/dist/logger.js +3 -13
  39. package/dist/logger.js.map +1 -1
  40. package/dist/mocks.cjs +29 -24
  41. package/dist/mocks.cjs.map +1 -1
  42. package/dist/mocks.d.cts +4 -3
  43. package/dist/mocks.d.ts +4 -3
  44. package/dist/mocks.js +22 -25
  45. package/dist/mocks.js.map +1 -1
  46. package/dist/{prompt-DVQN7JTN.cjs → prompt-FODZPXQF.cjs} +89 -89
  47. package/dist/prompt-FODZPXQF.cjs.map +1 -0
  48. package/dist/prompt-WQQUN22Z.js +8 -13
  49. package/dist/prompt-WQQUN22Z.js.map +1 -1
  50. package/dist/transformers.cjs +63 -52
  51. package/dist/transformers.cjs.map +1 -1
  52. package/dist/transformers.d.cts +1 -1
  53. package/dist/transformers.d.ts +1 -1
  54. package/dist/transformers.js +10 -37
  55. package/dist/transformers.js.map +1 -1
  56. package/dist/utils.cjs +65 -34
  57. package/dist/utils.cjs.map +1 -1
  58. package/dist/utils.d.cts +6 -8
  59. package/dist/utils.d.ts +6 -8
  60. package/dist/utils.js +3 -33
  61. package/dist/utils.js.map +1 -1
  62. package/package.json +10 -13
  63. package/src/BarrelManager.ts +76 -74
  64. package/src/FileManager.ts +55 -60
  65. package/src/PluginManager.ts +61 -61
  66. package/src/PromiseManager.ts +1 -1
  67. package/src/__snapshots__/barrel.json +11 -29
  68. package/src/__snapshots__/grouped.json +18 -12
  69. package/src/__snapshots__/ordered.json +18 -12
  70. package/src/build.ts +24 -11
  71. package/src/config.ts +2 -4
  72. package/src/index.ts +1 -1
  73. package/src/logger.ts +41 -7
  74. package/src/plugin.ts +0 -3
  75. package/src/transformers/escape.ts +0 -10
  76. package/src/transformers/stringify.ts +1 -1
  77. package/src/types.ts +70 -38
  78. package/src/utils/TreeNode.ts +31 -56
  79. package/src/utils/executeStrategies.ts +2 -2
  80. package/src/utils/parser.ts +38 -39
  81. package/dist/chunk-27CPVXAT.js.map +0 -1
  82. package/dist/chunk-4X5FFJPJ.js.map +0 -1
  83. package/dist/chunk-5E2I6KH4.cjs.map +0 -1
  84. package/dist/chunk-5IGANEGE.cjs.map +0 -1
  85. package/dist/chunk-A6PCLWEY.cjs.map +0 -1
  86. package/dist/chunk-DID47EQD.cjs.map +0 -1
  87. package/dist/chunk-IPZQXBA2.cjs.map +0 -1
  88. package/dist/chunk-SCR3LUXT.js.map +0 -1
  89. package/dist/chunk-SEH6NUCX.cjs.map +0 -1
  90. package/dist/prompt-DVQN7JTN.cjs.map +0 -1
  91. package/src/utils/cache.ts +0 -35
package/dist/index.js CHANGED
@@ -1,21 +1,16 @@
1
- import {
2
- transformReservedWord
3
- } from "./chunk-2EU7DMPM.js";
4
- import {
5
- EventEmitter,
6
- createLogger
7
- } from "./chunk-SCR3LUXT.js";
8
- import {
9
- FileManager,
10
- URLPath,
11
- processFiles,
12
- setUniqueName
13
- } from "./chunk-27CPVXAT.js";
14
- import "./chunk-4X5FFJPJ.js";
15
- import "./chunk-HBQM723K.js";
16
-
17
- // src/build.ts
18
- import { clean, read } from "@kubb/fs";
1
+ import { transformReservedWord } from './chunk-2EU7DMPM.js';
2
+ import { EventEmitter, createLogger } from './chunk-E6CN2CZC.js';
3
+ import { FileManager, setUniqueName, processFiles, URLPath } from './chunk-DXGMSPTW.js';
4
+ export { FileManager, getSource } from './chunk-DXGMSPTW.js';
5
+ import './chunk-BQXM32UO.js';
6
+ import './chunk-HBQM723K.js';
7
+ import { getRelativePath, read, readSync, clean } from '@kubb/fs';
8
+ import path, { resolve, join } from 'node:path';
9
+ import mod from 'node:module';
10
+ import os from 'node:os';
11
+ import { pathToFileURL } from 'node:url';
12
+ import { findUp, findUpSync } from 'find-up';
13
+ import { coerce, satisfies } from 'semver';
19
14
 
20
15
  // src/utils/executeStrategies.ts
21
16
  function hookSeq(promises) {
@@ -81,39 +76,6 @@ function isPromiseRejectedResult(result) {
81
76
  // src/errors.ts
82
77
  var ValidationPluginError = class extends Error {
83
78
  };
84
-
85
- // src/plugin.ts
86
- import path from "node:path";
87
-
88
- // src/utils/cache.ts
89
- function createPluginCache(Store = /* @__PURE__ */ Object.create(null)) {
90
- return {
91
- set(id, value) {
92
- Store[id] = [0, value];
93
- },
94
- get(id) {
95
- const item = Store[id];
96
- if (!item) {
97
- return null;
98
- }
99
- item[0] = 0;
100
- return item[1];
101
- },
102
- has(id) {
103
- const item = Store[id];
104
- if (!item) {
105
- return false;
106
- }
107
- item[0] = 0;
108
- return true;
109
- },
110
- delete(id) {
111
- return delete Store[id];
112
- }
113
- };
114
- }
115
-
116
- // src/plugin.ts
117
79
  function createPlugin(factory) {
118
80
  return (options = {}) => {
119
81
  return factory(options);
@@ -147,8 +109,7 @@ var pluginCore = createPlugin((options) => {
147
109
  return resolvedFiles;
148
110
  },
149
111
  resolvePath,
150
- resolveName,
151
- cache: createPluginCache()
112
+ resolveName
152
113
  };
153
114
  },
154
115
  resolvePath(baseName) {
@@ -163,7 +124,7 @@ var pluginCore = createPlugin((options) => {
163
124
 
164
125
  // src/PluginManager.ts
165
126
  var PluginManager = class {
166
- plugins;
127
+ plugins = /* @__PURE__ */ new Set();
167
128
  fileManager;
168
129
  events = new EventEmitter();
169
130
  config;
@@ -181,7 +142,6 @@ var PluginManager = class {
181
142
  this.#promiseManager = new PromiseManager({
182
143
  nullCheck: (state) => !!state?.result
183
144
  });
184
- const plugins = config.plugins || [];
185
145
  const core = pluginCore({
186
146
  config,
187
147
  logger: this.logger,
@@ -192,13 +152,14 @@ var PluginManager = class {
192
152
  getPlugins: this.#getSortedPlugins.bind(this)
193
153
  });
194
154
  this.#core = this.#parse(core, this, core.context.call(null));
195
- this.plugins = [this.#core, ...plugins].map((plugin) => {
196
- return this.#parse(plugin, this, this.#core.context);
155
+ [this.#core, ...config.plugins || []].forEach((plugin) => {
156
+ const parsedPlugin = this.#parse(plugin, this, this.#core.context);
157
+ this.plugins.add(parsedPlugin);
197
158
  });
198
159
  return this;
199
160
  }
200
- getFile({ name, mode, extName, pluginKey, options }) {
201
- const baseName = `${name}${extName}`;
161
+ getFile({ name, mode, extname, pluginKey, options }) {
162
+ const baseName = `${name}${extname}`;
202
163
  const path2 = this.resolvePath({ baseName, mode, pluginKey, options });
203
164
  if (!path2) {
204
165
  throw new Error(`Filepath should be defined for resolvedName "${name}" and pluginKey [${JSON.stringify(pluginKey)}]`);
@@ -217,10 +178,12 @@ var PluginManager = class {
217
178
  const paths = this.hookForPluginSync({
218
179
  pluginKey: params.pluginKey,
219
180
  hookName: "resolvePath",
220
- parameters: [params.baseName, params.mode, params.options]
181
+ parameters: [params.baseName, params.mode, params.options],
182
+ message: `Resolving path '${params.baseName}'`
221
183
  });
222
184
  if (paths && paths?.length > 1) {
223
185
  this.logger.emit("debug", {
186
+ date: /* @__PURE__ */ new Date(),
224
187
  logs: [
225
188
  `Cannot return a path where the 'pluginKey' ${params.pluginKey ? JSON.stringify(params.pluginKey) : '"'} is not unique enough
226
189
 
@@ -235,7 +198,8 @@ Falling back on the first item.
235
198
  }
236
199
  return this.hookFirstSync({
237
200
  hookName: "resolvePath",
238
- parameters: [params.baseName, params.mode, params.options]
201
+ parameters: [params.baseName, params.mode, params.options],
202
+ message: `Resolving path '${params.baseName}'`
239
203
  }).result;
240
204
  };
241
205
  //TODO refactor by using the order of plugins and the cache of the fileManager instead of guessing and recreating the name/path
@@ -244,10 +208,12 @@ Falling back on the first item.
244
208
  const names = this.hookForPluginSync({
245
209
  pluginKey: params.pluginKey,
246
210
  hookName: "resolveName",
247
- parameters: [params.name, params.type]
211
+ parameters: [params.name, params.type],
212
+ message: `Resolving name '${params.name}' and type '${params.type}'`
248
213
  });
249
214
  if (names && names?.length > 1) {
250
215
  this.logger.emit("debug", {
216
+ date: /* @__PURE__ */ new Date(),
251
217
  logs: [
252
218
  `Cannot return a name where the 'pluginKey' ${params.pluginKey ? JSON.stringify(params.pluginKey) : '"'} is not unique enough
253
219
 
@@ -262,7 +228,8 @@ Falling back on the first item.
262
228
  }
263
229
  const name = this.hookFirstSync({
264
230
  hookName: "resolveName",
265
- parameters: [params.name, params.type]
231
+ parameters: [params.name, params.type],
232
+ message: `Resolving name '${params.name}' and type '${params.type}'`
266
233
  }).result;
267
234
  return transformReservedWord(name);
268
235
  };
@@ -278,16 +245,18 @@ Falling back on the first item.
278
245
  async hookForPlugin({
279
246
  pluginKey,
280
247
  hookName,
281
- parameters
248
+ parameters,
249
+ message
282
250
  }) {
283
251
  const plugins = this.getPluginsByKey(hookName, pluginKey);
284
- this.logger.emit("progress_start", { id: hookName, size: plugins.length });
252
+ this.logger.emit("progress_start", { id: hookName, size: plugins.length, message: "Running plugins..." });
285
253
  const promises = plugins.map((plugin) => {
286
254
  return this.#execute({
287
255
  strategy: "hookFirst",
288
256
  hookName,
289
257
  parameters,
290
- plugin
258
+ plugin,
259
+ message
291
260
  });
292
261
  }).filter(Boolean);
293
262
  const items = await Promise.all(promises);
@@ -300,7 +269,8 @@ Falling back on the first item.
300
269
  hookForPluginSync({
301
270
  pluginKey,
302
271
  hookName,
303
- parameters
272
+ parameters,
273
+ message
304
274
  }) {
305
275
  const plugins = this.getPluginsByKey(hookName, pluginKey);
306
276
  const result = plugins.map((plugin) => {
@@ -308,7 +278,8 @@ Falling back on the first item.
308
278
  strategy: "hookFirst",
309
279
  hookName,
310
280
  parameters,
311
- plugin
281
+ plugin,
282
+ message
312
283
  });
313
284
  }).filter(Boolean);
314
285
  return result;
@@ -319,7 +290,8 @@ Falling back on the first item.
319
290
  async hookFirst({
320
291
  hookName,
321
292
  parameters,
322
- skipped
293
+ skipped,
294
+ message
323
295
  }) {
324
296
  const plugins = this.#getSortedPlugins(hookName).filter((plugin) => {
325
297
  return skipped ? skipped.has(plugin) : true;
@@ -331,7 +303,8 @@ Falling back on the first item.
331
303
  strategy: "hookFirst",
332
304
  hookName,
333
305
  parameters,
334
- plugin
306
+ plugin,
307
+ message
335
308
  });
336
309
  return Promise.resolve({
337
310
  plugin,
@@ -349,7 +322,8 @@ Falling back on the first item.
349
322
  hookFirstSync({
350
323
  hookName,
351
324
  parameters,
352
- skipped
325
+ skipped,
326
+ message
353
327
  }) {
354
328
  let parseResult = null;
355
329
  const plugins = this.#getSortedPlugins(hookName).filter((plugin) => {
@@ -361,7 +335,8 @@ Falling back on the first item.
361
335
  strategy: "hookFirst",
362
336
  hookName,
363
337
  parameters,
364
- plugin
338
+ plugin,
339
+ message
365
340
  }),
366
341
  plugin
367
342
  };
@@ -376,7 +351,8 @@ Falling back on the first item.
376
351
  */
377
352
  async hookParallel({
378
353
  hookName,
379
- parameters
354
+ parameters,
355
+ message
380
356
  }) {
381
357
  const plugins = this.#getSortedPlugins(hookName);
382
358
  this.logger.emit("progress_start", { id: hookName, size: plugins.length });
@@ -385,7 +361,8 @@ Falling back on the first item.
385
361
  strategy: "hookParallel",
386
362
  hookName,
387
363
  parameters,
388
- plugin
364
+ plugin,
365
+ message
389
366
  });
390
367
  });
391
368
  const results = await this.#promiseManager.run("parallel", promises);
@@ -399,33 +376,13 @@ Falling back on the first item.
399
376
  return results.filter((result) => result.status === "fulfilled").map((result) => result.value);
400
377
  }
401
378
  /**
402
- * 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.
379
+ * Chains plugins
403
380
  */
404
- hookReduceArg0({
381
+ async hookSeq({
405
382
  hookName,
406
383
  parameters,
407
- reduce
384
+ message
408
385
  }) {
409
- const [argument0, ...rest] = parameters;
410
- const plugins = this.#getSortedPlugins(hookName);
411
- let promise = Promise.resolve(argument0);
412
- for (const plugin of plugins) {
413
- promise = promise.then((arg0) => {
414
- const value = this.#execute({
415
- strategy: "hookReduceArg0",
416
- hookName,
417
- parameters: [arg0, ...rest],
418
- plugin
419
- });
420
- return value;
421
- }).then((result) => reduce.call(this.#core.context, argument0, result, plugin));
422
- }
423
- return promise;
424
- }
425
- /**
426
- * Chains plugins
427
- */
428
- async hookSeq({ hookName, parameters }) {
429
386
  const plugins = this.#getSortedPlugins(hookName);
430
387
  this.logger.emit("progress_start", { id: hookName, size: plugins.length });
431
388
  const promises = plugins.map((plugin) => {
@@ -433,7 +390,8 @@ Falling back on the first item.
433
390
  strategy: "hookSeq",
434
391
  hookName,
435
392
  parameters,
436
- plugin
393
+ plugin,
394
+ message
437
395
  });
438
396
  });
439
397
  await this.#promiseManager.run("seq", promises);
@@ -442,11 +400,7 @@ Falling back on the first item.
442
400
  #getSortedPlugins(hookName) {
443
401
  const plugins = [...this.plugins].filter((plugin) => plugin.name !== "core");
444
402
  if (hookName) {
445
- const containsHookName = plugins.some((item) => item[hookName]);
446
- if (!containsHookName) {
447
- this.logger.emit("debug", { logs: [`No hook ${hookName} found`] });
448
- }
449
- return plugins.filter((item) => item[hookName]);
403
+ return plugins.filter((plugin) => hookName in plugin);
450
404
  }
451
405
  return plugins.map((plugin) => {
452
406
  if (plugin.pre) {
@@ -469,7 +423,7 @@ Falling back on the first item.
469
423
  getPluginsByKey(hookName, pluginKey) {
470
424
  const plugins = [...this.plugins];
471
425
  const [searchPluginName, searchIdentifier] = pluginKey;
472
- const pluginByPluginName = plugins.filter((plugin) => plugin[hookName]).filter((item) => {
426
+ const pluginByPluginName = plugins.filter((plugin) => hookName in plugin).filter((item) => {
473
427
  const [name, identifier] = item.key;
474
428
  const identifierCheck = identifier?.toString() === searchIdentifier?.toString();
475
429
  const nameCheck = name === searchPluginName;
@@ -479,13 +433,15 @@ Falling back on the first item.
479
433
  return nameCheck;
480
434
  });
481
435
  if (!pluginByPluginName?.length) {
482
- const corePlugin = plugins.find((plugin) => plugin.name === "core" && plugin[hookName]);
436
+ const corePlugin = plugins.find((plugin) => plugin.name === "core" && hookName in plugin);
483
437
  if (corePlugin) {
484
438
  this.logger.emit("debug", {
439
+ date: /* @__PURE__ */ new Date(),
485
440
  logs: [`No hook '${hookName}' for pluginKey '${JSON.stringify(pluginKey)}' found, falling back on the '@kubb/core' plugin`]
486
441
  });
487
442
  } else {
488
443
  this.logger.emit("debug", {
444
+ date: /* @__PURE__ */ new Date(),
489
445
  logs: [`No hook '${hookName}' for pluginKey '${JSON.stringify(pluginKey)}' found, no fallback found in the '@kubb/core' plugin`]
490
446
  });
491
447
  }
@@ -497,7 +453,7 @@ Falling back on the first item.
497
453
  if (executer) {
498
454
  this.events.emit("executed", executer);
499
455
  this.executed.push(executer);
500
- this.logger.emit("progress", { id: executer.hookName, data: `${executer.plugin.name}` });
456
+ this.logger.emit("progressed", { id: executer.hookName, message: `${executer.plugin.name}: ${executer.message}` });
501
457
  }
502
458
  }
503
459
  /**
@@ -511,14 +467,15 @@ Falling back on the first item.
511
467
  strategy,
512
468
  hookName,
513
469
  parameters,
514
- plugin
470
+ plugin,
471
+ message
515
472
  }) {
516
473
  const hook = plugin[hookName];
517
474
  let output;
518
475
  if (!hook) {
519
476
  return null;
520
477
  }
521
- this.events.emit("execute", { strategy, hookName, parameters, plugin });
478
+ this.events.emit("executing", { strategy, hookName, parameters, plugin, message });
522
479
  const promise = new Promise((resolve2) => {
523
480
  resolve2(void 0);
524
481
  });
@@ -538,7 +495,8 @@ Falling back on the first item.
538
495
  output,
539
496
  strategy,
540
497
  hookName,
541
- plugin
498
+ plugin,
499
+ message
542
500
  });
543
501
  return result;
544
502
  }).catch((e) => {
@@ -558,18 +516,27 @@ Falling back on the first item.
558
516
  strategy,
559
517
  hookName,
560
518
  parameters,
561
- plugin
519
+ plugin,
520
+ message
562
521
  }) {
563
522
  const hook = plugin[hookName];
564
523
  let output;
565
524
  if (!hook) {
566
525
  return null;
567
526
  }
568
- this.events.emit("execute", { strategy, hookName, parameters, plugin });
527
+ this.events.emit("executing", { strategy, hookName, parameters, plugin, message });
569
528
  try {
570
529
  if (typeof hook === "function") {
571
530
  const fn = hook.apply({ ...this.#core.context, plugin }, parameters);
572
531
  output = fn;
532
+ this.#addExecutedToCallStack({
533
+ parameters,
534
+ output,
535
+ strategy,
536
+ hookName,
537
+ plugin,
538
+ message
539
+ });
573
540
  return fn;
574
541
  }
575
542
  output = hook;
@@ -578,7 +545,8 @@ Falling back on the first item.
578
545
  output,
579
546
  strategy,
580
547
  hookName,
581
- plugin
548
+ plugin,
549
+ message
582
550
  });
583
551
  return hook;
584
552
  } catch (e) {
@@ -632,12 +600,8 @@ function defineConfig(options) {
632
600
  return options;
633
601
  }
634
602
  function isInputPath(result) {
635
- return !!result && "path" in result;
603
+ return !!result && "path" in result?.input;
636
604
  }
637
-
638
- // src/build.ts
639
- import { resolve } from "node:path";
640
- import { getRelativePath } from "@kubb/fs";
641
605
  async function setup(options) {
642
606
  const { config, logger = createLogger() } = options;
643
607
  try {
@@ -653,6 +617,7 @@ async function setup(options) {
653
617
  }
654
618
  if (config.output.clean) {
655
619
  await clean(config.output.path);
620
+ await clean(join(config.root, ".kubb"));
656
621
  }
657
622
  return new PluginManager(config, { logger });
658
623
  }
@@ -666,12 +631,22 @@ async function build(options) {
666
631
  };
667
632
  }
668
633
  async function safeBuild(options) {
669
- const pluginManager = await setup(options);
670
634
  let files = [];
635
+ const pluginManager = await setup(options);
671
636
  try {
637
+ pluginManager.events.on("executing", ({ plugin, message }) => {
638
+ pluginManager.logger.emit("debug", { date: /* @__PURE__ */ new Date(), logs: [`Executing pluginKey ${plugin.key?.join(".")} | ${message}`] });
639
+ });
640
+ pluginManager.events.on("executed", ({ plugin, message, output }) => {
641
+ pluginManager.logger.emit("debug", {
642
+ date: /* @__PURE__ */ new Date(),
643
+ logs: [`Executed pluginKey ${plugin.key?.join(".")} | ${message} | ${JSON.stringify(output, void 0, 2)}`]
644
+ });
645
+ });
672
646
  await pluginManager.hookParallel({
673
647
  hookName: "buildStart",
674
- parameters: [options.config]
648
+ parameters: [options.config],
649
+ message: "buildStart"
675
650
  });
676
651
  const root = resolve(options.config.root);
677
652
  const rootPath = resolve(root, options.config.output.path, "index.ts");
@@ -686,18 +661,19 @@ async function safeBuild(options) {
686
661
  if (!file.path || !source.isIndexable) {
687
662
  return void 0;
688
663
  }
689
- const plugin = pluginManager.plugins.find((item) => {
664
+ const plugin = [...pluginManager.plugins].find((item) => {
690
665
  const meta = file.meta;
691
- return item.name === meta?.pluginKey?.[0];
666
+ return item.key === meta?.pluginKey;
692
667
  });
693
- if (plugin?.output?.exportType === false) {
668
+ const pluginOptions = plugin?.options ?? {};
669
+ if (pluginOptions.output?.barrelType === false) {
694
670
  return void 0;
695
671
  }
696
- if (FileManager.getMode(plugin?.output?.path) === "single") {
672
+ if (FileManager.getMode(pluginOptions.output?.path) === "single") {
697
673
  return void 0;
698
674
  }
699
675
  return {
700
- name: options.config.output.exportType === "barrel" ? void 0 : [source.name],
676
+ name: pluginOptions.output?.barrelType === "all" ? void 0 : [source.name],
701
677
  path: getRelativePath(rootPath, file.path),
702
678
  isTypeOnly: source.isTypeOnly
703
679
  };
@@ -706,7 +682,7 @@ async function safeBuild(options) {
706
682
  sources: [],
707
683
  meta: {}
708
684
  };
709
- if (options.config.output.exportType) {
685
+ if (options.config.output.barrelType) {
710
686
  await pluginManager.fileManager.add(rootFile);
711
687
  }
712
688
  files = await processFiles({
@@ -715,7 +691,7 @@ async function safeBuild(options) {
715
691
  files: pluginManager.fileManager.files,
716
692
  logger: pluginManager.logger
717
693
  });
718
- await pluginManager.hookParallel({ hookName: "buildEnd" });
694
+ await pluginManager.hookParallel({ hookName: "buildEnd", message: `Build stopped for ${options.config.name}` });
719
695
  pluginManager.fileManager.clear();
720
696
  } catch (e) {
721
697
  return {
@@ -753,14 +729,6 @@ var BaseGenerator = class {
753
729
  this.#options = { ...this.#options, ...options };
754
730
  }
755
731
  };
756
-
757
- // src/PackageManager.ts
758
- import mod from "node:module";
759
- import os from "node:os";
760
- import { pathToFileURL } from "node:url";
761
- import { findUp, findUpSync } from "find-up";
762
- import { coerce, satisfies } from "semver";
763
- import { read as read2, readSync } from "@kubb/fs";
764
732
  var PackageManager = class _PackageManager {
765
733
  static #cache = {};
766
734
  #cwd;
@@ -811,7 +779,7 @@ var PackageManager = class _PackageManager {
811
779
  if (!pkgPath) {
812
780
  return void 0;
813
781
  }
814
- const json = await read2(pkgPath);
782
+ const json = await read(pkgPath);
815
783
  return JSON.parse(json);
816
784
  }
817
785
  getPackageJSONSync() {
@@ -884,17 +852,7 @@ var PackageManager = class _PackageManager {
884
852
  return satisfies(semVer, version);
885
853
  }
886
854
  };
887
- export {
888
- BaseGenerator,
889
- FileManager,
890
- PackageManager,
891
- PluginManager,
892
- PromiseManager,
893
- build,
894
- createPlugin,
895
- build as default,
896
- defineConfig,
897
- isInputPath,
898
- safeBuild
899
- };
855
+
856
+ export { BaseGenerator, PackageManager, PluginManager, PromiseManager, build, createPlugin, build as default, defineConfig, isInputPath, safeBuild };
857
+ //# sourceMappingURL=index.js.map
900
858
  //# sourceMappingURL=index.js.map