@dudousxd/nestjs-codegen 0.21.1 → 0.22.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.
@@ -1,6 +1,6 @@
1
1
  import * as _nestjs_common from '@nestjs/common';
2
2
  import { DynamicModule, OnApplicationBootstrap, OnModuleDestroy, ExecutionContext } from '@nestjs/common';
3
- import { U as UserConfig } from '../index-Dyf4ttwU.cjs';
3
+ import { U as UserConfig } from '../index-BsptKWwz.cjs';
4
4
  import 'ts-morph';
5
5
 
6
6
  /**
@@ -1,6 +1,6 @@
1
1
  import * as _nestjs_common from '@nestjs/common';
2
2
  import { DynamicModule, OnApplicationBootstrap, OnModuleDestroy, ExecutionContext } from '@nestjs/common';
3
- import { U as UserConfig } from '../index-Dyf4ttwU.js';
3
+ import { U as UserConfig } from '../index-BsptKWwz.js';
4
4
  import 'ts-morph';
5
5
 
6
6
  /**
@@ -2347,12 +2347,18 @@ function bindDiscoveryContext(project, cwd, tsconfigPath, tsconfig = loadDiscove
2347
2347
  }
2348
2348
  function extractRoutesFrom(project, controllerPaths) {
2349
2349
  const routes = [];
2350
- for (const path of controllerPaths) {
2350
+ for (const path of byPath([...controllerPaths])) {
2351
2351
  const sourceFile = project.getSourceFile(path);
2352
2352
  if (sourceFile) routes.push(...extractFromSourceFile(sourceFile, project));
2353
2353
  }
2354
2354
  return routes;
2355
2355
  }
2356
+ function byPath(items, path = String) {
2357
+ return [...items].sort((a, b) => {
2358
+ const [x, y] = [path(a), path(b)];
2359
+ return x < y ? -1 : x > y ? 1 : 0;
2360
+ });
2361
+ }
2356
2362
  var PersistentDiscovery = class _PersistentDiscovery {
2357
2363
  project;
2358
2364
  cwd;
@@ -3083,6 +3089,7 @@ function mergeExclusive(target, incoming, {
3083
3089
  }
3084
3090
  function createExtensionContext(config, getRoutes, trackedInputs) {
3085
3091
  let project;
3092
+ let tsconfigProject;
3086
3093
  return {
3087
3094
  cwd: config.codegen.cwd,
3088
3095
  outDir: config.codegen.outDir,
@@ -3107,6 +3114,14 @@ function createExtensionContext(config, getRoutes, trackedInputs) {
3107
3114
  });
3108
3115
  }
3109
3116
  return project;
3117
+ },
3118
+ tsconfigProject() {
3119
+ if (!tsconfigProject) {
3120
+ tsconfigProject = createDiscoveryProject(
3121
+ resolveTsconfigPath(config.codegen.cwd, config.app?.tsconfig ?? void 0)
3122
+ );
3123
+ }
3124
+ return tsconfigProject;
3110
3125
  }
3111
3126
  };
3112
3127
  }
@@ -5001,7 +5016,7 @@ async function watch(config, onChange, options = {}) {
5001
5016
  }
5002
5017
 
5003
5018
  // src/index.ts
5004
- var VERSION = "0.21.1";
5019
+ var VERSION = "0.22.1";
5005
5020
 
5006
5021
  // src/generate-manifest.ts
5007
5022
  var MANIFEST_FILE = ".codegen-manifest.json";