UNPKG

@rxap/schematics-ts-morph

Version:

This package provides utilities for manipulating TypeScript code using ts-morph, particularly for Angular and NestJS projects. It offers functions to add, coerce, and modify code elements like classes, methods, decorators, and imports. The package also in

21 lines 1.12 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.GetNestModuleMetadata = GetNestModuleMetadata; const ts_morph_1 = require("ts-morph"); const get_class_decorator_arguments_1 = require("../get-class-decorator-arguments"); const is_nest_module_class_1 = require("./is-nest-module-class"); /** * @deprecated import from @rxap/schematics-ts-morph */ function GetNestModuleMetadata(sourceFile) { const classDeclaration = sourceFile.getClass(is_nest_module_class_1.IsNestModuleClass); if (!classDeclaration) { throw new Error(`The sourceFile '${sourceFile.getFilePath()}' does not have a NestJs Module class.`); } const [metadata] = (0, get_class_decorator_arguments_1.GetClassDecoratorArguments)(classDeclaration, 'Module'); if (!(metadata.isKind(ts_morph_1.SyntaxKind.ObjectLiteralExpression))) { throw new Error(`The NestJs Module class in the sourceFile '${sourceFile.getFilePath()}' does not have the @Module decorator with a metadata object literal expression.`); } return metadata; } //# sourceMappingURL=get-nest-module-metadata.js.map