@nx/rspack 20.5.0-beta.0 → 20.5.0-beta.1
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/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": "20.5.0-beta.
|
|
4
|
+
"version": "20.5.0-beta.1",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -24,10 +24,10 @@
|
|
|
24
24
|
"generators": "./generators.json",
|
|
25
25
|
"executors": "./executors.json",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@nx/js": "20.5.0-beta.
|
|
28
|
-
"@nx/devkit": "20.5.0-beta.
|
|
29
|
-
"@nx/web": "20.5.0-beta.
|
|
30
|
-
"@nx/module-federation": "20.5.0-beta.
|
|
27
|
+
"@nx/js": "20.5.0-beta.1",
|
|
28
|
+
"@nx/devkit": "20.5.0-beta.1",
|
|
29
|
+
"@nx/web": "20.5.0-beta.1",
|
|
30
|
+
"@nx/module-federation": "20.5.0-beta.1",
|
|
31
31
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
|
32
32
|
"@rspack/core": "^1.1.5",
|
|
33
33
|
"@rspack/dev-server": "^1.0.9",
|
|
@@ -6,7 +6,12 @@ const resolve_user_defined_rspack_config_1 = require("../../../utils/resolve-use
|
|
|
6
6
|
const with_nx_1 = require("../../../utils/with-nx");
|
|
7
7
|
const with_web_1 = require("../../../utils/with-web");
|
|
8
8
|
async function getRspackConfigs(options, context) {
|
|
9
|
-
let
|
|
9
|
+
let maybeUserDefinedConfig = await (0, resolve_user_defined_rspack_config_1.resolveUserDefinedRspackConfig)(options.rspackConfig, options.tsConfig);
|
|
10
|
+
let userDefinedConfig = 'default' in maybeUserDefinedConfig
|
|
11
|
+
? 'default' in maybeUserDefinedConfig.default
|
|
12
|
+
? maybeUserDefinedConfig.default.default
|
|
13
|
+
: maybeUserDefinedConfig.default
|
|
14
|
+
: maybeUserDefinedConfig;
|
|
10
15
|
if (typeof userDefinedConfig.then === 'function') {
|
|
11
16
|
userDefinedConfig = await userDefinedConfig;
|
|
12
17
|
}
|
package/src/plugins/plugin.js
CHANGED
|
@@ -66,7 +66,7 @@ async function createNodesInternal(configFilePath, options, context, targetsCach
|
|
|
66
66
|
}
|
|
67
67
|
async function createRspackTargets(configFilePath, projectRoot, options, context, isTsSolutionSetup) {
|
|
68
68
|
const namedInputs = (0, get_named_inputs_1.getNamedInputs)(projectRoot, context);
|
|
69
|
-
const rspackConfig = (0, resolve_user_defined_rspack_config_1.resolveUserDefinedRspackConfig)((0, path_1.join)(context.workspaceRoot, configFilePath), (0, js_1.getRootTsConfigPath)(), true);
|
|
69
|
+
const rspackConfig = await (0, resolve_user_defined_rspack_config_1.resolveUserDefinedRspackConfig)((0, path_1.join)(context.workspaceRoot, configFilePath), (0, js_1.getRootTsConfigPath)(), true);
|
|
70
70
|
const rspackOptions = await (0, read_rspack_options_1.readRspackOptions)(rspackConfig);
|
|
71
71
|
const outputs = [];
|
|
72
72
|
for (const config of rspackOptions) {
|
|
@@ -2,37 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.resolveUserDefinedRspackConfig = resolveUserDefinedRspackConfig;
|
|
4
4
|
const config_utils_1 = require("@nx/devkit/src/utils/config-utils");
|
|
5
|
-
|
|
6
|
-
function resolveUserDefinedRspackConfig(path, tsConfig,
|
|
5
|
+
async function resolveUserDefinedRspackConfig(path, tsConfig,
|
|
7
6
|
/** Skip require cache and return latest content */
|
|
8
7
|
reload = false) {
|
|
9
|
-
|
|
10
|
-
// Clear cache if the path is in the cache
|
|
11
|
-
if (require.cache[path]) {
|
|
12
|
-
// Clear all entries because config may import other modules
|
|
13
|
-
(0, config_utils_1.clearRequireCache)();
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
// Don't transpile non-TS files. This prevents workspaces libs from being registered via tsconfig-paths.
|
|
17
|
-
// There's an issue here with Nx workspace where loading plugins from source (via tsconfig-paths) can lead to errors.
|
|
18
|
-
if (!/\.(ts|mts|cts)$/.test(path)) {
|
|
19
|
-
return require(path);
|
|
20
|
-
}
|
|
21
|
-
const cleanupTranspiler = (0, internal_1.registerTsProject)(tsConfig);
|
|
22
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
23
|
-
const maybeCustomRspackConfig = require(path);
|
|
24
|
-
cleanupTranspiler();
|
|
25
|
-
// If the user provides a configuration in TS file
|
|
26
|
-
// then there are 3 cases for exploring an object. The first one is:
|
|
27
|
-
// `module.exports = { ... }`. And the second one is:
|
|
28
|
-
// `export default { ... }`. The ESM format is compiled into:
|
|
29
|
-
// `{ default: { ... } }`
|
|
30
|
-
// There is also a case of
|
|
31
|
-
// `{ default: { default: { ... } }`
|
|
32
|
-
const customRspackConfig = 'default' in maybeCustomRspackConfig
|
|
33
|
-
? 'default' in maybeCustomRspackConfig.default
|
|
34
|
-
? maybeCustomRspackConfig.default.default
|
|
35
|
-
: maybeCustomRspackConfig.default
|
|
36
|
-
: maybeCustomRspackConfig;
|
|
37
|
-
return customRspackConfig;
|
|
8
|
+
return await (0, config_utils_1.loadConfigFile)(path);
|
|
38
9
|
}
|