nx 19.7.0-canary.20240820-0853690 → 19.7.0-canary.20240822-d6a0cfb
Sign up to get free protection for your applications and to get access to all the features.
- package/package.json +12 -12
- package/src/command-line/add/add.js +1 -5
- package/src/command-line/add/command-object.js +1 -5
- package/src/command-line/affected/affected.js +0 -3
- package/src/command-line/exec/exec.js +0 -3
- package/src/command-line/generate/command-object.js +2 -5
- package/src/command-line/generate/generate.js +4 -8
- package/src/command-line/import/command-object.js +1 -1
- package/src/command-line/migrate/command-object.js +3 -2
- package/src/command-line/migrate/migrate.js +0 -3
- package/src/command-line/release/changelog.js +0 -3
- package/src/command-line/release/command-object.js +1 -5
- package/src/command-line/release/plan-check.js +0 -3
- package/src/command-line/release/plan.js +0 -3
- package/src/command-line/release/publish.js +0 -6
- package/src/command-line/release/release.js +0 -3
- package/src/command-line/release/version.js +0 -3
- package/src/command-line/repair/command-object.js +2 -4
- package/src/command-line/repair/repair.js +2 -6
- package/src/command-line/run/run-one.js +0 -3
- package/src/command-line/show/command-object.js +2 -2
- package/src/command-line/sync/command-object.js +3 -8
- package/src/command-line/sync/sync.js +1 -5
- package/src/command-line/watch/command-object.js +1 -1
- package/src/command-line/watch/watch.js +0 -3
- package/src/command-line/yargs-utils/shared-options.js +3 -3
- package/src/core/graph/main.js +1 -1
- package/src/daemon/client/client.d.ts +3 -6
- package/src/daemon/client/client.js +5 -4
- package/src/daemon/message-types/task-history.d.ts +9 -9
- package/src/daemon/message-types/task-history.js +7 -7
- package/src/daemon/server/handle-task-history.d.ts +9 -0
- package/src/daemon/server/handle-task-history.js +28 -0
- package/src/daemon/server/server.js +4 -5
- package/src/hasher/hash-task.js +36 -1
- package/src/native/assert-supported-platform.js +1 -1
- package/src/native/index.d.ts +45 -4
- package/src/native/native-bindings.js +4 -0
- package/src/native/nx.wasi-browser.js +50 -36
- package/src/native/nx.wasi.cjs +48 -36
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/nx-cloud/update-manager.d.ts +2 -0
- package/src/nx-cloud/utilities/url-shorten.js +1 -1
- package/src/plugins/js/package-json/create-package-json.d.ts +1 -0
- package/src/plugins/js/package-json/create-package-json.js +1 -1
- package/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +11 -6
- package/src/tasks-runner/cache.d.ts +21 -2
- package/src/tasks-runner/cache.js +118 -26
- package/src/tasks-runner/default-tasks-runner.d.ts +6 -0
- package/src/tasks-runner/default-tasks-runner.js +34 -1
- package/src/tasks-runner/life-cycles/task-history-life-cycle-old.d.ts +9 -0
- package/src/tasks-runner/life-cycles/task-history-life-cycle-old.js +54 -0
- package/src/tasks-runner/life-cycles/task-history-life-cycle.d.ts +1 -0
- package/src/tasks-runner/life-cycles/task-history-life-cycle.js +19 -21
- package/src/tasks-runner/run-command.js +3 -1
- package/src/tasks-runner/task-orchestrator.js +10 -1
- package/src/utils/cache-directory.d.ts +1 -0
- package/src/utils/cache-directory.js +7 -3
- package/src/utils/db-connection.d.ts +2 -0
- package/src/utils/db-connection.js +11 -0
- package/src/utils/legacy-task-history.d.ts +8 -0
- package/src/utils/legacy-task-history.js +87 -0
- package/src/utils/logger.js +1 -1
- package/src/utils/task-history.d.ts +6 -8
- package/src/utils/task-history.js +16 -88
- package/src/utils/workspace-context.js +1 -1
- package/src/daemon/server/handle-get-task-history.d.ts +0 -4
- package/src/daemon/server/handle-get-task-history.js +0 -11
- package/src/daemon/server/handle-write-task-runs-to-history.d.ts +0 -5
- package/src/daemon/server/handle-write-task-runs-to-history.js +0 -11
@@ -1,97 +1,25 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
4
|
-
exports.getHistoryForHashes = getHistoryForHashes;
|
5
|
-
exports.writeTaskRunsToHistory = writeTaskRunsToHistory;
|
6
|
-
const fs_1 = require("fs");
|
7
|
-
const path_1 = require("path");
|
3
|
+
exports.TaskHistory = void 0;
|
8
4
|
const client_1 = require("../daemon/client/client");
|
9
5
|
const is_on_daemon_1 = require("../daemon/is-on-daemon");
|
10
|
-
const
|
11
|
-
const
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
'end',
|
20
|
-
];
|
21
|
-
let taskHistory = undefined;
|
22
|
-
let taskHashToIndicesMap = new Map();
|
23
|
-
async function getHistoryForHashes(hashes) {
|
24
|
-
if ((0, is_on_daemon_1.isOnDaemon)() || !client_1.daemonClient.enabled()) {
|
25
|
-
if (taskHistory === undefined) {
|
26
|
-
loadTaskHistoryFromDisk();
|
6
|
+
const native_1 = require("../native");
|
7
|
+
const db_connection_1 = require("./db-connection");
|
8
|
+
class TaskHistory {
|
9
|
+
constructor() {
|
10
|
+
this.taskHistory = new native_1.NxTaskHistory((0, db_connection_1.getDbConnection)());
|
11
|
+
}
|
12
|
+
async getFlakyTasks(hashes) {
|
13
|
+
if ((0, is_on_daemon_1.isOnDaemon)() || !client_1.daemonClient.enabled()) {
|
14
|
+
return this.taskHistory.getFlakyTasks(hashes);
|
27
15
|
}
|
28
|
-
|
29
|
-
for (let hash of hashes) {
|
30
|
-
const indices = taskHashToIndicesMap.get(hash);
|
31
|
-
if (!indices) {
|
32
|
-
result[hash] = [];
|
33
|
-
}
|
34
|
-
else {
|
35
|
-
result[hash] = indices.map((index) => taskHistory[index]);
|
36
|
-
}
|
37
|
-
}
|
38
|
-
return result;
|
16
|
+
return await client_1.daemonClient.getFlakyTasks(hashes);
|
39
17
|
}
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
if ((0, is_on_daemon_1.isOnDaemon)() || !client_1.daemonClient.enabled()) {
|
44
|
-
if (taskHistory === undefined) {
|
45
|
-
loadTaskHistoryFromDisk();
|
46
|
-
}
|
47
|
-
const serializedLines = [];
|
48
|
-
for (let taskRun of taskRuns) {
|
49
|
-
const serializedLine = taskRunKeys.map((key) => taskRun[key]).join(',');
|
50
|
-
serializedLines.push(serializedLine);
|
51
|
-
recordTaskRunInMemory(taskRun);
|
52
|
-
}
|
53
|
-
if (!(0, fs_1.existsSync)(exports.taskHistoryFile)) {
|
54
|
-
(0, fs_1.writeFileSync)(exports.taskHistoryFile, `${taskRunKeys.join(',')}\n`);
|
18
|
+
async recordTaskRuns(taskRuns) {
|
19
|
+
if ((0, is_on_daemon_1.isOnDaemon)() || !client_1.daemonClient.enabled()) {
|
20
|
+
return this.taskHistory.recordTaskRuns(taskRuns);
|
55
21
|
}
|
56
|
-
|
57
|
-
}
|
58
|
-
else {
|
59
|
-
await client_1.daemonClient.writeTaskRunsToHistory(taskRuns);
|
60
|
-
}
|
61
|
-
}
|
62
|
-
exports.taskHistoryFile = (0, path_1.join)(cache_directory_1.workspaceDataDirectory, 'task-history.csv');
|
63
|
-
function loadTaskHistoryFromDisk() {
|
64
|
-
taskHashToIndicesMap.clear();
|
65
|
-
taskHistory = [];
|
66
|
-
if (!(0, fs_1.existsSync)(exports.taskHistoryFile)) {
|
67
|
-
return;
|
68
|
-
}
|
69
|
-
const fileContent = (0, fs_1.readFileSync)(exports.taskHistoryFile, 'utf8');
|
70
|
-
if (!fileContent) {
|
71
|
-
return;
|
72
|
-
}
|
73
|
-
const lines = fileContent.split('\n');
|
74
|
-
// if there are no lines or just the header, return
|
75
|
-
if (lines.length <= 1) {
|
76
|
-
return;
|
77
|
-
}
|
78
|
-
const contentLines = lines.slice(1).filter((l) => l.trim() !== '');
|
79
|
-
// read the values from csv format where each header is a key and the value is the value
|
80
|
-
for (let line of contentLines) {
|
81
|
-
const values = line.trim().split(',');
|
82
|
-
const run = {};
|
83
|
-
taskRunKeys.forEach((header, index) => {
|
84
|
-
run[header] = values[index];
|
85
|
-
});
|
86
|
-
recordTaskRunInMemory(run);
|
87
|
-
}
|
88
|
-
}
|
89
|
-
function recordTaskRunInMemory(taskRun) {
|
90
|
-
const index = taskHistory.push(taskRun) - 1;
|
91
|
-
if (taskHashToIndicesMap.has(taskRun.hash)) {
|
92
|
-
taskHashToIndicesMap.get(taskRun.hash).push(index);
|
93
|
-
}
|
94
|
-
else {
|
95
|
-
taskHashToIndicesMap.set(taskRun.hash, [index]);
|
22
|
+
return client_1.daemonClient.recordTaskRuns(taskRuns);
|
96
23
|
}
|
97
24
|
}
|
25
|
+
exports.TaskHistory = TaskHistory;
|
@@ -19,7 +19,7 @@ let workspaceContext;
|
|
19
19
|
function setupWorkspaceContext(workspaceRoot) {
|
20
20
|
const { WorkspaceContext } = require('../native');
|
21
21
|
perf_hooks_1.performance.mark('workspace-context');
|
22
|
-
workspaceContext = new WorkspaceContext(workspaceRoot, (0, cache_directory_1.
|
22
|
+
workspaceContext = new WorkspaceContext(workspaceRoot, (0, cache_directory_1.workspaceDataDirectoryForWorkspace)(workspaceRoot));
|
23
23
|
perf_hooks_1.performance.mark('workspace-context:end');
|
24
24
|
perf_hooks_1.performance.measure('workspace context init', 'workspace-context', 'workspace-context:end');
|
25
25
|
}
|
@@ -1,11 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.handleGetTaskHistoryForHashes = handleGetTaskHistoryForHashes;
|
4
|
-
const task_history_1 = require("../../utils/task-history");
|
5
|
-
async function handleGetTaskHistoryForHashes(hashes) {
|
6
|
-
const history = await (0, task_history_1.getHistoryForHashes)(hashes);
|
7
|
-
return {
|
8
|
-
response: JSON.stringify(history),
|
9
|
-
description: 'handleGetTaskHistoryForHashes',
|
10
|
-
};
|
11
|
-
}
|
@@ -1,11 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.handleWriteTaskRunsToHistory = handleWriteTaskRunsToHistory;
|
4
|
-
const task_history_1 = require("../../utils/task-history");
|
5
|
-
async function handleWriteTaskRunsToHistory(taskRuns) {
|
6
|
-
await (0, task_history_1.writeTaskRunsToHistory)(taskRuns);
|
7
|
-
return {
|
8
|
-
response: 'true',
|
9
|
-
description: 'handleWriteTaskRunsToHistory',
|
10
|
-
};
|
11
|
-
}
|