nx 16.7.0-beta.3 → 16.7.0-beta.5

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.
Files changed (46) hide show
  1. package/.eslintrc.json +1 -0
  2. package/bin/init-local.js +0 -1
  3. package/bin/nx.js +20 -0
  4. package/package.json +15 -15
  5. package/plugins/package-json-workspaces.d.ts +13 -0
  6. package/plugins/package-json-workspaces.js +111 -0
  7. package/plugins/project-json.d.ts +4 -0
  8. package/plugins/project-json.js +28 -0
  9. package/src/adapter/angular-json.d.ts +1 -0
  10. package/src/adapter/angular-json.js +26 -10
  11. package/src/command-line/run/executor-utils.js +12 -3
  12. package/src/command-line/run/run.js +1 -19
  13. package/src/config/project-graph.d.ts +2 -0
  14. package/src/config/workspaces.d.ts +2 -25
  15. package/src/config/workspaces.js +5 -287
  16. package/src/core/graph/main.js +1 -1
  17. package/src/core/graph/polyfills.js +1 -1
  18. package/src/daemon/server/project-graph-incremental-recomputation.js +7 -5
  19. package/src/devkit-exports.d.ts +2 -2
  20. package/src/devkit-exports.js +2 -1
  21. package/src/executors/run-commands/run-commands.impl.js +3 -3
  22. package/src/generators/utils/project-configuration.js +50 -19
  23. package/src/native/index.d.ts +7 -2
  24. package/src/project-graph/affected/locators/project-glob-changes.js +5 -12
  25. package/src/project-graph/build-nodes/workspace-projects.d.ts +2 -4
  26. package/src/project-graph/build-nodes/workspace-projects.js +16 -11
  27. package/src/project-graph/build-project-graph.d.ts +2 -2
  28. package/src/project-graph/build-project-graph.js +41 -6
  29. package/src/project-graph/nx-deps-cache.js +6 -5
  30. package/src/project-graph/project-graph-builder.d.ts +34 -3
  31. package/src/project-graph/project-graph-builder.js +81 -49
  32. package/src/project-graph/project-graph.js +2 -2
  33. package/src/project-graph/utils/project-configuration-utils.d.ts +13 -0
  34. package/src/project-graph/utils/project-configuration-utils.js +162 -0
  35. package/src/project-graph/utils/retrieve-workspace-files.d.ts +9 -2
  36. package/src/project-graph/utils/retrieve-workspace-files.js +50 -40
  37. package/src/tasks-runner/forked-process-task-runner.d.ts +2 -2
  38. package/src/tasks-runner/forked-process-task-runner.js +65 -20
  39. package/src/utils/find-matching-projects.js +7 -1
  40. package/src/utils/globs.d.ts +1 -0
  41. package/src/utils/globs.js +8 -0
  42. package/src/utils/nx-plugin.d.ts +77 -14
  43. package/src/utils/nx-plugin.deprecated.d.ts +26 -0
  44. package/src/utils/nx-plugin.deprecated.js +2 -0
  45. package/src/utils/nx-plugin.js +33 -19
  46. package/src/utils/plugins/plugin-capabilities.js +7 -2
package/.eslintrc.json CHANGED
@@ -81,6 +81,7 @@
81
81
  "buildTargets": ["build-base"],
82
82
  "ignoredDependencies": [
83
83
  "typescript",
84
+ "@nrwl/angular",
84
85
  "@angular-devkit/build-angular",
85
86
  "@angular-devkit/core",
86
87
  "@angular-devkit/architect",
package/bin/init-local.js CHANGED
@@ -16,7 +16,6 @@ function initLocal(workspace) {
16
16
  process.env.NX_CLI_SET = 'true';
17
17
  try {
18
18
  perf_hooks_1.performance.mark('init-local');
19
- require('nx/src/utils/perf-logging');
20
19
  monkeyPatchRequire();
21
20
  if (workspace.type !== 'nx' && shouldDelegateToAngularCLI()) {
22
21
  console.warn((0, strip_indents_1.stripIndents) `Using Nx to run Angular CLI commands is deprecated and will be removed in a future version.
package/bin/nx.js CHANGED
@@ -3,6 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  const find_workspace_root_1 = require("../src/utils/find-workspace-root");
5
5
  const chalk = require("chalk");
6
+ const dotenv_1 = require("dotenv");
6
7
  const init_local_1 = require("./init-local");
7
8
  const output_1 = require("../src/utils/output");
8
9
  const installation_directory_1 = require("../src/utils/installation-directory");
@@ -12,12 +13,18 @@ const package_json_1 = require("../src/utils/package-json");
12
13
  const child_process_1 = require("child_process");
13
14
  const path_1 = require("path");
14
15
  const assert_supported_platform_1 = require("../src/native/assert-supported-platform");
16
+ const perf_hooks_1 = require("perf_hooks");
15
17
  function main() {
16
18
  if (process.argv[2] !== 'report' &&
17
19
  process.argv[2] !== '--version' &&
18
20
  process.argv[2] !== '--help') {
19
21
  (0, assert_supported_platform_1.assertSupportedPlatform)();
20
22
  }
23
+ require('nx/src/utils/perf-logging');
24
+ perf_hooks_1.performance.mark('loading dotenv files:start');
25
+ loadDotEnvFiles();
26
+ perf_hooks_1.performance.mark('loading dotenv files:end');
27
+ perf_hooks_1.performance.measure('loading dotenv files', 'loading dotenv files:start', 'loading dotenv files:end');
21
28
  const workspace = (0, find_workspace_root_1.findWorkspaceRoot)(process.cwd());
22
29
  // new is a special case because there is no local workspace to load
23
30
  if (process.argv[2] === 'new' ||
@@ -71,6 +78,19 @@ function main() {
71
78
  }
72
79
  }
73
80
  }
81
+ /**
82
+ * This loads dotenv files from:
83
+ * - .env
84
+ * - .local.env
85
+ * - .env.local
86
+ */
87
+ function loadDotEnvFiles() {
88
+ for (const file of ['.env', '.local.env', '.env.local']) {
89
+ (0, dotenv_1.config)({
90
+ path: file,
91
+ });
92
+ }
93
+ }
74
94
  function handleNoWorkspace(globalNxVersion) {
75
95
  output_1.output.log({
76
96
  title: `The current directory isn't part of an Nx workspace.`,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nx",
3
- "version": "16.7.0-beta.3",
3
+ "version": "16.7.0-beta.5",
4
4
  "private": false,
5
5
  "description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
6
6
  "repository": {
@@ -32,7 +32,7 @@
32
32
  },
33
33
  "homepage": "https://nx.dev",
34
34
  "dependencies": {
35
- "@nrwl/tao": "16.7.0-beta.3",
35
+ "@nrwl/tao": "16.7.0-beta.5",
36
36
  "@parcel/watcher": "2.0.4",
37
37
  "@yarnpkg/lockfile": "^1.1.0",
38
38
  "@yarnpkg/parsers": "3.0.0-rc.46",
@@ -42,7 +42,7 @@
42
42
  "cli-cursor": "3.1.0",
43
43
  "cli-spinners": "2.6.1",
44
44
  "cliui": "^7.0.2",
45
- "dotenv": "~10.0.0",
45
+ "dotenv": "~16.3.1",
46
46
  "enquirer": "~2.3.6",
47
47
  "fast-glob": "3.2.7",
48
48
  "figures": "3.2.0",
@@ -81,16 +81,16 @@
81
81
  }
82
82
  },
83
83
  "optionalDependencies": {
84
- "@nx/nx-darwin-arm64": "16.7.0-beta.3",
85
- "@nx/nx-darwin-x64": "16.7.0-beta.3",
86
- "@nx/nx-freebsd-x64": "16.7.0-beta.3",
87
- "@nx/nx-linux-arm-gnueabihf": "16.7.0-beta.3",
88
- "@nx/nx-linux-arm64-gnu": "16.7.0-beta.3",
89
- "@nx/nx-linux-arm64-musl": "16.7.0-beta.3",
90
- "@nx/nx-linux-x64-gnu": "16.7.0-beta.3",
91
- "@nx/nx-linux-x64-musl": "16.7.0-beta.3",
92
- "@nx/nx-win32-arm64-msvc": "16.7.0-beta.3",
93
- "@nx/nx-win32-x64-msvc": "16.7.0-beta.3"
84
+ "@nx/nx-darwin-arm64": "16.7.0-beta.5",
85
+ "@nx/nx-darwin-x64": "16.7.0-beta.5",
86
+ "@nx/nx-freebsd-x64": "16.7.0-beta.5",
87
+ "@nx/nx-linux-arm-gnueabihf": "16.7.0-beta.5",
88
+ "@nx/nx-linux-arm64-gnu": "16.7.0-beta.5",
89
+ "@nx/nx-linux-arm64-musl": "16.7.0-beta.5",
90
+ "@nx/nx-linux-x64-gnu": "16.7.0-beta.5",
91
+ "@nx/nx-linux-x64-musl": "16.7.0-beta.5",
92
+ "@nx/nx-win32-arm64-msvc": "16.7.0-beta.5",
93
+ "@nx/nx-win32-x64-msvc": "16.7.0-beta.5"
94
94
  },
95
95
  "nx-migrations": {
96
96
  "migrations": "./migrations.json",
@@ -176,6 +176,6 @@
176
176
  }
177
177
  },
178
178
  "main": "./bin/nx.js",
179
- "types": "./bin/nx.d.ts",
180
- "gitHead": "118faf4e432667fd041954d96aa6c9c99fea5ebd"
179
+ "type": "commonjs",
180
+ "gitHead": "fa513731d4e6a960f112a5af6b0d725b2e624b36"
181
181
  }
@@ -0,0 +1,13 @@
1
+ import { NxJsonConfiguration } from '../src/config/nx-json';
2
+ import { ProjectConfiguration } from '../src/config/workspace-json-project-json';
3
+ import { NxPluginV2 } from '../src/utils/nx-plugin';
4
+ export declare function getNxPackageJsonWorkspacesPlugin(root: string): NxPluginV2;
5
+ export declare function buildProjectConfigurationFromPackageJson(packageJson: {
6
+ name: string;
7
+ }, path: string, nxJson: NxJsonConfiguration): ProjectConfiguration & {
8
+ name: string;
9
+ };
10
+ /**
11
+ * Get the package.json globs from package manager workspaces
12
+ */
13
+ export declare function getGlobPatternsFromPackageManagerWorkspaces(root: string, readJson?: <T extends Object>(path: string) => T): string[];
@@ -0,0 +1,111 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getGlobPatternsFromPackageManagerWorkspaces = exports.buildProjectConfigurationFromPackageJson = exports.getNxPackageJsonWorkspacesPlugin = void 0;
4
+ const node_fs_1 = require("node:fs");
5
+ const node_path_1 = require("node:path");
6
+ const nx_json_1 = require("../src/config/nx-json");
7
+ const workspaces_1 = require("../src/config/workspaces");
8
+ const fileutils_1 = require("../src/utils/fileutils");
9
+ const globs_1 = require("../src/utils/globs");
10
+ const logger_1 = require("../src/utils/logger");
11
+ const output_1 = require("../src/utils/output");
12
+ const path_1 = require("../src/utils/path");
13
+ function getNxPackageJsonWorkspacesPlugin(root) {
14
+ const readJson = (f) => (0, fileutils_1.readJsonFile)((0, node_path_1.join)(root, f));
15
+ return {
16
+ name: 'nx-core-build-package-json-nodes',
17
+ createNodes: [
18
+ (0, globs_1.combineGlobPatterns)(getGlobPatternsFromPackageManagerWorkspaces(root, readJson)),
19
+ (pkgJsonPath) => {
20
+ const json = readJson(pkgJsonPath);
21
+ return {
22
+ projects: {
23
+ [json.name]: buildProjectConfigurationFromPackageJson(json, pkgJsonPath, (0, nx_json_1.readNxJson)(root)),
24
+ },
25
+ };
26
+ },
27
+ ],
28
+ };
29
+ }
30
+ exports.getNxPackageJsonWorkspacesPlugin = getNxPackageJsonWorkspacesPlugin;
31
+ function buildProjectConfigurationFromPackageJson(packageJson, path, nxJson) {
32
+ var _a, _b, _c, _d;
33
+ const normalizedPath = path.split('\\').join('/');
34
+ const directory = (0, node_path_1.dirname)(normalizedPath);
35
+ if (!packageJson.name && directory === '.') {
36
+ throw new Error('Nx requires the root package.json to specify a name if it is being used as an Nx project.');
37
+ }
38
+ let name = (_a = packageJson.name) !== null && _a !== void 0 ? _a : (0, workspaces_1.toProjectName)(normalizedPath);
39
+ if (nxJson === null || nxJson === void 0 ? void 0 : nxJson.npmScope) {
40
+ const npmPrefix = `@${nxJson.npmScope}/`;
41
+ if (name.startsWith(npmPrefix)) {
42
+ name = name.replace(npmPrefix, '');
43
+ }
44
+ }
45
+ const projectType = ((_b = nxJson === null || nxJson === void 0 ? void 0 : nxJson.workspaceLayout) === null || _b === void 0 ? void 0 : _b.appsDir) != ((_c = nxJson === null || nxJson === void 0 ? void 0 : nxJson.workspaceLayout) === null || _c === void 0 ? void 0 : _c.libsDir) &&
46
+ ((_d = nxJson === null || nxJson === void 0 ? void 0 : nxJson.workspaceLayout) === null || _d === void 0 ? void 0 : _d.appsDir) &&
47
+ directory.startsWith(nxJson.workspaceLayout.appsDir)
48
+ ? 'application'
49
+ : 'library';
50
+ return {
51
+ root: directory,
52
+ sourceRoot: directory,
53
+ name,
54
+ projectType,
55
+ };
56
+ }
57
+ exports.buildProjectConfigurationFromPackageJson = buildProjectConfigurationFromPackageJson;
58
+ /**
59
+ * Get the package.json globs from package manager workspaces
60
+ */
61
+ function getGlobPatternsFromPackageManagerWorkspaces(root, readJson = (path) => (0, fileutils_1.readJsonFile)((0, node_path_1.join)(root, path)) // making this an arg allows us to reuse in devkit
62
+ ) {
63
+ var _a, _b;
64
+ try {
65
+ const patterns = [];
66
+ const packageJson = readJson('package.json');
67
+ patterns.push(...normalizePatterns(Array.isArray(packageJson.workspaces)
68
+ ? packageJson.workspaces
69
+ : (_b = (_a = packageJson.workspaces) === null || _a === void 0 ? void 0 : _a.packages) !== null && _b !== void 0 ? _b : []));
70
+ if ((0, node_fs_1.existsSync)((0, node_path_1.join)(root, 'pnpm-workspace.yaml'))) {
71
+ try {
72
+ const { packages } = (0, fileutils_1.readYamlFile)((0, node_path_1.join)(root, 'pnpm-workspace.yaml'));
73
+ patterns.push(...normalizePatterns(packages || []));
74
+ }
75
+ catch (e) {
76
+ output_1.output.warn({
77
+ title: `${logger_1.NX_PREFIX} Unable to parse pnpm-workspace.yaml`,
78
+ bodyLines: [e.toString()],
79
+ });
80
+ }
81
+ }
82
+ if ((0, node_fs_1.existsSync)((0, node_path_1.join)(root, 'lerna.json'))) {
83
+ try {
84
+ const { packages } = readJson('lerna.json');
85
+ patterns.push(...normalizePatterns((packages === null || packages === void 0 ? void 0 : packages.length) > 0 ? packages : ['packages/*']));
86
+ }
87
+ catch (e) {
88
+ output_1.output.warn({
89
+ title: `${logger_1.NX_PREFIX} Unable to parse lerna.json`,
90
+ bodyLines: [e.toString()],
91
+ });
92
+ }
93
+ }
94
+ // Merge patterns from workspaces definitions
95
+ // TODO(@AgentEnder): update logic after better way to determine root project inclusion
96
+ // Include the root project
97
+ return packageJson.nx ? patterns.concat('package.json') : patterns;
98
+ }
99
+ catch (_c) {
100
+ return [];
101
+ }
102
+ }
103
+ exports.getGlobPatternsFromPackageManagerWorkspaces = getGlobPatternsFromPackageManagerWorkspaces;
104
+ function normalizePatterns(patterns) {
105
+ return patterns.map((pattern) => removeRelativePath(pattern.endsWith('/package.json')
106
+ ? pattern
107
+ : (0, path_1.joinPathFragments)(pattern, 'package.json')));
108
+ }
109
+ function removeRelativePath(pattern) {
110
+ return pattern.startsWith('./') ? pattern.substring(2) : pattern;
111
+ }
@@ -0,0 +1,4 @@
1
+ import { ProjectConfiguration } from '../src/config/workspace-json-project-json';
2
+ import { NxPluginV2 } from '../src/utils/nx-plugin';
3
+ export declare function getNxProjectJsonPlugin(root: string): NxPluginV2;
4
+ export declare function buildProjectFromProjectJson(json: Partial<ProjectConfiguration>, path: string): ProjectConfiguration;
@@ -0,0 +1,28 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildProjectFromProjectJson = exports.getNxProjectJsonPlugin = void 0;
4
+ const node_path_1 = require("node:path");
5
+ const workspaces_1 = require("../src/config/workspaces");
6
+ const fileutils_1 = require("../src/utils/fileutils");
7
+ function getNxProjectJsonPlugin(root) {
8
+ return {
9
+ name: 'nx-core-build-project-json-nodes',
10
+ createNodes: [
11
+ '{project.json,**/project.json}',
12
+ (file) => {
13
+ const json = (0, fileutils_1.readJsonFile)((0, node_path_1.join)(root, file));
14
+ const project = buildProjectFromProjectJson(json, file);
15
+ return {
16
+ projects: {
17
+ [project.name]: project,
18
+ },
19
+ };
20
+ },
21
+ ],
22
+ };
23
+ }
24
+ exports.getNxProjectJsonPlugin = getNxProjectJsonPlugin;
25
+ function buildProjectFromProjectJson(json, path) {
26
+ return Object.assign({ name: (0, workspaces_1.toProjectName)(path), root: (0, node_path_1.dirname)(path) }, json);
27
+ }
28
+ exports.buildProjectFromProjectJson = buildProjectFromProjectJson;
@@ -8,3 +8,4 @@ export declare function mergeAngularJsonAndProjects(projects: {
8
8
  };
9
9
  export declare function toNewFormat(w: any): ProjectsConfigurations;
10
10
  export declare function toOldFormat(w: any): any;
11
+ export declare function renamePropertyWithStableKeys(obj: any, from: string, to: string): void;
@@ -1,10 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toOldFormat = exports.toNewFormat = exports.mergeAngularJsonAndProjects = exports.isAngularPluginInstalled = exports.shouldMergeAngularProjects = void 0;
3
+ exports.renamePropertyWithStableKeys = exports.toOldFormat = exports.toNewFormat = exports.mergeAngularJsonAndProjects = exports.isAngularPluginInstalled = exports.shouldMergeAngularProjects = void 0;
4
4
  const fs_1 = require("fs");
5
5
  const path = require("path");
6
6
  const fileutils_1 = require("../utils/fileutils");
7
- const workspaces_1 = require("../config/workspaces");
8
7
  function shouldMergeAngularProjects(root, includeProjectsFromAngularJson) {
9
8
  if ((0, fs_1.existsSync)(path.join(root, 'angular.json')) &&
10
9
  // Include projects from angular.json if explicitly required.
@@ -56,19 +55,19 @@ exports.mergeAngularJsonAndProjects = mergeAngularJsonAndProjects;
56
55
  function toNewFormat(w) {
57
56
  Object.values(w.projects || {}).forEach((projectConfig) => {
58
57
  if (projectConfig.architect) {
59
- (0, workspaces_1.renamePropertyWithStableKeys)(projectConfig, 'architect', 'targets');
58
+ renamePropertyWithStableKeys(projectConfig, 'architect', 'targets');
60
59
  }
61
60
  if (projectConfig.schematics) {
62
- (0, workspaces_1.renamePropertyWithStableKeys)(projectConfig, 'schematics', 'generators');
61
+ renamePropertyWithStableKeys(projectConfig, 'schematics', 'generators');
63
62
  }
64
63
  Object.values(projectConfig.targets || {}).forEach((target) => {
65
64
  if (target.builder !== undefined) {
66
- (0, workspaces_1.renamePropertyWithStableKeys)(target, 'builder', 'executor');
65
+ renamePropertyWithStableKeys(target, 'builder', 'executor');
67
66
  }
68
67
  });
69
68
  });
70
69
  if (w.schematics) {
71
- (0, workspaces_1.renamePropertyWithStableKeys)(w, 'schematics', 'generators');
70
+ renamePropertyWithStableKeys(w, 'schematics', 'generators');
72
71
  }
73
72
  if (w.version !== 2) {
74
73
  w.version = 2;
@@ -82,20 +81,20 @@ function toOldFormat(w) {
82
81
  throw new Error("'project.json' files are incompatible with version 1 workspace schemas.");
83
82
  }
84
83
  if (projectConfig.targets) {
85
- (0, workspaces_1.renamePropertyWithStableKeys)(projectConfig, 'targets', 'architect');
84
+ renamePropertyWithStableKeys(projectConfig, 'targets', 'architect');
86
85
  }
87
86
  if (projectConfig.generators) {
88
- (0, workspaces_1.renamePropertyWithStableKeys)(projectConfig, 'generators', 'schematics');
87
+ renamePropertyWithStableKeys(projectConfig, 'generators', 'schematics');
89
88
  }
90
89
  delete projectConfig.name;
91
90
  Object.values(projectConfig.architect || {}).forEach((target) => {
92
91
  if (target.executor !== undefined) {
93
- (0, workspaces_1.renamePropertyWithStableKeys)(target, 'executor', 'builder');
92
+ renamePropertyWithStableKeys(target, 'executor', 'builder');
94
93
  }
95
94
  });
96
95
  });
97
96
  if (w.generators) {
98
- (0, workspaces_1.renamePropertyWithStableKeys)(w, 'generators', 'schematics');
97
+ renamePropertyWithStableKeys(w, 'generators', 'schematics');
99
98
  }
100
99
  if (w.version !== 1) {
101
100
  w.version = 1;
@@ -103,3 +102,20 @@ function toOldFormat(w) {
103
102
  return w;
104
103
  }
105
104
  exports.toOldFormat = toOldFormat;
105
+ // we have to do it this way to preserve the order of properties
106
+ // not to screw up the formatting
107
+ function renamePropertyWithStableKeys(obj, from, to) {
108
+ const copy = Object.assign({}, obj);
109
+ Object.keys(obj).forEach((k) => {
110
+ delete obj[k];
111
+ });
112
+ Object.keys(copy).forEach((k) => {
113
+ if (k === from) {
114
+ obj[to] = copy[k];
115
+ }
116
+ else {
117
+ obj[k] = copy[k];
118
+ }
119
+ });
120
+ }
121
+ exports.renamePropertyWithStableKeys = renamePropertyWithStableKeys;
@@ -14,9 +14,16 @@ function normalizeExecutorSchema(schema) {
14
14
  : schema.properties }, schema);
15
15
  }
16
16
  exports.normalizeExecutorSchema = normalizeExecutorSchema;
17
+ function cacheKey(nodeModule, executor, root) {
18
+ return `${root}:${nodeModule}:${executor}`;
19
+ }
20
+ const cachedExecutorInformation = {};
17
21
  function getExecutorInformation(nodeModule, executor, root) {
18
22
  try {
19
- const { executorsFilePath, executorConfig, isNgCompat } = readExecutorsJson(nodeModule, executor, root);
23
+ const key = cacheKey(nodeModule, executor, root);
24
+ if (cachedExecutorInformation[key])
25
+ return cachedExecutorInformation[key];
26
+ const { executorsFilePath, executorConfig, isNgCompat } = readExecutorJson(nodeModule, executor, root);
20
27
  const executorsDir = (0, path_1.dirname)(executorsFilePath);
21
28
  const schemaPath = (0, schema_utils_1.resolveSchema)(executorConfig.schema, executorsDir);
22
29
  const schema = normalizeExecutorSchema((0, fileutils_1.readJsonFile)(schemaPath));
@@ -27,7 +34,7 @@ function getExecutorInformation(nodeModule, executor, root) {
27
34
  const hasherFactory = executorConfig.hasher
28
35
  ? (0, schema_utils_1.getImplementationFactory)(executorConfig.hasher, executorsDir)
29
36
  : null;
30
- return {
37
+ const res = {
31
38
  schema,
32
39
  implementationFactory,
33
40
  batchImplementationFactory,
@@ -35,13 +42,15 @@ function getExecutorInformation(nodeModule, executor, root) {
35
42
  isNgCompat,
36
43
  isNxExecutor: !isNgCompat,
37
44
  };
45
+ cachedExecutorInformation[key] = res;
46
+ return res;
38
47
  }
39
48
  catch (e) {
40
49
  throw new Error(`Unable to resolve ${nodeModule}:${executor}.\n${e.message}`);
41
50
  }
42
51
  }
43
52
  exports.getExecutorInformation = getExecutorInformation;
44
- function readExecutorsJson(nodeModule, executor, root) {
53
+ function readExecutorJson(nodeModule, executor, root) {
45
54
  var _a, _b, _c, _d;
46
55
  const { json: packageJson, path: packageJsonPath } = (0, nx_plugin_1.readPluginPackageJson)(nodeModule, root
47
56
  ? [root, __dirname, process.cwd(), ...(0, installation_directory_1.getNxRequirePaths)()]
@@ -4,11 +4,7 @@ exports.run = exports.printTargetRunHelp = exports.runExecutor = exports.validat
4
4
  const tslib_1 = require("tslib");
5
5
  const params_1 = require("../../utils/params");
6
6
  const print_help_1 = require("../../utils/print-help");
7
- const fileutils_1 = require("../../utils/fileutils");
8
- const package_json_1 = require("../../utils/package-json");
9
7
  const path_1 = require("path");
10
- const fs_1 = require("fs");
11
- const nx_plugin_1 = require("../../utils/nx-plugin");
12
8
  const serialize_overrides_into_command_line_1 = require("../../utils/serialize-overrides-into-command-line");
13
9
  const project_graph_1 = require("../../project-graph/project-graph");
14
10
  const configuration_1 = require("../../config/configuration");
@@ -51,25 +47,11 @@ function iteratorToProcessStatusCode(i) {
51
47
  }
52
48
  });
53
49
  }
54
- function createImplicitTargetConfig(root, proj, targetName) {
55
- const packageJsonPath = (0, path_1.join)(root, proj.root, 'package.json');
56
- if (!(0, fs_1.existsSync)(packageJsonPath)) {
57
- return null;
58
- }
59
- const { scripts, nx } = (0, fileutils_1.readJsonFile)(packageJsonPath);
60
- if (!(targetName in (scripts || {})) ||
61
- !(nx.includedScripts && nx.includedScripts.includes(targetName))) {
62
- return null;
63
- }
64
- return (0, package_json_1.buildTargetFromScript)(targetName, nx);
65
- }
66
50
  function parseExecutorAndTarget({ project, target, configuration }, root, projectsConfigurations, nxJsonConfiguration) {
67
51
  var _a;
68
52
  return tslib_1.__awaiter(this, void 0, void 0, function* () {
69
53
  const proj = projectsConfigurations.projects[project];
70
- const targetConfig = ((_a = proj.targets) === null || _a === void 0 ? void 0 : _a[target]) ||
71
- createImplicitTargetConfig(root, proj, target) ||
72
- (0, nx_plugin_1.mergePluginTargetsWithNxTargets)(proj.root, proj.targets, yield (0, nx_plugin_1.loadNxPlugins)(nxJsonConfiguration.plugins, [root], root))[target];
54
+ const targetConfig = (_a = proj.targets) === null || _a === void 0 ? void 0 : _a[target];
73
55
  if (!targetConfig) {
74
56
  throw new Error(`Cannot find target '${target}' for project '${project}'`);
75
57
  }
@@ -92,6 +92,7 @@ export interface ProjectGraphDependency {
92
92
  }
93
93
  /**
94
94
  * Additional information to be used to process a project graph
95
+ * @deprecated The {@link ProjectGraphProcessor} is deprecated. This will be removed in Nx 18.
95
96
  */
96
97
  export interface ProjectGraphProcessorContext {
97
98
  /**
@@ -112,5 +113,6 @@ export interface ProjectGraphProcessorContext {
112
113
  }
113
114
  /**
114
115
  * A function that produces an updated ProjectGraph
116
+ * @deprecated Use {@link CreateNodes} and {@link CreateDependencies} instead. This will be removed in Nx 18.
115
117
  */
116
118
  export type ProjectGraphProcessor = (currentGraph: ProjectGraph, context: ProjectGraphProcessorContext) => ProjectGraph | Promise<ProjectGraph>;
@@ -1,5 +1,5 @@
1
- import type { NxJsonConfiguration, TargetDefaults } from './nx-json';
2
- import { ProjectConfiguration, ProjectsConfigurations, TargetConfiguration } from './workspace-json-project-json';
1
+ import type { NxJsonConfiguration } from './nx-json';
2
+ import { ProjectsConfigurations } from './workspace-json-project-json';
3
3
  export declare class Workspaces {
4
4
  private root;
5
5
  private cachedProjectsConfig;
@@ -24,26 +24,3 @@ export declare class Workspaces {
24
24
  * Todo: Should refactor, not duplicate.
25
25
  */
26
26
  export declare function toProjectName(fileName: string): string;
27
- /**
28
- * @deprecated Use getGlobPatternsFromPluginsAsync instead.
29
- */
30
- export declare function getGlobPatternsFromPlugins(nxJson: NxJsonConfiguration, paths: string[], root?: string): string[];
31
- export declare function getGlobPatternsFromPluginsAsync(nxJson: NxJsonConfiguration, paths: string[], root?: string): Promise<string[]>;
32
- /**
33
- * Get the package.json globs from package manager workspaces
34
- */
35
- export declare function getGlobPatternsFromPackageManagerWorkspaces(root: string): string[];
36
- /**
37
- * @description Loops through files and reduces them to 1 file per project.
38
- * @param files Array of files that may represent projects
39
- */
40
- export declare function deduplicateProjectFiles(files: string[]): string[];
41
- export declare function inferProjectFromNonStandardFile(file: string): ProjectConfiguration & {
42
- name: string;
43
- };
44
- export declare function buildProjectsConfigurationsFromProjectPaths(nxJson: NxJsonConfiguration, projectFiles: string[], // making this parameter allows devkit to pick up newly created projects
45
- readJson?: <T extends Object>(string: any) => T): Record<string, ProjectConfiguration>;
46
- export declare function mergeTargetConfigurations(projectConfiguration: ProjectConfiguration, target: string, targetDefaults: TargetDefaults[string]): TargetConfiguration;
47
- export declare function resolveNxTokensInOptions<T extends Object | Array<unknown>>(object: T, project: ProjectConfiguration, key: string): T;
48
- export declare function readTargetDefaultsForTarget(targetName: string, targetDefaults: TargetDefaults, executor?: string): TargetDefaults[string];
49
- export declare function renamePropertyWithStableKeys(obj: any, from: string, to: string): void;