@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 CHANGED
@@ -681,19 +681,9 @@ var BarrelManager = class {
681
681
  __privateSet(this, _options, options);
682
682
  return this;
683
683
  }
684
- getIndexes(pathToBuild, extName) {
685
- const { treeNode = {}, isTypeOnly, includeExt } = __privateGet(this, _options);
686
- const extMapper = {
687
- ".ts": {
688
- extensions: /\.ts/,
689
- exclude: [/schemas/, /json/]
690
- },
691
- ".json": {
692
- extensions: /\.json/,
693
- exclude: []
694
- }
695
- };
696
- const tree = TreeNode.build(pathToBuild, { ...extMapper[extName] || {}, ...treeNode });
684
+ getIndexes(pathToBuild) {
685
+ const { treeNode = {}, isTypeOnly, extName } = __privateGet(this, _options);
686
+ const tree = TreeNode.build(pathToBuild, treeNode);
697
687
  if (!tree) {
698
688
  return null;
699
689
  }
@@ -709,7 +699,7 @@ var BarrelManager = class {
709
699
  return void 0;
710
700
  }
711
701
  return {
712
- path: includeExt ? `${importPath}${extName}` : importPath,
702
+ path: extName ? `${importPath}${extName}` : importPath,
713
703
  isTypeOnly
714
704
  };
715
705
  }).filter(Boolean);
@@ -728,7 +718,7 @@ var BarrelManager = class {
728
718
  const importPath = treeNodeChild.data.type === "directory" ? `./${treeNodeChild.data.name}/index` : `./${transformers_default.trimExtName(treeNodeChild.data.name)}`;
729
719
  const exports = [
730
720
  {
731
- path: includeExt ? `${importPath}${extName}` : importPath,
721
+ path: extName ? `${importPath}${extName}` : importPath,
732
722
  isTypeOnly
733
723
  }
734
724
  ];
@@ -800,12 +790,10 @@ var _FileManager = class _FileManager {
800
790
  }
801
791
  return resolvedFiles[0];
802
792
  }
803
- async addIndexes({ root, output, extName = ".ts", meta, options = {} }) {
804
- const outputPath = typeof output === "string" ? output : output.path;
805
- const exportAs = typeof output === "string" ? void 0 : output.exportAs;
806
- const exportPath = outputPath.startsWith("./") ? outputPath : `./${outputPath}`;
807
- const barrelManager = new BarrelManager(options);
808
- const files = barrelManager.getIndexes(path4.resolve(root, outputPath), extName);
793
+ async addIndexes({ root, output, meta, options = {} }) {
794
+ const exportPath = output.path.startsWith("./") ? output.path : `./${output.path}`;
795
+ const barrelManager = new BarrelManager({ extName: output.extName, ...options });
796
+ const files = barrelManager.getIndexes(path4.resolve(root, output.path));
809
797
  if (!files) {
810
798
  return void 0;
811
799
  }
@@ -814,9 +802,9 @@ var _FileManager = class _FileManager {
814
802
  baseName: "index.ts",
815
803
  source: "",
816
804
  exports: [
817
- exportAs ? {
818
- name: exportAs,
819
- asAlias: !!exportAs,
805
+ output.exportAs ? {
806
+ name: output.exportAs,
807
+ asAlias: true,
820
808
  path: exportPath,
821
809
  isTypeOnly: options.isTypeOnly
822
810
  } : {