@nrwl/react 13.10.2 → 14.0.0-beta.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.
Files changed (116) hide show
  1. package/README.md +1 -1
  2. package/executors.json +8 -8
  3. package/generators.json +8 -24
  4. package/index.d.ts +1 -2
  5. package/index.js +3 -5
  6. package/index.js.map +1 -1
  7. package/migrations.json +63 -0
  8. package/module-federation.d.ts +3 -3
  9. package/module-federation.js +3 -3
  10. package/module-federation.js.map +1 -1
  11. package/package.json +9 -9
  12. package/plugins/jest.js +22 -1
  13. package/plugins/jest.js.map +1 -1
  14. package/src/executors/{mfe-dev-server → module-federation-dev-server}/compat.d.ts +0 -0
  15. package/src/executors/module-federation-dev-server/compat.js +6 -0
  16. package/src/executors/module-federation-dev-server/compat.js.map +1 -0
  17. package/src/executors/{mfe-dev-server/mfe-dev-server.impl.d.ts → module-federation-dev-server/module-federation-dev-server.impl.d.ts} +3 -3
  18. package/src/executors/{mfe-dev-server/mfe-dev-server.impl.js → module-federation-dev-server/module-federation-dev-server.impl.js} +22 -21
  19. package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js.map +1 -0
  20. package/src/executors/{mfe-dev-server → module-federation-dev-server}/schema.json +8 -8
  21. package/src/generators/application/files/common/src/main.tsx__tmpl__ +2 -2
  22. package/src/generators/application/lib/add-project.js +10 -0
  23. package/src/generators/application/lib/add-project.js.map +1 -1
  24. package/src/generators/component/files/__fileName__.tsx__tmpl__ +2 -2
  25. package/src/generators/hook/files/{__fileName__.spec.ts__tmpl__ → __fileName__.spec.tsx__tmpl__} +17 -15
  26. package/src/generators/hook/hook.js +1 -0
  27. package/src/generators/hook/hook.js.map +1 -1
  28. package/src/generators/{mfe-host → host}/files/common/src/app/__fileName__.tsx__tmpl__ +5 -5
  29. package/src/generators/{mfe-host/files/mfe/mfe.config.js__tmpl__ → host/files/module-federation/module-federation.config.js__tmpl__} +0 -0
  30. package/src/generators/{mfe-host/files/mfe → host/files/module-federation}/src/main.ts__tmpl__ +0 -0
  31. package/src/generators/{mfe-host/files/mfe → host/files/module-federation}/src/remotes.d.ts__tmpl__ +0 -0
  32. package/src/generators/{mfe-host/files/mfe → host/files/module-federation}/webpack.config.js__tmpl__ +2 -2
  33. package/src/generators/{mfe-host/files/mfe → host/files/module-federation}/webpack.config.prod.js__tmpl__ +2 -2
  34. package/src/generators/host/host.d.ts +4 -0
  35. package/src/generators/{mfe-host/mfe-host.js → host/host.js} +14 -14
  36. package/src/generators/host/host.js.map +1 -0
  37. package/src/generators/host/lib/add-module-federation-files.d.ts +5 -0
  38. package/src/generators/{mfe-host/lib/add-mfe-files.js → host/lib/add-module-federation-files.js} +5 -5
  39. package/src/generators/host/lib/add-module-federation-files.js.map +1 -0
  40. package/src/generators/host/lib/update-module-federation-e2e-project.d.ts +3 -0
  41. package/src/generators/{mfe-host/lib/update-mfe-e2e-project.js → host/lib/update-module-federation-e2e-project.js} +4 -4
  42. package/src/generators/host/lib/update-module-federation-e2e-project.js.map +1 -0
  43. package/src/generators/{mfe-host → host}/schema.d.ts +0 -0
  44. package/src/generators/{mfe-host → host}/schema.json +1 -1
  45. package/src/generators/init/init.js +1 -1
  46. package/src/generators/init/init.js.map +1 -1
  47. package/src/generators/init/schema.json +1 -1
  48. package/src/generators/library/schema.json +1 -1
  49. package/src/generators/{mfe-remote/files/mfe/mfe.config.js__tmpl__ → remote/files/module-federation/module-federation.config.js__tmpl__} +0 -0
  50. package/src/generators/{mfe-remote/files/mfe → remote/files/module-federation}/src/main.ts__tmpl__ +0 -0
  51. package/src/generators/{mfe-remote/files/mfe → remote/files/module-federation}/src/remote-entry.ts__tmpl__ +0 -0
  52. package/src/generators/{mfe-remote/files/mfe → remote/files/module-federation}/webpack.config.js__tmpl__ +2 -2
  53. package/src/generators/{mfe-remote/files/mfe → remote/files/module-federation}/webpack.config.prod.js__tmpl__ +0 -0
  54. package/src/generators/{mfe-remote → remote}/lib/update-host-with-remote.d.ts +0 -0
  55. package/src/generators/{mfe-remote → remote}/lib/update-host-with-remote.js +13 -13
  56. package/src/generators/remote/lib/update-host-with-remote.js.map +1 -0
  57. package/src/generators/remote/remote.d.ts +6 -0
  58. package/src/generators/{mfe-remote/mfe-remote.js → remote/remote.js} +11 -11
  59. package/src/generators/remote/remote.js.map +1 -0
  60. package/src/generators/{mfe-remote → remote}/schema.d.ts +0 -0
  61. package/src/generators/{mfe-remote → remote}/schema.json +1 -1
  62. package/src/migrations/update-14-0-0/add-default-development-configurations.d.ts +3 -0
  63. package/src/migrations/update-14-0-0/add-default-development-configurations.js +38 -0
  64. package/src/migrations/update-14-0-0/add-default-development-configurations.js.map +1 -0
  65. package/src/migrations/update-14-0-0/replace-testing-library-react-hook.d.ts +3 -0
  66. package/src/migrations/update-14-0-0/replace-testing-library-react-hook.js +27 -0
  67. package/src/migrations/update-14-0-0/replace-testing-library-react-hook.js.map +1 -0
  68. package/src/migrations/update-14-0-0/update-react-dom-render-for-v18.d.ts +5 -0
  69. package/src/migrations/update-14-0-0/update-react-dom-render-for-v18.js +69 -0
  70. package/src/migrations/update-14-0-0/update-react-dom-render-for-v18.js.map +1 -0
  71. package/src/{mfe/mfe-ast-utils.d.ts → module-federation/ast-utils.d.ts} +1 -1
  72. package/src/{mfe/mfe-ast-utils.js → module-federation/ast-utils.js} +5 -5
  73. package/src/module-federation/ast-utils.js.map +1 -0
  74. package/src/module-federation/load-config.d.ts +3 -0
  75. package/src/module-federation/load-config.js +17 -0
  76. package/src/module-federation/load-config.js.map +1 -0
  77. package/src/module-federation/models.d.ts +18 -0
  78. package/src/module-federation/models.js +3 -0
  79. package/src/module-federation/models.js.map +1 -0
  80. package/src/{mfe → module-federation}/webpack-utils.d.ts +1 -6
  81. package/src/{mfe → module-federation}/webpack-utils.js +5 -5
  82. package/src/module-federation/webpack-utils.js.map +1 -0
  83. package/src/module-federation/with-module-federation.d.ts +2 -0
  84. package/src/{mfe → module-federation}/with-module-federation.js +1 -1
  85. package/src/module-federation/with-module-federation.js.map +1 -0
  86. package/src/rules/{update-mfe-project.d.ts → update-module-federation-project.d.ts} +1 -1
  87. package/src/rules/update-module-federation-project.js +32 -0
  88. package/src/rules/update-module-federation-project.js.map +1 -0
  89. package/src/utils/ast-utils.js +5 -7
  90. package/src/utils/ast-utils.js.map +1 -1
  91. package/src/utils/versions.d.ts +6 -6
  92. package/src/utils/versions.js +8 -8
  93. package/src/utils/versions.js.map +1 -1
  94. package/src/executors/mfe-dev-server/compat.js +0 -6
  95. package/src/executors/mfe-dev-server/compat.js.map +0 -1
  96. package/src/executors/mfe-dev-server/mfe-dev-server.impl.js.map +0 -1
  97. package/src/generators/mfe-host/lib/add-mfe-files.d.ts +0 -5
  98. package/src/generators/mfe-host/lib/add-mfe-files.js.map +0 -1
  99. package/src/generators/mfe-host/lib/update-mfe-e2e-project.d.ts +0 -3
  100. package/src/generators/mfe-host/lib/update-mfe-e2e-project.js.map +0 -1
  101. package/src/generators/mfe-host/mfe-host.d.ts +0 -4
  102. package/src/generators/mfe-host/mfe-host.js.map +0 -1
  103. package/src/generators/mfe-remote/lib/update-host-with-remote.js.map +0 -1
  104. package/src/generators/mfe-remote/mfe-remote.d.ts +0 -6
  105. package/src/generators/mfe-remote/mfe-remote.js.map +0 -1
  106. package/src/generators/storybook-migrate-defaults-5-to-6/migrate-defaults-5-to-6.d.ts +0 -5
  107. package/src/generators/storybook-migrate-defaults-5-to-6/migrate-defaults-5-to-6.js +0 -16
  108. package/src/generators/storybook-migrate-defaults-5-to-6/migrate-defaults-5-to-6.js.map +0 -1
  109. package/src/generators/storybook-migrate-defaults-5-to-6/schema.d.ts +0 -5
  110. package/src/generators/storybook-migrate-defaults-5-to-6/schema.json +0 -29
  111. package/src/mfe/mfe-ast-utils.js.map +0 -1
  112. package/src/mfe/webpack-utils.js.map +0 -1
  113. package/src/mfe/with-module-federation.d.ts +0 -14
  114. package/src/mfe/with-module-federation.js.map +0 -1
  115. package/src/rules/update-mfe-project.js +0 -14
  116. package/src/rules/update-mfe-project.js.map +0 -1
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import NxWelcome from "./nx-welcome";
3
3
  <% if (remotes.length > 0) { %>
4
- import { Link, Route, Switch } from 'react-router-dom';
4
+ import { Link, Route, Routes } from 'react-router-dom';
5
5
 
6
6
  <% remotes.forEach(function(r) { %>
7
7
  const <%= r.className %> = React.lazy(() => import('<%= r.fileName %>/Module'));
@@ -16,12 +16,12 @@ export function App() {
16
16
  <li><Link to="/<%=r.fileName%>"><%=r.className%></Link></li>
17
17
  <% }); %>
18
18
  </ul>
19
- <Switch>
20
- <Route exact path="/" render={() => <NxWelcome title="<%= projectName %>"/>} />
19
+ <Routes>
20
+ <Route path="/" element={<NxWelcome title="<%= projectName %>"/>} />
21
21
  <% remotes.forEach(function(r) { %>
22
- <Route path="/<%=r.fileName%>" render={() => <<%= r.className %>/>} />
22
+ <Route path="/<%=r.fileName%>" element={<<%= r.className %>/>} />
23
23
  <% }); %>
24
- </Switch>
24
+ </Routes>
25
25
  </React.Suspense>
26
26
  );
27
27
  }
@@ -1,6 +1,6 @@
1
1
  const withModuleFederation = require('@nrwl/react/module-federation');
2
- const mfeConfig = require('./mfe.config');
2
+ const moduleFederationConfig = require('./module-federation.config');
3
3
 
4
4
  module.exports = withModuleFederation({
5
- ...mfeConfig,
5
+ ...moduleFederationConfig,
6
6
  });
@@ -1,8 +1,8 @@
1
1
  const withModuleFederation = require('@nrwl/react/module-federation');
2
- const mfeConfig = require('./mfe.config');
2
+ const moduleFederationConfig = require('./module-federation.config');
3
3
 
4
4
  module.exports = withModuleFederation({
5
- ...mfeConfig,
5
+ ...moduleFederationConfig,
6
6
  /*
7
7
  * Remote overrides for production.
8
8
  * Each entry is a pair of an unique name and the URL where it is deployed.
@@ -0,0 +1,4 @@
1
+ import { Tree } from '@nrwl/devkit';
2
+ import { Schema } from './schema';
3
+ export declare function hostGenerator(host: Tree, schema: Schema): Promise<import("@nrwl/devkit").GeneratorCallback>;
4
+ export default hostGenerator;
@@ -1,26 +1,26 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mfeHostGenerator = void 0;
3
+ exports.hostGenerator = void 0;
4
4
  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 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
- const update_mfe_e2e_project_1 = require("./lib/update-mfe-e2e-project");
12
- function mfeHostGenerator(host, schema) {
8
+ const update_module_federation_project_1 = require("../../rules/update-module-federation-project");
9
+ const add_module_federation_files_1 = require("./lib/add-module-federation-files");
10
+ const update_module_federation_e2e_project_1 = require("./lib/update-module-federation-e2e-project");
11
+ const remote_1 = require("../remote/remote");
12
+ function hostGenerator(host, schema) {
13
13
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
14
14
  const options = (0, normalize_options_1.normalizeOptions)(host, schema);
15
15
  const initTask = yield (0, application_1.default)(host, Object.assign(Object.assign({}, options), {
16
- // The target use-case for MFE is loading remotes as child routes, thus always enable routing.
16
+ // The target use-case is loading remotes as child routes, thus always enable routing.
17
17
  routing: true }));
18
18
  const remotesWithPorts = [];
19
19
  if (schema.remotes) {
20
20
  let remotePort = options.devServerPort + 1;
21
21
  for (const remote of schema.remotes) {
22
22
  remotesWithPorts.push({ name: remote, port: remotePort });
23
- yield (0, mfe_remote_1.mfeRemoteGenerator)(host, {
23
+ yield (0, remote_1.default)(host, {
24
24
  name: remote,
25
25
  style: options.style,
26
26
  skipFormat: options.skipFormat,
@@ -32,15 +32,15 @@ function mfeHostGenerator(host, schema) {
32
32
  remotePort++;
33
33
  }
34
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);
35
+ (0, add_module_federation_files_1.addModuleFederationFiles)(host, options, remotesWithPorts);
36
+ (0, update_module_federation_project_1.updateModuleFederationProject)(host, options);
37
+ (0, update_module_federation_e2e_project_1.updateModuleFederationE2eProject)(host, options);
38
38
  if (!options.skipFormat) {
39
39
  yield (0, devkit_1.formatFiles)(host);
40
40
  }
41
41
  return initTask;
42
42
  });
43
43
  }
44
- exports.mfeHostGenerator = mfeHostGenerator;
45
- exports.default = mfeHostGenerator;
46
- //# sourceMappingURL=mfe-host.js.map
44
+ exports.hostGenerator = hostGenerator;
45
+ exports.default = hostGenerator;
46
+ //# sourceMappingURL=host.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"host.js","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/host/host.ts"],"names":[],"mappings":";;;;AAAA,yCAAiD;AAEjD,4DAA8D;AAC9D,4EAAwE;AACxE,mGAA6F;AAC7F,mFAA6E;AAC7E,qGAA8F;AAE9F,6CAA+C;AAE/C,SAAsB,aAAa,CAAC,IAAU,EAAE,MAAc;;QAC5D,MAAM,OAAO,GAAG,IAAA,oCAAgB,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;QAE/C,MAAM,QAAQ,GAAG,MAAM,IAAA,qBAAoB,EAAC,IAAI,kCAC3C,OAAO;YACV,sFAAsF;YACtF,OAAO,EAAE,IAAI,IACb,CAAC;QAEH,MAAM,gBAAgB,GAAqC,EAAE,CAAC;QAE9D,IAAI,MAAM,CAAC,OAAO,EAAE;YAClB,IAAI,UAAU,GAAG,OAAO,CAAC,aAAa,GAAG,CAAC,CAAC;YAC3C,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,OAAO,EAAE;gBACnC,gBAAgB,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC;gBAC1D,MAAM,IAAA,gBAAe,EAAC,IAAI,EAAE;oBAC1B,IAAI,EAAE,MAAM;oBACZ,KAAK,EAAE,OAAO,CAAC,KAAK;oBACpB,UAAU,EAAE,OAAO,CAAC,UAAU;oBAC9B,cAAc,EAAE,OAAO,CAAC,cAAc;oBACtC,aAAa,EAAE,OAAO,CAAC,aAAa;oBACpC,MAAM,EAAE,OAAO,CAAC,MAAM;oBACtB,aAAa,EAAE,UAAU;iBAC1B,CAAC,CAAC;gBACH,UAAU,EAAE,CAAC;aACd;SACF;QAED,IAAA,sDAAwB,EAAC,IAAI,EAAE,OAAO,EAAE,gBAAgB,CAAC,CAAC;QAC1D,IAAA,gEAA6B,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC7C,IAAA,uEAAgC,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAEhD,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE;YACvB,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;SACzB;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;CAAA;AArCD,sCAqCC;AAED,kBAAe,aAAa,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { NormalizedSchema } from '../schema';
2
+ export declare function addModuleFederationFiles(host: any, options: NormalizedSchema, defaultRemoteManifest: {
3
+ name: string;
4
+ port: number;
5
+ }[]): void;
@@ -1,17 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.addMfeFiles = void 0;
3
+ exports.addModuleFederationFiles = void 0;
4
4
  const devkit_1 = require("@nrwl/devkit");
5
5
  const path_1 = require("path");
6
- function addMfeFiles(host, options, defaultRemoteManifest) {
6
+ function addModuleFederationFiles(host, options, defaultRemoteManifest) {
7
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.
11
11
  host.rename((0, path_1.join)(options.appProjectRoot, 'src/main.tsx'), (0, path_1.join)(options.appProjectRoot, 'src/bootstrap.tsx'));
12
12
  // New entry file is created here.
13
- (0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, `../files/mfe`), options.appProjectRoot, templateVariables);
13
+ (0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, `../files/module-federation`), options.appProjectRoot, templateVariables);
14
14
  (0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, `../files/common`), options.appProjectRoot, templateVariables);
15
15
  }
16
- exports.addMfeFiles = addMfeFiles;
17
- //# sourceMappingURL=add-mfe-files.js.map
16
+ exports.addModuleFederationFiles = addModuleFederationFiles;
17
+ //# sourceMappingURL=add-module-federation-files.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-module-federation-files.js","sourceRoot":"","sources":["../../../../../../../packages/react/src/generators/host/lib/add-module-federation-files.ts"],"names":[],"mappings":";;;AACA,yCAAoD;AACpD,+BAA4B;AAE5B,SAAgB,wBAAwB,CACtC,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,4BAA4B,CAAC,EAC7C,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,4DAqCC"}
@@ -0,0 +1,3 @@
1
+ import { NormalizedSchema } from '../schema';
2
+ import { Tree } from '@nrwl/devkit';
3
+ export declare function updateModuleFederationE2eProject(host: Tree, options: NormalizedSchema): void;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.updateMfeE2eProject = void 0;
3
+ exports.updateModuleFederationE2eProject = void 0;
4
4
  const devkit_1 = require("@nrwl/devkit");
5
- function updateMfeE2eProject(host, options) {
5
+ function updateModuleFederationE2eProject(host, options) {
6
6
  const e2eName = `${options.name}-e2e`;
7
7
  try {
8
8
  let projectConfig = (0, devkit_1.readProjectConfiguration)(host, e2eName);
@@ -13,5 +13,5 @@ function updateMfeE2eProject(host, options) {
13
13
  // nothing
14
14
  }
15
15
  }
16
- exports.updateMfeE2eProject = updateMfeE2eProject;
17
- //# sourceMappingURL=update-mfe-e2e-project.js.map
16
+ exports.updateModuleFederationE2eProject = updateModuleFederationE2eProject;
17
+ //# sourceMappingURL=update-module-federation-e2e-project.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-module-federation-e2e-project.js","sourceRoot":"","sources":["../../../../../../../packages/react/src/generators/host/lib/update-module-federation-e2e-project.ts"],"names":[],"mappings":";;;AACA,yCAIsB;AAEtB,SAAgB,gCAAgC,CAC9C,IAAU,EACV,OAAyB;IAEzB,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;AAfD,4EAeC"}
File without changes
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/schema",
3
- "$id": "GeneratorReactMFEHost",
3
+ "$id": "GeneratorReactHost",
4
4
  "cli": "nx",
5
5
  "title": "Generate Module Federation Setup for React Host App",
6
6
  "description": "Create Module Federation configuration files for given React Host Application.",
@@ -27,10 +27,10 @@ function updateDependencies(host) {
27
27
  tslib: '^2.0.0',
28
28
  }, {
29
29
  '@nrwl/react': versions_1.nxVersion,
30
+ '@types/node': versions_1.typesNodeVersion,
30
31
  '@types/react': versions_1.typesReactVersion,
31
32
  '@types/react-dom': versions_1.typesReactDomVersion,
32
33
  '@testing-library/react': versions_1.testingLibraryReactVersion,
33
- '@testing-library/react-hooks': versions_1.testingLibraryReactHooksVersion,
34
34
  'react-test-renderer': versions_1.reactTestRendererVersion,
35
35
  });
36
36
  }
@@ -1 +1 @@
1
- {"version":3,"file":"init.js","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/init/init.ts"],"names":[],"mappings":";;;;AAAA,2CAAqD;AACrD,yCAQsB;AACtB,qCAA+C;AAC/C,mCAA6C;AAC7C,2FAAqF;AACrF,iGAA4F;AAC5F,mDAS8B;AAG9B,SAAS,UAAU,CAAC,IAAU;IAC5B,MAAM,SAAS,GAAG,IAAA,mCAA0B,EAAC,IAAI,CAAC,CAAC;IAEnD,SAAS,CAAC,UAAU,GAAG,SAAS,CAAC,UAAU,IAAI,EAAE,CAAC;IAClD,MAAM,eAAe,GAAG,SAAS,CAAC,UAAU,CAAC,aAAa,CAAC,I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CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAExB,OAAO,IAAA,sCAAgB,EAAC,GAAG,KAAK,CAAC,CAAC;IACpC,CAAC;CAAA;AApBD,gDAoBC;AAED,kBAAe,kBAAkB,CAAC;AAErB,QAAA,kBAAkB,GAAG,IAAA,2BAAkB,EAAC,kBAAkB,CAAC,CAAC"}
@@ -2,7 +2,7 @@
2
2
  "$schema": "http://json-schema.org/schema",
3
3
  "$id": "NxReactNgInit",
4
4
  "title": "Init React Plugin",
5
- "description": "Initialize a React Plugin",
5
+ "description": "Initialize a React Plugin.",
6
6
  "cli": "nx",
7
7
  "type": "object",
8
8
  "properties": {
@@ -3,7 +3,7 @@
3
3
  "cli": "nx",
4
4
  "$id": "NxReactLibrary",
5
5
  "title": "Create a React Library",
6
- "description": "Create a React Library for an Nx workspace",
6
+ "description": "Create a React Library for an Nx workspace.",
7
7
  "type": "object",
8
8
  "examples": [
9
9
  {
@@ -1,6 +1,6 @@
1
1
  const withModuleFederation = require('@nrwl/react/module-federation');
2
- const mfeConfig = require('./mfe.config');
2
+ const moduleFederationConfig = require('./module-federation.config');
3
3
 
4
4
  module.exports = withModuleFederation({
5
- ...mfeConfig,
5
+ ...moduleFederationConfig,
6
6
  });
@@ -2,39 +2,39 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.updateHostWithRemote = void 0;
4
4
  const devkit_1 = require("@nrwl/devkit");
5
- const mfe_ast_utils_1 = require("../../../mfe/mfe-ast-utils");
5
+ const ast_utils_1 = require("../../../module-federation/ast-utils");
6
6
  const ts = require("typescript");
7
7
  function updateHostWithRemote(host, hostName, remoteName) {
8
8
  const hostConfig = (0, devkit_1.readProjectConfiguration)(host, hostName);
9
- const mfeConfigPath = (0, devkit_1.joinPathFragments)(hostConfig.root, 'mfe.config.js');
9
+ const moduleFederationConfigPath = (0, devkit_1.joinPathFragments)(hostConfig.root, 'module-federation.config.js');
10
10
  const remoteDefsPath = (0, devkit_1.joinPathFragments)(hostConfig.sourceRoot, 'remotes.d.ts');
11
11
  const appComponentPath = findAppComponentPath(host, hostConfig.sourceRoot);
12
- if (host.exists(mfeConfigPath)) {
12
+ if (host.exists(moduleFederationConfigPath)) {
13
13
  // find the host project path
14
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)));
15
+ let sourceCode = host.read(moduleFederationConfigPath).toString();
16
+ const source = ts.createSourceFile(moduleFederationConfigPath, sourceCode, ts.ScriptTarget.Latest, true);
17
+ host.write(moduleFederationConfigPath, (0, devkit_1.applyChangesToString)(sourceCode, (0, ast_utils_1.addRemoteToConfig)(source, remoteName)));
18
18
  }
19
19
  else {
20
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"?`);
21
+ devkit_1.logger.warn(`Could not find configuration at ${moduleFederationConfigPath}. Did you generate this project with "@nrwl/react:host"?`);
22
22
  }
23
23
  if (host.exists(remoteDefsPath)) {
24
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)));
25
+ const source = ts.createSourceFile(moduleFederationConfigPath, sourceCode, ts.ScriptTarget.Latest, true);
26
+ host.write(remoteDefsPath, (0, devkit_1.applyChangesToString)(sourceCode, (0, ast_utils_1.addRemoteDefinition)(source, remoteName)));
27
27
  }
28
28
  else {
29
- devkit_1.logger.warn(`Could not find remote definitions at ${remoteDefsPath}. Did you generate this project with "@nrwl/react:mfe-host"?`);
29
+ devkit_1.logger.warn(`Could not find remote definitions at ${remoteDefsPath}. Did you generate this project with "@nrwl/react:host"?`);
30
30
  }
31
31
  if (host.exists(appComponentPath)) {
32
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))));
33
+ const source = ts.createSourceFile(moduleFederationConfigPath, sourceCode, ts.ScriptTarget.Latest, true);
34
+ host.write(appComponentPath, (0, devkit_1.applyChangesToString)(sourceCode, (0, ast_utils_1.addRemoteRoute)(source, (0, devkit_1.names)(remoteName))));
35
35
  }
36
36
  else {
37
- devkit_1.logger.warn(`Could not find app component at ${appComponentPath}. Did you generate this project with "@nrwl/react:mfe-host"?`);
37
+ devkit_1.logger.warn(`Could not find app component at ${appComponentPath}. Did you generate this project with "@nrwl/react:host"?`);
38
38
  }
39
39
  }
40
40
  exports.updateHostWithRemote = updateHostWithRemote;
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-host-with-remote.js","sourceRoot":"","sources":["../../../../../../../packages/react/src/generators/remote/lib/update-host-with-remote.ts"],"names":[],"mappings":";;;AAAA,yCAOsB;AACtB,oEAI8C;AAC9C,iCAAiC;AAEjC,SAAgB,oBAAoB,CAClC,IAAU,EACV,QAAgB,EAChB,UAAkB;IAElB,MAAM,UAAU,GAAG,IAAA,iCAAwB,EAAC,IAAI,EAAE,QAAQ,CAAC,CAAC;IAC5D,MAAM,0BAA0B,GAAG,IAAA,0BAAiB,EAClD,UAAU,CAAC,IAAI,EACf,6BAA6B,CAC9B,CAAC;IACF,MAAM,cAAc,GAAG,IAAA,0BAAiB,EACtC,UAAU,CAAC,UAAU,EACrB,cAAc,CACf,CAAC;IACF,MAAM,gBAAgB,GAAG,oBAAoB,CAAC,IAAI,EAAE,UAAU,CAAC,UAAU,CAAC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EAC1B,UAAU,EACV,EAAE,CAAC,YAAY,CAAC,MAAM,EACtB,IAAI,CACL,CAAC;QACF,IAAI,CAAC,KAAK,CACR,gBAAgB,EAChB,IAAA,6BAAoB,EAClB,UAAU,EACV,IAAA,0BAAc,EAAC,MAAM,EAAE,IAAA,cAAK,EAAC,UAAU,CAAC,CAAC,CAC1C,CACF,CAAC;KACH;SAAM;QACL,eAAM,CAAC,IAAI,CACT,mCAAmC,gBAAgB,0DAA0D,CAC9G,CAAC;KACH;AACH,CAAC;AA3ED,oDA2EC;AAED,SAAS,oBAAoB,CAAC,IAAU,EAAE,UAAkB;IAC1D,MAAM,SAAS,GAAG,CAAC,aAAa,EAAE,aAAa,EAAE,SAAS,EAAE,SAAS,CAAC,CAAC;IACvE,KAAK,MAAM,GAAG,IAAI,SAAS,EAAE;QAC3B,IAAI,IAAI,CAAC,MAAM,CAAC,IAAA,0BAAiB,EAAC,UAAU,EAAE,GAAG,CAAC,CAAC,EAAE;YACnD,OAAO,IAAA,0BAAiB,EAAC,UAAU,EAAE,GAAG,CAAC,CAAC;SAC3C;KACF;AACH,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { Tree } from '@nrwl/devkit';
2
+ import { NormalizedSchema } from '../application/schema';
3
+ import { Schema } from './schema';
4
+ export declare function addModuleFederationFiles(host: Tree, options: NormalizedSchema): void;
5
+ export declare function remoteGenerator(host: Tree, schema: Schema): Promise<import("@nrwl/devkit").GeneratorCallback>;
6
+ export default remoteGenerator;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mfeRemoteGenerator = exports.addMfeFiles = void 0;
3
+ exports.remoteGenerator = exports.addModuleFederationFiles = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const path_1 = require("path");
6
6
  const devkit_1 = require("@nrwl/devkit");
@@ -8,13 +8,13 @@ const run_tasks_in_serial_1 = require("@nrwl/workspace/src/utilities/run-tasks-i
8
8
  const normalize_options_1 = require("../application/lib/normalize-options");
9
9
  const application_1 = require("../application/application");
10
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
- function addMfeFiles(host, options) {
11
+ const update_module_federation_project_1 = require("../../rules/update-module-federation-project");
12
+ function addModuleFederationFiles(host, options) {
13
13
  const templateVariables = Object.assign(Object.assign(Object.assign({}, (0, devkit_1.names)(options.name)), options), { tmpl: '' });
14
- (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/module-federation`), options.appProjectRoot, templateVariables);
15
15
  }
16
- exports.addMfeFiles = addMfeFiles;
17
- function mfeRemoteGenerator(host, schema) {
16
+ exports.addModuleFederationFiles = addModuleFederationFiles;
17
+ function remoteGenerator(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);
@@ -25,14 +25,14 @@ function mfeRemoteGenerator(host, schema) {
25
25
  // Renaming original entry file so we can use `import(./bootstrap)` in
26
26
  // new entry file.
27
27
  host.rename((0, path_1.join)(options.appProjectRoot, 'src/main.tsx'), (0, path_1.join)(options.appProjectRoot, 'src/bootstrap.tsx'));
28
- addMfeFiles(host, options);
29
- (0, update_mfe_project_1.updateMfeProject)(host, options);
28
+ addModuleFederationFiles(host, options);
29
+ (0, update_module_federation_project_1.updateModuleFederationProject)(host, options);
30
30
  if (!options.skipFormat) {
31
31
  yield (0, devkit_1.formatFiles)(host);
32
32
  }
33
33
  return (0, run_tasks_in_serial_1.runTasksInSerial)(initApp);
34
34
  });
35
35
  }
36
- exports.mfeRemoteGenerator = mfeRemoteGenerator;
37
- exports.default = mfeRemoteGenerator;
38
- //# sourceMappingURL=mfe-remote.js.map
36
+ exports.remoteGenerator = remoteGenerator;
37
+ exports.default = remoteGenerator;
38
+ //# sourceMappingURL=remote.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"remote.js","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/remote/remote.ts"],"names":[],"mappings":";;;;AAAA,+BAA4B;AAC5B,yCAAuE;AACvE,2FAAqF;AAErF,4EAAwE;AACxE,4DAA8D;AAE9D,2EAAqE;AACrE,mGAA6F;AAG7F,SAAgB,wBAAwB,CACtC,IAAU,EACV,OAAyB;IAEzB,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,2BAA2B,CAAC,EAC5C,OAAO,CAAC,cAAc,EACtB,iBAAiB,CAClB,CAAC;AACJ,CAAC;AAhBD,4DAgBC;AAED,SAAsB,eAAe,CAAC,IAAU,EAAE,MAAc;;QAC9D,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,wBAAwB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QACxC,IAAA,gEAA6B,EAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAE7C,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,0CAwBC;AAED,kBAAe,eAAe,CAAC"}
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "$schema": "http://json-schema.org/schema",
3
- "$id": "GeneratorReactMFERemote",
3
+ "$id": "GeneratorReactRemote",
4
4
  "cli": "nx",
5
5
  "title": "Generate Module Federation Setup for React Remote App",
6
6
  "description": "Create Module Federation configuration files for given React Remote Application.",
@@ -0,0 +1,3 @@
1
+ import { Tree } from '@nrwl/devkit';
2
+ export declare function update(tree: Tree): Promise<void>;
3
+ export default update;
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.update = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const devkit_1 = require("@nrwl/devkit");
6
+ function update(tree) {
7
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
8
+ const projects = (0, devkit_1.getProjects)(tree);
9
+ projects.forEach((config, name) => {
10
+ var _a, _b, _c, _d, _e, _f;
11
+ var _g, _h, _j, _k;
12
+ let shouldUpdate = false;
13
+ if (((_a = config.targets.build) === null || _a === void 0 ? void 0 : _a.executor) === '@nrwl/web:webpack') {
14
+ shouldUpdate = true;
15
+ (_b = (_g = config.targets.build).defaultConfiguration) !== null && _b !== void 0 ? _b : (_g.defaultConfiguration = 'production');
16
+ (_c = (_h = config.targets.build.configurations).development) !== null && _c !== void 0 ? _c : (_h.development = {
17
+ extractLicenses: false,
18
+ optimization: false,
19
+ sourceMap: true,
20
+ vendorChunk: true,
21
+ });
22
+ }
23
+ if (((_d = config.targets.serve) === null || _d === void 0 ? void 0 : _d.executor) === '@nrwl/web:dev-server') {
24
+ shouldUpdate = true;
25
+ (_e = (_j = config.targets.serve).defaultConfiguration) !== null && _e !== void 0 ? _e : (_j.defaultConfiguration = 'development');
26
+ (_f = (_k = config.targets.serve.configurations).development) !== null && _f !== void 0 ? _f : (_k.development = {
27
+ buildTarget: `${name}:build:development`,
28
+ });
29
+ }
30
+ if (shouldUpdate)
31
+ (0, devkit_1.updateProjectConfiguration)(tree, name, config);
32
+ });
33
+ yield (0, devkit_1.formatFiles)(tree);
34
+ });
35
+ }
36
+ exports.update = update;
37
+ exports.default = update;
38
+ //# sourceMappingURL=add-default-development-configurations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"add-default-development-configurations.js","sourceRoot":"","sources":["../../../../../../packages/react/src/migrations/update-14-0-0/add-default-development-configurations.ts"],"names":[],"mappings":";;;;AAAA,yCAKsB;AAEtB,SAAsB,MAAM,CAAC,IAAU;;QACrC,MAAM,QAAQ,GAAG,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;QAEnC,QAAQ,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE;;;YAChC,IAAI,YAAY,GAAG,KAAK,CAAC;YACzB,IAAI,CAAA,MAAA,MAAM,CAAC,OAAO,CAAC,KAAK,0CAAE,QAAQ,MAAK,mBAAmB,EAAE;gBAC1D,YAAY,GAAG,IAAI,CAAC;gBACpB,YAAA,MAAM,CAAC,OAAO,CAAC,KAAK,EAAC,oBAAoB,uCAApB,oBAAoB,GAAK,YAAY,EAAC;gBAC3D,YAAA,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,cAAc,EAAC,WAAW,uCAAX,WAAW,GAAK;oBAClD,eAAe,EAAE,KAAK;oBACtB,YAAY,EAAE,KAAK;oBACnB,SAAS,EAAE,IAAI;oBACf,WAAW,EAAE,IAAI;iBAClB,EAAC;aACH;YAED,IAAI,CAAA,MAAA,MAAM,CAAC,OAAO,CAAC,KAAK,0CAAE,QAAQ,MAAK,sBAAsB,EAAE;gBAC7D,YAAY,GAAG,IAAI,CAAC;gBACpB,YAAA,MAAM,CAAC,OAAO,CAAC,KAAK,EAAC,oBAAoB,uCAApB,oBAAoB,GAAK,aAAa,EAAC;gBAC5D,YAAA,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,cAAc,EAAC,WAAW,uCAAX,WAAW,GAAK;oBAClD,WAAW,EAAE,GAAG,IAAI,oBAAoB;iBACzC,EAAC;aACH;YAED,IAAI,YAAY;gBAAE,IAAA,mCAA0B,EAAC,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC,CAAC;QACnE,CAAC,CAAC,CAAC;QAEH,MAAM,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;IAC1B,CAAC;CAAA;AA5BD,wBA4BC;AAED,kBAAe,MAAM,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Tree } from '@nrwl/devkit';
2
+ export declare function update(tree: Tree): Promise<void>;
3
+ export default update;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.update = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const devkit_1 = require("@nrwl/devkit");
6
+ function update(tree) {
7
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
8
+ const projects = (0, devkit_1.getProjects)(tree);
9
+ projects.forEach((config) => {
10
+ var _a;
11
+ if (((_a = config.targets.test) === null || _a === void 0 ? void 0 : _a.executor) !== '@nrwl/jest:jest')
12
+ return;
13
+ (0, devkit_1.visitNotIgnoredFiles)(tree, config.sourceRoot, (file) => {
14
+ if (!file.endsWith('.spec.ts'))
15
+ return;
16
+ const content = tree.read(file).toString();
17
+ if (content.includes('@testing-library/react-hook')) {
18
+ tree.write(file, content.replace(/@testing-library\/react-hook/g, '@testing-library/react'));
19
+ }
20
+ });
21
+ });
22
+ (0, devkit_1.removeDependenciesFromPackageJson)(tree, ['@testing-library/react-hooks'], ['@testing-library/react-hooks']);
23
+ });
24
+ }
25
+ exports.update = update;
26
+ exports.default = update;
27
+ //# sourceMappingURL=replace-testing-library-react-hook.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"replace-testing-library-react-hook.js","sourceRoot":"","sources":["../../../../../../packages/react/src/migrations/update-14-0-0/replace-testing-library-react-hook.ts"],"names":[],"mappings":";;;;AAAA,yCAKsB;AAEtB,SAAsB,MAAM,CAAC,IAAU;;QACrC,MAAM,QAAQ,GAAG,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;QACnC,QAAQ,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;;YAC1B,IAAI,CAAA,MAAA,MAAM,CAAC,OAAO,CAAC,IAAI,0CAAE,QAAQ,MAAK,iBAAiB;gBAAE,OAAO;YAEhE,IAAA,6BAAoB,EAAC,IAAI,EAAE,MAAM,CAAC,UAAU,EAAE,CAAC,IAAI,EAAE,EAAE;gBACrD,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC;oBAAE,OAAO;gBAEvC,MAAM,OAAO,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC;gBAC3C,IAAI,OAAO,CAAC,QAAQ,CAAC,6BAA6B,CAAC,EAAE;oBACnD,IAAI,CAAC,KAAK,CACR,IAAI,EACJ,OAAO,CAAC,OAAO,CACb,+BAA+B,EAC/B,wBAAwB,CACzB,CACF,CAAC;iBACH;YACH,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;QAEH,IAAA,0CAAiC,EAC/B,IAAI,EACJ,CAAC,8BAA8B,CAAC,EAChC,CAAC,8BAA8B,CAAC,CACjC,CAAC;IACJ,CAAC;CAAA;AA1BD,wBA0BC;AAED,kBAAe,MAAM,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { StringChange, Tree } from '@nrwl/devkit';
2
+ import * as ts from 'typescript';
3
+ export declare function update(tree: Tree): Promise<void>;
4
+ export declare function migrateReactDomRender(sourcePath: string, source: ts.SourceFile): StringChange[];
5
+ export default update;
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.migrateReactDomRender = exports.update = void 0;
4
+ const tslib_1 = require("tslib");
5
+ const devkit_1 = require("@nrwl/devkit");
6
+ const find_nodes_1 = require("@nrwl/workspace/src/utilities/typescript/find-nodes");
7
+ const ts = require("typescript");
8
+ function update(tree) {
9
+ return tslib_1.__awaiter(this, void 0, void 0, function* () {
10
+ const projects = (0, devkit_1.getProjects)(tree);
11
+ projects.forEach((config, name) => {
12
+ var _a;
13
+ const isReactProject = ((_a = config.targets.build) === null || _a === void 0 ? void 0 : _a.executor) === '@nrwl/web:webpack' &&
14
+ /main\.(t|j)sx?$/.test(config.targets.build.options.main);
15
+ if (isReactProject) {
16
+ const sourcePath = config.targets.build.options.main;
17
+ const sourceCode = tree.read(sourcePath).toString();
18
+ const source = ts.createSourceFile(sourcePath, sourceCode, ts.ScriptTarget.Latest, true);
19
+ const result = (0, devkit_1.applyChangesToString)(sourceCode, migrateReactDomRender(sourcePath, source));
20
+ tree.write(sourcePath, result);
21
+ }
22
+ });
23
+ yield (0, devkit_1.formatFiles)(tree);
24
+ });
25
+ }
26
+ exports.update = update;
27
+ function migrateReactDomRender(sourcePath, source) {
28
+ const allImports = (0, find_nodes_1.findNodes)(source, ts.SyntaxKind.ImportDeclaration);
29
+ const reactDomImport = allImports.find((x) => x.moduleSpecifier.getText() === "'react-dom'");
30
+ const changes = [];
31
+ if (reactDomImport) {
32
+ changes.push({
33
+ type: devkit_1.ChangeType.Insert,
34
+ index: reactDomImport.moduleSpecifier.end - 1,
35
+ text: '/client',
36
+ });
37
+ }
38
+ const calls = (0, find_nodes_1.findNodes)(source, ts.SyntaxKind.CallExpression);
39
+ const renderCall = calls.find((x) => {
40
+ if (x.expression.kind !== ts.SyntaxKind.PropertyAccessExpression)
41
+ return false;
42
+ const expr = x.expression;
43
+ return (expr.expression.getText() === 'ReactDOM' &&
44
+ expr.name.getText() === 'render');
45
+ });
46
+ if (renderCall) {
47
+ const [element, querySelector] = renderCall.arguments;
48
+ changes.push({
49
+ type: devkit_1.ChangeType.Delete,
50
+ start: renderCall.getStart(),
51
+ length: renderCall.end,
52
+ }, {
53
+ type: devkit_1.ChangeType.Insert,
54
+ index: renderCall.getStart(),
55
+ text: (0, devkit_1.stripIndents) `
56
+ const root = ReactDOM.createRoot(
57
+ ${querySelector.getText()}${sourcePath.endsWith('.tsx') ? ' as HTMLElement' : ''}
58
+ );
59
+ root.render(
60
+ ${element.getText()}
61
+ );
62
+ `,
63
+ });
64
+ }
65
+ return changes;
66
+ }
67
+ exports.migrateReactDomRender = migrateReactDomRender;
68
+ exports.default = update;
69
+ //# sourceMappingURL=update-react-dom-render-for-v18.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"update-react-dom-render-for-v18.js","sourceRoot":"","sources":["../../../../../../packages/react/src/migrations/update-14-0-0/update-react-dom-render-for-v18.ts"],"names":[],"mappings":";;;;AAAA,yCAQsB;AACtB,oFAAgF;AAChF,iCAAiC;AAEjC,SAAsB,MAAM,CAAC,IAAU;;QACrC,MAAM,QAAQ,GAAG,IAAA,oBAAW,EAAC,IAAI,CAAC,CAAC;QAEnC,QAAQ,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE;;YAChC,MAAM,cAAc,GAClB,CAAA,MAAA,MAAM,CAAC,OAAO,CAAC,KAAK,0CAAE,QAAQ,MAAK,mBAAmB;gBACtD,iBAAiB,CAAC,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;YAE5D,IAAI,cAAc,EAAE;gBAClB,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC;gBACrD,MAAM,UAAU,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,QAAQ,EAAE,CAAC;gBACpD,MAAM,MAAM,GAAG,EAAE,CAAC,gBAAgB,CAChC,UAAU,EACV,UAAU,EACV,EAAE,CAAC,YAAY,CAAC,MAAM,EACtB,IAAI,CACL,CAAC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AK,QAAQ,CACjC,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,IAAI,UAAU,EAAE;QACd,MAAM,CAAC,OAAO,EAAE,aAAa,CAAC,GAAG,UAAU,CAAC,SAAS,CAAC;QACtD,OAAO,CAAC,IAAI,CACV;YACE,IAAI,EAAE,mBAAU,CAAC,MAAM;YACvB,KAAK,EAAE,UAAU,CAAC,QAAQ,EAAE;YAC5B,MAAM,EAAE,UAAU,CAAC,GAAG;SACvB,EACD;YACE,IAAI,EAAE,mBAAU,CAAC,MAAM;YACvB,KAAK,EAAE,UAAU,CAAC,QAAQ,EAAE;YAC5B,IAAI,EAAE,IAAA,qBAAY,EAAA;;cAEZ,aAAa,CAAC,OAAO,EAAE,GAC3B,UAAU,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,EACpD;;;cAGM,OAAO,CAAC,OAAO,EAAE;;SAEtB;SACF,CACF,CAAC;KACH;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AA7DD,sDA6DC;AAED,kBAAe,MAAM,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import * as ts from 'typescript';
2
2
  import { StringChange } from '@nrwl/devkit';
3
- export declare function addRemoteToMfeConfig(source: ts.SourceFile, app: string): StringChange[];
3
+ export declare function addRemoteToConfig(source: ts.SourceFile, app: string): StringChange[];
4
4
  export declare function addRemoteDefinition(source: ts.SourceFile, app: string): StringChange[];
5
5
  export declare function addRemoteRoute(source: ts.SourceFile, names: {
6
6
  fileName: string;