@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.
@@ -286,10 +286,11 @@ function resolveModuleSpecifier(moduleSpecifier, sourceFile, project) {
286
286
  }
287
287
  return [];
288
288
  }
289
- function resolveImportedType(name, sourceFile, project) {
289
+ function resolveImportedType(name, sourceFile, project, seen = /* @__PURE__ */ new Set()) {
290
290
  for (const importDecl of sourceFile.getImportDeclarations()) {
291
- const namedImport = importDecl.getNamedImports().find((n) => n.getName() === name);
291
+ const namedImport = importDecl.getNamedImports().find((n) => (n.getAliasNode()?.getText() ?? n.getName()) === name);
292
292
  if (!namedImport) continue;
293
+ const sourceName = namedImport.getName();
293
294
  const moduleSpecifier = importDecl.getModuleSpecifierValue();
294
295
  const candidates = resolveModuleSpecifier(moduleSpecifier, sourceFile, project);
295
296
  for (const candidate of candidates) {
@@ -301,17 +302,17 @@ function resolveImportedType(name, sourceFile, project) {
301
302
  continue;
302
303
  }
303
304
  }
304
- const result = findTypeInFile(name, importedFile);
305
+ const result = findTypeInFile(sourceName, importedFile);
305
306
  if (result) return result;
306
- const viaReExport = resolveReExportedType(name, importedFile, project, /* @__PURE__ */ new Set());
307
+ const viaReExport = resolveReExportedType(sourceName, importedFile, project, /* @__PURE__ */ new Set());
307
308
  if (viaReExport) return viaReExport;
308
309
  }
309
310
  if (candidates.length === 0) {
310
- const viaCompiler = resolveBareSpecifierType(name, importDecl, project);
311
+ const viaCompiler = resolveBareSpecifierType(sourceName, importDecl, project);
311
312
  if (viaCompiler) return viaCompiler;
312
313
  }
313
314
  }
314
- return resolveReExportedType(name, sourceFile, project, /* @__PURE__ */ new Set());
315
+ return resolveReExportedType(name, sourceFile, project, seen);
315
316
  }
316
317
  function resolveBareSpecifierType(name, importDecl, project) {
317
318
  let target;
@@ -326,9 +327,9 @@ function resolveBareSpecifierType(name, importDecl, project) {
326
327
  return resolveReExportedType(name, target, project, /* @__PURE__ */ new Set());
327
328
  }
328
329
  function resolveReExportedType(name, file, project, seen) {
329
- const filePath = file.getFilePath();
330
- if (seen.has(filePath)) return null;
331
- seen.add(filePath);
330
+ const visit = `${file.getFilePath()}#${name}`;
331
+ if (seen.has(visit)) return null;
332
+ seen.add(visit);
332
333
  for (const exportDecl of file.getExportDeclarations()) {
333
334
  const moduleSpecifier = exportDecl.getModuleSpecifierValue();
334
335
  const namedExports = exportDecl.getNamedExports();
@@ -350,7 +351,7 @@ function resolveReExportedType(name, file, project, seen) {
350
351
  const sourceName = namedExports.find((n) => (n.getAliasNode()?.getText() ?? n.getName()) === name)?.getName() ?? name;
351
352
  const local = findTypeInFile(sourceName, file);
352
353
  if (local) return local;
353
- const imported = resolveImportedType(sourceName, file, project);
354
+ const imported = resolveImportedType(sourceName, file, project, seen);
354
355
  if (imported) return imported;
355
356
  }
356
357
  return null;
@@ -5784,7 +5785,7 @@ async function watch(config, onChange, options = {}) {
5784
5785
  }
5785
5786
 
5786
5787
  // src/index.ts
5787
- var VERSION = "0.27.0";
5788
+ var VERSION = "0.27.1";
5788
5789
 
5789
5790
  // src/generate-manifest.ts
5790
5791
  var MANIFEST_FILE = ".codegen-manifest.json";