@kubb/core 4.1.4 → 4.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. package/dist/{FileManager-COJW0Zp4.cjs → FileManager-DlkY9W5A.cjs} +5 -7
  2. package/dist/{FileManager-COJW0Zp4.cjs.map → FileManager-DlkY9W5A.cjs.map} +1 -1
  3. package/dist/{FileManager-B0V0rX5Z.js → FileManager-zlhCXf6A.js} +8 -10
  4. package/dist/{FileManager-B0V0rX5Z.js.map → FileManager-zlhCXf6A.js.map} +1 -1
  5. package/dist/{acorn-Z0oy0vSt.js → acorn-B0JdnMwY.js} +17 -21
  6. package/dist/{acorn-Z0oy0vSt.js.map → acorn-B0JdnMwY.js.map} +1 -1
  7. package/dist/{acorn-Cg_eXN51.cjs → acorn-DExO7r0H.cjs} +17 -21
  8. package/dist/{acorn-Cg_eXN51.cjs.map → acorn-DExO7r0H.cjs.map} +1 -1
  9. package/dist/{angular-nBly58h0.cjs → angular-C2M8l5eL.cjs} +24 -29
  10. package/dist/{angular-nBly58h0.cjs.map → angular-C2M8l5eL.cjs.map} +1 -1
  11. package/dist/{angular-BUlb_iaU.js → angular-CmU_K35W.js} +24 -29
  12. package/dist/{angular-BUlb_iaU.js.map → angular-CmU_K35W.js.map} +1 -1
  13. package/dist/{babel-5qXjvTGO.cjs → babel-BKn0s9Rj.cjs} +27 -37
  14. package/dist/{babel-5qXjvTGO.cjs.map → babel-BKn0s9Rj.cjs.map} +1 -1
  15. package/dist/{babel-DfXTN9QX.js → babel-CfF0c5A9.js} +27 -37
  16. package/dist/{babel-DfXTN9QX.js.map → babel-CfF0c5A9.js.map} +1 -1
  17. package/dist/{chunk-kPDogv7o.js → chunk-1SJ2vVWa.js} +1 -1
  18. package/dist/{estree-Bt3vRtV3.js → estree-B_YMDsR7.js} +49 -64
  19. package/dist/{estree-Bt3vRtV3.js.map → estree-B_YMDsR7.js.map} +1 -1
  20. package/dist/{estree-DyiFjXDy.cjs → estree-Br3l79C5.cjs} +49 -64
  21. package/dist/{estree-DyiFjXDy.cjs.map → estree-Br3l79C5.cjs.map} +1 -1
  22. package/dist/{flow-DdtBrX0O.cjs → flow-B_3vaVXc.cjs} +978 -1038
  23. package/dist/{flow-DdtBrX0O.cjs.map → flow-B_3vaVXc.cjs.map} +1 -1
  24. package/dist/{flow-Bb8_yYns.js → flow-Dc3wao4M.js} +978 -1038
  25. package/dist/{flow-Bb8_yYns.js.map → flow-Dc3wao4M.js.map} +1 -1
  26. package/dist/{fs-BNC5Fj6t.js → fs-BIPMUfpW.js} +3 -4
  27. package/dist/{fs-BNC5Fj6t.js.map → fs-BIPMUfpW.js.map} +1 -1
  28. package/dist/{fs-Bi2kuxAm.cjs → fs-RSVoUw3S.cjs} +2 -3
  29. package/dist/{fs-Bi2kuxAm.cjs.map → fs-RSVoUw3S.cjs.map} +1 -1
  30. package/dist/fs.cjs +1 -1
  31. package/dist/fs.d.cts +1 -1
  32. package/dist/fs.d.ts +1 -1
  33. package/dist/fs.js +2 -2
  34. package/dist/{glimmer-BuCRLjbI.cjs → glimmer-BF35HI3l.cjs} +27 -41
  35. package/dist/{glimmer-BuCRLjbI.cjs.map → glimmer-BF35HI3l.cjs.map} +1 -1
  36. package/dist/{glimmer-By8WZPkK.js → glimmer-CwM1XZA1.js} +27 -41
  37. package/dist/{glimmer-By8WZPkK.js.map → glimmer-CwM1XZA1.js.map} +1 -1
  38. package/dist/{graphql-TN0hv-fx.cjs → graphql-DhaHiYrP.cjs} +16 -20
  39. package/dist/{graphql-TN0hv-fx.cjs.map → graphql-DhaHiYrP.cjs.map} +1 -1
  40. package/dist/{graphql-DsrNefXx.js → graphql-KQQTidk7.js} +16 -20
  41. package/dist/{graphql-DsrNefXx.js.map → graphql-KQQTidk7.js.map} +1 -1
  42. package/dist/hooks.cjs +29 -0
  43. package/dist/hooks.cjs.map +1 -0
  44. package/dist/hooks.d.cts +15 -0
  45. package/dist/hooks.d.ts +15 -0
  46. package/dist/hooks.js +25 -0
  47. package/dist/hooks.js.map +1 -0
  48. package/dist/{html-1W4-2_9J.cjs → html-B2QWX43c.cjs} +26 -27
  49. package/dist/{html-1W4-2_9J.cjs.map → html-B2QWX43c.cjs.map} +1 -1
  50. package/dist/{html-Y5KDc150.js → html-DQoJX7Yj.js} +26 -27
  51. package/dist/{html-Y5KDc150.js.map → html-DQoJX7Yj.js.map} +1 -1
  52. package/dist/{index-CGJ3tdk-.d.ts → index-BY_kka8d.d.ts} +7 -2
  53. package/dist/{index-B7KKQHG8.d.cts → index-CYcjcRdj.d.ts} +5 -5
  54. package/dist/{index-BhFFCWR1.d.ts → index-DaYv9bst.d.cts} +5 -5
  55. package/dist/{index-CWX6_-da.d.cts → index-Iq8NJRgc.d.cts} +5 -2
  56. package/dist/index.cjs +9 -12
  57. package/dist/index.cjs.map +1 -1
  58. package/dist/index.d.cts +10 -10
  59. package/dist/index.d.ts +10 -10
  60. package/dist/index.js +11 -14
  61. package/dist/index.js.map +1 -1
  62. package/dist/{logger-OWS6fqk0.d.cts → logger-BkGPbocD.d.ts} +2 -2
  63. package/dist/{logger-BKPT4rkB.js → logger-CsQ2EGpR.js} +10 -14
  64. package/dist/{logger-BKPT4rkB.js.map → logger-CsQ2EGpR.js.map} +1 -1
  65. package/dist/{logger-B-4AXUmB.d.ts → logger-DpoDtxfo.d.cts} +2 -2
  66. package/dist/{logger-DBJsdlpZ.cjs → logger-S_t55o9n.cjs} +8 -12
  67. package/dist/{logger-DBJsdlpZ.cjs.map → logger-S_t55o9n.cjs.map} +1 -1
  68. package/dist/logger.cjs +1 -1
  69. package/dist/logger.d.cts +1 -1
  70. package/dist/logger.d.ts +1 -1
  71. package/dist/logger.js +2 -2
  72. package/dist/{markdown-Drl4Cbq5.js → markdown-CDf4HsAQ.js} +25 -29
  73. package/dist/{markdown-Drl4Cbq5.js.map → markdown-CDf4HsAQ.js.map} +1 -1
  74. package/dist/{markdown-Bltb-uzO.cjs → markdown-HXmAlxeH.cjs} +25 -29
  75. package/dist/{markdown-Bltb-uzO.cjs.map → markdown-HXmAlxeH.cjs.map} +1 -1
  76. package/dist/{meriyah-CdG8HPS2.cjs → meriyah-CWoiYjq_.cjs} +21 -29
  77. package/dist/{meriyah-CdG8HPS2.cjs.map → meriyah-CWoiYjq_.cjs.map} +1 -1
  78. package/dist/{meriyah-Cz9whwp-.js → meriyah-D8fyVkyI.js} +21 -29
  79. package/dist/{meriyah-Cz9whwp-.js.map → meriyah-D8fyVkyI.js.map} +1 -1
  80. package/dist/mocks.cjs +81 -138
  81. package/dist/mocks.cjs.map +1 -1
  82. package/dist/mocks.d.cts +3 -3
  83. package/dist/mocks.d.ts +3 -3
  84. package/dist/mocks.js +83 -140
  85. package/dist/mocks.js.map +1 -1
  86. package/dist/{postcss-Dfx_9buT.js → postcss-Dqh1XvaI.js} +41 -54
  87. package/dist/{postcss-Dfx_9buT.js.map → postcss-Dqh1XvaI.js.map} +1 -1
  88. package/dist/{postcss-B7n9zUIy.cjs → postcss-bESf1Yzf.cjs} +41 -54
  89. package/dist/{postcss-B7n9zUIy.cjs.map → postcss-bESf1Yzf.cjs.map} +1 -1
  90. package/dist/{prompt-BMs_Y-vT.js → prompt-C5GR2LPU.js} +30 -32
  91. package/dist/{prompt-BMs_Y-vT.js.map → prompt-C5GR2LPU.js.map} +1 -1
  92. package/dist/{prompt-BXlYKArM.cjs → prompt-ZBXNC-aV.cjs} +29 -31
  93. package/dist/{prompt-BXlYKArM.cjs.map → prompt-ZBXNC-aV.cjs.map} +1 -1
  94. package/dist/{transformers-BllSzdDt.js → transformers-5BubQvcu.js} +14 -23
  95. package/dist/{transformers-BllSzdDt.js.map → transformers-5BubQvcu.js.map} +1 -1
  96. package/dist/{transformers-DZ22lE-S.cjs → transformers-BIx7CVmw.cjs} +12 -21
  97. package/dist/{transformers-DZ22lE-S.cjs.map → transformers-BIx7CVmw.cjs.map} +1 -1
  98. package/dist/transformers.cjs +1 -1
  99. package/dist/transformers.js +1 -1
  100. package/dist/{PluginManager-BSUDeUfP.d.ts → types-DtokChaW.d.ts} +245 -245
  101. package/dist/{PluginManager-a3RiDAFC.d.cts → types-IOE1JAFC.d.cts} +245 -245
  102. package/dist/{typescript-C8iCxnaF.js → typescript-B7n7vRma.js} +101 -153
  103. package/dist/{typescript-C8iCxnaF.js.map → typescript-B7n7vRma.js.map} +1 -1
  104. package/dist/{typescript-Evf8GXVW.cjs → typescript-BYxryL2A.cjs} +100 -152
  105. package/dist/{typescript-Evf8GXVW.cjs.map → typescript-BYxryL2A.cjs.map} +1 -1
  106. package/dist/typescript-CIdP4XPm.js +3 -0
  107. package/dist/typescript-CbuCkdxv.cjs +4 -0
  108. package/dist/utils.cjs +3 -3
  109. package/dist/utils.d.cts +4 -4
  110. package/dist/utils.d.ts +4 -4
  111. package/dist/utils.js +4 -4
  112. package/dist/{write-O9QWtBJ_.js → write-CxO1CDML.js} +2 -2
  113. package/dist/{write-O9QWtBJ_.js.map → write-CxO1CDML.js.map} +1 -1
  114. package/dist/{yaml-Bi_nSoU_.js → yaml-BMiF8MYP.js} +141 -157
  115. package/dist/{yaml-Bi_nSoU_.js.map → yaml-BMiF8MYP.js.map} +1 -1
  116. package/dist/{yaml-B2qeXFgu.cjs → yaml-DQCs4b_O.cjs} +141 -157
  117. package/dist/{yaml-B2qeXFgu.cjs.map → yaml-DQCs4b_O.cjs.map} +1 -1
  118. package/package.json +15 -3
  119. package/src/hooks/index.ts +3 -0
  120. package/src/hooks/useMode.ts +8 -0
  121. package/src/hooks/usePlugin.ts +8 -0
  122. package/src/hooks/usePluginManager.ts +8 -0
  123. package/dist/typescript-BY9-7pw9.js +0 -3
  124. package/dist/typescript-PxlX-TH7.cjs +0 -4
@@ -1,10 +1,218 @@
1
- import { BaseName, Extname, File, Mode, OptionalPath, Path, ResolvedFile } from "./index-CWX6_-da.cjs";
2
- import { EventEmitter, Logger } from "./logger-OWS6fqk0.cjs";
1
+ import { a as File, c as OptionalPath, d as ResolvedFile, i as Extname, l as Path, n as BaseName, s as Mode } from "./index-Iq8NJRgc.cjs";
2
+ import { n as Logger, o as EventEmitter } from "./logger-DpoDtxfo.cjs";
3
3
 
4
4
  //#region src/utils/types.d.ts
5
- type PossiblePromise<T> = Promise<T> | T;
6
- type ArrayWithLength<T extends number, U extends any[] = []> = U['length'] extends T ? U : ArrayWithLength<T, [true, ...U]>;
7
- type GreaterThan<T extends number, U extends number> = ArrayWithLength<U> extends [...ArrayWithLength<T>, ...infer _] ? false : true;
5
+ type PossiblePromise<T$1> = Promise<T$1> | T$1;
6
+ type ArrayWithLength<T$1 extends number, U extends any[] = []> = U['length'] extends T$1 ? U : ArrayWithLength<T$1, [true, ...U]>;
7
+ type GreaterThan<T$1 extends number, U extends number> = ArrayWithLength<U> extends [...ArrayWithLength<T$1>, ...infer _] ? false : true;
8
+ //#endregion
9
+ //#region src/FileManager.d.ts
10
+ type FileMetaBase = {
11
+ pluginKey?: Plugin['key'];
12
+ };
13
+ type AddResult<T$1 extends Array<File>> = Promise<Awaited<GreaterThan<T$1['length'], 1> extends true ? Promise<ResolvedFile[]> : Promise<ResolvedFile>>>;
14
+ type AddIndexesProps = {
15
+ type: BarrelType | false | undefined;
16
+ /**
17
+ * Root based on root and output.path specified in the config
18
+ */
19
+ root: string;
20
+ /**
21
+ * Output for plugin
22
+ */
23
+ output: {
24
+ path: string;
25
+ };
26
+ group?: {
27
+ output: string;
28
+ exportAs: string;
29
+ };
30
+ logger?: Logger;
31
+ meta?: FileMetaBase;
32
+ };
33
+ type WriteFilesProps = {
34
+ root: Config['root'];
35
+ extension?: Record<Extname, Extname | ''>;
36
+ logger?: Logger;
37
+ dryRun?: boolean;
38
+ };
39
+ declare class FileManager {
40
+ #private;
41
+ constructor();
42
+ add<T extends Array<File> = Array<File>>(...files: T): AddResult<T>;
43
+ getByPath(path: Path): Promise<ResolvedFile | null>;
44
+ deleteByPath(path: Path): Promise<void>;
45
+ clear(): Promise<void>;
46
+ getFiles(): Promise<Array<ResolvedFile>>;
47
+ processFiles({
48
+ dryRun,
49
+ root,
50
+ extension,
51
+ logger
52
+ }: WriteFilesProps): Promise<Array<ResolvedFile>>;
53
+ getBarrelFiles({
54
+ type,
55
+ meta,
56
+ root,
57
+ output,
58
+ logger
59
+ }: AddIndexesProps): Promise<File[]>;
60
+ static getMode(path: string | undefined | null): Mode;
61
+ }
62
+ type GetSourceOptions = {
63
+ extname?: Extname;
64
+ logger?: Logger;
65
+ };
66
+ declare function getSource<TMeta extends FileMetaBase = FileMetaBase>(file: ResolvedFile<TMeta>, {
67
+ logger,
68
+ extname
69
+ }?: GetSourceOptions): Promise<string>;
70
+ //#endregion
71
+ //#region src/PluginManager.d.ts
72
+ type RequiredPluginLifecycle = Required<PluginLifecycle>;
73
+ type Strategy = 'hookFirst' | 'hookForPlugin' | 'hookParallel' | 'hookSeq';
74
+ type Executer<H$1 extends PluginLifecycleHooks = PluginLifecycleHooks> = {
75
+ message: string;
76
+ strategy: Strategy;
77
+ hookName: H$1;
78
+ plugin: Plugin;
79
+ parameters?: unknown[] | undefined;
80
+ output?: unknown;
81
+ };
82
+ type ParseResult<H$1 extends PluginLifecycleHooks> = RequiredPluginLifecycle[H$1];
83
+ type SafeParseResult<H$1 extends PluginLifecycleHooks, Result = ReturnType<ParseResult<H$1>>> = {
84
+ result: Result;
85
+ plugin: Plugin;
86
+ };
87
+ type Options = {
88
+ logger: Logger;
89
+ /**
90
+ * @default Number.POSITIVE_INFINITY
91
+ */
92
+ concurrency?: number;
93
+ };
94
+ type Events = {
95
+ executing: [executer: Executer];
96
+ executed: [executer: Executer];
97
+ error: [error: Error];
98
+ };
99
+ type GetFileProps<TOptions$1 = object> = {
100
+ name: string;
101
+ mode?: Mode;
102
+ extname: Extname;
103
+ pluginKey: Plugin['key'];
104
+ options?: TOptions$1;
105
+ };
106
+ declare class PluginManager {
107
+ #private;
108
+ readonly plugins: Set<Plugin<PluginFactoryOptions<string, object, object, any, object>>>;
109
+ readonly fileManager: FileManager;
110
+ readonly events: EventEmitter<Events>;
111
+ readonly config: Config;
112
+ readonly executed: Array<Executer>;
113
+ readonly logger: Logger;
114
+ readonly options: Options;
115
+ constructor(config: Config, options: Options);
116
+ getFile<TOptions = object>({
117
+ name,
118
+ mode,
119
+ extname,
120
+ pluginKey,
121
+ options
122
+ }: GetFileProps<TOptions>): File<{
123
+ pluginKey: Plugin['key'];
124
+ }>;
125
+ resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => OptionalPath;
126
+ resolveName: (params: ResolveNameParams) => string;
127
+ /**
128
+ * Instead of calling `pluginManager.events.on` you can use `pluginManager.on`. This one also has better types.
129
+ */
130
+ on<TEventName extends keyof Events & string>(eventName: TEventName, handler: (...eventArg: Events[TEventName]) => void): void;
131
+ /**
132
+ * Run a specific hookName for plugin x.
133
+ */
134
+ hookForPlugin<H extends PluginLifecycleHooks>({
135
+ pluginKey,
136
+ hookName,
137
+ parameters,
138
+ message
139
+ }: {
140
+ pluginKey: Plugin['key'];
141
+ hookName: H;
142
+ parameters: PluginParameter<H>;
143
+ message: string;
144
+ }): Promise<Array<ReturnType<ParseResult<H>> | null>>;
145
+ /**
146
+ * Run a specific hookName for plugin x.
147
+ */
148
+ hookForPluginSync<H extends PluginLifecycleHooks>({
149
+ pluginKey,
150
+ hookName,
151
+ parameters,
152
+ message
153
+ }: {
154
+ pluginKey: Plugin['key'];
155
+ hookName: H;
156
+ parameters: PluginParameter<H>;
157
+ message: string;
158
+ }): Array<ReturnType<ParseResult<H>>> | null;
159
+ /**
160
+ * First non-null result stops and will return it's value.
161
+ */
162
+ hookFirst<H extends PluginLifecycleHooks>({
163
+ hookName,
164
+ parameters,
165
+ skipped,
166
+ message
167
+ }: {
168
+ hookName: H;
169
+ parameters: PluginParameter<H>;
170
+ skipped?: ReadonlySet<Plugin> | null;
171
+ message: string;
172
+ }): Promise<SafeParseResult<H>>;
173
+ /**
174
+ * First non-null result stops and will return it's value.
175
+ */
176
+ hookFirstSync<H extends PluginLifecycleHooks>({
177
+ hookName,
178
+ parameters,
179
+ skipped,
180
+ message
181
+ }: {
182
+ hookName: H;
183
+ parameters: PluginParameter<H>;
184
+ skipped?: ReadonlySet<Plugin> | null;
185
+ message: string;
186
+ }): SafeParseResult<H>;
187
+ /**
188
+ * Run all plugins in parallel(order will be based on `this.plugin` and if `pre` or `post` is set).
189
+ */
190
+ hookParallel<H extends PluginLifecycleHooks, TOuput = void>({
191
+ hookName,
192
+ parameters,
193
+ message
194
+ }: {
195
+ hookName: H;
196
+ parameters?: Parameters<RequiredPluginLifecycle[H]> | undefined;
197
+ message: string;
198
+ }): Promise<Awaited<TOuput>[]>;
199
+ /**
200
+ * Chains plugins
201
+ */
202
+ hookSeq<H extends PluginLifecycleHooks>({
203
+ hookName,
204
+ parameters,
205
+ message
206
+ }: {
207
+ hookName: H;
208
+ parameters?: PluginParameter<H>;
209
+ message: string;
210
+ }): Promise<void>;
211
+ getPluginByKey(pluginKey: Plugin['key']): Plugin | undefined;
212
+ getPluginsByKey(hookName: keyof PluginWithLifeCycle, pluginKey: Plugin['key']): Plugin[];
213
+ static getDependedPlugins<T1 extends PluginFactoryOptions, T2 extends PluginFactoryOptions = never, T3 extends PluginFactoryOptions = never, TOutput = (T3 extends never ? (T2 extends never ? [T1: Plugin<T1>] : [T1: Plugin<T1>, T2: Plugin<T2>]) : [T1: Plugin<T1>, T2: Plugin<T2>, T3: Plugin<T3>])>(plugins: Array<Plugin>, dependedPluginNames: string | string[]): TOutput;
214
+ static get hooks(): readonly ["buildStart", "resolvePath", "resolveName", "buildEnd"];
215
+ }
8
216
  //#endregion
9
217
  //#region src/types.d.ts
10
218
  /**
@@ -137,11 +345,11 @@ TName extends string = string,
137
345
  /**
138
346
  * Options of the plugin.
139
347
  */
140
- TOptions extends object = object,
348
+ TOptions$1 extends object = object,
141
349
  /**
142
350
  * Options of the plugin that can be used later on, see `options` inside your plugin config.
143
351
  */
144
- TResolvedOptions extends object = TOptions,
352
+ TResolvedOptions extends object = TOptions$1,
145
353
  /**
146
354
  * Context that you want to expose to other plugins.
147
355
  */
@@ -155,24 +363,24 @@ TResolvePathOptions extends object = object> = {
155
363
  * Same behaviour like what has been done with `QueryKey` in `@tanstack/react-query`
156
364
  */
157
365
  key: PluginKey<TName | string>;
158
- options: TOptions;
366
+ options: TOptions$1;
159
367
  resolvedOptions: TResolvedOptions;
160
368
  context: TContext;
161
369
  resolvePathOptions: TResolvePathOptions;
162
370
  };
163
371
  type PluginKey<TName> = [name: TName, identifier?: string | number];
164
372
  type GetPluginFactoryOptions<TPlugin extends UserPlugin> = TPlugin extends UserPlugin<infer X> ? X : never;
165
- type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
373
+ type UserPlugin<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
166
374
  /**
167
375
  * Unique name used for the plugin
168
376
  * The name of the plugin follows the format scope:foo-bar or foo-bar, adding scope: can avoid naming conflicts with other plugins.
169
377
  * @example @kubb/typescript
170
378
  */
171
- name: TOptions['name'];
379
+ name: TOptions$1['name'];
172
380
  /**
173
381
  * Options set for a specific plugin(see kubb.config.js), passthrough of options.
174
382
  */
175
- options: TOptions['resolvedOptions'];
383
+ options: TOptions$1['resolvedOptions'];
176
384
  /**
177
385
  * Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin will be executed after these plugins.
178
386
  * Can be used to validate dependent plugins.
@@ -182,24 +390,24 @@ type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> =
182
390
  * Specifies the succeeding plugins for the current plugin. You can pass an array of succeeding plugin names, and the current plugin will be executed before these plugins.
183
391
  */
184
392
  post?: Array<string>;
185
- } & (TOptions['context'] extends never ? {
393
+ } & (TOptions$1['context'] extends never ? {
186
394
  context?: never;
187
395
  } : {
188
- context: (this: TOptions['name'] extends 'core' ? null : Omit<PluginContext<TOptions>, 'addFile'>) => TOptions['context'];
396
+ context: (this: TOptions$1['name'] extends 'core' ? null : Omit<PluginContext<TOptions$1>, 'addFile'>) => TOptions$1['context'];
189
397
  });
190
- type UserPluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = UserPlugin<TOptions> & PluginLifecycle<TOptions>;
398
+ type UserPluginWithLifeCycle<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = UserPlugin<TOptions$1> & PluginLifecycle<TOptions$1>;
191
399
  type UnknownUserPlugin = UserPlugin<PluginFactoryOptions<any, any, any, any, any>>;
192
- type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
400
+ type Plugin<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
193
401
  /**
194
402
  * Unique name used for the plugin
195
403
  * @example @kubb/typescript
196
404
  */
197
- name: TOptions['name'];
405
+ name: TOptions$1['name'];
198
406
  /**
199
407
  * Internal key used when a developer uses more than one of the same plugin
200
408
  * @private
201
409
  */
202
- key: TOptions['key'];
410
+ key: TOptions$1['key'];
203
411
  /**
204
412
  * Specifies the preceding plugins for the current plugin. You can pass an array of preceding plugin names, and the current plugin will be executed after these plugins.
205
413
  * Can be used to validate dependent plugins.
@@ -212,49 +420,49 @@ type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
212
420
  /**
213
421
  * Options set for a specific plugin(see kubb.config.js), passthrough of options.
214
422
  */
215
- options: TOptions['resolvedOptions'];
216
- } & (TOptions['context'] extends never ? {
423
+ options: TOptions$1['resolvedOptions'];
424
+ } & (TOptions$1['context'] extends never ? {
217
425
  context?: never;
218
426
  } : {
219
- context: TOptions['context'];
427
+ context: TOptions$1['context'];
220
428
  });
221
- type PluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = Plugin<TOptions> & PluginLifecycle<TOptions>;
222
- type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
429
+ type PluginWithLifeCycle<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = Plugin<TOptions$1> & PluginLifecycle<TOptions$1>;
430
+ type PluginLifecycle<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
223
431
  /**
224
432
  * Start of the lifecycle of a plugin.
225
433
  * @type hookParallel
226
434
  */
227
- buildStart?: (this: PluginContext<TOptions>, Config: Config) => PossiblePromise<void>;
435
+ buildStart?: (this: PluginContext<TOptions$1>, Config: Config) => PossiblePromise<void>;
228
436
  /**
229
437
  * Resolve to a Path based on a baseName(example: `./Pet.ts`) and directory(example: `./models`).
230
438
  * Options can als be included.
231
439
  * @type hookFirst
232
440
  * @example ('./Pet.ts', './src/gen/') => '/src/gen/Pet.ts'
233
441
  */
234
- resolvePath?: (this: PluginContext<TOptions>, baseName: BaseName, mode?: Mode, options?: TOptions['resolvePathOptions']) => OptionalPath;
442
+ resolvePath?: (this: PluginContext<TOptions$1>, baseName: BaseName, mode?: Mode, options?: TOptions$1['resolvePathOptions']) => OptionalPath;
235
443
  /**
236
444
  * Resolve to a name based on a string.
237
445
  * Useful when converting to PascalCase or camelCase.
238
446
  * @type hookFirst
239
447
  * @example ('pet') => 'Pet'
240
448
  */
241
- resolveName?: (this: PluginContext<TOptions>, name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
449
+ resolveName?: (this: PluginContext<TOptions$1>, name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
242
450
  /**
243
451
  * End of the plugin lifecycle.
244
452
  * @type hookParallel
245
453
  */
246
- buildEnd?: (this: PluginContext<TOptions>) => PossiblePromise<void>;
454
+ buildEnd?: (this: PluginContext<TOptions$1>) => PossiblePromise<void>;
247
455
  };
248
456
  type PluginLifecycleHooks = keyof PluginLifecycle;
249
- type PluginParameter<H extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H]>;
250
- type ResolvePathParams<TOptions = object> = {
457
+ type PluginParameter<H$1 extends PluginLifecycleHooks> = Parameters<Required<PluginLifecycle>[H$1]>;
458
+ type ResolvePathParams<TOptions$1 = object> = {
251
459
  pluginKey?: Plugin['key'];
252
460
  baseName: BaseName;
253
461
  mode?: Mode;
254
462
  /**
255
463
  * Options to be passed to 'resolvePath' 3th parameter
256
464
  */
257
- options?: TOptions;
465
+ options?: TOptions$1;
258
466
  };
259
467
  type ResolveNameParams = {
260
468
  name: string;
@@ -267,12 +475,12 @@ type ResolveNameParams = {
267
475
  */
268
476
  type?: 'file' | 'function' | 'type' | 'const';
269
477
  };
270
- type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
478
+ type PluginContext<TOptions$1 extends PluginFactoryOptions = PluginFactoryOptions> = {
271
479
  config: Config;
272
480
  fileManager: FileManager;
273
481
  pluginManager: PluginManager;
274
482
  addFile: (...file: Array<File>) => Promise<Array<ResolvedFile>>;
275
- resolvePath: (params: ResolvePathParams<TOptions['resolvePathOptions']>) => OptionalPath;
483
+ resolvePath: (params: ResolvePathParams<TOptions$1['resolvePathOptions']>) => OptionalPath;
276
484
  resolveName: (params: ResolveNameParams) => string;
277
485
  logger: Logger;
278
486
  /**
@@ -282,12 +490,12 @@ type PluginContext<TOptions extends PluginFactoryOptions = PluginFactoryOptions>
282
490
  /**
283
491
  * Current plugin
284
492
  */
285
- plugin: Plugin<TOptions>;
493
+ plugin: Plugin<TOptions$1>;
286
494
  };
287
495
  /**
288
496
  * Specify the export location for the files and define the behavior of the output
289
497
  */
290
- type Output<TOptions> = {
498
+ type Output<TOptions$1> = {
291
499
  /**
292
500
  * Path to the output folder or file that will contain the generated code
293
501
  */
@@ -300,11 +508,11 @@ type Output<TOptions> = {
300
508
  /**
301
509
  * Add a banner text in the beginning of every file
302
510
  */
303
- banner?: string | ((options: TOptions) => string);
511
+ banner?: string | ((options: TOptions$1) => string);
304
512
  /**
305
513
  * Add a footer text in the beginning of every file
306
514
  */
307
- footer?: string | ((options: TOptions) => string);
515
+ footer?: string | ((options: TOptions$1) => string);
308
516
  };
309
517
  type GroupContext = {
310
518
  group: string;
@@ -320,213 +528,5 @@ type Group = {
320
528
  name?: (context: GroupContext) => string;
321
529
  };
322
530
  //#endregion
323
- //#region src/FileManager.d.ts
324
- type FileMetaBase = {
325
- pluginKey?: Plugin['key'];
326
- };
327
- type AddResult<T extends Array<File>> = Promise<Awaited<GreaterThan<T['length'], 1> extends true ? Promise<ResolvedFile[]> : Promise<ResolvedFile>>>;
328
- type AddIndexesProps = {
329
- type: BarrelType | false | undefined;
330
- /**
331
- * Root based on root and output.path specified in the config
332
- */
333
- root: string;
334
- /**
335
- * Output for plugin
336
- */
337
- output: {
338
- path: string;
339
- };
340
- group?: {
341
- output: string;
342
- exportAs: string;
343
- };
344
- logger?: Logger;
345
- meta?: FileMetaBase;
346
- };
347
- type WriteFilesProps = {
348
- root: Config['root'];
349
- extension?: Record<Extname, Extname | ''>;
350
- logger?: Logger;
351
- dryRun?: boolean;
352
- };
353
- declare class FileManager {
354
- #private;
355
- constructor();
356
- add<T extends Array<File> = Array<File>>(...files: T): AddResult<T>;
357
- getByPath(path: Path): Promise<ResolvedFile | null>;
358
- deleteByPath(path: Path): Promise<void>;
359
- clear(): Promise<void>;
360
- getFiles(): Promise<Array<ResolvedFile>>;
361
- processFiles({
362
- dryRun,
363
- root,
364
- extension,
365
- logger
366
- }: WriteFilesProps): Promise<Array<ResolvedFile>>;
367
- getBarrelFiles({
368
- type,
369
- meta,
370
- root,
371
- output,
372
- logger
373
- }: AddIndexesProps): Promise<File[]>;
374
- static getMode(path: string | undefined | null): Mode;
375
- }
376
- type GetSourceOptions = {
377
- extname?: Extname;
378
- logger?: Logger;
379
- };
380
- declare function getSource<TMeta extends FileMetaBase = FileMetaBase>(file: ResolvedFile<TMeta>, {
381
- logger,
382
- extname
383
- }?: GetSourceOptions): Promise<string>;
384
- //#endregion
385
- //#region src/PluginManager.d.ts
386
- type RequiredPluginLifecycle = Required<PluginLifecycle>;
387
- type Strategy = 'hookFirst' | 'hookForPlugin' | 'hookParallel' | 'hookSeq';
388
- type Executer<H extends PluginLifecycleHooks = PluginLifecycleHooks> = {
389
- message: string;
390
- strategy: Strategy;
391
- hookName: H;
392
- plugin: Plugin;
393
- parameters?: unknown[] | undefined;
394
- output?: unknown;
395
- };
396
- type ParseResult<H extends PluginLifecycleHooks> = RequiredPluginLifecycle[H];
397
- type SafeParseResult<H extends PluginLifecycleHooks, Result = ReturnType<ParseResult<H>>> = {
398
- result: Result;
399
- plugin: Plugin;
400
- };
401
- type Options = {
402
- logger: Logger;
403
- /**
404
- * @default Number.POSITIVE_INFINITY
405
- */
406
- concurrency?: number;
407
- };
408
- type Events = {
409
- executing: [executer: Executer];
410
- executed: [executer: Executer];
411
- error: [error: Error];
412
- };
413
- type GetFileProps<TOptions = object> = {
414
- name: string;
415
- mode?: Mode;
416
- extname: Extname;
417
- pluginKey: Plugin['key'];
418
- options?: TOptions;
419
- };
420
- declare class PluginManager {
421
- #private;
422
- readonly plugins: Set<Plugin<PluginFactoryOptions<string, object, object, any, object>>>;
423
- readonly fileManager: FileManager;
424
- readonly events: EventEmitter<Events>;
425
- readonly config: Config;
426
- readonly executed: Array<Executer>;
427
- readonly logger: Logger;
428
- readonly options: Options;
429
- constructor(config: Config, options: Options);
430
- getFile<TOptions = object>({
431
- name,
432
- mode,
433
- extname,
434
- pluginKey,
435
- options
436
- }: GetFileProps<TOptions>): File<{
437
- pluginKey: Plugin['key'];
438
- }>;
439
- resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => OptionalPath;
440
- resolveName: (params: ResolveNameParams) => string;
441
- /**
442
- * Instead of calling `pluginManager.events.on` you can use `pluginManager.on`. This one also has better types.
443
- */
444
- on<TEventName extends keyof Events & string>(eventName: TEventName, handler: (...eventArg: Events[TEventName]) => void): void;
445
- /**
446
- * Run a specific hookName for plugin x.
447
- */
448
- hookForPlugin<H extends PluginLifecycleHooks>({
449
- pluginKey,
450
- hookName,
451
- parameters,
452
- message
453
- }: {
454
- pluginKey: Plugin['key'];
455
- hookName: H;
456
- parameters: PluginParameter<H>;
457
- message: string;
458
- }): Promise<Array<ReturnType<ParseResult<H>> | null>>;
459
- /**
460
- * Run a specific hookName for plugin x.
461
- */
462
- hookForPluginSync<H extends PluginLifecycleHooks>({
463
- pluginKey,
464
- hookName,
465
- parameters,
466
- message
467
- }: {
468
- pluginKey: Plugin['key'];
469
- hookName: H;
470
- parameters: PluginParameter<H>;
471
- message: string;
472
- }): Array<ReturnType<ParseResult<H>>> | null;
473
- /**
474
- * First non-null result stops and will return it's value.
475
- */
476
- hookFirst<H extends PluginLifecycleHooks>({
477
- hookName,
478
- parameters,
479
- skipped,
480
- message
481
- }: {
482
- hookName: H;
483
- parameters: PluginParameter<H>;
484
- skipped?: ReadonlySet<Plugin> | null;
485
- message: string;
486
- }): Promise<SafeParseResult<H>>;
487
- /**
488
- * First non-null result stops and will return it's value.
489
- */
490
- hookFirstSync<H extends PluginLifecycleHooks>({
491
- hookName,
492
- parameters,
493
- skipped,
494
- message
495
- }: {
496
- hookName: H;
497
- parameters: PluginParameter<H>;
498
- skipped?: ReadonlySet<Plugin> | null;
499
- message: string;
500
- }): SafeParseResult<H>;
501
- /**
502
- * Run all plugins in parallel(order will be based on `this.plugin` and if `pre` or `post` is set).
503
- */
504
- hookParallel<H extends PluginLifecycleHooks, TOuput = void>({
505
- hookName,
506
- parameters,
507
- message
508
- }: {
509
- hookName: H;
510
- parameters?: Parameters<RequiredPluginLifecycle[H]> | undefined;
511
- message: string;
512
- }): Promise<Awaited<TOuput>[]>;
513
- /**
514
- * Chains plugins
515
- */
516
- hookSeq<H extends PluginLifecycleHooks>({
517
- hookName,
518
- parameters,
519
- message
520
- }: {
521
- hookName: H;
522
- parameters?: PluginParameter<H>;
523
- message: string;
524
- }): Promise<void>;
525
- getPluginByKey(pluginKey: Plugin['key']): Plugin | undefined;
526
- getPluginsByKey(hookName: keyof PluginWithLifeCycle, pluginKey: Plugin['key']): Plugin[];
527
- static getDependedPlugins<T1 extends PluginFactoryOptions, T2 extends PluginFactoryOptions = never, T3 extends PluginFactoryOptions = never, TOutput = (T3 extends never ? (T2 extends never ? [T1: Plugin<T1>] : [T1: Plugin<T1>, T2: Plugin<T2>]) : [T1: Plugin<T1>, T2: Plugin<T2>, T3: Plugin<T3>])>(plugins: Array<Plugin>, dependedPluginNames: string | string[]): TOutput;
528
- static get hooks(): readonly ["buildStart", "resolvePath", "resolveName", "buildEnd"];
529
- }
530
- //#endregion
531
- export { 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 };
532
- //# sourceMappingURL=PluginManager-a3RiDAFC.d.cts.map
531
+ export { FileMetaBase as C, FileManager as S, PossiblePromise as T, ResolvePathParams as _, InputData as a, UserPluginWithLifeCycle as b, Plugin as c, PluginKey as d, PluginLifecycle as f, ResolveNameParams as g, PluginWithLifeCycle as h, Group as i, PluginContext as l, PluginParameter as m, Config as n, InputPath as o, PluginLifecycleHooks as p, GetPluginFactoryOptions as r, Output as s, BarrelType as t, PluginFactoryOptions as u, UserConfig as v, getSource as w, PluginManager as x, UserPlugin as y };
532
+ //# sourceMappingURL=types-IOE1JAFC.d.cts.map