nx 23.2.0-rc.2 → 23.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/release/changelog-renderer/index.d.ts +4 -0
- package/dist/release/changelog-renderer/index.js +17 -1
- package/dist/src/command-line/migrate/prompt-files.js +2 -9
- package/dist/src/command-line/release/changelog.js +3 -1
- package/dist/src/command-line/report/report.d.ts +2 -0
- package/dist/src/command-line/report/report.js +28 -1
- package/dist/src/command-line/reset/reset.js +1 -3
- package/dist/src/core/graph/main.js +1 -1
- package/dist/src/daemon/client/daemon-environment.d.ts +10 -0
- package/dist/src/daemon/client/daemon-environment.js +44 -0
- package/dist/src/daemon/server/handle-client-env.js +24 -3
- package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
- package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
- package/dist/src/nx-cloud/update-manager.js +4 -3
- package/dist/src/plugins/js/lock-file/pruned-output.d.ts +10 -9
- package/dist/src/plugins/js/lock-file/pruned-output.js +37 -13
- package/dist/src/project-graph/plugins/isolation/isolated-plugin.d.ts +16 -0
- package/dist/src/project-graph/plugins/isolation/isolated-plugin.js +59 -22
- package/dist/src/tasks-runner/forked-process-task-runner.d.ts +3 -0
- package/dist/src/tasks-runner/forked-process-task-runner.js +15 -6
- package/dist/src/tasks-runner/init-tasks-runner.js +32 -2
- package/dist/src/tasks-runner/life-cycles/task-history-life-cycle.js +16 -11
- package/dist/src/tasks-runner/running-tasks/batch-process.js +3 -0
- package/dist/src/tasks-runner/running-tasks/shared-running-task.d.ts +1 -0
- package/dist/src/tasks-runner/running-tasks/shared-running-task.js +12 -1
- package/dist/src/tasks-runner/task-orchestrator.d.ts +3 -0
- package/dist/src/tasks-runner/task-orchestrator.js +31 -3
- package/dist/src/utils/min-release-age/behavior/pnpm.js +17 -9
- package/dist/src/utils/package-json.js +13 -2
- package/dist/src/utils/params.js +1 -1
- package/dist/src/utils/path.d.ts +6 -0
- package/dist/src/utils/path.js +15 -0
- package/package.json +11 -11
|
@@ -56,6 +56,7 @@ export declare class TaskOrchestrator {
|
|
|
56
56
|
private discreteTaskExitHandled;
|
|
57
57
|
private continuousTaskExitHandled;
|
|
58
58
|
private cleanupPromise;
|
|
59
|
+
private signalHandlers;
|
|
59
60
|
constructor(hasher: TaskHasher, initiatingProject: string | undefined, initiatingTasks: Task[], projectGraph: ProjectGraph, taskGraph: TaskGraph, nxJson: NxJsonConfiguration, options: NxArgs & DefaultTasksRunnerOptions, bail: boolean, daemon: DaemonClient, outputStyle: string, fullTaskGraph?: TaskGraph);
|
|
60
61
|
init(): Promise<void>;
|
|
61
62
|
run(): Promise<{
|
|
@@ -251,6 +252,8 @@ export declare class TaskOrchestrator {
|
|
|
251
252
|
private cleanup;
|
|
252
253
|
private performCleanup;
|
|
253
254
|
private setupSignalHandlers;
|
|
255
|
+
waitForContinuousTaskExit(taskId: string): Promise<void>;
|
|
256
|
+
dispose(): Promise<void>;
|
|
254
257
|
private cleanUpUnneededContinuousTasks;
|
|
255
258
|
}
|
|
256
259
|
export declare function getThreadPoolSize(options: NxArgs & DefaultTasksRunnerOptions, taskGraph: TaskGraph): {
|
|
@@ -105,6 +105,7 @@ class TaskOrchestrator {
|
|
|
105
105
|
this.discreteTaskExitHandled = new Map();
|
|
106
106
|
this.continuousTaskExitHandled = new Map();
|
|
107
107
|
this.cleanupPromise = null;
|
|
108
|
+
this.signalHandlers = [];
|
|
108
109
|
}
|
|
109
110
|
async init() {
|
|
110
111
|
this.setupSignalHandlers();
|
|
@@ -159,6 +160,7 @@ class TaskOrchestrator {
|
|
|
159
160
|
this.cache.removeOldCacheRecords();
|
|
160
161
|
}
|
|
161
162
|
await this.cleanup();
|
|
163
|
+
await this.dispose();
|
|
162
164
|
// Public API (defaultTasksRunner) returns a plain object keyed by
|
|
163
165
|
// task id. Internal state is a Map for faster lookup.
|
|
164
166
|
return Object.fromEntries(this.completedTasks);
|
|
@@ -1474,9 +1476,35 @@ class TaskOrchestrator {
|
|
|
1474
1476
|
}
|
|
1475
1477
|
});
|
|
1476
1478
|
};
|
|
1477
|
-
|
|
1478
|
-
|
|
1479
|
-
|
|
1479
|
+
for (const signal of ['SIGINT', 'SIGTERM', 'SIGHUP']) {
|
|
1480
|
+
const handler = () => handleSignal(signal);
|
|
1481
|
+
this.signalHandlers.push([signal, handler]);
|
|
1482
|
+
process.on(signal, handler);
|
|
1483
|
+
}
|
|
1484
|
+
}
|
|
1485
|
+
// Registered at child creation, so unlike subscribing to RunningTask.onExit
|
|
1486
|
+
// after the fact it cannot miss an exit that already happened.
|
|
1487
|
+
waitForContinuousTaskExit(taskId) {
|
|
1488
|
+
return this.continuousTaskExitHandled.get(taskId) ?? Promise.resolve();
|
|
1489
|
+
}
|
|
1490
|
+
// Releases the process-level listeners registered by setupSignalHandlers.
|
|
1491
|
+
// Each closes over `this`, so a long-lived caller (an Nx Cloud agent creates
|
|
1492
|
+
// an orchestrator per invocation) leaks whole orchestrators until they run.
|
|
1493
|
+
async dispose() {
|
|
1494
|
+
// The forked runner's exit handler is the last-resort kill for child
|
|
1495
|
+
// processes, and a batch child can outlive its results message. Reap
|
|
1496
|
+
// children first so removing the handler cannot orphan a live one.
|
|
1497
|
+
try {
|
|
1498
|
+
await this.forkedProcessTaskRunner.cleanup();
|
|
1499
|
+
}
|
|
1500
|
+
catch (e) {
|
|
1501
|
+
console.error('Failed to clean up child processes on dispose:', e);
|
|
1502
|
+
}
|
|
1503
|
+
for (const [signal, handler] of this.signalHandlers) {
|
|
1504
|
+
process.off(signal, handler);
|
|
1505
|
+
}
|
|
1506
|
+
this.signalHandlers = [];
|
|
1507
|
+
this.forkedProcessTaskRunner.removeProcessEventListeners();
|
|
1480
1508
|
}
|
|
1481
1509
|
cleanUpUnneededContinuousTasks() {
|
|
1482
1510
|
const incompleteTasks = this.tasksSchedule.getIncompleteTasks();
|
|
@@ -9,6 +9,14 @@ const errors_1 = require("../errors");
|
|
|
9
9
|
const pick_1 = require("../pick");
|
|
10
10
|
// Ordered newest-bound-first so the first matching row applies.
|
|
11
11
|
const PNPM_BEHAVIOR_ROWS = [
|
|
12
|
+
{
|
|
13
|
+
minVersion: '12.0.0',
|
|
14
|
+
major: 12,
|
|
15
|
+
strictMode: 'default-loose',
|
|
16
|
+
strictAutoOnWhenExplicit: true,
|
|
17
|
+
excludeGrammar: 'v2-globs-unions',
|
|
18
|
+
writesExcludes: true,
|
|
19
|
+
},
|
|
12
20
|
{
|
|
13
21
|
minVersion: '11.1.3',
|
|
14
22
|
major: 11,
|
|
@@ -134,7 +142,7 @@ function toBoolean(value) {
|
|
|
134
142
|
async function readPnpmPolicy(root, pmVersion) {
|
|
135
143
|
// A pnpm major newer than the table knows can behave differently; defer to a
|
|
136
144
|
// real install rather than guessing.
|
|
137
|
-
if ((0, semver_1.gte)(pmVersion, '
|
|
145
|
+
if ((0, semver_1.gte)(pmVersion, '13.0.0')) {
|
|
138
146
|
return {
|
|
139
147
|
outcome: 'ambiguous',
|
|
140
148
|
reason: `pnpm ${pmVersion} is newer than the known cooldown behavior table.`,
|
|
@@ -155,15 +163,15 @@ async function readPnpmPolicy(root, pmVersion) {
|
|
|
155
163
|
}
|
|
156
164
|
const { windowMinutes: explicitWindow, excludes, strictExplicit, ignoreMissingTimeExplicit, } = parseCooldownConfig(config);
|
|
157
165
|
// An explicitly configured window (from whatever surface pnpm honors) wins;
|
|
158
|
-
// otherwise v11
|
|
159
|
-
// v10 has no default (no cooldown).
|
|
166
|
+
// otherwise v11 and v12 fall back to the built-in 1440-minute (1 day) default,
|
|
167
|
+
// while v10 has no default (no cooldown).
|
|
160
168
|
let windowMinutes;
|
|
161
169
|
let windowExplicit;
|
|
162
170
|
if (explicitWindow !== undefined) {
|
|
163
171
|
windowMinutes = explicitWindow;
|
|
164
172
|
windowExplicit = true;
|
|
165
173
|
}
|
|
166
|
-
else if (row.major
|
|
174
|
+
else if (row.major >= 11) {
|
|
167
175
|
windowMinutes = 1440;
|
|
168
176
|
windowExplicit = false;
|
|
169
177
|
}
|
|
@@ -178,14 +186,14 @@ async function readPnpmPolicy(root, pmVersion) {
|
|
|
178
186
|
const cutoffMs = Date.now() - windowMs;
|
|
179
187
|
const sourceDescription = `pnpm minimumReleaseAge (${windowMinutes} min)`;
|
|
180
188
|
const strict = resolveStrict(row, strictExplicit, windowExplicit);
|
|
181
|
-
// v10 always errors on missing time; v11
|
|
182
|
-
// explicitly disabled it.
|
|
183
|
-
const ignoreMissingTime = row.major
|
|
189
|
+
// v10 always errors on missing time; v11 and above default to skip unless a
|
|
190
|
+
// surface explicitly disabled it.
|
|
191
|
+
const ignoreMissingTime = row.major >= 11 ? (ignoreMissingTimeExplicit ?? true) : false;
|
|
184
192
|
const behavior = {
|
|
185
193
|
packageManager: 'pnpm',
|
|
186
194
|
strict,
|
|
187
|
-
// Loose fallback only exists
|
|
188
|
-
looseFallback: row.major
|
|
195
|
+
// Loose fallback only exists from v11 onwards when strict is off.
|
|
196
|
+
looseFallback: row.major >= 11 && !strict,
|
|
189
197
|
writesExcludes: row.writesExcludes,
|
|
190
198
|
missingTimeMap: row.major === 10 ? 'error' : ignoreMissingTime ? 'skip' : 'error',
|
|
191
199
|
};
|
|
@@ -23,6 +23,7 @@ const target_merging_1 = require("../project-graph/utils/project-configuration/t
|
|
|
23
23
|
const catalog_1 = require("./catalog");
|
|
24
24
|
const fileutils_1 = require("./fileutils");
|
|
25
25
|
const has_nx_js_plugin_1 = require("./has-nx-js-plugin");
|
|
26
|
+
const path_2 = require("./path");
|
|
26
27
|
const installation_directory_1 = require("./installation-directory");
|
|
27
28
|
const package_manager_1 = require("./package-manager");
|
|
28
29
|
const workspace_root_1 = require("./workspace-root");
|
|
@@ -35,15 +36,25 @@ function normalizePackageGroup(packageGroup) {
|
|
|
35
36
|
}));
|
|
36
37
|
}
|
|
37
38
|
function readNxMigrateConfig(json) {
|
|
39
|
+
// Registry fetching uses this value to build a temporary extraction path.
|
|
40
|
+
// Reject unsupported absolute paths and escaping parent traversal before extraction.
|
|
41
|
+
const assertContained = (migrations) => {
|
|
42
|
+
if (!(0, path_2.isContainedRelativePath)(migrations)) {
|
|
43
|
+
throw new Error(`Invalid migrations path "${migrations}" in package "${json.name ?? 'unknown'}@${json.version ?? 'unknown'}": migration paths must not be absolute or escape their base directory through parent traversal.`);
|
|
44
|
+
}
|
|
45
|
+
return migrations;
|
|
46
|
+
};
|
|
38
47
|
const parseNxMigrationsConfig = (fromJson) => {
|
|
39
48
|
if (!fromJson) {
|
|
40
49
|
return {};
|
|
41
50
|
}
|
|
42
51
|
if (typeof fromJson === 'string') {
|
|
43
|
-
return { migrations: fromJson, packageGroup: [] };
|
|
52
|
+
return { migrations: assertContained(fromJson), packageGroup: [] };
|
|
44
53
|
}
|
|
45
54
|
return {
|
|
46
|
-
...(fromJson.migrations
|
|
55
|
+
...(fromJson.migrations
|
|
56
|
+
? { migrations: assertContained(fromJson.migrations) }
|
|
57
|
+
: {}),
|
|
47
58
|
...(fromJson.packageGroup
|
|
48
59
|
? { packageGroup: normalizePackageGroup(fromJson.packageGroup) }
|
|
49
60
|
: {}),
|
package/dist/src/utils/params.js
CHANGED
|
@@ -443,7 +443,7 @@ function applyVerbosity(options, schema, isVerbose) {
|
|
|
443
443
|
}
|
|
444
444
|
function combineOptionsForExecutor(commandLineOpts, config, target, schema, defaultProjectName, relativeCwd, isVerbose = false) {
|
|
445
445
|
const r = convertAliases(coerceTypesInOptions(convertToCamelCase(commandLineOpts, schema), schema), schema, false);
|
|
446
|
-
let combined = target.options
|
|
446
|
+
let combined = { ...target.options };
|
|
447
447
|
if (config && target.configurations && target.configurations[config]) {
|
|
448
448
|
Object.assign(combined, target.configurations[config]);
|
|
449
449
|
}
|
package/dist/src/utils/path.d.ts
CHANGED
|
@@ -8,6 +8,12 @@ export declare function normalizePath(osSpecificPath: string): string;
|
|
|
8
8
|
* This should not be used to read files on disk because of the removal of Windows drive letters.
|
|
9
9
|
*/
|
|
10
10
|
export declare function joinPathFragments(...fragments: string[]): string;
|
|
11
|
+
/**
|
|
12
|
+
* True when `relativePath` stays inside the directory it is resolved against.
|
|
13
|
+
* Absolute paths are rejected because `path.join` silently treats them as
|
|
14
|
+
* relative, so they would otherwise slip past a `..` check.
|
|
15
|
+
*/
|
|
16
|
+
export declare function isContainedRelativePath(relativePath: string): boolean;
|
|
11
17
|
/**
|
|
12
18
|
* When running a script with the package manager (e.g. `npm run`), the package manager will
|
|
13
19
|
* traverse the directory tree upwards until it finds a `package.json` and will set `process.cwd()`
|
package/dist/src/utils/path.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.normalizePath = normalizePath;
|
|
4
4
|
exports.joinPathFragments = joinPathFragments;
|
|
5
|
+
exports.isContainedRelativePath = isContainedRelativePath;
|
|
5
6
|
exports.getCwd = getCwd;
|
|
6
7
|
const tslib_1 = require("tslib");
|
|
7
8
|
const path = tslib_1.__importStar(require("path"));
|
|
@@ -23,6 +24,20 @@ function normalizePath(osSpecificPath) {
|
|
|
23
24
|
function joinPathFragments(...fragments) {
|
|
24
25
|
return normalizePath(path.join(...fragments));
|
|
25
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* True when `relativePath` stays inside the directory it is resolved against.
|
|
29
|
+
* Absolute paths are rejected because `path.join` silently treats them as
|
|
30
|
+
* relative, so they would otherwise slip past a `..` check.
|
|
31
|
+
*/
|
|
32
|
+
function isContainedRelativePath(relativePath) {
|
|
33
|
+
if (path.isAbsolute(relativePath)) {
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
const normalized = path.normalize(relativePath);
|
|
37
|
+
return !(normalized === '..' ||
|
|
38
|
+
normalized.startsWith(`..${path.sep}`) ||
|
|
39
|
+
normalized.startsWith(`..${path.posix.sep}`));
|
|
40
|
+
}
|
|
26
41
|
/**
|
|
27
42
|
* When running a script with the package manager (e.g. `npm run`), the package manager will
|
|
28
43
|
* traverse the directory tree upwards until it finds a `package.json` and will set `process.cwd()`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nx",
|
|
3
|
-
"version": "23.2.
|
|
3
|
+
"version": "23.2.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"description": "The core Nx plugin contains the core functionality of Nx like the project graph, nx commands and task orchestration.",
|
|
@@ -185,16 +185,16 @@
|
|
|
185
185
|
}
|
|
186
186
|
},
|
|
187
187
|
"optionalDependencies": {
|
|
188
|
-
"@nx/nx-darwin-arm64": "23.2.
|
|
189
|
-
"@nx/nx-darwin-x64": "23.2.
|
|
190
|
-
"@nx/nx-freebsd-x64": "23.2.
|
|
191
|
-
"@nx/nx-linux-arm-gnueabihf": "23.2.
|
|
192
|
-
"@nx/nx-linux-arm64-gnu": "23.2.
|
|
193
|
-
"@nx/nx-linux-arm64-musl": "23.2.
|
|
194
|
-
"@nx/nx-linux-x64-gnu": "23.2.
|
|
195
|
-
"@nx/nx-linux-x64-musl": "23.2.
|
|
196
|
-
"@nx/nx-win32-arm64-msvc": "23.2.
|
|
197
|
-
"@nx/nx-win32-x64-msvc": "23.2.
|
|
188
|
+
"@nx/nx-darwin-arm64": "23.2.1",
|
|
189
|
+
"@nx/nx-darwin-x64": "23.2.1",
|
|
190
|
+
"@nx/nx-freebsd-x64": "23.2.1",
|
|
191
|
+
"@nx/nx-linux-arm-gnueabihf": "23.2.1",
|
|
192
|
+
"@nx/nx-linux-arm64-gnu": "23.2.1",
|
|
193
|
+
"@nx/nx-linux-arm64-musl": "23.2.1",
|
|
194
|
+
"@nx/nx-linux-x64-gnu": "23.2.1",
|
|
195
|
+
"@nx/nx-linux-x64-musl": "23.2.1",
|
|
196
|
+
"@nx/nx-win32-arm64-msvc": "23.2.1",
|
|
197
|
+
"@nx/nx-win32-x64-msvc": "23.2.1"
|
|
198
198
|
},
|
|
199
199
|
"nx-migrations": {
|
|
200
200
|
"migrations": "./migrations.json",
|