@nx/webpack 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,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/webpack",
3
- "version": "20.2.0-rc.0",
3
+ "version": "20.2.0",
4
4
  "private": false,
5
5
  "description": "The Nx Plugin for Webpack contains executors and generators that support building applications using Webpack.",
6
6
  "repository": {
@@ -65,8 +65,8 @@
65
65
  "webpack-dev-server": "^5.0.4",
66
66
  "webpack-node-externals": "^3.0.0",
67
67
  "webpack-subresource-integrity": "^5.1.0",
68
- "@nx/devkit": "20.2.0-rc.0",
69
- "@nx/js": "20.2.0-rc.0"
68
+ "@nx/devkit": "20.2.0",
69
+ "@nx/js": "20.2.0"
70
70
  },
71
71
  "publishConfig": {
72
72
  "access": "public"
@@ -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");
@@ -33,8 +34,9 @@ exports.createNodesV2 = [
33
34
  const cachePath = (0, path_1.join)(cache_directory_1.workspaceDataDirectory, `webpack-${optionsHash}.hash`);
34
35
  const targetsCache = readTargetsCache(cachePath);
35
36
  const normalizedOptions = normalizeOptions(options);
37
+ const isTsSolutionSetup = (0, ts_solution_setup_1.isUsingTsSolutionSetup)();
36
38
  try {
37
- return await (0, devkit_1.createNodesFromFiles)((configFile, options, context) => createNodesInternal(configFile, options, context, targetsCache), configFilePaths, normalizedOptions, context);
39
+ return await (0, devkit_1.createNodesFromFiles)((configFile, options, context) => createNodesInternal(configFile, options, context, targetsCache, isTsSolutionSetup), configFilePaths, normalizedOptions, context);
38
40
  }
39
41
  finally {
40
42
  writeTargetsToCache(cachePath, targetsCache);
@@ -46,10 +48,10 @@ exports.createNodes = [
46
48
  async (configFilePath, options, context) => {
47
49
  devkit_1.logger.warn('`createNodes` is deprecated. Update your plugin to utilize createNodesV2 instead. In Nx 20, this will change to the createNodesV2 API.');
48
50
  const normalizedOptions = normalizeOptions(options);
49
- return createNodesInternal(configFilePath, normalizedOptions, context, {});
51
+ return createNodesInternal(configFilePath, normalizedOptions, context, {}, (0, ts_solution_setup_1.isUsingTsSolutionSetup)());
50
52
  },
51
53
  ];
52
- async function createNodesInternal(configFilePath, options, context, targetsCache) {
54
+ async function createNodesInternal(configFilePath, options, context, targetsCache, isTsSolutionSetup) {
53
55
  const projectRoot = (0, path_1.dirname)(configFilePath);
54
56
  // Do not create a project if package.json and project.json isn't there.
55
57
  const siblingFiles = (0, fs_1.readdirSync)((0, path_1.join)(context.workspaceRoot, projectRoot));
@@ -58,7 +60,7 @@ async function createNodesInternal(configFilePath, options, context, targetsCach
58
60
  return {};
59
61
  }
60
62
  const hash = await (0, calculate_hash_for_create_nodes_1.calculateHashForCreateNodes)(projectRoot, options, context, [(0, js_1.getLockFileName)((0, devkit_1.detectPackageManager)(context.workspaceRoot))]);
61
- targetsCache[hash] ??= await createWebpackTargets(configFilePath, projectRoot, options, context);
63
+ targetsCache[hash] ??= await createWebpackTargets(configFilePath, projectRoot, options, context, isTsSolutionSetup);
62
64
  const { targets, metadata } = targetsCache[hash];
63
65
  return {
64
66
  projects: {
@@ -70,7 +72,7 @@ async function createNodesInternal(configFilePath, options, context, targetsCach
70
72
  },
71
73
  };
72
74
  }
73
- async function createWebpackTargets(configFilePath, projectRoot, options, context) {
75
+ async function createWebpackTargets(configFilePath, projectRoot, options, context, isTsSolutionSetup) {
74
76
  const namedInputs = (0, get_named_inputs_1.getNamedInputs)(projectRoot, context);
75
77
  const webpackConfig = (0, resolve_user_defined_webpack_config_1.resolveUserDefinedWebpackConfig)((0, path_1.join)(context.workspaceRoot, configFilePath), (0, js_1.getRootTsConfigPath)(), true);
76
78
  const webpackOptions = await (0, read_webpack_options_1.readWebpackOptions)(webpackConfig);
@@ -157,6 +159,20 @@ async function createWebpackTargets(configFilePath, projectRoot, options, contex
157
159
  spa: true,
158
160
  },
159
161
  };
162
+ if (isTsSolutionSetup) {
163
+ targets[options.buildTargetName].syncGenerators = [
164
+ '@nx/js:typescript-sync',
165
+ ];
166
+ targets[options.serveTargetName].syncGenerators = [
167
+ '@nx/js:typescript-sync',
168
+ ];
169
+ targets[options.previewTargetName].syncGenerators = [
170
+ '@nx/js:typescript-sync',
171
+ ];
172
+ targets[options.serveStaticTargetName].syncGenerators = [
173
+ '@nx/js:typescript-sync',
174
+ ];
175
+ }
160
176
  return { targets, metadata: {} };
161
177
  }
162
178
  function normalizeOutputPath(outputPath, projectRoot) {