@rxap/schematics-ts-morph 16.0.0-dev.11 → 16.0.0-dev.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +14 -0
- package/README.md +1 -1
- package/package.json +13 -12
- package/src/index.js +144 -141
- package/src/index.js.map +1 -1
- package/src/lib/add-class-method.js +6 -5
- package/src/lib/add-class-method.js.map +1 -1
- package/src/lib/add-dir.js +8 -4
- package/src/lib/add-dir.js.map +1 -1
- package/src/lib/add-fake-provider.js +23 -18
- package/src/lib/add-fake-provider.js.map +1 -1
- package/src/lib/add-method-class.js +20 -14
- package/src/lib/add-method-class.js.map +1 -1
- package/src/lib/add-provider-to-array.js +12 -7
- package/src/lib/add-provider-to-array.js.map +1 -1
- package/src/lib/add-to-array.js +9 -5
- package/src/lib/add-to-array.js.map +1 -1
- package/src/lib/add-variable-fake-provider.js +9 -5
- package/src/lib/add-variable-fake-provider.js.map +1 -1
- package/src/lib/add-variable-provider.js +14 -10
- package/src/lib/add-variable-provider.js.map +1 -1
- package/src/lib/angular/add-component-animations.js +11 -7
- package/src/lib/angular/add-component-animations.js.map +1 -1
- package/src/lib/angular/add-component-fake-provider.js +9 -5
- package/src/lib/angular/add-component-fake-provider.js.map +1 -1
- package/src/lib/angular/add-component-import.js +11 -7
- package/src/lib/angular/add-component-import.js.map +1 -1
- package/src/lib/angular/add-component-input.js +15 -11
- package/src/lib/angular/add-component-input.js.map +1 -1
- package/src/lib/angular/add-component-provider.js +13 -9
- package/src/lib/angular/add-component-provider.js.map +1 -1
- package/src/lib/angular/add-control-validator.js +10 -5
- package/src/lib/angular/add-control-validator.js.map +1 -1
- package/src/lib/angular/add-dependency-injection.d.ts +9 -0
- package/src/lib/angular/add-dependency-injection.js +25 -14
- package/src/lib/angular/add-dependency-injection.js.map +1 -1
- package/src/lib/angular/add-ng-module-export.js +11 -7
- package/src/lib/angular/add-ng-module-export.js.map +1 -1
- package/src/lib/angular/add-ng-module-import.js +11 -7
- package/src/lib/angular/add-ng-module-import.js.map +1 -1
- package/src/lib/angular/add-ng-module-provider.js +13 -9
- package/src/lib/angular/add-ng-module-provider.js.map +1 -1
- package/src/lib/angular/build-angular-base-path.js +12 -8
- package/src/lib/angular/build-angular-base-path.js.map +1 -1
- package/src/lib/angular/coerce-accordion-component.js +9 -5
- package/src/lib/angular/coerce-accordion-component.js.map +1 -1
- package/src/lib/angular/coerce-component-class.js +21 -17
- package/src/lib/angular/coerce-component-class.js.map +1 -1
- package/src/lib/angular/coerce-component.js +38 -40
- package/src/lib/angular/coerce-component.js.map +1 -1
- package/src/lib/angular/coerce-data-source-class.js +35 -27
- package/src/lib/angular/coerce-data-source-class.js.map +1 -1
- package/src/lib/angular/coerce-dialog-component.js +32 -27
- package/src/lib/angular/coerce-dialog-component.js.map +1 -1
- package/src/lib/angular/coerce-dialog-table-action-component.js +39 -35
- package/src/lib/angular/coerce-dialog-table-action-component.js.map +1 -1
- package/src/lib/angular/coerce-dialog-table-action.js +24 -27
- package/src/lib/angular/coerce-dialog-table-action.js.map +1 -1
- package/src/lib/angular/coerce-form-builder-provider.js +20 -15
- package/src/lib/angular/coerce-form-builder-provider.js.map +1 -1
- package/src/lib/angular/coerce-form-component-provider.js +21 -16
- package/src/lib/angular/coerce-form-component-provider.js.map +1 -1
- package/src/lib/angular/coerce-form-definition-control.js +40 -32
- package/src/lib/angular/coerce-form-definition-control.js.map +1 -1
- package/src/lib/angular/coerce-form-definition-type.js +19 -14
- package/src/lib/angular/coerce-form-definition-type.js.map +1 -1
- package/src/lib/angular/coerce-form-definition.js +37 -32
- package/src/lib/angular/coerce-form-definition.js.map +1 -1
- package/src/lib/angular/coerce-form-provider.js +20 -15
- package/src/lib/angular/coerce-form-provider.js.map +1 -1
- package/src/lib/angular/coerce-form-providers-file.js +29 -25
- package/src/lib/angular/coerce-form-providers-file.js.map +1 -1
- package/src/lib/angular/coerce-form-table-action.js +33 -38
- package/src/lib/angular/coerce-form-table-action.js.map +1 -1
- package/src/lib/angular/coerce-method-class.js +26 -21
- package/src/lib/angular/coerce-method-class.js.map +1 -1
- package/src/lib/angular/coerce-navigation-table-action.js +21 -25
- package/src/lib/angular/coerce-navigation-table-action.js.map +1 -1
- package/src/lib/angular/coerce-operation-table-action.js +23 -26
- package/src/lib/angular/coerce-operation-table-action.js.map +1 -1
- package/src/lib/angular/coerce-options-data-source.js +16 -12
- package/src/lib/angular/coerce-options-data-source.js.map +1 -1
- package/src/lib/angular/coerce-project-feature.js +14 -10
- package/src/lib/angular/coerce-project-feature.js.map +1 -1
- package/src/lib/angular/coerce-proxy-remote-method-class.js +29 -24
- package/src/lib/angular/coerce-proxy-remote-method-class.js.map +1 -1
- package/src/lib/angular/coerce-table-action-index-provider.js +12 -8
- package/src/lib/angular/coerce-table-action-index-provider.js.map +1 -1
- package/src/lib/angular/coerce-table-action-index.js +11 -7
- package/src/lib/angular/coerce-table-action-index.js.map +1 -1
- package/src/lib/angular/coerce-table-action-provider.js +24 -19
- package/src/lib/angular/coerce-table-action-provider.js.map +1 -1
- package/src/lib/angular/coerce-table-action.js +36 -41
- package/src/lib/angular/coerce-table-action.js.map +1 -1
- package/src/lib/angular/coerce-table-data-source.js +25 -26
- package/src/lib/angular/coerce-table-data-source.js.map +1 -1
- package/src/lib/angular/coerce-table-header-button-method.js +24 -22
- package/src/lib/angular/coerce-table-header-button-method.js.map +1 -1
- package/src/lib/angular/coerce-table-parameters-from-route.js +22 -18
- package/src/lib/angular/coerce-table-parameters-from-route.js.map +1 -1
- package/src/lib/angular/coerce-table-select-resolve-value-method.js +20 -19
- package/src/lib/angular/coerce-table-select-resolve-value-method.js.map +1 -1
- package/src/lib/angular/coerce-tree-table-children-proxy-remote-method-class.js +19 -22
- package/src/lib/angular/coerce-tree-table-children-proxy-remote-method-class.js.map +1 -1
- package/src/lib/angular/coerce-tree-table-root-proxy-remote-method-class.js +19 -22
- package/src/lib/angular/coerce-tree-table-root-proxy-remote-method-class.js.map +1 -1
- package/src/lib/angular/enforce-use-form-control-order.js +10 -6
- package/src/lib/angular/enforce-use-form-control-order.js.map +1 -1
- package/src/lib/angular/find-component-module-source-file.js +7 -3
- package/src/lib/angular/find-component-module-source-file.js.map +1 -1
- package/src/lib/angular/find-component-source-file.js +7 -3
- package/src/lib/angular/find-component-source-file.js.map +1 -1
- package/src/lib/angular/find-routing-module.js +9 -4
- package/src/lib/angular/find-routing-module.js.map +1 -1
- package/src/lib/angular/form-definition-utilities.js +19 -11
- package/src/lib/angular/form-definition-utilities.js.map +1 -1
- package/src/lib/angular/get-component-class.js +5 -1
- package/src/lib/angular/get-component-class.js.map +1 -1
- package/src/lib/angular/get-component-options-object.js +8 -4
- package/src/lib/angular/get-component-options-object.js.map +1 -1
- package/src/lib/angular/get-ng-module-options-object.js +8 -4
- package/src/lib/angular/get-ng-module-options-object.js.map +1 -1
- package/src/lib/angular/handle-component-module.js +2 -1
- package/src/lib/angular/handle-component.js +2 -1
- package/src/lib/angular/has-accordion-component.js +16 -12
- package/src/lib/angular/has-accordion-component.js.map +1 -1
- package/src/lib/angular/has-component.js +18 -14
- package/src/lib/angular/has-component.js.map +1 -1
- package/src/lib/angular/has-dialog-component.js +9 -5
- package/src/lib/angular/has-dialog-component.js.map +1 -1
- package/src/lib/angular/has-project-feature.js +14 -10
- package/src/lib/angular/has-project-feature.js.map +1 -1
- package/src/lib/angular/has-table-component.js +14 -10
- package/src/lib/angular/has-table-component.js.map +1 -1
- package/src/lib/angular/index.js +29 -26
- package/src/lib/angular/index.js.map +1 -1
- package/src/lib/auto-import.js +11 -7
- package/src/lib/auto-import.js.map +1 -1
- package/src/lib/coerce-class-constructor.d.ts +3 -0
- package/src/lib/coerce-class-constructor.js +8 -1
- package/src/lib/coerce-class-constructor.js.map +1 -1
- package/src/lib/coerce-class-method.d.ts +3 -0
- package/src/lib/coerce-class-method.js +8 -1
- package/src/lib/coerce-class-method.js.map +1 -1
- package/src/lib/coerce-class.d.ts +3 -0
- package/src/lib/coerce-class.js +9 -5
- package/src/lib/coerce-class.js.map +1 -1
- package/src/lib/coerce-property-key.js +5 -1
- package/src/lib/coerce-property-key.js.map +1 -1
- package/src/lib/coerce-source-file.d.ts +3 -0
- package/src/lib/coerce-source-file.js +8 -1
- package/src/lib/coerce-source-file.js.map +1 -1
- package/src/lib/coerce-variable-declaration.d.ts +3 -0
- package/src/lib/coerce-variable-declaration.js +16 -14
- package/src/lib/coerce-variable-declaration.js.map +1 -1
- package/src/lib/fix-missing-imports.js +11 -7
- package/src/lib/fix-missing-imports.js.map +1 -1
- package/src/lib/get-array-declaration.js +9 -5
- package/src/lib/get-array-declaration.js.map +1 -1
- package/src/lib/get-class-decorator-arguments.d.ts +3 -0
- package/src/lib/get-class-decorator-arguments.js +7 -2
- package/src/lib/get-class-decorator-arguments.js.map +1 -1
- package/src/lib/get-coerce-array-literal-form-object-literal.d.ts +3 -0
- package/src/lib/get-coerce-array-literal-form-object-literal.js +11 -4
- package/src/lib/get-coerce-array-literal-form-object-literal.js.map +1 -1
- package/src/lib/get-form-providers-source-file.js +13 -8
- package/src/lib/get-form-providers-source-file.js.map +1 -1
- package/src/lib/get-variable-declaration.js +7 -2
- package/src/lib/get-variable-declaration.js.map +1 -1
- package/src/lib/is-array-literal-expression.js +9 -4
- package/src/lib/is-array-literal-expression.js.map +1 -1
- package/src/lib/merge-ts-morph-project.js +7 -3
- package/src/lib/merge-ts-morph-project.js.map +1 -1
- package/src/lib/nest/add-nest-controller.js +20 -15
- package/src/lib/nest/add-nest-controller.js.map +1 -1
- package/src/lib/nest/add-nest-module-controller.js +13 -9
- package/src/lib/nest/add-nest-module-controller.js.map +1 -1
- package/src/lib/nest/add-nest-module-import.d.ts +3 -0
- package/src/lib/nest/add-nest-module-import.js +15 -8
- package/src/lib/nest/add-nest-module-import.js.map +1 -1
- package/src/lib/nest/add-nest-module-provider.d.ts +3 -0
- package/src/lib/nest/add-nest-module-provider.js +16 -9
- package/src/lib/nest/add-nest-module-provider.js.map +1 -1
- package/src/lib/nest/add-nest-module-to-app-module.js +16 -12
- package/src/lib/nest/add-nest-module-to-app-module.js.map +1 -1
- package/src/lib/nest/add-nest-provider-to-array.d.ts +4 -1
- package/src/lib/nest/add-nest-provider-to-array.js +15 -7
- package/src/lib/nest/add-nest-provider-to-array.js.map +1 -1
- package/src/lib/nest/add-operation-to-controller.js +74 -67
- package/src/lib/nest/add-operation-to-controller.js.map +1 -1
- package/src/lib/nest/assert-nest-project.js +9 -5
- package/src/lib/nest/assert-nest-project.js.map +1 -1
- package/src/lib/nest/build-nest-base-path.js +12 -8
- package/src/lib/nest/build-nest-base-path.js.map +1 -1
- package/src/lib/nest/build-nest-controller-name.js +9 -5
- package/src/lib/nest/build-nest-controller-name.js.map +1 -1
- package/src/lib/nest/coerce-dto-class.js +41 -36
- package/src/lib/nest/coerce-dto-class.js.map +1 -1
- package/src/lib/nest/coerce-form-submit-operation.js +17 -21
- package/src/lib/nest/coerce-form-submit-operation.js.map +1 -1
- package/src/lib/nest/coerce-get-by-id-operation.js +16 -19
- package/src/lib/nest/coerce-get-by-id-operation.js.map +1 -1
- package/src/lib/nest/coerce-get-children-operation.js +20 -24
- package/src/lib/nest/coerce-get-children-operation.js.map +1 -1
- package/src/lib/nest/coerce-get-data-grid-operation.js +18 -22
- package/src/lib/nest/coerce-get-data-grid-operation.js.map +1 -1
- package/src/lib/nest/coerce-get-page-operation.js +56 -53
- package/src/lib/nest/coerce-get-page-operation.js.map +1 -1
- package/src/lib/nest/coerce-get-root-operation.js +18 -22
- package/src/lib/nest/coerce-get-root-operation.js.map +1 -1
- package/src/lib/nest/coerce-nest-controller.js +32 -28
- package/src/lib/nest/coerce-nest-controller.js.map +1 -1
- package/src/lib/nest/coerce-nest-module.js +21 -17
- package/src/lib/nest/coerce-nest-module.js.map +1 -1
- package/src/lib/nest/coerce-nest-service-project.js +12 -8
- package/src/lib/nest/coerce-nest-service-project.js.map +1 -1
- package/src/lib/nest/coerce-operation.d.ts +3 -0
- package/src/lib/nest/coerce-operation.js +30 -25
- package/src/lib/nest/coerce-operation.js.map +1 -1
- package/src/lib/nest/coerce-options-operation.js +18 -17
- package/src/lib/nest/coerce-options-operation.js.map +1 -1
- package/src/lib/nest/coerce-page-dto-class.js +15 -11
- package/src/lib/nest/coerce-page-dto-class.js.map +1 -1
- package/src/lib/nest/coerce-row-dto-class.js +11 -7
- package/src/lib/nest/coerce-row-dto-class.js.map +1 -1
- package/src/lib/nest/coerce-submit-data-grid-operation.js +12 -11
- package/src/lib/nest/coerce-submit-data-grid-operation.js.map +1 -1
- package/src/lib/nest/coerce-table-select-operation.js +11 -10
- package/src/lib/nest/coerce-table-select-operation.js.map +1 -1
- package/src/lib/nest/coerce-table-select-value-resolve-operation.js +15 -14
- package/src/lib/nest/coerce-table-select-value-resolve-operation.js.map +1 -1
- package/src/lib/nest/coerce-tree-operation.js +18 -21
- package/src/lib/nest/coerce-tree-operation.js.map +1 -1
- package/src/lib/nest/create-dto-class.js +30 -24
- package/src/lib/nest/create-dto-class.js.map +1 -1
- package/src/lib/nest/find-nest-module-declaration.js +9 -5
- package/src/lib/nest/find-nest-module-declaration.js.map +1 -1
- package/src/lib/nest/find-nest-module-source-file.d.ts +3 -0
- package/src/lib/nest/find-nest-module-source-file.js +10 -3
- package/src/lib/nest/find-nest-module-source-file.js.map +1 -1
- package/src/lib/nest/get-nest-module-metadata.d.ts +3 -0
- package/src/lib/nest/get-nest-module-metadata.js +14 -7
- package/src/lib/nest/get-nest-module-metadata.js.map +1 -1
- package/src/lib/nest/has-nest-controller.js +11 -7
- package/src/lib/nest/has-nest-controller.js.map +1 -1
- package/src/lib/nest/has-nest-module-class.d.ts +3 -0
- package/src/lib/nest/has-nest-module-class.js +10 -3
- package/src/lib/nest/has-nest-module-class.js.map +1 -1
- package/src/lib/nest/has-nest-module.js +15 -11
- package/src/lib/nest/has-nest-module.js.map +1 -1
- package/src/lib/nest/is-nest-module-class.d.ts +3 -0
- package/src/lib/nest/is-nest-module-class.js +8 -1
- package/src/lib/nest/is-nest-module-class.js.map +1 -1
- package/src/lib/nest/nest-provider-object.d.ts +3 -0
- package/src/lib/nest/nest-provider-object.js +2 -1
- package/src/lib/nest/operation-id-utilities.js +52 -37
- package/src/lib/nest/operation-id-utilities.js.map +1 -1
- package/src/lib/nest/project-utilities.js +9 -4
- package/src/lib/nest/project-utilities.js.map +1 -1
- package/src/lib/nest/remove-nest-module-provider.d.ts +3 -0
- package/src/lib/nest/remove-nest-module-provider.js +14 -7
- package/src/lib/nest/remove-nest-module-provider.js.map +1 -1
- package/src/lib/nest/remove-nest-provider-to-array.d.ts +4 -1
- package/src/lib/nest/remove-nest-provider-to-array.js +13 -5
- package/src/lib/nest/remove-nest-provider-to-array.js.map +1 -1
- package/src/lib/organize-imports.js +9 -5
- package/src/lib/organize-imports.js.map +1 -1
- package/src/lib/overwrite-decorator.js +6 -2
- package/src/lib/overwrite-decorator.js.map +1 -1
- package/src/lib/overwrite-property.js +6 -2
- package/src/lib/overwrite-property.js.map +1 -1
- package/src/lib/provider-object.js +2 -1
- package/src/lib/to-value-context.js +2 -1
- package/src/lib/ts-morph/apply-ts-morph-project.js +7 -3
- package/src/lib/ts-morph/apply-ts-morph-project.js.map +1 -1
- package/src/lib/ts-morph/coerce-class-implementation.js +5 -1
- package/src/lib/ts-morph/coerce-class-implementation.js.map +1 -1
- package/src/lib/ts-morph/coerce-class-property.js +6 -5
- package/src/lib/ts-morph/coerce-class-property.js.map +1 -1
- package/src/lib/ts-morph/coerce-decorator.d.ts +3 -0
- package/src/lib/ts-morph/coerce-decorator.js +11 -7
- package/src/lib/ts-morph/coerce-decorator.js.map +1 -1
- package/src/lib/ts-morph/coerce-function.js +5 -1
- package/src/lib/ts-morph/coerce-function.js.map +1 -1
- package/src/lib/ts-morph/coerce-imports.d.ts +3 -0
- package/src/lib/ts-morph/coerce-imports.js +8 -1
- package/src/lib/ts-morph/coerce-imports.js.map +1 -1
- package/src/lib/ts-morph/coerce-interface.js +13 -11
- package/src/lib/ts-morph/coerce-interface.js.map +1 -1
- package/src/lib/ts-morph/coerce-parameter-declaration.js +6 -3
- package/src/lib/ts-morph/coerce-parameter-declaration.js.map +1 -1
- package/src/lib/ts-morph/coerce-statements.d.ts +3 -0
- package/src/lib/ts-morph/coerce-statements.js +8 -1
- package/src/lib/ts-morph/coerce-statements.js.map +1 -1
- package/src/lib/ts-morph/coerce-type-alias.js +6 -6
- package/src/lib/ts-morph/coerce-type-alias.js.map +1 -1
- package/src/lib/ts-morph/find-function.d.ts +6 -0
- package/src/lib/ts-morph/find-function.js +8 -1
- package/src/lib/ts-morph/find-function.js.map +1 -1
- package/src/lib/ts-morph/write-type.js +5 -1
- package/src/lib/ts-morph/write-type.js.map +1 -1
- package/src/lib/ts-morph-transform.js +13 -7
- package/src/lib/ts-morph-transform.js.map +1 -1
- package/src/lib/types/form-definition-control.js +2 -1
|
@@ -1,12 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AddDependencyInjection = exports.Module = void 0;
|
|
4
|
+
const ts_morph_1 = require("ts-morph");
|
|
5
|
+
const coerce_class_constructor_1 = require("../coerce-class-constructor");
|
|
6
|
+
const coerce_imports_1 = require("../ts-morph/coerce-imports");
|
|
7
|
+
/**
|
|
8
|
+
* @deprecated import from @rxap/ts-morph
|
|
9
|
+
*/
|
|
10
|
+
var Module;
|
|
5
11
|
(function (Module) {
|
|
6
12
|
Module["ANGULAR"] = "@angular/core";
|
|
7
13
|
Module["NEST"] = "@nestjs/common";
|
|
8
|
-
})(Module || (Module = {}));
|
|
9
|
-
|
|
14
|
+
})(Module || (exports.Module = Module = {}));
|
|
15
|
+
/**
|
|
16
|
+
* @deprecated import from @rxap/ts-morph
|
|
17
|
+
*/
|
|
18
|
+
function AddDependencyInjection(sourceFile, definition, structures = []) {
|
|
19
|
+
var _a, _b, _c, _d;
|
|
10
20
|
if (!definition.module) {
|
|
11
21
|
definition.module = Module.ANGULAR;
|
|
12
22
|
}
|
|
@@ -14,15 +24,15 @@ export function AddDependencyInjection(sourceFile, definition, structures = [])
|
|
|
14
24
|
if (!classDeclaration) {
|
|
15
25
|
throw new Error('Could not find class declaration');
|
|
16
26
|
}
|
|
17
|
-
const constructorDeclarations = CoerceClassConstructor(classDeclaration);
|
|
27
|
+
const constructorDeclarations = (0, coerce_class_constructor_1.CoerceClassConstructor)(classDeclaration);
|
|
18
28
|
const constructorDeclaration = constructorDeclarations[0];
|
|
19
29
|
if (constructorDeclaration.getParameter(definition.parameterName)) {
|
|
20
30
|
return;
|
|
21
31
|
}
|
|
22
32
|
const constructorParameter = {
|
|
23
33
|
name: definition.parameterName,
|
|
24
|
-
type: definition.type
|
|
25
|
-
scope: definition.scope
|
|
34
|
+
type: (_a = definition.type) !== null && _a !== void 0 ? _a : definition.injectionToken,
|
|
35
|
+
scope: (_b = definition.scope) !== null && _b !== void 0 ? _b : ts_morph_1.Scope.Public,
|
|
26
36
|
isReadonly: true,
|
|
27
37
|
decorators: [
|
|
28
38
|
{
|
|
@@ -32,21 +42,22 @@ export function AddDependencyInjection(sourceFile, definition, structures = [])
|
|
|
32
42
|
],
|
|
33
43
|
};
|
|
34
44
|
if (definition.optional) {
|
|
35
|
-
constructorParameter.decorators
|
|
45
|
+
(_c = constructorParameter.decorators) === null || _c === void 0 ? void 0 : _c.unshift({
|
|
36
46
|
name: 'Optional',
|
|
37
47
|
arguments: [],
|
|
38
48
|
});
|
|
39
|
-
constructorParameter.type = Writers.intersectionType(definition.type
|
|
40
|
-
CoerceImports(sourceFile, {
|
|
49
|
+
constructorParameter.type = ts_morph_1.Writers.intersectionType((_d = definition.type) !== null && _d !== void 0 ? _d : definition.injectionToken, 'null');
|
|
50
|
+
(0, coerce_imports_1.CoerceImports)(sourceFile, {
|
|
41
51
|
namedImports: ['Optional'],
|
|
42
52
|
moduleSpecifier: definition.module,
|
|
43
53
|
});
|
|
44
54
|
}
|
|
45
55
|
constructorDeclaration.addParameter(constructorParameter);
|
|
46
|
-
CoerceImports(sourceFile, {
|
|
56
|
+
(0, coerce_imports_1.CoerceImports)(sourceFile, {
|
|
47
57
|
namedImports: ['Inject'],
|
|
48
58
|
moduleSpecifier: definition.module,
|
|
49
59
|
});
|
|
50
|
-
CoerceImports(sourceFile, structures);
|
|
60
|
+
(0, coerce_imports_1.CoerceImports)(sourceFile, structures);
|
|
51
61
|
}
|
|
62
|
+
exports.AddDependencyInjection = AddDependencyInjection;
|
|
52
63
|
//# sourceMappingURL=add-dependency-injection.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-dependency-injection.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/angular/add-dependency-injection.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"add-dependency-injection.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/angular/add-dependency-injection.ts"],"names":[],"mappings":";;;AAAA,uCAOkB;AAClB,0EAAqE;AACrE,+DAA2D;AAE3D;;GAEG;AACH,IAAY,MAGX;AAHD,WAAY,MAAM;IAChB,mCAAyB,CAAA;IACzB,iCAAuB,CAAA;AACzB,CAAC,EAHW,MAAM,sBAAN,MAAM,QAGjB;AAcD;;GAEG;AACH,SAAgB,sBAAsB,CACpC,UAAsB,EACtB,UAA+B,EAC/B,aAAsE,EAAE;;IAGxE,IAAI,CAAC,UAAU,CAAC,MAAM,EAAE;QACtB,UAAU,CAAC,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC;KACpC;IAED,MAAM,gBAAgB,GAAG,UAAU,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC;IAEpD,IAAI,CAAC,gBAAgB,EAAE;QACrB,MAAM,IAAI,KAAK,CAAC,kCAAkC,CAAC,CAAC;KACrD;IAED,MAAM,uBAAuB,GAAG,IAAA,iDAAsB,EAAC,gBAAgB,CAAC,CAAC;IAC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
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AddNgModuleExport = void 0;
|
|
4
|
+
const get_coerce_array_literal_form_object_literal_1 = require("../get-coerce-array-literal-form-object-literal");
|
|
5
|
+
const coerce_imports_1 = require("../ts-morph/coerce-imports");
|
|
6
|
+
const get_ng_module_options_object_1 = require("./get-ng-module-options-object");
|
|
7
|
+
function AddNgModuleExport(sourceFile, namedImport, moduleSpecifier) {
|
|
5
8
|
if (moduleSpecifier) {
|
|
6
|
-
CoerceImports(sourceFile, {
|
|
9
|
+
(0, coerce_imports_1.CoerceImports)(sourceFile, {
|
|
7
10
|
moduleSpecifier,
|
|
8
11
|
namedImports: [namedImport],
|
|
9
12
|
});
|
|
10
13
|
}
|
|
11
|
-
const ngModuleOptions = GetNgModuleOptionsObject(sourceFile);
|
|
12
|
-
const importsArray = GetCoerceArrayLiteralFromObjectLiteral(ngModuleOptions, 'exports');
|
|
14
|
+
const ngModuleOptions = (0, get_ng_module_options_object_1.GetNgModuleOptionsObject)(sourceFile);
|
|
15
|
+
const importsArray = (0, get_coerce_array_literal_form_object_literal_1.GetCoerceArrayLiteralFromObjectLiteral)(ngModuleOptions, 'exports');
|
|
13
16
|
if (!importsArray.getElements().some(element => element.getFullText().trim() === namedImport)) {
|
|
14
17
|
importsArray.addElement(namedImport);
|
|
15
18
|
}
|
|
16
19
|
}
|
|
20
|
+
exports.AddNgModuleExport = AddNgModuleExport;
|
|
17
21
|
//# sourceMappingURL=add-ng-module-export.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-ng-module-export.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/angular/add-ng-module-export.ts"],"names":[],"mappings":"AACA,
|
|
1
|
+
{"version":3,"file":"add-ng-module-export.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/angular/add-ng-module-export.ts"],"names":[],"mappings":";;;AACA,kHAAyG;AAEzG,+DAA2D;AAC3D,iFAA0E;AAE1E,SAAgB,iBAAiB,CAAC,UAAsB,EAAE,WAAmB,EAAE,eAAwB;IAErG,IAAI,eAAe,EAAE;QACnB,IAAA,8BAAa,EAAC,UAAU,EAAE;YACxB,eAAe;YACf,YAAY,EAAE,CAAE,WAAW,CAAE;SAC9B,CAAC,CAAC;KACJ;IAED,MAAM,eAAe,GAAG,IAAA,uDAAwB,EAAC,UAAU,CAAC,CAAC;IAE7D,MAAM,YAAY,GAAG,IAAA,qFAAsC,EAAC,eAAe,EAAE,SAAS,CAAC,CAAC;IAExF,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,KAAK,WAAW,CAAC,EAAE;QAC7F,YAAY,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;KACtC;AAEH,CAAC;AAjBD,8CAiBC"}
|
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AddNgModuleImport = void 0;
|
|
4
|
+
const get_coerce_array_literal_form_object_literal_1 = require("../get-coerce-array-literal-form-object-literal");
|
|
5
|
+
const coerce_imports_1 = require("../ts-morph/coerce-imports");
|
|
6
|
+
const get_ng_module_options_object_1 = require("./get-ng-module-options-object");
|
|
7
|
+
function AddNgModuleImport(sourceFile, namedImport, moduleSpecifier) {
|
|
5
8
|
if (moduleSpecifier) {
|
|
6
|
-
CoerceImports(sourceFile, {
|
|
9
|
+
(0, coerce_imports_1.CoerceImports)(sourceFile, {
|
|
7
10
|
moduleSpecifier,
|
|
8
11
|
namedImports: [namedImport],
|
|
9
12
|
});
|
|
10
13
|
}
|
|
11
|
-
const ngModuleOptions = GetNgModuleOptionsObject(sourceFile);
|
|
12
|
-
const importsArray = GetCoerceArrayLiteralFromObjectLiteral(ngModuleOptions, 'imports');
|
|
14
|
+
const ngModuleOptions = (0, get_ng_module_options_object_1.GetNgModuleOptionsObject)(sourceFile);
|
|
15
|
+
const importsArray = (0, get_coerce_array_literal_form_object_literal_1.GetCoerceArrayLiteralFromObjectLiteral)(ngModuleOptions, 'imports');
|
|
13
16
|
if (!importsArray.getElements().some(element => element.getFullText().trim() === namedImport)) {
|
|
14
17
|
importsArray.addElement(namedImport);
|
|
15
18
|
}
|
|
16
19
|
}
|
|
20
|
+
exports.AddNgModuleImport = AddNgModuleImport;
|
|
17
21
|
//# sourceMappingURL=add-ng-module-import.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-ng-module-import.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/angular/add-ng-module-import.ts"],"names":[],"mappings":"AACA,
|
|
1
|
+
{"version":3,"file":"add-ng-module-import.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/angular/add-ng-module-import.ts"],"names":[],"mappings":";;;AACA,kHAAyG;AACzG,+DAA2D;AAC3D,iFAA0E;AAE1E,SAAgB,iBAAiB,CAAC,UAAsB,EAAE,WAAmB,EAAE,eAAwB;IAErG,IAAI,eAAe,EAAE;QACnB,IAAA,8BAAa,EAAC,UAAU,EAAE;YACxB,eAAe;YACf,YAAY,EAAE,CAAE,WAAW,CAAE;SAC9B,CAAC,CAAC;KACJ;IAED,MAAM,eAAe,GAAG,IAAA,uDAAwB,EAAC,UAAU,CAAC,CAAC;IAE7D,MAAM,YAAY,GAAG,IAAA,qFAAsC,EAAC,eAAe,EAAE,SAAS,CAAC,CAAC;IAExF,IAAI,CAAC,YAAY,CAAC,WAAW,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,IAAI,EAAE,KAAK,WAAW,CAAC,EAAE;QAC7F,YAAY,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;KACtC;AAEH,CAAC;AAjBD,8CAiBC"}
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AddNgModuleProvider = void 0;
|
|
4
|
+
const add_provider_to_array_1 = require("../add-provider-to-array");
|
|
5
|
+
const get_coerce_array_literal_form_object_literal_1 = require("../get-coerce-array-literal-form-object-literal");
|
|
6
|
+
const coerce_imports_1 = require("../ts-morph/coerce-imports");
|
|
7
|
+
const get_ng_module_options_object_1 = require("./get-ng-module-options-object");
|
|
8
|
+
function AddNgModuleProvider(sourceFile, providerObject, structures = [], overwrite = false) {
|
|
9
|
+
(0, coerce_imports_1.CoerceImports)(sourceFile, structures);
|
|
10
|
+
const ngModuleOptions = (0, get_ng_module_options_object_1.GetNgModuleOptionsObject)(sourceFile);
|
|
11
|
+
const providerArray = (0, get_coerce_array_literal_form_object_literal_1.GetCoerceArrayLiteralFromObjectLiteral)(ngModuleOptions, 'providers');
|
|
12
|
+
(0, add_provider_to_array_1.AddProviderToArray)(providerObject, providerArray, overwrite);
|
|
10
13
|
}
|
|
14
|
+
exports.AddNgModuleProvider = AddNgModuleProvider;
|
|
11
15
|
//# sourceMappingURL=add-ng-module-provider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-ng-module-provider.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/angular/add-ng-module-provider.ts"],"names":[],"mappings":"AAKA,
|
|
1
|
+
{"version":3,"file":"add-ng-module-provider.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/angular/add-ng-module-provider.ts"],"names":[],"mappings":";;;AAKA,oEAA8D;AAC9D,kHAAyG;AAEzG,+DAA2D;AAC3D,iFAA0E;AAE1E,SAAgB,mBAAmB,CACjC,UAAsB,EACtB,cAAuC,EACvC,aAAsE,EAAE,EACxE,SAAS,GAAG,KAAK;IAGjB,IAAA,8BAAa,EAAC,UAAU,EAAE,UAAU,CAAC,CAAC;IAEtC,MAAM,eAAe,GAAG,IAAA,uDAAwB,EAAC,UAAU,CAAC,CAAC;IAE7D,MAAM,aAAa,GAAG,IAAA,qFAAsC,EAAC,eAAe,EAAE,WAAW,CAAC,CAAC;IAE3F,IAAA,0CAAkB,EAAC,cAAc,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC;AAE/D,CAAC;AAfD,kDAeC"}
|
|
@@ -1,16 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BuildAngularBasePath = void 0;
|
|
4
|
+
const schematics_utilities_1 = require("@rxap/schematics-utilities");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
function BuildAngularBasePath(host, options) {
|
|
4
7
|
let { project, feature, directory, shared, } = options;
|
|
5
|
-
directory
|
|
8
|
+
directory !== null && directory !== void 0 ? directory : (directory = '');
|
|
6
9
|
project = shared ? 'shared' : project;
|
|
7
|
-
const projectSourceRoot = GetProjectSourceRoot(host, project);
|
|
8
|
-
const type = GetProjectType(host, project);
|
|
10
|
+
const projectSourceRoot = (0, schematics_utilities_1.GetProjectSourceRoot)(host, project);
|
|
11
|
+
const type = (0, schematics_utilities_1.GetProjectType)(host, project);
|
|
9
12
|
if (feature) {
|
|
10
|
-
return join(projectSourceRoot, type === 'library' ? 'lib' : '', 'feature', feature, directory);
|
|
13
|
+
return (0, path_1.join)(projectSourceRoot, type === 'library' ? 'lib' : '', 'feature', feature, directory);
|
|
11
14
|
}
|
|
12
15
|
else {
|
|
13
|
-
return join(projectSourceRoot, type === 'library' ? 'lib' : '', 'app', directory);
|
|
16
|
+
return (0, path_1.join)(projectSourceRoot, type === 'library' ? 'lib' : '', 'app', directory);
|
|
14
17
|
}
|
|
15
18
|
}
|
|
19
|
+
exports.BuildAngularBasePath = BuildAngularBasePath;
|
|
16
20
|
//# sourceMappingURL=build-angular-base-path.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-angular-base-path.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/angular/build-angular-base-path.ts"],"names":[],"mappings":"AACA,
|
|
1
|
+
{"version":3,"file":"build-angular-base-path.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/angular/build-angular-base-path.ts"],"names":[],"mappings":";;;AACA,qEAGoC;AACpC,+BAA4B;AAS5B,SAAgB,oBAAoB,CAAC,IAAU,EAAE,OAA8C;IAC7F,IAAI,EACF,OAAO,EACP,OAAO,EACP,SAAS,EACT,MAAM,GACP,GAAG,OAAO,CAAC;IACZ,SAAS,aAAT,SAAS,cAAT,SAAS,IAAT,SAAS,GAAK,EAAE,EAAC;IACjB,OAAO,GAAG,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC;IACtC,MAAM,iBAAiB,GAAG,IAAA,2CAAoB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC9D,MAAM,IAAI,GAAG,IAAA,qCAAc,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAC3C,IAAI,OAAO,EAAE;QACX,OAAO,IAAA,WAAI,EAAC,iBAAiB,EAAE,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,SAAS,EAAE,OAAO,EAAE,SAAS,CAAC,CAAC;KAChG;SAAM;QACL,OAAO,IAAA,WAAI,EAAC,iBAAiB,EAAE,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,SAAS,CAAC,CAAC;KACnF;AACH,CAAC;AAhBD,oDAgBC"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CoerceAccordionComponent = void 0;
|
|
4
|
+
const has_accordion_component_1 = require("./has-accordion-component");
|
|
5
|
+
const schematics_utilities_1 = require("@rxap/schematics-utilities");
|
|
6
|
+
function CoerceAccordionComponent(options) {
|
|
4
7
|
const { accordionName, project, feature, } = options;
|
|
5
8
|
return tree => {
|
|
6
|
-
if (!HasAccordionComponent(tree, options)) {
|
|
9
|
+
if (!(0, has_accordion_component_1.HasAccordionComponent)(tree, options)) {
|
|
7
10
|
console.log(`The accordion component '${accordionName}' does not exists in the feature '${feature}' of the project '${project}'. Accordion component will now be created ...`);
|
|
8
|
-
return ExecuteSchematic('accordion-component', {
|
|
11
|
+
return (0, schematics_utilities_1.ExecuteSchematic)('accordion-component', {
|
|
9
12
|
accordionName,
|
|
10
13
|
project,
|
|
11
14
|
feature,
|
|
@@ -15,4 +18,5 @@ export function CoerceAccordionComponent(options) {
|
|
|
15
18
|
return undefined;
|
|
16
19
|
};
|
|
17
20
|
}
|
|
21
|
+
exports.CoerceAccordionComponent = CoerceAccordionComponent;
|
|
18
22
|
//# sourceMappingURL=coerce-accordion-component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coerce-accordion-component.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/angular/coerce-accordion-component.ts"],"names":[],"mappings":"AACA,
|
|
1
|
+
{"version":3,"file":"coerce-accordion-component.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/angular/coerce-accordion-component.ts"],"names":[],"mappings":";;;AACA,uEAAkE;AAClE,qEAA8D;AAQ9D,SAAgB,wBAAwB,CAAC,OAAwC;IAC/E,MAAM,EACJ,aAAa,EACb,OAAO,EACP,OAAO,GACR,GAAG,OAAO,CAAC;IACZ,OAAO,IAAI,CAAC,EAAE;QACZ,IAAI,CAAC,IAAA,+CAAqB,EAAC,IAAI,EAAE,OAAO,CAAC,EAAE;YACzC,OAAO,CAAC,GAAG,CAAC,4BAA6B,aAAc,qCAAsC,OAAQ,qBAAsB,OAAQ,gDAAgD,CAAC,CAAC;YACrL,OAAO,IAAA,uCAAgB,EACrB,qBAAqB,EACrB;gBACE,aAAa;gBACb,OAAO;gBACP,OAAO;gBACP,QAAQ,EAAE,EAAE;aACb,CACF,CAAC;SACH;QACD,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC;AACJ,CAAC;AArBD,4DAqBC"}
|
|
@@ -1,21 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CoerceComponentClassRule = void 0;
|
|
4
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
|
+
const schematics_utilities_1 = require("@rxap/schematics-utilities");
|
|
6
|
+
const ts_morph_1 = require("ts-morph");
|
|
7
|
+
const coerce_class_1 = require("../coerce-class");
|
|
8
|
+
const coerce_source_file_1 = require("../coerce-source-file");
|
|
9
|
+
const ts_morph_transform_1 = require("../ts-morph-transform");
|
|
10
|
+
const coerce_decorator_1 = require("../ts-morph/coerce-decorator");
|
|
11
|
+
function CoerceComponentClassRule(options) {
|
|
9
12
|
const { componentName, selector, tsMorphTransform, } = options;
|
|
10
|
-
return TsMorphAngularProjectTransformRule(options, (project) => {
|
|
11
|
-
const sourceFile = CoerceSourceFile(project, `/${componentName}.component.ts`);
|
|
12
|
-
const classDeclaration = CoerceClass(sourceFile, classify(componentName) + 'Component', {
|
|
13
|
+
return (0, ts_morph_transform_1.TsMorphAngularProjectTransformRule)(options, (project) => {
|
|
14
|
+
const sourceFile = (0, coerce_source_file_1.CoerceSourceFile)(project, `/${componentName}.component.ts`);
|
|
15
|
+
const classDeclaration = (0, coerce_class_1.CoerceClass)(sourceFile, (0, schematics_utilities_1.classify)(componentName) + 'Component', {
|
|
13
16
|
isExported: true,
|
|
14
17
|
});
|
|
15
|
-
const componentDecoratorDeclaration = CoerceDecorator(classDeclaration, 'Component', {
|
|
18
|
+
const componentDecoratorDeclaration = (0, coerce_decorator_1.CoerceDecorator)(classDeclaration, 'Component', {
|
|
16
19
|
arguments: [
|
|
17
|
-
Writers.object({
|
|
18
|
-
selector: selector
|
|
20
|
+
ts_morph_1.Writers.object({
|
|
21
|
+
selector: selector !== null && selector !== void 0 ? selector : componentName,
|
|
19
22
|
template: '',
|
|
20
23
|
styles: '[]',
|
|
21
24
|
}),
|
|
@@ -23,13 +26,14 @@ export function CoerceComponentClassRule(options) {
|
|
|
23
26
|
});
|
|
24
27
|
const componentDecoratorObject = componentDecoratorDeclaration.getArguments()[0];
|
|
25
28
|
if (!componentDecoratorObject) {
|
|
26
|
-
throw new SchematicsException(`Could not find component decorator object for component '${componentName}'`);
|
|
29
|
+
throw new schematics_1.SchematicsException(`Could not find component decorator object for component '${componentName}'`);
|
|
27
30
|
}
|
|
28
|
-
if (!(componentDecoratorObject instanceof ObjectLiteralExpression)) {
|
|
29
|
-
throw new SchematicsException(`Component decorator object for component '${componentName}' is not an object literal expression`);
|
|
31
|
+
if (!(componentDecoratorObject instanceof ts_morph_1.ObjectLiteralExpression)) {
|
|
32
|
+
throw new schematics_1.SchematicsException(`Component decorator object for component '${componentName}' is not an object literal expression`);
|
|
30
33
|
}
|
|
31
34
|
// const providerArrayDeclaration = CoercePropertyDeclaration(componentDecoratorObject, 'providers', {
|
|
32
35
|
throw new Error('Not implemented yet');
|
|
33
36
|
});
|
|
34
37
|
}
|
|
38
|
+
exports.CoerceComponentClassRule = CoerceComponentClassRule;
|
|
35
39
|
//# sourceMappingURL=coerce-component-class.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coerce-component-class.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/angular/coerce-component-class.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"coerce-component-class.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/angular/coerce-component-class.ts"],"names":[],"mappings":";;;AAAA,2DAAiE;AACjE,qEAAsD;AACtD,uCAOkB;AAClB,kDAA8C;AAC9C,8DAAyD;AACzD,8DAG+B;AAC/B,mEAA+D;AAc/D,SAAgB,wBAAwB,CAAC,OAAkD;IACzF,MAAM,EACJ,aAAa,EACb,QAAQ,EACR,gBAAgB,GACjB,GAAG,OAAO,CAAC;IAEZ,OAAO,IAAA,uDAAkC,EAAC,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE;QAE7D,MAAM,UAAU,GAAG,IAAA,qCAAgB,EAAC,OAAO,EAAE,IAAK,aAAc,eAAe,CAAC,CAAC;QACjF,MAAM,gBAAgB,GAAG,IAAA,0BAAW,EAClC,UAAU,EACV,IAAA,+BAAQ,EAAC,aAAa,CAAC,GAAG,WAAW,EAAE;YACrC,UAAU,EAAE,IAAI;SACjB,CACF,CAAC;QACF,MAAM,6BAA6B,GAAG,IAAA,kCAAe,EAAC,gBAAgB,EAAE,WAAW,EAAE;YACnF,SAAS,EAAE;gBACT,kBAAO,CAAC,MAAM,CAAC;oBACb,QAAQ,EAAE,QAAQ,aAAR,QAAQ,cAAR,QAAQ,GAAI,aAAa;oBACnC,QAAQ,EAAE,EAAE;oBACZ,MAAM,EAAE,IAAI;iBACb,CAAC;aACH;SACF,CAAC,CAAC;QACH,MAAM,wBAAwB,GAAG,6BAA6B,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,CAAC;QACjF,IAAI,CAAC,wBAAwB,EAAE;YAC7B,MAAM,IAAI,gCAAmB,CAAC,4DAA6D,aAAc,GAAG,CAAC,CAAC;SAC/G;QACD,IAAI,CAAC,CAAC,wBAAwB,YAAY,kCAAuB,CAAC,EAAE;YAClE,MAAM,IAAI,gCAAmB,CAAC,6CAA8C,aAAc,uCAAuC,CAAC,CAAC;SACpI;QACD,sGAAsG;QACtG,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;IAEzC,CAAC,CAAC,CAAC;AAEL,CAAC;AArCD,4DAqCC"}
|
|
@@ -1,34 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CoerceComponentRule = void 0;
|
|
4
|
+
const core_1 = require("@angular-devkit/core");
|
|
5
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
6
|
+
const schematics_utilities_1 = require("@rxap/schematics-utilities");
|
|
7
|
+
const path_1 = require("path");
|
|
8
|
+
const ts_morph_1 = require("ts-morph");
|
|
9
|
+
const ts_morph_transform_1 = require("../ts-morph-transform");
|
|
10
|
+
const build_angular_base_path_1 = require("./build-angular-base-path");
|
|
11
|
+
const has_component_1 = require("./has-component");
|
|
12
|
+
function CoerceComponentRule(options) {
|
|
10
13
|
let { tsMorphTransform, template, project, feature, directory, name, flat, overwrite, } = options;
|
|
11
|
-
overwrite
|
|
12
|
-
directory
|
|
13
|
-
flat
|
|
14
|
+
overwrite !== null && overwrite !== void 0 ? overwrite : (overwrite = false);
|
|
15
|
+
directory !== null && directory !== void 0 ? directory : (directory = '');
|
|
16
|
+
flat !== null && flat !== void 0 ? flat : (flat = directory.endsWith(name));
|
|
14
17
|
return tree => {
|
|
18
|
+
var _a, _b, _c;
|
|
15
19
|
const rules = [];
|
|
16
|
-
const basePath = BuildAngularBasePath(tree, options);
|
|
17
|
-
const hasComponent = HasComponent(tree, options);
|
|
20
|
+
const basePath = (0, build_angular_base_path_1.BuildAngularBasePath)(tree, options);
|
|
21
|
+
const hasComponent = (0, has_component_1.HasComponent)(tree, options);
|
|
18
22
|
const componentPath = flat ? '' : name;
|
|
19
|
-
const prefix = GetProjectPrefix(tree, options.project);
|
|
23
|
+
const prefix = (0, schematics_utilities_1.GetProjectPrefix)(tree, options.project);
|
|
20
24
|
if (!hasComponent) {
|
|
21
25
|
rules.push(() => console.log(`Project '${project}' does not have a component '${name}' in the feature '${feature}' in the directory '${directory}', New component will be created.`));
|
|
22
|
-
rules.push(TsMorphAngularProjectTransformRule(options, (project, [componentSourceFile]) => {
|
|
26
|
+
rules.push((0, ts_morph_transform_1.TsMorphAngularProjectTransformRule)(options, (project, [componentSourceFile]) => {
|
|
23
27
|
componentSourceFile.addClass({
|
|
24
28
|
isExported: true,
|
|
25
|
-
name: `${classify(name)}Component`,
|
|
29
|
+
name: `${(0, schematics_utilities_1.classify)(name)}Component`,
|
|
26
30
|
decorators: [
|
|
27
31
|
{
|
|
28
32
|
name: 'Component',
|
|
29
33
|
arguments: [
|
|
30
|
-
Writers.object({
|
|
31
|
-
selector: w => w.quote(`${prefix}-${dasherize(name)}`),
|
|
34
|
+
ts_morph_1.Writers.object({
|
|
35
|
+
selector: w => w.quote(`${prefix}-${(0, schematics_utilities_1.dasherize)(name)}`),
|
|
32
36
|
templateUrl: w => w.quote(`./${name}.component.html`),
|
|
33
37
|
styleUrls: w => w.write('[').quote(`./${name}.component.scss`).write(']'),
|
|
34
38
|
changeDetection: 'ChangeDetectionStrategy.OnPush',
|
|
@@ -45,38 +49,32 @@ export function CoerceComponentRule(options) {
|
|
|
45
49
|
},
|
|
46
50
|
]);
|
|
47
51
|
}, [
|
|
48
|
-
join(componentPath, `${name}.component.ts?`),
|
|
52
|
+
(0, path_1.join)(componentPath, `${name}.component.ts?`),
|
|
49
53
|
]));
|
|
50
54
|
rules.push(tree => {
|
|
51
|
-
CoerceFile(tree, join(basePath, componentPath, `${name}.component.html`), '');
|
|
52
|
-
CoerceFile(tree, join(basePath, componentPath, `${name}.component.scss`), '');
|
|
55
|
+
(0, schematics_utilities_1.CoerceFile)(tree, (0, path_1.join)(basePath, componentPath, `${name}.component.html`), '');
|
|
56
|
+
(0, schematics_utilities_1.CoerceFile)(tree, (0, path_1.join)(basePath, componentPath, `${name}.component.scss`), '');
|
|
53
57
|
});
|
|
54
58
|
}
|
|
55
59
|
if (template && (overwrite || !hasComponent)) {
|
|
56
|
-
template.url
|
|
57
|
-
const templateOptions = {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
componentName: name,
|
|
64
|
-
};
|
|
65
|
-
templateOptions['prefix'] ??= GetProjectPrefix(tree, options.project);
|
|
66
|
-
rules.push(() => console.log(`Template '${template.url}' will be used to modify the component.`), mergeWith(apply(url(template.url), [
|
|
67
|
-
applyTemplates(templateOptions),
|
|
68
|
-
move(flat ? basePath : join(basePath, name)),
|
|
69
|
-
]), MergeStrategy.Overwrite));
|
|
60
|
+
(_a = template.url) !== null && _a !== void 0 ? _a : (template.url = './files/component');
|
|
61
|
+
const templateOptions = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, core_1.strings), { prefix, scope: `${prefix}` }), options), ((_b = template === null || template === void 0 ? void 0 : template.options) !== null && _b !== void 0 ? _b : {})), { componentName: name });
|
|
62
|
+
(_c = templateOptions['prefix']) !== null && _c !== void 0 ? _c : (templateOptions['prefix'] = (0, schematics_utilities_1.GetProjectPrefix)(tree, options.project));
|
|
63
|
+
rules.push(() => console.log(`Template '${template.url}' will be used to modify the component.`), (0, schematics_1.mergeWith)((0, schematics_1.apply)((0, schematics_1.url)(template.url), [
|
|
64
|
+
(0, schematics_1.applyTemplates)(templateOptions),
|
|
65
|
+
(0, schematics_1.move)(flat ? basePath : (0, path_1.join)(basePath, name)),
|
|
66
|
+
]), schematics_1.MergeStrategy.Overwrite));
|
|
70
67
|
}
|
|
71
68
|
if (tsMorphTransform) {
|
|
72
|
-
rules.push(TsMorphAngularProjectTransformRule(options, (project, [componentSourceFile]) => {
|
|
73
|
-
const componentClass = componentSourceFile.getClassOrThrow(`${classify(name)}Component`);
|
|
69
|
+
rules.push((0, ts_morph_transform_1.TsMorphAngularProjectTransformRule)(options, (project, [componentSourceFile]) => {
|
|
70
|
+
const componentClass = componentSourceFile.getClassOrThrow(`${(0, schematics_utilities_1.classify)(name)}Component`);
|
|
74
71
|
tsMorphTransform(project, [componentSourceFile], [componentClass], options);
|
|
75
72
|
}, [
|
|
76
|
-
join(componentPath, `${name}.component.ts`),
|
|
73
|
+
(0, path_1.join)(componentPath, `${name}.component.ts`),
|
|
77
74
|
]));
|
|
78
75
|
}
|
|
79
|
-
return chain(rules);
|
|
76
|
+
return (0, schematics_1.chain)(rules);
|
|
80
77
|
};
|
|
81
78
|
}
|
|
79
|
+
exports.CoerceComponentRule = CoerceComponentRule;
|
|
82
80
|
//# sourceMappingURL=coerce-component.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coerce-component.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/angular/coerce-component.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"coerce-component.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/angular/coerce-component.ts"],"names":[],"mappings":";;;AAAA,+CAA+C;AAC/C,2DASoC;AACpC,qEAKoC;AACpC,+BAA4B;AAC5B,uCAKkB;AAClB,8DAG+B;AAC/B,uEAAiE;AACjE,mDAA+C;AAoB/C,SAAgB,mBAAmB,CAAC,OAAyC;IAC3E,IAAI,EACF,gBAAgB,EAChB,QAAQ,EACR,OAAO,EACP,OAAO,EACP,SAAS,EACT,IAAI,EACJ,IAAI,EACJ,SAAS,GACV,GAAG,OAAO,CAAC;IACZ,SAAS,aAAT,SAAS,cAAT,SAAS,IAAT,SAAS,GAAK,KAAK,EAAC;IACpB,SAAS,aAAT,SAAS,cAAT,SAAS,IAAT,SAAS,GAAK,EAAE,EAAC;IACjB,IAAI,aAAJ,IAAI,cAAJ,IA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, "__esModule", { value: true });
|
|
3
|
+
exports.CoerceDataSourceClass = exports.CoerceExtendsBaseDataSource = exports.CoerceRxapDataSourceDecorator = void 0;
|
|
4
|
+
const schematics_utilities_1 = require("@rxap/schematics-utilities");
|
|
5
|
+
const coerce_class_1 = require("../coerce-class");
|
|
6
|
+
const coerce_source_file_1 = require("../coerce-source-file");
|
|
7
|
+
const ts_morph_transform_1 = require("../ts-morph-transform");
|
|
8
|
+
const coerce_decorator_1 = require("../ts-morph/coerce-decorator");
|
|
9
|
+
const coerce_imports_1 = require("../ts-morph/coerce-imports");
|
|
10
|
+
function CoerceRxapDataSourceDecorator(sourceFile, classDeclaration, options) {
|
|
11
|
+
(0, coerce_decorator_1.CoerceDecorator)(classDeclaration, options.decorator.name, { arguments: [options.decorator.argument] });
|
|
12
|
+
(0, coerce_imports_1.CoerceImports)(sourceFile, {
|
|
10
13
|
moduleSpecifier: options.decorator.moduleSpecifier,
|
|
11
14
|
namedImports: [options.decorator.name],
|
|
12
15
|
});
|
|
13
16
|
}
|
|
14
|
-
|
|
17
|
+
exports.CoerceRxapDataSourceDecorator = CoerceRxapDataSourceDecorator;
|
|
18
|
+
function CoerceExtendsBaseDataSource(sourceFile, classDeclaration, options) {
|
|
15
19
|
if (!classDeclaration.getExtends()) {
|
|
16
20
|
classDeclaration.setExtends(options.extends.name);
|
|
17
|
-
CoerceImports(sourceFile, [
|
|
21
|
+
(0, coerce_imports_1.CoerceImports)(sourceFile, [
|
|
18
22
|
{
|
|
19
23
|
moduleSpecifier: options.extends.moduleSpecifier,
|
|
20
24
|
namedImports: [options.extends.name],
|
|
@@ -22,27 +26,30 @@ export function CoerceExtendsBaseDataSource(sourceFile, classDeclaration, option
|
|
|
22
26
|
]);
|
|
23
27
|
}
|
|
24
28
|
}
|
|
25
|
-
|
|
29
|
+
exports.CoerceExtendsBaseDataSource = CoerceExtendsBaseDataSource;
|
|
30
|
+
function CoerceDataSourceClass(options) {
|
|
31
|
+
var _a, _b, _c;
|
|
32
|
+
var _d;
|
|
26
33
|
let { name, tsMorphTransform, coerceDecorator, providedInRoot, coerceExtends, } = options;
|
|
27
34
|
// eslint-disable-next-line @typescript-eslint/no-empty-function
|
|
28
|
-
tsMorphTransform
|
|
29
|
-
};
|
|
30
|
-
coerceDecorator
|
|
31
|
-
coerceExtends
|
|
32
|
-
options.decorator
|
|
35
|
+
tsMorphTransform !== null && tsMorphTransform !== void 0 ? tsMorphTransform : (tsMorphTransform = () => {
|
|
36
|
+
});
|
|
37
|
+
coerceDecorator !== null && coerceDecorator !== void 0 ? coerceDecorator : (coerceDecorator = CoerceRxapDataSourceDecorator);
|
|
38
|
+
coerceExtends !== null && coerceExtends !== void 0 ? coerceExtends : (coerceExtends = CoerceExtendsBaseDataSource);
|
|
39
|
+
(_a = options.decorator) !== null && _a !== void 0 ? _a : (options.decorator = {
|
|
33
40
|
name: 'RxapDataSource',
|
|
34
41
|
moduleSpecifier: '@rxap/data-source',
|
|
35
|
-
};
|
|
36
|
-
options.extends
|
|
42
|
+
});
|
|
43
|
+
(_b = options.extends) !== null && _b !== void 0 ? _b : (options.extends = {
|
|
37
44
|
name: 'BaseDataSource',
|
|
38
45
|
moduleSpecifier: '@rxap/data-source',
|
|
39
|
-
};
|
|
40
|
-
options.decorator.argument
|
|
41
|
-
const className = classify(CoerceSuffix(name, 'DataSource'));
|
|
42
|
-
const fileName = CoerceSuffix(name, '.data-source.ts');
|
|
43
|
-
return TsMorphAngularProjectTransformRule(options, (project) => {
|
|
44
|
-
const sourceFile = CoerceSourceFile(project, fileName);
|
|
45
|
-
const classDeclaration = CoerceClass(sourceFile, className, {
|
|
46
|
+
});
|
|
47
|
+
(_c = (_d = options.decorator).argument) !== null && _c !== void 0 ? _c : (_d.argument = w => w.quote(options.name));
|
|
48
|
+
const className = (0, schematics_utilities_1.classify)((0, schematics_utilities_1.CoerceSuffix)(name, 'DataSource'));
|
|
49
|
+
const fileName = (0, schematics_utilities_1.CoerceSuffix)(name, '.data-source.ts');
|
|
50
|
+
return (0, ts_morph_transform_1.TsMorphAngularProjectTransformRule)(options, (project) => {
|
|
51
|
+
const sourceFile = (0, coerce_source_file_1.CoerceSourceFile)(project, fileName);
|
|
52
|
+
const classDeclaration = (0, coerce_class_1.CoerceClass)(sourceFile, className, {
|
|
46
53
|
isExported: true,
|
|
47
54
|
decorators: [
|
|
48
55
|
{
|
|
@@ -59,11 +66,12 @@ export function CoerceDataSourceClass(options) {
|
|
|
59
66
|
});
|
|
60
67
|
coerceDecorator(sourceFile, classDeclaration, options);
|
|
61
68
|
coerceExtends(sourceFile, classDeclaration, options);
|
|
62
|
-
CoerceImports(sourceFile, {
|
|
69
|
+
(0, coerce_imports_1.CoerceImports)(sourceFile, {
|
|
63
70
|
moduleSpecifier: '@angular/core',
|
|
64
71
|
namedImports: ['Injectable'],
|
|
65
72
|
});
|
|
66
73
|
tsMorphTransform(project, sourceFile, classDeclaration);
|
|
67
74
|
});
|
|
68
75
|
}
|
|
76
|
+
exports.CoerceDataSourceClass = CoerceDataSourceClass;
|
|
69
77
|
//# sourceMappingURL=coerce-data-source-class.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coerce-data-source-class.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/angular/coerce-data-source-class.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"coerce-data-source-class.js","sourceRoot":"","sources":["../../../../../../../packages/schematic/ts-morph/src/lib/angular/coerce-data-source-class.ts"],"names":[],"mappings":";;;AAAA,qEAGoC;AAOpC,kDAA8C;AAC9C,8DAAyD;AACzD,8DAG+B;AAC/B,mEAA+D;AAC/D,+DAA2D;AA2B3D,SAAgB,6BAA6B,CAC3C,UAAsB,EACtB,gBAAkC,EAClC,OAAqC;IAErC,IAAA,kCAAe,EAAC,gBAAgB,EAAE,OAAO,CAAC,SAAU,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,CAAE,OAAO,CAAC,SAAU,CAAC,QAAS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