@nx/rspack 20.5.0-beta.3 → 20.5.0-beta.5

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/migrations.json CHANGED
@@ -94,6 +94,23 @@
94
94
  "alwaysAddToPackageJson": false
95
95
  }
96
96
  }
97
+ },
98
+ "20.5.0": {
99
+ "version": "20.5.0-beta.4",
100
+ "packages": {
101
+ "sass-embedded": {
102
+ "version": "^1.83.4",
103
+ "alwaysAddToPackageJson": true
104
+ },
105
+ "sass-loader": {
106
+ "version": "^16.0.4",
107
+ "alwaysAddToPackageJson": true
108
+ },
109
+ "@rspack/core": {
110
+ "version": "^1.2.2",
111
+ "alwaysAddToPackageJson": false
112
+ }
113
+ }
97
114
  }
98
115
  },
99
116
  "version": "0.1"
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.3",
4
+ "version": "20.5.0-beta.5",
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.3",
28
- "@nx/devkit": "20.5.0-beta.3",
29
- "@nx/web": "20.5.0-beta.3",
30
- "@nx/module-federation": "20.5.0-beta.3",
27
+ "@nx/js": "20.5.0-beta.5",
28
+ "@nx/devkit": "20.5.0-beta.5",
29
+ "@nx/web": "20.5.0-beta.5",
30
+ "@nx/module-federation": "20.5.0-beta.5",
31
31
  "@phenomnomnominal/tsquery": "~5.0.1",
32
32
  "@rspack/core": "^1.1.5",
33
33
  "@rspack/dev-server": "^1.0.9",
@@ -37,13 +37,14 @@
37
37
  "css-loader": "^6.4.0",
38
38
  "enquirer": "~2.3.6",
39
39
  "express": "^4.21.2",
40
- "fork-ts-checker-webpack-plugin": "7.2.13",
40
+ "ts-checker-rspack-plugin": "^1.1.1",
41
41
  "http-proxy-middleware": "^3.0.3",
42
42
  "less-loader": "11.1.0",
43
43
  "license-webpack-plugin": "^4.0.2",
44
44
  "loader-utils": "^2.0.3",
45
- "sass": "^1.42.1",
46
- "sass-loader": "^12.2.0",
45
+ "sass": "^1.85.0",
46
+ "sass-embedded": "^1.83.4",
47
+ "sass-loader": "^16.0.4",
47
48
  "source-map-loader": "^5.0.0",
48
49
  "style-loader": "^3.3.0",
49
50
  "picocolors": "^1.1.0",
@@ -55,8 +56,8 @@
55
56
  "webpack-node-externals": "^3.0.0"
56
57
  },
57
58
  "peerDependencies": {
58
- "@module-federation/enhanced": "^0.8.8",
59
- "@module-federation/node": "^2.6.21"
59
+ "@module-federation/enhanced": "^0.9.0",
60
+ "@module-federation/node": "^2.6.26"
60
61
  },
61
62
  "nx-migrations": {
62
63
  "migrations": "./migrations.json"
@@ -22,6 +22,7 @@ function normalizeOptions(options, root, projectRoot, sourceRoot) {
22
22
  styles: options.optimization,
23
23
  }
24
24
  : options.optimization,
25
+ sassImplementation: options.sassImplementation ?? 'sass',
25
26
  };
26
27
  if (options.assets) {
27
28
  normalizedOptions.assets = (0, normalize_options_1.normalizeAssets)(options.assets, root, sourceRoot, projectRoot, false // executor assets are relative to workspace root for consistency
@@ -35,7 +35,12 @@ export interface RspackExecutorSchema {
35
35
  sourceMap?: boolean | DevTool;
36
36
  standardRspackConfigFunction?: boolean;
37
37
  statsJson?: boolean;
38
- stylePreprocessorOptions?: any;
38
+ stylePreprocessorOptions?: {
39
+ includePaths?: string[];
40
+ sassOptions?: Record<string, any>;
41
+ lessOptions?: Record<string, any>;
42
+ };
43
+ sassImplementation?: 'sass' | 'sass-embedded';
39
44
  styles?: Array<ExtraEntryPointClass | string>;
40
45
  target?: 'web' | 'node';
41
46
  transformers?: TransformerEntry[];
@@ -245,10 +245,24 @@
245
245
  "items": {
246
246
  "type": "string"
247
247
  }
248
+ },
249
+ "sassOptions": {
250
+ "description": "Options to pass to sass-loader.",
251
+ "type": "object"
252
+ },
253
+ "lessOptions": {
254
+ "description": "Options to pass to less-loader.",
255
+ "type": "object"
248
256
  }
249
257
  },
250
258
  "additionalProperties": false
251
259
  },
260
+ "sassImplementation": {
261
+ "type": "string",
262
+ "description": "The implementation of the SASS compiler to use. Can be either `sass` or `sass-embedded`. Defaults to `sass-embedded`.",
263
+ "enum": ["sass", "sass-embedded"],
264
+ "default": "sass"
265
+ },
252
266
  "styles": {
253
267
  "type": "array",
254
268
  "description": "External Styles which will be included with the application",
@@ -70,6 +70,10 @@ async function rspackInitGenerator(tree, schema) {
70
70
  if (schema.style === 'less') {
71
71
  devDependencies['less-loader'] = versions_1.lessLoaderVersion;
72
72
  }
73
+ if (schema.style === 'scss') {
74
+ devDependencies['sass-loader'] = versions_1.sassLoaderVersion;
75
+ devDependencies['sass-embedded'] = versions_1.sassEmbeddedVersion;
76
+ }
73
77
  if (schema.framework !== 'none' || schema.devServer) {
74
78
  devDependencies['@rspack/dev-server'] = versions_1.rspackDevServerVersion;
75
79
  }
@@ -52,16 +52,15 @@ async function createNodesInternal(configFilePath, options, context, targetsCach
52
52
  packageJson = (0, devkit_1.readJsonFile)((0, path_1.join)(context.workspaceRoot, projectRoot, 'package.json'));
53
53
  }
54
54
  const normalizedOptions = normalizeOptions(options);
55
- // We do not want to alter how the hash is calculated, so appending the config file path to the hash
56
- // to prevent vite/vitest files overwriting the target cache created by the other
55
+ const lockFileHash = (0, file_hasher_1.hashFile)((0, path_1.join)(context.workspaceRoot, (0, js_1.getLockFileName)((0, devkit_1.detectPackageManager)(context.workspaceRoot)))) ?? '';
57
56
  const nodeHash = (0, file_hasher_1.hashArray)([
58
- ...[
59
- (0, path_1.join)(context.workspaceRoot, configFilePath),
60
- (0, path_1.join)(context.workspaceRoot, (0, js_1.getLockFileName)((0, devkit_1.detectPackageManager)(context.workspaceRoot))),
61
- ].map(file_hasher_1.hashFile),
62
- (0, file_hasher_1.hashObject)(options),
57
+ (0, file_hasher_1.hashFile)((0, path_1.join)(context.workspaceRoot, configFilePath)),
58
+ lockFileHash,
59
+ (0, file_hasher_1.hashObject)({ ...options, isTsSolutionSetup }),
63
60
  (0, file_hasher_1.hashObject)(packageJson),
64
61
  ]);
62
+ // We do not want to alter how the hash is calculated, so appending the config file path to the hash
63
+ // to prevent vite/vitest files overwriting the target cache created by the other
65
64
  const hash = `${nodeHash}_${configFilePath}`;
66
65
  targetsCache[hash] ??= await createRspackTargets(configFilePath, projectRoot, normalizedOptions, context, isTsSolutionSetup);
67
66
  const { targets, metadata } = targetsCache[hash];
@@ -179,13 +179,13 @@ function applyNxDependentConfig(options, config, { useNormalizedEntry } = {}) {
179
179
  }
180
180
  // New TS Solution already has a typecheck target
181
181
  if (!options?.skipTypeChecking && !isUsingTsSolution) {
182
- const ForkTsCheckerWebpackPlugin = require('fork-ts-checker-webpack-plugin');
183
- plugins.push(new ForkTsCheckerWebpackPlugin({
182
+ const { TsCheckerRspackPlugin } = require('ts-checker-rspack-plugin');
183
+ plugins.push(new TsCheckerRspackPlugin({
184
184
  typescript: {
185
185
  configFile: path.isAbsolute(tsConfig)
186
186
  ? tsConfig
187
187
  : path.join(options.root, tsConfig),
188
- memoryLimit: options.memoryLimit || 2018,
188
+ memoryLimit: options.memoryLimit || 8192, // default memory limit is 8192
189
189
  },
190
190
  }));
191
191
  }
@@ -54,6 +54,8 @@ function applyWebConfig(options, config = {}, { useNormalizedEntry, } = {}) {
54
54
  const globalStylePaths = [];
55
55
  // Determine hashing format.
56
56
  const hashFormat = (0, hash_format_1.getOutputHashFormat)(options.outputHashing);
57
+ const sassOptions = options.stylePreprocessorOptions?.sassOptions;
58
+ const lessOptions = options.stylePreprocessorOptions?.lessOptions;
57
59
  const includePaths = [];
58
60
  if (options?.stylePreprocessorOptions?.includePaths?.length > 0) {
59
61
  options.stylePreprocessorOptions.includePaths.forEach((includePath) => includePaths.push((0, path_1.resolve)(options.root, includePath)));
@@ -88,11 +90,15 @@ function applyWebConfig(options, config = {}, { useNormalizedEntry, } = {}) {
88
90
  {
89
91
  loader: require.resolve('sass-loader'),
90
92
  options: {
91
- implementation: require('sass'),
93
+ implementation: options.sassImplementation === 'sass-embedded'
94
+ ? require.resolve('sass-embedded')
95
+ : require.resolve('sass'),
96
+ api: 'modern-compiler',
92
97
  sassOptions: {
93
98
  fiber: false,
94
99
  precision: 8,
95
100
  includePaths,
101
+ ...(sassOptions ?? {}),
96
102
  },
97
103
  },
98
104
  },
@@ -108,6 +114,7 @@ function applyWebConfig(options, config = {}, { useNormalizedEntry, } = {}) {
108
114
  options: {
109
115
  lessOptions: {
110
116
  paths: includePaths,
117
+ ...(lessOptions ?? {}),
111
118
  },
112
119
  },
113
120
  },
@@ -143,13 +150,17 @@ function applyWebConfig(options, config = {}, { useNormalizedEntry, } = {}) {
143
150
  {
144
151
  loader: require.resolve('sass-loader'),
145
152
  options: {
146
- implementation: require('sass'),
153
+ api: 'modern-compiler',
154
+ implementation: options.sassImplementation === 'sass-embedded'
155
+ ? require.resolve('sass-embedded')
156
+ : require.resolve('sass'),
147
157
  sourceMap: !!options.sourceMap,
148
158
  sassOptions: {
149
159
  fiber: false,
150
160
  // bootstrap-sass requires a minimum precision of 8
151
161
  precision: 8,
152
162
  includePaths,
163
+ ...(sassOptions ?? {}),
153
164
  },
154
165
  },
155
166
  },
@@ -167,6 +178,7 @@ function applyWebConfig(options, config = {}, { useNormalizedEntry, } = {}) {
167
178
  lessOptions: {
168
179
  javascriptEnabled: true,
169
180
  ...lessPathOptions,
181
+ ...(lessOptions ?? {}),
170
182
  },
171
183
  },
172
184
  },
@@ -203,13 +215,17 @@ function applyWebConfig(options, config = {}, { useNormalizedEntry, } = {}) {
203
215
  {
204
216
  loader: require.resolve('sass-loader'),
205
217
  options: {
206
- implementation: require('sass'),
218
+ api: 'modern-compiler',
219
+ implementation: options.sassImplementation === 'sass-embedded'
220
+ ? require.resolve('sass-embedded')
221
+ : require.resolve('sass'),
207
222
  sourceMap: !!options.sourceMap,
208
223
  sassOptions: {
209
224
  fiber: false,
210
225
  // bootstrap-sass requires a minimum precision of 8
211
226
  precision: 8,
212
227
  includePaths,
228
+ ...(sassOptions ?? {}),
213
229
  },
214
230
  },
215
231
  },
@@ -227,6 +243,7 @@ function applyWebConfig(options, config = {}, { useNormalizedEntry, } = {}) {
227
243
  lessOptions: {
228
244
  javascriptEnabled: true,
229
245
  ...lessPathOptions,
246
+ ...(lessOptions ?? {}),
230
247
  },
231
248
  },
232
249
  },
@@ -148,6 +148,10 @@ export interface NxAppRspackPluginOptions {
148
148
  * Add an additional chunk for the rspack runtime. Defaults to `true` when `target === 'web'`.
149
149
  */
150
150
  runtimeChunk?: boolean;
151
+ /**
152
+ * The implementation of the SASS compiler to use. Can be either `sass` or `sass-embedded`. Defaults to `sass-embedded`.
153
+ */
154
+ sassImplementation?: 'sass' | 'sass-embedded';
151
155
  /**
152
156
  * External scripts that will be included before the main application entry.
153
157
  */
@@ -183,7 +187,11 @@ export interface NxAppRspackPluginOptions {
183
187
  /**
184
188
  * Options for the style preprocessor. e.g. `{ "includePaths": [] }` for SASS.
185
189
  */
186
- stylePreprocessorOptions?: any;
190
+ stylePreprocessorOptions?: {
191
+ includePaths?: string[];
192
+ sassOptions?: Record<string, any>;
193
+ lessOptions?: Record<string, any>;
194
+ };
187
195
  /**
188
196
  * External stylesheets that will be included with the application.
189
197
  */
@@ -77,6 +77,7 @@ function normalizeOptions(options) {
77
77
  projectRoot: projectNode.data.root,
78
78
  root: devkit_1.workspaceRoot,
79
79
  runtimeChunk: combinedPluginAndMaybeExecutorOptions.runtimeChunk ?? true,
80
+ sassImplementation: combinedPluginAndMaybeExecutorOptions.sassImplementation ?? 'sass',
80
81
  scripts: combinedPluginAndMaybeExecutorOptions.scripts ?? [],
81
82
  sourceMap: combinedPluginAndMaybeExecutorOptions.sourceMap ?? !isProd,
82
83
  sourceRoot,
@@ -1,16 +1,17 @@
1
1
  export declare const nxVersion: any;
2
- export declare const rspackCoreVersion = "^1.1.5";
2
+ export declare const rspackCoreVersion = "1.2.2";
3
3
  export declare const rspackDevServerVersion = "1.0.9";
4
4
  export declare const rspackPluginMinifyVersion = "^0.7.5";
5
5
  export declare const rspackPluginReactRefreshVersion = "^1.0.0";
6
6
  export declare const lessLoaderVersion = "~11.1.3";
7
+ export declare const sassLoaderVersion = "^16.0.4";
8
+ export declare const sassEmbeddedVersion = "^1.83.4";
7
9
  export declare const reactRefreshVersion = "~0.14.0";
8
10
  export declare const nestjsCommonVersion = "~9.0.0";
9
11
  export declare const nestjsCoreVersion = "~9.0.0";
10
12
  export declare const nestjsPlatformExpressVersion = "~9.0.0";
11
13
  export declare const nestjsMicroservicesVersion = "~9.0.0";
12
14
  export declare const lessVersion = "4.1.3";
13
- export declare const sassVersion = "^1.42.1";
14
15
  export declare const stylusVersion = "^0.55.0";
15
16
  export declare const eslintPluginImportVersion = "2.27.5";
16
17
  export declare const eslintPluginJsxA11yVersion = "6.7.1";
@@ -1,19 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.eslintPluginReactHooksVersion = exports.eslintPluginReactVersion = exports.eslintPluginJsxA11yVersion = exports.eslintPluginImportVersion = exports.stylusVersion = exports.sassVersion = exports.lessVersion = exports.nestjsMicroservicesVersion = exports.nestjsPlatformExpressVersion = exports.nestjsCoreVersion = exports.nestjsCommonVersion = exports.reactRefreshVersion = exports.lessLoaderVersion = exports.rspackPluginReactRefreshVersion = exports.rspackPluginMinifyVersion = exports.rspackDevServerVersion = exports.rspackCoreVersion = exports.nxVersion = void 0;
3
+ exports.eslintPluginReactHooksVersion = exports.eslintPluginReactVersion = exports.eslintPluginJsxA11yVersion = exports.eslintPluginImportVersion = exports.stylusVersion = exports.lessVersion = exports.nestjsMicroservicesVersion = exports.nestjsPlatformExpressVersion = exports.nestjsCoreVersion = exports.nestjsCommonVersion = exports.reactRefreshVersion = exports.sassEmbeddedVersion = exports.sassLoaderVersion = exports.lessLoaderVersion = exports.rspackPluginReactRefreshVersion = exports.rspackPluginMinifyVersion = exports.rspackDevServerVersion = exports.rspackCoreVersion = exports.nxVersion = void 0;
4
4
  exports.nxVersion = require('../../package.json').version;
5
- exports.rspackCoreVersion = '^1.1.5';
5
+ exports.rspackCoreVersion = '1.2.2';
6
6
  exports.rspackDevServerVersion = '1.0.9';
7
7
  exports.rspackPluginMinifyVersion = '^0.7.5';
8
8
  exports.rspackPluginReactRefreshVersion = '^1.0.0';
9
9
  exports.lessLoaderVersion = '~11.1.3';
10
+ exports.sassLoaderVersion = '^16.0.4';
11
+ exports.sassEmbeddedVersion = '^1.83.4';
10
12
  exports.reactRefreshVersion = '~0.14.0';
11
13
  exports.nestjsCommonVersion = '~9.0.0';
12
14
  exports.nestjsCoreVersion = '~9.0.0';
13
15
  exports.nestjsPlatformExpressVersion = '~9.0.0';
14
16
  exports.nestjsMicroservicesVersion = '~9.0.0';
15
17
  exports.lessVersion = '4.1.3';
16
- exports.sassVersion = '^1.42.1';
17
18
  exports.stylusVersion = '^0.55.0';
18
19
  exports.eslintPluginImportVersion = '2.27.5';
19
20
  exports.eslintPluginJsxA11yVersion = '6.7.1';
@@ -8,10 +8,13 @@ export interface WithWebOptions {
8
8
  generateIndexHtml?: boolean;
9
9
  index?: string;
10
10
  postcssConfig?: string;
11
+ sassImplementation?: 'sass' | 'sass-embedded';
11
12
  scripts?: Array<ExtraEntryPointClass | string>;
12
13
  styles?: Array<ExtraEntryPointClass | string>;
13
14
  stylePreprocessorOptions?: {
14
15
  includePaths?: string[];
16
+ sassOptions?: Record<string, any>;
17
+ lessOptions?: Record<string, any>;
15
18
  };
16
19
  cssModules?: boolean;
17
20
  ssr?: boolean;