@nx/devkit 16.7.0 → 16.7.2

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.
@@ -19,7 +19,7 @@ export type { Generator, GeneratorCallback, Executor, ExecutorContext, TaskGraph
19
19
  * @category Workspace
20
20
  */
21
21
  export { Workspaces } from 'nx/src/config/workspaces';
22
- export { readAllWorkspaceConfiguration, workspaceLayout, } from 'nx/src/config/configuration';
22
+ export { workspaceLayout } from 'nx/src/config/configuration';
23
23
  export type { NxPlugin, ProjectTargetConfigurator, } from 'nx/src/utils/nx-plugin';
24
24
  /**
25
25
  * @category Workspace
@@ -5,14 +5,13 @@
5
5
  * If you need to export something from nx, it should go into nx/src/devkit-exports
6
6
  */
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.cacheDir = exports.defaultTasksRunner = exports.getOutputsForTargetAndConfiguration = exports.readCachedProjectGraph = exports.createProjectGraphAsync = exports.reverse = exports.appRootPath = exports.workspaceRoot = exports.normalizePath = exports.joinPathFragments = exports.stripIndents = exports.writeJsonFile = exports.readJsonFile = exports.stripJsonComments = exports.serializeJson = exports.parseJson = exports.updateJson = exports.writeJson = exports.readJson = exports.ProjectGraphBuilder = exports.DependencyType = exports.getWorkspacePath = exports.isStandaloneProject = exports.updateWorkspaceConfiguration = exports.readWorkspaceConfiguration = exports.updateNxJson = exports.readNxJson = exports.getProjects = exports.updateProjectConfiguration = exports.removeProjectConfiguration = exports.readProjectConfiguration = exports.addProjectConfiguration = exports.runExecutor = exports.getPackageManagerVersion = exports.detectPackageManager = exports.getPackageManagerCommand = exports.output = exports.logger = exports.workspaceLayout = exports.readAllWorkspaceConfiguration = exports.Workspaces = void 0;
8
+ exports.cacheDir = exports.defaultTasksRunner = exports.getOutputsForTargetAndConfiguration = exports.readCachedProjectGraph = exports.createProjectGraphAsync = exports.reverse = exports.appRootPath = exports.workspaceRoot = exports.normalizePath = exports.joinPathFragments = exports.stripIndents = exports.writeJsonFile = exports.readJsonFile = exports.stripJsonComments = exports.serializeJson = exports.parseJson = exports.updateJson = exports.writeJson = exports.readJson = exports.ProjectGraphBuilder = exports.DependencyType = exports.getWorkspacePath = exports.isStandaloneProject = exports.updateWorkspaceConfiguration = exports.readWorkspaceConfiguration = exports.updateNxJson = exports.readNxJson = exports.getProjects = exports.updateProjectConfiguration = exports.removeProjectConfiguration = exports.readProjectConfiguration = exports.addProjectConfiguration = exports.runExecutor = exports.getPackageManagerVersion = exports.detectPackageManager = exports.getPackageManagerCommand = exports.output = exports.logger = exports.workspaceLayout = exports.Workspaces = void 0;
9
9
  /**
10
10
  * @category Workspace
11
11
  */
12
12
  var workspaces_1 = require("nx/src/config/workspaces");
13
13
  Object.defineProperty(exports, "Workspaces", { enumerable: true, get: function () { return workspaces_1.Workspaces; } });
14
14
  var configuration_1 = require("nx/src/config/configuration");
15
- Object.defineProperty(exports, "readAllWorkspaceConfiguration", { enumerable: true, get: function () { return configuration_1.readAllWorkspaceConfiguration; } });
16
15
  Object.defineProperty(exports, "workspaceLayout", { enumerable: true, get: function () { return configuration_1.workspaceLayout; } });
17
16
  /**
18
17
  * @category Logger
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/devkit",
3
- "version": "16.7.0",
3
+ "version": "16.7.2",
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.0",
31
+ "@nrwl/devkit": "16.7.2",
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": "37fd20b7063be8fe23a45892f5a21c2703bc53a6"
49
+ "gitHead": "b024f44a1ad4e1773e80f6dc72f9d22766b950f9"
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
@@ -52,7 +53,7 @@ function sortTsConfig(tree) {
52
53
  if (!tsConfigPath) {
53
54
  return;
54
55
  }
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) }) })));
56
+ updateJson(tree, tsConfigPath, (tsconfig) => (Object.assign(Object.assign({}, tsconfig), { compilerOptions: Object.assign(Object.assign({}, tsconfig.compilerOptions), { paths: sortObjectByKeys(tsconfig.compilerOptions.paths) }) })));
56
57
  }
57
58
  catch (e) {
58
59
  // catch noop
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.convertNxExecutor = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const nx_1 = require("../../nx");
6
- const { Workspaces, readNxJsonFromDisk } = (0, nx_1.requireNx)();
6
+ const { Workspaces, readNxJsonFromDisk, retrieveProjectConfigurationsWithAngularProjects, } = (0, nx_1.requireNx)();
7
7
  /**
8
8
  * Convert an Nx Executor into an Angular Devkit Builder
9
9
  *
@@ -17,10 +17,16 @@ function convertNxExecutor(executor) {
17
17
  ? readNxJsonFromDisk(builderContext.workspaceRoot)
18
18
  : // TODO(v18): remove readNxJson. This is to be backwards compatible with Nx 16.5 and below.
19
19
  workspaces.readNxJson();
20
- const projectsConfigurations = workspaces.readProjectsConfigurations({
21
- _includeProjectsFromAngularJson: true,
22
- });
23
20
  const promise = () => tslib_1.__awaiter(this, void 0, void 0, function* () {
21
+ const projectsConfigurations = retrieveProjectConfigurationsWithAngularProjects
22
+ ? {
23
+ version: 2,
24
+ projects: yield retrieveProjectConfigurationsWithAngularProjects(builderContext.workspaceRoot, nxJsonConfiguration).then((p) => p.projectNodes),
25
+ }
26
+ : // TODO(v18): remove retrieveProjectConfigurations. This is to be backwards compatible with Nx 16.5 and below.
27
+ workspaces.readProjectsConfigurations({
28
+ _includeProjectsFromAngularJson: true,
29
+ });
24
30
  const context = {
25
31
  root: builderContext.workspaceRoot,
26
32
  projectName: builderContext.target.project,
@@ -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) {