@nx/rspack 19.6.0 → 19.7.0
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/executors.json +15 -0
- package/migrations.json +17 -0
- package/module-federation.d.ts +1 -0
- package/module-federation.js +5 -0
- package/module-federation.js.map +1 -0
- package/package.json +9 -4
- package/src/executors/dev-server/dev-server.impl.d.ts +4 -1
- package/src/executors/dev-server/dev-server.impl.js +11 -11
- package/src/executors/dev-server/dev-server.impl.js.map +1 -1
- package/src/executors/dev-server/lib/get-dev-server-config.d.ts +4 -0
- package/src/executors/dev-server/lib/get-dev-server-config.js +71 -0
- package/src/executors/dev-server/lib/get-dev-server-config.js.map +1 -0
- package/src/executors/dev-server/lib/serve-path.d.ts +3 -0
- package/src/executors/dev-server/lib/serve-path.js +45 -0
- package/src/executors/dev-server/lib/serve-path.js.map +1 -0
- package/src/executors/dev-server/schema.d.ts +5 -1
- package/src/executors/dev-server/schema.json +30 -2
- package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.d.ts +19 -0
- package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js +230 -0
- package/src/executors/module-federation-dev-server/module-federation-dev-server.impl.js.map +1 -0
- package/src/executors/module-federation-dev-server/schema.json +100 -0
- package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.d.ts +21 -0
- package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js +209 -0
- package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js.map +1 -0
- package/src/executors/module-federation-ssr-dev-server/schema.json +82 -0
- package/src/executors/rspack/rspack.impl.js +3 -3
- package/src/executors/rspack/rspack.impl.js.map +1 -1
- package/src/executors/rspack/schema.d.ts +10 -1
- package/src/executors/rspack/schema.json +61 -7
- package/src/executors/ssr-dev-server/lib/wait-until-server-is-listening.d.ts +1 -0
- package/src/executors/ssr-dev-server/lib/wait-until-server-is-listening.js +40 -0
- package/src/executors/ssr-dev-server/lib/wait-until-server-is-listening.js.map +1 -0
- package/src/executors/ssr-dev-server/schema.d.ts +11 -0
- package/src/executors/ssr-dev-server/schema.json +39 -0
- package/src/executors/ssr-dev-server/ssr-dev-server.impl.d.ts +8 -0
- package/src/executors/ssr-dev-server/ssr-dev-server.impl.js +52 -0
- package/src/executors/ssr-dev-server/ssr-dev-server.impl.js.map +1 -0
- package/src/generators/application/application.js +2 -2
- package/src/generators/application/application.js.map +1 -1
- package/src/utils/create-compiler.d.ts +3 -1
- package/src/utils/create-compiler.js +12 -2
- package/src/utils/create-compiler.js.map +1 -1
- package/src/utils/module-federation/dependencies.d.ts +6 -0
- package/src/utils/module-federation/dependencies.js +58 -0
- package/src/utils/module-federation/dependencies.js.map +1 -0
- package/src/utils/module-federation/get-remotes-for-host.d.ts +16 -0
- package/src/utils/module-federation/get-remotes-for-host.js +103 -0
- package/src/utils/module-federation/get-remotes-for-host.js.map +1 -0
- package/src/utils/module-federation/index.d.ts +6 -0
- package/src/utils/module-federation/index.js +10 -0
- package/src/utils/module-federation/index.js.map +1 -0
- package/src/utils/module-federation/models/index.d.ts +47 -0
- package/src/utils/module-federation/models/index.js +3 -0
- package/src/utils/module-federation/models/index.js.map +1 -0
- package/src/utils/module-federation/package-json.d.ts +8 -0
- package/src/utils/module-federation/package-json.js +13 -0
- package/src/utils/module-federation/package-json.js.map +1 -0
- package/src/utils/module-federation/parse-static-remotes-config.d.ts +13 -0
- package/src/utils/module-federation/parse-static-remotes-config.js +35 -0
- package/src/utils/module-federation/parse-static-remotes-config.js.map +1 -0
- package/src/utils/module-federation/plugins/runtime-library-control.plugin.d.ts +3 -0
- package/src/utils/module-federation/plugins/runtime-library-control.plugin.js +55 -0
- package/src/utils/module-federation/plugins/runtime-library-control.plugin.js.map +1 -0
- package/src/utils/module-federation/public-api.d.ts +8 -0
- package/src/utils/module-federation/public-api.js +21 -0
- package/src/utils/module-federation/public-api.js.map +1 -0
- package/src/utils/module-federation/remotes.d.ts +19 -0
- package/src/utils/module-federation/remotes.js +78 -0
- package/src/utils/module-federation/remotes.js.map +1 -0
- package/src/utils/module-federation/secondary-entry-points.d.ts +12 -0
- package/src/utils/module-federation/secondary-entry-points.js +105 -0
- package/src/utils/module-federation/secondary-entry-points.js.map +1 -0
- package/src/utils/module-federation/share.d.ts +48 -0
- package/src/utils/module-federation/share.js +232 -0
- package/src/utils/module-federation/share.js.map +1 -0
- package/src/utils/module-federation/start-remote-proxies.d.ts +5 -0
- package/src/utils/module-federation/start-remote-proxies.js +46 -0
- package/src/utils/module-federation/start-remote-proxies.js.map +1 -0
- package/src/utils/module-federation/start-ssr-remote-proxies.d.ts +5 -0
- package/src/utils/module-federation/start-ssr-remote-proxies.js +60 -0
- package/src/utils/module-federation/start-ssr-remote-proxies.js.map +1 -0
- package/src/utils/module-federation/typescript.d.ts +4 -0
- package/src/utils/module-federation/typescript.js +53 -0
- package/src/utils/module-federation/typescript.js.map +1 -0
- package/src/utils/module-federation/with-module-federation/package-json.d.ts +8 -0
- package/src/utils/module-federation/with-module-federation/package-json.js +13 -0
- package/src/utils/module-federation/with-module-federation/package-json.js.map +1 -0
- package/src/utils/module-federation/with-module-federation/utils.d.ts +12 -0
- package/src/utils/module-federation/with-module-federation/utils.js +78 -0
- package/src/utils/module-federation/with-module-federation/utils.js.map +1 -0
- package/src/utils/module-federation/with-module-federation/with-module-federation-ssr.d.ts +3 -0
- package/src/utils/module-federation/with-module-federation/with-module-federation-ssr.js +42 -0
- package/src/utils/module-federation/with-module-federation/with-module-federation-ssr.js.map +1 -0
- package/src/utils/module-federation/with-module-federation/with-module-federation.d.ts +8 -0
- package/src/utils/module-federation/with-module-federation/with-module-federation.js +52 -0
- package/src/utils/module-federation/with-module-federation/with-module-federation.js.map +1 -0
- package/src/utils/versions.d.ts +3 -3
- package/src/utils/versions.js +3 -3
- package/src/utils/with-nx.js +41 -15
- package/src/utils/with-nx.js.map +1 -1
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 2,
|
|
3
|
+
"outputCapture": "direct-nodejs",
|
|
4
|
+
"title": "Rspack Module Federation Dev Server",
|
|
5
|
+
"description": "Serve a module federation application.",
|
|
6
|
+
"cli": "nx",
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"devRemotes": {
|
|
10
|
+
"type": "array",
|
|
11
|
+
"items": {
|
|
12
|
+
"oneOf": [
|
|
13
|
+
{
|
|
14
|
+
"type": "string"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"type": "object",
|
|
18
|
+
"properties": {
|
|
19
|
+
"remoteName": {
|
|
20
|
+
"type": "string"
|
|
21
|
+
},
|
|
22
|
+
"configuration": {
|
|
23
|
+
"type": "string"
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
"required": [
|
|
27
|
+
"remoteName"
|
|
28
|
+
],
|
|
29
|
+
"additionalProperties": false
|
|
30
|
+
}
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
"description": "List of remote applications to run in development mode (i.e. using serve target).",
|
|
34
|
+
"x-priority": "important"
|
|
35
|
+
},
|
|
36
|
+
"skipRemotes": {
|
|
37
|
+
"type": "array",
|
|
38
|
+
"items": {
|
|
39
|
+
"type": "string"
|
|
40
|
+
},
|
|
41
|
+
"description": "List of remote applications to not automatically serve, either statically or in development mode. This will not remove the remotes from the `module-federation.config` file, and therefore the application may still try to fetch these remotes.\nThis option is useful if you have other means for serving the `remote` application(s).\n**NOTE:** Remotes that are not in the workspace will be skipped automatically.",
|
|
42
|
+
"x-priority": "important"
|
|
43
|
+
},
|
|
44
|
+
"buildTarget": {
|
|
45
|
+
"type": "string",
|
|
46
|
+
"description": "Target which builds the application.",
|
|
47
|
+
"x-priority": "important"
|
|
48
|
+
},
|
|
49
|
+
"port": {
|
|
50
|
+
"type": "number",
|
|
51
|
+
"description": "Port to listen on.",
|
|
52
|
+
"default": 4200,
|
|
53
|
+
"x-priority": "important"
|
|
54
|
+
},
|
|
55
|
+
"host": {
|
|
56
|
+
"type": "string",
|
|
57
|
+
"description": "Host to listen on.",
|
|
58
|
+
"default": "localhost"
|
|
59
|
+
},
|
|
60
|
+
"ssl": {
|
|
61
|
+
"type": "boolean",
|
|
62
|
+
"description": "Serve using `HTTPS`.",
|
|
63
|
+
"default": false
|
|
64
|
+
},
|
|
65
|
+
"sslKey": {
|
|
66
|
+
"type": "string",
|
|
67
|
+
"description": "SSL key to use for serving `HTTPS`."
|
|
68
|
+
},
|
|
69
|
+
"sslCert": {
|
|
70
|
+
"type": "string",
|
|
71
|
+
"description": "SSL certificate to use for serving `HTTPS`."
|
|
72
|
+
},
|
|
73
|
+
"publicHost": {
|
|
74
|
+
"type": "string",
|
|
75
|
+
"description": "Public URL where the application will be served."
|
|
76
|
+
},
|
|
77
|
+
"static": {
|
|
78
|
+
"type": "boolean",
|
|
79
|
+
"description": "Whether to use a static file server instead of the rspack-dev-server. This should be used for remote applications that are also host applications."
|
|
80
|
+
},
|
|
81
|
+
"isInitialHost": {
|
|
82
|
+
"type": "boolean",
|
|
83
|
+
"description": "Whether the host that is running this executor is the first in the project tree to do so.",
|
|
84
|
+
"default": true,
|
|
85
|
+
"x-priority": "internal"
|
|
86
|
+
},
|
|
87
|
+
"parallel": {
|
|
88
|
+
"type": "number",
|
|
89
|
+
"description": "Max number of parallel processes for building static remotes"
|
|
90
|
+
},
|
|
91
|
+
"staticRemotesPort": {
|
|
92
|
+
"type": "number",
|
|
93
|
+
"description": "The port at which to serve the file-server for the static remotes."
|
|
94
|
+
},
|
|
95
|
+
"pathToManifestFile": {
|
|
96
|
+
"type": "string",
|
|
97
|
+
"description": "Path to a Module Federation manifest file (e.g. `my/path/to/module-federation.manifest.json`) containing the dynamic remote applications relative to the workspace root."
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
}
|
package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.d.ts
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ExecutorContext } from '@nx/devkit';
|
|
2
|
+
import { RspackSsrDevServerOptions } from '../ssr-dev-server/schema';
|
|
3
|
+
type ModuleFederationSsrDevServerOptions = RspackSsrDevServerOptions & {
|
|
4
|
+
devRemotes?: (string | {
|
|
5
|
+
remoteName: string;
|
|
6
|
+
configuration: string;
|
|
7
|
+
})[];
|
|
8
|
+
skipRemotes?: string[];
|
|
9
|
+
host: string;
|
|
10
|
+
pathToManifestFile?: string;
|
|
11
|
+
staticRemotesPort?: number;
|
|
12
|
+
parallel?: number;
|
|
13
|
+
ssl?: boolean;
|
|
14
|
+
sslKey?: string;
|
|
15
|
+
sslCert?: string;
|
|
16
|
+
isInitialHost?: boolean;
|
|
17
|
+
};
|
|
18
|
+
export default function moduleFederationSsrDevServer(ssrDevServerOptions: ModuleFederationSsrDevServerOptions, context: ExecutorContext): AsyncGenerator<{
|
|
19
|
+
success: boolean;
|
|
20
|
+
}, any, unknown>;
|
|
21
|
+
export {};
|
package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js
ADDED
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.default = moduleFederationSsrDevServer;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const devkit_1 = require("@nx/devkit");
|
|
6
|
+
const path_1 = require("path");
|
|
7
|
+
const module_federation_1 = require("../../utils/module-federation");
|
|
8
|
+
const ssr_dev_server_impl_1 = tslib_1.__importDefault(require("../ssr-dev-server/ssr-dev-server.impl"));
|
|
9
|
+
const async_iterable_1 = require("@nx/devkit/src/utils/async-iterable");
|
|
10
|
+
const child_process_1 = require("child_process");
|
|
11
|
+
const fs_1 = require("fs");
|
|
12
|
+
const parse_static_remotes_config_1 = require("../../utils/module-federation/parse-static-remotes-config");
|
|
13
|
+
const file_server_impl_1 = tslib_1.__importDefault(require("@nx/web/src/executors/file-server/file-server.impl"));
|
|
14
|
+
const wait_for_port_open_1 = require("@nx/web/src/utils/wait-for-port-open");
|
|
15
|
+
const cache_directory_1 = require("nx/src/utils/cache-directory");
|
|
16
|
+
const start_ssr_remote_proxies_1 = require("../../utils/module-federation/start-ssr-remote-proxies");
|
|
17
|
+
function normalizeOptions(options) {
|
|
18
|
+
var _a;
|
|
19
|
+
return Object.assign(Object.assign({}, options), { ssl: (_a = options.ssl) !== null && _a !== void 0 ? _a : false, sslCert: options.sslCert ? (0, path_1.join)(devkit_1.workspaceRoot, options.sslCert) : undefined, sslKey: options.sslKey ? (0, path_1.join)(devkit_1.workspaceRoot, options.sslKey) : undefined });
|
|
20
|
+
}
|
|
21
|
+
function getBuildOptions(buildTarget, context) {
|
|
22
|
+
const target = (0, devkit_1.parseTargetString)(buildTarget, context);
|
|
23
|
+
const buildOptions = (0, devkit_1.readTargetOptions)(target, context);
|
|
24
|
+
return Object.assign({}, buildOptions);
|
|
25
|
+
}
|
|
26
|
+
function startSsrStaticRemotesFileServer(ssrStaticRemotesConfig, context, options) {
|
|
27
|
+
if (ssrStaticRemotesConfig.remotes.length === 0) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
// The directories are usually generated with /browser and /server suffixes so we need to copy them to a common directory
|
|
31
|
+
const commonOutputDirectory = (0, path_1.join)(devkit_1.workspaceRoot, 'tmp/static-remotes');
|
|
32
|
+
for (const app of ssrStaticRemotesConfig.remotes) {
|
|
33
|
+
const remoteConfig = ssrStaticRemotesConfig.config[app];
|
|
34
|
+
(0, fs_1.cpSync)(remoteConfig.outputPath, (0, path_1.join)(commonOutputDirectory, remoteConfig.urlSegment), {
|
|
35
|
+
force: true,
|
|
36
|
+
recursive: true,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
const staticRemotesIter = (0, file_server_impl_1.default)({
|
|
40
|
+
cors: true,
|
|
41
|
+
watch: false,
|
|
42
|
+
staticFilePath: commonOutputDirectory,
|
|
43
|
+
parallel: false,
|
|
44
|
+
spa: false,
|
|
45
|
+
withDeps: false,
|
|
46
|
+
host: options.host,
|
|
47
|
+
port: options.staticRemotesPort,
|
|
48
|
+
ssl: options.ssl,
|
|
49
|
+
sslCert: options.sslCert,
|
|
50
|
+
sslKey: options.sslKey,
|
|
51
|
+
cacheSeconds: -1,
|
|
52
|
+
}, context);
|
|
53
|
+
return staticRemotesIter;
|
|
54
|
+
}
|
|
55
|
+
function startRemotes(remotes, context, options) {
|
|
56
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
57
|
+
var _a, _b;
|
|
58
|
+
const remoteIters = [];
|
|
59
|
+
const target = 'serve';
|
|
60
|
+
for (const app of remotes) {
|
|
61
|
+
const remoteProjectServeTarget = context.projectGraph.nodes[app].data.targets[target];
|
|
62
|
+
const isUsingModuleFederationSsrDevServerExecutor = remoteProjectServeTarget.executor.includes('module-federation-ssr-dev-server');
|
|
63
|
+
const configurationOverride = (_b = (_a = options.devRemotes) === null || _a === void 0 ? void 0 : _a.find((remote) => typeof remote !== 'string' && remote.remoteName === app)) === null || _b === void 0 ? void 0 : _b.configuration;
|
|
64
|
+
{
|
|
65
|
+
const defaultOverrides = Object.assign(Object.assign(Object.assign(Object.assign({}, (options.host ? { host: options.host } : {})), (options.ssl ? { ssl: options.ssl } : {})), (options.sslCert ? { sslCert: options.sslCert } : {})), (options.sslKey ? { sslKey: options.sslKey } : {}));
|
|
66
|
+
const overrides = Object.assign(Object.assign({ watch: true }, defaultOverrides), (isUsingModuleFederationSsrDevServerExecutor
|
|
67
|
+
? { isInitialHost: false }
|
|
68
|
+
: {}));
|
|
69
|
+
remoteIters.push(yield (0, devkit_1.runExecutor)({
|
|
70
|
+
project: app,
|
|
71
|
+
target,
|
|
72
|
+
configuration: configurationOverride !== null && configurationOverride !== void 0 ? configurationOverride : context.configurationName,
|
|
73
|
+
}, overrides, context));
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return remoteIters;
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
function buildSsrStaticRemotes(staticRemotesConfig, nxBin, context, options) {
|
|
80
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
81
|
+
if (!staticRemotesConfig.remotes.length) {
|
|
82
|
+
return;
|
|
83
|
+
}
|
|
84
|
+
devkit_1.logger.info(`Nx is building ${staticRemotesConfig.remotes.length} static remotes...`);
|
|
85
|
+
const mapLocationOfRemotes = {};
|
|
86
|
+
for (const remoteApp of staticRemotesConfig.remotes) {
|
|
87
|
+
mapLocationOfRemotes[remoteApp] = `http${options.ssl ? 's' : ''}://${options.host}:${options.staticRemotesPort}/${staticRemotesConfig.config[remoteApp].urlSegment}`;
|
|
88
|
+
}
|
|
89
|
+
yield new Promise((resolve) => {
|
|
90
|
+
const childProcess = (0, child_process_1.fork)(nxBin, [
|
|
91
|
+
'run-many',
|
|
92
|
+
'--target=server',
|
|
93
|
+
'--projects',
|
|
94
|
+
staticRemotesConfig.remotes.join(','),
|
|
95
|
+
...(context.configurationName
|
|
96
|
+
? [`--configuration=${context.configurationName}`]
|
|
97
|
+
: []),
|
|
98
|
+
...(options.parallel ? [`--parallel=${options.parallel}`] : []),
|
|
99
|
+
], {
|
|
100
|
+
cwd: context.root,
|
|
101
|
+
stdio: ['ignore', 'pipe', 'pipe', 'ipc'],
|
|
102
|
+
});
|
|
103
|
+
// Add a listener to the child process to capture the build log
|
|
104
|
+
const remoteBuildLogFile = (0, path_1.join)(cache_directory_1.workspaceDataDirectory,
|
|
105
|
+
// eslint-disable-next-line
|
|
106
|
+
`${new Date().toISOString().replace(/[:\.]/g, '_')}-build.log`);
|
|
107
|
+
const remoteBuildLogStream = (0, fs_1.createWriteStream)(remoteBuildLogFile);
|
|
108
|
+
childProcess.stdout.on('data', (data) => {
|
|
109
|
+
const ANSII_CODE_REGEX =
|
|
110
|
+
// eslint-disable-next-line no-control-regex
|
|
111
|
+
/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/g;
|
|
112
|
+
const stdoutString = data.toString().replace(ANSII_CODE_REGEX, '');
|
|
113
|
+
remoteBuildLogStream.write(stdoutString);
|
|
114
|
+
// in addition to writing into the stdout stream, also show error directly in console
|
|
115
|
+
// so the error is easily discoverable. 'ERROR in' is the key word to search in webpack output.
|
|
116
|
+
if (stdoutString.includes('ERROR in')) {
|
|
117
|
+
devkit_1.logger.log(stdoutString);
|
|
118
|
+
}
|
|
119
|
+
if (stdoutString.includes('Successfully ran target server')) {
|
|
120
|
+
childProcess.stdout.removeAllListeners('data');
|
|
121
|
+
devkit_1.logger.info(`Nx Built ${staticRemotesConfig.remotes.length} static remotes.`);
|
|
122
|
+
resolve();
|
|
123
|
+
}
|
|
124
|
+
});
|
|
125
|
+
process.on('SIGTERM', () => childProcess.kill('SIGTERM'));
|
|
126
|
+
process.on('exit', () => childProcess.kill('SIGTERM'));
|
|
127
|
+
});
|
|
128
|
+
return mapLocationOfRemotes;
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
function moduleFederationSsrDevServer(ssrDevServerOptions, context) {
|
|
132
|
+
return tslib_1.__asyncGenerator(this, arguments, function* moduleFederationSsrDevServer_1() {
|
|
133
|
+
var _a, _b, _c;
|
|
134
|
+
const options = normalizeOptions(ssrDevServerOptions);
|
|
135
|
+
// Force Node to resolve to look for the nx binary that is inside node_modules
|
|
136
|
+
const nxBin = require.resolve('nx/bin/nx');
|
|
137
|
+
const iter = (0, ssr_dev_server_impl_1.default)(options, context);
|
|
138
|
+
const projectConfig = context.projectsConfigurations.projects[context.projectName];
|
|
139
|
+
const buildOptions = getBuildOptions(options.browserTarget, context);
|
|
140
|
+
let pathToManifestFile = (0, path_1.join)(context.root, projectConfig.sourceRoot, 'assets/module-federation.manifest.json');
|
|
141
|
+
if (options.pathToManifestFile) {
|
|
142
|
+
const userPathToManifestFile = (0, path_1.join)(context.root, options.pathToManifestFile);
|
|
143
|
+
if (!(0, fs_1.existsSync)(userPathToManifestFile)) {
|
|
144
|
+
throw new Error(`The provided Module Federation manifest file path does not exist. Please check the file exists at "${userPathToManifestFile}".`);
|
|
145
|
+
}
|
|
146
|
+
else if ((0, path_1.extname)(userPathToManifestFile) !== '.json') {
|
|
147
|
+
throw new Error(`The Module Federation manifest file must be a JSON. Please ensure the file at ${userPathToManifestFile} is a JSON.`);
|
|
148
|
+
}
|
|
149
|
+
pathToManifestFile = userPathToManifestFile;
|
|
150
|
+
}
|
|
151
|
+
if (!options.isInitialHost) {
|
|
152
|
+
return yield tslib_1.__await(yield tslib_1.__await(yield* tslib_1.__asyncDelegator(tslib_1.__asyncValues(iter))));
|
|
153
|
+
}
|
|
154
|
+
const moduleFederationConfig = (0, module_federation_1.getModuleFederationConfig)(buildOptions.tsConfig, context.root, projectConfig.root, 'react');
|
|
155
|
+
const remoteNames = (_a = options.devRemotes) === null || _a === void 0 ? void 0 : _a.map((remote) => typeof remote === 'string' ? remote : remote.remoteName);
|
|
156
|
+
const remotes = (0, module_federation_1.getRemotes)(remoteNames, options.skipRemotes, moduleFederationConfig, {
|
|
157
|
+
projectName: context.projectName,
|
|
158
|
+
projectGraph: context.projectGraph,
|
|
159
|
+
root: context.root,
|
|
160
|
+
}, pathToManifestFile);
|
|
161
|
+
(_b = options.staticRemotesPort) !== null && _b !== void 0 ? _b : (options.staticRemotesPort = remotes.staticRemotePort);
|
|
162
|
+
process.env.NX_MF_DEV_REMOTES = JSON.stringify([
|
|
163
|
+
...((_c = remotes.devRemotes.map((r) => typeof r === 'string' ? r : r.remoteName)) !== null && _c !== void 0 ? _c : []),
|
|
164
|
+
projectConfig.name,
|
|
165
|
+
]);
|
|
166
|
+
const staticRemotesConfig = (0, parse_static_remotes_config_1.parseStaticSsrRemotesConfig)([...remotes.staticRemotes, ...remotes.dynamicRemotes], context);
|
|
167
|
+
const mappedLocationsOfStaticRemotes = yield tslib_1.__await(buildSsrStaticRemotes(staticRemotesConfig, nxBin, context, options));
|
|
168
|
+
const devRemoteIters = yield tslib_1.__await(startRemotes(remotes.devRemotes, context, options));
|
|
169
|
+
const staticRemotesIter = startSsrStaticRemotesFileServer(staticRemotesConfig, context, options);
|
|
170
|
+
(0, start_ssr_remote_proxies_1.startSsrRemoteProxies)(staticRemotesConfig, mappedLocationsOfStaticRemotes, options.ssl
|
|
171
|
+
? {
|
|
172
|
+
pathToCert: options.sslCert,
|
|
173
|
+
pathToKey: options.sslKey,
|
|
174
|
+
}
|
|
175
|
+
: undefined);
|
|
176
|
+
return yield tslib_1.__await(yield tslib_1.__await(yield* tslib_1.__asyncDelegator(tslib_1.__asyncValues((0, async_iterable_1.combineAsyncIterables)(iter, ...devRemoteIters, ...(staticRemotesIter ? [staticRemotesIter] : []), (0, async_iterable_1.createAsyncIterable)((_a) => tslib_1.__awaiter(this, [_a], void 0, function* ({ next, done }) {
|
|
177
|
+
var _b;
|
|
178
|
+
if (!options.isInitialHost) {
|
|
179
|
+
done();
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
if (remotes.remotePorts.length === 0) {
|
|
183
|
+
done();
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
try {
|
|
187
|
+
const host = (_b = options.host) !== null && _b !== void 0 ? _b : 'localhost';
|
|
188
|
+
const baseUrl = `http${options.ssl ? 's' : ''}://${host}:${options.port}`;
|
|
189
|
+
const portsToWaitFor = staticRemotesIter
|
|
190
|
+
? [options.staticRemotesPort, ...remotes.remotePorts]
|
|
191
|
+
: [...remotes.remotePorts];
|
|
192
|
+
yield Promise.all(portsToWaitFor.map((port) => (0, wait_for_port_open_1.waitForPortOpen)(port, {
|
|
193
|
+
retries: 480,
|
|
194
|
+
retryDelay: 2500,
|
|
195
|
+
host,
|
|
196
|
+
})));
|
|
197
|
+
devkit_1.logger.info(`Nx all ssr remotes have started, server ready at ${baseUrl}`);
|
|
198
|
+
next({ success: true, baseUrl });
|
|
199
|
+
}
|
|
200
|
+
catch (error) {
|
|
201
|
+
throw new Error(`Nx failed to start ssr remotes. Check above for errors.`);
|
|
202
|
+
}
|
|
203
|
+
finally {
|
|
204
|
+
done();
|
|
205
|
+
}
|
|
206
|
+
})))))));
|
|
207
|
+
});
|
|
208
|
+
}
|
|
209
|
+
//# sourceMappingURL=module-federation-ssr-dev-server.impl.js.map
|
package/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"module-federation-ssr-dev-server.impl.js","sourceRoot":"","sources":["../../../../../../packages/rspack/src/executors/module-federation-ssr-dev-server/module-federation-ssr-dev-server.impl.ts"],"names":[],"mappings":";;AAyPA,+CA4JC;;AArZD,uCAOoB;AACpB,+BAAqC;AACrC,qEAGuC;AAEvC,wGAAyE;AAEzE,wEAG6C;AAC7C,iDAAqC;AACrC,2BAA2D;AAE3D,2GAGmE;AAEnE,kHAAoF;AACpF,6EAAuE;AACvE,kEAAsE;AACtE,qGAA+F;AAsB/F,SAAS,gBAAgB,CACvB,OAA4C;;IAE5C,uCACK,OAAO,KACV,GAAG,EAAE,MAAA,OAAO,CAAC,GAAG,mCAAI,KAAK,EACzB,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,IAAA,WAAI,EAAC,sBAAa,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS,EAC3E,MAAM,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,IAAA,WAAI,EAAC,sBAAa,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,SAAS,IACxE;AACJ,CAAC;AAED,SAAS,eAAe,CAAC,WAAmB,EAAE,OAAwB;IACpE,MAAM,MAAM,GAAG,IAAA,0BAAiB,EAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IAEvD,MAAM,YAAY,GAAG,IAAA,0BAAiB,EAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAExD,yBACK,YAAY,EACf;AACJ,CAAC;AAED,SAAS,+BAA+B,CACtC,sBAA2C,EAC3C,OAAwB,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,OAAO,CAAC,WAAW,CAAC;oBACrD,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,WAAW,CAAC,CAAC;gBAE7B,MAAM,OAAO,CAAC,GAAG,CACf,cAAc,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAC1B,IAAA,oCAAe,EAAC,IAAI,EAAE;oBACpB,OAAO,EAAE,GAAG;oBACZ,UAAU,EAAE,IAAI;oBAChB,IAAI;iBACL,CAAC,CACH,CACF,CAAC;gBAEF,eAAM,CAAC,IAAI,CACT,oDAAoD,OAAO,EAAE,CAC9D,CAAC;gBACF,IAAI,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,CAAC;YACnC,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,MAAM,IAAI,KAAK,CACb,yDAAyD,CAC1D,CAAC;YACJ,CAAC;oBAAS,CAAC;gBACT,IAAI,EAAE,CAAC;YACT,CAAC;QACH,CAAC,CAAA,CACF,CACF,CAAA,CAAA,CAAA,EAAC;IACJ,CAAC;CAAA"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 2,
|
|
3
|
+
"outputCapture": "direct-nodejs",
|
|
4
|
+
"title": "Module Federation SSR Dev Server",
|
|
5
|
+
"description": "Serve a SSR host application along with its known remotes.",
|
|
6
|
+
"cli": "nx",
|
|
7
|
+
"type": "object",
|
|
8
|
+
"properties": {
|
|
9
|
+
"browserTarget": {
|
|
10
|
+
"type": "string",
|
|
11
|
+
"description": "Target which builds the browser application.",
|
|
12
|
+
"x-priority": "important"
|
|
13
|
+
},
|
|
14
|
+
"serverTarget": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"description": "Target which builds the server application.",
|
|
17
|
+
"x-priority": "important"
|
|
18
|
+
},
|
|
19
|
+
"port": {
|
|
20
|
+
"type": "number",
|
|
21
|
+
"description": "The port to be set on `process.env.PORT` for use in the server.",
|
|
22
|
+
"default": 4200,
|
|
23
|
+
"x-priority": "important"
|
|
24
|
+
},
|
|
25
|
+
"devRemotes": {
|
|
26
|
+
"type": "array",
|
|
27
|
+
"items": {
|
|
28
|
+
"type": "string"
|
|
29
|
+
},
|
|
30
|
+
"description": "List of remote applications to run in development mode (i.e. using serve target).",
|
|
31
|
+
"x-priority": "important"
|
|
32
|
+
},
|
|
33
|
+
"skipRemotes": {
|
|
34
|
+
"type": "array",
|
|
35
|
+
"items": {
|
|
36
|
+
"type": "string"
|
|
37
|
+
},
|
|
38
|
+
"description": "List of remote applications to not automatically serve, either statically or in development mode.",
|
|
39
|
+
"x-priority": "important"
|
|
40
|
+
},
|
|
41
|
+
"host": {
|
|
42
|
+
"type": "string",
|
|
43
|
+
"description": "Host to listen on.",
|
|
44
|
+
"default": "localhost"
|
|
45
|
+
},
|
|
46
|
+
"staticRemotesPort": {
|
|
47
|
+
"type": "number",
|
|
48
|
+
"description": "The port at which to serve the file-server for the static remotes."
|
|
49
|
+
},
|
|
50
|
+
"pathToManifestFile": {
|
|
51
|
+
"type": "string",
|
|
52
|
+
"description": "Path to a Module Federation manifest file (e.g. `my/path/to/module-federation.manifest.json`) containing the dynamic remote applications relative to the workspace root."
|
|
53
|
+
},
|
|
54
|
+
"ssl": {
|
|
55
|
+
"type": "boolean",
|
|
56
|
+
"description": "Serve using HTTPS.",
|
|
57
|
+
"default": false
|
|
58
|
+
},
|
|
59
|
+
"sslKey": {
|
|
60
|
+
"type": "string",
|
|
61
|
+
"description": "SSL key to use for serving HTTPS."
|
|
62
|
+
},
|
|
63
|
+
"sslCert": {
|
|
64
|
+
"type": "string",
|
|
65
|
+
"description": "SSL certificate to use for serving HTTPS."
|
|
66
|
+
},
|
|
67
|
+
"publicHost": {
|
|
68
|
+
"type": "string",
|
|
69
|
+
"description": "Public URL where the application will be served."
|
|
70
|
+
},
|
|
71
|
+
"isInitialHost": {
|
|
72
|
+
"type": "boolean",
|
|
73
|
+
"description": "Whether the host that is running this executor is the first in the project tree to do so.",
|
|
74
|
+
"default": true,
|
|
75
|
+
"x-priority": "internal"
|
|
76
|
+
}
|
|
77
|
+
},
|
|
78
|
+
"required": [
|
|
79
|
+
"browserTarget",
|
|
80
|
+
"serverTarget"
|
|
81
|
+
]
|
|
82
|
+
}
|
|
@@ -4,11 +4,11 @@ exports.default = runExecutor;
|
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const devkit_1 = require("@nx/devkit");
|
|
6
6
|
const async_iterable_1 = require("@nx/devkit/src/utils/async-iterable");
|
|
7
|
+
const js_1 = require("@nx/js");
|
|
7
8
|
const fs_1 = require("fs");
|
|
8
9
|
const path = tslib_1.__importStar(require("path"));
|
|
9
10
|
const create_compiler_1 = require("../../utils/create-compiler");
|
|
10
11
|
const mode_utils_1 = require("../../utils/mode-utils");
|
|
11
|
-
const js_1 = require("@nx/js");
|
|
12
12
|
function runExecutor(options, context) {
|
|
13
13
|
return tslib_1.__asyncGenerator(this, arguments, function* runExecutor_1() {
|
|
14
14
|
var _a, _b;
|
|
@@ -101,7 +101,7 @@ function registerCleanupCallback(callback) {
|
|
|
101
101
|
}
|
|
102
102
|
function executeTypeCheck(options, context) {
|
|
103
103
|
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
104
|
-
const projectConfiguration = context.
|
|
104
|
+
const projectConfiguration = context.projectGraph.nodes[context.projectName].data;
|
|
105
105
|
const result = yield (0, js_1.runTypeCheck)({
|
|
106
106
|
workspaceRoot: path.resolve(projectConfiguration.root),
|
|
107
107
|
tsConfigPath: options.tsConfig,
|
|
@@ -116,7 +116,7 @@ function executeTypeCheck(options, context) {
|
|
|
116
116
|
function getStatsOptions(compiler) {
|
|
117
117
|
return (0, create_compiler_1.isMultiCompiler)(compiler)
|
|
118
118
|
? {
|
|
119
|
-
children: compiler.compilers.map(compiler => compiler.options ? compiler.options.stats : undefined)
|
|
119
|
+
children: compiler.compilers.map((compiler) => compiler.options ? compiler.options.stats : undefined),
|
|
120
120
|
}
|
|
121
121
|
: compiler.options
|
|
122
122
|
? compiler.options.stats
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rspack.impl.js","sourceRoot":"","sources":["../../../../../../packages/rspack/src/executors/rspack/rspack.impl.ts"],"names":[],"mappings":";;AAUA,8BA0FC;;AApGD,uCAAqD;AACrD,wEAA0E;
|
|
1
|
+
{"version":3,"file":"rspack.impl.js","sourceRoot":"","sources":["../../../../../../packages/rspack/src/executors/rspack/rspack.impl.ts"],"names":[],"mappings":";;AAUA,8BA0FC;;AApGD,uCAAqD;AACrD,wEAA0E;AAC1E,+BAAwD;AAExD,2BAA4B;AAC5B,mDAA6B;AAC7B,iEAA8E;AAC9E,uDAAgD;AAGhD,SAA+B,WAAW,CACxC,OAA6B,EAC7B,OAAwB;;;;QAExB,YAAA,OAAO,CAAC,GAAG,EAAC,QAAQ,uCAAR,QAAQ,GAAK,MAAA,OAAO,CAAC,IAAI,mCAAI,YAAY,EAAC;QAEtD,IAAI,IAAA,mBAAM,EAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;YACjC,OAAO,CAAC,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC;QACtC,CAAC;QAED,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC;YACtB,sBAAM,gBAAgB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA,CAAC;QAC3C,CAAC;QAED,8BAA8B;QAC9B,IAAA,WAAM,EAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,UAAU,CAAC,EAAE;YAClD,KAAK,EAAE,IAAI;YACX,SAAS,EAAE,IAAI;SAChB,CAAC,CAAC;QAEH,MAAM,QAAQ,GAAG,sBAAM,IAAA,gCAAc,EAAC,OAAO,EAAE,OAAO,CAAC,CAAA,CAAC;QAExD,MAAM,QAAQ,GAAG,IAAA,oCAAmB,EAGjC,KAAuB,EAAE,kDAAlB,EAAE,IAAI,EAAE,IAAI,EAAE;YACtB,IA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QACH,CAAC,CAAC,QAAQ,CAAC,OAAO;YAClB,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK;YACxB,CAAC,CAAC,SAAS,CAAC;AAChB,CAAC"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { Mode } from '@rspack/core';
|
|
2
|
+
|
|
2
3
|
export interface RspackExecutorSchema {
|
|
3
4
|
target: 'web' | 'node';
|
|
4
5
|
main: string;
|
|
6
|
+
index?: string;
|
|
5
7
|
tsConfig: string;
|
|
6
8
|
typeCheck?: boolean;
|
|
7
9
|
outputPath: string;
|
|
@@ -9,9 +11,11 @@ export interface RspackExecutorSchema {
|
|
|
9
11
|
indexHtml?: string;
|
|
10
12
|
mode?: Mode;
|
|
11
13
|
watch?: boolean;
|
|
14
|
+
baseHref?: string;
|
|
15
|
+
deployUrl?: string;
|
|
12
16
|
|
|
13
17
|
rspackConfig: string;
|
|
14
|
-
optimization?: boolean;
|
|
18
|
+
optimization?: boolean | OptimizationOptions;
|
|
15
19
|
sourceMap?: boolean | string;
|
|
16
20
|
assets?: any[];
|
|
17
21
|
extractLicenses?: boolean;
|
|
@@ -23,3 +27,8 @@ export interface FileReplacement {
|
|
|
23
27
|
replace: string;
|
|
24
28
|
with: string;
|
|
25
29
|
}
|
|
30
|
+
|
|
31
|
+
export interface OptimizationOptions {
|
|
32
|
+
scripts: boolean;
|
|
33
|
+
styles: boolean;
|
|
34
|
+
}
|
|
@@ -8,7 +8,10 @@
|
|
|
8
8
|
"target": {
|
|
9
9
|
"type": "string",
|
|
10
10
|
"description": "The platform to target (e.g. web, node).",
|
|
11
|
-
"enum": [
|
|
11
|
+
"enum": [
|
|
12
|
+
"web",
|
|
13
|
+
"node"
|
|
14
|
+
]
|
|
12
15
|
},
|
|
13
16
|
"main": {
|
|
14
17
|
"type": "string",
|
|
@@ -34,13 +37,47 @@
|
|
|
34
37
|
"type": "string",
|
|
35
38
|
"description": "The path to the index.html file."
|
|
36
39
|
},
|
|
40
|
+
"index": {
|
|
41
|
+
"type": "string",
|
|
42
|
+
"description": "HTML File which will be contain the application.",
|
|
43
|
+
"x-completion-type": "file",
|
|
44
|
+
"x-completion-glob": "**/*@(.html|.htm)"
|
|
45
|
+
},
|
|
46
|
+
"baseHref": {
|
|
47
|
+
"type": "string",
|
|
48
|
+
"description": "Base url for the application being built."
|
|
49
|
+
},
|
|
50
|
+
"deployUrl": {
|
|
51
|
+
"type": "string",
|
|
52
|
+
"description": "URL where the application will be deployed."
|
|
53
|
+
},
|
|
37
54
|
"rspackConfig": {
|
|
38
55
|
"type": "string",
|
|
39
56
|
"description": "The path to the rspack config file."
|
|
40
57
|
},
|
|
41
58
|
"optimization": {
|
|
42
|
-
"
|
|
43
|
-
"
|
|
59
|
+
"description": "Enables optimization of the build output.",
|
|
60
|
+
"oneOf": [
|
|
61
|
+
{
|
|
62
|
+
"type": "object",
|
|
63
|
+
"properties": {
|
|
64
|
+
"scripts": {
|
|
65
|
+
"type": "boolean",
|
|
66
|
+
"description": "Enables optimization of the scripts output.",
|
|
67
|
+
"default": true
|
|
68
|
+
},
|
|
69
|
+
"styles": {
|
|
70
|
+
"type": "boolean",
|
|
71
|
+
"description": "Enables optimization of the styles output.",
|
|
72
|
+
"default": true
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
"additionalProperties": false
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"type": "boolean"
|
|
79
|
+
}
|
|
80
|
+
]
|
|
44
81
|
},
|
|
45
82
|
"sourceMap": {
|
|
46
83
|
"description": "Output sourcemaps. Use 'hidden' for use with error reporting tools without generating sourcemap comment.",
|
|
@@ -85,21 +122,34 @@
|
|
|
85
122
|
}
|
|
86
123
|
},
|
|
87
124
|
"additionalProperties": false,
|
|
88
|
-
"required": [
|
|
125
|
+
"required": [
|
|
126
|
+
"replace",
|
|
127
|
+
"with"
|
|
128
|
+
]
|
|
89
129
|
},
|
|
90
130
|
"default": []
|
|
91
131
|
},
|
|
92
132
|
"mode": {
|
|
93
133
|
"type": "string",
|
|
94
134
|
"description": "Mode to run the build in.",
|
|
95
|
-
"enum": [
|
|
135
|
+
"enum": [
|
|
136
|
+
"development",
|
|
137
|
+
"production",
|
|
138
|
+
"none"
|
|
139
|
+
]
|
|
96
140
|
},
|
|
97
141
|
"generatePackageJson": {
|
|
98
142
|
"type": "boolean",
|
|
99
143
|
"description": "Generates a `package.json` and pruned lock file with the project's `node_module` dependencies populated for installing in a container. If a `package.json` exists in the project's directory, it will be reused with dependencies populated."
|
|
100
144
|
}
|
|
101
145
|
},
|
|
102
|
-
"required": [
|
|
146
|
+
"required": [
|
|
147
|
+
"target",
|
|
148
|
+
"main",
|
|
149
|
+
"outputPath",
|
|
150
|
+
"tsConfig",
|
|
151
|
+
"rspackConfig"
|
|
152
|
+
],
|
|
103
153
|
"definitions": {
|
|
104
154
|
"assetPattern": {
|
|
105
155
|
"oneOf": [
|
|
@@ -132,7 +182,11 @@
|
|
|
132
182
|
}
|
|
133
183
|
},
|
|
134
184
|
"additionalProperties": false,
|
|
135
|
-
"required": [
|
|
185
|
+
"required": [
|
|
186
|
+
"glob",
|
|
187
|
+
"input",
|
|
188
|
+
"output"
|
|
189
|
+
]
|
|
136
190
|
},
|
|
137
191
|
{
|
|
138
192
|
"type": "string"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function waitUntilServerIsListening(port: number): Promise<void>;
|