@dudousxd/nestjs-codegen 0.27.0 → 0.27.1

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
@@ -775,10 +775,11 @@ function resolveModuleSpecifier(moduleSpecifier, sourceFile, project) {
775
775
  }
776
776
  return [];
777
777
  }
778
- function resolveImportedType(name, sourceFile, project) {
778
+ function resolveImportedType(name, sourceFile, project, seen = /* @__PURE__ */ new Set()) {
779
779
  for (const importDecl of sourceFile.getImportDeclarations()) {
780
- const namedImport = importDecl.getNamedImports().find((n) => n.getName() === name);
780
+ const namedImport = importDecl.getNamedImports().find((n) => (n.getAliasNode()?.getText() ?? n.getName()) === name);
781
781
  if (!namedImport) continue;
782
+ const sourceName = namedImport.getName();
782
783
  const moduleSpecifier = importDecl.getModuleSpecifierValue();
783
784
  const candidates = resolveModuleSpecifier(moduleSpecifier, sourceFile, project);
784
785
  for (const candidate of candidates) {
@@ -790,17 +791,17 @@ function resolveImportedType(name, sourceFile, project) {
790
791
  continue;
791
792
  }
792
793
  }
793
- const result = findTypeInFile(name, importedFile);
794
+ const result = findTypeInFile(sourceName, importedFile);
794
795
  if (result) return result;
795
- const viaReExport = resolveReExportedType(name, importedFile, project, /* @__PURE__ */ new Set());
796
+ const viaReExport = resolveReExportedType(sourceName, importedFile, project, /* @__PURE__ */ new Set());
796
797
  if (viaReExport) return viaReExport;
797
798
  }
798
799
  if (candidates.length === 0) {
799
- const viaCompiler = resolveBareSpecifierType(name, importDecl, project);
800
+ const viaCompiler = resolveBareSpecifierType(sourceName, importDecl, project);
800
801
  if (viaCompiler) return viaCompiler;
801
802
  }
802
803
  }
803
- return resolveReExportedType(name, sourceFile, project, /* @__PURE__ */ new Set());
804
+ return resolveReExportedType(name, sourceFile, project, seen);
804
805
  }
805
806
  function resolveBareSpecifierType(name, importDecl, project) {
806
807
  let target;
@@ -815,9 +816,9 @@ function resolveBareSpecifierType(name, importDecl, project) {
815
816
  return resolveReExportedType(name, target, project, /* @__PURE__ */ new Set());
816
817
  }
817
818
  function resolveReExportedType(name, file, project, seen) {
818
- const filePath = file.getFilePath();
819
- if (seen.has(filePath)) return null;
820
- seen.add(filePath);
819
+ const visit = `${file.getFilePath()}#${name}`;
820
+ if (seen.has(visit)) return null;
821
+ seen.add(visit);
821
822
  for (const exportDecl of file.getExportDeclarations()) {
822
823
  const moduleSpecifier = exportDecl.getModuleSpecifierValue();
823
824
  const namedExports = exportDecl.getNamedExports();
@@ -839,7 +840,7 @@ function resolveReExportedType(name, file, project, seen) {
839
840
  const sourceName = namedExports.find((n) => (n.getAliasNode()?.getText() ?? n.getName()) === name)?.getName() ?? name;
840
841
  const local = findTypeInFile(sourceName, file);
841
842
  if (local) return local;
842
- const imported = resolveImportedType(sourceName, file, project);
843
+ const imported = resolveImportedType(sourceName, file, project, seen);
843
844
  if (imported) return imported;
844
845
  }
845
846
  return null;
@@ -6138,7 +6139,7 @@ function createChainModuleRenderer(opts) {
6138
6139
  }
6139
6140
 
6140
6141
  // src/index.ts
6141
- var VERSION = "0.27.0";
6142
+ var VERSION = "0.27.1";
6142
6143
  // Annotate the CommonJS export names for ESM import in node:
6143
6144
  0 && (module.exports = {
6144
6145
  CodegenError,