@nx/react 19.5.2 → 19.5.4
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/mf/dynamic-federation.d.ts +1 -0
- package/mf/dynamic-federation.js +5 -1
- package/package.json +6 -6
- package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js +10 -3
- package/src/generators/application/files/base-vite/index.html__tmpl__ +1 -1
- package/src/generators/application/lib/create-application-files.js +4 -1
- package/src/generators/host/host.js +1 -0
- package/src/generators/host/schema.d.ts +1 -0
- package/src/generators/host/schema.json +6 -0
- package/src/generators/remote/schema.d.ts +1 -0
- package/src/generators/remote/schema.json +6 -0
- package/src/utils/versions.d.ts +1 -1
- package/src/utils/versions.js +1 -1
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export type ResolveRemoteUrlFunction = (remoteName: string) => string | Promise<string>;
|
|
2
2
|
export declare function setRemoteUrlResolver(_resolveRemoteUrl: ResolveRemoteUrlFunction): void;
|
|
3
3
|
export declare function setRemoteDefinitions(definitions: Record<string, string>): void;
|
|
4
|
+
export declare function setRemoteDefinition(remoteName: string, remoteUrl: string): void;
|
|
4
5
|
export declare function loadRemoteModule(remoteName: string, moduleName: string): Promise<any>;
|
package/mf/dynamic-federation.js
CHANGED
|
@@ -2,8 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.setRemoteUrlResolver = setRemoteUrlResolver;
|
|
4
4
|
exports.setRemoteDefinitions = setRemoteDefinitions;
|
|
5
|
+
exports.setRemoteDefinition = setRemoteDefinition;
|
|
5
6
|
exports.loadRemoteModule = loadRemoteModule;
|
|
6
|
-
let remoteUrlDefinitions;
|
|
7
|
+
let remoteUrlDefinitions = {};
|
|
7
8
|
let resolveRemoteUrl;
|
|
8
9
|
const remoteModuleMap = new Map();
|
|
9
10
|
const remoteContainerMap = new Map();
|
|
@@ -14,6 +15,9 @@ function setRemoteUrlResolver(_resolveRemoteUrl) {
|
|
|
14
15
|
function setRemoteDefinitions(definitions) {
|
|
15
16
|
remoteUrlDefinitions = definitions;
|
|
16
17
|
}
|
|
18
|
+
function setRemoteDefinition(remoteName, remoteUrl) {
|
|
19
|
+
remoteUrlDefinitions[remoteName] = remoteUrl;
|
|
20
|
+
}
|
|
17
21
|
async function loadRemoteModule(remoteName, moduleName) {
|
|
18
22
|
const remoteModuleKey = `${remoteName}:${moduleName}`;
|
|
19
23
|
if (remoteModuleMap.has(remoteModuleKey)) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/react",
|
|
3
|
-
"version": "19.5.
|
|
3
|
+
"version": "19.5.4",
|
|
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": "19.5.
|
|
43
|
-
"@nx/js": "19.5.
|
|
44
|
-
"@nx/eslint": "19.5.
|
|
45
|
-
"@nx/web": "19.5.
|
|
46
|
-
"@nrwl/react": "19.5.
|
|
42
|
+
"@nx/devkit": "19.5.4",
|
|
43
|
+
"@nx/js": "19.5.4",
|
|
44
|
+
"@nx/eslint": "19.5.4",
|
|
45
|
+
"@nx/web": "19.5.4",
|
|
46
|
+
"@nrwl/react": "19.5.4"
|
|
47
47
|
},
|
|
48
48
|
"publishConfig": {
|
|
49
49
|
"access": "public"
|
|
@@ -104,7 +104,7 @@ async function buildStaticRemotes(staticRemotesConfig, nxBin, context, options)
|
|
|
104
104
|
mappedLocationOfRemotes[app] = `http${options.ssl ? 's' : ''}://${options.host}:${options.staticRemotesPort}/${staticRemotesConfig.config[app].urlSegment}`;
|
|
105
105
|
}
|
|
106
106
|
process.env.NX_MF_DEV_SERVER_STATIC_REMOTES = JSON.stringify(mappedLocationOfRemotes);
|
|
107
|
-
await new Promise((res) => {
|
|
107
|
+
await new Promise((res, rej) => {
|
|
108
108
|
const staticProcess = (0, node_child_process_1.fork)(nxBin, [
|
|
109
109
|
'run-many',
|
|
110
110
|
`--target=build`,
|
|
@@ -124,6 +124,11 @@ async function buildStaticRemotes(staticRemotesConfig, nxBin, context, options)
|
|
|
124
124
|
const ANSII_CODE_REGEX = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g;
|
|
125
125
|
const stdoutString = data.toString().replace(ANSII_CODE_REGEX, '');
|
|
126
126
|
stdoutStream.write(stdoutString);
|
|
127
|
+
// in addition to writing into the stdout stream, also show error directly in console
|
|
128
|
+
// so the error is easily discoverable. 'ERROR in' is the key word to search in webpack output.
|
|
129
|
+
if (stdoutString.includes('ERROR in')) {
|
|
130
|
+
devkit_1.logger.log(stdoutString);
|
|
131
|
+
}
|
|
127
132
|
if (stdoutString.includes('Successfully ran target build')) {
|
|
128
133
|
staticProcess.stdout.removeAllListeners('data');
|
|
129
134
|
devkit_1.logger.info(`NX Built ${staticRemotesConfig.remotes.length} static remotes`);
|
|
@@ -136,9 +141,11 @@ async function buildStaticRemotes(staticRemotesConfig, nxBin, context, options)
|
|
|
136
141
|
staticProcess.stdout.removeAllListeners('data');
|
|
137
142
|
staticProcess.stderr.removeAllListeners('data');
|
|
138
143
|
if (code !== 0) {
|
|
139
|
-
|
|
144
|
+
rej(`Remote failed to start. A complete log can be found in: ${remoteBuildLogFile}`);
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
res();
|
|
140
148
|
}
|
|
141
|
-
res();
|
|
142
149
|
});
|
|
143
150
|
process.on('SIGTERM', () => staticProcess.kill('SIGTERM'));
|
|
144
151
|
process.on('exit', () => staticProcess.kill('SIGTERM'));
|
|
@@ -34,6 +34,7 @@ function createApplicationFiles(host, options) {
|
|
|
34
34
|
const templateVariables = {
|
|
35
35
|
...(0, devkit_1.names)(options.name),
|
|
36
36
|
...options,
|
|
37
|
+
js: !!options.js, // Ensure this is defined in template
|
|
37
38
|
tmpl: '',
|
|
38
39
|
offsetFromRoot: (0, devkit_1.offsetFromRoot)(options.appProjectRoot),
|
|
39
40
|
appTests,
|
|
@@ -117,7 +118,9 @@ function createApplicationFiles(host, options) {
|
|
|
117
118
|
}
|
|
118
119
|
(0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, styleSolutionSpecificAppFiles), options.appProjectRoot, templateVariables);
|
|
119
120
|
if (options.js) {
|
|
120
|
-
(0, devkit_1.toJS)(host
|
|
121
|
+
(0, devkit_1.toJS)(host, {
|
|
122
|
+
useJsx: options.bundler === 'vite',
|
|
123
|
+
});
|
|
121
124
|
}
|
|
122
125
|
(0, create_ts_config_1.createTsConfig)(host, options.appProjectRoot, 'app', options, relativePathToRootTsConfig);
|
|
123
126
|
}
|
|
@@ -177,6 +177,12 @@
|
|
|
177
177
|
"type": "boolean",
|
|
178
178
|
"description": "Whether the module federation configuration and webpack configuration files should use TS. When --js is used, this flag is ignored.",
|
|
179
179
|
"default": true
|
|
180
|
+
},
|
|
181
|
+
"skipPackageJson": {
|
|
182
|
+
"description": "Do not add dependencies to `package.json`.",
|
|
183
|
+
"type": "boolean",
|
|
184
|
+
"default": false,
|
|
185
|
+
"x-priority": "internal"
|
|
180
186
|
}
|
|
181
187
|
},
|
|
182
188
|
"required": ["name"],
|
|
@@ -176,6 +176,12 @@
|
|
|
176
176
|
"type": "boolean",
|
|
177
177
|
"description": "Whether the module federation configuration and webpack configuration files should use TS. When --js is used, this flag is ignored.",
|
|
178
178
|
"default": true
|
|
179
|
+
},
|
|
180
|
+
"skipPackageJson": {
|
|
181
|
+
"description": "Do not add dependencies to `package.json`.",
|
|
182
|
+
"type": "boolean",
|
|
183
|
+
"default": false,
|
|
184
|
+
"x-priority": "internal"
|
|
179
185
|
}
|
|
180
186
|
},
|
|
181
187
|
"required": ["name"],
|
package/src/utils/versions.d.ts
CHANGED
|
@@ -36,7 +36,7 @@ export declare const typesExpressVersion = "4.17.17";
|
|
|
36
36
|
export declare const isbotVersion = "^3.6.5";
|
|
37
37
|
export declare const corsVersion = "~2.8.5";
|
|
38
38
|
export declare const typesCorsVersion = "~2.8.12";
|
|
39
|
-
export declare const moduleFederationNodeVersion = "
|
|
39
|
+
export declare const moduleFederationNodeVersion = "~2.4.0";
|
|
40
40
|
export declare const moduleFederationEnhancedVersion = "~0.2.3";
|
|
41
41
|
export declare const lessVersion = "3.12.2";
|
|
42
42
|
export declare const sassVersion = "^1.55.0";
|
package/src/utils/versions.js
CHANGED
|
@@ -42,7 +42,7 @@ exports.typesExpressVersion = '4.17.17';
|
|
|
42
42
|
exports.isbotVersion = '^3.6.5';
|
|
43
43
|
exports.corsVersion = '~2.8.5';
|
|
44
44
|
exports.typesCorsVersion = '~2.8.12';
|
|
45
|
-
exports.moduleFederationNodeVersion = '
|
|
45
|
+
exports.moduleFederationNodeVersion = '~2.4.0';
|
|
46
46
|
exports.moduleFederationEnhancedVersion = '~0.2.3';
|
|
47
47
|
// style preprocessors
|
|
48
48
|
exports.lessVersion = '3.12.2';
|