@nx/rspack 23.2.0-beta.4 → 23.2.0-beta.6
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/dist/src/executors/module-federation-static-server/module-federation-static-server.impl.d.ts +1 -1
- package/dist/src/generators/convert-to-inferred/convert-to-inferred.d.ts +1 -2
- package/dist/src/generators/convert-to-inferred/convert-to-inferred.js +2 -3
- package/dist/src/plugins/plugin.js +8 -11
- package/dist/src/plugins/use-legacy-nx-plugin/use-legacy-nx-plugin.js +2 -2
- package/dist/src/plugins/utils/plugins/rspack-nx-build-coordination-plugin.js +8 -9
- package/dist/src/utils/config.js +2 -2
- package/dist/src/utils/read-rspack-options.js +2 -2
- package/package.json +8 -8
package/dist/src/executors/module-federation-static-server/module-federation-static-server.impl.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { ExecutorContext } from '@nx/devkit';
|
|
1
2
|
import { StaticRemotesConfig } from '@nx/module-federation/internal';
|
|
2
|
-
import { ExecutorContext } from 'nx/src/config/misc-interfaces';
|
|
3
3
|
import { ModuleFederationDevServerOptions } from '../module-federation-dev-server/schema';
|
|
4
4
|
import { ModuleFederationStaticServerSchema } from './schema';
|
|
5
5
|
export declare function startProxies(staticRemotesConfig: StaticRemotesConfig, hostServeOptions: ModuleFederationDevServerOptions, mappedLocationOfHost: string, mappedLocationsOfRemotes: Record<string, string>, sslOptions?: {
|
|
@@ -8,7 +8,6 @@ const tsquery_1 = require("@phenomnomnominal/tsquery");
|
|
|
8
8
|
const plugin_1 = require("../../plugins/plugin");
|
|
9
9
|
const versions_1 = require("../../utils/versions");
|
|
10
10
|
const utils_1 = require("./utils");
|
|
11
|
-
const devkit_exports_1 = require("nx/src/devkit-exports");
|
|
12
11
|
const assert_supported_rspack_version_1 = require("../../utils/assert-supported-rspack-version");
|
|
13
12
|
async function convertToInferred(tree, options) {
|
|
14
13
|
(0, assert_supported_rspack_version_1.assertSupportedRspackVersion)(tree);
|
|
@@ -97,12 +96,12 @@ function createCollectingLogger() {
|
|
|
97
96
|
loggedMessages.forEach((messages, method) => {
|
|
98
97
|
messages.forEach((message) => {
|
|
99
98
|
if (!filter || filter(message)) {
|
|
100
|
-
|
|
99
|
+
devkit_1.logger[method](message);
|
|
101
100
|
}
|
|
102
101
|
});
|
|
103
102
|
});
|
|
104
103
|
};
|
|
105
|
-
return new Proxy({ ...
|
|
104
|
+
return new Proxy({ ...devkit_1.logger, loggedMessages, flushLogs }, {
|
|
106
105
|
get(target, property) {
|
|
107
106
|
const originalMethod = target[property];
|
|
108
107
|
if (typeof originalMethod === 'function') {
|
|
@@ -6,9 +6,6 @@ const devkit_1 = require("@nx/devkit");
|
|
|
6
6
|
const js_1 = require("@nx/js");
|
|
7
7
|
const internal_2 = require("@nx/js/internal");
|
|
8
8
|
const fs_1 = require("fs");
|
|
9
|
-
const file_hasher_1 = require("nx/src/hasher/file-hasher");
|
|
10
|
-
const cache_directory_1 = require("nx/src/utils/cache-directory");
|
|
11
|
-
const package_manager_1 = require("nx/src/utils/package-manager");
|
|
12
9
|
const path_1 = require("path");
|
|
13
10
|
const read_rspack_options_1 = require("../utils/read-rspack-options");
|
|
14
11
|
const resolve_user_defined_rspack_config_1 = require("../utils/resolve-user-defined-rspack-config");
|
|
@@ -20,12 +17,12 @@ const rspackConfigGlob = '**/rspack.config.{js,ts,mjs,mts,cjs,cts}';
|
|
|
20
17
|
exports.createNodes = [
|
|
21
18
|
rspackConfigGlob,
|
|
22
19
|
async (configFilePaths, options, context) => {
|
|
23
|
-
const optionsHash = (0,
|
|
24
|
-
const cachePath = (0, path_1.join)(
|
|
20
|
+
const optionsHash = (0, internal_1.hashObject)(options);
|
|
21
|
+
const cachePath = (0, path_1.join)(internal_1.workspaceDataDirectory, `rspack-${optionsHash}.hash`);
|
|
25
22
|
const targetsCache = new internal_1.PluginCache(cachePath);
|
|
26
23
|
const isTsSolutionSetup = (0, internal_2.isUsingTsSolutionSetup)();
|
|
27
24
|
const packageManager = (0, devkit_1.detectPackageManager)(context.workspaceRoot);
|
|
28
|
-
const pmc = (0,
|
|
25
|
+
const pmc = (0, devkit_1.getPackageManagerCommand)(packageManager);
|
|
29
26
|
const lockFileName = (0, js_1.getLockFileName)(packageManager);
|
|
30
27
|
try {
|
|
31
28
|
return await (0, devkit_1.createNodesFromFiles)((configFile, options, context) => createNodesInternal(configFile, options, context, targetsCache, isTsSolutionSetup, pmc, lockFileName), configFilePaths, options, context);
|
|
@@ -52,12 +49,12 @@ async function createNodesInternal(configFilePath, options, context, targetsCach
|
|
|
52
49
|
packageJson = (0, devkit_1.readJsonFile)((0, path_1.join)(context.workspaceRoot, projectRoot, 'package.json'));
|
|
53
50
|
}
|
|
54
51
|
const normalizedOptions = normalizeOptions(options);
|
|
55
|
-
const lockFileHash = (0,
|
|
56
|
-
const nodeHash = (0,
|
|
57
|
-
(0,
|
|
52
|
+
const lockFileHash = (0, internal_1.hashFile)((0, path_1.join)(context.workspaceRoot, lockFileName)) ?? '';
|
|
53
|
+
const nodeHash = (0, devkit_1.hashArray)([
|
|
54
|
+
(0, internal_1.hashFile)((0, path_1.join)(context.workspaceRoot, configFilePath)),
|
|
58
55
|
lockFileHash,
|
|
59
|
-
(0,
|
|
60
|
-
(0,
|
|
56
|
+
(0, internal_1.hashObject)({ ...options, isTsSolutionSetup }),
|
|
57
|
+
(0, internal_1.hashObject)(packageJson),
|
|
61
58
|
]);
|
|
62
59
|
// We do not want to alter how the hash is calculated, so appending the config file path to the hash
|
|
63
60
|
// to prevent vite/vitest files overwriting the target cache created by the other
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.useLegacyNxPlugin = useLegacyNxPlugin;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const normalize_options_1 = require("../utils/plugins/normalize-options");
|
|
6
|
-
const
|
|
6
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
7
7
|
/**
|
|
8
8
|
* This function is used to wrap the legacy plugin function to be used with the `composePlugins` function.
|
|
9
9
|
* Initially the rspack config would be passed to the legacy plugin function and the options would be passed as a second argument.
|
|
@@ -44,7 +44,7 @@ async function useLegacyNxPlugin(fn, executorOptions) {
|
|
|
44
44
|
root: devkit_1.workspaceRoot,
|
|
45
45
|
projectGraph,
|
|
46
46
|
projectsConfigurations: (0, devkit_1.readProjectsConfigurationFromProjectGraph)(projectGraph),
|
|
47
|
-
nxJsonConfiguration: (0,
|
|
47
|
+
nxJsonConfiguration: (0, internal_1.readNxJsonFromDisk)(devkit_1.workspaceRoot),
|
|
48
48
|
target: project.data.targets[targetName],
|
|
49
49
|
targetName: targetName,
|
|
50
50
|
projectName: projectName,
|
|
@@ -2,9 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.RspackNxBuildCoordinationPlugin = void 0;
|
|
4
4
|
const child_process_1 = require("child_process");
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const output_1 = require("nx/src/utils/output");
|
|
5
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
6
|
+
const devkit_1 = require("@nx/devkit");
|
|
8
7
|
class RspackNxBuildCoordinationPlugin {
|
|
9
8
|
constructor(buildCmd, skipInitialBuild) {
|
|
10
9
|
this.buildCmd = buildCmd;
|
|
@@ -13,11 +12,11 @@ class RspackNxBuildCoordinationPlugin {
|
|
|
13
12
|
if (!skipInitialBuild) {
|
|
14
13
|
this.buildChangedProjects();
|
|
15
14
|
}
|
|
16
|
-
if ((0,
|
|
15
|
+
if ((0, devkit_1.isDaemonEnabled)()) {
|
|
17
16
|
this.startWatchingBuildableLibs();
|
|
18
17
|
}
|
|
19
18
|
else {
|
|
20
|
-
|
|
19
|
+
devkit_1.output.warn({
|
|
21
20
|
title: 'Nx Daemon is not enabled. Buildable libs will not be rebuilt on file changes.',
|
|
22
21
|
});
|
|
23
22
|
}
|
|
@@ -65,8 +64,8 @@ class RspackNxBuildCoordinationPlugin {
|
|
|
65
64
|
}
|
|
66
65
|
}
|
|
67
66
|
createFileWatcher() {
|
|
68
|
-
const runner = new
|
|
69
|
-
return
|
|
67
|
+
const runner = new internal_1.BatchFunctionRunner(() => this.buildChangedProjects());
|
|
68
|
+
return internal_1.daemonClient.registerFileWatcher({
|
|
70
69
|
watchProjects: 'all',
|
|
71
70
|
}, (err, { changedProjects, changedFiles }) => {
|
|
72
71
|
if (err === 'reconnecting') {
|
|
@@ -78,13 +77,13 @@ class RspackNxBuildCoordinationPlugin {
|
|
|
78
77
|
return;
|
|
79
78
|
}
|
|
80
79
|
else if (err === 'closed') {
|
|
81
|
-
|
|
80
|
+
devkit_1.output.error({
|
|
82
81
|
title: 'Failed to reconnect to daemon after multiple attempts',
|
|
83
82
|
});
|
|
84
83
|
process.exit(1);
|
|
85
84
|
}
|
|
86
85
|
else if (err) {
|
|
87
|
-
|
|
86
|
+
devkit_1.output.error({
|
|
88
87
|
title: `Watch error: ${err?.message ?? 'Unknown'}`,
|
|
89
88
|
});
|
|
90
89
|
}
|
package/dist/src/utils/config.js
CHANGED
|
@@ -6,8 +6,8 @@ exports.composePlugins = composePlugins;
|
|
|
6
6
|
exports.composePluginsSync = composePluginsSync;
|
|
7
7
|
const devkit_1 = require("@nx/devkit");
|
|
8
8
|
const internal_1 = require("@nx/js/internal");
|
|
9
|
-
const configuration_1 = require("nx/src/config/configuration");
|
|
10
9
|
const deprecation_1 = require("./deprecation");
|
|
10
|
+
const internal_2 = require("@nx/devkit/internal");
|
|
11
11
|
exports.nxRspackComposablePlugin = 'nxRspackComposablePlugin';
|
|
12
12
|
function isNxRspackComposablePlugin(a) {
|
|
13
13
|
return a?.[exports.nxRspackComposablePlugin] === true;
|
|
@@ -80,7 +80,7 @@ function ensureNxRspackExecutionContext(ctx) {
|
|
|
80
80
|
targetName,
|
|
81
81
|
configurationName,
|
|
82
82
|
projectsConfigurations: (0, devkit_1.readProjectsConfigurationFromProjectGraph)(projectGraph),
|
|
83
|
-
nxJsonConfiguration: (0,
|
|
83
|
+
nxJsonConfiguration: (0, internal_2.readNxJsonFromDisk)(devkit_1.workspaceRoot),
|
|
84
84
|
cwd: process.cwd(),
|
|
85
85
|
root: devkit_1.workspaceRoot,
|
|
86
86
|
isVerbose: process.env['NX_VERBOSE_LOGGING'] === 'true',
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.readRspackOptions = readRspackOptions;
|
|
4
4
|
const devkit_1 = require("@nx/devkit");
|
|
5
5
|
const config_1 = require("./config");
|
|
6
|
-
const
|
|
6
|
+
const internal_1 = require("@nx/devkit/internal");
|
|
7
7
|
/**
|
|
8
8
|
* Reads the Rspack options from a give Rspack configuration. The configuration can be:
|
|
9
9
|
* 1. A single standard config object
|
|
@@ -36,7 +36,7 @@ async function readRspackOptions(rspackConfig) {
|
|
|
36
36
|
root: devkit_1.workspaceRoot,
|
|
37
37
|
cwd: undefined,
|
|
38
38
|
isVerbose: false,
|
|
39
|
-
nxJsonConfiguration: (0,
|
|
39
|
+
nxJsonConfiguration: (0, internal_1.readNxJsonFromDisk)(devkit_1.workspaceRoot),
|
|
40
40
|
projectGraph: null,
|
|
41
41
|
projectsConfigurations: null,
|
|
42
42
|
},
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nx/rspack",
|
|
3
3
|
"description": "The Nx Plugin for Rspack contains executors and generators that support building applications using Rspack.",
|
|
4
|
-
"version": "23.2.0-beta.
|
|
4
|
+
"version": "23.2.0-beta.6",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist",
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
"css-loader": "^6.4.0",
|
|
134
134
|
"enquirer": "~2.3.6",
|
|
135
135
|
"express": "^4.21.2",
|
|
136
|
-
"http-proxy-middleware": "^3.0.
|
|
136
|
+
"http-proxy-middleware": "^3.0.7",
|
|
137
137
|
"less-loader": "^12.2.0",
|
|
138
138
|
"license-webpack-plugin": "^4.0.2",
|
|
139
139
|
"loader-utils": "^2.0.3",
|
|
@@ -152,14 +152,14 @@
|
|
|
152
152
|
"tslib": "^2.3.0",
|
|
153
153
|
"webpack": "5.105.2",
|
|
154
154
|
"webpack-node-externals": "^3.0.0",
|
|
155
|
-
"@nx/
|
|
156
|
-
"@nx/module-federation": "23.2.0-beta.
|
|
157
|
-
"@nx/
|
|
158
|
-
"@nx/
|
|
155
|
+
"@nx/devkit": "23.2.0-beta.6",
|
|
156
|
+
"@nx/module-federation": "23.2.0-beta.6",
|
|
157
|
+
"@nx/web": "23.2.0-beta.6",
|
|
158
|
+
"@nx/js": "23.2.0-beta.6"
|
|
159
159
|
},
|
|
160
160
|
"devDependencies": {
|
|
161
|
-
"nx": "23.2.0-beta.
|
|
162
|
-
"@nx/nest": "23.2.0-beta.
|
|
161
|
+
"nx": "23.2.0-beta.6",
|
|
162
|
+
"@nx/nest": "23.2.0-beta.6"
|
|
163
163
|
},
|
|
164
164
|
"peerDependencies": {
|
|
165
165
|
"@rspack/cli": "^1.0.0 || ^2.0.0",
|