@kubb/core 2.0.0-beta.7 → 2.0.0-beta.9
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/index.cjs +12 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +12 -24
- package/dist/index.js.map +1 -1
- package/dist/utils.cjs +12 -24
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +4 -4
- package/dist/utils.d.ts +4 -4
- package/dist/utils.js +12 -24
- package/dist/utils.js.map +1 -1
- package/package.json +5 -5
- package/src/BarrelManager.ts +5 -17
- package/src/FileManager.ts +9 -12
package/dist/index.d.cts
CHANGED
|
@@ -12,7 +12,7 @@ type BarrelManagerOptions = {
|
|
|
12
12
|
/**
|
|
13
13
|
* Add .ts or .js
|
|
14
14
|
*/
|
|
15
|
-
|
|
15
|
+
extName?: KubbFile.Extname;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
declare class EventEmitter<TEvents extends Record<string, any>> {
|
|
@@ -594,11 +594,11 @@ type AddIndexesProps = {
|
|
|
594
594
|
/**
|
|
595
595
|
* Output for plugin
|
|
596
596
|
*/
|
|
597
|
-
output:
|
|
597
|
+
output: {
|
|
598
598
|
path: string;
|
|
599
599
|
exportAs?: string;
|
|
600
|
+
extName?: KubbFile.Extname;
|
|
600
601
|
};
|
|
601
|
-
extName?: KubbFile.Extname;
|
|
602
602
|
options?: BarrelManagerOptions;
|
|
603
603
|
meta?: KubbFile.File['meta'];
|
|
604
604
|
};
|
|
@@ -616,7 +616,7 @@ declare class FileManager {
|
|
|
616
616
|
get files(): Array<KubbFile.File>;
|
|
617
617
|
get isExecuting(): boolean;
|
|
618
618
|
add<T extends Array<KubbFile.File> = Array<KubbFile.File>>(...files: T): AddResult<T>;
|
|
619
|
-
addIndexes({ root, output,
|
|
619
|
+
addIndexes({ root, output, meta, options }: AddIndexesProps): Promise<Array<KubbFile.File> | undefined>;
|
|
620
620
|
getCacheByUUID(UUID: KubbFile.UUID): KubbFile.File | undefined;
|
|
621
621
|
get(path: KubbFile.Path): Array<KubbFile.File> | undefined;
|
|
622
622
|
remove(path: KubbFile.Path): void;
|
package/dist/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ type BarrelManagerOptions = {
|
|
|
12
12
|
/**
|
|
13
13
|
* Add .ts or .js
|
|
14
14
|
*/
|
|
15
|
-
|
|
15
|
+
extName?: KubbFile.Extname;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
declare class EventEmitter<TEvents extends Record<string, any>> {
|
|
@@ -594,11 +594,11 @@ type AddIndexesProps = {
|
|
|
594
594
|
/**
|
|
595
595
|
* Output for plugin
|
|
596
596
|
*/
|
|
597
|
-
output:
|
|
597
|
+
output: {
|
|
598
598
|
path: string;
|
|
599
599
|
exportAs?: string;
|
|
600
|
+
extName?: KubbFile.Extname;
|
|
600
601
|
};
|
|
601
|
-
extName?: KubbFile.Extname;
|
|
602
602
|
options?: BarrelManagerOptions;
|
|
603
603
|
meta?: KubbFile.File['meta'];
|
|
604
604
|
};
|
|
@@ -616,7 +616,7 @@ declare class FileManager {
|
|
|
616
616
|
get files(): Array<KubbFile.File>;
|
|
617
617
|
get isExecuting(): boolean;
|
|
618
618
|
add<T extends Array<KubbFile.File> = Array<KubbFile.File>>(...files: T): AddResult<T>;
|
|
619
|
-
addIndexes({ root, output,
|
|
619
|
+
addIndexes({ root, output, meta, options }: AddIndexesProps): Promise<Array<KubbFile.File> | undefined>;
|
|
620
620
|
getCacheByUUID(UUID: KubbFile.UUID): KubbFile.File | undefined;
|
|
621
621
|
get(path: KubbFile.Path): Array<KubbFile.File> | undefined;
|
|
622
622
|
remove(path: KubbFile.Path): void;
|
package/dist/index.js
CHANGED
|
@@ -639,19 +639,9 @@ var BarrelManager = class {
|
|
|
639
639
|
__privateSet(this, _options, options);
|
|
640
640
|
return this;
|
|
641
641
|
}
|
|
642
|
-
getIndexes(pathToBuild
|
|
643
|
-
const { treeNode = {}, isTypeOnly,
|
|
644
|
-
const
|
|
645
|
-
".ts": {
|
|
646
|
-
extensions: /\.ts/,
|
|
647
|
-
exclude: [/schemas/, /json/]
|
|
648
|
-
},
|
|
649
|
-
".json": {
|
|
650
|
-
extensions: /\.json/,
|
|
651
|
-
exclude: []
|
|
652
|
-
}
|
|
653
|
-
};
|
|
654
|
-
const tree = TreeNode.build(pathToBuild, { ...extMapper[extName] || {}, ...treeNode });
|
|
642
|
+
getIndexes(pathToBuild) {
|
|
643
|
+
const { treeNode = {}, isTypeOnly, extName } = __privateGet(this, _options);
|
|
644
|
+
const tree = TreeNode.build(pathToBuild, treeNode);
|
|
655
645
|
if (!tree) {
|
|
656
646
|
return null;
|
|
657
647
|
}
|
|
@@ -667,7 +657,7 @@ var BarrelManager = class {
|
|
|
667
657
|
return void 0;
|
|
668
658
|
}
|
|
669
659
|
return {
|
|
670
|
-
path:
|
|
660
|
+
path: extName ? `${importPath}${extName}` : importPath,
|
|
671
661
|
isTypeOnly
|
|
672
662
|
};
|
|
673
663
|
}).filter(Boolean);
|
|
@@ -686,7 +676,7 @@ var BarrelManager = class {
|
|
|
686
676
|
const importPath = treeNodeChild.data.type === "directory" ? `./${treeNodeChild.data.name}/index` : `./${transformers_default.trimExtName(treeNodeChild.data.name)}`;
|
|
687
677
|
const exports = [
|
|
688
678
|
{
|
|
689
|
-
path:
|
|
679
|
+
path: extName ? `${importPath}${extName}` : importPath,
|
|
690
680
|
isTypeOnly
|
|
691
681
|
}
|
|
692
682
|
];
|
|
@@ -758,12 +748,10 @@ var _FileManager = class _FileManager {
|
|
|
758
748
|
}
|
|
759
749
|
return resolvedFiles[0];
|
|
760
750
|
}
|
|
761
|
-
async addIndexes({ root, output,
|
|
762
|
-
const
|
|
763
|
-
const
|
|
764
|
-
const
|
|
765
|
-
const barrelManager = new BarrelManager(options);
|
|
766
|
-
const files = barrelManager.getIndexes(resolve(root, outputPath), extName);
|
|
751
|
+
async addIndexes({ root, output, meta, options = {} }) {
|
|
752
|
+
const exportPath = output.path.startsWith("./") ? output.path : `./${output.path}`;
|
|
753
|
+
const barrelManager = new BarrelManager({ extName: output.extName, ...options });
|
|
754
|
+
const files = barrelManager.getIndexes(resolve(root, output.path));
|
|
767
755
|
if (!files) {
|
|
768
756
|
return void 0;
|
|
769
757
|
}
|
|
@@ -772,9 +760,9 @@ var _FileManager = class _FileManager {
|
|
|
772
760
|
baseName: "index.ts",
|
|
773
761
|
source: "",
|
|
774
762
|
exports: [
|
|
775
|
-
exportAs ? {
|
|
776
|
-
name: exportAs,
|
|
777
|
-
asAlias:
|
|
763
|
+
output.exportAs ? {
|
|
764
|
+
name: output.exportAs,
|
|
765
|
+
asAlias: true,
|
|
778
766
|
path: exportPath,
|
|
779
767
|
isTypeOnly: options.isTypeOnly
|
|
780
768
|
} : {
|