@ohos-ports/nx 19.8.4-beta.2 → 20.8.4-beta.1
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/.eslintrc.json +146 -0
- package/LICENSE +1 -1
- package/bin/init-local.js +0 -39
- package/bin/nx.js +28 -15
- package/bin/post-install.js +7 -5
- package/migrations.json +11 -37
- package/ohos-build/build-Cargo.toml.patch +12 -0
- package/ohos-build/build-cargo-config.patch +20 -0
- package/ohos-build/index.js.patch +18 -0
- package/ohos-build/native-bindings.js.patch +25 -0
- package/ohos-build/nix-0.25.1-ohos.patch +539 -0
- package/ohos-build/nix-0.27.1-ohos.patch +436 -0
- package/package.json +25 -62
- package/plugins/package-json.d.ts +5 -1
- package/plugins/package-json.js +27 -2
- package/release/changelog-renderer/index.d.ts +102 -0
- package/release/changelog-renderer/index.js +339 -0
- package/release/index.d.ts +4 -0
- package/release/index.js +13 -0
- package/schemas/nx-schema.json +964 -0
- package/schemas/project-schema.json +331 -0
- package/schemas/workspace-schema.json +185 -0
- package/src/adapter/angular-json.js +2 -8
- package/src/adapter/compat.d.ts +1 -1
- package/src/adapter/compat.js +3 -1
- package/src/adapter/ngcli-adapter.js +7 -7
- package/src/command-line/add/add.js +21 -48
- package/src/command-line/affected/affected.js +3 -3
- package/src/command-line/connect/view-logs.js +1 -1
- package/src/command-line/examples.js +0 -4
- package/src/command-line/exec/exec.js +3 -3
- package/src/command-line/format/command-object.js +9 -0
- package/src/command-line/format/format.js +10 -6
- package/src/command-line/generate/command-object.js +1 -2
- package/src/command-line/generate/generate.d.ts +1 -1
- package/src/command-line/generate/generate.js +3 -1
- package/src/command-line/generate/generator-utils.js +10 -5
- package/src/command-line/graph/graph.js +6 -9
- package/src/command-line/import/import.js +110 -71
- package/src/command-line/init/command-object.js +25 -9
- package/src/command-line/init/configure-plugins.d.ts +34 -0
- package/src/command-line/init/configure-plugins.js +203 -0
- package/src/command-line/init/implementation/add-nx-to-turborepo.d.ts +4 -0
- package/src/command-line/init/implementation/add-nx-to-turborepo.js +49 -0
- package/src/command-line/init/implementation/angular/integrated-workspace.js +1 -1
- package/src/command-line/init/implementation/angular/legacy-angular-versions.js +4 -3
- package/src/command-line/init/implementation/angular/standalone-workspace.js +8 -5
- package/src/command-line/init/implementation/check-compatible-with-plugins.d.ts +15 -0
- package/src/command-line/init/implementation/check-compatible-with-plugins.js +134 -0
- package/src/command-line/init/implementation/deduce-default-base.d.ts +1 -0
- package/src/command-line/init/implementation/deduce-default-base.js +53 -0
- package/src/command-line/init/implementation/dot-nx/add-nx-scripts.js +1 -1
- package/src/command-line/init/implementation/dot-nx/nxw.js +1 -1
- package/src/command-line/init/implementation/react/add-vite-commands-to-package-scripts.js +6 -4
- package/src/command-line/init/implementation/react/check-for-uncommitted-changes.js +1 -1
- package/src/command-line/init/implementation/react/index.d.ts +1 -1
- package/src/command-line/init/implementation/react/index.js +33 -186
- package/src/command-line/init/implementation/react/write-vite-config.js +19 -3
- package/src/command-line/init/implementation/utils.d.ts +6 -2
- package/src/command-line/init/implementation/utils.js +116 -37
- package/src/command-line/init/init-v1.js +2 -2
- package/src/command-line/init/init-v2.d.ts +2 -2
- package/src/command-line/init/init-v2.js +73 -55
- package/src/command-line/login/login.js +3 -0
- package/src/command-line/logout/logout.js +3 -0
- package/src/command-line/migrate/command-object.js +2 -96
- package/src/command-line/migrate/migrate.d.ts +1 -0
- package/src/command-line/migrate/migrate.js +111 -19
- package/src/command-line/nx-commands.js +20 -6
- package/src/command-line/register/command-object.d.ts +6 -0
- package/src/command-line/{activate-powerpack → register}/command-object.js +9 -9
- package/src/command-line/register/register.d.ts +2 -0
- package/src/command-line/register/register.js +9 -0
- package/src/command-line/release/changelog.d.ts +5 -4
- package/src/command-line/release/changelog.js +64 -79
- package/src/command-line/release/command-object.d.ts +7 -4
- package/src/command-line/release/command-object.js +24 -13
- package/src/command-line/release/config/config.d.ts +8 -7
- package/src/command-line/release/config/config.js +173 -43
- package/src/command-line/release/config/conventional-commits.js +7 -0
- package/src/command-line/release/config/filter-release-groups.d.ts +4 -0
- package/src/command-line/release/config/filter-release-groups.js +10 -3
- package/src/command-line/release/config/use-legacy-versioning.d.ts +2 -0
- package/src/command-line/release/config/use-legacy-versioning.js +9 -0
- package/src/command-line/release/config/version-plans.js +1 -1
- package/src/command-line/release/index.d.ts +9 -2
- package/src/command-line/release/index.js +6 -1
- package/src/command-line/release/plan-check.js +6 -3
- package/src/command-line/release/plan.js +8 -4
- package/src/command-line/release/publish.d.ts +6 -1
- package/src/command-line/release/publish.js +50 -27
- package/src/command-line/release/release.js +33 -20
- package/src/command-line/release/utils/batch-projects-by-generator-config.js +6 -3
- package/src/command-line/release/utils/exec-command.js +1 -1
- package/src/command-line/release/utils/git.d.ts +3 -2
- package/src/command-line/release/utils/git.js +104 -19
- package/src/command-line/release/utils/github.d.ts +1 -0
- package/src/command-line/release/utils/github.js +6 -2
- package/src/command-line/release/utils/launch-editor.js +2 -2
- package/src/command-line/release/utils/resolve-changelog-renderer.d.ts +2 -2
- package/src/command-line/release/utils/resolve-changelog-renderer.js +3 -3
- package/src/command-line/release/utils/resolve-semver-specifier.d.ts +2 -1
- package/src/command-line/release/utils/resolve-semver-specifier.js +2 -1
- package/src/command-line/release/utils/semver.d.ts +8 -0
- package/src/command-line/release/utils/semver.js +8 -0
- package/src/command-line/release/utils/shared-legacy.d.ts +25 -0
- package/src/command-line/release/utils/shared-legacy.js +2 -0
- package/src/command-line/release/utils/shared.d.ts +11 -17
- package/src/command-line/release/version/derive-specifier-from-conventional-commits.d.ts +7 -0
- package/src/command-line/release/version/derive-specifier-from-conventional-commits.js +47 -0
- package/src/command-line/release/version/deriver-specifier-from-version-plans.d.ts +8 -0
- package/src/command-line/release/version/deriver-specifier-from-version-plans.js +59 -0
- package/src/command-line/release/version/project-logger.d.ts +8 -0
- package/src/command-line/release/version/project-logger.js +45 -0
- package/src/command-line/release/version/release-group-processor.d.ts +251 -0
- package/src/command-line/release/version/release-group-processor.js +1048 -0
- package/src/command-line/release/version/resolve-current-version.d.ts +32 -0
- package/src/command-line/release/version/resolve-current-version.js +241 -0
- package/src/command-line/release/version/test-utils.d.ts +95 -0
- package/src/command-line/release/version/test-utils.js +416 -0
- package/src/command-line/release/version/topological-sort.d.ts +9 -0
- package/src/command-line/release/version/topological-sort.js +41 -0
- package/src/command-line/release/version/version-actions.d.ts +170 -0
- package/src/command-line/release/version/version-actions.js +183 -0
- package/src/command-line/release/version-legacy.d.ts +46 -0
- package/src/command-line/release/version-legacy.js +453 -0
- package/src/command-line/release/version.d.ts +0 -40
- package/src/command-line/release/version.js +93 -255
- package/src/command-line/report/report.d.ts +7 -3
- package/src/command-line/report/report.js +52 -16
- package/src/command-line/run/executor-utils.js +4 -4
- package/src/command-line/run/run-one.js +37 -15
- package/src/command-line/run/run.js +1 -2
- package/src/command-line/run-many/run-many.js +1 -4
- package/src/command-line/show/project.js +25 -3
- package/src/command-line/show/projects.js +4 -0
- package/src/command-line/sync/sync.js +3 -3
- package/src/command-line/watch/watch.js +1 -1
- package/src/command-line/yargs-utils/shared-options.d.ts +4 -0
- package/src/command-line/yargs-utils/shared-options.js +26 -0
- package/src/config/misc-interfaces.d.ts +3 -15
- package/src/config/nx-json.d.ts +145 -19
- package/src/config/project-graph.d.ts +4 -4
- package/src/config/project-graph.js +8 -0
- package/src/config/schema-utils.d.ts +4 -3
- package/src/config/schema-utils.js +71 -4
- package/src/config/workspace-json-project-json.d.ts +23 -2
- package/src/core/graph/main.js +1 -1
- package/src/core/graph/runtime.js +1 -1
- package/src/core/graph/styles.css +2 -2
- package/src/core/graph/styles.js +1 -1
- package/src/daemon/client/client.d.ts +5 -0
- package/src/daemon/client/client.js +42 -4
- package/src/daemon/client/generate-help-output.js +1 -1
- package/src/daemon/message-types/glob.d.ts +7 -0
- package/src/daemon/message-types/glob.js +9 -1
- package/src/daemon/message-types/hash-glob.d.ts +6 -0
- package/src/daemon/message-types/hash-glob.js +9 -1
- package/src/daemon/message-types/run-tasks-execution-hooks.d.ts +13 -0
- package/src/daemon/message-types/run-tasks-execution-hooks.js +19 -0
- package/src/daemon/server/handle-glob.d.ts +1 -0
- package/src/daemon/server/handle-glob.js +8 -0
- package/src/daemon/server/handle-hash-glob.d.ts +1 -0
- package/src/daemon/server/handle-hash-glob.js +8 -0
- package/src/daemon/server/handle-hash-tasks.js +1 -1
- package/src/daemon/server/handle-tasks-execution-hooks.d.ts +19 -0
- package/src/daemon/server/handle-tasks-execution-hooks.js +35 -0
- package/src/daemon/server/logger.js +2 -1
- package/src/daemon/server/project-graph-incremental-recomputation.js +5 -5
- package/src/daemon/server/server.js +26 -2
- package/src/daemon/server/shutdown-utils.js +4 -2
- package/src/devkit-exports.d.ts +10 -7
- package/src/devkit-exports.js +4 -6
- package/src/devkit-internals.d.ts +4 -2
- package/src/devkit-internals.js +8 -3
- package/src/executors/run-commands/run-commands.impl.d.ts +1 -0
- package/src/executors/run-commands/run-commands.impl.js +11 -4
- package/src/executors/run-commands/schema.json +14 -0
- package/src/executors/run-script/run-script.impl.js +1 -1
- package/src/executors/utils/convert-nx-executor.js +2 -4
- package/src/generators/internal-utils/format-changed-files-with-prettier-if-available.js +8 -0
- package/src/generators/testing-utils/create-tree.js +5 -1
- package/src/generators/utils/nx-json.d.ts +1 -1
- package/src/generators/utils/project-configuration.js +15 -4
- package/src/hasher/create-task-hasher.js +1 -1
- package/src/hasher/file-hasher.d.ts +1 -0
- package/src/hasher/file-hasher.js +5 -0
- package/src/hasher/hash-task.js +1 -1
- package/src/hasher/task-hasher.d.ts +2 -6
- package/src/hasher/task-hasher.js +6 -32
- package/src/migrations/update-20-0-0/move-use-daemon-process.d.ts +2 -0
- package/src/migrations/update-20-0-0/move-use-daemon-process.js +25 -0
- package/src/migrations/update-20-0-1/use-legacy-cache.d.ts +2 -0
- package/src/migrations/update-20-0-1/use-legacy-cache.js +20 -0
- package/src/native/index.d.ts +49 -20
- package/src/native/index.js +18 -3
- package/src/native/native-bindings.js +12 -2
- package/src/native/nx.openharmony-arm64.node +0 -0
- package/src/native/nx.wasi-browser.js +11 -8
- package/src/native/nx.wasi.cjs +11 -8
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/native/tests/__fixtures__/file-lock.fixture.js +20 -0
- package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +3 -2
- package/src/nx-cloud/update-manager.js +13 -1
- package/src/plugins/js/index.js +2 -2
- package/src/plugins/js/lock-file/lock-file.js +28 -13
- package/src/plugins/js/lock-file/utils/package-json.d.ts +1 -1
- package/src/plugins/js/lock-file/utils/package-json.js +3 -1
- package/src/plugins/js/lock-file/yarn-parser.js +102 -44
- package/src/plugins/js/project-graph/affected/lock-file-changes.js +1 -0
- package/src/plugins/js/project-graph/build-dependencies/explicit-package-json-dependencies.d.ts +2 -2
- package/src/plugins/js/project-graph/build-dependencies/explicit-package-json-dependencies.js +6 -20
- package/src/plugins/js/project-graph/build-dependencies/explicit-project-dependencies.js +1 -1
- package/src/plugins/js/project-graph/build-dependencies/target-project-locator.d.ts +14 -2
- package/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +81 -19
- package/src/plugins/js/utils/config.js +2 -9
- package/src/plugins/js/utils/packages.d.ts +8 -0
- package/src/plugins/js/utils/packages.js +91 -0
- package/src/plugins/js/utils/register.d.ts +5 -1
- package/src/plugins/js/utils/register.js +2 -1
- package/src/plugins/js/utils/typescript.d.ts +1 -0
- package/src/plugins/js/utils/typescript.js +4 -3
- package/src/plugins/js/versions.d.ts +1 -1
- package/src/plugins/js/versions.js +1 -1
- package/src/plugins/package-json/create-nodes.d.ts +7 -8
- package/src/plugins/package-json/create-nodes.js +34 -12
- package/src/project-graph/affected/affected-project-graph.js +3 -0
- package/src/project-graph/affected/locators/project-glob-changes.js +16 -4
- package/src/project-graph/build-project-graph.d.ts +2 -1
- package/src/project-graph/build-project-graph.js +66 -43
- package/src/project-graph/error-types.d.ts +15 -12
- package/src/project-graph/error-types.js +109 -23
- package/src/project-graph/file-utils.d.ts +3 -3
- package/src/project-graph/file-utils.js +8 -7
- package/src/project-graph/nx-deps-cache.d.ts +6 -3
- package/src/project-graph/nx-deps-cache.js +66 -11
- package/src/project-graph/plugins/get-plugins.d.ts +4 -0
- package/src/project-graph/plugins/get-plugins.js +144 -0
- package/src/project-graph/plugins/in-process-loader.d.ts +10 -0
- package/src/project-graph/plugins/in-process-loader.js +60 -0
- package/src/project-graph/plugins/index.d.ts +2 -1
- package/src/project-graph/plugins/index.js +5 -3
- package/src/project-graph/plugins/isolation/enabled.d.ts +1 -0
- package/src/project-graph/plugins/isolation/enabled.js +19 -0
- package/src/project-graph/plugins/isolation/index.d.ts +2 -2
- package/src/project-graph/plugins/isolation/index.js +1 -7
- package/src/project-graph/plugins/isolation/messaging.d.ts +39 -21
- package/src/project-graph/plugins/isolation/messaging.js +5 -1
- package/src/project-graph/plugins/isolation/plugin-pool.d.ts +1 -1
- package/src/project-graph/plugins/isolation/plugin-pool.js +58 -49
- package/src/project-graph/plugins/isolation/plugin-worker.js +79 -29
- package/src/project-graph/plugins/load-resolved-plugin.d.ts +3 -0
- package/src/project-graph/plugins/load-resolved-plugin.js +22 -0
- package/src/project-graph/plugins/loaded-nx-plugin.d.ts +20 -0
- package/src/project-graph/plugins/loaded-nx-plugin.js +80 -0
- package/src/project-graph/plugins/public-api.d.ts +32 -13
- package/src/project-graph/plugins/resolve-plugin.d.ts +15 -0
- package/src/project-graph/plugins/resolve-plugin.js +134 -0
- package/src/project-graph/plugins/tasks-execution-hooks.d.ts +3 -0
- package/src/project-graph/plugins/tasks-execution-hooks.js +65 -0
- package/src/project-graph/plugins/transpiler.d.ts +8 -0
- package/src/project-graph/plugins/transpiler.js +47 -0
- package/src/project-graph/plugins/utils.d.ts +2 -8
- package/src/project-graph/plugins/utils.js +2 -39
- package/src/project-graph/project-graph.d.ts +3 -1
- package/src/project-graph/project-graph.js +86 -20
- package/src/project-graph/utils/project-configuration-utils.d.ts +2 -2
- package/src/project-graph/utils/project-configuration-utils.js +55 -25
- package/src/project-graph/utils/retrieve-workspace-files.d.ts +3 -7
- package/src/project-graph/utils/retrieve-workspace-files.js +17 -23
- package/src/tasks-runner/batch/batch-messages.d.ts +2 -0
- package/src/tasks-runner/batch/run-batch.js +2 -4
- package/src/tasks-runner/cache.d.ts +22 -4
- package/src/tasks-runner/cache.js +160 -18
- package/src/tasks-runner/create-task-graph.d.ts +13 -1
- package/src/tasks-runner/create-task-graph.js +50 -22
- package/src/tasks-runner/default-tasks-runner.d.ts +1 -0
- package/src/tasks-runner/default-tasks-runner.js +20 -2
- package/src/tasks-runner/forked-process-task-runner.d.ts +4 -1
- package/src/tasks-runner/forked-process-task-runner.js +62 -40
- package/src/tasks-runner/init-tasks-runner.js +0 -2
- package/src/tasks-runner/life-cycle.d.ts +7 -0
- package/src/tasks-runner/run-command.d.ts +2 -4
- package/src/tasks-runner/run-command.js +51 -18
- package/src/tasks-runner/task-graph-utils.d.ts +11 -0
- package/src/tasks-runner/task-graph-utils.js +23 -0
- package/src/tasks-runner/task-orchestrator.js +14 -4
- package/src/tasks-runner/utils.js +2 -0
- package/src/utils/ab-testing.js +1 -1
- package/src/utils/assert-workspace-validity.js +4 -0
- package/src/utils/child-process.d.ts +4 -0
- package/src/utils/child-process.js +23 -30
- package/src/utils/command-line-utils.d.ts +5 -3
- package/src/utils/command-line-utils.js +37 -57
- package/src/utils/db-connection.d.ts +2 -1
- package/src/utils/db-connection.js +7 -0
- package/src/utils/default-base.js +1 -1
- package/src/utils/delayed-spinner.d.ts +42 -0
- package/src/utils/delayed-spinner.js +80 -0
- package/src/utils/find-matching-projects.js +13 -1
- package/src/utils/git-utils.index-filter.js +2 -2
- package/src/utils/git-utils.js +4 -4
- package/src/utils/git-utils.tree-filter.js +1 -1
- package/src/utils/handle-errors.js +24 -13
- package/src/utils/is-ci.js +4 -1
- package/src/utils/is-using-prettier.d.ts +3 -0
- package/src/utils/is-using-prettier.js +62 -0
- package/src/utils/nx-cloud-utils.js +3 -0
- package/src/utils/nx-key.d.ts +7 -0
- package/src/utils/nx-key.js +52 -0
- package/src/utils/package-json.d.ts +5 -1
- package/src/utils/package-json.js +9 -3
- package/src/utils/package-manager.d.ts +14 -0
- package/src/utils/package-manager.js +89 -3
- package/src/utils/path.js +1 -1
- package/src/utils/plugins/core-plugins.js +4 -0
- package/src/utils/plugins/plugin-capabilities.js +4 -5
- package/src/utils/print-help.js +3 -9
- package/src/utils/require-nx-key.d.ts +1 -0
- package/src/utils/require-nx-key.js +22 -0
- package/src/utils/sync-generators.js +9 -14
- package/src/utils/task-history.d.ts +1 -1
- package/src/utils/task-history.js +2 -2
- package/src/utils/workspace-context.d.ts +2 -0
- package/src/utils/workspace-context.js +16 -0
- package/tasks-runners/default.d.ts +1 -0
- package/tasks-runners/default.js +5 -0
- package/src/command-line/activate-powerpack/activate-powerpack.d.ts +0 -2
- package/src/command-line/activate-powerpack/activate-powerpack.js +0 -34
- package/src/command-line/activate-powerpack/command-object.d.ts +0 -6
- package/src/command-line/import/utils/needs-install.d.ts +0 -3
- package/src/command-line/import/utils/needs-install.js +0 -31
- package/src/command-line/init/implementation/react/write-craco-config.d.ts +0 -1
- package/src/command-line/init/implementation/react/write-craco-config.js +0 -61
- package/src/daemon/server/plugins.d.ts +0 -3
- package/src/daemon/server/plugins.js +0 -32
- package/src/hasher/node-task-hasher-impl.d.ts +0 -48
- package/src/hasher/node-task-hasher-impl.js +0 -449
- package/src/migrations/update-15-0-0/migrate-to-inputs.d.ts +0 -2
- package/src/migrations/update-15-0-0/migrate-to-inputs.js +0 -102
- package/src/migrations/update-15-0-0/prefix-outputs.d.ts +0 -2
- package/src/migrations/update-15-0-0/prefix-outputs.js +0 -49
- package/src/migrations/update-16-0-0/remove-nrwl-cli.d.ts +0 -2
- package/src/migrations/update-16-0-0/remove-nrwl-cli.js +0 -16
- package/src/migrations/update-16-0-0/update-depends-on-to-tokens.d.ts +0 -2
- package/src/migrations/update-16-0-0/update-depends-on-to-tokens.js +0 -97
- package/src/migrations/update-16-0-0/update-nx-cloud-runner.d.ts +0 -2
- package/src/migrations/update-16-0-0/update-nx-cloud-runner.js +0 -29
- package/src/migrations/update-16-2-0/remove-run-commands-output-path.d.ts +0 -2
- package/src/migrations/update-16-2-0/remove-run-commands-output-path.js +0 -45
- package/src/migrations/update-16-8-0/escape-dollar-sign-env-variables.d.ts +0 -12
- package/src/migrations/update-16-8-0/escape-dollar-sign-env-variables.js +0 -67
- package/src/migrations/update-16-9-0/remove-project-name-and-root-format.d.ts +0 -2
- package/src/migrations/update-16-9-0/remove-project-name-and-root-format.js +0 -21
- package/src/native/nx.ohos-arm64.node +0 -0
- package/src/project-graph/plugins/internal-api.d.ts +0 -29
- package/src/project-graph/plugins/internal-api.js +0 -134
- package/src/project-graph/plugins/loader.d.ts +0 -24
- package/src/project-graph/plugins/loader.js +0 -220
- package/src/utils/app-root.d.ts +0 -8
- package/src/utils/app-root.js +0 -12
- package/src/utils/nx-plugin.deprecated.d.ts +0 -31
- package/src/utils/nx-plugin.deprecated.js +0 -20
- package/src/utils/powerpack.d.ts +0 -5
- package/src/utils/powerpack.js +0 -33
- package/src/utils/workspace-configuration-check.d.ts +0 -1
- package/src/utils/workspace-configuration-check.js +0 -36
|
@@ -18,14 +18,21 @@ const workspace_root_1 = require("../utils/workspace-root");
|
|
|
18
18
|
const build_project_graph_1 = require("./build-project-graph");
|
|
19
19
|
const error_types_1 = require("./error-types");
|
|
20
20
|
const nx_deps_cache_1 = require("./nx-deps-cache");
|
|
21
|
-
const internal_api_1 = require("./plugins/internal-api");
|
|
22
21
|
const retrieve_workspace_files_1 = require("./utils/retrieve-workspace-files");
|
|
22
|
+
const get_plugins_1 = require("./plugins/get-plugins");
|
|
23
|
+
const logger_1 = require("../utils/logger");
|
|
24
|
+
const native_1 = require("../native");
|
|
25
|
+
const path_1 = require("path");
|
|
26
|
+
const cache_directory_1 = require("../utils/cache-directory");
|
|
27
|
+
const delayed_spinner_1 = require("../utils/delayed-spinner");
|
|
23
28
|
/**
|
|
24
29
|
* Synchronously reads the latest cached copy of the workspace's ProjectGraph.
|
|
30
|
+
*
|
|
31
|
+
* @param {number} [minimumComputedAt] - The minimum timestamp that the cached ProjectGraph must have been computed at.
|
|
25
32
|
* @throws {Error} if there is no cached ProjectGraph to read from
|
|
26
33
|
*/
|
|
27
|
-
function readCachedProjectGraph() {
|
|
28
|
-
const projectGraphCache = (0, nx_deps_cache_1.readProjectGraphCache)();
|
|
34
|
+
function readCachedProjectGraph(minimumComputedAt) {
|
|
35
|
+
const projectGraphCache = (0, nx_deps_cache_1.readProjectGraphCache)(minimumComputedAt);
|
|
29
36
|
if (!projectGraphCache) {
|
|
30
37
|
const angularSpecificError = (0, fileutils_1.fileExists)(`${workspace_root_1.workspaceRoot}/angular.json`)
|
|
31
38
|
? (0, strip_indents_1.stripIndents) `
|
|
@@ -75,7 +82,7 @@ async function buildProjectGraphAndSourceMapsWithoutDaemon() {
|
|
|
75
82
|
perf_hooks_1.performance.mark('retrieve-project-configurations:start');
|
|
76
83
|
let configurationResult;
|
|
77
84
|
let projectConfigurationsError;
|
|
78
|
-
const
|
|
85
|
+
const plugins = await (0, get_plugins_1.getPlugins)();
|
|
79
86
|
try {
|
|
80
87
|
configurationResult = await (0, retrieve_workspace_files_1.retrieveProjectConfigurations)(plugins, workspace_root_1.workspaceRoot, nxJson);
|
|
81
88
|
}
|
|
@@ -112,15 +119,6 @@ async function buildProjectGraphAndSourceMapsWithoutDaemon() {
|
|
|
112
119
|
throw e;
|
|
113
120
|
}
|
|
114
121
|
}
|
|
115
|
-
finally {
|
|
116
|
-
// When plugins are isolated we don't clean them up during
|
|
117
|
-
// a single run of the CLI. They are cleaned up when the CLI
|
|
118
|
-
// process exits. Cleaning them here could cause issues if pending
|
|
119
|
-
// promises are not resolved.
|
|
120
|
-
if (process.env.NX_ISOLATE_PLUGINS !== 'true') {
|
|
121
|
-
cleanup();
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
122
|
const { projectGraph, projectFileMapCache } = projectGraphResult;
|
|
125
123
|
perf_hooks_1.performance.mark('build-project-graph-using-project-file-map:end');
|
|
126
124
|
delete global.NX_GRAPH_CREATION;
|
|
@@ -128,13 +126,13 @@ async function buildProjectGraphAndSourceMapsWithoutDaemon() {
|
|
|
128
126
|
...(projectConfigurationsError?.errors ?? []),
|
|
129
127
|
...(projectGraphError?.errors ?? []),
|
|
130
128
|
];
|
|
129
|
+
if (cacheEnabled) {
|
|
130
|
+
(0, nx_deps_cache_1.writeCache)(projectFileMapCache, projectGraph, sourceMaps, errors);
|
|
131
|
+
}
|
|
131
132
|
if (errors.length > 0) {
|
|
132
133
|
throw new error_types_1.ProjectGraphError(errors, projectGraph, sourceMaps);
|
|
133
134
|
}
|
|
134
135
|
else {
|
|
135
|
-
if (cacheEnabled) {
|
|
136
|
-
(0, nx_deps_cache_1.writeCache)(projectFileMapCache, projectGraph);
|
|
137
|
-
}
|
|
138
136
|
return { projectGraph, sourceMaps };
|
|
139
137
|
}
|
|
140
138
|
}
|
|
@@ -143,9 +141,6 @@ function handleProjectGraphError(opts, e) {
|
|
|
143
141
|
const isVerbose = process.env.NX_VERBOSE_LOGGING === 'true';
|
|
144
142
|
if (e instanceof error_types_1.ProjectGraphError) {
|
|
145
143
|
let title = e.message;
|
|
146
|
-
if (isVerbose) {
|
|
147
|
-
title += ' See errors below.';
|
|
148
|
-
}
|
|
149
144
|
const bodyLines = isVerbose
|
|
150
145
|
? [e.stack]
|
|
151
146
|
: ['Pass --verbose to see the stacktraces.'];
|
|
@@ -154,7 +149,7 @@ function handleProjectGraphError(opts, e) {
|
|
|
154
149
|
bodyLines: bodyLines,
|
|
155
150
|
});
|
|
156
151
|
}
|
|
157
|
-
else {
|
|
152
|
+
else if (typeof e.message === 'string') {
|
|
158
153
|
const lines = e.message.split('\n');
|
|
159
154
|
output_1.output.error({
|
|
160
155
|
title: lines[0],
|
|
@@ -164,12 +159,25 @@ function handleProjectGraphError(opts, e) {
|
|
|
164
159
|
console.error(e);
|
|
165
160
|
}
|
|
166
161
|
}
|
|
162
|
+
else {
|
|
163
|
+
console.error(e);
|
|
164
|
+
}
|
|
167
165
|
process.exit(1);
|
|
168
166
|
}
|
|
169
167
|
else {
|
|
170
168
|
throw e;
|
|
171
169
|
}
|
|
172
170
|
}
|
|
171
|
+
async function readCachedGraphAndHydrateFileMap(minimumComputedAt) {
|
|
172
|
+
const graph = readCachedProjectGraph(minimumComputedAt);
|
|
173
|
+
const projectRootMap = Object.fromEntries(Object.entries(graph.nodes).map(([project, { data }]) => [
|
|
174
|
+
data.root,
|
|
175
|
+
project,
|
|
176
|
+
]));
|
|
177
|
+
const { allWorkspaceFiles, fileMap, rustReferences } = await (0, retrieve_workspace_files_1.retrieveWorkspaceFiles)(workspace_root_1.workspaceRoot, projectRootMap);
|
|
178
|
+
(0, build_project_graph_1.hydrateFileMap)(fileMap, allWorkspaceFiles, rustReferences);
|
|
179
|
+
return graph;
|
|
180
|
+
}
|
|
173
181
|
/**
|
|
174
182
|
* Computes and returns a ProjectGraph.
|
|
175
183
|
*
|
|
@@ -195,6 +203,19 @@ async function createProjectGraphAsync(opts = {
|
|
|
195
203
|
exitOnError: false,
|
|
196
204
|
resetDaemonClient: false,
|
|
197
205
|
}) {
|
|
206
|
+
if (process.env.NX_FORCE_REUSE_CACHED_GRAPH === 'true') {
|
|
207
|
+
try {
|
|
208
|
+
// If no cached graph is found, we will fall through to the normal flow
|
|
209
|
+
const graph = await readCachedGraphAndHydrateFileMap();
|
|
210
|
+
return graph;
|
|
211
|
+
}
|
|
212
|
+
catch (e) {
|
|
213
|
+
if (e instanceof error_types_1.ProjectGraphError) {
|
|
214
|
+
throw e;
|
|
215
|
+
}
|
|
216
|
+
logger_1.logger.verbose('Unable to use cached project graph', e);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
198
219
|
const projectGraphAndSourceMaps = await createProjectGraphAndSourceMapsAsync(opts);
|
|
199
220
|
return projectGraphAndSourceMaps.projectGraph;
|
|
200
221
|
}
|
|
@@ -204,6 +225,48 @@ async function createProjectGraphAndSourceMapsAsync(opts = {
|
|
|
204
225
|
}) {
|
|
205
226
|
perf_hooks_1.performance.mark('create-project-graph-async:start');
|
|
206
227
|
if (!client_1.daemonClient.enabled()) {
|
|
228
|
+
const lock = !native_1.IS_WASM
|
|
229
|
+
? new native_1.FileLock((0, path_1.join)(cache_directory_1.workspaceDataDirectory, 'project-graph.lock'))
|
|
230
|
+
: null;
|
|
231
|
+
let locked = lock?.locked;
|
|
232
|
+
while (locked) {
|
|
233
|
+
logger_1.logger.verbose('Waiting for graph construction in another process to complete');
|
|
234
|
+
const spinner = new delayed_spinner_1.DelayedSpinner('Waiting for graph construction in another process to complete');
|
|
235
|
+
const start = Date.now();
|
|
236
|
+
await lock.wait();
|
|
237
|
+
spinner.cleanup();
|
|
238
|
+
// Note: This will currently throw if any of the caches are missing...
|
|
239
|
+
// It would be nice if one of the processes that was waiting for the lock
|
|
240
|
+
// could pick up the slack and build the graph if it's missing, but
|
|
241
|
+
// we wouldn't want either of the below to happen:
|
|
242
|
+
// - All of the waiting processes to build the graph
|
|
243
|
+
// - Even one of the processes building the graph on a legitimate error
|
|
244
|
+
try {
|
|
245
|
+
// Ensuring that computedAt was after this process started
|
|
246
|
+
// waiting for the graph to complete, means that the graph
|
|
247
|
+
// was computed by the process was already working.
|
|
248
|
+
const graph = await readCachedGraphAndHydrateFileMap(start);
|
|
249
|
+
const sourceMaps = (0, nx_deps_cache_1.readSourceMapsCache)();
|
|
250
|
+
if (!sourceMaps) {
|
|
251
|
+
throw new Error('The project graph was computed in another process, but the source maps are missing.');
|
|
252
|
+
}
|
|
253
|
+
return {
|
|
254
|
+
projectGraph: graph,
|
|
255
|
+
sourceMaps,
|
|
256
|
+
};
|
|
257
|
+
}
|
|
258
|
+
catch (e) {
|
|
259
|
+
// If the error is that the cached graph is stale after unlock,
|
|
260
|
+
// the process that was working on the graph must have been canceled,
|
|
261
|
+
// so we will fall through to the normal flow to ensure
|
|
262
|
+
// its created by one of the processes that was waiting
|
|
263
|
+
if (!(e instanceof error_types_1.StaleProjectGraphCacheError)) {
|
|
264
|
+
throw e;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
locked = lock.check();
|
|
268
|
+
}
|
|
269
|
+
lock?.lock();
|
|
207
270
|
try {
|
|
208
271
|
const res = await buildProjectGraphAndSourceMapsWithoutDaemon();
|
|
209
272
|
perf_hooks_1.performance.measure('create-project-graph-async >> retrieve-project-configurations', 'retrieve-project-configurations:start', 'retrieve-project-configurations:end');
|
|
@@ -216,6 +279,9 @@ async function createProjectGraphAndSourceMapsAsync(opts = {
|
|
|
216
279
|
catch (e) {
|
|
217
280
|
handleProjectGraphError(opts, e);
|
|
218
281
|
}
|
|
282
|
+
finally {
|
|
283
|
+
lock?.unlock();
|
|
284
|
+
}
|
|
219
285
|
}
|
|
220
286
|
else {
|
|
221
287
|
try {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { NxJsonConfiguration, TargetDefaults } from '../../config/nx-json';
|
|
2
2
|
import { ProjectGraphExternalNode } from '../../config/project-graph';
|
|
3
3
|
import { ProjectConfiguration, ProjectMetadata, TargetConfiguration, TargetMetadata } from '../../config/workspace-json-project-json';
|
|
4
|
-
import { LoadedNxPlugin } from '../plugins/
|
|
4
|
+
import { LoadedNxPlugin } from '../plugins/loaded-nx-plugin';
|
|
5
5
|
export type SourceInformation = [file: string | null, plugin: string];
|
|
6
6
|
export type ConfigurationSourceMaps = Record<string, Record<string, SourceInformation>>;
|
|
7
7
|
export declare function mergeProjectConfigurationIntoRootMap(projectRootMap: Record<string, ProjectConfiguration>, project: ProjectConfiguration, configurationSourceMaps?: ConfigurationSourceMaps, sourceInformation?: SourceInformation, skipTargetNormalization?: boolean): void;
|
|
@@ -35,7 +35,7 @@ export type ConfigurationResult = {
|
|
|
35
35
|
* @param workspaceFiles A list of non-ignored workspace files
|
|
36
36
|
* @param plugins The plugins that should be used to infer project configuration
|
|
37
37
|
*/
|
|
38
|
-
export declare function
|
|
38
|
+
export declare function createProjectConfigurationsWithPlugins(root: string, nxJson: NxJsonConfiguration, projectFiles: string[][], // making this parameter allows devkit to pick up newly created projects
|
|
39
39
|
plugins: LoadedNxPlugin[]): Promise<ConfigurationResult>;
|
|
40
40
|
export declare function findMatchingConfigFiles(projectFiles: string[], pattern: string, include: string[], exclude: string[]): string[];
|
|
41
41
|
export declare function readProjectConfigurationsFromRootMap(projectRootMap: Record<string, ProjectConfiguration>): Record<string, ProjectConfiguration>;
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.mergeProjectConfigurationIntoRootMap = mergeProjectConfigurationIntoRootMap;
|
|
4
4
|
exports.mergeMetadata = mergeMetadata;
|
|
5
|
-
exports.
|
|
5
|
+
exports.createProjectConfigurationsWithPlugins = createProjectConfigurationsWithPlugins;
|
|
6
6
|
exports.findMatchingConfigFiles = findMatchingConfigFiles;
|
|
7
7
|
exports.readProjectConfigurationsFromRootMap = readProjectConfigurationsFromRootMap;
|
|
8
8
|
exports.validateProject = validateProject;
|
|
@@ -20,6 +20,7 @@ const path_1 = require("path");
|
|
|
20
20
|
const perf_hooks_1 = require("perf_hooks");
|
|
21
21
|
const error_types_1 = require("../error-types");
|
|
22
22
|
const globs_1 = require("../../utils/globs");
|
|
23
|
+
const delayed_spinner_1 = require("../../utils/delayed-spinner");
|
|
23
24
|
function mergeProjectConfigurationIntoRootMap(projectRootMap, project, configurationSourceMaps, sourceInformation,
|
|
24
25
|
// This function is used when reading project configuration
|
|
25
26
|
// in generators, where we don't want to do this.
|
|
@@ -137,8 +138,20 @@ skipTargetNormalization) {
|
|
|
137
138
|
const normalizedTarget = skipTargetNormalization
|
|
138
139
|
? target
|
|
139
140
|
: resolveCommandSyntacticSugar(target, project.root);
|
|
140
|
-
|
|
141
|
-
|
|
141
|
+
let matchingTargets = [];
|
|
142
|
+
if ((0, globs_1.isGlobPattern)(targetName)) {
|
|
143
|
+
// find all targets matching the glob pattern
|
|
144
|
+
// this will map atomized targets to the glob pattern same as it does for targetDefaults
|
|
145
|
+
matchingTargets = Object.keys(updatedProjectConfiguration.targets).filter((key) => (0, minimatch_1.minimatch)(key, targetName));
|
|
146
|
+
}
|
|
147
|
+
// If no matching targets were found, we can assume that the target name is not (meant to be) a glob pattern
|
|
148
|
+
if (!matchingTargets.length) {
|
|
149
|
+
matchingTargets = [targetName];
|
|
150
|
+
}
|
|
151
|
+
for (const matchingTargetName of matchingTargets) {
|
|
152
|
+
const mergedTarget = mergeTargetConfigurations(normalizedTarget, matchingProject.targets?.[matchingTargetName], sourceMap, sourceInformation, `targets.${matchingTargetName}`);
|
|
153
|
+
updatedProjectConfiguration.targets[matchingTargetName] = mergedTarget;
|
|
154
|
+
}
|
|
142
155
|
}
|
|
143
156
|
}
|
|
144
157
|
projectRootMap[updatedProjectConfiguration.root] =
|
|
@@ -221,50 +234,66 @@ function mergeMetadata(sourceMap, sourceInformation, baseSourceMapPath, metadata
|
|
|
221
234
|
* @param workspaceFiles A list of non-ignored workspace files
|
|
222
235
|
* @param plugins The plugins that should be used to infer project configuration
|
|
223
236
|
*/
|
|
224
|
-
async function
|
|
237
|
+
async function createProjectConfigurationsWithPlugins(root = workspace_root_1.workspaceRoot, nxJson, projectFiles, // making this parameter allows devkit to pick up newly created projects
|
|
225
238
|
plugins) {
|
|
226
239
|
perf_hooks_1.performance.mark('build-project-configs:start');
|
|
240
|
+
let spinner;
|
|
241
|
+
const inProgressPlugins = new Set();
|
|
242
|
+
function updateSpinner() {
|
|
243
|
+
if (!spinner || inProgressPlugins.size === 0) {
|
|
244
|
+
return;
|
|
245
|
+
}
|
|
246
|
+
if (inProgressPlugins.size === 1) {
|
|
247
|
+
spinner.setMessage(`Creating project graph nodes with ${inProgressPlugins.values().next().value}`);
|
|
248
|
+
}
|
|
249
|
+
else if (process.env.NX_VERBOSE_LOGGING === 'true') {
|
|
250
|
+
spinner.setMessage([
|
|
251
|
+
`Creating project graph nodes with ${inProgressPlugins.size} plugins`,
|
|
252
|
+
...Array.from(inProgressPlugins).map((p) => ` - ${p}`),
|
|
253
|
+
].join('\n'));
|
|
254
|
+
}
|
|
255
|
+
else {
|
|
256
|
+
spinner.setMessage(`Creating project graph nodes with ${inProgressPlugins.size} plugins`);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
spinner = new delayed_spinner_1.DelayedSpinner(`Creating project graph nodes with ${plugins.length} plugins`);
|
|
227
260
|
const results = [];
|
|
228
261
|
const errors = [];
|
|
229
262
|
// We iterate over plugins first - this ensures that plugins specified first take precedence.
|
|
230
|
-
for (const { createNodes: createNodesTuple, include, exclude, name: pluginName, } of plugins) {
|
|
263
|
+
for (const [index, { index: pluginIndex, createNodes: createNodesTuple, include, exclude, name: pluginName, },] of plugins.entries()) {
|
|
231
264
|
const [pattern, createNodes] = createNodesTuple ?? [];
|
|
232
265
|
if (!pattern) {
|
|
233
266
|
continue;
|
|
234
267
|
}
|
|
235
|
-
const matchingConfigFiles = findMatchingConfigFiles(projectFiles, pattern, include, exclude);
|
|
268
|
+
const matchingConfigFiles = findMatchingConfigFiles(projectFiles[index], pattern, include, exclude);
|
|
269
|
+
inProgressPlugins.add(pluginName);
|
|
236
270
|
let r = createNodes(matchingConfigFiles, {
|
|
237
271
|
nxJsonConfiguration: nxJson,
|
|
238
272
|
workspaceRoot: root,
|
|
239
|
-
})
|
|
240
|
-
|
|
241
|
-
`An error occurred while processing files for the ${pluginName} plugin.`,
|
|
242
|
-
];
|
|
273
|
+
})
|
|
274
|
+
.catch((e) => {
|
|
243
275
|
const error = (0, error_types_1.isAggregateCreateNodesError)(e)
|
|
244
276
|
? // This is an expected error if something goes wrong while processing files.
|
|
245
277
|
e
|
|
246
278
|
: // This represents a single plugin erroring out with a hard error.
|
|
247
279
|
new error_types_1.AggregateCreateNodesError([[null, e]], []);
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
if (file) {
|
|
251
|
-
errorBodyLines.push(` - ${file}: ${e.message}`);
|
|
252
|
-
}
|
|
253
|
-
else {
|
|
254
|
-
errorBodyLines.push(` - ${e.message}`);
|
|
255
|
-
}
|
|
256
|
-
const innerStackTrace = ' ' + e.stack.split('\n').join('\n ');
|
|
257
|
-
errorBodyLines.push(innerStackTrace);
|
|
280
|
+
if (pluginIndex !== undefined) {
|
|
281
|
+
error.pluginIndex = pluginIndex;
|
|
258
282
|
}
|
|
259
|
-
|
|
283
|
+
(0, error_types_1.formatAggregateCreateNodesError)(error, pluginName);
|
|
260
284
|
// This represents a single plugin erroring out with a hard error.
|
|
261
285
|
errors.push(error);
|
|
262
286
|
// The plugin didn't return partial results, so we return an empty array.
|
|
263
|
-
return error.partialResults.map((r) => [pluginName, r[0], r[1]]);
|
|
287
|
+
return error.partialResults.map((r) => [pluginName, r[0], r[1], index]);
|
|
288
|
+
})
|
|
289
|
+
.finally(() => {
|
|
290
|
+
inProgressPlugins.delete(pluginName);
|
|
291
|
+
updateSpinner();
|
|
264
292
|
});
|
|
265
293
|
results.push(r);
|
|
266
294
|
}
|
|
267
295
|
return Promise.all(results).then((results) => {
|
|
296
|
+
spinner?.cleanup();
|
|
268
297
|
const { projectRootMap, externalNodes, rootMap, configurationSourceMaps } = mergeCreateNodesResults(results, nxJson, errors);
|
|
269
298
|
perf_hooks_1.performance.mark('build-project-configs:end');
|
|
270
299
|
perf_hooks_1.performance.measure('build-project-configs', 'build-project-configs:start', 'build-project-configs:end');
|
|
@@ -274,7 +303,7 @@ plugins) {
|
|
|
274
303
|
externalNodes,
|
|
275
304
|
projectRootMap: rootMap,
|
|
276
305
|
sourceMaps: configurationSourceMaps,
|
|
277
|
-
matchingProjectFiles: projectFiles,
|
|
306
|
+
matchingProjectFiles: projectFiles.flat(),
|
|
278
307
|
};
|
|
279
308
|
}
|
|
280
309
|
else {
|
|
@@ -283,7 +312,7 @@ plugins) {
|
|
|
283
312
|
externalNodes,
|
|
284
313
|
projectRootMap: rootMap,
|
|
285
314
|
sourceMaps: configurationSourceMaps,
|
|
286
|
-
matchingProjectFiles: projectFiles,
|
|
315
|
+
matchingProjectFiles: projectFiles.flat(),
|
|
287
316
|
});
|
|
288
317
|
}
|
|
289
318
|
});
|
|
@@ -294,7 +323,7 @@ function mergeCreateNodesResults(results, nxJsonConfiguration, errors) {
|
|
|
294
323
|
const externalNodes = {};
|
|
295
324
|
const configurationSourceMaps = {};
|
|
296
325
|
for (const result of results.flat()) {
|
|
297
|
-
const [pluginName, file, nodes] = result;
|
|
326
|
+
const [pluginName, file, nodes, pluginIndex] = result;
|
|
298
327
|
const { projects: projectNodes, externalNodes: pluginExternalNodes } = nodes;
|
|
299
328
|
const sourceInfo = [file, pluginName];
|
|
300
329
|
for (const node in projectNodes) {
|
|
@@ -314,6 +343,7 @@ function mergeCreateNodesResults(results, nxJsonConfiguration, errors) {
|
|
|
314
343
|
file,
|
|
315
344
|
pluginName,
|
|
316
345
|
error,
|
|
346
|
+
pluginIndex,
|
|
317
347
|
}));
|
|
318
348
|
}
|
|
319
349
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ProjectConfiguration } from '../../config/workspace-json-project-json';
|
|
2
2
|
import { NxJsonConfiguration } from '../../config/nx-json';
|
|
3
3
|
import { ConfigurationResult } from './project-configuration-utils';
|
|
4
|
-
import { LoadedNxPlugin } from '../plugins/
|
|
4
|
+
import { LoadedNxPlugin } from '../plugins/loaded-nx-plugin';
|
|
5
5
|
/**
|
|
6
6
|
* Walks the workspace directory to create the `projectFileMap`, `ProjectConfigurations` and `allWorkspaceFiles`
|
|
7
7
|
* @throws
|
|
@@ -21,10 +21,6 @@ export declare function retrieveWorkspaceFiles(workspaceRoot: string, projectRoo
|
|
|
21
21
|
*/
|
|
22
22
|
export declare function retrieveProjectConfigurations(plugins: LoadedNxPlugin[], workspaceRoot: string, nxJson: NxJsonConfiguration): Promise<ConfigurationResult>;
|
|
23
23
|
export declare function retrieveProjectConfigurationsWithAngularProjects(workspaceRoot: string, nxJson: NxJsonConfiguration): Promise<ConfigurationResult>;
|
|
24
|
-
export declare function retrieveProjectConfigurationPaths(root: string, plugins: Array<
|
|
25
|
-
createNodes?: readonly [string, ...unknown[]];
|
|
26
|
-
} & unknown>): Promise<string[]>;
|
|
24
|
+
export declare function retrieveProjectConfigurationPaths(root: string, plugins: Array<LoadedNxPlugin>): Promise<string[]>;
|
|
27
25
|
export declare function retrieveProjectConfigurationsWithoutPluginInference(root: string): Promise<Record<string, ProjectConfiguration>>;
|
|
28
|
-
export declare function
|
|
29
|
-
createNodes?: readonly [string, ...unknown[]];
|
|
30
|
-
}>): string[];
|
|
26
|
+
export declare function getGlobPatternsOfPlugins(plugins: Array<LoadedNxPlugin>): string[];
|
|
@@ -5,15 +5,15 @@ exports.retrieveProjectConfigurations = retrieveProjectConfigurations;
|
|
|
5
5
|
exports.retrieveProjectConfigurationsWithAngularProjects = retrieveProjectConfigurationsWithAngularProjects;
|
|
6
6
|
exports.retrieveProjectConfigurationPaths = retrieveProjectConfigurationPaths;
|
|
7
7
|
exports.retrieveProjectConfigurationsWithoutPluginInference = retrieveProjectConfigurationsWithoutPluginInference;
|
|
8
|
-
exports.
|
|
8
|
+
exports.getGlobPatternsOfPlugins = getGlobPatternsOfPlugins;
|
|
9
9
|
const perf_hooks_1 = require("perf_hooks");
|
|
10
10
|
const angular_json_1 = require("../../adapter/angular-json");
|
|
11
11
|
const nx_json_1 = require("../../config/nx-json");
|
|
12
12
|
const project_configuration_utils_1 = require("./project-configuration-utils");
|
|
13
|
-
const internal_api_1 = require("../plugins/internal-api");
|
|
14
13
|
const workspace_context_1 = require("../../utils/workspace-context");
|
|
15
14
|
const build_all_workspace_files_1 = require("./build-all-workspace-files");
|
|
16
15
|
const path_1 = require("path");
|
|
16
|
+
const get_plugins_1 = require("../plugins/get-plugins");
|
|
17
17
|
/**
|
|
18
18
|
* Walks the workspace directory to create the `projectFileMap`, `ProjectConfigurations` and `allWorkspaceFiles`
|
|
19
19
|
* @throws
|
|
@@ -41,9 +41,10 @@ async function retrieveWorkspaceFiles(workspaceRoot, projectRootMap) {
|
|
|
41
41
|
* Walk through the workspace and return `ProjectConfigurations`. Only use this if the projectFileMap is not needed.
|
|
42
42
|
*/
|
|
43
43
|
async function retrieveProjectConfigurations(plugins, workspaceRoot, nxJson) {
|
|
44
|
-
const
|
|
45
|
-
const
|
|
46
|
-
|
|
44
|
+
const pluginsWithCreateNodes = plugins.filter((p) => !!p.createNodes);
|
|
45
|
+
const globPatterns = getGlobPatternsOfPlugins(pluginsWithCreateNodes);
|
|
46
|
+
const pluginConfigFiles = await (0, workspace_context_1.multiGlobWithWorkspaceContext)(workspaceRoot, globPatterns);
|
|
47
|
+
return (0, project_configuration_utils_1.createProjectConfigurationsWithPlugins)(workspaceRoot, nxJson, pluginConfigFiles, pluginsWithCreateNodes);
|
|
47
48
|
}
|
|
48
49
|
async function retrieveProjectConfigurationsWithAngularProjects(workspaceRoot, nxJson) {
|
|
49
50
|
const pluginsToLoad = nxJson?.plugins ?? [];
|
|
@@ -52,37 +53,30 @@ async function retrieveProjectConfigurationsWithAngularProjects(workspaceRoot, n
|
|
|
52
53
|
(typeof p === 'object' && p.plugin === angular_json_1.NX_ANGULAR_JSON_PLUGIN_NAME))) {
|
|
53
54
|
pluginsToLoad.push((0, path_1.join)(__dirname, '../../adapter/angular-json'));
|
|
54
55
|
}
|
|
55
|
-
const
|
|
56
|
+
const plugins = await (0, get_plugins_1.getPlugins)(workspaceRoot);
|
|
56
57
|
const res = await retrieveProjectConfigurations(plugins, workspaceRoot, nxJson);
|
|
57
|
-
cleanup();
|
|
58
58
|
return res;
|
|
59
59
|
}
|
|
60
|
-
function retrieveProjectConfigurationPaths(root, plugins) {
|
|
61
|
-
const projectGlobPatterns =
|
|
62
|
-
|
|
60
|
+
async function retrieveProjectConfigurationPaths(root, plugins) {
|
|
61
|
+
const projectGlobPatterns = getGlobPatternsOfPlugins(plugins);
|
|
62
|
+
const pluginConfigFiles = await (0, workspace_context_1.multiGlobWithWorkspaceContext)(root, projectGlobPatterns);
|
|
63
|
+
return pluginConfigFiles.flat();
|
|
63
64
|
}
|
|
64
65
|
const projectsWithoutPluginCache = new Map();
|
|
65
66
|
// TODO: This function is called way too often, it should be optimized without this cache
|
|
66
67
|
async function retrieveProjectConfigurationsWithoutPluginInference(root) {
|
|
67
68
|
const nxJson = (0, nx_json_1.readNxJson)(root);
|
|
68
|
-
const
|
|
69
|
-
const projectGlobPatterns =
|
|
69
|
+
const plugins = await (0, get_plugins_1.getOnlyDefaultPlugins)(); // only load default plugins
|
|
70
|
+
const projectGlobPatterns = getGlobPatternsOfPlugins(plugins);
|
|
70
71
|
const cacheKey = root + ',' + projectGlobPatterns.join(',');
|
|
71
72
|
if (projectsWithoutPluginCache.has(cacheKey)) {
|
|
72
73
|
return projectsWithoutPluginCache.get(cacheKey);
|
|
73
74
|
}
|
|
74
|
-
const projectFiles = (await (0, workspace_context_1.
|
|
75
|
-
const { projects } = await (0, project_configuration_utils_1.
|
|
75
|
+
const projectFiles = (await (0, workspace_context_1.multiGlobWithWorkspaceContext)(root, projectGlobPatterns)) ?? [];
|
|
76
|
+
const { projects } = await (0, project_configuration_utils_1.createProjectConfigurationsWithPlugins)(root, nxJson, projectFiles, plugins);
|
|
76
77
|
projectsWithoutPluginCache.set(cacheKey, projects);
|
|
77
|
-
cleanup();
|
|
78
78
|
return projects;
|
|
79
79
|
}
|
|
80
|
-
function
|
|
81
|
-
|
|
82
|
-
for (const plugin of plugins) {
|
|
83
|
-
if ('createNodes' in plugin && plugin.createNodes) {
|
|
84
|
-
globPatterns.push(plugin.createNodes[0]);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
return globPatterns;
|
|
80
|
+
function getGlobPatternsOfPlugins(plugins) {
|
|
81
|
+
return plugins.map((p) => p.createNodes[0]);
|
|
88
82
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { TaskResult } from '../../config/misc-interfaces';
|
|
2
2
|
import type { TaskGraph } from '../../config/task-graph';
|
|
3
|
+
import type { ProjectGraph } from '../../config/project-graph';
|
|
3
4
|
export declare enum BatchMessageType {
|
|
4
5
|
RunTasks = 0,
|
|
5
6
|
CompleteTask = 1,
|
|
@@ -18,6 +19,7 @@ export interface BatchTaskResult {
|
|
|
18
19
|
export interface RunTasksMessage {
|
|
19
20
|
type: BatchMessageType.RunTasks;
|
|
20
21
|
executorName: string;
|
|
22
|
+
projectGraph: ProjectGraph;
|
|
21
23
|
batchTaskGraph: TaskGraph;
|
|
22
24
|
fullTaskGraph: TaskGraph;
|
|
23
25
|
}
|
|
@@ -11,9 +11,8 @@ function getBatchExecutor(executorName, projects) {
|
|
|
11
11
|
const [nodeModule, exportName] = executorName.split(':');
|
|
12
12
|
return (0, executor_utils_1.getExecutorInformation)(nodeModule, exportName, workspace_root_1.workspaceRoot, projects);
|
|
13
13
|
}
|
|
14
|
-
async function runTasks(executorName, batchTaskGraph, fullTaskGraph) {
|
|
14
|
+
async function runTasks(executorName, projectGraph, batchTaskGraph, fullTaskGraph) {
|
|
15
15
|
const input = {};
|
|
16
|
-
const projectGraph = await (0, project_graph_1.createProjectGraphAsync)();
|
|
17
16
|
const projectsConfigurations = (0, project_graph_1.readProjectsConfigurationFromProjectGraph)(projectGraph);
|
|
18
17
|
const nxJsonConfiguration = (0, configuration_1.readNxJson)();
|
|
19
18
|
const batchExecutor = getBatchExecutor(executorName, projectsConfigurations.projects);
|
|
@@ -23,7 +22,6 @@ async function runTasks(executorName, batchTaskGraph, fullTaskGraph) {
|
|
|
23
22
|
cwd: process.cwd(),
|
|
24
23
|
projectsConfigurations,
|
|
25
24
|
nxJsonConfiguration,
|
|
26
|
-
workspace: { ...projectsConfigurations, ...nxJsonConfiguration },
|
|
27
25
|
isVerbose: false,
|
|
28
26
|
projectGraph,
|
|
29
27
|
taskGraph: fullTaskGraph,
|
|
@@ -67,7 +65,7 @@ async function runTasks(executorName, batchTaskGraph, fullTaskGraph) {
|
|
|
67
65
|
process.on('message', async (message) => {
|
|
68
66
|
switch (message.type) {
|
|
69
67
|
case batch_messages_1.BatchMessageType.RunTasks: {
|
|
70
|
-
const results = await runTasks(message.executorName, message.batchTaskGraph, message.fullTaskGraph);
|
|
68
|
+
const results = await runTasks(message.executorName, message.projectGraph, message.batchTaskGraph, message.fullTaskGraph);
|
|
71
69
|
process.send({
|
|
72
70
|
type: batch_messages_1.BatchMessageType.CompleteBatchExecution,
|
|
73
71
|
results,
|
|
@@ -15,24 +15,31 @@ export declare function dbCacheEnabled(nxJson?: NxJsonConfiguration): boolean;
|
|
|
15
15
|
export declare function getCache(options: DefaultTasksRunnerOptions): DbCache | Cache;
|
|
16
16
|
export declare class DbCache {
|
|
17
17
|
private readonly options;
|
|
18
|
+
private nxJson;
|
|
18
19
|
private cache;
|
|
19
20
|
private remoteCache;
|
|
20
21
|
private remoteCachePromise;
|
|
22
|
+
private isVerbose;
|
|
21
23
|
constructor(options: {
|
|
22
24
|
nxCloudRemoteCache: RemoteCache;
|
|
25
|
+
skipRemoteCache?: boolean;
|
|
23
26
|
});
|
|
24
27
|
init(): Promise<void>;
|
|
25
28
|
get(task: Task): Promise<CachedResult | null>;
|
|
29
|
+
getUsedCacheSpace(): number;
|
|
26
30
|
private applyRemoteCacheResults;
|
|
27
31
|
put(task: Task, terminalOutput: string | null, outputs: string[], code: number): Promise<void>;
|
|
28
|
-
copyFilesFromCache(_: string, cachedResult: CachedResult, outputs: string[]): Promise<
|
|
32
|
+
copyFilesFromCache(_: string, cachedResult: CachedResult, outputs: string[]): Promise<number>;
|
|
29
33
|
removeOldCacheRecords(): void;
|
|
30
34
|
temporaryOutputPath(task: Task): string;
|
|
31
35
|
private getRemoteCache;
|
|
32
36
|
private _getRemoteCache;
|
|
33
|
-
private
|
|
34
|
-
private
|
|
35
|
-
private
|
|
37
|
+
private getS3Cache;
|
|
38
|
+
private getSharedCache;
|
|
39
|
+
private getGcsCache;
|
|
40
|
+
private getAzureCache;
|
|
41
|
+
private getHttpCache;
|
|
42
|
+
private resolveRemoteCache;
|
|
36
43
|
private resolvePackage;
|
|
37
44
|
private assertCacheIsValid;
|
|
38
45
|
}
|
|
@@ -62,3 +69,14 @@ export declare class Cache {
|
|
|
62
69
|
private createCacheDir;
|
|
63
70
|
private createTerminalOutputsDir;
|
|
64
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* Converts a string representation of a max cache size to a number.
|
|
74
|
+
*
|
|
75
|
+
* e.g. '1GB' -> 1024 * 1024 * 1024
|
|
76
|
+
* '1MB' -> 1024 * 1024
|
|
77
|
+
* '1KB' -> 1024
|
|
78
|
+
*
|
|
79
|
+
* @param maxCacheSize Max cache size as specified in nx.json
|
|
80
|
+
*/
|
|
81
|
+
export declare function parseMaxCacheSize(maxCacheSize: string | number): number | undefined;
|
|
82
|
+
export declare function formatCacheSize(maxCacheSize: number, decimals?: number): string;
|