@nx/rspack 22.7.0-beta.1 → 22.7.0-beta.11

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": "22.7.0-beta.1",
4
+ "version": "22.7.0-beta.11",
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/devkit": "22.7.0-beta.1",
28
- "@nx/js": "22.7.0-beta.1",
29
- "@nx/module-federation": "22.7.0-beta.1",
30
- "@nx/web": "22.7.0-beta.1",
27
+ "@nx/devkit": "22.7.0-beta.11",
28
+ "@nx/js": "22.7.0-beta.11",
29
+ "@nx/module-federation": "22.7.0-beta.11",
30
+ "@nx/web": "22.7.0-beta.11",
31
31
  "@phenomnomnominal/tsquery": "~6.1.4",
32
32
  "@rspack/core": "1.6.8",
33
33
  "@rspack/dev-server": "^1.1.4",
@@ -57,8 +57,8 @@
57
57
  "webpack-node-externals": "^3.0.0"
58
58
  },
59
59
  "devDependencies": {
60
- "nx": "22.7.0-beta.1",
61
- "@nx/nest": "22.7.0-beta.1"
60
+ "nx": "22.7.0-beta.11",
61
+ "@nx/nest": "22.7.0-beta.11"
62
62
  },
63
63
  "peerDependencies": {
64
64
  "@module-federation/enhanced": "^2.1.0",
@@ -69,6 +69,5 @@
69
69
  },
70
70
  "publishConfig": {
71
71
  "access": "public"
72
- },
73
- "types": "./src/index.d.ts"
72
+ }
74
73
  }
@@ -1 +1 @@
1
- {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/rspack/src/plugins/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAGlB,aAAa,EAMd,MAAM,YAAY,CAAC;AAapB,MAAM,WAAW,mBAAmB;IAClC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAuBD,eAAO,MAAM,kBAAkB,EAAE,kBAEhC,CAAC;AAIF,eAAO,MAAM,aAAa,EAAE,aAAa,CAAC,mBAAmB,CA4B5D,CAAC"}
1
+ {"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../../packages/rspack/src/plugins/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,kBAAkB,EAGlB,aAAa,EAMd,MAAM,YAAY,CAAC;AAapB,MAAM,WAAW,mBAAmB;IAClC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAqBD,eAAO,MAAM,kBAAkB,EAAE,kBAEhC,CAAC;AAIF,eAAO,MAAM,aAAa,EAAE,aAAa,CAAC,mBAAmB,CAgC5D,CAAC"}
@@ -13,7 +13,6 @@ 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
15
  const util_1 = require("@nx/js/src/plugins/typescript/util");
16
- const pmc = (0, package_manager_1.getPackageManagerCommand)();
17
16
  function readTargetsCache(cachePath) {
18
17
  try {
19
18
  return process.env.NX_CACHE_PROJECT_GRAPH !== 'false'
@@ -39,15 +38,16 @@ exports.createNodesV2 = [
39
38
  const cachePath = (0, path_1.join)(cache_directory_1.workspaceDataDirectory, `rspack-${optionsHash}.hash`);
40
39
  const targetsCache = readTargetsCache(cachePath);
41
40
  const isTsSolutionSetup = (0, ts_solution_setup_1.isUsingTsSolutionSetup)();
41
+ const pmc = (0, package_manager_1.getPackageManagerCommand)((0, devkit_1.detectPackageManager)(context.workspaceRoot));
42
42
  try {
43
- return await (0, devkit_1.createNodesFromFiles)((configFile, options, context) => createNodesInternal(configFile, options, context, targetsCache, isTsSolutionSetup), configFilePaths, options, context);
43
+ return await (0, devkit_1.createNodesFromFiles)((configFile, options, context) => createNodesInternal(configFile, options, context, targetsCache, isTsSolutionSetup, pmc), configFilePaths, options, context);
44
44
  }
45
45
  finally {
46
46
  writeTargetsToCache(cachePath, targetsCache);
47
47
  }
48
48
  },
49
49
  ];
50
- async function createNodesInternal(configFilePath, options, context, targetsCache, isTsSolutionSetup) {
50
+ async function createNodesInternal(configFilePath, options, context, targetsCache, isTsSolutionSetup, pmc) {
51
51
  const projectRoot = (0, path_1.dirname)(configFilePath);
52
52
  // Do not create a project if package.json and project.json isn't there.
53
53
  const siblingFiles = (0, fs_1.readdirSync)((0, path_1.join)(context.workspaceRoot, projectRoot));
@@ -70,7 +70,7 @@ async function createNodesInternal(configFilePath, options, context, targetsCach
70
70
  // We do not want to alter how the hash is calculated, so appending the config file path to the hash
71
71
  // to prevent vite/vitest files overwriting the target cache created by the other
72
72
  const hash = `${nodeHash}_${configFilePath}`;
73
- targetsCache[hash] ??= await createRspackTargets(configFilePath, projectRoot, normalizedOptions, context, isTsSolutionSetup);
73
+ targetsCache[hash] ??= await createRspackTargets(configFilePath, projectRoot, normalizedOptions, context, isTsSolutionSetup, pmc);
74
74
  const { targets, metadata } = targetsCache[hash];
75
75
  return {
76
76
  projects: {
@@ -82,7 +82,7 @@ async function createNodesInternal(configFilePath, options, context, targetsCach
82
82
  },
83
83
  };
84
84
  }
85
- async function createRspackTargets(configFilePath, projectRoot, options, context, isTsSolutionSetup) {
85
+ async function createRspackTargets(configFilePath, projectRoot, options, context, isTsSolutionSetup, pmc) {
86
86
  const namedInputs = (0, get_named_inputs_1.getNamedInputs)(projectRoot, context);
87
87
  const rspackConfig = await (0, resolve_user_defined_rspack_config_1.resolveUserDefinedRspackConfig)((0, path_1.join)(context.workspaceRoot, configFilePath), (0, js_1.getRootTsConfigPath)(), true);
88
88
  const rspackOptions = await (0, read_rspack_options_1.readRspackOptions)(rspackConfig);
@@ -47,7 +47,7 @@ class RspackNxBuildCoordinationPlugin {
47
47
  try {
48
48
  return await new Promise((res) => {
49
49
  this.buildCmdProcess = (0, child_process_1.exec)(this.buildCmd, {
50
- windowsHide: false,
50
+ windowsHide: true,
51
51
  });
52
52
  this.buildCmdProcess.stdout.pipe(process.stdout);
53
53
  this.buildCmdProcess.stderr.pipe(process.stderr);
package/project.json DELETED
@@ -1,39 +0,0 @@
1
- {
2
- "name": "rspack",
3
- "$schema": "../../node_modules/nx/schemas/project-schema.json",
4
- "sourceRoot": "packages/rspack/src",
5
- "projectType": "library",
6
- "targets": {
7
- "build": {
8
- "outputs": ["{workspaceRoot}/dist/packages/rspack/README.md"],
9
- "command": "node ./scripts/copy-readme.js rspack"
10
- },
11
- "legacy-post-build": {
12
- "executor": "@nx/workspace-plugin:legacy-post-build",
13
- "options": {
14
- "tsConfig": "./tsconfig.lib.json",
15
- "assets": [
16
- "packages/rspack/*.md",
17
- {
18
- "input": "./packages/rspack/src",
19
- "glob": "**/!(*.ts)",
20
- "output": "./src"
21
- },
22
- {
23
- "input": "./packages/rspack/src",
24
- "glob": "**/*.d.ts",
25
- "output": "./src"
26
- },
27
- {
28
- "input": "./packages/rspack",
29
- "glob": "**.json",
30
- "output": ".",
31
- "ignore": ["**/tsconfig*.json", "project.json", ".eslintrc.json"]
32
- },
33
- "LICENSE"
34
- ]
35
- }
36
- }
37
- },
38
- "tags": []
39
- }
@@ -1,268 +0,0 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
2
-
3
- exports[`convert-to-inferred all projects should migrate all projects using the rspack executors 1`] = `
4
- "const { NxAppRspackPlugin } = require('@nx/rspack/app-plugin');
5
- const { NxReactRspackPlugin } = require('@nx/rspack/react-plugin');
6
- const { useLegacyNxPlugin } = require('@nx/rspack');
7
-
8
- // These options were migrated by @nx/rspack:convert-to-inferred from
9
- // the project.json file and merged with the options in this file
10
- const configValues = {
11
- build: {
12
- default: {
13
- outputPath: '../../dist/apps/app1',
14
- index: './src/index.html',
15
- main: './src/main.tsx',
16
- tsConfig: './tsconfig.app.json',
17
- assets: ['./src/favicon.ico', './src/assets'],
18
- styles: ['./src/styles.scss'],
19
- },
20
- development: {
21
- extractLicenses: false,
22
- optimization: false,
23
- sourceMap: true,
24
- vendorChunk: true,
25
- },
26
- production: {
27
- fileReplacements: [
28
- {
29
- replace: './src/environments/environment.ts',
30
- with: './src/environments/environment.prod.ts',
31
- },
32
- ],
33
- optimization: true,
34
- outputHashing: 'all',
35
- sourceMap: false,
36
- namedChunks: false,
37
- extractLicenses: true,
38
- vendorChunk: false,
39
- },
40
- },
41
- serve: {
42
- default: {
43
- hmr: true,
44
- server: {
45
- type: 'https',
46
- options: { cert: './server.crt', key: './server.key' },
47
- },
48
- port: 4200,
49
- headers: { 'Access-Control-Allow-Origin': '*' },
50
- historyApiFallback: {
51
- index: '/index.html',
52
- disableDotRule: true,
53
- htmlAcceptHeaders: ['text/html', 'application/xhtml+xml'],
54
- },
55
- },
56
- development: { open: true },
57
- production: { hmr: false },
58
- },
59
- };
60
-
61
- // Determine the correct configValue to use based on the configuration
62
- const configuration = process.env.NX_TASK_TARGET_CONFIGURATION || 'default';
63
-
64
- const buildOptions = {
65
- ...configValues.build.default,
66
- ...configValues.build[configuration],
67
- };
68
- const devServerOptions = {
69
- ...configValues.serve.default,
70
- ...configValues.serve[configuration],
71
- };
72
-
73
- /**
74
- * @type{import('@rspack/core').RspackOptionsNormalized}
75
- */
76
- module.exports = async () => ({
77
- devServer: devServerOptions,
78
- plugins: [
79
- new NxAppRspackPlugin(buildOptions),
80
- new NxReactRspackPlugin({
81
- // Uncomment this line if you don't want to use SVGR
82
- // See: https://react-svgr.com/
83
- // svgr: false
84
- }),
85
- // eslint-disable-next-line react-hooks/rules-of-hooks
86
- await useLegacyNxPlugin(require('./rspack.config.old'), buildOptions),
87
- ],
88
- });
89
- "
90
- `;
91
-
92
- exports[`convert-to-inferred all projects should migrate all projects using the rspack executors 2`] = `
93
- "const { NxAppRspackPlugin } = require('@nx/rspack/app-plugin');
94
- const { NxReactRspackPlugin } = require('@nx/rspack/react-plugin');
95
- const { useLegacyNxPlugin } = require('@nx/rspack');
96
-
97
- // These options were migrated by @nx/rspack:convert-to-inferred from
98
- // the project.json file and merged with the options in this file
99
- const configValues = {
100
- build: {
101
- default: {
102
- outputPath: '../../dist/apps/app2',
103
- index: './src/index.html',
104
- main: './src/main.tsx',
105
- tsConfig: './tsconfig.app.json',
106
- assets: ['./src/favicon.ico', './src/assets'],
107
- styles: ['./src/styles.scss'],
108
- },
109
- development: {
110
- extractLicenses: false,
111
- optimization: false,
112
- sourceMap: true,
113
- vendorChunk: true,
114
- },
115
- production: {
116
- fileReplacements: [
117
- {
118
- replace: './src/environments/environment.ts',
119
- with: './src/environments/environment.prod.ts',
120
- },
121
- ],
122
- optimization: true,
123
- outputHashing: 'all',
124
- sourceMap: false,
125
- namedChunks: false,
126
- extractLicenses: true,
127
- vendorChunk: false,
128
- },
129
- },
130
- serve: {
131
- default: {
132
- hmr: true,
133
- server: {
134
- type: 'https',
135
- options: { cert: './server.crt', key: './server.key' },
136
- },
137
- port: 4200,
138
- headers: { 'Access-Control-Allow-Origin': '*' },
139
- historyApiFallback: {
140
- index: '/index.html',
141
- disableDotRule: true,
142
- htmlAcceptHeaders: ['text/html', 'application/xhtml+xml'],
143
- },
144
- },
145
- development: { open: true },
146
- production: { hmr: false },
147
- },
148
- };
149
-
150
- // Determine the correct configValue to use based on the configuration
151
- const configuration = process.env.NX_TASK_TARGET_CONFIGURATION || 'default';
152
-
153
- const buildOptions = {
154
- ...configValues.build.default,
155
- ...configValues.build[configuration],
156
- };
157
- const devServerOptions = {
158
- ...configValues.serve.default,
159
- ...configValues.serve[configuration],
160
- };
161
-
162
- /**
163
- * @type{import('@rspack/core').RspackOptionsNormalized}
164
- */
165
- module.exports = async () => ({
166
- devServer: devServerOptions,
167
- plugins: [
168
- new NxAppRspackPlugin(buildOptions),
169
- new NxReactRspackPlugin({
170
- // Uncomment this line if you don't want to use SVGR
171
- // See: https://react-svgr.com/
172
- // svgr: false
173
- }),
174
- // eslint-disable-next-line react-hooks/rules-of-hooks
175
- await useLegacyNxPlugin(require('./rspack.config.old'), buildOptions),
176
- ],
177
- });
178
- "
179
- `;
180
-
181
- exports[`convert-to-inferred all projects should migrate all projects using the rspack executors 3`] = `
182
- "const { NxAppRspackPlugin } = require('@nx/rspack/app-plugin');
183
- const { NxReactRspackPlugin } = require('@nx/rspack/react-plugin');
184
- const { useLegacyNxPlugin } = require('@nx/rspack');
185
-
186
- // These options were migrated by @nx/rspack:convert-to-inferred from
187
- // the project.json file and merged with the options in this file
188
- const configValues = {
189
- build: {
190
- default: {
191
- outputPath: '../../dist/apps/app3',
192
- index: './src/index.html',
193
- main: './src/main.tsx',
194
- tsConfig: './tsconfig.app.json',
195
- assets: ['./src/favicon.ico', './src/assets'],
196
- styles: ['./src/styles.scss'],
197
- },
198
- development: {
199
- extractLicenses: false,
200
- optimization: false,
201
- sourceMap: true,
202
- vendorChunk: true,
203
- },
204
- production: {
205
- fileReplacements: [
206
- {
207
- replace: './src/environments/environment.ts',
208
- with: './src/environments/environment.prod.ts',
209
- },
210
- ],
211
- optimization: true,
212
- outputHashing: 'all',
213
- sourceMap: false,
214
- namedChunks: false,
215
- extractLicenses: true,
216
- vendorChunk: false,
217
- },
218
- },
219
- serve: {
220
- default: {
221
- hmr: true,
222
- server: {
223
- type: 'https',
224
- options: { cert: './server.crt', key: './server.key' },
225
- },
226
- port: 4200,
227
- headers: { 'Access-Control-Allow-Origin': '*' },
228
- historyApiFallback: {
229
- index: '/index.html',
230
- disableDotRule: true,
231
- htmlAcceptHeaders: ['text/html', 'application/xhtml+xml'],
232
- },
233
- },
234
- development: { open: true },
235
- production: { hmr: false },
236
- },
237
- };
238
-
239
- // Determine the correct configValue to use based on the configuration
240
- const configuration = process.env.NX_TASK_TARGET_CONFIGURATION || 'default';
241
-
242
- const buildOptions = {
243
- ...configValues.build.default,
244
- ...configValues.build[configuration],
245
- };
246
- const devServerOptions = {
247
- ...configValues.serve.default,
248
- ...configValues.serve[configuration],
249
- };
250
-
251
- /**
252
- * @type{import('@rspack/core').RspackOptionsNormalized}
253
- */
254
- module.exports = async () => ({
255
- devServer: devServerOptions,
256
- plugins: [
257
- new NxAppRspackPlugin(buildOptions),
258
- new NxReactRspackPlugin({
259
- // Uncomment this line if you don't want to use SVGR
260
- // See: https://react-svgr.com/
261
- // svgr: false
262
- }),
263
- // eslint-disable-next-line react-hooks/rules-of-hooks
264
- await useLegacyNxPlugin(require('./rspack.config.old'), buildOptions),
265
- ],
266
- });
267
- "
268
- `;