@smoothbricks/nx-plugin 0.7.17 → 0.7.19
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/README.md +315 -114
- package/dist/.build-inputs.json +47 -38
- package/dist/built-output-packages.js +1 -1
- package/dist/bun-lock-scope.d.ts +128 -20
- package/dist/bun-lock-scope.d.ts.map +1 -1
- package/dist/bun-lock-scope.js +267 -44
- package/dist/cargo-closure-input.d.ts +8 -6
- package/dist/cargo-closure-input.d.ts.map +1 -1
- package/dist/cargo-closure-input.js +15 -12
- package/dist/cargo-source-hash.d.ts +26 -25
- package/dist/cargo-source-hash.d.ts.map +1 -1
- package/dist/cargo-source-hash.js +84 -105
- package/dist/cargo-toolchain-paths.d.ts +2 -2
- package/dist/cargo-toolchain-paths.js +2 -2
- package/dist/cargo-workspace.d.ts +20 -2
- package/dist/cargo-workspace.d.ts.map +1 -1
- package/dist/cargo-workspace.js +43 -22
- package/dist/ensure-built-receipt.d.ts +3 -2
- package/dist/ensure-built-receipt.d.ts.map +1 -1
- package/dist/ensure-built-receipt.js +3 -2
- package/dist/eslint-config-closure.d.ts +8 -3
- package/dist/eslint-config-closure.d.ts.map +1 -1
- package/dist/eslint-config-closure.js +24 -5
- package/dist/executors/bounded-exec/admission-queue.d.ts +3 -1
- package/dist/executors/bounded-exec/admission-queue.d.ts.map +1 -1
- package/dist/executors/bounded-exec/admission-queue.js +9 -10
- package/dist/executors/bounded-exec/awake-clock.d.ts +5 -0
- package/dist/executors/bounded-exec/awake-clock.d.ts.map +1 -0
- package/dist/executors/bounded-exec/awake-clock.js +22 -0
- package/dist/executors/bounded-exec/bounds.d.ts +19 -6
- package/dist/executors/bounded-exec/bounds.d.ts.map +1 -1
- package/dist/executors/bounded-exec/bounds.js +22 -15
- package/dist/executors/bounded-exec/case-gate.d.ts +114 -0
- package/dist/executors/bounded-exec/case-gate.d.ts.map +1 -0
- package/dist/executors/bounded-exec/case-gate.js +342 -0
- package/dist/executors/bounded-exec/cpu-pool-thread.d.ts +1 -0
- package/dist/executors/bounded-exec/cpu-pool-thread.d.ts.map +1 -1
- package/dist/executors/bounded-exec/cpu-pool-thread.js +2 -2
- package/dist/executors/bounded-exec/cpu-pool.d.ts +28 -1
- package/dist/executors/bounded-exec/cpu-pool.d.ts.map +1 -1
- package/dist/executors/bounded-exec/cpu-pool.js +102 -16
- package/dist/executors/bounded-exec/cpu-rise.d.ts +73 -0
- package/dist/executors/bounded-exec/cpu-rise.d.ts.map +1 -0
- package/dist/executors/bounded-exec/cpu-rise.js +111 -0
- package/dist/executors/bounded-exec/endpoint-life.d.ts +146 -0
- package/dist/executors/bounded-exec/endpoint-life.d.ts.map +1 -0
- package/dist/executors/bounded-exec/endpoint-life.js +228 -0
- package/dist/executors/bounded-exec/executor.d.ts +1 -1
- package/dist/executors/bounded-exec/executor.d.ts.map +1 -1
- package/dist/executors/bounded-exec/executor.js +256 -86
- package/dist/executors/bounded-exec/gateway-lease.d.ts +1 -1
- package/dist/executors/bounded-exec/gateway-lease.d.ts.map +1 -1
- package/dist/executors/bounded-exec/gateway-lease.js +8 -1
- package/dist/executors/bounded-exec/go-run-summary.d.ts +51 -0
- package/dist/executors/bounded-exec/go-run-summary.d.ts.map +1 -0
- package/dist/executors/bounded-exec/go-run-summary.js +98 -0
- package/dist/executors/bounded-exec/hang-diagnostics.d.ts +11 -3
- package/dist/executors/bounded-exec/hang-diagnostics.d.ts.map +1 -1
- package/dist/executors/bounded-exec/hang-diagnostics.js +125 -47
- package/dist/executors/bounded-exec/lease-wait.d.ts +1 -0
- package/dist/executors/bounded-exec/lease-wait.d.ts.map +1 -1
- package/dist/executors/bounded-exec/lease-wait.js +1 -0
- package/dist/executors/bounded-exec/mbx-pool.d.ts +42 -7
- package/dist/executors/bounded-exec/mbx-pool.d.ts.map +1 -1
- package/dist/executors/bounded-exec/mbx-pool.js +45 -8
- package/dist/executors/bounded-exec/mbx-reservations.d.ts +12 -6
- package/dist/executors/bounded-exec/mbx-reservations.d.ts.map +1 -1
- package/dist/executors/bounded-exec/mbx-reservations.js +190 -284
- package/dist/executors/bounded-exec/parent-grant.d.ts +2 -0
- package/dist/executors/bounded-exec/parent-grant.d.ts.map +1 -1
- package/dist/executors/bounded-exec/parent-grant.js +1 -0
- package/dist/executors/bounded-exec/pool-admission.d.ts +29 -3
- package/dist/executors/bounded-exec/pool-admission.d.ts.map +1 -1
- package/dist/executors/bounded-exec/pool-admission.js +47 -1
- package/dist/executors/bounded-exec/progress-channel.d.ts +38 -0
- package/dist/executors/bounded-exec/progress-channel.d.ts.map +1 -0
- package/dist/executors/bounded-exec/progress-channel.js +113 -0
- package/dist/executors/bounded-exec/progress.d.ts +5 -1
- package/dist/executors/bounded-exec/progress.d.ts.map +1 -1
- package/dist/executors/bounded-exec/progress.js +31 -1
- package/dist/executors/bounded-exec/ram-temp.d.ts +24 -1
- package/dist/executors/bounded-exec/ram-temp.d.ts.map +1 -1
- package/dist/executors/bounded-exec/ram-temp.js +123 -16
- package/dist/executors/bounded-exec/reservation-connection.d.ts +90 -0
- package/dist/executors/bounded-exec/reservation-connection.d.ts.map +1 -0
- package/dist/executors/bounded-exec/reservation-connection.js +248 -0
- package/dist/executors/bounded-exec/run-cpu-pool.d.ts.map +1 -1
- package/dist/executors/bounded-exec/run-cpu-pool.js +3 -0
- package/dist/executors/bounded-exec/runner-sizing.d.ts +9 -5
- package/dist/executors/bounded-exec/runner-sizing.d.ts.map +1 -1
- package/dist/executors/bounded-exec/runner-sizing.js +13 -9
- package/dist/executors/bounded-exec/schema.d.ts +7 -2
- package/dist/executors/bounded-exec/schema.d.ts.map +1 -1
- package/dist/executors/bounded-exec/schema.js +17 -1
- package/dist/executors/bounded-exec/suite-minimum.d.ts +21 -0
- package/dist/executors/bounded-exec/suite-minimum.d.ts.map +1 -0
- package/dist/executors/bounded-exec/suite-minimum.js +85 -0
- package/dist/executors/bounded-exec/test-result-writer.d.ts +2 -0
- package/dist/executors/bounded-exec/test-result-writer.d.ts.map +1 -1
- package/dist/executors/bounded-exec/test-result-writer.js +1 -0
- package/dist/executors/bounded-exec/test-results.d.ts +5 -0
- package/dist/executors/bounded-exec/test-results.d.ts.map +1 -1
- package/dist/executors/bounded-exec/test-results.js +2 -2
- package/dist/executors/bounded-exec/verdict.d.ts +39 -10
- package/dist/executors/bounded-exec/verdict.d.ts.map +1 -1
- package/dist/executors/bounded-exec/verdict.js +60 -14
- package/dist/executors/cargo-zigbuild/executor.d.ts +10 -8
- package/dist/executors/cargo-zigbuild/executor.d.ts.map +1 -1
- package/dist/executors/cargo-zigbuild/executor.js +32 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +294 -152
- package/dist/managed-files/ci-workflow.d.ts +4 -1
- package/dist/managed-files/ci-workflow.d.ts.map +1 -1
- package/dist/managed-files/ci-workflow.js +9 -14
- package/dist/managed-files/files.d.ts +3 -3
- package/dist/managed-files/files.js +3 -3
- package/dist/managed-files/generator.d.ts +5 -1
- package/dist/managed-files/generator.d.ts.map +1 -1
- package/dist/managed-files/generator.js +22 -7
- package/dist/managed-files/render-memo.d.ts +13 -0
- package/dist/managed-files/render-memo.d.ts.map +1 -0
- package/dist/managed-files/render-memo.js +94 -0
- package/dist/task-results.js +2 -1
- package/dist/test-program.d.ts +11 -6
- package/dist/test-program.d.ts.map +1 -1
- package/dist/test-program.js +39 -35
- package/dist/tool-bins.d.ts +12 -0
- package/dist/tool-bins.d.ts.map +1 -1
- package/dist/tool-bins.js +31 -6
- package/dist/typecheck-test-policy.d.ts +10 -1
- package/dist/typecheck-test-policy.d.ts.map +1 -1
- package/dist/typecheck-test-policy.js +40 -24
- package/dist/workspace-config-policy.d.ts.map +1 -1
- package/dist/workspace-config-policy.js +135 -42
- package/dist/workspace-index.d.ts +14 -1
- package/dist/workspace-index.d.ts.map +1 -1
- package/dist/workspace-index.js +36 -4
- package/executors.json +2 -0
- package/managed/raw/envrc +24 -0
- package/managed/raw/patches/nx@24.0.3.patch +1851 -221
- package/managed/raw/patches/ttsc@0.37.1.patch +1055 -0
- package/managed/raw/tooling/direnv/developer-links.ts +122 -14
- package/managed/raw/tooling/direnv/devenv.smoo.nix +20 -19
- package/managed/templates/github/actions/save-nix-devenv/action.yml +19 -1
- package/managed/templates/github/actions/setup-devenv/action.yml +2 -0
- package/package.json +68 -11
- package/runtime/nx-publish/.build-inputs.json +2 -2
- package/runtime/nx-publish/cache_adapter.js +293 -3
- package/runtime/nx-publish/nx_publish.js +36 -14
- package/src/built-output-packages.ts +1 -1
- package/src/bun-lock-scope.ts +293 -40
- package/src/cargo-closure-input.ts +20 -12
- package/src/cargo-source-hash.ts +119 -145
- package/src/cargo-toolchain-paths.ts +2 -2
- package/src/cargo-workspace.ts +59 -21
- package/src/ensure-built-receipt.ts +3 -2
- package/src/eslint-config-closure.ts +27 -6
- package/src/executors/bounded-exec/admission-queue.ts +11 -10
- package/src/executors/bounded-exec/awake-clock.ts +20 -0
- package/src/executors/bounded-exec/bounds.ts +41 -19
- package/src/executors/bounded-exec/case-gate.ts +365 -0
- package/src/executors/bounded-exec/cpu-pool-thread.ts +3 -3
- package/src/executors/bounded-exec/cpu-pool.ts +139 -12
- package/src/executors/bounded-exec/cpu-rise.ts +156 -0
- package/src/executors/bounded-exec/endpoint-life.ts +279 -0
- package/src/executors/bounded-exec/executor.ts +341 -123
- package/src/executors/bounded-exec/gateway-lease.ts +6 -0
- package/src/executors/bounded-exec/go-run-summary.ts +137 -0
- package/src/executors/bounded-exec/hang-diagnostics.ts +150 -50
- package/src/executors/bounded-exec/lease-wait.ts +1 -0
- package/src/executors/bounded-exec/mbx-pool.ts +57 -9
- package/src/executors/bounded-exec/mbx-reservations.ts +216 -183
- package/src/executors/bounded-exec/parent-grant.ts +3 -0
- package/src/executors/bounded-exec/pool-admission.ts +59 -2
- package/src/executors/bounded-exec/progress-channel.ts +129 -0
- package/src/executors/bounded-exec/progress.ts +39 -3
- package/src/executors/bounded-exec/ram-temp.ts +137 -17
- package/src/executors/bounded-exec/reservation-connection.ts +221 -0
- package/src/executors/bounded-exec/run-cpu-pool.ts +2 -0
- package/src/executors/bounded-exec/runner-sizing.ts +13 -8
- package/src/executors/bounded-exec/schema.json +1 -1
- package/src/executors/bounded-exec/schema.ts +21 -2
- package/src/executors/bounded-exec/suite-minimum.ts +81 -0
- package/src/executors/bounded-exec/test-result-writer.ts +3 -0
- package/src/executors/bounded-exec/test-results.ts +5 -0
- package/src/executors/bounded-exec/verdict.ts +83 -22
- package/src/executors/cargo-zigbuild/executor.ts +30 -19
- package/src/index.ts +357 -166
- package/src/managed-files/ci-workflow.ts +13 -17
- package/src/managed-files/files.ts +3 -3
- package/src/managed-files/generator.ts +21 -6
- package/src/managed-files/render-memo.ts +135 -0
- package/src/test-program.ts +36 -41
- package/src/tool-bins.ts +35 -6
- package/src/typecheck-test-policy.ts +49 -24
- package/src/workspace-config-policy.ts +161 -43
- package/src/workspace-index.ts +40 -5
- package/test-timings.json +157 -141
- package/managed/raw/patches/ttsc@0.36.3.patch +0 -1660
|
@@ -358,19 +358,21 @@ index 757fd200dbd83f335c9868987e4135d4b7b580cb..1bf7e571cc66d3483f8b2ebb7b73ad8b
|
|
|
358
358
|
}
|
|
359
359
|
// Must be sync for the help output use case
|
|
360
360
|
diff --git a/dist/src/daemon/client/client.d.ts b/dist/src/daemon/client/client.d.ts
|
|
361
|
-
index d7ee773807a7d25214be89c5536c86a8e6589a44..
|
|
361
|
+
index d7ee773807a7d25214be89c5536c86a8e6589a44..fa08b44690e853ae7ff829115e75fd7897e8b71f 100644
|
|
362
362
|
--- a/dist/src/daemon/client/client.d.ts
|
|
363
363
|
+++ b/dist/src/daemon/client/client.d.ts
|
|
364
|
-
@@ -3,
|
|
364
|
+
@@ -3,9 +3,7 @@ import { FileData, ProjectGraph } from '../../config/project-graph';
|
|
365
365
|
import { Task, TaskGraph } from '../../config/task-graph';
|
|
366
366
|
import type { UltracacheConfigurationVersion } from '../message-types/ultracache-configuration-version';
|
|
367
367
|
import { Hash } from '../../hasher/task-hasher';
|
|
368
368
|
-import { NxWorkspaceFiles, TaskOutputs, TaskRun, TaskTarget } from '../../native';
|
|
369
|
+
-import { PreTasksExecutionContext } from '../../project-graph/plugins/public-api';
|
|
370
|
+
-import type { MaybeStubbedPostTasksExecutionContext } from '../../project-graph/plugins/task-results-stub';
|
|
369
371
|
+import { NxWorkspaceFiles, TaskOutputs } from '../../native';
|
|
370
|
-
import { PreTasksExecutionContext } from '../../project-graph/plugins/public-api';
|
|
371
|
-
import type { MaybeStubbedPostTasksExecutionContext } from '../../project-graph/plugins/task-results-stub';
|
|
372
372
|
import { ConfigurationSourceMaps } from '../../project-graph/utils/project-configuration/source-maps';
|
|
373
|
-
|
|
373
|
+
import type { FlushSyncGeneratorChangesResult, SyncGeneratorRunResult } from '../../utils/sync-generators';
|
|
374
|
+
import { type ConfigureAiAgentsStatusResponse } from '../message-types/configure-ai-agents';
|
|
375
|
+
@@ -61,6 +59,14 @@ export declare class DaemonClient {
|
|
374
376
|
private projectGraphListenerFramingFailures;
|
|
375
377
|
private projectGraphListenerCallbacks;
|
|
376
378
|
enabled(): boolean;
|
|
@@ -385,7 +387,7 @@ index d7ee773807a7d25214be89c5536c86a8e6589a44..7c3de650d6d61c4db3a0e1538ecf887e
|
|
|
385
387
|
reset(): void;
|
|
386
388
|
private createReadyPromise;
|
|
387
389
|
private failDaemonReady;
|
|
388
|
-
@@ -105,9 +
|
|
390
|
+
@@ -105,9 +111,6 @@ export declare class DaemonClient {
|
|
389
391
|
getFilesInDirectory(dir: string): Promise<string[]>;
|
|
390
392
|
hashGlob(globs: string[], exclude?: string[]): Promise<string>;
|
|
391
393
|
hashMultiGlob(globGroups: string[][]): Promise<string[]>;
|
|
@@ -395,19 +397,30 @@ index d7ee773807a7d25214be89c5536c86a8e6589a44..7c3de650d6d61c4db3a0e1538ecf887e
|
|
|
395
397
|
getSyncGeneratorChanges(generators: string[]): Promise<SyncGeneratorRunResult[]>;
|
|
396
398
|
flushSyncGeneratorChangesToDisk(generators: string[]): Promise<FlushSyncGeneratorChangesResult>;
|
|
397
399
|
getRegisteredSyncGenerators(): Promise<{
|
|
400
|
+
@@ -118,8 +121,6 @@ export declare class DaemonClient {
|
|
401
|
+
/** Selection runs where hashing does, so the plans it builds are reused. */
|
|
402
|
+
selectAffectedTasks(request: AffectedTasksRequest): Promise<SelectAffectedTasksResponse>;
|
|
403
|
+
updateWorkspaceContext(createdFiles: string[], updatedFiles: string[], deletedFiles: string[]): Promise<void>;
|
|
404
|
+
- runPreTasksExecution(context: PreTasksExecutionContext): Promise<NodeJS.ProcessEnv[]>;
|
|
405
|
+
- runPostTasksExecution(context: MaybeStubbedPostTasksExecutionContext): Promise<void>;
|
|
406
|
+
getNxConsoleStatus(): Promise<NxConsoleStatusResponse>;
|
|
407
|
+
setNxConsolePreferenceAndInstall(preference: boolean): Promise<SetNxConsolePreferenceAndInstallResponse>;
|
|
408
|
+
getConfigureAiAgentsStatus(): Promise<ConfigureAiAgentsStatusResponse>;
|
|
398
409
|
diff --git a/dist/src/daemon/client/client.js b/dist/src/daemon/client/client.js
|
|
399
|
-
index af7da5654b807f8e9d8693cd45aad32a162a4765..
|
|
410
|
+
index af7da5654b807f8e9d8693cd45aad32a162a4765..6bdfade7ca1d18fa7c9fc072ad1a924d09697f6a 100644
|
|
400
411
|
--- a/dist/src/daemon/client/client.js
|
|
401
412
|
+++ b/dist/src/daemon/client/client.js
|
|
402
|
-
@@ -
|
|
413
|
+
@@ -41,9 +41,7 @@ const get_sync_generator_changes_1 = require("../message-types/get-sync-generato
|
|
414
|
+
const hash_glob_1 = require("../message-types/hash-glob");
|
|
415
|
+
const nx_console_1 = require("../message-types/nx-console");
|
|
403
416
|
const register_project_graph_listener_1 = require("../message-types/register-project-graph-listener");
|
|
404
|
-
|
|
417
|
+
-const run_tasks_execution_hooks_1 = require("../message-types/run-tasks-execution-hooks");
|
|
405
418
|
const streaming_messages_1 = require("../message-types/streaming-messages");
|
|
406
419
|
-const task_history_1 = require("../message-types/task-history");
|
|
407
420
|
const update_workspace_context_1 = require("../message-types/update-workspace-context");
|
|
408
421
|
const tmp_dir_1 = require("../tmp-dir");
|
|
409
422
|
const sandbox_socket_hint_1 = require("../sandbox-socket-hint");
|
|
410
|
-
@@ -56,6 +
|
|
423
|
+
@@ -56,6 +54,8 @@ var DaemonStatus;
|
|
411
424
|
DaemonStatus[DaemonStatus["DISCONNECTED"] = 1] = "DISCONNECTED";
|
|
412
425
|
DaemonStatus[DaemonStatus["CONNECTED"] = 2] = "CONNECTED";
|
|
413
426
|
})(DaemonStatus || (exports.DaemonStatus = DaemonStatus = {}));
|
|
@@ -416,7 +429,7 @@ index af7da5654b807f8e9d8693cd45aad32a162a4765..0555ac8faebbe0d3dae8e758a0e6b51d
|
|
|
416
429
|
const WAIT_FOR_SERVER_CONFIG = {
|
|
417
430
|
delayMs: 10,
|
|
418
431
|
maxAttempts: 6000, // 6000 * 10ms = 60 seconds
|
|
419
|
-
@@ -107,6 +
|
|
432
|
+
@@ -107,6 +107,8 @@ class DaemonClient {
|
|
420
433
|
this.projectGraphListenerFramingFailures = 0;
|
|
421
434
|
this.projectGraphListenerCallbacks = new Map();
|
|
422
435
|
this.envReflectionSent = false;
|
|
@@ -425,7 +438,7 @@ index af7da5654b807f8e9d8693cd45aad32a162a4765..0555ac8faebbe0d3dae8e758a0e6b51d
|
|
|
425
438
|
try {
|
|
426
439
|
this.nxJson = (0, configuration_1.readNxJson)();
|
|
427
440
|
}
|
|
428
|
-
@@ -150,12 +
|
|
441
|
+
@@ -150,12 +152,55 @@ class DaemonClient {
|
|
429
442
|
});
|
|
430
443
|
this._enabled = false;
|
|
431
444
|
}
|
|
@@ -481,7 +494,7 @@ index af7da5654b807f8e9d8693cd45aad32a162a4765..0555ac8faebbe0d3dae8e758a0e6b51d
|
|
|
481
494
|
reset() {
|
|
482
495
|
this.rejectFileWatcherRegistrations(new Error('Daemon client reset'));
|
|
483
496
|
this.socketMessenger?.close();
|
|
484
|
-
@@ -192,6 +
|
|
497
|
+
@@ -192,6 +237,24 @@ class DaemonClient {
|
|
485
498
|
this._daemonStatus = DaemonStatus.DISCONNECTED;
|
|
486
499
|
this._daemonReadyFailed?.(err);
|
|
487
500
|
}
|
|
@@ -506,7 +519,7 @@ index af7da5654b807f8e9d8693cd45aad32a162a4765..0555ac8faebbe0d3dae8e758a0e6b51d
|
|
|
506
519
|
getSocketPath() {
|
|
507
520
|
const daemonProcessJson = (0, cache_1.readDaemonProcessJsonCache)();
|
|
508
521
|
if (daemonProcessJson?.socketPath) {
|
|
509
|
-
@@ -328,6 +
|
|
522
|
+
@@ -328,6 +391,7 @@ class DaemonClient {
|
|
510
523
|
// failure would otherwise leave this channel silent forever.
|
|
511
524
|
this.fileWatcherMessenger?.close();
|
|
512
525
|
});
|
|
@@ -514,7 +527,7 @@ index af7da5654b807f8e9d8693cd45aad32a162a4765..0555ac8faebbe0d3dae8e758a0e6b51d
|
|
|
514
527
|
await this.sendFileWatcherRegistration(callbackId);
|
|
515
528
|
})
|
|
516
529
|
.catch((error) => {
|
|
517
|
-
@@ -392,6 +
|
|
530
|
+
@@ -392,6 +456,48 @@ class DaemonClient {
|
|
518
531
|
registration.reject(error);
|
|
519
532
|
}
|
|
520
533
|
}
|
|
@@ -563,7 +576,7 @@ index af7da5654b807f8e9d8693cd45aad32a162a4765..0555ac8faebbe0d3dae8e758a0e6b51d
|
|
|
563
576
|
async reconnectFileWatcher() {
|
|
564
577
|
// Guard against concurrent reconnection attempts
|
|
565
578
|
if (this.fileWatcherReconnecting) {
|
|
566
|
-
@@ -483,6 +
|
|
579
|
+
@@ -483,6 +589,7 @@ class DaemonClient {
|
|
567
580
|
// not emit, so close explicitly to hand off to it.
|
|
568
581
|
this.fileWatcherMessenger?.close();
|
|
569
582
|
});
|
|
@@ -571,7 +584,7 @@ index af7da5654b807f8e9d8693cd45aad32a162a4765..0555ac8faebbe0d3dae8e758a0e6b51d
|
|
|
571
584
|
// Re-register all stored configs
|
|
572
585
|
for (const cfg of this.fileWatcherConfigs.values()) {
|
|
573
586
|
this.fileWatcherMessenger.sendMessage({
|
|
574
|
-
@@ -559,6 +
|
|
587
|
+
@@ -559,6 +666,7 @@ class DaemonClient {
|
|
575
588
|
}
|
|
576
589
|
this.projectGraphListenerMessenger?.close();
|
|
577
590
|
});
|
|
@@ -579,7 +592,7 @@ index af7da5654b807f8e9d8693cd45aad32a162a4765..0555ac8faebbe0d3dae8e758a0e6b51d
|
|
|
579
592
|
this.projectGraphListenerMessenger.sendMessage({
|
|
580
593
|
type: register_project_graph_listener_1.REGISTER_PROJECT_GRAPH_LISTENER,
|
|
581
594
|
});
|
|
582
|
-
@@ -659,6 +
|
|
595
|
+
@@ -659,6 +767,7 @@ class DaemonClient {
|
|
583
596
|
// not emit, so close explicitly to hand off to it.
|
|
584
597
|
this.projectGraphListenerMessenger?.close();
|
|
585
598
|
});
|
|
@@ -587,7 +600,7 @@ index af7da5654b807f8e9d8693cd45aad32a162a4765..0555ac8faebbe0d3dae8e758a0e6b51d
|
|
|
587
600
|
// Re-register
|
|
588
601
|
this.projectGraphListenerMessenger.sendMessage({
|
|
589
602
|
type: register_project_graph_listener_1.REGISTER_PROJECT_GRAPH_LISTENER,
|
|
590
|
-
@@ -749,27 +
|
|
603
|
+
@@ -749,27 +858,6 @@ class DaemonClient {
|
|
591
604
|
};
|
|
592
605
|
return this.sendToDaemonViaQueue(message);
|
|
593
606
|
}
|
|
@@ -615,7 +628,28 @@ index af7da5654b807f8e9d8693cd45aad32a162a4765..0555ac8faebbe0d3dae8e758a0e6b51d
|
|
|
615
628
|
getSyncGeneratorChanges(generators) {
|
|
616
629
|
const message = {
|
|
617
630
|
type: get_sync_generator_changes_1.GET_SYNC_GENERATOR_CHANGES,
|
|
618
|
-
@@ -
|
|
631
|
+
@@ -813,20 +901,6 @@ class DaemonClient {
|
|
632
|
+
};
|
|
633
|
+
return this.sendToDaemonViaQueue(message);
|
|
634
|
+
}
|
|
635
|
+
- async runPreTasksExecution(context) {
|
|
636
|
+
- const message = {
|
|
637
|
+
- type: run_tasks_execution_hooks_1.PRE_TASKS_EXECUTION,
|
|
638
|
+
- context,
|
|
639
|
+
- };
|
|
640
|
+
- return this.sendToDaemonViaQueue(message);
|
|
641
|
+
- }
|
|
642
|
+
- async runPostTasksExecution(context) {
|
|
643
|
+
- const message = {
|
|
644
|
+
- type: run_tasks_execution_hooks_1.POST_TASKS_EXECUTION,
|
|
645
|
+
- context,
|
|
646
|
+
- };
|
|
647
|
+
- return this.sendToDaemonViaQueue(message);
|
|
648
|
+
- }
|
|
649
|
+
getNxConsoleStatus() {
|
|
650
|
+
const message = {
|
|
651
|
+
type: nx_console_1.GET_NX_CONSOLE_STATUS,
|
|
652
|
+
@@ -890,6 +964,9 @@ class DaemonClient {
|
|
619
653
|
if (this._pluginWorkerConnectionLost) {
|
|
620
654
|
throw this._pluginWorkerConnectionLost;
|
|
621
655
|
}
|
|
@@ -625,7 +659,7 @@ index af7da5654b807f8e9d8693cd45aad32a162a4765..0555ac8faebbe0d3dae8e758a0e6b51d
|
|
|
625
659
|
if (this._daemonStatus == DaemonStatus.CONNECTED) {
|
|
626
660
|
return;
|
|
627
661
|
}
|
|
628
|
-
@@ -915,6 +
|
|
662
|
+
@@ -915,6 +992,10 @@ class DaemonClient {
|
|
629
663
|
}
|
|
630
664
|
}
|
|
631
665
|
if (!probe.available) {
|
|
@@ -636,7 +670,7 @@ index af7da5654b807f8e9d8693cd45aad32a162a4765..0555ac8faebbe0d3dae8e758a0e6b51d
|
|
|
636
670
|
// Carried as a value so no other caller's probe can substitute for it.
|
|
637
671
|
daemonPid = await this.startInBackground(probe.refusal);
|
|
638
672
|
}
|
|
639
|
-
@@ -953,17 +
|
|
673
|
+
@@ -953,17 +1034,36 @@ class DaemonClient {
|
|
640
674
|
}
|
|
641
675
|
}
|
|
642
676
|
async sendToDaemonViaQueue(messageToDaemon, spinner) {
|
|
@@ -683,7 +717,7 @@ index af7da5654b807f8e9d8693cd45aad32a162a4765..0555ac8faebbe0d3dae8e758a0e6b51d
|
|
|
683
717
|
}
|
|
684
718
|
setUpConnection() {
|
|
685
719
|
const socketPath = this.getSocketPath();
|
|
686
|
-
@@ -972,7 +
|
|
720
|
+
@@ -972,7 +1072,13 @@ class DaemonClient {
|
|
687
721
|
// sendMessageToDaemon method uses a keep-alive setTimeout to
|
|
688
722
|
// explicitly hold the event loop open while awaiting a response.
|
|
689
723
|
socket.unref();
|
|
@@ -698,7 +732,7 @@ index af7da5654b807f8e9d8693cd45aad32a162a4765..0555ac8faebbe0d3dae8e758a0e6b51d
|
|
|
698
732
|
// it's ok for the daemon to terminate if the client doesn't wait on
|
|
699
733
|
// any messages from the daemon
|
|
700
734
|
if (this.queue.isEmpty()) {
|
|
701
|
-
@@ -1018,12 +
|
|
735
|
+
@@ -1018,12 +1124,22 @@ class DaemonClient {
|
|
702
736
|
else {
|
|
703
737
|
error = daemonProcessException(err.toString());
|
|
704
738
|
}
|
|
@@ -721,7 +755,7 @@ index af7da5654b807f8e9d8693cd45aad32a162a4765..0555ac8faebbe0d3dae8e758a0e6b51d
|
|
|
721
755
|
// A plugin worker cannot bring a daemon back — `startInBackground` throws
|
|
722
756
|
// in one — and it is usually hosted by the daemon that just died, so the
|
|
723
757
|
// 60s reconnect poll almost always ends in the same failure. Make the loss
|
|
724
|
-
@@ -1066,16 +
|
|
758
|
+
@@ -1066,16 +1182,18 @@ class DaemonClient {
|
|
725
759
|
}
|
|
726
760
|
}
|
|
727
761
|
catch (err) {
|
|
@@ -748,7 +782,7 @@ index af7da5654b807f8e9d8693cd45aad32a162a4765..0555ac8faebbe0d3dae8e758a0e6b51d
|
|
|
748
782
|
throw err;
|
|
749
783
|
}
|
|
750
784
|
}
|
|
751
|
-
@@ -1137,14 +
|
|
785
|
+
@@ -1137,14 +1255,31 @@ class DaemonClient {
|
|
752
786
|
return { available: false, refusal };
|
|
753
787
|
}
|
|
754
788
|
async sendMessageToDaemon(message) {
|
|
@@ -780,7 +814,7 @@ index af7da5654b807f8e9d8693cd45aad32a162a4765..0555ac8faebbe0d3dae8e758a0e6b51d
|
|
|
780
814
|
return new Promise((resolve, reject) => {
|
|
781
815
|
perf_hooks_1.performance.mark('sendMessageToDaemon-start');
|
|
782
816
|
// An open promise isn't enough to keep the event loop
|
|
783
|
-
@@ -1155,12 +
|
|
817
|
+
@@ -1155,12 +1290,25 @@ class DaemonClient {
|
|
784
818
|
keepAlive = setTimeout(() => {
|
|
785
819
|
reject(new Error('The daemon timed out while processing ' + message.type));
|
|
786
820
|
}, 20 * 60 * 1000);
|
|
@@ -806,7 +840,7 @@ index af7da5654b807f8e9d8693cd45aad32a162a4765..0555ac8faebbe0d3dae8e758a0e6b51d
|
|
|
806
840
|
});
|
|
807
841
|
}
|
|
808
842
|
async registerDaemonProcessWithMetricsService(daemonPid) {
|
|
809
|
-
@@ -1194,7 +
|
|
843
|
+
@@ -1194,7 +1342,13 @@ class DaemonClient {
|
|
810
844
|
console[parsedResult.level](parsedResult.message);
|
|
811
845
|
return;
|
|
812
846
|
}
|
|
@@ -821,7 +855,7 @@ index af7da5654b807f8e9d8693cd45aad32a162a4765..0555ac8faebbe0d3dae8e758a0e6b51d
|
|
|
821
855
|
this.currentReject(parsedResult.error);
|
|
822
856
|
}
|
|
823
857
|
else {
|
|
824
|
-
@@ -1271,8 +
|
|
858
|
+
@@ -1271,8 +1425,11 @@ class DaemonClient {
|
|
825
859
|
*/
|
|
826
860
|
const { available, refusal: polled } = await this.waitForServerToBeAvailable({ ignoreVersionMismatch: true });
|
|
827
861
|
if (available) {
|
|
@@ -835,7 +869,7 @@ index af7da5654b807f8e9d8693cd45aad32a162a4765..0555ac8faebbe0d3dae8e758a0e6b51d
|
|
|
835
869
|
}
|
|
836
870
|
else {
|
|
837
871
|
// A permission refusal from either source wins, then the poll's errno,
|
|
838
|
-
@@ -1300,19 +
|
|
872
|
+
@@ -1300,19 +1457,31 @@ class DaemonClient {
|
|
839
873
|
].join('\n'));
|
|
840
874
|
}
|
|
841
875
|
}
|
|
@@ -877,7 +911,7 @@ index af7da5654b807f8e9d8693cd45aad32a162a4765..0555ac8faebbe0d3dae8e758a0e6b51d
|
|
|
877
911
|
}
|
|
878
912
|
}
|
|
879
913
|
(0, tmp_dir_1.removeSocketDir)();
|
|
880
|
-
@@ -1339,6 +
|
|
914
|
+
@@ -1339,6 +1508,59 @@ function isDocker() {
|
|
881
915
|
function nxJsonIsNotPresent() {
|
|
882
916
|
return !(0, nx_json_1.hasNxJson)(workspace_root_1.workspaceRoot);
|
|
883
917
|
}
|
|
@@ -938,7 +972,7 @@ index af7da5654b807f8e9d8693cd45aad32a162a4765..0555ac8faebbe0d3dae8e758a0e6b51d
|
|
|
938
972
|
* The operating system refused the connection. Most often the socket belongs to
|
|
939
973
|
* another user, which is the guarantee the owner-only socket directory buys —
|
|
940
974
|
diff --git a/dist/src/daemon/client/daemon-environment.d.ts b/dist/src/daemon/client/daemon-environment.d.ts
|
|
941
|
-
index 65ae9cfd686c3c676cf321cf402bbbf03fc87dab..
|
|
975
|
+
index 65ae9cfd686c3c676cf321cf402bbbf03fc87dab..7e79adfe9efef8a58674757be0380f6e9c34f043 100644
|
|
942
976
|
--- a/dist/src/daemon/client/daemon-environment.d.ts
|
|
943
977
|
+++ b/dist/src/daemon/client/daemon-environment.d.ts
|
|
944
978
|
@@ -3,7 +3,9 @@
|
|
@@ -952,7 +986,7 @@ index 65ae9cfd686c3c676cf321cf402bbbf03fc87dab..9a68ae94318403ce70aef08f08a3af9c
|
|
|
952
986
|
*/
|
|
953
987
|
export declare function hashDaemonClientEnv(): string;
|
|
954
988
|
export declare function getDaemonEnv(): NodeJS.ProcessEnv & {
|
|
955
|
-
@@ -63,12 +65,
|
|
989
|
+
@@ -63,12 +65,32 @@ export declare function getAppliedDaemonClientEnv(): {
|
|
956
990
|
*/
|
|
957
991
|
export declare function applyDaemonEnvFromClient(newEnv: NodeJS.ProcessEnv): string[];
|
|
958
992
|
/**
|
|
@@ -982,13 +1016,17 @@ index 65ae9cfd686c3c676cf321cf402bbbf03fc87dab..9a68ae94318403ce70aef08f08a3af9c
|
|
|
982
1016
|
+ * `bun-node-<hash>` directory whose `node` is Bun, puts it on PATH and names
|
|
983
1017
|
+ * it in NODE; that directory leaves PATH with NODE when its `node` is the one
|
|
984
1018
|
+ * PATH resolves. Any other NODE stays, and so does every other PATH entry.
|
|
1019
|
+
+ * - A run's mbx reservation endpoint (`MBX_RESERVATIONS_SOCKET`, or
|
|
1020
|
+
+ * `BOUNDED_EXEC_RESERVATIONS_UNSERVED` when it did not start): the endpoint
|
|
1021
|
+
+ * of one Nx run, fresh for each, which every task inherits and no plugin
|
|
1022
|
+
+ * reads. It leaves the identity; the daemon still receives it.
|
|
985
1023
|
+ * The order of the remaining PATH entries is kept. Returns a copy; never
|
|
986
1024
|
+ * mutates runtime env.
|
|
987
1025
|
*/
|
|
988
1026
|
export declare function normalizeDaemonEnvironmentForGraph(env: NodeJS.ProcessEnv, platform?: NodeJS.Platform): NodeJS.ProcessEnv;
|
|
989
1027
|
export declare function getChangedEnvKeys(before: NodeJS.ProcessEnv, after: NodeJS.ProcessEnv): string[];
|
|
990
1028
|
diff --git a/dist/src/daemon/client/daemon-environment.js b/dist/src/daemon/client/daemon-environment.js
|
|
991
|
-
index 427ced7822fb05ba966d0543c224c5760b016572..
|
|
1029
|
+
index 427ced7822fb05ba966d0543c224c5760b016572..4f07a52210d000864d12dcc4a5bdff55b5ee5bcb 100644
|
|
992
1030
|
--- a/dist/src/daemon/client/daemon-environment.js
|
|
993
1031
|
+++ b/dist/src/daemon/client/daemon-environment.js
|
|
994
1032
|
@@ -8,7 +8,10 @@ exports.getAppliedDaemonClientEnv = getAppliedDaemonClientEnv;
|
|
@@ -1022,10 +1060,20 @@ index 427ced7822fb05ba966d0543c224c5760b016572..303548db369472e0f99f31c3bc66ae9b
|
|
|
1022
1060
|
}
|
|
1023
1061
|
/**
|
|
1024
1062
|
* `NX_LOAD_DOT_ENV_FILES` as its meaning rather than its spelling. `run-command`
|
|
1025
|
-
@@ -
|
|
1026
|
-
return [...changedKeys];
|
|
1063
|
+
@@ -380,35 +385,185 @@ function applyDaemonEnvFromClient(newEnv) {
|
|
1027
1064
|
}
|
|
1028
1065
|
const BERRY_BIN_FOLDER_GRAPH_IDENTITY = '<YARN_BERRY_BIN_FOLDER>';
|
|
1066
|
+
/**
|
|
1067
|
+
- * Yarn Berry creates a fresh BERRY_BIN_FOLDER for every invocation and puts it
|
|
1068
|
+
- * first on PATH. The wrappers inside are runtime state the daemon and workers
|
|
1069
|
+
- * must receive, but the folder's random name is not project-graph identity:
|
|
1070
|
+
- * two invocations whose environments differ only by it would compute the same
|
|
1071
|
+
- * graph. Strips the folder from PATH and pins the var to a sentinel so such
|
|
1072
|
+
- * environments compare equal. Returns a copy; never mutates runtime env.
|
|
1073
|
+
+ * What a run's task hooks publish for its tasks: the endpoint of the run's mbx
|
|
1074
|
+
+ * reservations, or why it has none. Fresh for each run, and read by no plugin.
|
|
1075
|
+
+ */
|
|
1076
|
+
+const RUN_RESERVATION_ENV = ['MBX_RESERVATIONS_SOCKET', 'BOUNDED_EXEC_RESERVATIONS_UNSERVED'];
|
|
1029
1077
|
+/** The directory Bun makes for one run when it finds no `node` on PATH. */
|
|
1030
1078
|
+const BUN_NODE_SHIM = /^bun-node-[0-9a-f]+$/;
|
|
1031
1079
|
+/** Errors that prove a path names nothing; any other leaves it unknown. */
|
|
@@ -1108,13 +1156,7 @@ index 427ced7822fb05ba966d0543c224c5760b016572..303548db369472e0f99f31c3bc66ae9b
|
|
|
1108
1156
|
+ }
|
|
1109
1157
|
+ return { workspace: locate(workspaceRoot, paths), entries: located, resolvedNode };
|
|
1110
1158
|
+}
|
|
1111
|
-
|
|
1112
|
-
- * Yarn Berry creates a fresh BERRY_BIN_FOLDER for every invocation and puts it
|
|
1113
|
-
- * first on PATH. The wrappers inside are runtime state the daemon and workers
|
|
1114
|
-
- * must receive, but the folder's random name is not project-graph identity:
|
|
1115
|
-
- * two invocations whose environments differ only by it would compute the same
|
|
1116
|
-
- * graph. Strips the folder from PATH and pins the var to a sentinel so such
|
|
1117
|
-
- * environments compare equal. Returns a copy; never mutates runtime env.
|
|
1159
|
+
+/**
|
|
1118
1160
|
+ * An env as project-graph identity: the env without what a package manager
|
|
1119
1161
|
+ * adds to run one command in this workspace. The daemon and its workers still
|
|
1120
1162
|
+ * receive all of it, but two clients whose envs differ only by it compute the
|
|
@@ -1135,6 +1177,10 @@ index 427ced7822fb05ba966d0543c224c5760b016572..303548db369472e0f99f31c3bc66ae9b
|
|
|
1135
1177
|
+ * `bun-node-<hash>` directory whose `node` is Bun, puts it on PATH and names
|
|
1136
1178
|
+ * it in NODE; that directory leaves PATH with NODE when its `node` is the one
|
|
1137
1179
|
+ * PATH resolves. Any other NODE stays, and so does every other PATH entry.
|
|
1180
|
+
+ * - A run's mbx reservation endpoint (`MBX_RESERVATIONS_SOCKET`, or
|
|
1181
|
+
+ * `BOUNDED_EXEC_RESERVATIONS_UNSERVED` when it did not start): the endpoint
|
|
1182
|
+
+ * of one Nx run, fresh for each, which every task inherits and no plugin
|
|
1183
|
+
+ * reads. It leaves the identity; the daemon still receives it.
|
|
1138
1184
|
+ * The order of the remaining PATH entries is kept. Returns a copy; never
|
|
1139
1185
|
+ * mutates runtime env.
|
|
1140
1186
|
*/
|
|
@@ -1157,6 +1203,17 @@ index 427ced7822fb05ba966d0543c224c5760b016572..303548db369472e0f99f31c3bc66ae9b
|
|
|
1157
1203
|
+ if (normalized.BERRY_BIN_FOLDER) {
|
|
1158
1204
|
+ scaffolding.add(canonicalize(normalized.BERRY_BIN_FOLDER));
|
|
1159
1205
|
+ normalized.BERRY_BIN_FOLDER = BERRY_BIN_FOLDER_GRAPH_IDENTITY;
|
|
1206
|
+
}
|
|
1207
|
+
- const pathKey = Object.keys(normalized).find((key) => key.toUpperCase() === 'PATH');
|
|
1208
|
+
- if (pathKey && normalized[pathKey]) {
|
|
1209
|
+
- const pathDelimiter = platform === 'win32' ? ';' : ':';
|
|
1210
|
+
- const canonicalize = (value) => {
|
|
1211
|
+
- const withPlatformSeparators = platform === 'win32' ? value.replaceAll('/', '\\') : value;
|
|
1212
|
+
- return platform === 'win32'
|
|
1213
|
+
- ? withPlatformSeparators.toLowerCase()
|
|
1214
|
+
- : withPlatformSeparators;
|
|
1215
|
+
+ for (const key of RUN_RESERVATION_ENV) {
|
|
1216
|
+
+ delete normalized[key];
|
|
1160
1217
|
+ }
|
|
1161
1218
|
+ if (normalized.NODE && facts.resolvedNode !== undefined) {
|
|
1162
1219
|
+ const node = canonicalize(normalized.NODE);
|
|
@@ -1171,15 +1228,7 @@ index 427ced7822fb05ba966d0543c224c5760b016572..303548db369472e0f99f31c3bc66ae9b
|
|
|
1171
1228
|
+ }
|
|
1172
1229
|
+ delete normalized.NODE;
|
|
1173
1230
|
+ }
|
|
1174
|
-
|
|
1175
|
-
- const pathKey = Object.keys(normalized).find((key) => key.toUpperCase() === 'PATH');
|
|
1176
|
-
- if (pathKey && normalized[pathKey]) {
|
|
1177
|
-
- const pathDelimiter = platform === 'win32' ? ';' : ':';
|
|
1178
|
-
- const canonicalize = (value) => {
|
|
1179
|
-
- const withPlatformSeparators = platform === 'win32' ? value.replaceAll('/', '\\') : value;
|
|
1180
|
-
- return platform === 'win32'
|
|
1181
|
-
- ? withPlatformSeparators.toLowerCase()
|
|
1182
|
-
- : withPlatformSeparators;
|
|
1231
|
+
+ }
|
|
1183
1232
|
+ if (entries.length > 0) {
|
|
1184
1233
|
+ const within = (path, directory) => path === directory ||
|
|
1185
1234
|
+ path.startsWith(directory.endsWith(paths.sep) ? directory : directory + paths.sep);
|
|
@@ -1304,6 +1353,51 @@ index e7a63499d18a3a8896fb117591356c3bb138032a..8d03082ada878fedd70c6245791f4c69
|
|
|
1304
1353
|
}
|
|
1305
1354
|
/**
|
|
1306
1355
|
* Throws on a message this receiver must not act on. The daemon catches it and
|
|
1356
|
+
diff --git a/dist/src/daemon/message-types/run-tasks-execution-hooks.d.ts b/dist/src/daemon/message-types/run-tasks-execution-hooks.d.ts
|
|
1357
|
+
deleted file mode 100644
|
|
1358
|
+
index f3986f288394dd45b36ee70c3e8cd5b0230c3391..0000000000000000000000000000000000000000
|
|
1359
|
+
--- a/dist/src/daemon/message-types/run-tasks-execution-hooks.d.ts
|
|
1360
|
+
+++ /dev/null
|
|
1361
|
+
@@ -1,14 +0,0 @@
|
|
1362
|
+
-import type { PreTasksExecutionContext } from '../../project-graph/plugins';
|
|
1363
|
+
-import type { MaybeStubbedPostTasksExecutionContext } from '../../project-graph/plugins/task-results-stub';
|
|
1364
|
+
-export declare const PRE_TASKS_EXECUTION: 'PRE_TASKS_EXECUTION';
|
|
1365
|
+
-export declare const POST_TASKS_EXECUTION: 'POST_TASKS_EXECUTION';
|
|
1366
|
+
-export type HandlePreTasksExecutionMessage = {
|
|
1367
|
+
- type: typeof PRE_TASKS_EXECUTION;
|
|
1368
|
+
- context: PreTasksExecutionContext;
|
|
1369
|
+
-};
|
|
1370
|
+
-export type HandlePostTasksExecutionMessage = {
|
|
1371
|
+
- type: typeof POST_TASKS_EXECUTION;
|
|
1372
|
+
- context: MaybeStubbedPostTasksExecutionContext;
|
|
1373
|
+
-};
|
|
1374
|
+
-export declare function isHandlePreTasksExecutionMessage(message: unknown): message is HandlePreTasksExecutionMessage;
|
|
1375
|
+
-export declare function isHandlePostTasksExecutionMessage(message: unknown): message is HandlePostTasksExecutionMessage;
|
|
1376
|
+
diff --git a/dist/src/daemon/message-types/run-tasks-execution-hooks.js b/dist/src/daemon/message-types/run-tasks-execution-hooks.js
|
|
1377
|
+
deleted file mode 100644
|
|
1378
|
+
index ba3abde11e4c444339882a65e3368e6f5054f56f..0000000000000000000000000000000000000000
|
|
1379
|
+
--- a/dist/src/daemon/message-types/run-tasks-execution-hooks.js
|
|
1380
|
+
+++ /dev/null
|
|
1381
|
+
@@ -1,19 +0,0 @@
|
|
1382
|
+
-"use strict";
|
|
1383
|
+
-Object.defineProperty(exports, "__esModule", { value: true });
|
|
1384
|
+
-exports.POST_TASKS_EXECUTION = exports.PRE_TASKS_EXECUTION = void 0;
|
|
1385
|
+
-exports.isHandlePreTasksExecutionMessage = isHandlePreTasksExecutionMessage;
|
|
1386
|
+
-exports.isHandlePostTasksExecutionMessage = isHandlePostTasksExecutionMessage;
|
|
1387
|
+
-exports.PRE_TASKS_EXECUTION = 'PRE_TASKS_EXECUTION';
|
|
1388
|
+
-exports.POST_TASKS_EXECUTION = 'POST_TASKS_EXECUTION';
|
|
1389
|
+
-function isHandlePreTasksExecutionMessage(message) {
|
|
1390
|
+
- return (typeof message === 'object' &&
|
|
1391
|
+
- message !== null &&
|
|
1392
|
+
- 'type' in message &&
|
|
1393
|
+
- message['type'] === exports.PRE_TASKS_EXECUTION);
|
|
1394
|
+
-}
|
|
1395
|
+
-function isHandlePostTasksExecutionMessage(message) {
|
|
1396
|
+
- return (typeof message === 'object' &&
|
|
1397
|
+
- message !== null &&
|
|
1398
|
+
- 'type' in message &&
|
|
1399
|
+
- message['type'] === exports.POST_TASKS_EXECUTION);
|
|
1400
|
+
-}
|
|
1307
1401
|
diff --git a/dist/src/daemon/message-types/task-history.d.ts b/dist/src/daemon/message-types/task-history.d.ts
|
|
1308
1402
|
deleted file mode 100644
|
|
1309
1403
|
index cc2b606d99db19beb05d85e5ec2f13600712e7bd..0000000000000000000000000000000000000000
|
|
@@ -1364,10 +1458,10 @@ index 12c1507aec3cf894bc18c680818bf76ec1533cca..00000000000000000000000000000000
|
|
|
1364
1458
|
-}
|
|
1365
1459
|
diff --git a/dist/src/daemon/server/file-watching/watch-probe.d.ts b/dist/src/daemon/server/file-watching/watch-probe.d.ts
|
|
1366
1460
|
new file mode 100644
|
|
1367
|
-
index 0000000000000000000000000000000000000000..
|
|
1461
|
+
index 0000000000000000000000000000000000000000..2c6c035de438e7a25e5655216a53ac35c41f3385
|
|
1368
1462
|
--- /dev/null
|
|
1369
1463
|
+++ b/dist/src/daemon/server/file-watching/watch-probe.d.ts
|
|
1370
|
-
@@ -0,0 +1,
|
|
1464
|
+
@@ -0,0 +1,15 @@
|
|
1371
1465
|
+import type { WatchEvent } from '../../../native';
|
|
1372
1466
|
+/**
|
|
1373
1467
|
+ * The paths the daemon's watch must admit for its probes (`alwaysWatch`), to
|
|
@@ -1379,15 +1473,16 @@ index 0000000000000000000000000000000000000000..86526ad3fdf29ad815e3838deb54ae04
|
|
|
1379
1473
|
+export declare function takeProbeEvents(events: WatchEvent[]): WatchEvent[];
|
|
1380
1474
|
+/**
|
|
1381
1475
|
+ * Resolves `undefined` once everything written before the call has reached
|
|
1382
|
-
+ * the daemon, or the reason the watch's stream cannot be proven current.
|
|
1476
|
+
+ * the daemon, or the reason the watch's stream cannot be proven current. A
|
|
1477
|
+
+ * call that resolves `undefined` has also walked the files again.
|
|
1383
1478
|
+ */
|
|
1384
1479
|
+export declare function proveWatcherCurrent(): Promise<string | undefined>;
|
|
1385
1480
|
diff --git a/dist/src/daemon/server/file-watching/watch-probe.js b/dist/src/daemon/server/file-watching/watch-probe.js
|
|
1386
1481
|
new file mode 100644
|
|
1387
|
-
index 0000000000000000000000000000000000000000..
|
|
1482
|
+
index 0000000000000000000000000000000000000000..a3020e12bc219b7cbedb441a0a049ca8173d8c60
|
|
1388
1483
|
--- /dev/null
|
|
1389
1484
|
+++ b/dist/src/daemon/server/file-watching/watch-probe.js
|
|
1390
|
-
@@ -0,0 +1,
|
|
1485
|
+
@@ -0,0 +1,167 @@
|
|
1391
1486
|
+'use strict';
|
|
1392
1487
|
+Object.defineProperty(exports, '__esModule', { value: true });
|
|
1393
1488
|
+exports.watchProbeAdmissions = watchProbeAdmissions;
|
|
@@ -1541,6 +1636,14 @@ index 0000000000000000000000000000000000000000..84f36a3e211cb168dc3c7d6e94157d54
|
|
|
1541
1636
|
+ logger_1.serverLogger.watcherLog(
|
|
1542
1637
|
+ `watcher current: probe came back in ${(node_perf_hooks_1.performance.now() - writtenAt).toFixed(1)} ms`,
|
|
1543
1638
|
+ );
|
|
1639
|
+
+ // A probe proves the stream only from its own write on. The files the
|
|
1640
|
+
+ // daemon holds can still lack a write the stream never delivered: one its
|
|
1641
|
+
+ // boot walk read past before the stream delivered it, or one fseventsd
|
|
1642
|
+
+ // dropped, whose rescan flag can arrive after a later probe came back. So
|
|
1643
|
+
+ // every probe that comes back is followed by one walk of the files, and what
|
|
1644
|
+
+ // that walk finds changed is routed before the request is answered.
|
|
1645
|
+
+ const changed = (0, project_graph_incremental_recomputation_1.rewalkWorkspaceChanges)();
|
|
1646
|
+
+ logger_1.serverLogger.watcherLog(`files walked after the probe: ${changed} changed`);
|
|
1544
1647
|
+ return undefined;
|
|
1545
1648
|
+ } finally {
|
|
1546
1649
|
+ probesAwaited.delete(probe);
|
|
@@ -1602,6 +1705,73 @@ index 0051f7f97f0d9c05341f8cbaa7f51eb851051077..00000000000000000000000000000000
|
|
|
1602
1705
|
- description: 'handleGetEstimatedTaskTimings',
|
|
1603
1706
|
- };
|
|
1604
1707
|
-}
|
|
1708
|
+
diff --git a/dist/src/daemon/server/handle-tasks-execution-hooks.d.ts b/dist/src/daemon/server/handle-tasks-execution-hooks.d.ts
|
|
1709
|
+
deleted file mode 100644
|
|
1710
|
+
index b7a9b3637f1306a650cc3954172fe93b82c2db40..0000000000000000000000000000000000000000
|
|
1711
|
+
--- a/dist/src/daemon/server/handle-tasks-execution-hooks.d.ts
|
|
1712
|
+
+++ /dev/null
|
|
1713
|
+
@@ -1,20 +0,0 @@
|
|
1714
|
+
-import type { PreTasksExecutionContext } from '../../project-graph/plugins/public-api';
|
|
1715
|
+
-import type { MaybeStubbedPostTasksExecutionContext } from '../../project-graph/plugins/task-results-stub';
|
|
1716
|
+
-export declare function handleRunPreTasksExecution(context: PreTasksExecutionContext): Promise<{
|
|
1717
|
+
- response: NodeJS.ProcessEnv[];
|
|
1718
|
+
- description: string;
|
|
1719
|
+
- error?: undefined;
|
|
1720
|
+
-} | {
|
|
1721
|
+
- response?: undefined;
|
|
1722
|
+
- error: any;
|
|
1723
|
+
- description: string;
|
|
1724
|
+
-}>;
|
|
1725
|
+
-export declare function handleRunPostTasksExecution(context: MaybeStubbedPostTasksExecutionContext): Promise<{
|
|
1726
|
+
- error?: undefined;
|
|
1727
|
+
- response: string;
|
|
1728
|
+
- description: string;
|
|
1729
|
+
-} | {
|
|
1730
|
+
- response?: undefined;
|
|
1731
|
+
- error: any;
|
|
1732
|
+
- description: string;
|
|
1733
|
+
-}>;
|
|
1734
|
+
diff --git a/dist/src/daemon/server/handle-tasks-execution-hooks.js b/dist/src/daemon/server/handle-tasks-execution-hooks.js
|
|
1735
|
+
deleted file mode 100644
|
|
1736
|
+
index 2d5c114ed5c9b2b55acd614d8c306fabc362b408..0000000000000000000000000000000000000000
|
|
1737
|
+
--- a/dist/src/daemon/server/handle-tasks-execution-hooks.js
|
|
1738
|
+
+++ /dev/null
|
|
1739
|
+
@@ -1,35 +0,0 @@
|
|
1740
|
+
-"use strict";
|
|
1741
|
+
-Object.defineProperty(exports, "__esModule", { value: true });
|
|
1742
|
+
-exports.handleRunPreTasksExecution = handleRunPreTasksExecution;
|
|
1743
|
+
-exports.handleRunPostTasksExecution = handleRunPostTasksExecution;
|
|
1744
|
+
-const tasks_execution_hooks_1 = require("../../project-graph/plugins/tasks-execution-hooks");
|
|
1745
|
+
-async function handleRunPreTasksExecution(context) {
|
|
1746
|
+
- try {
|
|
1747
|
+
- const envs = await (0, tasks_execution_hooks_1.runPreTasksExecution)(context);
|
|
1748
|
+
- return {
|
|
1749
|
+
- response: envs,
|
|
1750
|
+
- description: 'handleRunPreTasksExecution',
|
|
1751
|
+
- };
|
|
1752
|
+
- }
|
|
1753
|
+
- catch (e) {
|
|
1754
|
+
- return {
|
|
1755
|
+
- error: e,
|
|
1756
|
+
- description: `Error when running preTasksExecution.`,
|
|
1757
|
+
- };
|
|
1758
|
+
- }
|
|
1759
|
+
-}
|
|
1760
|
+
-async function handleRunPostTasksExecution(context) {
|
|
1761
|
+
- try {
|
|
1762
|
+
- await (0, tasks_execution_hooks_1.runPostTasksExecution)(context);
|
|
1763
|
+
- return {
|
|
1764
|
+
- response: 'true',
|
|
1765
|
+
- description: 'handleRunPostTasksExecution',
|
|
1766
|
+
- };
|
|
1767
|
+
- }
|
|
1768
|
+
- catch (e) {
|
|
1769
|
+
- return {
|
|
1770
|
+
- error: e,
|
|
1771
|
+
- description: `Error when running postTasksExecution.`,
|
|
1772
|
+
- };
|
|
1773
|
+
- }
|
|
1774
|
+
-}
|
|
1605
1775
|
diff --git a/dist/src/daemon/server/latest-nx.js b/dist/src/daemon/server/latest-nx.js
|
|
1606
1776
|
index ef00ae3212498e75d6bb6371aec4b113970c0c68..06eb2bf7436cc20dad1d646be44ba99064395f3d 100644
|
|
1607
1777
|
--- a/dist/src/daemon/server/latest-nx.js
|
|
@@ -1618,11 +1788,36 @@ index ef00ae3212498e75d6bb6371aec4b113970c0c68..06eb2bf7436cc20dad1d646be44ba990
|
|
|
1618
1788
|
if (latestNxTmpPath !== null) {
|
|
1619
1789
|
logger_1.serverLogger.log('[LATEST-NX]: Reusing cached Nx installation from', latestNxTmpPath);
|
|
1620
1790
|
return latestNxTmpPath;
|
|
1791
|
+
diff --git a/dist/src/daemon/server/project-graph-incremental-recomputation.d.ts b/dist/src/daemon/server/project-graph-incremental-recomputation.d.ts
|
|
1792
|
+
index 63638e921d68af659ca03f65e82a98c1e2e3f853..b329afc3da3053a3460c44c6ae67130459e820f6 100644
|
|
1793
|
+
--- a/dist/src/daemon/server/project-graph-incremental-recomputation.d.ts
|
|
1794
|
+
+++ b/dist/src/daemon/server/project-graph-incremental-recomputation.d.ts
|
|
1795
|
+
@@ -32,6 +32,12 @@ export declare function routeAppliedChanges(batch: ChangeBatch): void;
|
|
1796
|
+
* saw is never missed.
|
|
1797
|
+
*/
|
|
1798
|
+
export declare function flushPendingWorkspaceChanges(): Promise<void>;
|
|
1799
|
+
+/**
|
|
1800
|
+
+ * Walks the workspace's files again and routes what changed against the files
|
|
1801
|
+
+ * the context held, for files no watch event vouches for. Answers how many
|
|
1802
|
+
+ * files changed.
|
|
1803
|
+
+ */
|
|
1804
|
+
+export declare function rewalkWorkspaceChanges(): number;
|
|
1805
|
+
/**
|
|
1806
|
+
* Applies changes a caller learned of on its own to the workspace context,
|
|
1807
|
+
* then schedules the recomputation as for a batch the context applied.
|
|
1621
1808
|
diff --git a/dist/src/daemon/server/project-graph-incremental-recomputation.js b/dist/src/daemon/server/project-graph-incremental-recomputation.js
|
|
1622
|
-
index 8f441c4d4258be48c9080b4ae200bf1c0034f3f1..
|
|
1809
|
+
index 8f441c4d4258be48c9080b4ae200bf1c0034f3f1..af5865170398b5da1cd43ef4f1e6118e1d77a12b 100644
|
|
1623
1810
|
--- a/dist/src/daemon/server/project-graph-incremental-recomputation.js
|
|
1624
1811
|
+++ b/dist/src/daemon/server/project-graph-incremental-recomputation.js
|
|
1625
|
-
@@ -
|
|
1812
|
+
@@ -4,6 +4,7 @@ exports.currentSourceMaps = exports.currentProjectGraph = exports.currentProject
|
|
1813
|
+
exports.getCachedSerializedProjectGraphPromise = getCachedSerializedProjectGraphPromise;
|
|
1814
|
+
exports.routeAppliedChanges = routeAppliedChanges;
|
|
1815
|
+
exports.flushPendingWorkspaceChanges = flushPendingWorkspaceChanges;
|
|
1816
|
+
+exports.rewalkWorkspaceChanges = rewalkWorkspaceChanges;
|
|
1817
|
+
exports.scheduleProjectGraphRecomputation = scheduleProjectGraphRecomputation;
|
|
1818
|
+
exports.scheduleInitialProjectGraphComputation = scheduleInitialProjectGraphComputation;
|
|
1819
|
+
exports.registerProjectGraphRecomputationListener = registerProjectGraphRecomputationListener;
|
|
1820
|
+
@@ -17,6 +18,7 @@ const error_types_1 = require("../../project-graph/error-types");
|
|
1626
1821
|
const file_map_utils_1 = require("../../project-graph/file-map-utils");
|
|
1627
1822
|
const nx_deps_cache_1 = require("../../project-graph/nx-deps-cache");
|
|
1628
1823
|
const get_plugins_1 = require("../../project-graph/plugins/get-plugins");
|
|
@@ -1630,7 +1825,7 @@ index 8f441c4d4258be48c9080b4ae200bf1c0034f3f1..7b8e536cf989571698d2b693f9ea2995
|
|
|
1630
1825
|
const retrieve_workspace_files_1 = require("../../project-graph/utils/retrieve-workspace-files");
|
|
1631
1826
|
const fileutils_1 = require("../../utils/fileutils");
|
|
1632
1827
|
const workspace_context_1 = require("../../utils/workspace-context");
|
|
1633
|
-
@@ -77,7 +
|
|
1828
|
+
@@ -77,7 +79,7 @@ function kickOffRecompute() {
|
|
1634
1829
|
// the plugin loader's) into one, so the snap hash and the plugin
|
|
1635
1830
|
// set the compute uses always reflect the same disk state.
|
|
1636
1831
|
const nxJson = (0, nx_json_1.readNxJson)(workspace_root_1.workspaceRoot);
|
|
@@ -1639,7 +1834,7 @@ index 8f441c4d4258be48c9080b4ae200bf1c0034f3f1..7b8e536cf989571698d2b693f9ea2995
|
|
|
1639
1834
|
const plugins = await (0, get_plugins_1.getPluginsSeparated)(nxJson, workspace_root_1.workspaceRoot);
|
|
1640
1835
|
// Plugin set we just loaded may already be stale vs disk.
|
|
1641
1836
|
if (isStale(myPluginsHash))
|
|
1642
|
-
@@ -118,13 +
|
|
1837
|
+
@@ -118,13 +120,13 @@ function isStale(expectedHash) {
|
|
1643
1838
|
* pointer so awaiters chain onto it.
|
|
1644
1839
|
*/
|
|
1645
1840
|
function chainToSuccessor(myPromise) {
|
|
@@ -1655,7 +1850,7 @@ index 8f441c4d4258be48c9080b4ae200bf1c0034f3f1..7b8e536cf989571698d2b693f9ea2995
|
|
|
1655
1850
|
}
|
|
1656
1851
|
async function getCachedSerializedProjectGraphPromise(socket) {
|
|
1657
1852
|
// Subscribe the requesting client to the graph-construction topic
|
|
1658
|
-
@@ -238,
|
|
1853
|
+
@@ -238,11 +240,18 @@ function summarize(files) {
|
|
1659
1854
|
}
|
|
1660
1855
|
/**
|
|
1661
1856
|
* Takes in changes the workspace context handed out: restarts the daemon if
|
|
@@ -1670,14 +1865,37 @@ index 8f441c4d4258be48c9080b4ae200bf1c0034f3f1..7b8e536cf989571698d2b693f9ea2995
|
|
|
1670
1865
|
+ const changed = (0, restart_checks_1.changedPaths)(batch);
|
|
1671
1866
|
+ if ((0, restart_checks_1.restartDaemonIfIgnoreFilesChanged)(changed) ||
|
|
1672
1867
|
+ (0, restart_checks_1.restartDaemonIfLockFilesChanged)(changed)) {
|
|
1868
|
+
+ return;
|
|
1869
|
+
+ }
|
|
1870
|
+
+ if ((0, local_plugin_source_1.invalidateLocalPluginSources)(workspace_root_1.workspaceRoot, changed)) {
|
|
1673
1871
|
return;
|
|
1674
1872
|
}
|
|
1675
|
-
+ (0, local_plugin_source_1.invalidateLocalPluginSources)(workspace_root_1.workspaceRoot, changed);
|
|
1676
1873
|
logger_1.serverLogger.watcherLog(`File changes detected (seq ${batch.seq}):\n` +
|
|
1677
|
-
|
|
1678
|
-
|
|
1874
|
+
@@ -268,6 +277,22 @@ async function flushPendingWorkspaceChanges() {
|
|
1875
|
+
}
|
|
1876
|
+
routeAppliedChanges(batch);
|
|
1877
|
+
}
|
|
1878
|
+
+/**
|
|
1879
|
+
+ * Walks the workspace's files again and routes what changed against the files
|
|
1880
|
+
+ * the context held, for files no watch event vouches for. Answers how many
|
|
1881
|
+
+ * files changed.
|
|
1882
|
+
+ */
|
|
1883
|
+
+function rewalkWorkspaceChanges() {
|
|
1884
|
+
+ if (!(0, workspace_context_1.isWatchingWorkspaceContext)())
|
|
1885
|
+
+ return 0;
|
|
1886
|
+
+ (0, workspace_context_1.rescanWorkspaceContext)(workspace_root_1.workspaceRoot);
|
|
1887
|
+
+ const batch = (0, workspace_context_1.takeAppliedWorkspaceChanges)(workspace_root_1.workspaceRoot);
|
|
1888
|
+
+ if ((0, workspace_context_1.isEmptyBatch)(batch)) {
|
|
1889
|
+
+ return 0;
|
|
1890
|
+
+ }
|
|
1891
|
+
+ routeAppliedChanges(batch);
|
|
1892
|
+
+ return batch.createdFiles.length + batch.updatedFiles.length + batch.deletedFiles.length;
|
|
1893
|
+
+}
|
|
1894
|
+
/**
|
|
1895
|
+
* Applies changes a caller learned of on its own to the workspace context,
|
|
1896
|
+
* then schedules the recomputation as for a batch the context applied.
|
|
1679
1897
|
diff --git a/dist/src/daemon/server/restart-checks.d.ts b/dist/src/daemon/server/restart-checks.d.ts
|
|
1680
|
-
index e99e10b616b35b81b1060b25eeb0acc2351c4776..
|
|
1898
|
+
index e99e10b616b35b81b1060b25eeb0acc2351c4776..66d6e21694a0a8607e7841167dd8d31c2776a5bc 100644
|
|
1681
1899
|
--- a/dist/src/daemon/server/restart-checks.d.ts
|
|
1682
1900
|
+++ b/dist/src/daemon/server/restart-checks.d.ts
|
|
1683
1901
|
@@ -1,6 +1,6 @@
|
|
@@ -1688,7 +1906,7 @@ index e99e10b616b35b81b1060b25eeb0acc2351c4776..e94e74921349d081353fc14498178cce
|
|
|
1688
1906
|
/**
|
|
1689
1907
|
* The daemon's own process file, workspace-relative. It lives under the
|
|
1690
1908
|
* hardcoded-ignored .nx/workspace-data, so the watch admits it explicitly;
|
|
1691
|
-
@@ -15,8 +15,
|
|
1909
|
+
@@ -15,8 +15,25 @@ export declare function changedPaths(batch: ChangeBatch): string[];
|
|
1692
1910
|
* needs a daemon restart to take effect. True when it stopped the daemon.
|
|
1693
1911
|
*/
|
|
1694
1912
|
export declare function restartDaemonIfIgnoreFilesChanged(paths: string[]): boolean;
|
|
@@ -1704,6 +1922,7 @@ index e99e10b616b35b81b1060b25eeb0acc2351c4776..e94e74921349d081353fc14498178cce
|
|
|
1704
1922
|
+export declare function registerDaemonForRestartChecks(server: Server, sockets: Iterable<Socket>, socketPath: string): void;
|
|
1705
1923
|
+export declare function recordInstallationBaseline(): Promise<void>;
|
|
1706
1924
|
+export declare function restartDaemonIfLockFilesChanged(paths: string[]): boolean;
|
|
1925
|
+
+export declare function restartDaemonForLocalPlugins(): void;
|
|
1707
1926
|
/**
|
|
1708
1927
|
* Stops this daemon when the events show another process has written the
|
|
1709
1928
|
* daemon's process file. True when it stopped the daemon.
|
|
@@ -1714,10 +1933,10 @@ index e99e10b616b35b81b1060b25eeb0acc2351c4776..e94e74921349d081353fc14498178cce
|
|
|
1714
1933
|
+/** Stops the daemon, naming `reason` in its log: its file watcher stopped delivering. */
|
|
1715
1934
|
+export declare function stopDaemonForStoppedWatcher(reason: string): void;
|
|
1716
1935
|
diff --git a/dist/src/daemon/server/restart-checks.js b/dist/src/daemon/server/restart-checks.js
|
|
1717
|
-
index e692c3cfc73bacf3252e117d4e895b981412f4b9..
|
|
1936
|
+
index e692c3cfc73bacf3252e117d4e895b981412f4b9..aca2e9b4948f89ef074e1b0ac609bc0805f8e936 100644
|
|
1718
1937
|
--- a/dist/src/daemon/server/restart-checks.js
|
|
1719
1938
|
+++ b/dist/src/daemon/server/restart-checks.js
|
|
1720
|
-
@@ -1,22 +1,
|
|
1939
|
+
@@ -1,22 +1,47 @@
|
|
1721
1940
|
"use strict";
|
|
1722
1941
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1723
1942
|
-exports.relativeServerProcess = void 0;
|
|
@@ -1725,6 +1944,7 @@ index e692c3cfc73bacf3252e117d4e895b981412f4b9..94c06c88dfac8df73dd1c12f5c09b900
|
|
|
1725
1944
|
exports.registerDaemonForRestartChecks = registerDaemonForRestartChecks;
|
|
1726
1945
|
+exports.recordInstallationBaseline = recordInstallationBaseline;
|
|
1727
1946
|
+exports.restartDaemonIfLockFilesChanged = restartDaemonIfLockFilesChanged;
|
|
1947
|
+
+exports.restartDaemonForLocalPlugins = restartDaemonForLocalPlugins;
|
|
1728
1948
|
+exports.stopDaemonIfReplaced = stopDaemonIfReplaced;
|
|
1729
1949
|
+exports.stopDaemonIfOutdated = stopDaemonIfOutdated;
|
|
1730
1950
|
+exports.stopDaemonIfWorkspaceGone = stopDaemonIfWorkspaceGone;
|
|
@@ -1770,7 +1990,7 @@ index e692c3cfc73bacf3252e117d4e895b981412f4b9..94c06c88dfac8df73dd1c12f5c09b900
|
|
|
1770
1990
|
/**
|
|
1771
1991
|
* The daemon's own process file, workspace-relative. It lives under the
|
|
1772
1992
|
* hardcoded-ignored .nx/workspace-data, so the watch admits it explicitly;
|
|
1773
|
-
@@ -45,6 +
|
|
1993
|
+
@@ -45,6 +70,8 @@ const IGNORE_FILE_NAMES = ['.gitignore', '.nxignore'];
|
|
1774
1994
|
* needs a daemon restart to take effect. True when it stopped the daemon.
|
|
1775
1995
|
*/
|
|
1776
1996
|
function restartDaemonIfIgnoreFilesChanged(paths) {
|
|
@@ -1779,7 +1999,7 @@ index e692c3cfc73bacf3252e117d4e895b981412f4b9..94c06c88dfac8df73dd1c12f5c09b900
|
|
|
1779
1999
|
for (const path of paths) {
|
|
1780
2000
|
const basename = path.slice(path.lastIndexOf('/') + 1);
|
|
1781
2001
|
if (IGNORE_FILE_NAMES.includes(basename)) {
|
|
1782
|
-
@@ -54,24 +
|
|
2002
|
+
@@ -54,24 +81,451 @@ function restartDaemonIfIgnoreFilesChanged(paths) {
|
|
1783
2003
|
}
|
|
1784
2004
|
return false;
|
|
1785
2005
|
}
|
|
@@ -2132,6 +2352,12 @@ index e692c3cfc73bacf3252e117d4e895b981412f4b9..94c06c88dfac8df73dd1c12f5c09b900
|
|
|
2132
2352
|
+ restartDaemon('LINKED_PLUGIN_CHANGED', notice);
|
|
2133
2353
|
+}
|
|
2134
2354
|
+// Applied paths have been hashed by the native workspace context; same-byte
|
|
2355
|
+
+// A local plugin this daemon loaded into its own process cannot be evicted, so
|
|
2356
|
+
+// a change to a file it loaded restarts the daemon. Clients wait for the
|
|
2357
|
+
+// successor and resend, as after a lockfile change.
|
|
2358
|
+
+function restartDaemonForLocalPlugins() {
|
|
2359
|
+
+ restartDaemon('LOCAL_PLUGIN_CHANGED');
|
|
2360
|
+
+}
|
|
2135
2361
|
+// rewrites were dropped already. No lockfile is read on this watcher path.
|
|
2136
2362
|
+function restartDaemonIfLockFilesChanged(paths) {
|
|
2137
2363
|
+ if (!paths.some((path) => LOCK_FILE_NAMES.includes(path))) {
|
|
@@ -2235,7 +2461,7 @@ index e692c3cfc73bacf3252e117d4e895b981412f4b9..94c06c88dfac8df73dd1c12f5c09b900
|
|
|
2235
2461
|
+ (0, shutdown_utils_1.handleServerProcessTerminationWithRestart)({ server: daemon.server, reason, sockets: daemon.sockets, notice });
|
|
2236
2462
|
}
|
|
2237
2463
|
diff --git a/dist/src/daemon/server/server.js b/dist/src/daemon/server/server.js
|
|
2238
|
-
index 5989aac4d2d8d860033f93d369efb54133a4d715..
|
|
2464
|
+
index 5989aac4d2d8d860033f93d369efb54133a4d715..9064121a456494d96f611ac8043b8fdf265a4ad5 100644
|
|
2239
2465
|
--- a/dist/src/daemon/server/server.js
|
|
2240
2466
|
+++ b/dist/src/daemon/server/server.js
|
|
2241
2467
|
@@ -8,16 +8,12 @@ const fs_1 = require("fs");
|
|
@@ -2255,10 +2481,11 @@ index 5989aac4d2d8d860033f93d369efb54133a4d715..c6b75a1303a3a5ffb47fc38d928dd1bf
|
|
|
2255
2481
|
const installed_nx_version_1 = require("../../utils/installed-nx-version");
|
|
2256
2482
|
const logger_1 = require("../logger");
|
|
2257
2483
|
const configure_ai_agents_1 = require("../message-types/configure-ai-agents");
|
|
2258
|
-
@@ -
|
|
2484
|
+
@@ -35,12 +31,12 @@ const glob_1 = require("../message-types/glob");
|
|
2485
|
+
const hash_glob_1 = require("../message-types/hash-glob");
|
|
2259
2486
|
const nx_console_1 = require("../message-types/nx-console");
|
|
2260
2487
|
const register_project_graph_listener_1 = require("../message-types/register-project-graph-listener");
|
|
2261
|
-
|
|
2488
|
+
-const run_tasks_execution_hooks_1 = require("../message-types/run-tasks-execution-hooks");
|
|
2262
2489
|
-const task_history_1 = require("../message-types/task-history");
|
|
2263
2490
|
const update_workspace_context_1 = require("../message-types/update-workspace-context");
|
|
2264
2491
|
const socket_utils_1 = require("../socket-utils");
|
|
@@ -2269,15 +2496,16 @@ index 5989aac4d2d8d860033f93d369efb54133a4d715..c6b75a1303a3a5ffb47fc38d928dd1bf
|
|
|
2269
2496
|
const handle_configure_ai_agents_1 = require("./handle-configure-ai-agents");
|
|
2270
2497
|
const handle_context_file_data_1 = require("./handle-context-file-data");
|
|
2271
2498
|
const handle_flush_sync_generator_changes_to_disk_1 = require("./handle-flush-sync-generator-changes-to-disk");
|
|
2272
|
-
@@ -60,
|
|
2499
|
+
@@ -60,8 +56,6 @@ const handle_outputs_tracking_1 = require("./handle-outputs-tracking");
|
|
2273
2500
|
const handle_process_in_background_1 = require("./handle-process-in-background");
|
|
2274
2501
|
const handle_request_project_graph_1 = require("./handle-request-project-graph");
|
|
2275
2502
|
const handle_request_shutdown_1 = require("./handle-request-shutdown");
|
|
2276
2503
|
-const handle_task_history_1 = require("./handle-task-history");
|
|
2277
|
-
|
|
2504
|
+
-const handle_tasks_execution_hooks_1 = require("./handle-tasks-execution-hooks");
|
|
2278
2505
|
const handle_update_workspace_context_1 = require("./handle-update-workspace-context");
|
|
2279
2506
|
const handle_watch_events_1 = require("./handle-watch-events");
|
|
2280
|
-
|
|
2507
|
+
const project_graph_incremental_recomputation_1 = require("./project-graph-incremental-recomputation");
|
|
2508
|
+
@@ -70,7 +64,6 @@ const project_graph_listener_sockets_1 = require("./project-graph-listener-socke
|
|
2281
2509
|
const shutdown_utils_1 = require("./shutdown-utils");
|
|
2282
2510
|
const sync_generators_1 = require("./sync-generators");
|
|
2283
2511
|
const workspace_context_1 = require("../../utils/workspace-context");
|
|
@@ -2285,7 +2513,7 @@ index 5989aac4d2d8d860033f93d369efb54133a4d715..c6b75a1303a3a5ffb47fc38d928dd1bf
|
|
|
2285
2513
|
let workspaceWatcherError;
|
|
2286
2514
|
global.NX_DAEMON = true;
|
|
2287
2515
|
process.env.NX_DAEMON_PROCESS = 'true';
|
|
2288
|
-
@@ -102,11 +
|
|
2516
|
+
@@ -102,11 +95,17 @@ const server = (0, net_1.createServer)(async (socket) => {
|
|
2289
2517
|
numberOfOpenConnections -= 1;
|
|
2290
2518
|
exports.openSockets.delete(socket);
|
|
2291
2519
|
logger_1.serverLogger.log(`Closed a connection. Number of open connections: ${numberOfOpenConnections}`);
|
|
@@ -2303,7 +2531,7 @@ index 5989aac4d2d8d860033f93d369efb54133a4d715..c6b75a1303a3a5ffb47fc38d928dd1bf
|
|
|
2303
2531
|
async function handleMessage(socket, data) {
|
|
2304
2532
|
if (workspaceWatcherError) {
|
|
2305
2533
|
await (0, shutdown_utils_1.respondWithErrorAndExit)(socket, `File watcher error in the workspace '${workspace_root_1.workspaceRoot}'.`, workspaceWatcherError);
|
|
2306
|
-
@@ -139,14 +
|
|
2534
|
+
@@ -139,14 +138,46 @@ async function handleMessage(socket, data) {
|
|
2307
2535
|
return;
|
|
2308
2536
|
}
|
|
2309
2537
|
}
|
|
@@ -2351,7 +2579,7 @@ index 5989aac4d2d8d860033f93d369efb54133a4d715..c6b75a1303a3a5ffb47fc38d928dd1bf
|
|
|
2351
2579
|
}
|
|
2352
2580
|
else if (payload.type === 'HASH_TASKS') {
|
|
2353
2581
|
await handleResult(socket, 'HASH_TASKS', () => (0, handle_hash_tasks_1.handleHashTasks)(payload), mode);
|
|
2354
|
-
@@ -206,15 +
|
|
2582
|
+
@@ -206,15 +237,6 @@ async function handleMessage(socket, data) {
|
|
2355
2583
|
else if ((0, hash_glob_1.isHandleHashMultiGlobMessage)(payload)) {
|
|
2356
2584
|
await handleResult(socket, hash_glob_1.HASH_GLOB, () => (0, handle_hash_glob_1.handleHashMultiGlob)(payload.globGroups), mode);
|
|
2357
2585
|
}
|
|
@@ -2367,7 +2595,20 @@ index 5989aac4d2d8d860033f93d369efb54133a4d715..c6b75a1303a3a5ffb47fc38d928dd1bf
|
|
|
2367
2595
|
else if ((0, force_shutdown_1.isHandleForceShutdownMessage)(payload)) {
|
|
2368
2596
|
await handleResult(socket, 'FORCE_SHUTDOWN', () => (0, handle_force_shutdown_1.handleForceShutdown)(server), mode);
|
|
2369
2597
|
}
|
|
2370
|
-
@@ -
|
|
2598
|
+
@@ -236,12 +258,6 @@ async function handleMessage(socket, data) {
|
|
2599
|
+
else if ((0, update_workspace_context_1.isHandleUpdateWorkspaceContextMessage)(payload)) {
|
|
2600
|
+
await handleResult(socket, update_workspace_context_1.UPDATE_WORKSPACE_CONTEXT, () => (0, handle_update_workspace_context_1.handleUpdateWorkspaceContext)(payload.createdFiles, payload.updatedFiles, payload.deletedFiles), mode);
|
|
2601
|
+
}
|
|
2602
|
+
- else if ((0, run_tasks_execution_hooks_1.isHandlePreTasksExecutionMessage)(payload)) {
|
|
2603
|
+
- await handleResult(socket, run_tasks_execution_hooks_1.PRE_TASKS_EXECUTION, () => (0, handle_tasks_execution_hooks_1.handleRunPreTasksExecution)(payload.context), mode);
|
|
2604
|
+
- }
|
|
2605
|
+
- else if ((0, run_tasks_execution_hooks_1.isHandlePostTasksExecutionMessage)(payload)) {
|
|
2606
|
+
- await handleResult(socket, run_tasks_execution_hooks_1.POST_TASKS_EXECUTION, () => (0, handle_tasks_execution_hooks_1.handleRunPostTasksExecution)(payload.context), mode);
|
|
2607
|
+
- }
|
|
2608
|
+
else if ((0, nx_console_1.isHandleGetNxConsoleStatusMessage)(payload)) {
|
|
2609
|
+
await handleResult(socket, nx_console_1.GET_NX_CONSOLE_STATUS, () => (0, handle_nx_console_1.handleGetNxConsoleStatus)(), mode);
|
|
2610
|
+
}
|
|
2611
|
+
@@ -258,6 +274,22 @@ async function handleMessage(socket, data) {
|
|
2371
2612
|
await (0, shutdown_utils_1.respondWithErrorAndExit)(socket, `Invalid payload from the client`, new Error(`Unsupported payload sent to daemon server: ${(0, consume_messages_from_socket_1.describeMessage)(unparsedPayload, { maxBytes: 200 })}`));
|
|
2372
2613
|
}
|
|
2373
2614
|
}
|
|
@@ -2390,7 +2631,7 @@ index 5989aac4d2d8d860033f93d369efb54133a4d715..c6b75a1303a3a5ffb47fc38d928dd1bf
|
|
|
2390
2631
|
async function handleResult(socket, type, hrFn, mode, respondToError = shutdown_utils_1.respondWithErrorAndExit) {
|
|
2391
2632
|
let hr;
|
|
2392
2633
|
const startMark = new Date();
|
|
2393
|
-
@@ -283,9 +
|
|
2634
|
+
@@ -283,9 +315,10 @@ async function handleResult(socket, type, hrFn, mode, respondToError = shutdown_
|
|
2394
2635
|
logger_1.serverLogger.log(`Handled ${mode} message ${type}. Handling time: ${doneHandlingMark.getTime() - startMark.getTime()}. Response time: ${endMark.getTime() - doneHandlingMark.getTime()}.`);
|
|
2395
2636
|
}
|
|
2396
2637
|
function handleInactivityTimeout() {
|
|
@@ -2403,7 +2644,7 @@ index 5989aac4d2d8d860033f93d369efb54133a4d715..c6b75a1303a3a5ffb47fc38d928dd1bf
|
|
|
2403
2644
|
(0, shutdown_utils_1.resetInactivityTimeout)(handleInactivityTimeout);
|
|
2404
2645
|
}
|
|
2405
2646
|
else {
|
|
2406
|
-
@@ -314,35 +
|
|
2647
|
+
@@ -314,35 +347,21 @@ function registerProcessTerminationListeners() {
|
|
2407
2648
|
sockets: exports.openSockets,
|
|
2408
2649
|
}));
|
|
2409
2650
|
}
|
|
@@ -2453,7 +2694,7 @@ index 5989aac4d2d8d860033f93d369efb54133a4d715..c6b75a1303a3a5ffb47fc38d928dd1bf
|
|
|
2453
2694
|
}
|
|
2454
2695
|
}
|
|
2455
2696
|
/**
|
|
2456
|
-
@@ -365,6 +
|
|
2697
|
+
@@ -365,6 +384,10 @@ const handleWorkspaceChanges = (err, batch) => {
|
|
2457
2698
|
(0, file_watcher_sockets_1.notifyFileWatcherSocketsOfError)(error);
|
|
2458
2699
|
return;
|
|
2459
2700
|
}
|
|
@@ -2464,7 +2705,7 @@ index 5989aac4d2d8d860033f93d369efb54133a4d715..c6b75a1303a3a5ffb47fc38d928dd1bf
|
|
|
2464
2705
|
(0, project_graph_incremental_recomputation_1.routeAppliedChanges)(batch);
|
|
2465
2706
|
}
|
|
2466
2707
|
catch (err) {
|
|
2467
|
-
@@ -374,68 +
|
|
2708
|
+
@@ -374,68 +397,90 @@ const handleWorkspaceChanges = (err, batch) => {
|
|
2468
2709
|
(0, file_watcher_sockets_1.notifyFileWatcherSocketsOfError)(err);
|
|
2469
2710
|
}
|
|
2470
2711
|
};
|
|
@@ -2595,7 +2836,7 @@ index 5989aac4d2d8d860033f93d369efb54133a4d715..c6b75a1303a3a5ffb47fc38d928dd1bf
|
|
|
2595
2836
|
return new Promise(async (resolve, reject) => {
|
|
2596
2837
|
// `listen` reports a failed bind asynchronously on the server, which the
|
|
2597
2838
|
// try below cannot catch — without this an EACCES became an uncaught
|
|
2598
|
-
@@ -461,33 +
|
|
2839
|
+
@@ -461,33 +506,16 @@ async function startServer() {
|
|
2599
2840
|
// Best effort; the 0700 socket directory is the primary control.
|
|
2600
2841
|
}
|
|
2601
2842
|
}
|
|
@@ -2794,6 +3035,49 @@ index 3b0c4d67595cbff1d083f21bb6b70abeda8e377e..d87056c79d0097182de7d725a93100ea
|
|
|
2794
3035
|
});
|
|
2795
3036
|
(0, cache_1.deleteDaemonJsonProcessCache)();
|
|
2796
3037
|
(0, get_plugins_1.cleanupPlugins)();
|
|
3038
|
+
diff --git a/dist/src/daemon/server/sync-generators.js b/dist/src/daemon/server/sync-generators.js
|
|
3039
|
+
index 731ba638ab39ae3babe35db7d98ee9e66995b62f..78c9296b4322cfd8fc024a8c26aa6fe036b0ff8c 100644
|
|
3040
|
+
--- a/dist/src/daemon/server/sync-generators.js
|
|
3041
|
+
+++ b/dist/src/daemon/server/sync-generators.js
|
|
3042
|
+
@@ -90,31 +90,13 @@ function collectAndScheduleSyncGenerators(projectGraph) {
|
|
3043
|
+
scheduledGenerators.add(generator);
|
|
3044
|
+
}
|
|
3045
|
+
log('scheduling:', [...scheduledGenerators]);
|
|
3046
|
+
- if (scheduledTimeoutId) {
|
|
3047
|
+
- // we have a scheduled run already, so we don't need to do anything
|
|
3048
|
+
- return;
|
|
3049
|
+
- }
|
|
3050
|
+
- scheduledTimeoutId = setTimeout(async () => {
|
|
3051
|
+
- scheduledTimeoutId = undefined;
|
|
3052
|
+
- if (waitPeriod < 4000) {
|
|
3053
|
+
- waitPeriod = waitPeriod * 2;
|
|
3054
|
+
- }
|
|
3055
|
+
- if (scheduledGenerators.size === 0) {
|
|
3056
|
+
- // no generators to run
|
|
3057
|
+
- return;
|
|
3058
|
+
- }
|
|
3059
|
+
- // Fetch the latest graph instead of using the captured one which might be stale
|
|
3060
|
+
- const { projectGraph: latestGraph, error } = await (0, project_graph_incremental_recomputation_1.getCachedSerializedProjectGraphPromise)();
|
|
3061
|
+
- if (!latestGraph || error) {
|
|
3062
|
+
- log('Cannot run scheduled generators: graph unavailable or errored');
|
|
3063
|
+
- return;
|
|
3064
|
+
- }
|
|
3065
|
+
- const { projects } = (0, project_graph_1.readProjectsConfigurationFromProjectGraph)(latestGraph);
|
|
3066
|
+
- for (const generator of scheduledGenerators) {
|
|
3067
|
+
- syncGeneratorsCacheResultPromises.set(generator, runGenerator(generator, projects));
|
|
3068
|
+
- }
|
|
3069
|
+
- await Promise.all(syncGeneratorsCacheResultPromises.values());
|
|
3070
|
+
- }, waitPeriod);
|
|
3071
|
+
+ // Nothing runs here. A generator left in `scheduledGenerators` is stale, and
|
|
3072
|
+
+ // runs when a client asks for its changes (getFromCacheOrRunGenerators) against
|
|
3073
|
+
+ // the graph that is current then. Running each one 100 ms after every graph
|
|
3074
|
+
+ // recomputation put its synchronous work on the daemon's one event loop while
|
|
3075
|
+
+ // the client that caused the recomputation waited for its graph: 2.4 s of a cold
|
|
3076
|
+
+ // daemon's first project graph for `managed-files`, in a workspace whose clients
|
|
3077
|
+
+ // never ask for its sync changes.
|
|
3078
|
+
}
|
|
3079
|
+
async function getCachedRegisteredSyncGenerators() {
|
|
3080
|
+
log('get registered sync generators');
|
|
2797
3081
|
diff --git a/dist/src/daemon/socket-utils.d.ts b/dist/src/daemon/socket-utils.d.ts
|
|
2798
3082
|
index fb36b09efa216204d5148f5e6c1fc68f462a4929..ad6409689f42cd37e00acb2488972005a9d9f667 100644
|
|
2799
3083
|
--- a/dist/src/daemon/socket-utils.d.ts
|
|
@@ -2880,6 +3164,330 @@ index 3aed2d0e8233491ed17cf2659fc44bd3ed74eac9..cc914c2dd0755a3ee555805b4ed085eb
|
|
|
2880
3164
|
// Prepare a serialized project graph result for sending over IPC from the server to the client
|
|
2881
3165
|
function serializeResult(error, serializedProjectGraph, serializedSourceMaps) {
|
|
2882
3166
|
// We do not want to repeat work `JSON.stringify`ing an object containing the potentially large project graph so merge as strings
|
|
3167
|
+
diff --git a/dist/src/daemon/tmp-dir.js b/dist/src/daemon/tmp-dir.js
|
|
3168
|
+
index 400e96394bbef2f44ca626a1d9445bd539674068..f31f54daa6b87d595fdf6384778313e8f5b8ecaf 100644
|
|
3169
|
+
--- a/dist/src/daemon/tmp-dir.js
|
|
3170
|
+
+++ b/dist/src/daemon/tmp-dir.js
|
|
3171
|
+
@@ -224,20 +224,28 @@ function assertWithinBudget(details) {
|
|
3172
|
+
`The directory set in NX_SOCKET_DIR (${details.refusedConfiguredDir}) could not be used — see the warning above — so Nx fell back to a longer path.\nPoint NX_SOCKET_DIR at a short directory your user owns.`,
|
|
3173
|
+
].join('\n'), cause === undefined ? undefined : { cause });
|
|
3174
|
+
}
|
|
3175
|
+
+/*
|
|
3176
|
+
+ * Every resolver below hands the native side `process.env`, the environment Nx
|
|
3177
|
+
+ * reads its configuration from everywhere else. Given none, the native side
|
|
3178
|
+
+ * reads the C environment, which under Bun an assignment to `process.env` never
|
|
3179
|
+
+ * reaches: a Bun process that points `process.env.NX_SOCKET_DIR` at another
|
|
3180
|
+
+ * workspace (a wrapper entered from another workspace's shell) would bind its
|
|
3181
|
+
+ * plugin workers in the directory it inherited.
|
|
3182
|
+
+ */
|
|
3183
|
+
/** The daemon's own socket. */
|
|
3184
|
+
function getDaemonSocketPath() {
|
|
3185
|
+
- return adopt((0, native_1.resolveDaemonSocketPath)(workspace_root_1.workspaceRoot));
|
|
3186
|
+
+ return adopt((0, native_1.resolveDaemonSocketPath)(workspace_root_1.workspaceRoot, process.env));
|
|
3187
|
+
}
|
|
3188
|
+
/** A forked task process's socket, in the daemon's per-run directory. */
|
|
3189
|
+
function getForkedProcessSocketPath(id) {
|
|
3190
|
+
- return adopt((0, native_1.resolveForkedProcessSocketPath)(workspace_root_1.workspaceRoot, id));
|
|
3191
|
+
+ return adopt((0, native_1.resolveForkedProcessSocketPath)(workspace_root_1.workspaceRoot, id, process.env));
|
|
3192
|
+
}
|
|
3193
|
+
/**
|
|
3194
|
+
* Plugin worker sockets get their own workspace-scoped directory rather than
|
|
3195
|
+
* sitting in the shared system temp dir, which cannot be locked down.
|
|
3196
|
+
*/
|
|
3197
|
+
function getPluginSocketPath(id) {
|
|
3198
|
+
- return adopt((0, native_1.resolvePluginSocketPath)(workspace_root_1.workspaceRoot, id));
|
|
3199
|
+
+ return adopt((0, native_1.resolvePluginSocketPath)(workspace_root_1.workspaceRoot, id, process.env));
|
|
3200
|
+
}
|
|
3201
|
+
/**
|
|
3202
|
+
* Where the Nx Console socket lives, for whoever binds or connects to it.
|
|
3203
|
+
@@ -251,12 +259,12 @@ function getPluginSocketPath(id) {
|
|
3204
|
+
* load a workspace `.env` into a copy rather than into `process.env`
|
|
3205
|
+
*/
|
|
3206
|
+
function getNxConsoleSocketPath(workspaceRootOverride, env) {
|
|
3207
|
+
- return adopt((0, native_1.resolveNxConsoleSocketPath)(workspaceRootOverride ?? workspace_root_1.workspaceRoot, env));
|
|
3208
|
+
+ return adopt((0, native_1.resolveNxConsoleSocketPath)(workspaceRootOverride ?? workspace_root_1.workspaceRoot, env ?? process.env));
|
|
3209
|
+
}
|
|
3210
|
+
function removeSocketDir() {
|
|
3211
|
+
try {
|
|
3212
|
+
// The directory, not the socket: the daemon's whole per-run directory goes.
|
|
3213
|
+
- (0, node_fs_1.rmSync)((0, native_1.resolveDaemonSocketPath)(workspace_root_1.workspaceRoot).dir, {
|
|
3214
|
+
+ (0, node_fs_1.rmSync)((0, native_1.resolveDaemonSocketPath)(workspace_root_1.workspaceRoot, process.env).dir, {
|
|
3215
|
+
recursive: true,
|
|
3216
|
+
force: true,
|
|
3217
|
+
});
|
|
3218
|
+
diff --git a/dist/src/executors/run-commands/running-tasks.d.ts b/dist/src/executors/run-commands/running-tasks.d.ts
|
|
3219
|
+
index 9813a098eb17d9e799e1583a848f4e2fce945b6f..3d5dfcfc981cac0540758d15fd3fc7a600a2d1a6 100644
|
|
3220
|
+
--- a/dist/src/executors/run-commands/running-tasks.d.ts
|
|
3221
|
+
+++ b/dist/src/executors/run-commands/running-tasks.d.ts
|
|
3222
|
+
@@ -36,6 +36,7 @@ export declare class SeriallyRunningTasks implements RunningTask {
|
|
3223
|
+
private code;
|
|
3224
|
+
private error;
|
|
3225
|
+
private outputCallbacks;
|
|
3226
|
+
+ private killSignal;
|
|
3227
|
+
private exited;
|
|
3228
|
+
private exitTerminalOutput;
|
|
3229
|
+
constructor(options: NormalizedRunCommandsOptions, context: ExecutorContext, tuiEnabled: boolean, task: Pick<Task, 'id' | 'ultracache'>, baseEnv?: NodeJS.ProcessEnv);
|
|
3230
|
+
diff --git a/dist/src/executors/run-commands/running-tasks.js b/dist/src/executors/run-commands/running-tasks.js
|
|
3231
|
+
index be662a6ea68d9df1a606795b2b39934740467d54..17f40095c4eb0963d704d6fdb16fc5951e0e3b4e 100644
|
|
3232
|
+
--- a/dist/src/executors/run-commands/running-tasks.js
|
|
3233
|
+
+++ b/dist/src/executors/run-commands/running-tasks.js
|
|
3234
|
+
@@ -14,6 +14,7 @@ const pseudo_terminal_1 = require("../../tasks-runner/pseudo-terminal");
|
|
3235
|
+
const task_env_1 = require("../../tasks-runner/task-env");
|
|
3236
|
+
const tokens_1 = require("../../tasks-runner/tokens");
|
|
3237
|
+
const task_io_service_1 = require("../../tasks-runner/task-io-service");
|
|
3238
|
+
+const child_process_2 = require("../../utils/child-process");
|
|
3239
|
+
const exit_codes_1 = require("../../utils/exit-codes");
|
|
3240
|
+
const output_1 = require("../../utils/output");
|
|
3241
|
+
/**
|
|
3242
|
+
@@ -110,6 +111,12 @@ class ParallelRunningTasks {
|
|
3243
|
+
}
|
|
3244
|
+
});
|
|
3245
|
+
childProcess.onExit((code, terminalOutput) => {
|
|
3246
|
+
+ // A failed command reports only once its output is read, so
|
|
3247
|
+
+ // readyWhen text a sibling prints meanwhile must not hide it.
|
|
3248
|
+
+ if (code === 0 &&
|
|
3249
|
+
+ this.childProcesses.some((p) => p !== childProcess && p.exitedWithFailure)) {
|
|
3250
|
+
+ return;
|
|
3251
|
+
+ }
|
|
3252
|
+
res({
|
|
3253
|
+
childProcess,
|
|
3254
|
+
result: { code, terminalOutput },
|
|
3255
|
+
@@ -137,9 +144,14 @@ class ParallelRunningTasks {
|
|
3256
|
+
}
|
|
3257
|
+
else {
|
|
3258
|
+
const runningProcesses = new Set();
|
|
3259
|
+
- let hasFailure = false;
|
|
3260
|
+
- let failureDetails = null;
|
|
3261
|
+
+ let failedProcess = null;
|
|
3262
|
+
const terminalOutputs = new Map();
|
|
3263
|
+
+ const failFast = (childProcess) => {
|
|
3264
|
+
+ if (failedProcess)
|
|
3265
|
+
+ return;
|
|
3266
|
+
+ failedProcess = childProcess;
|
|
3267
|
+
+ this.terminateRemainingProcesses(runningProcesses, childProcess);
|
|
3268
|
+
+ };
|
|
3269
|
+
await Promise.allSettled(this.childProcesses.map(async (childProcess) => {
|
|
3270
|
+
runningProcesses.add(childProcess);
|
|
3271
|
+
childProcess.onOutput((terminalOutput) => {
|
|
3272
|
+
@@ -147,20 +159,20 @@ class ParallelRunningTasks {
|
|
3273
|
+
cb(terminalOutput);
|
|
3274
|
+
}
|
|
3275
|
+
});
|
|
3276
|
+
+ // Results wait for the output to drain, which a descendant holding
|
|
3277
|
+
+ // the pipes can stretch to a second.
|
|
3278
|
+
+ childProcess.onFailedExit(() => failFast(childProcess));
|
|
3279
|
+
const { code, terminalOutput } = await childProcess.getResults();
|
|
3280
|
+
terminalOutputs.set(childProcess, terminalOutput);
|
|
3281
|
+
- if (code !== 0 && !hasFailure) {
|
|
3282
|
+
- hasFailure = true;
|
|
3283
|
+
- failureDetails = { childProcess, code, terminalOutput };
|
|
3284
|
+
- // Immediately terminate all other running processes
|
|
3285
|
+
- this.terminateRemainingProcesses(runningProcesses, childProcess);
|
|
3286
|
+
+ if (code !== 0) {
|
|
3287
|
+
+ failFast(childProcess);
|
|
3288
|
+
}
|
|
3289
|
+
runningProcesses.delete(childProcess);
|
|
3290
|
+
}));
|
|
3291
|
+
let terminalOutput = Array.from(terminalOutputs.values()).join('\r\n');
|
|
3292
|
+
- if (hasFailure && failureDetails) {
|
|
3293
|
+
+ if (failedProcess) {
|
|
3294
|
+
// Add failure message
|
|
3295
|
+
- const warning = commandExitedNonZeroWarning(failureDetails.childProcess.command);
|
|
3296
|
+
+ const warning = commandExitedNonZeroWarning(failedProcess.command);
|
|
3297
|
+
terminalOutput += warning;
|
|
3298
|
+
streamChunk(warning, this.streamOutput, process.stderr);
|
|
3299
|
+
this.emitExit(1, terminalOutput);
|
|
3300
|
+
@@ -186,6 +198,9 @@ class SeriallyRunningTasks {
|
|
3301
|
+
this.baseEnv = baseEnv;
|
|
3302
|
+
this.terminalOutputChunks = [];
|
|
3303
|
+
this.currentProcess = null;
|
|
3304
|
+
+ // A command can be killed after it exits, while its output drains. The
|
|
3305
|
+
+ // signal then reaches no process, so this is what stops the next command.
|
|
3306
|
+
+ this.killSignal = null;
|
|
3307
|
+
this.exitCallbacks = [];
|
|
3308
|
+
this.code = 0;
|
|
3309
|
+
this.outputCallbacks = [];
|
|
3310
|
+
@@ -253,10 +268,15 @@ class SeriallyRunningTasks {
|
|
3311
|
+
throw new Error('Not implemented');
|
|
3312
|
+
}
|
|
3313
|
+
kill(signal) {
|
|
3314
|
+
+ this.killSignal = signal ?? 'SIGTERM';
|
|
3315
|
+
return this.currentProcess?.kill(signal);
|
|
3316
|
+
}
|
|
3317
|
+
async run(options, context) {
|
|
3318
|
+
for (const c of options.commands) {
|
|
3319
|
+
+ if (this.killSignal) {
|
|
3320
|
+
+ this.code = (0, exit_codes_1.signalToCode)(this.killSignal);
|
|
3321
|
+
+ break;
|
|
3322
|
+
+ }
|
|
3323
|
+
const childProcess = await this.createProcess(c, options.color, calculateCwd(options.cwd, context), options.processEnv ?? options.env ?? {}, this.task, options.usePty, options.streamOutput, options.tty, options.envFile, this.baseEnv);
|
|
3324
|
+
this.currentProcess = childProcess;
|
|
3325
|
+
childProcess.onOutput((output, isCommandHeader) => {
|
|
3326
|
+
@@ -349,7 +369,10 @@ class RunningNodeProcess {
|
|
3327
|
+
this.terminalOutputChunks = [];
|
|
3328
|
+
this.exitCallbacks = [];
|
|
3329
|
+
this.outputCallbacks = [];
|
|
3330
|
+
+ this.failedExitCallbacks = [];
|
|
3331
|
+
this.killPromise = null;
|
|
3332
|
+
+ // Set at 'exit', while the output may still be unread.
|
|
3333
|
+
+ this.exitedWithFailure = false;
|
|
3334
|
+
// Memoized exit so late getResults()/onExit() callers don't hang.
|
|
3335
|
+
this.exited = false;
|
|
3336
|
+
this.exitCode = 0;
|
|
3337
|
+
@@ -367,6 +390,7 @@ class RunningNodeProcess {
|
|
3338
|
+
windowsHide: true,
|
|
3339
|
+
stdio: ['inherit', 'pipe', 'pipe'],
|
|
3340
|
+
});
|
|
3341
|
+
+ this.stdioClosed = (0, child_process_2.whenStdioClosed)(this.childProcess);
|
|
3342
|
+
this.closedPromise = new Promise((resolve) => {
|
|
3343
|
+
this.childProcess.on('close', resolve);
|
|
3344
|
+
});
|
|
3345
|
+
@@ -402,6 +426,10 @@ class RunningNodeProcess {
|
|
3346
|
+
}
|
|
3347
|
+
this.exitCallbacks.push(cb);
|
|
3348
|
+
}
|
|
3349
|
+
+ /** Runs at a non-zero 'exit', before the rest of the output is read. */
|
|
3350
|
+
+ onFailedExit(cb) {
|
|
3351
|
+
+ this.failedExitCallbacks.push(cb);
|
|
3352
|
+
+ }
|
|
3353
|
+
send(message) {
|
|
3354
|
+
this.childProcess.send(message);
|
|
3355
|
+
}
|
|
3356
|
+
@@ -424,10 +452,15 @@ class RunningNodeProcess {
|
|
3357
|
+
return this.killPromise;
|
|
3358
|
+
if (!this.childProcess.pid)
|
|
3359
|
+
return Promise.resolve();
|
|
3360
|
+
+ // An exited child's pid is free for reuse, so signalling it could reach an
|
|
3361
|
+
+ // unrelated process.
|
|
3362
|
+
+ const signalled = (0, child_process_2.hasExited)(this.childProcess)
|
|
3363
|
+
+ ? Promise.resolve()
|
|
3364
|
+
+ : (0, native_1.killProcessTreeGraceful)(this.childProcess.pid, signal);
|
|
3365
|
+
// Cache the promise so concurrent callers (e.g. cleanup() after a
|
|
3366
|
+
// fire-and-forget kill from cleanUpUnneededContinuousTasks) await the
|
|
3367
|
+
// same in-progress operation instead of no-oping.
|
|
3368
|
+
- this.killPromise = (0, native_1.killProcessTreeGraceful)(this.childProcess.pid, signal).then(() =>
|
|
3369
|
+
+ this.killPromise = signalled.then(() =>
|
|
3370
|
+
// Wait for stdio drain and close events before the orchestrator
|
|
3371
|
+
// tears down the event loop via process.exit().
|
|
3372
|
+
Promise.race([
|
|
3373
|
+
@@ -451,9 +484,10 @@ class RunningNodeProcess {
|
|
3374
|
+
addListeners(commandConfig) {
|
|
3375
|
+
this.childProcess.stdout.setEncoding('utf8');
|
|
3376
|
+
this.childProcess.stderr.setEncoding('utf8');
|
|
3377
|
+
+ const exitedWithFailure = () => this.exitedWithFailure;
|
|
3378
|
+
// Separate matchers, so a ready string never spans stdout and stderr
|
|
3379
|
+
- const stdoutReady = readyWhenMatcher(this.readyWhenStatus);
|
|
3380
|
+
- const stderrReady = readyWhenMatcher(this.readyWhenStatus);
|
|
3381
|
+
+ const stdoutReady = readyWhenMatcher(this.readyWhenStatus, exitedWithFailure);
|
|
3382
|
+
+ const stderrReady = readyWhenMatcher(this.readyWhenStatus, exitedWithFailure);
|
|
3383
|
+
this.childProcess.stdout.on('data', (data) => {
|
|
3384
|
+
const output = addColorAndPrefix(data, commandConfig);
|
|
3385
|
+
this.terminalOutputChunks.push(output);
|
|
3386
|
+
@@ -485,11 +519,19 @@ class RunningNodeProcess {
|
|
3387
|
+
untrackRunningNodeProcess(this);
|
|
3388
|
+
this.emitExit(1, terminalOutput);
|
|
3389
|
+
});
|
|
3390
|
+
- this.childProcess.on('exit', (code, signal) => {
|
|
3391
|
+
+ this.childProcess.on('exit', async (code, signal) => {
|
|
3392
|
+
if (code === null) {
|
|
3393
|
+
code = (0, exit_codes_1.signalToCode)(signal);
|
|
3394
|
+
}
|
|
3395
|
+
untrackRunningNodeProcess(this);
|
|
3396
|
+
+ this.exitedWithFailure = code !== 0;
|
|
3397
|
+
+ if (this.exitedWithFailure) {
|
|
3398
|
+
+ for (const cb of this.failedExitCallbacks) {
|
|
3399
|
+
+ cb();
|
|
3400
|
+
+ }
|
|
3401
|
+
+ }
|
|
3402
|
+
+ // The last stdout and stderr chunks can still be unread at 'exit'.
|
|
3403
|
+
+ await this.stdioClosed;
|
|
3404
|
+
if (code === 0 &&
|
|
3405
|
+
this.readyWhenStatus.length &&
|
|
3406
|
+
!isReady(this.readyWhenStatus)) {
|
|
3407
|
+
@@ -591,23 +633,33 @@ function isReady(readyWhenStatus) {
|
|
3408
|
+
// The output as printed, kept across chunks, matches strings that hold escape
|
|
3409
|
+
// sequences. LogMatcher, absent from the WASM binding, matches text with
|
|
3410
|
+
// escapes inside it.
|
|
3411
|
+
-function readyWhenMatcher(readyWhenStatus) {
|
|
3412
|
+
+function readyWhenMatcher(readyWhenStatus, exitedWithFailure) {
|
|
3413
|
+
const matchers = readyWhenStatus.map((status) => ({
|
|
3414
|
+
status,
|
|
3415
|
+
matcher: native_1.IS_WASM ? null : new native_1.LogMatcher([status.stringToMatch]),
|
|
3416
|
+
tail: '',
|
|
3417
|
+
+ matched: false,
|
|
3418
|
+
}));
|
|
3419
|
+
return (chunk) => {
|
|
3420
|
+
+ // The status is shared, so only a chunk with this command's own match
|
|
3421
|
+
+ // reports ready. Once ready, only a failed command can change the result.
|
|
3422
|
+
+ if (isReady(readyWhenStatus) && !exitedWithFailure())
|
|
3423
|
+
+ return false;
|
|
3424
|
+
+ let matchedNow = false;
|
|
3425
|
+
for (const entry of matchers) {
|
|
3426
|
+
const { status, matcher } = entry;
|
|
3427
|
+
- if (status.found)
|
|
3428
|
+
+ if (entry.matched)
|
|
3429
|
+
continue;
|
|
3430
|
+
const printed = entry.tail + chunk;
|
|
3431
|
+
- status.found =
|
|
3432
|
+
+ entry.matched =
|
|
3433
|
+
printed.includes(status.stringToMatch) || !!matcher?.feed(chunk);
|
|
3434
|
+
entry.tail = printed.slice(Math.max(0, printed.length - status.stringToMatch.length + 1));
|
|
3435
|
+
+ if (entry.matched) {
|
|
3436
|
+
+ status.found = true;
|
|
3437
|
+
+ matchedNow = true;
|
|
3438
|
+
+ }
|
|
3439
|
+
}
|
|
3440
|
+
- return isReady(readyWhenStatus);
|
|
3441
|
+
+ return matchedNow && isReady(readyWhenStatus);
|
|
3442
|
+
};
|
|
3443
|
+
}
|
|
3444
|
+
function loadEnvVarsFile(path, env = {}) {
|
|
3445
|
+
diff --git a/dist/src/executors/run-script/run-script.impl.js b/dist/src/executors/run-script/run-script.impl.js
|
|
3446
|
+
index 196ee42030c875ceb3d734d9e26ed3b64b47c9b7..4ed3d5227987b9e1531cfed4fb42045b023c4544 100644
|
|
3447
|
+
--- a/dist/src/executors/run-script/run-script.impl.js
|
|
3448
|
+
+++ b/dist/src/executors/run-script/run-script.impl.js
|
|
3449
|
+
@@ -6,6 +6,7 @@ const child_process_1 = require("child_process");
|
|
3450
|
+
const path = tslib_1.__importStar(require("path"));
|
|
3451
|
+
const native_1 = require("../../native");
|
|
3452
|
+
const pseudo_terminal_1 = require("../../tasks-runner/pseudo-terminal");
|
|
3453
|
+
+const child_process_2 = require("../../utils/child-process");
|
|
3454
|
+
const package_manager_1 = require("../../utils/package-manager");
|
|
3455
|
+
async function default_1(options, context) {
|
|
3456
|
+
const pm = (0, package_manager_1.getPackageManagerCommand)();
|
|
3457
|
+
@@ -40,13 +41,16 @@ function nodeProcess(command, cwd, env) {
|
|
3458
|
+
env,
|
|
3459
|
+
windowsHide: true,
|
|
3460
|
+
});
|
|
3461
|
+
+ const stdioClosed = (0, child_process_2.whenStdioClosed)(cp);
|
|
3462
|
+
// Forward stdout/stderr to parent process
|
|
3463
|
+
cp.stdout.pipe(process.stdout);
|
|
3464
|
+
cp.stderr.pipe(process.stderr);
|
|
3465
|
+
cp.on('error', (error) => {
|
|
3466
|
+
rej(error);
|
|
3467
|
+
});
|
|
3468
|
+
- cp.on('exit', (code) => {
|
|
3469
|
+
+ cp.on('exit', async (code) => {
|
|
3470
|
+
+ // The last stdout and stderr chunks can still be unread at 'exit'.
|
|
3471
|
+
+ await stdioClosed;
|
|
3472
|
+
if (code === 0) {
|
|
3473
|
+
res();
|
|
3474
|
+
}
|
|
3475
|
+
@@ -55,9 +59,13 @@ function nodeProcess(command, cwd, env) {
|
|
3476
|
+
}
|
|
3477
|
+
});
|
|
3478
|
+
const exitHandler = (signal) => {
|
|
3479
|
+
- if (cp && cp.pid && !cp.killed) {
|
|
3480
|
+
+ // An exited child's pid is free for reuse, and its exit code decides
|
|
3481
|
+
+ // the result, also when the kill is what made it exit.
|
|
3482
|
+
+ if (cp && cp.pid && !cp.killed && !(0, child_process_2.hasExited)(cp)) {
|
|
3483
|
+
(0, native_1.killProcessTreeGraceful)(cp.pid, signal).finally(() => {
|
|
3484
|
+
- res();
|
|
3485
|
+
+ if (!(0, child_process_2.hasExited)(cp)) {
|
|
3486
|
+
+ res();
|
|
3487
|
+
+ }
|
|
3488
|
+
});
|
|
3489
|
+
}
|
|
3490
|
+
};
|
|
2883
3491
|
diff --git a/dist/src/hasher/check-task-files.js b/dist/src/hasher/check-task-files.js
|
|
2884
3492
|
index b027c02a6df7532cce64ae9684bfb76e56bf975b..ce045a0e126de3d349a10d0f367a0bdbbaad820a 100644
|
|
2885
3493
|
--- a/dist/src/hasher/check-task-files.js
|
|
@@ -2958,27 +3566,47 @@ index 1914a3eca8b47318a3aede3990836f5e757501ce..efc124fa0f23869852af305b5e77961a
|
|
|
2958
3566
|
const plansReference = this.planner.getPlansReference(taskIds, taskGraph);
|
|
2959
3567
|
return this.inspector.inspectInputs(plansReference);
|
|
2960
3568
|
}
|
|
3569
|
+
diff --git a/dist/src/hasher/native-task-hasher-impl.d.ts b/dist/src/hasher/native-task-hasher-impl.d.ts
|
|
3570
|
+
index 57d1ce513dfb13aa98579dd4929aaef84a758bf6..2e40f2aa2cf7a01e1f0b31435526c486d80b5043 100644
|
|
3571
|
+
--- a/dist/src/hasher/native-task-hasher-impl.d.ts
|
|
3572
|
+
+++ b/dist/src/hasher/native-task-hasher-impl.d.ts
|
|
3573
|
+
@@ -7,6 +7,7 @@ import type { TaskPlanningContext } from './task-planning-context';
|
|
3574
|
+
import { PartialHash, TaskHasherImpl } from './task-hasher';
|
|
3575
|
+
export declare class NativeTaskHasherImpl implements TaskHasherImpl {
|
|
3576
|
+
private readonly projectGraph;
|
|
3577
|
+
+ private readonly nxJson;
|
|
3578
|
+
hasher: TaskHasher;
|
|
3579
|
+
planner: HashPlanner;
|
|
3580
|
+
projectGraphRef: ExternalObject<NativeProjectGraph>;
|
|
2961
3581
|
diff --git a/dist/src/hasher/native-task-hasher-impl.js b/dist/src/hasher/native-task-hasher-impl.js
|
|
2962
|
-
index 5812bc2b6c931a98193985115a15d3050e2d1020..
|
|
3582
|
+
index 5812bc2b6c931a98193985115a15d3050e2d1020..af2205ff9a7ff94d490012ceb4c49878ee1faac3 100644
|
|
2963
3583
|
--- a/dist/src/hasher/native-task-hasher-impl.js
|
|
2964
3584
|
+++ b/dist/src/hasher/native-task-hasher-impl.js
|
|
2965
|
-
@@ -
|
|
3585
|
+
@@ -10,6 +10,7 @@ const overrides_1 = require("../ultracache/overrides");
|
|
3586
|
+
class NativeTaskHasherImpl {
|
|
3587
|
+
constructor(workspaceRoot, nxJson, projectGraph, externals, options, planningContext) {
|
|
3588
|
+
this.projectGraph = projectGraph;
|
|
3589
|
+
+ this.nxJson = nxJson;
|
|
3590
|
+
/**
|
|
3591
|
+
* Plans of the last up-front batch and the task graph they were built for.
|
|
3592
|
+
* The tasks that batch deferred hash from them later without planning again.
|
|
3593
|
+
@@ -50,12 +51,13 @@ class NativeTaskHasherImpl {
|
|
2966
3594
|
unplanned.some((id) => this.upfrontPlans.taskIds.has(id)) &&
|
|
2967
3595
|
this.upfrontPlans.fingerprint ===
|
|
2968
3596
|
taskGraphFingerprint(taskGraph, ultracacheConfigurations)) {
|
|
2969
3597
|
- Object.assign(hashes, this.hasher.hashPlansFor(this.upfrontPlans.plans, unplanned, envs, resolvedCwd, shouldCollectInputs));
|
|
2970
3598
|
+ const { plans } = this.upfrontPlans;
|
|
2971
|
-
+ Object.assign(hashes, nameHashFailure(unplanned, this.planner, taskGraph, () => this.hasher.hashPlansFor(plans, unplanned, envs, resolvedCwd, shouldCollectInputs)));
|
|
3599
|
+
+ Object.assign(hashes, keyOwnTargetConfiguration(nameHashFailure(unplanned, this.planner, taskGraph, () => this.hasher.hashPlansFor(plans, unplanned, envs, resolvedCwd, shouldCollectInputs)), taskGraph, this.projectGraph, this.nxJson));
|
|
2972
3600
|
unplanned = unplanned.filter((id) => !(id in hashes));
|
|
2973
3601
|
}
|
|
2974
3602
|
if (unplanned.length > 0) {
|
|
2975
3603
|
const plans = this.plan(unplanned, taskGraph, ultracacheConfigurations);
|
|
2976
3604
|
- Object.assign(hashes, this.hasher.hashPlans(plans, envs, resolvedCwd, shouldCollectInputs));
|
|
2977
|
-
+ Object.assign(hashes, nameHashFailure(unplanned, this.planner, taskGraph, () => this.hasher.hashPlans(plans, envs, resolvedCwd, shouldCollectInputs)));
|
|
3605
|
+
+ Object.assign(hashes, keyOwnTargetConfiguration(nameHashFailure(unplanned, this.planner, taskGraph, () => this.hasher.hashPlans(plans, envs, resolvedCwd, shouldCollectInputs)), taskGraph, this.projectGraph, this.nxJson));
|
|
2978
3606
|
}
|
|
2979
3607
|
return tasks.map((t) => hashes[t.id]);
|
|
2980
3608
|
}
|
|
2981
|
-
@@ -71,14 +
|
|
3609
|
+
@@ -71,14 +73,15 @@ class NativeTaskHasherImpl {
|
|
2982
3610
|
return this.planner.getPlansReference(taskIds, taskGraph, ultracacheConfigurations, (0, overrides_1.ultracacheEligibilityOptions)(this.projectGraph, taskGraph));
|
|
2983
3611
|
}
|
|
2984
3612
|
async hashTasksUpfront(tasks, taskGraph, perTaskEnvs, cwd, collectInputs, ultracacheConfigurations) {
|
|
@@ -2993,14 +3621,156 @@ index 5812bc2b6c931a98193985115a15d3050e2d1020..92095397db52325e9de4278d72958825
|
|
|
2993
3621
|
};
|
|
2994
3622
|
const shouldCollectInputs = collectInputs ?? (0, task_io_service_1.getTaskIOService)().hasTaskInputSubscribers();
|
|
2995
3623
|
- return this.hasher.hashPlansUpfront(plans, perTaskEnvs, cwd ?? process.cwd(), shouldCollectInputs);
|
|
2996
|
-
+ return nameHashFailure(taskIds, this.planner, taskGraph, () => this.hasher.hashPlansUpfront(plans, perTaskEnvs, cwd ?? process.cwd(), shouldCollectInputs));
|
|
3624
|
+
+ return keyOwnTargetConfiguration(nameHashFailure(taskIds, this.planner, taskGraph, () => this.hasher.hashPlansUpfront(plans, perTaskEnvs, cwd ?? process.cwd(), shouldCollectInputs)), taskGraph, this.projectGraph, this.nxJson);
|
|
2997
3625
|
}
|
|
2998
3626
|
}
|
|
2999
3627
|
exports.NativeTaskHasherImpl = NativeTaskHasherImpl;
|
|
3000
|
-
@@ -104,3 +
|
|
3628
|
+
@@ -104,3 +107,202 @@ function taskGraphFingerprint(taskGraph, ultracacheConfigurations) {
|
|
3001
3629
|
}
|
|
3002
3630
|
return (0, native_1.hashArray)(parts);
|
|
3003
3631
|
}
|
|
3632
|
+
+const PROJECT_CONFIGURATION = ':ProjectConfiguration';
|
|
3633
|
+
+/**
|
|
3634
|
+
+ * The native `ProjectConfiguration` node (`hash_project_config.rs`) hashes the
|
|
3635
|
+
+ * executor, outputs, options, configurations and parallelism of every target
|
|
3636
|
+
+ * of a project, so an edit to one target re-keyed every task of that project
|
|
3637
|
+
+ * and every task whose `^` inputs reach it. A task's key holds the
|
|
3638
|
+
+ * configuration it runs: the node of the task's own project hashes the
|
|
3639
|
+
+ * project's root, tags and the task's own target, and the named inputs its
|
|
3640
|
+
+ * `inputs` reach; the node of a project its `^` inputs reach hashes that
|
|
3641
|
+
+ * project's root, tags and the same named inputs. A named input is reached when
|
|
3642
|
+
+ * an input of the task names it, directly, as `^name` or as `{ input }`, or
|
|
3643
|
+
+ * when a reached named input (in nx.json or in any project) names it in turn, so
|
|
3644
|
+
+ * a named input no input of the task reaches moves no key of it: adding one to a
|
|
3645
|
+
+ * project re-keyed every task of that project, including a source build that reads
|
|
3646
|
+
+ * none. A task that declares no `inputs` keys every named input of its project.
|
|
3647
|
+
+ * The task's value folds its details again, their values in key order, as the
|
|
3648
|
+
+ * native hasher does.
|
|
3649
|
+
+ * Upstream: https://github.com/nrwl/nx/issues/37802 and the pull request that
|
|
3650
|
+
+ * fixes it; drop this once the installed Nx keys a task's own target only.
|
|
3651
|
+
+ */
|
|
3652
|
+
+function keyOwnTargetConfiguration(hashes, taskGraph, projectGraph, nxJson) {
|
|
3653
|
+
+ const configurations = new Map();
|
|
3654
|
+
+ const configuration = (project, target, reached) => {
|
|
3655
|
+
+ const id = JSON.stringify([project, target, reached === null ? null : [...reached].sort()]);
|
|
3656
|
+
+ let hashed = configurations.get(id);
|
|
3657
|
+
+ if (hashed === undefined) {
|
|
3658
|
+
+ hashed = projectConfigurationHash(projectGraph, project, target, reached);
|
|
3659
|
+
+ configurations.set(id, hashed);
|
|
3660
|
+
+ }
|
|
3661
|
+
+ return hashed;
|
|
3662
|
+
+ };
|
|
3663
|
+
+ for (const [taskId, hashed] of Object.entries(hashes)) {
|
|
3664
|
+
+ const task = taskGraph.tasks[taskId];
|
|
3665
|
+
+ if (task === undefined) {
|
|
3666
|
+
+ throw new Error(`Hashed task ${taskId} is not in the task graph it was hashed for`);
|
|
3667
|
+
+ }
|
|
3668
|
+
+ const keys = Object.keys(hashed.details).sort();
|
|
3669
|
+
+ const details = {};
|
|
3670
|
+
+ for (const key of keys) {
|
|
3671
|
+
+ if (!key.endsWith(PROJECT_CONFIGURATION)) {
|
|
3672
|
+
+ details[key] = hashed.details[key];
|
|
3673
|
+
+ continue;
|
|
3674
|
+
+ }
|
|
3675
|
+
+ const project = key.slice(0, -PROJECT_CONFIGURATION.length);
|
|
3676
|
+
+ details[key] = configuration(project, project === task.target.project ? task.target.target : null, reachedNamedInputs(task, projectGraph, nxJson));
|
|
3677
|
+
+ }
|
|
3678
|
+
+ hashes[taskId] = {
|
|
3679
|
+
+ ...hashed,
|
|
3680
|
+
+ value: (0, native_1.hashArray)(keys.map((key) => details[key])),
|
|
3681
|
+
+ details,
|
|
3682
|
+
+ };
|
|
3683
|
+
+ }
|
|
3684
|
+
+ return hashes;
|
|
3685
|
+
+}
|
|
3686
|
+
+/**
|
|
3687
|
+
+ * A project's root, tags and the named inputs in `reached` (every one when it is null), and `target`'s executor,
|
|
3688
|
+
+ * outputs, options, configurations and parallelism.
|
|
3689
|
+
+ */
|
|
3690
|
+
+function projectConfigurationHash(projectGraph, project, target, reached) {
|
|
3691
|
+
+ const node = projectGraph.nodes[project];
|
|
3692
|
+
+ if (node === undefined) {
|
|
3693
|
+
+ throw new Error(`Could not find project '${project}'`);
|
|
3694
|
+
+ }
|
|
3695
|
+
+ const { root, tags, namedInputs, targets } = node.data;
|
|
3696
|
+
+ let own = null;
|
|
3697
|
+
+ if (target !== null) {
|
|
3698
|
+
+ const configured = targets?.[target];
|
|
3699
|
+
+ if (configured === undefined) {
|
|
3700
|
+
+ throw new Error(`Project '${project}' has no target '${target}' to hash`);
|
|
3701
|
+
+ }
|
|
3702
|
+
+ own = [
|
|
3703
|
+
+ target,
|
|
3704
|
+
+ configured.executor ?? null,
|
|
3705
|
+
+ configured.outputs ?? [],
|
|
3706
|
+
+ configured.options ?? {},
|
|
3707
|
+
+ configured.configurations ?? {},
|
|
3708
|
+
+ configured.parallelism ?? null,
|
|
3709
|
+
+ ];
|
|
3710
|
+
+ }
|
|
3711
|
+
+ const inputs = Object.keys(namedInputs ?? {})
|
|
3712
|
+
+ .filter((name) => reached === null || reached.has(name))
|
|
3713
|
+
+ .sort()
|
|
3714
|
+
+ .map((name) => [name, namedInputs[name]]);
|
|
3715
|
+
+ return (0, native_1.hashArray)([JSON.stringify([root, tags ?? [], inputs, own])]);
|
|
3716
|
+
+}
|
|
3717
|
+
+/** What an input entry can name: a string that is not a file set, a glob or a negation, or an `{ input }` object. */
|
|
3718
|
+
+const NAMED_INPUT = /^[A-Za-z_][\w.-]*$/;
|
|
3719
|
+
+function namedInputsOf(entry) {
|
|
3720
|
+
+ if (typeof entry === 'string') {
|
|
3721
|
+
+ const name = entry.startsWith('^') ? entry.slice(1) : entry;
|
|
3722
|
+
+ return NAMED_INPUT.test(name) ? [name] : [];
|
|
3723
|
+
+ }
|
|
3724
|
+
+ return typeof entry?.input === 'string' ? [entry.input] : [];
|
|
3725
|
+
+}
|
|
3726
|
+
+/** Which named input names which, over nx.json and every project: a name's references are the union of its definitions. */
|
|
3727
|
+
+const namedInputReferences = new WeakMap();
|
|
3728
|
+
+function referencesOf(projectGraph, nxJson) {
|
|
3729
|
+
+ const known = namedInputReferences.get(projectGraph);
|
|
3730
|
+
+ if (known !== undefined && known.nxJson === nxJson) {
|
|
3731
|
+
+ return known.references;
|
|
3732
|
+
+ }
|
|
3733
|
+
+ const references = new Map();
|
|
3734
|
+
+ const add = (definitions) => {
|
|
3735
|
+
+ for (const [name, entries] of Object.entries(definitions ?? {})) {
|
|
3736
|
+
+ const named = references.get(name) ?? new Set();
|
|
3737
|
+
+ for (const entry of Array.isArray(entries) ? entries : []) {
|
|
3738
|
+
+ for (const reference of namedInputsOf(entry)) {
|
|
3739
|
+
+ named.add(reference);
|
|
3740
|
+
+ }
|
|
3741
|
+
+ }
|
|
3742
|
+
+ references.set(name, named);
|
|
3743
|
+
+ }
|
|
3744
|
+
+ };
|
|
3745
|
+
+ add(nxJson?.namedInputs);
|
|
3746
|
+
+ for (const node of Object.values(projectGraph.nodes)) {
|
|
3747
|
+
+ add(node.data.namedInputs);
|
|
3748
|
+
+ }
|
|
3749
|
+
+ namedInputReferences.set(projectGraph, { nxJson, references });
|
|
3750
|
+
+ return references;
|
|
3751
|
+
+}
|
|
3752
|
+
+/**
|
|
3753
|
+
+ * The named inputs a task's inputs reach, or null when it declares none to follow: no `inputs` (the planner then
|
|
3754
|
+
+ * uses its project's defaults) or an unexpanded `...`.
|
|
3755
|
+
+ */
|
|
3756
|
+
+function reachedNamedInputs(task, projectGraph, nxJson) {
|
|
3757
|
+
+ const inputs = projectGraph.nodes[task.target.project]?.data.targets?.[task.target.target]?.inputs;
|
|
3758
|
+
+ if (!Array.isArray(inputs) || inputs.includes('...')) {
|
|
3759
|
+
+ return null;
|
|
3760
|
+
+ }
|
|
3761
|
+
+ const references = referencesOf(projectGraph, nxJson);
|
|
3762
|
+
+ const reached = new Set();
|
|
3763
|
+
+ const pending = inputs.flatMap(namedInputsOf);
|
|
3764
|
+
+ while (pending.length > 0) {
|
|
3765
|
+
+ const name = pending.pop();
|
|
3766
|
+
+ if (reached.has(name)) {
|
|
3767
|
+
+ continue;
|
|
3768
|
+
+ }
|
|
3769
|
+
+ reached.add(name);
|
|
3770
|
+
+ pending.push(...(references.get(name) ?? []));
|
|
3771
|
+
+ }
|
|
3772
|
+
+ return reached;
|
|
3773
|
+
+}
|
|
3004
3774
|
+/** A refusal names this many task ids and counts the rest, as cowshed's refusals do. */
|
|
3005
3775
|
+const NAMED_TASKS = 10;
|
|
3006
3776
|
+function namedTasks(ids) {
|
|
@@ -3123,19 +3893,83 @@ index 6fa8fdb04f096837631b21a25893a714848ea922..37f16e888262892b51392c76f5d0ecea
|
|
|
3123
3893
|
}
|
|
3124
3894
|
async hashTask(task, taskGraph, env) {
|
|
3125
3895
|
return (await this.hashTasks([task], taskGraph, {
|
|
3896
|
+
diff --git a/dist/src/plugins/js/index.js b/dist/src/plugins/js/index.js
|
|
3897
|
+
index 8190f2152e5dd4beb64de47758e4b6a351511758..8cd064c681e4cde87579da4fe59c353d6439265b 100644
|
|
3898
|
+
--- a/dist/src/plugins/js/index.js
|
|
3899
|
+
+++ b/dist/src/plugins/js/index.js
|
|
3900
|
+
@@ -47,21 +47,29 @@ function internalCreateNodes(lockFile, _, context) {
|
|
3901
|
+
: (0, bun_parser_1.readBunLockFile)(lockFilePath);
|
|
3902
|
+
const lockFileHash = getLockFileHash(lockFileContents);
|
|
3903
|
+
cachedLockFile = { packageManager, lockFile, lockFileContents, lockFileHash };
|
|
3904
|
+
+ const isBunTextLock = lockFile === bun_parser_1.BUN_TEXT_LOCK_FILE;
|
|
3905
|
+
const cached = readCache(externalNodesCache, lockFileHash);
|
|
3906
|
+
+ let nodes;
|
|
3907
|
+
if (cached) {
|
|
3908
|
+
- cachedKeyMap = deserializeKeyMap(cached.keyMap, cached.nodes);
|
|
3909
|
+
- return {
|
|
3910
|
+
- externalNodes: cached.nodes,
|
|
3911
|
+
- };
|
|
3912
|
+
+ nodes = cached.nodes;
|
|
3913
|
+
+ cachedKeyMap = deserializeKeyMap(cached.keyMap, nodes);
|
|
3914
|
+
+ }
|
|
3915
|
+
+ else {
|
|
3916
|
+
+ // The persistent cache is a function of lock text, never live patch bytes.
|
|
3917
|
+
+ const parsed = isBunTextLock
|
|
3918
|
+
+ ? (0, lock_file_1.getLockFileNodesForName)(lockFile, lockFileContents, lockFileHash)
|
|
3919
|
+
+ : (0, lock_file_1.getLockFileNodes)(packageManager, lockFile, lockFileContents, lockFileHash, context);
|
|
3920
|
+
+ nodes = parsed.nodes;
|
|
3921
|
+
+ cachedKeyMap = parsed.keyMap;
|
|
3922
|
+
+ writeCache(externalNodesCache, lockFileHash, {
|
|
3923
|
+
+ nodes,
|
|
3924
|
+
+ keyMap: serializeKeyMap(cachedKeyMap),
|
|
3925
|
+
+ });
|
|
3926
|
+
}
|
|
3927
|
+
- const { nodes: externalNodes, keyMap } = (0, lock_file_1.getLockFileNodes)(packageManager, lockFile, lockFileContents, lockFileHash, context);
|
|
3928
|
+
- cachedKeyMap = keyMap;
|
|
3929
|
+
- writeCache(externalNodesCache, lockFileHash, {
|
|
3930
|
+
- nodes: externalNodes,
|
|
3931
|
+
- keyMap: serializeKeyMap(keyMap),
|
|
3932
|
+
- });
|
|
3933
|
+
return {
|
|
3934
|
+
- externalNodes,
|
|
3935
|
+
+ externalNodes: isBunTextLock
|
|
3936
|
+
+ ? (0, bun_parser_1.applyBunPatchHashes)(nodes, lockFileContents, lockFileHash, context.workspaceRoot)
|
|
3937
|
+
+ : nodes,
|
|
3938
|
+
};
|
|
3939
|
+
}
|
|
3940
|
+
const createDependencies = (_, ctx) => {
|
|
3126
3941
|
diff --git a/dist/src/plugins/js/lock-file/bun-parser.js b/dist/src/plugins/js/lock-file/bun-parser.js
|
|
3127
|
-
index 169563d598af64c8b74d00ab9815dd651650ec9d..
|
|
3942
|
+
index 169563d598af64c8b74d00ab9815dd651650ec9d..20649f44c57701a6b7aa8e3a6a8438b9949e07f9 100644
|
|
3128
3943
|
--- a/dist/src/plugins/js/lock-file/bun-parser.js
|
|
3129
3944
|
+++ b/dist/src/plugins/js/lock-file/bun-parser.js
|
|
3130
|
-
@@ -
|
|
3945
|
+
@@ -5,8 +5,10 @@ exports.readBunLockFile = readBunLockFile;
|
|
3946
|
+
exports.getBunTextLockfileDependencies = getBunTextLockfileDependencies;
|
|
3947
|
+
exports.clearCache = clearCache;
|
|
3131
3948
|
exports.getBunTextLockfileNodes = getBunTextLockfileNodes;
|
|
3949
|
+
+exports.applyBunPatchHashes = applyBunPatchHashes;
|
|
3132
3950
|
const node_child_process_1 = require("node:child_process");
|
|
3133
3951
|
const node_fs_1 = require("node:fs");
|
|
3134
3952
|
+const node_path_1 = require("node:path");
|
|
3135
3953
|
const semver_1 = require("semver");
|
|
3136
3954
|
const project_graph_1 = require("../../../config/project-graph");
|
|
3137
3955
|
const file_hasher_1 = require("../../../hasher/file-hasher");
|
|
3138
|
-
@@ -
|
|
3956
|
+
@@ -33,6 +35,7 @@ exports.BUN_TEXT_LOCK_FILE = 'bun.lock';
|
|
3957
|
+
let currentLockFileHash;
|
|
3958
|
+
let cachedParsedLockFile;
|
|
3959
|
+
let cachedPackageIndex;
|
|
3960
|
+
+let cachedExternalNodes;
|
|
3961
|
+
const keyMap = new Map();
|
|
3962
|
+
const packageVersions = new Map();
|
|
3963
|
+
const specParseCache = new Map();
|
|
3964
|
+
@@ -83,6 +86,7 @@ function clearCache() {
|
|
3965
|
+
currentLockFileHash = undefined;
|
|
3966
|
+
cachedParsedLockFile = undefined;
|
|
3967
|
+
cachedPackageIndex = undefined;
|
|
3968
|
+
+ cachedExternalNodes = undefined;
|
|
3969
|
+
keyMap.clear();
|
|
3970
|
+
packageVersions.clear();
|
|
3971
|
+
specParseCache.clear();
|
|
3972
|
+
@@ -285,8 +289,7 @@ function buildPackageIndex(lockFile) {
|
|
3139
3973
|
...workspace.peerDependencies,
|
|
3140
3974
|
};
|
|
3141
3975
|
for (const [depName, depVersion] of Object.entries(allDeps)) {
|
|
@@ -3145,7 +3979,7 @@ index 169563d598af64c8b74d00ab9815dd651650ec9d..0bd5e1f536b1e0e02843396e01b29dce
|
|
|
3145
3979
|
workspaceNames.add(depName);
|
|
3146
3980
|
}
|
|
3147
3981
|
}
|
|
3148
|
-
@@ -306,8 +
|
|
3982
|
+
@@ -306,8 +309,9 @@ function buildPackageIndex(lockFile) {
|
|
3149
3983
|
if (!name || !version) {
|
|
3150
3984
|
continue;
|
|
3151
3985
|
}
|
|
@@ -3157,6 +3991,136 @@ index 169563d598af64c8b74d00ab9815dd651650ec9d..0bd5e1f536b1e0e02843396e01b29dce
|
|
|
3157
3991
|
workspaceNames.add(name);
|
|
3158
3992
|
}
|
|
3159
3993
|
// Check if this is a workspace-specific variant (e.g., "@quz/pkg1/lodash")
|
|
3994
|
+
@@ -384,6 +388,10 @@ function parseLockFile(lockFileContent, lockFileHash) {
|
|
3995
|
+
if (result.patches && typeof result.patches !== 'object') {
|
|
3996
|
+
throw new Error('Lockfile patches section must be an object');
|
|
3997
|
+
}
|
|
3998
|
+
+ if (result.patchedDependencies !== undefined &&
|
|
3999
|
+
+ (!result.patchedDependencies || typeof result.patchedDependencies !== 'object' || Array.isArray(result.patchedDependencies))) {
|
|
4000
|
+
+ throw new Error('Lockfile patchedDependencies must map package versions to patch paths');
|
|
4001
|
+
+ }
|
|
4002
|
+
if (result.manifests && typeof result.manifests !== 'object') {
|
|
4003
|
+
throw new Error('Lockfile manifests section must be an object');
|
|
4004
|
+
}
|
|
4005
|
+
@@ -440,10 +448,11 @@ function parseLockFile(lockFileContent, lockFileHash) {
|
|
4006
|
+
function getBunTextLockfileNodes(lockFileContent, lockFileHash) {
|
|
4007
|
+
try {
|
|
4008
|
+
const { lockFile, index } = parseLockFile(lockFileContent, lockFileHash);
|
|
4009
|
+
+ if (cachedExternalNodes) return cachedExternalNodes;
|
|
4010
|
+
const nodes = {};
|
|
4011
|
+
const localPackageVersions = new Map();
|
|
4012
|
+
if (!lockFile.packages || Object.keys(lockFile.packages).length === 0) {
|
|
4013
|
+
- return nodes;
|
|
4014
|
+
+ return (cachedExternalNodes = nodes);
|
|
4015
|
+
}
|
|
4016
|
+
const packageEntries = Object.entries(lockFile.packages);
|
|
4017
|
+
for (const [packageKey, packageData] of packageEntries) {
|
|
4018
|
+
@@ -453,7 +462,7 @@ function getBunTextLockfileNodes(lockFileContent, lockFileHash) {
|
|
4019
|
+
}
|
|
4020
|
+
}
|
|
4021
|
+
createHoistedNodes(localPackageVersions, lockFile, index, keyMap, nodes);
|
|
4022
|
+
- return nodes;
|
|
4023
|
+
+ return (cachedExternalNodes = nodes);
|
|
4024
|
+
}
|
|
4025
|
+
catch (error) {
|
|
4026
|
+
if (error instanceof Error) {
|
|
4027
|
+
@@ -462,6 +471,50 @@ function getBunTextLockfileNodes(lockFileContent, lockFileHash) {
|
|
4028
|
+
throw new Error(`Failed to get Bun lockfile nodes: ${error.message}`);
|
|
4029
|
+
}
|
|
4030
|
+
}
|
|
4031
|
+
+/** Apply live patch bytes after loading the lock-only nodes, including on a cache hit. */
|
|
4032
|
+
+/** Apply live patch bytes after loading the lock-only nodes, including on a cache hit. */
|
|
4033
|
+
+function applyBunPatchHashes(nodes, lockFileContent, lockFileHash, workspaceRoot) {
|
|
4034
|
+
+ const { lockFile, index } = parseLockFile(lockFileContent, lockFileHash);
|
|
4035
|
+
+ const patches = lockFile.patchedDependencies;
|
|
4036
|
+
+ if (!patches) return nodes;
|
|
4037
|
+
+ let result = nodes;
|
|
4038
|
+
+ const byPath = new Map();
|
|
4039
|
+
+ for (const [identity, path] of Object.entries(patches)) {
|
|
4040
|
+
+ const versioned = nodes[`npm:${identity}`];
|
|
4041
|
+
+ if (!versioned) continue;
|
|
4042
|
+
+ const { packageName, version } = versioned.data;
|
|
4043
|
+
+ if (typeof path !== 'string' || path.length === 0) {
|
|
4044
|
+
+ throw new Error(`Invalid Bun patch path for ${identity}: expected a non-empty path`);
|
|
4045
|
+
+ }
|
|
4046
|
+
+ let patchHash = byPath.get(path);
|
|
4047
|
+
+ if (patchHash === undefined) {
|
|
4048
|
+
+ try {
|
|
4049
|
+
+ patchHash = (0, file_hasher_1.hashFile)((0, node_path_1.resolve)(workspaceRoot, path));
|
|
4050
|
+
+ if (patchHash == null) throw new Error('could not read its bytes');
|
|
4051
|
+
+ }
|
|
4052
|
+
+ catch (error) {
|
|
4053
|
+
+ throw new Error(`Cannot hash Bun patch ${path} for ${identity}: ${error.message}`, { cause: error });
|
|
4054
|
+
+ }
|
|
4055
|
+
+ byPath.set(path, patchHash);
|
|
4056
|
+
+ }
|
|
4057
|
+
+ if (result === nodes) result = { ...nodes };
|
|
4058
|
+
+ const withPatch = (node) => ({
|
|
4059
|
+
+ ...node,
|
|
4060
|
+
+ data: { ...node.data, hash: (0, file_hasher_1.hashArray)([node.data.hash, patchHash]) },
|
|
4061
|
+
+ });
|
|
4062
|
+
+ result[versioned.name] = withPatch(versioned);
|
|
4063
|
+
+ const hoisted = nodes[`npm:${packageName}`];
|
|
4064
|
+
+ if (hoisted?.data.version === version) {
|
|
4065
|
+
+ result[hoisted.name] = { ...hoisted, data: { ...hoisted.data, hash: result[versioned.name].data.hash } };
|
|
4066
|
+
+ }
|
|
4067
|
+
+ for (const entry of index.byName.get(packageName) ?? []) {
|
|
4068
|
+
+ if (entry.version !== version || entry.packageKey === packageName) continue;
|
|
4069
|
+
+ const alias = nodes[`npm:${entry.packageKey}`];
|
|
4070
|
+
+ if (alias?.data.version === `npm:${identity}`) result[alias.name] = withPatch(alias);
|
|
4071
|
+
+ }
|
|
4072
|
+
+ }
|
|
4073
|
+
+ return result;
|
|
4074
|
+
+}
|
|
4075
|
+
function processPackageEntry(packageKey, packageData, lockFile, index, keyMap, nodes, packageVersions) {
|
|
4076
|
+
try {
|
|
4077
|
+
if (!Array.isArray(packageData) ||
|
|
4078
|
+
diff --git a/dist/src/plugins/js/lock-file/lock-file.js b/dist/src/plugins/js/lock-file/lock-file.js
|
|
4079
|
+
index e9bc3673ce7e3ecb71e74c26633d88a4e6d9aa67..7810678810f73a20b15333c1481c653b98178e40 100644
|
|
4080
|
+
--- a/dist/src/plugins/js/lock-file/lock-file.js
|
|
4081
|
+
+++ b/dist/src/plugins/js/lock-file/lock-file.js
|
|
4082
|
+
@@ -58,7 +58,14 @@ const BUN_TEXT_LOCK_PATH = (0, node_path_1.join)(workspace_root_1.workspaceRoot,
|
|
4083
|
+
*/
|
|
4084
|
+
function getLockFileNodes(packageManager, lockFile, contents, lockFileHash, context) {
|
|
4085
|
+
try {
|
|
4086
|
+
- const packageJson = packageManager === 'yarn' || packageManager === 'bun'
|
|
4087
|
+
+ if (lockFile === bun_parser_1.BUN_TEXT_LOCK_FILE) {
|
|
4088
|
+
+ const nodes = (0, bun_parser_1.getBunTextLockfileNodes)(contents, lockFileHash);
|
|
4089
|
+
+ return {
|
|
4090
|
+
+ nodes: (0, bun_parser_1.applyBunPatchHashes)(nodes, contents, lockFileHash, context.workspaceRoot),
|
|
4091
|
+
+ keyMap: new Map(),
|
|
4092
|
+
+ };
|
|
4093
|
+
+ }
|
|
4094
|
+
+ const packageJson = packageManager === 'yarn' || lockFile === bun_parser_1.BUN_LOCK_FILE
|
|
4095
|
+
? (0, fileutils_1.readJsonFile)((0, node_path_1.join)(context.workspaceRoot, 'package.json'))
|
|
4096
|
+
: undefined;
|
|
4097
|
+
return getLockFileNodesForName(lockFile, contents, lockFileHash, packageJson);
|
|
4098
|
+
diff --git a/dist/src/plugins/js/project-graph/build-dependencies/target-project-locator.js b/dist/src/plugins/js/project-graph/build-dependencies/target-project-locator.js
|
|
4099
|
+
index 5c2bcfaa11caef956fc906f2693586cb647b1382..1eeccd1ba61ce8391596f06aafeb0452cb49cf2a 100644
|
|
4100
|
+
--- a/dist/src/plugins/js/project-graph/build-dependencies/target-project-locator.js
|
|
4101
|
+
+++ b/dist/src/plugins/js/project-graph/build-dependencies/target-project-locator.js
|
|
4102
|
+
@@ -21,7 +21,20 @@ const defaultPackageJsonResolutionCache = new Map();
|
|
4103
|
+
const experimentalNodeModules = new Set(['node:sqlite']);
|
|
4104
|
+
function isBuiltinModuleImport(importExpr) {
|
|
4105
|
+
const packageName = (0, get_package_name_from_import_path_1.getPackageNameFromImportPath)(importExpr);
|
|
4106
|
+
- return (0, node_module_1.isBuiltin)(packageName) || experimentalNodeModules.has(packageName);
|
|
4107
|
+
+ return ((0, node_module_1.isBuiltin)(packageName) ||
|
|
4108
|
+
+ experimentalNodeModules.has(packageName) ||
|
|
4109
|
+
+ isBunModuleImport(importExpr));
|
|
4110
|
+
+}
|
|
4111
|
+
+/**
|
|
4112
|
+
+ * Bun's runtime modules: `bun` and `bun:*` (`bun:test`, `bun:sqlite`, ...).
|
|
4113
|
+
+ * `isBuiltin` knows them only when Nx itself runs under Bun. A daemon under
|
|
4114
|
+
+ * Node (one an editor's Nx language server starts) took each `bun:test`
|
|
4115
|
+
+ * import for a package and looked it up through npm, TypeScript and
|
|
4116
|
+
+ * `require.resolve` from the importing directory: thousands of failed
|
|
4117
|
+
+ * `node_modules` probes per graph recompute. Upstream: nrwl/nx#37809.
|
|
4118
|
+
+ */
|
|
4119
|
+
+function isBunModuleImport(importExpr) {
|
|
4120
|
+
+ return importExpr === 'bun' || importExpr.startsWith('bun:');
|
|
4121
|
+
}
|
|
4122
|
+
// TypeScript matches the `${configDir}` template case-insensitively and only as a
|
|
4123
|
+
// prefix (commandLineParser.ts `startsWithConfigDirTemplate`).
|
|
3160
4124
|
diff --git a/dist/src/project-graph/affected/affected-tasks.js b/dist/src/project-graph/affected/affected-tasks.js
|
|
3161
4125
|
index 63d31ac684db1ae64d396771733f07fb2e562eb7..b79292b2b642e07f0092f2eb26c104bcb0fc8fb6 100644
|
|
3162
4126
|
--- a/dist/src/project-graph/affected/affected-tasks.js
|
|
@@ -3417,7 +4381,7 @@ index 93f05fdfa622883efbb45dba383fd419938a605c..34ec5d92356d4262c233dfbef88804a0
|
|
|
3417
4381
|
* Returns specified plugins (from nx.json) and default plugins (project.json,
|
|
3418
4382
|
* package.json, etc.) as separate arrays. This separation is needed for
|
|
3419
4383
|
diff --git a/dist/src/project-graph/plugins/get-plugins.js b/dist/src/project-graph/plugins/get-plugins.js
|
|
3420
|
-
index b5f180eb7c517d26c2bf8ca6377c1aeb9f69d0e7..
|
|
4384
|
+
index b5f180eb7c517d26c2bf8ca6377c1aeb9f69d0e7..109b9d9a2fe169ea8a70314dca68dddda3152a6b 100644
|
|
3421
4385
|
--- a/dist/src/project-graph/plugins/get-plugins.js
|
|
3422
4386
|
+++ b/dist/src/project-graph/plugins/get-plugins.js
|
|
3423
4387
|
@@ -4,6 +4,7 @@ exports.loadingMethod = void 0;
|
|
@@ -3438,13 +4402,15 @@ index b5f180eb7c517d26c2bf8ca6377c1aeb9f69d0e7..bca08e11b1daef7a6da85b7fdd4dbca9
|
|
|
3438
4402
|
/**
|
|
3439
4403
|
* Stuff for specified NX Plugins.
|
|
3440
4404
|
*/
|
|
3441
|
-
@@ -65,11 +69,
|
|
4405
|
+
@@ -65,11 +69,13 @@ function resetIsolationFallbackForTesting() {
|
|
3442
4406
|
isolationRefusedInThisProcess = false;
|
|
3443
4407
|
}
|
|
3444
4408
|
/**
|
|
3445
4409
|
- * Loads a plugin in a worker, falling back to this process when the worker's
|
|
3446
4410
|
- * socket was refused.
|
|
3447
|
-
+ * Loads local source
|
|
4411
|
+
+ * Loads local source where a change to it can take effect: in restartable
|
|
4412
|
+
+ * workers, or, in a daemon with isolation off, in the daemon's own process,
|
|
4413
|
+
+ * which restarts when a file it loaded changes. Installed plugins follow the
|
|
3448
4414
|
+ * isolation setting and may fall back to this process on worker socket refusal.
|
|
3449
4415
|
*
|
|
3450
4416
|
- * Isolation is preferred: it is what keeps two plugins with conflicting
|
|
@@ -3454,7 +4420,7 @@ index b5f180eb7c517d26c2bf8ca6377c1aeb9f69d0e7..bca08e11b1daef7a6da85b7fdd4dbca9
|
|
|
3454
4420
|
* been told about the Nx socket root refuses the worker's socket, and failing
|
|
3455
4421
|
* the whole command over that is worse than running the plugins here. The
|
|
3456
4422
|
* fallback is narrow on purpose. It needs a failure to start or reach the
|
|
3457
|
-
@@ -80,15 +
|
|
4423
|
+
@@ -80,15 +86,34 @@ function resetIsolationFallbackForTesting() {
|
|
3458
4424
|
* error.
|
|
3459
4425
|
*/
|
|
3460
4426
|
const loadingMethod = async (plugin, root, index) => {
|
|
@@ -3468,11 +4434,15 @@ index b5f180eb7c517d26c2bf8ca6377c1aeb9f69d0e7..bca08e11b1daef7a6da85b7fdd4dbca9
|
|
|
3468
4434
|
+ throw new error_types_1.LoadPluginError(moduleName, error);
|
|
3469
4435
|
+ }
|
|
3470
4436
|
+ const local = (0, local_plugin_source_1.localPluginPath)(root, resolved.pluginPath) !== null;
|
|
3471
|
-
+ // ESM modules cannot be evicted in-process. Local source therefore needs a
|
|
3472
|
-
+ // restartable worker even when installed plugins run in this process.
|
|
3473
4437
|
+ if (!local && (!(0, enabled_1.isIsolationEnabled)() || isolationRefusedInThisProcess)) {
|
|
3474
4438
|
return (0, in_process_loader_1.loadNxPlugin)(plugin, root, index);
|
|
3475
4439
|
}
|
|
4440
|
+
+ // ESM modules cannot be evicted in-process. A daemon with isolation off
|
|
4441
|
+
+ // holds local source itself and restarts when it changes; every other
|
|
4442
|
+
+ // process needs a restartable worker.
|
|
4443
|
+
+ if (local && !(0, enabled_1.isIsolationEnabled)() && (0, local_plugin_source_1.canHoldLocalPlugins)()) {
|
|
4444
|
+
+ return (0, local_plugin_source_1.holdLocalPlugin)(root, () => (0, in_process_loader_1.loadNxPlugin)(plugin, root, index), () => require('../../daemon/server/restart-checks').restartDaemonForLocalPlugins());
|
|
4445
|
+
+ }
|
|
3476
4446
|
// Awaited here rather than handed on, because the worker failure surfaces on
|
|
3477
4447
|
// this promise and the fallback has to happen before the caller sees it.
|
|
3478
4448
|
try {
|
|
@@ -3480,14 +4450,14 @@ index b5f180eb7c517d26c2bf8ca6377c1aeb9f69d0e7..bca08e11b1daef7a6da85b7fdd4dbca9
|
|
|
3480
4450
|
+ return await (0, isolation_1.loadIsolatedNxPlugin)(plugin, root, index, resolved);
|
|
3481
4451
|
}
|
|
3482
4452
|
catch (e) {
|
|
3483
|
-
+ // A local plugin
|
|
4453
|
+
+ // A local plugin's worker is its reload, so it has no fallback.
|
|
3484
4454
|
+ if (local) {
|
|
3485
4455
|
+ throw e;
|
|
3486
4456
|
+ }
|
|
3487
4457
|
// Proof, kept separate from policy. The errno the worker saw is what makes
|
|
3488
4458
|
// the message certain; whether that errno is also grounds for degrading is a
|
|
3489
4459
|
// different question, and conflating them made the warning assert a sandbox
|
|
3490
|
-
@@ -127,6 +
|
|
4460
|
+
@@ -127,6 +152,13 @@ const loadingMethod = async (plugin, root, index) => {
|
|
3491
4461
|
}
|
|
3492
4462
|
};
|
|
3493
4463
|
exports.loadingMethod = loadingMethod;
|
|
@@ -3501,7 +4471,7 @@ index b5f180eb7c517d26c2bf8ca6377c1aeb9f69d0e7..bca08e11b1daef7a6da85b7fdd4dbca9
|
|
|
3501
4471
|
/**
|
|
3502
4472
|
* Returns all plugins (specified + default) as a flat list.
|
|
3503
4473
|
* Specified plugins come first, followed by default plugins.
|
|
3504
|
-
@@ -147,8 +
|
|
4474
|
+
@@ -147,8 +179,8 @@ async function getPlugins(nxJson, root = workspace_root_1.workspaceRoot) {
|
|
3505
4475
|
*/
|
|
3506
4476
|
async function getPluginsSeparated(nxJson, root = workspace_root_1.workspaceRoot) {
|
|
3507
4477
|
const pluginsConfiguration = nxJson.plugins ?? [];
|
|
@@ -3512,7 +4482,7 @@ index b5f180eb7c517d26c2bf8ca6377c1aeb9f69d0e7..bca08e11b1daef7a6da85b7fdd4dbca9
|
|
|
3512
4482
|
if (cachedSeparatedPlugins &&
|
|
3513
4483
|
pluginsConfigurationHash === currentPluginsConfigurationHash) {
|
|
3514
4484
|
return cachedSeparatedPlugins;
|
|
3515
|
-
@@ -281,7 +
|
|
4485
|
+
@@ -281,7 +313,9 @@ async function loadPlugins(loader, pluginConfigurations, root, assignIndexes) {
|
|
3516
4486
|
}
|
|
3517
4487
|
async function capabilitiesOfConfiguredPlugins(nxJson, root = workspace_root_1.workspaceRoot) {
|
|
3518
4488
|
if (!(0, is_on_daemon_1.isOnDaemon)() && (0, client_1.isDaemonEnabled)()) {
|
|
@@ -3523,7 +4493,7 @@ index b5f180eb7c517d26c2bf8ca6377c1aeb9f69d0e7..bca08e11b1daef7a6da85b7fdd4dbca9
|
|
|
3523
4493
|
}
|
|
3524
4494
|
const recorded = (0, nx_plugin_capabilities_1.capabilitiesOfNxPluginsReadFromCache)();
|
|
3525
4495
|
if (recorded) {
|
|
3526
|
-
@@ -311,7 +
|
|
4496
|
+
@@ -311,7 +345,7 @@ async function loadDefaultNxPlugins(root = workspace_root_1.workspaceRoot) {
|
|
3527
4497
|
// Cleared so the next call retries instead of re-awaiting this rejection.
|
|
3528
4498
|
pendingDefaultPluginPromise = undefined;
|
|
3529
4499
|
const errorMessage = errors
|
|
@@ -3532,7 +4502,7 @@ index b5f180eb7c517d26c2bf8ca6377c1aeb9f69d0e7..bca08e11b1daef7a6da85b7fdd4dbca9
|
|
|
3532
4502
|
.join('\n');
|
|
3533
4503
|
throw new AggregateError(errors.map((e) => e.error), `Failed to load ${errors.length} default Nx plugin(s):\n${errorMessage}`);
|
|
3534
4504
|
}
|
|
3535
|
-
@@ -348,7 +
|
|
4505
|
+
@@ -348,7 +382,7 @@ async function loadSpecifiedNxPlugins(pluginsConfigurations, root = workspace_ro
|
|
3536
4506
|
if (errors.length > 0) {
|
|
3537
4507
|
// Wants are not retracted: a newer load may own the declaration by now.
|
|
3538
4508
|
const errorMessage = errors
|
|
@@ -3541,7 +4511,7 @@ index b5f180eb7c517d26c2bf8ca6377c1aeb9f69d0e7..bca08e11b1daef7a6da85b7fdd4dbca9
|
|
|
3541
4511
|
.join('\n');
|
|
3542
4512
|
throw new AggregateError(errors.map((e) => e.error), `Failed to load ${errors.length} Nx plugin(s):\n${errorMessage}`);
|
|
3543
4513
|
}
|
|
3544
|
-
@@ -363,6 +
|
|
4514
|
+
@@ -363,6 +397,12 @@ function reasonToError(reason) {
|
|
3545
4515
|
if ('stack' in reason) {
|
|
3546
4516
|
error.stack = String(reason.stack);
|
|
3547
4517
|
}
|
|
@@ -4018,10 +4988,10 @@ index 9fa6b993ac4dbe918c163092c12f77f87eaccb27..d93538310c4dc2622cde88cd9da983bc
|
|
|
4018
4988
|
target[key] = value;
|
|
4019
4989
|
diff --git a/dist/src/project-graph/plugins/local-plugin-source.d.ts b/dist/src/project-graph/plugins/local-plugin-source.d.ts
|
|
4020
4990
|
new file mode 100644
|
|
4021
|
-
index 0000000000000000000000000000000000000000..
|
|
4991
|
+
index 0000000000000000000000000000000000000000..9aaee0e0b5b3a14dacfc4ca1a618b9f1f391cc59
|
|
4022
4992
|
--- /dev/null
|
|
4023
4993
|
+++ b/dist/src/project-graph/plugins/local-plugin-source.d.ts
|
|
4024
|
-
@@ -0,0 +1,
|
|
4994
|
+
@@ -0,0 +1,26 @@
|
|
4025
4995
|
+export interface LocalPluginSourceReceipt {
|
|
4026
4996
|
+ readonly path: string;
|
|
4027
4997
|
+ readonly hash: string;
|
|
@@ -4040,16 +5010,20 @@ index 0000000000000000000000000000000000000000..1a84106509d0e05a2f0d6c595b79ecc7
|
|
|
4040
5010
|
+export declare function recordLocalPluginSources(source: LocalPluginSource | undefined, loaded: readonly LocalPluginSourceReceipt[] | undefined): void;
|
|
4041
5011
|
+export declare function invalidateLocalPluginSources(root: string, changedFiles: readonly string[]): void;
|
|
4042
5012
|
+/** The paths among `paths` that a local plugin of `root` loaded, in order. */
|
|
4043
|
-
+export declare function
|
|
5013
|
+
+export declare function invalidateLocalPluginSources(root: string, changedFiles: readonly string[]): boolean;
|
|
5014
|
+
+/** Whether this process can hold local plugins in its own module cache: a Node daemon. */
|
|
5015
|
+
+export declare function canHoldLocalPlugins(): boolean;
|
|
5016
|
+
+/** Loads a local plugin into this process; `restart` runs once when a file its closure loaded changes. */
|
|
5017
|
+
+export declare function holdLocalPlugin<T>(root: string, load: () => Promise<T>, restart: () => void): Promise<T>;
|
|
4044
5018
|
+export declare function invalidateIgnoredLocalPluginSources(root: string, changedFiles: readonly string[]): boolean;
|
|
4045
5019
|
+export declare function getLocalPluginGeneration(): number;
|
|
4046
5020
|
+export declare function trackLocalPluginLoads(root: string): () => LocalPluginSourceReceipt[];
|
|
4047
5021
|
diff --git a/dist/src/project-graph/plugins/local-plugin-source.js b/dist/src/project-graph/plugins/local-plugin-source.js
|
|
4048
5022
|
new file mode 100644
|
|
4049
|
-
index 0000000000000000000000000000000000000000..
|
|
5023
|
+
index 0000000000000000000000000000000000000000..813c7134e970f00e7003a0708cc483f55c320d33
|
|
4050
5024
|
--- /dev/null
|
|
4051
5025
|
+++ b/dist/src/project-graph/plugins/local-plugin-source.js
|
|
4052
|
-
@@ -0,0 +1,
|
|
5026
|
+
@@ -0,0 +1,209 @@
|
|
4053
5027
|
+"use strict";
|
|
4054
5028
|
+Object.defineProperty(exports, "__esModule", { value: true });
|
|
4055
5029
|
+exports.localPluginPath = localPluginPath;
|
|
@@ -4062,12 +5036,48 @@ index 0000000000000000000000000000000000000000..acc04ca3d6da95a0992bf96df3587a78
|
|
|
4062
5036
|
+exports.localPluginSourceMembers = localPluginSourceMembers;
|
|
4063
5037
|
+exports.pluginsAffectedBySourceHashes = pluginsAffectedBySourceHashes;
|
|
4064
5038
|
+exports.trackLocalPluginLoads = trackLocalPluginLoads;
|
|
5039
|
+
+exports.canHoldLocalPlugins = canHoldLocalPlugins;
|
|
5040
|
+
+exports.holdLocalPlugin = holdLocalPlugin;
|
|
4065
5041
|
+const { createHash } = require("node:crypto");
|
|
4066
5042
|
+const { readFileSync } = require("node:fs");
|
|
4067
5043
|
+const { relative, resolve, sep, isAbsolute } = require("node:path");
|
|
4068
5044
|
+const { fileURLToPath } = require("node:url");
|
|
4069
5045
|
+const sourcesByRoot = new Map();
|
|
4070
5046
|
+let generation = 0;
|
|
5047
|
+
+// The one closure of every local plugin this process holds in its own module
|
|
5048
|
+
+// cache: a daemon with isolation off. Its loads are observed as a worker's are.
|
|
5049
|
+
+let held;
|
|
5050
|
+
+let takeHeldLoads;
|
|
5051
|
+
+// Only a daemon can answer a changed closure by restarting, and only Node
|
|
5052
|
+
+// observes module loads.
|
|
5053
|
+
+function canHoldLocalPlugins() {
|
|
5054
|
+
+ return !!global.NX_DAEMON && !process.versions.bun && typeof require('node:module').registerHooks === 'function';
|
|
5055
|
+
+}
|
|
5056
|
+
+// Loads a local plugin into this process. Its closure joins the held one, and
|
|
5057
|
+
+// `restart` runs once when a file of that closure changes. A load that failed
|
|
5058
|
+
+// may have left a module no one can evict, so the next source change restarts.
|
|
5059
|
+
+async function holdLocalPlugin(root, load, restart) {
|
|
5060
|
+
+ if (!held?.active) {
|
|
5061
|
+
+ held = createLocalPluginSource(root, restart);
|
|
5062
|
+
+ takeHeldLoads ??= trackLocalPluginLoads(resolve(root));
|
|
5063
|
+
+ }
|
|
5064
|
+
+ const source = held;
|
|
5065
|
+
+ try {
|
|
5066
|
+
+ return await load();
|
|
5067
|
+
+ }
|
|
5068
|
+
+ catch (error) {
|
|
5069
|
+
+ source.failed = true;
|
|
5070
|
+
+ throw error;
|
|
5071
|
+
+ }
|
|
5072
|
+
+ finally {
|
|
5073
|
+
+ recordHeldLoads();
|
|
5074
|
+
+ }
|
|
5075
|
+
+}
|
|
5076
|
+
+// Lazy and computed imports load after the plugin did: take what the hook saw
|
|
5077
|
+
+// before each judgment.
|
|
5078
|
+
+function recordHeldLoads() {
|
|
5079
|
+
+ if (held?.active) recordLocalPluginSources(held, takeHeldLoads());
|
|
5080
|
+
+}
|
|
4071
5081
|
+// A resolved package-manager link into workspace source is local; installed
|
|
4072
5082
|
+// packages and links into another checkout retain their installation policy.
|
|
4073
5083
|
+function localPluginPath(root, file) {
|
|
@@ -4138,15 +5148,22 @@ index 0000000000000000000000000000000000000000..acc04ca3d6da95a0992bf96df3587a78
|
|
|
4138
5148
|
+ }
|
|
4139
5149
|
+ }
|
|
4140
5150
|
+}
|
|
5151
|
+
+// True when the held closure changed: the daemon is restarting and no
|
|
5152
|
+
+// recompute follows.
|
|
4141
5153
|
+function invalidateLocalPluginSources(root, changedFiles) {
|
|
5154
|
+
+ recordHeldLoads();
|
|
4142
5155
|
+ const sources = sourcesByRoot.get(resolve(root));
|
|
4143
|
-
+ if (!sources) return;
|
|
5156
|
+
+ if (!sources) return false;
|
|
4144
5157
|
+ const affected = pluginsAffectedByChanges(sources, changedFiles);
|
|
5158
|
+
+ if (held?.active && held.failed && changedFiles.length > 0 && !affected.includes(held)) affected.push(held);
|
|
5159
|
+
+ const restarting = affected.includes(held);
|
|
4145
5160
|
+ for (const source of affected) source.invalidate();
|
|
5161
|
+
+ return restarting;
|
|
4146
5162
|
+}
|
|
4147
5163
|
+// The paths among `paths` that a local plugin of `root` loaded, in order.
|
|
4148
5164
|
+function localPluginSourceMembers(root, paths) {
|
|
4149
5165
|
+ const sources = sourcesByRoot.get(resolve(root));
|
|
5166
|
+
+ recordHeldLoads();
|
|
4150
5167
|
+ if (!sources) return [];
|
|
4151
5168
|
+ return paths.filter((path) => [...sources.keys()].some((source) => source.files.has(path)));
|
|
4152
5169
|
+}
|
|
@@ -4166,6 +5183,7 @@ index 0000000000000000000000000000000000000000..acc04ca3d6da95a0992bf96df3587a78
|
|
|
4166
5183
|
+ return affected;
|
|
4167
5184
|
+}
|
|
4168
5185
|
+function invalidateIgnoredLocalPluginSources(root, changedFiles) {
|
|
5186
|
+
+ recordHeldLoads();
|
|
4169
5187
|
+ const sources = sourcesByRoot.get(resolve(root));
|
|
4170
5188
|
+ if (!sources) return false;
|
|
4171
5189
|
+ const currentHashes = new Map();
|
|
@@ -4236,30 +5254,167 @@ index 9014799cfb98f624d9d2b04891c3c9d876c64916..e29dd0e015e0e63ccdd27c2036b0395f
|
|
|
4236
5254
|
readonly argv: string[];
|
|
4237
5255
|
};
|
|
4238
5256
|
export type PostTasksExecutionContext = {
|
|
5257
|
+
diff --git a/dist/src/project-graph/plugins/resolve-plugin.js b/dist/src/project-graph/plugins/resolve-plugin.js
|
|
5258
|
+
index 8dcf1f508bd5447f356cab4d63fedd3f24a6e383..3cf40d176ccbef975fa9794901eda3af0157ed3e 100644
|
|
5259
|
+
--- a/dist/src/project-graph/plugins/resolve-plugin.js
|
|
5260
|
+
+++ b/dist/src/project-graph/plugins/resolve-plugin.js
|
|
5261
|
+
@@ -19,6 +19,18 @@ const retrieve_workspace_files_1 = require("../utils/retrieve-workspace-files");
|
|
5262
|
+
const TS_SOURCE_EXTENSIONS = new Set(['.ts', '.tsx', '.cts', '.mts']);
|
|
5263
|
+
let projectsWithoutInference;
|
|
5264
|
+
let projectsWithoutInferencePromise = null;
|
|
5265
|
+
+/**
|
|
5266
|
+
+ * A plugin nx.json names by a relative path (`./tools/plugin.js`) is that file under the
|
|
5267
|
+
+ * workspace root, resolved as a path. Bun's resolver keeps a directory's entries for the life of
|
|
5268
|
+
+ * its process once it has looked anything up there, so a relative specifier never finds a file
|
|
5269
|
+
+ * written after that lookup, while the absolute path is read from the file system: a long-lived
|
|
5270
|
+
+ * Bun client (one Nx run after another in one process) then loaded no plugin a writer had added.
|
|
5271
|
+
+ */
|
|
5272
|
+
+function fromRoot(moduleName, root) {
|
|
5273
|
+
+ return moduleName.startsWith('./') || moduleName.startsWith('../')
|
|
5274
|
+
+ ? path.resolve(root, moduleName)
|
|
5275
|
+
+ : moduleName;
|
|
5276
|
+
+}
|
|
5277
|
+
async function resolveNxPlugin(moduleName, root, paths) {
|
|
5278
|
+
// Default plugins (see `getDefaultPlugins` in `get-plugins.ts`) are passed
|
|
5279
|
+
// as absolute file paths to compiled bundles inside `nx` itself; they are
|
|
5280
|
+
@@ -28,7 +40,7 @@ async function resolveNxPlugin(moduleName, root, paths) {
|
|
5281
|
+
if (!path.isAbsolute(moduleName)) {
|
|
5282
|
+
let resolvedFromNode;
|
|
5283
|
+
try {
|
|
5284
|
+
- resolvedFromNode = require.resolve(moduleName, { paths });
|
|
5285
|
+
+ resolvedFromNode = require.resolve(fromRoot(moduleName, root), { paths });
|
|
5286
|
+
}
|
|
5287
|
+
catch { }
|
|
5288
|
+
// Load projects if Node couldn't resolve (so the local fallback can run)
|
|
5289
|
+
@@ -95,7 +107,7 @@ function getPluginPathAndName(moduleName, paths, projects, root) {
|
|
5290
|
+
}
|
|
5291
|
+
if (!pluginPath) {
|
|
5292
|
+
try {
|
|
5293
|
+
- pluginPath = require.resolve(moduleName, { paths });
|
|
5294
|
+
+ pluginPath = require.resolve(fromRoot(moduleName, root), { paths });
|
|
5295
|
+
}
|
|
5296
|
+
catch (e) {
|
|
5297
|
+
if (localPlugin && isPackageResolutionError(e)) {
|
|
4239
5298
|
diff --git a/dist/src/project-graph/plugins/tasks-execution-hooks.js b/dist/src/project-graph/plugins/tasks-execution-hooks.js
|
|
4240
|
-
index 867a717e26592ed291df332083e1aded275dc404..
|
|
5299
|
+
index 867a717e26592ed291df332083e1aded275dc404..8af158796c275950c11c55953b6deb63ff353c95 100644
|
|
4241
5300
|
--- a/dist/src/project-graph/plugins/tasks-execution-hooks.js
|
|
4242
5301
|
+++ b/dist/src/project-graph/plugins/tasks-execution-hooks.js
|
|
4243
|
-
@@ -
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
|
|
5302
|
+
@@ -4,46 +4,39 @@ exports.runPreTasksExecution = runPreTasksExecution;
|
|
5303
|
+
exports.runPostTasksExecution = runPostTasksExecution;
|
|
5304
|
+
const nx_json_1 = require("../../config/nx-json");
|
|
5305
|
+
const get_plugins_1 = require("./get-plugins");
|
|
5306
|
+
-const is_on_daemon_1 = require("../../daemon/is-on-daemon");
|
|
5307
|
+
-const client_1 = require("../../daemon/client/client");
|
|
5308
|
+
const workspace_root_1 = require("../../utils/workspace-root");
|
|
5309
|
+
-const task_results_stub_1 = require("./task-results-stub");
|
|
5310
|
+
const nx_plugin_capabilities_1 = require("./nx-plugin-capabilities");
|
|
5311
|
+
/** True only when the cached graph's recorded rows show no plugin has `hook`; unknown is false. */
|
|
5312
|
+
function knownThatNoPluginRegisters(hook) {
|
|
5313
|
+
const recorded = (0, nx_plugin_capabilities_1.capabilitiesOfNxPluginsReadFromCache)();
|
|
5314
|
+
return !!recorded && !recorded.some((capabilities) => capabilities[hook]);
|
|
5315
|
+
}
|
|
5316
|
+
+// The task hooks run in the process that runs the tasks, never in a daemon. What a pre hook starts for its run (a
|
|
5317
|
+
+// process, a socket it publishes to the tasks) is then a child of the run that ends with it, and the post hook runs
|
|
5318
|
+
+// where the pre hook ran. Run in the daemon, it was the daemon's: a daemon that stopped under the run took it along,
|
|
5319
|
+
+// and the post hook the client then ran in its own process found nothing of the pre hook's.
|
|
5320
|
+
async function runPreTasksExecution(pluginContext) {
|
|
5321
|
+
- if ((0, is_on_daemon_1.isOnDaemon)() || !(0, client_1.isDaemonEnabled)()) {
|
|
5322
|
+
- if (knownThatNoPluginRegisters('hasPreTasksExecution')) {
|
|
5323
|
+
- return [];
|
|
5324
|
+
+ if (knownThatNoPluginRegisters('hasPreTasksExecution')) {
|
|
5325
|
+
+ return [];
|
|
5326
|
+
+ }
|
|
5327
|
+
+ performance.mark(`preTasksExecution:start`);
|
|
5328
|
+
+ const plugins = await (0, get_plugins_1.getPlugins)((0, nx_json_1.readNxJson)(pluginContext.workspaceRoot), pluginContext.workspaceRoot);
|
|
5329
|
+
+ const envs = await Promise.all(plugins
|
|
5330
|
+
+ .filter((p) => p.preTasksExecution)
|
|
5331
|
+
+ .map(async (plugin) => {
|
|
5332
|
+
+ performance.mark(`${plugin.name}:preTasksExecution:start`);
|
|
5333
|
+
+ try {
|
|
5334
|
+
+ return await plugin.preTasksExecution(pluginContext);
|
|
5335
|
+
}
|
|
5336
|
+
- performance.mark(`preTasksExecution:start`);
|
|
5337
|
+
- const plugins = await (0, get_plugins_1.getPlugins)((0, nx_json_1.readNxJson)(pluginContext.workspaceRoot), pluginContext.workspaceRoot);
|
|
5338
|
+
- const envs = await Promise.all(plugins
|
|
5339
|
+
- .filter((p) => p.preTasksExecution)
|
|
5340
|
+
- .map(async (plugin) => {
|
|
5341
|
+
- performance.mark(`${plugin.name}:preTasksExecution:start`);
|
|
5342
|
+
- try {
|
|
5343
|
+
- return await plugin.preTasksExecution(pluginContext);
|
|
5344
|
+
- }
|
|
5345
|
+
- finally {
|
|
5346
|
+
- performance.mark(`${plugin.name}:preTasksExecution:end`);
|
|
5347
|
+
- performance.measure(`${plugin.name}:preTasksExecution`, `${plugin.name}:preTasksExecution:start`, `${plugin.name}:preTasksExecution:end`);
|
|
5348
|
+
- }
|
|
5349
|
+
- }));
|
|
5350
|
+
- if (!(0, client_1.isDaemonEnabled)()) {
|
|
5351
|
+
- applyProcessEnvs(envs);
|
|
5352
|
+
+ finally {
|
|
5353
|
+
+ performance.mark(`${plugin.name}:preTasksExecution:end`);
|
|
5354
|
+
+ performance.measure(`${plugin.name}:preTasksExecution`, `${plugin.name}:preTasksExecution:start`, `${plugin.name}:preTasksExecution:end`);
|
|
5355
|
+
}
|
|
5356
|
+
- performance.mark(`preTasksExecution:end`);
|
|
5357
|
+
- performance.measure(`preTasksExecution`, `preTasksExecution:start`, `preTasksExecution:end`);
|
|
5358
|
+
- return envs;
|
|
5359
|
+
- }
|
|
5360
|
+
- else {
|
|
4247
5361
|
- const envs = await client_1.daemonClient.runPreTasksExecution(pluginContext);
|
|
4248
5362
|
- applyProcessEnvs(envs);
|
|
4249
|
-
|
|
4250
|
-
+
|
|
4251
|
-
+
|
|
4252
|
-
+
|
|
4253
|
-
|
|
5363
|
+
- }
|
|
5364
|
+
+ }));
|
|
5365
|
+
+ applyProcessEnvs(envs);
|
|
5366
|
+
+ performance.mark(`preTasksExecution:end`);
|
|
5367
|
+
+ performance.measure(`preTasksExecution`, `preTasksExecution:start`, `preTasksExecution:end`);
|
|
5368
|
+
+ return envs;
|
|
4254
5369
|
}
|
|
4255
5370
|
function applyProcessEnvs(envs) {
|
|
4256
|
-
|
|
4257
|
-
|
|
5371
|
+
for (const env of envs) {
|
|
5372
|
+
@@ -53,28 +46,23 @@ function applyProcessEnvs(envs) {
|
|
4258
5373
|
}
|
|
4259
|
-
|
|
5374
|
+
}
|
|
5375
|
+
async function runPostTasksExecution(context) {
|
|
5376
|
+
- if ((0, is_on_daemon_1.isOnDaemon)() || !(0, client_1.isDaemonEnabled)()) {
|
|
5377
|
+
- if (knownThatNoPluginRegisters('hasPostTasksExecution')) {
|
|
5378
|
+
- return;
|
|
5379
|
+
- }
|
|
5380
|
+
- performance.mark(`postTasksExecution:start`);
|
|
5381
|
+
- const plugins = await (0, get_plugins_1.getPlugins)((0, nx_json_1.readNxJson)(workspace_root_1.workspaceRoot));
|
|
5382
|
+
- await Promise.all(plugins
|
|
5383
|
+
- .filter((p) => p.postTasksExecution)
|
|
5384
|
+
- .map(async (plugin) => {
|
|
5385
|
+
- performance.mark(`${plugin.name}:postTasksExecution:start`);
|
|
5386
|
+
- try {
|
|
5387
|
+
- await plugin.postTasksExecution(context);
|
|
5388
|
+
- }
|
|
5389
|
+
- finally {
|
|
5390
|
+
- performance.mark(`${plugin.name}:postTasksExecution:end`);
|
|
5391
|
+
- performance.measure(`${plugin.name}:postTasksExecution`, `${plugin.name}:postTasksExecution:start`, `${plugin.name}:postTasksExecution:end`);
|
|
5392
|
+
- }
|
|
5393
|
+
- }));
|
|
5394
|
+
- performance.mark(`postTasksExecution:end`);
|
|
5395
|
+
- performance.measure(`postTasksExecution`, `postTasksExecution:start`, `postTasksExecution:end`);
|
|
5396
|
+
- }
|
|
5397
|
+
- else {
|
|
4260
5398
|
- await client_1.daemonClient.runPostTasksExecution((0, task_results_stub_1.stubTerminalOutputs)(context));
|
|
4261
|
-
+
|
|
5399
|
+
+ if (knownThatNoPluginRegisters('hasPostTasksExecution')) {
|
|
5400
|
+
+ return;
|
|
4262
5401
|
}
|
|
5402
|
+
+ performance.mark(`postTasksExecution:start`);
|
|
5403
|
+
+ const plugins = await (0, get_plugins_1.getPlugins)((0, nx_json_1.readNxJson)(workspace_root_1.workspaceRoot));
|
|
5404
|
+
+ await Promise.all(plugins
|
|
5405
|
+
+ .filter((p) => p.postTasksExecution)
|
|
5406
|
+
+ .map(async (plugin) => {
|
|
5407
|
+
+ performance.mark(`${plugin.name}:postTasksExecution:start`);
|
|
5408
|
+
+ try {
|
|
5409
|
+
+ await plugin.postTasksExecution(context);
|
|
5410
|
+
+ }
|
|
5411
|
+
+ finally {
|
|
5412
|
+
+ performance.mark(`${plugin.name}:postTasksExecution:end`);
|
|
5413
|
+
+ performance.measure(`${plugin.name}:postTasksExecution`, `${plugin.name}:postTasksExecution:start`, `${plugin.name}:postTasksExecution:end`);
|
|
5414
|
+
+ }
|
|
5415
|
+
+ }));
|
|
5416
|
+
+ performance.mark(`postTasksExecution:end`);
|
|
5417
|
+
+ performance.measure(`postTasksExecution`, `postTasksExecution:start`, `postTasksExecution:end`);
|
|
4263
5418
|
}
|
|
4264
5419
|
diff --git a/dist/src/project-graph/project-graph.js b/dist/src/project-graph/project-graph.js
|
|
4265
5420
|
index 3ab406eee377e39ebd9229a1d07b7b11c94413b2..1f14ec608e0386ce0918db7ca14f29a635a87a95 100644
|
|
@@ -4279,20 +5434,8 @@ index 3ab406eee377e39ebd9229a1d07b7b11c94413b2..1f14ec608e0386ce0918db7ca14f29a6
|
|
|
4279
5434
|
if (e.daemonPermissionError) {
|
|
4280
5435
|
// Deliberately not disabled: unlike the inotify limit above, a socket
|
|
4281
5436
|
// owned by someone else stops being there when it is removed or the
|
|
4282
|
-
diff --git a/dist/src/tasks-runner/cache.d.ts b/dist/src/tasks-runner/cache.d.ts
|
|
4283
|
-
index 7af1ca6cae5c72a9fa601a0360b5da71a37ff731..560e5bedcda4102272febe15c09f19172ab1943e 100644
|
|
4284
|
-
--- a/dist/src/tasks-runner/cache.d.ts
|
|
4285
|
-
+++ b/dist/src/tasks-runner/cache.d.ts
|
|
4286
|
-
@@ -60,6 +60,7 @@ export declare class DbCache {
|
|
4287
|
-
size: number;
|
|
4288
|
-
}[]): void;
|
|
4289
|
-
copyFilesFromCache(_: string, cachedResult: CachedResult, outputs: string[]): Promise<import("../native").OutputFile[]>;
|
|
4290
|
-
+ private stampRestored;
|
|
4291
|
-
removeOldCacheRecords(): void;
|
|
4292
|
-
temporaryOutputPath(task: Task): string;
|
|
4293
|
-
private getRemoteCache;
|
|
4294
5437
|
diff --git a/dist/src/tasks-runner/cache.js b/dist/src/tasks-runner/cache.js
|
|
4295
|
-
index 02b4d14fca9314d8f4f277aa0aa1cb5b3c9736c8..
|
|
5438
|
+
index 02b4d14fca9314d8f4f277aa0aa1cb5b3c9736c8..23c356d6c628374336b1919e95fa10ce5770c8a3 100644
|
|
4296
5439
|
--- a/dist/src/tasks-runner/cache.js
|
|
4297
5440
|
+++ b/dist/src/tasks-runner/cache.js
|
|
4298
5441
|
@@ -28,6 +28,7 @@ const workspace_root_1 = require("../utils/workspace-root");
|
|
@@ -4303,54 +5446,57 @@ index 02b4d14fca9314d8f4f277aa0aa1cb5b3c9736c8..7106ae0df08d36128af9467bf92951ae
|
|
|
4303
5446
|
// This function is called once during tasks runner initialization. It checks if the db cache is enabled and logs a warning if it is not.
|
|
4304
5447
|
function dbCacheEnabled() {
|
|
4305
5448
|
// ...but if on wasm and the the db cache isnt supported we shouldn't warn
|
|
4306
|
-
@@ -175,7 +176,
|
|
5449
|
+
@@ -175,7 +176,17 @@ class DbCache {
|
|
4307
5450
|
return this.cache.getCacheSize();
|
|
4308
5451
|
}
|
|
4309
5452
|
applyRemoteCacheResults(hash, res, outputs) {
|
|
4310
5453
|
- return this.cache.applyRemoteCacheResults(hash, res, outputs);
|
|
4311
5454
|
+ this.cache.applyRemoteCacheResults(hash, res, outputs);
|
|
4312
|
-
+ // The native call restores the outputs itself, under this same condition
|
|
5455
|
+
+ // The native call restores the outputs itself, under this same condition:
|
|
5456
|
+
+ // it removes each output the artifact holds and copies it whole. It also
|
|
5457
|
+
+ // records the entry's size as the bytes it copies, so it cannot be handed
|
|
5458
|
+
+ // only the outputs that differ (restoreChangedOutputs) without
|
|
5459
|
+
+ // undercounting the entry against maxCacheSize.
|
|
4313
5460
|
+ if (outputs?.length > 0 && res.code === 0) {
|
|
4314
|
-
+
|
|
5461
|
+
+ const relativeOutputs = workspaceRelativeOutputs(outputs);
|
|
5462
|
+
+ removeAbsentOutputs(workspace_root_1.workspaceRoot, res.outputsPath, relativeOutputs);
|
|
5463
|
+
+ stampRestoredOutputs(workspace_root_1.workspaceRoot, res.outputsPath, (0, native_1.expandOutputs)(res.outputsPath, relativeOutputs));
|
|
4315
5464
|
+ }
|
|
4316
5465
|
}
|
|
4317
5466
|
async put(task, terminalOutput, outputs, code) {
|
|
4318
5467
|
return tryAndRetry(async () => {
|
|
4319
|
-
@@ -
|
|
5468
|
+
@@ -183,7 +194,9 @@ class DbCache {
|
|
5469
|
+
// Notify TaskIOService of actual output files
|
|
5470
|
+
(0, task_io_service_1.getTaskIOService)().notifyTaskOutputs(task.id, expandedOutputs);
|
|
5471
|
+
if (this.remoteCache) {
|
|
5472
|
+
- await this.remoteCache.store(task.hash, this.cache.cacheDirectory, terminalOutput, code);
|
|
5473
|
+
+ // A store policy (NX_SELF_HOSTED_REMOTE_CACHE_STORE_SECONDS_PER_MIB) decides on how long the task
|
|
5474
|
+
+ // ran, before any archive is built. The orchestrator sets both times before it calls put.
|
|
5475
|
+
+ await this.remoteCache.store(task.hash, this.cache.cacheDirectory, terminalOutput, code, task.endTime - task.startTime);
|
|
5476
|
+
}
|
|
5477
|
+
return files;
|
|
5478
|
+
});
|
|
5479
|
+
@@ -198,7 +211,7 @@ class DbCache {
|
|
4320
5480
|
this.cache.recordTerminalOutputs(records);
|
|
4321
5481
|
}
|
|
4322
5482
|
copyFilesFromCache(_, cachedResult, outputs) {
|
|
4323
5483
|
- return tryAndRetry(async () => this.cache.copyFilesFromCache(cachedResult, outputs));
|
|
4324
|
-
+ return tryAndRetry(async () =>
|
|
4325
|
-
+ const files = this.cache.copyFilesFromCache(cachedResult, outputs);
|
|
4326
|
-
+ this.stampRestored(cachedResult.outputsPath, outputs);
|
|
4327
|
-
+ // These stamps go to the daemon in place of a walk of the outputs,
|
|
4328
|
-
+ // so they carry the time the restore gave the files.
|
|
4329
|
-
+ return files && restampOutputFiles(workspace_root_1.workspaceRoot, files);
|
|
4330
|
-
+ });
|
|
4331
|
-
+ }
|
|
4332
|
-
+ /**
|
|
4333
|
-
+ * Stamps what the native restore wrote from the cache entry at
|
|
4334
|
-
+ * `outputsPath`. The native restore makes an absolute in-workspace output
|
|
4335
|
-
+ * relative before expanding it in the entry, so this does too.
|
|
4336
|
-
+ */
|
|
4337
|
-
+ stampRestored(outputsPath, outputs) {
|
|
4338
|
-
+ const relativeOutputs = outputs.map((output) => (0, path_1.isAbsolute)(output) ? (0, path_1.relative)(workspace_root_1.workspaceRoot, output) : output);
|
|
4339
|
-
+ stampRestoredOutputs(workspace_root_1.workspaceRoot, outputsPath, (0, native_1.expandOutputs)(outputsPath, relativeOutputs));
|
|
5484
|
+
+ return tryAndRetry(async () => restoreChangedOutputs(this.cache, workspace_root_1.workspaceRoot, cachedResult, workspaceRelativeOutputs(outputs)));
|
|
4340
5485
|
}
|
|
4341
5486
|
removeOldCacheRecords() {
|
|
4342
5487
|
return this.cache.removeOldCacheRecords();
|
|
4343
|
-
@@ -293,7 +
|
|
5488
|
+
@@ -293,7 +306,9 @@ class DbCache {
|
|
4344
5489
|
if (process.env.NODE_TLS_REJECT_UNAUTHORIZED === '0') {
|
|
4345
5490
|
process.emitWarning("Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to '0' makes TLS connections and HTTPS requests insecure by disabling certificate verification.");
|
|
4346
5491
|
}
|
|
4347
5492
|
- return new native_1.HttpRemoteCache();
|
|
4348
5493
|
+ const guard = new remote_cache_outage_1.RemoteCacheOutageGuard(new native_1.HttpRemoteCache(), process.env.NX_SELF_HOSTED_REMOTE_CACHE_SERVER);
|
|
4349
|
-
+
|
|
5494
|
+
+ const secondsPerMiB = (0, remote_cache_outage_1.parseStoreSecondsPerMiB)(process.env.NX_SELF_HOSTED_REMOTE_CACHE_STORE_SECONDS_PER_MIB);
|
|
5495
|
+
+ return secondsPerMiB === null ? guard : new remote_cache_outage_1.CostBoundRemoteCache(guard, secondsPerMiB);
|
|
4350
5496
|
}
|
|
4351
5497
|
return null;
|
|
4352
5498
|
}
|
|
4353
|
-
@@ -452,6 +
|
|
5499
|
+
@@ -452,6 +467,7 @@ class Cache {
|
|
4354
5500
|
await this.copy(cached, src);
|
|
4355
5501
|
}
|
|
4356
5502
|
}));
|
|
@@ -4358,7 +5504,7 @@ index 02b4d14fca9314d8f4f277aa0aa1cb5b3c9736c8..7106ae0df08d36128af9467bf92951ae
|
|
|
4358
5504
|
});
|
|
4359
5505
|
}
|
|
4360
5506
|
temporaryOutputPath(task) {
|
|
4361
|
-
@@ -557,6 +
|
|
5507
|
+
@@ -557,6 +573,213 @@ class Cache {
|
|
4362
5508
|
}
|
|
4363
5509
|
}
|
|
4364
5510
|
exports.Cache = Cache;
|
|
@@ -4370,7 +5516,9 @@ index 02b4d14fca9314d8f4f277aa0aa1cb5b3c9736c8..7106ae0df08d36128af9467bf92951ae
|
|
|
4370
5516
|
+ * judges freshness by mtime (a Cargo build script's `rerun-if-changed`, make,
|
|
4371
5517
|
+ * a file watcher) then kept what it built from the newer bytes. Running the
|
|
4372
5518
|
+ * task would have written the output now, so the restore stamps it now. Links
|
|
4373
|
-
+ * keep their own times: `utimes` would stamp what they point at.
|
|
5519
|
+
+ * keep their own times: `utimes` would stamp what they point at. A local hit
|
|
5520
|
+
+ * passes only the outputs it wrote (restoreChangedOutputs): a file it kept
|
|
5521
|
+
+ * keeps its time.
|
|
4374
5522
|
+ */
|
|
4375
5523
|
+function stampRestoredOutputs(workspaceRoot, outputsPath, expandedOutputs) {
|
|
4376
5524
|
+ const now = new Date();
|
|
@@ -4401,6 +5549,171 @@ index 02b4d14fca9314d8f4f277aa0aa1cb5b3c9736c8..7106ae0df08d36128af9467bf92951ae
|
|
|
4401
5549
|
+ const stats = (0, node_fs_1.lstatSync)((0, path_1.resolve)(workspaceRoot, file.path), { bigint: true });
|
|
4402
5550
|
+ return stats.isFile() ? { ...file, stamp: `${stats.mtimeNs}:${stats.size}` } : file;
|
|
4403
5551
|
+ });
|
|
5552
|
+
+}
|
|
5553
|
+
+/**
|
|
5554
|
+
+ * Outputs as the native restore expands them: it makes an absolute
|
|
5555
|
+
+ * in-workspace output relative first, so these helpers do too.
|
|
5556
|
+
+ */
|
|
5557
|
+
+function workspaceRelativeOutputs(outputs) {
|
|
5558
|
+
+ return outputs.map((output) => (0, path_1.isAbsolute)(output) ? (0, path_1.relative)(workspace_root_1.workspaceRoot, output) : output);
|
|
5559
|
+
+}
|
|
5560
|
+
+/**
|
|
5561
|
+
+ * Removes each output the workspace holds that the cache entry at
|
|
5562
|
+
+ * `outputsPath` does not. The native restore copies only the outputs an entry
|
|
5563
|
+
+ * holds and leaves every other one in place, so a hit kept an output its run
|
|
5564
|
+
+ * never wrote: what a run on other inputs left, which the restored task's
|
|
5565
|
+
+ * consumers then read as its output.
|
|
5566
|
+
+ */
|
|
5567
|
+
+/**
|
|
5568
|
+
+ * The outputs the cache entry at `outputsPath` holds. Native `expandOutputs` follows links, so it drops a literal
|
|
5569
|
+
+ * output that is a link whose target lies outside the entry (`.runtime/bun -> ../.cache/runtime-bun/bun`): the entry
|
|
5570
|
+
+ * holds the link, and its target is the workspace's. A literal output is the entry's when the entry holds anything at
|
|
5571
|
+
+ * its path; a pattern expands as before.
|
|
5572
|
+
+ */
|
|
5573
|
+
+function entryOutputs(outputsPath, outputs) {
|
|
5574
|
+
+ const literal = outputs.filter((output) => !/[!*?[\]{}()]/.test(output));
|
|
5575
|
+
+ const patterns = outputs.filter((output) => /[!*?[\]{}()]/.test(output));
|
|
5576
|
+
+ const held = literal.filter((output) => (0, node_fs_1.lstatSync)((0, path_1.join)(outputsPath, output), { throwIfNoEntry: false }) !== undefined);
|
|
5577
|
+
+ return patterns.length === 0 ? held : [...held, ...(0, native_1.expandOutputs)(outputsPath, patterns)];
|
|
5578
|
+
+}
|
|
5579
|
+
+function removeAbsentOutputs(workspaceRoot, outputsPath, outputs) {
|
|
5580
|
+
+ const cached = new Set(entryOutputs(outputsPath, outputs));
|
|
5581
|
+
+ for (const output of (0, native_1.expandOutputs)(workspaceRoot, outputs)) {
|
|
5582
|
+
+ if (!cached.has(output)) {
|
|
5583
|
+
+ (0, node_fs_1.rmSync)((0, path_1.join)(workspaceRoot, output), { recursive: true, force: true });
|
|
5584
|
+
+ }
|
|
5585
|
+
+ }
|
|
5586
|
+
+}
|
|
5587
|
+
+/**
|
|
5588
|
+
+ * Restores a local hit from the cache entry at `cachedResult.outputsPath`,
|
|
5589
|
+
+ * writing only what differs from the workspace. The native restore removes
|
|
5590
|
+
+ * each output and copies it whole, so a hit on outputs that already held the
|
|
5591
|
+
+ * entry's bytes (a run on an input those bytes do not depend on, an output
|
|
5592
|
+
+ * edited and put back, a checkout without the outputs-stamp record) gave every
|
|
5593
|
+
+ * file a new inode and, stamped, a new mtime: each consumer that judges
|
|
5594
|
+
+ * freshness by mtime or file identity (a Cargo build script's
|
|
5595
|
+
+ * `rerun-if-changed`, a watcher, a producer receipt over its tool) redid its
|
|
5596
|
+
+ * work for bytes that had not changed. Here an output file with the size, mode
|
|
5597
|
+
+ * and bytes of its cached copy, and a link to the same target, stay as they
|
|
5598
|
+
+ * are. Everything else the entry holds goes through the native copy and is
|
|
5599
|
+
+ * stamped as written. What the workspace holds inside a cached directory and
|
|
5600
|
+
+ * the entry lacks is removed, as the native removal of the whole directory
|
|
5601
|
+
+ * did, and so is each output the entry does not hold (removeAbsentOutputs).
|
|
5602
|
+
+ *
|
|
5603
|
+
+ * Answers the stamps of every file the outputs now hold, which go to the
|
|
5604
|
+
+ * daemon in place of a walk, or null when an output is a pattern or a
|
|
5605
|
+
+ * negation, as the native copy does.
|
|
5606
|
+
+ */
|
|
5607
|
+
+function restoreChangedOutputs(cache, workspaceRoot, cachedResult, outputs) {
|
|
5608
|
+
+ const outputsPath = cachedResult.outputsPath;
|
|
5609
|
+
+ removeAbsentOutputs(workspaceRoot, outputsPath, outputs);
|
|
5610
|
+
+ const changed = [];
|
|
5611
|
+
+ const kept = [];
|
|
5612
|
+
+ for (const output of entryOutputs(outputsPath, outputs)) {
|
|
5613
|
+
+ collectChangedOutputs(outputsPath, workspaceRoot, output, changed, kept);
|
|
5614
|
+
+ }
|
|
5615
|
+
+ let written = [];
|
|
5616
|
+
+ if (changed.length > 0) {
|
|
5617
|
+
+ // Each changed path is a literal output of its own: the native copy
|
|
5618
|
+
+ // removes it and copies it whole from the entry, confined to the
|
|
5619
|
+
+ // workspace as for any restore.
|
|
5620
|
+
+ written = cache.copyFilesFromCache(cachedResult, changed);
|
|
5621
|
+
+ stampRestoredOutputs(workspaceRoot, outputsPath, changed);
|
|
5622
|
+
+ }
|
|
5623
|
+
+ if (written === null || outputs.some((output) => /[!*?[\]{}()]/.test(output))) {
|
|
5624
|
+
+ return null;
|
|
5625
|
+
+ }
|
|
5626
|
+
+ return [...kept, ...restampOutputFiles(workspaceRoot, written)];
|
|
5627
|
+
+}
|
|
5628
|
+
+/**
|
|
5629
|
+
+ * Sorts `output` (workspace-relative, present in the cache entry) into what
|
|
5630
|
+
+ * the restore must write from the entry (`changed`) and the file stamps it
|
|
5631
|
+
+ * keeps (`kept`), removing what the workspace holds inside a cached directory
|
|
5632
|
+
+ * that the entry does not.
|
|
5633
|
+
+ */
|
|
5634
|
+
+function collectChangedOutputs(outputsPath, workspaceRoot, output, changed, kept) {
|
|
5635
|
+
+ const cachedPath = (0, path_1.join)(outputsPath, output);
|
|
5636
|
+
+ const presentPath = (0, path_1.join)(workspaceRoot, output);
|
|
5637
|
+
+ const cached = (0, node_fs_1.lstatSync)(cachedPath, { bigint: true });
|
|
5638
|
+
+ const present = (0, node_fs_1.lstatSync)(presentPath, { bigint: true, throwIfNoEntry: false });
|
|
5639
|
+
+ if (cached.isDirectory()) {
|
|
5640
|
+
+ if (!present?.isDirectory()) {
|
|
5641
|
+
+ // Made here and filled entry by entry, so a link inside it is restored as one too.
|
|
5642
|
+
+ (0, node_fs_1.rmSync)(presentPath, { recursive: true, force: true });
|
|
5643
|
+
+ (0, node_fs_1.mkdirSync)(presentPath, { recursive: true });
|
|
5644
|
+
+ }
|
|
5645
|
+
+ const names = (0, node_fs_1.readdirSync)(cachedPath);
|
|
5646
|
+
+ const cachedNames = new Set(names);
|
|
5647
|
+
+ for (const name of (0, node_fs_1.readdirSync)(presentPath)) {
|
|
5648
|
+
+ if (!cachedNames.has(name)) {
|
|
5649
|
+
+ (0, node_fs_1.rmSync)((0, path_1.join)(presentPath, name), { recursive: true, force: true });
|
|
5650
|
+
+ }
|
|
5651
|
+
+ }
|
|
5652
|
+
+ for (const name of names) {
|
|
5653
|
+
+ collectChangedOutputs(outputsPath, workspaceRoot, path_1.posix.join(output, name), changed, kept);
|
|
5654
|
+
+ }
|
|
5655
|
+
+ }
|
|
5656
|
+
+ else if (cached.isSymbolicLink()) {
|
|
5657
|
+
+ const linked = (0, node_fs_1.readlinkSync)(cachedPath);
|
|
5658
|
+
+ if (!present?.isSymbolicLink() || (0, node_fs_1.readlinkSync)(presentPath) !== linked) {
|
|
5659
|
+
+ // The link as the entry holds it. The native copy follows it inside the entry, where a target outside the
|
|
5660
|
+
+ // outputs (`.runtime/bun -> ../.cache/runtime-bun/bun`) is not, and after removing the workspace's
|
|
5661
|
+
+ // link it wrote nothing back.
|
|
5662
|
+
+ (0, node_fs_1.rmSync)(presentPath, { recursive: true, force: true });
|
|
5663
|
+
+ (0, node_fs_1.mkdirSync)((0, path_1.dirname)(presentPath), { recursive: true });
|
|
5664
|
+
+ (0, node_fs_1.symlinkSync)(linked, presentPath);
|
|
5665
|
+
+ }
|
|
5666
|
+
+ // The native copy stamps a link by what it points at, and only a file.
|
|
5667
|
+
+ const target = (0, node_fs_1.statSync)(presentPath, { bigint: true, throwIfNoEntry: false });
|
|
5668
|
+
+ if (target?.isFile()) {
|
|
5669
|
+
+ kept.push({ path: output, stamp: `${target.mtimeNs}:${target.size}` });
|
|
5670
|
+
+ }
|
|
5671
|
+
+ }
|
|
5672
|
+
+ else if (cached.isFile() && present?.isFile() && sameFileBytes(cachedPath, cached, presentPath, present)) {
|
|
5673
|
+
+ kept.push({ path: output, stamp: `${present.mtimeNs}:${present.size}` });
|
|
5674
|
+
+ }
|
|
5675
|
+
+ else {
|
|
5676
|
+
+ changed.push(output);
|
|
5677
|
+
+ }
|
|
5678
|
+
+}
|
|
5679
|
+
+/** The comparison's two read buffers, made on its first use: the restore is synchronous. */
|
|
5680
|
+
+let compareBuffers;
|
|
5681
|
+
+/** Whether two regular files have the same size, permission bits and bytes. */
|
|
5682
|
+
+function sameFileBytes(cachedPath, cached, presentPath, present) {
|
|
5683
|
+
+ if (cached.size !== present.size || (cached.mode & 0o7777n) !== (present.mode & 0o7777n)) {
|
|
5684
|
+
+ return false;
|
|
5685
|
+
+ }
|
|
5686
|
+
+ compareBuffers ??= [Buffer.allocUnsafe(1 << 20), Buffer.allocUnsafe(1 << 20)];
|
|
5687
|
+
+ const [cachedBytes, presentBytes] = compareBuffers;
|
|
5688
|
+
+ const cachedFd = (0, node_fs_1.openSync)(cachedPath, 'r');
|
|
5689
|
+
+ try {
|
|
5690
|
+
+ const presentFd = (0, node_fs_1.openSync)(presentPath, 'r');
|
|
5691
|
+
+ try {
|
|
5692
|
+
+ for (;;) {
|
|
5693
|
+
+ const read = (0, node_fs_1.readSync)(cachedFd, cachedBytes, 0, cachedBytes.length, null);
|
|
5694
|
+
+ if (read === 0) {
|
|
5695
|
+
+ return true;
|
|
5696
|
+
+ }
|
|
5697
|
+
+ let filled = 0;
|
|
5698
|
+
+ while (filled < read) {
|
|
5699
|
+
+ const more = (0, node_fs_1.readSync)(presentFd, presentBytes, filled, read - filled, null);
|
|
5700
|
+
+ if (more === 0) {
|
|
5701
|
+
+ return false;
|
|
5702
|
+
+ }
|
|
5703
|
+
+ filled += more;
|
|
5704
|
+
+ }
|
|
5705
|
+
+ if (cachedBytes.compare(presentBytes, 0, read, 0, read) !== 0) {
|
|
5706
|
+
+ return false;
|
|
5707
|
+
+ }
|
|
5708
|
+
+ }
|
|
5709
|
+
+ }
|
|
5710
|
+
+ finally {
|
|
5711
|
+
+ (0, node_fs_1.closeSync)(presentFd);
|
|
5712
|
+
+ }
|
|
5713
|
+
+ }
|
|
5714
|
+
+ finally {
|
|
5715
|
+
+ (0, node_fs_1.closeSync)(cachedFd);
|
|
5716
|
+
+ }
|
|
4404
5717
|
+}
|
|
4405
5718
|
function tryAndRetry(fn) {
|
|
4406
5719
|
let attempts = 0;
|
|
@@ -4763,10 +6076,10 @@ index 0000000000000000000000000000000000000000..80e276f0681686cf4f47829bbdcfa705
|
|
|
4763
6076
|
+}
|
|
4764
6077
|
diff --git a/dist/src/tasks-runner/remote-cache-outage.d.ts b/dist/src/tasks-runner/remote-cache-outage.d.ts
|
|
4765
6078
|
new file mode 100644
|
|
4766
|
-
index 0000000000000000000000000000000000000000..
|
|
6079
|
+
index 0000000000000000000000000000000000000000..6a09eaddf12b558dbe78044e715e617f3ab1f2d5
|
|
4767
6080
|
--- /dev/null
|
|
4768
6081
|
+++ b/dist/src/tasks-runner/remote-cache-outage.d.ts
|
|
4769
|
-
@@ -0,0 +1,
|
|
6082
|
+
@@ -0,0 +1,52 @@
|
|
4770
6083
|
+import type { CachedResult } from '../native';
|
|
4771
6084
|
+import type { RemoteCacheV2 } from './default-tasks-runner';
|
|
4772
6085
|
+export declare const REMOTE_CACHE_ANSWER_WITHIN_MS = 90000;
|
|
@@ -4807,23 +6120,32 @@ index 0000000000000000000000000000000000000000..aecbe296f6bf80377fca38969c6efbf6
|
|
|
4807
6120
|
+ store(hash: string, cacheDirectory: string, terminalOutput: string, code: number): Promise<boolean>;
|
|
4808
6121
|
+ private request;
|
|
4809
6122
|
+}
|
|
4810
|
-
+export declare
|
|
6123
|
+
+export declare function parseStoreSecondsPerMiB(value: string | undefined): number | null;
|
|
6124
|
+
+export declare function isWorthStoring(builtInMs: number | undefined, outputBytes: number, secondsPerMiB: number): boolean;
|
|
6125
|
+
+export declare function outputBytesOf(directory: string): Promise<number>;
|
|
6126
|
+
+export declare class CostBoundRemoteCache implements RemoteCacheV2 {
|
|
4811
6127
|
+ private readonly remote;
|
|
4812
|
-
+
|
|
6128
|
+
+ private readonly secondsPerMiB;
|
|
6129
|
+
+ private readonly measure;
|
|
6130
|
+
+ private measureFailureSaid;
|
|
6131
|
+
+ constructor(remote: RemoteCacheV2, secondsPerMiB: number, measure?: (entryDirectory: string) => Promise<number>);
|
|
4813
6132
|
+ retrieve(hash: string, cacheDirectory: string): Promise<CachedResult | null>;
|
|
4814
|
-
+ store(hash: string, cacheDirectory: string, terminalOutput: string, code: number): Promise<boolean>;
|
|
6133
|
+
+ store(hash: string, cacheDirectory: string, terminalOutput: string, code: number, builtInMs?: number): Promise<boolean>;
|
|
4815
6134
|
+}
|
|
4816
6135
|
diff --git a/dist/src/tasks-runner/remote-cache-outage.js b/dist/src/tasks-runner/remote-cache-outage.js
|
|
4817
6136
|
new file mode 100644
|
|
4818
|
-
index 0000000000000000000000000000000000000000..
|
|
6137
|
+
index 0000000000000000000000000000000000000000..85a6d257c34dd84bb2acc85b62f4e0e97aed9e69
|
|
4819
6138
|
--- /dev/null
|
|
4820
6139
|
+++ b/dist/src/tasks-runner/remote-cache-outage.js
|
|
4821
|
-
@@ -0,0 +1,
|
|
6140
|
+
@@ -0,0 +1,264 @@
|
|
4822
6141
|
+"use strict";
|
|
4823
6142
|
+Object.defineProperty(exports, "__esModule", { value: true });
|
|
4824
|
-
+exports.
|
|
6143
|
+
+exports.CostBoundRemoteCache = exports.RemoteCacheOutageGuard = exports.REMOTE_CACHE_ANSWER_WITHIN_MS = void 0;
|
|
4825
6144
|
+exports.settleRemoteCacheRequest = settleRemoteCacheRequest;
|
|
4826
6145
|
+exports.describeRemoteCacheOutage = describeRemoteCacheOutage;
|
|
6146
|
+
+exports.parseStoreSecondsPerMiB = parseStoreSecondsPerMiB;
|
|
6147
|
+
+exports.isWorthStoring = isWorthStoring;
|
|
6148
|
+
+exports.outputBytesOf = outputBytesOf;
|
|
4827
6149
|
+const node_fs_1 = require("node:fs");
|
|
4828
6150
|
+const promises_1 = require("node:fs/promises");
|
|
4829
6151
|
+const path_1 = require("node:path");
|
|
@@ -4984,21 +6306,76 @@ index 0000000000000000000000000000000000000000..c8d00d0f94ed40dfc27b4ffaf0018311
|
|
|
4984
6306
|
+}
|
|
4985
6307
|
+exports.RemoteCacheOutageGuard = RemoteCacheOutageGuard;
|
|
4986
6308
|
+/**
|
|
4987
|
-
+ *
|
|
4988
|
-
+ *
|
|
6309
|
+
+ * The bytes of one task result's entry directory: the outputs and terminal output Nx's native `store` archives. A
|
|
6310
|
+
+ * symbolic link counts nothing: the bytes of its own path are not an output's.
|
|
6311
|
+
+ */
|
|
6312
|
+
+async function outputBytesOf(directory) {
|
|
6313
|
+
+ let bytes = 0;
|
|
6314
|
+
+ for (const entry of await (0, promises_1.readdir)(directory, { recursive: true, withFileTypes: true })) {
|
|
6315
|
+
+ if (entry.isFile()) {
|
|
6316
|
+
+ bytes += (await (0, promises_1.stat)((0, path_1.join)(entry.parentPath ?? entry.path, entry.name))).size;
|
|
6317
|
+
+ }
|
|
6318
|
+
+ }
|
|
6319
|
+
+ return bytes;
|
|
6320
|
+
+}
|
|
6321
|
+
+const BYTES_PER_MIB = 1024 * 1024;
|
|
6322
|
+
+const STORE_BOUND_ENV = 'NX_SELF_HOSTED_REMOTE_CACHE_STORE_SECONDS_PER_MIB';
|
|
6323
|
+
+/**
|
|
6324
|
+
+ * Reads NX_SELF_HOSTED_REMOTE_CACHE_STORE_SECONDS_PER_MIB: null when it is unset, so the client stores as stock Nx
|
|
6325
|
+
+ * does, else the seconds of build time a result must have per MiB of outputs. Any other value is misconfiguration and
|
|
6326
|
+
+ * fails the run, naming the variable and the value.
|
|
4989
6327
|
+ */
|
|
4990
|
-
+
|
|
4991
|
-
+
|
|
6328
|
+
+function parseStoreSecondsPerMiB(value) {
|
|
6329
|
+
+ if (value === undefined || value === '') {
|
|
6330
|
+
+ return null;
|
|
6331
|
+
+ }
|
|
6332
|
+
+ if (!/^\d+(\.\d+)?$/.test(value)) {
|
|
6333
|
+
+ throw new Error(STORE_BOUND_ENV + ' must be a number of seconds, 0 or more: got ' + JSON.stringify(value));
|
|
6334
|
+
+ }
|
|
6335
|
+
+ return Number(value);
|
|
6336
|
+
+}
|
|
6337
|
+
+/**
|
|
6338
|
+
+ * Whether a result that took `builtInMs` to build and holds `outputBytes` of outputs saves enough to be stored: at
|
|
6339
|
+
+ * least `secondsPerMiB` seconds per MiB of outputs, counting at least one MiB. A build time that is not a number is
|
|
6340
|
+
+ * never worth it.
|
|
6341
|
+
+ */
|
|
6342
|
+
+function isWorthStoring(builtInMs, outputBytes, secondsPerMiB) {
|
|
6343
|
+
+ return builtInMs / 1000 >= secondsPerMiB * Math.max(1, outputBytes / BYTES_PER_MIB);
|
|
6344
|
+
+}
|
|
6345
|
+
+/**
|
|
6346
|
+
+ * A checkout stores the tasks it executed that are worth their bytes and no other (specs/cowshed/03_caches.md "What a
|
|
6347
|
+
+ * checkout stores"). `store` answers false, before any archive is built, for a result that took less than the bound asks.
|
|
6348
|
+
+ */
|
|
6349
|
+
+class CostBoundRemoteCache {
|
|
6350
|
+
+ constructor(remote, secondsPerMiB, measure = outputBytesOf) {
|
|
4992
6351
|
+ this.remote = remote;
|
|
6352
|
+
+ this.secondsPerMiB = secondsPerMiB;
|
|
6353
|
+
+ this.measure = measure;
|
|
6354
|
+
+ this.measureFailureSaid = false;
|
|
4993
6355
|
+ }
|
|
4994
6356
|
+ retrieve(hash, cacheDirectory) {
|
|
4995
6357
|
+ return this.remote.retrieve(hash, cacheDirectory);
|
|
4996
6358
|
+ }
|
|
4997
|
-
+ async store() {
|
|
4998
|
-
+
|
|
6359
|
+
+ async store(hash, cacheDirectory, terminalOutput, code, builtInMs) {
|
|
6360
|
+
+ let bytes;
|
|
6361
|
+
+ try {
|
|
6362
|
+
+ bytes = await this.measure((0, path_1.join)(cacheDirectory, hash));
|
|
6363
|
+
+ }
|
|
6364
|
+
+ catch (error) {
|
|
6365
|
+
+ if (!this.measureFailureSaid) {
|
|
6366
|
+
+ this.measureFailureSaid = true;
|
|
6367
|
+
+ logger_1.logger.warn('Remote cache store skipped: could not measure the outputs of ' + hash + ' (' + oneLine(String(error)) + ')');
|
|
6368
|
+
+ }
|
|
6369
|
+
+ return false;
|
|
6370
|
+
+ }
|
|
6371
|
+
+ if (!isWorthStoring(builtInMs, bytes, this.secondsPerMiB)) {
|
|
6372
|
+
+ logger_1.logger.verbose('Remote cache: not storing ' + hash + ', built in ' + builtInMs + ' ms with ' + bytes + ' bytes of outputs (' + STORE_BOUND_ENV + '=' + this.secondsPerMiB + ')');
|
|
6373
|
+
+ return false;
|
|
6374
|
+
+ }
|
|
6375
|
+
+ return this.remote.store(hash, cacheDirectory, terminalOutput, code);
|
|
4999
6376
|
+ }
|
|
5000
6377
|
+}
|
|
5001
|
-
+exports.
|
|
6378
|
+
+exports.CostBoundRemoteCache = CostBoundRemoteCache;
|
|
5002
6379
|
+/** Staging directories not yet removed; the process removes what is left as it exits. */
|
|
5003
6380
|
+const unsettledStaging = new Set();
|
|
5004
6381
|
+process.on('exit', () => {
|
|
@@ -5050,6 +6427,90 @@ index b068c8bb203fd47d11e0d5cdc411b4444fc244fd..851d4428983a7e32aafd059580cfbc82
|
|
|
5050
6427
|
return;
|
|
5051
6428
|
}
|
|
5052
6429
|
const { outdatedAgents } = await client_1.daemonClient.getConfigureAiAgentsStatus();
|
|
6430
|
+
diff --git a/dist/src/tasks-runner/running-tasks/batch-process.js b/dist/src/tasks-runner/running-tasks/batch-process.js
|
|
6431
|
+
index 4c56ddede1856427cf936950e2771bf8f9322e92..9c3b57391a002f29a4f5a72c1d925050a8efe31a 100644
|
|
6432
|
+
--- a/dist/src/tasks-runner/running-tasks/batch-process.js
|
|
6433
|
+
+++ b/dist/src/tasks-runner/running-tasks/batch-process.js
|
|
6434
|
+
@@ -6,6 +6,7 @@ const crypto_1 = require("crypto");
|
|
6435
|
+
const path_1 = require("path");
|
|
6436
|
+
const native_1 = require("../../native");
|
|
6437
|
+
const cache_1 = require("../cache");
|
|
6438
|
+
+const child_process_1 = require("../../utils/child-process");
|
|
6439
|
+
const exit_codes_1 = require("../../utils/exit-codes");
|
|
6440
|
+
const output_1 = require("../../utils/output");
|
|
6441
|
+
const batch_messages_1 = require("../batch/batch-messages");
|
|
6442
|
+
@@ -68,6 +69,7 @@ class BatchProcess {
|
|
6443
|
+
* summary is still pointing at.
|
|
6444
|
+
*/
|
|
6445
|
+
this.captureNonce = (0, crypto_1.randomBytes)(4).toString('hex');
|
|
6446
|
+
+ this.stdioClosed = (0, child_process_1.whenStdioClosed)(this.childProcess);
|
|
6447
|
+
this.childProcess.on('message', (message) => {
|
|
6448
|
+
switch (message.type) {
|
|
6449
|
+
case batch_messages_1.BatchMessageType.CompleteTask: {
|
|
6450
|
+
@@ -294,8 +296,8 @@ class BatchProcess {
|
|
6451
|
+
* batch as one fold, so output no task claimed is not lost.
|
|
6452
|
+
*
|
|
6453
|
+
* Not valid to read before `flushCapturedOutput`; that flush ends the stream,
|
|
6454
|
+
- * so a chunk arriving afterwards - a worker's stdout can deliver past the
|
|
6455
|
+
- * exit event `getResults()` settles on - is dropped rather than appended.
|
|
6456
|
+
+ * so a chunk arriving afterwards - a worker can still write after the
|
|
6457
|
+
+ * results message `getResults()` settles on - is dropped rather than appended.
|
|
6458
|
+
*/
|
|
6459
|
+
getCapturedOutputPath() {
|
|
6460
|
+
return this.capturedOutputPath;
|
|
6461
|
+
@@ -341,7 +343,9 @@ class BatchProcess {
|
|
6462
|
+
new Promise((_, rej) => {
|
|
6463
|
+
this.onExit((code) => {
|
|
6464
|
+
if (code !== 0) {
|
|
6465
|
+
- rej(new Error(`"${this.executorName}" exited unexpectedly with code: ${code}`));
|
|
6466
|
+
+ // A rejection makes the caller flush the capture, which drops
|
|
6467
|
+
+ // whatever the crashed worker wrote that has not been read yet.
|
|
6468
|
+
+ this.stdioClosed.then(() => rej(new Error(`"${this.executorName}" exited unexpectedly with code: ${code}`)));
|
|
6469
|
+
}
|
|
6470
|
+
});
|
|
6471
|
+
}),
|
|
6472
|
+
diff --git a/dist/src/tasks-runner/task-env.js b/dist/src/tasks-runner/task-env.js
|
|
6473
|
+
index bded0d604f20417f61fdf18bcf62b09966847d43..2aa4f9cde2f677b89032b439ef90c7c7ee68f977 100644
|
|
6474
|
+
--- a/dist/src/tasks-runner/task-env.js
|
|
6475
|
+
+++ b/dist/src/tasks-runner/task-env.js
|
|
6476
|
+
@@ -49,29 +49,20 @@ function getEnvVariablesForBatchProcess(skipNxCache, captureStderr) {
|
|
6477
|
+
delete res[ready_signal_1.READY_URL_ENV];
|
|
6478
|
+
return res;
|
|
6479
|
+
}
|
|
6480
|
+
-// The orchestrator now calls this eagerly during the coordinator pre-hash
|
|
6481
|
+
-// in addition to processTask (and again in hashBatchTasks), so the same
|
|
6482
|
+
-// task hits this function multiple times per run. Each call reads 3+ .env
|
|
6483
|
+
-// files from disk — memoize by task.id to skip the repeat work.
|
|
6484
|
+
-//
|
|
6485
|
+
-// Cache lifetime is the current Nx invocation: the function is only called
|
|
6486
|
+
-// from CLI/orchestrator code (not the long-lived daemon), so the map is
|
|
6487
|
+
-// scoped to a single run. Callers must not mutate the returned env — they
|
|
6488
|
+
-// already spread it into new objects before adding task-specific overrides
|
|
6489
|
+
-// (see getEnvVariablesForTask).
|
|
6490
|
+
-const taskSpecificEnvCache = new Map();
|
|
6491
|
+
+// The environment a task is hashed and forked with: the ambient env with the root dotenv files Nx loaded on init
|
|
6492
|
+
+// unloaded, then the task's own dotenv files. It reads `process.env` as it stands, so what a run's preTasksExecution
|
|
6493
|
+
+// published reaches that run's tasks. A run reads it once per task through its orchestrator
|
|
6494
|
+
+// (`TaskOrchestrator.taskSpecificEnv`), whose memo lives exactly as long as the run. A module-level memo outlived the
|
|
6495
|
+
+// invocation in a client that runs several in one process, and hashed and forked a later run's tasks with the first
|
|
6496
|
+
+// run's environment. Callers must not mutate the returned env — they already spread it into new objects before adding
|
|
6497
|
+
+// task-specific overrides (see getEnvVariablesForTask).
|
|
6498
|
+
function getTaskSpecificEnv(task, graph) {
|
|
6499
|
+
- const cached = taskSpecificEnvCache.get(task.id);
|
|
6500
|
+
- if (cached)
|
|
6501
|
+
- return cached;
|
|
6502
|
+
// Unload any dot env files at the root of the workspace that were loaded on init of Nx.
|
|
6503
|
+
const taskEnv = unloadDotEnvFiles({ ...process.env });
|
|
6504
|
+
- const env = process.env.NX_LOAD_DOT_ENV_FILES === 'true'
|
|
6505
|
+
+ return process.env.NX_LOAD_DOT_ENV_FILES === 'true'
|
|
6506
|
+
? loadDotEnvFilesForTask(task, graph, taskEnv)
|
|
6507
|
+
: // If not loading dot env files, ensure env vars created by system are still loaded
|
|
6508
|
+
taskEnv;
|
|
6509
|
+
- taskSpecificEnvCache.set(task.id, env);
|
|
6510
|
+
- return env;
|
|
6511
|
+
}
|
|
6512
|
+
/**
|
|
6513
|
+
* Reconstructs, at graph-construction time, the env a task would see: the
|
|
5053
6514
|
diff --git a/dist/src/tasks-runner/task-graph-utils.d.ts b/dist/src/tasks-runner/task-graph-utils.d.ts
|
|
5054
6515
|
index c808d03befeaa74a79967f03c5a0dcf86685c2e7..024f58d5b865e4080bc6fd47584838567219ec6e 100644
|
|
5055
6516
|
--- a/dist/src/tasks-runner/task-graph-utils.d.ts
|
|
@@ -5147,10 +6608,18 @@ index f9f93ce62eab9448a72ad9d95b962067de113f1c..8657ded47a3b9df09d7a7ee8ed04490e
|
|
|
5147
6608
|
}
|
|
5148
6609
|
return cycles.size ? cycles : null;
|
|
5149
6610
|
diff --git a/dist/src/tasks-runner/task-orchestrator.d.ts b/dist/src/tasks-runner/task-orchestrator.d.ts
|
|
5150
|
-
index b0d3c985bc330a54b43df557d3e247e1bf64e060..
|
|
6611
|
+
index b0d3c985bc330a54b43df557d3e247e1bf64e060..ff7cd099c7a2092bdba5d1232ee7357028e63ab9 100644
|
|
5151
6612
|
--- a/dist/src/tasks-runner/task-orchestrator.d.ts
|
|
5152
6613
|
+++ b/dist/src/tasks-runner/task-orchestrator.d.ts
|
|
5153
|
-
@@ -
|
|
6614
|
+
@@ -42,6 +42,7 @@ export declare class TaskOrchestrator {
|
|
6615
|
+
private reverseTaskDeps;
|
|
6616
|
+
private initializingTaskIds;
|
|
6617
|
+
private processedTasks;
|
|
6618
|
+
+ private readonly taskSpecificEnvs;
|
|
6619
|
+
private cacheMissedHashes;
|
|
6620
|
+
private copiedOutputFiles;
|
|
6621
|
+
private completedTasks;
|
|
6622
|
+
@@ -49,6 +50,8 @@ export declare class TaskOrchestrator {
|
|
5154
6623
|
private pendingDiscreteWorkers;
|
|
5155
6624
|
private groups;
|
|
5156
6625
|
private continuousTasksStarted;
|
|
@@ -5159,7 +6628,7 @@ index b0d3c985bc330a54b43df557d3e247e1bf64e060..30dbf685a4b05ceb19e27b0b262d821b
|
|
|
5159
6628
|
/**
|
|
5160
6629
|
* How many folds each batch id has rendered. A batch that reports a strict
|
|
5161
6630
|
* subset of its tasks is re-run under the same id, so one id can produce more
|
|
5162
|
-
@@ -58,6 +
|
|
6631
|
+
@@ -58,6 +61,7 @@ export declare class TaskOrchestrator {
|
|
5163
6632
|
private bailed;
|
|
5164
6633
|
private resolveStopPromise;
|
|
5165
6634
|
private stopRequested;
|
|
@@ -5167,7 +6636,7 @@ index b0d3c985bc330a54b43df557d3e247e1bf64e060..30dbf685a4b05ceb19e27b0b262d821b
|
|
|
5167
6636
|
private runningContinuousTasks;
|
|
5168
6637
|
private runningRunCommandsTasks;
|
|
5169
6638
|
private runningDiscreteTasks;
|
|
5170
|
-
@@ -73,6 +
|
|
6639
|
+
@@ -73,6 +77,8 @@ export declare class TaskOrchestrator {
|
|
5171
6640
|
private cleanupPromise;
|
|
5172
6641
|
private signalHandlers;
|
|
5173
6642
|
private tasksWithPersistedOutput;
|
|
@@ -5176,7 +6645,7 @@ index b0d3c985bc330a54b43df557d3e247e1bf64e060..30dbf685a4b05ceb19e27b0b262d821b
|
|
|
5176
6645
|
constructor(hasher: TaskHasher, initiatingProject: string | undefined, initiatingTasks: Task[], projectGraph: ProjectGraph, taskGraph: TaskGraph, nxJson: NxJsonConfiguration, options: NxArgs & DefaultTasksRunnerOptions, bail: boolean, daemon: DaemonClient,
|
|
5177
6646
|
/** What the user named; undefined means they named nothing. */
|
|
5178
6647
|
specifiedOutputStyle: OutputStyle | undefined,
|
|
5179
|
-
@@ -84,6 +
|
|
6648
|
+
@@ -84,6 +90,7 @@ export declare class TaskOrchestrator {
|
|
5180
6649
|
run(): Promise<{
|
|
5181
6650
|
[k: string]: TaskStatus;
|
|
5182
6651
|
}>;
|
|
@@ -5184,7 +6653,15 @@ index b0d3c985bc330a54b43df557d3e247e1bf64e060..30dbf685a4b05ceb19e27b0b262d821b
|
|
|
5184
6653
|
nextBatch(): Batch;
|
|
5185
6654
|
/**
|
|
5186
6655
|
* Coordinator loop. All batch operations (hashing, cache resolution)
|
|
5187
|
-
@@ -
|
|
6656
|
+
@@ -99,6 +106,7 @@ export declare class TaskOrchestrator {
|
|
6657
|
+
private executeContinuousTaskLoop;
|
|
6658
|
+
private hasUnresolvedCacheableTask;
|
|
6659
|
+
private scheduleAfterReadiness;
|
|
6660
|
+
+ private taskSpecificEnv;
|
|
6661
|
+
private processTask;
|
|
6662
|
+
processAllScheduledTasks(): void;
|
|
6663
|
+
processTasks(taskIds: string[]): void;
|
|
6664
|
+
@@ -136,12 +144,9 @@ export declare class TaskOrchestrator {
|
|
5188
6665
|
* cache fetch + lifecycle to the public method. Returns true if any
|
|
5189
6666
|
* tasks were resolved.
|
|
5190
6667
|
*
|
|
@@ -5200,7 +6677,7 @@ index b0d3c985bc330a54b43df557d3e247e1bf64e060..30dbf685a4b05ceb19e27b0b262d821b
|
|
|
5200
6677
|
*/
|
|
5201
6678
|
private resolveCachedTasksBulk;
|
|
5202
6679
|
/**
|
|
5203
|
-
@@ -158,6 +
|
|
6680
|
+
@@ -158,6 +163,7 @@ export declare class TaskOrchestrator {
|
|
5204
6681
|
private applyBatchCachedResults;
|
|
5205
6682
|
private hashBatchTasks;
|
|
5206
6683
|
applyFromCacheOrRunBatch(doNotSkipCache: boolean, batch: Batch, groupId: number): Promise<TaskResult[]>;
|
|
@@ -5208,7 +6685,7 @@ index b0d3c985bc330a54b43df557d3e247e1bf64e060..30dbf685a4b05ceb19e27b0b262d821b
|
|
|
5208
6685
|
private runBatchWave;
|
|
5209
6686
|
private runBatch;
|
|
5210
6687
|
/**
|
|
5211
|
-
@@ -252,12 +
|
|
6688
|
+
@@ -252,12 +258,11 @@ export declare class TaskOrchestrator {
|
|
5212
6689
|
* don't actually compete for parallelism.
|
|
5213
6690
|
*/
|
|
5214
6691
|
resolveCachedTasks(doNotSkipCache: boolean, tasks: Task[], groupId: number): Promise<TaskResult[]>;
|
|
@@ -5224,7 +6701,7 @@ index b0d3c985bc330a54b43df557d3e247e1bf64e060..30dbf685a4b05ceb19e27b0b262d821b
|
|
|
5224
6701
|
*/
|
|
5225
6702
|
private dispatchDiscreteWorker;
|
|
5226
6703
|
/**
|
|
5227
|
-
@@ -269,11 +
|
|
6704
|
+
@@ -269,11 +274,14 @@ export declare class TaskOrchestrator {
|
|
5228
6705
|
*/
|
|
5229
6706
|
private handleDiscreteWorkerFailure;
|
|
5230
6707
|
/**
|
|
@@ -5243,7 +6720,7 @@ index b0d3c985bc330a54b43df557d3e247e1bf64e060..30dbf685a4b05ceb19e27b0b262d821b
|
|
|
5243
6720
|
private runTaskInForkedProcess;
|
|
5244
6721
|
startContinuousTask(task: Task, groupId: number): Promise<NoopChildProcess | RunningTask | SharedRunningTask>;
|
|
5245
6722
|
diff --git a/dist/src/tasks-runner/task-orchestrator.js b/dist/src/tasks-runner/task-orchestrator.js
|
|
5246
|
-
index 9a17f88be6502a302c5f5eab71df646a2f87851c..
|
|
6723
|
+
index 9a17f88be6502a302c5f5eab71df646a2f87851c..8fc11ce4af48b49d7055f8bdbb9d0d8d8882119b 100644
|
|
5247
6724
|
--- a/dist/src/tasks-runner/task-orchestrator.js
|
|
5248
6725
|
+++ b/dist/src/tasks-runner/task-orchestrator.js
|
|
5249
6726
|
@@ -32,6 +32,8 @@ const shared_running_task_1 = require("./running-tasks/shared-running-task");
|
|
@@ -5255,7 +6732,7 @@ index 9a17f88be6502a302c5f5eab71df646a2f87851c..df1b06c7369aea573df06a3a3d8afd99
|
|
|
5255
6732
|
/**
|
|
5256
6733
|
* Resolve a batch executor's per-task result to a TaskStatus. Prefers an
|
|
5257
6734
|
* explicit `status` from the executor; falls back to the `success` boolean
|
|
5258
|
-
@@ -150,11 +152,
|
|
6735
|
+
@@ -150,11 +152,12 @@ class TaskOrchestrator {
|
|
5259
6736
|
// underlying real tasks become the anchors.
|
|
5260
6737
|
this.initializingTaskIds = (0, utils_1.expandInitiatingTasksThroughNoop)(this.initiatingTasks, this.taskGraph, this.projectGraph);
|
|
5261
6738
|
this.processedTasks = new Map();
|
|
@@ -5264,13 +6741,16 @@ index 9a17f88be6502a302c5f5eab71df646a2f87851c..df1b06c7369aea573df06a3a3d8afd99
|
|
|
5264
6741
|
- // schedule — so a missed hash never needs re-querying. Without this, a
|
|
5265
6742
|
- // miss waiting for a worker slot is re-queried (including the remote
|
|
5266
6743
|
- // retrieval) on every coordinator cycle.
|
|
6744
|
+
+ // Each task's environment for this run, read once: the coordinator's pre-hash, processTask and a batch's
|
|
6745
|
+
+ // hashing share it, and it ends with the run (`taskSpecificEnv`).
|
|
6746
|
+
+ this.taskSpecificEnvs = new Map();
|
|
5267
6747
|
+ // Probe a queued miss once, not on every coordinator wakeup.
|
|
5268
6748
|
+ // Output producers recheck after taking their cross-client lease: a
|
|
5269
6749
|
+ // foreign client can populate the key while this worker is queued.
|
|
5270
6750
|
this.cacheMissedHashes = new Set();
|
|
5271
6751
|
// The files the cache just wrote or restored, by task id, for postRunSteps
|
|
5272
6752
|
// to hand the daemon instead of it walking the outputs again.
|
|
5273
|
-
@@ -164,6 +
|
|
6753
|
+
@@ -164,6 +167,9 @@ class TaskOrchestrator {
|
|
5274
6754
|
this.pendingDiscreteWorkers = new Set();
|
|
5275
6755
|
this.groups = [];
|
|
5276
6756
|
this.continuousTasksStarted = 0;
|
|
@@ -5280,7 +6760,7 @@ index 9a17f88be6502a302c5f5eab71df646a2f87851c..df1b06c7369aea573df06a3a3d8afd99
|
|
|
5280
6760
|
/**
|
|
5281
6761
|
* How many folds each batch id has rendered. A batch that reports a strict
|
|
5282
6762
|
* subset of its tasks is re-run under the same id, so one id can produce more
|
|
5283
|
-
@@ -173,6 +
|
|
6763
|
+
@@ -173,6 +179,7 @@ class TaskOrchestrator {
|
|
5284
6764
|
this.bailed = false;
|
|
5285
6765
|
this.resolveStopPromise = null;
|
|
5286
6766
|
this.stopRequested = false;
|
|
@@ -5288,7 +6768,7 @@ index 9a17f88be6502a302c5f5eab71df646a2f87851c..df1b06c7369aea573df06a3a3d8afd99
|
|
|
5288
6768
|
this.runningContinuousTasks = new Map();
|
|
5289
6769
|
this.runningRunCommandsTasks = new Map();
|
|
5290
6770
|
this.runningDiscreteTasks = new Map();
|
|
5291
|
-
@@ -195,6 +
|
|
6771
|
+
@@ -195,6 +202,9 @@ class TaskOrchestrator {
|
|
5292
6772
|
// exit, and the paths that never spawn one write it inline. The backstop in
|
|
5293
6773
|
// postRunSteps consults this so a task's output is written exactly once.
|
|
5294
6774
|
this.tasksWithPersistedOutput = new Set();
|
|
@@ -5298,7 +6778,7 @@ index 9a17f88be6502a302c5f5eab71df646a2f87851c..df1b06c7369aea573df06a3a3d8afd99
|
|
|
5298
6778
|
}
|
|
5299
6779
|
async init() {
|
|
5300
6780
|
this.setupSignalHandlers();
|
|
5301
|
-
@@ -214,9 +
|
|
6781
|
+
@@ -214,9 +224,24 @@ class TaskOrchestrator {
|
|
5302
6782
|
}
|
|
5303
6783
|
}
|
|
5304
6784
|
async run() {
|
|
@@ -5323,7 +6803,7 @@ index 9a17f88be6502a302c5f5eab71df646a2f87851c..df1b06c7369aea573df06a3a3d8afd99
|
|
|
5323
6803
|
process.stdout.setMaxListeners(total + events_1.defaultMaxListeners);
|
|
5324
6804
|
process.stderr.setMaxListeners(total + events_1.defaultMaxListeners);
|
|
5325
6805
|
process.setMaxListeners(total + events_1.defaultMaxListeners);
|
|
5326
|
-
@@ -252,8 +
|
|
6806
|
+
@@ -252,8 +277,6 @@ class TaskOrchestrator {
|
|
5327
6807
|
// the native half does not exist.
|
|
5328
6808
|
(0, cache_1.sweepBatchOutputs)();
|
|
5329
6809
|
}
|
|
@@ -5332,7 +6812,16 @@ index 9a17f88be6502a302c5f5eab71df646a2f87851c..df1b06c7369aea573df06a3a3d8afd99
|
|
|
5332
6812
|
// Public API (defaultTasksRunner) returns a plain object keyed by
|
|
5333
6813
|
// task id. Internal state is a Map for faster lookup.
|
|
5334
6814
|
return Object.fromEntries(this.completedTasks);
|
|
5335
|
-
@@ -
|
|
6815
|
+
@@ -307,7 +330,7 @@ class TaskOrchestrator {
|
|
6816
|
+
if (unhashed.length > 0) {
|
|
6817
|
+
const perTaskEnvs = {};
|
|
6818
|
+
for (const task of unhashed) {
|
|
6819
|
+
- perTaskEnvs[task.id] = (0, task_env_1.getTaskSpecificEnv)(task, this.projectGraph);
|
|
6820
|
+
+ perTaskEnvs[task.id] = this.taskSpecificEnv(task);
|
|
6821
|
+
}
|
|
6822
|
+
await (0, hash_task_1.hashTasks)(this.hasher, this.projectGraph, this.fullTaskGraph, perTaskEnvs, this.taskDetails, unhashed);
|
|
6823
|
+
}
|
|
6824
|
+
@@ -345,6 +368,18 @@ class TaskOrchestrator {
|
|
5336
6825
|
const groupId = this.closeGroup();
|
|
5337
6826
|
this.dispatchDiscreteWorker(doNotSkipCache, task, groupId);
|
|
5338
6827
|
}
|
|
@@ -5351,7 +6840,27 @@ index 9a17f88be6502a302c5f5eab71df646a2f87851c..df1b06c7369aea573df06a3a3d8afd99
|
|
|
5351
6840
|
// 6. Nothing left to dispatch and nothing in flight — done.
|
|
5352
6841
|
if (!this.tasksSchedule.hasTasks() &&
|
|
5353
6842
|
this.pendingDiscreteWorkers.size === 0) {
|
|
5354
|
-
@@ -
|
|
6843
|
+
@@ -410,9 +445,18 @@ class TaskOrchestrator {
|
|
6844
|
+
}
|
|
6845
|
+
}
|
|
6846
|
+
// region Processing Scheduled Tasks
|
|
6847
|
+
+ /** `task`'s environment for this run, read once per task and kept only as long as this orchestrator. */
|
|
6848
|
+
+ taskSpecificEnv(task) {
|
|
6849
|
+
+ let env = this.taskSpecificEnvs.get(task.id);
|
|
6850
|
+
+ if (env === undefined) {
|
|
6851
|
+
+ env = (0, task_env_1.getTaskSpecificEnv)(task, this.projectGraph);
|
|
6852
|
+
+ this.taskSpecificEnvs.set(task.id, env);
|
|
6853
|
+
+ }
|
|
6854
|
+
+ return env;
|
|
6855
|
+
+ }
|
|
6856
|
+
async processTask(taskId) {
|
|
6857
|
+
const task = this.taskGraph.tasks[taskId];
|
|
6858
|
+
- const taskSpecificEnv = (0, task_env_1.getTaskSpecificEnv)(task, this.projectGraph);
|
|
6859
|
+
+ const taskSpecificEnv = this.taskSpecificEnv(task);
|
|
6860
|
+
if (!task.hash) {
|
|
6861
|
+
await (0, hash_task_1.hashTask)(this.hasher, this.projectGraph, this.fullTaskGraph, task, taskSpecificEnv, this.taskDetails);
|
|
6862
|
+
}
|
|
6863
|
+
@@ -581,12 +625,9 @@ class TaskOrchestrator {
|
|
5355
6864
|
* cache fetch + lifecycle to the public method. Returns true if any
|
|
5356
6865
|
* tasks were resolved.
|
|
5357
6866
|
*
|
|
@@ -5367,7 +6876,16 @@ index 9a17f88be6502a302c5f5eab71df646a2f87851c..df1b06c7369aea573df06a3a3d8afd99
|
|
|
5367
6876
|
*/
|
|
5368
6877
|
async resolveCachedTasksBulk() {
|
|
5369
6878
|
const { scheduledTasks } = this.tasksSchedule.getAllScheduledTasks();
|
|
5370
|
-
@@ -
|
|
6879
|
+
@@ -701,7 +742,7 @@ class TaskOrchestrator {
|
|
6880
|
+
// single-task path.
|
|
6881
|
+
const perTaskEnvs = {};
|
|
6882
|
+
for (const task of tasks) {
|
|
6883
|
+
- perTaskEnvs[task.id] = (0, task_env_1.getTaskSpecificEnv)(task, this.projectGraph);
|
|
6884
|
+
+ perTaskEnvs[task.id] = this.taskSpecificEnv(task);
|
|
6885
|
+
}
|
|
6886
|
+
await (0, hash_task_1.hashTasks)(this.hasher, this.projectGraph, this.fullTaskGraph, perTaskEnvs, this.taskDetails, tasks);
|
|
6887
|
+
}
|
|
6888
|
+
@@ -709,6 +750,17 @@ class TaskOrchestrator {
|
|
5371
6889
|
if (this.bailed || this.stopRequested) {
|
|
5372
6890
|
return [];
|
|
5373
6891
|
}
|
|
@@ -5385,7 +6903,7 @@ index 9a17f88be6502a302c5f5eab71df646a2f87851c..df1b06c7369aea573df06a3a3d8afd99
|
|
|
5385
6903
|
const applyFromCacheOrRunBatchStart = perf_hooks_1.performance.mark('TaskOrchestrator-apply-from-cache-or-run-batch:start');
|
|
5386
6904
|
const taskIds = Object.keys(batch.taskGraph.tasks);
|
|
5387
6905
|
this.options.lifeCycle.registerRunningBatch?.(batch.id, {
|
|
5388
|
-
@@ -1062,6 +
|
|
6906
|
+
@@ -1062,6 +1114,20 @@ class TaskOrchestrator {
|
|
5389
6907
|
* don't actually compete for parallelism.
|
|
5390
6908
|
*/
|
|
5391
6909
|
async resolveCachedTasks(doNotSkipCache, tasks, groupId) {
|
|
@@ -5406,7 +6924,7 @@ index 9a17f88be6502a302c5f5eab71df646a2f87851c..df1b06c7369aea573df06a3a3d8afd99
|
|
|
5406
6924
|
if (!doNotSkipCache || tasks.length === 0)
|
|
5407
6925
|
return [];
|
|
5408
6926
|
const cacheableTasks = tasks.filter((t) => t.cache);
|
|
5409
|
-
@@ -1088,10 +
|
|
6927
|
+
@@ -1088,10 +1154,8 @@ class TaskOrchestrator {
|
|
5410
6928
|
}
|
|
5411
6929
|
/**
|
|
5412
6930
|
* Fire a discrete-task worker and track it in pendingDiscreteWorkers until
|
|
@@ -5419,7 +6937,7 @@ index 9a17f88be6502a302c5f5eab71df646a2f87851c..df1b06c7369aea573df06a3a3d8afd99
|
|
|
5419
6937
|
*/
|
|
5420
6938
|
dispatchDiscreteWorker(doNotSkipCache, task, groupId) {
|
|
5421
6939
|
const worker = this.runTaskDirectly(doNotSkipCache, task, groupId)
|
|
5422
|
-
@@ -1125,9 +
|
|
6940
|
+
@@ -1125,9 +1189,11 @@ class TaskOrchestrator {
|
|
5423
6941
|
await this.postRunSteps([{ task, status: 'failure', terminalOutput }], doNotSkipCache, groupId);
|
|
5424
6942
|
}
|
|
5425
6943
|
/**
|
|
@@ -5434,7 +6952,7 @@ index 9a17f88be6502a302c5f5eab71df646a2f87851c..df1b06c7369aea573df06a3a3d8afd99
|
|
|
5434
6952
|
*/
|
|
5435
6953
|
async runTaskDirectly(doNotSkipCache, task, groupId) {
|
|
5436
6954
|
// Wait for task to be processed
|
|
5437
|
-
@@ -1155,6 +
|
|
6955
|
+
@@ -1155,6 +1221,18 @@ class TaskOrchestrator {
|
|
5438
6956
|
terminalOutput: waitError.message,
|
|
5439
6957
|
};
|
|
5440
6958
|
}
|
|
@@ -5453,7 +6971,7 @@ index 9a17f88be6502a302c5f5eab71df646a2f87851c..df1b06c7369aea573df06a3a3d8afd99
|
|
|
5453
6971
|
await this.preRunSteps([task], { groupId });
|
|
5454
6972
|
const pipeOutput = await this.pipeOutputCapture(task);
|
|
5455
6973
|
const temporaryOutputPath = this.cache.temporaryOutputPath(task);
|
|
5456
|
-
@@ -1382,8 +
|
|
6974
|
+
@@ -1382,8 +1460,22 @@ class TaskOrchestrator {
|
|
5457
6975
|
}
|
|
5458
6976
|
}
|
|
5459
6977
|
async startContinuousTask(task, groupId) {
|
|
@@ -5478,7 +6996,7 @@ index 9a17f88be6502a302c5f5eab71df646a2f87851c..df1b06c7369aea573df06a3a3d8afd99
|
|
|
5478
6996
|
// This branch never reads the hash, so a failure to compute it is dropped
|
|
5479
6997
|
void this.processedTasks.get(task.id)?.catch(() => { });
|
|
5480
6998
|
let readyWhen;
|
|
5481
|
-
@@ -1432,11 +
|
|
6999
|
+
@@ -1432,11 +1524,6 @@ class TaskOrchestrator {
|
|
5482
7000
|
await this.scheduleNextTasksAndReleaseThreads();
|
|
5483
7001
|
return runningTask;
|
|
5484
7002
|
}
|
|
@@ -5490,7 +7008,7 @@ index 9a17f88be6502a302c5f5eab71df646a2f87851c..df1b06c7369aea573df06a3a3d8afd99
|
|
|
5490
7008
|
let pipeOutput;
|
|
5491
7009
|
let temporaryOutputPath;
|
|
5492
7010
|
let streamOutput;
|
|
5493
|
-
@@ -1485,7 +
|
|
7011
|
+
@@ -1485,7 +1572,11 @@ class TaskOrchestrator {
|
|
5494
7012
|
return new noop_child_process_1.NoopChildProcess({ code: 1, terminalOutput: '' });
|
|
5495
7013
|
}
|
|
5496
7014
|
let childProcess;
|
|
@@ -5502,7 +7020,7 @@ index 9a17f88be6502a302c5f5eab71df646a2f87851c..df1b06c7369aea573df06a3a3d8afd99
|
|
|
5502
7020
|
await this.preRunSteps([task], { groupId });
|
|
5503
7021
|
this.detectTaskInvocationLoop(task);
|
|
5504
7022
|
childProcess = await this.runTask(task, streamOutput, env, temporaryOutputPath, pipeOutput);
|
|
5505
|
-
@@ -1515,15 +
|
|
7023
|
+
@@ -1515,15 +1606,19 @@ class TaskOrchestrator {
|
|
5506
7024
|
// release paths (completeContinuousTask, the signal handler) both iterate
|
|
5507
7025
|
// that map. Drop it here or siblings wait on a task no one is running.
|
|
5508
7026
|
this.runningTasksService?.removeRunningTask(task.id);
|
|
@@ -5529,7 +7047,7 @@ index 9a17f88be6502a302c5f5eab71df646a2f87851c..df1b06c7369aea573df06a3a3d8afd99
|
|
|
5529
7047
|
});
|
|
5530
7048
|
}));
|
|
5531
7049
|
await this.scheduleNextTasksAndReleaseThreads();
|
|
5532
|
-
@@ -2114,22 +
|
|
7050
|
+
@@ -2114,22 +2209,32 @@ class TaskOrchestrator {
|
|
5533
7051
|
if (tasks.length === 0)
|
|
5534
7052
|
return resultMap;
|
|
5535
7053
|
if (this.daemon?.enabled()) {
|
|
@@ -5537,8 +7055,13 @@ index 9a17f88be6502a302c5f5eab71df646a2f87851c..df1b06c7369aea573df06a3a3d8afd99
|
|
|
5537
7055
|
+ // A daemon gone under a client that may never start one leaves the
|
|
5538
7056
|
+ // recorded outputs stamps to verify them, as without one.
|
|
5539
7057
|
+ const matches = await this.daemon.orWithoutDaemon(() => this.daemon.outputsHashesMatchBatch(tasks), () => (0, outputs_stamp_1.outputsStampsMatch)(tasks));
|
|
7058
|
+
+ // The daemon matches the hash it recorded of what a run or restore left, so a record of no files matched
|
|
7059
|
+
+ // outputs that were never there again. A hit keeps outputs only where the workspace holds them, as the
|
|
7060
|
+
+ // stamps answer without a daemon (outputs-stamp.js).
|
|
7061
|
+
+ const present = (0, native_1.getFilesForOutputsBatch)(workspace_root_1.workspaceRoot, tasks.map((task) => task.outputs));
|
|
5540
7062
|
for (let i = 0; i < tasks.length; i++) {
|
|
5541
|
-
|
|
7063
|
+
- resultMap.set(tasks[i].hash, !matches[i]);
|
|
7064
|
+
+ resultMap.set(tasks[i].hash, !matches[i] || present[i].length === 0);
|
|
5542
7065
|
}
|
|
5543
7066
|
}
|
|
5544
7067
|
else {
|
|
@@ -5563,7 +7086,7 @@ index 9a17f88be6502a302c5f5eab71df646a2f87851c..df1b06c7369aea573df06a3a3d8afd99
|
|
|
5563
7086
|
}
|
|
5564
7087
|
}
|
|
5565
7088
|
// endregion utils
|
|
5566
|
-
@@ -2208,6 +
|
|
7089
|
+
@@ -2208,6 +2313,8 @@ class TaskOrchestrator {
|
|
5567
7090
|
// Waiters must not sit out a probe once the run is stopping
|
|
5568
7091
|
this.abortAllReadiness();
|
|
5569
7092
|
this.readySignal?.close();
|
|
@@ -5572,7 +7095,7 @@ index 9a17f88be6502a302c5f5eab71df646a2f87851c..df1b06c7369aea573df06a3a3d8afd99
|
|
|
5572
7095
|
// Mark all running tasks for intentional stop
|
|
5573
7096
|
const reason = this.stopRequested ? 'interrupted' : 'fulfilled';
|
|
5574
7097
|
for (const entry of this.runningContinuousTasks.values()) {
|
|
5575
|
-
@@ -2277,6 +
|
|
7098
|
+
@@ -2277,6 +2384,7 @@ class TaskOrchestrator {
|
|
5576
7099
|
if (this.stopRequested)
|
|
5577
7100
|
return;
|
|
5578
7101
|
this.stopRequested = true;
|
|
@@ -5970,6 +7493,72 @@ index e654d8c832c5275a2aaa5015887db9167392a694..3e8af252980e6fa141a4af35a51b0681
|
|
|
5970
7493
|
+ }
|
|
5971
7494
|
+ return paths;
|
|
5972
7495
|
+}
|
|
7496
|
+
diff --git a/dist/src/utils/child-process.d.ts b/dist/src/utils/child-process.d.ts
|
|
7497
|
+
index d68999b0b603795bbbc4eb6ef916a8ae008e59ce..4ec8ff6292f811b2d12091250d275e6fa68062a8 100644
|
|
7498
|
+
--- a/dist/src/utils/child-process.d.ts
|
|
7499
|
+
+++ b/dist/src/utils/child-process.d.ts
|
|
7500
|
+
@@ -1,4 +1,4 @@
|
|
7501
|
+
-import { type ExecOptions, type ExecSyncOptions, type SpawnSyncOptions } from 'child_process';
|
|
7502
|
+
+import { type ChildProcess as NodeChildProcess, type ExecOptions, type ExecSyncOptions, type SpawnSyncOptions } from 'child_process';
|
|
7503
|
+
import { PackageManagerCommands } from './package-manager';
|
|
7504
|
+
import { ChildProcess } from '../native';
|
|
7505
|
+
export declare function getRunNxBaseCommand(packageManagerCommand?: PackageManagerCommands, cwd?: string): string;
|
|
7506
|
+
@@ -41,6 +41,13 @@ export declare function runNxAsync(cmd: string, options?: ExecOptions & {
|
|
7507
|
+
silent?: boolean;
|
|
7508
|
+
packageManagerCommand?: PackageManagerCommands;
|
|
7509
|
+
}): Promise<void>;
|
|
7510
|
+
+export declare function hasExited(child: NodeChildProcess): boolean;
|
|
7511
|
+
+/**
|
|
7512
|
+
+ * Settles once `child`'s stdio has closed, which Node reports after 'exit'.
|
|
7513
|
+
+ * Call it at spawn time: a 'close' emitted before the call is missed. Gives up
|
|
7514
|
+
+ * 1s after 'exit', since a descendant can keep the pipes open indefinitely.
|
|
7515
|
+
+ */
|
|
7516
|
+
+export declare function whenStdioClosed(child: NodeChildProcess): Promise<void>;
|
|
7517
|
+
export declare class PseudoTtyProcess {
|
|
7518
|
+
private childProcess;
|
|
7519
|
+
isAlive: boolean;
|
|
7520
|
+
diff --git a/dist/src/utils/child-process.js b/dist/src/utils/child-process.js
|
|
7521
|
+
index fc523cf236b7973e2f4e3f65d042a40f5fda40b3..6eb3daf7dc6640b8b7c45cea97d62aee2163c0b7 100644
|
|
7522
|
+
--- a/dist/src/utils/child-process.js
|
|
7523
|
+
+++ b/dist/src/utils/child-process.js
|
|
7524
|
+
@@ -7,6 +7,8 @@ exports.readInstalledNxBin = readInstalledNxBin;
|
|
7525
|
+
exports.runNxArgvSync = runNxArgvSync;
|
|
7526
|
+
exports.runNxSync = runNxSync;
|
|
7527
|
+
exports.runNxAsync = runNxAsync;
|
|
7528
|
+
+exports.hasExited = hasExited;
|
|
7529
|
+
+exports.whenStdioClosed = whenStdioClosed;
|
|
7530
|
+
const child_process_1 = require("child_process");
|
|
7531
|
+
const fs_1 = require("fs");
|
|
7532
|
+
const path_1 = require("path");
|
|
7533
|
+
@@ -160,6 +162,28 @@ async function runNxAsync(cmd, options) {
|
|
7534
|
+
}
|
|
7535
|
+
});
|
|
7536
|
+
}
|
|
7537
|
+
+function hasExited(child) {
|
|
7538
|
+
+ return child.exitCode !== null || child.signalCode !== null;
|
|
7539
|
+
+}
|
|
7540
|
+
+/**
|
|
7541
|
+
+ * Settles once `child`'s stdio has closed, which Node reports after 'exit'.
|
|
7542
|
+
+ * Call it at spawn time: a 'close' emitted before the call is missed. Gives up
|
|
7543
|
+
+ * 1s after 'exit', since a descendant can keep the pipes open indefinitely.
|
|
7544
|
+
+ */
|
|
7545
|
+
+function whenStdioClosed(child) {
|
|
7546
|
+
+ return new Promise((resolve) => {
|
|
7547
|
+
+ let timeout;
|
|
7548
|
+
+ child.once('close', () => {
|
|
7549
|
+
+ clearTimeout(timeout);
|
|
7550
|
+
+ resolve();
|
|
7551
|
+
+ });
|
|
7552
|
+
+ child.once('exit', () => {
|
|
7553
|
+
+ // Node runs expired timers before it reads the pipes, so a blocked event
|
|
7554
|
+
+ // loop would otherwise give up on output that is already there.
|
|
7555
|
+
+ timeout = setTimeout(() => setImmediate(resolve), 1000);
|
|
7556
|
+
+ });
|
|
7557
|
+
+ });
|
|
7558
|
+
+}
|
|
7559
|
+
class PseudoTtyProcess {
|
|
7560
|
+
constructor(childProcess) {
|
|
7561
|
+
this.childProcess = childProcess;
|
|
5973
7562
|
diff --git a/dist/src/utils/installed-nx-version.js b/dist/src/utils/installed-nx-version.js
|
|
5974
7563
|
index 15a5d36aa9116f7b5ddcadbbeca9dccb7cc7fe45..70cd1b78afb4c54e257c7eec99014a9b139c1293 100644
|
|
5975
7564
|
--- a/dist/src/utils/installed-nx-version.js
|
|
@@ -6145,11 +7734,36 @@ index 34dbaa2a5a44e6b7d1f69a516756b30939877bd7..09f95b73572a0d411f26d42aac2cfbf0
|
|
|
6145
7734
|
}
|
|
6146
7735
|
}
|
|
6147
7736
|
exports.TaskHistory = TaskHistory;
|
|
7737
|
+
diff --git a/dist/src/utils/workspace-context.d.ts b/dist/src/utils/workspace-context.d.ts
|
|
7738
|
+
index 8a4b38e06755c303b2328ff9ef01d06f49a7c249..70397218ce0a137315732c6b7adfbb97758c2611 100644
|
|
7739
|
+
--- a/dist/src/utils/workspace-context.d.ts
|
|
7740
|
+
+++ b/dist/src/utils/workspace-context.d.ts
|
|
7741
|
+
@@ -47,6 +47,12 @@ export declare function settleWorkspaceContext(workspaceRoot: string): ChangeBat
|
|
7742
|
+
* watcher: for a caller that has just applied changes itself.
|
|
7743
|
+
*/
|
|
7744
|
+
export declare function takeAppliedWorkspaceChanges(workspaceRoot: string): ChangeBatch;
|
|
7745
|
+
+/**
|
|
7746
|
+
+ * Walks the workspace again from the disk, never from another process's
|
|
7747
|
+
+ * archive, and applies what the walk finds changed to the context: take those
|
|
7748
|
+
+ * changes with `takeAppliedWorkspaceChanges`.
|
|
7749
|
+
+ */
|
|
7750
|
+
+export declare function rescanWorkspaceContext(workspaceRoot: string): void;
|
|
7751
|
+
export declare function isWatchingWorkspaceContext(): boolean;
|
|
7752
|
+
/**
|
|
7753
|
+
* Listens for every event the context's watch delivers, including writes
|
|
6148
7754
|
diff --git a/dist/src/utils/workspace-context.js b/dist/src/utils/workspace-context.js
|
|
6149
|
-
index 1b551e8dcab2b0b1e6ac46af9d46456e7b9a3eeb..
|
|
7755
|
+
index 1b551e8dcab2b0b1e6ac46af9d46456e7b9a3eeb..05de9601000f683210ef76c4939e925e11a5a6ed 100644
|
|
6150
7756
|
--- a/dist/src/utils/workspace-context.js
|
|
6151
7757
|
+++ b/dist/src/utils/workspace-context.js
|
|
6152
|
-
@@ -
|
|
7758
|
+
@@ -16,6 +16,7 @@ exports.getAllFileDataInContext = getAllFileDataInContext;
|
|
7759
|
+
exports.subscribeToWorkspaceChanges = subscribeToWorkspaceChanges;
|
|
7760
|
+
exports.settleWorkspaceContext = settleWorkspaceContext;
|
|
7761
|
+
exports.takeAppliedWorkspaceChanges = takeAppliedWorkspaceChanges;
|
|
7762
|
+
+exports.rescanWorkspaceContext = rescanWorkspaceContext;
|
|
7763
|
+
exports.isWatchingWorkspaceContext = isWatchingWorkspaceContext;
|
|
7764
|
+
exports.subscribeToWatchEvents = subscribeToWatchEvents;
|
|
7765
|
+
exports.isEmptyBatch = isEmptyBatch;
|
|
7766
|
+
@@ -62,7 +63,7 @@ async function getNxWorkspaceFilesFromContext(workspaceRoot, projectRootMap, use
|
|
6153
7767
|
await ensureFilesReady(workspaceRoot);
|
|
6154
7768
|
return workspaceContext.getWorkspaceFiles(projectRootMap);
|
|
6155
7769
|
}
|
|
@@ -6158,7 +7772,7 @@ index 1b551e8dcab2b0b1e6ac46af9d46456e7b9a3eeb..bab5280fc705e522dfcc6aefe383f67e
|
|
|
6158
7772
|
}
|
|
6159
7773
|
/**
|
|
6160
7774
|
* Sync method to get files matching globs from workspace context.
|
|
6161
|
-
@@ -81,7 +
|
|
7775
|
+
@@ -81,7 +82,7 @@ async function globWithWorkspaceContext(workspaceRoot, globs, exclude) {
|
|
6162
7776
|
return workspaceContext.glob(globs, exclude);
|
|
6163
7777
|
}
|
|
6164
7778
|
else {
|
|
@@ -6167,7 +7781,7 @@ index 1b551e8dcab2b0b1e6ac46af9d46456e7b9a3eeb..bab5280fc705e522dfcc6aefe383f67e
|
|
|
6167
7781
|
}
|
|
6168
7782
|
}
|
|
6169
7783
|
async function multiGlobWithWorkspaceContext(workspaceRoot, globs, exclude) {
|
|
6170
|
-
@@ -89,21 +
|
|
7784
|
+
@@ -89,21 +90,21 @@ async function multiGlobWithWorkspaceContext(workspaceRoot, globs, exclude) {
|
|
6171
7785
|
await ensureFilesReady(workspaceRoot);
|
|
6172
7786
|
return workspaceContext.multiGlob(globs, exclude);
|
|
6173
7787
|
}
|
|
@@ -6192,7 +7806,7 @@ index 1b551e8dcab2b0b1e6ac46af9d46456e7b9a3eeb..bab5280fc705e522dfcc6aefe383f67e
|
|
|
6192
7806
|
}
|
|
6193
7807
|
async function updateContextWithChangedFiles(workspaceRoot, createdFiles, updatedFiles, deletedFiles) {
|
|
6194
7808
|
if (!client_1.daemonClient.enabled()) {
|
|
6195
|
-
@@ -117,7 +
|
|
7809
|
+
@@ -117,7 +118,7 @@ async function updateContextWithChangedFiles(workspaceRoot, createdFiles, update
|
|
6196
7810
|
}
|
|
6197
7811
|
else {
|
|
6198
7812
|
// daemon is enabled but we are not running on it, ask the daemon to update the context
|
|
@@ -6201,7 +7815,7 @@ index 1b551e8dcab2b0b1e6ac46af9d46456e7b9a3eeb..bab5280fc705e522dfcc6aefe383f67e
|
|
|
6201
7815
|
}
|
|
6202
7816
|
}
|
|
6203
7817
|
/**
|
|
6204
|
-
@@ -147,7 +
|
|
7818
|
+
@@ -147,7 +148,7 @@ async function getAllFileDataInContext(workspaceRoot) {
|
|
6205
7819
|
await ensureFilesReady(workspaceRoot);
|
|
6206
7820
|
return workspaceContext.allFileData();
|
|
6207
7821
|
}
|
|
@@ -6210,7 +7824,23 @@ index 1b551e8dcab2b0b1e6ac46af9d46456e7b9a3eeb..bab5280fc705e522dfcc6aefe383f67e
|
|
|
6210
7824
|
}
|
|
6211
7825
|
/**
|
|
6212
7826
|
* Listens for the changes a watching context applies: each change reaches the
|
|
6213
|
-
@@ -
|
|
7827
|
+
@@ -178,6 +179,15 @@ function takeAppliedWorkspaceChanges(workspaceRoot) {
|
|
7828
|
+
ensureContextAvailable(workspaceRoot);
|
|
7829
|
+
return workspaceContext.takeAppliedChanges();
|
|
7830
|
+
}
|
|
7831
|
+
+/**
|
|
7832
|
+
+ * Walks the workspace again from the disk, never from another process's
|
|
7833
|
+
+ * archive, and applies what the walk finds changed to the context: take those
|
|
7834
|
+
+ * changes with `takeAppliedWorkspaceChanges`.
|
|
7835
|
+
+ */
|
|
7836
|
+
+function rescanWorkspaceContext(workspaceRoot) {
|
|
7837
|
+
+ ensureContextAvailable(workspaceRoot);
|
|
7838
|
+
+ workspaceContext.rescanAndDiff();
|
|
7839
|
+
+}
|
|
7840
|
+
function isWatchingWorkspaceContext() {
|
|
7841
|
+
return !!contextOptions?.watch;
|
|
7842
|
+
}
|
|
7843
|
+
@@ -232,7 +242,7 @@ async function getFilesInDirectoryUsingContext(workspaceRoot, dir) {
|
|
6214
7844
|
await ensureFilesReady(workspaceRoot);
|
|
6215
7845
|
return workspaceContext.getFilesInDirectory(dir);
|
|
6216
7846
|
}
|