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

14 lines 1.01 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.AddNgModuleProvider = AddNgModuleProvider; const add_provider_to_array_1 = require("../add-provider-to-array"); const get_coerce_array_literal_form_object_literal_1 = require("../get-coerce-array-literal-form-object-literal"); const coerce_imports_1 = require("../ts-morph/coerce-imports"); const get_ng_module_options_object_1 = require("./get-ng-module-options-object"); function AddNgModuleProvider(sourceFile, providerObject, structures = [], overwrite = false) { (0, coerce_imports_1.CoerceImports)(sourceFile, structures); const ngModuleOptions = (0, get_ng_module_options_object_1.GetNgModuleOptionsObject)(sourceFile); const providerArray = (0, get_coerce_array_literal_form_object_literal_1.GetCoerceArrayLiteralFromObjectLiteral)(ngModuleOptions, 'providers'); (0, add_provider_to_array_1.AddProviderToArray)(providerObject, providerArray, overwrite); } //# sourceMappingURL=add-ng-module-provider.js.map