@nx/react 21.0.0-canary.20250206-8bd0bcd → 21.0.0-canary.20250418-8619c1d

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 (100) hide show
  1. package/package.json +6 -6
  2. package/plugins/nx-react-webpack-plugin/lib/apply-react-config.js +3 -1
  3. package/router-plugin.d.ts +1 -0
  4. package/router-plugin.js +5 -0
  5. package/src/generators/application/application.js +52 -15
  6. package/src/generators/application/files/react-router-ssr/common/app/app-nav.tsx__tmpl__ +14 -0
  7. package/src/generators/application/files/react-router-ssr/common/app/entry.client.tsx__tmpl__ +18 -0
  8. package/src/generators/application/files/react-router-ssr/common/app/entry.server.tsx__tmpl__ +74 -0
  9. package/src/generators/application/files/react-router-ssr/common/app/root.tsx__tmpl__ +51 -0
  10. package/src/generators/application/files/react-router-ssr/common/app/routes/about.tsx__tmpl__ +7 -0
  11. package/src/generators/application/files/react-router-ssr/common/app/routes.tsx__tmpl__ +6 -0
  12. package/src/generators/application/files/react-router-ssr/common/public/favicon.ico +0 -0
  13. package/src/generators/application/files/react-router-ssr/common/react-router.config.ts__tmpl__ +5 -0
  14. package/src/generators/application/files/react-router-ssr/common/tests/routes/_index.spec.tsx__tmpl__ +16 -0
  15. package/src/generators/application/files/react-router-ssr/common/tsconfig.app.json__tmpl__ +23 -0
  16. package/src/generators/application/files/react-router-ssr/common/tsconfig.json__tmpl__ +27 -0
  17. package/src/generators/application/files/react-router-ssr/non-root/.gitignore__tmpl__ +5 -0
  18. package/src/generators/application/files/react-router-ssr/non-root/package.json__tmpl__ +24 -0
  19. package/src/generators/application/files/react-router-ssr/nx-welcome/claimed/app/nx-welcome.tsx__tmpl__ +866 -0
  20. package/src/generators/application/files/react-router-ssr/nx-welcome/not-configured/app/nx-welcome.tsx__tmpl__ +866 -0
  21. package/src/generators/application/files/react-router-ssr/nx-welcome/unclaimed/app/nx-welcome.tsx__tmpl__ +864 -0
  22. package/src/generators/application/files/react-router-ssr/ts-solution/package.json__tmpl__ +24 -0
  23. package/src/generators/application/files/react-router-ssr/ts-solution/tsconfig.app.json__tmpl__ +39 -0
  24. package/src/generators/application/lib/add-e2e.js +38 -71
  25. package/src/generators/application/lib/add-jest.js +26 -2
  26. package/src/generators/application/lib/add-linting.d.ts +1 -0
  27. package/src/generators/application/lib/add-linting.js +38 -0
  28. package/src/generators/application/lib/add-project.js +31 -15
  29. package/src/generators/application/lib/add-routing.js +1 -1
  30. package/src/generators/application/lib/bundlers/add-rspack.d.ts +0 -1
  31. package/src/generators/application/lib/bundlers/add-rspack.js +0 -18
  32. package/src/generators/application/lib/bundlers/add-vite.js +15 -6
  33. package/src/generators/application/lib/create-application-files.d.ts +61 -0
  34. package/src/generators/application/lib/create-application-files.js +81 -39
  35. package/src/generators/application/lib/get-app-tests.js +3 -3
  36. package/src/generators/application/lib/install-common-dependencies.js +13 -2
  37. package/src/generators/application/lib/normalize-options.d.ts +0 -2
  38. package/src/generators/application/lib/normalize-options.js +14 -20
  39. package/src/generators/application/schema.d.ts +5 -1
  40. package/src/generators/application/schema.json +10 -1
  41. package/src/generators/component-test/component-test.js +1 -1
  42. package/src/generators/cypress-component-configuration/lib/add-files.d.ts +1 -1
  43. package/src/generators/cypress-component-configuration/lib/add-files.js +7 -4
  44. package/src/generators/host/files/rspack-module-federation/rspack.config.js__tmpl__ +37 -13
  45. package/src/generators/host/files/rspack-module-federation/rspack.config.prod.js__tmpl__ +60 -32
  46. package/src/generators/host/files/rspack-module-federation-ssr/module-federation.server.config.js__tmpl__ +6 -0
  47. package/src/generators/host/files/rspack-module-federation-ssr/rspack.config.js__tmpl__ +66 -0
  48. package/src/generators/host/files/rspack-module-federation-ssr/server.ts__tmpl__ +1 -1
  49. package/src/generators/host/files/rspack-module-federation-ssr/src/main.server.tsx__tmpl__ +49 -0
  50. package/src/generators/host/files/rspack-module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ +6 -0
  51. package/src/generators/host/files/rspack-module-federation-ssr-ts/rspack.config.ts__tmpl__ +66 -0
  52. package/src/generators/host/files/rspack-module-federation-ssr-ts/server.ts__tmpl__ +1 -1
  53. package/src/generators/host/files/rspack-module-federation-ssr-ts/src/main.server.tsx__tmpl__ +49 -0
  54. package/src/generators/host/files/rspack-module-federation-ts/rspack.config.prod.ts__tmpl__ +37 -9
  55. package/src/generators/host/files/rspack-module-federation-ts/rspack.config.ts__tmpl__ +37 -14
  56. package/src/generators/host/host.js +21 -18
  57. package/src/generators/host/lib/add-module-federation-files.js +28 -12
  58. package/src/generators/host/lib/normalize-host-name.d.ts +2 -0
  59. package/src/generators/host/lib/normalize-host-name.js +12 -0
  60. package/src/generators/host/lib/setup-ssr-for-host.d.ts +3 -3
  61. package/src/generators/host/lib/setup-ssr-for-host.js +46 -22
  62. package/src/generators/init/init.js +23 -0
  63. package/src/generators/init/schema.d.ts +2 -0
  64. package/src/generators/library/lib/add-rollup-build-target.d.ts +3 -1
  65. package/src/generators/library/lib/add-rollup-build-target.js +6 -7
  66. package/src/generators/library/lib/create-files.js +2 -1
  67. package/src/generators/library/lib/normalize-options.js +8 -5
  68. package/src/generators/library/library.js +44 -30
  69. package/src/generators/library/schema.d.ts +2 -0
  70. package/src/generators/library/schema.json +8 -4
  71. package/src/generators/remote/files/rspack-module-federation/rspack.config.js__tmpl__ +40 -13
  72. package/src/generators/remote/files/rspack-module-federation-ssr/module-federation.server.config.js__tmpl__ +6 -0
  73. package/src/generators/remote/files/rspack-module-federation-ssr/rspack.config.js__tmpl__ +69 -0
  74. package/src/generators/remote/files/rspack-module-federation-ssr/server.ts__tmpl__ +2 -2
  75. package/src/generators/remote/files/rspack-module-federation-ssr/src/main.server.tsx__tmpl__ +45 -0
  76. package/src/generators/remote/files/rspack-module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ +6 -0
  77. package/src/generators/remote/files/rspack-module-federation-ssr-ts/rspack.config.ts__tmpl__ +69 -0
  78. package/src/generators/remote/files/rspack-module-federation-ssr-ts/server.ts__tmpl__ +2 -2
  79. package/src/generators/remote/files/rspack-module-federation-ssr-ts/src/main.server.tsx__tmpl__ +45 -0
  80. package/src/generators/remote/files/rspack-module-federation-ts/rspack.config.ts__tmpl__ +40 -13
  81. package/src/generators/remote/lib/setup-ssr-for-remote.d.ts +1 -1
  82. package/src/generators/remote/lib/setup-ssr-for-remote.js +37 -15
  83. package/src/generators/remote/remote.js +46 -30
  84. package/src/plugins/router-plugin.d.ts +10 -0
  85. package/src/plugins/router-plugin.js +221 -0
  86. package/src/rules/update-module-federation-project.d.ts +2 -1
  87. package/src/rules/update-module-federation-project.js +28 -47
  88. package/src/utils/assertion.d.ts +2 -0
  89. package/src/utils/assertion.js +6 -0
  90. package/src/utils/ast-utils.d.ts +1 -1
  91. package/src/utils/ast-utils.js +2 -2
  92. package/src/utils/ct-utils.d.ts +1 -1
  93. package/src/utils/versions.d.ts +6 -4
  94. package/src/utils/versions.js +9 -6
  95. package/src/generators/host/files/rspack-module-federation-ssr/rspack.server.config.js__tmpl__ +0 -16
  96. package/src/generators/host/files/rspack-module-federation-ssr-ts/rspack.server.config.ts__tmpl__ +0 -16
  97. package/src/generators/remote/files/rspack-module-federation-ssr/rspack.server.config.js__tmpl__ +0 -16
  98. package/src/generators/remote/files/rspack-module-federation-ssr-ts/rspack.server.config.ts__tmpl__ +0 -16
  99. package/src/utils/format-file.d.ts +0 -1
  100. package/src/utils/format-file.js +0 -11
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.svgrRollupVersion = exports.rollupPluginUrlVersion = exports.sassVersion = exports.lessVersion = exports.moduleFederationEnhancedVersion = exports.moduleFederationNodeVersion = exports.typesCorsVersion = exports.corsVersion = exports.isbotVersion = exports.typesExpressVersion = exports.expressVersion = exports.autoprefixerVersion = exports.tailwindcssVersion = exports.postcssVersion = exports.tsLibVersion = exports.babelPluginStyledComponentsVersion = exports.eslintPluginReactHooksVersion = exports.eslintPluginReactVersion = exports.eslintPluginJsxA11yVersion = exports.eslintPluginImportVersion = exports.reactReduxVersion = exports.reduxjsToolkitVersion = exports.testingLibraryDomVersion = exports.testingLibraryReactVersion = exports.reactRouterDomVersion = exports.styledJsxVersion = exports.emotionBabelPlugin = exports.emotionReactVersion = exports.emotionStyledVersion = exports.typesStyledComponentsVersion = exports.styledComponentsVersion = exports.babelCoreVersion = exports.babelPresetReactVersion = exports.typesNodeVersion = exports.reactViteVersion = exports.typesReactIsVersion = exports.typesReactIsV18Version = exports.typesReactDomVersion = exports.typesReactDomV18Version = exports.typesReactVersion = exports.typesReactV18Version = exports.babelLoaderVersion = exports.swcLoaderVersion = exports.reactIsV18Version = exports.reactIsVersion = exports.reactDomV18Version = exports.reactDomVersion = exports.reactV18Version = exports.reactVersion = exports.nxVersion = void 0;
4
- exports.swcPluginStyledComponentsVersion = exports.swcPluginEmotionVersion = exports.swcPluginStyledJsxVersion = void 0;
3
+ exports.sassVersion = exports.lessVersion = exports.moduleFederationEnhancedVersion = exports.moduleFederationNodeVersion = exports.typesCorsVersion = exports.corsVersion = exports.isbotVersion = exports.typesExpressVersion = exports.expressVersion = exports.autoprefixerVersion = exports.tailwindcssVersion = exports.postcssVersion = exports.tsLibVersion = exports.babelPluginStyledComponentsVersion = exports.eslintPluginReactHooksVersion = exports.eslintPluginReactVersion = exports.eslintPluginJsxA11yVersion = exports.eslintPluginImportVersion = exports.reactReduxVersion = exports.reduxjsToolkitVersion = exports.testingLibraryDomVersion = exports.testingLibraryReactVersion = exports.reactRouterIsBotVersion = exports.reactRouterVersion = exports.reactRouterDomVersion = exports.styledJsxVersion = exports.emotionBabelPlugin = exports.emotionReactVersion = exports.emotionStyledVersion = exports.typesStyledComponentsVersion = exports.styledComponentsVersion = exports.babelCoreVersion = exports.babelPresetReactVersion = exports.typesNodeVersion = exports.reactViteVersion = exports.typesReactIsVersion = exports.typesReactIsV18Version = exports.typesReactDomVersion = exports.typesReactDomV18Version = exports.typesReactVersion = exports.typesReactV18Version = exports.babelLoaderVersion = exports.swcLoaderVersion = exports.reactIsV18Version = exports.reactIsVersion = exports.reactDomV18Version = exports.reactDomVersion = exports.reactV18Version = exports.reactVersion = exports.nxVersion = void 0;
4
+ exports.swcPluginStyledComponentsVersion = exports.swcPluginEmotionVersion = exports.swcPluginStyledJsxVersion = exports.svgrRollupVersion = exports.rollupPluginUrlVersion = void 0;
5
5
  exports.nxVersion = require('../../package.json').version;
6
6
  exports.reactVersion = '19.0.0';
7
7
  exports.reactV18Version = '18.3.1';
@@ -18,7 +18,8 @@ exports.typesReactDomVersion = '19.0.0';
18
18
  exports.typesReactIsV18Version = '18.3.0';
19
19
  exports.typesReactIsVersion = '19.0.0';
20
20
  exports.reactViteVersion = '^4.2.0';
21
- exports.typesNodeVersion = '18.16.9';
21
+ // Needed for React-Router
22
+ exports.typesNodeVersion = '^20.0.0';
22
23
  exports.babelPresetReactVersion = '^7.14.5';
23
24
  exports.babelCoreVersion = '^7.14.5';
24
25
  exports.styledComponentsVersion = '5.3.6';
@@ -28,7 +29,9 @@ exports.emotionReactVersion = '11.11.1';
28
29
  exports.emotionBabelPlugin = '11.11.0';
29
30
  // WARNING: This needs to be in sync with Next.js' dependency or else there might be issues.
30
31
  exports.styledJsxVersion = '5.1.2';
31
- exports.reactRouterDomVersion = '6.11.2';
32
+ exports.reactRouterDomVersion = '6.29.0';
33
+ exports.reactRouterVersion = '^7.2.0';
34
+ exports.reactRouterIsBotVersion = '^4.4.0';
32
35
  exports.testingLibraryReactVersion = '16.1.0';
33
36
  exports.testingLibraryDomVersion = '10.4.0';
34
37
  exports.reduxjsToolkitVersion = '1.9.3';
@@ -48,8 +51,8 @@ exports.typesExpressVersion = '^4.17.21';
48
51
  exports.isbotVersion = '^3.6.5';
49
52
  exports.corsVersion = '~2.8.5';
50
53
  exports.typesCorsVersion = '~2.8.12';
51
- exports.moduleFederationNodeVersion = '^2.6.21';
52
- exports.moduleFederationEnhancedVersion = '^0.8.8';
54
+ exports.moduleFederationNodeVersion = '^2.6.26';
55
+ exports.moduleFederationEnhancedVersion = '^0.9.0';
53
56
  // style preprocessors
54
57
  exports.lessVersion = '3.12.2';
55
58
  exports.sassVersion = '^1.55.0';
@@ -1,16 +0,0 @@
1
- const {composePlugins, withNx, withReact} = require('@nx/rspack');
2
- const {withModuleFederationForSSR} = require('@nx/module-federation/rspack');
3
-
4
- const baseConfig = require('./module-federation.config');
5
-
6
- const defaultConfig = {
7
- ...baseConfig
8
- };
9
-
10
- // Nx plugins for rspack to build config object from Nx options and context.
11
- /**
12
- * DTS Plugin is disabled in Nx Workspaces as Nx already provides Typing support for Module Federation
13
- * The DTS Plugin can be enabled by setting dts: true
14
- * Learn more about the DTS Plugin here: https://module-federation.io/configure/dts.html
15
- */
16
- module.exports = composePlugins(withNx(), withReact({ssr: true}), withModuleFederationForSSR(defaultConfig, { dts: false }));
@@ -1,16 +0,0 @@
1
- import {composePlugins, withNx, withReact} from '@nx/rspack';
2
- import {withModuleFederationForSSR} from '@nx/module-federation/rspack';
3
-
4
- import baseConfig from './module-federation.config';
5
-
6
- const defaultConfig = {
7
- ...baseConfig
8
- };
9
-
10
- // Nx plugins for rspack to build config object from Nx options and context.
11
- /**
12
- * DTS Plugin is disabled in Nx Workspaces as Nx already provides Typing support for Module Federation
13
- * The DTS Plugin can be enabled by setting dts: true
14
- * Learn more about the DTS Plugin here: https://module-federation.io/configure/dts.html
15
- */
16
- export default composePlugins(withNx(), withReact({ssr: true}), withModuleFederationForSSR(defaultConfig, { dts: false }));
@@ -1,16 +0,0 @@
1
- const {composePlugins, withNx, withReact} = require('@nx/rspack');
2
- const {withModuleFederationForSSR} = require('@nx/module-federation/rspack');
3
-
4
- const baseConfig = require("./module-federation.server.config");
5
-
6
- const defaultConfig = {
7
- ...baseConfig,
8
- };
9
-
10
- // Nx plugins for rspack to build config object from Nx options and context.
11
- /**
12
- * DTS Plugin is disabled in Nx Workspaces as Nx already provides Typing support Module Federation
13
- * The DTS Plugin can be enabled by setting dts: true
14
- * Learn more about the DTS Plugin here: https://module-federation.io/configure/dts.html
15
- */
16
- module.exports = composePlugins(withNx(), withReact({ssr: true}), withModuleFederationForSSR(defaultConfig, { dts: false }));
@@ -1,16 +0,0 @@
1
- import {composePlugins, withNx, withReact} from '@nx/rspack';
2
- import {withModuleFederationForSSR} from '@nx/module-federation/rspack';
3
-
4
- import baseConfig from "./module-federation.server.config";
5
-
6
- const defaultConfig = {
7
- ...baseConfig,
8
- };
9
-
10
- // Nx plugins for rspack to build config object from Nx options and context.
11
- /**
12
- * DTS Plugin is disabled in Nx Workspaces as Nx already provides Typing support Module Federation
13
- * The DTS Plugin can be enabled by setting dts: true
14
- * Learn more about the DTS Plugin here: https://module-federation.io/configure/dts.html
15
- */
16
- export default composePlugins(withNx(), withReact({ssr: true}), withModuleFederationForSSR(defaultConfig, { dts: false }));
@@ -1 +0,0 @@
1
- export declare function formatFile(content: any, ...values: any[]): string;
@@ -1,11 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.formatFile = formatFile;
4
- const prettier_1 = require("prettier");
5
- const devkit_1 = require("@nx/devkit");
6
- function formatFile(content, ...values) {
7
- return (0, prettier_1.format)((0, devkit_1.stripIndents)(content, values), {
8
- singleQuote: true,
9
- parser: 'typescript',
10
- });
11
- }