nx 19.7.0-canary.20240905-ccda7f9 → 19.7.0
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/command-object.js +2 -2
- package/src/command-line/affected/command-object.js +1 -1
- package/src/command-line/connect/command-object.js +2 -2
- package/src/command-line/daemon/command-object.js +1 -1
- package/src/command-line/deprecated/command-objects.js +2 -2
- package/src/command-line/exec/command-object.js +1 -1
- package/src/command-line/format/command-object.js +4 -4
- package/src/command-line/generate/command-object.js +4 -4
- package/src/command-line/graph/command-object.js +6 -6
- package/src/command-line/import/command-object.js +6 -6
- package/src/command-line/list/command-object.js +1 -1
- package/src/command-line/login/command-object.js +1 -1
- package/src/command-line/logout/command-object.js +1 -1
- package/src/command-line/migrate/command-object.js +9 -9
- package/src/command-line/new/command-object.js +2 -2
- package/src/command-line/release/command-object.js +27 -27
- package/src/command-line/report/command-object.js +1 -1
- package/src/command-line/reset/command-object.js +1 -1
- package/src/command-line/run/command-object.js +1 -1
- package/src/command-line/run-many/command-object.js +1 -1
- package/src/command-line/show/command-object.js +10 -10
- package/src/command-line/watch/command-object.js +1 -1
- package/src/command-line/yargs-utils/shared-options.js +20 -20
- package/src/core/graph/main.js +1 -1
- package/src/core/graph/styles.css +1 -1
- package/src/daemon/server/server.js +1 -1
- package/src/daemon/server/watcher.d.ts +1 -1
- package/src/daemon/server/watcher.js +14 -12
- package/src/migrations/update-15-0-0/prefix-outputs.js +3 -18
- package/src/native/index.d.ts +4 -0
- package/src/native/native-bindings.js +2 -0
- package/src/native/nx.wasi-browser.js +53 -49
- package/src/native/nx.wasi.cjs +53 -49
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/nx-cloud/generators/connect-to-nx-cloud/connect-to-nx-cloud.js +6 -41
- package/src/tasks-runner/cache.d.ts +2 -0
- package/src/tasks-runner/cache.js +15 -1
- package/src/tasks-runner/task-orchestrator.js +1 -10
- package/src/tasks-runner/utils.d.ts +1 -8
- package/src/tasks-runner/utils.js +9 -12
@@ -10,6 +10,7 @@ export type TaskWithCachedResult = {
|
|
10
10
|
task: Task;
|
11
11
|
cachedResult: CachedResult;
|
12
12
|
};
|
13
|
+
export declare function getCache(options: DefaultTasksRunnerOptions): DbCache | Cache;
|
13
14
|
export declare class DbCache {
|
14
15
|
private readonly options;
|
15
16
|
private cache;
|
@@ -20,6 +21,7 @@ export declare class DbCache {
|
|
20
21
|
nxCloudRemoteCache: RemoteCache;
|
21
22
|
});
|
22
23
|
get(task: Task): Promise<CachedResult | null>;
|
24
|
+
private applyRemoteCacheResults;
|
23
25
|
put(task: Task, terminalOutput: string | null, outputs: string[], code: number): Promise<void>;
|
24
26
|
copyFilesFromCache(_: string, cachedResult: CachedResult, outputs: string[]): Promise<void>;
|
25
27
|
removeOldCacheRecords(): void;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.Cache = exports.DbCache = void 0;
|
4
|
+
exports.getCache = getCache;
|
4
5
|
const workspace_root_1 = require("../utils/workspace-root");
|
5
6
|
const fs_extra_1 = require("fs-extra");
|
6
7
|
const path_1 = require("path");
|
@@ -15,6 +16,16 @@ const nx_cloud_utils_1 = require("../utils/nx-cloud-utils");
|
|
15
16
|
const nx_json_1 = require("../config/nx-json");
|
16
17
|
const update_manager_1 = require("../nx-cloud/update-manager");
|
17
18
|
const get_cloud_options_1 = require("../nx-cloud/utilities/get-cloud-options");
|
19
|
+
function getCache(options) {
|
20
|
+
return process.env.NX_DB_CACHE === 'true'
|
21
|
+
? new DbCache({
|
22
|
+
// Remove this in Nx 21
|
23
|
+
nxCloudRemoteCache: (0, nx_cloud_utils_1.isNxCloudUsed)((0, nx_json_1.readNxJson)())
|
24
|
+
? options.remoteCache
|
25
|
+
: null,
|
26
|
+
})
|
27
|
+
: new Cache(options);
|
28
|
+
}
|
18
29
|
class DbCache {
|
19
30
|
async setup() {
|
20
31
|
this.remoteCache = await this.getRemoteCache();
|
@@ -37,7 +48,7 @@ class DbCache {
|
|
37
48
|
// attempt remote cache
|
38
49
|
const res = await this.remoteCache.retrieve(task.hash, this.cache.cacheDirectory);
|
39
50
|
if (res) {
|
40
|
-
this.
|
51
|
+
this.applyRemoteCacheResults(task.hash, res);
|
41
52
|
return {
|
42
53
|
...res,
|
43
54
|
remote: true,
|
@@ -51,6 +62,9 @@ class DbCache {
|
|
51
62
|
return null;
|
52
63
|
}
|
53
64
|
}
|
65
|
+
applyRemoteCacheResults(hash, res) {
|
66
|
+
return this.cache.applyRemoteCacheResults(hash, res);
|
67
|
+
}
|
54
68
|
async put(task, terminalOutput, outputs, code) {
|
55
69
|
return tryAndRetry(async () => {
|
56
70
|
this.cache.put(task.hash, terminalOutput, outputs, code);
|
@@ -15,8 +15,6 @@ const task_env_1 = require("./task-env");
|
|
15
15
|
const workspace_root_1 = require("../utils/workspace-root");
|
16
16
|
const output_1 = require("../utils/output");
|
17
17
|
const params_1 = require("../utils/params");
|
18
|
-
const nx_cloud_utils_1 = require("../utils/nx-cloud-utils");
|
19
|
-
const nx_json_1 = require("../config/nx-json");
|
20
18
|
class TaskOrchestrator {
|
21
19
|
// endregion internal state
|
22
20
|
constructor(hasher, initiatingProject, projectGraph, taskGraph, options, bail, daemon, outputStyle) {
|
@@ -28,14 +26,7 @@ class TaskOrchestrator {
|
|
28
26
|
this.bail = bail;
|
29
27
|
this.daemon = daemon;
|
30
28
|
this.outputStyle = outputStyle;
|
31
|
-
this.cache =
|
32
|
-
? new cache_1.DbCache({
|
33
|
-
// Remove this in Nx 21
|
34
|
-
nxCloudRemoteCache: (0, nx_cloud_utils_1.isNxCloudUsed)((0, nx_json_1.readNxJson)())
|
35
|
-
? this.options.remoteCache
|
36
|
-
: null,
|
37
|
-
})
|
38
|
-
: new cache_1.Cache(this.options);
|
29
|
+
this.cache = (0, cache_1.getCache)(this.options);
|
39
30
|
this.forkedProcessTaskRunner = new forked_process_task_runner_1.ForkedProcessTaskRunner(this.options);
|
40
31
|
this.tasksSchedule = new tasks_schedule_1.TasksSchedule(this.projectGraph, this.taskGraph, this.options);
|
41
32
|
// region internal state
|
@@ -21,14 +21,8 @@ export declare function getOutputs(p: Record<string, ProjectGraphProjectNode>, t
|
|
21
21
|
export declare function normalizeTargetDependencyWithStringProjects(dependencyConfig: TargetDependencyConfig): Omit<TargetDependencyConfig, 'projects'> & {
|
22
22
|
projects: string[];
|
23
23
|
};
|
24
|
-
declare class InvalidOutputsError extends Error {
|
25
|
-
outputs: string[];
|
26
|
-
invalidOutputs: Set<string>;
|
27
|
-
constructor(outputs: string[], invalidOutputs: Set<string>);
|
28
|
-
private static createMessage;
|
29
|
-
}
|
30
24
|
export declare function validateOutputs(outputs: string[]): void;
|
31
|
-
export declare function transformLegacyOutputs(projectRoot: string,
|
25
|
+
export declare function transformLegacyOutputs(projectRoot: string, outputs: string[]): string[];
|
32
26
|
/**
|
33
27
|
* @deprecated Pass the target and overrides instead. This will be removed in v20.
|
34
28
|
*/
|
@@ -61,4 +55,3 @@ export declare function isCacheableTask(task: Task, options: {
|
|
61
55
|
cacheableTargets?: string[] | null;
|
62
56
|
}): boolean;
|
63
57
|
export declare function unparse(options: Object): string[];
|
64
|
-
export {};
|
@@ -37,6 +37,7 @@ const project_graph_1 = require("../project-graph/project-graph");
|
|
37
37
|
const find_matching_projects_1 = require("../utils/find-matching-projects");
|
38
38
|
const minimatch_1 = require("minimatch");
|
39
39
|
const globs_1 = require("../utils/globs");
|
40
|
+
const native_1 = require("../native");
|
40
41
|
function getDependencyConfigs({ project, target }, extraTargetDependencies, projectGraph, allTargetNames) {
|
41
42
|
const dependencyConfigs = (projectGraph.nodes[project].data?.targets[target]?.dependsOn ??
|
42
43
|
// This is passed into `run-command` from programmatic invocations
|
@@ -177,19 +178,15 @@ function assertOutputsAreValidType(outputs) {
|
|
177
178
|
}
|
178
179
|
function validateOutputs(outputs) {
|
179
180
|
assertOutputsAreValidType(outputs);
|
180
|
-
|
181
|
-
for (const output of outputs) {
|
182
|
-
if (!/^!?{[\s\S]+}/.test(output)) {
|
183
|
-
invalidOutputs.add(output);
|
184
|
-
}
|
185
|
-
}
|
186
|
-
if (invalidOutputs.size > 0) {
|
187
|
-
throw new InvalidOutputsError(outputs, invalidOutputs);
|
188
|
-
}
|
181
|
+
(0, native_1.validateOutputs)(outputs);
|
189
182
|
}
|
190
|
-
function transformLegacyOutputs(projectRoot,
|
191
|
-
|
192
|
-
|
183
|
+
function transformLegacyOutputs(projectRoot, outputs) {
|
184
|
+
const transformableOutputs = new Set((0, native_1.getTransformableOutputs)(outputs));
|
185
|
+
if (transformableOutputs.size === 0) {
|
186
|
+
return outputs;
|
187
|
+
}
|
188
|
+
return outputs.map((output) => {
|
189
|
+
if (!transformableOutputs.has(output)) {
|
193
190
|
return output;
|
194
191
|
}
|
195
192
|
let [isNegated, outputPath] = output.startsWith('!')
|