@nx/rspack 20.2.0-rc.0 → 20.2.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/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.2.0-rc.0",
4
+ "version": "20.2.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.2.0-rc.0",
28
- "@nx/devkit": "20.2.0-rc.0",
29
- "@nx/web": "20.2.0-rc.0",
30
- "@nx/module-federation": "20.2.0-rc.0",
27
+ "@nx/js": "20.2.0",
28
+ "@nx/devkit": "20.2.0",
29
+ "@nx/web": "20.2.0",
30
+ "@nx/module-federation": "20.2.0",
31
31
  "@phenomnomnominal/tsquery": "~5.0.1",
32
32
  "@rspack/core": "^1.1.5",
33
33
  "@rspack/dev-server": "^1.0.9",
@@ -5,6 +5,7 @@ const devkit_1 = require("@nx/devkit");
5
5
  const calculate_hash_for_create_nodes_1 = require("@nx/devkit/src/utils/calculate-hash-for-create-nodes");
6
6
  const get_named_inputs_1 = require("@nx/devkit/src/utils/get-named-inputs");
7
7
  const js_1 = require("@nx/js");
8
+ const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
8
9
  const fs_1 = require("fs");
9
10
  const file_hasher_1 = require("nx/src/hasher/file-hasher");
10
11
  const cache_directory_1 = require("nx/src/utils/cache-directory");
@@ -28,15 +29,16 @@ exports.createNodesV2 = [
28
29
  const optionsHash = (0, file_hasher_1.hashObject)(options);
29
30
  const cachePath = (0, path_1.join)(cache_directory_1.workspaceDataDirectory, `rspack-${optionsHash}.hash`);
30
31
  const targetsCache = readTargetsCache(cachePath);
32
+ const isTsSolutionSetup = (0, ts_solution_setup_1.isUsingTsSolutionSetup)();
31
33
  try {
32
- return await (0, devkit_1.createNodesFromFiles)((configFile, options, context) => createNodesInternal(configFile, options, context, targetsCache), configFilePaths, options, context);
34
+ return await (0, devkit_1.createNodesFromFiles)((configFile, options, context) => createNodesInternal(configFile, options, context, targetsCache, isTsSolutionSetup), configFilePaths, options, context);
33
35
  }
34
36
  finally {
35
37
  writeTargetsToCache(cachePath, targetsCache);
36
38
  }
37
39
  },
38
40
  ];
39
- async function createNodesInternal(configFilePath, options, context, targetsCache) {
41
+ async function createNodesInternal(configFilePath, options, context, targetsCache, isTsSolutionSetup) {
40
42
  const projectRoot = (0, path_1.dirname)(configFilePath);
41
43
  // Do not create a project if package.json and project.json isn't there.
42
44
  const siblingFiles = (0, fs_1.readdirSync)((0, path_1.join)(context.workspaceRoot, projectRoot));
@@ -48,7 +50,7 @@ async function createNodesInternal(configFilePath, options, context, targetsCach
48
50
  // We do not want to alter how the hash is calculated, so appending the config file path to the hash
49
51
  // to prevent vite/vitest files overwriting the target cache created by the other
50
52
  const hash = (await (0, calculate_hash_for_create_nodes_1.calculateHashForCreateNodes)(projectRoot, normalizedOptions, context, [(0, js_1.getLockFileName)((0, devkit_1.detectPackageManager)(context.workspaceRoot))])) + configFilePath;
51
- targetsCache[hash] ??= await createRspackTargets(configFilePath, projectRoot, normalizedOptions, context);
53
+ targetsCache[hash] ??= await createRspackTargets(configFilePath, projectRoot, normalizedOptions, context, isTsSolutionSetup);
52
54
  const { targets, metadata } = targetsCache[hash];
53
55
  return {
54
56
  projects: {
@@ -60,7 +62,7 @@ async function createNodesInternal(configFilePath, options, context, targetsCach
60
62
  },
61
63
  };
62
64
  }
63
- async function createRspackTargets(configFilePath, projectRoot, options, context) {
65
+ async function createRspackTargets(configFilePath, projectRoot, options, context, isTsSolutionSetup) {
64
66
  const namedInputs = (0, get_named_inputs_1.getNamedInputs)(projectRoot, context);
65
67
  const rspackConfig = (0, resolve_user_defined_rspack_config_1.resolveUserDefinedRspackConfig)((0, path_1.join)(context.workspaceRoot, configFilePath), (0, js_1.getRootTsConfigPath)(), true);
66
68
  const rspackOptions = await (0, read_rspack_options_1.readRspackOptions)(rspackConfig);
@@ -109,6 +111,20 @@ async function createRspackTargets(configFilePath, projectRoot, options, context
109
111
  spa: true,
110
112
  },
111
113
  };
114
+ if (isTsSolutionSetup) {
115
+ targets[options.buildTargetName].syncGenerators = [
116
+ '@nx/js:typescript-sync',
117
+ ];
118
+ targets[options.serveTargetName].syncGenerators = [
119
+ '@nx/js:typescript-sync',
120
+ ];
121
+ targets[options.previewTargetName].syncGenerators = [
122
+ '@nx/js:typescript-sync',
123
+ ];
124
+ targets[options.serveStaticTargetName].syncGenerators = [
125
+ '@nx/js:typescript-sync',
126
+ ];
127
+ }
112
128
  return { targets, metadata: {} };
113
129
  }
114
130
  function normalizeOptions(options) {