@nrwl/react 13.10.0-rc.1 → 13.10.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +9 -9
- package/src/generators/application/lib/find-free-port.d.ts +2 -0
- package/src/generators/application/lib/find-free-port.js +18 -0
- package/src/generators/application/lib/find-free-port.js.map +1 -0
- package/src/generators/application/lib/normalize-options.js +3 -1
- package/src/generators/application/lib/normalize-options.js.map +1 -1
- package/src/generators/mfe-host/files/mfe/webpack.config.prod.js__tmpl__ +26 -1
- package/src/generators/mfe-host/lib/add-mfe-files.d.ts +5 -0
- package/src/generators/mfe-host/lib/{add-mfe.js → add-mfe-files.js} +5 -5
- package/src/generators/mfe-host/lib/add-mfe-files.js.map +1 -0
- package/src/generators/mfe-host/lib/update-mfe-e2e-project.d.ts +1 -1
- package/src/generators/mfe-host/lib/update-mfe-e2e-project.js.map +1 -1
- package/src/generators/mfe-host/mfe-host.d.ts +1 -0
- package/src/generators/mfe-host/mfe-host.js +8 -5
- package/src/generators/mfe-host/mfe-host.js.map +1 -1
- package/src/generators/mfe-remote/lib/update-host-with-remote.d.ts +2 -0
- package/src/generators/mfe-remote/lib/update-host-with-remote.js +49 -0
- package/src/generators/mfe-remote/lib/update-host-with-remote.js.map +1 -0
- package/src/generators/mfe-remote/mfe-remote.d.ts +2 -1
- package/src/generators/mfe-remote/mfe-remote.js +6 -9
- package/src/generators/mfe-remote/mfe-remote.js.map +1 -1
- package/src/generators/mfe-remote/schema.d.ts +0 -4
- package/src/generators/storybook-configuration/schema.d.ts +1 -0
- package/src/generators/storybook-configuration/schema.json +4 -0
- package/src/mfe/mfe-ast-utils.d.ts +8 -0
- package/src/mfe/mfe-ast-utils.js +96 -0
- package/src/mfe/mfe-ast-utils.js.map +1 -0
- package/src/rules/update-mfe-project.d.ts +6 -0
- package/src/{generators/mfe-host/lib → rules}/update-mfe-project.js +1 -0
- package/src/rules/update-mfe-project.js.map +1 -0
- package/src/utils/versions.js +1 -1
- package/src/generators/mfe-host/lib/add-mfe.d.ts +0 -2
- package/src/generators/mfe-host/lib/add-mfe.js.map +0 -1
- package/src/generators/mfe-host/lib/update-host-with-remote.d.ts +0 -3
- package/src/generators/mfe-host/lib/update-host-with-remote.js +0 -10
- package/src/generators/mfe-host/lib/update-host-with-remote.js.map +0 -1
- package/src/generators/mfe-host/lib/update-mfe-project.d.ts +0 -3
- package/src/generators/mfe-host/lib/update-mfe-project.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nrwl/react",
|
|
3
|
-
"version": "13.10.
|
|
3
|
+
"version": "13.10.1",
|
|
4
4
|
"description": "The React plugin contains executors and generators for managing React applications and libraries within an Nx workspace. It provides:\n\n\n- Integration with libraries such as Jest, Cypress, and Storybook.\n\n- Generators for applications, libraries, components, hooks, and more.\n\n- Library build support for publishing packages to npm or other registries.\n\n- Utilities for automatic workspace refactoring.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -32,14 +32,14 @@
|
|
|
32
32
|
"dependencies": {
|
|
33
33
|
"@babel/core": "^7.15.0",
|
|
34
34
|
"@babel/preset-react": "^7.14.5",
|
|
35
|
-
"@nrwl/cypress": "13.10.
|
|
36
|
-
"@nrwl/devkit": "13.10.
|
|
37
|
-
"@nrwl/jest": "13.10.
|
|
38
|
-
"@nrwl/js": "13.10.
|
|
39
|
-
"@nrwl/linter": "13.10.
|
|
40
|
-
"@nrwl/storybook": "13.10.
|
|
41
|
-
"@nrwl/web": "13.10.
|
|
42
|
-
"@nrwl/workspace": "13.10.
|
|
35
|
+
"@nrwl/cypress": "13.10.1",
|
|
36
|
+
"@nrwl/devkit": "13.10.1",
|
|
37
|
+
"@nrwl/jest": "13.10.1",
|
|
38
|
+
"@nrwl/js": "13.10.1",
|
|
39
|
+
"@nrwl/linter": "13.10.1",
|
|
40
|
+
"@nrwl/storybook": "13.10.1",
|
|
41
|
+
"@nrwl/web": "13.10.1",
|
|
42
|
+
"@nrwl/workspace": "13.10.1",
|
|
43
43
|
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.1",
|
|
44
44
|
"@svgr/webpack": "^6.1.2",
|
|
45
45
|
"chalk": "4.1.0",
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.findFreePort = void 0;
|
|
4
|
+
const devkit_1 = require("@nrwl/devkit");
|
|
5
|
+
function findFreePort(host) {
|
|
6
|
+
var _a, _b, _c;
|
|
7
|
+
const projects = (0, devkit_1.getProjects)(host);
|
|
8
|
+
let port = -Infinity;
|
|
9
|
+
for (const [, p] of projects.entries()) {
|
|
10
|
+
const curr = (_c = (_b = (_a = p.targets) === null || _a === void 0 ? void 0 : _a.serve) === null || _b === void 0 ? void 0 : _b.options) === null || _c === void 0 ? void 0 : _c.port;
|
|
11
|
+
if (typeof curr === 'number') {
|
|
12
|
+
port = Math.max(port, curr);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
return port > 0 ? port + 1 : 4200;
|
|
16
|
+
}
|
|
17
|
+
exports.findFreePort = findFreePort;
|
|
18
|
+
//# sourceMappingURL=find-free-port.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"find-free-port.js","sourceRoot":"","sources":["../../../../../../../packages/react/src/generators/application/lib/find-free-port.ts"],"names":[],"mappings":";;;AACA,yCAA2C;AAE3C,SAAgB,YAAY,CAAC,IAAU;;IACrC,MAAM,QAAQ,GAAG,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IACnC,IAAI,IAAI,GAAG,CAAC,QAAQ,CAAC;IACrB,KAAK,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,QAAQ,CAAC,OAAO,EAAE,EAAE;QACtC,MAAM,IAAI,GAAG,MAAA,MAAA,MAAA,CAAC,CAAC,OAAO,0CAAE,KAAK,0CAAE,OAAO,0CAAE,IAAI,CAAC;QAC7C,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE;YAC5B,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;SAC7B;KACF;IACD,OAAO,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACpC,CAAC;AAVD,oCAUC"}
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.normalizeOptions = void 0;
|
|
4
4
|
const assertion_1 = require("../../../utils/assertion");
|
|
5
5
|
const devkit_1 = require("@nrwl/devkit");
|
|
6
|
+
const find_free_port_1 = require("./find-free-port");
|
|
6
7
|
function normalizeOptions(host, options) {
|
|
7
8
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
8
9
|
const appDirectory = options.directory
|
|
@@ -26,11 +27,12 @@ function normalizeOptions(host, options) {
|
|
|
26
27
|
options.unitTestRunner = (_d = options.unitTestRunner) !== null && _d !== void 0 ? _d : 'jest';
|
|
27
28
|
options.e2eTestRunner = (_e = options.e2eTestRunner) !== null && _e !== void 0 ? _e : 'cypress';
|
|
28
29
|
options.compiler = (_f = options.compiler) !== null && _f !== void 0 ? _f : 'babel';
|
|
30
|
+
(_g = options.devServerPort) !== null && _g !== void 0 ? _g : (options.devServerPort = (0, find_free_port_1.findFreePort)(host));
|
|
29
31
|
return Object.assign(Object.assign({}, options), { name: (0, devkit_1.names)(options.name).fileName, projectName: appProjectName, appProjectRoot,
|
|
30
32
|
e2eProjectName,
|
|
31
33
|
parsedTags,
|
|
32
34
|
fileName,
|
|
33
|
-
styledModule, hasStyles: options.style !== 'none'
|
|
35
|
+
styledModule, hasStyles: options.style !== 'none' });
|
|
34
36
|
}
|
|
35
37
|
exports.normalizeOptions = normalizeOptions;
|
|
36
38
|
//# sourceMappingURL=normalize-options.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"normalize-options.js","sourceRoot":"","sources":["../../../../../../../packages/react/src/generators/application/lib/normalize-options.ts"],"names":[],"mappings":";;;AACA,wDAA4D;AAC5D,yCAA8E;
|
|
1
|
+
{"version":3,"file":"normalize-options.js","sourceRoot":"","sources":["../../../../../../../packages/react/src/generators/application/lib/normalize-options.ts"],"names":[],"mappings":";;;AACA,wDAA4D;AAC5D,yCAA8E;AAC9E,qDAAgD;AAEhD,SAAgB,gBAAgB,CAC9B,IAAU,EACV,OAAe;;IAEf,MAAM,YAAY,GAAG,OAAO,CAAC,SAAS;QACpC,CAAC,CAAC,GAAG,IAAA,cAAK,EAAC,OAAO,CAAC,SAAS,CAAC,CAAC,QAAQ,IAAI,IAAA,cAAK,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE;QACxE,CAAC,CAAC,IAAA,cAAK,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC;IAEjC,MAAM,cAAc,GAAG,YAAY,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC;IACvE,MAAM,cAAc,GAAG,GAAG,cAAc,MAAM,CAAC;IAE/C,MAAM,EAAE,OAAO,EAAE,GAAG,IAAA,2BAAkB,EAAC,IAAI,CAAC,CAAC;IAC7C,MAAM,cAAc,GAAG,IAAA,sBAAa,EAAC,GAAG,OAAO,IAAI,YAAY,EAAE,CAAC,CAAC;IAEnE,MAAM,UAAU,GAAG,OAAO,CAAC,IAAI;QAC7B,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QAC9C,CAAC,CAAC,EAAE,CAAC;IAEP,MAAM,QAAQ,GAAG,OAAO,CAAC,eAAe,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC;IAEzD,MAAM,YAAY,GAAG,6BAA6B,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC;QACpE,CAAC,CAAC,IAAI;QACN,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC;IAElB,IAAA,4BAAgB,EAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAEhC,OAAO,CAAC,OAAO,GAAG,MAAA,OAAO,CAAC,OAAO,mCAAI,KAAK,CAAC;IAC3C,OAAO,CAAC,MAAM,GAAG,MAAA,OAAO,CAAC,MAAM,mCAAI,IAAI,CAAC;IACxC,OAAO,CAAC,cAAc,GAAG,MAAA,OAAO,CAAC,cAAc,mCAAI,KAAK,CAAC;IACzD,OAAO,CAAC,cAAc,GAAG,MAAA,OAAO,CAAC,cAAc,mCAAI,MAAM,CAAC;IAC1D,OAAO,CAAC,aAAa,GAAG,MAAA,OAAO,CAAC,aAAa,mCAAI,SAAS,CAAC;IAC3D,OAAO,CAAC,QAAQ,GAAG,MAAA,OAAO,CAAC,QAAQ,mCAAI,OAAO,CAAC;IAC/C,MAAA,OAAO,CAAC,aAAa,oCAArB,OAAO,CAAC,aAAa,GAAK,IAAA,6BAAY,EAAC,IAAI,CAAC,EAAC;IAE7C,uCACK,OAAO,KACV,IAAI,EAAE,IAAA,cAAK,EAAC,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,EAClC,WAAW,EAAE,cAAc,EAC3B,cAAc;QACd,cAAc;QACd,UAAU;QACV,QAAQ;QACR,YAAY,EACZ,SAAS,EAAE,OAAO,CAAC,KAAK,KAAK,MAAM,IACnC;AACJ,CAAC;AA7CD,4CA6CC"}
|
|
@@ -1 +1,26 @@
|
|
|
1
|
-
|
|
1
|
+
const withModuleFederation = require('@nrwl/react/module-federation');
|
|
2
|
+
const mfeConfig = require('./mfe.config');
|
|
3
|
+
|
|
4
|
+
module.exports = withModuleFederation({
|
|
5
|
+
...mfeConfig,
|
|
6
|
+
/*
|
|
7
|
+
* Remote overrides for production.
|
|
8
|
+
* Each entry is a pair of an unique name and the URL where it is deployed.
|
|
9
|
+
*
|
|
10
|
+
* e.g.
|
|
11
|
+
* remotes: [
|
|
12
|
+
* ['app1', '//app1.example.com'],
|
|
13
|
+
* ['app2', '//app2.example.com'],
|
|
14
|
+
* ]
|
|
15
|
+
*
|
|
16
|
+
* You can also use a full path to the remoteEntry.js file if desired.
|
|
17
|
+
*
|
|
18
|
+
* remotes: [
|
|
19
|
+
* ['app1', '//example.com/path/to/app1/remoteEntry.js'],
|
|
20
|
+
* ['app2', '//example.com/path/to/app2/remoteEntry.js'],
|
|
21
|
+
* ]
|
|
22
|
+
*/
|
|
23
|
+
remotes: [
|
|
24
|
+
<% remotes.forEach(function(r) {%>['<%= r.fileName %>', '//localhost:<%= r.port %>/'],<% }); %>
|
|
25
|
+
],
|
|
26
|
+
});
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.addMfeFiles = void 0;
|
|
4
4
|
const devkit_1 = require("@nrwl/devkit");
|
|
5
5
|
const path_1 = require("path");
|
|
6
|
-
function
|
|
7
|
-
const templateVariables = Object.assign(Object.assign(Object.assign({}, (0, devkit_1.names)(options.name)), options), { tmpl: '', remotes:
|
|
6
|
+
function addMfeFiles(host, options, defaultRemoteManifest) {
|
|
7
|
+
const templateVariables = Object.assign(Object.assign(Object.assign({}, (0, devkit_1.names)(options.name)), options), { tmpl: '', remotes: defaultRemoteManifest.map(({ name, port }) => (Object.assign(Object.assign({}, (0, devkit_1.names)(name)), { port }))) });
|
|
8
8
|
// Module federation requires bootstrap code to be dynamically imported.
|
|
9
9
|
// Renaming original entry file so we can use `import(./bootstrap)` in
|
|
10
10
|
// new entry file.
|
|
@@ -13,5 +13,5 @@ function addMFEFiles(host, options) {
|
|
|
13
13
|
(0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, `../files/mfe`), options.appProjectRoot, templateVariables);
|
|
14
14
|
(0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, `../files/common`), options.appProjectRoot, templateVariables);
|
|
15
15
|
}
|
|
16
|
-
exports.
|
|
17
|
-
//# sourceMappingURL=add-mfe.js.map
|
|
16
|
+
exports.addMfeFiles = addMfeFiles;
|
|
17
|
+
//# sourceMappingURL=add-mfe-files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-mfe-files.js","sourceRoot":"","sources":["../../../../../../../packages/react/src/generators/mfe-host/lib/add-mfe-files.ts"],"names":[],"mappings":";;;AACA,yCAAoD;AACpD,+BAA4B;AAE5B,SAAgB,WAAW,CACzB,IAAI,EACJ,OAAyB,EACzB,qBAAuD;IAEvD,MAAM,iBAAiB,iDAClB,IAAA,cAAK,EAAC,OAAO,CAAC,IAAI,CAAC,GACnB,OAAO,KACV,IAAI,EAAE,EAAE,EACR,OAAO,EAAE,qBAAqB,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC,iCAClD,IAAA,cAAK,EAAC,IAAI,CAAC,KACd,IAAI,IACJ,CAAC,GACJ,CAAC;IAEF,wEAAwE;IACxE,sEAAsE;IACtE,kBAAkB;IAClB,IAAI,CAAC,MAAM,CACT,IAAA,WAAI,EAAC,OAAO,CAAC,cAAc,EAAE,cAAc,CAAC,EAC5C,IAAA,WAAI,EAAC,OAAO,CAAC,cAAc,EAAE,mBAAmB,CAAC,CAClD,CAAC;IAEF,kCAAkC;IAClC,IAAA,sBAAa,EACX,IAAI,EACJ,IAAA,WAAI,EAAC,SAAS,EAAE,cAAc,CAAC,EAC/B,OAAO,CAAC,cAAc,EACtB,iBAAiB,CAClB,CAAC;IAEF,IAAA,sBAAa,EACX,IAAI,EACJ,IAAA,WAAI,EAAC,SAAS,EAAE,iBAAiB,CAAC,EAClC,OAAO,CAAC,cAAc,EACtB,iBAAiB,CAClB,CAAC;AACJ,CAAC;AArCD,kCAqCC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-mfe-e2e-project.js","sourceRoot":"","sources":["../../../../../../../packages/react/src/generators/mfe-host/lib/update-mfe-e2e-project.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"update-mfe-e2e-project.js","sourceRoot":"","sources":["../../../../../../../packages/react/src/generators/mfe-host/lib/update-mfe-e2e-project.ts"],"names":[],"mappings":";;;AACA,yCAIsB;AAEtB,SAAgB,mBAAmB,CAAC,IAAU,EAAE,OAAyB;IACvE,MAAM,OAAO,GAAG,GAAG,OAAO,CAAC,IAAI,MAAM,CAAC;IACtC,IAAI;QACF,IAAI,aAAa,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC5D,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,mCAC5B,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,OAAO,KACpC,OAAO,EAAE,uBAAuB,GACjC,CAAC;QACF,IAAA,mCAA0B,EAAC,IAAI,EAAE,OAAO,EAAE,aAAa,CAAC,CAAC;KAC1D;IAAC,WAAM;QACN,UAAU;KACX;AACH,CAAC;AAZD,kDAYC"}
|
|
@@ -5,9 +5,9 @@ const tslib_1 = require("tslib");
|
|
|
5
5
|
const devkit_1 = require("@nrwl/devkit");
|
|
6
6
|
const application_1 = require("../application/application");
|
|
7
7
|
const normalize_options_1 = require("../application/lib/normalize-options");
|
|
8
|
-
const add_mfe_1 = require("./lib/add-mfe");
|
|
9
|
-
const update_mfe_project_1 = require("./lib/update-mfe-project");
|
|
10
8
|
const mfe_remote_1 = require("../mfe-remote/mfe-remote");
|
|
9
|
+
const update_mfe_project_1 = require("../../rules/update-mfe-project");
|
|
10
|
+
const add_mfe_files_1 = require("./lib/add-mfe-files");
|
|
11
11
|
const update_mfe_e2e_project_1 = require("./lib/update-mfe-e2e-project");
|
|
12
12
|
function mfeHostGenerator(host, schema) {
|
|
13
13
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
@@ -15,12 +15,11 @@ function mfeHostGenerator(host, schema) {
|
|
|
15
15
|
const initTask = yield (0, application_1.default)(host, Object.assign(Object.assign({}, options), {
|
|
16
16
|
// The target use-case for MFE is loading remotes as child routes, thus always enable routing.
|
|
17
17
|
routing: true }));
|
|
18
|
-
|
|
19
|
-
(0, update_mfe_project_1.updateMfeProject)(host, options);
|
|
20
|
-
(0, update_mfe_e2e_project_1.updateMfeE2eProject)(host, options);
|
|
18
|
+
const remotesWithPorts = [];
|
|
21
19
|
if (schema.remotes) {
|
|
22
20
|
let remotePort = options.devServerPort + 1;
|
|
23
21
|
for (const remote of schema.remotes) {
|
|
22
|
+
remotesWithPorts.push({ name: remote, port: remotePort });
|
|
24
23
|
yield (0, mfe_remote_1.mfeRemoteGenerator)(host, {
|
|
25
24
|
name: remote,
|
|
26
25
|
style: options.style,
|
|
@@ -33,6 +32,9 @@ function mfeHostGenerator(host, schema) {
|
|
|
33
32
|
remotePort++;
|
|
34
33
|
}
|
|
35
34
|
}
|
|
35
|
+
(0, add_mfe_files_1.addMfeFiles)(host, options, remotesWithPorts);
|
|
36
|
+
(0, update_mfe_project_1.updateMfeProject)(host, options);
|
|
37
|
+
(0, update_mfe_e2e_project_1.updateMfeE2eProject)(host, options);
|
|
36
38
|
if (!options.skipFormat) {
|
|
37
39
|
yield (0, devkit_1.formatFiles)(host);
|
|
38
40
|
}
|
|
@@ -40,4 +42,5 @@ function mfeHostGenerator(host, schema) {
|
|
|
40
42
|
});
|
|
41
43
|
}
|
|
42
44
|
exports.mfeHostGenerator = mfeHostGenerator;
|
|
45
|
+
exports.default = mfeHostGenerator;
|
|
43
46
|
//# sourceMappingURL=mfe-host.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mfe-host.js","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/mfe-host/mfe-host.ts"],"names":[],"mappings":";;;;AAAA,yCAAiD;AAEjD,4DAA8D;AAC9D,4EA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,IAAA,4CAAmB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAEnC,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;YACvB,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;SACzB;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;CAAA;AArCD,4CAqCC;AAED,kBAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.updateHostWithRemote = void 0;
|
|
4
|
+
const devkit_1 = require("@nrwl/devkit");
|
|
5
|
+
const mfe_ast_utils_1 = require("../../../mfe/mfe-ast-utils");
|
|
6
|
+
const ts = require("typescript");
|
|
7
|
+
function updateHostWithRemote(host, hostName, remoteName) {
|
|
8
|
+
const hostConfig = (0, devkit_1.readProjectConfiguration)(host, hostName);
|
|
9
|
+
const mfeConfigPath = (0, devkit_1.joinPathFragments)(hostConfig.root, 'mfe.config.js');
|
|
10
|
+
const remoteDefsPath = (0, devkit_1.joinPathFragments)(hostConfig.sourceRoot, 'remotes.d.ts');
|
|
11
|
+
const appComponentPath = findAppComponentPath(host, hostConfig.sourceRoot);
|
|
12
|
+
if (host.exists(mfeConfigPath)) {
|
|
13
|
+
// find the host project path
|
|
14
|
+
// Update remotes inside ${host_path}/src/remotes.d.ts
|
|
15
|
+
let sourceCode = host.read(mfeConfigPath).toString();
|
|
16
|
+
const source = ts.createSourceFile(mfeConfigPath, sourceCode, ts.ScriptTarget.Latest, true);
|
|
17
|
+
host.write(mfeConfigPath, (0, devkit_1.applyChangesToString)(sourceCode, (0, mfe_ast_utils_1.addRemoteToMfeConfig)(source, remoteName)));
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
// TODO(jack): Point to the nx.dev guide when ready.
|
|
21
|
+
devkit_1.logger.warn(`Could not find MFE configuration at ${mfeConfigPath}. Did you generate this project with "@nrwl/react:mfe-host"?`);
|
|
22
|
+
}
|
|
23
|
+
if (host.exists(remoteDefsPath)) {
|
|
24
|
+
let sourceCode = host.read(remoteDefsPath).toString();
|
|
25
|
+
const source = ts.createSourceFile(mfeConfigPath, sourceCode, ts.ScriptTarget.Latest, true);
|
|
26
|
+
host.write(remoteDefsPath, (0, devkit_1.applyChangesToString)(sourceCode, (0, mfe_ast_utils_1.addRemoteDefinition)(source, remoteName)));
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
devkit_1.logger.warn(`Could not find remote definitions at ${remoteDefsPath}. Did you generate this project with "@nrwl/react:mfe-host"?`);
|
|
30
|
+
}
|
|
31
|
+
if (host.exists(appComponentPath)) {
|
|
32
|
+
let sourceCode = host.read(appComponentPath).toString();
|
|
33
|
+
const source = ts.createSourceFile(mfeConfigPath, sourceCode, ts.ScriptTarget.Latest, true);
|
|
34
|
+
host.write(appComponentPath, (0, devkit_1.applyChangesToString)(sourceCode, (0, mfe_ast_utils_1.addRemoteRoute)(source, (0, devkit_1.names)(remoteName))));
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
devkit_1.logger.warn(`Could not find app component at ${appComponentPath}. Did you generate this project with "@nrwl/react:mfe-host"?`);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
exports.updateHostWithRemote = updateHostWithRemote;
|
|
41
|
+
function findAppComponentPath(host, sourceRoot) {
|
|
42
|
+
const locations = ['app/app.tsx', 'app/App.tsx', 'app.tsx', 'App.tsx'];
|
|
43
|
+
for (const loc of locations) {
|
|
44
|
+
if (host.exists((0, devkit_1.joinPathFragments)(sourceRoot, loc))) {
|
|
45
|
+
return (0, devkit_1.joinPathFragments)(sourceRoot, loc);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=update-host-with-remote.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-host-with-remote.js","sourceRoot":"","sources":["../../../../../../../packages/react/src/generators/mfe-remote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ormalizedSchema } from '../application/schema';
|
|
3
|
+
import { Schema } from './schema';
|
|
4
4
|
export declare function addMfeFiles(host: Tree, options: NormalizedSchema): void;
|
|
5
5
|
export declare function mfeRemoteGenerator(host: Tree, schema: Schema): Promise<import("@nrwl/devkit").GeneratorCallback>;
|
|
6
|
+
export default mfeRemoteGenerator;
|
|
@@ -7,8 +7,8 @@ const devkit_1 = require("@nrwl/devkit");
|
|
|
7
7
|
const run_tasks_in_serial_1 = require("@nrwl/workspace/src/utilities/run-tasks-in-serial");
|
|
8
8
|
const normalize_options_1 = require("../application/lib/normalize-options");
|
|
9
9
|
const application_1 = require("../application/application");
|
|
10
|
-
const
|
|
11
|
-
const
|
|
10
|
+
const update_host_with_remote_1 = require("./lib/update-host-with-remote");
|
|
11
|
+
const update_mfe_project_1 = require("../../rules/update-mfe-project");
|
|
12
12
|
function addMfeFiles(host, options) {
|
|
13
13
|
const templateVariables = Object.assign(Object.assign(Object.assign({}, (0, devkit_1.names)(options.name)), options), { tmpl: '' });
|
|
14
14
|
(0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, `./files/mfe`), options.appProjectRoot, templateVariables);
|
|
@@ -18,19 +18,15 @@ function mfeRemoteGenerator(host, schema) {
|
|
|
18
18
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
19
19
|
const options = (0, normalize_options_1.normalizeOptions)(host, schema);
|
|
20
20
|
const initApp = yield (0, application_1.default)(host, options);
|
|
21
|
+
if (schema.host) {
|
|
22
|
+
(0, update_host_with_remote_1.updateHostWithRemote)(host, schema.host, options.name);
|
|
23
|
+
}
|
|
21
24
|
// Module federation requires bootstrap code to be dynamically imported.
|
|
22
25
|
// Renaming original entry file so we can use `import(./bootstrap)` in
|
|
23
26
|
// new entry file.
|
|
24
27
|
host.rename((0, path_1.join)(options.appProjectRoot, 'src/main.tsx'), (0, path_1.join)(options.appProjectRoot, 'src/bootstrap.tsx'));
|
|
25
28
|
addMfeFiles(host, options);
|
|
26
29
|
(0, update_mfe_project_1.updateMfeProject)(host, options);
|
|
27
|
-
if (schema.host) {
|
|
28
|
-
(0, update_host_with_remote_1.updateHostWithRemote)(host, options);
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
// Log that no host has been passed in so we will use the default project as the host (Only if through CLI)
|
|
32
|
-
// Since Remotes can be generated from the Host Generator we should probably have some identifier to use
|
|
33
|
-
}
|
|
34
30
|
if (!options.skipFormat) {
|
|
35
31
|
yield (0, devkit_1.formatFiles)(host);
|
|
36
32
|
}
|
|
@@ -38,4 +34,5 @@ function mfeRemoteGenerator(host, schema) {
|
|
|
38
34
|
});
|
|
39
35
|
}
|
|
40
36
|
exports.mfeRemoteGenerator = mfeRemoteGenerator;
|
|
37
|
+
exports.default = mfeRemoteGenerator;
|
|
41
38
|
//# sourceMappingURL=mfe-remote.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mfe-remote.js","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/mfe-remote/mfe-remote.ts"],"names":[],"mappings":";;;;AAAA,+BAA4B;AAC5B,yCAAuE;AACvE,2FAAqF;
|
|
1
|
+
{"version":3,"file":"mfe-remote.js","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/mfe-remote/mfe-remote.ts"],"names":[],"mappings":";;;;AAAA,+BAA4B;AAC5B,yCAAuE;AACvE,2FAAqF;AAErF,4EAAwE;AACxE,4DAA8D;AAE9D,2EAAqE;AACrE,uEAAkE;AAGlE,SAAgB,WAAW,CAAC,IAAU,EAAE,OAAyB;IAC/D,MAAM,iBAAiB,iDAClB,IAAA,cAAK,EAAC,OAAO,CAAC,IAAI,CAAC,GACnB,OAAO,KACV,IAAI,EAAE,EAAE,GACT,CAAC;IAEF,IAAA,sBAAa,EACX,IAAI,EACJ,IAAA,WAAI,EAAC,SAAS,EAAE,aAAa,CAAC,EAC9B,OAAO,CAAC,cAAc,EACtB,iBAAiB,CAClB,CAAC;AACJ,CAAC;AAbD,kCAaC;AAED,SAAsB,kBAAkB,CAAC,IAAU,EAAE,MAAc;;QACjE,MAAM,OAAO,GAAG,IAAA,oCAAgB,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAC/C,MAAM,OAAO,GAAG,MAAM,IAAA,qBAAoB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAE1D,IAAI,MAAM,CAAC,IAAI,EAAE;YACf,IAAA,8CAAoB,EAAC,IAAI,EAAE,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;SACvD;QAED,wEAAwE;QACxE,sEAAsE;QACtE,kBAAkB;QAClB,IAAI,CAAC,MAAM,CACT,IAAA,WAAI,EAAC,OAAO,CAAC,cAAc,EAAE,cAAc,CAAC,EAC5C,IAAA,WAAI,EAAC,OAAO,CAAC,cAAc,EAAE,mBAAmB,CAAC,CAClD,CAAC;QAEF,WAAW,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC3B,IAAA,qCAAgB,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAEhC,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;YACvB,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;SACzB;QAED,OAAO,IAAA,sCAAgB,EAAC,OAAO,CAAC,CAAC;IACnC,CAAC;CAAA;AAxBD,gDAwBC;AAED,kBAAe,kBAAkB,CAAC"}
|
|
@@ -47,6 +47,10 @@
|
|
|
47
47
|
"enum": ["eslint", "tslint"],
|
|
48
48
|
"default": "eslint"
|
|
49
49
|
},
|
|
50
|
+
"projectBuildConfig": {
|
|
51
|
+
"description": "Provide a custom projectBuildConfig for the Angular executor. If left blank, Nx will use the default.",
|
|
52
|
+
"type": "string"
|
|
53
|
+
},
|
|
50
54
|
"standaloneConfig": {
|
|
51
55
|
"description": "Split the project configuration into `<projectRoot>/project.json` rather than including it inside `workspace.json`.",
|
|
52
56
|
"type": "boolean"
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as ts from 'typescript';
|
|
2
|
+
import { StringChange } from '@nrwl/devkit';
|
|
3
|
+
export declare function addRemoteToMfeConfig(source: ts.SourceFile, app: string): StringChange[];
|
|
4
|
+
export declare function addRemoteDefinition(source: ts.SourceFile, app: string): StringChange[];
|
|
5
|
+
export declare function addRemoteRoute(source: ts.SourceFile, names: {
|
|
6
|
+
fileName: string;
|
|
7
|
+
className: string;
|
|
8
|
+
}): StringChange[];
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addRemoteRoute = exports.addRemoteDefinition = exports.addRemoteToMfeConfig = void 0;
|
|
4
|
+
const ts = require("typescript");
|
|
5
|
+
const devkit_1 = require("@nrwl/devkit");
|
|
6
|
+
const find_nodes_1 = require("@nrwl/workspace/src/utilities/typescript/find-nodes");
|
|
7
|
+
const ast_utils_1 = require("../utils/ast-utils");
|
|
8
|
+
function addRemoteToMfeConfig(source, app) {
|
|
9
|
+
const assignments = (0, find_nodes_1.findNodes)(source, ts.SyntaxKind.PropertyAssignment);
|
|
10
|
+
const remotesAssignment = assignments.find((s) => s.name.getText() === 'remotes');
|
|
11
|
+
if (remotesAssignment) {
|
|
12
|
+
const arrayExpression = remotesAssignment.initializer;
|
|
13
|
+
return arrayExpression.elements
|
|
14
|
+
? [
|
|
15
|
+
{
|
|
16
|
+
type: devkit_1.ChangeType.Insert,
|
|
17
|
+
index: arrayExpression.elements[arrayExpression.elements.length - 1].end,
|
|
18
|
+
text: `,`,
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
type: devkit_1.ChangeType.Insert,
|
|
22
|
+
index: remotesAssignment.end - 1,
|
|
23
|
+
text: `'${app}',\n`,
|
|
24
|
+
},
|
|
25
|
+
]
|
|
26
|
+
: [];
|
|
27
|
+
}
|
|
28
|
+
const binaryExpressions = (0, find_nodes_1.findNodes)(source, ts.SyntaxKind.BinaryExpression);
|
|
29
|
+
const exportExpression = binaryExpressions.find((b) => {
|
|
30
|
+
if (b.left.kind === ts.SyntaxKind.PropertyAccessExpression) {
|
|
31
|
+
const pae = b.left;
|
|
32
|
+
return (pae.expression.getText() === 'module' &&
|
|
33
|
+
pae.name.getText() === 'exports');
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
if ((exportExpression === null || exportExpression === void 0 ? void 0 : exportExpression.right.kind) === ts.SyntaxKind.ObjectLiteralExpression) {
|
|
37
|
+
const ole = exportExpression.right;
|
|
38
|
+
return [
|
|
39
|
+
{
|
|
40
|
+
type: devkit_1.ChangeType.Insert,
|
|
41
|
+
index: ole.end - 1,
|
|
42
|
+
text: `remotes: ['${app}']\n`,
|
|
43
|
+
},
|
|
44
|
+
];
|
|
45
|
+
}
|
|
46
|
+
return [];
|
|
47
|
+
}
|
|
48
|
+
exports.addRemoteToMfeConfig = addRemoteToMfeConfig;
|
|
49
|
+
function addRemoteDefinition(source, app) {
|
|
50
|
+
return [
|
|
51
|
+
{
|
|
52
|
+
type: devkit_1.ChangeType.Insert,
|
|
53
|
+
index: source.end,
|
|
54
|
+
text: `\ndeclare module '${app}/Module';`,
|
|
55
|
+
},
|
|
56
|
+
];
|
|
57
|
+
}
|
|
58
|
+
exports.addRemoteDefinition = addRemoteDefinition;
|
|
59
|
+
function addRemoteRoute(source, names) {
|
|
60
|
+
const routes = (0, ast_utils_1.findElements)(source, 'Route');
|
|
61
|
+
const links = (0, ast_utils_1.findElements)(source, 'Link');
|
|
62
|
+
if (routes.length === 0) {
|
|
63
|
+
return [];
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
const changes = [];
|
|
67
|
+
const firstRoute = routes[0];
|
|
68
|
+
const firstLink = links[0];
|
|
69
|
+
changes.push(...(0, ast_utils_1.addImport)(source, `const ${names.className} = React.lazy(() => import('${names.fileName}/Module'));`));
|
|
70
|
+
changes.push({
|
|
71
|
+
type: devkit_1.ChangeType.Insert,
|
|
72
|
+
index: firstRoute.end,
|
|
73
|
+
text: `\n<Route path="/${names.fileName}" render={() => <${names.className} />} />`,
|
|
74
|
+
});
|
|
75
|
+
if (firstLink) {
|
|
76
|
+
const parentLi = (0, ast_utils_1.findClosestOpening)('li', firstLink);
|
|
77
|
+
if (parentLi) {
|
|
78
|
+
changes.push({
|
|
79
|
+
type: devkit_1.ChangeType.Insert,
|
|
80
|
+
index: parentLi.end,
|
|
81
|
+
text: `\n<li><Link to="/${names.fileName}">${names.className}</Link></li>`,
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
changes.push({
|
|
86
|
+
type: devkit_1.ChangeType.Insert,
|
|
87
|
+
index: firstLink.parent.end,
|
|
88
|
+
text: `\n<Link to="/${names.fileName}">${names.className}</Link>`,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return changes;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
exports.addRemoteRoute = addRemoteRoute;
|
|
96
|
+
//# sourceMappingURL=mfe-ast-utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mfe-ast-utils.js","sourceRoot":"","sources":["../../../../../packages/react/src/mfe/mfe-ast-utils.ts"],"names":[],"mappings":";;;AAAA,iCAAiC;AACjC,yCAAwD;AACxD,oFAAgF;AAChF,kDAI4B;AAE5B,SAAgB,oBAAoB,CAClC,MAAqB,EACrB,GAAW;IAEX,MAAM,WAAW,GAAG,IAAA,sBAAS,EAC3B,MAAM,EACN,EAAE,CAAC,UAAU,CAAC,kBAAkB,CACN,CAAC;IAE7B,MAAM,iBAAiB,GAAG,WAAW,CAAC,IAAI,CACxC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,SAAS,CACtC,CAAC;IAEF,IAAI,iBAAiB,EAAE;QACrB,MAAM,eAAe,GACnB,iBAAiB,CAAC,WAAwC,CAAC;QAE7D,OAAO,eAAe,CAAC,QAAQ;YAC7B,CAAC,CAAC;gBACE;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AC,QAAQ,KAAK,KAAK,CAAC,SAAS,cAAc;iBAC3E,CAAC,CAAC;aACJ;iBAAM;gBACL,OAAO,CAAC,IAAI,CAAC;oBACX,IAAI,EAAE,mBAAU,CAAC,MAAM;oBACvB,KAAK,EAAE,SAAS,CAAC,MAAM,CAAC,GAAG;oBAC3B,IAAI,EAAE,gBAAgB,KAAK,CAAC,QAAQ,KAAK,KAAK,CAAC,SAAS,SAAS;iBAClE,CAAC,CAAC;aACJ;SACF;QAED,OAAO,OAAO,CAAC;KAChB;AACH,CAAC;AAjDD,wCAiDC"}
|
|
@@ -5,6 +5,7 @@ const devkit_1 = require("@nrwl/devkit");
|
|
|
5
5
|
function updateMfeProject(host, options) {
|
|
6
6
|
let projectConfig = (0, devkit_1.readProjectConfiguration)(host, options.name);
|
|
7
7
|
projectConfig.targets.build.options = Object.assign(Object.assign({}, projectConfig.targets.build.options), { main: `${options.appProjectRoot}/src/main.ts`, webpackConfig: `${options.appProjectRoot}/webpack.config.js` });
|
|
8
|
+
projectConfig.targets.build.configurations.production = Object.assign(Object.assign({}, projectConfig.targets.build.configurations.production), { webpackConfig: `${options.appProjectRoot}/webpack.config.prod.js` });
|
|
8
9
|
projectConfig.targets.serve.executor = '@nrwl/react:mfe-dev-server';
|
|
9
10
|
projectConfig.targets.serve.options.port = options.devServerPort;
|
|
10
11
|
(0, devkit_1.updateProjectConfiguration)(host, options.name, projectConfig);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"update-mfe-project.js","sourceRoot":"","sources":["../../../../../packages/react/src/rules/update-mfe-project.ts"],"names":[],"mappings":";;;AAAA,yCAIsB;AAEtB,SAAgB,gBAAgB,CAC9B,IAAU,EACV,OAAyE;IAEzE,IAAI,aAAa,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACjE,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,mCAC9B,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,KACtC,IAAI,EAAE,GAAG,OAAO,CAAC,cAAc,cAAc,EAC7C,aAAa,EAAE,GAAG,OAAO,CAAC,cAAc,oBAAoB,GAC7D,CAAC;IACF,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,UAAU,mCAChD,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC,cAAc,CAAC,UAAU,KACxD,aAAa,EAAE,GAAG,OAAO,CAAC,cAAc,yBAAyB,GAClE,CAAC;IACF,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,GAAG,4BAA4B,CAAC;IACpE,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,aAAa,CAAC;IACjE,IAAA,mCAA0B,EAAC,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;AAChE,CAAC;AAjBD,4CAiBC"}
|
package/src/utils/versions.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.babelPluginStyledComponentsVersion = exports.eslintPluginReactHooksVersion = exports.eslintPluginReactVersion = exports.eslintPluginJsxA11yVersion = exports.eslintPluginImportVersion = exports.reactTestRendererVersion = exports.reactReduxVersion = exports.reduxjsToolkitVersion = exports.testingLibraryReactHooksVersion = exports.testingLibraryReactVersion = exports.typesReactRouterDomVersion = exports.reactRouterDomVersion = exports.styledJsxVersion = exports.emotionBabelPlugin = exports.emotionReactVersion = exports.emotionStyledVersion = exports.typesStyledComponentsVersion = exports.styledComponentsVersion = exports.typesReactIsVersion = exports.typesReactDomVersion = exports.typesReactVersion = exports.reactIsVersion = exports.reactDomVersion = exports.reactVersion = exports.nxVersion = void 0;
|
|
4
|
-
exports.nxVersion = '13.10.
|
|
4
|
+
exports.nxVersion = '13.10.1';
|
|
5
5
|
exports.reactVersion = '18.0.0';
|
|
6
6
|
exports.reactDomVersion = '18.0.0';
|
|
7
7
|
exports.reactIsVersion = '18.0.0';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"add-mfe.js","sourceRoot":"","sources":["../../../../../../../packages/react/src/generators/mfe-host/lib/add-mfe.ts"],"names":[],"mappings":";;;AACA,yCAAoD;AACpD,+BAA4B;AAE5B,SAAgB,WAAW,CAAC,IAAI,EAAE,OAAyB;IACzD,MAAM,iBAAiB,iDAClB,IAAA,cAAK,EAAC,OAAO,CAAC,IAAI,CAAC,GACnB,OAAO,KACV,IAAI,EAAE,EAAE,EACR,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAA,cAAK,EAAC,CAAC,CAAC,CAAC,GAC9C,CAAC;IAEF,wEAAwE;IACxE,sEAAsE;IACtE,kBAAkB;IAClB,IAAI,CAAC,MAAM,CACT,IAAA,WAAI,EAAC,OAAO,CAAC,cAAc,EAAE,cAAc,CAAC,EAC5C,IAAA,WAAI,EAAC,OAAO,CAAC,cAAc,EAAE,mBAAmB,CAAC,CAClD,CAAC;IAEF,kCAAkC;IAClC,IAAA,sBAAa,EACX,IAAI,EACJ,IAAA,WAAI,EAAC,SAAS,EAAE,cAAc,CAAC,EAC/B,OAAO,CAAC,cAAc,EACtB,iBAAiB,CAClB,CAAC;IAEF,IAAA,sBAAa,EACX,IAAI,EACJ,IAAA,WAAI,EAAC,SAAS,EAAE,iBAAiB,CAAC,EAClC,OAAO,CAAC,cAAc,EACtB,iBAAiB,CAClB,CAAC;AACJ,CAAC;AA9BD,kCA8BC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateHostWithRemote = void 0;
|
|
4
|
-
function updateHostWithRemote(host, options) {
|
|
5
|
-
// find the host project path
|
|
6
|
-
// Update remotes inside ${host_path}/src/remotes.d.ts
|
|
7
|
-
// Update remotes inside ${host_path}/mfe.config.js
|
|
8
|
-
}
|
|
9
|
-
exports.updateHostWithRemote = updateHostWithRemote;
|
|
10
|
-
//# sourceMappingURL=update-host-with-remote.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update-host-with-remote.js","sourceRoot":"","sources":["../../../../../../../packages/react/src/generators/mfe-host/lib/update-host-with-remote.ts"],"names":[],"mappings":";;;AAGA,SAAgB,oBAAoB,CAAC,IAAU,EAAE,OAAe;IAC9D,6BAA6B;IAC7B,sDAAsD;IACtD,mDAAmD;AACrD,CAAC;AAJD,oDAIC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"update-mfe-project.js","sourceRoot":"","sources":["../../../../../../../packages/react/src/generators/mfe-host/lib/update-mfe-project.ts"],"names":[],"mappings":";;;AAEA,yCAGsB;AAEtB,SAAgB,gBAAgB,CAAC,IAAU,EAAE,OAAyB;IACpE,IAAI,aAAa,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC;IACjE,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,mCAC9B,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,KACtC,IAAI,EAAE,GAAG,OAAO,CAAC,cAAc,cAAc,EAC7C,aAAa,EAAE,GAAG,OAAO,CAAC,cAAc,oBAAoB,GAC7D,CAAC;IACF,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC,QAAQ,GAAG,4BAA4B,CAAC;IACpE,aAAa,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,aAAa,CAAC;IACjE,IAAA,mCAA0B,EAAC,IAAI,EAAE,OAAO,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;AAChE,CAAC;AAVD,4CAUC"}
|