@nx/react 0.0.0-pr-26816-51699f9 → 0.0.0-pr-22870-1e85c39
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/babel.d.ts +8 -4
- package/babel.js +17 -1
- package/migrations.json +2 -2
- package/package.json +6 -6
- package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js +0 -2
- package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js +0 -2
- package/src/module-federation/with-module-federation-ssr.js +0 -14
- package/src/module-federation/with-module-federation.js +0 -14
- package/src/utils/add-mf-env-to-inputs.js +1 -1
package/babel.d.ts
CHANGED
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
interface NxReactBabelOptions {
|
|
2
|
-
development?: boolean;
|
|
3
|
-
runtime?: string;
|
|
4
|
-
importSource?: string;
|
|
5
|
-
useBuiltIns?: boolean | string;
|
|
6
2
|
decorators?: {
|
|
7
3
|
decoratorsBeforeExport?: boolean;
|
|
8
4
|
legacy?: boolean;
|
|
9
5
|
};
|
|
6
|
+
development?: boolean;
|
|
7
|
+
importSource?: string;
|
|
10
8
|
loose?: boolean;
|
|
9
|
+
reactCompiler?: boolean | {
|
|
10
|
+
compilationMode?: string;
|
|
11
|
+
sources?: (filename: string) => boolean;
|
|
12
|
+
};
|
|
13
|
+
runtime?: string;
|
|
14
|
+
useBuiltIns?: boolean | string;
|
|
11
15
|
/** @deprecated Use `loose` option instead of `classProperties.loose`
|
|
12
16
|
*/
|
|
13
17
|
classProperties?: {
|
package/babel.js
CHANGED
|
@@ -8,7 +8,10 @@ module.exports = function (api, options) {
|
|
|
8
8
|
* pagesDir is set when being transpiled by Next.js
|
|
9
9
|
*/
|
|
10
10
|
const isNextJs = api.caller((caller) => caller?.pagesDir);
|
|
11
|
-
const presets = [
|
|
11
|
+
const presets = [
|
|
12
|
+
[require.resolve('@nx/js/babel'), options],
|
|
13
|
+
];
|
|
14
|
+
const plugins = [];
|
|
12
15
|
/**
|
|
13
16
|
* Next.js already includes the preset-react, and including it
|
|
14
17
|
* the second time here results in having two instances of this preset.
|
|
@@ -29,8 +32,21 @@ module.exports = function (api, options) {
|
|
|
29
32
|
}),
|
|
30
33
|
]);
|
|
31
34
|
}
|
|
35
|
+
if (options.reactCompiler) {
|
|
36
|
+
try {
|
|
37
|
+
const reactCompilerPlugin = require.resolve('babel-plugin-react-compiler');
|
|
38
|
+
plugins.push([
|
|
39
|
+
reactCompilerPlugin,
|
|
40
|
+
typeof options.reactCompiler !== 'boolean' ? options.reactCompiler : {},
|
|
41
|
+
]);
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
throw new Error(`Could not find "babel-plugin-react-compiler". Did you install it?`);
|
|
45
|
+
}
|
|
46
|
+
}
|
|
32
47
|
return {
|
|
33
48
|
presets,
|
|
49
|
+
plugins,
|
|
34
50
|
};
|
|
35
51
|
};
|
|
36
52
|
function getReactPresetOptions({ presetOptions, env, }) {
|
package/migrations.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/react",
|
|
3
|
-
"version": "0.0.0-pr-
|
|
3
|
+
"version": "0.0.0-pr-22870-1e85c39",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "The React plugin for Nx 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, Vitest, Playwright, 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.",
|
|
6
6
|
"repository": {
|
|
@@ -39,11 +39,11 @@
|
|
|
39
39
|
"minimatch": "9.0.3",
|
|
40
40
|
"tslib": "^2.3.0",
|
|
41
41
|
"@module-federation/enhanced": "~0.2.3",
|
|
42
|
-
"@nx/devkit": "0.0.0-pr-
|
|
43
|
-
"@nx/js": "0.0.0-pr-
|
|
44
|
-
"@nx/eslint": "0.0.0-pr-
|
|
45
|
-
"@nx/web": "0.0.0-pr-
|
|
46
|
-
"@nrwl/react": "0.0.0-pr-
|
|
42
|
+
"@nx/devkit": "0.0.0-pr-22870-1e85c39",
|
|
43
|
+
"@nx/js": "0.0.0-pr-22870-1e85c39",
|
|
44
|
+
"@nx/eslint": "0.0.0-pr-22870-1e85c39",
|
|
45
|
+
"@nx/web": "0.0.0-pr-22870-1e85c39",
|
|
46
|
+
"@nrwl/react": "0.0.0-pr-22870-1e85c39"
|
|
47
47
|
},
|
|
48
48
|
"publishConfig": {
|
|
49
49
|
"access": "public"
|
|
@@ -188,8 +188,6 @@ async function* moduleFederationDevServer(options, context) {
|
|
|
188
188
|
projectGraph: context.projectGraph,
|
|
189
189
|
root: context.root,
|
|
190
190
|
}, pathToManifestFile);
|
|
191
|
-
// Set NX_MF_DEV_REMOTES for the Nx Runtime Library Control Plugin
|
|
192
|
-
process.env.NX_MF_DEV_REMOTES = JSON.stringify(remotes.devRemotes.map((r) => (typeof r === 'string' ? r : r.remoteName)));
|
|
193
191
|
if (remotes.devRemotes.length > 0 && !initialStaticRemotesPorts) {
|
|
194
192
|
options.staticRemotesPort = options.devRemotes.reduce((portToUse, r) => {
|
|
195
193
|
const remoteName = typeof r === 'string' ? r : r.remoteName;
|
package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js
CHANGED
|
@@ -65,8 +65,6 @@ async function* moduleFederationSsrDevServer(options, context) {
|
|
|
65
65
|
: Array.isArray(options.devRemotes)
|
|
66
66
|
? options.devRemotes
|
|
67
67
|
: [options.devRemotes];
|
|
68
|
-
// Set NX_MF_DEV_REMOTES for the Nx Runtime Library Control Plugin
|
|
69
|
-
process.env.NX_MF_DEV_REMOTES = JSON.stringify(devServeApps);
|
|
70
68
|
for (const app of knownRemotes) {
|
|
71
69
|
const [appName] = Array.isArray(app) ? app : [app];
|
|
72
70
|
const isDev = devServeApps.includes(appName);
|
|
@@ -6,7 +6,6 @@ async function withModuleFederationForSSR(options, configOverride) {
|
|
|
6
6
|
if (global.NX_GRAPH_CREATION) {
|
|
7
7
|
return (config) => config;
|
|
8
8
|
}
|
|
9
|
-
options.useNxLibraryControlPlugin ??= true;
|
|
10
9
|
const { sharedLibraries, sharedDependencies, mappedRemotes } = await (0, utils_1.getModuleFederationConfig)(options, {
|
|
11
10
|
isServer: true,
|
|
12
11
|
});
|
|
@@ -32,20 +31,7 @@ async function withModuleFederationForSSR(options, configOverride) {
|
|
|
32
31
|
* Apply user-defined config overrides
|
|
33
32
|
*/
|
|
34
33
|
...(configOverride ? configOverride : {}),
|
|
35
|
-
runtimePlugins: process.env.NX_MF_DEV_REMOTES && options.useNxLibraryControlPlugin
|
|
36
|
-
? [
|
|
37
|
-
...(configOverride?.runtimePlugins ?? []),
|
|
38
|
-
require.resolve('@nx/webpack/src/utils/module-federation/plugins/runtime-library-control.plugin.js'),
|
|
39
|
-
]
|
|
40
|
-
: configOverride?.runtimePlugins,
|
|
41
34
|
}, {}), sharedLibraries.getReplacementPlugin());
|
|
42
|
-
if (process.env.NX_MF_DEV_REMOTES && options.useNxLibraryControlPlugin) {
|
|
43
|
-
// The env var is only set from the module-federation-dev-server
|
|
44
|
-
// Attach the runtime plugin
|
|
45
|
-
config.plugins.push(new (require('webpack').DefinePlugin)({
|
|
46
|
-
'process.env.NX_MF_DEV_REMOTES': process.env.NX_MF_DEV_REMOTES,
|
|
47
|
-
}));
|
|
48
|
-
}
|
|
49
35
|
return config;
|
|
50
36
|
};
|
|
51
37
|
}
|
|
@@ -12,7 +12,6 @@ async function withModuleFederation(options, configOverride) {
|
|
|
12
12
|
if (global.NX_GRAPH_CREATION) {
|
|
13
13
|
return (config) => config;
|
|
14
14
|
}
|
|
15
|
-
options.useNxLibraryControlPlugin ??= true;
|
|
16
15
|
const { sharedDependencies, sharedLibraries, mappedRemotes } = await (0, utils_1.getModuleFederationConfig)(options);
|
|
17
16
|
const isGlobal = isVarOrWindow(options.library?.type);
|
|
18
17
|
return (config, ctx) => {
|
|
@@ -53,20 +52,7 @@ async function withModuleFederation(options, configOverride) {
|
|
|
53
52
|
* Apply user-defined config overrides
|
|
54
53
|
*/
|
|
55
54
|
...(configOverride ? configOverride : {}),
|
|
56
|
-
runtimePlugins: process.env.NX_MF_DEV_REMOTES && options.useNxLibraryControlPlugin
|
|
57
|
-
? [
|
|
58
|
-
...(configOverride?.runtimePlugins ?? []),
|
|
59
|
-
require.resolve('@nx/webpack/src/utils/module-federation/plugins/runtime-library-control.plugin.js'),
|
|
60
|
-
]
|
|
61
|
-
: configOverride?.runtimePlugins,
|
|
62
55
|
}), sharedLibraries.getReplacementPlugin());
|
|
63
|
-
if (process.env.NX_MF_DEV_REMOTES && options.useNxLibraryControlPlugin) {
|
|
64
|
-
// The env var is only set from the module-federation-dev-server
|
|
65
|
-
// Attach the runtime plugin
|
|
66
|
-
config.plugins.push(new (require('webpack').DefinePlugin)({
|
|
67
|
-
'process.env.NX_MF_DEV_REMOTES': process.env.NX_MF_DEV_REMOTES,
|
|
68
|
-
}));
|
|
69
|
-
}
|
|
70
56
|
return config;
|
|
71
57
|
};
|
|
72
58
|
}
|
|
@@ -5,7 +5,7 @@ const devkit_1 = require("@nx/devkit");
|
|
|
5
5
|
function addMfEnvToTargetDefaultInputs(tree) {
|
|
6
6
|
const nxJson = (0, devkit_1.readNxJson)(tree);
|
|
7
7
|
const webpackExecutor = '@nx/webpack:webpack';
|
|
8
|
-
const mfEnvVar = '
|
|
8
|
+
const mfEnvVar = 'NX_MF_DEV_SERVER_STATIC_REMOTES';
|
|
9
9
|
nxJson.targetDefaults ??= {};
|
|
10
10
|
nxJson.targetDefaults[webpackExecutor] ??= {};
|
|
11
11
|
nxJson.targetDefaults[webpackExecutor].inputs ??= [
|