@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/CHANGELOG.md +6 -0
- package/dist/cli/main.cjs +12 -11
- package/dist/cli/main.cjs.map +1 -1
- package/dist/cli/main.js +12 -11
- package/dist/cli/main.js.map +1 -1
- package/dist/index.cjs +12 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +12 -11
- package/dist/index.js.map +1 -1
- package/dist/nest/index.cjs +12 -11
- package/dist/nest/index.cjs.map +1 -1
- package/dist/nest/index.js +12 -11
- package/dist/nest/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/main.js
CHANGED
|
@@ -720,10 +720,11 @@ function resolveModuleSpecifier(moduleSpecifier, sourceFile, project) {
|
|
|
720
720
|
}
|
|
721
721
|
return [];
|
|
722
722
|
}
|
|
723
|
-
function resolveImportedType(name, sourceFile, project) {
|
|
723
|
+
function resolveImportedType(name, sourceFile, project, seen = /* @__PURE__ */ new Set()) {
|
|
724
724
|
for (const importDecl of sourceFile.getImportDeclarations()) {
|
|
725
|
-
const namedImport = importDecl.getNamedImports().find((n) => n.getName() === name);
|
|
725
|
+
const namedImport = importDecl.getNamedImports().find((n) => (n.getAliasNode()?.getText() ?? n.getName()) === name);
|
|
726
726
|
if (!namedImport) continue;
|
|
727
|
+
const sourceName = namedImport.getName();
|
|
727
728
|
const moduleSpecifier = importDecl.getModuleSpecifierValue();
|
|
728
729
|
const candidates = resolveModuleSpecifier(moduleSpecifier, sourceFile, project);
|
|
729
730
|
for (const candidate of candidates) {
|
|
@@ -735,17 +736,17 @@ function resolveImportedType(name, sourceFile, project) {
|
|
|
735
736
|
continue;
|
|
736
737
|
}
|
|
737
738
|
}
|
|
738
|
-
const result = findTypeInFile(
|
|
739
|
+
const result = findTypeInFile(sourceName, importedFile);
|
|
739
740
|
if (result) return result;
|
|
740
|
-
const viaReExport = resolveReExportedType(
|
|
741
|
+
const viaReExport = resolveReExportedType(sourceName, importedFile, project, /* @__PURE__ */ new Set());
|
|
741
742
|
if (viaReExport) return viaReExport;
|
|
742
743
|
}
|
|
743
744
|
if (candidates.length === 0) {
|
|
744
|
-
const viaCompiler = resolveBareSpecifierType(
|
|
745
|
+
const viaCompiler = resolveBareSpecifierType(sourceName, importDecl, project);
|
|
745
746
|
if (viaCompiler) return viaCompiler;
|
|
746
747
|
}
|
|
747
748
|
}
|
|
748
|
-
return resolveReExportedType(name, sourceFile, project,
|
|
749
|
+
return resolveReExportedType(name, sourceFile, project, seen);
|
|
749
750
|
}
|
|
750
751
|
function resolveBareSpecifierType(name, importDecl, project) {
|
|
751
752
|
let target;
|
|
@@ -760,9 +761,9 @@ function resolveBareSpecifierType(name, importDecl, project) {
|
|
|
760
761
|
return resolveReExportedType(name, target, project, /* @__PURE__ */ new Set());
|
|
761
762
|
}
|
|
762
763
|
function resolveReExportedType(name, file, project, seen) {
|
|
763
|
-
const
|
|
764
|
-
if (seen.has(
|
|
765
|
-
seen.add(
|
|
764
|
+
const visit = `${file.getFilePath()}#${name}`;
|
|
765
|
+
if (seen.has(visit)) return null;
|
|
766
|
+
seen.add(visit);
|
|
766
767
|
for (const exportDecl of file.getExportDeclarations()) {
|
|
767
768
|
const moduleSpecifier = exportDecl.getModuleSpecifierValue();
|
|
768
769
|
const namedExports = exportDecl.getNamedExports();
|
|
@@ -784,7 +785,7 @@ function resolveReExportedType(name, file, project, seen) {
|
|
|
784
785
|
const sourceName = namedExports.find((n) => (n.getAliasNode()?.getText() ?? n.getName()) === name)?.getName() ?? name;
|
|
785
786
|
const local = findTypeInFile(sourceName, file);
|
|
786
787
|
if (local) return local;
|
|
787
|
-
const imported = resolveImportedType(sourceName, file, project);
|
|
788
|
+
const imported = resolveImportedType(sourceName, file, project, seen);
|
|
788
789
|
if (imported) return imported;
|
|
789
790
|
}
|
|
790
791
|
return null;
|
|
@@ -6004,7 +6005,7 @@ async function watch(config, onChange, options = {}) {
|
|
|
6004
6005
|
}
|
|
6005
6006
|
|
|
6006
6007
|
// src/index.ts
|
|
6007
|
-
var VERSION = "0.27.
|
|
6008
|
+
var VERSION = "0.27.1";
|
|
6008
6009
|
|
|
6009
6010
|
// src/cli/codegen.ts
|
|
6010
6011
|
async function runCodegen(opts = {}) {
|