@magic-xpa/cli 4.1000.0 → 4.1100.0-dev000.0
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/README.md +28 -28
- package/index.d.ts +1 -1
- package/index.js +4 -4
- package/index.js.map +1 -1
- package/index.ts +1 -1
- package/package.json +2 -2
- package/src/collection.json +75 -75
- package/src/public_api.d.ts +3 -3
- package/src/public_api.js +6 -6
- package/src/public_api.js.map +1 -1
- package/src/public_api.ts +5 -5
- package/src/schematics/magic-utils/Util.d.ts +6 -6
- package/src/schematics/magic-utils/Util.js +26 -26
- package/src/schematics/magic-utils/Util.js.map +1 -1
- package/src/schematics/magic-utils/config.d.ts +12 -12
- package/src/schematics/magic-utils/config.js +56 -56
- package/src/schematics/magic-utils/config.js.map +1 -1
- package/src/schematics/magic-utils/config.ts +68 -68
- package/src/schematics/magic-utils/env.d.ts +23 -23
- package/src/schematics/magic-utils/env.js +39 -39
- package/src/schematics/magic-utils/env.js.map +1 -1
- package/src/schematics/magic-utils/env.ts +50 -50
- package/src/schematics/magic-utils/manifest.d.ts +11 -11
- package/src/schematics/magic-utils/manifest.js +40 -40
- package/src/schematics/magic-utils/manifest.js.map +1 -1
- package/src/schematics/magic-utils/manifest.ts +46 -46
- package/src/schematics/magic-utils/metadata.class.d.ts +51 -51
- package/src/schematics/magic-utils/metadata.class.js +124 -124
- package/src/schematics/magic-utils/metadata.class.js.map +1 -1
- package/src/schematics/magic-utils/metadata.class.ts +159 -159
- package/src/schematics/magic-utils/process-json.d.ts +2 -2
- package/src/schematics/magic-utils/process-json.js +157 -158
- package/src/schematics/magic-utils/process-json.js.map +1 -1
- package/src/schematics/magic-utils/rules/build-control.rule.d.ts +5 -5
- package/src/schematics/magic-utils/rules/build-control.rule.js +73 -74
- package/src/schematics/magic-utils/rules/build-control.rule.js.map +1 -1
- package/src/schematics/magic-utils/rules/build-view.rule.d.ts +3 -3
- package/src/schematics/magic-utils/rules/build-view.rule.js +82 -80
- package/src/schematics/magic-utils/rules/build-view.rule.js.map +1 -1
- package/src/schematics/magic-utils/rules/build-view.rule.ts +4 -0
- package/src/schematics/magic-utils/rules/component-list.rule.d.ts +3 -3
- package/src/schematics/magic-utils/rules/component-list.rule.js +316 -317
- package/src/schematics/magic-utils/rules/component-list.rule.js.map +1 -1
- package/src/schematics/magic-utils/rules/generate.rule.d.ts +5 -5
- package/src/schematics/magic-utils/rules/generate.rule.js +53 -54
- package/src/schematics/magic-utils/rules/generate.rule.js.map +1 -1
- package/src/schematics/magic-utils/rules/generate.rule.ts +61 -61
- package/src/schematics/magic-utils/rules/init-add-modules.rule.d.ts +12 -12
- package/src/schematics/magic-utils/rules/init-add-modules.rule.js +295 -296
- package/src/schematics/magic-utils/rules/init-add-modules.rule.js.map +1 -1
- package/src/schematics/magic-utils/rules/init-add-modules.rule.ts +360 -360
- package/src/schematics/magic-utils/rules/init-gen-components.rule.d.ts +4 -4
- package/src/schematics/magic-utils/rules/init-gen-components.rule.js +65 -66
- package/src/schematics/magic-utils/rules/init-gen-components.rule.js.map +1 -1
- package/src/schematics/magic-utils/rules/init-magic-metadata.rule.d.ts +3 -3
- package/src/schematics/magic-utils/rules/init-magic-metadata.rule.js +17 -18
- package/src/schematics/magic-utils/rules/init-magic-metadata.rule.js.map +1 -1
- package/src/schematics/magic-utils/rules/init-magic-metadata.rule.ts +19 -19
- package/src/schematics/magic-utils/rules/load-views-gen.rule.d.ts +3 -3
- package/src/schematics/magic-utils/rules/load-views-gen.rule.js +28 -29
- package/src/schematics/magic-utils/rules/load-views-gen.rule.js.map +1 -1
- package/src/schematics/magic-utils/rules/magic-option.scheme.d.ts +22 -21
- package/src/schematics/magic-utils/rules/magic-option.scheme.js +2 -2
- package/src/schematics/magic-utils/rules/magic-option.scheme.js.map +1 -1
- package/src/schematics/magic-utils/rules/magic-option.scheme.ts +24 -23
- package/src/schematics/magic-utils/utils.d.ts +12 -12
- package/src/schematics/magic-utils/utils.js +116 -117
- package/src/schematics/magic-utils/utils.js.map +1 -1
- package/src/schematics/magic-utils/utils.ts +134 -134
- package/src/schematics/mg-Install-prerequisites/index.d.ts +3 -3
- package/src/schematics/mg-Install-prerequisites/index.js +24 -25
- package/src/schematics/mg-Install-prerequisites/index.js.map +1 -1
- package/src/schematics/mg-Install-prerequisites/index.ts +30 -30
- package/src/schematics/mg-Install-prerequisites/schema.json +14 -14
- package/src/schematics/mg-add/files/src/app/app.component.html +17 -17
- package/src/schematics/mg-add/files/src/app/app.routes.ts +14 -14
- package/src/schematics/mg-add/files/src/app/magic/component-list.g.ts +9 -9
- package/src/schematics/mg-add/files/src/app/magic/lazy-loader.service.ts +2 -1
- package/src/schematics/mg-add/files/src/app/magic/magic.gen.lib.module.ts +19 -19
- package/src/schematics/mg-add/files/src/magic-styles.css +131 -131
- package/src/schematics/mg-add/index.d.ts +3 -3
- package/src/schematics/mg-add/index.js +150 -151
- package/src/schematics/mg-add/index.js.map +1 -1
- package/src/schematics/mg-add/schema.json +29 -29
- package/src/schematics/mg-add/utils/add-declaration-to-root-module.d.ts +2 -2
- package/src/schematics/mg-add/utils/add-declaration-to-root-module.js +10 -11
- package/src/schematics/mg-add/utils/add-declaration-to-root-module.js.map +1 -1
- package/src/schematics/mg-add/utils/add-declaration-to-root-module.ts +12 -12
- package/src/schematics/mg-add/webModule/app.routes.ts +14 -14
- package/src/schematics/mg-add-tasks/index.d.ts +3 -3
- package/src/schematics/mg-add-tasks/index.js +29 -30
- package/src/schematics/mg-add-tasks/index.js.map +1 -1
- package/src/schematics/mg-add-tasks/index.ts +53 -53
- package/src/schematics/mg-add-tasks/schema.json +41 -41
- package/src/schematics/mg-delete-files/index.d.ts +3 -3
- package/src/schematics/mg-delete-files/index.js +12 -13
- package/src/schematics/mg-delete-files/index.js.map +1 -1
- package/src/schematics/mg-delete-files/index.ts +12 -12
- package/src/schematics/mg-delete-files/schema.json +14 -14
- package/src/schematics/mg-gen-module/index.d.ts +3 -3
- package/src/schematics/mg-gen-module/index.js +14 -15
- package/src/schematics/mg-gen-module/index.js.map +1 -1
- package/src/schematics/mg-gen-module/index.ts +14 -14
- package/src/schematics/mg-gen-module/schema.json +24 -24
- package/src/schematics/mg-generate/index.d.ts +3 -3
- package/src/schematics/mg-generate/index.js +12 -13
- package/src/schematics/mg-generate/index.js.map +1 -1
- package/src/schematics/mg-generate/index.ts +12 -12
- package/src/schematics/mg-generate/schema.json +34 -34
- package/src/schematics/mg-generate-component/index.d.ts +3 -3
- package/src/schematics/mg-generate-component/index.js +34 -35
- package/src/schematics/mg-generate-component/index.js.map +1 -1
- package/src/schematics/mg-generate-component/schema.json +6 -0
- package/src/schematics/mg-install/index.d.ts +3 -3
- package/src/schematics/mg-install/index.js +29 -30
- package/src/schematics/mg-install/index.js.map +1 -1
- package/src/schematics/mg-install/index.ts +37 -37
- package/src/schematics/mg-install/schema.json +24 -24
- package/src/schematics/mg-routes/index.d.ts +6 -6
- package/src/schematics/mg-routes/index.js +62 -63
- package/src/schematics/mg-routes/index.js.map +1 -1
- package/src/schematics/mg-routes/schema.json +14 -14
- package/src/schematics/mg-single-control/index.d.ts +3 -3
- package/src/schematics/mg-single-control/index.js +28 -29
- package/src/schematics/mg-single-control/index.js.map +1 -1
- package/src/schematics/mg-single-control/schema.json +24 -24
- package/src/schematics/utils/ast.d.ts +21 -21
- package/src/schematics/utils/ast.js +90 -91
- package/src/schematics/utils/ast.js.map +1 -1
- package/src/schematics/utils/ast.ts +103 -103
- package/src/schematics/utils/devkit-utils/README.md +1 -1
- package/src/schematics/utils/devkit-utils/ast-utils.d.ts +87 -87
- package/src/schematics/utils/devkit-utils/ast-utils.js +489 -490
- package/src/schematics/utils/devkit-utils/ast-utils.js.map +1 -1
- package/src/schematics/utils/devkit-utils/ast-utils.ts +570 -570
- package/src/schematics/utils/devkit-utils/ast-utils_old.d.ts +68 -68
- package/src/schematics/utils/devkit-utils/ast-utils_old.js +419 -420
- package/src/schematics/utils/devkit-utils/ast-utils_old.js.map +1 -1
- package/src/schematics/utils/devkit-utils/ast-utils_old.ts +478 -478
- package/src/schematics/utils/devkit-utils/change.d.ts +66 -66
- package/src/schematics/utils/devkit-utils/change.js +94 -94
- package/src/schematics/utils/devkit-utils/change.js.map +1 -1
- package/src/schematics/utils/devkit-utils/change.ts +127 -127
- package/src/schematics/utils/devkit-utils/component.d.ts +2 -2
- package/src/schematics/utils/devkit-utils/component.js +96 -97
- package/src/schematics/utils/devkit-utils/component.js.map +1 -1
- package/src/schematics/utils/devkit-utils/component.ts +136 -136
- package/src/schematics/utils/devkit-utils/config.d.ts +78 -78
- package/src/schematics/utils/devkit-utils/config.js +52 -52
- package/src/schematics/utils/devkit-utils/config.js.map +1 -1
- package/src/schematics/utils/devkit-utils/config.ts +120 -120
- package/src/schematics/utils/devkit-utils/find-module.d.ts +28 -28
- package/src/schematics/utils/devkit-utils/find-module.js +92 -93
- package/src/schematics/utils/devkit-utils/find-module.js.map +1 -1
- package/src/schematics/utils/devkit-utils/find-module.ts +108 -108
- package/src/schematics/utils/devkit-utils/ng-ast-utils.d.ts +5 -5
- package/src/schematics/utils/devkit-utils/ng-ast-utils.js +73 -74
- package/src/schematics/utils/devkit-utils/ng-ast-utils.js.map +1 -1
- package/src/schematics/utils/devkit-utils/ng-ast-utils.ts +84 -84
- package/src/schematics/utils/devkit-utils/parse-name.d.ts +13 -13
- package/src/schematics/utils/devkit-utils/parse-name.js +19 -20
- package/src/schematics/utils/devkit-utils/parse-name.js.map +1 -1
- package/src/schematics/utils/devkit-utils/parse-name.ts +24 -24
- package/src/schematics/utils/devkit-utils/route-utils.d.ts +20 -20
- package/src/schematics/utils/devkit-utils/route-utils.js +133 -134
- package/src/schematics/utils/devkit-utils/route-utils.js.map +1 -1
- package/src/schematics/utils/devkit-utils/route-utils.ts +180 -180
- package/src/schematics/utils/devkit-utils/validation.d.ts +1 -1
- package/src/schematics/utils/devkit-utils/validation.js +18 -19
- package/src/schematics/utils/devkit-utils/validation.js.map +1 -1
- package/src/schematics/utils/devkit-utils/validation.ts +16 -16
- package/src/schematics/utils/html.d.ts +18 -18
- package/src/schematics/utils/html.js +59 -60
- package/src/schematics/utils/html.js.map +1 -1
- package/src/schematics/utils/html.ts +63 -63
- package/src/schematics/utils/lib-versions.d.ts +3 -3
- package/src/schematics/utils/lib-versions.js +6 -6
- package/src/schematics/utils/lib-versions.js.map +1 -1
- package/src/schematics/utils/lib-versions.ts +3 -3
- package/src/schematics/utils/package.d.ts +5 -5
- package/src/schematics/utils/package.js +20 -21
- package/src/schematics/utils/package.js.map +1 -1
- package/src/schematics/utils/package.ts +22 -22
- package/src/schematics/utils/testing.d.ts +5 -5
- package/src/schematics/utils/testing.js +26 -27
- package/src/schematics/utils/testing.js.map +1 -1
- package/src/schematics/utils/testing.ts +25 -25
- package/src/types/enums/Enums.d.ts +1646 -1646
- package/src/types/enums/Enums.js +1862 -1862
- package/src/types/enums/Enums.js.map +1 -1
- package/src/types/enums/Enums.ts +2063 -2063
- package/src/types/enums/generated-file-types.enum.d.ts +6 -6
- package/src/types/enums/generated-file-types.enum.js +10 -10
- package/src/types/enums/generated-file-types.enum.js.map +1 -1
- package/src/types/enums/generated-file-types.enum.ts +6 -6
- package/src/types/enums/horizontal-alignments.enum.d.ts +5 -5
- package/src/types/enums/horizontal-alignments.enum.js +9 -9
- package/src/types/enums/horizontal-alignments.enum.js.map +1 -1
- package/src/types/enums/horizontal-alignments.enum.ts +6 -6
- package/src/types/enums/themes.enum.d.ts +6 -6
- package/src/types/enums/themes.enum.js +10 -10
- package/src/types/enums/themes.enum.js.map +1 -1
- package/src/types/enums/themes.enum.ts +6 -6
- package/src/types/index.d.ts +7 -7
- package/src/types/index.js +10 -10
- package/src/types/index.js.map +1 -1
- package/src/types/index.ts +8 -8
- package/src/types/interfaces/app.d.ts +53 -53
- package/src/types/interfaces/app.js +9 -9
- package/src/types/interfaces/app.js.map +1 -1
- package/src/types/interfaces/app.ts +89 -89
- package/src/types/interfaces/control.d.ts +82 -82
- package/src/types/interfaces/control.js +2 -2
- package/src/types/interfaces/control.js.map +1 -1
- package/src/types/interfaces/control.ts +106 -106
- package/src/types/interfaces/env.interface.d.ts +19 -19
- package/src/types/interfaces/env.interface.js +10 -10
- package/src/types/interfaces/template.config.d.ts +8 -8
- package/src/types/interfaces/template.config.js +2 -2
- package/src/types/interfaces/template.config.js.map +1 -1
- package/src/types/interfaces/template.config.ts +11 -11
- package/templates/angular/src/app/app.component.html.ejs +17 -17
- package/templates/angular/src/app/cmp-array.ejs +3 -3
- package/templates/angular/src/app/cmp-hash.ejs +3 -3
- package/templates/angular/src/app/component-list.g.ts +21 -21
- package/templates/angular/src/app.component.ts +14 -14
- package/templates/angular/src/app.module.ts +70 -70
- package/templates/angular/src/app.routes.ts +73 -73
- package/templates/angular/src/styles/app.css +5 -5
- package/templates/attributes/button_attributes.ejs +2 -2
- package/templates/attributes/common/base/class.ejs +6 -6
- package/templates/attributes/common/base/control_type.ejs +53 -53
- package/templates/attributes/common/base/enabled.ejs +9 -9
- package/templates/attributes/common/base/imageFileName.ejs +3 -3
- package/templates/attributes/common/base/no_control_class.ejs +3 -3
- package/templates/attributes/common/base/rtol.ejs +3 -3
- package/templates/attributes/common/base/tabindex.ejs +11 -11
- package/templates/attributes/common/base/testingId.ejs +8 -8
- package/templates/attributes/common/base/tooltip.ejs +7 -7
- package/templates/attributes/common/base/visible.ejs +6 -6
- package/templates/attributes/common/base/wallpaper.ejs +3 -3
- package/templates/attributes/common/base_attributes.ejs +10 -10
- package/templates/attributes/common/container_attributes.ejs +6 -6
- package/templates/attributes/common/control_attributes.ejs +3 -3
- package/templates/attributes/common/format.ejs +5 -5
- package/templates/attributes/common/input/hint.ejs +13 -13
- package/templates/attributes/common/input/multiline_edit.ejs +3 -3
- package/templates/attributes/common/input/must_input.ejs +8 -8
- package/templates/attributes/common/input/password_edit.ejs +7 -7
- package/templates/attributes/common/input/row_editing_input_attributes.ejs +6 -6
- package/templates/attributes/common/input/validation.ejs +5 -5
- package/templates/attributes/common/input_attributes.ejs +4 -4
- package/templates/attributes/common/no_control_base_attributes.ejs +4 -4
- package/templates/attributes/common/row_editing_button_attributes.ejs +10 -10
- package/templates/component/view.component.html +14 -14
- package/templates/component/view.component.ts +123 -122
- package/templates/themes/basicHTML/Code/theme.module.ts +10 -10
- package/templates/themes/basicHTML/checkbox.ejs +1 -1
- package/templates/themes/basicHTML/combobox.ejs +37 -37
- package/templates/themes/basicHTML/edit.ejs +169 -168
- package/templates/themes/basicHTML/form.ejs +4 -4
- package/templates/themes/basicHTML/group.ejs +4 -4
- package/templates/themes/basicHTML/image.ejs +6 -6
- package/templates/themes/basicHTML/label.ejs +11 -11
- package/templates/themes/basicHTML/listbox.ejs +21 -21
- package/templates/themes/basicHTML/push-button.ejs +28 -28
- package/templates/themes/basicHTML/radio.ejs +20 -20
- package/templates/themes/basicHTML/subform.ejs +6 -6
- package/templates/themes/basicHTML/tab.ejs +31 -31
- package/templates/themes/basicHTML/tabpage.ejs +5 -5
- package/templates/themes/basicHiddenHTML/Code/theme.module.ts +10 -10
- package/templates/themes/basicHiddenHTML/combobox.ejs +5 -5
- package/templates/themes/basicHiddenHTML/form.ejs +3 -3
- package/templates/themes/basicHiddenHTML/group.ejs +2 -2
- package/templates/themes/basicHiddenHTML/image.ejs +4 -4
- package/templates/themes/basicHiddenHTML/label.ejs +1 -1
- package/templates/themes/basicHiddenHTML/listbox.ejs +8 -8
- package/templates/themes/basicHiddenHTML/push-button.ejs +26 -26
- package/templates/themes/basicHiddenHTML/radio.ejs +17 -17
- package/templates/themes/basicHiddenHTML/tab.ejs +13 -13
- package/templates/themes/basicHiddenHTML/table.ejs +18 -18
- package/templates/themes/basicHiddenHTML/tabpage.ejs +2 -2
- package/templates/themes/container.ejs +26 -26
- package/templates/themes/control.ejs +52 -52
- package/templates/themes/editTypeSelector.ejs +1 -1
- package/templates/themes/material/Code/theme.module.ts +68 -68
- package/templates/themes/material/base_attributes_date.ejs +8 -8
- package/templates/themes/material/checkbox.ejs +1 -1
- package/templates/themes/material/combobox.ejs +43 -43
- package/templates/themes/material/edit.ejs +204 -204
- package/templates/themes/material/group.ejs +3 -3
- package/templates/themes/material/listbox.ejs +22 -23
- package/templates/themes/material/push-button.ejs +28 -28
- package/templates/themes/material/radio.ejs +22 -22
- package/templates/themes/material/subform.ejs +8 -8
- package/templates/themes/material/tab.ejs +19 -19
- package/templates/themes/router_outlet.ejs +5 -5
- package/templates/themes/table/HTMLTable/columnHeader.ejs +3 -1
- package/templates/themes/table/HTMLTable/table.ejs +37 -37
- package/templates/themes/table/grid/additionalComponentCode.ejs +26 -26
- package/templates/themes/table/grid/additionalIncludes.ejs +1 -1
- package/templates/themes/table/grid/column.ejs +3 -1
- package/templates/themes/table/grid/table.ejs +37 -37
- package/templates/themes/table/repeatable/column.ejs +11 -11
- package/templates/themes/table/repeatable/table.ejs +28 -28
- package/templates/themes/tableTypeSelector.ejs +21 -21
- package/tsconfig.json +36 -36
|
@@ -1,326 +1,325 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.componentlistGen =
|
|
4
|
-
const ts = require("typescript");
|
|
5
|
-
const EJS = require("ejs");
|
|
6
|
-
const schematics_1 = require("@angular-devkit/schematics");
|
|
7
|
-
const env_1 = require("../env");
|
|
8
|
-
const types_1 = require("../../../types");
|
|
9
|
-
const generate_rule_1 = require("./generate.rule");
|
|
10
|
-
const ast_1 = require("../../utils/ast");
|
|
11
|
-
const route_utils_1 = require("../../utils/devkit-utils/route-utils");
|
|
12
|
-
const ast_utils_1 = require("../../utils/devkit-utils/ast-utils");
|
|
13
|
-
const Util_1 = require("../Util");
|
|
14
|
-
const util_1 = require("util");
|
|
15
|
-
let existCmpListSet;
|
|
16
|
-
let newCmpListSet = new Set();
|
|
17
|
-
let toAddImports = true;
|
|
18
|
-
let orgPreventLog = env_1.env.prevent_log;
|
|
19
|
-
function componentlistGen(options, module_name, loadOnDemand) {
|
|
20
|
-
return (host, context) => {
|
|
21
|
-
(0, Util_1.LogLn)(`[>] Step 4: components-list.`);
|
|
22
|
-
return (0, schematics_1.chain)([
|
|
23
|
-
addNewCmpsToCmpListOrGenAll(options, module_name),
|
|
24
|
-
addCmpsImportsToCmpList(options, module_name),
|
|
25
|
-
createLazyModuleMap(options, module_name),
|
|
26
|
-
addLazyLoadComponentList(options, module_name, loadOnDemand),
|
|
27
|
-
addLazyModuleToMagicGen(options),
|
|
28
|
-
addImportForLazyModule(options)
|
|
29
|
-
])(host, context);
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
const
|
|
39
|
-
const
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
let
|
|
58
|
-
let
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
let
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
const
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
const
|
|
121
|
-
const
|
|
122
|
-
const
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
let
|
|
126
|
-
let
|
|
127
|
-
let
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
let
|
|
140
|
-
let
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
//
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
*
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
const
|
|
161
|
-
const
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
*
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
let
|
|
189
|
-
let
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
const
|
|
205
|
-
|
|
206
|
-
let
|
|
207
|
-
let
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
const
|
|
228
|
-
|
|
229
|
-
let
|
|
230
|
-
let
|
|
231
|
-
let
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
//
|
|
247
|
-
//
|
|
248
|
-
//
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
let
|
|
260
|
-
let
|
|
261
|
-
let
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
const
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
const
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
return info.isEmpty ?
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.componentlistGen = componentlistGen;
|
|
4
|
+
const ts = require("typescript");
|
|
5
|
+
const EJS = require("ejs");
|
|
6
|
+
const schematics_1 = require("@angular-devkit/schematics");
|
|
7
|
+
const env_1 = require("../env");
|
|
8
|
+
const types_1 = require("../../../types");
|
|
9
|
+
const generate_rule_1 = require("./generate.rule");
|
|
10
|
+
const ast_1 = require("../../utils/ast");
|
|
11
|
+
const route_utils_1 = require("../../utils/devkit-utils/route-utils");
|
|
12
|
+
const ast_utils_1 = require("../../utils/devkit-utils/ast-utils");
|
|
13
|
+
const Util_1 = require("../Util");
|
|
14
|
+
const util_1 = require("util");
|
|
15
|
+
let existCmpListSet;
|
|
16
|
+
let newCmpListSet = new Set();
|
|
17
|
+
let toAddImports = true;
|
|
18
|
+
let orgPreventLog = env_1.env.prevent_log;
|
|
19
|
+
function componentlistGen(options, module_name, loadOnDemand) {
|
|
20
|
+
return (host, context) => {
|
|
21
|
+
(0, Util_1.LogLn)(`[>] Step 4: components-list.`);
|
|
22
|
+
return (0, schematics_1.chain)([
|
|
23
|
+
addNewCmpsToCmpListOrGenAll(options, module_name),
|
|
24
|
+
addCmpsImportsToCmpList(options, module_name),
|
|
25
|
+
createLazyModuleMap(options, module_name),
|
|
26
|
+
addLazyLoadComponentList(options, module_name, loadOnDemand),
|
|
27
|
+
addLazyModuleToMagicGen(options),
|
|
28
|
+
addImportForLazyModule(options)
|
|
29
|
+
])(host, context);
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
// create the lazy load map if it does not exist
|
|
33
|
+
function createLazyModuleMap(options, module_name) {
|
|
34
|
+
return (host, context) => {
|
|
35
|
+
const cmpListPath = env_1.env.metadata.paths.componentListPath("");
|
|
36
|
+
env_1.env.prevent_log = false;
|
|
37
|
+
const source = host.read(cmpListPath).toString("utf-8");
|
|
38
|
+
const LazyModuleArrayStart = 'export const ' + env_1.GEN_LAZY_LOAD_MODULES_ARRAY + ' = {';
|
|
39
|
+
const LazyMOduleArrayEnd = '};';
|
|
40
|
+
// create lazy load component array if it does not exist
|
|
41
|
+
if (source.indexOf(LazyModuleArrayStart) < 0) {
|
|
42
|
+
(0, Util_1.LogLn)(`[>] Creating LazyLoadModulesMap `);
|
|
43
|
+
// add the code of creating map in file
|
|
44
|
+
host.overwrite(cmpListPath, source + "\r\n" + LazyModuleArrayStart + LazyMOduleArrayEnd);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
// add the lazy load components
|
|
49
|
+
function addLazyLoadComponentList(options, module_name, loadOnDemand) {
|
|
50
|
+
return (host, context) => {
|
|
51
|
+
if (loadOnDemand) {
|
|
52
|
+
let lazyLoadedComponents = new Array();
|
|
53
|
+
const cmpListPath = env_1.env.metadata.paths.componentListPath("");
|
|
54
|
+
const source = host.read(cmpListPath);
|
|
55
|
+
if (source) {
|
|
56
|
+
let cmpListSource = (0, ast_1.getSourceFile)(host, cmpListPath);
|
|
57
|
+
let cmpListTs = getLazyLoadCompoenentsInfo(cmpListSource, env_1.GEN_LAZY_LOAD_MODULES_ARRAY);
|
|
58
|
+
let sourceStep1 = host.read(cmpListPath).toString("utf-8");
|
|
59
|
+
env_1.env.app.views.forEach(view => {
|
|
60
|
+
if ((0, util_1.isNullOrUndefined)(cmpListTs.components) || !(cmpListTs.components.includes(view.props.component_uniquename))) {
|
|
61
|
+
lazyLoadedComponents.push(view); // if component does not exist add it to list
|
|
62
|
+
(0, Util_1.LogLn)(`[>] Add ${view.props.component_uniquename} component to LazyLoadModulesMap`);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
// add components to map
|
|
66
|
+
if (lazyLoadedComponents.length > 0) {
|
|
67
|
+
let sourceStep2 = addComponentsToLazyLoad(sourceStep1, cmpListTs, lazyLoadedComponents, module_name);
|
|
68
|
+
host.overwrite(cmpListPath, sourceStep2);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
env_1.env.prevent_log = orgPreventLog;
|
|
72
|
+
}
|
|
73
|
+
return host;
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
function addImportForLazyModule(options) {
|
|
77
|
+
return (tree, context) => {
|
|
78
|
+
let genLibPath = env_1.env.metadata.paths.rootMagicGenFolder + '/magic/magic.gen.lib.module.ts';
|
|
79
|
+
const recorder = tree.beginUpdate(genLibPath);
|
|
80
|
+
let genLibSource = (0, ast_1.getSourceFile)(tree, genLibPath);
|
|
81
|
+
const importChange = (0, route_utils_1.insertImport)(genLibSource, genLibPath, env_1.GEN_LAZY_LOAD_MODULES_ARRAY, './component-list.g');
|
|
82
|
+
if (importChange.toAdd) {
|
|
83
|
+
recorder.insertLeft(importChange.pos, importChange.toAdd);
|
|
84
|
+
}
|
|
85
|
+
tree.commitUpdate(recorder);
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
// add the lazy load module to magic.gen.lib
|
|
89
|
+
function addLazyModuleToMagicGen(options) {
|
|
90
|
+
return (tree, context) => {
|
|
91
|
+
let origModuleFileName = env_1.env.metadata.paths.rootMagicGenFolder + '/magic/magic.gen.lib.module.ts';
|
|
92
|
+
if (!tree.exists(origModuleFileName)) {
|
|
93
|
+
(0, Util_1.LogLn)(` [>Error] File cannot be overwrite, The file is not exist !!! : ${origModuleFileName}`);
|
|
94
|
+
}
|
|
95
|
+
const text = tree.read(origModuleFileName);
|
|
96
|
+
if (text === null) {
|
|
97
|
+
throw new schematics_1.SchematicsException(`File ${origModuleFileName} does not exist.`);
|
|
98
|
+
}
|
|
99
|
+
let sourceText = text.toString('utf-8');
|
|
100
|
+
const lazyModuleStatement = '\r\n componentList.lazyLoadModulesMap = ' + env_1.GEN_LAZY_LOAD_MODULES_ARRAY + ';';
|
|
101
|
+
if (sourceText !== "" && sourceText.indexOf(lazyModuleStatement) == -1) {
|
|
102
|
+
let genLibSource = (0, ast_1.getSourceFile)(tree, origModuleFileName);
|
|
103
|
+
let newLazyModuleText = sourceText.replace(lazyModuleStatement, '').trim();
|
|
104
|
+
const constNode = (0, ast_utils_1.findNodes)(genLibSource, ts.SyntaxKind.Constructor)[0];
|
|
105
|
+
let lastStatementEnd = constNode.body.statements.end;
|
|
106
|
+
const prefix = sourceText.substring(0, lastStatementEnd);
|
|
107
|
+
const suffix = sourceText.substring(lastStatementEnd);
|
|
108
|
+
tree.overwrite(origModuleFileName, `${prefix} ${lazyModuleStatement} ${suffix}`);
|
|
109
|
+
}
|
|
110
|
+
return tree;
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
/*
|
|
114
|
+
* Add new component to component-list.g file (Array and Hash).
|
|
115
|
+
* If the file not exist new file will create by componentListGenIfNotExist function.
|
|
116
|
+
* */
|
|
117
|
+
function addNewCmpsToCmpListOrGenAll(options, module_name) {
|
|
118
|
+
return (host, context) => {
|
|
119
|
+
const metadata = env_1.env.metadata;
|
|
120
|
+
const cmpsToGen = env_1.env.app.views;
|
|
121
|
+
const cmpListPath = env_1.env.metadata.paths.componentListPath(module_name);
|
|
122
|
+
const source = host.read(cmpListPath);
|
|
123
|
+
if (source) {
|
|
124
|
+
let cmpToGenNum = 0;
|
|
125
|
+
let sourceStep1 = source.toString("utf-8");
|
|
126
|
+
let cmpListSource = (0, ast_1.getSourceFile)(host, cmpListPath);
|
|
127
|
+
let cmpListTs = getComponentsArrayInfo(cmpListSource, env_1.GEN_COMPONENTS_ARRAY);
|
|
128
|
+
existCmpListSet = new Set(cmpListTs.components);
|
|
129
|
+
newCmpListSet = new Set();
|
|
130
|
+
// merge between components in the file and new component to gen
|
|
131
|
+
cmpsToGen.forEach(newCmpGen => {
|
|
132
|
+
if (!existCmpListSet.has(newCmpGen.props.component_uniquename)) {
|
|
133
|
+
newCmpListSet.add(newCmpGen.props.component_uniquename);
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
const newCmpListArray = Array.from(newCmpListSet);
|
|
137
|
+
if (newCmpListArray && newCmpListArray.length > 0) {
|
|
138
|
+
let sourceStep2 = addComponentsToArray(sourceStep1, cmpListTs, newCmpListArray);
|
|
139
|
+
let cmpListHashTs = getComponentsHashInfo(cmpListSource, env_1.GEN_COMPONENTS_HASH);
|
|
140
|
+
let sourceStep3 = addComponentsToHash(sourceStep2, cmpListHashTs, newCmpListArray);
|
|
141
|
+
(0, Util_1.LogLn)(` Total old components: ${existCmpListSet.size}, added components: ${newCmpListSet.size}. `);
|
|
142
|
+
host.overwrite(cmpListPath, sourceStep3);
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
// If component-list.g.ts doesn't exist.
|
|
147
|
+
toAddImports = false; // We generate the entire file with imports.
|
|
148
|
+
return componentListGenIfNotExist(options)(host, context);
|
|
149
|
+
}
|
|
150
|
+
return host;
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
/*
|
|
154
|
+
* Create new component-list.g file.
|
|
155
|
+
* */
|
|
156
|
+
function componentListGenIfNotExist(options) {
|
|
157
|
+
return (host, context) => {
|
|
158
|
+
console.log("creating component-list");
|
|
159
|
+
const metadata = env_1.env.metadata;
|
|
160
|
+
const cmpList = new Set();
|
|
161
|
+
const data = {
|
|
162
|
+
app: env_1.env.app,
|
|
163
|
+
cmpList: env_1.env.app.views
|
|
164
|
+
};
|
|
165
|
+
const componentFile = {
|
|
166
|
+
template: `./templates/angular/src/app/component-list.g.ts`,
|
|
167
|
+
name: 'component-list.g.ts',
|
|
168
|
+
destination: metadata.paths.magicGenFolderPath,
|
|
169
|
+
type: types_1.GeneratedFileTypes.TS,
|
|
170
|
+
data: data
|
|
171
|
+
};
|
|
172
|
+
return (0, schematics_1.chain)([
|
|
173
|
+
(0, generate_rule_1.generate)(componentFile, options)
|
|
174
|
+
])(host, context);
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
/*
|
|
178
|
+
* Add new imports to component-list.g file.
|
|
179
|
+
* */
|
|
180
|
+
function addCmpsImportsToCmpList(options, module_name) {
|
|
181
|
+
return (host, context) => {
|
|
182
|
+
if (toAddImports) {
|
|
183
|
+
const cmpsToGen = env_1.env.app.views;
|
|
184
|
+
let cmpListSource = (0, ast_1.getSourceFile)(host, env_1.env.metadata.paths.componentListPath(module_name));
|
|
185
|
+
const recorder = host.beginUpdate(env_1.env.metadata.paths.componentListPath(module_name));
|
|
186
|
+
cmpsToGen.forEach(cmp => {
|
|
187
|
+
let name = cmp.props.id;
|
|
188
|
+
let uniqueName = cmp.props.component_uniquename;
|
|
189
|
+
let cmpPath = cmp.props.component_path;
|
|
190
|
+
if (newCmpListSet.has(uniqueName)) {
|
|
191
|
+
const importsChange = (0, route_utils_1.insertImport2)(cmpListSource, env_1.env.metadata.paths.componentListPath(module_name), name, uniqueName, `./${cmpPath}${name}.component`);
|
|
192
|
+
if (importsChange.toAdd) {
|
|
193
|
+
recorder.insertLeft(importsChange.pos, importsChange.toAdd);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
host.commitUpdate(recorder);
|
|
198
|
+
}
|
|
199
|
+
return host;
|
|
200
|
+
};
|
|
201
|
+
}
|
|
202
|
+
function getComponentsHashInfo(source, variable) {
|
|
203
|
+
const rootNode = source;
|
|
204
|
+
const cmpListVars = (0, ast_utils_1.findNodes)(rootNode, ts.SyntaxKind.VariableDeclaration);
|
|
205
|
+
let endPos = -1;
|
|
206
|
+
let isEmpty = true;
|
|
207
|
+
let magicGenCmpsInfo = cmpListVars.filter((node) => node.name.escapedText === variable);
|
|
208
|
+
if (magicGenCmpsInfo && magicGenCmpsInfo.length > 0) {
|
|
209
|
+
const firstPunctuation = (0, ast_utils_1.findNodes)(magicGenCmpsInfo[0], ts.SyntaxKind.FirstPunctuation);
|
|
210
|
+
if (!(firstPunctuation && firstPunctuation.length > 0)) {
|
|
211
|
+
throw new Error('magicGenCmpsHash variable has no open bracket ( { )');
|
|
212
|
+
}
|
|
213
|
+
endPos = firstPunctuation[0].end;
|
|
214
|
+
const propertyAssignment = (0, ast_utils_1.findNodes)(firstPunctuation[0].parent, ts.SyntaxKind.PropertyAssignment);
|
|
215
|
+
if (propertyAssignment && propertyAssignment.length > 0) {
|
|
216
|
+
isEmpty = false;
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
return {
|
|
220
|
+
components: null,
|
|
221
|
+
endPos,
|
|
222
|
+
isEmpty
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
function getComponentsArrayInfo(source, variable) {
|
|
226
|
+
const rootNode = source;
|
|
227
|
+
const cmpListVars = (0, ast_utils_1.findNodes)(rootNode, ts.SyntaxKind.VariableDeclaration);
|
|
228
|
+
let endPos = -1;
|
|
229
|
+
let cmpListArray;
|
|
230
|
+
let isEmpty = true;
|
|
231
|
+
let magicGenCmpsInfo = cmpListVars.filter((node) => node.name.escapedText === variable);
|
|
232
|
+
if (magicGenCmpsInfo && magicGenCmpsInfo.length > 0) {
|
|
233
|
+
const openBracketToken = (0, ast_utils_1.findNodes)(magicGenCmpsInfo[0], ts.SyntaxKind.OpenBracketToken);
|
|
234
|
+
if (!(openBracketToken && openBracketToken.length > 0)) {
|
|
235
|
+
throw new Error('magicGenComponents variable has no open bracket ([)');
|
|
236
|
+
}
|
|
237
|
+
endPos = openBracketToken[0].end;
|
|
238
|
+
const identifiers = (0, ast_utils_1.findNodes)(openBracketToken[0].parent, ts.SyntaxKind.Identifier);
|
|
239
|
+
// Array with items
|
|
240
|
+
if (identifiers && identifiers.length > 0) {
|
|
241
|
+
isEmpty = false;
|
|
242
|
+
//endPos = identifiers[identifiers.length - 1].end;
|
|
243
|
+
cmpListArray = identifiers.map((i) => i.escapedText);
|
|
244
|
+
}
|
|
245
|
+
// Array with no items
|
|
246
|
+
// else{
|
|
247
|
+
// endPos = openBracketToken[0].end;
|
|
248
|
+
// }
|
|
249
|
+
}
|
|
250
|
+
return {
|
|
251
|
+
components: cmpListArray,
|
|
252
|
+
endPos,
|
|
253
|
+
isEmpty
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
function getLazyLoadCompoenentsInfo(source, variable) {
|
|
257
|
+
const cmpListVars = (0, ast_utils_1.findNodes)(source, ts.SyntaxKind.VariableDeclaration);
|
|
258
|
+
let endPos = -1;
|
|
259
|
+
let cmpListArray;
|
|
260
|
+
let isEmpty = true;
|
|
261
|
+
let magicGenCmpsInfo = cmpListVars.filter((node) => node.name.escapedText === variable);
|
|
262
|
+
if (magicGenCmpsInfo && magicGenCmpsInfo.length > 0) {
|
|
263
|
+
const openBracketToken = (0, ast_utils_1.findNodes)(magicGenCmpsInfo[0], ts.SyntaxKind.FirstPunctuation);
|
|
264
|
+
if (!(openBracketToken && openBracketToken.length > 0)) {
|
|
265
|
+
throw new Error('FirstPunctuation variable has no open bracket ([)');
|
|
266
|
+
}
|
|
267
|
+
endPos = openBracketToken[0].end;
|
|
268
|
+
const identifiers = (0, ast_utils_1.findNodes)(openBracketToken[0].parent, ts.SyntaxKind.PropertyAssignment);
|
|
269
|
+
const identifiers1 = (0, ast_utils_1.findNodes)(openBracketToken[0].parent, ts.SyntaxKind.Identifier);
|
|
270
|
+
// Array with items
|
|
271
|
+
if (identifiers && identifiers.length > 0) {
|
|
272
|
+
isEmpty = false;
|
|
273
|
+
cmpListArray = identifiers.map((i) => i.name.escapedText).filter(id => id !== "moduleName" && id !== "modulePath");
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
return {
|
|
277
|
+
components: cmpListArray,
|
|
278
|
+
endPos,
|
|
279
|
+
isEmpty
|
|
280
|
+
};
|
|
281
|
+
}
|
|
282
|
+
function addComponentsToArray(source, info, cmpsToAdd) {
|
|
283
|
+
const prefix = source.substring(0, info.endPos);
|
|
284
|
+
const suffix = source.substring(info.endPos);
|
|
285
|
+
let toAdd = `${cmpsToAdd}`;
|
|
286
|
+
toAdd = `${toAdd.replace(/,/g, ",\n\t")}`;
|
|
287
|
+
return info.isEmpty ?
|
|
289
288
|
`${prefix}
|
|
290
|
-
\t${toAdd} ${suffix}` :
|
|
289
|
+
\t${toAdd} ${suffix}` :
|
|
291
290
|
`${prefix}
|
|
292
|
-
\t${toAdd},${suffix}`;
|
|
293
|
-
}
|
|
294
|
-
function addComponentsToHash(source, info, cmpsToAdd) {
|
|
295
|
-
const prefix = source.substring(0, info.endPos);
|
|
296
|
-
const suffix = source.substring(info.endPos);
|
|
291
|
+
\t${toAdd},${suffix}`;
|
|
292
|
+
}
|
|
293
|
+
function addComponentsToHash(source, info, cmpsToAdd) {
|
|
294
|
+
const prefix = source.substring(0, info.endPos);
|
|
295
|
+
const suffix = source.substring(info.endPos);
|
|
297
296
|
const cmpHashStr = EJS.render(`
|
|
298
297
|
<% components.forEach(componentUniqueName => { %>
|
|
299
298
|
<%= componentUniqueName %>:<%- componentUniqueName %>,
|
|
300
|
-
<%})%>`, { components: cmpsToAdd });
|
|
301
|
-
let toAdd = `${cmpHashStr.replace(/\n/g, '').replace(/,/g, ",\n")}`;
|
|
302
|
-
// update source
|
|
303
|
-
return `${prefix} ${toAdd} ${suffix}`;
|
|
304
|
-
/*return info.isEmpty ?
|
|
305
|
-
`${prefix} ${delLastComma(cmpHashStr)} ${suffix}` :
|
|
306
|
-
`${prefix} ${delLastComma(cmpHashStr)}, ${suffix}` ;*/
|
|
307
|
-
}
|
|
308
|
-
// add the lazy loaded components to map
|
|
309
|
-
function addComponentsToLazyLoad(source, info, cmpsToAdd, module_name) {
|
|
310
|
-
const prefix = source.substring(0, info.endPos);
|
|
311
|
-
const suffix = source.substring(info.endPos);
|
|
312
|
-
// get the module path
|
|
313
|
-
let currentModulePath = env_1.env.metadata.paths.magicGenLibModulePath(module_name);
|
|
299
|
+
<%})%>`, { components: cmpsToAdd });
|
|
300
|
+
let toAdd = `${cmpHashStr.replace(/\n/g, '').replace(/,/g, ",\n")}`;
|
|
301
|
+
// update source
|
|
302
|
+
return `${prefix} ${toAdd} ${suffix}`;
|
|
303
|
+
/*return info.isEmpty ?
|
|
304
|
+
`${prefix} ${delLastComma(cmpHashStr)} ${suffix}` :
|
|
305
|
+
`${prefix} ${delLastComma(cmpHashStr)}, ${suffix}` ;*/
|
|
306
|
+
}
|
|
307
|
+
// add the lazy loaded components to map
|
|
308
|
+
function addComponentsToLazyLoad(source, info, cmpsToAdd, module_name) {
|
|
309
|
+
const prefix = source.substring(0, info.endPos);
|
|
310
|
+
const suffix = source.substring(info.endPos);
|
|
311
|
+
// get the module path
|
|
312
|
+
let currentModulePath = env_1.env.metadata.paths.magicGenLibModulePath(module_name);
|
|
314
313
|
const cmpHashStr = EJS.render(`
|
|
315
314
|
<%{components.forEach(view =>{-%>
|
|
316
315
|
<%=view.props.component_uniquename %> : { moduleName : 'Magic<%=moduleName%>Module'},
|
|
317
|
-
<%})}-%>`, { components: cmpsToAdd, moduleName: module_name, modulePath: currentModulePath });
|
|
318
|
-
let toAdd = `${cmpHashStr.replace(/\n/g, '').replace(/,/g, ",\n")}`;
|
|
319
|
-
// update source
|
|
320
|
-
return `${prefix} ${toAdd} ${suffix}`;
|
|
321
|
-
}
|
|
322
|
-
function delLastComma(source) {
|
|
323
|
-
let index = source.lastIndexOf(',');
|
|
324
|
-
return source.substring(0, index);
|
|
325
|
-
}
|
|
316
|
+
<%})}-%>`, { components: cmpsToAdd, moduleName: module_name, modulePath: currentModulePath });
|
|
317
|
+
let toAdd = `${cmpHashStr.replace(/\n/g, '').replace(/,/g, ",\n")}`;
|
|
318
|
+
// update source
|
|
319
|
+
return `${prefix} ${toAdd} ${suffix}`;
|
|
320
|
+
}
|
|
321
|
+
function delLastComma(source) {
|
|
322
|
+
let index = source.lastIndexOf(',');
|
|
323
|
+
return source.substring(0, index);
|
|
324
|
+
}
|
|
326
325
|
//# sourceMappingURL=component-list.rule.js.map
|