@nestjs/schematics
Advanced tools
Comparing version 10.1.1 to 10.1.2
@@ -25,13 +25,13 @@ { | ||
"@nestjs/testing": "^10.0.0", | ||
"@babel/core": "7.23.9", | ||
"@babel/node": "7.23.9", | ||
"@babel/plugin-proposal-decorators": "7.23.9", | ||
"@babel/plugin-transform-runtime": "7.23.9", | ||
"@babel/preset-env": "7.23.9", | ||
"@babel/register": "7.23.7", | ||
"@babel/runtime": "7.23.9", | ||
"@babel/core": "7.24.7", | ||
"@babel/node": "7.24.7", | ||
"@babel/plugin-proposal-decorators": "7.24.7", | ||
"@babel/plugin-transform-runtime": "7.24.7", | ||
"@babel/preset-env": "7.24.7", | ||
"@babel/register": "7.24.6", | ||
"@babel/runtime": "7.24.7", | ||
"jest": "29.7.0", | ||
"nodemon": "3.0.3", | ||
"prettier": "3.2.5", | ||
"supertest": "6.3.4" | ||
"nodemon": "3.1.4", | ||
"prettier": "3.3.2", | ||
"supertest": "7.0.0" | ||
}, | ||
@@ -38,0 +38,0 @@ "jest": { |
@@ -37,4 +37,4 @@ { | ||
"@types/supertest": "^6.0.0", | ||
"@typescript-eslint/eslint-plugin": "^6.0.0", | ||
"@typescript-eslint/parser": "^6.0.0", | ||
"@typescript-eslint/eslint-plugin": "^7.0.0", | ||
"@typescript-eslint/parser": "^7.0.0", | ||
"eslint": "^8.42.0", | ||
@@ -46,3 +46,3 @@ "eslint-config-prettier": "^9.0.0", | ||
"source-map-support": "^0.5.21", | ||
"supertest": "^6.3.3", | ||
"supertest": "^7.0.0", | ||
"ts-jest": "^29.1.0", | ||
@@ -49,0 +49,0 @@ "ts-loader": "^9.4.3", |
@@ -6,3 +6,3 @@ import { DeclarationOptions } from './module.declarator'; | ||
insert(metadata: string, symbol: string, staticOptions?: DeclarationOptions['staticOptions']): string | undefined; | ||
private getDecoratorMetadata; | ||
private findFirstDecoratorMetadata; | ||
private getSourceNodes; | ||
@@ -9,0 +9,0 @@ private insertMetadataToEmptyModuleDecorator; |
@@ -11,8 +11,7 @@ "use strict"; | ||
const source = (0, typescript_1.createSourceFile)('filename.ts', this.content, typescript_1.ScriptTarget.ES2017); | ||
const decoratorNodes = this.getDecoratorMetadata(source, '@Module'); | ||
const node = decoratorNodes[0]; | ||
if (!node) { | ||
const moduleDecoratorNode = this.findFirstDecoratorMetadata(source, 'Module'); | ||
if (!moduleDecoratorNode) { | ||
return; | ||
} | ||
const matchingProperties = node.properties | ||
const matchingProperties = moduleDecoratorNode.properties | ||
.filter((prop) => prop.kind === typescript_1.SyntaxKind.PropertyAssignment) | ||
@@ -35,3 +34,3 @@ .filter((prop) => { | ||
if (matchingProperties.length === 0) { | ||
const expr = node; | ||
const expr = moduleDecoratorNode; | ||
if (expr.properties.length === 0) { | ||
@@ -50,10 +49,22 @@ addBlankLinesIfDynamic(); | ||
} | ||
getDecoratorMetadata(source, identifier) { | ||
return this.getSourceNodes(source) | ||
.filter((node) => node.kind === typescript_1.SyntaxKind.Decorator && | ||
node.expression.kind === typescript_1.SyntaxKind.CallExpression) | ||
.map((node) => node.expression) | ||
.filter((expr) => expr.arguments[0] && | ||
expr.arguments[0].kind === typescript_1.SyntaxKind.ObjectLiteralExpression) | ||
.map((expr) => expr.arguments[0]); | ||
findFirstDecoratorMetadata(source, identifier) { | ||
for (const node of this.getSourceNodes(source)) { | ||
const isDecoratorFactoryNode = node.kind === typescript_1.SyntaxKind.Decorator && | ||
node.expression.kind === typescript_1.SyntaxKind.CallExpression; | ||
if (!isDecoratorFactoryNode) | ||
continue; | ||
const expr = node.expression; | ||
const isExpectedExpression = expr.arguments[0]?.kind === typescript_1.SyntaxKind.ObjectLiteralExpression; | ||
if (!isExpectedExpression) | ||
continue; | ||
if (expr.expression.kind === typescript_1.SyntaxKind.Identifier) { | ||
const escapedText = expr.expression.escapedText; | ||
const isTargetIdentifier = escapedText | ||
? escapedText.toLowerCase() === identifier.toLowerCase() | ||
: true; | ||
if (isTargetIdentifier) { | ||
return expr.arguments[0]; | ||
} | ||
} | ||
} | ||
} | ||
@@ -60,0 +71,0 @@ getSourceNodes(sourceFile) { |
{ | ||
"name": "@nestjs/schematics", | ||
"version": "10.1.1", | ||
"version": "10.1.2", | ||
"description": "Nest - modern, fast, powerful node.js web framework (@schematics)", | ||
@@ -44,28 +44,28 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"@angular-devkit/core": "17.1.2", | ||
"@angular-devkit/schematics": "17.1.2", | ||
"@angular-devkit/core": "17.3.8", | ||
"@angular-devkit/schematics": "17.3.8", | ||
"comment-json": "4.2.3", | ||
"jsonc-parser": "3.2.1", | ||
"jsonc-parser": "3.3.1", | ||
"pluralize": "8.0.0" | ||
}, | ||
"devDependencies": { | ||
"@commitlint/cli": "18.6.0", | ||
"@commitlint/config-angular": "18.6.0", | ||
"@commitlint/cli": "19.3.0", | ||
"@commitlint/config-angular": "19.3.0", | ||
"@types/jest": "29.5.12", | ||
"@types/node": "20.11.16", | ||
"@typescript-eslint/eslint-plugin": "6.21.0", | ||
"@typescript-eslint/parser": "6.21.0", | ||
"cpx": "1.5.0", | ||
"eslint": "8.56.0", | ||
"@types/node": "20.14.9", | ||
"@typescript-eslint/eslint-plugin": "7.15.0", | ||
"@typescript-eslint/parser": "7.15.0", | ||
"cpx2": "7.0.1", | ||
"eslint": "8.57.0", | ||
"eslint-config-prettier": "9.1.0", | ||
"eslint-plugin-import": "2.29.1", | ||
"gulp": "4.0.2", | ||
"gulp": "5.0.0", | ||
"gulp-clean": "0.4.0", | ||
"husky": "9.0.10", | ||
"husky": "9.0.11", | ||
"jest": "29.7.0", | ||
"nyc": "15.1.0", | ||
"release-it": "17.0.3", | ||
"ts-jest": "29.1.2", | ||
"nyc": "17.0.0", | ||
"release-it": "17.4.1", | ||
"ts-jest": "29.1.5", | ||
"ts-node": "10.9.2", | ||
"typescript": "5.3.3" | ||
"typescript": "5.5.3" | ||
}, | ||
@@ -72,0 +72,0 @@ "peerDependencies": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
190385
4772
+ Added@angular-devkit/core@17.3.8(transitive)
+ Added@angular-devkit/schematics@17.3.8(transitive)
+ Addedjsonc-parser@3.3.1(transitive)
+ Addedmagic-string@0.30.8(transitive)
+ Addedpicomatch@4.0.1(transitive)
- Removed@angular-devkit/core@17.1.2(transitive)
- Removed@angular-devkit/schematics@17.1.2(transitive)
- Removedjsonc-parser@3.2.0(transitive)
- Removedmagic-string@0.30.5(transitive)
- Removedpicomatch@3.0.1(transitive)
Updated@angular-devkit/core@17.3.8
Updatedjsonc-parser@3.3.1