@nx/react 21.0.0-beta.1 → 21.0.0-beta.10
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/migrations.json +0 -38
- package/package.json +6 -6
- package/plugins/nx-react-webpack-plugin/lib/apply-react-config.js +3 -1
- package/router-plugin.d.ts +1 -0
- package/router-plugin.js +5 -0
- package/src/executors/module-federation-dev-server/schema.json +1 -0
- package/src/executors/module-federation-ssr-dev-server/schema.json +1 -0
- package/src/executors/module-federation-static-server/schema.json +1 -0
- package/src/generators/application/application.js +52 -15
- package/src/generators/application/files/react-router-ssr/common/app/app-nav.tsx__tmpl__ +14 -0
- package/src/generators/application/files/react-router-ssr/common/app/entry.client.tsx__tmpl__ +18 -0
- package/src/generators/application/files/react-router-ssr/common/app/entry.server.tsx__tmpl__ +74 -0
- package/src/generators/application/files/react-router-ssr/common/app/root.tsx__tmpl__ +51 -0
- package/src/generators/application/files/react-router-ssr/common/app/routes/about.tsx__tmpl__ +7 -0
- package/src/generators/application/files/react-router-ssr/common/app/routes.tsx__tmpl__ +6 -0
- package/src/generators/application/files/react-router-ssr/common/public/favicon.ico +0 -0
- package/src/generators/application/files/react-router-ssr/common/react-router.config.ts__tmpl__ +5 -0
- package/src/generators/application/files/react-router-ssr/common/tests/routes/_index.spec.tsx__tmpl__ +16 -0
- package/src/generators/application/files/react-router-ssr/common/tsconfig.app.json__tmpl__ +23 -0
- package/src/generators/application/files/react-router-ssr/common/tsconfig.json__tmpl__ +27 -0
- package/src/generators/application/files/react-router-ssr/non-root/.gitignore__tmpl__ +5 -0
- package/src/generators/application/files/react-router-ssr/non-root/package.json__tmpl__ +24 -0
- package/src/generators/application/files/react-router-ssr/nx-welcome/claimed/app/nx-welcome.tsx__tmpl__ +866 -0
- package/src/generators/application/files/react-router-ssr/nx-welcome/not-configured/app/nx-welcome.tsx__tmpl__ +866 -0
- package/src/generators/application/files/react-router-ssr/nx-welcome/unclaimed/app/nx-welcome.tsx__tmpl__ +864 -0
- package/src/generators/application/files/react-router-ssr/ts-solution/package.json__tmpl__ +24 -0
- package/src/generators/application/files/react-router-ssr/ts-solution/tsconfig.app.json__tmpl__ +39 -0
- package/src/generators/application/lib/add-e2e.js +38 -71
- package/src/generators/application/lib/add-jest.js +26 -2
- package/src/generators/application/lib/add-linting.d.ts +1 -0
- package/src/generators/application/lib/add-linting.js +38 -0
- package/src/generators/application/lib/add-project.js +31 -15
- package/src/generators/application/lib/add-routing.js +1 -1
- package/src/generators/application/lib/bundlers/add-rspack.d.ts +0 -1
- package/src/generators/application/lib/bundlers/add-rspack.js +0 -18
- package/src/generators/application/lib/bundlers/add-vite.js +15 -6
- package/src/generators/application/lib/create-application-files.d.ts +61 -0
- package/src/generators/application/lib/create-application-files.js +81 -39
- package/src/generators/application/lib/get-app-tests.js +3 -3
- package/src/generators/application/lib/install-common-dependencies.js +13 -2
- package/src/generators/application/lib/normalize-options.d.ts +0 -2
- package/src/generators/application/lib/normalize-options.js +14 -20
- package/src/generators/application/schema.d.ts +5 -1
- package/src/generators/application/schema.json +10 -1
- package/src/generators/component-test/component-test.js +1 -1
- package/src/generators/cypress-component-configuration/lib/add-files.d.ts +1 -1
- package/src/generators/cypress-component-configuration/lib/add-files.js +7 -4
- package/src/generators/host/files/rspack-module-federation/rspack.config.js__tmpl__ +37 -13
- package/src/generators/host/files/rspack-module-federation/rspack.config.prod.js__tmpl__ +60 -32
- package/src/generators/host/files/rspack-module-federation-ssr/module-federation.server.config.js__tmpl__ +6 -0
- package/src/generators/host/files/rspack-module-federation-ssr/rspack.config.js__tmpl__ +66 -0
- package/src/generators/host/files/rspack-module-federation-ssr/server.ts__tmpl__ +1 -1
- package/src/generators/host/files/rspack-module-federation-ssr/src/main.server.tsx__tmpl__ +49 -0
- package/src/generators/host/files/rspack-module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ +6 -0
- package/src/generators/host/files/rspack-module-federation-ssr-ts/rspack.config.ts__tmpl__ +66 -0
- package/src/generators/host/files/rspack-module-federation-ssr-ts/server.ts__tmpl__ +1 -1
- package/src/generators/host/files/rspack-module-federation-ssr-ts/src/main.server.tsx__tmpl__ +49 -0
- package/src/generators/host/files/rspack-module-federation-ts/rspack.config.prod.ts__tmpl__ +37 -9
- package/src/generators/host/files/rspack-module-federation-ts/rspack.config.ts__tmpl__ +37 -14
- package/src/generators/host/host.js +21 -18
- package/src/generators/host/lib/add-module-federation-files.js +28 -12
- package/src/generators/host/lib/normalize-host-name.d.ts +2 -0
- package/src/generators/host/lib/normalize-host-name.js +12 -0
- package/src/generators/host/lib/setup-ssr-for-host.d.ts +3 -3
- package/src/generators/host/lib/setup-ssr-for-host.js +46 -22
- package/src/generators/init/init.js +23 -0
- package/src/generators/init/schema.d.ts +2 -0
- package/src/generators/library/lib/add-rollup-build-target.d.ts +3 -1
- package/src/generators/library/lib/add-rollup-build-target.js +6 -7
- package/src/generators/library/lib/create-files.js +2 -1
- package/src/generators/library/lib/normalize-options.js +8 -5
- package/src/generators/library/library.js +44 -30
- package/src/generators/library/schema.d.ts +2 -0
- package/src/generators/library/schema.json +8 -4
- package/src/generators/remote/files/rspack-module-federation/rspack.config.js__tmpl__ +40 -13
- package/src/generators/remote/files/rspack-module-federation-ssr/module-federation.server.config.js__tmpl__ +6 -0
- package/src/generators/remote/files/rspack-module-federation-ssr/rspack.config.js__tmpl__ +69 -0
- package/src/generators/remote/files/rspack-module-federation-ssr/server.ts__tmpl__ +2 -2
- package/src/generators/remote/files/rspack-module-federation-ssr/src/main.server.tsx__tmpl__ +45 -0
- package/src/generators/remote/files/rspack-module-federation-ssr-ts/module-federation.server.config.ts__tmpl__ +6 -0
- package/src/generators/remote/files/rspack-module-federation-ssr-ts/rspack.config.ts__tmpl__ +69 -0
- package/src/generators/remote/files/rspack-module-federation-ssr-ts/server.ts__tmpl__ +2 -2
- package/src/generators/remote/files/rspack-module-federation-ssr-ts/src/main.server.tsx__tmpl__ +45 -0
- package/src/generators/remote/files/rspack-module-federation-ts/rspack.config.ts__tmpl__ +40 -13
- package/src/generators/remote/lib/setup-ssr-for-remote.d.ts +1 -1
- package/src/generators/remote/lib/setup-ssr-for-remote.js +37 -15
- package/src/generators/remote/remote.js +46 -30
- package/src/plugins/router-plugin.d.ts +10 -0
- package/src/plugins/router-plugin.js +221 -0
- package/src/rules/update-module-federation-project.d.ts +2 -1
- package/src/rules/update-module-federation-project.js +28 -47
- package/src/utils/assertion.d.ts +2 -0
- package/src/utils/assertion.js +6 -0
- package/src/utils/ast-utils.d.ts +1 -1
- package/src/utils/ast-utils.js +2 -2
- package/src/utils/ct-utils.d.ts +1 -1
- package/src/utils/versions.d.ts +6 -4
- package/src/utils/versions.js +9 -6
- package/src/generators/host/files/rspack-module-federation-ssr/rspack.server.config.js__tmpl__ +0 -16
- package/src/generators/host/files/rspack-module-federation-ssr-ts/rspack.server.config.ts__tmpl__ +0 -16
- package/src/generators/remote/files/rspack-module-federation-ssr/rspack.server.config.js__tmpl__ +0 -16
- package/src/generators/remote/files/rspack-module-federation-ssr-ts/rspack.server.config.ts__tmpl__ +0 -16
- package/src/migrations/update-18-1-1/fix-target-defaults-inputs.d.ts +0 -2
- package/src/migrations/update-18-1-1/fix-target-defaults-inputs.js +0 -53
- package/src/utils/format-file.d.ts +0 -1
- package/src/utils/format-file.js +0 -11
package/src/utils/versions.js
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
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
|
-
|
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.
|
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.
|
52
|
-
exports.moduleFederationEnhancedVersion = '^0.
|
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';
|
package/src/generators/host/files/rspack-module-federation-ssr/rspack.server.config.js__tmpl__
DELETED
@@ -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 }));
|
package/src/generators/host/files/rspack-module-federation-ssr-ts/rspack.server.config.ts__tmpl__
DELETED
@@ -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 }));
|
package/src/generators/remote/files/rspack-module-federation-ssr/rspack.server.config.js__tmpl__
DELETED
@@ -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 }));
|
package/src/generators/remote/files/rspack-module-federation-ssr-ts/rspack.server.config.ts__tmpl__
DELETED
@@ -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,53 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.default = default_1;
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
5
|
-
async function default_1(tree) {
|
6
|
-
if (!hasModuleFederationProject(tree)) {
|
7
|
-
return;
|
8
|
-
}
|
9
|
-
ensureTargetDefaultsContainProductionInputs(tree);
|
10
|
-
await (0, devkit_1.formatFiles)(tree);
|
11
|
-
}
|
12
|
-
function ensureTargetDefaultsContainProductionInputs(tree) {
|
13
|
-
const nxJson = (0, devkit_1.readNxJson)(tree);
|
14
|
-
const webpackExecutor = '@nx/webpack:webpack';
|
15
|
-
const mfEnvVar = 'NX_MF_DEV_SERVER_STATIC_REMOTES';
|
16
|
-
nxJson.targetDefaults[webpackExecutor] ??= {};
|
17
|
-
nxJson.targetDefaults[webpackExecutor].inputs ??= [
|
18
|
-
'production',
|
19
|
-
'^production',
|
20
|
-
{ env: mfEnvVar },
|
21
|
-
];
|
22
|
-
if (!nxJson.targetDefaults[webpackExecutor].inputs.includes('production')) {
|
23
|
-
nxJson.targetDefaults[webpackExecutor].inputs.push('production');
|
24
|
-
}
|
25
|
-
if (!nxJson.targetDefaults[webpackExecutor].inputs.includes('^production')) {
|
26
|
-
nxJson.targetDefaults[webpackExecutor].inputs.push('^production');
|
27
|
-
}
|
28
|
-
let mfEnvVarExists = false;
|
29
|
-
for (const input of nxJson.targetDefaults[webpackExecutor].inputs) {
|
30
|
-
if (typeof input === 'object' && input['env'] === mfEnvVar) {
|
31
|
-
mfEnvVarExists = true;
|
32
|
-
break;
|
33
|
-
}
|
34
|
-
}
|
35
|
-
if (!mfEnvVarExists) {
|
36
|
-
nxJson.targetDefaults[webpackExecutor].inputs.push({ env: mfEnvVar });
|
37
|
-
}
|
38
|
-
(0, devkit_1.updateNxJson)(tree, nxJson);
|
39
|
-
}
|
40
|
-
function hasModuleFederationProject(tree) {
|
41
|
-
const projects = (0, devkit_1.getProjects)(tree);
|
42
|
-
for (const project of projects.values()) {
|
43
|
-
const targets = project.targets || {};
|
44
|
-
for (const [_, target] of Object.entries(targets)) {
|
45
|
-
if (target.executor === '@nx/webpack:webpack' &&
|
46
|
-
(tree.exists((0, devkit_1.joinPathFragments)(project.root, 'module-federation.config.ts')) ||
|
47
|
-
tree.exists((0, devkit_1.joinPathFragments)(project.root, 'module-federation.config.js')))) {
|
48
|
-
return true;
|
49
|
-
}
|
50
|
-
}
|
51
|
-
}
|
52
|
-
return false;
|
53
|
-
}
|
@@ -1 +0,0 @@
|
|
1
|
-
export declare function formatFile(content: any, ...values: any[]): string;
|
package/src/utils/format-file.js
DELETED
@@ -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
|
-
}
|