@dudousxd/nestjs-codegen 0.8.0 → 0.10.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 +39 -0
- package/README.md +7 -3
- package/dist/cli/main.cjs +16 -5
- package/dist/cli/main.cjs.map +1 -1
- package/dist/cli/main.js +16 -5
- package/dist/cli/main.js.map +1 -1
- package/dist/extension/index.d.cts +1 -1
- package/dist/extension/index.d.ts +1 -1
- package/dist/{index-DgIAN5k5.d.cts → index-CxkGbILp.d.cts} +23 -3
- package/dist/{index-DgIAN5k5.d.ts → index-CxkGbILp.d.ts} +23 -3
- package/dist/index.cjs +16 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +16 -5
- package/dist/index.js.map +1 -1
- package/dist/nest/index.cjs +15 -4
- package/dist/nest/index.cjs.map +1 -1
- package/dist/nest/index.d.cts +1 -1
- package/dist/nest/index.d.ts +1 -1
- package/dist/nest/index.js +15 -4
- package/dist/nest/index.js.map +1 -1
- package/package.json +6 -2
- package/skills/codegen-serialization-output/SKILL.md +148 -0
- package/skills/codegen-setup/SKILL.md +159 -0
package/dist/nest/index.d.cts
CHANGED
package/dist/nest/index.d.ts
CHANGED
package/dist/nest/index.js
CHANGED
|
@@ -95,6 +95,7 @@ function applyDefaults(userConfig, cwd) {
|
|
|
95
95
|
};
|
|
96
96
|
}
|
|
97
97
|
return {
|
|
98
|
+
debug: userConfig.debug ?? false,
|
|
98
99
|
extensions: userConfig.extensions ?? [],
|
|
99
100
|
// Non-null: validateUserConfig() above throws when `validation` is absent.
|
|
100
101
|
validation: resolveAdapter(userConfig.validation),
|
|
@@ -160,6 +161,15 @@ import {
|
|
|
160
161
|
Node as Node2
|
|
161
162
|
} from "ts-morph";
|
|
162
163
|
|
|
164
|
+
// src/util/debug-log.ts
|
|
165
|
+
var debugEnabled = false;
|
|
166
|
+
function setCodegenDebug(enabled) {
|
|
167
|
+
debugEnabled = enabled;
|
|
168
|
+
}
|
|
169
|
+
function debugWarn(message) {
|
|
170
|
+
if (debugEnabled) console.warn(`[nestjs-codegen] ${message}`);
|
|
171
|
+
}
|
|
172
|
+
|
|
163
173
|
// src/discovery/type-ref-resolution.ts
|
|
164
174
|
import { readFileSync } from "fs";
|
|
165
175
|
import { dirname, resolve as resolve2 } from "path";
|
|
@@ -678,7 +688,7 @@ function buildProperty(prop, classFile, ctx) {
|
|
|
678
688
|
ctx.warnedDecorators.add(name);
|
|
679
689
|
const msg = `@${name} is not translatable to a client validation schema and was skipped (server-only validation).`;
|
|
680
690
|
ctx.warnings.push(msg);
|
|
681
|
-
|
|
691
|
+
debugWarn(msg);
|
|
682
692
|
}
|
|
683
693
|
}
|
|
684
694
|
}
|
|
@@ -729,7 +739,7 @@ function buildNestedReference(className, fromFile, ctx, typeArgs = []) {
|
|
|
729
739
|
ctx.warnedDecorators.add(`recursive:${reserved}`);
|
|
730
740
|
const msg = `${className} is a recursive type; the generated schema validates it via a lazy self-reference.`;
|
|
731
741
|
ctx.warnings.push(msg);
|
|
732
|
-
|
|
742
|
+
debugWarn(msg);
|
|
733
743
|
}
|
|
734
744
|
return { kind: "lazyRef", name: reserved };
|
|
735
745
|
}
|
|
@@ -738,7 +748,7 @@ function buildNestedReference(className, fromFile, ctx, typeArgs = []) {
|
|
|
738
748
|
ctx.warnedDecorators.add(`deep:${className}`);
|
|
739
749
|
const msg = `${className} nesting is too deep to expand; the generated schema uses unknown for it.`;
|
|
740
750
|
ctx.warnings.push(msg);
|
|
741
|
-
|
|
751
|
+
debugWarn(msg);
|
|
742
752
|
}
|
|
743
753
|
return { kind: "unknown", note: "nesting too deep \u2014 not expanded" };
|
|
744
754
|
}
|
|
@@ -879,7 +889,7 @@ function enumSchemaFromDecorator(decorator, classFile, ctx) {
|
|
|
879
889
|
if (!ctx.warnedDecorators.has(`IsEnum:${name}`)) {
|
|
880
890
|
ctx.warnedDecorators.add(`IsEnum:${name}`);
|
|
881
891
|
ctx.warnings.push(msg);
|
|
882
|
-
|
|
892
|
+
debugWarn(msg);
|
|
883
893
|
}
|
|
884
894
|
return { kind: "unknown", note: `@IsEnum(${name}): enum not resolvable to literals` };
|
|
885
895
|
}
|
|
@@ -4178,6 +4188,7 @@ function buildEmpty() {
|
|
|
4178
4188
|
|
|
4179
4189
|
// src/generate.ts
|
|
4180
4190
|
async function generate(config, inputRoutes = []) {
|
|
4191
|
+
setCodegenDebug(config.debug);
|
|
4181
4192
|
const extensions = config.extensions ?? [];
|
|
4182
4193
|
let routes = inputRoutes;
|
|
4183
4194
|
const ctx = createExtensionContext(config, () => routes);
|