@nx/rspack 0.0.0-pr-29720-06f67e5 → 0.0.0-pr-3-4fa8cf8
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/generators.json
CHANGED
|
@@ -28,6 +28,7 @@
|
|
|
28
28
|
"description": "React application generator."
|
|
29
29
|
},
|
|
30
30
|
"convert-webpack": {
|
|
31
|
+
"alias": "convert-to-rspack",
|
|
31
32
|
"factory": "./src/generators/convert-webpack/convert-webpack",
|
|
32
33
|
"schema": "./src/generators/convert-webpack/schema.json",
|
|
33
34
|
"description": "Convert a webpack application to use rspack."
|
package/migrations.json
CHANGED
|
@@ -98,13 +98,9 @@
|
|
|
98
98
|
"20.5.0": {
|
|
99
99
|
"version": "20.5.0-beta.4",
|
|
100
100
|
"packages": {
|
|
101
|
-
"sass-embedded": {
|
|
102
|
-
"version": "^1.83.4",
|
|
103
|
-
"alwaysAddToPackageJson": true
|
|
104
|
-
},
|
|
105
101
|
"sass-loader": {
|
|
106
102
|
"version": "^16.0.4",
|
|
107
|
-
"alwaysAddToPackageJson":
|
|
103
|
+
"alwaysAddToPackageJson": false
|
|
108
104
|
},
|
|
109
105
|
"@rspack/core": {
|
|
110
106
|
"version": "^1.2.2",
|
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": "0.0.0-pr-
|
|
4
|
+
"version": "0.0.0-pr-3-4fa8cf8",
|
|
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": "0.0.0-pr-
|
|
28
|
-
"@nx/devkit": "0.0.0-pr-
|
|
29
|
-
"@nx/web": "0.0.0-pr-
|
|
30
|
-
"@nx/module-federation": "0.0.0-pr-
|
|
27
|
+
"@nx/js": "0.0.0-pr-3-4fa8cf8",
|
|
28
|
+
"@nx/devkit": "0.0.0-pr-3-4fa8cf8",
|
|
29
|
+
"@nx/web": "0.0.0-pr-3-4fa8cf8",
|
|
30
|
+
"@nx/module-federation": "0.0.0-pr-3-4fa8cf8",
|
|
31
31
|
"@phenomnomnominal/tsquery": "~5.0.1",
|
|
32
32
|
"@rspack/core": "^1.1.5",
|
|
33
33
|
"@rspack/dev-server": "^1.0.9",
|
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.normalizeOptions = normalizeOptions;
|
|
4
|
-
const devkit_1 = require("@nx/devkit");
|
|
5
4
|
const project_name_and_root_utils_1 = require("@nx/devkit/src/generators/project-name-and-root-utils");
|
|
5
|
+
const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
|
|
6
6
|
async function normalizeOptions(host, options) {
|
|
7
|
-
await (0, project_name_and_root_utils_1.
|
|
8
|
-
const { projectName
|
|
7
|
+
await (0, project_name_and_root_utils_1.ensureRootProjectName)(options, 'application');
|
|
8
|
+
const { projectName, projectRoot: appProjectRoot, importPath, } = await (0, project_name_and_root_utils_1.determineProjectNameAndRootOptions)(host, {
|
|
9
9
|
...options,
|
|
10
10
|
projectType: 'application',
|
|
11
11
|
});
|
|
12
12
|
// --monorepo takes precedence over --rootProject
|
|
13
13
|
// This won't be needed once we add --bundler=rspack to the @nx/react:app preset
|
|
14
14
|
const rootProject = !options.monorepo && options.rootProject;
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
15
|
+
const isTsSolutionSetup = (0, ts_solution_setup_1.isUsingTsSolutionSetup)(host);
|
|
16
|
+
const appProjectName = !isTsSolutionSetup || options.name ? projectName : importPath;
|
|
17
|
+
const e2eProjectName = options.rootProject ? 'e2e' : `${projectName}-e2e`;
|
|
18
18
|
const normalized = {
|
|
19
19
|
...options,
|
|
20
20
|
rootProject,
|
|
21
|
-
name:
|
|
21
|
+
name: appProjectName,
|
|
22
22
|
projectName: appProjectName,
|
|
23
23
|
appProjectRoot,
|
|
24
24
|
e2eProjectName,
|
package/src/plugins/plugin.js
CHANGED
|
@@ -14,7 +14,14 @@ const resolve_user_defined_rspack_config_1 = require("../utils/resolve-user-defi
|
|
|
14
14
|
const util_1 = require("@nx/js/src/plugins/typescript/util");
|
|
15
15
|
const pmc = (0, devkit_1.getPackageManagerCommand)();
|
|
16
16
|
function readTargetsCache(cachePath) {
|
|
17
|
-
|
|
17
|
+
try {
|
|
18
|
+
return process.env.NX_CACHE_PROJECT_GRAPH !== 'false'
|
|
19
|
+
? (0, devkit_1.readJsonFile)(cachePath)
|
|
20
|
+
: {};
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
return {};
|
|
24
|
+
}
|
|
18
25
|
}
|
|
19
26
|
function writeTargetsToCache(cachePath, results) {
|
|
20
27
|
(0, devkit_1.writeJsonFile)(cachePath, results);
|
|
@@ -85,9 +92,24 @@ async function createRspackTargets(configFilePath, projectRoot, options, context
|
|
|
85
92
|
}
|
|
86
93
|
}
|
|
87
94
|
const targets = {};
|
|
95
|
+
const env = {};
|
|
96
|
+
const isTsConfig = ['.ts', '.cts', '.mts'].includes((0, path_1.extname)(configFilePath));
|
|
97
|
+
if (isTsConfig) {
|
|
98
|
+
// https://rspack.dev/config/#using-ts-node
|
|
99
|
+
const existingValue = process.env['TS_NODE_COMPILER_OPTIONS'];
|
|
100
|
+
env['TS_NODE_COMPILER_OPTIONS'] = JSON.stringify({
|
|
101
|
+
...(existingValue ? JSON.parse(existingValue) : {}),
|
|
102
|
+
module: 'CommonJS',
|
|
103
|
+
moduleResolution: 'Node10',
|
|
104
|
+
});
|
|
105
|
+
}
|
|
88
106
|
targets[options.buildTargetName] = {
|
|
89
107
|
command: `rspack build`,
|
|
90
|
-
options: {
|
|
108
|
+
options: {
|
|
109
|
+
cwd: projectRoot,
|
|
110
|
+
args: ['--node-env=production'],
|
|
111
|
+
env,
|
|
112
|
+
},
|
|
91
113
|
cache: true,
|
|
92
114
|
dependsOn: [`^${options.buildTargetName}`],
|
|
93
115
|
inputs: 'production' in namedInputs
|
|
@@ -108,20 +130,25 @@ async function createRspackTargets(configFilePath, projectRoot, options, context
|
|
|
108
130
|
outputs,
|
|
109
131
|
};
|
|
110
132
|
targets[options.serveTargetName] = {
|
|
133
|
+
continuous: true,
|
|
111
134
|
command: `rspack serve`,
|
|
112
135
|
options: {
|
|
113
136
|
cwd: projectRoot,
|
|
114
137
|
args: ['--node-env=development'],
|
|
138
|
+
env,
|
|
115
139
|
},
|
|
116
140
|
};
|
|
117
141
|
targets[options.previewTargetName] = {
|
|
142
|
+
continuous: true,
|
|
118
143
|
command: `rspack serve`,
|
|
119
144
|
options: {
|
|
120
145
|
cwd: projectRoot,
|
|
121
146
|
args: ['--node-env=production'],
|
|
147
|
+
env,
|
|
122
148
|
},
|
|
123
149
|
};
|
|
124
150
|
targets[options.serveStaticTargetName] = {
|
|
151
|
+
continuous: true,
|
|
125
152
|
executor: '@nx/web:file-server',
|
|
126
153
|
options: {
|
|
127
154
|
buildTarget: options.buildTargetName,
|
|
@@ -3,7 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.RspackNxBuildCoordinationPlugin = void 0;
|
|
4
4
|
const child_process_1 = require("child_process");
|
|
5
5
|
const client_1 = require("nx/src/daemon/client/client");
|
|
6
|
-
const enabled_1 = require("nx/src/daemon/client/enabled");
|
|
7
6
|
const watch_1 = require("nx/src/command-line/watch/watch");
|
|
8
7
|
const output_1 = require("nx/src/utils/output");
|
|
9
8
|
class RspackNxBuildCoordinationPlugin {
|
|
@@ -14,7 +13,7 @@ class RspackNxBuildCoordinationPlugin {
|
|
|
14
13
|
if (!skipInitialBuild) {
|
|
15
14
|
this.buildChangedProjects();
|
|
16
15
|
}
|
|
17
|
-
if ((0,
|
|
16
|
+
if ((0, client_1.isDaemonEnabled)()) {
|
|
18
17
|
this.startWatchingBuildableLibs();
|
|
19
18
|
}
|
|
20
19
|
else {
|