@dudousxd/nestjs-codegen 0.22.0 → 0.23.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.cjs CHANGED
@@ -1401,6 +1401,7 @@ function classifyTypeKeyword(raw) {
1401
1401
  function markNullable(r, nullable) {
1402
1402
  return nullable ? { ...r, nullable: true } : r;
1403
1403
  }
1404
+ var TRANSPARENT_TYPE_BRANDS = /* @__PURE__ */ new Set(["Opt", "Hidden"]);
1404
1405
  function classifyTypeNode(typeNode, sourceFile, project, opts) {
1405
1406
  if (import_ts_morph4.Node.isUnionTypeNode(typeNode)) {
1406
1407
  let nullable = false;
@@ -1459,6 +1460,11 @@ function classifyTypeNode(typeNode, sourceFile, project, opts) {
1459
1460
  const refName = typeNode.getTypeName().getText();
1460
1461
  if (refName === "Date") return { kind: "date" };
1461
1462
  if (refName === "Record" || refName === "Object") return { kind: "json" };
1463
+ const unwrapped = TRANSPARENT_TYPE_BRANDS.has(refName) ? typeNode.getTypeArguments()[0] : void 0;
1464
+ if (unwrapped) {
1465
+ const inner = classifyTypeNode(unwrapped, sourceFile, project, opts);
1466
+ return inner;
1467
+ }
1462
1468
  const typeRef = opts?.resolveRef?.(refName) ?? null;
1463
1469
  const en = resolveEnumValues(refName, sourceFile, project);
1464
1470
  if (en) {
@@ -2786,7 +2792,7 @@ function bindDiscoveryContext(project, cwd, tsconfigPath, tsconfig = loadDiscove
2786
2792
  }
2787
2793
  function extractRoutesFrom(project, controllerPaths) {
2788
2794
  const routes = [];
2789
- for (const path of controllerPaths) {
2795
+ for (const path of byPath([...controllerPaths])) {
2790
2796
  const sourceFile = project.getSourceFile(path);
2791
2797
  if (sourceFile) routes.push(...extractFromSourceFile(sourceFile, project));
2792
2798
  }
@@ -2794,11 +2800,17 @@ function extractRoutesFrom(project, controllerPaths) {
2794
2800
  }
2795
2801
  function extractAllRoutes(project) {
2796
2802
  const routes = [];
2797
- for (const sourceFile of project.getSourceFiles()) {
2803
+ for (const sourceFile of byPath(project.getSourceFiles(), (f) => f.getFilePath())) {
2798
2804
  routes.push(...extractFromSourceFile(sourceFile, project));
2799
2805
  }
2800
2806
  return routes;
2801
2807
  }
2808
+ function byPath(items, path = String) {
2809
+ return [...items].sort((a, b) => {
2810
+ const [x, y] = [path(a), path(b)];
2811
+ return x < y ? -1 : x > y ? 1 : 0;
2812
+ });
2813
+ }
2802
2814
  var PersistentDiscovery = class _PersistentDiscovery {
2803
2815
  project;
2804
2816
  cwd;
@@ -5365,7 +5377,7 @@ function createChainModuleRenderer(opts) {
5365
5377
  }
5366
5378
 
5367
5379
  // src/index.ts
5368
- var VERSION = "0.22.0";
5380
+ var VERSION = "0.23.0";
5369
5381
  // Annotate the CommonJS export names for ESM import in node:
5370
5382
  0 && (module.exports = {
5371
5383
  CodegenError,