@nx/js 20.2.0-beta.5 → 20.2.0-beta.7

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/js",
3
- "version": "20.2.0-beta.5",
3
+ "version": "20.2.0-beta.7",
4
4
  "private": false,
5
5
  "description": "The JS plugin for Nx contains executors and generators that provide the best experience for developing JavaScript and TypeScript projects. ",
6
6
  "repository": {
@@ -39,8 +39,8 @@
39
39
  "@babel/preset-env": "^7.23.2",
40
40
  "@babel/preset-typescript": "^7.22.5",
41
41
  "@babel/runtime": "^7.22.6",
42
- "@nx/devkit": "20.2.0-beta.5",
43
- "@nx/workspace": "20.2.0-beta.5",
42
+ "@nx/devkit": "20.2.0-beta.7",
43
+ "@nx/workspace": "20.2.0-beta.7",
44
44
  "@zkochan/js-yaml": "0.0.7",
45
45
  "babel-plugin-const-enum": "^1.0.1",
46
46
  "babel-plugin-macros": "^2.8.0",
@@ -136,7 +136,7 @@ async function syncGenerator(tree) {
136
136
  if (hasChanges) {
137
137
  await (0, devkit_1.formatFiles)(tree);
138
138
  return {
139
- outOfSyncMessage: 'Based on the workspace project graph, some TypeScript configuration files are missing project references to the projects they depend on or contain outdated project references.',
139
+ outOfSyncMessage: 'Some TypeScript configuration files are missing project references to the projects they depend on or contain outdated project references.',
140
140
  };
141
141
  }
142
142
  }
@@ -325,7 +325,7 @@ function getTsConfigPathFromReferencePath(tree, ownerTsConfigPath, referencePath
325
325
  */
326
326
  function patchTsconfigJsonReferences(tree, tsconfigInfoCaches, tsconfigPath, updatedReferences) {
327
327
  const stringifiedJsonContents = readRawTsconfigContents(tree, tsconfigInfoCaches, tsconfigPath);
328
- const edits = (0, jsonc_parser_1.modify)(stringifiedJsonContents, ['references'], updatedReferences, {});
328
+ const edits = (0, jsonc_parser_1.modify)(stringifiedJsonContents, ['references'], updatedReferences, { formattingOptions: { keepLines: false } });
329
329
  const updatedJsonContents = (0, jsonc_parser_1.applyEdits)(stringifiedJsonContents, edits);
330
330
  // The final contents will be formatted by formatFiles() later
331
331
  tree.write(tsconfigPath, updatedJsonContents);
@@ -109,14 +109,12 @@ function collectDependencies(project, projGraph, acc, shallow, areTopLevelDeps =
109
109
  });
110
110
  return acc;
111
111
  }
112
- function readTsConfigWithRemappedPaths(tsConfig, generatedTsConfigPath, dependencies) {
112
+ function readTsConfigWithRemappedPaths(originalTsconfigPath, generatedTsconfigPath, dependencies, workspaceRoot) {
113
113
  const generatedTsConfig = { compilerOptions: {} };
114
- const dirnameTsConfig = (0, path_1.dirname)(generatedTsConfigPath);
115
- const relativeTsconfig = (0, path_1.isAbsolute)(dirnameTsConfig)
116
- ? (0, path_1.relative)(devkit_1.workspaceRoot, dirnameTsConfig)
117
- : dirnameTsConfig;
118
- generatedTsConfig.extends = (0, path_1.relative)(relativeTsconfig, tsConfig);
119
- generatedTsConfig.compilerOptions.paths = computeCompilerOptionsPaths(tsConfig, dependencies);
114
+ const normalizedTsConfig = (0, path_1.resolve)(workspaceRoot, originalTsconfigPath);
115
+ const normalizedGeneratedTsConfigDir = (0, path_1.resolve)(workspaceRoot, (0, path_1.dirname)(generatedTsconfigPath));
116
+ generatedTsConfig.extends = (0, path_1.relative)(normalizedGeneratedTsConfigDir, normalizedTsConfig);
117
+ generatedTsConfig.compilerOptions.paths = computeCompilerOptionsPaths(originalTsconfigPath, dependencies);
120
118
  if (process.env.NX_VERBOSE_LOGGING_PATH_MAPPINGS === 'true') {
121
119
  output_1.output.log({
122
120
  title: 'TypeScript path mappings have been rewritten.',
@@ -232,7 +230,7 @@ function computeCompilerOptionsPaths(tsConfig, dependencies) {
232
230
  }
233
231
  function createTmpTsConfig(tsconfigPath, workspaceRoot, projectRoot, dependencies, useWorkspaceAsBaseUrl = false) {
234
232
  const tmpTsConfigPath = (0, path_1.join)(workspaceRoot, 'tmp', projectRoot, process.env.NX_TASK_TARGET_TARGET ?? 'build', 'tsconfig.generated.json');
235
- const parsedTSConfig = readTsConfigWithRemappedPaths(tsconfigPath, tmpTsConfigPath, dependencies);
233
+ const parsedTSConfig = readTsConfigWithRemappedPaths(tsconfigPath, tmpTsConfigPath, dependencies, workspaceRoot);
236
234
  process.on('exit', () => cleanupTmpTsConfigFile(tmpTsConfigPath));
237
235
  if (useWorkspaceAsBaseUrl) {
238
236
  parsedTSConfig.compilerOptions ??= {};