@dudousxd/nestjs-codegen 0.17.0 → 0.17.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.
- package/CHANGELOG.md +23 -0
- package/dist/cli/main.cjs +20 -5
- package/dist/cli/main.cjs.map +1 -1
- package/dist/cli/main.js +20 -5
- package/dist/cli/main.js.map +1 -1
- package/dist/index.cjs +20 -5
- 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 +20 -5
- package/dist/index.js.map +1 -1
- package/dist/nest/index.cjs +20 -5
- package/dist/nest/index.cjs.map +1 -1
- package/dist/nest/index.js +20 -5
- package/dist/nest/index.js.map +1 -1
- package/package.json +1 -1
package/dist/cli/main.js
CHANGED
|
@@ -4184,6 +4184,19 @@ function resolveParamClass(method, decoratorName, sourceFile, project) {
|
|
|
4184
4184
|
|
|
4185
4185
|
// src/discovery/heritage.ts
|
|
4186
4186
|
import { Node as Node7, Project as Project3 } from "ts-morph";
|
|
4187
|
+
function resolveHeritageCall(node) {
|
|
4188
|
+
if (!node) return void 0;
|
|
4189
|
+
const expr = unwrapExpression(node);
|
|
4190
|
+
if (Node7.isCallExpression(expr)) return expr;
|
|
4191
|
+
if (!Node7.isIdentifier(expr)) return void 0;
|
|
4192
|
+
const decl = expr.getDefinitions().map((d) => d.getDeclarationNode()).find(
|
|
4193
|
+
(n) => n !== void 0 && Node7.isVariableDeclaration(n)
|
|
4194
|
+
);
|
|
4195
|
+
const init = decl?.getInitializer();
|
|
4196
|
+
if (!init) return void 0;
|
|
4197
|
+
const unwrapped = unwrapExpression(init);
|
|
4198
|
+
return Node7.isCallExpression(unwrapped) ? unwrapped : void 0;
|
|
4199
|
+
}
|
|
4187
4200
|
function unwrapExpression(node) {
|
|
4188
4201
|
let current = node;
|
|
4189
4202
|
while (Node7.isAsExpression(current) || Node7.isSatisfiesExpression(current) || Node7.isParenthesizedExpression(current) || Node7.isTypeAssertion(current)) {
|
|
@@ -4211,8 +4224,8 @@ function resolveReturnedClass(factoryDecl) {
|
|
|
4211
4224
|
return void 0;
|
|
4212
4225
|
}
|
|
4213
4226
|
function resolveInheritedMethods(cls) {
|
|
4214
|
-
const expr = cls.getExtends()?.getExpression();
|
|
4215
|
-
if (!expr
|
|
4227
|
+
const expr = resolveHeritageCall(cls.getExtends()?.getExpression());
|
|
4228
|
+
if (!expr) return void 0;
|
|
4216
4229
|
const callee = expr.getExpression();
|
|
4217
4230
|
if (!Node7.isIdentifier(callee)) return void 0;
|
|
4218
4231
|
const factoryDecl = callee.getDefinitions().map((d) => d.getDeclarationNode()).find((n) => Node7.isFunctionDeclaration(n));
|
|
@@ -4767,9 +4780,11 @@ function extractFromSourceFile(sourceFile, project) {
|
|
|
4767
4780
|
factoryFilePath: inherited.factoryFilePath,
|
|
4768
4781
|
classArgs: inherited.classArgs
|
|
4769
4782
|
} : void 0;
|
|
4783
|
+
const ownMethods = cls.getMethods();
|
|
4784
|
+
const ownNames = new Set(ownMethods.map((m) => m.getName()));
|
|
4770
4785
|
const methods = [
|
|
4771
|
-
...
|
|
4772
|
-
...(inherited?.methods ?? []).map((method) => ({ method, mixin: mixinBinding }))
|
|
4786
|
+
...ownMethods.map((method) => ({ method, mixin: mixinBinding })),
|
|
4787
|
+
...(inherited?.methods ?? []).filter((method) => !ownNames.has(method.getName())).map((method) => ({ method, mixin: mixinBinding }))
|
|
4773
4788
|
];
|
|
4774
4789
|
for (const { method, mixin } of methods) {
|
|
4775
4790
|
const verb = resolveVerb(method);
|
|
@@ -4995,7 +5010,7 @@ async function watch(config, onChange, options = {}) {
|
|
|
4995
5010
|
}
|
|
4996
5011
|
|
|
4997
5012
|
// src/index.ts
|
|
4998
|
-
var VERSION = "0.17.
|
|
5013
|
+
var VERSION = "0.17.1";
|
|
4999
5014
|
|
|
5000
5015
|
// src/cli/codegen.ts
|
|
5001
5016
|
async function runCodegen(opts = {}) {
|