@nx/devkit 16.7.1 → 16.7.3

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/devkit",
3
- "version": "16.7.1",
3
+ "version": "16.7.3",
4
4
  "private": false,
5
5
  "description": "The Nx Devkit is used to customize Nx for different technologies and use cases. It contains many utility functions for reading and writing files, updating configuration, working with Abstract Syntax Trees(ASTs), and more.",
6
6
  "repository": {
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "homepage": "https://nx.dev",
30
30
  "dependencies": {
31
- "@nrwl/devkit": "16.7.1",
31
+ "@nrwl/devkit": "16.7.3",
32
32
  "ejs": "^3.1.7",
33
33
  "enquirer": "~2.3.6",
34
34
  "ignore": "^5.0.4",
@@ -46,5 +46,5 @@
46
46
  "migrations": "./migrations.json"
47
47
  },
48
48
  "type": "commonjs",
49
- "gitHead": "8b38708d6c18496711695499d07c95f3ecc31cc9"
49
+ "gitHead": "6ff5487c5f4ed9ed008df2af39e37d98fd289259"
50
50
  }
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.targetToTargetString = exports.parseTargetString = void 0;
4
- // eslint-disable-next-line @typescript-eslint/no-restricted-imports
5
- const split_target_1 = require("nx/src/utils/split-target");
6
4
  const nx_1 = require("../../nx");
7
- const { readCachedProjectGraph } = (0, nx_1.requireNx)();
5
+ let { readCachedProjectGraph, splitTarget } = (0, nx_1.requireNx)();
6
+ // TODO: Remove this in Nx 18 when Nx 16.7.0 is no longer supported
7
+ splitTarget = splitTarget !== null && splitTarget !== void 0 ? splitTarget : require('nx/src/utils/split-target').splitTarget;
8
8
  function parseTargetString(targetString, projectGraph) {
9
9
  if (!projectGraph) {
10
10
  try {
@@ -14,7 +14,7 @@ function parseTargetString(targetString, projectGraph) {
14
14
  projectGraph = { nodes: {} };
15
15
  }
16
16
  }
17
- const [project, target, configuration] = (0, split_target_1.splitTarget)(targetString, projectGraph);
17
+ const [project, target, configuration] = splitTarget(targetString, projectGraph);
18
18
  if (!project || !target) {
19
19
  throw new Error(`Invalid Target String: ${targetString}`);
20
20
  }
@@ -1,11 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.readTargetOptions = void 0;
4
- // eslint-disable-next-line @typescript-eslint/no-restricted-imports
5
- const params_1 = require("nx/src/utils/params");
6
4
  const nx_1 = require("../../nx");
7
5
  const path_1 = require("path");
8
- const { Workspaces, getExecutorInformation, calculateDefaultProjectName } = (0, nx_1.requireNx)();
6
+ let { Workspaces, getExecutorInformation, calculateDefaultProjectName, combineOptionsForExecutor, } = (0, nx_1.requireNx)();
7
+ // TODO: Remove this in Nx 18 when Nx 16.7.0 is no longer supported
8
+ combineOptionsForExecutor =
9
+ combineOptionsForExecutor !== null && combineOptionsForExecutor !== void 0 ? combineOptionsForExecutor : require('nx/src/utils/params').combineOptionsForExecutor;
9
10
  /**
10
11
  * Reads and combines options for a given target.
11
12
  *
@@ -26,6 +27,6 @@ function readTargetOptions({ project, target, configuration }, context) {
26
27
  ? calculateDefaultProjectName(context.cwd, context.root, { version: 2, projects: context.projectsConfigurations.projects }, context.nxJsonConfiguration)
27
28
  : // TODO(v18): remove calculateDefaultProjectName. This is to be backwards compatible with Nx 16.5 and below.
28
29
  ws.calculateDefaultProjectName(context.cwd, { version: 2, projects: context.projectsConfigurations.projects }, context.nxJsonConfiguration);
29
- return (0, params_1.combineOptionsForExecutor)({}, (_a = configuration !== null && configuration !== void 0 ? configuration : targetConfiguration.defaultConfiguration) !== null && _a !== void 0 ? _a : '', targetConfiguration, schema, defaultProject, (0, path_1.relative)(context.cwd, context.root));
30
+ return combineOptionsForExecutor({}, (_a = configuration !== null && configuration !== void 0 ? configuration : targetConfiguration.defaultConfiguration) !== null && _a !== void 0 ? _a : '', targetConfiguration, schema, defaultProject, (0, path_1.relative)(context.cwd, context.root));
30
31
  }
31
32
  exports.readTargetOptions = readTargetOptions;
@@ -3,10 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.formatFiles = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const path = require("path");
6
- // eslint-disable-next-line @typescript-eslint/no-restricted-imports
7
- const object_sort_1 = require("nx/src/utils/object-sort");
8
6
  const nx_1 = require("../../nx");
9
- const { updateJson, readJson } = (0, nx_1.requireNx)();
7
+ let { updateJson, readJson, sortObjectByKeys } = (0, nx_1.requireNx)();
8
+ // TODO: Remove this in Nx 18 when Nx 16.7.0 is no longer supported
9
+ sortObjectByKeys =
10
+ sortObjectByKeys !== null && sortObjectByKeys !== void 0 ? sortObjectByKeys : require('nx/src/utils/object-sort').sortObjectByKeys;
10
11
  /**
11
12
  * Formats all the created or updated files using Prettier
12
13
  * @param tree - the file system tree
@@ -37,7 +38,9 @@ function formatFiles(tree) {
37
38
  if (support.ignored || !support.inferredParser) {
38
39
  return;
39
40
  }
40
- tree.write(file.path, prettier.format(file.content.toString('utf-8'), options));
41
+ tree.write(file.path,
42
+ // In prettier v3 the format result is a promise
43
+ yield prettier.format(file.content.toString('utf-8'), options));
41
44
  }
42
45
  catch (e) {
43
46
  console.warn(`Could not format ${file.path}. Error: "${e.message}"`);
@@ -52,7 +55,7 @@ function sortTsConfig(tree) {
52
55
  if (!tsConfigPath) {
53
56
  return;
54
57
  }
55
- updateJson(tree, tsConfigPath, (tsconfig) => (Object.assign(Object.assign({}, tsconfig), { compilerOptions: Object.assign(Object.assign({}, tsconfig.compilerOptions), { paths: (0, object_sort_1.sortObjectByKeys)(tsconfig.compilerOptions.paths) }) })));
58
+ updateJson(tree, tsConfigPath, (tsconfig) => (Object.assign(Object.assign({}, tsconfig), { compilerOptions: Object.assign(Object.assign({}, tsconfig.compilerOptions), { paths: sortObjectByKeys(tsconfig.compilerOptions.paths) }) })));
56
59
  }
57
60
  catch (e) {
58
61
  // catch noop
@@ -29,9 +29,6 @@ function installPackagesTask(tree, alwaysRun = false, cwd = '', packageManager =
29
29
  cwd: (0, path_1.join)(tree.root, cwd),
30
30
  stdio: process.env.NX_GENERATE_QUIET === 'true' ? 'ignore' : 'inherit',
31
31
  };
32
- if (pmc.preInstall) {
33
- (0, child_process_1.execSync)(pmc.preInstall, execSyncOptions);
34
- }
35
32
  (0, child_process_1.execSync)(pmc.install, execSyncOptions);
36
33
  }
37
34
  }
@@ -21,7 +21,7 @@ function convertNxExecutor(executor) {
21
21
  const projectsConfigurations = retrieveProjectConfigurationsWithAngularProjects
22
22
  ? {
23
23
  version: 2,
24
- projects: yield retrieveProjectConfigurationsWithAngularProjects(builderContext.workspaceRoot, nxJsonConfiguration),
24
+ projects: yield retrieveProjectConfigurationsWithAngularProjects(builderContext.workspaceRoot, nxJsonConfiguration).then((p) => p.projectNodes),
25
25
  }
26
26
  : // TODO(v18): remove retrieveProjectConfigurations. This is to be backwards compatible with Nx 16.5 and below.
27
27
  workspaces.readProjectsConfigurations({
@@ -2,11 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.convertNxGenerator = void 0;
4
4
  const tslib_1 = require("tslib");
5
- // eslint-disable-next-line @typescript-eslint/no-restricted-imports
6
- const logger_1 = require("nx/src/utils/logger");
7
5
  const path_1 = require("path");
8
6
  const nx_1 = require("../../nx");
9
- const { logger } = (0, nx_1.requireNx)();
7
+ let { logger, stripIndent } = (0, nx_1.requireNx)();
8
+ // TODO: Remove this in Nx 18 when Nx 16.7.0 is no longer supported
9
+ stripIndent = stripIndent !== null && stripIndent !== void 0 ? stripIndent : require('nx/src/utils/logger').stripIndent;
10
10
  class RunCallbackTask {
11
11
  constructor(callback) {
12
12
  this.callback = callback;
@@ -167,7 +167,7 @@ class DevkitTreeFromAngularDevkitTree {
167
167
  this.warnUnsupportedFilePermissionsChange(filePath, mode);
168
168
  }
169
169
  warnUnsupportedFilePermissionsChange(filePath, mode) {
170
- logger.warn((0, logger_1.stripIndent)(`The Angular DevKit tree does not support changing a file permissions.
170
+ logger.warn(stripIndent(`The Angular DevKit tree does not support changing a file permissions.
171
171
  Ignoring changing ${filePath} permissions to ${mode}.`));
172
172
  }
173
173
  }
@@ -3,10 +3,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.collectPackageSecondaryEntryPoints = exports.recursivelyCollectSecondaryEntryPointsFromDirectory = exports.getNonNodeModulesSubDirs = exports.collectWorkspaceLibrarySecondaryEntryPoints = void 0;
4
4
  const path_1 = require("path");
5
5
  const fs_1 = require("fs");
6
- // eslint-disable-next-line @typescript-eslint/no-restricted-imports
7
- const package_json_1 = require("nx/src/utils/package-json");
8
6
  const nx_1 = require("../../../nx");
9
- const { readJsonFile, joinPathFragments, workspaceRoot } = (0, nx_1.requireNx)();
7
+ let { readJsonFile, joinPathFragments, workspaceRoot, readModulePackageJson } = (0, nx_1.requireNx)();
8
+ // TODO: Remove this in Nx 18 when Nx 16.7.0 is no longer supported
9
+ readModulePackageJson =
10
+ readModulePackageJson !== null && readModulePackageJson !== void 0 ? readModulePackageJson : require('nx/src/utils/package-json').readModulePackageJson;
10
11
  function collectWorkspaceLibrarySecondaryEntryPoints(library, tsconfigPathAliases) {
11
12
  const libraryRoot = (0, path_1.join)(workspaceRoot, library.root);
12
13
  const needsSecondaryEntryPointsCollected = (0, fs_1.existsSync)((0, path_1.join)(libraryRoot, 'ng-package.json'));
@@ -83,7 +84,7 @@ function collectPackageSecondaryEntryPoints(pkgName, pkgVersion, collectedPackag
83
84
  let packageJsonPath;
84
85
  let packageJson;
85
86
  try {
86
- ({ path: packageJsonPath, packageJson } = (0, package_json_1.readModulePackageJson)(pkgName));
87
+ ({ path: packageJsonPath, packageJson } = readModulePackageJson(pkgName));
87
88
  pathToPackage = (0, path_1.dirname)(packageJsonPath);
88
89
  }
89
90
  catch (_a) {