@nx/rspack 0.0.0-pr-30457-0ed97e4 → 0.0.0-pr-30516-4c8bfff

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": "0.0.0-pr-30457-0ed97e4",
4
+ "version": "0.0.0-pr-30516-4c8bfff",
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-30457-0ed97e4",
28
- "@nx/devkit": "0.0.0-pr-30457-0ed97e4",
29
- "@nx/web": "0.0.0-pr-30457-0ed97e4",
30
- "@nx/module-federation": "0.0.0-pr-30457-0ed97e4",
27
+ "@nx/js": "0.0.0-pr-30516-4c8bfff",
28
+ "@nx/devkit": "0.0.0-pr-30516-4c8bfff",
29
+ "@nx/web": "0.0.0-pr-30516-4c8bfff",
30
+ "@nx/module-federation": "0.0.0-pr-30516-4c8bfff",
31
31
  "@phenomnomnominal/tsquery": "~5.0.1",
32
32
  "@rspack/core": "^1.1.5",
33
33
  "@rspack/dev-server": "^1.0.9",
@@ -31,7 +31,8 @@ function getDevServerOptions(root, serveOptions, buildOptions) {
31
31
  htmlAcceptHeaders: ['text/html', 'application/xhtml+xml'],
32
32
  },
33
33
  onListening(server) {
34
- const isHttps = server.options.server?.type === 'https';
34
+ const isHttps = server.options.https ||
35
+ server.options.server?.type === 'https';
35
36
  devkit_1.logger.info(`NX Web Development Server is listening at ${isHttps ? 'https' : 'http'}://${server.options.host}:${server.options.port}${(0, serve_path_1.buildServePath)(buildOptions)}`);
36
37
  },
37
38
  open: false,
@@ -57,29 +57,6 @@ async function default_1(tree, options) {
57
57
  transformConfigFile(tree, rspackConfigPath);
58
58
  }
59
59
  (0, devkit_1.updateProjectConfiguration)(tree, options.project, project);
60
- const nxJson = (0, devkit_1.readNxJson)(tree);
61
- if (nxJson.plugins !== undefined && nxJson.plugins.length > 0) {
62
- const nonRspackPlugins = nxJson.plugins.filter((plugin) => (typeof plugin !== 'string' && plugin.plugin !== '@nx/rspack/plugin') ||
63
- (typeof plugin === 'string' && plugin !== '@nx/rspack/plugin'));
64
- let rspackPlugins = nxJson.plugins.filter((plugin) => (typeof plugin !== 'string' && plugin.plugin === '@nx/rspack/plugin') ||
65
- (typeof plugin === 'string' && plugin === '@nx/rspack/plugin'));
66
- if (rspackPlugins.length === 0) {
67
- rspackPlugins = rspackPlugins.map((plugin) => {
68
- if (typeof plugin === 'string') {
69
- return {
70
- plugin: plugin,
71
- exclude: [`${project.root}/*`],
72
- };
73
- }
74
- return {
75
- ...plugin,
76
- exclude: [...(plugin.exclude ?? []), `${project.root}/*`],
77
- };
78
- });
79
- nxJson.plugins = [...nonRspackPlugins, ...rspackPlugins];
80
- (0, devkit_1.updateNxJson)(tree, nxJson);
81
- }
82
- }
83
60
  const installTask = (0, devkit_1.addDependenciesToPackageJson)(tree, {}, {
84
61
  '@rspack/core': versions_1.rspackCoreVersion,
85
62
  '@rspack/dev-server': versions_1.rspackDevServerVersion,
@@ -57,6 +57,7 @@ async function rspackInitGenerator(tree, schema) {
57
57
  const devDependencies = {
58
58
  '@rspack/core': versions_1.rspackCoreVersion,
59
59
  '@rspack/cli': versions_1.rspackCoreVersion,
60
+ '@rspack/plugin-minify': versions_1.rspackPluginMinifyVersion,
60
61
  '@rspack/plugin-react-refresh': versions_1.rspackPluginReactRefreshVersion,
61
62
  'react-refresh': versions_1.reactRefreshVersion,
62
63
  };
package/src/index.d.ts CHANGED
@@ -4,5 +4,4 @@ export * from './utils/config';
4
4
  export * from './utils/with-nx';
5
5
  export * from './utils/with-react';
6
6
  export * from './utils/with-web';
7
- export * from './utils/e2e-web-server-info-utils';
8
7
  export * from './plugins/use-legacy-nx-plugin/use-legacy-nx-plugin';
package/src/index.js CHANGED
@@ -7,5 +7,4 @@ tslib_1.__exportStar(require("./utils/config"), exports);
7
7
  tslib_1.__exportStar(require("./utils/with-nx"), exports);
8
8
  tslib_1.__exportStar(require("./utils/with-react"), exports);
9
9
  tslib_1.__exportStar(require("./utils/with-web"), exports);
10
- tslib_1.__exportStar(require("./utils/e2e-web-server-info-utils"), exports);
11
10
  tslib_1.__exportStar(require("./plugins/use-legacy-nx-plugin/use-legacy-nx-plugin"), exports);
@@ -33,10 +33,6 @@ class NxAppRspackPlugin {
33
33
  Object.keys(compiler.options.entry['main']).length === 0) {
34
34
  compiler.options.entry = {};
35
35
  }
36
- // Prefer `clean` option from Rspack config over our own.
37
- if (typeof compiler.options.output.clean !== 'undefined') {
38
- this.options.deleteOutputPath = false;
39
- }
40
36
  (0, apply_base_config_1.applyBaseConfig)(this.options, compiler.options, {
41
37
  useNormalizedEntry: true,
42
38
  });
@@ -13,7 +13,6 @@ const nx_tsconfig_paths_rspack_plugin_1 = require("./plugins/nx-tsconfig-paths-r
13
13
  const get_terser_ecma_version_1 = require("./get-terser-ecma-version");
14
14
  const nodeExternals = require("webpack-node-externals");
15
15
  const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
16
- const is_lib_buildable_1 = require("./is-lib-buildable");
17
16
  const IGNORED_RSPACK_WARNINGS = [
18
17
  /The comment file/i,
19
18
  /could not find any license/i,
@@ -89,7 +88,7 @@ function applyNxIndependentConfig(options, config) {
89
88
  hashFunction: config.output?.hashFunction ?? 'xxhash64',
90
89
  // Disabled for performance
91
90
  pathinfo: config.output?.pathinfo ?? false,
92
- clean: config.output?.clean ?? options.deleteOutputPath,
91
+ clean: options.deleteOutputPath,
93
92
  };
94
93
  config.watch = options.watch;
95
94
  config.watchOptions = {
@@ -185,11 +184,8 @@ function applyNxDependentConfig(options, config, { useNormalizedEntry } = {}) {
185
184
  if (options.useTsconfigPaths) {
186
185
  plugins.push(new nx_tsconfig_paths_rspack_plugin_1.NxTsconfigPathsRspackPlugin({ ...options, tsConfig }));
187
186
  }
188
- // New TS Solution already has a typecheck target but allow it to run during serve
189
- if ((!options?.skipTypeChecking && !isUsingTsSolution) ||
190
- (isUsingTsSolution &&
191
- options?.skipTypeChecking === false &&
192
- process.env['WEBPACK_SERVE'])) {
187
+ // New TS Solution already has a typecheck target
188
+ if (!options?.skipTypeChecking && !isUsingTsSolution) {
193
189
  const { TsCheckerRspackPlugin } = require('ts-checker-rspack-plugin');
194
190
  plugins.push(new TsCheckerRspackPlugin({
195
191
  typescript: {
@@ -277,31 +273,7 @@ function applyNxDependentConfig(options, config, { useNormalizedEntry } = {}) {
277
273
  if ((options.target === 'node' || options.target === 'async-node') &&
278
274
  options.externalDependencies === 'all') {
279
275
  const modulesDir = `${options.root}/node_modules`;
280
- const graph = options.projectGraph;
281
- const projectName = options.projectName;
282
- const deps = graph?.dependencies?.[projectName] ?? [];
283
- // Collect non-buildable TS project references so that they are bundled
284
- // in the final output. This is needed for projects that are not buildable
285
- // but are referenced by buildable projects. This is needed for the new TS
286
- // solution setup.
287
- const nonBuildableWorkspaceLibs = isUsingTsSolution
288
- ? deps
289
- .filter((dep) => {
290
- const node = graph.nodes?.[dep.target];
291
- if (!node || node.type !== 'lib')
292
- return false;
293
- const hasBuildTarget = 'build' in (node.data?.targets ?? {});
294
- if (hasBuildTarget) {
295
- return false;
296
- }
297
- // If there is no build target we check the package exports to see if they reference
298
- // source files
299
- return !(0, is_lib_buildable_1.isBuildableLibrary)(node);
300
- })
301
- .map((dep) => graph.nodes?.[dep.target]?.data?.metadata?.js?.packageName)
302
- .filter((name) => !!name)
303
- : [];
304
- externals.push(nodeExternals({ modulesDir, allowlist: nonBuildableWorkspaceLibs }));
276
+ externals.push(nodeExternals({ modulesDir }));
305
277
  }
306
278
  else if (Array.isArray(options.externalDependencies)) {
307
279
  externals.push(function (ctx, callback) {
@@ -369,8 +341,6 @@ function applyNxDependentConfig(options, config, { useNormalizedEntry } = {}) {
369
341
  tsx: true,
370
342
  },
371
343
  transform: {
372
- legacyDecorator: true,
373
- decoratorMetadata: true,
374
344
  react: {
375
345
  runtime: 'automatic',
376
346
  pragma: 'React.createElement',
@@ -99,7 +99,7 @@ function postcssOptionsCreator(options, { includePaths, forCssModules = false, }
99
99
  ? []
100
100
  : [
101
101
  (0, postcss_cli_resources_1.PostcssCliResources)({
102
- baseHref: options.baseHref ? options.baseHref : undefined,
102
+ baseHref: options.baseHref,
103
103
  deployUrl: options.deployUrl,
104
104
  loader,
105
105
  filename: `[name]${hashFormat.file}.[ext]`,
@@ -55,7 +55,7 @@ export interface NxAppRspackPluginOptions {
55
55
  /**
56
56
  * Set <base href> for the resulting index.html.
57
57
  */
58
- baseHref?: string | false;
58
+ baseHref?: string;
59
59
  /**
60
60
  * Build the libraries from source. Default is `true`.
61
61
  */
@@ -63,7 +63,6 @@ export interface NxAppRspackPluginOptions {
63
63
  commonChunk?: boolean;
64
64
  /**
65
65
  * Delete the output path before building.
66
- * @deprecated Use the `output.clean` option in Rspack. https://rspack.dev/config/output#outputclean
67
66
  */
68
67
  deleteOutputPath?: boolean;
69
68
  /**
@@ -1,6 +1,7 @@
1
1
  export declare const nxVersion: any;
2
2
  export declare const rspackCoreVersion = "1.2.2";
3
3
  export declare const rspackDevServerVersion = "1.0.9";
4
+ export declare const rspackPluginMinifyVersion = "^0.7.5";
4
5
  export declare const rspackPluginReactRefreshVersion = "^1.0.0";
5
6
  export declare const lessLoaderVersion = "~11.1.3";
6
7
  export declare const sassLoaderVersion = "^16.0.4";
@@ -1,9 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
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.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
5
  exports.rspackCoreVersion = '1.2.2';
6
6
  exports.rspackDevServerVersion = '1.0.9';
7
+ exports.rspackPluginMinifyVersion = '^0.7.5';
7
8
  exports.rspackPluginReactRefreshVersion = '^1.0.0';
8
9
  exports.lessLoaderVersion = '~11.1.3';
9
10
  exports.sassLoaderVersion = '^16.0.4';
@@ -1,7 +0,0 @@
1
- import { type ProjectGraphProjectNode } from '@nx/devkit';
2
- /**
3
- * Check if the library is buildable.
4
- * @param node from the project graph
5
- * @returns boolean
6
- */
7
- export declare function isBuildableLibrary(node: ProjectGraphProjectNode): boolean;
@@ -1,48 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isBuildableLibrary = isBuildableLibrary;
4
- function isSourceFile(path) {
5
- return ['.ts', '.tsx', '.mts', '.cts'].some((ext) => path.endsWith(ext));
6
- }
7
- function isBuildableExportMap(packageExports) {
8
- if (!packageExports || Object.keys(packageExports).length === 0) {
9
- return false; // exports = {} → not buildable
10
- }
11
- const isCompiledExport = (value) => {
12
- if (typeof value === 'string') {
13
- return !isSourceFile(value);
14
- }
15
- if (typeof value === 'object' && value !== null) {
16
- return Object.entries(value).some(([key, subValue]) => {
17
- if (key === 'types' ||
18
- key === 'development' ||
19
- key === './package.json')
20
- return false;
21
- return typeof subValue === 'string' && !isSourceFile(subValue);
22
- });
23
- }
24
- return false;
25
- };
26
- if (packageExports['.']) {
27
- return isCompiledExport(packageExports['.']);
28
- }
29
- return Object.entries(packageExports).some(([key, value]) => key !== '.' && isCompiledExport(value));
30
- }
31
- /**
32
- * Check if the library is buildable.
33
- * @param node from the project graph
34
- * @returns boolean
35
- */
36
- function isBuildableLibrary(node) {
37
- if (!node.data.metadata?.js) {
38
- return false;
39
- }
40
- const { packageExports, packageMain } = node.data.metadata.js;
41
- // if we have exports only check this else fallback to packageMain
42
- if (packageExports) {
43
- return isBuildableExportMap(packageExports);
44
- }
45
- return (typeof packageMain === 'string' &&
46
- packageMain !== '' &&
47
- !isSourceFile(packageMain));
48
- }
@@ -1,2 +0,0 @@
1
- import { type Tree } from '@nx/devkit';
2
- export declare function getRspackE2EWebServerInfo(tree: Tree, projectName: string, configFilePath: string, isPluginBeingAdded: boolean, e2ePortOverride?: number): Promise<import("@nx/devkit/src/generators/e2e-web-server-info-utils").E2EWebServerDetails>;
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getRspackE2EWebServerInfo = getRspackE2EWebServerInfo;
4
- const devkit_1 = require("@nx/devkit");
5
- const e2e_web_server_info_utils_1 = require("@nx/devkit/src/generators/e2e-web-server-info-utils");
6
- async function getRspackE2EWebServerInfo(tree, projectName, configFilePath, isPluginBeingAdded, e2ePortOverride) {
7
- const nxJson = (0, devkit_1.readNxJson)(tree);
8
- let e2ePort = e2ePortOverride ?? 4200;
9
- if (nxJson.targetDefaults?.['serve'] &&
10
- nxJson.targetDefaults?.['serve'].options?.port) {
11
- e2ePort = nxJson.targetDefaults?.['serve'].options?.port;
12
- }
13
- return (0, e2e_web_server_info_utils_1.getE2EWebServerInfo)(tree, projectName, {
14
- plugin: '@nx/rspack/plugin',
15
- serveTargetName: 'serveTargetName',
16
- serveStaticTargetName: 'previewTargetName',
17
- configFilePath,
18
- }, {
19
- defaultServeTargetName: 'serve',
20
- defaultServeStaticTargetName: 'preview',
21
- defaultE2EWebServerAddress: `http://localhost:${e2ePort}`,
22
- defaultE2ECiBaseUrl: 'http://localhost:4200',
23
- defaultE2EPort: e2ePort,
24
- }, isPluginBeingAdded);
25
- }