@dudousxd/nestjs-codegen 0.17.2 → 0.18.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 +26 -0
- package/dist/cli/main.cjs +41 -11
- package/dist/cli/main.cjs.map +1 -1
- package/dist/cli/main.js +41 -11
- 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-DCF9QSPY.d.cts → index-Dyf4ttwU.d.cts} +24 -1
- package/dist/{index-DCF9QSPY.d.ts → index-Dyf4ttwU.d.ts} +24 -1
- package/dist/index.cjs +41 -11
- 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 +41 -11
- package/dist/index.js.map +1 -1
- package/dist/nest/index.cjs +41 -11
- 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 +41 -11
- package/dist/nest/index.js.map +1 -1
- package/package.json +1 -1
package/dist/nest/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _nestjs_common from '@nestjs/common';
|
|
2
2
|
import { DynamicModule, OnApplicationBootstrap, OnModuleDestroy, ExecutionContext } from '@nestjs/common';
|
|
3
|
-
import { U as UserConfig } from '../index-
|
|
3
|
+
import { U as UserConfig } from '../index-Dyf4ttwU.cjs';
|
|
4
4
|
import 'ts-morph';
|
|
5
5
|
|
|
6
6
|
/**
|
package/dist/nest/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as _nestjs_common from '@nestjs/common';
|
|
2
2
|
import { DynamicModule, OnApplicationBootstrap, OnModuleDestroy, ExecutionContext } from '@nestjs/common';
|
|
3
|
-
import { U as UserConfig } from '../index-
|
|
3
|
+
import { U as UserConfig } from '../index-Dyf4ttwU.js';
|
|
4
4
|
import 'ts-morph';
|
|
5
5
|
|
|
6
6
|
/**
|
package/dist/nest/index.js
CHANGED
|
@@ -3316,23 +3316,52 @@ function resolveInheritedMethods(cls) {
|
|
|
3316
3316
|
const returnedClass = resolveReturnedClass(factoryDecl);
|
|
3317
3317
|
if (!returnedClass) return void 0;
|
|
3318
3318
|
const classArgs = [];
|
|
3319
|
+
const namedClassArgs = {};
|
|
3319
3320
|
for (const arg of expr.getArguments()) {
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3321
|
+
const positional = resolveClassReference(arg);
|
|
3322
|
+
if (positional) {
|
|
3323
|
+
classArgs.push(positional);
|
|
3324
|
+
continue;
|
|
3325
|
+
}
|
|
3326
|
+
if (!Node5.isObjectLiteralExpression(arg)) continue;
|
|
3327
|
+
for (const prop of arg.getProperties()) {
|
|
3328
|
+
const named = resolvePropertyClassReference(prop);
|
|
3329
|
+
if (!named) continue;
|
|
3330
|
+
namedClassArgs[named.key] ??= named.ref;
|
|
3327
3331
|
}
|
|
3328
3332
|
}
|
|
3329
3333
|
return {
|
|
3330
3334
|
methods: returnedClass.getMethods(),
|
|
3331
3335
|
factoryName: callee.getText(),
|
|
3332
3336
|
factoryFilePath: factoryDecl.getSourceFile().getFilePath(),
|
|
3333
|
-
classArgs
|
|
3337
|
+
classArgs,
|
|
3338
|
+
namedClassArgs
|
|
3334
3339
|
};
|
|
3335
3340
|
}
|
|
3341
|
+
function resolveClassReference(node) {
|
|
3342
|
+
const expr = unwrapExpression(node);
|
|
3343
|
+
if (!Node5.isIdentifier(expr)) return void 0;
|
|
3344
|
+
const decl = expr.getDefinitions().map((d) => d.getDeclarationNode()).find((n) => n !== void 0 && Node5.isClassDeclaration(n));
|
|
3345
|
+
if (!decl) return void 0;
|
|
3346
|
+
return {
|
|
3347
|
+
name: decl.getName() ?? expr.getText(),
|
|
3348
|
+
filePath: decl.getSourceFile().getFilePath()
|
|
3349
|
+
};
|
|
3350
|
+
}
|
|
3351
|
+
function resolvePropertyClassReference(prop) {
|
|
3352
|
+
if (Node5.isShorthandPropertyAssignment(prop)) {
|
|
3353
|
+
const ref2 = resolveClassReference(prop.getNameNode());
|
|
3354
|
+
return ref2 ? { key: prop.getName(), ref: ref2 } : void 0;
|
|
3355
|
+
}
|
|
3356
|
+
if (!Node5.isPropertyAssignment(prop)) return void 0;
|
|
3357
|
+
const init = prop.getInitializer();
|
|
3358
|
+
if (!init) return void 0;
|
|
3359
|
+
const ref = resolveClassReference(init);
|
|
3360
|
+
if (!ref) return void 0;
|
|
3361
|
+
const nameNode = prop.getNameNode();
|
|
3362
|
+
const key = Node5.isStringLiteral(nameNode) ? nameNode.getLiteralValue() : prop.getName();
|
|
3363
|
+
return { key, ref };
|
|
3364
|
+
}
|
|
3336
3365
|
var mixinTypeProject;
|
|
3337
3366
|
function getMixinTypeProject() {
|
|
3338
3367
|
mixinTypeProject ??= new Project3({
|
|
@@ -3362,7 +3391,7 @@ function resolveInstantiatedReturnType(cls, methodName) {
|
|
|
3362
3391
|
|
|
3363
3392
|
// src/discovery/filter-for.ts
|
|
3364
3393
|
function resolveMixinEntityClass(mixin, project) {
|
|
3365
|
-
const entityArg = mixin?.classArgs[0];
|
|
3394
|
+
const entityArg = mixin?.namedClassArgs?.entity ?? mixin?.classArgs[0];
|
|
3366
3395
|
if (!entityArg) return void 0;
|
|
3367
3396
|
const file = project.getSourceFile(entityArg.filePath) ?? project.addSourceFileAtPathIfExists(entityArg.filePath);
|
|
3368
3397
|
return file?.getClass(entityArg.name);
|
|
@@ -4595,7 +4624,8 @@ function extractFromSourceFile(sourceFile, project) {
|
|
|
4595
4624
|
const mixinBinding = inherited ? {
|
|
4596
4625
|
factoryName: inherited.factoryName,
|
|
4597
4626
|
factoryFilePath: inherited.factoryFilePath,
|
|
4598
|
-
classArgs: inherited.classArgs
|
|
4627
|
+
classArgs: inherited.classArgs,
|
|
4628
|
+
namedClassArgs: inherited.namedClassArgs
|
|
4599
4629
|
} : void 0;
|
|
4600
4630
|
const ownMethods = cls.getMethods();
|
|
4601
4631
|
const ownNames = new Set(ownMethods.map((m) => m.getName()));
|
|
@@ -4827,7 +4857,7 @@ async function watch(config, onChange, options = {}) {
|
|
|
4827
4857
|
}
|
|
4828
4858
|
|
|
4829
4859
|
// src/index.ts
|
|
4830
|
-
var VERSION = "0.
|
|
4860
|
+
var VERSION = "0.18.0";
|
|
4831
4861
|
|
|
4832
4862
|
// src/generate-manifest.ts
|
|
4833
4863
|
var MANIFEST_FILE = ".codegen-manifest.json";
|