@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
15 lines • 885 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.RemoveNestModuleImport = RemoveNestModuleImport;
const get_coerce_array_literal_form_object_literal_1 = require("../get-coerce-array-literal-form-object-literal");
const get_nest_module_metadata_1 = require("./get-nest-module-metadata");
function RemoveNestModuleImport(sourceFile, options) {
const { moduleName, } = options;
const metadata = (0, get_nest_module_metadata_1.GetNestModuleMetadata)(sourceFile);
const importsArray = (0, get_coerce_array_literal_form_object_literal_1.GetCoerceArrayLiteralFromObjectLiteral)(metadata, 'imports');
const index = importsArray.getElements().findIndex(element => element.getText().trim().startsWith(moduleName));
if (index !== -1) {
importsArray.removeElement(index);
}
}
//# sourceMappingURL=remove-nest-module-import.js.map