@nestjs/schematics 10.1.1 → 10.1.2
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.
|
@@ -22,17 +22,17 @@
|
|
|
22
22
|
},
|
|
23
23
|
"devDependencies": {
|
|
24
24
|
"@nestjs/testing": "^10.0.0",
|
|
25
|
-
"@babel/core": "7.
|
|
26
|
-
"@babel/node": "7.
|
|
27
|
-
"@babel/plugin-proposal-decorators": "7.
|
|
28
|
-
"@babel/plugin-transform-runtime": "7.
|
|
29
|
-
"@babel/preset-env": "7.
|
|
30
|
-
"@babel/register": "7.
|
|
31
|
-
"@babel/runtime": "7.
|
|
25
|
+
"@babel/core": "7.24.7",
|
|
26
|
+
"@babel/node": "7.24.7",
|
|
27
|
+
"@babel/plugin-proposal-decorators": "7.24.7",
|
|
28
|
+
"@babel/plugin-transform-runtime": "7.24.7",
|
|
29
|
+
"@babel/preset-env": "7.24.7",
|
|
30
|
+
"@babel/register": "7.24.6",
|
|
31
|
+
"@babel/runtime": "7.24.7",
|
|
32
32
|
"jest": "29.7.0",
|
|
33
|
-
"nodemon": "3.
|
|
34
|
-
"prettier": "3.2
|
|
35
|
-
"supertest": "
|
|
33
|
+
"nodemon": "3.1.4",
|
|
34
|
+
"prettier": "3.3.2",
|
|
35
|
+
"supertest": "7.0.0"
|
|
36
36
|
},
|
|
37
37
|
"jest": {
|
|
38
38
|
"moduleFileExtensions": [
|
|
@@ -34,15 +34,15 @@
|
|
|
34
34
|
"@types/jest": "^29.5.2",
|
|
35
35
|
"@types/node": "^20.3.1",
|
|
36
36
|
"@types/supertest": "^6.0.0",
|
|
37
|
-
"@typescript-eslint/eslint-plugin": "^
|
|
38
|
-
"@typescript-eslint/parser": "^
|
|
37
|
+
"@typescript-eslint/eslint-plugin": "^7.0.0",
|
|
38
|
+
"@typescript-eslint/parser": "^7.0.0",
|
|
39
39
|
"eslint": "^8.42.0",
|
|
40
40
|
"eslint-config-prettier": "^9.0.0",
|
|
41
41
|
"eslint-plugin-prettier": "^5.0.0",
|
|
42
42
|
"jest": "^29.5.0",
|
|
43
43
|
"prettier": "^3.0.0",
|
|
44
44
|
"source-map-support": "^0.5.21",
|
|
45
|
-
"supertest": "^
|
|
45
|
+
"supertest": "^7.0.0",
|
|
46
46
|
"ts-jest": "^29.1.0",
|
|
47
47
|
"ts-loader": "^9.4.3",
|
|
48
48
|
"ts-node": "^10.9.1",
|
|
@@ -3,7 +3,7 @@ export declare class MetadataManager {
|
|
|
3
3
|
private content;
|
|
4
4
|
constructor(content: string);
|
|
5
5
|
insert(metadata: string, symbol: string, staticOptions?: DeclarationOptions['staticOptions']): string | undefined;
|
|
6
|
-
private
|
|
6
|
+
private findFirstDecoratorMetadata;
|
|
7
7
|
private getSourceNodes;
|
|
8
8
|
private insertMetadataToEmptyModuleDecorator;
|
|
9
9
|
private insertNewMetadataToDecorator;
|
|
@@ -8,12 +8,11 @@ class MetadataManager {
|
|
|
8
8
|
}
|
|
9
9
|
insert(metadata, symbol, staticOptions) {
|
|
10
10
|
const source = (0, typescript_1.createSourceFile)('filename.ts', this.content, typescript_1.ScriptTarget.ES2017);
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
if (!node) {
|
|
11
|
+
const moduleDecoratorNode = this.findFirstDecoratorMetadata(source, 'Module');
|
|
12
|
+
if (!moduleDecoratorNode) {
|
|
14
13
|
return;
|
|
15
14
|
}
|
|
16
|
-
const matchingProperties =
|
|
15
|
+
const matchingProperties = moduleDecoratorNode.properties
|
|
17
16
|
.filter((prop) => prop.kind === typescript_1.SyntaxKind.PropertyAssignment)
|
|
18
17
|
.filter((prop) => {
|
|
19
18
|
const name = prop.name;
|
|
@@ -31,7 +30,7 @@ class MetadataManager {
|
|
|
31
30
|
symbol = staticOptions ? this.addBlankLines(symbol) : symbol;
|
|
32
31
|
};
|
|
33
32
|
if (matchingProperties.length === 0) {
|
|
34
|
-
const expr =
|
|
33
|
+
const expr = moduleDecoratorNode;
|
|
35
34
|
if (expr.properties.length === 0) {
|
|
36
35
|
addBlankLinesIfDynamic();
|
|
37
36
|
return this.insertMetadataToEmptyModuleDecorator(expr, metadata, symbol);
|
|
@@ -45,14 +44,26 @@ class MetadataManager {
|
|
|
45
44
|
return this.insertSymbolToMetadata(source, matchingProperties, symbol, staticOptions);
|
|
46
45
|
}
|
|
47
46
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
expr
|
|
55
|
-
|
|
47
|
+
findFirstDecoratorMetadata(source, identifier) {
|
|
48
|
+
for (const node of this.getSourceNodes(source)) {
|
|
49
|
+
const isDecoratorFactoryNode = node.kind === typescript_1.SyntaxKind.Decorator &&
|
|
50
|
+
node.expression.kind === typescript_1.SyntaxKind.CallExpression;
|
|
51
|
+
if (!isDecoratorFactoryNode)
|
|
52
|
+
continue;
|
|
53
|
+
const expr = node.expression;
|
|
54
|
+
const isExpectedExpression = expr.arguments[0]?.kind === typescript_1.SyntaxKind.ObjectLiteralExpression;
|
|
55
|
+
if (!isExpectedExpression)
|
|
56
|
+
continue;
|
|
57
|
+
if (expr.expression.kind === typescript_1.SyntaxKind.Identifier) {
|
|
58
|
+
const escapedText = expr.expression.escapedText;
|
|
59
|
+
const isTargetIdentifier = escapedText
|
|
60
|
+
? escapedText.toLowerCase() === identifier.toLowerCase()
|
|
61
|
+
: true;
|
|
62
|
+
if (isTargetIdentifier) {
|
|
63
|
+
return expr.arguments[0];
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
56
67
|
}
|
|
57
68
|
getSourceNodes(sourceFile) {
|
|
58
69
|
const nodes = [sourceFile];
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nestjs/schematics",
|
|
3
|
-
"version": "10.1.
|
|
3
|
+
"version": "10.1.2",
|
|
4
4
|
"description": "Nest - modern, fast, powerful node.js web framework (@schematics)",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"files": [
|
|
@@ -41,32 +41,32 @@
|
|
|
41
41
|
},
|
|
42
42
|
"homepage": "https://github.com/nestjs/schematics#readme",
|
|
43
43
|
"dependencies": {
|
|
44
|
-
"@angular-devkit/core": "17.
|
|
45
|
-
"@angular-devkit/schematics": "17.
|
|
44
|
+
"@angular-devkit/core": "17.3.8",
|
|
45
|
+
"@angular-devkit/schematics": "17.3.8",
|
|
46
46
|
"comment-json": "4.2.3",
|
|
47
|
-
"jsonc-parser": "3.
|
|
47
|
+
"jsonc-parser": "3.3.1",
|
|
48
48
|
"pluralize": "8.0.0"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
|
-
"@commitlint/cli": "
|
|
52
|
-
"@commitlint/config-angular": "
|
|
51
|
+
"@commitlint/cli": "19.3.0",
|
|
52
|
+
"@commitlint/config-angular": "19.3.0",
|
|
53
53
|
"@types/jest": "29.5.12",
|
|
54
|
-
"@types/node": "20.
|
|
55
|
-
"@typescript-eslint/eslint-plugin": "
|
|
56
|
-
"@typescript-eslint/parser": "
|
|
57
|
-
"
|
|
58
|
-
"eslint": "8.
|
|
54
|
+
"@types/node": "20.14.9",
|
|
55
|
+
"@typescript-eslint/eslint-plugin": "7.15.0",
|
|
56
|
+
"@typescript-eslint/parser": "7.15.0",
|
|
57
|
+
"cpx2": "7.0.1",
|
|
58
|
+
"eslint": "8.57.0",
|
|
59
59
|
"eslint-config-prettier": "9.1.0",
|
|
60
60
|
"eslint-plugin-import": "2.29.1",
|
|
61
|
-
"gulp": "
|
|
61
|
+
"gulp": "5.0.0",
|
|
62
62
|
"gulp-clean": "0.4.0",
|
|
63
|
-
"husky": "9.0.
|
|
63
|
+
"husky": "9.0.11",
|
|
64
64
|
"jest": "29.7.0",
|
|
65
|
-
"nyc": "
|
|
66
|
-
"release-it": "17.
|
|
67
|
-
"ts-jest": "29.1.
|
|
65
|
+
"nyc": "17.0.0",
|
|
66
|
+
"release-it": "17.4.1",
|
|
67
|
+
"ts-jest": "29.1.5",
|
|
68
68
|
"ts-node": "10.9.2",
|
|
69
|
-
"typescript": "5.
|
|
69
|
+
"typescript": "5.5.3"
|
|
70
70
|
},
|
|
71
71
|
"peerDependencies": {
|
|
72
72
|
"typescript": ">=4.8.2"
|