@kubb/core 3.0.0-alpha.6 → 3.0.0-alpha.8
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/{FileManager-wyXRkgIk.d.cts → FileManager-B0GJlthB.d.cts} +30 -16
- package/dist/{FileManager-Ceski1W9.d.ts → FileManager-BFycBDqG.d.ts} +30 -16
- package/dist/chunk-27CPVXAT.js +945 -0
- package/dist/chunk-27CPVXAT.js.map +1 -0
- package/dist/{chunk-34BPAXR2.cjs → chunk-5E2I6KH4.cjs} +7 -7
- package/dist/{chunk-34BPAXR2.cjs.map → chunk-5E2I6KH4.cjs.map} +1 -1
- package/dist/chunk-5IGANEGE.cjs +1564 -0
- package/dist/chunk-5IGANEGE.cjs.map +1 -0
- package/dist/{chunk-67C6RBGQ.cjs → chunk-A6PCLWEY.cjs} +5 -5
- package/dist/{chunk-67C6RBGQ.cjs.map → chunk-A6PCLWEY.cjs.map} +1 -1
- package/dist/{chunk-5HN4LW3R.cjs → chunk-DID47EQD.cjs} +3 -3
- package/dist/{chunk-5HN4LW3R.cjs.map → chunk-DID47EQD.cjs.map} +1 -1
- package/dist/{chunk-25NKJ3DV.js → chunk-HBQM723K.js} +6 -6
- package/dist/{chunk-LOLEBOMW.cjs → chunk-IPZQXBA2.cjs} +16 -21
- package/dist/chunk-IPZQXBA2.cjs.map +1 -0
- package/dist/{chunk-76UEJFFE.js → chunk-SCR3LUXT.js} +9 -16
- package/dist/{chunk-76UEJFFE.js.map → chunk-SCR3LUXT.js.map} +1 -1
- package/dist/{chunk-XCPFG6DO.cjs → chunk-SEH6NUCX.cjs} +4 -28
- package/dist/chunk-SEH6NUCX.cjs.map +1 -0
- package/dist/index.cjs +380 -378
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +325 -319
- package/dist/index.js.map +1 -1
- package/dist/logger.cjs +4 -4
- package/dist/logger.js +2 -3
- package/dist/mocks.cjs +20 -15
- package/dist/mocks.cjs.map +1 -1
- package/dist/mocks.d.cts +6 -5
- package/dist/mocks.d.ts +6 -5
- package/dist/mocks.js +15 -11
- package/dist/mocks.js.map +1 -1
- package/dist/{prompt-6FWP747F.cjs → prompt-DVQN7JTN.cjs} +61 -61
- package/dist/{prompt-6FWP747F.cjs.map → prompt-DVQN7JTN.cjs.map} +1 -1
- package/dist/{prompt-HK3MWREM.js → prompt-WQQUN22Z.js} +5 -6
- package/dist/{prompt-HK3MWREM.js.map → prompt-WQQUN22Z.js.map} +1 -1
- package/dist/transformers.cjs +19 -19
- package/dist/transformers.js +0 -1
- package/dist/transformers.js.map +1 -1
- package/dist/utils.cjs +8 -4
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +25 -24
- package/dist/utils.d.ts +25 -24
- package/dist/utils.js +5 -2
- package/package.json +7 -7
- package/src/BarrelManager.ts +90 -40
- package/src/FileManager.ts +89 -109
- package/src/PluginManager.ts +2 -1
- package/src/__snapshots__/barrel.json +91 -0
- package/src/__snapshots__/grouped.json +114 -0
- package/src/__snapshots__/ordered.json +62 -0
- package/src/build.ts +60 -23
- package/src/plugin.ts +2 -2
- package/src/types.ts +22 -2
- package/src/utils/TreeNode.ts +43 -1
- package/src/utils/index.ts +1 -1
- package/src/utils/parser.ts +128 -67
- package/dist/chunk-AWAZR3D5.js +0 -360
- package/dist/chunk-AWAZR3D5.js.map +0 -1
- package/dist/chunk-DCZQYCCO.cjs +0 -1155
- package/dist/chunk-DCZQYCCO.cjs.map +0 -1
- package/dist/chunk-HMLY7DHA.js +0 -16
- package/dist/chunk-HMLY7DHA.js.map +0 -1
- package/dist/chunk-L3JJLZ5Q.cjs +0 -371
- package/dist/chunk-L3JJLZ5Q.cjs.map +0 -1
- package/dist/chunk-LOLEBOMW.cjs.map +0 -1
- package/dist/chunk-RIEGCND2.js +0 -525
- package/dist/chunk-RIEGCND2.js.map +0 -1
- package/dist/chunk-XCPFG6DO.cjs.map +0 -1
- package/schema.json +0 -86
- /package/dist/{chunk-25NKJ3DV.js.map → chunk-HBQM723K.js.map} +0 -0
|
@@ -4,14 +4,6 @@ import { ResolvedFile } from '@kubb/fs/types';
|
|
|
4
4
|
import { PossiblePromise, GreaterThan } from '@kubb/types';
|
|
5
5
|
import { E as EventEmitter, L as Logger } from './logger-BWFeedRk.cjs';
|
|
6
6
|
|
|
7
|
-
type BarrelManagerOptions = {
|
|
8
|
-
isTypeOnly?: boolean;
|
|
9
|
-
/**
|
|
10
|
-
* Add .ts or .js
|
|
11
|
-
*/
|
|
12
|
-
extName?: string;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
7
|
type RequiredPluginLifecycle = Required<PluginLifecycle>;
|
|
16
8
|
/**
|
|
17
9
|
* Get the type of the first argument in a function.
|
|
@@ -195,6 +187,11 @@ type Config<TInput = Input> = {
|
|
|
195
187
|
* @default true
|
|
196
188
|
*/
|
|
197
189
|
write?: boolean;
|
|
190
|
+
/**
|
|
191
|
+
* Define what needs to exported, here you can also disable the export of barrel files
|
|
192
|
+
* @default `'barrelNamed'`
|
|
193
|
+
*/
|
|
194
|
+
exportType?: 'barrel' | 'barrelNamed' | false;
|
|
198
195
|
};
|
|
199
196
|
/**
|
|
200
197
|
* Array of Kubb plugins to use.
|
|
@@ -259,7 +256,7 @@ type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> =
|
|
|
259
256
|
options: TOptions['resolvedOptions'];
|
|
260
257
|
/**
|
|
261
258
|
* 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.
|
|
262
|
-
* Can be used to validate
|
|
259
|
+
* Can be used to validate dependent plugins.
|
|
263
260
|
*/
|
|
264
261
|
pre?: Array<string>;
|
|
265
262
|
/**
|
|
@@ -284,9 +281,24 @@ type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
|
284
281
|
* @private
|
|
285
282
|
*/
|
|
286
283
|
key: TOptions['key'];
|
|
284
|
+
output?: {
|
|
285
|
+
/**
|
|
286
|
+
* Output to save the clients.
|
|
287
|
+
*/
|
|
288
|
+
path: string;
|
|
289
|
+
/**
|
|
290
|
+
* Add an extension to the generated imports and exports, default it will not use an extension
|
|
291
|
+
*/
|
|
292
|
+
extName?: KubbFile.Extname;
|
|
293
|
+
/**
|
|
294
|
+
* Define what needs to exported, here you can also disable the export of barrel files
|
|
295
|
+
* @default `'barrelNamed'`
|
|
296
|
+
*/
|
|
297
|
+
exportType?: 'barrel' | 'barrelNamed' | false;
|
|
298
|
+
};
|
|
287
299
|
/**
|
|
288
300
|
* 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.
|
|
289
|
-
* Can be used to validate
|
|
301
|
+
* Can be used to validate dependent plugins.
|
|
290
302
|
*/
|
|
291
303
|
pre?: Array<string>;
|
|
292
304
|
/**
|
|
@@ -389,6 +401,8 @@ declare class TreeNode {
|
|
|
389
401
|
get leaves(): Array<TreeNode>;
|
|
390
402
|
get root(): TreeNode;
|
|
391
403
|
forEach(callback: (treeNode: TreeNode) => void): this;
|
|
404
|
+
filter(callback: (treeNode: TreeNode) => boolean): Array<TreeNode>;
|
|
405
|
+
map<T>(callback: (treeNode: TreeNode) => T): Array<T>;
|
|
392
406
|
static build(files: KubbFile.File[], root?: string): TreeNode | null;
|
|
393
407
|
}
|
|
394
408
|
type DirectoryTree = {
|
|
@@ -407,23 +421,22 @@ type AddIndexesProps = {
|
|
|
407
421
|
* Root based on root and output.path specified in the config
|
|
408
422
|
*/
|
|
409
423
|
root: string;
|
|
424
|
+
files: KubbFile.File[];
|
|
410
425
|
/**
|
|
411
426
|
* Output for plugin
|
|
412
427
|
*/
|
|
413
428
|
output: {
|
|
414
429
|
path: string;
|
|
430
|
+
extName?: KubbFile.Extname;
|
|
415
431
|
exportAs?: string;
|
|
416
|
-
extName?: string;
|
|
417
432
|
exportType?: 'barrel' | 'barrelNamed' | false;
|
|
418
433
|
};
|
|
419
434
|
group?: {
|
|
420
435
|
output: string;
|
|
421
436
|
exportAs: string;
|
|
422
437
|
};
|
|
423
|
-
logger
|
|
424
|
-
|
|
425
|
-
options?: BarrelManagerOptions;
|
|
426
|
-
plugin: Plugin;
|
|
438
|
+
logger?: Logger;
|
|
439
|
+
meta?: FileMetaBase;
|
|
427
440
|
};
|
|
428
441
|
declare class FileManager {
|
|
429
442
|
#private;
|
|
@@ -433,10 +446,11 @@ declare class FileManager {
|
|
|
433
446
|
get groupedFiles(): DirectoryTree | null;
|
|
434
447
|
get treeNode(): TreeNode | null;
|
|
435
448
|
add<T extends Array<KubbFile.File> = Array<KubbFile.File>>(...files: T): AddResult<T>;
|
|
449
|
+
clear(): void;
|
|
436
450
|
getCacheById(id: string): KubbFile.File | undefined;
|
|
437
451
|
getByPath(path: KubbFile.Path): KubbFile.ResolvedFile | undefined;
|
|
438
452
|
deleteByPath(path: KubbFile.Path): void;
|
|
439
|
-
|
|
453
|
+
getBarrelFiles({ files, meta, root, output, logger }: AddIndexesProps): Promise<KubbFile.File[]>;
|
|
440
454
|
write(...params: Parameters<typeof write>): ReturnType<typeof write>;
|
|
441
455
|
read(...params: Parameters<typeof read>): ReturnType<typeof read>;
|
|
442
456
|
static getMode(path: string | undefined | null): KubbFile.Mode;
|
|
@@ -4,14 +4,6 @@ import { ResolvedFile } from '@kubb/fs/types';
|
|
|
4
4
|
import { PossiblePromise, GreaterThan } from '@kubb/types';
|
|
5
5
|
import { E as EventEmitter, L as Logger } from './logger-BWFeedRk.js';
|
|
6
6
|
|
|
7
|
-
type BarrelManagerOptions = {
|
|
8
|
-
isTypeOnly?: boolean;
|
|
9
|
-
/**
|
|
10
|
-
* Add .ts or .js
|
|
11
|
-
*/
|
|
12
|
-
extName?: string;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
7
|
type RequiredPluginLifecycle = Required<PluginLifecycle>;
|
|
16
8
|
/**
|
|
17
9
|
* Get the type of the first argument in a function.
|
|
@@ -195,6 +187,11 @@ type Config<TInput = Input> = {
|
|
|
195
187
|
* @default true
|
|
196
188
|
*/
|
|
197
189
|
write?: boolean;
|
|
190
|
+
/**
|
|
191
|
+
* Define what needs to exported, here you can also disable the export of barrel files
|
|
192
|
+
* @default `'barrelNamed'`
|
|
193
|
+
*/
|
|
194
|
+
exportType?: 'barrel' | 'barrelNamed' | false;
|
|
198
195
|
};
|
|
199
196
|
/**
|
|
200
197
|
* Array of Kubb plugins to use.
|
|
@@ -259,7 +256,7 @@ type UserPlugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> =
|
|
|
259
256
|
options: TOptions['resolvedOptions'];
|
|
260
257
|
/**
|
|
261
258
|
* 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.
|
|
262
|
-
* Can be used to validate
|
|
259
|
+
* Can be used to validate dependent plugins.
|
|
263
260
|
*/
|
|
264
261
|
pre?: Array<string>;
|
|
265
262
|
/**
|
|
@@ -284,9 +281,24 @@ type Plugin<TOptions extends PluginFactoryOptions = PluginFactoryOptions> = {
|
|
|
284
281
|
* @private
|
|
285
282
|
*/
|
|
286
283
|
key: TOptions['key'];
|
|
284
|
+
output?: {
|
|
285
|
+
/**
|
|
286
|
+
* Output to save the clients.
|
|
287
|
+
*/
|
|
288
|
+
path: string;
|
|
289
|
+
/**
|
|
290
|
+
* Add an extension to the generated imports and exports, default it will not use an extension
|
|
291
|
+
*/
|
|
292
|
+
extName?: KubbFile.Extname;
|
|
293
|
+
/**
|
|
294
|
+
* Define what needs to exported, here you can also disable the export of barrel files
|
|
295
|
+
* @default `'barrelNamed'`
|
|
296
|
+
*/
|
|
297
|
+
exportType?: 'barrel' | 'barrelNamed' | false;
|
|
298
|
+
};
|
|
287
299
|
/**
|
|
288
300
|
* 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.
|
|
289
|
-
* Can be used to validate
|
|
301
|
+
* Can be used to validate dependent plugins.
|
|
290
302
|
*/
|
|
291
303
|
pre?: Array<string>;
|
|
292
304
|
/**
|
|
@@ -389,6 +401,8 @@ declare class TreeNode {
|
|
|
389
401
|
get leaves(): Array<TreeNode>;
|
|
390
402
|
get root(): TreeNode;
|
|
391
403
|
forEach(callback: (treeNode: TreeNode) => void): this;
|
|
404
|
+
filter(callback: (treeNode: TreeNode) => boolean): Array<TreeNode>;
|
|
405
|
+
map<T>(callback: (treeNode: TreeNode) => T): Array<T>;
|
|
392
406
|
static build(files: KubbFile.File[], root?: string): TreeNode | null;
|
|
393
407
|
}
|
|
394
408
|
type DirectoryTree = {
|
|
@@ -407,23 +421,22 @@ type AddIndexesProps = {
|
|
|
407
421
|
* Root based on root and output.path specified in the config
|
|
408
422
|
*/
|
|
409
423
|
root: string;
|
|
424
|
+
files: KubbFile.File[];
|
|
410
425
|
/**
|
|
411
426
|
* Output for plugin
|
|
412
427
|
*/
|
|
413
428
|
output: {
|
|
414
429
|
path: string;
|
|
430
|
+
extName?: KubbFile.Extname;
|
|
415
431
|
exportAs?: string;
|
|
416
|
-
extName?: string;
|
|
417
432
|
exportType?: 'barrel' | 'barrelNamed' | false;
|
|
418
433
|
};
|
|
419
434
|
group?: {
|
|
420
435
|
output: string;
|
|
421
436
|
exportAs: string;
|
|
422
437
|
};
|
|
423
|
-
logger
|
|
424
|
-
|
|
425
|
-
options?: BarrelManagerOptions;
|
|
426
|
-
plugin: Plugin;
|
|
438
|
+
logger?: Logger;
|
|
439
|
+
meta?: FileMetaBase;
|
|
427
440
|
};
|
|
428
441
|
declare class FileManager {
|
|
429
442
|
#private;
|
|
@@ -433,10 +446,11 @@ declare class FileManager {
|
|
|
433
446
|
get groupedFiles(): DirectoryTree | null;
|
|
434
447
|
get treeNode(): TreeNode | null;
|
|
435
448
|
add<T extends Array<KubbFile.File> = Array<KubbFile.File>>(...files: T): AddResult<T>;
|
|
449
|
+
clear(): void;
|
|
436
450
|
getCacheById(id: string): KubbFile.File | undefined;
|
|
437
451
|
getByPath(path: KubbFile.Path): KubbFile.ResolvedFile | undefined;
|
|
438
452
|
deleteByPath(path: KubbFile.Path): void;
|
|
439
|
-
|
|
453
|
+
getBarrelFiles({ files, meta, root, output, logger }: AddIndexesProps): Promise<KubbFile.File[]>;
|
|
440
454
|
write(...params: Parameters<typeof write>): ReturnType<typeof write>;
|
|
441
455
|
read(...params: Parameters<typeof read>): ReturnType<typeof read>;
|
|
442
456
|
static getMode(path: string | undefined | null): KubbFile.Mode;
|