@nrwl/angular 14.4.0-beta.7 → 14.4.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/CHANGELOG.md +1 -1
- package/esm2020/mf/index.mjs +2 -0
- package/esm2020/mf/mf.mjs +45 -0
- package/esm2020/mf/nrwl-angular-mf.mjs +5 -0
- package/fesm2015/{nrwl-angular-mfe.mjs → nrwl-angular-mf.mjs} +1 -1
- package/fesm2015/nrwl-angular-mf.mjs.map +1 -0
- package/fesm2020/{nrwl-angular-mfe.mjs → nrwl-angular-mf.mjs} +1 -1
- package/fesm2020/nrwl-angular-mf.mjs.map +1 -0
- package/generators.d.ts +1 -1
- package/generators.js +1 -1
- package/generators.js.map +1 -1
- package/generators.json +6 -6
- package/{mfe → mf}/index.d.ts +1 -1
- package/{mfe → mf}/index.js +4 -4
- package/mf/index.js.map +1 -0
- package/{mfe/mfe.d.ts → mf/mf.d.ts} +0 -0
- package/{mfe/mfe.js → mf/mf.js} +1 -1
- package/mf/mf.js.map +1 -0
- package/{mfe → mf}/ng-package.json +0 -0
- package/migrations.json +8 -2
- package/module-federation/index.d.ts +2 -2
- package/module-federation/index.js +2 -2
- package/module-federation/index.js.map +1 -1
- package/package.json +16 -16
- package/src/generators/application/application.js +2 -2
- package/src/generators/application/application.js.map +1 -1
- package/src/generators/application/lib/{add-mfe.d.ts → add-mf.d.ts} +1 -1
- package/src/generators/application/lib/{add-mfe.js → add-mf.js} +7 -7
- package/src/generators/application/lib/add-mf.js.map +1 -0
- package/src/generators/application/lib/index.d.ts +1 -1
- package/src/generators/application/lib/index.js +1 -1
- package/src/generators/application/lib/index.js.map +1 -1
- package/src/generators/application/schema.d.ts +2 -2
- package/src/generators/application/schema.json +2 -2
- package/src/generators/component/lib/component.js +4 -4
- package/src/generators/component/lib/component.js.map +1 -1
- package/src/generators/host/host.js +1 -1
- package/src/generators/host/host.js.map +1 -1
- package/src/generators/remote/remote.js +4 -4
- package/src/generators/remote/remote.js.map +1 -1
- package/src/generators/scam/lib/convert-component-to-scam.d.ts +3 -3
- package/src/generators/scam/lib/convert-component-to-scam.js +10 -10
- package/src/generators/scam/lib/convert-component-to-scam.js.map +1 -1
- package/src/generators/scam/lib/index.d.ts +0 -1
- package/src/generators/scam/lib/index.js +0 -1
- package/src/generators/scam/lib/index.js.map +1 -1
- package/src/generators/scam/lib/normalize-options.js +2 -2
- package/src/generators/scam/lib/normalize-options.js.map +1 -1
- package/src/generators/scam/scam.js +5 -4
- package/src/generators/scam/scam.js.map +1 -1
- package/src/generators/scam/schema.d.ts +2 -0
- package/src/generators/scam-directive/lib/convert-directive-to-scam.d.ts +4 -0
- package/src/generators/scam-directive/lib/convert-directive-to-scam.js +43 -0
- package/src/generators/scam-directive/lib/convert-directive-to-scam.js.map +1 -0
- package/src/generators/scam-directive/lib/index.d.ts +2 -0
- package/src/generators/scam-directive/lib/index.js +5 -0
- package/src/generators/scam-directive/lib/index.js.map +1 -1
- package/src/generators/scam-directive/lib/normalize-options.d.ts +3 -0
- package/src/generators/scam-directive/lib/normalize-options.js +16 -0
- package/src/generators/scam-directive/lib/normalize-options.js.map +1 -0
- package/src/generators/scam-directive/scam-directive.d.ts +1 -1
- package/src/generators/scam-directive/scam-directive.js +11 -6
- package/src/generators/scam-directive/scam-directive.js.map +1 -1
- package/src/generators/scam-directive/schema.d.ts +9 -0
- package/src/generators/scam-pipe/lib/convert-pipe-to-scam.d.ts +4 -0
- package/src/generators/scam-pipe/lib/convert-pipe-to-scam.js +43 -0
- package/src/generators/scam-pipe/lib/convert-pipe-to-scam.js.map +1 -0
- package/src/generators/scam-pipe/lib/index.d.ts +2 -0
- package/src/generators/scam-pipe/lib/index.js +5 -0
- package/src/generators/scam-pipe/lib/index.js.map +1 -1
- package/src/generators/scam-pipe/lib/normalize-options.d.ts +3 -0
- package/src/generators/scam-pipe/lib/normalize-options.js +16 -0
- package/src/generators/scam-pipe/lib/normalize-options.js.map +1 -0
- package/src/generators/scam-pipe/scam-pipe.d.ts +1 -1
- package/src/generators/scam-pipe/scam-pipe.js +11 -6
- package/src/generators/scam-pipe/scam-pipe.js.map +1 -1
- package/src/generators/scam-pipe/schema.d.ts +9 -0
- package/src/generators/{setup-mfe → setup-mf}/files/entry-module-files/entry.component.ts__tmpl__ +0 -0
- package/src/generators/{setup-mfe → setup-mf}/files/entry-module-files/entry.module.ts__tmpl__ +0 -0
- package/src/generators/{setup-mfe → setup-mf}/files/webpack/module-federation.config.js__tmpl__ +0 -0
- package/src/generators/{setup-mfe → setup-mf}/files/webpack/webpack.config.js__tmpl__ +0 -0
- package/src/generators/{setup-mfe → setup-mf}/files/webpack/webpack.prod.config.js__tmpl__ +0 -0
- package/src/generators/{setup-mfe → setup-mf}/lib/add-cypress-workaround.d.ts +0 -0
- package/src/generators/{setup-mfe → setup-mf}/lib/add-cypress-workaround.js +0 -0
- package/src/generators/setup-mf/lib/add-cypress-workaround.js.map +1 -0
- package/src/generators/{setup-mfe → setup-mf}/lib/add-entry-module.d.ts +1 -1
- package/src/generators/{setup-mfe → setup-mf}/lib/add-entry-module.js +2 -2
- package/src/generators/setup-mf/lib/add-entry-module.js.map +1 -0
- package/src/generators/{setup-mfe → setup-mf}/lib/add-remote-to-host.d.ts +1 -1
- package/src/generators/{setup-mfe → setup-mf}/lib/add-remote-to-host.js +8 -8
- package/src/generators/setup-mf/lib/add-remote-to-host.js.map +1 -0
- package/src/generators/{setup-mfe → setup-mf}/lib/change-build-target.d.ts +0 -0
- package/src/generators/{setup-mfe → setup-mf}/lib/change-build-target.js +0 -0
- package/src/generators/setup-mf/lib/change-build-target.js.map +1 -0
- package/src/generators/{setup-mfe → setup-mf}/lib/fix-bootstrap.d.ts +0 -0
- package/src/generators/{setup-mfe → setup-mf}/lib/fix-bootstrap.js +2 -2
- package/src/generators/setup-mf/lib/fix-bootstrap.js.map +1 -0
- package/src/generators/{setup-mfe → setup-mf}/lib/generate-config.d.ts +0 -0
- package/src/generators/{setup-mfe → setup-mf}/lib/generate-config.js +1 -1
- package/src/generators/setup-mf/lib/generate-config.js.map +1 -0
- package/src/generators/{setup-mfe → setup-mf}/lib/get-remotes-with-ports.d.ts +0 -0
- package/src/generators/{setup-mfe → setup-mf}/lib/get-remotes-with-ports.js +1 -1
- package/src/generators/setup-mf/lib/get-remotes-with-ports.js.map +1 -0
- package/src/generators/{setup-mfe → setup-mf}/lib/index.d.ts +0 -0
- package/src/generators/{setup-mfe → setup-mf}/lib/index.js +0 -0
- package/src/generators/setup-mf/lib/index.js.map +1 -0
- package/src/generators/{setup-mfe → setup-mf}/lib/set-tsconfig-target.d.ts +0 -0
- package/src/generators/{setup-mfe → setup-mf}/lib/set-tsconfig-target.js +0 -0
- package/src/generators/setup-mf/lib/set-tsconfig-target.js.map +1 -0
- package/src/generators/{setup-mfe → setup-mf}/lib/setup-host-if-dynamic.d.ts +0 -0
- package/src/generators/{setup-mfe → setup-mf}/lib/setup-host-if-dynamic.js +1 -1
- package/src/generators/setup-mf/lib/setup-host-if-dynamic.js.map +1 -0
- package/src/generators/{setup-mfe → setup-mf}/lib/setup-serve-target.d.ts +0 -0
- package/src/generators/{setup-mfe → setup-mf}/lib/setup-serve-target.js +2 -2
- package/src/generators/setup-mf/lib/setup-serve-target.js.map +1 -0
- package/src/generators/{setup-mfe → setup-mf}/schema.d.ts +1 -1
- package/src/generators/{setup-mfe → setup-mf}/schema.json +3 -3
- package/src/generators/{setup-mfe/setup-mfe.compat.d.ts → setup-mf/setup-mf.compat.d.ts} +0 -0
- package/src/generators/setup-mf/setup-mf.compat.js +6 -0
- package/src/generators/setup-mf/setup-mf.compat.js.map +1 -0
- package/src/generators/setup-mf/setup-mf.d.ts +4 -0
- package/src/generators/{setup-mfe/setup-mfe.js → setup-mf/setup-mf.js} +5 -5
- package/src/generators/setup-mf/setup-mf.js.map +1 -0
- package/src/generators/utils/export-scam.d.ts +9 -0
- package/src/generators/{scam/lib → utils}/export-scam.js +9 -8
- package/src/generators/utils/export-scam.js.map +1 -0
- package/src/generators/utils/file-info.d.ts +16 -0
- package/src/generators/utils/{component.js → file-info.js} +18 -7
- package/src/generators/utils/file-info.js.map +1 -0
- package/src/migrations/update-13-8-1/{add-cypress-mfe-workaround.d.ts → add-cypress-mf-workaround.d.ts} +0 -0
- package/src/migrations/update-13-8-1/{add-cypress-mfe-workaround.js → add-cypress-mf-workaround.js} +1 -1
- package/src/migrations/update-13-8-1/add-cypress-mf-workaround.js.map +1 -0
- package/src/migrations/update-14-5-0/migrate-mfe-to-mf.d.ts +5 -0
- package/src/migrations/update-14-5-0/migrate-mfe-to-mf.js +94 -0
- package/src/migrations/update-14-5-0/migrate-mfe-to-mf.js.map +1 -0
- package/src/utils/{mfe/mfe-webpack.d.ts → mf/mf-webpack.d.ts} +0 -0
- package/src/utils/{mfe/mfe-webpack.js → mf/mf-webpack.js} +2 -2
- package/src/utils/mf/mf-webpack.js.map +1 -0
- package/src/utils/{mfe → mf}/utils.d.ts +0 -0
- package/src/utils/{mfe → mf}/utils.js +1 -1
- package/src/utils/mf/utils.js.map +1 -0
- package/src/utils/{mfe → mf}/with-module-federation.d.ts +5 -5
- package/src/utils/{mfe → mf}/with-module-federation.js +6 -6
- package/src/utils/mf/with-module-federation.js.map +1 -0
- package/esm2020/mfe/index.mjs +0 -2
- package/esm2020/mfe/mfe.mjs +0 -45
- package/esm2020/mfe/nrwl-angular-mfe.mjs +0 -5
- package/fesm2015/nrwl-angular-mfe.mjs.map +0 -1
- package/fesm2020/nrwl-angular-mfe.mjs.map +0 -1
- package/mfe/index.js.map +0 -1
- package/mfe/mfe.js.map +0 -1
- package/src/generators/application/lib/add-mfe.js.map +0 -1
- package/src/generators/scam/lib/export-scam.d.ts +0 -4
- package/src/generators/scam/lib/export-scam.js.map +0 -1
- package/src/generators/scam-directive/lib/create-module.d.ts +0 -3
- package/src/generators/scam-directive/lib/create-module.js +0 -90
- package/src/generators/scam-directive/lib/create-module.js.map +0 -1
- package/src/generators/scam-pipe/lib/create-module.d.ts +0 -3
- package/src/generators/scam-pipe/lib/create-module.js +0 -90
- package/src/generators/scam-pipe/lib/create-module.js.map +0 -1
- package/src/generators/setup-mfe/lib/add-cypress-workaround.js.map +0 -1
- package/src/generators/setup-mfe/lib/add-entry-module.js.map +0 -1
- package/src/generators/setup-mfe/lib/add-remote-to-host.js.map +0 -1
- package/src/generators/setup-mfe/lib/change-build-target.js.map +0 -1
- package/src/generators/setup-mfe/lib/fix-bootstrap.js.map +0 -1
- package/src/generators/setup-mfe/lib/generate-config.js.map +0 -1
- package/src/generators/setup-mfe/lib/get-remotes-with-ports.js.map +0 -1
- package/src/generators/setup-mfe/lib/index.js.map +0 -1
- package/src/generators/setup-mfe/lib/set-tsconfig-target.js.map +0 -1
- package/src/generators/setup-mfe/lib/setup-host-if-dynamic.js.map +0 -1
- package/src/generators/setup-mfe/lib/setup-serve-target.js.map +0 -1
- package/src/generators/setup-mfe/setup-mfe.compat.js +0 -6
- package/src/generators/setup-mfe/setup-mfe.compat.js.map +0 -1
- package/src/generators/setup-mfe/setup-mfe.d.ts +0 -4
- package/src/generators/setup-mfe/setup-mfe.js.map +0 -1
- package/src/generators/utils/component.d.ts +0 -14
- package/src/generators/utils/component.js.map +0 -1
- package/src/migrations/update-13-8-1/add-cypress-mfe-workaround.js.map +0 -1
- package/src/utils/mfe/mfe-webpack.js.map +0 -1
- package/src/utils/mfe/utils.js.map +0 -1
- package/src/utils/mfe/with-module-federation.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"convert-component-to-scam.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/scam/lib/convert-component-to-scam.ts"],"names":[],"mappings":";;;AACA,yCAAwD;AACxD,uEAAuE;AACvE,2CAA4D;AAI5D,SAAgB,sBAAsB,CACpC,IAAU,EACV,
|
|
1
|
+
{"version":3,"file":"convert-component-to-scam.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/scam/lib/convert-component-to-scam.ts"],"names":[],"mappings":";;;AACA,y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QAC/D,OAAO;KACR;IAED,MAAM,cAAc,GAAG,IAAA,0BAAiB,EACtC,iBAAiB,CAAC,SAAS,EAC3B,GAAG,cAAc,CAAC,QAAQ,YAAY,CACvC,CAAC;IAEF,IAAI,CAAC,KAAK,CACR,cAAc,EACd,oBAAoB,CAAC,kBAAkB,EAAE,iBAAiB,CAAC,QAAQ,CAAC,CACrE,CAAC;AACJ,CAAC;AA5DD,wDA4DC;AAED,SAAS,oBAAoB,CAC3B,kBAA0B,EAC1B,iBAAyB;IAEzB,OAAO;;WAEE,kBAAkB,cAAc,iBAAiB;EAC1D,sBAAsB,CAAC,kBAAkB,CAAC,EAAE,CAAC;AAC/C,CAAC;AAED,SAAS,sBAAsB,CAAC,kBAA0B;IACxD,OAAO;;;mBAGU,kBAAkB;cACvB,kBAAkB;;eAEjB,kBAAkB,WAAW,CAAC;AAC7C,CAAC"}
|
|
@@ -2,6 +2,5 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
4
|
tslib_1.__exportStar(require("./convert-component-to-scam"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./export-scam"), exports);
|
|
6
5
|
tslib_1.__exportStar(require("./normalize-options"), exports);
|
|
7
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/scam/lib/index.ts"],"names":[],"mappings":";;;AAAA,sEAA4C;AAC5C,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/scam/lib/index.ts"],"names":[],"mappings":";;;AAAA,sEAA4C;AAC5C,8DAAoC"}
|
|
@@ -3,12 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.normalizeOptions = void 0;
|
|
4
4
|
const devkit_1 = require("@nrwl/devkit");
|
|
5
5
|
function normalizeOptions(tree, options) {
|
|
6
|
-
var _a, _b;
|
|
6
|
+
var _a, _b, _c, _d;
|
|
7
7
|
const project = (_a = options.project) !== null && _a !== void 0 ? _a : (0, devkit_1.readWorkspaceConfiguration)(tree).defaultProject;
|
|
8
8
|
const { projectType, root, sourceRoot } = (0, devkit_1.readProjectConfiguration)(tree, project);
|
|
9
9
|
const projectSourceRoot = sourceRoot !== null && sourceRoot !== void 0 ? sourceRoot : (0, devkit_1.joinPathFragments)(root, 'src');
|
|
10
10
|
const path = (_b = options.path) !== null && _b !== void 0 ? _b : (0, devkit_1.joinPathFragments)(projectSourceRoot, projectType === 'application' ? 'app' : 'lib');
|
|
11
|
-
return Object.assign(Object.assign({}, options), { path,
|
|
11
|
+
return Object.assign(Object.assign({}, options), { export: (_c = options.export) !== null && _c !== void 0 ? _c : true, inlineScam: (_d = options.inlineScam) !== null && _d !== void 0 ? _d : true, path,
|
|
12
12
|
project,
|
|
13
13
|
projectSourceRoot });
|
|
14
14
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-options.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/scam/lib/normalize-options.ts"],"names":[],"mappings":";;;AACA,yCAIsB;AAGtB,SAAgB,gBAAgB,CAC9B,IAAU,EACV,OAAe;;IAEf,MAAM,OAAO,GACX,MAAA,OAAO,CAAC,OAAO,mCAAI,IAAA,mCAA0B,EAAC,IAAI,CAAC,CAAC,cAAc,CAAC;IACrE,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,IAAA,iCAAwB,EAChE,IAAI,EACJ,OAAO,CACR,CAAC;IACF,MAAM,iBAAiB,GAAG,UAAU,aAAV,UAAU,cAAV,UAAU,GAAI,IAAA,0BAAiB,EAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACvE,MAAM,IAAI,GACR,MAAA,OAAO,CAAC,IAAI,mCACZ,IAAA,0BAAiB,EACf,iBAAiB,EACjB,WAAW,KAAK,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAC9C,CAAC;IAEJ,uCACK,OAAO,KACV,IAAI;QACJ,OAAO;QACP,iBAAiB,IACjB;AACJ,CAAC;
|
|
1
|
+
{"version":3,"file":"normalize-options.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/scam/lib/normalize-options.ts"],"names":[],"mappings":";;;AACA,yCAIsB;AAGtB,SAAgB,gBAAgB,CAC9B,IAAU,EACV,OAAe;;IAEf,MAAM,OAAO,GACX,MAAA,OAAO,CAAC,OAAO,mCAAI,IAAA,mCAA0B,EAAC,IAAI,CAAC,CAAC,cAAc,CAAC;IACrE,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,IAAA,iCAAwB,EAChE,IAAI,EACJ,OAAO,CACR,CAAC;IACF,MAAM,iBAAiB,GAAG,UAAU,aAAV,UAAU,cAAV,UAAU,GAAI,IAAA,0BAAiB,EAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACvE,MAAM,IAAI,GACR,MAAA,OAAO,CAAC,IAAI,mCACZ,IAAA,0BAAiB,EACf,iBAAiB,EACjB,WAAW,KAAK,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAC9C,CAAC;IAEJ,uCACK,OAAO,KACV,MAAM,EAAE,MAAA,OAAO,CAAC,MAAM,mCAAI,IAAI,EAC9B,UAAU,EAAE,MAAA,OAAO,CAAC,UAAU,mCAAI,IAAI,EACtC,IAAI;QACJ,OAAO;QACP,iBAAiB,IACjB;AACJ,CAAC;AA1BD,4CA0BC"}
|
|
@@ -4,19 +4,20 @@ exports.scamGenerator = void 0;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const devkit_1 = require("@nrwl/devkit");
|
|
6
6
|
const ngcli_adapter_1 = require("@nrwl/devkit/ngcli-adapter");
|
|
7
|
+
const export_scam_1 = require("../utils/export-scam");
|
|
8
|
+
const file_info_1 = require("../utils/file-info");
|
|
7
9
|
const path_1 = require("../utils/path");
|
|
8
10
|
const lib_1 = require("./lib");
|
|
9
|
-
const component_1 = require("../utils/component");
|
|
10
11
|
function scamGenerator(tree, rawOptions) {
|
|
11
12
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
12
13
|
const options = (0, lib_1.normalizeOptions)(tree, rawOptions);
|
|
13
14
|
const { inlineScam, projectSourceRoot } = options, schematicOptions = tslib_1.__rest(options, ["inlineScam", "projectSourceRoot"]);
|
|
14
15
|
checkPathUnderProjectRoot(tree, options);
|
|
15
16
|
const angularComponentSchematic = (0, ngcli_adapter_1.wrapAngularDevkitSchematic)('@schematics/angular', 'component');
|
|
16
|
-
yield angularComponentSchematic(tree, Object.assign(Object.assign({}, schematicOptions), { skipImport: true, export: false }));
|
|
17
|
-
const componentFileInfo = (0,
|
|
17
|
+
yield angularComponentSchematic(tree, Object.assign(Object.assign({}, schematicOptions), { skipImport: true, export: false, standalone: false }));
|
|
18
|
+
const componentFileInfo = (0, file_info_1.getComponentFileInfo)(tree, options);
|
|
18
19
|
(0, lib_1.convertComponentToScam)(tree, componentFileInfo, options);
|
|
19
|
-
(0,
|
|
20
|
+
(0, export_scam_1.exportScam)(tree, componentFileInfo, options);
|
|
20
21
|
yield (0, devkit_1.formatFiles)(tree);
|
|
21
22
|
});
|
|
22
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scam.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/scam/scam.ts"],"names":[],"mappings":";;;;AACA,yCAKsB;AACtB,8DAAwE;AACxE,wCAA+C;AAC/C,+
|
|
1
|
+
{"version":3,"file":"scam.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/scam/scam.ts"],"names":[],"mappings":";;;;AACA,yCAKsB;AACtB,8DAAwE;AACxE,sDAAkD;AAClD,kDAA0D;AAC1D,wCAA+C;AAC/C,+BAAiE;AAGjE,SAAsB,aAAa,CAAC,IAAU,EAAE,UAAkB;;QACh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B,CAAC,CAAC,eAAe,CAAC;IAEpB,IAAI,CAAC,IAAA,qBAAc,EAAC,eAAe,EAAE,IAAI,CAAC,EAAE;QAC1C,MAAM,IAAI,KAAK,CACb,mCAAmC,OAAO,CAAC,IAAI,4CAA4C,IAAI,IAAI,CACpG,CAAC;KACH;AACH,CAAC;AAED,kBAAe,aAAa,CAAC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { Tree } from '@nrwl/devkit';
|
|
2
|
+
import type { FileInfo } from '../../utils/file-info';
|
|
3
|
+
import type { NormalizedSchema } from '../schema';
|
|
4
|
+
export declare function convertDirectiveToScam(tree: Tree, directiveFileInfo: FileInfo, options: NormalizedSchema): void;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertDirectiveToScam = void 0;
|
|
4
|
+
const devkit_1 = require("@nrwl/devkit");
|
|
5
|
+
const ast_utils_1 = require("@nrwl/workspace/src/utilities/ast-utils");
|
|
6
|
+
const typescript_1 = require("typescript");
|
|
7
|
+
function convertDirectiveToScam(tree, directiveFileInfo, options) {
|
|
8
|
+
if (!tree.exists(directiveFileInfo.filePath)) {
|
|
9
|
+
throw new Error(`Couldn't find directive at path ${directiveFileInfo.filePath} to add SCAM setup.`);
|
|
10
|
+
}
|
|
11
|
+
const directiveNames = (0, devkit_1.names)(options.name);
|
|
12
|
+
const typeNames = (0, devkit_1.names)('directive');
|
|
13
|
+
const directiveClassName = `${directiveNames.className}${typeNames.className}`;
|
|
14
|
+
if (options.inlineScam) {
|
|
15
|
+
const currentDirectiveContents = tree.read(directiveFileInfo.filePath, 'utf-8');
|
|
16
|
+
let source = (0, typescript_1.createSourceFile)(directiveFileInfo.filePath, currentDirectiveContents, typescript_1.ScriptTarget.Latest, true);
|
|
17
|
+
source = (0, ast_utils_1.insertImport)(tree, source, directiveFileInfo.filePath, 'NgModule', '@angular/core');
|
|
18
|
+
source = (0, ast_utils_1.insertImport)(tree, source, directiveFileInfo.filePath, 'CommonModule', '@angular/common');
|
|
19
|
+
let updatedDirectiveSource = source.getText();
|
|
20
|
+
updatedDirectiveSource = `${updatedDirectiveSource}${getNgModuleDeclaration(directiveClassName)}`;
|
|
21
|
+
tree.write(directiveFileInfo.filePath, updatedDirectiveSource);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const scamFilePath = (0, devkit_1.joinPathFragments)(directiveFileInfo.directory, `${directiveNames.fileName}.module.ts`);
|
|
25
|
+
tree.write(scamFilePath, getModuleFileContent(directiveClassName, directiveFileInfo.fileName));
|
|
26
|
+
}
|
|
27
|
+
exports.convertDirectiveToScam = convertDirectiveToScam;
|
|
28
|
+
function getModuleFileContent(directiveClassName, directiveFileName) {
|
|
29
|
+
return `import { NgModule } from '@angular/core';
|
|
30
|
+
import { CommonModule } from '@angular/common';
|
|
31
|
+
import { ${directiveClassName} } from './${directiveFileName}';
|
|
32
|
+
${getNgModuleDeclaration(directiveClassName)}`;
|
|
33
|
+
}
|
|
34
|
+
function getNgModuleDeclaration(directiveClassName) {
|
|
35
|
+
return `
|
|
36
|
+
@NgModule({
|
|
37
|
+
imports: [CommonModule],
|
|
38
|
+
declarations: [${directiveClassName}],
|
|
39
|
+
exports: [${directiveClassName}],
|
|
40
|
+
})
|
|
41
|
+
export class ${directiveClassName}Module {}`;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=convert-directive-to-scam.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convert-directive-to-scam.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/scam-directive/lib/convert-directive-to-scam.ts"],"names":[],"mappings":";;;AACA,yCAAwD;AACxD,uEAAuE;AACvE,2CAA4D;AAI5D,SAAgB,sBAAsB,CACpC,IAAU,EACV,iBAA2B,EAC3B,OAAyB;IAEzB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,iBAAiB,CAAC,QAAQ,C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AAE,iBAAiB,CAAC,QAAQ,CAAC,CACrE,CAAC;AACJ,CAAC;AA5DD,wDA4DC;AAED,SAAS,oBAAoB,CAC3B,kBAA0B,EAC1B,iBAAyB;IAEzB,OAAO;;WAEE,kBAAkB,cAAc,iBAAiB;EAC1D,sBAAsB,CAAC,kBAAkB,CAAC,EAAE,CAAC;AAC/C,CAAC;AAED,SAAS,sBAAsB,CAAC,kBAA0B;IACxD,OAAO;;;mBAGU,kBAAkB;cACvB,kBAAkB;;eAEjB,kBAAkB,WAAW,CAAC;AAC7C,CAAC"}
|
|
@@ -1 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./convert-directive-to-scam"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./normalize-options"), exports);
|
|
1
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/scam-directive/lib/index.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/scam-directive/lib/index.ts"],"names":[],"mappings":";;;AAAA,sEAA4C;AAC5C,8DAAoC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normalizeOptions = void 0;
|
|
4
|
+
const devkit_1 = require("@nrwl/devkit");
|
|
5
|
+
function normalizeOptions(tree, options) {
|
|
6
|
+
var _a, _b, _c, _d, _e;
|
|
7
|
+
const project = (_a = options.project) !== null && _a !== void 0 ? _a : (0, devkit_1.readWorkspaceConfiguration)(tree).defaultProject;
|
|
8
|
+
const { projectType, root, sourceRoot } = (0, devkit_1.readProjectConfiguration)(tree, project);
|
|
9
|
+
const projectSourceRoot = sourceRoot !== null && sourceRoot !== void 0 ? sourceRoot : (0, devkit_1.joinPathFragments)(root, 'src');
|
|
10
|
+
const path = (_b = options.path) !== null && _b !== void 0 ? _b : (0, devkit_1.joinPathFragments)(projectSourceRoot, projectType === 'application' ? 'app' : 'lib');
|
|
11
|
+
return Object.assign(Object.assign({}, options), { export: (_c = options.export) !== null && _c !== void 0 ? _c : true, flat: (_d = options.flat) !== null && _d !== void 0 ? _d : true, inlineScam: (_e = options.inlineScam) !== null && _e !== void 0 ? _e : true, path,
|
|
12
|
+
project,
|
|
13
|
+
projectSourceRoot });
|
|
14
|
+
}
|
|
15
|
+
exports.normalizeOptions = normalizeOptions;
|
|
16
|
+
//# sourceMappingURL=normalize-options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize-options.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/scam-directive/lib/normalize-options.ts"],"names":[],"mappings":";;;AACA,yCAIsB;AAGtB,SAAgB,gBAAgB,CAC9B,IAAU,EACV,OAAe;;IAEf,MAAM,OAAO,GACX,MAAA,OAAO,CAAC,OAAO,mCAAI,IAAA,mCAA0B,EAAC,IAAI,CAAC,CAAC,cAAc,CAAC;IACrE,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,IAAA,iCAAwB,EAChE,IAAI,EACJ,OAAO,CACR,CAAC;IACF,MAAM,iBAAiB,GAAG,UAAU,aAAV,UAAU,cAAV,UAAU,GAAI,IAAA,0BAAiB,EAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACvE,MAAM,IAAI,GACR,MAAA,OAAO,CAAC,IAAI,mCACZ,IAAA,0BAAiB,EACf,iBAAiB,EACjB,WAAW,KAAK,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAC9C,CAAC;IAEJ,uCACK,OAAO,KACV,MAAM,EAAE,MAAA,OAAO,CAAC,MAAM,mCAAI,IAAI,EAC9B,IAAI,EAAE,MAAA,OAAO,CAAC,IAAI,mCAAI,IAAI,EAC1B,UAAU,EAAE,MAAA,OAAO,CAAC,UAAU,mCAAI,IAAI,EACtC,IAAI;QACJ,OAAO;QACP,iBAAiB,IACjB;AACJ,CAAC;AA3BD,4CA2BC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Tree } from '@nrwl/devkit';
|
|
2
2
|
import type { Schema } from './schema';
|
|
3
|
-
export declare function scamDirectiveGenerator(tree: Tree,
|
|
3
|
+
export declare function scamDirectiveGenerator(tree: Tree, rawOptions: Schema): Promise<void>;
|
|
4
4
|
export default scamDirectiveGenerator;
|
|
@@ -2,17 +2,22 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.scamDirectiveGenerator = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const ngcli_adapter_1 = require("@nrwl/devkit/ngcli-adapter");
|
|
6
5
|
const devkit_1 = require("@nrwl/devkit");
|
|
7
|
-
const
|
|
6
|
+
const ngcli_adapter_1 = require("@nrwl/devkit/ngcli-adapter");
|
|
7
|
+
const export_scam_1 = require("../utils/export-scam");
|
|
8
|
+
const file_info_1 = require("../utils/file-info");
|
|
8
9
|
const path_1 = require("../utils/path");
|
|
9
|
-
|
|
10
|
+
const lib_1 = require("./lib");
|
|
11
|
+
function scamDirectiveGenerator(tree, rawOptions) {
|
|
10
12
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
11
|
-
const
|
|
13
|
+
const options = (0, lib_1.normalizeOptions)(tree, rawOptions);
|
|
14
|
+
const { inlineScam, projectSourceRoot } = options, schematicOptions = tslib_1.__rest(options, ["inlineScam", "projectSourceRoot"]);
|
|
12
15
|
checkPathUnderProjectRoot(tree, options);
|
|
13
16
|
const angularDirectiveSchematic = (0, ngcli_adapter_1.wrapAngularDevkitSchematic)('@schematics/angular', 'directive');
|
|
14
|
-
yield angularDirectiveSchematic(tree, Object.assign(Object.assign({},
|
|
15
|
-
(0,
|
|
17
|
+
yield angularDirectiveSchematic(tree, Object.assign(Object.assign({}, schematicOptions), { skipImport: true, export: false, standalone: false }));
|
|
18
|
+
const pipeFileInfo = (0, file_info_1.getDirectiveFileInfo)(tree, options);
|
|
19
|
+
(0, lib_1.convertDirectiveToScam)(tree, pipeFileInfo, options);
|
|
20
|
+
(0, export_scam_1.exportScam)(tree, pipeFileInfo, options);
|
|
16
21
|
yield (0, devkit_1.formatFiles)(tree);
|
|
17
22
|
});
|
|
18
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scam-directive.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/scam-directive/scam-directive.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"scam-directive.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/scam-directive/scam-directive.ts"],"names":[],"mappings":";;;;AACA,yCAKsB;AACtB,8DAAwE;AACxE,sDAAkD;AAClD,kDAA0D;AAC1D,wCAA+C;AAC/C,+BAAiE;AAGjE,SAAsB,sBAAsB,CAAC,IAAU,EAAE,UAAkB;;QACzE,MAAM,OAAO,GAAG,IAAA,sBAAgB,EAAC,IAAI,EAAE,UAAU,CAAC,CAAC;QACnD,MAAM,EAAE,UAAU,EAAE,iBAAiB,KAA0B,OAAO,EAA5B,gBAAgB,kBAAK,OAAO,EAAhE,mCAAsD,CAAU,CAAC;QAEvE,yBAAyB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAEzC,MAAM,yBAAyB,GAAG,IAAA,0CAA0B,EAC1D,qBAAqB,EACrB,WAAW,CACZ,CAAC;QACF,MAAM,yBAAyB,CAAC,IAAI,kCAC/B,gBAAgB,KACnB,UAAU,EAAE,IAAI,EAChB,MAAM,EAAE,KAAK,EACb,UAAU,EAAE,KAAK,IACjB,CAAC;QAEH,MAAM,YAAY,GAAG,IAAA,gCAAoB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACzD,IAAA,4BAAsB,EAAC,IAAI,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC;QACpD,IAAA,wBAAU,EAAC,IAAI,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC;QAExC,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CAAA;AAtBD,wDAsBC;AAED,SAAS,yBAAyB,CAAC,IAAU,EAAE,OAAwB;;IACrE,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE;QACjB,OAAO;KACR;IAED,MAAM,OAAO,GACX,MAAA,OAAO,CAAC,OAAO,mCAAI,IAAA,mCAA0B,EAAC,IAAI,CAAC,CAAC,cAAc,CAAC;IACrE,MAAM,EAAE,IAAI,EAAE,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;IAEzD,IAAI,eAAe,GAAG,IAAA,sBAAa,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAClD,eAAe,GAAG,eAAe,CAAC,UAAU,CAAC,GAAG,CAAC;QAC/C,CAAC,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC,CAAC;QAC1B,CAAC,CAAC,eAAe,CAAC;IAEpB,IAAI,CAAC,IAAA,qBAAc,EAAC,eAAe,EAAE,IAAI,CAAC,EAAE;QAC1C,MAAM,IAAI,KAAK,CACb,mCAAmC,OAAO,CAAC,IAAI,4CAA4C,IAAI,IAAI,CACpG,CAAC;KACH;AACH,CAAC;AAED,kBAAe,sBAAsB,CAAC"}
|
|
@@ -9,3 +9,12 @@ export interface Schema {
|
|
|
9
9
|
selector?: string;
|
|
10
10
|
export?: boolean;
|
|
11
11
|
}
|
|
12
|
+
|
|
13
|
+
export interface NormalizedSchema extends Schema {
|
|
14
|
+
export: boolean;
|
|
15
|
+
flat: boolean;
|
|
16
|
+
inlineScam: boolean;
|
|
17
|
+
path: string;
|
|
18
|
+
project: string;
|
|
19
|
+
projectSourceRoot: string;
|
|
20
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.convertPipeToScam = void 0;
|
|
4
|
+
const devkit_1 = require("@nrwl/devkit");
|
|
5
|
+
const ast_utils_1 = require("@nrwl/workspace/src/utilities/ast-utils");
|
|
6
|
+
const typescript_1 = require("typescript");
|
|
7
|
+
function convertPipeToScam(tree, pipeFileInfo, options) {
|
|
8
|
+
if (!tree.exists(pipeFileInfo.filePath)) {
|
|
9
|
+
throw new Error(`Couldn't find pipe at path ${pipeFileInfo.filePath} to add SCAM setup.`);
|
|
10
|
+
}
|
|
11
|
+
const pipeNames = (0, devkit_1.names)(options.name);
|
|
12
|
+
const typeNames = (0, devkit_1.names)('pipe');
|
|
13
|
+
const pipeClassName = `${pipeNames.className}${typeNames.className}`;
|
|
14
|
+
if (options.inlineScam) {
|
|
15
|
+
const currentPipeContents = tree.read(pipeFileInfo.filePath, 'utf-8');
|
|
16
|
+
let source = (0, typescript_1.createSourceFile)(pipeFileInfo.filePath, currentPipeContents, typescript_1.ScriptTarget.Latest, true);
|
|
17
|
+
source = (0, ast_utils_1.insertImport)(tree, source, pipeFileInfo.filePath, 'NgModule', '@angular/core');
|
|
18
|
+
source = (0, ast_utils_1.insertImport)(tree, source, pipeFileInfo.filePath, 'CommonModule', '@angular/common');
|
|
19
|
+
let updatedPipeSource = source.getText();
|
|
20
|
+
updatedPipeSource = `${updatedPipeSource}${getNgModuleDeclaration(pipeClassName)}`;
|
|
21
|
+
tree.write(pipeFileInfo.filePath, updatedPipeSource);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
const scamFilePath = (0, devkit_1.joinPathFragments)(pipeFileInfo.directory, `${pipeNames.fileName}.module.ts`);
|
|
25
|
+
tree.write(scamFilePath, getModuleFileContent(pipeClassName, pipeFileInfo.fileName));
|
|
26
|
+
}
|
|
27
|
+
exports.convertPipeToScam = convertPipeToScam;
|
|
28
|
+
function getModuleFileContent(pipeClassName, pipeFileName) {
|
|
29
|
+
return `import { NgModule } from '@angular/core';
|
|
30
|
+
import { CommonModule } from '@angular/common';
|
|
31
|
+
import { ${pipeClassName} } from './${pipeFileName}';
|
|
32
|
+
${getNgModuleDeclaration(pipeClassName)}`;
|
|
33
|
+
}
|
|
34
|
+
function getNgModuleDeclaration(pipeClassName) {
|
|
35
|
+
return `
|
|
36
|
+
@NgModule({
|
|
37
|
+
imports: [CommonModule],
|
|
38
|
+
declarations: [${pipeClassName}],
|
|
39
|
+
exports: [${pipeClassName}],
|
|
40
|
+
})
|
|
41
|
+
export class ${pipeClassName}Module {}`;
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=convert-pipe-to-scam.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"convert-pipe-to-scam.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/scam-pipe/lib/convert-pipe-to-scam.ts"],"names":[],"mappings":";;;AACA,yCAAwD;AACxD,uEAAuE;AACvE,2CAA4D;AAI5D,SAAgB,iBAAiB,CAC/B,IAAU,EACV,YAAsB,EACtB,OAAyB;IAEzB,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE;QACvC,MAAM,IAAI,KAAK,CACb,8BAA8B,YAAY,CAAC,QAAQ,qBAAqB,CACzE,CAAC;KACH;IAED,MAAM,SAAS,GAAG,IAAA,cAAK,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACtC,MAAM,SAAS,GAAG,IAAA,cAAK,EAAC,MAAM,CAAC,CAAC;IAChC,MAAM,aAAa,GAAG,GAAG,SAAS,CAAC,SAAS,GAAG,SAAS,CAAC,SAAS,EAAE,CAAC;IAErE,IAAI,OAAO,CAAC,UAAU,EAAE;QACtB,MAAM,mBAAmB,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QACtE,IAAI,MAAM,GAAG,IAAA,6BAAgB,EAC3B,YAAY,CAAC,QAAQ,EACrB,mBAAmB,EACnB,yBAAY,CAAC,MAAM,EACnB,IAAI,CACL,CAAC;QAEF,MAAM,GAAG,IAAA,wBAAY,EACnB,IAAI,EACJ,MAAM,EACN,YAAY,CAAC,QAAQ,EACrB,UAAU,EACV,eAAe,CAChB,CAAC;QACF,MAAM,GAAG,IAAA,wBAAY,EACnB,IAAI,EACJ,MAAM,EACN,YAAY,CAAC,QAAQ,EACrB,cAAc,EACd,iBAAiB,CAClB,CAAC;QAEF,IAAI,iBAAiB,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC;QACzC,iBAAiB,GAAG,GAAG,iBAAiB,GAAG,sBAAsB,CAC/D,aAAa,CACd,EAAE,CAAC;QAEJ,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,QAAQ,EAAE,iBAAiB,CAAC,CAAC;QACrD,OAAO;KACR;IAED,MAAM,YAAY,GAAG,IAAA,0BAAiB,EACpC,YAAY,CAAC,SAAS,EACtB,GAAG,SAAS,CAAC,QAAQ,YAAY,CAClC,CAAC;IAEF,IAAI,CAAC,KAAK,CACR,YAAY,EACZ,oBAAoB,CAAC,aAAa,EAAE,YAAY,CAAC,QAAQ,CAAC,CAC3D,CAAC;AACJ,CAAC;AAzDD,8CAyDC;AAED,SAAS,oBAAoB,CAC3B,aAAqB,EACrB,YAAoB;IAEpB,OAAO;;WAEE,aAAa,cAAc,YAAY;EAChD,sBAAsB,CAAC,aAAa,CAAC,EAAE,CAAC;AAC1C,CAAC;AAED,SAAS,sBAAsB,CAAC,aAAqB;IACnD,OAAO;;;mBAGU,aAAa;cAClB,aAAa;;eAEZ,aAAa,WAAW,CAAC;AACxC,CAAC"}
|
|
@@ -1 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
tslib_1.__exportStar(require("./convert-pipe-to-scam"), exports);
|
|
5
|
+
tslib_1.__exportStar(require("./normalize-options"), exports);
|
|
1
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/scam-pipe/lib/index.ts"],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/scam-pipe/lib/index.ts"],"names":[],"mappings":";;;AAAA,iEAAuC;AACvC,8DAAoC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.normalizeOptions = void 0;
|
|
4
|
+
const devkit_1 = require("@nrwl/devkit");
|
|
5
|
+
function normalizeOptions(tree, options) {
|
|
6
|
+
var _a, _b, _c, _d, _e;
|
|
7
|
+
const project = (_a = options.project) !== null && _a !== void 0 ? _a : (0, devkit_1.readWorkspaceConfiguration)(tree).defaultProject;
|
|
8
|
+
const { projectType, root, sourceRoot } = (0, devkit_1.readProjectConfiguration)(tree, project);
|
|
9
|
+
const projectSourceRoot = sourceRoot !== null && sourceRoot !== void 0 ? sourceRoot : (0, devkit_1.joinPathFragments)(root, 'src');
|
|
10
|
+
const path = (_b = options.path) !== null && _b !== void 0 ? _b : (0, devkit_1.joinPathFragments)(projectSourceRoot, projectType === 'application' ? 'app' : 'lib');
|
|
11
|
+
return Object.assign(Object.assign({}, options), { export: (_c = options.export) !== null && _c !== void 0 ? _c : true, flat: (_d = options.flat) !== null && _d !== void 0 ? _d : true, inlineScam: (_e = options.inlineScam) !== null && _e !== void 0 ? _e : true, path,
|
|
12
|
+
project,
|
|
13
|
+
projectSourceRoot });
|
|
14
|
+
}
|
|
15
|
+
exports.normalizeOptions = normalizeOptions;
|
|
16
|
+
//# sourceMappingURL=normalize-options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"normalize-options.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/scam-pipe/lib/normalize-options.ts"],"names":[],"mappings":";;;AACA,yCAIsB;AAGtB,SAAgB,gBAAgB,CAC9B,IAAU,EACV,OAAe;;IAEf,MAAM,OAAO,GACX,MAAA,OAAO,CAAC,OAAO,mCAAI,IAAA,mCAA0B,EAAC,IAAI,CAAC,CAAC,cAAc,CAAC;IACrE,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,IAAA,iCAAwB,EAChE,IAAI,EACJ,OAAO,CACR,CAAC;IACF,MAAM,iBAAiB,GAAG,UAAU,aAAV,UAAU,cAAV,UAAU,GAAI,IAAA,0BAAiB,EAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IACvE,MAAM,IAAI,GACR,MAAA,OAAO,CAAC,IAAI,mCACZ,IAAA,0BAAiB,EACf,iBAAiB,EACjB,WAAW,KAAK,aAAa,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAC9C,CAAC;IAEJ,uCACK,OAAO,KACV,MAAM,EAAE,MAAA,OAAO,CAAC,MAAM,mCAAI,IAAI,EAC9B,IAAI,EAAE,MAAA,OAAO,CAAC,IAAI,mCAAI,IAAI,EAC1B,UAAU,EAAE,MAAA,OAAO,CAAC,UAAU,mCAAI,IAAI,EACtC,IAAI;QACJ,OAAO;QACP,iBAAiB,IACjB;AACJ,CAAC;AA3BD,4CA2BC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Tree } from '@nrwl/devkit';
|
|
2
2
|
import type { Schema } from './schema';
|
|
3
|
-
export declare function scamPipeGenerator(tree: Tree,
|
|
3
|
+
export declare function scamPipeGenerator(tree: Tree, rawOptions: Schema): Promise<void>;
|
|
4
4
|
export default scamPipeGenerator;
|
|
@@ -2,17 +2,22 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.scamPipeGenerator = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
|
-
const ngcli_adapter_1 = require("@nrwl/devkit/ngcli-adapter");
|
|
6
5
|
const devkit_1 = require("@nrwl/devkit");
|
|
7
|
-
const
|
|
6
|
+
const ngcli_adapter_1 = require("@nrwl/devkit/ngcli-adapter");
|
|
7
|
+
const export_scam_1 = require("../utils/export-scam");
|
|
8
|
+
const file_info_1 = require("../utils/file-info");
|
|
8
9
|
const path_1 = require("../utils/path");
|
|
9
|
-
|
|
10
|
+
const lib_1 = require("./lib");
|
|
11
|
+
function scamPipeGenerator(tree, rawOptions) {
|
|
10
12
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
11
|
-
const
|
|
13
|
+
const options = (0, lib_1.normalizeOptions)(tree, rawOptions);
|
|
14
|
+
const { inlineScam, projectSourceRoot } = options, schematicOptions = tslib_1.__rest(options, ["inlineScam", "projectSourceRoot"]);
|
|
12
15
|
checkPathUnderProjectRoot(tree, options);
|
|
13
16
|
const angularPipeSchematic = (0, ngcli_adapter_1.wrapAngularDevkitSchematic)('@schematics/angular', 'pipe');
|
|
14
|
-
yield angularPipeSchematic(tree, Object.assign(Object.assign({},
|
|
15
|
-
(0,
|
|
17
|
+
yield angularPipeSchematic(tree, Object.assign(Object.assign({}, schematicOptions), { skipImport: true, export: false, standalone: false }));
|
|
18
|
+
const pipeFileInfo = (0, file_info_1.getPipeFileInfo)(tree, options);
|
|
19
|
+
(0, lib_1.convertPipeToScam)(tree, pipeFileInfo, options);
|
|
20
|
+
(0, export_scam_1.exportScam)(tree, pipeFileInfo, options);
|
|
16
21
|
yield (0, devkit_1.formatFiles)(tree);
|
|
17
22
|
});
|
|
18
23
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scam-pipe.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/scam-pipe/scam-pipe.ts"],"names":[],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"scam-pipe.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/scam-pipe/scam-pipe.ts"],"names":[],"mappings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,IAAI,CAAC,CAAC;IAC7C,UAAU,GAAG,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC;IAE3E,IAAI,CAAC,IAAA,qBAAc,EAAC,UAAU,EAAE,IAAI,CAAC,EAAE;QACrC,MAAM,IAAI,KAAK,CACb,mCAAmC,OAAO,CAAC,IAAI,4CAA4C,IAAI,IAAI,CACpG,CAAC;KACH;AACH,CAAC;AAED,kBAAe,iBAAiB,CAAC"}
|
package/src/generators/{setup-mfe → setup-mf}/files/entry-module-files/entry.component.ts__tmpl__
RENAMED
|
File without changes
|
package/src/generators/{setup-mfe → setup-mf}/files/entry-module-files/entry.module.ts__tmpl__
RENAMED
|
File without changes
|
package/src/generators/{setup-mfe → setup-mf}/files/webpack/module-federation.config.js__tmpl__
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-cypress-workaround.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/setup-mf/lib/add-cypress-workaround.ts"],"names":[],"mappings":";AAAA,6DAA6D;AAC7D,iEAAiE;AACjE,iDAAiD;;;AAKjD,yCAIsB;AAEtB,SAAgB,2BAA2B,CAAC,IAAU,EAAE,MAAc;;IACpE,MAAM,cAAc,GAAG,MAAA,MAAM,CAAC,cAAc,mCAAI,GAAG,MAAM,CAAC,OAAO,MAAM,CAAC;IACxE,IAAI,UAAgC,CAAC;IAErC,IAAI;QACF,UAAU,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,cAAc,CAAC,CAAC;KAC7D;IAAC,WAAM;QACN,eAAM,CAAC,IAAI,CAAC,gDAAgD,MAAM,CAAC,OAAO,cAAc,cAAc;iIACuB,CAAC,CAAC;QAC/H,OAAO;KACR;IAED,IAAI,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,uBAAuB,EAAE;QAC/D,kCAAkC;QAClC,OAAO;KACR;IAED,MAAM,YAAY,GAAG;;;;;MAKjB,CAAC;IAEL,MAAM,kBAAkB,GAAG,IAAA,0BAAiB,EAC1C,UAAU,CAAC,UAAU,EACrB,kBAAkB,CACnB,CAAC;IAEF,MAAM,eAAe,GAAG,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC;QACrD,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE,OAAO,CAAC;QACxC,CAAC,CAAC,EAAE,CAAC;IACP,IAAI,CAAC,KAAK,CAAC,kBAAkB,EAAE,GAAG,eAAe,KAAK,YAAY,EAAE,CAAC,CAAC;AACxE,CAAC;AAjCD,kEAiCC"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Tree } from '@nrwl/devkit';
|
|
2
2
|
import type { Schema } from '../schema';
|
|
3
|
-
export declare function addEntryModule(host: Tree, { appName, routing,
|
|
3
|
+
export declare function addEntryModule(host: Tree, { appName, routing, mfType, prefix }: Schema, appRoot: string): void;
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.addEntryModule = void 0;
|
|
4
4
|
const devkit_1 = require("@nrwl/devkit");
|
|
5
|
-
function addEntryModule(host, { appName, routing,
|
|
6
|
-
if (
|
|
5
|
+
function addEntryModule(host, { appName, routing, mfType, prefix }, appRoot) {
|
|
6
|
+
if (mfType === 'remote') {
|
|
7
7
|
(0, devkit_1.generateFiles)(host, (0, devkit_1.joinPathFragments)(__dirname, '../files/entry-module-files'), `${appRoot}/src/app/remote-entry`, {
|
|
8
8
|
tmpl: '',
|
|
9
9
|
appName,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-entry-module.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/setup-mf/lib/add-entry-module.ts"],"names":[],"mappings":";;;AACA,yCAAgE;AAGhE,SAAgB,cAAc,CAC5B,IAAU,EACV,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAU,EAC5C,OAAe;IAEf,IAAI,MAAM,KAAK,QAAQ,EAAE;QACvB,IAAA,sBAAa,EACX,IAAI,EACJ,IAAA,0BAAiB,EAAC,SAAS,EAAE,6BAA6B,CAAC,EAC3D,GAAG,OAAO,uBAAuB,EACjC;YACE,IAAI,EAAE,EAAE;YACR,OAAO;YACP,OAAO;YACP,MAAM;SACP,CACF,CAAC;QAEF,IAAI,CAAC,KAAK,CACR,GAAG,OAAO,wBAAwB,EAClC;;;;;;EAMJ,IAAI,CAAC,IAAI,CAAC,GAAG,OAAO,wBAAwB,EAAE,OAAO,CAAC,EAAE,CACrD,CAAC;KACH;AACH,CAAC;AA7BD,wCA6BC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Tree } from '@nrwl/devkit';
|
|
2
2
|
import type { Schema } from '../schema';
|
|
3
|
-
export declare function checkIsCommaNeeded(
|
|
3
|
+
export declare function checkIsCommaNeeded(mfRemoteText: string): boolean;
|
|
4
4
|
export declare function addRemoteToHost(tree: Tree, options: Schema): void;
|
|
@@ -6,8 +6,8 @@ const tsquery_1 = require("@phenomnomnominal/tsquery");
|
|
|
6
6
|
const ts = require("typescript");
|
|
7
7
|
const ast_utils_1 = require("../../../utils/nx-devkit/ast-utils");
|
|
8
8
|
const ast_utils_2 = require("@nrwl/workspace/src/utilities/ast-utils");
|
|
9
|
-
function checkIsCommaNeeded(
|
|
10
|
-
const remoteText =
|
|
9
|
+
function checkIsCommaNeeded(mfRemoteText) {
|
|
10
|
+
const remoteText = mfRemoteText.replace(/\s+/g, '');
|
|
11
11
|
return !remoteText.endsWith(',]')
|
|
12
12
|
? remoteText === '[]'
|
|
13
13
|
? false
|
|
@@ -16,7 +16,7 @@ function checkIsCommaNeeded(mfeRemoteText) {
|
|
|
16
16
|
}
|
|
17
17
|
exports.checkIsCommaNeeded = checkIsCommaNeeded;
|
|
18
18
|
function addRemoteToHost(tree, options) {
|
|
19
|
-
if (options.
|
|
19
|
+
if (options.mfType === 'remote' && options.host) {
|
|
20
20
|
const hostProject = (0, devkit_1.readProjectConfiguration)(tree, options.host);
|
|
21
21
|
const pathToMFManifest = (0, devkit_1.joinPathFragments)(hostProject.sourceRoot, 'assets/module-federation.manifest.json');
|
|
22
22
|
const hostFederationType = determineHostFederationType(tree, pathToMFManifest);
|
|
@@ -35,8 +35,8 @@ function addRemoteToHost(tree, options) {
|
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
exports.addRemoteToHost = addRemoteToHost;
|
|
38
|
-
function determineHostFederationType(tree,
|
|
39
|
-
return tree.exists(
|
|
38
|
+
function determineHostFederationType(tree, pathToMfManifest) {
|
|
39
|
+
return tree.exists(pathToMfManifest) ? 'dynamic' : 'static';
|
|
40
40
|
}
|
|
41
41
|
function addRemoteToStaticHost(tree, options, hostProject) {
|
|
42
42
|
const hostMFConfigPath = (0, devkit_1.joinPathFragments)(hostProject.root, 'module-federation.config.js');
|
|
@@ -51,8 +51,8 @@ function addRemoteToStaticHost(tree, options, hostProject) {
|
|
|
51
51
|
const updatedConfig = `${hostMFConfig.slice(0, endOfPropertiesPos)}${isCommaNeeded ? ',' : ''}'${options.appName}',${hostMFConfig.slice(endOfPropertiesPos)}`;
|
|
52
52
|
tree.write(hostMFConfigPath, updatedConfig);
|
|
53
53
|
}
|
|
54
|
-
function addRemoteToDynamicHost(tree, options,
|
|
55
|
-
(0, devkit_1.updateJson)(tree,
|
|
54
|
+
function addRemoteToDynamicHost(tree, options, pathToMfManifest) {
|
|
55
|
+
(0, devkit_1.updateJson)(tree, pathToMfManifest, (manifest) => {
|
|
56
56
|
return Object.assign(Object.assign({}, manifest), { [options.appName]: `http://localhost:${options.port}` });
|
|
57
57
|
});
|
|
58
58
|
}
|
|
@@ -69,7 +69,7 @@ function addLazyLoadedRouteToHostAppModule(tree, options, hostFederationType) {
|
|
|
69
69
|
}
|
|
70
70
|
let sourceFile = ts.createSourceFile(pathToHostAppModule, hostAppModule, ts.ScriptTarget.Latest, true);
|
|
71
71
|
if (hostFederationType === 'dynamic') {
|
|
72
|
-
sourceFile = (0, ast_utils_2.insertImport)(tree, sourceFile, pathToHostAppModule, 'loadRemoteModule', '@nrwl/angular/
|
|
72
|
+
sourceFile = (0, ast_utils_2.insertImport)(tree, sourceFile, pathToHostAppModule, 'loadRemoteModule', '@nrwl/angular/mf');
|
|
73
73
|
}
|
|
74
74
|
const routeToAdd = hostFederationType === 'dynamic'
|
|
75
75
|
? `loadRemoteModule('${options.appName}', './Module')`
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-remote-to-host.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/setup-mf/lib/add-remote-to-host.ts"],"names":[],"mappings":";;;AAAA,yCAOsB;AAEtB,uDAAoD;AACpD,iCAAiC;AAEjC,kEAA8D;AAC9D,uEAAuE;AAEvE,SAAgB,kBAAkB,CAAC,YAAoB;IACrD,MAAM,UAAU,GAAG,YAAY,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;IACpD,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,IAAI,CAAC;QAC/B,CAAC,CAAC,UAAU,KAAK,IAAI;YACnB,CAAC,CAAC,KAAK;YACP,CAAC,CAAC,IAAI;QACR,CAAC,CAAC,KAAK,CAAC;AACZ,CAAC;AAPD,gDAOC;AAED,SAAgB,eAAe,CAAC,IAAU,EAAE,OAAe;IACzD,IAAI,OAAO,CAAC,MAAM,KAAK,QAAQ,IAAI,OAAO,CAAC,IAAI,EAAE;QAC/C,MAAM,WAAW,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;QACjE,MAAM,gBAAgB,GAAG,IAAA,0BAAiB,EACxC,WAAW,CAAC,UAAU,EACtB,wCAAwC,CACzC,CAAC;QACF,MAAM,kBAAkB,GAAG,2B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AC,OAAO,CAAC,OAAO,CAAC,CAAC,SACzB,cAAc,YAAY,CAAC,KAAK,CAAC,qBAAqB,CAAC,EAAE,CAAC;QAC1D,IAAI,CAAC,KAAK,CAAC,0BAA0B,EAAE,eAAe,CAAC,CAAC;KACzD;AACH,CAAC"}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"change-build-target.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/setup-mf/lib/change-build-target.ts"],"names":[],"mappings":";;;AAGA,yCAGsB;AAEtB,SAAgB,iBAAiB,CAAC,IAAU,EAAE,OAAe;IAC3D,MAAM,SAAS,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAElE,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,GAAG,+BAA+B,CAAC;IACnE,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,mCAC1B,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,KAClC,mBAAmB,EAAE;YACnB,IAAI,EAAE,GAAG,SAAS,CAAC,IAAI,oBAAoB;SAC5C,GACF,CAAC;IAEF,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,UAAU,mCAC5C,SAAS,CAAC,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,UAAU,KACpD,mBAAmB,EAAE;YACnB,IAAI,EAAE,GAAG,SAAS,CAAC,IAAI,yBAAyB;SACjD,GACF,CAAC;IAEF,IAAA,mCAA0B,EAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;AAC/D,CAAC;AAnBD,8CAmBC"}
|
|
File without changes
|
|
@@ -7,13 +7,13 @@ function fixBootstrap(tree, appRoot, options) {
|
|
|
7
7
|
const bootstrapCode = tree.read(mainFilePath, 'utf-8');
|
|
8
8
|
tree.write((0, devkit_1.joinPathFragments)(appRoot, 'src/bootstrap.ts'), bootstrapCode);
|
|
9
9
|
const bootstrapImportCode = `import('./bootstrap').catch(err => console.error(err))`;
|
|
10
|
-
const fetchMFManifestCode = `import { setRemoteDefinitions } from '@nrwl/angular/
|
|
10
|
+
const fetchMFManifestCode = `import { setRemoteDefinitions } from '@nrwl/angular/mf';
|
|
11
11
|
|
|
12
12
|
fetch('/assets/module-federation.manifest.json')
|
|
13
13
|
.then((res) => res.json())
|
|
14
14
|
.then(definitions => setRemoteDefinitions(definitions))
|
|
15
15
|
.then(() => ${bootstrapImportCode})`;
|
|
16
|
-
tree.write(mainFilePath, options.
|
|
16
|
+
tree.write(mainFilePath, options.mfType === 'host' && options.federationType === 'dynamic'
|
|
17
17
|
? fetchMFManifestCode
|
|
18
18
|
: bootstrapImportCode);
|
|
19
19
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fix-bootstrap.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/setup-mf/lib/fix-bootstrap.ts"],"names":[],"mappings":";;;AACA,yCAAiD;AAGjD,SAAgB,YAAY,CAAC,IAAU,EAAE,OAAe,EAAE,OAAe;IACvE,MAAM,YAAY,GAAG,IAAA,0BAAiB,EAAC,OAAO,EAAE,aAAa,CAAC,CAAC;IAC/D,MAAM,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;IACvD,IAAI,CAAC,KAAK,CAAC,IAAA,0BAAiB,EAAC,OAAO,EAAE,kBAAkB,CAAC,EAAE,aAAa,CAAC,CAAC;IAE1E,MAAM,mBAAmB,GAAG,wDAAwD,CAAC;IAErF,MAAM,mBAAmB,GAAG;;;;;gBAKd,mBAAmB,GAAG,CAAC;IAErC,IAAI,CAAC,KAAK,CACR,YAAY,EACZ,OAAO,CAAC,MAAM,KAAK,MAAM,IAAI,OAAO,CAAC,cAAc,KAAK,SAAS;QAC/D,CAAC,CAAC,mBAAmB;QACrB,CAAC,CAAC,mBAAmB,CACxB,CAAC;AACJ,CAAC;AApBD,oCAoBC"}
|
|
File without changes
|
|
@@ -11,7 +11,7 @@ function generateWebpackConfig(host, options, appRoot, remotesWithPorts) {
|
|
|
11
11
|
}
|
|
12
12
|
(0, devkit_1.generateFiles)(host, (0, devkit_1.joinPathFragments)(__dirname, '../files/webpack'), appRoot, {
|
|
13
13
|
tmpl: '',
|
|
14
|
-
type: options.
|
|
14
|
+
type: options.mfType,
|
|
15
15
|
name: options.appName,
|
|
16
16
|
remotes: remotesWithPorts !== null && remotesWithPorts !== void 0 ? remotesWithPorts : [],
|
|
17
17
|
projectRoot: appRoot,
|