@kubb/core 2.0.0-beta.1 → 2.0.0-beta.11
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.
- package/dist/Queue-2-6pMcCx.d.cts +32 -0
- package/dist/Queue-2-6pMcCx.d.ts +32 -0
- package/dist/fs.cjs +2383 -0
- package/dist/fs.cjs.map +1 -0
- package/dist/fs.d.cts +5 -0
- package/dist/fs.d.ts +5 -0
- package/dist/fs.js +2380 -0
- package/dist/fs.js.map +1 -0
- package/dist/index.cjs +3448 -394
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +77 -127
- package/dist/index.d.ts +77 -127
- package/dist/index.js +3761 -423
- package/dist/index.js.map +1 -1
- package/dist/logger.cjs +90 -0
- package/dist/logger.cjs.map +1 -0
- package/dist/logger.d.cts +32 -0
- package/dist/logger.d.ts +32 -0
- package/dist/logger.js +78 -0
- package/dist/logger.js.map +1 -0
- package/dist/transformers.cjs +222 -0
- package/dist/transformers.cjs.map +1 -0
- package/dist/transformers.d.cts +55 -0
- package/dist/transformers.d.ts +55 -0
- package/dist/transformers.js +207 -0
- package/dist/transformers.js.map +1 -0
- package/dist/utils.cjs +174 -899
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +2 -146
- package/dist/utils.d.ts +2 -146
- package/dist/utils.js +175 -859
- package/dist/utils.js.map +1 -1
- package/dist/write-46ytbnu9.d.cts +7 -0
- package/dist/write-46ytbnu9.d.ts +7 -0
- package/package.json +27 -12
- package/src/BarrelManager.ts +55 -65
- package/src/FileManager.ts +109 -68
- package/src/PluginManager.ts +55 -32
- package/src/build.ts +5 -16
- package/src/fs/index.ts +3 -0
- package/src/index.ts +4 -5
- package/src/{utils/logger.ts → logger.ts} +37 -0
- package/src/plugin.ts +4 -4
- package/src/transformers/casing.ts +9 -0
- package/src/transformers/createJSDocBlockText.ts +9 -0
- package/src/transformers/index.ts +36 -0
- package/src/transformers/trim.ts +7 -0
- package/src/types.ts +23 -42
- package/src/utils/FunctionParams.ts +3 -2
- package/src/utils/TreeNode.ts +6 -3
- package/src/utils/URLPath.ts +5 -5
- package/src/utils/index.ts +10 -19
- package/src/SchemaGenerator.ts +0 -8
- package/src/utils/randomColour.ts +0 -39
- package/src/utils/throttle.ts +0 -30
- package/src/utils/transformers/createJSDocBlockText.ts +0 -15
- package/src/utils/transformers/index.ts +0 -22
- package/src/utils/transformers/trim.ts +0 -3
- /package/src/{utils → fs}/clean.ts +0 -0
- /package/src/{utils → fs}/read.ts +0 -0
- /package/src/{utils → fs}/write.ts +0 -0
- /package/src/{utils/transformers → transformers}/combineCodes.ts +0 -0
- /package/src/{utils/transformers → transformers}/escape.ts +0 -0
- /package/src/{utils/transformers → transformers}/indent.ts +0 -0
- /package/src/{utils/transformers → transformers}/nameSorter.ts +0 -0
- /package/src/{utils/transformers → transformers}/searchAndReplace.ts +0 -0
- /package/src/{utils/transformers → transformers}/transformReservedWord.ts +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,69 +1,18 @@
|
|
|
1
|
+
import { w as write, r as read } from './write-46ytbnu9.js';
|
|
1
2
|
import { PossiblePromise, GreaterThan, TupleToUnion, ObjValueTuple } from '@kubb/types';
|
|
2
3
|
import { DirectoryTreeOptions } from 'directory-tree';
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
declare function write(data: string, path: string): Promise<string | undefined>;
|
|
4
|
+
import { E as EventEmitter, Q as Queue, a as QueueJob } from './Queue-2-6pMcCx.js';
|
|
5
|
+
import { Logger, LogLevel } from './logger.js';
|
|
6
|
+
import 'ora';
|
|
7
|
+
import 'picocolors';
|
|
8
8
|
|
|
9
9
|
type BarrelManagerOptions = {
|
|
10
10
|
treeNode?: DirectoryTreeOptions;
|
|
11
11
|
isTypeOnly?: boolean;
|
|
12
|
-
filter?: (file: KubbFile.File) => boolean;
|
|
13
|
-
map?: (file: KubbFile.File) => KubbFile.File;
|
|
14
|
-
includeExt?: boolean;
|
|
15
|
-
output?: string;
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
declare class EventEmitter<TEvents extends Record<string, any>> {
|
|
19
|
-
#private;
|
|
20
|
-
constructor();
|
|
21
|
-
emit<TEventName extends keyof TEvents & string>(eventName: TEventName, ...eventArg: TEvents[TEventName]): void;
|
|
22
|
-
on<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
|
|
23
|
-
off<TEventName extends keyof TEvents & string>(eventName: TEventName, handler: (...eventArg: TEvents[TEventName]) => void): void;
|
|
24
|
-
removeAll(): void;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
type QueueJob<T = unknown> = {
|
|
28
|
-
(...args: unknown[]): Promise<T | void>;
|
|
29
|
-
};
|
|
30
|
-
type RunOptions = {
|
|
31
|
-
controller?: AbortController;
|
|
32
|
-
name?: string;
|
|
33
|
-
description?: string;
|
|
34
|
-
};
|
|
35
|
-
type Events$1 = {
|
|
36
|
-
jobDone: [result: unknown];
|
|
37
|
-
jobFailed: [error: Error];
|
|
38
|
-
};
|
|
39
|
-
declare class Queue {
|
|
40
|
-
#private;
|
|
41
|
-
readonly eventEmitter: EventEmitter<Events$1>;
|
|
42
|
-
constructor(maxParallel: number, debug?: boolean);
|
|
43
|
-
run<T>(job: QueueJob<T>, options?: RunOptions): Promise<T>;
|
|
44
|
-
runSync<T>(job: QueueJob<T>, options?: RunOptions): void;
|
|
45
|
-
get hasJobs(): boolean;
|
|
46
|
-
get count(): number;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
declare const LogLevel: {
|
|
50
|
-
readonly silent: "silent";
|
|
51
|
-
readonly info: "info";
|
|
52
|
-
readonly debug: "debug";
|
|
53
|
-
};
|
|
54
|
-
type LogLevel = keyof typeof LogLevel;
|
|
55
|
-
type Logger = {
|
|
56
12
|
/**
|
|
57
|
-
*
|
|
13
|
+
* Add .ts or .js
|
|
58
14
|
*/
|
|
59
|
-
|
|
60
|
-
logLevel: LogLevel;
|
|
61
|
-
log: (message: string | null) => void;
|
|
62
|
-
error: (message: string | null) => void;
|
|
63
|
-
info: (message: string | null) => void;
|
|
64
|
-
warn: (message: string | null) => void;
|
|
65
|
-
spinner?: Ora;
|
|
66
|
-
logs: string[];
|
|
15
|
+
extName?: KubbFile.Extname;
|
|
67
16
|
};
|
|
68
17
|
|
|
69
18
|
type RequiredPluginLifecycle = Required<PluginLifecycle>;
|
|
@@ -105,30 +54,36 @@ declare class PluginManager {
|
|
|
105
54
|
#private;
|
|
106
55
|
readonly plugins: KubbPluginWithLifeCycle[];
|
|
107
56
|
readonly fileManager: FileManager;
|
|
108
|
-
readonly
|
|
57
|
+
readonly events: EventEmitter<Events>;
|
|
109
58
|
readonly queue: Queue;
|
|
110
59
|
readonly config: KubbConfig;
|
|
111
|
-
readonly executed: Executer
|
|
60
|
+
readonly executed: Array<Executer>;
|
|
112
61
|
readonly logger: Logger;
|
|
113
62
|
constructor(config: KubbConfig, options: Options$2);
|
|
114
63
|
resolvePath: <TOptions = object>(params: ResolvePathParams<TOptions>) => KubbFile.OptionalPath;
|
|
115
64
|
resolveName: (params: ResolveNameParams) => string;
|
|
65
|
+
/**
|
|
66
|
+
* Instead of calling `pluginManager.events.on` you can use `pluginManager.on`. This one also has better types.
|
|
67
|
+
*/
|
|
116
68
|
on<TEventName extends keyof Events & string>(eventName: TEventName, handler: (...eventArg: Events[TEventName]) => void): void;
|
|
117
69
|
/**
|
|
118
|
-
* Run
|
|
70
|
+
* Run a specific hookName for plugin x.
|
|
119
71
|
*/
|
|
120
72
|
hookForPlugin<H extends PluginLifecycleHooks>({ pluginKey, hookName, parameters, }: {
|
|
121
73
|
pluginKey: KubbPlugin['key'];
|
|
122
74
|
hookName: H;
|
|
123
75
|
parameters: PluginParameter<H>;
|
|
124
76
|
}): Promise<Array<ReturnType<ParseResult<H>> | null>> | null;
|
|
77
|
+
/**
|
|
78
|
+
* Run a specific hookName for plugin x.
|
|
79
|
+
*/
|
|
125
80
|
hookForPluginSync<H extends PluginLifecycleHooks>({ pluginKey, hookName, parameters, }: {
|
|
126
81
|
pluginKey: KubbPlugin['key'];
|
|
127
82
|
hookName: H;
|
|
128
83
|
parameters: PluginParameter<H>;
|
|
129
84
|
}): Array<ReturnType<ParseResult<H>>> | null;
|
|
130
85
|
/**
|
|
131
|
-
*
|
|
86
|
+
* First non-null result stops and will return it's value.
|
|
132
87
|
*/
|
|
133
88
|
hookFirst<H extends PluginLifecycleHooks>({ hookName, parameters, skipped, }: {
|
|
134
89
|
hookName: H;
|
|
@@ -136,7 +91,7 @@ declare class PluginManager {
|
|
|
136
91
|
skipped?: ReadonlySet<KubbPlugin> | null;
|
|
137
92
|
}): Promise<SafeParseResult<H>>;
|
|
138
93
|
/**
|
|
139
|
-
*
|
|
94
|
+
* First non-null result stops and will return it's value.
|
|
140
95
|
*/
|
|
141
96
|
hookFirstSync<H extends PluginLifecycleHooks>({ hookName, parameters, skipped, }: {
|
|
142
97
|
hookName: H;
|
|
@@ -144,14 +99,14 @@ declare class PluginManager {
|
|
|
144
99
|
skipped?: ReadonlySet<KubbPlugin> | null;
|
|
145
100
|
}): SafeParseResult<H>;
|
|
146
101
|
/**
|
|
147
|
-
*
|
|
102
|
+
* Run all plugins in parallel(order will be based on `this.plugin` and if `pre` or `post` is set).
|
|
148
103
|
*/
|
|
149
104
|
hookParallel<H extends PluginLifecycleHooks, TOuput = void>({ hookName, parameters, }: {
|
|
150
105
|
hookName: H;
|
|
151
106
|
parameters?: Parameters<RequiredPluginLifecycle[H]> | undefined;
|
|
152
107
|
}): Promise<Awaited<TOuput>[]>;
|
|
153
108
|
/**
|
|
154
|
-
*
|
|
109
|
+
* 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.
|
|
155
110
|
*/
|
|
156
111
|
hookReduceArg0<H extends PluginLifecycleHooks>({ hookName, parameters, reduce, }: {
|
|
157
112
|
hookName: H;
|
|
@@ -167,7 +122,7 @@ declare class PluginManager {
|
|
|
167
122
|
}): Promise<void>;
|
|
168
123
|
getPluginsByKey(hookName: keyof PluginLifecycle, pluginKey: KubbPlugin['key']): KubbPlugin[];
|
|
169
124
|
static getDependedPlugins<T1 extends PluginFactoryOptions, T2 extends PluginFactoryOptions = never, T3 extends PluginFactoryOptions = never, TOutput = T3 extends never ? T2 extends never ? [T1: KubbPlugin<T1>] : [T1: KubbPlugin<T1>, T2: KubbPlugin<T2>] : [T1: KubbPlugin<T1>, T2: KubbPlugin<T2>, T3: KubbPlugin<T3>]>(plugins: Array<KubbPlugin>, dependedPluginNames: string | string[]): TOutput;
|
|
170
|
-
static get hooks(): readonly ["
|
|
125
|
+
static get hooks(): readonly ["buildStart", "resolvePath", "resolveName", "load", "transform", "writeFile", "buildEnd"];
|
|
171
126
|
}
|
|
172
127
|
|
|
173
128
|
interface Cache<TStore extends object = object> {
|
|
@@ -282,7 +237,6 @@ type CLIOptions = {
|
|
|
282
237
|
*/
|
|
283
238
|
logLevel?: LogLevel;
|
|
284
239
|
};
|
|
285
|
-
type KubbPluginKind = 'schema' | 'controller';
|
|
286
240
|
type KubbUnionPlugins = PluginUnion;
|
|
287
241
|
type KubbObjectPlugin = keyof OptionsPlugins;
|
|
288
242
|
type PluginFactoryOptions<
|
|
@@ -290,10 +244,6 @@ type PluginFactoryOptions<
|
|
|
290
244
|
* Name to be used for the plugin, this will also be used for they key.
|
|
291
245
|
*/
|
|
292
246
|
TName extends string = string,
|
|
293
|
-
/**
|
|
294
|
-
* @type "schema" | "controller"
|
|
295
|
-
*/
|
|
296
|
-
TKind extends KubbPluginKind = KubbPluginKind,
|
|
297
247
|
/**
|
|
298
248
|
* Options of the plugin.
|
|
299
249
|
*/
|
|
@@ -316,55 +266,47 @@ TResolvePathOptions extends object = object,
|
|
|
316
266
|
*/
|
|
317
267
|
TAppMeta = unknown> = {
|
|
318
268
|
name: TName;
|
|
319
|
-
kind: TKind;
|
|
320
269
|
/**
|
|
321
270
|
* Same behaviour like what has been done with `QueryKey` in `@tanstack/react-query`
|
|
322
271
|
*/
|
|
323
|
-
key: [
|
|
272
|
+
key: [name: TName | string, identifier?: string | number];
|
|
324
273
|
options: TOptions;
|
|
325
274
|
resolvedOptions: TResolvedOptions;
|
|
326
275
|
api: TAPI;
|
|
327
276
|
resolvePathOptions: TResolvePathOptions;
|
|
328
277
|
appMeta: {
|
|
329
278
|
pluginManager: PluginManager;
|
|
330
|
-
plugin: KubbPlugin<PluginFactoryOptions<TName,
|
|
279
|
+
plugin: KubbPlugin<PluginFactoryOptions<TName, TOptions, TResolvedOptions, TAPI, TResolvePathOptions, TAppMeta>>;
|
|
331
280
|
} & TAppMeta;
|
|
332
281
|
};
|
|
333
282
|
type GetPluginFactoryOptions<TPlugin extends KubbUserPlugin> = TPlugin extends KubbUserPlugin<infer X> ? X : never;
|
|
334
283
|
type KubbUserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
335
284
|
/**
|
|
336
285
|
* Unique name used for the plugin
|
|
286
|
+
* The name of the plugin follows the format scope:foo-bar or foo-bar, adding scope: can avoid naming conflicts with other plugins.
|
|
337
287
|
* @example @kubb/typescript
|
|
338
288
|
*/
|
|
339
289
|
name: TOptions['name'];
|
|
340
|
-
/**
|
|
341
|
-
* Internal key used when a developer uses more than one of the same plugin
|
|
342
|
-
* @private
|
|
343
|
-
*/
|
|
344
|
-
key?: TOptions['key'];
|
|
345
290
|
/**
|
|
346
291
|
* Options set for a specific plugin(see kubb.config.js), passthrough of options.
|
|
347
292
|
*/
|
|
348
293
|
options: TOptions['resolvedOptions'];
|
|
294
|
+
/**
|
|
295
|
+
* 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.
|
|
296
|
+
* Can be used to validate depended plugins.
|
|
297
|
+
*/
|
|
298
|
+
pre?: Array<string>;
|
|
299
|
+
/**
|
|
300
|
+
* 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.
|
|
301
|
+
*/
|
|
302
|
+
post?: Array<string>;
|
|
349
303
|
} & (TOptions['api'] extends never ? {
|
|
350
304
|
api?: never;
|
|
351
305
|
} : {
|
|
352
306
|
api: (this: TOptions['name'] extends 'core' ? null : Omit<PluginContext<TOptions>, 'addFile'>) => TOptions['api'];
|
|
353
|
-
}) & (TOptions['kind'] extends never ? {
|
|
354
|
-
kind?: never;
|
|
355
|
-
} : {
|
|
356
|
-
/**
|
|
357
|
-
* Kind/type for the plugin
|
|
358
|
-
*
|
|
359
|
-
* Type 'schema' can be used for JSON schema's, TypeScript types, ...
|
|
360
|
-
*
|
|
361
|
-
* Type 'controller' can be used to create generate API calls, React-Query hooks, Axios controllers, ...
|
|
362
|
-
* @default undefined
|
|
363
|
-
*/
|
|
364
|
-
kind: TOptions['kind'];
|
|
365
307
|
});
|
|
366
308
|
type KubbUserPluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = KubbUserPlugin<TOptions> & PluginLifecycle<TOptions>;
|
|
367
|
-
type UnknownKubbUserPlugin = KubbUserPlugin<PluginFactoryOptions<any, any, any, any, any, any
|
|
309
|
+
type UnknownKubbUserPlugin = KubbUserPlugin<PluginFactoryOptions<any, any, any, any, any, any>>;
|
|
368
310
|
type KubbPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
369
311
|
/**
|
|
370
312
|
* Unique name used for the plugin
|
|
@@ -377,16 +319,18 @@ type KubbPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> =
|
|
|
377
319
|
*/
|
|
378
320
|
key: TOptions['key'];
|
|
379
321
|
/**
|
|
380
|
-
*
|
|
322
|
+
* 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.
|
|
323
|
+
* Can be used to validate depended plugins.
|
|
381
324
|
*/
|
|
382
|
-
|
|
325
|
+
pre?: Array<string>;
|
|
383
326
|
/**
|
|
384
|
-
*
|
|
385
|
-
* Type 'schema' can be used for JSON schema's, TypeScript types, ...
|
|
386
|
-
* Type 'controller' can be used to create generate API calls, React-Query hooks, Axios controllers, ...
|
|
387
|
-
* @default undefined
|
|
327
|
+
* 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.
|
|
388
328
|
*/
|
|
389
|
-
|
|
329
|
+
post?: Array<string>;
|
|
330
|
+
/**
|
|
331
|
+
* Options set for a specific plugin(see kubb.config.js), passthrough of options.
|
|
332
|
+
*/
|
|
333
|
+
options: TOptions['resolvedOptions'];
|
|
390
334
|
} & (TOptions['api'] extends never ? {
|
|
391
335
|
api?: never;
|
|
392
336
|
} : {
|
|
@@ -394,11 +338,6 @@ type KubbPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> =
|
|
|
394
338
|
});
|
|
395
339
|
type KubbPluginWithLifeCycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = KubbPlugin<TOptions> & PluginLifecycle<TOptions>;
|
|
396
340
|
type PluginLifecycle<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
397
|
-
/**
|
|
398
|
-
* Valdiate all plugins to see if their depended plugins are installed and configured.
|
|
399
|
-
* @type hookParallel
|
|
400
|
-
*/
|
|
401
|
-
validate?: (this: Omit<PluginContext<TOptions>, 'addFile'>, plugins: NonNullable<KubbConfig['plugins']>) => PossiblePromise<true>;
|
|
402
341
|
/**
|
|
403
342
|
* Start of the lifecycle of a plugin.
|
|
404
343
|
* @type hookParallel
|
|
@@ -489,7 +428,10 @@ declare namespace KubbFile {
|
|
|
489
428
|
* @example ["useState"]
|
|
490
429
|
* @example "React"
|
|
491
430
|
*/
|
|
492
|
-
name: string | Array<string
|
|
431
|
+
name: string | Array<string | {
|
|
432
|
+
propertyName: string;
|
|
433
|
+
name?: string;
|
|
434
|
+
}>;
|
|
493
435
|
/**
|
|
494
436
|
* Path for the import
|
|
495
437
|
* @xample '@kubb/core'
|
|
@@ -499,6 +441,14 @@ declare namespace KubbFile {
|
|
|
499
441
|
* Add `type` prefix to the import, this will result in: `import type { Type } from './path'`.
|
|
500
442
|
*/
|
|
501
443
|
isTypeOnly?: boolean;
|
|
444
|
+
/**
|
|
445
|
+
* Add `* as` prefix to the import, this will result in: `import * as path from './path'`.
|
|
446
|
+
*/
|
|
447
|
+
isNameSpace?: boolean;
|
|
448
|
+
/**
|
|
449
|
+
* When root is set it will get the path with relative getRelativePath(root, path).
|
|
450
|
+
*/
|
|
451
|
+
root?: string;
|
|
502
452
|
};
|
|
503
453
|
type Export = {
|
|
504
454
|
/**
|
|
@@ -551,8 +501,8 @@ declare namespace KubbFile {
|
|
|
551
501
|
*/
|
|
552
502
|
id?: string;
|
|
553
503
|
/**
|
|
554
|
-
* Name to be used to
|
|
555
|
-
* Based on UNIX basename
|
|
504
|
+
* Name to be used to create the path
|
|
505
|
+
* Based on UNIX basename, `${name}.extName`
|
|
556
506
|
* @link https://nodejs.org/api/path.html#pathbasenamepath-suffix
|
|
557
507
|
*/
|
|
558
508
|
baseName: TBaseName;
|
|
@@ -577,22 +527,34 @@ declare namespace KubbFile {
|
|
|
577
527
|
* This will override `process.env[key]` inside the `source`, see `getFileSource`.
|
|
578
528
|
*/
|
|
579
529
|
env?: NodeJS.ProcessEnv;
|
|
580
|
-
/**
|
|
581
|
-
* @deprecated
|
|
582
|
-
*/
|
|
583
|
-
validate?: boolean;
|
|
584
530
|
};
|
|
585
531
|
type ResolvedFile<TMeta extends FileMetaBase = FileMetaBase, TBaseName extends BaseName = BaseName> = KubbFile.File<TMeta, TBaseName> & {
|
|
586
532
|
/**
|
|
587
533
|
* @default crypto.randomUUID()
|
|
588
534
|
*/
|
|
589
535
|
id: UUID;
|
|
536
|
+
/**
|
|
537
|
+
* Contains the first part of the baseName, generated based on baseName
|
|
538
|
+
* @link https://nodejs.org/api/path.html#pathformatpathobject
|
|
539
|
+
*/
|
|
540
|
+
name: string;
|
|
590
541
|
};
|
|
591
542
|
}
|
|
592
543
|
type AddResult<T extends Array<KubbFile.File>> = Promise<Awaited<GreaterThan<T['length'], 1> extends true ? Promise<KubbFile.ResolvedFile[]> : Promise<KubbFile.ResolvedFile>>>;
|
|
593
544
|
type AddIndexesProps = {
|
|
594
|
-
|
|
595
|
-
|
|
545
|
+
/**
|
|
546
|
+
* Root based on root and output.path specified in the config
|
|
547
|
+
*/
|
|
548
|
+
root: string;
|
|
549
|
+
/**
|
|
550
|
+
* Output for plugin
|
|
551
|
+
*/
|
|
552
|
+
output: {
|
|
553
|
+
path: string;
|
|
554
|
+
exportAs?: string;
|
|
555
|
+
extName?: KubbFile.Extname;
|
|
556
|
+
exportType?: 'barrel' | false;
|
|
557
|
+
};
|
|
596
558
|
options?: BarrelManagerOptions;
|
|
597
559
|
meta?: KubbFile.File['meta'];
|
|
598
560
|
};
|
|
@@ -610,20 +572,17 @@ declare class FileManager {
|
|
|
610
572
|
get files(): Array<KubbFile.File>;
|
|
611
573
|
get isExecuting(): boolean;
|
|
612
574
|
add<T extends Array<KubbFile.File> = Array<KubbFile.File>>(...files: T): AddResult<T>;
|
|
613
|
-
addIndexes({ root,
|
|
575
|
+
addIndexes({ root, output, meta, options }: AddIndexesProps): Promise<Array<KubbFile.File> | undefined>;
|
|
614
576
|
getCacheByUUID(UUID: KubbFile.UUID): KubbFile.File | undefined;
|
|
615
577
|
get(path: KubbFile.Path): Array<KubbFile.File> | undefined;
|
|
616
578
|
remove(path: KubbFile.Path): void;
|
|
617
579
|
write(...params: Parameters<typeof write>): Promise<string | undefined>;
|
|
618
580
|
read(...params: Parameters<typeof read>): Promise<string>;
|
|
619
581
|
static getSource<TMeta extends KubbFile.FileMetaBase = KubbFile.FileMetaBase>(file: KubbFile.File<TMeta>): string;
|
|
620
|
-
static combineFiles<TMeta extends KubbFile.FileMetaBase = KubbFile.FileMetaBase>(files: Array<KubbFile.File<TMeta> | null>): Array<KubbFile.File<TMeta>>;
|
|
621
582
|
static getMode(path: string | undefined | null): KubbFile.Mode;
|
|
622
583
|
static get extensions(): Array<KubbFile.Extname>;
|
|
623
584
|
static isExtensionAllowed(baseName: string): boolean;
|
|
624
585
|
}
|
|
625
|
-
declare function combineExports(exports: Array<KubbFile.Export>): Array<KubbFile.Export>;
|
|
626
|
-
declare function combineImports(imports: Array<KubbFile.Import>, exports: Array<KubbFile.Export>, source?: string): Array<KubbFile.Import>;
|
|
627
586
|
|
|
628
587
|
type BuildOptions = {
|
|
629
588
|
config: PluginContext['config'];
|
|
@@ -661,8 +620,6 @@ declare class Warning extends Error {
|
|
|
661
620
|
cause: Error;
|
|
662
621
|
});
|
|
663
622
|
}
|
|
664
|
-
declare class ValidationPluginError extends Error {
|
|
665
|
-
}
|
|
666
623
|
|
|
667
624
|
/**
|
|
668
625
|
* Abstract class that contains the building blocks for plugins to create their own Generator
|
|
@@ -722,13 +679,6 @@ declare class PromiseManager<TState = any> {
|
|
|
722
679
|
run<TInput extends Array<PromiseFunc<TValue, null>>, TValue, TStrategy extends Strategy, TOutput = StrategySwitch<TStrategy, TInput, TValue>>(strategy: TStrategy, promises: TInput): TOutput;
|
|
723
680
|
}
|
|
724
681
|
|
|
725
|
-
/**
|
|
726
|
-
* Abstract class that contains the building blocks for plugins to create their own SchemaGenerator
|
|
727
|
-
*/
|
|
728
|
-
declare abstract class SchemaGenerator<TOptions extends object, TInput, TOutput> extends Generator<TOptions> {
|
|
729
|
-
abstract build(schema: TInput, name: string, description?: string): TOutput;
|
|
730
|
-
}
|
|
731
|
-
|
|
732
682
|
interface _Register {
|
|
733
683
|
}
|
|
734
684
|
type Plugins = _Register;
|
|
@@ -739,4 +689,4 @@ type OptionsOfPlugin<K extends keyof Plugins> = Plugins[K]['options'];
|
|
|
739
689
|
type PluginUnion = TupleToUnion<ObjValueTuple<OptionsPlugins>>;
|
|
740
690
|
type Plugin = keyof Plugins;
|
|
741
691
|
|
|
742
|
-
export { type CLIOptions, FileManager, Generator, type GetPluginFactoryOptions, type InputData, type InputPath, type KubbConfig, KubbFile, type KubbObjectPlugin, type KubbPlugin, type
|
|
692
|
+
export { type CLIOptions, FileManager, Generator, type GetPluginFactoryOptions, type InputData, type InputPath, type KubbConfig, KubbFile, type KubbObjectPlugin, type KubbPlugin, type KubbPluginWithLifeCycle, type KubbUnionPlugins, type KubbUserConfig, type KubbUserPlugin, type KubbUserPluginWithLifeCycle, type OptionsOfPlugin, type OptionsPlugins, PackageManager, type Plugin, type PluginCache, type PluginContext, type PluginFactoryOptions, type PluginLifecycle, type PluginLifecycleHooks, PluginManager, type PluginParameter, type PluginUnion, type Plugins, PromiseManager, type ResolveNameParams, type ResolvePathParams, type TransformResult, Warning, type _Register, build, createPlugin, build as default, defineConfig, isInputPath, pluginName as name, pluginName, safeBuild };
|