@dudousxd/nestjs-codegen 0.6.0 → 0.6.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
@@ -289,6 +289,6 @@ interface FastDiscoveryOptions {
289
289
  }
290
290
  declare function discoverContractsFast(opts: FastDiscoveryOptions): Promise<RouteDescriptor[]>;
291
291
 
292
- declare const VERSION = "0.6.0";
292
+ declare const VERSION = "0.6.1";
293
293
 
294
294
  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
@@ -289,6 +289,6 @@ interface FastDiscoveryOptions {
289
289
  }
290
290
  declare function discoverContractsFast(opts: FastDiscoveryOptions): Promise<RouteDescriptor[]>;
291
291
 
292
- declare const VERSION = "0.6.0";
292
+ declare const VERSION = "0.6.1";
293
293
 
294
294
  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
@@ -4344,6 +4344,7 @@ async function watch(config, onChange) {
4344
4344
  return NO_OP_WATCHER;
4345
4345
  }
4346
4346
  let discovery = null;
4347
+ let lastRoutes = [];
4347
4348
  async function getDiscovery() {
4348
4349
  if (discovery === null) {
4349
4350
  discovery = await PersistentDiscovery.create({
@@ -4357,13 +4358,14 @@ async function watch(config, onChange) {
4357
4358
  }
4358
4359
  try {
4359
4360
  const initialRoutes = (await getDiscovery()).discover();
4361
+ lastRoutes = initialRoutes;
4360
4362
  await generate(config, initialRoutes);
4361
4363
  } catch (err) {
4362
4364
  console.warn(
4363
4365
  `[nestjs-codegen] Initial route discovery failed, falling back to pages-only: ${err instanceof Error ? err.message : String(err)}`
4364
4366
  );
4365
4367
  try {
4366
- await generate(config);
4368
+ await generate(config, lastRoutes);
4367
4369
  } catch {
4368
4370
  }
4369
4371
  }
@@ -4381,7 +4383,7 @@ async function watch(config, onChange) {
4381
4383
  pagesDebounceTimer = setTimeout(async () => {
4382
4384
  pagesDebounceTimer = void 0;
4383
4385
  try {
4384
- await generate(config);
4386
+ await generate(config, lastRoutes);
4385
4387
  } catch (err) {
4386
4388
  console.error(
4387
4389
  "[nestjs-codegen] Pages generation failed:",
@@ -4412,6 +4414,7 @@ async function watch(config, onChange) {
4412
4414
  pendingChangedPaths.clear();
4413
4415
  try {
4414
4416
  const routes = await (await getDiscovery()).rediscover(changed);
4417
+ lastRoutes = routes;
4415
4418
  await generate(config, routes);
4416
4419
  } catch (err) {
4417
4420
  console.error(
@@ -4535,7 +4538,7 @@ function createChainModuleRenderer(opts) {
4535
4538
  }
4536
4539
 
4537
4540
  // src/index.ts
4538
- var VERSION = "0.6.0";
4541
+ var VERSION = "0.6.1";
4539
4542
  export {
4540
4543
  CodegenError,
4541
4544
  ConfigError,