@rxap/ts-morph
Version:
Provides utilities for manipulating TypeScript code using the ts-morph library. It offers a fluent API to add, modify, and remove code elements such as classes, decorators, imports, and properties in both Angular and NestJS projects. This package simplifi
18 lines • 1.06 kB
JavaScript
;
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");
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