@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.
@@ -2370,12 +2370,18 @@ function bindDiscoveryContext(project, cwd, tsconfigPath, tsconfig = loadDiscove
2370
2370
  }
2371
2371
  function extractRoutesFrom(project, controllerPaths) {
2372
2372
  const routes = [];
2373
- for (const path of controllerPaths) {
2373
+ for (const path of byPath([...controllerPaths])) {
2374
2374
  const sourceFile = project.getSourceFile(path);
2375
2375
  if (sourceFile) routes.push(...extractFromSourceFile(sourceFile, project));
2376
2376
  }
2377
2377
  return routes;
2378
2378
  }
2379
+ function byPath(items, path = String) {
2380
+ return [...items].sort((a, b) => {
2381
+ const [x, y] = [path(a), path(b)];
2382
+ return x < y ? -1 : x > y ? 1 : 0;
2383
+ });
2384
+ }
2379
2385
  var PersistentDiscovery = class _PersistentDiscovery {
2380
2386
  project;
2381
2387
  cwd;
@@ -3106,6 +3112,7 @@ function mergeExclusive(target, incoming, {
3106
3112
  }
3107
3113
  function createExtensionContext(config, getRoutes, trackedInputs) {
3108
3114
  let project;
3115
+ let tsconfigProject;
3109
3116
  return {
3110
3117
  cwd: config.codegen.cwd,
3111
3118
  outDir: config.codegen.outDir,
@@ -3130,6 +3137,14 @@ function createExtensionContext(config, getRoutes, trackedInputs) {
3130
3137
  });
3131
3138
  }
3132
3139
  return project;
3140
+ },
3141
+ tsconfigProject() {
3142
+ if (!tsconfigProject) {
3143
+ tsconfigProject = createDiscoveryProject(
3144
+ resolveTsconfigPath(config.codegen.cwd, config.app?.tsconfig ?? void 0)
3145
+ );
3146
+ }
3147
+ return tsconfigProject;
3133
3148
  }
3134
3149
  };
3135
3150
  }
@@ -5024,7 +5039,7 @@ async function watch(config, onChange, options = {}) {
5024
5039
  }
5025
5040
 
5026
5041
  // src/index.ts
5027
- var VERSION = "0.21.1";
5042
+ var VERSION = "0.22.1";
5028
5043
 
5029
5044
  // src/generate-manifest.ts
5030
5045
  var MANIFEST_FILE = ".codegen-manifest.json";