@magic-xpa/cli 4.1200.0-dev4120.7 → 4.1200.0-dev4120.71
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/package.json +1 -1
- package/src/schematics/magic-utils/Util.js +4 -4
- package/src/schematics/magic-utils/Util.js.map +1 -1
- package/src/schematics/magic-utils/config.js +2 -2
- package/src/schematics/magic-utils/config.js.map +1 -1
- package/src/schematics/magic-utils/env.js +3 -3
- package/src/schematics/magic-utils/env.js.map +1 -1
- package/src/schematics/magic-utils/env.ts +3 -3
- package/src/schematics/magic-utils/manifest.js.map +1 -1
- package/src/schematics/magic-utils/metadata.class.js +1 -1
- package/src/schematics/magic-utils/metadata.class.js.map +1 -1
- package/src/schematics/magic-utils/metadata.class.ts +1 -1
- package/src/schematics/magic-utils/process-json.js +1 -2
- package/src/schematics/magic-utils/process-json.js.map +1 -1
- package/src/schematics/magic-utils/rules/build-control.rule.js +2 -3
- package/src/schematics/magic-utils/rules/build-control.rule.js.map +1 -1
- package/src/schematics/magic-utils/rules/build-view.rule.js +1 -2
- package/src/schematics/magic-utils/rules/build-view.rule.js.map +1 -1
- package/src/schematics/magic-utils/rules/component-list.rule.js +1 -2
- package/src/schematics/magic-utils/rules/component-list.rule.js.map +1 -1
- package/src/schematics/magic-utils/rules/generate.rule.js +2 -3
- package/src/schematics/magic-utils/rules/generate.rule.js.map +1 -1
- package/src/schematics/magic-utils/rules/init-add-modules.rule.js +10 -11
- package/src/schematics/magic-utils/rules/init-add-modules.rule.js.map +1 -1
- package/src/schematics/magic-utils/rules/init-gen-components.rule.js +2 -3
- package/src/schematics/magic-utils/rules/init-gen-components.rule.js.map +1 -1
- package/src/schematics/magic-utils/rules/init-magic-metadata.rule.js +1 -2
- package/src/schematics/magic-utils/rules/init-magic-metadata.rule.js.map +1 -1
- package/src/schematics/magic-utils/rules/load-views-gen.rule.js +1 -2
- package/src/schematics/magic-utils/rules/load-views-gen.rule.js.map +1 -1
- package/src/schematics/magic-utils/utils.js +9 -10
- package/src/schematics/magic-utils/utils.js.map +1 -1
- package/src/schematics/mg-Install-prerequisites/index.js +1 -2
- package/src/schematics/mg-Install-prerequisites/index.js.map +1 -1
- package/src/schematics/mg-add/index.js +5 -4
- package/src/schematics/mg-add/index.js.map +1 -1
- package/src/schematics/mg-add/index.ts +4 -2
- package/src/schematics/mg-add/utils/add-declaration-to-root-module.js +1 -2
- package/src/schematics/mg-add/utils/add-declaration-to-root-module.js.map +1 -1
- package/src/schematics/mg-add-tasks/index.js +1 -2
- package/src/schematics/mg-add-tasks/index.js.map +1 -1
- package/src/schematics/mg-delete-files/index.js +1 -2
- package/src/schematics/mg-delete-files/index.js.map +1 -1
- package/src/schematics/mg-gen-module/index.js +1 -2
- package/src/schematics/mg-gen-module/index.js.map +1 -1
- package/src/schematics/mg-generate/index.js +1 -2
- package/src/schematics/mg-generate/index.js.map +1 -1
- package/src/schematics/mg-generate-component/index.js +1 -2
- package/src/schematics/mg-generate-component/index.js.map +1 -1
- package/src/schematics/mg-install/index.js +1 -2
- package/src/schematics/mg-install/index.js.map +1 -1
- package/src/schematics/mg-routes/index.js +5 -6
- package/src/schematics/mg-routes/index.js.map +1 -1
- package/src/schematics/mg-single-control/index.js +1 -2
- package/src/schematics/mg-single-control/index.js.map +1 -1
- package/src/schematics/utils/ast.js +6 -7
- package/src/schematics/utils/ast.js.map +1 -1
- package/src/schematics/utils/devkit-utils/ast-utils.js +16 -17
- package/src/schematics/utils/devkit-utils/ast-utils.js.map +1 -1
- package/src/schematics/utils/devkit-utils/ast-utils_old.js +14 -15
- package/src/schematics/utils/devkit-utils/ast-utils_old.js.map +1 -1
- package/src/schematics/utils/devkit-utils/change.js.map +1 -1
- package/src/schematics/utils/devkit-utils/component.js +1 -2
- package/src/schematics/utils/devkit-utils/component.js.map +1 -1
- package/src/schematics/utils/devkit-utils/config.js +3 -3
- package/src/schematics/utils/devkit-utils/config.js.map +1 -1
- package/src/schematics/utils/devkit-utils/find-module.js +3 -4
- package/src/schematics/utils/devkit-utils/find-module.js.map +1 -1
- package/src/schematics/utils/devkit-utils/ng-ast-utils.js +3 -4
- package/src/schematics/utils/devkit-utils/ng-ast-utils.js.map +1 -1
- package/src/schematics/utils/devkit-utils/parse-name.js +1 -2
- package/src/schematics/utils/devkit-utils/parse-name.js.map +1 -1
- package/src/schematics/utils/devkit-utils/route-utils.js +2 -3
- package/src/schematics/utils/devkit-utils/route-utils.js.map +1 -1
- package/src/schematics/utils/devkit-utils/validation.js +1 -2
- package/src/schematics/utils/devkit-utils/validation.js.map +1 -1
- package/src/schematics/utils/html.js +2 -3
- package/src/schematics/utils/html.js.map +1 -1
- package/src/schematics/utils/package.js +1 -2
- package/src/schematics/utils/package.js.map +1 -1
- package/src/schematics/utils/testing.js +1 -2
- package/src/schematics/utils/testing.js.map +1 -1
- package/src/types/enums/Enums.d.ts +4 -4
- package/templates/angular/src/app.component.ts +4 -2
- package/templates/component/view.component.ts +1 -0
- /package/src/schematics/mg-add/files/{src → public}/favicon.ico +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.addDeclarationToRootModule =
|
|
3
|
+
exports.addDeclarationToRootModule = addDeclarationToRootModule;
|
|
4
4
|
const ast_1 = require("../../utils/ast");
|
|
5
5
|
const ast_utils_1 = require("../../utils/devkit-utils/ast-utils");
|
|
6
6
|
const core_1 = require("@angular-devkit/core");
|
|
@@ -8,5 +8,4 @@ function addDeclarationToRootModule(host, moduleName, importSrc) {
|
|
|
8
8
|
let path = `src/app/app.module.ts`, source = (0, ast_1.getSourceFile)(host, path);
|
|
9
9
|
(0, ast_utils_1.addDeclarationToModule)(source, (0, core_1.normalize)(path), moduleName, importSrc);
|
|
10
10
|
}
|
|
11
|
-
exports.addDeclarationToRootModule = addDeclarationToRootModule;
|
|
12
11
|
//# sourceMappingURL=add-declaration-to-root-module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"add-declaration-to-root-module.js","sourceRoot":"","sources":["add-declaration-to-root-module.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"add-declaration-to-root-module.js","sourceRoot":"","sources":["add-declaration-to-root-module.ts"],"names":[],"mappings":";;AAKA,gEAMC;AAXD,yCAA8C;AAC9C,kEAA0E;AAE1E,+CAA+C;AAE/C,SAAgB,0BAA0B,CAAC,IAAU,EAAE,UAAkB,EAAE,SAAiB;IAC3F,IACC,IAAI,GAAK,uBAAuB,EAChC,MAAM,GAAG,IAAA,mBAAa,EAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAEpC,IAAA,kCAAsB,EAAC,MAAM,EAAE,IAAA,gBAAS,EAAC,IAAI,CAAC,EAAE,UAAU,EAAE,SAAS,CAAC,CAAC;AACxE,CAAC","sourcesContent":["import {getSourceFile} from '../../utils/ast';\nimport {addDeclarationToModule} from '../../utils/devkit-utils/ast-utils';\nimport {Tree} from '@angular-devkit/schematics';\nimport {normalize} from '@angular-devkit/core';\n\nexport function addDeclarationToRootModule(host: Tree, moduleName: string, importSrc: string) {\n\tlet\n\t\tpath = `src/app/app.module.ts`,\n\t\tsource = getSourceFile(host, path);\n\t\n\taddDeclarationToModule(source, normalize(path), moduleName, importSrc);\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mgAddTasks =
|
|
3
|
+
exports.mgAddTasks = mgAddTasks;
|
|
4
4
|
const tasks_1 = require("@angular-devkit/schematics/tasks");
|
|
5
5
|
const env_1 = require("../magic-utils/env");
|
|
6
6
|
function mgAddTasks(options) {
|
|
@@ -27,5 +27,4 @@ function mgAddTasks(options) {
|
|
|
27
27
|
const ngAddTask = context.addTask(new tasks_1.RunSchematicTask('mg-add', options), [devInstallTask, packagesInstallTask, deleteFilesTask]);
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
-
exports.mgAddTasks = mgAddTasks;
|
|
31
30
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAMA,gCA4CC;AAjDD,4DAA4F;AAE5F,4CAAkF;AAGlF,SAAgB,UAAU,CAAC,OAAyB;IAClD,OAAO,CAAC,IAAS,EAAE,OAAwB,EAAC,EAAE;QAE5C,OAAO,CAAC,GAAG,CAAC,yDAAyD,GAAG,OAAO,CAAC,UAAU,CAAE,CAAC;QAC7F,qBAAe,CAAC,IAAI,CAAC,IAAI,mBAAa,CAAC,gBAAgB,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC;QAE9E,8BAA8B;QAC9B,MAAM,cAAc,GAAG,OAAO,CAAC,OAAO,CACpC,IAAI,wBAAgB,CAAC,YAAY,EAAE;YACjC,WAAW,EAAO,KAAK;YACvB,eAAe,EAAG,KAAK;YACvB,YAAY,EAAM,EAAE;YACpB,eAAe,EAAG,qBAAe;SAClC,CAAC,CACH,CAAC;QAIF,OAAO,CAAC,GAAG,CAAC,6DAA6D,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;QACpG,kBAAY,CAAC,IAAI,CAAC,IAAI,mBAAa,CAAC,oBAAoB,EAAE,OAAO,CAAC,cAAc,CAAE,CAAC,CAAC;QAEpF,2BAA2B;QAC3B,MAAM,mBAAmB,GAAG,OAAO,CAAC,OAAO,CACzC,IAAI,wBAAgB,CAAC,YAAY,EAAE;YACjC,WAAW,EAAO,OAAO,CAAC,WAAW;YACrC,eAAe,EAAG,OAAO,CAAC,eAAe;YACzC,YAAY,EAAM,kBAAY;YAC9B,eAAe,EAAG,EAAE;SACrB,CAAC,EACF,CAAC,cAAc,CAAC,CACjB,CAAC;QAGF,MAAM,eAAe,GAAG,OAAO,CAAC,OAAO,CACrC,IAAI,wBAAgB,CAAC,cAAc,EAAE,OAAO,CAAC,EAC7C,CAAC,cAAc,EAAC,mBAAmB,CAAC,CACrC,CAAC;QAEF,MAAM,SAAS,GAAG,OAAO,CAAC,OAAO,CAC/B,IAAI,wBAAgB,CAAC,QAAQ,EAAE,OAAO,CAAC,EACvC,CAAC,cAAc,EAAE,mBAAmB,EAAE,eAAe,CAAC,CACvD,CAAC;IAEJ,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { Rule,Tree,SchematicContext } from \"@angular-devkit/schematics\";\nimport { NodePackageInstallTask, RunSchematicTask } from \"@angular-devkit/schematics/tasks\";\nimport { addPackageToPackageJson } from \"../utils/package\";\nimport { dependencies, devDependencies, Idependencies } from \"../magic-utils/env\";\nimport { MagicOptionScheme } from \"../magic-utils/rules/magic-option.scheme\";\n\nexport function mgAddTasks(options:MagicOptionScheme): Rule {\n return (host:Tree, context:SchematicContext)=>{\n\n console.log(\" [V - add install dependencies !] options.cliVersion=\" + options.cliVersion );\n devDependencies.push(new Idependencies(\"@magic-xpa/cli\", options.cliVersion));\n\n // install the devDependencies\n const devInstallTask = context.addTask(\n new RunSchematicTask('mg-install', {\n skipInstall : false,\n skipPackageJson : false,\n dependencies : [],\n devDependencies : devDependencies\n })\n );\n\n\n\n console.log(\" [V - add install dependencies !] options.angularVersion=\" + options.angularVersion);\n dependencies.push(new Idependencies(\"@magic-xpa/angular\", options.angularVersion ));\n\n // install the dependencies\n const packagesInstallTask = context.addTask(\n new RunSchematicTask('mg-install', {\n skipInstall : options.skipInstall,\n skipPackageJson : options.skipPackageJson,\n dependencies : dependencies,\n devDependencies : []\n }),\n [devInstallTask]\n );\n\n\n const deleteFilesTask = context.addTask(\n new RunSchematicTask('delete-files', options),\n [devInstallTask,packagesInstallTask]\n );\n\n const ngAddTask = context.addTask(\n new RunSchematicTask('mg-add', options),\n [devInstallTask, packagesInstallTask, deleteFilesTask]\n );\n\n };\n}\n\n\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mgDeleteFiles =
|
|
3
|
+
exports.mgDeleteFiles = mgDeleteFiles;
|
|
4
4
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
5
|
const init_magic_metadata_rule_1 = require("../magic-utils/rules/init-magic-metadata.rule");
|
|
6
6
|
const utils_1 = require("../magic-utils/utils");
|
|
@@ -10,5 +10,4 @@ function mgDeleteFiles(options) {
|
|
|
10
10
|
(0, utils_1.deleteMagicFiles)(options),
|
|
11
11
|
]);
|
|
12
12
|
}
|
|
13
|
-
exports.mgDeleteFiles = mgDeleteFiles;
|
|
14
13
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAKA,sCAKC;AAVD,2DAAsD;AACtD,4FAAmF;AACnF,gDAAuD;AAGvD,SAAgB,aAAa,CAAC,OAAyB;IACrD,OAAO,IAAA,kBAAK,EAAC;QACX,IAAA,4CAAiB,EAAE,OAAO,CAAC;QAC3B,IAAA,wBAAgB,EAAG,OAAO,CAAC;KAC5B,CAAC,CAAC;AACL,CAAC","sourcesContent":["import {chain,Rule} from \"@angular-devkit/schematics\";\nimport { initMagicMetadata} from \"../magic-utils/rules/init-magic-metadata.rule\";\nimport { deleteMagicFiles} from \"../magic-utils/utils\";\nimport { MagicOptionScheme } from \"../magic-utils/rules/magic-option.scheme\";\n\nexport function mgDeleteFiles(options:MagicOptionScheme): Rule {\n return chain([\n initMagicMetadata (options),\n deleteMagicFiles (options),\n ]);\n}\n\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mgGenModule =
|
|
3
|
+
exports.mgGenModule = mgGenModule;
|
|
4
4
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
5
|
const init_magic_metadata_rule_1 = require("../magic-utils/rules/init-magic-metadata.rule");
|
|
6
6
|
const init_add_modules_rule_1 = require("../magic-utils/rules/init-add-modules.rule");
|
|
@@ -12,5 +12,4 @@ function mgGenModule(options) {
|
|
|
12
12
|
(0, init_add_modules_rule_1.generateWebModules)(options)
|
|
13
13
|
]);
|
|
14
14
|
}
|
|
15
|
-
exports.mgGenModule = mgGenModule;
|
|
16
15
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAKA,kCAQC;AAbD,2DAAyD;AACzD,4FAAmF;AAEnF,sFAAgG;AAEhG,SAAgB,WAAW,CAAC,OAAyB;IACnD,OAAO,IAAA,kBAAK,EAAC;QACX,IAAA,4CAAiB,EAAE,OAAO,CAAC;QAE3B,4CAA4C;QAC5C,IAAA,sCAAc,EAAE,OAAO,CAAC;QACxB,IAAA,0CAAkB,EAAC,OAAO,CAAC;KAC5B,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { chain, Rule } from \"@angular-devkit/schematics\";\nimport { initMagicMetadata} from \"../magic-utils/rules/init-magic-metadata.rule\";\nimport { MagicOptionScheme } from \"../magic-utils/rules/magic-option.scheme\";\nimport { generateWebModules, initGenModules } from \"../magic-utils/rules/init-add-modules.rule\";\n\nexport function mgGenModule(options:MagicOptionScheme): Rule {\n return chain([\n initMagicMetadata (options),\n\n // ** generate the modules in the project **\n initGenModules (options),\n generateWebModules(options)\n ]);\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mgGenerate =
|
|
3
|
+
exports.mgGenerate = mgGenerate;
|
|
4
4
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
5
|
const init_magic_metadata_rule_1 = require("../magic-utils/rules/init-magic-metadata.rule");
|
|
6
6
|
const init_gen_components_rule_1 = require("../magic-utils/rules/init-gen-components.rule");
|
|
@@ -10,5 +10,4 @@ function mgGenerate(options) {
|
|
|
10
10
|
(0, init_gen_components_rule_1.initAndGenComponentsForModule)(options, true)
|
|
11
11
|
]);
|
|
12
12
|
}
|
|
13
|
-
exports.mgGenerate = mgGenerate;
|
|
14
13
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAMA,gCAKC;AAXD,2DAAiF;AAEjF,4FAAmF;AACnF,4FAA6F;AAG7F,SAAgB,UAAU,CAAC,OAAyB;IAClD,OAAO,IAAA,kBAAK,EAAC;QACX,IAAA,4CAAiB,EAAE,OAAO,CAAC;QAC3B,IAAA,wDAA6B,EAAE,OAAO,EAAE,IAAI,CAAC;KAC9C,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { chain, Rule, SchematicContext, Tree } from \"@angular-devkit/schematics\";\n\nimport { initMagicMetadata} from \"../magic-utils/rules/init-magic-metadata.rule\";\nimport { initAndGenComponentsForModule} from \"../magic-utils/rules/init-gen-components.rule\";\nimport { MagicOptionScheme } from \"../magic-utils/rules/magic-option.scheme\";\n\nexport function mgGenerate(options:MagicOptionScheme): Rule {\n return chain([\n initMagicMetadata (options),\n initAndGenComponentsForModule (options, true)\n ]);\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mgGenerateComponent =
|
|
3
|
+
exports.mgGenerateComponent = mgGenerateComponent;
|
|
4
4
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
5
|
const init_magic_metadata_rule_1 = require("../magic-utils/rules/init-magic-metadata.rule");
|
|
6
6
|
const Util_1 = require("../magic-utils/Util");
|
|
@@ -17,7 +17,6 @@ function mgGenerateComponent(options) {
|
|
|
17
17
|
(0, init_gen_components_rule_1.initAndGenComponentsForModule)(options, true, true)
|
|
18
18
|
]);
|
|
19
19
|
}
|
|
20
|
-
exports.mgGenerateComponent = mgGenerateComponent;
|
|
21
20
|
// To get the module name from the FormId
|
|
22
21
|
// In the case of containertype="Directory", consider root module.
|
|
23
22
|
// In all other cases gets the first string value till separator(/) from the formId.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAMA,kDAcC;AApBD,2DAAiF;AACjF,4FAAmF;AAEnF,8CAA0C;AAC1C,4FAA4F;AAE5F,SAAgB,mBAAmB,CAAC,OAAyB;IAE3D,IAAG,OAAO,CAAC,SAAS,IAAI,EAAE,EAAC,CAAC;QAC1B,IAAA,YAAK,EAAC,qCAAqC,CAAC,CAAC;QAC7C,OAAO,IAAA,kBAAK,EAAC,EAAE,CAAC,CAAC;IACnB,CAAC;IAED,OAAO,CAAC,MAAM,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;IACxC,OAAO,CAAC,YAAY,GAAG,4BAA4B,CAAC,OAAO,CAAC,CAAC;IAE7D,OAAO,IAAA,kBAAK,EAAC;QACX,IAAA,4CAAiB,EAAE,OAAO,CAAC;QAC3B,IAAA,wDAA6B,EAAC,OAAO,EAAE,IAAI,EAAC,IAAI,CAAC;KAClD,CAAC,CAAC;AACL,CAAC;AAED,yCAAyC;AACzC,kEAAkE;AAClE,oFAAoF;AACpF,SAAS,aAAa,CAAC,OAA0B;IAC/C,IAAI,UAAU,GAAU,EAAE,CAAC;IAC3B,IAAG,OAAO,CAAC,aAAa,IAAI,OAAO,CAAC,aAAa,KAAK,WAAW;QAC/D,UAAU,GAAG,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;IAC/C,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,0CAA0C;AAC1C,4EAA4E;AAC5E,2CAA2C;AAC3C,SAAS,4BAA4B,CAAC,OAA0B;IAC7D,OAAO,OAAO,CAAC,aAAa,KAAK,oBAAoB,CAAC;AACzD,CAAC","sourcesContent":["import { chain, Rule, SchematicContext, Tree } from \"@angular-devkit/schematics\";\r\nimport { initMagicMetadata} from \"../magic-utils/rules/init-magic-metadata.rule\";\r\nimport { MagicOptionScheme } from \"../magic-utils/rules/magic-option.scheme\";\r\nimport {LogLn} from \"../magic-utils/Util\";\r\nimport {initAndGenComponentsForModule} from \"../magic-utils/rules/init-gen-components.rule\";\r\n\r\nexport function mgGenerateComponent(options:MagicOptionScheme): Rule {\r\n\r\n if(options.component == ''){\r\n LogLn('Component name should not be empty.');\r\n return chain([]);\r\n }\r\n\r\n options.module = getModuleName(options);\r\n options.loadOnDemand = getLoadOnDemandFlagForModule(options);\r\n\r\n return chain([\r\n initMagicMetadata (options),\r\n initAndGenComponentsForModule(options, true,true)\r\n ]);\r\n}\r\n\r\n// To get the module name from the FormId\r\n// In the case of containertype=\"Directory\", consider root module.\r\n// In all other cases gets the first string value till separator(/) from the formId.\r\nfunction getModuleName(options: MagicOptionScheme){\r\n let moduleName:string = \"\";\r\n if(options.containertype && options.containertype !== \"Directory\")\r\n moduleName = options.component.split('/')[0];\r\n return moduleName;\r\n}\r\n\r\n// To get loadOnDemand flag for the module\r\n// In the case of containertype == \"LoadOnDemandModule\", consider it as true\r\n// In all other cases, consider it as false\r\nfunction getLoadOnDemandFlagForModule(options: MagicOptionScheme){\r\n return options.containertype === \"LoadOnDemandModule\";\r\n}\r\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mgInstall =
|
|
3
|
+
exports.mgInstall = mgInstall;
|
|
4
4
|
const tasks_1 = require("@angular-devkit/schematics/tasks");
|
|
5
5
|
const package_1 = require("../utils/package");
|
|
6
6
|
function mgInstall(options) {
|
|
@@ -27,5 +27,4 @@ function mgInstall(options) {
|
|
|
27
27
|
return host;
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
-
exports.mgInstall = mgInstall;
|
|
31
30
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAMA,8BA4BC;AAjCD,4DAA4F;AAC5F,8CAA2D;AAI3D,SAAgB,SAAS,CAAC,OAAyB;IACjD,OAAO,CAAC,IAAS,EAAE,OAAwB,EAAC,EAAE;QAE5C,iBAAiB;QACjB,sCAAsC;QACtC,+BAA+B;QAC/B,mFAAmF;QACnF,IAAI;QAEJ,IAAG,CAAC,OAAO,CAAC,eAAe,EAAC,CAAC;YAC3B,KAAK,IAAI,GAAG,IAAI,OAAO,CAAC,YAAY,EAAC,CAAC;gBACpC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,wBAAwB,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;gBACvE,IAAA,iCAAuB,EAAC,IAAI,EAAE,cAAc,EAAE,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;YACvE,CAAC;YACD,KAAK,IAAI,GAAG,IAAI,OAAO,CAAC,eAAe,EAAC,CAAC;gBACvC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,2BAA2B,GAAG,CAAC,IAAI,IAAI,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;gBAC1E,IAAA,iCAAuB,EAAC,IAAI,EAAE,iBAAiB,EAAE,GAAG,CAAC,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC;YAC1E,CAAC;QACH,CAAC;QAED,IAAG,CAAC,OAAO,CAAC,WAAW,EAAC,CAAC;YACvB,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,2BAA2B,CAAC,CAAC;YACjD,OAAO,CAAC,OAAO,CAAC,IAAI,8BAAsB,EAAE,CAAC,CAAC;QAChD,CAAC;QAED,OAAO,IAAI,CAAC;IAEd,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { Rule,Tree,SchematicContext } from \"@angular-devkit/schematics\";\nimport { NodePackageInstallTask, RunSchematicTask } from \"@angular-devkit/schematics/tasks\";\nimport { addPackageToPackageJson } from \"../utils/package\";\nimport { dependencies, devDependencies, Idependencies } from \"../magic-utils/env\";\nimport { MagicOptionScheme } from \"../magic-utils/rules/magic-option.scheme\";\n\nexport function mgInstall(options:MagicOptionScheme): Rule {\n return (host:Tree, context:SchematicContext)=>{\n\n // for debug only\n // if (options.dependencies == null) {\n // options.dependencies = [];\n // options.dependencies.push(new Idependencies(\"@magic-xpa/angular\", \"0.0.177\"));\n // }\n\n if(!options.skipPackageJson){\n for (let dep of options.dependencies){\n context.logger.info(`[>] Add dependencies ${dep.name} ${dep.version}`);\n addPackageToPackageJson(host, 'dependencies', dep.name, dep.version);\n }\n for (let dep of options.devDependencies){\n context.logger.info(`[>] Add devDependencies ${dep.name} ${dep.version}`);\n addPackageToPackageJson(host, 'devDependencies', dep.name, dep.version);\n }\n }\n\n if(!options.skipInstall){\n context.logger.info(`[>] Install dependencies.`);\n context.addTask(new NodePackageInstallTask());\n }\n\n return host;\n\n };\n}\n\n\n"]}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.mgGenerateRoutes = mgGenerateRoutes;
|
|
4
|
+
exports.genRoutesFile = genRoutesFile;
|
|
5
|
+
exports.genRouteFile = genRouteFile;
|
|
4
6
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
7
|
const init_magic_metadata_rule_1 = require("../magic-utils/rules/init-magic-metadata.rule");
|
|
6
8
|
const types_1 = require("../../types");
|
|
@@ -13,7 +15,6 @@ function mgGenerateRoutes(options) {
|
|
|
13
15
|
genRoutesFile(options)
|
|
14
16
|
]);
|
|
15
17
|
}
|
|
16
|
-
exports.mgGenerateRoutes = mgGenerateRoutes;
|
|
17
18
|
//-------------------------------------------------------------------------------------------------
|
|
18
19
|
// generate all the modules in env.modulesGen
|
|
19
20
|
//-------------------------------------------------------------------------------------------------
|
|
@@ -29,7 +30,6 @@ function genRoutesFile(options) {
|
|
|
29
30
|
return (0, schematics_1.chain)(rules)(tree, context);
|
|
30
31
|
};
|
|
31
32
|
}
|
|
32
|
-
exports.genRoutesFile = genRoutesFile;
|
|
33
33
|
function genRouteFile(options, routeItem) {
|
|
34
34
|
return (host, context) => {
|
|
35
35
|
const metadata = env_1.env.metadata;
|
|
@@ -50,8 +50,8 @@ function genRouteFile(options, routeItem) {
|
|
|
50
50
|
context.logger.info(`generating ${data.routesArray.length} root routes`);
|
|
51
51
|
const componentFile = {
|
|
52
52
|
type: types_1.GeneratedFileTypes.TS,
|
|
53
|
-
template: template,
|
|
54
|
-
destination: destinationPath,
|
|
53
|
+
template: template, // `./templates/angular/src/app.routes.ts`,
|
|
54
|
+
destination: destinationPath, // metadata.paths.rootMagicGenFolder,
|
|
55
55
|
name: 'app.routes.ts',
|
|
56
56
|
data: data
|
|
57
57
|
};
|
|
@@ -60,5 +60,4 @@ function genRouteFile(options, routeItem) {
|
|
|
60
60
|
])(host, context);
|
|
61
61
|
};
|
|
62
62
|
}
|
|
63
|
-
exports.genRouteFile = genRouteFile;
|
|
64
63
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index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AAK,CAAC;QACvE,IAAA,YAAK,EAAC,mBAAmB,SAAS,CAAC,WAAW,wBAAwB,eAAe,EAAE,CAAC,CAAA;QAExF,MAAM,IAAI,GAAQ;YAChB,WAAW,EAAE,SAAS,CAAC,WAAW;YAClC,eAAe,EAAC,eAAe;SAChC,CAAC;QAEF,IAAI,QAAQ,GAAY,uCAAuC,CAAC;QAChE,IAAI,eAAe,GAAW,QAAQ,CAAC,KAAK,CAAC,kBAAkB,CAAC;QAChE,IAAI,SAAS,CAAC,WAAW,IAAI,EAAE,EAC/B,CAAC;YACC,eAAe,GAAG,QAAQ,CAAC,KAAK,CAAC,kBAAkB,GAAG,IAAI,SAAS,CAAC,WAAW,EAAE,CAAC;QACpF,CAAC;QAED,IAAI,IAAI,CAAC,WAAW,IAAK,SAAS;YAChC,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,6BAA6B,CAAC,CAAC;;YAEnD,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,cAAc,IAAI,CAAC,WAAW,CAAC,MAAM,cAAc,CAAC,CAAC;QAE3E,MAAM,aAAa,GAAmB;YACpC,IAAI,EAAU,0BAAkB,CAAC,EAAE;YACnC,QAAQ,EAAM,QAAQ,EAAoC,2CAA2C;YACrG,WAAW,EAAG,eAAe,EAA6B,qCAAqC;YAC/F,IAAI,EAAU,eAAe;YAC7B,IAAI,EAAU,IAAI;SACnB,CAAC;QAEF,OAAO,IAAA,kBAAK,EAAC;YACX,IAAA,wBAAQ,EAAC,aAAa,EAAC,OAAO,CAAC;SAChC,CAAC,CAAC,IAAI,EAAC,OAAO,CAAC,CAAC;IACnB,CAAC,CAAA;AACH,CAAC","sourcesContent":["import { chain, forEach, Rule, SchematicContext, Tree, url } from \"@angular-devkit/schematics\";\r\nimport { initMagicMetadata } from \"../magic-utils/rules/init-magic-metadata.rule\";\r\nimport { GeneratedFileTypes, TemplateConfig } from \"../../types\";\r\nimport { generate } from \"../magic-utils/rules/generate.rule\";\r\nimport { env } from \"../magic-utils/env\";\r\nimport { MagicOptionScheme } from \"../magic-utils/rules/magic-option.scheme\";\r\nimport { RouteTable } from \"../../types/interfaces/app\";\r\nimport { LogLn } from \"../magic-utils/Util\";\r\n\r\nexport function mgGenerateRoutes(options: MagicOptionScheme): Rule {\r\n return chain([\r\n initMagicMetadata (options),\r\n genRoutesFile (options)\r\n ]);\r\n}\r\n\r\n//-------------------------------------------------------------------------------------------------\r\n// generate all the modules in env.modulesGen\r\n//-------------------------------------------------------------------------------------------------\r\nexport function genRoutesFile(options: MagicOptionScheme): Rule {\r\n return (tree: Tree, context: SchematicContext) => {\r\n\r\n const metadata = env.metadata;\r\n let routeTable: RouteTable[] = metadata.routesTable;\r\n let rules:Rule[] = [];\r\n\r\n context.logger.info(`routes length: ${routeTable.length}`);\r\n\r\n for (let routeItem of routeTable){\r\n rules.push(genRouteFile(options, routeItem));\r\n }\r\n\r\n return chain(rules)(tree,context);\r\n };\r\n}\r\n\r\n\r\n\r\n\r\n\r\nexport function genRouteFile(options: MagicOptionScheme, routeItem : RouteTable ) : Rule {\r\n return (host: Tree, context: SchematicContext) => {\r\n const metadata = env.metadata;\r\n let createRootRoute:boolean = routeItem.module_name =='' ? true: false;\r\n LogLn(`genRouteFile : [${routeItem.module_name}] createRootRoute = ${createRootRoute}`)\r\n\r\n const data: any = {\r\n routesArray: routeItem.routesArray,\r\n createRootRoute:createRootRoute\r\n };\r\n\r\n let template : string = `./templates/angular/src/app.routes.ts`;\r\n let destinationPath:string = metadata.paths.rootMagicGenFolder;\r\n if (routeItem.module_name != '')\r\n {\r\n destinationPath = metadata.paths.magicGenFolderPath + `/${routeItem.module_name}`;\r\n }\r\n\r\n if (data.routesArray == undefined)\r\n context.logger.info(`RouteTable is not defined !`);\r\n else\r\n context.logger.info(`generating ${data.routesArray.length} root routes`);\r\n\r\n const componentFile: TemplateConfig = {\r\n type : GeneratedFileTypes.TS,\r\n template : template, // `./templates/angular/src/app.routes.ts`,\r\n destination : destinationPath, // metadata.paths.rootMagicGenFolder,\r\n name : 'app.routes.ts',\r\n data : data\r\n };\r\n\r\n return chain([\r\n generate(componentFile,options)\r\n ])(host,context);\r\n }\r\n}\r\n\r\n\r\n\r\n\r\n\r\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mgSingleControl =
|
|
3
|
+
exports.mgSingleControl = mgSingleControl;
|
|
4
4
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
5
5
|
const init_magic_metadata_rule_1 = require("../magic-utils/rules/init-magic-metadata.rule");
|
|
6
6
|
const init_gen_components_rule_1 = require("../magic-utils/rules/init-gen-components.rule");
|
|
@@ -17,7 +17,6 @@ function mgSingleControl(options) {
|
|
|
17
17
|
(0, build_control_rule_1.buildControl)(options, "")
|
|
18
18
|
]);
|
|
19
19
|
}
|
|
20
|
-
exports.mgSingleControl = mgSingleControl;
|
|
21
20
|
//
|
|
22
21
|
// single control generation helper - turn on the no-log flag
|
|
23
22
|
//
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;AAYA,0CAOC;AAnBD,2DAAsF;AACtF,4FAAiF;AACjF,4FAEuD;AACvD,gFAAuE;AACvE,4CAAyC;AAGzC,EAAE;AACF,oDAAoD;AACpD,EAAE;AACF,SAAgB,eAAe,CAAC,OAA0B;IACxD,OAAO,IAAA,kBAAK,EAAC;QACX,IAAA,4CAAiB,EAAC,OAAO,CAAC;QAC1B,iBAAiB,CAAC,OAAO,CAAC;QAC1B,IAAA,wDAA6B,EAAE,OAAO,EAAE,KAAK,CAAC;QAC9C,IAAA,iCAAY,EAAC,OAAO,EAAE,EAAE,CAAC;KAC1B,CAAC,CAAC;AACL,CAAC;AAED,EAAE;AACF,6DAA6D;AAC7D,EAAE;AACF,SAAS,iBAAiB,CAAC,OAA0B;IACnD,OAAO,CAAC,IAAU,EAAE,OAAyB,EAAE,EAAE;QAC/C,SAAG,CAAC,WAAW,GAAG,IAAI,CAAC;QACvB,OAAO,IAAI,CAAC;IACd,CAAC,CAAC;AACJ,CAAC","sourcesContent":["import { chain, Rule, SchematicContext, Tree, url } from \"@angular-devkit/schematics\";\r\nimport { initMagicMetadata} from \"../magic-utils/rules/init-magic-metadata.rule\";\r\nimport {\r\n initAndGenComponentsForModule\r\n} from \"../magic-utils/rules/init-gen-components.rule\";\r\nimport { buildControl } from \"../magic-utils/rules/build-control.rule\";\r\nimport { env } from \"../magic-utils/env\";\r\nimport { MagicOptionScheme } from \"../magic-utils/rules/magic-option.scheme\";\r\n\r\n//\r\n// entry point for generation of single control HTML\r\n//\r\nexport function mgSingleControl(options: MagicOptionScheme): Rule {\r\n return chain([\r\n initMagicMetadata(options),\r\n initSingleControl(options),\r\n initAndGenComponentsForModule (options, false),\r\n buildControl(options, \"\")\r\n ]);\r\n}\r\n\r\n//\r\n// single control generation helper - turn on the no-log flag\r\n//\r\nfunction initSingleControl(options: MagicOptionScheme): Rule {\r\n return (host: Tree, context: SchematicContext) => {\r\n env.prevent_log = true;\r\n return host;\r\n };\r\n}\r\n\r\n\r\n\r\n"]}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.getSourceFile = getSourceFile;
|
|
4
|
+
exports.addModuleImportToRootModule = addModuleImportToRootModule;
|
|
5
|
+
exports.addModuleImportToModule = addModuleImportToModule;
|
|
6
|
+
exports.getIndexHtmlPath = getIndexHtmlPath;
|
|
7
|
+
exports.getStylesPath = getStylesPath;
|
|
8
|
+
exports.findModuleFromOptions = findModuleFromOptions;
|
|
4
9
|
const core_1 = require("@angular-devkit/core");
|
|
5
10
|
const schematics_1 = require("@angular-devkit/schematics");
|
|
6
11
|
const ts = require("typescript");
|
|
@@ -18,13 +23,11 @@ function getSourceFile(host, path) {
|
|
|
18
23
|
const content = buffer.toString();
|
|
19
24
|
return ts.createSourceFile(path, content, ts.ScriptTarget.Latest, true);
|
|
20
25
|
}
|
|
21
|
-
exports.getSourceFile = getSourceFile;
|
|
22
26
|
/** Import and add module to root app module. */
|
|
23
27
|
function addModuleImportToRootModule(host, moduleName, src, project) {
|
|
24
28
|
const modulePath = (0, ng_ast_utils_1.getAppModulePath)(host, project.architect.build.options.browser);
|
|
25
29
|
addModuleImportToModule(host, modulePath, moduleName, src);
|
|
26
30
|
}
|
|
27
|
-
exports.addModuleImportToRootModule = addModuleImportToRootModule;
|
|
28
31
|
/**
|
|
29
32
|
* Import and add module to specific module path.
|
|
30
33
|
* @param host the tree we are updating
|
|
@@ -46,7 +49,6 @@ function addModuleImportToModule(host, modulePath, moduleName, src) {
|
|
|
46
49
|
});
|
|
47
50
|
host.commitUpdate(recorder);
|
|
48
51
|
}
|
|
49
|
-
exports.addModuleImportToModule = addModuleImportToModule;
|
|
50
52
|
/** Gets the app index.html file */
|
|
51
53
|
function getIndexHtmlPath(host, project) {
|
|
52
54
|
const buildTarget = project.architect.build.options;
|
|
@@ -55,7 +57,6 @@ function getIndexHtmlPath(host, project) {
|
|
|
55
57
|
}
|
|
56
58
|
throw new schematics_1.SchematicsException('No index.html file was found.');
|
|
57
59
|
}
|
|
58
|
-
exports.getIndexHtmlPath = getIndexHtmlPath;
|
|
59
60
|
/** Get the root stylesheet file. */
|
|
60
61
|
function getStylesPath(host, project) {
|
|
61
62
|
const buildTarget = project.architect['build'];
|
|
@@ -75,7 +76,6 @@ function getStylesPath(host, project) {
|
|
|
75
76
|
}
|
|
76
77
|
throw new schematics_1.SchematicsException('No style files could be found into which a theme could be added');
|
|
77
78
|
}
|
|
78
|
-
exports.getStylesPath = getStylesPath;
|
|
79
79
|
/** Wraps the internal find module from options with undefined path handling */
|
|
80
80
|
function findModuleFromOptions(host, options) {
|
|
81
81
|
const workspace = (0, config_1.getWorkspace)(host);
|
|
@@ -88,5 +88,4 @@ function findModuleFromOptions(host, options) {
|
|
|
88
88
|
}
|
|
89
89
|
return (0, find_module_1.findModuleFromOptions)(host, options);
|
|
90
90
|
}
|
|
91
|
-
exports.findModuleFromOptions = findModuleFromOptions;
|
|
92
91
|
//# sourceMappingURL=ast.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ast.js","sourceRoot":"","sources":["ast.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ast.js","sourceRoot":"","sources":["ast.ts"],"names":[],"mappings":";;AAWA,sCAOC;AAGD,kEAGC;AASD,0DAkBC;AAGD,4CAQC;AAGD,sCAqBC;AAGD,sDAaC;AAtGD,+CAA+C;AAC/C,2DAAqE;AACrE,iCAAiC;AACjC,wDAA2D;AAC3D,kDAAmD;AACnD,kDAA4D;AAC5D,8DAAsF;AACtF,4DAAsG;AAGtG,gEAAgE;AAChE,SAAgB,aAAa,CAAC,IAAU,EAAE,IAAY;IACpD,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC/B,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,IAAI,gCAAmB,CAAC,iCAAiC,IAAI,EAAE,CAAC,CAAC;IACzE,CAAC;IACD,MAAM,OAAO,GAAG,MAAM,CAAC,QAAQ,EAAE,CAAC;IAClC,OAAO,EAAE,CAAC,gBAAgB,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;AAC1E,CAAC;AAED,gDAAgD;AAChD,SAAgB,2BAA2B,CAAC,IAAU,EAAE,UAAkB,EAAE,GAAW,EAAE,OAAgB;IACvG,MAAM,UAAU,GAAG,IAAA,+BAAgB,EAAC,IAAI,EAAE,OAAO,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACnF,uBAAuB,C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,KAAK,SAAS,EAAE,CAAC;QAC/B,OAAO,CAAC,IAAI,GAAG,IAAI,OAAO,CAAC,IAAI,UAAU,CAAC;IAC5C,CAAC;IAED,OAAO,IAAA,mCAAkB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAC3C,CAAC","sourcesContent":["import {normalize} from '@angular-devkit/core';\nimport {SchematicsException, Tree} from '@angular-devkit/schematics';\nimport * as ts from 'typescript';\nimport {addImportToModule} from './devkit-utils/ast-utils';\nimport {InsertChange} from './devkit-utils/change';\nimport {Project, getWorkspace} from './devkit-utils/config';\nimport {findBootstrapModulePath, getAppModulePath} from './devkit-utils/ng-ast-utils';\nimport {ModuleOptions, findModuleFromOptions as internalFindModule} from './devkit-utils/find-module';\n\n\n/** Reads file given path and returns TypeScript source file. */\nexport function getSourceFile(host: Tree, path: string): ts.SourceFile {\n const buffer = host.read(path);\n if (!buffer) {\n throw new SchematicsException(`Could not find file for path: ${path}`);\n }\n const content = buffer.toString();\n return ts.createSourceFile(path, content, ts.ScriptTarget.Latest, true);\n}\n\n/** Import and add module to root app module. */\nexport function addModuleImportToRootModule(host: Tree, moduleName: string, src: string, project: Project) {\n const modulePath = getAppModulePath(host, project.architect.build.options.browser);\n addModuleImportToModule(host, modulePath, moduleName, src);\n}\n\n/**\n * Import and add module to specific module path.\n * @param host the tree we are updating\n * @param modulePath src location of the module to import\n * @param moduleName name of module to import\n * @param src src location to import\n */\nexport function addModuleImportToModule(\n host: Tree, modulePath: string, moduleName: string, src: string) {\n const moduleSource = getSourceFile(host, modulePath);\n\n if (!moduleSource) {\n throw new SchematicsException(`Module not found: ${modulePath}`);\n }\n\n const changes = addImportToModule(moduleSource, modulePath, moduleName, src);\n const recorder = host.beginUpdate(modulePath);\n\n changes.forEach((change) => {\n if (change instanceof InsertChange) {\n recorder.insertLeft(change.pos, change.toAdd);\n }\n });\n\n host.commitUpdate(recorder);\n}\n\n/** Gets the app index.html file */\nexport function getIndexHtmlPath(host: Tree, project: Project): string {\n const buildTarget = project.architect.build.options;\n\n if (buildTarget.index && buildTarget.index.endsWith('index.html')) {\n return buildTarget.index;\n }\n\n throw new SchematicsException('No index.html file was found.');\n}\n\n/** Get the root stylesheet file. */\nexport function getStylesPath(host: Tree, project: Project): string {\n const buildTarget = project.architect['build'];\n\n if (buildTarget.options && buildTarget.options.styles && buildTarget.options.styles.length) {\n const styles = buildTarget.options.styles.map(s => s.input);\n\n // First, see if any of the assets is called \"styles.(le|sc|c)ss\", which is the default\n // \"main\" style sheet.\n const defaultMainStylePath = styles.find(a => /styles\\.(c|le|sc)ss/.test(a));\n if (defaultMainStylePath) {\n return normalize(defaultMainStylePath);\n }\n\n // If there was no obvious default file, use the first style asset.\n const fallbackStylePath = styles.find(a => /\\.(c|le|sc)ss/.test(a));\n if (fallbackStylePath) {\n return normalize(fallbackStylePath);\n }\n }\n\n throw new SchematicsException('No style files could be found into which a theme could be added');\n}\n\n/** Wraps the internal find module from options with undefined path handling */\nexport function findModuleFromOptions(host: Tree, options: any) {\n const workspace = getWorkspace(host);\n if (!options.project) {\n options.project = Object.keys(workspace.projects)[0];\n }\n\n const project = workspace.projects[options.project];\n\n if (options.path === undefined) {\n options.path = `/${project.root}/src/app`;\n }\n\n return internalFindModule(host, options);\n}\n"]}
|
|
@@ -1,6 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.insertImport = insertImport;
|
|
4
|
+
exports.findNodes = findNodes;
|
|
5
|
+
exports.getSourceNodes = getSourceNodes;
|
|
6
|
+
exports.findNode = findNode;
|
|
7
|
+
exports.insertAfterLastOccurrence = insertAfterLastOccurrence;
|
|
8
|
+
exports.getContentOfKeyLiteral = getContentOfKeyLiteral;
|
|
9
|
+
exports.getDecoratorMetadata = getDecoratorMetadata;
|
|
10
|
+
exports.getFirstNgModuleName = getFirstNgModuleName;
|
|
11
|
+
exports.addSymbolToNgModuleMetadata = addSymbolToNgModuleMetadata;
|
|
12
|
+
exports.addDeclarationToModule = addDeclarationToModule;
|
|
13
|
+
exports.addImportToModule = addImportToModule;
|
|
14
|
+
exports.addProviderToModule = addProviderToModule;
|
|
15
|
+
exports.addExportToModule = addExportToModule;
|
|
16
|
+
exports.addBootstrapToModule = addBootstrapToModule;
|
|
17
|
+
exports.addEntryComponentToModule = addEntryComponentToModule;
|
|
18
|
+
exports.isImported = isImported;
|
|
4
19
|
/**
|
|
5
20
|
* @license
|
|
6
21
|
* Copyright Google Inc. All Rights Reserved.
|
|
@@ -69,7 +84,6 @@ function insertImport(source, fileToEdit, symbolName, fileName, isDefault = fals
|
|
|
69
84
|
` from '${fileName}'${insertAtBeginning ? ';\n' : ''}`;
|
|
70
85
|
return insertAfterLastOccurrence(allImports, toInsert, fileToEdit, fallbackPos, ts.SyntaxKind.StringLiteral);
|
|
71
86
|
}
|
|
72
|
-
exports.insertImport = insertImport;
|
|
73
87
|
/**
|
|
74
88
|
* Find all nodes from the AST in the subtree of node of SyntaxKind kind.
|
|
75
89
|
* @param node
|
|
@@ -101,7 +115,6 @@ function findNodes(node, kind, max = Infinity) {
|
|
|
101
115
|
}
|
|
102
116
|
return arr;
|
|
103
117
|
}
|
|
104
|
-
exports.findNodes = findNodes;
|
|
105
118
|
/**
|
|
106
119
|
* Get all the nodes from a source.
|
|
107
120
|
* @param sourceFile The source file object.
|
|
@@ -121,7 +134,6 @@ function getSourceNodes(sourceFile) {
|
|
|
121
134
|
}
|
|
122
135
|
return result;
|
|
123
136
|
}
|
|
124
|
-
exports.getSourceNodes = getSourceNodes;
|
|
125
137
|
function findNode(node, kind, text) {
|
|
126
138
|
if (node.kind === kind && node.getText() === text) {
|
|
127
139
|
// throw new Error(node.getText());
|
|
@@ -133,7 +145,6 @@ function findNode(node, kind, text) {
|
|
|
133
145
|
});
|
|
134
146
|
return foundNode;
|
|
135
147
|
}
|
|
136
|
-
exports.findNode = findNode;
|
|
137
148
|
/**
|
|
138
149
|
* Helper for sorting nodes.
|
|
139
150
|
* @return function to sort nodes in increasing order of position in sourceFile
|
|
@@ -169,7 +180,6 @@ function insertAfterLastOccurrence(nodes, toInsert, file, fallbackPos, syntaxKin
|
|
|
169
180
|
const lastItemPosition = lastItem ? lastItem.getEnd() : fallbackPos;
|
|
170
181
|
return new change_1.InsertChange(file, lastItemPosition, toInsert);
|
|
171
182
|
}
|
|
172
|
-
exports.insertAfterLastOccurrence = insertAfterLastOccurrence;
|
|
173
183
|
function getContentOfKeyLiteral(_source, node) {
|
|
174
184
|
if (node.kind == ts.SyntaxKind.Identifier) {
|
|
175
185
|
return node.text;
|
|
@@ -181,7 +191,6 @@ function getContentOfKeyLiteral(_source, node) {
|
|
|
181
191
|
return null;
|
|
182
192
|
}
|
|
183
193
|
}
|
|
184
|
-
exports.getContentOfKeyLiteral = getContentOfKeyLiteral;
|
|
185
194
|
function _angularImportsFromNode(node, _sourceFile) {
|
|
186
195
|
const ms = node.moduleSpecifier;
|
|
187
196
|
let modulePath;
|
|
@@ -264,7 +273,6 @@ function getDecoratorMetadata(source, identifier, module) {
|
|
|
264
273
|
&& expr.arguments[0].kind == ts.SyntaxKind.ObjectLiteralExpression)
|
|
265
274
|
.map(expr => expr.arguments[0]);
|
|
266
275
|
}
|
|
267
|
-
exports.getDecoratorMetadata = getDecoratorMetadata;
|
|
268
276
|
function findClassDeclarationParent(node) {
|
|
269
277
|
if (ts.isClassDeclaration(node)) {
|
|
270
278
|
return node;
|
|
@@ -292,7 +300,6 @@ function getFirstNgModuleName(source) {
|
|
|
292
300
|
// Get the class name of the module ClassDeclaration.
|
|
293
301
|
return moduleClass.name.text;
|
|
294
302
|
}
|
|
295
|
-
exports.getFirstNgModuleName = getFirstNgModuleName;
|
|
296
303
|
function addSymbolToNgModuleMetadata(source, ngModulePath, metadataField, symbolName, importPath = null) {
|
|
297
304
|
const nodes = getDecoratorMetadata(source, 'NgModule', '@angular/core');
|
|
298
305
|
let node = nodes[0]; // tslint:disable-line:no-any
|
|
@@ -422,7 +429,6 @@ function addSymbolToNgModuleMetadata(source, ngModulePath, metadataField, symbol
|
|
|
422
429
|
}
|
|
423
430
|
return [new change_1.InsertChange(ngModulePath, position, toInsert)];
|
|
424
431
|
}
|
|
425
|
-
exports.addSymbolToNgModuleMetadata = addSymbolToNgModuleMetadata;
|
|
426
432
|
/**
|
|
427
433
|
* Custom function to insert a declaration (component, pipe, directive)
|
|
428
434
|
* into NgModule declarations. It also imports the component.
|
|
@@ -430,42 +436,36 @@ exports.addSymbolToNgModuleMetadata = addSymbolToNgModuleMetadata;
|
|
|
430
436
|
function addDeclarationToModule(source, modulePath, classifiedName, importPath) {
|
|
431
437
|
return addSymbolToNgModuleMetadata(source, modulePath, 'declarations', classifiedName, importPath);
|
|
432
438
|
}
|
|
433
|
-
exports.addDeclarationToModule = addDeclarationToModule;
|
|
434
439
|
/**
|
|
435
440
|
* Custom function to insert an NgModule into NgModule imports. It also imports the module.
|
|
436
441
|
*/
|
|
437
442
|
function addImportToModule(source, modulePath, classifiedName, importPath) {
|
|
438
443
|
return addSymbolToNgModuleMetadata(source, modulePath, 'imports', classifiedName, importPath);
|
|
439
444
|
}
|
|
440
|
-
exports.addImportToModule = addImportToModule;
|
|
441
445
|
/**
|
|
442
446
|
* Custom function to insert a provider into NgModule. It also imports it.
|
|
443
447
|
*/
|
|
444
448
|
function addProviderToModule(source, modulePath, classifiedName, importPath) {
|
|
445
449
|
return addSymbolToNgModuleMetadata(source, modulePath, 'providers', classifiedName, importPath);
|
|
446
450
|
}
|
|
447
|
-
exports.addProviderToModule = addProviderToModule;
|
|
448
451
|
/**
|
|
449
452
|
* Custom function to insert an export into NgModule. It also imports it.
|
|
450
453
|
*/
|
|
451
454
|
function addExportToModule(source, modulePath, classifiedName, importPath) {
|
|
452
455
|
return addSymbolToNgModuleMetadata(source, modulePath, 'exports', classifiedName, importPath);
|
|
453
456
|
}
|
|
454
|
-
exports.addExportToModule = addExportToModule;
|
|
455
457
|
/**
|
|
456
458
|
* Custom function to insert an export into NgModule. It also imports it.
|
|
457
459
|
*/
|
|
458
460
|
function addBootstrapToModule(source, modulePath, classifiedName, importPath) {
|
|
459
461
|
return addSymbolToNgModuleMetadata(source, modulePath, 'bootstrap', classifiedName, importPath);
|
|
460
462
|
}
|
|
461
|
-
exports.addBootstrapToModule = addBootstrapToModule;
|
|
462
463
|
/**
|
|
463
464
|
* Custom function to insert an entryComponent into NgModule. It also imports it.
|
|
464
465
|
*/
|
|
465
466
|
function addEntryComponentToModule(source, modulePath, classifiedName, importPath) {
|
|
466
467
|
return addSymbolToNgModuleMetadata(source, modulePath, 'entryComponents', classifiedName, importPath);
|
|
467
468
|
}
|
|
468
|
-
exports.addEntryComponentToModule = addEntryComponentToModule;
|
|
469
469
|
/**
|
|
470
470
|
* Determine if an import already exists.
|
|
471
471
|
*/
|
|
@@ -487,5 +487,4 @@ function isImported(source, classifiedName, importPath) {
|
|
|
487
487
|
});
|
|
488
488
|
return matchingNodes.length > 0;
|
|
489
489
|
}
|
|
490
|
-
exports.isImported = isImported;
|
|
491
490
|
//# sourceMappingURL=ast-utils.js.map
|