Comparing version 1.6.1 to 2.0.0
import { ClassDeclaration } from 'ts-morph'; | ||
export declare function pushToArrayProperty(classDeclaration: ClassDeclaration, decoratorName: string, propertyName: string, initializer: string): void; | ||
export declare function pushToArrayProperty(classDeclaration: ClassDeclaration, decoratorName: string, propertyName: string, initializer: string, { unique, forceToArray, }?: { | ||
unique?: boolean; | ||
forceToArray?: boolean; | ||
}): void; |
@@ -6,3 +6,4 @@ "use strict"; | ||
const ts_morph_1 = require("ts-morph"); | ||
function pushToArrayProperty(classDeclaration, decoratorName, propertyName, initializer) { | ||
// TODO: investigate how to handle consts in descriptors that don't accept array of array type, like styleUrls | ||
function pushToArrayProperty(classDeclaration, decoratorName, propertyName, initializer, { unique = false, forceToArray = false, } = {}) { | ||
var _a; | ||
@@ -20,2 +21,6 @@ const [decorator] = decorators_1.getDecorators(classDeclaration, { | ||
} | ||
if (forceToArray && | ||
!ts_morph_1.Node.isArrayLiteralExpression(property.getInitializer())) { | ||
property.setInitializer(`[${property.getInitializer().getText()}]`); | ||
} | ||
const importsInitializer = property.getInitializer(); | ||
@@ -25,2 +30,8 @@ if (!ts_morph_1.Node.isArrayLiteralExpression(importsInitializer)) { | ||
} | ||
if (unique && | ||
importsInitializer | ||
.getElements() | ||
.some((element) => element.getText() === initializer)) { | ||
return; | ||
} | ||
importsInitializer.addElement(initializer); | ||
@@ -27,0 +38,0 @@ } |
export * from './helpers/get-bootstrap-fn'; | ||
export * from './helpers/get-main-module'; | ||
export * from './module'; | ||
export * from './component'; | ||
export * from './directive'; |
@@ -7,2 +7,4 @@ "use strict"; | ||
tslib_1.__exportStar(require("./module"), exports); | ||
tslib_1.__exportStar(require("./component"), exports); | ||
tslib_1.__exportStar(require("./directive"), exports); | ||
//# sourceMappingURL=index.js.map |
@@ -1,7 +0,7 @@ | ||
export * from './add-bootstrap-to-module'; | ||
export * from './add-declaration-to-module'; | ||
export * from './add-entry-component-to-module'; | ||
export * from './add-export-to-module'; | ||
export * from './add-import-to-module'; | ||
export * from './add-provider-to-module'; | ||
export * from './add-schema-to-module'; | ||
export * from './add-bootstrap-to-ng-module'; | ||
export * from './add-declaration-to-ng-module'; | ||
export * from './add-entry-component-to-ng-module'; | ||
export * from './add-export-to-ng-module'; | ||
export * from './add-import-to-ng-module'; | ||
export * from './add-provider-to-ng-module'; | ||
export * from './add-schema-to-ng-module'; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
const tslib_1 = require("tslib"); | ||
tslib_1.__exportStar(require("./add-bootstrap-to-module"), exports); | ||
tslib_1.__exportStar(require("./add-declaration-to-module"), exports); | ||
tslib_1.__exportStar(require("./add-entry-component-to-module"), exports); | ||
tslib_1.__exportStar(require("./add-export-to-module"), exports); | ||
tslib_1.__exportStar(require("./add-import-to-module"), exports); | ||
tslib_1.__exportStar(require("./add-provider-to-module"), exports); | ||
tslib_1.__exportStar(require("./add-schema-to-module"), exports); | ||
tslib_1.__exportStar(require("./add-bootstrap-to-ng-module"), exports); | ||
tslib_1.__exportStar(require("./add-declaration-to-ng-module"), exports); | ||
tslib_1.__exportStar(require("./add-entry-component-to-ng-module"), exports); | ||
tslib_1.__exportStar(require("./add-export-to-ng-module"), exports); | ||
tslib_1.__exportStar(require("./add-import-to-ng-module"), exports); | ||
tslib_1.__exportStar(require("./add-provider-to-ng-module"), exports); | ||
tslib_1.__exportStar(require("./add-schema-to-ng-module"), exports); | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "ng-morph", | ||
"version": "1.6.1", | ||
"version": "2.0.0", | ||
"peerDependencies": { | ||
@@ -30,5 +30,5 @@ "@angular-devkit/core": ">=11.0.0", | ||
"repository": "https://github.com/TinkoffCreditSystems/ng-morph", | ||
"homepage": "https://github.com/TinkoffCreditSystems/ng-morph", | ||
"homepage": "https://tinkoffcreditsystems.github.io/ng-morph/", | ||
"main": "src/index.js", | ||
"typings": "src/index.d.ts" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
160925
374
2167
1