@kubb/core 3.16.2 → 3.16.4

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 (106) hide show
  1. package/dist/FileManager-Dk759iZ3.js +918 -0
  2. package/dist/FileManager-Dk759iZ3.js.map +1 -0
  3. package/dist/FileManager-DsRjYJa_.cjs +1031 -0
  4. package/dist/FileManager-DsRjYJa_.cjs.map +1 -0
  5. package/dist/PluginManager-1jPxuyQK.d.ts +511 -0
  6. package/dist/PluginManager-Cvj5AlsU.d.cts +511 -0
  7. package/dist/chunk-DWy1uDak.cjs +39 -0
  8. package/dist/chunk-DbvY3SJr.js +33 -0
  9. package/dist/fs-BacxV1CO.js +87 -0
  10. package/dist/fs-BacxV1CO.js.map +1 -0
  11. package/dist/fs-BazSaf2y.cjs +129 -0
  12. package/dist/fs-BazSaf2y.cjs.map +1 -0
  13. package/dist/fs.cjs +15 -39
  14. package/dist/fs.d.cts +2 -19
  15. package/dist/fs.d.ts +2 -19
  16. package/dist/fs.js +4 -3
  17. package/dist/index-BKHQGQVq.d.ts +140 -0
  18. package/dist/index-BfD6z1P5.d.cts +141 -0
  19. package/dist/index-Cb4pChs8.d.ts +180 -0
  20. package/dist/index-D2ptHzfn.d.cts +180 -0
  21. package/dist/index.cjs +997 -1077
  22. package/dist/index.cjs.map +1 -1
  23. package/dist/index.d.cts +107 -89
  24. package/dist/index.d.ts +107 -89
  25. package/dist/index.js +1020 -864
  26. package/dist/index.js.map +1 -1
  27. package/dist/logger-BxvJpQMX.cjs +1115 -0
  28. package/dist/logger-BxvJpQMX.cjs.map +1 -0
  29. package/dist/logger-Cs45J4yy.js +1085 -0
  30. package/dist/logger-Cs45J4yy.js.map +1 -0
  31. package/dist/logger-OWS6fqk0.d.cts +69 -0
  32. package/dist/logger-xcdTETKy.d.ts +69 -0
  33. package/dist/logger.cjs +6 -24
  34. package/dist/logger.d.cts +2 -3
  35. package/dist/logger.d.ts +2 -3
  36. package/dist/logger.js +4 -4
  37. package/dist/mocks.cjs +49 -65
  38. package/dist/mocks.cjs.map +1 -1
  39. package/dist/mocks.d.cts +6 -6
  40. package/dist/mocks.d.ts +6 -6
  41. package/dist/mocks.js +48 -59
  42. package/dist/mocks.js.map +1 -1
  43. package/dist/prompt-DwEAzq0q.js +853 -0
  44. package/dist/prompt-DwEAzq0q.js.map +1 -0
  45. package/dist/prompt-qiwl6Be9.cjs +855 -0
  46. package/dist/prompt-qiwl6Be9.cjs.map +1 -0
  47. package/dist/transformers-B3CHtwuB.cjs +948 -0
  48. package/dist/transformers-B3CHtwuB.cjs.map +1 -0
  49. package/dist/transformers-CJqBQFIl.js +829 -0
  50. package/dist/transformers-CJqBQFIl.js.map +1 -0
  51. package/dist/transformers.cjs +33 -88
  52. package/dist/transformers.d.cts +75 -54
  53. package/dist/transformers.d.ts +75 -54
  54. package/dist/transformers.js +4 -3
  55. package/dist/utils.cjs +20 -73
  56. package/dist/utils.d.cts +5 -126
  57. package/dist/utils.d.ts +5 -126
  58. package/dist/utils.js +6 -5
  59. package/dist/write-CLTPlucv.js +42 -0
  60. package/dist/write-CLTPlucv.js.map +1 -0
  61. package/dist/write-l_NzIqyy.cjs +48 -0
  62. package/dist/write-l_NzIqyy.cjs.map +1 -0
  63. package/package.json +25 -32
  64. package/src/BarrelManager.ts +1 -0
  65. package/src/PromiseManager.ts +1 -7
  66. package/src/build.ts +9 -11
  67. package/src/index.ts +5 -5
  68. package/src/logger.ts +10 -10
  69. package/src/utils/FunctionParams.ts +3 -1
  70. package/src/utils/TreeNode.ts +3 -1
  71. package/dist/PluginManager-E3SghPP9.d.cts +0 -458
  72. package/dist/PluginManager-PDmRCu9k.d.ts +0 -458
  73. package/dist/chunk-4V7HK7PT.js +0 -1199
  74. package/dist/chunk-4V7HK7PT.js.map +0 -1
  75. package/dist/chunk-BHSTNFNQ.cjs +0 -701
  76. package/dist/chunk-BHSTNFNQ.cjs.map +0 -1
  77. package/dist/chunk-CAZ37TGB.js +0 -918
  78. package/dist/chunk-CAZ37TGB.js.map +0 -1
  79. package/dist/chunk-E4XLCCPK.cjs +0 -170
  80. package/dist/chunk-E4XLCCPK.cjs.map +0 -1
  81. package/dist/chunk-GBYHPDPK.js +0 -595
  82. package/dist/chunk-GBYHPDPK.js.map +0 -1
  83. package/dist/chunk-L3A3DTAX.cjs +0 -1074
  84. package/dist/chunk-L3A3DTAX.cjs.map +0 -1
  85. package/dist/chunk-MCNA6SYG.cjs +0 -1231
  86. package/dist/chunk-MCNA6SYG.cjs.map +0 -1
  87. package/dist/chunk-YRPOID7E.js +0 -157
  88. package/dist/chunk-YRPOID7E.js.map +0 -1
  89. package/dist/fs.cjs.map +0 -1
  90. package/dist/fs.js.map +0 -1
  91. package/dist/logger-BWq-oJU_.d.cts +0 -63
  92. package/dist/logger-BWq-oJU_.d.ts +0 -63
  93. package/dist/logger.cjs.map +0 -1
  94. package/dist/logger.js.map +0 -1
  95. package/dist/parser-C1vOjVEd.d.ts +0 -41
  96. package/dist/parser-D6vU1kA9.d.cts +0 -41
  97. package/dist/prompt-ELTHGQK6.js +0 -753
  98. package/dist/prompt-ELTHGQK6.js.map +0 -1
  99. package/dist/prompt-U7M5G25C.cjs +0 -761
  100. package/dist/prompt-U7M5G25C.cjs.map +0 -1
  101. package/dist/transformers.cjs.map +0 -1
  102. package/dist/transformers.js.map +0 -1
  103. package/dist/types-CA8nQKwM.d.cts +0 -132
  104. package/dist/types-CA8nQKwM.d.ts +0 -132
  105. package/dist/utils.cjs.map +0 -1
  106. package/dist/utils.js.map +0 -1
package/dist/index.d.ts CHANGED
@@ -1,122 +1,140 @@
1
- import { R as ResolvedFile } from './types-CA8nQKwM.js';
2
- import { U as UserConfig, P as PluginManager, a as PossiblePromise, I as InputPath, b as PluginFactoryOptions, c as UserPluginWithLifeCycle } from './PluginManager-PDmRCu9k.js';
3
- export { B as BarrelType, C as Config, F as FileManager, d as FileMetaBase, G as GetPluginFactoryOptions, p as Group, e as InputData, O as Output, i as Plugin, o as PluginContext, f as PluginKey, k as PluginLifecycle, l as PluginLifecycleHooks, m as PluginParameter, j as PluginWithLifeCycle, n as ResolveNameParams, R as ResolvePathParams, h as UserPlugin, g as getSource } from './PluginManager-PDmRCu9k.js';
4
- import { L as Logger } from './logger-BWq-oJU_.js';
5
- export { g as getDefaultBanner } from './parser-C1vOjVEd.js';
6
- import 'consola/utils';
7
- import 'consola';
1
+ import { ResolvedFile } from "./index-BKHQGQVq.js";
2
+ import { Logger } from "./logger-xcdTETKy.js";
3
+ import { BarrelType, Config, FileManager, FileMetaBase, GetPluginFactoryOptions, Group, InputData, InputPath, Output, Plugin, PluginContext, PluginFactoryOptions, PluginKey, PluginLifecycle, PluginLifecycleHooks, PluginManager, PluginParameter, PluginWithLifeCycle, PossiblePromise, ResolveNameParams, ResolvePathParams, UserConfig, UserPlugin, UserPluginWithLifeCycle, getSource } from "./PluginManager-1jPxuyQK.js";
4
+ import { getDefaultBanner } from "./index-Cb4pChs8.js";
8
5
 
6
+ //#region src/BaseGenerator.d.ts
7
+ /**
8
+ * Abstract class that contains the building blocks for plugins to create their own Generator
9
+ * @link idea based on https://github.com/colinhacks/zod/blob/master/src/types.ts#L137
10
+ */
11
+ declare abstract class BaseGenerator<TOptions = unknown, TContext = unknown> {
12
+ #private;
13
+ constructor(options?: TOptions, context?: TContext);
14
+ get options(): TOptions;
15
+ get context(): TContext;
16
+ set options(options: TOptions);
17
+ abstract build(...params: unknown[]): unknown;
18
+ }
19
+ //#endregion
20
+ //#region src/build.d.ts
9
21
  type BuildOptions = {
10
- config: UserConfig;
11
- /**
12
- * @default Logger without the spinner
13
- */
14
- logger?: Logger;
15
- pluginManager?: PluginManager;
22
+ config: UserConfig;
23
+ /**
24
+ * @default Logger without the spinner
25
+ */
26
+ logger?: Logger;
27
+ pluginManager?: PluginManager;
16
28
  };
17
29
  type BuildOutput = {
18
- files: Array<ResolvedFile>;
19
- pluginManager: PluginManager;
20
- /**
21
- * Only for safeBuild
22
- */
23
- error?: Error;
30
+ files: Array<ResolvedFile>;
31
+ pluginManager: PluginManager;
32
+ /**
33
+ * Only for safeBuild
34
+ */
35
+ error?: Error;
24
36
  };
25
37
  declare function setup(options: BuildOptions): Promise<PluginManager>;
26
38
  declare function build(options: BuildOptions): Promise<BuildOutput>;
27
39
  declare function safeBuild(options: BuildOptions): Promise<BuildOutput>;
28
-
40
+ //#endregion
41
+ //#region src/config.d.ts
29
42
  type Args = {
30
- /**
31
- * Path to `kubb.config.js`
32
- */
33
- config?: string;
34
- /**
35
- * Watch changes on input
36
- */
37
- watch?: boolean;
38
- /**
39
- * Log level to report when using the CLI
40
- *
41
- * `silent` will hide all information that is not relevant
42
- *
43
- * `info` will show all information possible(not related to the PluginManager)
44
- *
45
- * `debug` will show all information possible(related to the PluginManager), handy for seeing logs
46
- * @default `silent`
47
- */
48
- logLevel?: string;
49
- /**
50
- * Run Kubb with Bun
51
- */
52
- bun?: boolean;
43
+ /**
44
+ * Path to `kubb.config.js`
45
+ */
46
+ config?: string;
47
+ /**
48
+ * Watch changes on input
49
+ */
50
+ watch?: boolean;
51
+ /**
52
+ * Log level to report when using the CLI
53
+ *
54
+ * `silent` will hide all information that is not relevant
55
+ *
56
+ * `info` will show all information possible(not related to the PluginManager)
57
+ *
58
+ * `debug` will show all information possible(related to the PluginManager), handy for seeing logs
59
+ * @default `silent`
60
+ */
61
+ logLevel?: string;
62
+ /**
63
+ * Run Kubb with Bun
64
+ */
65
+ bun?: boolean;
53
66
  };
54
67
  /**
55
68
  * Type helper to make it easier to use vite.config.ts accepts a direct UserConfig object, or a function that returns it. The function receives a ConfigEnv object.
56
69
  */
57
- declare function defineConfig(options: PossiblePromise<UserConfig | Array<UserConfig>> | ((
58
- /** The options derived from the CLI flags */
70
+ declare function defineConfig(options: PossiblePromise<UserConfig | Array<UserConfig>> | ((/** The options derived from the CLI flags */
59
71
  args: Args) => PossiblePromise<UserConfig | Array<UserConfig>>)): typeof options;
60
72
  declare function isInputPath(result: UserConfig | undefined): result is UserConfig<InputPath>;
61
-
62
- /**
63
- * Abstract class that contains the building blocks for plugins to create their own Generator
64
- * @link idea based on https://github.com/colinhacks/zod/blob/master/src/types.ts#L137
65
- */
66
- declare abstract class BaseGenerator<TOptions = unknown, TContext = unknown> {
67
- #private;
68
- constructor(options?: TOptions, context?: TContext);
69
- get options(): TOptions;
70
- get context(): TContext;
71
- set options(options: TOptions);
72
- abstract build(...params: unknown[]): unknown;
73
- }
74
-
73
+ //#endregion
74
+ //#region src/PackageManager.d.ts
75
75
  type PackageJSON = {
76
- dependencies?: Record<string, string>;
77
- devDependencies?: Record<string, string>;
76
+ dependencies?: Record<string, string>;
77
+ devDependencies?: Record<string, string>;
78
78
  };
79
79
  type DependencyName = string;
80
80
  type DependencyVersion = string;
81
81
  declare class PackageManager {
82
- #private;
83
- constructor(workspace?: string);
84
- set workspace(workspace: string);
85
- get workspace(): string | undefined;
86
- normalizeDirectory(directory: string): string;
87
- getLocation(path: string): string;
88
- import(path: string): Promise<any | undefined>;
89
- getPackageJSON(): Promise<PackageJSON | undefined>;
90
- getPackageJSONSync(): PackageJSON | undefined;
91
- static setVersion(dependency: DependencyName, version: DependencyVersion): void;
92
- getVersion(dependency: DependencyName | RegExp): Promise<DependencyVersion | undefined>;
93
- getVersionSync(dependency: DependencyName | RegExp): DependencyVersion | undefined;
94
- isValid(dependency: DependencyName | RegExp, version: DependencyVersion): Promise<boolean>;
95
- isValidSync(dependency: DependencyName | RegExp, version: DependencyVersion): boolean;
82
+ #private;
83
+ constructor(workspace?: string);
84
+ set workspace(workspace: string);
85
+ get workspace(): string | undefined;
86
+ normalizeDirectory(directory: string): string;
87
+ getLocation(path: string): string;
88
+ import(path: string): Promise<any | undefined>;
89
+ getPackageJSON(): Promise<PackageJSON | undefined>;
90
+ getPackageJSONSync(): PackageJSON | undefined;
91
+ static setVersion(dependency: DependencyName, version: DependencyVersion): void;
92
+ getVersion(dependency: DependencyName | RegExp): Promise<DependencyVersion | undefined>;
93
+ getVersionSync(dependency: DependencyName | RegExp): DependencyVersion | undefined;
94
+ isValid(dependency: DependencyName | RegExp, version: DependencyVersion): Promise<boolean>;
95
+ isValidSync(dependency: DependencyName | RegExp, version: DependencyVersion): boolean;
96
96
  }
97
-
98
- type PluginFactory<T extends PluginFactoryOptions = PluginFactoryOptions> = (options: T['options']) => UserPluginWithLifeCycle<T>;
99
- type OptionalPluginFactory<T extends PluginFactoryOptions = PluginFactoryOptions> = (options?: T['options']) => UserPluginWithLifeCycle<T>;
100
- declare function createPlugin<T extends PluginFactoryOptions = PluginFactoryOptions>(factory: PluginFactory<T>): OptionalPluginFactory<T>;
101
-
97
+ //#endregion
98
+ //#region src/utils/executeStrategies.d.ts
102
99
  type PromiseFunc$1<T = unknown, T2 = never> = (state?: T) => T2 extends never ? Promise<T> : Promise<T> | T2;
103
100
  type ValueOfPromiseFuncArray<TInput extends Array<unknown>> = TInput extends Array<PromiseFunc$1<infer X, infer Y>> ? X | Y : never;
104
101
  type SeqOutput<TInput extends Array<PromiseFunc$1<TValue, null>>, TValue> = Promise<Array<Awaited<ValueOfPromiseFuncArray<TInput>>>>;
102
+ /**
103
+ * Chains promises
104
+ */
105
+
105
106
  type HookFirstOutput<TInput extends Array<PromiseFunc$1<TValue, null>>, TValue = unknown> = ValueOfPromiseFuncArray<TInput>;
107
+ /**
108
+ * Chains promises, first non-null result stops and returns
109
+ */
110
+
106
111
  type HookParallelOutput<TInput extends Array<PromiseFunc$1<TValue, null>>, TValue> = Promise<PromiseSettledResult<Awaited<ValueOfPromiseFuncArray<TInput>>>[]>;
112
+ /**
113
+ * Runs an array of promise functions with optional concurrency limit.
114
+ */
115
+
107
116
  type Strategy = 'seq' | 'first' | 'parallel';
108
117
  type StrategySwitch<TStrategy extends Strategy, TInput extends Array<PromiseFunc$1<TValue, null>>, TValue> = TStrategy extends 'first' ? HookFirstOutput<TInput, TValue> : TStrategy extends 'seq' ? SeqOutput<TInput, TValue> : TStrategy extends 'parallel' ? HookParallelOutput<TInput, TValue> : never;
109
-
118
+ //#endregion
119
+ //#region src/PromiseManager.d.ts
110
120
  type PromiseFunc<T = unknown, T2 = never> = () => T2 extends never ? Promise<T> : Promise<T> | T2;
111
121
  type Options<TState = any> = {
112
- nullCheck?: (state: TState) => boolean;
122
+ nullCheck?: (state: TState) => boolean;
113
123
  };
114
124
  declare class PromiseManager<TState = any> {
115
- #private;
116
- constructor(options?: Options<TState>);
117
- run<TInput extends Array<PromiseFunc<TValue, null>>, TValue, TStrategy extends Strategy, TOutput = StrategySwitch<TStrategy, TInput, TValue>>(strategy: TStrategy, promises: TInput, { concurrency }?: {
118
- concurrency?: number;
119
- }): TOutput;
125
+ #private;
126
+ constructor(options?: Options<TState>);
127
+ run<TInput extends Array<PromiseFunc<TValue, null>>, TValue, TStrategy extends Strategy, TOutput = StrategySwitch<TStrategy, TInput, TValue>>(strategy: TStrategy, promises: TInput, {
128
+ concurrency
129
+ }?: {
130
+ concurrency?: number;
131
+ }): TOutput;
120
132
  }
121
-
122
- export { BaseGenerator, InputPath, PackageManager, PluginFactoryOptions, PluginManager, PromiseManager, UserConfig, UserPluginWithLifeCycle, build, createPlugin, build as default, defineConfig, isInputPath, safeBuild, setup };
133
+ //#endregion
134
+ //#region src/plugin.d.ts
135
+ type PluginFactory<T extends PluginFactoryOptions = PluginFactoryOptions> = (options: T['options']) => UserPluginWithLifeCycle<T>;
136
+ type OptionalPluginFactory<T extends PluginFactoryOptions = PluginFactoryOptions> = (options?: T['options']) => UserPluginWithLifeCycle<T>;
137
+ declare function createPlugin<T extends PluginFactoryOptions = PluginFactoryOptions>(factory: PluginFactory<T>): OptionalPluginFactory<T>;
138
+ //#endregion
139
+ export { BarrelType, BaseGenerator, Config, FileManager, type FileMetaBase, GetPluginFactoryOptions, Group, InputData, InputPath, Output, PackageManager, Plugin, PluginContext, PluginFactoryOptions, PluginKey, PluginLifecycle, PluginLifecycleHooks, PluginManager, PluginParameter, PluginWithLifeCycle, PromiseManager, ResolveNameParams, ResolvePathParams, UserConfig, UserPlugin, UserPluginWithLifeCycle, build, createPlugin, build as default, defineConfig, getDefaultBanner, getSource, isInputPath, safeBuild, setup };
140
+ //# sourceMappingURL=index.d.ts.map