nx 17.0.2 → 17.0.4
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/LICENSE +1 -1
- package/README.md +9 -4
- package/bin/init-local.js +10 -60
- package/bin/nx-cloud.js +6 -0
- package/bin/nx.js +1 -9
- package/bin/post-install.js +5 -1
- package/bin/run-executor.js +1 -1
- package/migrations.json +18 -0
- package/package.json +21 -18
- package/plugins/package-json.js +1 -1
- package/{changelog-renderer → release/changelog-renderer}/index.d.ts +18 -3
- package/{changelog-renderer → release/changelog-renderer}/index.js +78 -34
- package/release/index.d.ts +4 -0
- package/release/index.js +11 -0
- package/schemas/nx-schema.json +203 -19
- package/schemas/project-schema.json +20 -0
- package/src/adapter/angular-json.js +28 -18
- package/src/adapter/compat.d.ts +2 -2
- package/src/adapter/compat.js +6 -1
- package/src/adapter/ngcli-adapter.d.ts +16 -4
- package/src/adapter/ngcli-adapter.js +85 -28
- package/src/command-line/add/add.d.ts +2 -0
- package/src/command-line/add/add.js +169 -0
- package/src/command-line/add/command-object.d.ts +7 -0
- package/src/command-line/add/command-object.js +24 -0
- package/src/command-line/affected/affected.js +0 -3
- package/src/command-line/affected/command-object.d.ts +4 -4
- package/src/command-line/affected/command-object.js +53 -26
- package/src/command-line/affected/print-affected.js +10 -1
- package/src/command-line/connect/command-object.d.ts +1 -2
- package/src/command-line/connect/command-object.js +3 -7
- package/src/command-line/connect/connect-to-nx-cloud.d.ts +4 -5
- package/src/command-line/connect/connect-to-nx-cloud.js +43 -31
- package/src/command-line/connect/view-logs.js +5 -21
- package/src/command-line/examples.js +18 -0
- package/src/command-line/exec/command-object.js +2 -1
- package/src/command-line/exec/exec.d.ts +1 -1
- package/src/command-line/exec/exec.js +78 -35
- package/src/command-line/format/format.js +13 -4
- package/src/command-line/generate/generate.js +9 -9
- package/src/command-line/generate/generator-utils.d.ts +3 -2
- package/src/command-line/generate/generator-utils.js +5 -5
- package/src/command-line/graph/graph.d.ts +1 -1
- package/src/command-line/graph/graph.js +82 -37
- package/src/command-line/init/command-object.js +70 -43
- package/src/command-line/init/implementation/add-nx-to-monorepo.d.ts +4 -2
- package/src/command-line/init/implementation/add-nx-to-monorepo.js +12 -2
- package/src/command-line/init/implementation/add-nx-to-nest.d.ts +1 -1
- package/src/command-line/init/implementation/add-nx-to-nest.js +10 -6
- package/src/command-line/init/implementation/add-nx-to-npm-repo.d.ts +4 -2
- package/src/command-line/init/implementation/add-nx-to-npm-repo.js +15 -4
- package/src/command-line/init/implementation/angular/index.js +4 -1
- package/src/command-line/init/implementation/angular/legacy-angular-versions.js +10 -5
- package/src/command-line/init/implementation/angular/standalone-workspace.js +1 -1
- package/src/command-line/init/implementation/angular/types.d.ts +1 -1
- package/src/command-line/init/implementation/dot-nx/nxw.js +47 -16
- package/src/command-line/init/implementation/react/index.d.ts +1 -1
- package/src/command-line/init/implementation/react/index.js +4 -2
- package/src/command-line/init/implementation/react/rename-js-to-jsx.js +4 -2
- package/src/command-line/init/implementation/utils.d.ts +6 -5
- package/src/command-line/init/implementation/utils.js +59 -44
- package/src/command-line/init/{init.js → init-v1.js} +5 -13
- package/src/command-line/init/init-v2.d.ts +7 -0
- package/src/command-line/init/init-v2.js +201 -0
- package/src/command-line/list/list.js +6 -5
- package/src/command-line/migrate/command-object.js +19 -4
- package/src/command-line/migrate/migrate.js +21 -17
- package/src/command-line/new/new.js +1 -1
- package/src/command-line/nx-commands.js +4 -1
- package/src/command-line/release/changelog.d.ts +22 -1
- package/src/command-line/release/changelog.js +459 -257
- package/src/command-line/release/command-object.d.ts +29 -7
- package/src/command-line/release/command-object.js +120 -20
- package/src/command-line/release/config/config.d.ts +26 -21
- package/src/command-line/release/config/config.js +416 -59
- package/src/command-line/release/config/conventional-commits.d.ts +2 -0
- package/src/command-line/release/config/conventional-commits.js +98 -0
- package/src/command-line/release/config/filter-release-groups.d.ts +1 -2
- package/src/command-line/release/config/filter-release-groups.js +38 -1
- package/src/command-line/release/index.d.ts +16 -0
- package/src/command-line/release/index.js +23 -0
- package/src/command-line/release/publish.d.ts +7 -3
- package/src/command-line/release/publish.js +89 -37
- package/src/command-line/release/release.d.ts +4 -0
- package/src/command-line/release/release.js +176 -0
- package/src/command-line/release/utils/batch-projects-by-generator-config.d.ts +7 -0
- package/src/command-line/release/utils/batch-projects-by-generator-config.js +37 -0
- package/src/command-line/release/utils/exec-command.d.ts +1 -0
- package/src/command-line/release/utils/exec-command.js +34 -0
- package/src/command-line/release/utils/git.d.ts +34 -1
- package/src/command-line/release/utils/git.js +238 -34
- package/src/command-line/release/utils/github.d.ts +5 -5
- package/src/command-line/release/utils/github.js +155 -8
- package/src/command-line/release/utils/markdown.js +6 -1
- package/src/command-line/release/utils/print-changes.d.ts +1 -1
- package/src/command-line/release/utils/print-changes.js +3 -3
- package/src/command-line/release/utils/resolve-nx-json-error-message.js +4 -1
- package/src/command-line/release/utils/resolve-semver-specifier.d.ts +4 -0
- package/src/command-line/release/utils/resolve-semver-specifier.js +58 -0
- package/src/command-line/release/utils/semver.d.ts +8 -0
- package/src/command-line/release/utils/semver.js +30 -1
- package/src/command-line/release/utils/shared.d.ts +39 -0
- package/src/command-line/release/utils/shared.js +213 -0
- package/src/command-line/release/version.d.ts +37 -3
- package/src/command-line/release/version.js +312 -117
- package/src/command-line/repair/repair.js +13 -9
- package/src/command-line/report/report.js +2 -2
- package/src/command-line/run/command-object.d.ts +4 -0
- package/src/command-line/run/command-object.js +18 -2
- package/src/command-line/run/executor-utils.d.ts +2 -1
- package/src/command-line/run/executor-utils.js +4 -4
- package/src/command-line/run/run-one.js +3 -6
- package/src/command-line/run/run.js +34 -9
- package/src/command-line/run-many/command-object.js +4 -1
- package/src/command-line/run-many/run-many.js +0 -3
- package/src/command-line/show/command-object.d.ts +3 -0
- package/src/command-line/show/command-object.js +29 -2
- package/src/command-line/show/show.js +9 -0
- package/src/command-line/yargs-utils/shared-options.d.ts +4 -1
- package/src/command-line/yargs-utils/shared-options.js +23 -9
- package/src/commands-runner/command-graph.d.ts +13 -0
- package/src/commands-runner/command-graph.js +2 -0
- package/src/commands-runner/create-command-graph.d.ts +4 -0
- package/src/commands-runner/create-command-graph.js +44 -0
- package/src/commands-runner/get-command-projects.d.ts +3 -0
- package/src/commands-runner/get-command-projects.js +19 -0
- package/src/config/nx-json.d.ts +160 -25
- package/src/config/project-graph.d.ts +3 -3
- package/src/config/workspace-json-project-json.d.ts +11 -1
- package/src/config/workspaces.d.ts +1 -1
- package/src/config/workspaces.js +4 -6
- package/src/core/graph/3rdpartylicenses.txt +144 -74
- package/src/core/graph/environment.js +1 -1
- package/src/core/graph/index.html +4 -6
- package/src/core/graph/main.js +1 -1
- package/src/core/graph/runtime.js +1 -1
- package/src/core/graph/styles.css +3 -3
- package/src/core/graph/styles.js +1 -1
- package/src/daemon/client/client.d.ts +5 -1
- package/src/daemon/client/client.js +27 -8
- package/src/daemon/client/{socket-messenger.d.ts → daemon-socket-messenger.d.ts} +1 -1
- package/src/daemon/client/{socket-messenger.js → daemon-socket-messenger.js} +3 -3
- package/src/daemon/daemon-project-graph-error.d.ts +8 -0
- package/src/daemon/daemon-project-graph-error.js +13 -0
- package/src/daemon/server/handle-hash-tasks.js +12 -2
- package/src/daemon/server/handle-request-project-graph.js +1 -1
- package/src/daemon/server/project-graph-incremental-recomputation.d.ts +14 -13
- package/src/daemon/server/project-graph-incremental-recomputation.js +98 -33
- package/src/daemon/server/shutdown-utils.js +2 -4
- package/src/daemon/server/watcher.js +0 -3
- package/src/daemon/socket-utils.d.ts +2 -1
- package/src/daemon/socket-utils.js +15 -4
- package/src/daemon/tmp-dir.d.ts +1 -0
- package/src/daemon/tmp-dir.js +4 -4
- package/src/devkit-exports.d.ts +2 -2
- package/src/devkit-exports.js +3 -2
- package/src/devkit-internals.d.ts +3 -0
- package/src/devkit-internals.js +7 -1
- package/src/executors/noop/schema.json +1 -1
- package/src/executors/run-commands/run-commands.impl.d.ts +10 -2
- package/src/executors/run-commands/run-commands.impl.js +152 -48
- package/src/executors/run-commands/schema.json +11 -1
- package/src/executors/run-script/run-script.impl.js +43 -11
- package/src/executors/utils/convert-nx-executor.js +1 -1
- package/src/generators/internal-utils/format-changed-files-with-prettier-if-available.d.ts +3 -1
- package/src/generators/internal-utils/format-changed-files-with-prettier-if-available.js +4 -2
- package/src/generators/testing-utils/create-tree-with-empty-workspace.js +0 -6
- package/src/generators/tree.d.ts +1 -0
- package/src/generators/utils/glob.js +2 -2
- package/src/generators/utils/project-configuration.js +37 -16
- package/src/hasher/create-task-hasher.d.ts +4 -0
- package/src/hasher/create-task-hasher.js +16 -0
- package/src/hasher/hash-task.js +9 -3
- package/src/hasher/native-task-hasher-impl.d.ts +19 -0
- package/src/hasher/native-task-hasher-impl.js +37 -0
- package/src/hasher/node-task-hasher-impl.d.ts +49 -0
- package/src/hasher/node-task-hasher-impl.js +431 -0
- package/src/hasher/task-hasher.d.ts +33 -21
- package/src/hasher/task-hasher.js +30 -428
- package/src/migrations/update-15-0-0/migrate-to-inputs.js +5 -5
- package/src/migrations/update-15-1-0/set-project-names.js +2 -1
- package/src/migrations/update-15-8-2/update-nxw.js +2 -6
- package/src/migrations/update-17-0-0/rm-default-collection-npm-scope.js +3 -3
- package/src/migrations/update-17-0-0/use-minimal-config-for-tasks-runner-options.js +49 -13
- package/src/migrations/update-17-2-0/move-default-base.d.ts +5 -0
- package/src/migrations/update-17-2-0/move-default-base.js +21 -0
- package/src/migrations/update-17-3-0/nx-release-path.d.ts +3 -0
- package/src/migrations/update-17-3-0/nx-release-path.js +48 -0
- package/src/migrations/update-17-3-0/update-nxw.d.ts +2 -0
- package/src/migrations/update-17-3-0/update-nxw.js +7 -0
- package/src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.d.ts +2 -0
- package/src/migrations/update-18-0-0/disable-crystal-for-existing-workspaces.js +9 -0
- package/src/native/index.d.ts +65 -15
- package/src/native/index.js +6 -2
- package/src/native/transform-objects.js +2 -0
- package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.d.ts +1 -0
- package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +13 -12
- package/src/nx-cloud/generators/connect-to-nx-cloud/schema.json +6 -1
- package/src/nx-cloud/update-manager.js +2 -1
- package/src/plugins/js/index.d.ts +1 -1
- package/src/plugins/js/index.js +3 -3
- package/src/plugins/js/lock-file/lock-file.d.ts +2 -2
- package/src/plugins/js/lock-file/lock-file.js +15 -3
- package/src/plugins/js/package-json/create-package-json.js +1 -1
- package/src/plugins/js/project-graph/build-dependencies/strip-source-code.d.ts +1 -1
- package/src/plugins/js/project-graph/build-dependencies/strip-source-code.js +1 -1
- package/src/plugins/js/project-graph/build-dependencies/typescript-import-locator.d.ts +1 -1
- package/src/plugins/js/project-graph/build-dependencies/typescript-import-locator.js +1 -1
- package/src/plugins/js/utils/register.d.ts +1 -1
- package/src/plugins/js/utils/register.js +28 -8
- package/src/plugins/js/versions.d.ts +1 -1
- package/src/plugins/js/versions.js +1 -1
- package/{plugins/package-json-workspaces.d.ts → src/plugins/package-json-workspaces/create-nodes.d.ts} +4 -4
- package/{plugins/package-json-workspaces.js → src/plugins/package-json-workspaces/create-nodes.js} +34 -12
- package/src/plugins/package-json-workspaces/index.d.ts +1 -0
- package/src/plugins/package-json-workspaces/index.js +4 -0
- package/src/plugins/project-json/build-nodes/package-json-next-to-project-json.d.ts +2 -0
- package/src/plugins/project-json/build-nodes/package-json-next-to-project-json.js +47 -0
- package/src/plugins/project-json/build-nodes/project-json.d.ts +2 -5
- package/src/plugins/project-json/build-nodes/project-json.js +6 -44
- package/src/plugins/target-defaults/target-defaults-plugin.d.ts +66 -0
- package/src/plugins/target-defaults/target-defaults-plugin.js +182 -0
- package/src/project-graph/affected/locators/project-glob-changes.js +3 -3
- package/src/project-graph/affected/locators/workspace-projects.d.ts +0 -2
- package/src/project-graph/affected/locators/workspace-projects.js +16 -29
- package/src/project-graph/build-project-graph.d.ts +20 -1
- package/src/project-graph/build-project-graph.js +91 -33
- package/src/project-graph/file-map-utils.d.ts +9 -5
- package/src/project-graph/file-map-utils.js +16 -63
- package/src/project-graph/file-utils.d.ts +1 -1
- package/src/project-graph/file-utils.js +44 -2
- package/src/project-graph/nx-deps-cache.js +1 -1
- package/src/project-graph/project-graph-builder.d.ts +1 -1
- package/src/project-graph/project-graph-builder.js +1 -1
- package/src/project-graph/project-graph.d.ts +32 -1
- package/src/project-graph/project-graph.js +147 -23
- package/src/project-graph/utils/build-all-workspace-files.d.ts +2 -0
- package/src/project-graph/utils/build-all-workspace-files.js +15 -0
- package/src/project-graph/utils/normalize-project-nodes.d.ts +2 -3
- package/src/project-graph/utils/normalize-project-nodes.js +11 -34
- package/src/project-graph/utils/project-configuration-utils.d.ts +66 -4
- package/src/project-graph/utils/project-configuration-utils.js +503 -62
- package/src/project-graph/utils/retrieve-workspace-files.d.ts +12 -31
- package/src/project-graph/utils/retrieve-workspace-files.js +27 -88
- package/src/tasks-runner/batch/run-batch.js +3 -3
- package/src/tasks-runner/cache.js +6 -3
- package/src/tasks-runner/create-task-graph.js +1 -1
- package/src/tasks-runner/fork.d.ts +1 -0
- package/src/tasks-runner/fork.js +23 -0
- package/src/tasks-runner/forked-process-task-runner.d.ts +13 -5
- package/src/tasks-runner/forked-process-task-runner.js +111 -21
- package/src/tasks-runner/init-tasks-runner.js +1 -1
- package/src/tasks-runner/life-cycles/dynamic-run-many-terminal-output-life-cycle.js +28 -28
- package/src/tasks-runner/life-cycles/dynamic-run-one-terminal-output-life-cycle.js +19 -22
- package/src/tasks-runner/life-cycles/empty-terminal-output-life-cycle.js +1 -3
- package/src/tasks-runner/life-cycles/invoke-runner-terminal-output-life-cycle.js +1 -3
- package/src/tasks-runner/life-cycles/static-run-many-terminal-output-life-cycle.js +2 -4
- package/src/tasks-runner/life-cycles/static-run-one-terminal-output-life-cycle.d.ts +1 -0
- package/src/tasks-runner/life-cycles/static-run-one-terminal-output-life-cycle.js +11 -5
- package/src/tasks-runner/life-cycles/view-logs-utils.js +1 -1
- package/src/tasks-runner/pseudo-ipc.d.ts +49 -0
- package/src/tasks-runner/pseudo-ipc.js +140 -0
- package/src/tasks-runner/pseudo-terminal.d.ts +43 -0
- package/src/tasks-runner/pseudo-terminal.js +159 -0
- package/src/tasks-runner/run-command.d.ts +1 -1
- package/src/tasks-runner/run-command.js +13 -19
- package/src/tasks-runner/task-env.js +1 -2
- package/src/tasks-runner/task-graph-utils.d.ts +7 -3
- package/src/tasks-runner/task-graph-utils.js +15 -15
- package/src/tasks-runner/task-orchestrator.js +66 -12
- package/src/tasks-runner/tasks-schedule.js +3 -3
- package/src/tasks-runner/utils.d.ts +16 -7
- package/src/tasks-runner/utils.js +30 -16
- package/src/utils/ab-testing.d.ts +36 -2
- package/src/utils/ab-testing.js +34 -16
- package/src/utils/assert-workspace-validity.js +1 -1
- package/src/utils/cache-directory.d.ts +1 -0
- package/src/utils/cache-directory.js +5 -1
- package/src/utils/child-process.d.ts +15 -1
- package/src/utils/child-process.js +91 -1
- package/src/utils/command-line-utils.js +2 -1
- package/src/utils/exit-codes.d.ts +6 -0
- package/src/utils/exit-codes.js +20 -0
- package/src/utils/fileutils.d.ts +1 -0
- package/src/utils/find-matching-projects.js +5 -5
- package/src/utils/find-workspace-root.js +1 -0
- package/src/utils/ignore.js +8 -1
- package/src/utils/json-diff.d.ts +1 -0
- package/src/utils/json-diff.js +2 -1
- package/src/utils/json.js +3 -1
- package/src/utils/logger.js +1 -1
- package/src/utils/nx-cloud-utils.d.ts +1 -1
- package/src/utils/nx-cloud-utils.js +9 -4
- package/src/utils/nx-plugin.d.ts +32 -15
- package/src/utils/nx-plugin.deprecated.d.ts +10 -5
- package/src/utils/nx-plugin.deprecated.js +23 -0
- package/src/utils/nx-plugin.js +71 -80
- package/src/utils/output.d.ts +4 -2
- package/src/utils/output.js +44 -9
- package/src/utils/package-json.d.ts +4 -4
- package/src/utils/package-json.js +18 -12
- package/src/utils/package-manager.d.ts +8 -0
- package/src/utils/package-manager.js +29 -6
- package/src/utils/params.d.ts +12 -4
- package/src/utils/params.js +56 -8
- package/src/utils/plugins/core-plugins.js +8 -0
- package/src/utils/plugins/installed-plugins.d.ts +2 -1
- package/src/utils/plugins/installed-plugins.js +2 -2
- package/src/utils/plugins/local-plugins.js +1 -1
- package/src/utils/plugins/plugin-capabilities.d.ts +3 -2
- package/src/utils/plugins/plugin-capabilities.js +7 -7
- package/src/utils/typescript.js +1 -1
- package/src/utils/update-nxw.d.ts +2 -0
- package/src/utils/update-nxw.js +12 -0
- package/src/utils/workspace-configuration-check.js +1 -1
- package/src/utils/workspace-context.d.ts +6 -4
- package/src/utils/workspace-context.js +19 -9
- package/src/core/graph/polyfills.js +0 -1
- /package/src/command-line/init/{init.d.ts → init-v1.d.ts} +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const
|
|
3
|
+
exports.getImplicitlyTouchedProjects = exports.getTouchedProjects = void 0;
|
|
4
|
+
const minimatch_1 = require("minimatch");
|
|
5
5
|
const find_project_for_path_1 = require("../../utils/find-project-for-path");
|
|
6
6
|
const getTouchedProjects = (touchedFiles, projectGraphNodes) => {
|
|
7
7
|
const projectRootMap = (0, find_project_for_path_1.createProjectRootMappings)(projectGraphNodes);
|
|
@@ -16,15 +16,12 @@ const getTouchedProjects = (touchedFiles, projectGraphNodes) => {
|
|
|
16
16
|
exports.getTouchedProjects = getTouchedProjects;
|
|
17
17
|
const getImplicitlyTouchedProjects = (fileChanges, projectGraphNodes, nxJson) => {
|
|
18
18
|
const implicits = {};
|
|
19
|
-
const globalFiles = [...extractGlobalFilesFromInputs(nxJson), 'nx.json'];
|
|
20
|
-
globalFiles.forEach((file) => {
|
|
21
|
-
implicits[file] = '*';
|
|
22
|
-
});
|
|
23
19
|
Object.values(projectGraphNodes || {}).forEach((node) => {
|
|
24
|
-
|
|
25
|
-
...
|
|
26
|
-
...
|
|
27
|
-
|
|
20
|
+
const namedInputs = {
|
|
21
|
+
...nxJson.namedInputs,
|
|
22
|
+
...node.data.namedInputs,
|
|
23
|
+
};
|
|
24
|
+
extractFilesFromTargetInputs(node.data.targets, namedInputs).forEach((input) => {
|
|
28
25
|
implicits[input] ??= [];
|
|
29
26
|
if (Array.isArray(implicits[input])) {
|
|
30
27
|
implicits[input].push(node.name);
|
|
@@ -33,7 +30,7 @@ const getImplicitlyTouchedProjects = (fileChanges, projectGraphNodes, nxJson) =>
|
|
|
33
30
|
});
|
|
34
31
|
const touched = new Set();
|
|
35
32
|
for (const [pattern, projects] of Object.entries(implicits)) {
|
|
36
|
-
const implicitDependencyWasChanged = fileChanges.some((f) => minimatch(f.file, pattern, { dot: true }));
|
|
33
|
+
const implicitDependencyWasChanged = fileChanges.some((f) => (0, minimatch_1.minimatch)(f.file, pattern, { dot: true }));
|
|
37
34
|
if (!implicitDependencyWasChanged) {
|
|
38
35
|
continue;
|
|
39
36
|
}
|
|
@@ -48,33 +45,23 @@ const getImplicitlyTouchedProjects = (fileChanges, projectGraphNodes, nxJson) =>
|
|
|
48
45
|
return Array.from(touched);
|
|
49
46
|
};
|
|
50
47
|
exports.getImplicitlyTouchedProjects = getImplicitlyTouchedProjects;
|
|
51
|
-
function
|
|
52
|
-
const globalFiles = [];
|
|
53
|
-
globalFiles.push(...extractFilesFromNamedInputs(nxJson.namedInputs));
|
|
54
|
-
globalFiles.push(...extractFilesFromTargetInputs(nxJson.targetDefaults));
|
|
55
|
-
return globalFiles;
|
|
56
|
-
}
|
|
57
|
-
exports.extractGlobalFilesFromInputs = extractGlobalFilesFromInputs;
|
|
58
|
-
function extractFilesFromNamedInputs(namedInputs) {
|
|
59
|
-
const files = [];
|
|
60
|
-
for (const inputs of Object.values(namedInputs || {})) {
|
|
61
|
-
files.push(...extractFilesFromInputs(inputs));
|
|
62
|
-
}
|
|
63
|
-
return files;
|
|
64
|
-
}
|
|
65
|
-
function extractFilesFromTargetInputs(targets) {
|
|
48
|
+
function extractFilesFromTargetInputs(targets, namedInputs) {
|
|
66
49
|
const globalFiles = [];
|
|
67
50
|
for (const target of Object.values(targets || {})) {
|
|
68
51
|
if (target.inputs) {
|
|
69
|
-
globalFiles.push(...extractFilesFromInputs(target.inputs));
|
|
52
|
+
globalFiles.push(...extractFilesFromInputs(target.inputs, namedInputs));
|
|
70
53
|
}
|
|
71
54
|
}
|
|
72
55
|
return globalFiles;
|
|
73
56
|
}
|
|
74
|
-
function extractFilesFromInputs(inputs) {
|
|
57
|
+
function extractFilesFromInputs(inputs, namedInputs) {
|
|
75
58
|
const globalFiles = [];
|
|
76
59
|
for (const input of inputs) {
|
|
77
|
-
if (typeof input === 'string' && input
|
|
60
|
+
if (typeof input === 'string' && input in namedInputs) {
|
|
61
|
+
return extractFilesFromInputs(namedInputs[input], namedInputs);
|
|
62
|
+
}
|
|
63
|
+
else if (typeof input === 'string' &&
|
|
64
|
+
input.startsWith('{workspaceRoot}/')) {
|
|
78
65
|
globalFiles.push(input.substring('{workspaceRoot}/'.length));
|
|
79
66
|
}
|
|
80
67
|
else if (input.fileset && input.fileset.startsWith('{workspaceRoot}/')) {
|
|
@@ -2,11 +2,30 @@ import { FileData } from './file-utils';
|
|
|
2
2
|
import { FileMapCache } from './nx-deps-cache';
|
|
3
3
|
import { FileMap, ProjectGraph, ProjectGraphExternalNode } from '../config/project-graph';
|
|
4
4
|
import { ProjectConfiguration } from '../config/workspace-json-project-json';
|
|
5
|
+
import { NxWorkspaceFilesExternals } from '../native';
|
|
5
6
|
export declare function getFileMap(): {
|
|
6
7
|
fileMap: FileMap;
|
|
7
8
|
allWorkspaceFiles: FileData[];
|
|
9
|
+
rustReferences: NxWorkspaceFilesExternals | null;
|
|
8
10
|
};
|
|
9
|
-
export declare function buildProjectGraphUsingProjectFileMap(projects: Record<string, ProjectConfiguration>, externalNodes: Record<string, ProjectGraphExternalNode>, fileMap: FileMap, allWorkspaceFiles: FileData[], fileMapCache: FileMapCache | null
|
|
11
|
+
export declare function buildProjectGraphUsingProjectFileMap(projects: Record<string, ProjectConfiguration>, externalNodes: Record<string, ProjectGraphExternalNode>, fileMap: FileMap, allWorkspaceFiles: FileData[], rustReferences: NxWorkspaceFilesExternals, fileMapCache: FileMapCache | null): Promise<{
|
|
10
12
|
projectGraph: ProjectGraph;
|
|
11
13
|
projectFileMapCache: FileMapCache;
|
|
12
14
|
}>;
|
|
15
|
+
export declare class ProcessDependenciesError extends Error {
|
|
16
|
+
readonly pluginName: string;
|
|
17
|
+
constructor(pluginName: string, { cause }: {
|
|
18
|
+
cause: any;
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
export declare class ProcessProjectGraphError extends Error {
|
|
22
|
+
readonly pluginName: string;
|
|
23
|
+
constructor(pluginName: string, { cause }: {
|
|
24
|
+
cause: any;
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
export declare class CreateDependenciesError extends Error {
|
|
28
|
+
readonly errors: Array<ProcessDependenciesError | ProcessProjectGraphError>;
|
|
29
|
+
readonly partialProjectGraph: ProjectGraph;
|
|
30
|
+
constructor(errors: Array<ProcessDependenciesError | ProcessProjectGraphError>, partialProjectGraph: ProjectGraph);
|
|
31
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.buildProjectGraphUsingProjectFileMap = exports.getFileMap = void 0;
|
|
3
|
+
exports.CreateDependenciesError = exports.ProcessProjectGraphError = exports.ProcessDependenciesError = exports.buildProjectGraphUsingProjectFileMap = exports.getFileMap = void 0;
|
|
4
4
|
const workspace_root_1 = require("../utils/workspace-root");
|
|
5
5
|
const path_1 = require("path");
|
|
6
6
|
const perf_hooks_1 = require("perf_hooks");
|
|
@@ -14,13 +14,17 @@ const fileutils_1 = require("../utils/fileutils");
|
|
|
14
14
|
const project_graph_builder_1 = require("./project-graph-builder");
|
|
15
15
|
const configuration_1 = require("../config/configuration");
|
|
16
16
|
const fs_1 = require("fs");
|
|
17
|
+
const installation_directory_1 = require("../utils/installation-directory");
|
|
18
|
+
const output_1 = require("../utils/output");
|
|
17
19
|
let storedFileMap = null;
|
|
18
20
|
let storedAllWorkspaceFiles = null;
|
|
21
|
+
let storedRustReferences = null;
|
|
19
22
|
function getFileMap() {
|
|
20
23
|
if (!!storedFileMap) {
|
|
21
24
|
return {
|
|
22
25
|
fileMap: storedFileMap,
|
|
23
26
|
allWorkspaceFiles: storedAllWorkspaceFiles,
|
|
27
|
+
rustReferences: storedRustReferences,
|
|
24
28
|
};
|
|
25
29
|
}
|
|
26
30
|
else {
|
|
@@ -30,13 +34,15 @@ function getFileMap() {
|
|
|
30
34
|
projectFileMap: {},
|
|
31
35
|
},
|
|
32
36
|
allWorkspaceFiles: [],
|
|
37
|
+
rustReferences: null,
|
|
33
38
|
};
|
|
34
39
|
}
|
|
35
40
|
}
|
|
36
41
|
exports.getFileMap = getFileMap;
|
|
37
|
-
async function buildProjectGraphUsingProjectFileMap(projects, externalNodes, fileMap, allWorkspaceFiles,
|
|
42
|
+
async function buildProjectGraphUsingProjectFileMap(projects, externalNodes, fileMap, allWorkspaceFiles, rustReferences, fileMapCache) {
|
|
38
43
|
storedFileMap = fileMap;
|
|
39
44
|
storedAllWorkspaceFiles = allWorkspaceFiles;
|
|
45
|
+
storedRustReferences = rustReferences;
|
|
40
46
|
const nxJson = (0, configuration_1.readNxJson)();
|
|
41
47
|
const projectGraphVersion = '6.0';
|
|
42
48
|
(0, assert_workspace_validity_1.assertWorkspaceValidity)(projects, nxJson);
|
|
@@ -59,11 +65,8 @@ async function buildProjectGraphUsingProjectFileMap(projects, externalNodes, fil
|
|
|
59
65
|
};
|
|
60
66
|
}
|
|
61
67
|
const context = createContext(projects, nxJson, externalNodes, fileMap, filesToProcess);
|
|
62
|
-
let projectGraph = await buildProjectGraphUsingContext(
|
|
68
|
+
let projectGraph = await buildProjectGraphUsingContext(externalNodes, context, cachedFileData, projectGraphVersion);
|
|
63
69
|
const projectFileMapCache = (0, nx_deps_cache_1.createProjectFileMapCache)(nxJson, packageJsonDeps, fileMap, rootTsConfig);
|
|
64
|
-
if (shouldWriteCache) {
|
|
65
|
-
(0, nx_deps_cache_1.writeCache)(projectFileMapCache, projectGraph);
|
|
66
|
-
}
|
|
67
70
|
return {
|
|
68
71
|
projectGraph,
|
|
69
72
|
projectFileMapCache,
|
|
@@ -86,17 +89,30 @@ function readCombinedDeps() {
|
|
|
86
89
|
...installationPackageJson.devDependencies,
|
|
87
90
|
};
|
|
88
91
|
}
|
|
89
|
-
async function buildProjectGraphUsingContext(
|
|
92
|
+
async function buildProjectGraphUsingContext(knownExternalNodes, ctx, cachedFileData, projectGraphVersion) {
|
|
90
93
|
perf_hooks_1.performance.mark('build project graph:start');
|
|
91
94
|
const builder = new project_graph_builder_1.ProjectGraphBuilder(null, ctx.fileMap.projectFileMap);
|
|
92
95
|
builder.setVersion(projectGraphVersion);
|
|
93
96
|
for (const node in knownExternalNodes) {
|
|
94
97
|
builder.addExternalNode(knownExternalNodes[node]);
|
|
95
98
|
}
|
|
96
|
-
await (0, normalize_project_nodes_1.normalizeProjectNodes)(ctx, builder
|
|
99
|
+
await (0, normalize_project_nodes_1.normalizeProjectNodes)(ctx, builder);
|
|
97
100
|
const initProjectGraph = builder.getUpdatedProjectGraph();
|
|
98
|
-
|
|
99
|
-
|
|
101
|
+
let updatedGraph;
|
|
102
|
+
let error;
|
|
103
|
+
try {
|
|
104
|
+
updatedGraph = await updateProjectGraphWithPlugins(ctx, initProjectGraph);
|
|
105
|
+
}
|
|
106
|
+
catch (e) {
|
|
107
|
+
if (e instanceof CreateDependenciesError) {
|
|
108
|
+
updatedGraph = e.partialProjectGraph;
|
|
109
|
+
error = e;
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
throw e;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
const updatedBuilder = new project_graph_builder_1.ProjectGraphBuilder(updatedGraph, ctx.fileMap.projectFileMap);
|
|
100
116
|
for (const proj of Object.keys(cachedFileData.projectFileMap)) {
|
|
101
117
|
for (const f of ctx.fileMap.projectFileMap[proj] || []) {
|
|
102
118
|
const cached = cachedFileData.projectFileMap[proj][f.file];
|
|
@@ -115,7 +131,12 @@ async function buildProjectGraphUsingContext(nxJson, knownExternalNodes, ctx, ca
|
|
|
115
131
|
const finalGraph = updatedBuilder.getUpdatedProjectGraph();
|
|
116
132
|
perf_hooks_1.performance.mark('build project graph:end');
|
|
117
133
|
perf_hooks_1.performance.measure('build project graph', 'build project graph:start', 'build project graph:end');
|
|
118
|
-
|
|
134
|
+
if (!error) {
|
|
135
|
+
return finalGraph;
|
|
136
|
+
}
|
|
137
|
+
else {
|
|
138
|
+
throw new CreateDependenciesError(error.errors, finalGraph);
|
|
139
|
+
}
|
|
119
140
|
}
|
|
120
141
|
function createContext(projects, nxJson, externalNodes, fileMap, filesToProcess) {
|
|
121
142
|
const clonedProjects = Object.keys(projects).reduce((map, projectName) => {
|
|
@@ -134,20 +155,21 @@ function createContext(projects, nxJson, externalNodes, fileMap, filesToProcess)
|
|
|
134
155
|
};
|
|
135
156
|
}
|
|
136
157
|
async function updateProjectGraphWithPlugins(context, initProjectGraph) {
|
|
137
|
-
const plugins = await (0, nx_plugin_1.loadNxPlugins)(context.nxJsonConfiguration?.plugins);
|
|
158
|
+
const plugins = await (0, nx_plugin_1.loadNxPlugins)(context.nxJsonConfiguration?.plugins, (0, installation_directory_1.getNxRequirePaths)(), context.workspaceRoot, context.projects);
|
|
138
159
|
let graph = initProjectGraph;
|
|
160
|
+
const errors = [];
|
|
139
161
|
for (const { plugin } of plugins) {
|
|
140
162
|
try {
|
|
141
163
|
if ((0, nx_plugin_1.isNxPluginV1)(plugin) &&
|
|
142
164
|
plugin.processProjectGraph &&
|
|
143
165
|
!plugin.createDependencies) {
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
166
|
+
output_1.output.warn({
|
|
167
|
+
title: `${plugin.name} is a v1 plugin.`,
|
|
168
|
+
bodyLines: [
|
|
169
|
+
'Nx has recently released a v2 model for project graph plugins. The `processProjectGraph` method is deprecated. Plugins should use some combination of `createNodes` and `createDependencies` instead.',
|
|
170
|
+
],
|
|
171
|
+
});
|
|
172
|
+
perf_hooks_1.performance.mark(`${plugin.name}:processProjectGraph - start`);
|
|
151
173
|
graph = await plugin.processProjectGraph(graph, {
|
|
152
174
|
...context,
|
|
153
175
|
projectsConfigurations: {
|
|
@@ -162,20 +184,20 @@ async function updateProjectGraphWithPlugins(context, initProjectGraph) {
|
|
|
162
184
|
...context.nxJsonConfiguration,
|
|
163
185
|
},
|
|
164
186
|
});
|
|
187
|
+
perf_hooks_1.performance.mark(`${plugin.name}:processProjectGraph - end`);
|
|
188
|
+
perf_hooks_1.performance.measure(`${plugin.name}:processProjectGraph`, `${plugin.name}:processProjectGraph - start`, `${plugin.name}:processProjectGraph - end`);
|
|
165
189
|
}
|
|
166
190
|
}
|
|
167
191
|
catch (e) {
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
throw e;
|
|
172
|
-
}
|
|
173
|
-
throw new Error(message);
|
|
192
|
+
errors.push(new ProcessProjectGraphError(plugin.name, {
|
|
193
|
+
cause: e,
|
|
194
|
+
}));
|
|
174
195
|
}
|
|
175
196
|
}
|
|
176
197
|
const builder = new project_graph_builder_1.ProjectGraphBuilder(graph, context.fileMap.projectFileMap, context.fileMap.nonProjectFiles);
|
|
177
198
|
const createDependencyPlugins = plugins.filter(({ plugin }) => (0, nx_plugin_1.isNxPluginV2)(plugin) && plugin.createDependencies);
|
|
178
199
|
await Promise.all(createDependencyPlugins.map(async ({ plugin, options }) => {
|
|
200
|
+
perf_hooks_1.performance.mark(`${plugin.name}:createDependencies - start`);
|
|
179
201
|
try {
|
|
180
202
|
const dependencies = await plugin.createDependencies(options, {
|
|
181
203
|
...context,
|
|
@@ -184,17 +206,53 @@ async function updateProjectGraphWithPlugins(context, initProjectGraph) {
|
|
|
184
206
|
builder.addDependency(dep.source, dep.target, dep.type, 'sourceFile' in dep ? dep.sourceFile : null);
|
|
185
207
|
}
|
|
186
208
|
}
|
|
187
|
-
catch (
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
throw e;
|
|
192
|
-
}
|
|
193
|
-
throw new Error(message);
|
|
209
|
+
catch (cause) {
|
|
210
|
+
errors.push(new ProcessDependenciesError(plugin.name, {
|
|
211
|
+
cause,
|
|
212
|
+
}));
|
|
194
213
|
}
|
|
214
|
+
perf_hooks_1.performance.mark(`${plugin.name}:createDependencies - end`);
|
|
215
|
+
perf_hooks_1.performance.measure(`${plugin.name}:createDependencies`, `${plugin.name}:createDependencies - start`, `${plugin.name}:createDependencies - end`);
|
|
195
216
|
}));
|
|
196
|
-
|
|
217
|
+
const result = builder.getUpdatedProjectGraph();
|
|
218
|
+
if (errors.length === 0) {
|
|
219
|
+
return result;
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
throw new CreateDependenciesError(errors, result);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
class ProcessDependenciesError extends Error {
|
|
226
|
+
constructor(pluginName, { cause }) {
|
|
227
|
+
super(`The "${pluginName}" plugin threw an error while creating dependencies:`, {
|
|
228
|
+
cause,
|
|
229
|
+
});
|
|
230
|
+
this.pluginName = pluginName;
|
|
231
|
+
this.name = this.constructor.name;
|
|
232
|
+
this.stack = `${this.message}\n ${cause.stack.split('\n').join('\n ')}`;
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
exports.ProcessDependenciesError = ProcessDependenciesError;
|
|
236
|
+
class ProcessProjectGraphError extends Error {
|
|
237
|
+
constructor(pluginName, { cause }) {
|
|
238
|
+
super(`The "${pluginName}" plugin threw an error while processing the project graph:`, {
|
|
239
|
+
cause,
|
|
240
|
+
});
|
|
241
|
+
this.pluginName = pluginName;
|
|
242
|
+
this.name = this.constructor.name;
|
|
243
|
+
this.stack = `${this.message}\n ${cause.stack.split('\n').join('\n ')}`;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
exports.ProcessProjectGraphError = ProcessProjectGraphError;
|
|
247
|
+
class CreateDependenciesError extends Error {
|
|
248
|
+
constructor(errors, partialProjectGraph) {
|
|
249
|
+
super('Failed to create dependencies. See above for errors');
|
|
250
|
+
this.errors = errors;
|
|
251
|
+
this.partialProjectGraph = partialProjectGraph;
|
|
252
|
+
this.name = this.constructor.name;
|
|
253
|
+
}
|
|
197
254
|
}
|
|
255
|
+
exports.CreateDependenciesError = CreateDependenciesError;
|
|
198
256
|
function readRootTsConfig() {
|
|
199
257
|
try {
|
|
200
258
|
const tsConfigPath = (0, typescript_1.getRootTsConfigPath)();
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { FileData, FileMap, ProjectFileMap, ProjectGraph } from '../config/project-graph';
|
|
2
2
|
import { ProjectConfiguration, ProjectsConfigurations } from '../config/workspace-json-project-json';
|
|
3
|
-
|
|
4
|
-
export
|
|
3
|
+
import { NxWorkspaceFilesExternals } from '../native';
|
|
4
|
+
export interface WorkspaceFileMap {
|
|
5
5
|
allWorkspaceFiles: FileData[];
|
|
6
6
|
fileMap: FileMap;
|
|
7
|
-
}
|
|
8
|
-
export declare function
|
|
9
|
-
|
|
7
|
+
}
|
|
8
|
+
export declare function createProjectFileMapUsingProjectGraph(graph: ProjectGraph): Promise<ProjectFileMap>;
|
|
9
|
+
export declare function createFileMapUsingProjectGraph(graph: ProjectGraph): Promise<WorkspaceFileMap>;
|
|
10
|
+
export declare function createFileMap(projectsConfigurations: ProjectsConfigurations, allWorkspaceFiles: FileData[]): WorkspaceFileMap;
|
|
11
|
+
export declare function updateFileMap(projectsConfigurations: Record<string, ProjectConfiguration>, rustReferences: NxWorkspaceFilesExternals, updatedFiles: Record<string, string>, deletedFiles: string[]): {
|
|
12
|
+
fileMap: import("../native").FileMap;
|
|
10
13
|
allWorkspaceFiles: FileData[];
|
|
14
|
+
rustReferences: NxWorkspaceFilesExternals;
|
|
11
15
|
};
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.updateFileMap = exports.createFileMap = exports.createProjectFileMapUsingProjectGraph = void 0;
|
|
4
|
-
const find_project_for_path_1 = require("./utils/find-project-for-path");
|
|
3
|
+
exports.updateFileMap = exports.createFileMap = exports.createFileMapUsingProjectGraph = exports.createProjectFileMapUsingProjectGraph = void 0;
|
|
5
4
|
const client_1 = require("../daemon/client/client");
|
|
6
|
-
const project_graph_1 = require("./project-graph");
|
|
7
5
|
const workspace_context_1 = require("../utils/workspace-context");
|
|
8
6
|
const workspace_root_1 = require("../utils/workspace-root");
|
|
7
|
+
const project_graph_1 = require("./project-graph");
|
|
8
|
+
const build_all_workspace_files_1 = require("./utils/build-all-workspace-files");
|
|
9
|
+
const find_project_for_path_1 = require("./utils/find-project-for-path");
|
|
9
10
|
async function createProjectFileMapUsingProjectGraph(graph) {
|
|
11
|
+
return (await createFileMapUsingProjectGraph(graph)).fileMap.projectFileMap;
|
|
12
|
+
}
|
|
13
|
+
exports.createProjectFileMapUsingProjectGraph = createProjectFileMapUsingProjectGraph;
|
|
14
|
+
// TODO: refactor this to pull straight from the rust context instead of creating the file map in JS
|
|
15
|
+
async function createFileMapUsingProjectGraph(graph) {
|
|
10
16
|
const configs = (0, project_graph_1.readProjectsConfigurationFromProjectGraph)(graph);
|
|
11
17
|
let files;
|
|
12
18
|
if (client_1.daemonClient.enabled()) {
|
|
@@ -15,9 +21,9 @@ async function createProjectFileMapUsingProjectGraph(graph) {
|
|
|
15
21
|
else {
|
|
16
22
|
files = (0, workspace_context_1.getAllFileDataInContext)(workspace_root_1.workspaceRoot);
|
|
17
23
|
}
|
|
18
|
-
return createFileMap(configs, files)
|
|
24
|
+
return createFileMap(configs, files);
|
|
19
25
|
}
|
|
20
|
-
exports.
|
|
26
|
+
exports.createFileMapUsingProjectGraph = createFileMapUsingProjectGraph;
|
|
21
27
|
function createFileMap(projectsConfigurations, allWorkspaceFiles) {
|
|
22
28
|
const projectFileMap = {};
|
|
23
29
|
const projectRootMappings = (0, find_project_for_path_1.createProjectRootMappingsFromProjectConfigurations)(projectsConfigurations.projects);
|
|
@@ -46,65 +52,12 @@ function createFileMap(projectsConfigurations, allWorkspaceFiles) {
|
|
|
46
52
|
};
|
|
47
53
|
}
|
|
48
54
|
exports.createFileMap = createFileMap;
|
|
49
|
-
function updateFileMap(projectsConfigurations,
|
|
50
|
-
const
|
|
51
|
-
let nonProjectFilesMap = new Map(nonProjectFiles.map((f) => [f.file, f]));
|
|
52
|
-
for (const f of updatedFiles.keys()) {
|
|
53
|
-
const project = (0, find_project_for_path_1.findProjectForPath)(f, projectRootMappings);
|
|
54
|
-
if (project) {
|
|
55
|
-
const matchingProjectFiles = projectFileMap[project] ?? [];
|
|
56
|
-
if (matchingProjectFiles) {
|
|
57
|
-
const fileData = matchingProjectFiles.find((t) => t.file === f);
|
|
58
|
-
if (fileData) {
|
|
59
|
-
fileData.hash = updatedFiles.get(f);
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
matchingProjectFiles.push({
|
|
63
|
-
file: f,
|
|
64
|
-
hash: updatedFiles.get(f),
|
|
65
|
-
});
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
else {
|
|
70
|
-
const hash = updatedFiles.get(f);
|
|
71
|
-
const entry = nonProjectFilesMap.get(f) ?? { file: f, hash };
|
|
72
|
-
entry.hash = hash;
|
|
73
|
-
nonProjectFilesMap.set(f, entry);
|
|
74
|
-
}
|
|
75
|
-
const fileData = allWorkspaceFiles.find((t) => t.file === f);
|
|
76
|
-
if (fileData) {
|
|
77
|
-
fileData.hash = updatedFiles.get(f);
|
|
78
|
-
}
|
|
79
|
-
else {
|
|
80
|
-
allWorkspaceFiles.push({
|
|
81
|
-
file: f,
|
|
82
|
-
hash: updatedFiles.get(f),
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
for (const f of deletedFiles) {
|
|
87
|
-
const matchingProjectFiles = projectFileMap[(0, find_project_for_path_1.findProjectForPath)(f, projectRootMappings)] ?? [];
|
|
88
|
-
if (matchingProjectFiles) {
|
|
89
|
-
const index = matchingProjectFiles.findIndex((t) => t.file === f);
|
|
90
|
-
if (index > -1) {
|
|
91
|
-
matchingProjectFiles.splice(index, 1);
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
if (nonProjectFilesMap.has(f)) {
|
|
95
|
-
nonProjectFilesMap.delete(f);
|
|
96
|
-
}
|
|
97
|
-
const index = allWorkspaceFiles.findIndex((t) => t.file === f);
|
|
98
|
-
if (index > -1) {
|
|
99
|
-
allWorkspaceFiles.splice(index, 1);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
55
|
+
function updateFileMap(projectsConfigurations, rustReferences, updatedFiles, deletedFiles) {
|
|
56
|
+
const updates = (0, workspace_context_1.updateProjectFiles)(Object.fromEntries((0, find_project_for_path_1.createProjectRootMappingsFromProjectConfigurations)(projectsConfigurations)), rustReferences, updatedFiles, deletedFiles);
|
|
102
57
|
return {
|
|
103
|
-
fileMap:
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
},
|
|
107
|
-
allWorkspaceFiles,
|
|
58
|
+
fileMap: updates.fileMap,
|
|
59
|
+
allWorkspaceFiles: (0, build_all_workspace_files_1.buildAllWorkspaceFiles)(updates.fileMap.projectFileMap, updates.fileMap.nonProjectFiles),
|
|
60
|
+
rustReferences: updates.externalReferences,
|
|
108
61
|
};
|
|
109
62
|
}
|
|
110
63
|
exports.updateFileMap = updateFileMap;
|
|
@@ -18,7 +18,7 @@ export declare function isDeletedFileChange(change: Change): change is DeletedFi
|
|
|
18
18
|
export declare function calculateFileChanges(files: string[], allWorkspaceFiles: FileData[], nxArgs?: NxArgs, readFileAtRevision?: (f: string, r: void | string) => string, ignore?: any): FileChange[];
|
|
19
19
|
export declare const TEN_MEGABYTES: number;
|
|
20
20
|
/**
|
|
21
|
-
* TODO(
|
|
21
|
+
* TODO(v19): Remove this function
|
|
22
22
|
* @deprecated To get projects use {@link retrieveProjectConfigurations} instead
|
|
23
23
|
*/
|
|
24
24
|
export declare function readWorkspaceConfig(opts: {
|
|
@@ -12,6 +12,10 @@ const project_graph_1 = require("./project-graph");
|
|
|
12
12
|
const angular_json_1 = require("../adapter/angular-json");
|
|
13
13
|
const ignore_1 = require("../utils/ignore");
|
|
14
14
|
const retrieve_workspace_files_1 = require("./utils/retrieve-workspace-files");
|
|
15
|
+
const project_configuration_utils_1 = require("./utils/project-configuration-utils");
|
|
16
|
+
const nx_plugin_deprecated_1 = require("../utils/nx-plugin.deprecated");
|
|
17
|
+
const minimatch_1 = require("minimatch");
|
|
18
|
+
const package_json_next_to_project_json_1 = require("../plugins/project-json/build-nodes/package-json-next-to-project-json");
|
|
15
19
|
class WholeFileChange {
|
|
16
20
|
constructor() {
|
|
17
21
|
this.type = 'WholeFileChange';
|
|
@@ -94,7 +98,7 @@ function defaultReadFileAtRevision(file, revision) {
|
|
|
94
98
|
}
|
|
95
99
|
}
|
|
96
100
|
/**
|
|
97
|
-
* TODO(
|
|
101
|
+
* TODO(v19): Remove this function
|
|
98
102
|
* @deprecated To get projects use {@link retrieveProjectConfigurations} instead
|
|
99
103
|
*/
|
|
100
104
|
function readWorkspaceConfig(opts) {
|
|
@@ -111,7 +115,7 @@ function readWorkspaceConfig(opts) {
|
|
|
111
115
|
catch {
|
|
112
116
|
configuration = {
|
|
113
117
|
version: 2,
|
|
114
|
-
projects: (
|
|
118
|
+
projects: getProjectsSyncNoInference(root, nxJson).projects,
|
|
115
119
|
};
|
|
116
120
|
}
|
|
117
121
|
if (opts.format === 'angularCli') {
|
|
@@ -139,3 +143,41 @@ exports.readPackageJson = readPackageJson;
|
|
|
139
143
|
var configuration_2 = require("../config/configuration");
|
|
140
144
|
Object.defineProperty(exports, "readNxJson", { enumerable: true, get: function () { return configuration_2.readNxJson; } });
|
|
141
145
|
Object.defineProperty(exports, "workspaceLayout", { enumerable: true, get: function () { return configuration_2.workspaceLayout; } });
|
|
146
|
+
/**
|
|
147
|
+
* TODO(v19): Remove this function.
|
|
148
|
+
*/
|
|
149
|
+
function getProjectsSyncNoInference(root, nxJson) {
|
|
150
|
+
const allConfigFiles = (0, retrieve_workspace_files_1.retrieveProjectConfigurationPaths)(root, (0, nx_plugin_deprecated_1.getDefaultPluginsSync)(root));
|
|
151
|
+
const plugins = [
|
|
152
|
+
{ plugin: package_json_next_to_project_json_1.PackageJsonProjectsNextToProjectJsonPlugin },
|
|
153
|
+
...(0, nx_plugin_deprecated_1.getDefaultPluginsSync)(root),
|
|
154
|
+
];
|
|
155
|
+
const projectRootMap = new Map();
|
|
156
|
+
// We iterate over plugins first - this ensures that plugins specified first take precedence.
|
|
157
|
+
for (const { plugin, options } of plugins) {
|
|
158
|
+
const [pattern, createNodes] = plugin.createNodes ?? [];
|
|
159
|
+
if (!pattern) {
|
|
160
|
+
continue;
|
|
161
|
+
}
|
|
162
|
+
const matchingConfigFiles = allConfigFiles.filter((file) => (0, minimatch_1.minimatch)(file, pattern, { dot: true }));
|
|
163
|
+
for (const file of matchingConfigFiles) {
|
|
164
|
+
if ((0, minimatch_1.minimatch)(file, pattern, { dot: true })) {
|
|
165
|
+
let r = createNodes(file, options, {
|
|
166
|
+
nxJsonConfiguration: nxJson,
|
|
167
|
+
workspaceRoot: root,
|
|
168
|
+
configFiles: matchingConfigFiles,
|
|
169
|
+
});
|
|
170
|
+
for (const node in r.projects) {
|
|
171
|
+
const project = {
|
|
172
|
+
root: node,
|
|
173
|
+
...r.projects[node],
|
|
174
|
+
};
|
|
175
|
+
(0, project_configuration_utils_1.mergeProjectConfigurationIntoRootMap)(projectRootMap, project);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return {
|
|
181
|
+
projects: (0, project_configuration_utils_1.readProjectConfigurationsFromRootMap)(projectRootMap),
|
|
182
|
+
};
|
|
183
|
+
}
|
|
@@ -74,7 +74,7 @@ function createProjectFileMapCache(nxJson, packageJsonDeps, fileMap, tsConfig) {
|
|
|
74
74
|
const newValue = {
|
|
75
75
|
version: '6.0',
|
|
76
76
|
nxVersion: versions_1.nxVersion,
|
|
77
|
-
deps: packageJsonDeps,
|
|
77
|
+
deps: packageJsonDeps, // TODO(v19): We can remove this in favor of nxVersion
|
|
78
78
|
// compilerOptions may not exist, especially for package-based repos
|
|
79
79
|
pathMappings: tsConfig?.compilerOptions?.paths || {},
|
|
80
80
|
nxJsonPlugins,
|
|
@@ -5,7 +5,7 @@ import { DependencyType, FileMap, ProjectFileMap, ProjectGraph, ProjectGraphExte
|
|
|
5
5
|
import { CreateDependenciesContext } from '../utils/nx-plugin';
|
|
6
6
|
/**
|
|
7
7
|
* A class which builds up a project graph
|
|
8
|
-
* @deprecated The {@link ProjectGraphProcessor} has been deprecated. Use a {@link CreateNodes} and/or a {@link CreateDependencies} instead. This will be removed in Nx
|
|
8
|
+
* @deprecated The {@link ProjectGraphProcessor} has been deprecated. Use a {@link CreateNodes} and/or a {@link CreateDependencies} instead. This will be removed in Nx 19.
|
|
9
9
|
*/
|
|
10
10
|
export declare class ProjectGraphBuilder {
|
|
11
11
|
readonly graph: ProjectGraph;
|
|
@@ -8,7 +8,7 @@ const project_graph_1 = require("../config/project-graph");
|
|
|
8
8
|
const build_project_graph_1 = require("./build-project-graph");
|
|
9
9
|
/**
|
|
10
10
|
* A class which builds up a project graph
|
|
11
|
-
* @deprecated The {@link ProjectGraphProcessor} has been deprecated. Use a {@link CreateNodes} and/or a {@link CreateDependencies} instead. This will be removed in Nx
|
|
11
|
+
* @deprecated The {@link ProjectGraphProcessor} has been deprecated. Use a {@link CreateNodes} and/or a {@link CreateDependencies} instead. This will be removed in Nx 19.
|
|
12
12
|
*/
|
|
13
13
|
class ProjectGraphBuilder {
|
|
14
14
|
constructor(graph, projectFileMap, nonProjectFiles) {
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import { ProcessDependenciesError, ProcessProjectGraphError } from './build-project-graph';
|
|
1
2
|
import { ProjectGraph } from '../config/project-graph';
|
|
2
3
|
import { ProjectConfiguration, ProjectsConfigurations } from '../config/workspace-json-project-json';
|
|
4
|
+
import { ConfigurationSourceMaps, CreateNodesError, MergeNodesError } from './utils/project-configuration-utils';
|
|
5
|
+
import { DaemonProjectGraphError } from '../daemon/daemon-project-graph-error';
|
|
3
6
|
/**
|
|
4
7
|
* Synchronously reads the latest cached copy of the workspace's ProjectGraph.
|
|
5
8
|
* @throws {Error} if there is no cached ProjectGraph to read from
|
|
@@ -10,7 +13,28 @@ export declare function readCachedProjectConfiguration(projectName: string): Pro
|
|
|
10
13
|
* Get the {@link ProjectsConfigurations} from the {@link ProjectGraph}
|
|
11
14
|
*/
|
|
12
15
|
export declare function readProjectsConfigurationFromProjectGraph(projectGraph: ProjectGraph): ProjectsConfigurations;
|
|
13
|
-
export declare function
|
|
16
|
+
export declare function buildProjectGraphAndSourceMapsWithoutDaemon(): Promise<{
|
|
17
|
+
projectGraph: ProjectGraph;
|
|
18
|
+
sourceMaps: ConfigurationSourceMaps;
|
|
19
|
+
}>;
|
|
20
|
+
export declare class ProjectGraphError extends Error {
|
|
21
|
+
#private;
|
|
22
|
+
constructor(errors: Array<CreateNodesError | MergeNodesError | ProcessDependenciesError | ProcessProjectGraphError>, partialProjectGraph: ProjectGraph, partialSourceMaps: ConfigurationSourceMaps);
|
|
23
|
+
/**
|
|
24
|
+
* The daemon cannot throw errors which contain methods as they are not serializable.
|
|
25
|
+
*
|
|
26
|
+
* This method creates a new {@link ProjectGraphError} from a {@link DaemonProjectGraphError} with the methods based on the same serialized data.
|
|
27
|
+
*/
|
|
28
|
+
static fromDaemonProjectGraphError(e: DaemonProjectGraphError): ProjectGraphError;
|
|
29
|
+
/**
|
|
30
|
+
* This gets the partial project graph despite the errors which occured.
|
|
31
|
+
* This partial project graph may be missing nodes, properties of nodes, or dependencies.
|
|
32
|
+
* This is useful mostly for visualization/debugging. It should not be used for running tasks.
|
|
33
|
+
*/
|
|
34
|
+
getPartialProjectGraph(): ProjectGraph;
|
|
35
|
+
getPartialSourcemaps(): ConfigurationSourceMaps;
|
|
36
|
+
getErrors(): (ProcessDependenciesError | ProcessProjectGraphError | CreateNodesError)[];
|
|
37
|
+
}
|
|
14
38
|
/**
|
|
15
39
|
* Computes and returns a ProjectGraph.
|
|
16
40
|
*
|
|
@@ -36,3 +60,10 @@ export declare function createProjectGraphAsync(opts?: {
|
|
|
36
60
|
exitOnError: boolean;
|
|
37
61
|
resetDaemonClient?: boolean;
|
|
38
62
|
}): Promise<ProjectGraph>;
|
|
63
|
+
export declare function createProjectGraphAndSourceMapsAsync(opts?: {
|
|
64
|
+
exitOnError: boolean;
|
|
65
|
+
resetDaemonClient?: boolean;
|
|
66
|
+
}): Promise<{
|
|
67
|
+
projectGraph: ProjectGraph;
|
|
68
|
+
sourceMaps: ConfigurationSourceMaps;
|
|
69
|
+
}>;
|