@nrwl/angular 14.4.0-beta.5 → 14.4.0-beta.8
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/executors/file-server/file-server.impl.js +0 -3
- package/src/executors/file-server/file-server.impl.js.map +1 -1
- 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/move/lib/update-ng-package.js +1 -1
- package/src/generators/move/lib/update-ng-package.js.map +1 -1
- package/src/generators/ngrx/files/classes-syntax/__directory__/__fileName__.facade.spec.ts__tmpl__ +3 -3
- package/src/generators/ngrx/files/classes-syntax/__directory__/__fileName__.reducer.spec.ts__tmpl__ +4 -4
- package/src/generators/ngrx/files/classes-syntax/__directory__/__fileName__.reducer.ts__tmpl__ +3 -3
- package/src/generators/ngrx/files/creator-syntax/__directory__/__fileName__.actions.ts__tmpl__ +1 -1
- package/src/generators/ngrx/files/creator-syntax/__directory__/__fileName__.effects.spec.ts__tmpl__ +1 -1
- package/src/generators/ngrx/files/creator-syntax/__directory__/__fileName__.effects.ts__tmpl__ +4 -4
- package/src/generators/ngrx/files/creator-syntax/__directory__/__fileName__.facade.spec.ts__tmpl__ +5 -5
- package/src/generators/ngrx/files/creator-syntax/__directory__/__fileName__.facade.ts__tmpl__ +1 -1
- package/src/generators/ngrx/files/creator-syntax/__directory__/__fileName__.reducer.spec.ts__tmpl__ +4 -4
- package/src/generators/ngrx/files/creator-syntax/__directory__/__fileName__.reducer.ts__tmpl__ +8 -8
- package/src/generators/ngrx/files/creator-syntax/__directory__/__fileName__.selectors.spec.ts__tmpl__ +2 -2
- package/src/generators/ngrx/files/creator-syntax/__directory__/__fileName__.selectors.ts__tmpl__ +7 -7
- package/src/generators/ngrx/lib/add-imports-to-module.js +2 -1
- package/src/generators/ngrx/lib/add-imports-to-module.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/scam.js +4 -3
- package/src/generators/scam/scam.js.map +1 -1
- 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 +7 -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 +15 -0
- package/src/generators/utils/{component.js → file-info.js} +14 -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-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
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,2BAA2B,CACpD,IAAI,EACJ,gBAAgB,CACjB,CAAC;QAEF,IAAI,kBAAkB,KAAK,QAAQ,EAAE;YACnC,qBAAqB,CAAC,IAAI,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;SACnD;aAAM,IAAI,kBAAkB,KAAK,SAAS,EAAE;YAC3C,sBAAsB,CAAC,IAAI,EAAE,OAAO,EAAE,gBAAgB,CAAC,CAAC;SACzD;QAED,MAAM,mBAAmB,GAAG,IAAA,0BAAiB,EAC3C,WAAW,CAAC,UAAU,EACtB,cAAc,CACf,CAAC;QAEF,MAAM,sBAAsB,GAC1B,CAAC,IAAI,CAAC,MAAM,C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B,IAAI,EACJ,UAAU,EACV,mBAAmB,EACnB,kBAAkB,EAClB,kBAAkB,CACnB,CAAC;KACH;IACD,MAAM,UAAU,GACd,kBAAkB,KAAK,SAAS;QAC9B,CAAC,CAAC,qBAAqB,OAAO,CAAC,OAAO,gBAAgB;QACtD,CAAC,CAAC,WAAW,OAAO,CAAC,OAAO,WAAW,CAAC;IAE5C,UAAU,GAAG,IAAA,oBAAQ,EACnB,IAAI,EACJ,mBAAmB,EACnB,UAAU,EACV;kBACc,OAAO,CAAC,OAAO;+BACF,UAAU;OAClC,CACJ,CAAC;IACF,MAAM,0BAA0B,GAAG,IAAA,0BAAiB,EAClD,aAAa,CAAC,UAAU,EACxB,wBAAwB,CACzB,CAAC;IACF,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,0BAA0B,EAAE,OAAO,CAAC,CAAC;IACpE,IACE,YAAY,CAAC,QAAQ,CAAC,0BAA0B,CAAC;QACjD,YAAY,CAAC,QAAQ,CAAC,OAAO,CAAC,EAC9B;QACA,MAAM,qBAAqB,GAAG,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC5D,MAAM,eAAe,GAAG,GAAG,YAAY,CAAC,KAAK,CAC3C,CAAC,EACD,qBAAqB,CACtB,sBAAsB,OAAO,CAAC,OAAO,KACpC,IAAA,cAAK,EAAC,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,
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generate-config.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/setup-mf/lib/generate-config.ts"],"names":[],"mappings":";;;AACA,yCAAwE;AAGxE,SAAgB,qBAAqB,CACnC,IAAU,EACV,OAAe,EACf,OAAe,EACf,gBAAwD;IAExD,IACE,IAAI,CAAC,MAAM,CAAC,GAAG,OAAO,8BAA8B,CAAC;QACrD,IAAI,CAAC,MAAM,CAAC,GAAG,OAAO,oBAAoB,CAAC;QAC3C,IAAI,CAAC,MAAM,CAAC,GAAG,OAAO,yBAAyB,CAAC,EAChD;QACA,eAAM,CAAC,IAAI,CACT,+DAA+D,OAAO,CAAC,OAAO;qKACiF,CAChK,CAAC;KACH;IAED,IAAA,sBAAa,EACX,IAAI,EACJ,IAAA,0BAAiB,EAAC,SAAS,EAAE,kBAAkB,CAAC,EAChD,OAAO,EACP;QACE,IAAI,EAAE,EAAE;QACR,IAAI,EAAE,OAAO,CAAC,MAAM;QACpB,IAAI,EAAE,OAAO,CAAC,OAAO;QACrB,OAAO,EAAE,gBAAgB,aAAhB,gBAAgB,cAAhB,gBAAgB,GAAI,EAAE;QAC/B,WAAW,EAAE,OAAO;KACrB,CACF,CAAC;AACJ,CAAC;AA7BD,sDA6BC"}
|
|
File without changes
|
|
@@ -6,7 +6,7 @@ function getRemotesWithPorts(host, options) {
|
|
|
6
6
|
var _a, _b, _c;
|
|
7
7
|
// If type is host and remotes supplied, check remotes exist
|
|
8
8
|
const remotesWithPort = [];
|
|
9
|
-
if (options.
|
|
9
|
+
if (options.mfType === 'host' &&
|
|
10
10
|
Array.isArray(options.remotes) &&
|
|
11
11
|
options.remotes.length > 0) {
|
|
12
12
|
for (const remote of options.remotes) {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-remotes-with-ports.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/setup-mf/lib/get-remotes-with-ports.ts"],"names":[],"mappings":";;;AACA,yCAAwD;AAGxD,SAAgB,mBAAmB,CAAC,IAAU,EAAE,OAAe;;IAC7D,4DAA4D;IAC5D,MAAM,eAAe,GAA2C,EAAE,CAAC;IACnE,IACE,OAAO,CAAC,MAAM,KAAK,MAAM;QACzB,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC;QAC9B,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAC1B;QACA,KAAK,MAAM,MAAM,IAAI,OAAO,CAAC,OAAO,EAAE;YACpC,MAAM,YAAY,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;YAC5D,eAAe,CAAC,IAAI,CAAC;gBACnB,UAAU,EAAE,MAAM;gBAClB,IAAI,EAAE,MAAA,MAAA,MAAA,YAAY,CAAC,OAAO,CAAC,OAAO,CAAC,0CAAE,OAAO,0CAAE,IAAI,mCAAI,IAAI;aAC3D,CAAC,CAAC;SACJ;KACF;IACD,OAAO,eAAe,CAAC;AACzB,CAAC;AAjBD,kDAiBC"}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/setup-mf/lib/index.ts"],"names":[],"mappings":";;;AAAA,mEAAyC;AACzC,6DAAmC;AACnC,+DAAqC;AACrC,gEAAsC;AACtC,0DAAgC;AAChC,4DAAkC;AAClC,mEAAyC;AACzC,gEAAsC;AACtC,kEAAwC;AACxC,+DAAqC"}
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-tsconfig-target.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/setup-mf/lib/set-tsconfig-target.ts"],"names":[],"mappings":";;;AAGA,yCAIsB;AAEtB,SAAgB,oBAAoB,CAAC,IAAU,EAAE,MAAc;IAC7D,MAAM,EAAE,IAAI,EAAE,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC;IAChE,oBAAoB;IACpB,IAAA,mBAAU,EAAC,IAAI,EAAE,IAAA,0BAAiB,EAAC,IAAI,EAAE,mBAAmB,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,iCACpE,IAAI,KACP,eAAe,kCACV,IAAI,CAAC,eAAe,KACvB,MAAM,EAAE,QAAQ,OAElB,CAAC,CAAC;AACN,CAAC;AAVD,oDAUC"}
|
|
File without changes
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.setupHostIfDynamic = void 0;
|
|
4
4
|
const devkit_1 = require("@nrwl/devkit");
|
|
5
5
|
function setupHostIfDynamic(tree, options) {
|
|
6
|
-
if (options.federationType === 'static' || options.
|
|
6
|
+
if (options.federationType === 'static' || options.mfType === 'remote') {
|
|
7
7
|
return;
|
|
8
8
|
}
|
|
9
9
|
const pathToMFManifest = (0, devkit_1.joinPathFragments)((0, devkit_1.readProjectConfiguration)(tree, options.appName).sourceRoot, 'assets/module-federation.manifest.json');
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup-host-if-dynamic.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/setup-mf/lib/setup-host-if-dynamic.ts"],"names":[],"mappings":";;;AACA,yCAA2E;AAG3E,SAAgB,kBAAkB,CAAC,IAAU,EAAE,OAAe;IAC5D,IAAI,OAAO,CAAC,cAAc,KAAK,QAAQ,IAAI,OAAO,CAAC,MAAM,KAAK,QAAQ,EAAE;QACtE,OAAO;KACR;IAED,MAAM,gBAAgB,GAAG,IAAA,0BAAiB,EACxC,IAAA,iCAAwB,EAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,UAAU,EAC1D,wCAAwC,CACzC,CAAC;IAEF,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,gBAAgB,CAAC,EAAE;QAClC,IAAI,CAAC,KAAK,CAAC,gBAAgB,EAAE,IAAI,CAAC,CAAC;KACpC;AACH,CAAC;AAbD,gDAaC"}
|
|
File without changes
|
|
@@ -5,10 +5,10 @@ const devkit_1 = require("@nrwl/devkit");
|
|
|
5
5
|
function setupServeTarget(host, options) {
|
|
6
6
|
var _a, _b;
|
|
7
7
|
const appConfig = (0, devkit_1.readProjectConfiguration)(host, options.appName);
|
|
8
|
-
appConfig.targets['serve'] = Object.assign(Object.assign({}, appConfig.targets['serve']), { executor: options.
|
|
8
|
+
appConfig.targets['serve'] = Object.assign(Object.assign({}, appConfig.targets['serve']), { executor: options.mfType === 'host'
|
|
9
9
|
? '@nrwl/angular:module-federation-dev-server'
|
|
10
10
|
: '@nrwl/angular:webpack-server', options: Object.assign(Object.assign({}, appConfig.targets['serve'].options), { port: (_a = options.port) !== null && _a !== void 0 ? _a : undefined, publicHost: `http://localhost:${(_b = options.port) !== null && _b !== void 0 ? _b : 4200}` }) });
|
|
11
|
-
if (options.
|
|
11
|
+
if (options.mfType === 'remote') {
|
|
12
12
|
appConfig.targets['serve-static'] = {
|
|
13
13
|
executor: '@nrwl/angular:file-server',
|
|
14
14
|
defaultConfiguration: 'development',
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup-serve-target.js","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/setup-mf/lib/setup-serve-target.ts"],"names":[],"mappings":";;;AACA,yCAGsB;AAGtB,SAAgB,gBAAgB,CAAC,IAAU,EAAE,OAAe;;IAC1D,MAAM,SAAS,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC;IAElE,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,mCACrB,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,KAC7B,QAAQ,EACN,OAAO,CAAC,MAAM,KAAK,MAAM;YACvB,CAAC,CAAC,4CAA4C;YAC9C,CAAC,CAAC,8BAA8B,EACpC,OAAO,kCACF,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,OAAO,KACrC,IAAI,EAAE,MAAA,OAAO,CAAC,IAAI,mCAAI,SAAS,EAC/B,UAAU,EAAE,oBAAoB,MAAA,OAAO,CAAC,IAAI,mCAAI,IAAI,EAAE,MAEzD,CAAC;IAEF,IAAI,OAAO,CAAC,MAAM,KAAK,QAAQ,EAAE;QAC/B,SAAS,CAAC,OAAO,CAAC,cAAc,CAAC,GAAG;YAClC,QAAQ,EAAE,2BAA2B;YACrC,oBAAoB,EAAE,aAAa;YACnC,OAAO,EAAE;gBACP,WAAW,EAAE,GAAG,OAAO,CAAC,OAAO,QAAQ;gBACvC,IAAI,EAAE,OAAO,CAAC,IAAI;aACnB;YACD,cAAc,EAAE;gBACd,WAAW,EAAE;oBACX,WAAW,EAAE,GAAG,OAAO,CAAC,OAAO,oBAAoB;iBACpD;gBACD,UAAU,EAAE;oBACV,WAAW,EAAE,GAAG,OAAO,CAAC,OAAO,mBAAmB;iBACnD;aACF;SACF,CAAC;KACH;IAED,IAAA,mCAA0B,EAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;AAC/D,CAAC;AApCD,4CAoCC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json-schema.org/schema",
|
|
3
|
-
"$id": "
|
|
3
|
+
"$id": "GeneratorAngularMFSetup",
|
|
4
4
|
"cli": "nx",
|
|
5
5
|
"title": "Generate Module Federation Setup for Angular App",
|
|
6
6
|
"description": "Create Module Federation configuration files for given Angular Application.",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
},
|
|
16
16
|
"x-prompt": "What app would you like to generate a Module Federation configuration for?"
|
|
17
17
|
},
|
|
18
|
-
"
|
|
18
|
+
"mfType": {
|
|
19
19
|
"type": "string",
|
|
20
20
|
"enum": ["host", "remote"],
|
|
21
21
|
"description": "Type of application to generate the Module Federation configuration for.",
|
|
@@ -61,6 +61,6 @@
|
|
|
61
61
|
"description": "The prefix to use for any generated component."
|
|
62
62
|
}
|
|
63
63
|
},
|
|
64
|
-
"required": ["appName", "
|
|
64
|
+
"required": ["appName", "mfType"],
|
|
65
65
|
"additionalProperties": false
|
|
66
66
|
}
|
|
File without changes
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const devkit_1 = require("@nrwl/devkit");
|
|
4
|
+
const setup_mf_1 = require("./setup-mf");
|
|
5
|
+
exports.default = (0, devkit_1.convertNxGenerator)(setup_mf_1.setupMf);
|
|
6
|
+
//# sourceMappingURL=setup-mf.compat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup-mf.compat.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/setup-mf/setup-mf.compat.ts"],"names":[],"mappings":";;AAAA,yCAAkD;AAClD,yCAAqC;AAErC,kBAAe,IAAA,2BAAkB,EAAC,kBAAO,CAAC,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.setupMf = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const devkit_1 = require("@nrwl/devkit");
|
|
6
6
|
const lib_1 = require("./lib");
|
|
7
|
-
function
|
|
7
|
+
function setupMf(tree, options) {
|
|
8
8
|
var _a;
|
|
9
9
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
10
10
|
const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.appName);
|
|
@@ -25,6 +25,6 @@ function setupMfe(tree, options) {
|
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
|
-
exports.
|
|
29
|
-
exports.default =
|
|
30
|
-
//# sourceMappingURL=setup-
|
|
28
|
+
exports.setupMf = setupMf;
|
|
29
|
+
exports.default = setupMf;
|
|
30
|
+
//# sourceMappingURL=setup-mf.js.map
|
|
@@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type { Tree } from '@nrwl/devkit';
|
|
2
|
+
import type { FileInfo } from './file-info';
|
|
3
|
+
export declare type GenerationOptions = {
|
|
4
|
+
name: string;
|
|
5
|
+
project: string;
|
|
6
|
+
export?: boolean;
|
|
7
|
+
inlineScam?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare function exportScam(tree: Tree, fileInfo: FileInfo, options: GenerationOptions): void;
|
|
@@ -2,18 +2,19 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.exportScam = void 0;
|
|
4
4
|
const devkit_1 = require("@nrwl/devkit");
|
|
5
|
-
const entry_point_1 = require("
|
|
6
|
-
const path_1 = require("
|
|
7
|
-
function exportScam(tree,
|
|
5
|
+
const entry_point_1 = require("./entry-point");
|
|
6
|
+
const path_1 = require("./path");
|
|
7
|
+
function exportScam(tree, fileInfo, options) {
|
|
8
8
|
if (!options.export) {
|
|
9
9
|
return;
|
|
10
10
|
}
|
|
11
|
-
const { root,
|
|
11
|
+
const { projectType, root, sourceRoot } = (0, devkit_1.readProjectConfiguration)(tree, options.project);
|
|
12
|
+
const projectSourceRoot = sourceRoot !== null && sourceRoot !== void 0 ? sourceRoot : (0, devkit_1.joinPathFragments)(root, 'src');
|
|
12
13
|
if (projectType === 'application') {
|
|
13
14
|
devkit_1.logger.warn('--export=true was ignored as the project the SCAM is being generated in is not a library.');
|
|
14
15
|
return;
|
|
15
16
|
}
|
|
16
|
-
const entryPointPath = (0, entry_point_1.locateLibraryEntryPointFromDirectory)(tree,
|
|
17
|
+
const entryPointPath = (0, entry_point_1.locateLibraryEntryPointFromDirectory)(tree, fileInfo.directory, root, projectSourceRoot);
|
|
17
18
|
if (!entryPointPath) {
|
|
18
19
|
// Let's not error, simply warn the user
|
|
19
20
|
// It's not too much effort to manually do this
|
|
@@ -21,15 +22,15 @@ function exportScam(tree, { componentDirectory, componentFilePath }, options) {
|
|
|
21
22
|
devkit_1.logger.warn(`Could not export SCAM. Unable to determine project's entry point. SCAM has still been created.`);
|
|
22
23
|
return;
|
|
23
24
|
}
|
|
24
|
-
const relativePathFromEntryPoint = (0, path_1.getRelativeImportToFile)(entryPointPath,
|
|
25
|
+
const relativePathFromEntryPoint = (0, path_1.getRelativeImportToFile)(entryPointPath, fileInfo.filePath);
|
|
25
26
|
const entryPointContent = tree.read(entryPointPath, 'utf-8');
|
|
26
27
|
let updatedEntryPointContent = (0, devkit_1.stripIndents) `${entryPointContent}
|
|
27
28
|
export * from "${relativePathFromEntryPoint}";`;
|
|
28
29
|
if (!options.inlineScam) {
|
|
29
|
-
const moduleFilePath = (0, devkit_1.joinPathFragments)(
|
|
30
|
+
const moduleFilePath = (0, devkit_1.joinPathFragments)(fileInfo.directory, `${(0, devkit_1.names)(options.name).fileName}.module.ts`);
|
|
30
31
|
const relativePathFromModule = (0, path_1.getRelativeImportToFile)(entryPointPath, moduleFilePath);
|
|
31
32
|
updatedEntryPointContent = (0, devkit_1.stripIndents) `${updatedEntryPointContent}
|
|
32
|
-
|
|
33
|
+
export * from "${relativePathFromModule}";`;
|
|
33
34
|
}
|
|
34
35
|
tree.write(entryPointPath, updatedEntryPointContent);
|
|
35
36
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export-scam.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/utils/export-scam.ts"],"names":[],"mappings":";;;AACA,yCAMsB;AACtB,+CAAqE;AAErE,iCAAiD;AASjD,SAAgB,UAAU,CACxB,IAAU,EACV,QAAkB,EAClB,OAA0B;IAE1B,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;QACnB,OAAO;KACR;IAED,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,IAAA,iCAAwB,EAChE,IAAI,EACJ,OAAO,CAAC,OAAO,CAChB,CAAC;IACF,MAAM,iBAAiB,GAAG,UAAU,aAAV,UAAU,cAAV,UAAU,GAAI,IAAA,0BAAiB,EAAC,IAAI,EAAE,KAAK,C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+
project?: string;
|
|
7
|
+
type?: string;
|
|
8
|
+
};
|
|
9
|
+
export declare type FileInfo = {
|
|
10
|
+
directory: string;
|
|
11
|
+
fileName: string;
|
|
12
|
+
filePath: string;
|
|
13
|
+
};
|
|
14
|
+
export declare function getComponentFileInfo(tree: Tree, options: GenerationOptions): FileInfo;
|
|
15
|
+
export declare function getPipeFileInfo(tree: Tree, options: GenerationOptions): FileInfo;
|
|
@@ -1,20 +1,27 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getComponentFileInfo = void 0;
|
|
3
|
+
exports.getPipeFileInfo = exports.getComponentFileInfo = void 0;
|
|
4
4
|
const devkit_1 = require("@nrwl/devkit");
|
|
5
5
|
function getComponentFileInfo(tree, options) {
|
|
6
|
+
return getFileInfo(tree, options, 'component');
|
|
7
|
+
}
|
|
8
|
+
exports.getComponentFileInfo = getComponentFileInfo;
|
|
9
|
+
function getPipeFileInfo(tree, options) {
|
|
10
|
+
return getFileInfo(tree, options, 'pipe');
|
|
11
|
+
}
|
|
12
|
+
exports.getPipeFileInfo = getPipeFileInfo;
|
|
13
|
+
function getFileInfo(tree, options, defaultType) {
|
|
6
14
|
var _a, _b;
|
|
7
15
|
const project = (_a = options.project) !== null && _a !== void 0 ? _a : (0, devkit_1.readWorkspaceConfiguration)(tree).defaultProject;
|
|
8
16
|
const { root, sourceRoot, projectType } = (0, devkit_1.readProjectConfiguration)(tree, project);
|
|
9
17
|
const { fileName: normalizedName } = (0, devkit_1.names)(options.name);
|
|
10
|
-
const
|
|
18
|
+
const fileName = `${normalizedName}.${options.type ? (0, devkit_1.names)(options.type).fileName : defaultType}`;
|
|
11
19
|
const projectSourceRoot = sourceRoot !== null && sourceRoot !== void 0 ? sourceRoot : (0, devkit_1.joinPathFragments)(root, 'src');
|
|
12
20
|
const path = (_b = options.path) !== null && _b !== void 0 ? _b : (0, devkit_1.joinPathFragments)(projectSourceRoot, projectType === 'application' ? 'app' : 'lib');
|
|
13
|
-
const
|
|
21
|
+
const directory = options.flat
|
|
14
22
|
? (0, devkit_1.normalizePath)(path)
|
|
15
23
|
: (0, devkit_1.joinPathFragments)(path, normalizedName);
|
|
16
|
-
const
|
|
17
|
-
return {
|
|
24
|
+
const filePath = (0, devkit_1.joinPathFragments)(directory, `${fileName}.ts`);
|
|
25
|
+
return { directory, fileName, filePath };
|
|
18
26
|
}
|
|
19
|
-
|
|
20
|
-
//# sourceMappingURL=component.js.map
|
|
27
|
+
//# sourceMappingURL=file-info.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-info.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/utils/file-info.ts"],"names":[],"mappings":";;;AAAA,yCAOsB;AAetB,SAAgB,oBAAoB,CAClC,IAAU,EACV,OAA0B;IAE1B,OAAO,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE,WAAW,CAAC,CAAC;AACjD,CAAC;AALD,oDAKC;AAED,SAAgB,eAAe,CAC7B,IAAU,EACV,OAA0B;IAE1B,OAAO,WAAW,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;AAC5C,CAAC;AALD,0CAKC;AAED,SAAS,WAAW,CAClB,IAAU,EACV,OAA0B,EAC1B,WAAmB;;IAEnB,MAAM,OAAO,GACX,MAAA,OAAO,CAAC,OAAO,mCAAI,IAAA,mCAA0B,EAAC,IAAI,CAAC,CAAC,cAAc,CAAC;IACrE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,WAAW,EAAE,GAAG,IAAA,iCAAwB,EAChE,IAAI,EACJ,OAAO,CACR,CAAC;IACF,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,GAAG,IAAA,cAAK,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IAEzD,MAAM,QAAQ,GAAG,GAAG,cAAc,IAChC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAA,cAAK,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,WAChD,EAAE,CAAC;IAEH,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;IACJ,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI;QAC5B,CAAC,CAAC,IAAA,sBAAa,EAAC,IAAI,CAAC;QACrB,CAAC,CAAC,IAAA,0BAAiB,EAAC,IAAI,EAAE,cAAc,CAAC,CAAC;IAE5C,MAAM,QAAQ,GAAG,IAAA,0BAAiB,EAAC,SAAS,EAAE,GAAG,QAAQ,KAAK,CAAC,CAAC;IAEhE,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,CAAC;AAC3C,CAAC"}
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-cypress-mf-workaround.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/migrations/update-13-8-1/add-cypress-mf-workaround.ts"],"names":[],"mappings":";;;AACA,yCAIsB;AACtB,iEAA4D;AAE5D,mBAA+B,IAAU;;QACvC,MAAM,QAAQ,GAAG,IAAA,+BAAa,EAAC,IAAI,CAAC,CAAC;QAErC,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE;YAC9B,MAAM,cAAc,GAAG,GAAG,OAAO,MAAM,CAAC;YACxC,IAAI,UAAgC,CAAC;YACrC,IAAI;gBACF,UAAU,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,cAAc,CAAC,CAAC;aAC7D;YAAC,WAAM;gBACN,SAAS;aACV;YAED,IAAI,UAAU,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,uBAAuB,EAAE;gBAC/D,kCAAkC;gBAClC,OAAO;aACR;YAED,MAAM,YAAY,GAAG;;;;;UAKf,CAAC;YAEP,MAAM,kBAAkB,GAAG,IAAA,0BAAiB,EAC1C,UAAU,CAAC,UAAU,EACrB,kBAAkB,CACnB,CAAC;YAEF,MAAM,eAAe,GAAG,IAAI,CAAC,MAAM,CAAC,kBAAkB,CAAC;gBACrD,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,kBAAkB,EAAE,OAAO,CAAC;gBACxC,CAAC,CAAC,EAAE,CAAC;YACP,IAAI,CAAC,KAAK,CAAC,kBAAkB,EAAE,GAAG,eAAe,KAAK,YAAY,EAAE,CAAC,CAAC;SACvE;QAED,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CAAA;AApCD,4BAoCC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Tree } from '@nrwl/devkit';
|
|
2
|
+
export declare function replaceNrwlAngularMfImport(fileContents: string): string;
|
|
3
|
+
export declare function replaceExportedMFETypes(fileContents: string): string;
|
|
4
|
+
export declare function renameSetupMfeGeneratorUsages(fileContents: string): string;
|
|
5
|
+
export default function (tree: Tree): Promise<void>;
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.renameSetupMfeGeneratorUsages = exports.replaceExportedMFETypes = exports.replaceNrwlAngularMfImport = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const devkit_1 = require("@nrwl/devkit");
|
|
6
|
+
const path_1 = require("path");
|
|
7
|
+
const tsquery_1 = require("@phenomnomnominal/tsquery");
|
|
8
|
+
const NRWL_ANGULAR_MFE_STATIC_IMPORT_SELECTOR = 'ImportDeclaration > StringLiteral[value="@nrwl/angular/mfe"]';
|
|
9
|
+
const NRWL_ANGULAR_MFE_DYNAMIC_IMPORT_SELECTOR = 'CallExpression:has(ImportKeyword) > StringLiteral[value="@nrwl/angular/mfe"]';
|
|
10
|
+
const NRWL_ANGULAR_MFE_TYPES_SELECTOR = 'ImportDeclaration:has(StringLiteral[value=@nrwl/angular/module-federation]) > ImportClause > NamedImports';
|
|
11
|
+
function replaceNrwlAngularMfImport(fileContents) {
|
|
12
|
+
let fileAst = tsquery_1.tsquery.ast(fileContents);
|
|
13
|
+
if (fileContents.includes('@nrwl/angular/mfe')) {
|
|
14
|
+
// This file definitely contains the string, however, we're interested in whether it is an import
|
|
15
|
+
const staticQueryResult = (0, tsquery_1.tsquery)(fileAst, NRWL_ANGULAR_MFE_STATIC_IMPORT_SELECTOR, {
|
|
16
|
+
visitAllChildren: true,
|
|
17
|
+
});
|
|
18
|
+
if (staticQueryResult && staticQueryResult.length > 0) {
|
|
19
|
+
fileContents = `${fileContents.slice(0, staticQueryResult[0].getStart())}'@nrwl/angular/mf'${fileContents.slice(staticQueryResult[0].getEnd())}`;
|
|
20
|
+
}
|
|
21
|
+
fileAst = tsquery_1.tsquery.ast(fileContents);
|
|
22
|
+
const dynamicQueryResult = (0, tsquery_1.tsquery)(fileAst, NRWL_ANGULAR_MFE_DYNAMIC_IMPORT_SELECTOR, {
|
|
23
|
+
visitAllChildren: true,
|
|
24
|
+
});
|
|
25
|
+
if (dynamicQueryResult && dynamicQueryResult.length > 0) {
|
|
26
|
+
fileContents = `${fileContents.slice(0, dynamicQueryResult[0].getStart())}'@nrwl/angular/mf'${fileContents.slice(dynamicQueryResult[0].getEnd())}`;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
return fileContents;
|
|
30
|
+
}
|
|
31
|
+
exports.replaceNrwlAngularMfImport = replaceNrwlAngularMfImport;
|
|
32
|
+
function replaceExportedMFETypes(fileContents) {
|
|
33
|
+
const ast = tsquery_1.tsquery.ast(fileContents);
|
|
34
|
+
const queryResult = (0, tsquery_1.tsquery)(ast, NRWL_ANGULAR_MFE_TYPES_SELECTOR, {
|
|
35
|
+
visitAllChildren: true,
|
|
36
|
+
});
|
|
37
|
+
if (queryResult && queryResult.length > 0) {
|
|
38
|
+
const TYPES_IMPORTED_FROM_NRWL_REGEX = /(MFERemotes|MFEConfig)+.*from+.+(@nrwl\/angular\/module-federation)+/g;
|
|
39
|
+
if (TYPES_IMPORTED_FROM_NRWL_REGEX.test(fileContents)) {
|
|
40
|
+
fileContents = fileContents.replace(/MFERemotes/g, 'MFRemotes');
|
|
41
|
+
fileContents = fileContents.replace(/MFEConfig/g, 'MFConfig');
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return fileContents;
|
|
45
|
+
}
|
|
46
|
+
exports.replaceExportedMFETypes = replaceExportedMFETypes;
|
|
47
|
+
function renameSetupMfeGeneratorUsages(fileContents) {
|
|
48
|
+
// Attempt to update any custom generator usage of the changed generators
|
|
49
|
+
const NRWL_SETUP_MFE_IMPORT_SELECTOR = 'ImportDeclaration:has(StringLiteral[value=@nrwl/angular/generators]) > ImportClause:has(NamedImports:has(ImportSpecifier > Identifier[name=setupMfe]))';
|
|
50
|
+
const SETUP_MFE_IMPORTED_FROM_NRWL_REGEX = /(setupMfe)+.*from+.+(@nrwl\/angular\/generators)+/g;
|
|
51
|
+
const SETUP_MFE_FUNCTION_CALL_MFE_TYPE_PROPERTY_ASSIGNMENT_SELECTOR = 'CallExpression:has(Identifier[name=setupMf]) ObjectLiteralExpression > PropertyAssignment > Identifier[name=mfeType]';
|
|
52
|
+
let ast = tsquery_1.tsquery.ast(fileContents);
|
|
53
|
+
let queryResult = (0, tsquery_1.tsquery)(ast, NRWL_SETUP_MFE_IMPORT_SELECTOR, {
|
|
54
|
+
visitAllChildren: true,
|
|
55
|
+
});
|
|
56
|
+
if (queryResult &&
|
|
57
|
+
queryResult.length > 0 &&
|
|
58
|
+
SETUP_MFE_IMPORTED_FROM_NRWL_REGEX.test(fileContents)) {
|
|
59
|
+
fileContents = fileContents.replace(/setupMfe/g, 'setupMf');
|
|
60
|
+
}
|
|
61
|
+
ast = tsquery_1.tsquery.ast(fileContents);
|
|
62
|
+
queryResult = (0, tsquery_1.tsquery)(ast, SETUP_MFE_FUNCTION_CALL_MFE_TYPE_PROPERTY_ASSIGNMENT_SELECTOR, {
|
|
63
|
+
visitAllChildren: true,
|
|
64
|
+
});
|
|
65
|
+
while (queryResult && queryResult.length > 0) {
|
|
66
|
+
const node = queryResult[0];
|
|
67
|
+
fileContents = `${fileContents.slice(0, node.getStart())}mfType${fileContents.slice(node.getEnd())}`;
|
|
68
|
+
ast = tsquery_1.tsquery.ast(fileContents);
|
|
69
|
+
queryResult = (0, tsquery_1.tsquery)(ast, SETUP_MFE_FUNCTION_CALL_MFE_TYPE_PROPERTY_ASSIGNMENT_SELECTOR, {
|
|
70
|
+
visitAllChildren: true,
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
return fileContents;
|
|
74
|
+
}
|
|
75
|
+
exports.renameSetupMfeGeneratorUsages = renameSetupMfeGeneratorUsages;
|
|
76
|
+
function default_1(tree) {
|
|
77
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
78
|
+
(0, devkit_1.visitNotIgnoredFiles)(tree, '/', (path) => {
|
|
79
|
+
const pathExtName = (0, path_1.extname)(path);
|
|
80
|
+
let fileContents = tree.read(path, 'utf-8');
|
|
81
|
+
if (pathExtName === '.ts' || pathExtName === '.js') {
|
|
82
|
+
fileContents = replaceNrwlAngularMfImport(fileContents);
|
|
83
|
+
}
|
|
84
|
+
if (pathExtName === '.ts') {
|
|
85
|
+
// Only TS files can import types and interfaces
|
|
86
|
+
fileContents = replaceExportedMFETypes(fileContents);
|
|
87
|
+
fileContents = renameSetupMfeGeneratorUsages(fileContents);
|
|
88
|
+
}
|
|
89
|
+
tree.write(path, fileContents);
|
|
90
|
+
});
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
exports.default = default_1;
|
|
94
|
+
//# sourceMappingURL=migrate-mfe-to-mf.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrate-mfe-to-mf.js","sourceRoot":"","sources":["../../../../../../packages/angular/src/migrations/update-14-5-0/migrate-mfe-to-mf.ts"],"names":[],"mappings":";;;;AACA,yCAAoD;AACpD,+BAA+B;AAC/B,uDAAoD;AAGpD,MAAM,uCAAuC,GAC3C,8DAA8D,CAAC;AAEjE,MAAM,wCAAwC,GAC5C,8EAA8E,CAAC;AAEjF,MAAM,+BAA+B,GACnC,2GAA2G,CAAC;AAE9G,SAAgB,0BAA0B,CAAC,YAAoB;IAC7D,IAAI,OAAO,GAAe,iBAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IACpD,IAAI,YAAY,CAAC,QAAQ,CAAC,mBAAmB,CAAC,EAAE;QAC9C,iGAAiG;QACjG,MAAM,iBAAiB,GAAG,IAAA,iBAAO,EAC/B,OAAO,EACP,uCAAuC,EACvC;YACE,gBAAgB,EAAE,IAAI;SACvB,CACF,CAAC;QAEF,IAAI,iBAAiB,IAAI,iBAAiB,CAAC,MAAM,GAAG,CAAC,EAAE;YACrD,YAAY,GAAG,GAAG,YAAY,CAAC,KAAK,CAClC,CAAC,EACD,iBAAiB,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CAChC,qBAAqB,YAAY,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC;SAC3E;QAED,OAAO,GAAG,iBAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QAEpC,MAAM,kBAAkB,GAAG,IAAA,iBAAO,EAChC,OAAO,EACP,wCAAwC,EACxC;YACE,gBAAgB,EAAE,IAAI;SACvB,CACF,CAAC;QAEF,IAAI,kBAAkB,IAAI,kBAAkB,CAAC,MAAM,GAAG,CAAC,EAAE;YACvD,YAAY,GAAG,GAAG,YAAY,CAAC,KAAK,CAClC,CAAC,EACD,kBAAkB,CAAC,CAAC,CAAC,CAAC,QAAQ,EAAE,CACjC,qBAAqB,YAAY,CAAC,KAA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AAI,EAAE,YAAY,CAAC,CAAC;QACjC,CAAC,CAAC,CAAC;IACL,CAAC;CAAA;AAlBD,4BAkBC"}
|
|
File without changes
|
|
@@ -46,7 +46,7 @@ function shareWorkspaceLibraries(libraries, tsConfigPath) {
|
|
|
46
46
|
var _a, _b;
|
|
47
47
|
if (tsConfigPath === void 0) { tsConfigPath = (_a = process.env.NX_TSCONFIG_PATH) !== null && _a !== void 0 ? _a : (0, typescript_1.getRootTsConfigPath)(); }
|
|
48
48
|
if (!(0, fs_1.existsSync)(tsConfigPath)) {
|
|
49
|
-
throw new Error(`NX
|
|
49
|
+
throw new Error(`NX MF: TsConfig Path for workspace libraries does not exist! (${tsConfigPath})`);
|
|
50
50
|
}
|
|
51
51
|
const tsConfig = (0, typescript_1.readTsConfig)(tsConfigPath);
|
|
52
52
|
const tsconfigPathAliases = (_b = tsConfig.options) === null || _b === void 0 ? void 0 : _b.paths;
|
|
@@ -184,4 +184,4 @@ function sharePackages(packages) {
|
|
|
184
184
|
}, {});
|
|
185
185
|
}
|
|
186
186
|
exports.sharePackages = sharePackages;
|
|
187
|
-
//# sourceMappingURL=
|
|
187
|
+
//# sourceMappingURL=mf-webpack.js.map
|