@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.d.cts CHANGED
@@ -382,6 +382,6 @@ interface FastDiscoveryOptions {
382
382
  }
383
383
  declare function discoverContractsFast(opts: FastDiscoveryOptions): Promise<RouteDescriptor[]>;
384
384
 
385
- declare const VERSION = "0.27.0";
385
+ declare const VERSION = "0.27.1";
386
386
 
387
387
  export { type ChainModuleRendererOptions, CodegenError, type CodegenManifest, ConfigError, DriftGuardError, type EntryPoint, type FastDiscoveryOptions, type JsonSchema, type MocksEmitOptions, type OpenApiDocument, type OpenApiEmitOptions, type OpenApiInfo, RenderContext, RenderedModule, ResolvedConfig, RouteDescriptor, SchemaModule, SchemaNode, type TsTypeContext, UserConfig, VERSION, ValidationAdapter, type WatchOptions, type Watcher, acquireLock, buildMocksFile, buildOpenApiSpec, createChainModuleRenderer, defineConfig, discoverContractsFast, emitApi, emitForms, emitMocks, emitOpenApi, emitRoutes, extractSchemaFromDto, generate, loadConfig, renderTsType, resolveConfig, schemaModuleToJsonSchema, schemaNodeToJsonSchema, toObjectKey, typeNameFor, watch };
package/dist/index.d.ts CHANGED
@@ -382,6 +382,6 @@ interface FastDiscoveryOptions {
382
382
  }
383
383
  declare function discoverContractsFast(opts: FastDiscoveryOptions): Promise<RouteDescriptor[]>;
384
384
 
385
- declare const VERSION = "0.27.0";
385
+ declare const VERSION = "0.27.1";
386
386
 
387
387
  export { type ChainModuleRendererOptions, CodegenError, type CodegenManifest, ConfigError, DriftGuardError, type EntryPoint, type FastDiscoveryOptions, type JsonSchema, type MocksEmitOptions, type OpenApiDocument, type OpenApiEmitOptions, type OpenApiInfo, RenderContext, RenderedModule, ResolvedConfig, RouteDescriptor, SchemaModule, SchemaNode, type TsTypeContext, UserConfig, VERSION, ValidationAdapter, type WatchOptions, type Watcher, acquireLock, buildMocksFile, buildOpenApiSpec, createChainModuleRenderer, defineConfig, discoverContractsFast, emitApi, emitForms, emitMocks, emitOpenApi, emitRoutes, extractSchemaFromDto, generate, loadConfig, renderTsType, resolveConfig, schemaModuleToJsonSchema, schemaNodeToJsonSchema, toObjectKey, typeNameFor, watch };
package/dist/index.js CHANGED
@@ -725,10 +725,11 @@ function resolveModuleSpecifier(moduleSpecifier, sourceFile, project) {
725
725
  }
726
726
  return [];
727
727
  }
728
- function resolveImportedType(name, sourceFile, project) {
728
+ function resolveImportedType(name, sourceFile, project, seen = /* @__PURE__ */ new Set()) {
729
729
  for (const importDecl of sourceFile.getImportDeclarations()) {
730
- const namedImport = importDecl.getNamedImports().find((n) => n.getName() === name);
730
+ const namedImport = importDecl.getNamedImports().find((n) => (n.getAliasNode()?.getText() ?? n.getName()) === name);
731
731
  if (!namedImport) continue;
732
+ const sourceName = namedImport.getName();
732
733
  const moduleSpecifier = importDecl.getModuleSpecifierValue();
733
734
  const candidates = resolveModuleSpecifier(moduleSpecifier, sourceFile, project);
734
735
  for (const candidate of candidates) {
@@ -740,17 +741,17 @@ function resolveImportedType(name, sourceFile, project) {
740
741
  continue;
741
742
  }
742
743
  }
743
- const result = findTypeInFile(name, importedFile);
744
+ const result = findTypeInFile(sourceName, importedFile);
744
745
  if (result) return result;
745
- const viaReExport = resolveReExportedType(name, importedFile, project, /* @__PURE__ */ new Set());
746
+ const viaReExport = resolveReExportedType(sourceName, importedFile, project, /* @__PURE__ */ new Set());
746
747
  if (viaReExport) return viaReExport;
747
748
  }
748
749
  if (candidates.length === 0) {
749
- const viaCompiler = resolveBareSpecifierType(name, importDecl, project);
750
+ const viaCompiler = resolveBareSpecifierType(sourceName, importDecl, project);
750
751
  if (viaCompiler) return viaCompiler;
751
752
  }
752
753
  }
753
- return resolveReExportedType(name, sourceFile, project, /* @__PURE__ */ new Set());
754
+ return resolveReExportedType(name, sourceFile, project, seen);
754
755
  }
755
756
  function resolveBareSpecifierType(name, importDecl, project) {
756
757
  let target;
@@ -765,9 +766,9 @@ function resolveBareSpecifierType(name, importDecl, project) {
765
766
  return resolveReExportedType(name, target, project, /* @__PURE__ */ new Set());
766
767
  }
767
768
  function resolveReExportedType(name, file, project, seen) {
768
- const filePath = file.getFilePath();
769
- if (seen.has(filePath)) return null;
770
- seen.add(filePath);
769
+ const visit = `${file.getFilePath()}#${name}`;
770
+ if (seen.has(visit)) return null;
771
+ seen.add(visit);
771
772
  for (const exportDecl of file.getExportDeclarations()) {
772
773
  const moduleSpecifier = exportDecl.getModuleSpecifierValue();
773
774
  const namedExports = exportDecl.getNamedExports();
@@ -789,7 +790,7 @@ function resolveReExportedType(name, file, project, seen) {
789
790
  const sourceName = namedExports.find((n) => (n.getAliasNode()?.getText() ?? n.getName()) === name)?.getName() ?? name;
790
791
  const local = findTypeInFile(sourceName, file);
791
792
  if (local) return local;
792
- const imported = resolveImportedType(sourceName, file, project);
793
+ const imported = resolveImportedType(sourceName, file, project, seen);
793
794
  if (imported) return imported;
794
795
  }
795
796
  return null;
@@ -6095,7 +6096,7 @@ function createChainModuleRenderer(opts) {
6095
6096
  }
6096
6097
 
6097
6098
  // src/index.ts
6098
- var VERSION = "0.27.0";
6099
+ var VERSION = "0.27.1";
6099
6100
  export {
6100
6101
  CodegenError,
6101
6102
  ConfigError,