@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/cli/main.js CHANGED
@@ -1351,6 +1351,7 @@ function classifyTypeKeyword(raw) {
1351
1351
  function markNullable(r, nullable) {
1352
1352
  return nullable ? { ...r, nullable: true } : r;
1353
1353
  }
1354
+ var TRANSPARENT_TYPE_BRANDS = /* @__PURE__ */ new Set(["Opt", "Hidden"]);
1354
1355
  function classifyTypeNode(typeNode, sourceFile, project, opts) {
1355
1356
  if (Node4.isUnionTypeNode(typeNode)) {
1356
1357
  let nullable = false;
@@ -1409,6 +1410,11 @@ function classifyTypeNode(typeNode, sourceFile, project, opts) {
1409
1410
  const refName = typeNode.getTypeName().getText();
1410
1411
  if (refName === "Date") return { kind: "date" };
1411
1412
  if (refName === "Record" || refName === "Object") return { kind: "json" };
1413
+ const unwrapped = TRANSPARENT_TYPE_BRANDS.has(refName) ? typeNode.getTypeArguments()[0] : void 0;
1414
+ if (unwrapped) {
1415
+ const inner = classifyTypeNode(unwrapped, sourceFile, project, opts);
1416
+ return inner;
1417
+ }
1412
1418
  const typeRef = opts?.resolveRef?.(refName) ?? null;
1413
1419
  const en = resolveEnumValues(refName, sourceFile, project);
1414
1420
  if (en) {
@@ -2736,7 +2742,7 @@ function bindDiscoveryContext(project, cwd, tsconfigPath, tsconfig = loadDiscove
2736
2742
  }
2737
2743
  function extractRoutesFrom(project, controllerPaths) {
2738
2744
  const routes = [];
2739
- for (const path of controllerPaths) {
2745
+ for (const path of byPath([...controllerPaths])) {
2740
2746
  const sourceFile = project.getSourceFile(path);
2741
2747
  if (sourceFile) routes.push(...extractFromSourceFile(sourceFile, project));
2742
2748
  }
@@ -2744,11 +2750,17 @@ function extractRoutesFrom(project, controllerPaths) {
2744
2750
  }
2745
2751
  function extractAllRoutes(project) {
2746
2752
  const routes = [];
2747
- for (const sourceFile of project.getSourceFiles()) {
2753
+ for (const sourceFile of byPath(project.getSourceFiles(), (f) => f.getFilePath())) {
2748
2754
  routes.push(...extractFromSourceFile(sourceFile, project));
2749
2755
  }
2750
2756
  return routes;
2751
2757
  }
2758
+ function byPath(items, path = String) {
2759
+ return [...items].sort((a, b) => {
2760
+ const [x, y] = [path(a), path(b)];
2761
+ return x < y ? -1 : x > y ? 1 : 0;
2762
+ });
2763
+ }
2752
2764
  var PersistentDiscovery = class _PersistentDiscovery {
2753
2765
  project;
2754
2766
  cwd;
@@ -5229,7 +5241,7 @@ async function watch(config, onChange, options = {}) {
5229
5241
  }
5230
5242
 
5231
5243
  // src/index.ts
5232
- var VERSION = "0.22.0";
5244
+ var VERSION = "0.23.0";
5233
5245
 
5234
5246
  // src/cli/codegen.ts
5235
5247
  async function runCodegen(opts = {}) {