@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/CHANGELOG.md +38 -0
- package/dist/cli/main.cjs +15 -3
- package/dist/cli/main.cjs.map +1 -1
- package/dist/cli/main.js +15 -3
- package/dist/cli/main.js.map +1 -1
- package/dist/index.cjs +15 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +15 -3
- package/dist/index.js.map +1 -1
- package/dist/nest/index.cjs +14 -2
- package/dist/nest/index.cjs.map +1 -1
- package/dist/nest/index.js +14 -2
- package/dist/nest/index.js.map +1 -1
- package/package.json +1 -1
package/dist/nest/index.cjs
CHANGED
|
@@ -998,6 +998,7 @@ function classifyTypeKeyword(raw) {
|
|
|
998
998
|
function markNullable(r, nullable) {
|
|
999
999
|
return nullable ? { ...r, nullable: true } : r;
|
|
1000
1000
|
}
|
|
1001
|
+
var TRANSPARENT_TYPE_BRANDS = /* @__PURE__ */ new Set(["Opt", "Hidden"]);
|
|
1001
1002
|
function classifyTypeNode(typeNode, sourceFile, project, opts) {
|
|
1002
1003
|
if (import_ts_morph3.Node.isUnionTypeNode(typeNode)) {
|
|
1003
1004
|
let nullable = false;
|
|
@@ -1056,6 +1057,11 @@ function classifyTypeNode(typeNode, sourceFile, project, opts) {
|
|
|
1056
1057
|
const refName = typeNode.getTypeName().getText();
|
|
1057
1058
|
if (refName === "Date") return { kind: "date" };
|
|
1058
1059
|
if (refName === "Record" || refName === "Object") return { kind: "json" };
|
|
1060
|
+
const unwrapped = TRANSPARENT_TYPE_BRANDS.has(refName) ? typeNode.getTypeArguments()[0] : void 0;
|
|
1061
|
+
if (unwrapped) {
|
|
1062
|
+
const inner = classifyTypeNode(unwrapped, sourceFile, project, opts);
|
|
1063
|
+
return inner;
|
|
1064
|
+
}
|
|
1059
1065
|
const typeRef = opts?.resolveRef?.(refName) ?? null;
|
|
1060
1066
|
const en = resolveEnumValues(refName, sourceFile, project);
|
|
1061
1067
|
if (en) {
|
|
@@ -2370,12 +2376,18 @@ function bindDiscoveryContext(project, cwd, tsconfigPath, tsconfig = loadDiscove
|
|
|
2370
2376
|
}
|
|
2371
2377
|
function extractRoutesFrom(project, controllerPaths) {
|
|
2372
2378
|
const routes = [];
|
|
2373
|
-
for (const path of controllerPaths) {
|
|
2379
|
+
for (const path of byPath([...controllerPaths])) {
|
|
2374
2380
|
const sourceFile = project.getSourceFile(path);
|
|
2375
2381
|
if (sourceFile) routes.push(...extractFromSourceFile(sourceFile, project));
|
|
2376
2382
|
}
|
|
2377
2383
|
return routes;
|
|
2378
2384
|
}
|
|
2385
|
+
function byPath(items, path = String) {
|
|
2386
|
+
return [...items].sort((a, b) => {
|
|
2387
|
+
const [x, y] = [path(a), path(b)];
|
|
2388
|
+
return x < y ? -1 : x > y ? 1 : 0;
|
|
2389
|
+
});
|
|
2390
|
+
}
|
|
2379
2391
|
var PersistentDiscovery = class _PersistentDiscovery {
|
|
2380
2392
|
project;
|
|
2381
2393
|
cwd;
|
|
@@ -5033,7 +5045,7 @@ async function watch(config, onChange, options = {}) {
|
|
|
5033
5045
|
}
|
|
5034
5046
|
|
|
5035
5047
|
// src/index.ts
|
|
5036
|
-
var VERSION = "0.
|
|
5048
|
+
var VERSION = "0.23.0";
|
|
5037
5049
|
|
|
5038
5050
|
// src/generate-manifest.ts
|
|
5039
5051
|
var MANIFEST_FILE = ".codegen-manifest.json";
|