nx 17.0.3 → 17.0.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.
- 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 +11 -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 +9 -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 +14 -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 +5 -5
- package/src/command-line/init/implementation/utils.js +46 -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.d.ts +3 -0
- package/src/command-line/report/report.js +22 -5
- 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 +23 -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 +28 -9
- 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 +7 -33
- package/src/project-graph/utils/project-configuration-utils.d.ts +66 -4
- package/src/project-graph/utils/project-configuration-utils.js +509 -62
- package/src/project-graph/utils/retrieve-workspace-files.d.ts +12 -31
- package/src/project-graph/utils/retrieve-workspace-files.js +27 -90
- 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 +112 -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 +68 -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 +7 -0
- package/src/utils/package-manager.js +24 -4
- package/src/utils/params.d.ts +12 -4
- package/src/utils/params.js +37 -4
- 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,17 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.filterUsingGlobPatterns = exports.expandNamedInput = exports.getInputs = exports.extractPatternsFromFileSets = exports.getTargetInputs = exports.getNamedInputs = exports.InProcessTaskHasher = exports.DaemonBasedTaskHasher = void 0;
|
|
4
|
-
const child_process_1 = require("child_process");
|
|
5
|
-
const minimatch = require("minimatch");
|
|
6
|
-
const hasher_1 = require("../plugins/js/hasher/hasher");
|
|
7
|
-
const find_project_for_path_1 = require("../project-graph/utils/find-project-for-path");
|
|
8
|
-
const find_matching_projects_1 = require("../utils/find-matching-projects");
|
|
3
|
+
exports.filterUsingGlobPatterns = exports.expandNamedInput = exports.expandSingleProjectInputs = exports.isDepsOutput = exports.isSelfInput = exports.getInputs = exports.extractPatternsFromFileSets = exports.getTargetInputs = exports.getNamedInputs = exports.InProcessTaskHasher = exports.DaemonBasedTaskHasher = void 0;
|
|
9
4
|
const file_hasher_1 = require("./file-hasher");
|
|
10
|
-
const
|
|
5
|
+
const node_task_hasher_impl_1 = require("./node-task-hasher-impl");
|
|
6
|
+
const minimatch_1 = require("minimatch");
|
|
7
|
+
const native_task_hasher_impl_1 = require("./native-task-hasher-impl");
|
|
11
8
|
const workspace_root_1 = require("../utils/workspace-root");
|
|
12
|
-
const path_1 = require("path");
|
|
13
|
-
const project_graph_utils_1 = require("../utils/project-graph-utils");
|
|
14
|
-
const native_1 = require("../native");
|
|
15
9
|
class DaemonBasedTaskHasher {
|
|
16
10
|
constructor(daemonClient, runnerOptions) {
|
|
17
11
|
this.daemonClient = daemonClient;
|
|
@@ -26,12 +20,14 @@ class DaemonBasedTaskHasher {
|
|
|
26
20
|
}
|
|
27
21
|
exports.DaemonBasedTaskHasher = DaemonBasedTaskHasher;
|
|
28
22
|
class InProcessTaskHasher {
|
|
29
|
-
constructor(projectFileMap, allWorkspaceFiles, projectGraph, nxJson, options) {
|
|
23
|
+
constructor(projectFileMap, allWorkspaceFiles, projectGraph, nxJson, externalRustReferences, options) {
|
|
30
24
|
this.projectFileMap = projectFileMap;
|
|
31
25
|
this.allWorkspaceFiles = allWorkspaceFiles;
|
|
32
26
|
this.projectGraph = projectGraph;
|
|
33
27
|
this.nxJson = nxJson;
|
|
28
|
+
this.externalRustReferences = externalRustReferences;
|
|
34
29
|
this.options = options;
|
|
30
|
+
this.useNativeTaskHasher = process.env.NX_NATIVE_TASK_HASHER !== 'false';
|
|
35
31
|
const legacyRuntimeInputs = (this.options && this.options.runtimeCacheInputs
|
|
36
32
|
? this.options.runtimeCacheInputs
|
|
37
33
|
: []).map((r) => ({ runtime: r }));
|
|
@@ -44,13 +40,28 @@ class InProcessTaskHasher {
|
|
|
44
40
|
'.gitignore',
|
|
45
41
|
'.nxignore',
|
|
46
42
|
].map((d) => ({ fileset: `{workspaceRoot}/${d}` }));
|
|
47
|
-
this.taskHasher =
|
|
43
|
+
this.taskHasher = !this.useNativeTaskHasher
|
|
44
|
+
? new node_task_hasher_impl_1.NodeTaskHasherImpl(nxJson, legacyRuntimeInputs, legacyFilesetInputs, this.projectFileMap, this.allWorkspaceFiles, this.projectGraph, {
|
|
45
|
+
selectivelyHashTsConfig: this.options?.selectivelyHashTsConfig ?? false,
|
|
46
|
+
})
|
|
47
|
+
: new native_task_hasher_impl_1.NativeTaskHasherImpl(workspace_root_1.workspaceRoot, nxJson, this.projectGraph, this.externalRustReferences, {
|
|
48
|
+
selectivelyHashTsConfig: this.options?.selectivelyHashTsConfig ?? false,
|
|
49
|
+
});
|
|
48
50
|
}
|
|
49
51
|
async hashTasks(tasks, taskGraph, env) {
|
|
50
|
-
|
|
52
|
+
if (this.useNativeTaskHasher) {
|
|
53
|
+
const hashes = await this.taskHasher.hashTasks(tasks, taskGraph, env ?? process.env);
|
|
54
|
+
return tasks.map((task, index) => this.createHashDetails(task, hashes[index]));
|
|
55
|
+
}
|
|
56
|
+
else {
|
|
57
|
+
return await Promise.all(tasks.map((t) => this.hashTask(t, taskGraph, env)));
|
|
58
|
+
}
|
|
51
59
|
}
|
|
52
60
|
async hashTask(task, taskGraph, env) {
|
|
53
|
-
const res = await this.taskHasher.hashTask(task, taskGraph, env ?? process.env
|
|
61
|
+
const res = await this.taskHasher.hashTask(task, taskGraph, env ?? process.env);
|
|
62
|
+
return this.createHashDetails(task, res);
|
|
63
|
+
}
|
|
64
|
+
createHashDetails(task, res) {
|
|
54
65
|
const command = this.hashCommand(task);
|
|
55
66
|
return {
|
|
56
67
|
value: (0, file_hasher_1.hashArray)([res.value, command]),
|
|
@@ -88,418 +99,6 @@ const DEFAULT_INPUTS = [
|
|
|
88
99
|
input: 'default',
|
|
89
100
|
},
|
|
90
101
|
];
|
|
91
|
-
class TaskHasherImpl {
|
|
92
|
-
constructor(nxJson, legacyRuntimeInputs, legacyFilesetInputs, projectFileMap, allWorkspaceFiles, projectGraph, options) {
|
|
93
|
-
this.nxJson = nxJson;
|
|
94
|
-
this.legacyRuntimeInputs = legacyRuntimeInputs;
|
|
95
|
-
this.legacyFilesetInputs = legacyFilesetInputs;
|
|
96
|
-
this.projectFileMap = projectFileMap;
|
|
97
|
-
this.allWorkspaceFiles = allWorkspaceFiles;
|
|
98
|
-
this.projectGraph = projectGraph;
|
|
99
|
-
this.options = options;
|
|
100
|
-
this.filesetHashes = {};
|
|
101
|
-
this.runtimeHashes = {};
|
|
102
|
-
this.externalDependencyHashes = new Map();
|
|
103
|
-
this.projectRootMappings = (0, find_project_for_path_1.createProjectRootMappings)(this.projectGraph.nodes);
|
|
104
|
-
// External Dependencies are all calculated up front in a deterministic order
|
|
105
|
-
this.calculateExternalDependencyHashes();
|
|
106
|
-
}
|
|
107
|
-
async hashTask(task, taskGraph, env, visited) {
|
|
108
|
-
return Promise.resolve().then(async () => {
|
|
109
|
-
const { selfInputs, depsInputs, depsOutputs, projectInputs } = getInputs(task, this.projectGraph, this.nxJson);
|
|
110
|
-
const selfAndInputs = await this.hashSelfAndDepsInputs(task.target.project, task, selfInputs, depsInputs, depsOutputs, projectInputs, taskGraph, env, visited);
|
|
111
|
-
const target = this.hashTarget(task.target.project, task.target.target, selfInputs);
|
|
112
|
-
if (target) {
|
|
113
|
-
return this.combinePartialHashes([selfAndInputs, target]);
|
|
114
|
-
}
|
|
115
|
-
return selfAndInputs;
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
async hashNamedInputForDependencies(projectName, task, namedInput, taskGraph, env, visited) {
|
|
119
|
-
const projectNode = this.projectGraph.nodes[projectName];
|
|
120
|
-
const namedInputs = {
|
|
121
|
-
default: [{ fileset: '{projectRoot}/**/*' }],
|
|
122
|
-
...this.nxJson.namedInputs,
|
|
123
|
-
...projectNode.data.namedInputs,
|
|
124
|
-
};
|
|
125
|
-
const expandedInputs = expandNamedInput(namedInput, namedInputs);
|
|
126
|
-
const selfInputs = expandedInputs.filter(isSelfInput);
|
|
127
|
-
const depsOutputs = expandedInputs.filter(isDepsOutput);
|
|
128
|
-
const depsInputs = [{ input: namedInput, dependencies: true }]; // true is boolean by default
|
|
129
|
-
return this.hashSelfAndDepsInputs(projectName, task, selfInputs, depsInputs, depsOutputs, [], taskGraph, env, visited);
|
|
130
|
-
}
|
|
131
|
-
async hashSelfAndDepsInputs(projectName, task, selfInputs, depsInputs, depsOutputs, projectInputs, taskGraph, env, visited) {
|
|
132
|
-
const projectGraphDeps = this.projectGraph.dependencies[projectName] ?? [];
|
|
133
|
-
// we don't want random order of dependencies to change the hash
|
|
134
|
-
projectGraphDeps.sort((a, b) => a.target.localeCompare(b.target));
|
|
135
|
-
const self = await this.hashSingleProjectInputs(projectName, selfInputs, env);
|
|
136
|
-
const deps = await this.hashDepsInputs(task, depsInputs, projectGraphDeps, taskGraph, env, visited);
|
|
137
|
-
const depsOut = await this.hashDepsOutputs(task, depsOutputs, taskGraph);
|
|
138
|
-
const projects = await this.hashProjectInputs(projectInputs, env);
|
|
139
|
-
return this.combinePartialHashes([
|
|
140
|
-
...self,
|
|
141
|
-
...deps,
|
|
142
|
-
...projects,
|
|
143
|
-
...depsOut,
|
|
144
|
-
]);
|
|
145
|
-
}
|
|
146
|
-
combinePartialHashes(partialHashes) {
|
|
147
|
-
if (partialHashes.length === 1) {
|
|
148
|
-
return partialHashes[0];
|
|
149
|
-
}
|
|
150
|
-
const details = {};
|
|
151
|
-
const hashValues = [];
|
|
152
|
-
for (const partial of partialHashes) {
|
|
153
|
-
hashValues.push(partial.value);
|
|
154
|
-
Object.assign(details, partial.details);
|
|
155
|
-
}
|
|
156
|
-
const value = (0, file_hasher_1.hashArray)(hashValues);
|
|
157
|
-
return { value, details };
|
|
158
|
-
}
|
|
159
|
-
async hashDepsInputs(task, inputs, projectGraphDeps, taskGraph, env, visited) {
|
|
160
|
-
return (await Promise.all(inputs.map(async (input) => {
|
|
161
|
-
return await Promise.all(projectGraphDeps.map(async (d) => {
|
|
162
|
-
if (visited.indexOf(d.target) > -1) {
|
|
163
|
-
return null;
|
|
164
|
-
}
|
|
165
|
-
else {
|
|
166
|
-
visited.push(d.target);
|
|
167
|
-
if (this.projectGraph.nodes[d.target]) {
|
|
168
|
-
return await this.hashNamedInputForDependencies(d.target, task, input.input || 'default', taskGraph, env, visited);
|
|
169
|
-
}
|
|
170
|
-
else {
|
|
171
|
-
return this.getExternalDependencyHash(d.target);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
}));
|
|
175
|
-
})))
|
|
176
|
-
.flat()
|
|
177
|
-
.filter((r) => !!r);
|
|
178
|
-
}
|
|
179
|
-
async hashDepsOutputs(task, depsOutputs, taskGraph) {
|
|
180
|
-
if (depsOutputs.length === 0) {
|
|
181
|
-
return [];
|
|
182
|
-
}
|
|
183
|
-
const result = [];
|
|
184
|
-
for (const { dependentTasksOutputFiles, transitive } of depsOutputs) {
|
|
185
|
-
result.push(...(await this.hashDepOuputs(task, dependentTasksOutputFiles, taskGraph, transitive)));
|
|
186
|
-
}
|
|
187
|
-
return result;
|
|
188
|
-
}
|
|
189
|
-
async hashDepOuputs(task, dependentTasksOutputFiles, taskGraph, transitive) {
|
|
190
|
-
// task has no dependencies
|
|
191
|
-
if (!taskGraph.dependencies[task.id]) {
|
|
192
|
-
return [];
|
|
193
|
-
}
|
|
194
|
-
const partialHashes = [];
|
|
195
|
-
for (const d of taskGraph.dependencies[task.id]) {
|
|
196
|
-
const childTask = taskGraph.tasks[d];
|
|
197
|
-
const outputs = (0, utils_1.getOutputsForTargetAndConfiguration)(childTask.target, childTask.overrides, this.projectGraph.nodes[childTask.target.project]);
|
|
198
|
-
const { getFilesForOutputs } = require('../native');
|
|
199
|
-
const outputFiles = getFilesForOutputs(workspace_root_1.workspaceRoot, outputs);
|
|
200
|
-
const filteredFiles = outputFiles.filter((p) => p === dependentTasksOutputFiles ||
|
|
201
|
-
minimatch(p, dependentTasksOutputFiles, { dot: true }));
|
|
202
|
-
const hashDetails = {};
|
|
203
|
-
const hashes = [];
|
|
204
|
-
for (const [file, hash] of this.hashFiles(filteredFiles.map((p) => (0, path_1.join)(workspace_root_1.workspaceRoot, p)))) {
|
|
205
|
-
hashes.push(hash);
|
|
206
|
-
}
|
|
207
|
-
let hash = (0, file_hasher_1.hashArray)(hashes);
|
|
208
|
-
partialHashes.push({
|
|
209
|
-
value: hash,
|
|
210
|
-
details: {
|
|
211
|
-
[`${dependentTasksOutputFiles}:${outputs.join(',')}`]: hash,
|
|
212
|
-
},
|
|
213
|
-
});
|
|
214
|
-
if (transitive) {
|
|
215
|
-
partialHashes.push(...(await this.hashDepOuputs(childTask, dependentTasksOutputFiles, taskGraph, transitive)));
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
return partialHashes;
|
|
219
|
-
}
|
|
220
|
-
hashFiles(files) {
|
|
221
|
-
const r = new Map();
|
|
222
|
-
for (let f of files) {
|
|
223
|
-
r.set(f, (0, native_1.hashFile)(f));
|
|
224
|
-
}
|
|
225
|
-
return r;
|
|
226
|
-
}
|
|
227
|
-
getExternalDependencyHash(externalNodeName) {
|
|
228
|
-
const combinedHash = this.combinePartialHashes(this.externalDependencyHashes.get(externalNodeName));
|
|
229
|
-
// Set the combined hash into the hashes so it's not recalculated next time
|
|
230
|
-
this.externalDependencyHashes.set(externalNodeName, [combinedHash]);
|
|
231
|
-
return combinedHash;
|
|
232
|
-
}
|
|
233
|
-
hashSingleExternalDependency(externalNodeName) {
|
|
234
|
-
const node = this.projectGraph.externalNodes[externalNodeName];
|
|
235
|
-
if (node.data.hash) {
|
|
236
|
-
// we already know the hash of this dependency
|
|
237
|
-
return {
|
|
238
|
-
value: node.data.hash,
|
|
239
|
-
details: {
|
|
240
|
-
[externalNodeName]: node.data.hash,
|
|
241
|
-
},
|
|
242
|
-
};
|
|
243
|
-
}
|
|
244
|
-
else {
|
|
245
|
-
// we take version as a hash
|
|
246
|
-
return {
|
|
247
|
-
value: node.data.version,
|
|
248
|
-
details: {
|
|
249
|
-
[externalNodeName]: node.data.version,
|
|
250
|
-
},
|
|
251
|
-
};
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
hashExternalDependency(externalNodeName) {
|
|
255
|
-
const partialHashes = new Set();
|
|
256
|
-
partialHashes.add(this.hashSingleExternalDependency(externalNodeName));
|
|
257
|
-
const deps = (0, project_graph_utils_1.findAllProjectNodeDependencies)(externalNodeName, this.projectGraph, true);
|
|
258
|
-
for (const dep of deps) {
|
|
259
|
-
partialHashes.add(this.hashSingleExternalDependency(dep));
|
|
260
|
-
}
|
|
261
|
-
return Array.from(partialHashes);
|
|
262
|
-
}
|
|
263
|
-
hashTarget(projectName, targetName, selfInputs) {
|
|
264
|
-
const projectNode = this.projectGraph.nodes[projectName];
|
|
265
|
-
const target = projectNode.data.targets[targetName];
|
|
266
|
-
if (!target) {
|
|
267
|
-
return;
|
|
268
|
-
}
|
|
269
|
-
let hash;
|
|
270
|
-
// we can only vouch for @nx packages's executor dependencies
|
|
271
|
-
// if it's "run commands" or third-party we skip traversing since we have no info what this command depends on
|
|
272
|
-
if (target.executor.startsWith(`@nrwl/`) ||
|
|
273
|
-
target.executor.startsWith(`@nx/`)) {
|
|
274
|
-
const executorPackage = target.executor.split(':')[0];
|
|
275
|
-
const executorNodeName = this.findExternalDependencyNodeName(executorPackage);
|
|
276
|
-
// This is either a local plugin or a non-existent executor
|
|
277
|
-
if (!executorNodeName) {
|
|
278
|
-
// TODO: This should not return null if it is a local plugin's executor
|
|
279
|
-
return null;
|
|
280
|
-
}
|
|
281
|
-
return this.getExternalDependencyHash(executorNodeName);
|
|
282
|
-
}
|
|
283
|
-
else {
|
|
284
|
-
// use command external dependencies if available to construct the hash
|
|
285
|
-
const partialHashes = [];
|
|
286
|
-
let hasCommandExternalDependencies = false;
|
|
287
|
-
for (const input of selfInputs) {
|
|
288
|
-
if (input['externalDependencies']) {
|
|
289
|
-
// if we have externalDependencies with empty array we still want to override the default hash
|
|
290
|
-
hasCommandExternalDependencies = true;
|
|
291
|
-
const externalDependencies = input['externalDependencies'];
|
|
292
|
-
for (let dep of externalDependencies) {
|
|
293
|
-
dep = this.findExternalDependencyNodeName(dep);
|
|
294
|
-
if (!dep) {
|
|
295
|
-
throw new Error(`The externalDependency "${dep}" for "${projectName}:${targetName}" could not be found`);
|
|
296
|
-
}
|
|
297
|
-
partialHashes.push(this.getExternalDependencyHash(dep));
|
|
298
|
-
}
|
|
299
|
-
}
|
|
300
|
-
}
|
|
301
|
-
if (hasCommandExternalDependencies) {
|
|
302
|
-
return this.combinePartialHashes(partialHashes);
|
|
303
|
-
}
|
|
304
|
-
else {
|
|
305
|
-
// cache the hash of the entire external dependencies tree
|
|
306
|
-
if (this.allExternalDependenciesHash) {
|
|
307
|
-
return this.allExternalDependenciesHash;
|
|
308
|
-
}
|
|
309
|
-
else {
|
|
310
|
-
hash = (0, file_hasher_1.hashObject)(this.projectGraph.externalNodes);
|
|
311
|
-
this.allExternalDependenciesHash = {
|
|
312
|
-
value: hash,
|
|
313
|
-
details: {
|
|
314
|
-
AllExternalDependencies: hash,
|
|
315
|
-
},
|
|
316
|
-
};
|
|
317
|
-
return this.allExternalDependenciesHash;
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
findExternalDependencyNodeName(packageName) {
|
|
323
|
-
if (this.projectGraph.externalNodes[packageName]) {
|
|
324
|
-
return packageName;
|
|
325
|
-
}
|
|
326
|
-
if (this.projectGraph.externalNodes[`npm:${packageName}`]) {
|
|
327
|
-
return `npm:${packageName}`;
|
|
328
|
-
}
|
|
329
|
-
for (const node of Object.values(this.projectGraph.externalNodes)) {
|
|
330
|
-
if (node.data.packageName === packageName) {
|
|
331
|
-
return node.name;
|
|
332
|
-
}
|
|
333
|
-
}
|
|
334
|
-
// not found
|
|
335
|
-
return null;
|
|
336
|
-
}
|
|
337
|
-
async hashSingleProjectInputs(projectName, inputs, env) {
|
|
338
|
-
const filesets = extractPatternsFromFileSets(inputs);
|
|
339
|
-
const projectFilesets = [];
|
|
340
|
-
const workspaceFilesets = [];
|
|
341
|
-
let invalidFilesetNoPrefix = null;
|
|
342
|
-
let invalidFilesetWorkspaceRootNegative = null;
|
|
343
|
-
for (let f of filesets) {
|
|
344
|
-
if (f.startsWith('{projectRoot}/') || f.startsWith('!{projectRoot}/')) {
|
|
345
|
-
projectFilesets.push(f);
|
|
346
|
-
}
|
|
347
|
-
else if (f.startsWith('{workspaceRoot}/') ||
|
|
348
|
-
f.startsWith('!{workspaceRoot}/')) {
|
|
349
|
-
workspaceFilesets.push(f);
|
|
350
|
-
}
|
|
351
|
-
else {
|
|
352
|
-
invalidFilesetNoPrefix = f;
|
|
353
|
-
}
|
|
354
|
-
}
|
|
355
|
-
if (invalidFilesetNoPrefix) {
|
|
356
|
-
throw new Error([
|
|
357
|
-
`"${invalidFilesetNoPrefix}" is an invalid fileset.`,
|
|
358
|
-
'All filesets have to start with either {workspaceRoot} or {projectRoot}.',
|
|
359
|
-
'For instance: "!{projectRoot}/**/*.spec.ts" or "{workspaceRoot}/package.json".',
|
|
360
|
-
`If "${invalidFilesetNoPrefix}" is a named input, make sure it is defined in, for instance, nx.json.`,
|
|
361
|
-
].join('\n'));
|
|
362
|
-
}
|
|
363
|
-
if (invalidFilesetWorkspaceRootNegative) {
|
|
364
|
-
throw new Error([
|
|
365
|
-
`"${invalidFilesetWorkspaceRootNegative}" is an invalid fileset.`,
|
|
366
|
-
'It is not possible to negative filesets starting with {workspaceRoot}.',
|
|
367
|
-
].join('\n'));
|
|
368
|
-
}
|
|
369
|
-
const notFilesets = inputs.filter((r) => !r['fileset']);
|
|
370
|
-
return Promise.all([
|
|
371
|
-
this.hashProjectFileset(projectName, projectFilesets),
|
|
372
|
-
this.hashProjectConfig(projectName),
|
|
373
|
-
this.hashTsConfig(projectName),
|
|
374
|
-
...[
|
|
375
|
-
...workspaceFilesets,
|
|
376
|
-
...this.legacyFilesetInputs.map((r) => r.fileset),
|
|
377
|
-
].map((fileset) => this.hashRootFileset(fileset)),
|
|
378
|
-
...[...notFilesets, ...this.legacyRuntimeInputs].map((r) => r['runtime']
|
|
379
|
-
? this.hashRuntime(env, r['runtime'])
|
|
380
|
-
: this.hashEnv(env, r['env'])),
|
|
381
|
-
]);
|
|
382
|
-
}
|
|
383
|
-
async hashProjectInputs(projectInputs, env) {
|
|
384
|
-
const partialHashes = [];
|
|
385
|
-
for (const input of projectInputs) {
|
|
386
|
-
const projects = (0, find_matching_projects_1.findMatchingProjects)(input.projects, this.projectGraph.nodes);
|
|
387
|
-
for (const project of projects) {
|
|
388
|
-
const namedInputs = getNamedInputs(this.nxJson, this.projectGraph.nodes[project]);
|
|
389
|
-
const expandedInput = expandSingleProjectInputs([{ input: input.input }], namedInputs);
|
|
390
|
-
partialHashes.push(this.hashSingleProjectInputs(project, expandedInput, env));
|
|
391
|
-
}
|
|
392
|
-
}
|
|
393
|
-
return Promise.all(partialHashes).then((hashes) => hashes.flat());
|
|
394
|
-
}
|
|
395
|
-
async hashRootFileset(fileset) {
|
|
396
|
-
const mapKey = fileset;
|
|
397
|
-
const withoutWorkspaceRoot = fileset.substring(16);
|
|
398
|
-
if (!this.filesetHashes[mapKey]) {
|
|
399
|
-
this.filesetHashes[mapKey] = new Promise(async (res) => {
|
|
400
|
-
const parts = [];
|
|
401
|
-
const matchingFile = this.allWorkspaceFiles.find((t) => t.file === withoutWorkspaceRoot);
|
|
402
|
-
if (matchingFile) {
|
|
403
|
-
parts.push(matchingFile.hash);
|
|
404
|
-
}
|
|
405
|
-
else {
|
|
406
|
-
this.allWorkspaceFiles
|
|
407
|
-
.filter((f) => minimatch(f.file, withoutWorkspaceRoot))
|
|
408
|
-
.forEach((f) => {
|
|
409
|
-
parts.push(f.hash);
|
|
410
|
-
});
|
|
411
|
-
}
|
|
412
|
-
const value = (0, file_hasher_1.hashArray)(parts);
|
|
413
|
-
res({
|
|
414
|
-
value,
|
|
415
|
-
details: { [mapKey]: value },
|
|
416
|
-
});
|
|
417
|
-
});
|
|
418
|
-
}
|
|
419
|
-
return this.filesetHashes[mapKey];
|
|
420
|
-
}
|
|
421
|
-
hashProjectConfig(projectName) {
|
|
422
|
-
const p = this.projectGraph.nodes[projectName];
|
|
423
|
-
const projectConfig = (0, file_hasher_1.hashArray)([
|
|
424
|
-
JSON.stringify({ ...p.data, files: undefined }),
|
|
425
|
-
]);
|
|
426
|
-
return {
|
|
427
|
-
value: projectConfig,
|
|
428
|
-
details: {
|
|
429
|
-
[`${projectName}:ProjectConfiguration`]: projectConfig,
|
|
430
|
-
},
|
|
431
|
-
};
|
|
432
|
-
}
|
|
433
|
-
hashTsConfig(projectName) {
|
|
434
|
-
const p = this.projectGraph.nodes[projectName];
|
|
435
|
-
const tsConfig = (0, file_hasher_1.hashArray)([
|
|
436
|
-
(0, hasher_1.hashTsConfig)(p, this.projectRootMappings, this.options),
|
|
437
|
-
]);
|
|
438
|
-
return {
|
|
439
|
-
value: tsConfig,
|
|
440
|
-
details: {
|
|
441
|
-
[`${projectName}:TsConfig`]: tsConfig,
|
|
442
|
-
},
|
|
443
|
-
};
|
|
444
|
-
}
|
|
445
|
-
async hashProjectFileset(projectName, filesetPatterns) {
|
|
446
|
-
const mapKey = `${projectName}:${filesetPatterns.join(',')}`;
|
|
447
|
-
if (!this.filesetHashes[mapKey]) {
|
|
448
|
-
this.filesetHashes[mapKey] = new Promise(async (res) => {
|
|
449
|
-
const p = this.projectGraph.nodes[projectName];
|
|
450
|
-
const filteredFiles = filterUsingGlobPatterns(p.data.root, this.projectFileMap[projectName] || [], filesetPatterns);
|
|
451
|
-
const files = [];
|
|
452
|
-
for (const { file, hash } of filteredFiles) {
|
|
453
|
-
files.push(file, hash);
|
|
454
|
-
}
|
|
455
|
-
const value = (0, file_hasher_1.hashArray)(files);
|
|
456
|
-
res({
|
|
457
|
-
value,
|
|
458
|
-
details: { [mapKey]: value },
|
|
459
|
-
});
|
|
460
|
-
});
|
|
461
|
-
}
|
|
462
|
-
return this.filesetHashes[mapKey];
|
|
463
|
-
}
|
|
464
|
-
async hashRuntime(env, runtime) {
|
|
465
|
-
const env_key = JSON.stringify(env);
|
|
466
|
-
const mapKey = `runtime:${runtime}-${env_key}`;
|
|
467
|
-
if (!this.runtimeHashes[mapKey]) {
|
|
468
|
-
this.runtimeHashes[mapKey] = new Promise((res, rej) => {
|
|
469
|
-
(0, child_process_1.exec)(runtime, {
|
|
470
|
-
windowsHide: true,
|
|
471
|
-
cwd: workspace_root_1.workspaceRoot,
|
|
472
|
-
env,
|
|
473
|
-
}, (err, stdout, stderr) => {
|
|
474
|
-
if (err) {
|
|
475
|
-
rej(new Error(`Nx failed to execute {runtime: '${runtime}'}. ${err}.`));
|
|
476
|
-
}
|
|
477
|
-
else {
|
|
478
|
-
const value = (0, file_hasher_1.hashArray)([`${stdout}${stderr}`.trim()]);
|
|
479
|
-
res({
|
|
480
|
-
details: { [`runtime:${runtime}`]: value },
|
|
481
|
-
value,
|
|
482
|
-
});
|
|
483
|
-
}
|
|
484
|
-
});
|
|
485
|
-
});
|
|
486
|
-
}
|
|
487
|
-
return this.runtimeHashes[mapKey];
|
|
488
|
-
}
|
|
489
|
-
async hashEnv(env, envVarName) {
|
|
490
|
-
const value = (0, file_hasher_1.hashArray)([env[envVarName] ?? '']);
|
|
491
|
-
return {
|
|
492
|
-
details: { [`env:${envVarName}`]: value },
|
|
493
|
-
value,
|
|
494
|
-
};
|
|
495
|
-
}
|
|
496
|
-
calculateExternalDependencyHashes() {
|
|
497
|
-
const keys = Object.keys(this.projectGraph.externalNodes);
|
|
498
|
-
for (const externalNodeName of keys) {
|
|
499
|
-
this.externalDependencyHashes.set(externalNodeName, this.hashExternalDependency(externalNodeName));
|
|
500
|
-
}
|
|
501
|
-
}
|
|
502
|
-
}
|
|
503
102
|
function getNamedInputs(nxJson, project) {
|
|
504
103
|
return {
|
|
505
104
|
default: [{ fileset: '{projectRoot}/**/*' }],
|
|
@@ -582,9 +181,11 @@ function splitInputsIntoSelfAndDependencies(inputs, namedInputs) {
|
|
|
582
181
|
function isSelfInput(input) {
|
|
583
182
|
return !('dependentTasksOutputFiles' in input);
|
|
584
183
|
}
|
|
184
|
+
exports.isSelfInput = isSelfInput;
|
|
585
185
|
function isDepsOutput(input) {
|
|
586
186
|
return 'dependentTasksOutputFiles' in input;
|
|
587
187
|
}
|
|
188
|
+
exports.isDepsOutput = isDepsOutput;
|
|
588
189
|
function expandSingleProjectInputs(inputs, namedInputs) {
|
|
589
190
|
const expanded = [];
|
|
590
191
|
for (const d of inputs) {
|
|
@@ -616,6 +217,7 @@ function expandSingleProjectInputs(inputs, namedInputs) {
|
|
|
616
217
|
}
|
|
617
218
|
return expanded;
|
|
618
219
|
}
|
|
220
|
+
exports.expandSingleProjectInputs = expandSingleProjectInputs;
|
|
619
221
|
function expandNamedInput(input, namedInputs) {
|
|
620
222
|
namedInputs ||= {};
|
|
621
223
|
if (!namedInputs[input])
|
|
@@ -654,11 +256,11 @@ function filterUsingGlobPatterns(root, files, patterns) {
|
|
|
654
256
|
matchedPositive = true;
|
|
655
257
|
}
|
|
656
258
|
else {
|
|
657
|
-
matchedPositive = positive.some((pattern) => minimatch(f.file, pattern));
|
|
259
|
+
matchedPositive = positive.some((pattern) => (0, minimatch_1.minimatch)(f.file, pattern));
|
|
658
260
|
}
|
|
659
261
|
if (!matchedPositive)
|
|
660
262
|
return false;
|
|
661
|
-
return negative.every((pattern) => minimatch(f.file, pattern));
|
|
263
|
+
return negative.every((pattern) => (0, minimatch_1.minimatch)(f.file, pattern));
|
|
662
264
|
});
|
|
663
265
|
}
|
|
664
266
|
exports.filterUsingGlobPatterns = filterUsingGlobPatterns;
|
|
@@ -7,11 +7,11 @@ const path_1 = require("../../utils/path");
|
|
|
7
7
|
const path_2 = require("path");
|
|
8
8
|
const json_1 = require("../../generators/utils/json");
|
|
9
9
|
const skippedFiles = [
|
|
10
|
-
'package.json',
|
|
11
|
-
'babel.config.json',
|
|
12
|
-
'karma.conf.js',
|
|
13
|
-
'jest.preset.js',
|
|
14
|
-
'.storybook',
|
|
10
|
+
'package.json', // Not to be added to filesets
|
|
11
|
+
'babel.config.json', // Will be handled by various plugins
|
|
12
|
+
'karma.conf.js', // Will be handled by @nx/angular
|
|
13
|
+
'jest.preset.js', // Will be handled by @nx/jest
|
|
14
|
+
'.storybook', // Will be handled by @nx/storybook
|
|
15
15
|
// Will be handled by @nx/eslint
|
|
16
16
|
'.eslintrc.json',
|
|
17
17
|
'.eslintrc.js',
|
|
@@ -5,9 +5,10 @@ const path_1 = require("path");
|
|
|
5
5
|
const json_1 = require("../../generators/utils/json");
|
|
6
6
|
const format_changed_files_with_prettier_if_available_1 = require("../../generators/internal-utils/format-changed-files-with-prettier-if-available");
|
|
7
7
|
const retrieve_workspace_files_1 = require("../../project-graph/utils/retrieve-workspace-files");
|
|
8
|
+
const nx_plugin_1 = require("../../utils/nx-plugin");
|
|
8
9
|
async function default_1(tree) {
|
|
9
10
|
const nxJson = (0, nx_json_1.readNxJson)(tree);
|
|
10
|
-
const projectFiles = await (0, retrieve_workspace_files_1.retrieveProjectConfigurationPaths)(tree.root, nxJson);
|
|
11
|
+
const projectFiles = await (0, retrieve_workspace_files_1.retrieveProjectConfigurationPaths)(tree.root, await (0, nx_plugin_1.loadNxPlugins)(nxJson?.plugins));
|
|
11
12
|
const projectJsons = projectFiles.filter((f) => f.endsWith('project.json'));
|
|
12
13
|
for (let f of projectJsons) {
|
|
13
14
|
const projectJson = (0, json_1.readJson)(tree, f);
|
|
@@ -1,11 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
4
|
-
const path_1 = require("../../utils/path");
|
|
3
|
+
const update_nxw_1 = require("../../utils/update-nxw");
|
|
5
4
|
async function default_1(tree) {
|
|
6
|
-
|
|
7
|
-
if (tree.exists(wrapperPath)) {
|
|
8
|
-
tree.write(wrapperPath, (0, add_nx_scripts_1.getNxWrapperContents)());
|
|
9
|
-
}
|
|
5
|
+
(0, update_nxw_1.updateNxw)(tree);
|
|
10
6
|
}
|
|
11
7
|
exports.default = default_1;
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const format_changed_files_with_prettier_if_available_1 = require("../../generators/internal-utils/format-changed-files-with-prettier-if-available");
|
|
4
4
|
const nx_json_1 = require("../../generators/utils/nx-json");
|
|
5
5
|
const json_1 = require("../../generators/utils/json");
|
|
6
|
-
const
|
|
6
|
+
const output_1 = require("../../utils/output");
|
|
7
7
|
const path_1 = require("../../utils/path");
|
|
8
8
|
async function update(tree) {
|
|
9
9
|
if (!tree.exists('nx.json')) {
|
|
@@ -37,7 +37,7 @@ function warnNpmScopeHasChanged(tree, nxJson) {
|
|
|
37
37
|
}
|
|
38
38
|
const packageJsonName = (0, json_1.readJson)(tree, 'package.json').name;
|
|
39
39
|
if (newScope) {
|
|
40
|
-
|
|
40
|
+
output_1.output.warn({
|
|
41
41
|
title: 'npmScope has been removed from nx.json',
|
|
42
42
|
bodyLines: [
|
|
43
43
|
'This will now be read from package.json',
|
|
@@ -50,7 +50,7 @@ function warnNpmScopeHasChanged(tree, nxJson) {
|
|
|
50
50
|
}
|
|
51
51
|
else {
|
|
52
52
|
// There is no scope in package.json
|
|
53
|
-
|
|
53
|
+
output_1.output.warn({
|
|
54
54
|
title: 'npmScope has been removed from nx.json',
|
|
55
55
|
bodyLines: [
|
|
56
56
|
'This will now be read from package.json',
|