@kubb/core 2.12.1 → 2.12.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 (42) hide show
  1. package/dist/{chunk-33S7A7ZE.cjs → chunk-LHNV7GQH.cjs} +23 -23
  2. package/dist/chunk-LHNV7GQH.cjs.map +1 -0
  3. package/dist/{chunk-ALE7CO7I.js → chunk-NKAOH4VT.js} +24 -24
  4. package/dist/chunk-NKAOH4VT.js.map +1 -0
  5. package/dist/chunk-OPTGFWPQ.cjs +368 -0
  6. package/dist/chunk-OPTGFWPQ.cjs.map +1 -0
  7. package/dist/{chunk-OMX2RMAX.cjs → chunk-TTAE4JRW.cjs} +4 -2
  8. package/dist/chunk-TTAE4JRW.cjs.map +1 -0
  9. package/dist/chunk-VPKB6WED.js +368 -0
  10. package/dist/chunk-VPKB6WED.js.map +1 -0
  11. package/dist/{chunk-4BZD7YTT.js → chunk-XHJKKPCO.js} +4 -2
  12. package/dist/chunk-XHJKKPCO.js.map +1 -0
  13. package/dist/index.cjs +129 -130
  14. package/dist/index.cjs.map +1 -1
  15. package/dist/index.d.cts +20 -23
  16. package/dist/index.d.ts +20 -23
  17. package/dist/index.js +108 -109
  18. package/dist/index.js.map +1 -1
  19. package/dist/logger.cjs +2 -2
  20. package/dist/logger.js +1 -1
  21. package/dist/transformers.cjs +18 -205
  22. package/dist/transformers.cjs.map +1 -1
  23. package/dist/transformers.js +16 -203
  24. package/dist/transformers.js.map +1 -1
  25. package/dist/utils.cjs +2 -2
  26. package/dist/utils.js +1 -1
  27. package/package.json +3 -3
  28. package/src/BarrelManager.ts +3 -3
  29. package/src/FileManager.ts +14 -5
  30. package/src/PluginManager.ts +12 -15
  31. package/src/build.ts +14 -18
  32. package/src/logger.ts +4 -1
  33. package/src/types.ts +2 -6
  34. package/src/utils/TreeNode.ts +2 -2
  35. package/dist/chunk-33S7A7ZE.cjs.map +0 -1
  36. package/dist/chunk-4BZD7YTT.js.map +0 -1
  37. package/dist/chunk-ALE7CO7I.js.map +0 -1
  38. package/dist/chunk-OMX2RMAX.cjs.map +0 -1
  39. package/dist/chunk-VHRZO2NC.cjs +0 -145
  40. package/dist/chunk-VHRZO2NC.cjs.map +0 -1
  41. package/dist/chunk-Z5N655B7.js +0 -145
  42. package/dist/chunk-Z5N655B7.js.map +0 -1
package/dist/index.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import PQueue from 'p-queue';
2
2
  import { w as write, r as read } from './write-CN8f7bYv.cjs';
3
- import { TupleToUnion, ObjValueTuple, PossiblePromise, GreaterThan } from '@kubb/types';
3
+ import { PossiblePromise, TupleToUnion, ObjValueTuple, GreaterThan } from '@kubb/types';
4
4
  import { DirectoryTreeOptions } from 'directory-tree';
5
5
  import { E as EventEmitter, L as Logger, a as LogLevel } from './logger-Cskfrvra.cjs';
6
6
  import 'ora';
@@ -14,22 +14,6 @@ type BarrelManagerOptions = {
14
14
  extName?: KubbFile.Extname;
15
15
  };
16
16
 
17
- type Plugins = _Register;
18
- type OptionsPlugins = {
19
- [K in keyof Plugins]: Plugins[K]['options'];
20
- };
21
- type OptionsOfPlugin<K extends keyof Plugins> = Plugins[K]['options'];
22
- type PluginUnion = TupleToUnion<ObjValueTuple<OptionsPlugins>>;
23
- type Plugin$1 = keyof Plugins;
24
-
25
- type kubb_OptionsOfPlugin<K extends keyof Plugins> = OptionsOfPlugin<K>;
26
- type kubb_OptionsPlugins = OptionsPlugins;
27
- type kubb_PluginUnion = PluginUnion;
28
- type kubb_Plugins = Plugins;
29
- declare namespace kubb {
30
- export type { kubb_OptionsOfPlugin as OptionsOfPlugin, kubb_OptionsPlugins as OptionsPlugins, Plugin$1 as Plugin, kubb_PluginUnion as PluginUnion, kubb_Plugins as Plugins };
31
- }
32
-
33
17
  type RequiredPluginLifecycle = Required<PluginLifecycle>;
34
18
  /**
35
19
  * Get the type of the first argument in a function.
@@ -146,6 +130,22 @@ declare class PluginManager {
146
130
  static get hooks(): readonly ["buildStart", "resolvePath", "resolveName", "load", "transform", "writeFile", "buildEnd"];
147
131
  }
148
132
 
133
+ type Plugins = _Register;
134
+ type OptionsPlugins = {
135
+ [K in keyof Plugins]: Plugins[K]['options'];
136
+ };
137
+ type OptionsOfPlugin<K extends keyof Plugins> = Plugins[K]['options'];
138
+ type PluginUnion = TupleToUnion<ObjValueTuple<OptionsPlugins>>;
139
+ type Plugin$1 = keyof Plugins;
140
+
141
+ type kubb_OptionsOfPlugin<K extends keyof Plugins> = OptionsOfPlugin<K>;
142
+ type kubb_OptionsPlugins = OptionsPlugins;
143
+ type kubb_PluginUnion = PluginUnion;
144
+ type kubb_Plugins = Plugins;
145
+ declare namespace kubb {
146
+ export type { kubb_OptionsOfPlugin as OptionsOfPlugin, kubb_OptionsPlugins as OptionsPlugins, Plugin$1 as Plugin, kubb_PluginUnion as PluginUnion, kubb_Plugins as Plugins };
147
+ }
148
+
149
149
  interface Cache<TStore extends object = object> {
150
150
  delete(id: keyof TStore): boolean;
151
151
  get(id: keyof TStore): TStore[keyof TStore] | null;
@@ -290,10 +290,6 @@ TResolvePathOptions extends object = object> = {
290
290
  resolvedOptions: TResolvedOptions;
291
291
  api: TAPI;
292
292
  resolvePathOptions: TResolvePathOptions;
293
- appMeta: {
294
- pluginManager: PluginManager;
295
- plugin: Plugin<PluginFactoryOptions<TName, TOptions, TResolvedOptions, TAPI, TResolvePathOptions>>;
296
- };
297
293
  };
298
294
  type GetPluginFactoryOptions<TPlugin extends UserPlugin> = TPlugin extends UserPlugin<infer X> ? X : never;
299
295
  type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
@@ -494,7 +490,7 @@ declare namespace KubbFile {
494
490
  type UUID = string;
495
491
  type Source = string;
496
492
  type Extname = '.ts' | '.js' | '.tsx' | '.json' | `.${string}`;
497
- type Mode = 'file' | 'directory';
493
+ type Mode = 'single' | 'split';
498
494
  /**
499
495
  * Name to be used to dynamicly create the baseName(based on input.path)
500
496
  * Based on UNIX basename
@@ -580,6 +576,7 @@ type AddIndexesProps = {
580
576
  extName?: KubbFile.Extname;
581
577
  exportType?: 'barrel' | 'barrelNamed' | false;
582
578
  };
579
+ logger: Logger;
583
580
  options?: BarrelManagerOptions;
584
581
  meta?: KubbFile.File['meta'];
585
582
  };
@@ -593,7 +590,7 @@ declare class FileManager {
593
590
  get files(): Array<KubbFile.File>;
594
591
  get isExecuting(): boolean;
595
592
  add<T extends Array<KubbFile.File> = Array<KubbFile.File>>(...files: T): AddResult<T>;
596
- addIndexes({ root, output, meta, options }: AddIndexesProps): Promise<void>;
593
+ addIndexes({ root, output, meta, logger, options }: AddIndexesProps): Promise<void>;
597
594
  getCacheByUUID(UUID: KubbFile.UUID): KubbFile.File | undefined;
598
595
  get(path: KubbFile.Path): Array<KubbFile.File> | undefined;
599
596
  remove(path: KubbFile.Path): void;
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import PQueue from 'p-queue';
2
2
  import { w as write, r as read } from './write-CN8f7bYv.js';
3
- import { TupleToUnion, ObjValueTuple, PossiblePromise, GreaterThan } from '@kubb/types';
3
+ import { PossiblePromise, TupleToUnion, ObjValueTuple, GreaterThan } from '@kubb/types';
4
4
  import { DirectoryTreeOptions } from 'directory-tree';
5
5
  import { E as EventEmitter, L as Logger, a as LogLevel } from './logger-Cskfrvra.js';
6
6
  import 'ora';
@@ -14,22 +14,6 @@ type BarrelManagerOptions = {
14
14
  extName?: KubbFile.Extname;
15
15
  };
16
16
 
17
- type Plugins = _Register;
18
- type OptionsPlugins = {
19
- [K in keyof Plugins]: Plugins[K]['options'];
20
- };
21
- type OptionsOfPlugin<K extends keyof Plugins> = Plugins[K]['options'];
22
- type PluginUnion = TupleToUnion<ObjValueTuple<OptionsPlugins>>;
23
- type Plugin$1 = keyof Plugins;
24
-
25
- type kubb_OptionsOfPlugin<K extends keyof Plugins> = OptionsOfPlugin<K>;
26
- type kubb_OptionsPlugins = OptionsPlugins;
27
- type kubb_PluginUnion = PluginUnion;
28
- type kubb_Plugins = Plugins;
29
- declare namespace kubb {
30
- export type { kubb_OptionsOfPlugin as OptionsOfPlugin, kubb_OptionsPlugins as OptionsPlugins, Plugin$1 as Plugin, kubb_PluginUnion as PluginUnion, kubb_Plugins as Plugins };
31
- }
32
-
33
17
  type RequiredPluginLifecycle = Required<PluginLifecycle>;
34
18
  /**
35
19
  * Get the type of the first argument in a function.
@@ -146,6 +130,22 @@ declare class PluginManager {
146
130
  static get hooks(): readonly ["buildStart", "resolvePath", "resolveName", "load", "transform", "writeFile", "buildEnd"];
147
131
  }
148
132
 
133
+ type Plugins = _Register;
134
+ type OptionsPlugins = {
135
+ [K in keyof Plugins]: Plugins[K]['options'];
136
+ };
137
+ type OptionsOfPlugin<K extends keyof Plugins> = Plugins[K]['options'];
138
+ type PluginUnion = TupleToUnion<ObjValueTuple<OptionsPlugins>>;
139
+ type Plugin$1 = keyof Plugins;
140
+
141
+ type kubb_OptionsOfPlugin<K extends keyof Plugins> = OptionsOfPlugin<K>;
142
+ type kubb_OptionsPlugins = OptionsPlugins;
143
+ type kubb_PluginUnion = PluginUnion;
144
+ type kubb_Plugins = Plugins;
145
+ declare namespace kubb {
146
+ export type { kubb_OptionsOfPlugin as OptionsOfPlugin, kubb_OptionsPlugins as OptionsPlugins, Plugin$1 as Plugin, kubb_PluginUnion as PluginUnion, kubb_Plugins as Plugins };
147
+ }
148
+
149
149
  interface Cache<TStore extends object = object> {
150
150
  delete(id: keyof TStore): boolean;
151
151
  get(id: keyof TStore): TStore[keyof TStore] | null;
@@ -290,10 +290,6 @@ TResolvePathOptions extends object = object> = {
290
290
  resolvedOptions: TResolvedOptions;
291
291
  api: TAPI;
292
292
  resolvePathOptions: TResolvePathOptions;
293
- appMeta: {
294
- pluginManager: PluginManager;
295
- plugin: Plugin<PluginFactoryOptions<TName, TOptions, TResolvedOptions, TAPI, TResolvePathOptions>>;
296
- };
297
293
  };
298
294
  type GetPluginFactoryOptions<TPlugin extends UserPlugin> = TPlugin extends UserPlugin<infer X> ? X : never;
299
295
  type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
@@ -494,7 +490,7 @@ declare namespace KubbFile {
494
490
  type UUID = string;
495
491
  type Source = string;
496
492
  type Extname = '.ts' | '.js' | '.tsx' | '.json' | `.${string}`;
497
- type Mode = 'file' | 'directory';
493
+ type Mode = 'single' | 'split';
498
494
  /**
499
495
  * Name to be used to dynamicly create the baseName(based on input.path)
500
496
  * Based on UNIX basename
@@ -580,6 +576,7 @@ type AddIndexesProps = {
580
576
  extName?: KubbFile.Extname;
581
577
  exportType?: 'barrel' | 'barrelNamed' | false;
582
578
  };
579
+ logger: Logger;
583
580
  options?: BarrelManagerOptions;
584
581
  meta?: KubbFile.File['meta'];
585
582
  };
@@ -593,7 +590,7 @@ declare class FileManager {
593
590
  get files(): Array<KubbFile.File>;
594
591
  get isExecuting(): boolean;
595
592
  add<T extends Array<KubbFile.File> = Array<KubbFile.File>>(...files: T): AddResult<T>;
596
- addIndexes({ root, output, meta, options }: AddIndexesProps): Promise<void>;
593
+ addIndexes({ root, output, meta, logger, options }: AddIndexesProps): Promise<void>;
597
594
  getCacheByUUID(UUID: KubbFile.UUID): KubbFile.File | undefined;
598
595
  get(path: KubbFile.Path): Array<KubbFile.File> | undefined;
599
596
  remove(path: KubbFile.Path): void;
package/dist/index.js CHANGED
@@ -1,12 +1,13 @@
1
1
  import {
2
2
  searchAndReplace,
3
3
  transformReservedWord,
4
+ transformers_default,
4
5
  trimExtName
5
- } from "./chunk-Z5N655B7.js";
6
+ } from "./chunk-VPKB6WED.js";
6
7
  import {
7
8
  URLPath,
8
9
  setUniqueName
9
- } from "./chunk-ALE7CO7I.js";
10
+ } from "./chunk-NKAOH4VT.js";
10
11
  import {
11
12
  orderBy
12
13
  } from "./chunk-IP732R22.js";
@@ -16,7 +17,7 @@ import {
16
17
  createLogger,
17
18
  p,
18
19
  randomCliColour
19
- } from "./chunk-4BZD7YTT.js";
20
+ } from "./chunk-XHJKKPCO.js";
20
21
  import {
21
22
  clean
22
23
  } from "./chunk-KXDRK6DY.js";
@@ -748,15 +749,6 @@ init_esm_shims();
748
749
  // src/build.ts
749
750
  init_esm_shims();
750
751
 
751
- // src/config.ts
752
- init_esm_shims();
753
- function defineConfig(options) {
754
- return options;
755
- }
756
- function isInputPath(result) {
757
- return !!result && "path" in result;
758
- }
759
-
760
752
  // src/FileManager.ts
761
753
  init_esm_shims();
762
754
  var import_lodash = __toESM(require_lodash(), 1);
@@ -849,13 +841,13 @@ var TreeNode = class _TreeNode {
849
841
  const treeNode = new _TreeNode({
850
842
  name: filteredTree.name,
851
843
  path: filteredTree.path,
852
- type: filteredTree.type || FileManager.getMode(filteredTree.path)
844
+ type: FileManager.getMode(filteredTree.path)
853
845
  });
854
846
  const recurse = (node, item) => {
855
847
  const subNode = node.addChild({
856
848
  name: item.name,
857
849
  path: item.path,
858
- type: item.type || FileManager.getMode(item.path)
850
+ type: FileManager.getMode(item.path)
859
851
  });
860
852
  if (item.children?.length) {
861
853
  item.children?.forEach((child) => {
@@ -928,8 +920,8 @@ var BarrelManager = class {
928
920
  if (treeNode2.children.length > 1) {
929
921
  const indexPath = path.resolve(treeNode2.data.path, "index.ts");
930
922
  const exports = treeNode2.children.filter(Boolean).map((file) => {
931
- const importPath = file.data.type === "directory" ? `./${file.data.name}/index` : `./${trimExtName(file.data.name)}`;
932
- if (importPath.endsWith("index") && file.data.type === "file") {
923
+ const importPath = file.data.type === "split" ? `./${file.data.name}/index` : `./${trimExtName(file.data.name)}`;
924
+ if (importPath.endsWith("index") && file.data.type === "single") {
933
925
  return void 0;
934
926
  }
935
927
  return {
@@ -947,7 +939,7 @@ var BarrelManager = class {
947
939
  } else if (treeNode2.children.length === 1) {
948
940
  const [treeNodeChild] = treeNode2.children;
949
941
  const indexPath = path.resolve(treeNode2.data.path, "index.ts");
950
- const importPath = treeNodeChild.data.type === "directory" ? `./${treeNodeChild.data.name}/index` : `./${trimExtName(treeNodeChild.data.name)}`;
942
+ const importPath = treeNodeChild.data.type === "split" ? `./${treeNodeChild.data.name}/index` : `./${trimExtName(treeNodeChild.data.name)}`;
951
943
  const exports = [
952
944
  {
953
945
  path: extName ? `${importPath}${extName}` : importPath,
@@ -1011,12 +1003,16 @@ var _FileManager = class _FileManager {
1011
1003
  }
1012
1004
  return resolvedFiles[0];
1013
1005
  }
1014
- async addIndexes({ root, output, meta, options = {} }) {
1006
+ async addIndexes({ root, output, meta, logger, options = {} }) {
1015
1007
  const { exportType = "barrel" } = output;
1016
1008
  if (exportType === false) {
1017
1009
  return void 0;
1018
1010
  }
1019
1011
  const pathToBuildFrom = resolve(root, output.path);
1012
+ if (transformers_default.trimExtName(pathToBuildFrom).endsWith("index")) {
1013
+ logger.emit("warning", "Output has the same fileName as the barrelFiles, please disable barrel generation");
1014
+ return;
1015
+ }
1020
1016
  const exportPath = output.path.startsWith("./") ? trimExtName(output.path) : `./${trimExtName(output.path)}`;
1021
1017
  const mode = _FileManager.getMode(output.path);
1022
1018
  const barrelManager = new BarrelManager({
@@ -1046,7 +1042,7 @@ var _FileManager = class _FileManager {
1046
1042
  });
1047
1043
  })
1048
1044
  );
1049
- const rootPath = mode === "directory" ? `${exportPath}/index${output.extName || ""}` : `${exportPath}${output.extName || ""}`;
1045
+ const rootPath = mode === "split" ? `${exportPath}/index${output.extName || ""}` : `${exportPath}${output.extName || ""}`;
1050
1046
  const rootFile = {
1051
1047
  path: resolve(root, "index.ts"),
1052
1048
  baseName: "index.ts",
@@ -1104,9 +1100,9 @@ var _FileManager = class _FileManager {
1104
1100
  }
1105
1101
  static getMode(path3) {
1106
1102
  if (!path3) {
1107
- return "directory";
1103
+ return "split";
1108
1104
  }
1109
- return extname(path3) ? "file" : "directory";
1105
+ return extname(path3) ? "single" : "split";
1110
1106
  }
1111
1107
  static get extensions() {
1112
1108
  return [".js", ".ts", ".tsx"];
@@ -1334,6 +1330,73 @@ function getEnvSource(source, env) {
1334
1330
  init_esm_shims();
1335
1331
  import PQueue2 from "p-queue";
1336
1332
 
1333
+ // src/PromiseManager.ts
1334
+ init_esm_shims();
1335
+
1336
+ // src/utils/executeStrategies.ts
1337
+ init_esm_shims();
1338
+ function hookSeq(promises) {
1339
+ return promises.filter(Boolean).reduce(
1340
+ (promise, func) => {
1341
+ if (typeof func !== "function") {
1342
+ throw new Error("HookSeq needs a function that returns a promise `() => Promise<unknown>`");
1343
+ }
1344
+ return promise.then((state) => {
1345
+ const calledFunc = func(state);
1346
+ if (calledFunc) {
1347
+ return calledFunc.then(Array.prototype.concat.bind(state));
1348
+ }
1349
+ });
1350
+ },
1351
+ Promise.resolve([])
1352
+ );
1353
+ }
1354
+ function hookFirst(promises, nullCheck = (state) => state !== null) {
1355
+ let promise = Promise.resolve(null);
1356
+ for (const func of promises.filter(Boolean)) {
1357
+ promise = promise.then((state) => {
1358
+ if (nullCheck(state)) {
1359
+ return state;
1360
+ }
1361
+ const calledFunc = func(state);
1362
+ return calledFunc;
1363
+ });
1364
+ }
1365
+ return promise;
1366
+ }
1367
+ function hookParallel(promises) {
1368
+ return Promise.allSettled(promises.filter(Boolean).map((promise) => promise()));
1369
+ }
1370
+
1371
+ // src/PromiseManager.ts
1372
+ var _options2;
1373
+ var PromiseManager = class {
1374
+ constructor(options = {}) {
1375
+ __privateAdd(this, _options2, {});
1376
+ __privateSet(this, _options2, options);
1377
+ return this;
1378
+ }
1379
+ run(strategy, promises) {
1380
+ if (strategy === "seq") {
1381
+ return hookSeq(promises);
1382
+ }
1383
+ if (strategy === "first") {
1384
+ return hookFirst(promises, __privateGet(this, _options2).nullCheck);
1385
+ }
1386
+ if (strategy === "parallel") {
1387
+ return hookParallel(promises);
1388
+ }
1389
+ throw new Error(`${strategy} not implemented`);
1390
+ }
1391
+ };
1392
+ _options2 = new WeakMap();
1393
+ function isPromise(result) {
1394
+ return !!result && typeof result?.then === "function";
1395
+ }
1396
+ function isPromiseRejectedResult(result) {
1397
+ return result.status === "rejected";
1398
+ }
1399
+
1337
1400
  // src/errors.ts
1338
1401
  init_esm_shims();
1339
1402
  var Warning = class extends Error {
@@ -1427,73 +1490,6 @@ var definePlugin = createPlugin((options) => {
1427
1490
  };
1428
1491
  });
1429
1492
 
1430
- // src/PromiseManager.ts
1431
- init_esm_shims();
1432
-
1433
- // src/utils/executeStrategies.ts
1434
- init_esm_shims();
1435
- function hookSeq(promises) {
1436
- return promises.filter(Boolean).reduce(
1437
- (promise, func) => {
1438
- if (typeof func !== "function") {
1439
- throw new Error("HookSeq needs a function that returns a promise `() => Promise<unknown>`");
1440
- }
1441
- return promise.then((state) => {
1442
- const calledFunc = func(state);
1443
- if (calledFunc) {
1444
- return calledFunc.then(Array.prototype.concat.bind(state));
1445
- }
1446
- });
1447
- },
1448
- Promise.resolve([])
1449
- );
1450
- }
1451
- function hookFirst(promises, nullCheck = (state) => state !== null) {
1452
- let promise = Promise.resolve(null);
1453
- for (const func of promises.filter(Boolean)) {
1454
- promise = promise.then((state) => {
1455
- if (nullCheck(state)) {
1456
- return state;
1457
- }
1458
- const calledFunc = func(state);
1459
- return calledFunc;
1460
- });
1461
- }
1462
- return promise;
1463
- }
1464
- function hookParallel(promises) {
1465
- return Promise.allSettled(promises.filter(Boolean).map((promise) => promise()));
1466
- }
1467
-
1468
- // src/PromiseManager.ts
1469
- var _options2;
1470
- var PromiseManager = class {
1471
- constructor(options = {}) {
1472
- __privateAdd(this, _options2, {});
1473
- __privateSet(this, _options2, options);
1474
- return this;
1475
- }
1476
- run(strategy, promises) {
1477
- if (strategy === "seq") {
1478
- return hookSeq(promises);
1479
- }
1480
- if (strategy === "first") {
1481
- return hookFirst(promises, __privateGet(this, _options2).nullCheck);
1482
- }
1483
- if (strategy === "parallel") {
1484
- return hookParallel(promises);
1485
- }
1486
- throw new Error(`${strategy} not implemented`);
1487
- }
1488
- };
1489
- _options2 = new WeakMap();
1490
- function isPromise(result) {
1491
- return !!result && typeof result?.then === "function";
1492
- }
1493
- function isPromiseRejectedResult(result) {
1494
- return result.status === "rejected";
1495
- }
1496
-
1497
1493
  // src/PluginManager.ts
1498
1494
  var _core, _usedPluginNames, _promiseManager, _getSortedPlugins, getSortedPlugins_fn, _addExecutedToCallStack, addExecutedToCallStack_fn, _execute, execute_fn, _executeSync, executeSync_fn, _catcher, catcher_fn, _parse, parse_fn;
1499
1495
  var PluginManager = class {
@@ -1530,7 +1526,7 @@ var PluginManager = class {
1530
1526
  hookName: "resolvePath",
1531
1527
  parameters: [params.baseName, params.mode, params.options]
1532
1528
  });
1533
- if (paths && paths?.length > 1 && this.logger.logLevel === LogLevel.debug) {
1529
+ if (paths && paths?.length > 1) {
1534
1530
  this.logger.emit("debug", [
1535
1531
  `Cannot return a path where the 'pluginKey' ${params.pluginKey ? JSON.stringify(params.pluginKey) : '"'} is not unique enough
1536
1532
 
@@ -1554,7 +1550,7 @@ Falling back on the first item.
1554
1550
  hookName: "resolveName",
1555
1551
  parameters: [params.name, params.type]
1556
1552
  });
1557
- if (names && names?.length > 1 && this.logger.logLevel === LogLevel.debug) {
1553
+ if (names && names?.length > 1) {
1558
1554
  this.logger.emit("debug", [
1559
1555
  `Cannot return a name where the 'pluginKey' ${params.pluginKey ? JSON.stringify(params.pluginKey) : '"'} is not unique enough
1560
1556
 
@@ -1790,12 +1786,10 @@ Falling back on the first item.
1790
1786
  });
1791
1787
  if (!pluginByPluginName?.length) {
1792
1788
  const corePlugin = plugins.find((plugin) => plugin.name === "core" && plugin[hookName]);
1793
- if (this.logger.logLevel === LogLevel.debug) {
1794
- if (corePlugin) {
1795
- this.logger.emit("debug", [`No hook '${hookName}' for pluginKey '${JSON.stringify(pluginKey)}' found, falling back on the '@kubb/core' plugin`]);
1796
- } else {
1797
- this.logger.emit("debug", [`No hook '${hookName}' for pluginKey '${JSON.stringify(pluginKey)}' found, no fallback found in the '@kubb/core' plugin`]);
1798
- }
1789
+ if (corePlugin) {
1790
+ this.logger.emit("debug", [`No hook '${hookName}' for pluginKey '${JSON.stringify(pluginKey)}' found, falling back on the '@kubb/core' plugin`]);
1791
+ } else {
1792
+ this.logger.emit("debug", [`No hook '${hookName}' for pluginKey '${JSON.stringify(pluginKey)}' found, no fallback found in the '@kubb/core' plugin`]);
1799
1793
  }
1800
1794
  return corePlugin ? [corePlugin] : [];
1801
1795
  }
@@ -1962,6 +1956,15 @@ parse_fn = function(plugin, pluginManager, context) {
1962
1956
  };
1963
1957
  };
1964
1958
 
1959
+ // src/config.ts
1960
+ init_esm_shims();
1961
+ function defineConfig(options) {
1962
+ return options;
1963
+ }
1964
+ function isInputPath(result) {
1965
+ return !!result && "path" in result;
1966
+ }
1967
+
1965
1968
  // src/build.ts
1966
1969
  async function transformReducer(_previousCode, result, _plugin) {
1967
1970
  return result;
@@ -2029,12 +2032,10 @@ async function setup(options) {
2029
2032
  const { hookName, parameters, plugin } = executer;
2030
2033
  if (hookName === "writeFile") {
2031
2034
  const [code] = parameters;
2032
- if (logger.logLevel === LogLevel.debug) {
2033
- logger.emit("debug", [`PluginKey ${p.dim(JSON.stringify(plugin.key))}
2035
+ logger.emit("debug", [`PluginKey ${p.dim(JSON.stringify(plugin.key))}
2034
2036
  with source
2035
2037
 
2036
2038
  ${code}`]);
2037
- }
2038
2039
  }
2039
2040
  });
2040
2041
  pluginManager.queue.on("add", () => {
@@ -2066,16 +2067,14 @@ ${code}`]);
2066
2067
  });
2067
2068
  pluginManager.on("executed", (executer) => {
2068
2069
  const { hookName, plugin, output, parameters } = executer;
2069
- if (logger.logLevel === LogLevel.debug) {
2070
- const logs = [
2071
- `${randomCliColour(plugin.name)} Executing ${hookName}`,
2072
- parameters && `${p.bgWhite("Parameters")} ${randomCliColour(plugin.name)} ${hookName}`,
2073
- JSON.stringify(parameters, void 0, 2),
2074
- output && `${p.bgWhite("Output")} ${randomCliColour(plugin.name)} ${hookName}`,
2075
- output
2076
- ].filter(Boolean);
2077
- logger.emit("debug", logs);
2078
- }
2070
+ const logs = [
2071
+ `${randomCliColour(plugin.name)} Executing ${hookName}`,
2072
+ parameters && `${p.bgWhite("Parameters")} ${randomCliColour(plugin.name)} ${hookName}`,
2073
+ JSON.stringify(parameters, void 0, 2),
2074
+ output && `${p.bgWhite("Output")} ${randomCliColour(plugin.name)} ${hookName}`,
2075
+ output
2076
+ ].filter(Boolean);
2077
+ logger.emit("debug", logs);
2079
2078
  });
2080
2079
  return pluginManager;
2081
2080
  }