@nrwl/react 13.10.0-beta.9 → 13.10.0-rc.2
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/executors.json +16 -0
- package/generators.json +14 -0
- package/index.d.ts +1 -0
- package/index.js +3 -1
- package/index.js.map +1 -1
- package/module-federation.d.ts +4 -0
- package/module-federation.js +10 -0
- package/module-federation.js.map +1 -0
- package/package.json +10 -9
- package/plugins/webpack.d.ts +2 -1
- package/plugins/webpack.js +2 -0
- package/plugins/webpack.js.map +1 -1
- package/src/executors/mfe-dev-server/compat.d.ts +2 -0
- package/src/executors/mfe-dev-server/compat.js +6 -0
- package/src/executors/mfe-dev-server/compat.js.map +1 -0
- package/src/executors/mfe-dev-server/mfe-dev-server.impl.d.ts +11 -0
- package/src/executors/mfe-dev-server/mfe-dev-server.impl.js +86 -0
- package/src/executors/mfe-dev-server/mfe-dev-server.impl.js.map +1 -0
- package/src/executors/mfe-dev-server/schema.json +82 -0
- package/src/generators/application/application.d.ts +1 -1
- package/src/generators/application/files/common/src/app/__fileName__.spec.tsx__tmpl__ +1 -1
- 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/application/schema.d.ts +2 -0
- package/src/generators/component/component.d.ts +1 -1
- package/src/generators/component-cypress-spec/component-cypress-spec.d.ts +1 -1
- package/src/generators/component-story/component-story.d.ts +1 -1
- package/src/generators/hook/hook.d.ts +1 -1
- package/src/generators/init/init.d.ts +1 -1
- package/src/generators/library/library.d.ts +1 -1
- package/src/generators/mfe-host/files/common/src/app/__fileName__.tsx__tmpl__ +29 -0
- package/src/generators/mfe-host/files/mfe/mfe.config.js__tmpl__ +6 -0
- package/src/generators/mfe-host/files/mfe/src/main.ts__tmpl__ +1 -0
- package/src/generators/mfe-host/files/mfe/src/remotes.d.ts__tmpl__ +4 -0
- package/src/generators/mfe-host/files/mfe/webpack.config.js__tmpl__ +6 -0
- package/src/generators/mfe-host/files/mfe/webpack.config.prod.js__tmpl__ +12 -0
- package/src/generators/mfe-host/lib/add-mfe.d.ts +2 -0
- package/src/generators/mfe-host/lib/add-mfe.js +17 -0
- package/src/generators/mfe-host/lib/add-mfe.js.map +1 -0
- package/src/generators/mfe-host/lib/update-host-with-remote.d.ts +2 -0
- package/src/generators/mfe-host/lib/update-host-with-remote.js +49 -0
- package/src/generators/mfe-host/lib/update-host-with-remote.js.map +1 -0
- package/src/generators/mfe-host/lib/update-mfe-e2e-project.d.ts +3 -0
- package/src/generators/mfe-host/lib/update-mfe-e2e-project.js +17 -0
- package/src/generators/mfe-host/lib/update-mfe-e2e-project.js.map +1 -0
- package/src/generators/mfe-host/lib/update-mfe-project.d.ts +3 -0
- package/src/generators/mfe-host/lib/update-mfe-project.js +13 -0
- package/src/generators/mfe-host/lib/update-mfe-project.js.map +1 -0
- package/src/generators/mfe-host/mfe-host.d.ts +4 -0
- package/src/generators/mfe-host/mfe-host.js +44 -0
- package/src/generators/mfe-host/mfe-host.js.map +1 -0
- package/src/generators/mfe-host/schema.d.ts +28 -0
- package/src/generators/mfe-host/schema.json +155 -0
- package/src/generators/mfe-remote/files/mfe/mfe.config.js__tmpl__ +6 -0
- package/src/generators/mfe-remote/files/mfe/src/main.ts__tmpl__ +1 -0
- package/src/generators/mfe-remote/files/mfe/src/remote-entry.ts__tmpl__ +1 -0
- package/src/generators/mfe-remote/files/mfe/webpack.config.js__tmpl__ +6 -0
- package/src/generators/mfe-remote/files/mfe/webpack.config.prod.js__tmpl__ +1 -0
- package/src/generators/mfe-remote/mfe-remote.d.ts +6 -0
- package/src/generators/mfe-remote/mfe-remote.js +38 -0
- package/src/generators/mfe-remote/mfe-remote.js.map +1 -0
- package/src/generators/mfe-remote/schema.d.ts +26 -0
- package/src/generators/mfe-remote/schema.json +159 -0
- package/src/generators/redux/redux.d.ts +1 -1
- package/src/generators/stories/stories.d.ts +1 -1
- package/src/generators/storybook-configuration/configuration.d.ts +1 -1
- package/src/generators/storybook-configuration/schema.d.ts +1 -0
- package/src/generators/storybook-configuration/schema.json +4 -0
- package/src/generators/storybook-migrate-defaults-5-to-6/migrate-defaults-5-to-6.d.ts +1 -1
- 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/mfe/webpack-utils.d.ts +17 -0
- package/src/mfe/webpack-utils.js +66 -0
- package/src/mfe/webpack-utils.js.map +1 -0
- package/src/mfe/with-module-federation.d.ts +14 -0
- package/src/mfe/with-module-federation.js +167 -0
- package/src/mfe/with-module-federation.js.map +1 -0
- package/src/utils/versions.js +1 -1
package/executors.json
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
{
|
|
2
|
+
"builders": {
|
|
3
|
+
"mfe-dev-server": {
|
|
4
|
+
"implementation": "./src/executors/mfe-dev-server/compat",
|
|
5
|
+
"schema": "./src/executors/mfe-dev-server/schema.json",
|
|
6
|
+
"description": "Serve an MFE host or remote application."
|
|
7
|
+
}
|
|
8
|
+
},
|
|
9
|
+
"executors": {
|
|
10
|
+
"mfe-dev-server": {
|
|
11
|
+
"implementation": "./src/executors/mfe-dev-server/mfe-dev-server.impl",
|
|
12
|
+
"schema": "./src/executors/mfe-dev-server/schema.json",
|
|
13
|
+
"description": "Serve an MFE host or remote application."
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
package/generators.json
CHANGED
|
@@ -162,6 +162,20 @@
|
|
|
162
162
|
"schema": "./src/generators/hook/schema.json",
|
|
163
163
|
"description": "Create a hook.",
|
|
164
164
|
"aliases": "c"
|
|
165
|
+
},
|
|
166
|
+
|
|
167
|
+
"mfe-host": {
|
|
168
|
+
"factory": "./src/generators/mfe-host/mfe-host#mfeHostGenerator",
|
|
169
|
+
"schema": "./src/generators/mfe-host/schema.json",
|
|
170
|
+
"description": "Generate a host react application",
|
|
171
|
+
"aliases": "host"
|
|
172
|
+
},
|
|
173
|
+
|
|
174
|
+
"mfe-remote": {
|
|
175
|
+
"factory": "./src/generators/mfe-remote/mfe-remote#mfeRemoteGenerator",
|
|
176
|
+
"schema": "./src/generators/mfe-remote/schema.json",
|
|
177
|
+
"description": "Generate a remote react application",
|
|
178
|
+
"aliases": "remote"
|
|
165
179
|
}
|
|
166
180
|
}
|
|
167
181
|
}
|
package/index.d.ts
CHANGED
|
@@ -13,4 +13,5 @@ export { reduxGenerator } from './src/generators/redux/redux';
|
|
|
13
13
|
export { storiesGenerator } from './src/generators/stories/stories';
|
|
14
14
|
export { storybookConfigurationGenerator } from './src/generators/storybook-configuration/configuration';
|
|
15
15
|
export { storybookMigration5to6Generator } from './src/generators/storybook-migrate-defaults-5-to-6/migrate-defaults-5-to-6';
|
|
16
|
+
export { mfeHostGenerator } from './src/generators/mfe-host/mfe-host';
|
|
16
17
|
export type { SupportedStyles } from './typings/style';
|
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.storybookMigration5to6Generator = exports.storybookConfigurationGenerator = exports.storiesGenerator = exports.reduxGenerator = exports.reactInitGenerator = exports.libraryGenerator = exports.componentStoryGenerator = exports.componentCypressGenerator = exports.hookGenerator = exports.componentGenerator = exports.applicationGenerator = exports.reactVersion = exports.reactDomVersion = exports.assertValidStyle = exports.CSS_IN_JS_DEPENDENCIES = exports.createReactEslintJson = exports.extraEslintDependencies = void 0;
|
|
3
|
+
exports.mfeHostGenerator = exports.storybookMigration5to6Generator = exports.storybookConfigurationGenerator = exports.storiesGenerator = exports.reduxGenerator = exports.reactInitGenerator = exports.libraryGenerator = exports.componentStoryGenerator = exports.componentCypressGenerator = exports.hookGenerator = exports.componentGenerator = exports.applicationGenerator = exports.reactVersion = exports.reactDomVersion = exports.assertValidStyle = exports.CSS_IN_JS_DEPENDENCIES = exports.createReactEslintJson = exports.extraEslintDependencies = void 0;
|
|
4
4
|
var lint_1 = require("./src/utils/lint");
|
|
5
5
|
Object.defineProperty(exports, "extraEslintDependencies", { enumerable: true, get: function () { return lint_1.extraEslintDependencies; } });
|
|
6
6
|
Object.defineProperty(exports, "createReactEslintJson", { enumerable: true, get: function () { return lint_1.createReactEslintJson; } });
|
|
@@ -33,4 +33,6 @@ var configuration_1 = require("./src/generators/storybook-configuration/configur
|
|
|
33
33
|
Object.defineProperty(exports, "storybookConfigurationGenerator", { enumerable: true, get: function () { return configuration_1.storybookConfigurationGenerator; } });
|
|
34
34
|
var migrate_defaults_5_to_6_1 = require("./src/generators/storybook-migrate-defaults-5-to-6/migrate-defaults-5-to-6");
|
|
35
35
|
Object.defineProperty(exports, "storybookMigration5to6Generator", { enumerable: true, get: function () { return migrate_defaults_5_to_6_1.storybookMigration5to6Generator; } });
|
|
36
|
+
var mfe_host_1 = require("./src/generators/mfe-host/mfe-host");
|
|
37
|
+
Object.defineProperty(exports, "mfeHostGenerator", { enumerable: true, get: function () { return mfe_host_1.mfeHostGenerator; } });
|
|
36
38
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages/react/index.ts"],"names":[],"mappings":";;;AAAA,yCAG0B;AAFxB,+GAAA,uBAAuB,OAAA;AACvB,6GAAA,qBAAqB,OAAA;AAEvB,6CAA4D;AAAnD,gHAAA,sBAAsB,OAAA;AAC/B,mDAAyD;AAAhD,6GAAA,gBAAgB,OAAA;AACzB,iDAAqE;AAA5D,2GAAA,eAAe,OAAA;AAAE,wGAAA,YAAY,OAAA;AACtC,wEAAgF;AAAvE,mHAAA,oBAAoB,OAAA;AAC7B,kEAA0E;AAAjE,+GAAA,kBAAkB,OAAA;AAC3B,mDAA2D;AAAlD,qGAAA,aAAa,OAAA;AACtB,yGAA2G;AAAlG,mIAAA,yBAAyB,OAAA;AAClC,oFAA2F;AAAlF,0HAAA,uBAAuB,OAAA;AAChC,4DAAoE;AAA3D,2GAAA,gBAAgB,OAAA;AACzB,mDAAgE;AAAvD,0GAAA,kBAAkB,OAAA;AAC3B,sDAA8D;AAArD,uGAAA,cAAc,OAAA;AACvB,4DAAoE;AAA3D,2GAAA,gBAAgB,OAAA;AACzB,wFAAyG;AAAhG,gIAAA,+BAA+B,OAAA;AACxC,sHAA6H;AAApH,0IAAA,+BAA+B,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../packages/react/index.ts"],"names":[],"mappings":";;;AAAA,yCAG0B;AAFxB,+GAAA,uBAAuB,OAAA;AACvB,6GAAA,qBAAqB,OAAA;AAEvB,6CAA4D;AAAnD,gHAAA,sBAAsB,OAAA;AAC/B,mDAAyD;AAAhD,6GAAA,gBAAgB,OAAA;AACzB,iDAAqE;AAA5D,2GAAA,eAAe,OAAA;AAAE,wGAAA,YAAY,OAAA;AACtC,wEAAgF;AAAvE,mHAAA,oBAAoB,OAAA;AAC7B,kEAA0E;AAAjE,+GAAA,kBAAkB,OAAA;AAC3B,mDAA2D;AAAlD,qGAAA,aAAa,OAAA;AACtB,yGAA2G;AAAlG,mIAAA,yBAAyB,OAAA;AAClC,oFAA2F;AAAlF,0HAAA,uBAAuB,OAAA;AAChC,4DAAoE;AAA3D,2GAAA,gBAAgB,OAAA;AACzB,mDAAgE;AAAvD,0GAAA,kBAAkB,OAAA;AAC3B,sDAA8D;AAArD,uGAAA,cAAc,OAAA;AACvB,4DAAoE;AAA3D,2GAAA,gBAAgB,OAAA;AACzB,wFAAyG;AAAhG,gIAAA,+BAA+B,OAAA;AACxC,sHAA6H;AAApH,0IAAA,+BAA+B,OAAA;AACxC,+DAAsE;AAA7D,4GAAA,gBAAgB,OAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const with_module_federation_1 = require("./src/mfe/with-module-federation");
|
|
6
|
+
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return with_module_federation_1.withModuleFederation; } });
|
|
7
|
+
tslib_1.__exportStar(require("./src/mfe/webpack-utils"), exports);
|
|
8
|
+
tslib_1.__exportStar(require("./src/mfe/with-module-federation"), exports);
|
|
9
|
+
module.exports = with_module_federation_1.withModuleFederation;
|
|
10
|
+
//# sourceMappingURL=module-federation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module-federation.js","sourceRoot":"","sources":["../../../packages/react/module-federation.ts"],"names":[],"mappings":";;;;AAAA,6EAAwE;AAIvC,wFAJxB,6CAAoB,OAIW;AAFxC,kEAAwC;AACxC,2EAAiD;AAGjD,MAAM,CAAC,OAAO,GAAG,6CAAoB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nrwl/react",
|
|
3
|
-
"version": "13.10.0-
|
|
3
|
+
"version": "13.10.0-rc.2",
|
|
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",
|
|
@@ -23,6 +23,7 @@
|
|
|
23
23
|
"url": "https://github.com/nrwl/nx/issues"
|
|
24
24
|
},
|
|
25
25
|
"homepage": "https://nx.dev",
|
|
26
|
+
"builders": "./executors.json",
|
|
26
27
|
"schematics": "./generators.json",
|
|
27
28
|
"ng-update": {
|
|
28
29
|
"requirements": {},
|
|
@@ -31,14 +32,14 @@
|
|
|
31
32
|
"dependencies": {
|
|
32
33
|
"@babel/core": "^7.15.0",
|
|
33
34
|
"@babel/preset-react": "^7.14.5",
|
|
34
|
-
"@nrwl/cypress": "13.10.0-
|
|
35
|
-
"@nrwl/devkit": "13.10.0-
|
|
36
|
-
"@nrwl/jest": "13.10.0-
|
|
37
|
-
"@nrwl/js": "13.10.0-
|
|
38
|
-
"@nrwl/linter": "13.10.0-
|
|
39
|
-
"@nrwl/storybook": "13.10.0-
|
|
40
|
-
"@nrwl/web": "13.10.0-
|
|
41
|
-
"@nrwl/workspace": "13.10.0-
|
|
35
|
+
"@nrwl/cypress": "13.10.0-rc.2",
|
|
36
|
+
"@nrwl/devkit": "13.10.0-rc.2",
|
|
37
|
+
"@nrwl/jest": "13.10.0-rc.2",
|
|
38
|
+
"@nrwl/js": "13.10.0-rc.2",
|
|
39
|
+
"@nrwl/linter": "13.10.0-rc.2",
|
|
40
|
+
"@nrwl/storybook": "13.10.0-rc.2",
|
|
41
|
+
"@nrwl/web": "13.10.0-rc.2",
|
|
42
|
+
"@nrwl/workspace": "13.10.0-rc.2",
|
|
42
43
|
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.1",
|
|
43
44
|
"@svgr/webpack": "^6.1.2",
|
|
44
45
|
"chalk": "4.1.0",
|
package/plugins/webpack.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import type { Configuration } from 'webpack';
|
|
2
|
+
export declare function getWebpackConfig(config: Configuration): Configuration;
|
package/plugins/webpack.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getWebpackConfig = void 0;
|
|
3
4
|
const ReactRefreshPlugin = require("@pmmmwh/react-refresh-webpack-plugin");
|
|
4
5
|
// Add React-specific configuration
|
|
5
6
|
function getWebpackConfig(config) {
|
|
@@ -66,5 +67,6 @@ function getWebpackConfig(config) {
|
|
|
66
67
|
}
|
|
67
68
|
return config;
|
|
68
69
|
}
|
|
70
|
+
exports.getWebpackConfig = getWebpackConfig;
|
|
69
71
|
module.exports = getWebpackConfig;
|
|
70
72
|
//# sourceMappingURL=webpack.js.map
|
package/plugins/webpack.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webpack.js","sourceRoot":"","sources":["../../../../packages/react/plugins/webpack.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"webpack.js","sourceRoot":"","sources":["../../../../packages/react/plugins/webpack.ts"],"names":[],"mappings":";;;AACA,2EAA4E;AAE5E,mCAAmC;AACnC,SAAgB,gBAAgB,CAAC,MAAqB;;IACpD,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;QACvB,IAAI,EAAE,QAAQ;QACd,KAAK,EAAE;YACL,oFAAoF;YACpF;gBACE,MAAM,EAAE,iBAAiB;gBACzB,GAAG,EAAE;oBACH;wBACE,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC;wBACxC,OAAO,EAAE;4BACP,IAAI,EAAE,KAAK;4BACX,SAAS,EAAE,IAAI;4BACf,GAAG,EAAE,IAAI;yBACV;qBACF;oBACD;wBACE,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC;wBACrC,OAAO,EAAE;4BACP,KAAK,EAAE,KAAK;4BACZ,IAAI,EAAE,uBAAuB;4BAC7B,QAAQ,EAAE,KAAK;yBAChB;qBACF;iBACF;aACF;YACD,gCAAgC;YAChC;gBACE,GAAG,EAAE;oBACH;wBACE,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,YAAY,CAAC;wBACrC,OAAO,EAAE;4BACP,KAAK,EAAE,KAAK;4BACZ,IAAI,EAAE,uBAAuB;yBAC9B;qBACF;iBACF;aACF;SACF;KACF,CAAC,CAAC;IAEH,IAAI,MAAM,CAAC,IAAI,KAAK,aAAa,KAAI,MAAA,MAAM,CAAC,WAAW,CAAC,0CAAE,GAAG,CAAA,EAAE;QAC7D,mDAAmD;QACnD,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAC1C,CAAC,IAAI,EAAE,EAAE;;YACP,OAAA,OAAO,IAAI,KAAK,QAAQ;iBACxB,MAAA,IAAI,CAAC,MAAM,0CAAE,QAAQ,GAAG,QAAQ,CAAC,cAAc,CAAC,CAAA,CAAA;SAAA,CACnD,CAAC;QACF,IAAI,WAAW,IAAI,OAAO,WAAW,KAAK,QAAQ,EAAE;YAClD,WAAW,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG;gBAC/B,GAAG,CAAC,WAAW,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,EAAE,CAAC;gBACzC;oBACE,OAAO,CAAC,OAAO,CAAC,qBAAqB,CAAC;oBACtC;wBACE,YAAY,EAAE,IAAI;qBACnB;iBACF;aACF,CAAC;SACH;QACD,+EAA+E;QAC/E,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,kBAAkB,EAAE,CAAC,CAAC;KAC/C;IAED,OAAO,MAAM,CAAC;AAChB,CAAC;AAhED,4CAgEC;AAED,MAAM,CAAC,OAAO,GAAG,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const devkit_1 = require("@nrwl/devkit");
|
|
4
|
+
const mfe_dev_server_impl_1 = require("./mfe-dev-server.impl");
|
|
5
|
+
exports.default = (0, devkit_1.convertNxExecutor)(mfe_dev_server_impl_1.default);
|
|
6
|
+
//# sourceMappingURL=compat.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compat.js","sourceRoot":"","sources":["../../../../../../packages/react/src/executors/mfe-dev-server/compat.ts"],"names":[],"mappings":";;AAAA,yCAAiD;AAEjD,+DAAiD;AAEjD,kBAAe,IAAA,0BAAiB,EAAC,6BAAY,CAAC,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ExecutorContext } from '@nrwl/devkit';
|
|
2
|
+
import { WebDevServerOptions } from '@nrwl/web/src/executors/dev-server/dev-server.impl';
|
|
3
|
+
declare type MFEDevServerOptions = WebDevServerOptions & {
|
|
4
|
+
apps?: string[];
|
|
5
|
+
};
|
|
6
|
+
export default function mfeDevServer(options: MFEDevServerOptions, context: ExecutorContext): AsyncGenerator<{
|
|
7
|
+
baseUrl: string;
|
|
8
|
+
emittedFiles: import("../../../../../build/packages/web/src/utils/run-webpack").EmittedFile[];
|
|
9
|
+
success: boolean;
|
|
10
|
+
}, any, undefined>;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const devkit_1 = require("@nrwl/devkit");
|
|
5
|
+
const dev_server_impl_1 = require("@nrwl/web/src/executors/dev-server/dev-server.impl");
|
|
6
|
+
const path_1 = require("path");
|
|
7
|
+
function mfeDevServer(options, context) {
|
|
8
|
+
var _a, _b;
|
|
9
|
+
return tslib_1.__asyncGenerator(this, arguments, function* mfeDevServer_1() {
|
|
10
|
+
let iter = (0, dev_server_impl_1.default)(options, context);
|
|
11
|
+
const p = context.workspace.projects[context.projectName];
|
|
12
|
+
const mfeConfigPath = (0, path_1.join)(context.root, p.root, 'mfe.config.js');
|
|
13
|
+
let mfeConfig;
|
|
14
|
+
try {
|
|
15
|
+
mfeConfig = require(mfeConfigPath);
|
|
16
|
+
}
|
|
17
|
+
catch (_c) {
|
|
18
|
+
// TODO(jack): Add a link to guide
|
|
19
|
+
throw new Error(`Could not load ${mfeConfigPath}. Was this project generated with "@nrwl/react:mfe-host"?`);
|
|
20
|
+
}
|
|
21
|
+
// Remotes can be specified with a custom location
|
|
22
|
+
// e.g.
|
|
23
|
+
// ```
|
|
24
|
+
// remotes: ['app1', 'http://example.com']
|
|
25
|
+
// ```
|
|
26
|
+
// This shouldn't happen for local dev, but we support it regardless.
|
|
27
|
+
let apps = (_b = (_a = options.apps) !== null && _a !== void 0 ? _a : mfeConfig.remotes) !== null && _b !== void 0 ? _b : [];
|
|
28
|
+
apps = apps.map((a) => (Array.isArray(a) ? a[0] : a));
|
|
29
|
+
for (const app of apps) {
|
|
30
|
+
iter = combineAsyncIterators(iter, yield tslib_1.__await((0, devkit_1.runExecutor)({
|
|
31
|
+
project: app,
|
|
32
|
+
target: 'serve',
|
|
33
|
+
configuration: context.configurationName,
|
|
34
|
+
}, {}, context)));
|
|
35
|
+
}
|
|
36
|
+
return yield tslib_1.__await(yield tslib_1.__await(yield* tslib_1.__asyncDelegator(tslib_1.__asyncValues(iter))));
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
exports.default = mfeDevServer;
|
|
40
|
+
// TODO(jack): Extract this helper
|
|
41
|
+
function getNextAsyncIteratorFactory(options) {
|
|
42
|
+
return (asyncIterator, index) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
try {
|
|
44
|
+
const iterator = yield asyncIterator.next();
|
|
45
|
+
return { index, iterator };
|
|
46
|
+
}
|
|
47
|
+
catch (err) {
|
|
48
|
+
if (options.errorCallback) {
|
|
49
|
+
options.errorCallback(err, index);
|
|
50
|
+
}
|
|
51
|
+
if (options.throwError !== false) {
|
|
52
|
+
return Promise.reject(err);
|
|
53
|
+
}
|
|
54
|
+
return { index, iterator: { done: true } };
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
function combineAsyncIterators(...iterators) {
|
|
59
|
+
return tslib_1.__asyncGenerator(this, arguments, function* combineAsyncIterators_1() {
|
|
60
|
+
let [options] = iterators;
|
|
61
|
+
if (typeof options.next === 'function') {
|
|
62
|
+
options = Object.create(null);
|
|
63
|
+
}
|
|
64
|
+
else {
|
|
65
|
+
iterators.shift();
|
|
66
|
+
}
|
|
67
|
+
const getNextAsyncIteratorValue = getNextAsyncIteratorFactory(options);
|
|
68
|
+
try {
|
|
69
|
+
const asyncIteratorsValues = new Map(iterators.map((it, idx) => [idx, getNextAsyncIteratorValue(it, idx)]));
|
|
70
|
+
do {
|
|
71
|
+
const { iterator, index } = yield tslib_1.__await(Promise.race(asyncIteratorsValues.values()));
|
|
72
|
+
if (iterator.done) {
|
|
73
|
+
asyncIteratorsValues.delete(index);
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
yield yield tslib_1.__await(iterator.value);
|
|
77
|
+
asyncIteratorsValues.set(index, getNextAsyncIteratorValue(iterators[index], index));
|
|
78
|
+
}
|
|
79
|
+
} while (asyncIteratorsValues.size > 0);
|
|
80
|
+
}
|
|
81
|
+
finally {
|
|
82
|
+
yield tslib_1.__await(Promise.allSettled(iterators.map((it) => it.return())));
|
|
83
|
+
}
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
//# sourceMappingURL=mfe-dev-server.impl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mfe-dev-server.impl.js","sourceRoot":"","sources":["../../../../../../packages/react/src/executors/mfe-dev-server/mfe-dev-server.impl.ts"],"names":[],"mappings":";;;AAAA,yCAA4D;AAC5D,wFAE4D;AAC5D,+BAA4B;AAM5B,SAA+B,YAAY,CACzC,OAA4B,EAC5B,OAAwB;;;QAExB,IAAI,IAAI,GAAG,IAAA,yBAAiB,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QAC/C,MAAM,CAAC,GAAG,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAE1D,MAAM,aAAa,GAAG,IAAA,WAAI,EAAC,OAAO,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;QAElE,IAAI,SAAc,CAAC;QACnB,IAAI;YACF,SAAS,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;SACpC;QAAC,WAAM;YACN,kCAAkC;YAClC,MAAM,IAAI,KAAK,CACb,k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AE,CAAC,CAAC,CAAA,CAAC;SAC9D;IACH,CAAC;CAAA"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
{
|
|
2
|
+
"title": "Web Dev Server",
|
|
3
|
+
"description": "Serve a web application.",
|
|
4
|
+
"cli": "nx",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"properties": {
|
|
7
|
+
"buildTarget": {
|
|
8
|
+
"type": "string",
|
|
9
|
+
"description": "Target which builds the application."
|
|
10
|
+
},
|
|
11
|
+
"port": {
|
|
12
|
+
"type": "number",
|
|
13
|
+
"description": "Port to listen on.",
|
|
14
|
+
"default": 4200
|
|
15
|
+
},
|
|
16
|
+
"host": {
|
|
17
|
+
"type": "string",
|
|
18
|
+
"description": "Host to listen on.",
|
|
19
|
+
"default": "localhost"
|
|
20
|
+
},
|
|
21
|
+
"ssl": {
|
|
22
|
+
"type": "boolean",
|
|
23
|
+
"description": "Serve using `HTTPS`.",
|
|
24
|
+
"default": false
|
|
25
|
+
},
|
|
26
|
+
"sslKey": {
|
|
27
|
+
"type": "string",
|
|
28
|
+
"description": "SSL key to use for serving `HTTPS`."
|
|
29
|
+
},
|
|
30
|
+
"sslCert": {
|
|
31
|
+
"type": "string",
|
|
32
|
+
"description": "SSL certificate to use for serving `HTTPS`."
|
|
33
|
+
},
|
|
34
|
+
"watch": {
|
|
35
|
+
"type": "boolean",
|
|
36
|
+
"description": "Watches for changes and rebuilds application.",
|
|
37
|
+
"default": true
|
|
38
|
+
},
|
|
39
|
+
"liveReload": {
|
|
40
|
+
"type": "boolean",
|
|
41
|
+
"description": "Whether to reload the page on change, using live-reload.",
|
|
42
|
+
"default": true
|
|
43
|
+
},
|
|
44
|
+
"hmr": {
|
|
45
|
+
"type": "boolean",
|
|
46
|
+
"description": "Enable hot module replacement.",
|
|
47
|
+
"default": false
|
|
48
|
+
},
|
|
49
|
+
"publicHost": {
|
|
50
|
+
"type": "string",
|
|
51
|
+
"description": "Public URL where the application will be served."
|
|
52
|
+
},
|
|
53
|
+
"open": {
|
|
54
|
+
"type": "boolean",
|
|
55
|
+
"description": "Open the application in the browser.",
|
|
56
|
+
"default": false
|
|
57
|
+
},
|
|
58
|
+
"allowedHosts": {
|
|
59
|
+
"type": "string",
|
|
60
|
+
"description": "This option allows you to whitelist services that are allowed to access the dev server."
|
|
61
|
+
},
|
|
62
|
+
"memoryLimit": {
|
|
63
|
+
"type": "number",
|
|
64
|
+
"description": "Memory limit for type checking service process in `MB`."
|
|
65
|
+
},
|
|
66
|
+
"maxWorkers": {
|
|
67
|
+
"type": "number",
|
|
68
|
+
"description": "Number of workers to use for type checking."
|
|
69
|
+
},
|
|
70
|
+
"baseHref": {
|
|
71
|
+
"type": "string",
|
|
72
|
+
"description": "Base url for the application being built."
|
|
73
|
+
},
|
|
74
|
+
"apps": {
|
|
75
|
+
"type": "array",
|
|
76
|
+
"items": {
|
|
77
|
+
"type": "string"
|
|
78
|
+
},
|
|
79
|
+
"description": "List of remote applications to serve in addition to the host application."
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -2,4 +2,4 @@ import { Schema } from './schema';
|
|
|
2
2
|
import { GeneratorCallback, Tree } from '@nrwl/devkit';
|
|
3
3
|
export declare function applicationGenerator(host: Tree, schema: Schema): Promise<GeneratorCallback>;
|
|
4
4
|
export default applicationGenerator;
|
|
5
|
-
export declare const applicationSchematic: (
|
|
5
|
+
export declare const applicationSchematic: (generatorOptions: Schema) => (tree: any, context: any) => Promise<any>;
|
|
@@ -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,8 +3,9 @@ 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
|
-
var _a, _b, _c, _d, _e, _f;
|
|
8
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
8
9
|
const appDirectory = options.directory
|
|
9
10
|
? `${(0, devkit_1.names)(options.directory).fileName}/${(0, devkit_1.names)(options.name).fileName}`
|
|
10
11
|
: (0, devkit_1.names)(options.name).fileName;
|
|
@@ -26,6 +27,7 @@ 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,
|
|
@@ -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,C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a,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"}
|
|
@@ -2,4 +2,4 @@ import { Schema } from './schema';
|
|
|
2
2
|
import { GeneratorCallback, Tree } from '@nrwl/devkit';
|
|
3
3
|
export declare function componentGenerator(host: Tree, schema: Schema): Promise<GeneratorCallback>;
|
|
4
4
|
export default componentGenerator;
|
|
5
|
-
export declare const componentSchematic: (
|
|
5
|
+
export declare const componentSchematic: (generatorOptions: Schema) => (tree: any, context: any) => Promise<any>;
|
|
@@ -10,4 +10,4 @@ export declare function componentCypressGenerator(host: Tree, schema: CreateComp
|
|
|
10
10
|
export declare function getArgsDefaultValue(property: ts.SyntaxKind): string;
|
|
11
11
|
export declare function createComponentSpecFile(tree: Tree, { project, componentPath, js, cypressProject }: CreateComponentSpecFileSchema): void;
|
|
12
12
|
export default componentCypressGenerator;
|
|
13
|
-
export declare const componentCypressSchematic: (
|
|
13
|
+
export declare const componentCypressSchematic: (generatorOptions: CreateComponentSpecFileSchema) => (tree: any, context: any) => Promise<any>;
|
|
@@ -8,4 +8,4 @@ export declare function getArgsDefaultValue(property: ts.SyntaxKind): string;
|
|
|
8
8
|
export declare function createComponentStoriesFile(host: Tree, { project, componentPath }: CreateComponentStoriesFileSchema): void;
|
|
9
9
|
export declare function componentStoryGenerator(host: Tree, schema: CreateComponentStoriesFileSchema): Promise<void>;
|
|
10
10
|
export default componentStoryGenerator;
|
|
11
|
-
export declare const componentStorySchematic: (
|
|
11
|
+
export declare const componentStorySchematic: (generatorOptions: CreateComponentStoriesFileSchema) => (tree: any, context: any) => Promise<any>;
|
|
@@ -2,4 +2,4 @@ import { Tree } from '@nrwl/devkit';
|
|
|
2
2
|
import { Schema } from './schema';
|
|
3
3
|
export declare function hookGenerator(host: Tree, schema: Schema): Promise<void>;
|
|
4
4
|
export default hookGenerator;
|
|
5
|
-
export declare const hookSchematic: (
|
|
5
|
+
export declare const hookSchematic: (generatorOptions: Schema) => (tree: any, context: any) => Promise<any>;
|
|
@@ -2,4 +2,4 @@ import { InitSchema } from './schema';
|
|
|
2
2
|
import { GeneratorCallback, Tree } from '@nrwl/devkit';
|
|
3
3
|
export declare function reactInitGenerator(host: Tree, schema: InitSchema): Promise<GeneratorCallback>;
|
|
4
4
|
export default reactInitGenerator;
|
|
5
|
-
export declare const reactInitSchematic: (
|
|
5
|
+
export declare const reactInitSchematic: (generatorOptions: InitSchema) => (tree: any, context: any) => Promise<any>;
|
|
@@ -12,4 +12,4 @@ export interface NormalizedSchema extends Schema {
|
|
|
12
12
|
}
|
|
13
13
|
export declare function libraryGenerator(host: Tree, schema: Schema): Promise<GeneratorCallback>;
|
|
14
14
|
export default libraryGenerator;
|
|
15
|
-
export declare const librarySchematic: (
|
|
15
|
+
export declare const librarySchematic: (generatorOptions: Schema) => (tree: any, context: any) => Promise<any>;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import NxWelcome from "./nx-welcome";
|
|
3
|
+
<% if (remotes.length > 0) { %>
|
|
4
|
+
import { Link, Route, Switch } from 'react-router-dom';
|
|
5
|
+
|
|
6
|
+
<% remotes.forEach(function(r) { %>
|
|
7
|
+
const <%= r.className %> = React.lazy(() => import('<%= r.fileName %>/Module'));
|
|
8
|
+
<% }); %>
|
|
9
|
+
<% } %>
|
|
10
|
+
export function App() {
|
|
11
|
+
return (
|
|
12
|
+
<React.Suspense fallback={null}>
|
|
13
|
+
<ul>
|
|
14
|
+
<li><Link to="/">Home</Link></li>
|
|
15
|
+
<% remotes.forEach(function(r) { %>
|
|
16
|
+
<li><Link to="/<%=r.fileName%>"><%=r.className%></Link></li>
|
|
17
|
+
<% }); %>
|
|
18
|
+
</ul>
|
|
19
|
+
<Switch>
|
|
20
|
+
<Route exact path="/" render={() => <NxWelcome title="<%= projectName %>"/>} />
|
|
21
|
+
<% remotes.forEach(function(r) { %>
|
|
22
|
+
<Route path="/<%=r.fileName%>" render={() => <<%= r.className %>/>} />
|
|
23
|
+
<% }); %>
|
|
24
|
+
</Switch>
|
|
25
|
+
</React.Suspense>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export default App;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import('./bootstrap');
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
const withModuleFederation = require('@nrwl/react/module-federation');
|
|
2
|
+
const mfeConfig = require('./mfe.config');
|
|
3
|
+
|
|
4
|
+
module.exports = withModuleFederation({
|
|
5
|
+
...mfeConfig,
|
|
6
|
+
// Override remote location for production build.
|
|
7
|
+
// Each entry is a pair of an unique name and the URL where it is deployed.
|
|
8
|
+
// remotes: [
|
|
9
|
+
// ['app1', 'http://app1.example.com/'],
|
|
10
|
+
// ['app2', 'http://app2.example.com/'],
|
|
11
|
+
// ],
|
|
12
|
+
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addMFEFiles = void 0;
|
|
4
|
+
const devkit_1 = require("@nrwl/devkit");
|
|
5
|
+
const path_1 = require("path");
|
|
6
|
+
function addMFEFiles(host, options) {
|
|
7
|
+
const templateVariables = Object.assign(Object.assign(Object.assign({}, (0, devkit_1.names)(options.name)), options), { tmpl: '', remotes: options.remotes.map((r) => (0, devkit_1.names)(r)) });
|
|
8
|
+
// Module federation requires bootstrap code to be dynamically imported.
|
|
9
|
+
// Renaming original entry file so we can use `import(./bootstrap)` in
|
|
10
|
+
// new entry file.
|
|
11
|
+
host.rename((0, path_1.join)(options.appProjectRoot, 'src/main.tsx'), (0, path_1.join)(options.appProjectRoot, 'src/bootstrap.tsx'));
|
|
12
|
+
// New entry file is created here.
|
|
13
|
+
(0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, `../files/mfe`), options.appProjectRoot, templateVariables);
|
|
14
|
+
(0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, `../files/common`), options.appProjectRoot, templateVariables);
|
|
15
|
+
}
|
|
16
|
+
exports.addMFEFiles = addMFEFiles;
|
|
17
|
+
//# sourceMappingURL=add-mfe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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"}
|