@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.
@@ -314,10 +314,11 @@ function resolveModuleSpecifier(moduleSpecifier, sourceFile, project) {
314
314
  }
315
315
  return [];
316
316
  }
317
- function resolveImportedType(name, sourceFile, project) {
317
+ function resolveImportedType(name, sourceFile, project, seen = /* @__PURE__ */ new Set()) {
318
318
  for (const importDecl of sourceFile.getImportDeclarations()) {
319
- const namedImport = importDecl.getNamedImports().find((n) => n.getName() === name);
319
+ const namedImport = importDecl.getNamedImports().find((n) => (n.getAliasNode()?.getText() ?? n.getName()) === name);
320
320
  if (!namedImport) continue;
321
+ const sourceName = namedImport.getName();
321
322
  const moduleSpecifier = importDecl.getModuleSpecifierValue();
322
323
  const candidates = resolveModuleSpecifier(moduleSpecifier, sourceFile, project);
323
324
  for (const candidate of candidates) {
@@ -329,17 +330,17 @@ function resolveImportedType(name, sourceFile, project) {
329
330
  continue;
330
331
  }
331
332
  }
332
- const result = findTypeInFile(name, importedFile);
333
+ const result = findTypeInFile(sourceName, importedFile);
333
334
  if (result) return result;
334
- const viaReExport = resolveReExportedType(name, importedFile, project, /* @__PURE__ */ new Set());
335
+ const viaReExport = resolveReExportedType(sourceName, importedFile, project, /* @__PURE__ */ new Set());
335
336
  if (viaReExport) return viaReExport;
336
337
  }
337
338
  if (candidates.length === 0) {
338
- const viaCompiler = resolveBareSpecifierType(name, importDecl, project);
339
+ const viaCompiler = resolveBareSpecifierType(sourceName, importDecl, project);
339
340
  if (viaCompiler) return viaCompiler;
340
341
  }
341
342
  }
342
- return resolveReExportedType(name, sourceFile, project, /* @__PURE__ */ new Set());
343
+ return resolveReExportedType(name, sourceFile, project, seen);
343
344
  }
344
345
  function resolveBareSpecifierType(name, importDecl, project) {
345
346
  let target;
@@ -354,9 +355,9 @@ function resolveBareSpecifierType(name, importDecl, project) {
354
355
  return resolveReExportedType(name, target, project, /* @__PURE__ */ new Set());
355
356
  }
356
357
  function resolveReExportedType(name, file, project, seen) {
357
- const filePath = file.getFilePath();
358
- if (seen.has(filePath)) return null;
359
- seen.add(filePath);
358
+ const visit = `${file.getFilePath()}#${name}`;
359
+ if (seen.has(visit)) return null;
360
+ seen.add(visit);
360
361
  for (const exportDecl of file.getExportDeclarations()) {
361
362
  const moduleSpecifier = exportDecl.getModuleSpecifierValue();
362
363
  const namedExports = exportDecl.getNamedExports();
@@ -378,7 +379,7 @@ function resolveReExportedType(name, file, project, seen) {
378
379
  const sourceName = namedExports.find((n) => (n.getAliasNode()?.getText() ?? n.getName()) === name)?.getName() ?? name;
379
380
  const local = findTypeInFile(sourceName, file);
380
381
  if (local) return local;
381
- const imported = resolveImportedType(sourceName, file, project);
382
+ const imported = resolveImportedType(sourceName, file, project, seen);
382
383
  if (imported) return imported;
383
384
  }
384
385
  return null;
@@ -5805,7 +5806,7 @@ async function watch(config, onChange, options = {}) {
5805
5806
  }
5806
5807
 
5807
5808
  // src/index.ts
5808
- var VERSION = "0.27.0";
5809
+ var VERSION = "0.27.1";
5809
5810
 
5810
5811
  // src/generate-manifest.ts
5811
5812
  var MANIFEST_FILE = ".codegen-manifest.json";