@nx/rspack 20.3.0 → 20.4.0-beta.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/LICENSE +1 -1
- package/package.json +7 -7
- package/src/generators/init/init.js +10 -0
- package/src/plugins/plugin.d.ts +2 -0
- package/src/plugins/plugin.js +3 -0
- package/src/plugins/utils/apply-web-config.js +1 -1
- package/src/plugins/utils/models.d.ts +4 -0
- package/src/plugins/utils/plugins/normalize-options.js +1 -0
package/LICENSE
CHANGED
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.
|
|
4
|
+
"version": "20.4.0-beta.0",
|
|
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.
|
|
28
|
-
"@nx/devkit": "20.
|
|
29
|
-
"@nx/web": "20.
|
|
30
|
-
"@nx/module-federation": "20.
|
|
27
|
+
"@nx/js": "20.4.0-beta.0",
|
|
28
|
+
"@nx/devkit": "20.4.0-beta.0",
|
|
29
|
+
"@nx/web": "20.4.0-beta.0",
|
|
30
|
+
"@nx/module-federation": "20.4.0-beta.0",
|
|
31
31
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
|
32
32
|
"@rspack/core": "^1.1.5",
|
|
33
33
|
"@rspack/dev-server": "^1.0.9",
|
|
@@ -55,8 +55,8 @@
|
|
|
55
55
|
"webpack-node-externals": "^3.0.0"
|
|
56
56
|
},
|
|
57
57
|
"peerDependencies": {
|
|
58
|
-
"@module-federation/enhanced": "
|
|
59
|
-
"@module-federation/node": "
|
|
58
|
+
"@module-federation/enhanced": "^0.8.8",
|
|
59
|
+
"@module-federation/node": "^2.6.21"
|
|
60
60
|
},
|
|
61
61
|
"nx-migrations": {
|
|
62
62
|
"migrations": "./migrations.json"
|
|
@@ -36,6 +36,16 @@ async function rspackInitGenerator(tree, schema) {
|
|
|
36
36
|
'rspack-preview',
|
|
37
37
|
'preview-rspack',
|
|
38
38
|
],
|
|
39
|
+
buildDepsTargetName: [
|
|
40
|
+
'build-deps',
|
|
41
|
+
'rspack:build-deps',
|
|
42
|
+
'rspack-build-deps',
|
|
43
|
+
],
|
|
44
|
+
watchDepsTargetName: [
|
|
45
|
+
'watch-deps',
|
|
46
|
+
'rspack:watch-deps',
|
|
47
|
+
'rspack-watch-deps',
|
|
48
|
+
],
|
|
39
49
|
}, schema.updatePackageScripts);
|
|
40
50
|
}
|
|
41
51
|
const jsInitTask = await (0, js_1.initGenerator)(tree, {
|
package/src/plugins/plugin.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ export interface RspackPluginOptions {
|
|
|
4
4
|
serveTargetName?: string;
|
|
5
5
|
serveStaticTargetName?: string;
|
|
6
6
|
previewTargetName?: string;
|
|
7
|
+
buildDepsTargetName?: string;
|
|
8
|
+
watchDepsTargetName?: string;
|
|
7
9
|
}
|
|
8
10
|
export declare const createDependencies: CreateDependencies;
|
|
9
11
|
export declare const createNodesV2: CreateNodesV2<RspackPluginOptions>;
|
package/src/plugins/plugin.js
CHANGED
|
@@ -12,6 +12,8 @@ const cache_directory_1 = require("nx/src/utils/cache-directory");
|
|
|
12
12
|
const path_1 = require("path");
|
|
13
13
|
const read_rspack_options_1 = require("../utils/read-rspack-options");
|
|
14
14
|
const resolve_user_defined_rspack_config_1 = require("../utils/resolve-user-defined-rspack-config");
|
|
15
|
+
const util_1 = require("@nx/js/src/plugins/typescript/util");
|
|
16
|
+
const pmc = (0, devkit_1.getPackageManagerCommand)();
|
|
15
17
|
function readTargetsCache(cachePath) {
|
|
16
18
|
return (0, fs_1.existsSync)(cachePath) ? (0, devkit_1.readJsonFile)(cachePath) : {};
|
|
17
19
|
}
|
|
@@ -125,6 +127,7 @@ async function createRspackTargets(configFilePath, projectRoot, options, context
|
|
|
125
127
|
'@nx/js:typescript-sync',
|
|
126
128
|
];
|
|
127
129
|
}
|
|
130
|
+
(0, util_1.addBuildAndWatchDepsTargets)(context.workspaceRoot, projectRoot, targets, options, pmc);
|
|
128
131
|
return { targets, metadata: {} };
|
|
129
132
|
}
|
|
130
133
|
function normalizeOptions(options) {
|
|
@@ -34,7 +34,7 @@ function applyWebConfig(options, config = {}, { useNormalizedEntry, } = {}) {
|
|
|
34
34
|
if (options.index && options.generateIndexHtml) {
|
|
35
35
|
plugins.push(new core_1.HtmlRspackPlugin({
|
|
36
36
|
template: options.index,
|
|
37
|
-
sri: 'sha256',
|
|
37
|
+
sri: options.subresourceIntegrity ? 'sha256' : undefined,
|
|
38
38
|
...(options.baseHref ? { base: { href: options.baseHref } } : {}),
|
|
39
39
|
...(config.output?.scriptType === 'module'
|
|
40
40
|
? { scriptLoading: 'module' }
|
|
@@ -188,6 +188,10 @@ export interface NxAppRspackPluginOptions {
|
|
|
188
188
|
* External stylesheets that will be included with the application.
|
|
189
189
|
*/
|
|
190
190
|
styles?: Array<ExtraEntryPointClass | string>;
|
|
191
|
+
/**
|
|
192
|
+
* Enables the use of subresource integrity validation.
|
|
193
|
+
*/
|
|
194
|
+
subresourceIntegrity?: boolean;
|
|
191
195
|
/**
|
|
192
196
|
* Override the `target` option in rspack configuration. This setting is not recommended and exists for backwards compatibility.
|
|
193
197
|
*/
|
|
@@ -81,6 +81,7 @@ function normalizeOptions(options) {
|
|
|
81
81
|
sourceMap: combinedPluginAndMaybeExecutorOptions.sourceMap ?? !isProd,
|
|
82
82
|
sourceRoot,
|
|
83
83
|
styles: combinedPluginAndMaybeExecutorOptions.styles ?? [],
|
|
84
|
+
subresourceIntegrity: combinedPluginAndMaybeExecutorOptions.subresourceIntegrity ?? false,
|
|
84
85
|
target: combinedPluginAndMaybeExecutorOptions.target ?? 'web',
|
|
85
86
|
targetName,
|
|
86
87
|
vendorChunk: combinedPluginAndMaybeExecutorOptions.vendorChunk ?? !isProd,
|