nx 13.9.4 → 13.10.0-beta.3
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/bin/init-local.d.ts +2 -0
- package/bin/init-local.js +123 -0
- package/bin/init-local.js.map +1 -0
- package/{src/cli/run-cli.d.ts → bin/init.d.ts} +0 -0
- package/bin/init.js +13 -0
- package/bin/init.js.map +1 -0
- package/bin/nx.js +8 -8
- package/bin/nx.js.map +1 -1
- package/{src/compat/compat.d.ts → bin/run-executor.d.ts} +0 -0
- package/{src/cli/run-cli.js → bin/run-executor.js} +11 -3
- package/bin/run-executor.js.map +1 -0
- package/package.json +26 -11
- package/src/adapter/compat.d.ts +1 -0
- package/src/{compat → adapter}/compat.js +2 -2
- package/src/adapter/compat.js.map +1 -0
- package/src/{cli → adapter}/decorate-cli.d.ts +0 -0
- package/src/{cli → adapter}/decorate-cli.js +0 -0
- package/src/adapter/decorate-cli.js.map +1 -0
- package/src/{commands → adapter}/ngcli-adapter.d.ts +1 -1
- package/src/{commands → adapter}/ngcli-adapter.js +14 -14
- package/src/adapter/ngcli-adapter.js.map +1 -0
- package/src/cli/index.d.ts +0 -3
- package/src/cli/index.js +0 -74
- package/src/cli/index.js.map +1 -1
- package/src/command-line/affected.d.ts +3 -0
- package/src/command-line/affected.js +117 -0
- package/src/command-line/affected.js.map +1 -0
- package/src/command-line/connect-to-nx-cloud.d.ts +2 -0
- package/src/command-line/connect-to-nx-cloud.js +79 -0
- package/src/command-line/connect-to-nx-cloud.js.map +1 -0
- package/src/command-line/daemon.d.ts +2 -0
- package/src/command-line/daemon.js +23 -0
- package/src/command-line/daemon.js.map +1 -0
- package/src/command-line/dep-graph.d.ts +24 -0
- package/src/command-line/dep-graph.js +371 -0
- package/src/command-line/dep-graph.js.map +1 -0
- package/src/command-line/examples.d.ts +5 -0
- package/src/command-line/examples.js +283 -0
- package/src/command-line/examples.js.map +1 -0
- package/src/command-line/format.d.ts +7 -0
- package/src/command-line/format.js +205 -0
- package/src/command-line/format.js.map +1 -0
- package/src/command-line/generate.d.ts +17 -0
- package/src/{commands → command-line}/generate.js +46 -67
- package/src/command-line/generate.js.map +1 -0
- package/src/command-line/lint.d.ts +1 -0
- package/src/command-line/lint.js +33 -0
- package/src/command-line/lint.js.map +1 -0
- package/src/command-line/list.d.ts +13 -0
- package/src/command-line/list.js +41 -0
- package/src/command-line/list.js.map +1 -0
- package/src/{commands → command-line}/migrate.d.ts +6 -2
- package/src/{commands → command-line}/migrate.js +30 -67
- package/src/command-line/migrate.js.map +1 -0
- package/src/command-line/nx-commands.d.ts +9 -0
- package/src/command-line/nx-commands.js +607 -0
- package/src/command-line/nx-commands.js.map +1 -0
- package/src/command-line/print-affected.d.ts +6 -0
- package/src/command-line/print-affected.js +82 -0
- package/src/command-line/print-affected.js.map +1 -0
- package/src/command-line/report.d.ts +17 -0
- package/src/command-line/report.js +125 -0
- package/src/command-line/report.js.map +1 -0
- package/src/command-line/reset.d.ts +1 -0
- package/src/command-line/reset.js +20 -0
- package/src/command-line/reset.js.map +1 -0
- package/src/command-line/run-many.d.ts +3 -0
- package/src/command-line/run-many.js +61 -0
- package/src/command-line/run-many.js.map +1 -0
- package/src/command-line/run-one.d.ts +3 -0
- package/src/command-line/run-one.js +111 -0
- package/src/command-line/run-one.js.map +1 -0
- package/src/{commands → command-line}/run.d.ts +12 -7
- package/src/{commands → command-line}/run.js +24 -74
- package/src/command-line/run.js.map +1 -0
- package/src/command-line/utils.d.ts +51 -0
- package/src/command-line/utils.js +272 -0
- package/src/command-line/utils.js.map +1 -0
- package/src/command-line/workspace-generators.d.ts +1 -0
- package/src/command-line/workspace-generators.js +151 -0
- package/src/command-line/workspace-generators.js.map +1 -0
- package/src/command-line/workspace-integrity-checks.d.ts +11 -0
- package/src/command-line/workspace-integrity-checks.js +60 -0
- package/src/command-line/workspace-integrity-checks.js.map +1 -0
- package/src/core/affected-project-graph/affected-project-graph-models.d.ts +11 -0
- package/src/core/affected-project-graph/affected-project-graph-models.js +3 -0
- package/src/core/affected-project-graph/affected-project-graph-models.js.map +1 -0
- package/src/core/affected-project-graph/affected-project-graph.d.ts +5 -0
- package/src/core/affected-project-graph/affected-project-graph.js +88 -0
- package/src/core/affected-project-graph/affected-project-graph.js.map +1 -0
- package/src/core/affected-project-graph/index.d.ts +2 -0
- package/src/core/affected-project-graph/index.js +6 -0
- package/src/core/affected-project-graph/index.js.map +1 -0
- package/src/core/affected-project-graph/locators/implicit-json-changes.d.ts +4 -0
- package/src/core/affected-project-graph/locators/implicit-json-changes.js +54 -0
- package/src/core/affected-project-graph/locators/implicit-json-changes.js.map +1 -0
- package/src/core/affected-project-graph/locators/npm-packages.d.ts +4 -0
- package/src/core/affected-project-graph/locators/npm-packages.js +35 -0
- package/src/core/affected-project-graph/locators/npm-packages.js.map +1 -0
- package/src/core/affected-project-graph/locators/tsconfig-json-changes.d.ts +4 -0
- package/src/core/affected-project-graph/locators/tsconfig-json-changes.js +64 -0
- package/src/core/affected-project-graph/locators/tsconfig-json-changes.js.map +1 -0
- package/src/core/affected-project-graph/locators/workspace-json-changes.d.ts +4 -0
- package/src/core/affected-project-graph/locators/workspace-json-changes.js +48 -0
- package/src/core/affected-project-graph/locators/workspace-json-changes.js.map +1 -0
- package/src/core/affected-project-graph/locators/workspace-projects.d.ts +3 -0
- package/src/core/affected-project-graph/locators/workspace-projects.js +40 -0
- package/src/core/affected-project-graph/locators/workspace-projects.js.map +1 -0
- package/src/core/assert-workspace-validity.d.ts +2 -0
- package/src/core/assert-workspace-validity.js +72 -0
- package/src/core/assert-workspace-validity.js.map +1 -0
- package/src/core/dep-graph/3rdpartylicenses.txt +732 -0
- package/src/core/dep-graph/index.html +16 -0
- package/src/core/dep-graph/main.esm.js +2 -0
- package/src/core/dep-graph/main.esm.js.LICENSE.txt +39 -0
- package/src/core/dep-graph/polyfills.esm.js +1 -0
- package/src/core/dep-graph/runtime.esm.js +1 -0
- package/src/core/dep-graph/styles.css +3 -0
- package/src/core/file-map-utils.d.ts +9 -0
- package/src/core/file-map-utils.js +80 -0
- package/src/core/file-map-utils.js.map +1 -0
- package/src/core/file-utils.d.ts +41 -0
- package/src/core/file-utils.js +168 -0
- package/src/core/file-utils.js.map +1 -0
- package/src/core/hasher/file-hasher-base.d.ts +12 -0
- package/src/core/hasher/file-hasher-base.js +68 -0
- package/src/core/hasher/file-hasher-base.js.map +1 -0
- package/src/core/hasher/file-hasher.d.ts +2 -0
- package/src/core/hasher/file-hasher.js +22 -0
- package/src/core/hasher/file-hasher.js.map +1 -0
- package/src/core/hasher/git-based-file-hasher.d.ts +10 -0
- package/src/core/hasher/git-based-file-hasher.js +50 -0
- package/src/core/hasher/git-based-file-hasher.js.map +1 -0
- package/src/core/hasher/git-hasher.d.ts +7 -0
- package/src/core/hasher/git-hasher.js +134 -0
- package/src/core/hasher/git-hasher.js.map +1 -0
- package/src/core/hasher/hasher.d.ts +60 -0
- package/src/core/hasher/hasher.js +362 -0
- package/src/core/hasher/hasher.js.map +1 -0
- package/src/core/hasher/hashing-impl.d.ts +5 -0
- package/src/core/hasher/hashing-impl.js +23 -0
- package/src/core/hasher/hashing-impl.js.map +1 -0
- package/src/core/hasher/node-based-file-hasher.d.ts +7 -0
- package/src/core/hasher/node-based-file-hasher.js +78 -0
- package/src/core/hasher/node-based-file-hasher.js.map +1 -0
- package/src/core/normalize-nx-json.d.ts +8 -0
- package/src/core/normalize-nx-json.js +32 -0
- package/src/core/normalize-nx-json.js.map +1 -0
- package/src/core/nx-deps/nx-deps-cache.d.ts +41 -0
- package/src/core/nx-deps/nx-deps-cache.js +164 -0
- package/src/core/nx-deps/nx-deps-cache.js.map +1 -0
- package/src/core/project-graph/build-dependencies/build-explicit-typescript-and-package-json-dependencies.d.ts +6 -0
- package/src/core/project-graph/build-dependencies/build-explicit-typescript-and-package-json-dependencies.js +19 -0
- package/src/core/project-graph/build-dependencies/build-explicit-typescript-and-package-json-dependencies.js.map +1 -0
- package/src/core/project-graph/build-dependencies/explicit-package-json-dependencies.d.ts +3 -0
- package/src/core/project-graph/build-dependencies/explicit-package-json-dependencies.js +76 -0
- package/src/core/project-graph/build-dependencies/explicit-package-json-dependencies.js.map +1 -0
- package/src/core/project-graph/build-dependencies/explicit-project-dependencies.d.ts +3 -0
- package/src/core/project-graph/build-dependencies/explicit-project-dependencies.js +27 -0
- package/src/core/project-graph/build-dependencies/explicit-project-dependencies.js.map +1 -0
- package/src/core/project-graph/build-dependencies/implicit-project-dependencies.d.ts +3 -0
- package/src/core/project-graph/build-dependencies/implicit-project-dependencies.js +20 -0
- package/src/core/project-graph/build-dependencies/implicit-project-dependencies.js.map +1 -0
- package/src/core/project-graph/build-dependencies/index.d.ts +3 -0
- package/src/core/project-graph/build-dependencies/index.js +7 -0
- package/src/core/project-graph/build-dependencies/index.js.map +1 -0
- package/src/core/project-graph/build-dependencies/typescript-import-locator.d.ts +11 -0
- package/src/core/project-graph/build-dependencies/typescript-import-locator.js +114 -0
- package/src/core/project-graph/build-dependencies/typescript-import-locator.js.map +1 -0
- package/src/core/project-graph/build-nodes/index.d.ts +2 -0
- package/src/core/project-graph/build-nodes/index.js +6 -0
- package/src/core/project-graph/build-nodes/index.js.map +1 -0
- package/src/core/project-graph/build-nodes/npm-packages.d.ts +2 -0
- package/src/core/project-graph/build-nodes/npm-packages.js +22 -0
- package/src/core/project-graph/build-nodes/npm-packages.js.map +1 -0
- package/src/core/project-graph/build-nodes/workspace-projects.d.ts +3 -0
- package/src/core/project-graph/build-nodes/workspace-projects.js +49 -0
- package/src/core/project-graph/build-nodes/workspace-projects.js.map +1 -0
- package/src/core/project-graph/build-project-graph.d.ts +9 -0
- package/src/core/project-graph/build-project-graph.js +233 -0
- package/src/core/project-graph/build-project-graph.js.map +1 -0
- package/src/core/project-graph/daemon/cache.d.ts +6 -0
- package/src/core/project-graph/daemon/cache.js +56 -0
- package/src/core/project-graph/daemon/cache.js.map +1 -0
- package/src/core/project-graph/daemon/client/client.d.ts +26 -0
- package/src/core/project-graph/daemon/client/client.js +200 -0
- package/src/core/project-graph/daemon/client/client.js.map +1 -0
- package/src/core/project-graph/daemon/client/exec-is-server-available.d.ts +1 -0
- package/src/core/project-graph/daemon/client/exec-is-server-available.js +13 -0
- package/src/core/project-graph/daemon/client/exec-is-server-available.js.map +1 -0
- package/src/core/project-graph/daemon/client/generate-help-output.d.ts +1 -0
- package/src/core/project-graph/daemon/client/generate-help-output.js +31 -0
- package/src/core/project-graph/daemon/client/generate-help-output.js.map +1 -0
- package/src/core/project-graph/daemon/server/logger.d.ts +18 -0
- package/src/core/project-graph/daemon/server/logger.js +38 -0
- package/src/core/project-graph/daemon/server/logger.js.map +1 -0
- package/src/core/project-graph/daemon/server/project-graph-incremental-recomputation.d.ts +8 -0
- package/src/core/project-graph/daemon/server/project-graph-incremental-recomputation.js +191 -0
- package/src/core/project-graph/daemon/server/project-graph-incremental-recomputation.js.map +1 -0
- package/src/core/project-graph/daemon/server/server.d.ts +4 -0
- package/src/core/project-graph/daemon/server/server.js +236 -0
- package/src/core/project-graph/daemon/server/server.js.map +1 -0
- package/src/core/project-graph/daemon/server/shutdown-utils.d.ts +12 -0
- package/src/core/project-graph/daemon/server/shutdown-utils.js +32 -0
- package/src/core/project-graph/daemon/server/shutdown-utils.js.map +1 -0
- package/src/core/project-graph/daemon/server/start.d.ts +1 -0
- package/src/core/project-graph/daemon/server/start.js +19 -0
- package/src/core/project-graph/daemon/server/start.js.map +1 -0
- package/src/core/project-graph/daemon/server/stop.d.ts +1 -0
- package/src/core/project-graph/daemon/server/stop.js +19 -0
- package/src/core/project-graph/daemon/server/stop.js.map +1 -0
- package/src/core/project-graph/daemon/server/watcher.d.ts +12 -0
- package/src/core/project-graph/daemon/server/watcher.js +158 -0
- package/src/core/project-graph/daemon/server/watcher.js.map +1 -0
- package/src/core/project-graph/daemon/socket-utils.d.ts +15 -0
- package/src/core/project-graph/daemon/socket-utils.js +38 -0
- package/src/core/project-graph/daemon/socket-utils.js.map +1 -0
- package/src/core/project-graph/daemon/tmp-dir.d.ts +6 -0
- package/src/core/project-graph/daemon/tmp-dir.js +37 -0
- package/src/core/project-graph/daemon/tmp-dir.js.map +1 -0
- package/src/core/project-graph/operators.d.ts +20 -0
- package/src/core/project-graph/operators.js +125 -0
- package/src/core/project-graph/operators.js.map +1 -0
- package/src/core/project-graph/project-graph-builder.d.ts +38 -0
- package/src/core/project-graph/project-graph-builder.js +164 -0
- package/src/core/project-graph/project-graph-builder.js.map +1 -0
- package/src/core/project-graph/project-graph-worker.d.ts +1 -0
- package/src/core/project-graph/project-graph-worker.js +19 -0
- package/src/core/project-graph/project-graph-worker.js.map +1 -0
- package/src/core/project-graph/project-graph.d.ts +37 -0
- package/src/core/project-graph/project-graph.js +188 -0
- package/src/core/project-graph/project-graph.js.map +1 -0
- package/src/core/shared-interfaces.d.ts +11 -0
- package/src/core/shared-interfaces.js +3 -0
- package/src/core/shared-interfaces.js.map +1 -0
- package/src/core/target-project-locator.d.ts +36 -0
- package/src/core/target-project-locator.js +164 -0
- package/src/core/target-project-locator.js.map +1 -0
- package/src/shared/nx.d.ts +2 -1
- package/src/shared/tree.js +1 -1
- package/src/shared/tree.js.map +1 -1
- package/src/shared/workspace.d.ts +8 -6
- package/src/shared/workspace.js +17 -21
- package/src/shared/workspace.js.map +1 -1
- package/src/tasks-runner/batch/batch-messages.d.ts +24 -0
- package/src/tasks-runner/batch/batch-messages.js +9 -0
- package/src/tasks-runner/batch/batch-messages.js.map +1 -0
- package/src/tasks-runner/batch/run-batch.d.ts +1 -0
- package/src/tasks-runner/batch/run-batch.js +57 -0
- package/src/tasks-runner/batch/run-batch.js.map +1 -0
- package/src/tasks-runner/cache.d.ts +40 -0
- package/src/tasks-runner/cache.js +284 -0
- package/src/tasks-runner/cache.js.map +1 -0
- package/src/tasks-runner/default-tasks-runner.d.ts +19 -0
- package/src/tasks-runner/default-tasks-runner.js +48 -0
- package/src/tasks-runner/default-tasks-runner.js.map +1 -0
- package/src/tasks-runner/forked-process-task-runner.d.ts +36 -0
- package/src/tasks-runner/forked-process-task-runner.js +259 -0
- package/src/tasks-runner/forked-process-task-runner.js.map +1 -0
- package/src/tasks-runner/life-cycle.d.ts +43 -0
- package/src/tasks-runner/life-cycle.js +72 -0
- package/src/tasks-runner/life-cycle.js.map +1 -0
- package/src/tasks-runner/life-cycles/dynamic-run-many-terminal-output-life-cycle.d.ts +25 -0
- package/src/tasks-runner/life-cycles/dynamic-run-many-terminal-output-life-cycle.js +349 -0
- package/src/tasks-runner/life-cycles/dynamic-run-many-terminal-output-life-cycle.js.map +1 -0
- package/src/tasks-runner/life-cycles/dynamic-run-one-terminal-output-life-cycle.d.ts +25 -0
- package/src/tasks-runner/life-cycles/dynamic-run-one-terminal-output-life-cycle.js +231 -0
- package/src/tasks-runner/life-cycles/dynamic-run-one-terminal-output-life-cycle.js.map +1 -0
- package/src/tasks-runner/life-cycles/empty-terminal-output-life-cycle.d.ts +5 -0
- package/src/tasks-runner/life-cycles/empty-terminal-output-life-cycle.js +19 -0
- package/src/tasks-runner/life-cycles/empty-terminal-output-life-cycle.js.map +1 -0
- package/src/tasks-runner/life-cycles/pretty-time.d.ts +4 -0
- package/src/tasks-runner/life-cycles/pretty-time.js +75 -0
- package/src/tasks-runner/life-cycles/pretty-time.js.map +1 -0
- package/src/tasks-runner/life-cycles/static-run-many-terminal-output-life-cycle.d.ts +33 -0
- package/src/tasks-runner/life-cycles/static-run-many-terminal-output-life-cycle.js +110 -0
- package/src/tasks-runner/life-cycles/static-run-many-terminal-output-life-cycle.js.map +1 -0
- package/src/tasks-runner/life-cycles/static-run-one-terminal-output-life-cycle.d.ts +31 -0
- package/src/tasks-runner/life-cycles/static-run-one-terminal-output-life-cycle.js +97 -0
- package/src/tasks-runner/life-cycles/static-run-one-terminal-output-life-cycle.js.map +1 -0
- package/src/tasks-runner/life-cycles/task-profiling-life-cycle.d.ts +19 -0
- package/src/tasks-runner/life-cycles/task-profiling-life-cycle.js +67 -0
- package/src/tasks-runner/life-cycles/task-profiling-life-cycle.js.map +1 -0
- package/src/tasks-runner/life-cycles/task-timings-life-cycle.d.ts +13 -0
- package/src/tasks-runner/life-cycles/task-timings-life-cycle.js +33 -0
- package/src/tasks-runner/life-cycles/task-timings-life-cycle.js.map +1 -0
- package/src/tasks-runner/remove-old-cache-records.d.ts +1 -0
- package/src/tasks-runner/remove-old-cache-records.js +62 -0
- package/src/tasks-runner/remove-old-cache-records.js.map +1 -0
- package/src/tasks-runner/reporter.d.ts +14 -0
- package/src/tasks-runner/reporter.js +11 -0
- package/src/tasks-runner/reporter.js.map +1 -0
- package/src/tasks-runner/run-command.d.ts +22 -0
- package/src/tasks-runner/run-command.js +352 -0
- package/src/tasks-runner/run-command.js.map +1 -0
- package/src/tasks-runner/task-graph-creator.d.ts +13 -0
- package/src/tasks-runner/task-graph-creator.js +71 -0
- package/src/tasks-runner/task-graph-creator.js.map +1 -0
- package/src/tasks-runner/task-orchestrator.d.ts +38 -0
- package/src/tasks-runner/task-orchestrator.js +299 -0
- package/src/tasks-runner/task-orchestrator.js.map +1 -0
- package/src/tasks-runner/tasks-runner-v2.d.ts +19 -0
- package/src/tasks-runner/tasks-runner-v2.js +42 -0
- package/src/tasks-runner/tasks-runner-v2.js.map +1 -0
- package/src/tasks-runner/tasks-runner.d.ts +45 -0
- package/src/tasks-runner/tasks-runner.js +15 -0
- package/src/tasks-runner/tasks-runner.js.map +1 -0
- package/src/tasks-runner/tasks-schedule.d.ts +33 -0
- package/src/tasks-runner/tasks-schedule.js +130 -0
- package/src/tasks-runner/tasks-schedule.js.map +1 -0
- package/src/tasks-runner/utils.d.ts +32 -0
- package/src/tasks-runner/utils.js +234 -0
- package/src/tasks-runner/utils.js.map +1 -0
- package/src/utils/app-root.d.ts +9 -0
- package/src/utils/app-root.js +10 -1
- package/src/utils/app-root.js.map +1 -1
- package/src/utils/cache-directory.d.ts +4 -0
- package/src/utils/cache-directory.js +37 -0
- package/src/utils/cache-directory.js.map +1 -0
- package/src/utils/default-base.d.ts +1 -0
- package/src/utils/default-base.js +16 -0
- package/src/utils/default-base.js.map +1 -0
- package/src/utils/fileutils.d.ts +4 -0
- package/src/utils/fileutils.js +38 -1
- package/src/utils/fileutils.js.map +1 -1
- package/src/{cli → utils}/find-workspace-root.d.ts +5 -2
- package/src/{cli → utils}/find-workspace-root.js +0 -0
- package/src/utils/find-workspace-root.js.map +1 -0
- package/src/{cli/is_ci.d.ts → utils/is-ci.d.ts} +0 -0
- package/src/{cli/is_ci.js → utils/is-ci.js} +2 -1
- package/src/utils/is-ci.js.map +1 -0
- package/src/utils/json-diff.d.ts +17 -0
- package/src/utils/json-diff.js +112 -0
- package/src/utils/json-diff.js.map +1 -0
- package/src/{shared → utils}/logger.d.ts +0 -0
- package/src/{shared → utils}/logger.js +0 -0
- package/src/utils/logger.js.map +1 -0
- package/src/{shared → utils}/nx-plugin.d.ts +12 -3
- package/src/utils/nx-plugin.js +162 -0
- package/src/utils/nx-plugin.js.map +1 -0
- package/src/{cli → utils}/output.d.ts +17 -14
- package/src/utils/output.js +170 -0
- package/src/utils/output.js.map +1 -0
- package/src/{shared → utils}/package-json.d.ts +2 -2
- package/src/{shared → utils}/package-json.js +0 -0
- package/src/utils/package-json.js.map +1 -0
- package/src/{shared → utils}/package-manager.d.ts +0 -0
- package/src/{shared → utils}/package-manager.js +0 -0
- package/src/utils/package-manager.js.map +1 -0
- package/src/{shared → utils}/params.d.ts +5 -4
- package/src/{shared → utils}/params.js +3 -3
- package/src/utils/params.js.map +1 -0
- package/src/utils/path.d.ts +8 -0
- package/src/utils/path.js +22 -0
- package/src/utils/path.js.map +1 -0
- package/src/utils/perf-logging.d.ts +1 -0
- package/src/utils/perf-logging.js +12 -0
- package/src/utils/perf-logging.js.map +1 -0
- package/src/utils/plugins/community-plugins.d.ts +3 -0
- package/src/utils/plugins/community-plugins.js +47 -0
- package/src/utils/plugins/community-plugins.js.map +1 -0
- package/src/utils/plugins/core-plugins.d.ts +3 -0
- package/src/utils/plugins/core-plugins.js +80 -0
- package/src/utils/plugins/core-plugins.js.map +1 -0
- package/src/utils/plugins/index.d.ts +4 -0
- package/src/utils/plugins/index.js +16 -0
- package/src/utils/plugins/index.js.map +1 -0
- package/src/utils/plugins/installed-plugins.d.ts +3 -0
- package/src/utils/plugins/installed-plugins.js +55 -0
- package/src/utils/plugins/installed-plugins.js.map +1 -0
- package/src/utils/plugins/models.d.ts +31 -0
- package/src/{cli/workspace.js → utils/plugins/models.js} +1 -1
- package/src/utils/plugins/models.js.map +1 -0
- package/src/utils/plugins/plugin-capabilities.d.ts +3 -0
- package/src/utils/plugins/plugin-capabilities.js +81 -0
- package/src/utils/plugins/plugin-capabilities.js.map +1 -0
- package/src/utils/plugins/shared.d.ts +1 -0
- package/src/utils/plugins/shared.js +9 -0
- package/src/utils/plugins/shared.js.map +1 -0
- package/src/utils/print-help.d.ts +10 -0
- package/src/utils/print-help.js +46 -0
- package/src/utils/print-help.js.map +1 -0
- package/src/utils/project-graph-utils.d.ts +12 -0
- package/src/utils/project-graph-utils.js +96 -0
- package/src/utils/project-graph-utils.js.map +1 -0
- package/src/utils/register.d.ts +1 -1
- package/src/utils/register.js +14 -9
- package/src/utils/register.js.map +1 -1
- package/src/utils/strip-indents.d.ts +14 -0
- package/src/utils/strip-indents.js +25 -0
- package/src/utils/strip-indents.js.map +1 -0
- package/src/utils/strip-source-code.d.ts +2 -0
- package/src/utils/strip-source-code.js +85 -0
- package/src/utils/strip-source-code.js.map +1 -0
- package/src/utils/typescript.d.ts +11 -0
- package/src/utils/typescript.js +70 -0
- package/src/utils/typescript.js.map +1 -0
- package/src/utils/version-utils.d.ts +1 -0
- package/src/utils/version-utils.js +19 -0
- package/src/utils/version-utils.js.map +1 -0
- package/src/utils/versions.d.ts +8 -0
- package/src/utils/versions.js +12 -0
- package/src/utils/versions.js.map +1 -0
- package/tasks-runners/default.d.ts +1 -0
- package/tasks-runners/default.js +6 -0
- package/tasks-runners/default.js.map +1 -0
- package/src/cli/decorate-cli.js.map +0 -1
- package/src/cli/find-workspace-root.js.map +0 -1
- package/src/cli/init-local.d.ts +0 -2
- package/src/cli/init-local.js +0 -109
- package/src/cli/init-local.js.map +0 -1
- package/src/cli/is_ci.js.map +0 -1
- package/src/cli/output.js +0 -129
- package/src/cli/output.js.map +0 -1
- package/src/cli/parse-run-one-options.d.ts +0 -6
- package/src/cli/parse-run-one-options.js +0 -139
- package/src/cli/parse-run-one-options.js.map +0 -1
- package/src/cli/run-cli.js.map +0 -1
- package/src/cli/workspace.d.ts +0 -4
- package/src/cli/workspace.js.map +0 -1
- package/src/commands/generate.d.ts +0 -15
- package/src/commands/generate.js.map +0 -1
- package/src/commands/help.d.ts +0 -1
- package/src/commands/help.js +0 -34
- package/src/commands/help.js.map +0 -1
- package/src/commands/migrate.js.map +0 -1
- package/src/commands/ngcli-adapter.js.map +0 -1
- package/src/commands/run.js.map +0 -1
- package/src/compat/compat.js.map +0 -1
- package/src/shared/logger.js.map +0 -1
- package/src/shared/nx-plugin.js +0 -53
- package/src/shared/nx-plugin.js.map +0 -1
- package/src/shared/package-json.js.map +0 -1
- package/src/shared/package-manager.js.map +0 -1
- package/src/shared/params.js.map +0 -1
- package/src/shared/print-help.d.ts +0 -2
- package/src/shared/print-help.js +0 -32
- package/src/shared/print-help.js.map +0 -1
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.affected = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const affected_project_graph_1 = require("../core/affected-project-graph");
|
|
6
|
+
const file_utils_1 = require("../core/file-utils");
|
|
7
|
+
const run_command_1 = require("../tasks-runner/run-command");
|
|
8
|
+
const output_1 = require("../utils/output");
|
|
9
|
+
const dep_graph_1 = require("./dep-graph");
|
|
10
|
+
const print_affected_1 = require("./print-affected");
|
|
11
|
+
const connect_to_nx_cloud_1 = require("./connect-to-nx-cloud");
|
|
12
|
+
const utils_1 = require("./utils");
|
|
13
|
+
const perf_hooks_1 = require("perf_hooks");
|
|
14
|
+
const project_graph_1 = require("nx/src/core/project-graph/project-graph");
|
|
15
|
+
const operators_1 = require("nx/src/core/project-graph/operators");
|
|
16
|
+
const project_graph_utils_1 = require("../utils/project-graph-utils");
|
|
17
|
+
function affected(command, parsedArgs) {
|
|
18
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
perf_hooks_1.performance.mark('command-execution-begins');
|
|
20
|
+
const { nxArgs, overrides } = (0, utils_1.splitArgsIntoNxArgsAndOverrides)(parsedArgs, 'affected', {
|
|
21
|
+
printWarnings: command !== 'print-affected' && !parsedArgs.plain,
|
|
22
|
+
});
|
|
23
|
+
yield (0, connect_to_nx_cloud_1.connectToNxCloudUsingScan)(nxArgs.scan);
|
|
24
|
+
const projectGraph = yield (0, project_graph_1.createProjectGraphAsync)();
|
|
25
|
+
const projects = projectsToRun(nxArgs, projectGraph);
|
|
26
|
+
const env = (0, file_utils_1.readEnvironment)();
|
|
27
|
+
try {
|
|
28
|
+
switch (command) {
|
|
29
|
+
case 'apps':
|
|
30
|
+
const apps = projects
|
|
31
|
+
.filter((p) => p.type === 'app')
|
|
32
|
+
.map((p) => p.name);
|
|
33
|
+
if (parsedArgs.plain) {
|
|
34
|
+
console.log(apps.join(' '));
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
if (apps.length) {
|
|
38
|
+
output_1.output.log({
|
|
39
|
+
title: 'Affected apps:',
|
|
40
|
+
bodyLines: apps.map((app) => `${output_1.output.dim('-')} ${app}`),
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
break;
|
|
45
|
+
case 'libs':
|
|
46
|
+
const libs = projects
|
|
47
|
+
.filter((p) => p.type === 'lib')
|
|
48
|
+
.map((p) => p.name);
|
|
49
|
+
if (parsedArgs.plain) {
|
|
50
|
+
console.log(libs.join(' '));
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
if (libs.length) {
|
|
54
|
+
output_1.output.log({
|
|
55
|
+
title: 'Affected libs:',
|
|
56
|
+
bodyLines: libs.map((lib) => `${output_1.output.dim('-')} ${lib}`),
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
break;
|
|
61
|
+
case 'graph':
|
|
62
|
+
const projectNames = projects.map((p) => p.name);
|
|
63
|
+
yield (0, dep_graph_1.generateGraph)(parsedArgs, projectNames);
|
|
64
|
+
break;
|
|
65
|
+
case 'print-affected':
|
|
66
|
+
if (nxArgs.target) {
|
|
67
|
+
const projectsWithTarget = allProjectsWithTarget(projects, nxArgs);
|
|
68
|
+
yield (0, print_affected_1.printAffected)(projectsWithTarget, projects, projectGraph, env, nxArgs, overrides);
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
yield (0, print_affected_1.printAffected)([], projects, projectGraph, env, nxArgs, overrides);
|
|
72
|
+
}
|
|
73
|
+
break;
|
|
74
|
+
case 'affected': {
|
|
75
|
+
const projectsWithTarget = allProjectsWithTarget(projects, nxArgs);
|
|
76
|
+
yield (0, run_command_1.runCommand)(projectsWithTarget, projectGraph, env, nxArgs, overrides, nxArgs.hideCachedOutput ? 'hide-cached-output' : 'default', null);
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
catch (e) {
|
|
82
|
+
printError(e, parsedArgs.verbose);
|
|
83
|
+
process.exit(1);
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
exports.affected = affected;
|
|
88
|
+
function projectsToRun(nxArgs, projectGraph) {
|
|
89
|
+
let affectedGraph = nxArgs.all
|
|
90
|
+
? projectGraph
|
|
91
|
+
: (0, affected_project_graph_1.filterAffected)(projectGraph, (0, file_utils_1.calculateFileChanges)((0, utils_1.parseFiles)(nxArgs).files, projectGraph.allWorkspaceFiles, nxArgs));
|
|
92
|
+
if (!nxArgs.all && nxArgs.withDeps) {
|
|
93
|
+
affectedGraph = (0, operators_1.withDeps)(projectGraph, Object.values(affectedGraph.nodes));
|
|
94
|
+
}
|
|
95
|
+
if (nxArgs.exclude) {
|
|
96
|
+
const excludedProjects = new Set(nxArgs.exclude);
|
|
97
|
+
return Object.entries(affectedGraph.nodes)
|
|
98
|
+
.filter(([projectName]) => !excludedProjects.has(projectName))
|
|
99
|
+
.map(([, project]) => project);
|
|
100
|
+
}
|
|
101
|
+
return Object.values(affectedGraph.nodes);
|
|
102
|
+
}
|
|
103
|
+
function allProjectsWithTarget(projects, nxArgs) {
|
|
104
|
+
return projects.filter((p) => (0, project_graph_utils_1.projectHasTarget)(p, nxArgs.target));
|
|
105
|
+
}
|
|
106
|
+
function printError(e, verbose) {
|
|
107
|
+
const bodyLines = [e.message];
|
|
108
|
+
if (verbose && e.stack) {
|
|
109
|
+
bodyLines.push('');
|
|
110
|
+
bodyLines.push(e.stack);
|
|
111
|
+
}
|
|
112
|
+
output_1.output.error({
|
|
113
|
+
title: 'There was a critical error when running your command',
|
|
114
|
+
bodyLines,
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
//# sourceMappingURL=affected.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"affected.js","sourceRoot":"","sources":["../../../../../packages/nx/src/command-line/affected.ts"],"names":[],"mappings":";;;;AACA,2EAAgE;AAChE,mDAA2E;AAC3E,6DAAyD;AACzD,4CAAyC;AACzC,2CAA4C;AAC5C,qDAAiD;AACjD,+DAAkE;AAElE,mCAAsE;AACtE,2CAAyC;AACzC,2EAAkF;AAClF,mEAA+D;AAE/D,sEAAgE;AAEhE,SAAsB,QAAQ,CAC5B,OAAkE,EAClE,UAAuC;;QAEvC,wBAAW,CAAC,IAAI,CAAC,0BAA0B,CAAC,CAAC;QAC7C,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,IAAA,uCAA+B,EAC3D,UAAU,EACV,UAAU,EACV;YACE,aAAa,EAAE,OAAO,KAAK,gBAAgB,IAAI,CAAC,UA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,CAAC,CAAC,CAAC;AACpE,CAAC;AAED,SAAS,UAAU,CAAC,CAAM,EAAE,OAAiB;IAC3C,MAAM,SAAS,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC;IAC9B,IAAI,OAAO,IAAI,CAAC,CAAC,KAAK,EAAE;QACtB,SAAS,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QACnB,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;KACzB;IACD,eAAM,CAAC,KAAK,CAAC;QACX,KAAK,EAAE,sDAAsD;QAC7D,SAAS;KACV,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.connectToNxCloudCommand = exports.connectToNxCloudUsingScan = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const file_utils_1 = require("../core/file-utils");
|
|
6
|
+
const output_1 = require("../utils/output");
|
|
7
|
+
const package_manager_1 = require("../utils/package-manager");
|
|
8
|
+
const child_process_1 = require("child_process");
|
|
9
|
+
function connectToNxCloudUsingScan(scan) {
|
|
10
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
11
|
+
if (!scan)
|
|
12
|
+
return;
|
|
13
|
+
const nxJson = (0, file_utils_1.readNxJson)();
|
|
14
|
+
const defaultRunnerIsUsed = Object.values(nxJson.tasksRunnerOptions).find((r) => r.runner == '@nrwl/workspace/tasks-runners/default' ||
|
|
15
|
+
r.runner == 'nx/tasks-runners/default');
|
|
16
|
+
if (!defaultRunnerIsUsed)
|
|
17
|
+
return;
|
|
18
|
+
output_1.output.log({
|
|
19
|
+
title: '--scan requires the workspace to be connected to Nx Cloud.',
|
|
20
|
+
});
|
|
21
|
+
const res = yield connectToNxCloudPrompt();
|
|
22
|
+
if (res) {
|
|
23
|
+
const pmc = (0, package_manager_1.getPackageManagerCommand)();
|
|
24
|
+
(0, child_process_1.execSync)(`${pmc.addDev} @nrwl/nx-cloud@latest`);
|
|
25
|
+
(0, child_process_1.execSync)(`${pmc.exec} nx g @nrwl/nx-cloud:init`, {
|
|
26
|
+
stdio: [0, 1, 2],
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
output_1.output.log({ title: 'Executing the command without --scan' });
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
exports.connectToNxCloudUsingScan = connectToNxCloudUsingScan;
|
|
35
|
+
function connectToNxCloudCommand() {
|
|
36
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
const nxJson = (0, file_utils_1.readNxJson)();
|
|
38
|
+
const nxCloudUsed = Object.values(nxJson.tasksRunnerOptions).find((r) => r.runner == '@nrwl/nx-cloud');
|
|
39
|
+
if (nxCloudUsed) {
|
|
40
|
+
output_1.output.log({
|
|
41
|
+
title: 'This workspace is already connected to Nx Cloud.',
|
|
42
|
+
});
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const res = yield connectToNxCloudPrompt();
|
|
46
|
+
if (!res)
|
|
47
|
+
return;
|
|
48
|
+
const pmc = (0, package_manager_1.getPackageManagerCommand)();
|
|
49
|
+
(0, child_process_1.execSync)(`${pmc.addDev} @nrwl/nx-cloud@latest`);
|
|
50
|
+
(0, child_process_1.execSync)(`${pmc.exec} nx g @nrwl/nx-cloud:init`, {
|
|
51
|
+
stdio: [0, 1, 2],
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
exports.connectToNxCloudCommand = connectToNxCloudCommand;
|
|
56
|
+
function connectToNxCloudPrompt() {
|
|
57
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
return yield (yield Promise.resolve().then(() => require('enquirer')))
|
|
59
|
+
.prompt([
|
|
60
|
+
{
|
|
61
|
+
name: 'NxCloud',
|
|
62
|
+
message: `Connect to Nx Cloud? (It's free and doesn't require registration.)`,
|
|
63
|
+
type: 'select',
|
|
64
|
+
choices: [
|
|
65
|
+
{
|
|
66
|
+
name: 'Yes',
|
|
67
|
+
hint: 'Faster builds, run details, GitHub integration. Learn more at https://nx.app',
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: 'No',
|
|
71
|
+
},
|
|
72
|
+
],
|
|
73
|
+
initial: 'Yes',
|
|
74
|
+
},
|
|
75
|
+
])
|
|
76
|
+
.then((a) => a.NxCloud === 'Yes');
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=connect-to-nx-cloud.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connect-to-nx-cloud.js","sourceRoot":"","sources":["../../../../../packages/nx/src/command-line/connect-to-nx-cloud.ts"],"names":[],"mappings":";;;;AAAA,mDAAgD;AAChD,4CAAyC;AACzC,8DAAoE;AACpE,iDAAyC;AAEzC,SAAsB,yBAAyB,CAAC,IAAa;;QAC3D,IAAI,CAAC,IAAI;YAAE,OAAO;QAElB,MAAM,MAAM,GAAG,IAAA,uBAAU,GAAE,CAAC;QAC5B,MAAM,mBAAmB,GAAG,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC,IAAI,CACvE,CAAC,CAAC,EAAE,EAAE,CACJ,CAAC,CAAC,MAAM,IAAI,uCAAuC;YACnD,CAAC,CAAC,MAAM,IAAI,0BAA0B,CACzC,CAAC;QACF,IAAI,CAAC,mBAAmB;YAAE,OAAO;QAEjC,eAAM,CAAC,GAAG,CAAC;YACT,KAAK,EAAE,4DAA4D;SACpE,CAAC,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,sBAAsB,EAAE,CAAC;QAC3C,IAAI,GAAG,EAAE;YACP,MAAM,GAAG,GAAG,IAAA,0CAAwB,GAAE,CAAC;YACvC,IAAA,wBAAQ,EAAC,GAAG,GAAG,CAAC,MAAM,wBAAwB,CAAC,CAAC;YAChD,IAAA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E,8EAA8E;qBACrF;oBACD;wBACE,IAAI,EAAE,IAAI;qBACX;iBACF;gBACD,OAAO,EAAE,KAAY;aACtB;SACF,CAAC;aACD,IAAI,CAAC,CAAC,CAA4B,EAAE,EAAE,CAAC,CAAC,CAAC,OAAO,KAAK,KAAK,CAAC,CAAC;IACjE,CAAC;CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.daemonHandler = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const tmp_dir_1 = require("../core/project-graph/daemon/tmp-dir");
|
|
6
|
+
const output_1 = require("../utils/output");
|
|
7
|
+
function daemonHandler(args) {
|
|
8
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
9
|
+
const { startInBackground, startInCurrentProcess } = yield Promise.resolve().then(() => require('../core/project-graph/daemon/client/client'));
|
|
10
|
+
if (!args.background) {
|
|
11
|
+
return startInCurrentProcess();
|
|
12
|
+
}
|
|
13
|
+
const pid = yield startInBackground();
|
|
14
|
+
output_1.output.log({
|
|
15
|
+
title: `Daemon Server - Started in a background process...`,
|
|
16
|
+
bodyLines: [
|
|
17
|
+
`${output_1.output.dim('Logs from the Daemon process (')}ID: ${pid}${output_1.output.dim(') can be found here:')} ${tmp_dir_1.DAEMON_OUTPUT_LOG_FILE}\n`,
|
|
18
|
+
],
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
exports.daemonHandler = daemonHandler;
|
|
23
|
+
//# sourceMappingURL=daemon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"daemon.js","sourceRoot":"","sources":["../../../../../packages/nx/src/command-line/daemon.ts"],"names":[],"mappings":";;;;AACA,kEAA8E;AAC9E,4CAAyC;AAEzC,SAAsB,aAAa,CAAC,IAAe;;QACjD,MAAM,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,GAAG,2CACnD,4CAA4C,EAC7C,CAAC;QACF,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;YACpB,OAAO,qBAAqB,EAAE,CAAC;SAChC;QACD,MAAM,GAAG,GAAG,MAAM,iBAAiB,EAAE,CAAC;QACtC,eAAM,CAAC,GAAG,CAAC;YACT,KAAK,EAAE,oDAAoD;YAC3D,SAAS,EAAE;gBACT,GAAG,eAAM,CAAC,GAAG,CAAC,gCAAgC,CAAC,OAAO,GAAG,GAAG,eAAM,CAAC,GAAG,CACpE,sBAAsB,CACvB,IAAI,gCAAsB,IAAI;aAChC;SACF,CAAC,CAAC;IACL,CAAC;CAAA;AAhBD,sCAgBC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ProjectGraphDependency, ProjectGraphProjectNode } from 'nx/src/shared/project-graph';
|
|
2
|
+
export interface DepGraphClientResponse {
|
|
3
|
+
hash: string;
|
|
4
|
+
projects: ProjectGraphProjectNode[];
|
|
5
|
+
dependencies: Record<string, ProjectGraphDependency[]>;
|
|
6
|
+
layout: {
|
|
7
|
+
appsDir: string;
|
|
8
|
+
libsDir: string;
|
|
9
|
+
};
|
|
10
|
+
affected: string[];
|
|
11
|
+
focus: string;
|
|
12
|
+
groupByFolder: boolean;
|
|
13
|
+
exclude: string[];
|
|
14
|
+
}
|
|
15
|
+
export declare function generateGraph(args: {
|
|
16
|
+
file?: string;
|
|
17
|
+
host?: string;
|
|
18
|
+
port?: number;
|
|
19
|
+
focus?: string;
|
|
20
|
+
exclude?: string[];
|
|
21
|
+
groupByFolder?: boolean;
|
|
22
|
+
watch?: boolean;
|
|
23
|
+
open?: boolean;
|
|
24
|
+
}, affectedProjects: string[]): Promise<void>;
|
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateGraph = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
5
|
+
const app_root_1 = require("nx/src/utils/app-root");
|
|
6
|
+
const chokidar_1 = require("chokidar");
|
|
7
|
+
const crypto_1 = require("crypto");
|
|
8
|
+
const fs_1 = require("fs");
|
|
9
|
+
const fs_extra_1 = require("fs-extra");
|
|
10
|
+
const http = require("http");
|
|
11
|
+
const ignore_1 = require("ignore");
|
|
12
|
+
const open = require("open");
|
|
13
|
+
const path_1 = require("path");
|
|
14
|
+
const perf_hooks_1 = require("perf_hooks");
|
|
15
|
+
const url_1 = require("url");
|
|
16
|
+
const file_utils_1 = require("../core/file-utils");
|
|
17
|
+
const file_hasher_1 = require("../core/hasher/file-hasher");
|
|
18
|
+
const output_1 = require("../utils/output");
|
|
19
|
+
const fileutils_1 = require("nx/src/utils/fileutils");
|
|
20
|
+
const path_2 = require("nx/src/utils/path");
|
|
21
|
+
const operators_1 = require("nx/src/core/project-graph/operators");
|
|
22
|
+
const project_graph_1 = require("nx/src/core/project-graph/project-graph");
|
|
23
|
+
// maps file extention to MIME types
|
|
24
|
+
const mimeType = {
|
|
25
|
+
'.ico': 'image/x-icon',
|
|
26
|
+
'.html': 'text/html',
|
|
27
|
+
'.js': 'text/javascript',
|
|
28
|
+
'.json': 'application/json',
|
|
29
|
+
'.css': 'text/css',
|
|
30
|
+
'.png': 'image/png',
|
|
31
|
+
'.jpg': 'image/jpeg',
|
|
32
|
+
'.wav': 'audio/wav',
|
|
33
|
+
'.mp3': 'audio/mpeg',
|
|
34
|
+
'.svg': 'image/svg+xml',
|
|
35
|
+
'.pdf': 'application/pdf',
|
|
36
|
+
'.doc': 'application/msword',
|
|
37
|
+
'.eot': 'appliaction/vnd.ms-fontobject',
|
|
38
|
+
'.ttf': 'aplication/font-sfnt',
|
|
39
|
+
};
|
|
40
|
+
function buildEnvironmentJs(exclude, watchMode, localMode, depGraphClientResponse) {
|
|
41
|
+
let environmentJs = `window.exclude = ${JSON.stringify(exclude)};
|
|
42
|
+
window.watch = ${!!watchMode};
|
|
43
|
+
window.environment = 'release';
|
|
44
|
+
window.localMode = '${localMode}';
|
|
45
|
+
|
|
46
|
+
window.appConfig = {
|
|
47
|
+
showDebugger: false,
|
|
48
|
+
showExperimentalFeatures: false,
|
|
49
|
+
projectGraphs: [
|
|
50
|
+
{
|
|
51
|
+
id: 'local',
|
|
52
|
+
label: 'local',
|
|
53
|
+
url: 'projectGraph.json',
|
|
54
|
+
}
|
|
55
|
+
],
|
|
56
|
+
defaultProjectGraph: 'local',
|
|
57
|
+
};
|
|
58
|
+
`;
|
|
59
|
+
if (localMode === 'build') {
|
|
60
|
+
environmentJs += `window.projectGraphResponse = ${JSON.stringify(depGraphClientResponse)};`;
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
environmentJs += `window.projectGraphResponse = null;`;
|
|
64
|
+
}
|
|
65
|
+
return environmentJs;
|
|
66
|
+
}
|
|
67
|
+
function projectExists(projects, projectToFind) {
|
|
68
|
+
return (projects.find((project) => project.name === projectToFind) !== undefined);
|
|
69
|
+
}
|
|
70
|
+
function hasPath(graph, target, node, visited) {
|
|
71
|
+
if (target === node)
|
|
72
|
+
return true;
|
|
73
|
+
for (let d of graph.dependencies[node] || []) {
|
|
74
|
+
if (visited.indexOf(d.target) > -1)
|
|
75
|
+
continue;
|
|
76
|
+
visited.push(d.target);
|
|
77
|
+
if (hasPath(graph, target, d.target, visited))
|
|
78
|
+
return true;
|
|
79
|
+
}
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
function filterGraph(graph, focus, exclude) {
|
|
83
|
+
let projectNames = Object.values(graph.nodes).map((project) => project.name);
|
|
84
|
+
let filteredProjectNames;
|
|
85
|
+
if (focus !== null) {
|
|
86
|
+
filteredProjectNames = new Set();
|
|
87
|
+
projectNames.forEach((p) => {
|
|
88
|
+
const isInPath = hasPath(graph, p, focus, []) || hasPath(graph, focus, p, []);
|
|
89
|
+
if (isInPath) {
|
|
90
|
+
filteredProjectNames.add(p);
|
|
91
|
+
}
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
95
|
+
filteredProjectNames = new Set(projectNames);
|
|
96
|
+
}
|
|
97
|
+
if (exclude.length !== 0) {
|
|
98
|
+
exclude.forEach((p) => filteredProjectNames.delete(p));
|
|
99
|
+
}
|
|
100
|
+
let filteredGraph = {
|
|
101
|
+
nodes: {},
|
|
102
|
+
dependencies: {},
|
|
103
|
+
};
|
|
104
|
+
filteredProjectNames.forEach((p) => {
|
|
105
|
+
filteredGraph.nodes[p] = graph.nodes[p];
|
|
106
|
+
filteredGraph.dependencies[p] = graph.dependencies[p];
|
|
107
|
+
});
|
|
108
|
+
return filteredGraph;
|
|
109
|
+
}
|
|
110
|
+
function generateGraph(args, affectedProjects) {
|
|
111
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
112
|
+
let graph = (0, operators_1.pruneExternalNodes)(yield (0, project_graph_1.createProjectGraphAsync)());
|
|
113
|
+
const layout = (0, file_utils_1.workspaceLayout)();
|
|
114
|
+
const projects = Object.values(graph.nodes);
|
|
115
|
+
projects.sort((a, b) => {
|
|
116
|
+
return a.name.localeCompare(b.name);
|
|
117
|
+
});
|
|
118
|
+
if (args.focus) {
|
|
119
|
+
if (!projectExists(projects, args.focus)) {
|
|
120
|
+
output_1.output.error({
|
|
121
|
+
title: `Project to focus does not exist.`,
|
|
122
|
+
bodyLines: [`You provided --focus=${args.focus}`],
|
|
123
|
+
});
|
|
124
|
+
process.exit(1);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
if (args.exclude) {
|
|
128
|
+
const invalidExcludes = [];
|
|
129
|
+
args.exclude.forEach((project) => {
|
|
130
|
+
if (!projectExists(projects, project)) {
|
|
131
|
+
invalidExcludes.push(project);
|
|
132
|
+
}
|
|
133
|
+
});
|
|
134
|
+
if (invalidExcludes.length > 0) {
|
|
135
|
+
output_1.output.error({
|
|
136
|
+
title: `The following projects provided to --exclude do not exist:`,
|
|
137
|
+
bodyLines: invalidExcludes,
|
|
138
|
+
});
|
|
139
|
+
process.exit(1);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
let html = (0, fs_1.readFileSync)((0, path_1.join)(__dirname, '../core/dep-graph/index.html'), 'utf-8');
|
|
143
|
+
graph = filterGraph(graph, args.focus || null, args.exclude || []);
|
|
144
|
+
if (args.file) {
|
|
145
|
+
const workspaceFolder = app_root_1.appRootPath;
|
|
146
|
+
const ext = (0, path_1.extname)(args.file);
|
|
147
|
+
const fullFilePath = (0, path_1.isAbsolute)(args.file)
|
|
148
|
+
? args.file
|
|
149
|
+
: (0, path_1.join)(workspaceFolder, args.file);
|
|
150
|
+
const fileFolderPath = (0, path_1.dirname)(fullFilePath);
|
|
151
|
+
if (ext === '.html') {
|
|
152
|
+
const assetsFolder = (0, path_1.join)(fileFolderPath, 'static');
|
|
153
|
+
const assets = [];
|
|
154
|
+
(0, fs_extra_1.copySync)((0, path_1.join)(__dirname, '../core/dep-graph'), assetsFolder, {
|
|
155
|
+
filter: (_src, dest) => {
|
|
156
|
+
const isntHtml = !/index\.html/.test(dest);
|
|
157
|
+
if (isntHtml && dest.includes('.')) {
|
|
158
|
+
assets.push(dest);
|
|
159
|
+
}
|
|
160
|
+
return isntHtml;
|
|
161
|
+
},
|
|
162
|
+
});
|
|
163
|
+
const depGraphClientResponse = yield createDepGraphClientResponse(affectedProjects);
|
|
164
|
+
const environmentJs = buildEnvironmentJs(args.exclude || [], args.watch, !!args.file && args.file.endsWith('html') ? 'build' : 'serve', depGraphClientResponse);
|
|
165
|
+
html = html.replace(/src="/g, 'src="static/');
|
|
166
|
+
html = html.replace(/href="styles/g, 'href="static/styles');
|
|
167
|
+
html = html.replace('<base href="/" />', '');
|
|
168
|
+
html = html.replace(/type="module"/g, '');
|
|
169
|
+
(0, fs_1.writeFileSync)(fullFilePath, html);
|
|
170
|
+
(0, fs_1.writeFileSync)((0, path_1.join)(assetsFolder, 'environment.js'), environmentJs);
|
|
171
|
+
output_1.output.success({
|
|
172
|
+
title: `HTML output created in ${fileFolderPath}`,
|
|
173
|
+
bodyLines: [fileFolderPath, ...assets],
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
else if (ext === '.json') {
|
|
177
|
+
(0, fs_extra_1.ensureDirSync)((0, path_1.dirname)(fullFilePath));
|
|
178
|
+
(0, fileutils_1.writeJsonFile)(fullFilePath, {
|
|
179
|
+
graph,
|
|
180
|
+
affectedProjects,
|
|
181
|
+
criticalPath: affectedProjects,
|
|
182
|
+
});
|
|
183
|
+
output_1.output.success({
|
|
184
|
+
title: `JSON output created in ${fileFolderPath}`,
|
|
185
|
+
bodyLines: [fullFilePath],
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
output_1.output.error({
|
|
190
|
+
title: `Please specify a filename with either .json or .html extension.`,
|
|
191
|
+
bodyLines: [`You provided --file=${args.file}`],
|
|
192
|
+
});
|
|
193
|
+
process.exit(1);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
else {
|
|
197
|
+
const environmentJs = buildEnvironmentJs(args.exclude || [], args.watch, !!args.file && args.file.endsWith('html') ? 'build' : 'serve');
|
|
198
|
+
yield startServer(html, environmentJs, args.host || '127.0.0.1', args.port || 4211, args.watch, affectedProjects, args.focus, args.groupByFolder, args.exclude, args.open);
|
|
199
|
+
}
|
|
200
|
+
});
|
|
201
|
+
}
|
|
202
|
+
exports.generateGraph = generateGraph;
|
|
203
|
+
function startServer(html, environmentJs, host, port = 4211, watchForchanges = false, affected = [], focus = null, groupByFolder = false, exclude = [], openBrowser = true) {
|
|
204
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
205
|
+
if (watchForchanges) {
|
|
206
|
+
startWatcher();
|
|
207
|
+
}
|
|
208
|
+
currentDepGraphClientResponse = yield createDepGraphClientResponse(affected);
|
|
209
|
+
currentDepGraphClientResponse.focus = focus;
|
|
210
|
+
currentDepGraphClientResponse.groupByFolder = groupByFolder;
|
|
211
|
+
currentDepGraphClientResponse.exclude = exclude;
|
|
212
|
+
const app = http.createServer((req, res) => {
|
|
213
|
+
// parse URL
|
|
214
|
+
const parsedUrl = new url_1.URL(req.url, `http://${host}:${port}`);
|
|
215
|
+
// extract URL path
|
|
216
|
+
// Avoid https://en.wikipedia.org/wiki/Directory_traversal_attack
|
|
217
|
+
// e.g curl --path-as-is http://localhost:9000/../fileInDanger.txt
|
|
218
|
+
// by limiting the path to current directory only
|
|
219
|
+
const sanitizePath = (0, path_1.basename)(parsedUrl.pathname);
|
|
220
|
+
if (sanitizePath === 'projectGraph.json') {
|
|
221
|
+
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
222
|
+
res.end(JSON.stringify(currentDepGraphClientResponse));
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
if (sanitizePath === 'currentHash') {
|
|
226
|
+
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
227
|
+
res.end(JSON.stringify({ hash: currentDepGraphClientResponse.hash }));
|
|
228
|
+
return;
|
|
229
|
+
}
|
|
230
|
+
if (sanitizePath === 'environment.js') {
|
|
231
|
+
res.writeHead(200, { 'Content-Type': 'application/javascript' });
|
|
232
|
+
res.end(environmentJs);
|
|
233
|
+
return;
|
|
234
|
+
}
|
|
235
|
+
let pathname = (0, path_1.join)(__dirname, '../core/dep-graph/', sanitizePath);
|
|
236
|
+
if (!(0, fs_1.existsSync)(pathname)) {
|
|
237
|
+
// if the file is not found, return 404
|
|
238
|
+
res.statusCode = 404;
|
|
239
|
+
res.end(`File ${pathname} not found!`);
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
// if is a directory, then look for index.html
|
|
243
|
+
if ((0, fs_1.statSync)(pathname).isDirectory()) {
|
|
244
|
+
res.writeHead(200, { 'Content-Type': 'text/html' });
|
|
245
|
+
res.end(html);
|
|
246
|
+
return;
|
|
247
|
+
}
|
|
248
|
+
try {
|
|
249
|
+
const data = (0, fs_1.readFileSync)(pathname);
|
|
250
|
+
const ext = (0, path_1.parse)(pathname).ext;
|
|
251
|
+
res.setHeader('Content-type', mimeType[ext] || 'text/plain');
|
|
252
|
+
res.end(data);
|
|
253
|
+
}
|
|
254
|
+
catch (err) {
|
|
255
|
+
res.statusCode = 500;
|
|
256
|
+
res.end(`Error getting the file: ${err}.`);
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
app.listen(port, host);
|
|
260
|
+
output_1.output.note({
|
|
261
|
+
title: `Project graph started at http://${host}:${port}`,
|
|
262
|
+
});
|
|
263
|
+
if (openBrowser) {
|
|
264
|
+
let url = `http://${host}:${port}`;
|
|
265
|
+
let params = new url_1.URLSearchParams();
|
|
266
|
+
if (focus) {
|
|
267
|
+
params.append('focus', focus);
|
|
268
|
+
}
|
|
269
|
+
if (groupByFolder) {
|
|
270
|
+
params.append('groupByFolder', 'true');
|
|
271
|
+
}
|
|
272
|
+
open(`${url}?${params.toString()}`);
|
|
273
|
+
}
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
let currentDepGraphClientResponse = {
|
|
277
|
+
hash: null,
|
|
278
|
+
projects: [],
|
|
279
|
+
dependencies: {},
|
|
280
|
+
layout: {
|
|
281
|
+
appsDir: '',
|
|
282
|
+
libsDir: '',
|
|
283
|
+
},
|
|
284
|
+
affected: [],
|
|
285
|
+
focus: null,
|
|
286
|
+
groupByFolder: false,
|
|
287
|
+
exclude: [],
|
|
288
|
+
};
|
|
289
|
+
function getIgnoredGlobs(root) {
|
|
290
|
+
const ig = (0, ignore_1.default)();
|
|
291
|
+
try {
|
|
292
|
+
ig.add((0, fs_1.readFileSync)(`${root}/.gitignore`, 'utf-8'));
|
|
293
|
+
}
|
|
294
|
+
catch (_a) { }
|
|
295
|
+
try {
|
|
296
|
+
ig.add((0, fs_1.readFileSync)(`${root}/.nxignore`, 'utf-8'));
|
|
297
|
+
}
|
|
298
|
+
catch (_b) { }
|
|
299
|
+
return ig;
|
|
300
|
+
}
|
|
301
|
+
function startWatcher() {
|
|
302
|
+
createFileWatcher(app_root_1.appRootPath, () => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
303
|
+
output_1.output.note({ title: 'Recalculating project graph...' });
|
|
304
|
+
const newGraphClientResponse = yield createDepGraphClientResponse();
|
|
305
|
+
if (newGraphClientResponse.hash !== currentDepGraphClientResponse.hash) {
|
|
306
|
+
output_1.output.note({ title: 'Graph changes updated.' });
|
|
307
|
+
currentDepGraphClientResponse = newGraphClientResponse;
|
|
308
|
+
}
|
|
309
|
+
else {
|
|
310
|
+
output_1.output.note({ title: 'No graph changes found.' });
|
|
311
|
+
}
|
|
312
|
+
}));
|
|
313
|
+
}
|
|
314
|
+
function debounce(fn, time) {
|
|
315
|
+
let timeout;
|
|
316
|
+
return (...args) => {
|
|
317
|
+
if (timeout) {
|
|
318
|
+
clearTimeout(timeout);
|
|
319
|
+
}
|
|
320
|
+
timeout = setTimeout(() => fn(...args), time);
|
|
321
|
+
};
|
|
322
|
+
}
|
|
323
|
+
function createFileWatcher(root, changeHandler) {
|
|
324
|
+
const ignoredGlobs = getIgnoredGlobs(root);
|
|
325
|
+
const layout = (0, file_utils_1.workspaceLayout)();
|
|
326
|
+
const watcher = (0, chokidar_1.watch)([
|
|
327
|
+
(0, path_2.joinPathFragments)(layout.appsDir, '**'),
|
|
328
|
+
(0, path_2.joinPathFragments)(layout.libsDir, '**'),
|
|
329
|
+
], {
|
|
330
|
+
cwd: root,
|
|
331
|
+
ignoreInitial: true,
|
|
332
|
+
});
|
|
333
|
+
watcher.on('all', debounce((event, path) => tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
334
|
+
if (ignoredGlobs.ignores(path))
|
|
335
|
+
return;
|
|
336
|
+
yield changeHandler();
|
|
337
|
+
}), 500));
|
|
338
|
+
return { close: () => watcher.close() };
|
|
339
|
+
}
|
|
340
|
+
function createDepGraphClientResponse(affected = []) {
|
|
341
|
+
return tslib_1.__awaiter(this, void 0, void 0, function* () {
|
|
342
|
+
perf_hooks_1.performance.mark('project graph watch calculation:start');
|
|
343
|
+
yield file_hasher_1.defaultFileHasher.init();
|
|
344
|
+
let graph = (0, operators_1.pruneExternalNodes)(yield (0, project_graph_1.createProjectGraphAsync)());
|
|
345
|
+
perf_hooks_1.performance.mark('project graph watch calculation:end');
|
|
346
|
+
perf_hooks_1.performance.mark('project graph response generation:start');
|
|
347
|
+
const layout = (0, file_utils_1.workspaceLayout)();
|
|
348
|
+
const projects = Object.values(graph.nodes).map((project) => ({
|
|
349
|
+
name: project.name,
|
|
350
|
+
type: project.type,
|
|
351
|
+
data: {
|
|
352
|
+
tags: project.data.tags,
|
|
353
|
+
root: project.data.root,
|
|
354
|
+
files: [],
|
|
355
|
+
},
|
|
356
|
+
}));
|
|
357
|
+
const dependencies = graph.dependencies;
|
|
358
|
+
const hasher = (0, crypto_1.createHash)('sha256');
|
|
359
|
+
hasher.update(JSON.stringify({ layout, projects, dependencies }));
|
|
360
|
+
const hash = hasher.digest('hex');
|
|
361
|
+
perf_hooks_1.performance.mark('project graph response generation:end');
|
|
362
|
+
perf_hooks_1.performance.measure('project graph watch calculation', 'project graph watch calculation:start', 'project graph watch calculation:end');
|
|
363
|
+
perf_hooks_1.performance.measure('project graph response generation', 'project graph response generation:start', 'project graph response generation:end');
|
|
364
|
+
return Object.assign(Object.assign({}, currentDepGraphClientResponse), { hash,
|
|
365
|
+
layout,
|
|
366
|
+
projects,
|
|
367
|
+
dependencies,
|
|
368
|
+
affected });
|
|
369
|
+
});
|
|
370
|
+
}
|
|
371
|
+
//# sourceMappingURL=dep-graph.js.map
|