@dudousxd/nestjs-codegen 0.8.0 → 0.10.0

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
@@ -1,5 +1,5 @@
1
- import { U as UserConfig, R as ResolvedConfig, a as RouteDescriptor, S as SchemaNode, b as RenderContext, c as SchemaModule, d as RenderedModule, e as ResolvedFormsConfig, V as ValidationAdapter, C as CodegenExtension, E as ExtensionContext, f as SerializationMode } from './index-DgIAN5k5.cjs';
2
- export { A as AdapterUsage, g as ContractDescriptor, h as ContractSource, i as ControllerRef, N as NumberCheck, j as ScopeConfig, k as StringCheck, T as TypeRef, l as ValidationOption, r as resolveAdapter } from './index-DgIAN5k5.cjs';
1
+ import { U as UserConfig, R as ResolvedConfig, a as RouteDescriptor, S as SchemaNode, b as RenderContext, c as SchemaModule, d as RenderedModule, e as ResolvedFormsConfig, V as ValidationAdapter, C as CodegenExtension, E as ExtensionContext, f as SerializationMode } from './index-CxkGbILp.cjs';
2
+ export { A as AdapterUsage, g as ContractDescriptor, h as ContractSource, i as ControllerRef, N as NumberCheck, j as ScopeConfig, k as StringCheck, T as TypeRef, l as ValidationOption, r as resolveAdapter } from './index-CxkGbILp.cjs';
3
3
  import { ClassDeclaration, SourceFile, Project } from 'ts-morph';
4
4
 
5
5
  declare function defineConfig(c: UserConfig): UserConfig;
@@ -296,6 +296,6 @@ interface FastDiscoveryOptions {
296
296
  }
297
297
  declare function discoverContractsFast(opts: FastDiscoveryOptions): Promise<RouteDescriptor[]>;
298
298
 
299
- declare const VERSION = "0.8.0";
299
+ declare const VERSION = "0.10.0";
300
300
 
301
301
  export { type ChainModuleRendererOptions, CodegenError, ConfigError, type FastDiscoveryOptions, type JsonSchema, type MocksEmitOptions, type OpenApiDocument, type OpenApiEmitOptions, type OpenApiInfo, RenderContext, RenderedModule, ResolvedConfig, RouteDescriptor, SchemaModule, SchemaNode, type TsTypeContext, UserConfig, VERSION, ValidationAdapter, 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
@@ -1,5 +1,5 @@
1
- import { U as UserConfig, R as ResolvedConfig, a as RouteDescriptor, S as SchemaNode, b as RenderContext, c as SchemaModule, d as RenderedModule, e as ResolvedFormsConfig, V as ValidationAdapter, C as CodegenExtension, E as ExtensionContext, f as SerializationMode } from './index-DgIAN5k5.js';
2
- export { A as AdapterUsage, g as ContractDescriptor, h as ContractSource, i as ControllerRef, N as NumberCheck, j as ScopeConfig, k as StringCheck, T as TypeRef, l as ValidationOption, r as resolveAdapter } from './index-DgIAN5k5.js';
1
+ import { U as UserConfig, R as ResolvedConfig, a as RouteDescriptor, S as SchemaNode, b as RenderContext, c as SchemaModule, d as RenderedModule, e as ResolvedFormsConfig, V as ValidationAdapter, C as CodegenExtension, E as ExtensionContext, f as SerializationMode } from './index-CxkGbILp.js';
2
+ export { A as AdapterUsage, g as ContractDescriptor, h as ContractSource, i as ControllerRef, N as NumberCheck, j as ScopeConfig, k as StringCheck, T as TypeRef, l as ValidationOption, r as resolveAdapter } from './index-CxkGbILp.js';
3
3
  import { ClassDeclaration, SourceFile, Project } from 'ts-morph';
4
4
 
5
5
  declare function defineConfig(c: UserConfig): UserConfig;
@@ -296,6 +296,6 @@ interface FastDiscoveryOptions {
296
296
  }
297
297
  declare function discoverContractsFast(opts: FastDiscoveryOptions): Promise<RouteDescriptor[]>;
298
298
 
299
- declare const VERSION = "0.8.0";
299
+ declare const VERSION = "0.10.0";
300
300
 
301
301
  export { type ChainModuleRendererOptions, CodegenError, ConfigError, type FastDiscoveryOptions, type JsonSchema, type MocksEmitOptions, type OpenApiDocument, type OpenApiEmitOptions, type OpenApiInfo, RenderContext, RenderedModule, ResolvedConfig, RouteDescriptor, SchemaModule, SchemaNode, type TsTypeContext, UserConfig, VERSION, ValidationAdapter, 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
@@ -113,6 +113,7 @@ function applyDefaults(userConfig, cwd) {
113
113
  };
114
114
  }
115
115
  return {
116
+ debug: userConfig.debug ?? false,
116
117
  extensions: userConfig.extensions ?? [],
117
118
  // Non-null: validateUserConfig() above throws when `validation` is absent.
118
119
  validation: resolveAdapter(userConfig.validation),
@@ -2082,8 +2083,18 @@ function buildEmpty() {
2082
2083
  ].join("\n");
2083
2084
  }
2084
2085
 
2086
+ // src/util/debug-log.ts
2087
+ var debugEnabled = false;
2088
+ function setCodegenDebug(enabled) {
2089
+ debugEnabled = enabled;
2090
+ }
2091
+ function debugWarn(message) {
2092
+ if (debugEnabled) console.warn(`[nestjs-codegen] ${message}`);
2093
+ }
2094
+
2085
2095
  // src/generate.ts
2086
2096
  async function generate(config, inputRoutes = []) {
2097
+ setCodegenDebug(config.debug);
2087
2098
  const extensions = config.extensions ?? [];
2088
2099
  let routes = inputRoutes;
2089
2100
  const ctx = createExtensionContext(config, () => routes);
@@ -2689,7 +2700,7 @@ function buildProperty(prop, classFile, ctx) {
2689
2700
  ctx.warnedDecorators.add(name);
2690
2701
  const msg = `@${name} is not translatable to a client validation schema and was skipped (server-only validation).`;
2691
2702
  ctx.warnings.push(msg);
2692
- console.warn(`[nestjs-codegen] ${msg}`);
2703
+ debugWarn(msg);
2693
2704
  }
2694
2705
  }
2695
2706
  }
@@ -2740,7 +2751,7 @@ function buildNestedReference(className, fromFile, ctx, typeArgs = []) {
2740
2751
  ctx.warnedDecorators.add(`recursive:${reserved}`);
2741
2752
  const msg = `${className} is a recursive type; the generated schema validates it via a lazy self-reference.`;
2742
2753
  ctx.warnings.push(msg);
2743
- console.warn(`[nestjs-codegen] ${msg}`);
2754
+ debugWarn(msg);
2744
2755
  }
2745
2756
  return { kind: "lazyRef", name: reserved };
2746
2757
  }
@@ -2749,7 +2760,7 @@ function buildNestedReference(className, fromFile, ctx, typeArgs = []) {
2749
2760
  ctx.warnedDecorators.add(`deep:${className}`);
2750
2761
  const msg = `${className} nesting is too deep to expand; the generated schema uses unknown for it.`;
2751
2762
  ctx.warnings.push(msg);
2752
- console.warn(`[nestjs-codegen] ${msg}`);
2763
+ debugWarn(msg);
2753
2764
  }
2754
2765
  return { kind: "unknown", note: "nesting too deep \u2014 not expanded" };
2755
2766
  }
@@ -2890,7 +2901,7 @@ function enumSchemaFromDecorator(decorator, classFile, ctx) {
2890
2901
  if (!ctx.warnedDecorators.has(`IsEnum:${name}`)) {
2891
2902
  ctx.warnedDecorators.add(`IsEnum:${name}`);
2892
2903
  ctx.warnings.push(msg);
2893
- console.warn(`[nestjs-codegen] ${msg}`);
2904
+ debugWarn(msg);
2894
2905
  }
2895
2906
  return { kind: "unknown", note: `@IsEnum(${name}): enum not resolvable to literals` };
2896
2907
  }
@@ -4572,7 +4583,7 @@ function createChainModuleRenderer(opts) {
4572
4583
  }
4573
4584
 
4574
4585
  // src/index.ts
4575
- var VERSION = "0.8.0";
4586
+ var VERSION = "0.10.0";
4576
4587
  export {
4577
4588
  CodegenError,
4578
4589
  ConfigError,