nx 24.0.4 → 24.0.6
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/bin/nx.js +2 -8
- package/dist/bin/workspace-env.d.ts +7 -0
- package/dist/bin/workspace-env.js +20 -0
- package/dist/src/command-line/affected/affected.js +1 -0
- package/dist/src/command-line/migrate/migrate.js +23 -7
- package/dist/src/command-line/migrate/prompt-files.d.ts +4 -2
- package/dist/src/command-line/migrate/prompt-files.js +26 -5
- package/dist/src/command-line/nx-cloud/start-nx-agents/command-object.js +1 -1
- package/dist/src/command-line/release/changelog.js +15 -12
- package/dist/src/command-line/reset/reset.js +13 -1
- package/dist/src/daemon/client/client.js +8 -7
- package/dist/src/daemon/client/daemon-environment.d.ts +43 -11
- package/dist/src/daemon/client/daemon-environment.js +139 -8
- package/dist/src/daemon/server/handle-client-env.d.ts +11 -1
- package/dist/src/daemon/server/handle-client-env.js +96 -5
- package/dist/src/daemon/server/handle-configure-ai-agents.js +2 -1
- package/dist/src/daemon/server/latest-nx.js +2 -1
- package/dist/src/daemon/server/server.js +1 -1
- package/dist/src/daemon/socket-utils.d.ts +9 -1
- package/dist/src/daemon/socket-utils.js +25 -0
- package/dist/src/executors/run-commands/running-tasks.d.ts +1 -0
- package/dist/src/executors/run-commands/running-tasks.js +69 -17
- package/dist/src/executors/run-script/run-script.impl.js +11 -3
- package/dist/src/native/index.d.ts +1 -1
- package/dist/src/native/index.js +31 -3
- package/dist/src/native/native-file-cache-location.js +10 -4
- package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
- package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
- package/dist/src/native/transform-objects.js +5 -1
- package/dist/src/nx-cloud/update-manager.d.ts +6 -1
- package/dist/src/nx-cloud/update-manager.js +39 -12
- package/dist/src/plugins/js/lock-file/pnpm-parser.js +22 -34
- package/dist/src/plugins/js/lock-file/project-graph-pruning.d.ts +7 -0
- package/dist/src/plugins/js/lock-file/project-graph-pruning.js +31 -5
- package/dist/src/plugins/js/lock-file/utils/pnpm-normalizer.d.ts +1 -1
- package/dist/src/plugins/js/lock-file/utils/pnpm-normalizer.js +6 -5
- package/dist/src/plugins/js/package-json/create-package-json.d.ts +1 -1
- package/dist/src/plugins/js/package-json/create-package-json.js +53 -16
- package/dist/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +7 -1
- package/dist/src/project-graph/affected/affected-tasks.js +29 -1
- package/dist/src/project-graph/plugins/get-plugins.d.ts +2 -0
- package/dist/src/project-graph/plugins/get-plugins.js +17 -2
- package/dist/src/project-graph/plugins/isolation/isolated-plugin.js +4 -2
- package/dist/src/tasks-runner/fork.js +4 -2
- package/dist/src/tasks-runner/run-command.d.ts +4 -1
- package/dist/src/tasks-runner/run-command.js +6 -4
- package/dist/src/tasks-runner/running-tasks/batch-process.d.ts +3 -2
- package/dist/src/tasks-runner/running-tasks/batch-process.js +7 -3
- package/dist/src/tasks-runner/task-orchestrator.d.ts +1 -0
- package/dist/src/tasks-runner/task-orchestrator.js +12 -3
- package/dist/src/tasks-runner/tasks-runner.d.ts +5 -0
- package/dist/src/ultracache/overrides.d.ts +1 -1
- package/dist/src/ultracache/overrides.js +1 -1
- package/dist/src/ultracache/report.d.ts +1 -1
- package/dist/src/ultracache/report.js +4 -1
- package/dist/src/utils/cache-directory.d.ts +3 -0
- package/dist/src/utils/cache-directory.js +105 -25
- package/dist/src/utils/child-process.d.ts +8 -1
- package/dist/src/utils/child-process.js +24 -0
- package/dist/src/utils/compile-cache.d.ts +6 -8
- package/dist/src/utils/compile-cache.js +23 -16
- package/dist/src/utils/min-release-age/packument.d.ts +2 -1
- package/dist/src/utils/min-release-age/packument.js +5 -3
- package/dist/src/utils/nx-tmp-dir.d.ts +14 -2
- package/dist/src/utils/nx-tmp-dir.js +26 -2
- package/dist/src/utils/owned-private-dir.d.ts +22 -0
- package/dist/src/utils/owned-private-dir.js +148 -0
- package/dist/src/utils/package-json.d.ts +8 -1
- package/dist/src/utils/package-json.js +77 -34
- package/dist/src/utils/package-manager.d.ts +25 -0
- package/dist/src/utils/package-manager.js +244 -9
- package/dist/src/utils/path.d.ts +4 -0
- package/dist/src/utils/path.js +8 -0
- package/dist/src/utils/redact-url-credentials.js +3 -2
- package/dist/src/utils/wait-for-socket-connection.d.ts +2 -0
- package/dist/src/utils/wait-for-socket-connection.js +3 -3
- package/package.json +11 -11
- package/schemas/migrations-schema.json +1 -1
|
@@ -6,7 +6,7 @@ exports.formatUltracacheSummary = formatUltracacheSummary;
|
|
|
6
6
|
* configurations: `result` is what hashing used, `status` whether they were
|
|
7
7
|
* fetched or already stored.
|
|
8
8
|
*/
|
|
9
|
-
function formatUltracacheSummary(result, status) {
|
|
9
|
+
function formatUltracacheSummary(result, status, skipped) {
|
|
10
10
|
const used = result.used.length;
|
|
11
11
|
const withheld = result.diagnostics.filter((d) => d.taskId != null);
|
|
12
12
|
const byReason = countByReason(withheld);
|
|
@@ -17,6 +17,9 @@ function formatUltracacheSummary(result, status) {
|
|
|
17
17
|
: `Ultracache: ${plural(used, 'task')} hashed from their configuration, ${plural(fellBack, 'task')} fell back${fellBack ? ` (${summarizeReasons(byReason)})` : ''}`;
|
|
18
18
|
const bodyLines = [`configurations: ${status}`];
|
|
19
19
|
bodyLines.push(`commit ${result.resolution.requestedCommit}, configurations for ${result.resolution.tasks} tasks`);
|
|
20
|
+
if (skipped !== undefined) {
|
|
21
|
+
bodyLines.push(`${plural(skipped, 'task')} skipped by Ultracache`);
|
|
22
|
+
}
|
|
20
23
|
for (const d of result.diagnostics) {
|
|
21
24
|
bodyLines.push(describeDiagnostic(d));
|
|
22
25
|
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
export declare class UntrustedDataDirectoryError extends Error {
|
|
2
|
+
constructor(kind: string, dir: string, reason: string);
|
|
3
|
+
}
|
|
1
4
|
/**
|
|
2
5
|
* `readNxJson` rather than a raw read, so a `cacheDirectory` reached through
|
|
3
6
|
* `extends` counts. It throws on malformed JSON, which must not take the
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.workspaceDataDirectory = exports.cacheDir = void 0;
|
|
3
|
+
exports.workspaceDataDirectory = exports.cacheDir = exports.UntrustedDataDirectoryError = void 0;
|
|
4
4
|
exports.readCacheDirectoryProperty = readCacheDirectoryProperty;
|
|
5
5
|
exports.resetSharedRootCacheForTesting = resetSharedRootCacheForTesting;
|
|
6
6
|
exports.resolveSharedDataLocation = resolveSharedDataLocation;
|
|
@@ -16,6 +16,102 @@ const nx_tmp_dir_1 = require("./nx-tmp-dir");
|
|
|
16
16
|
const owned_private_dir_1 = require("./owned-private-dir");
|
|
17
17
|
const workspace_id_1 = require("./workspace-id");
|
|
18
18
|
const workspace_root_1 = require("./workspace-root");
|
|
19
|
+
const S_ISVTX = 0o1000;
|
|
20
|
+
const trustedConfiguredDirs = new Set();
|
|
21
|
+
class UntrustedDataDirectoryError extends Error {
|
|
22
|
+
constructor(kind, dir, reason) {
|
|
23
|
+
super(`The configured Nx ${kind} directory ${dir} is not safe to use: ${reason}. ` +
|
|
24
|
+
`Nx restores task outputs and reads cached configuration from this directory, so it must only be modifiable by you, root, or the owner of the workspace. ` +
|
|
25
|
+
`Point it at a directory you own instead, or set NX_ALLOW_INSECURE_DIRECTORIES=true to use it anyway.`);
|
|
26
|
+
this.name = 'UntrustedDataDirectoryError';
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.UntrustedDataDirectoryError = UntrustedDataDirectoryError;
|
|
30
|
+
/**
|
|
31
|
+
* Creates a configured data directory and refuses it if a user other than us,
|
|
32
|
+
* root, or the workspace owner could replace its contents. Paths inside the
|
|
33
|
+
* workspace are trusted like the workspace. Group write is an explicit grant.
|
|
34
|
+
*/
|
|
35
|
+
function ensureTrustedConfiguredDir(dir, root, kind) {
|
|
36
|
+
const key = `${dir}\0${root}`;
|
|
37
|
+
if (typeof process.getuid !== 'function' || trustedConfiguredDirs.has(key)) {
|
|
38
|
+
return dir;
|
|
39
|
+
}
|
|
40
|
+
// Claim a missing directory under a shared parent before another user can.
|
|
41
|
+
if (!isWithin((0, path_1.resolve)(dir), (0, path_1.resolve)(root)) && nearestExistingIsShared(dir)) {
|
|
42
|
+
try {
|
|
43
|
+
(0, fs_1.mkdirSync)(dir, { recursive: true, mode: 0o775 });
|
|
44
|
+
}
|
|
45
|
+
catch { }
|
|
46
|
+
}
|
|
47
|
+
const trusted = new Set([process.getuid(), 0]);
|
|
48
|
+
try {
|
|
49
|
+
trusted.add((0, fs_1.statSync)(root).uid);
|
|
50
|
+
}
|
|
51
|
+
catch { }
|
|
52
|
+
// The path as written catches a symlink a peer could repoint; the canonical
|
|
53
|
+
// path catches the directories the symlinks lead to.
|
|
54
|
+
for (const [leaf, stop] of [
|
|
55
|
+
[(0, path_1.resolve)(dir), (0, path_1.resolve)(root)],
|
|
56
|
+
[(0, owned_private_dir_1.canonicalDir)(dir), (0, owned_private_dir_1.canonicalDir)(root)],
|
|
57
|
+
]) {
|
|
58
|
+
if (isWithin(leaf, stop)) {
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
for (let p = leaf; p !== stop; p = (0, path_1.dirname)(p)) {
|
|
62
|
+
const reason = untrustedReason(p, p === leaf, trusted);
|
|
63
|
+
if (reason) {
|
|
64
|
+
if (process.env.NX_ALLOW_INSECURE_DIRECTORIES !== 'true') {
|
|
65
|
+
throw new UntrustedDataDirectoryError(kind, dir, reason);
|
|
66
|
+
}
|
|
67
|
+
console.warn(`NX_ALLOW_INSECURE_DIRECTORIES is set, so Nx is using the ${kind} directory ${dir} although ${reason}.`);
|
|
68
|
+
trustedConfiguredDirs.add(key);
|
|
69
|
+
return dir;
|
|
70
|
+
}
|
|
71
|
+
if ((0, path_1.dirname)(p) === p) {
|
|
72
|
+
break;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
trustedConfiguredDirs.add(key);
|
|
77
|
+
return dir;
|
|
78
|
+
}
|
|
79
|
+
function nearestExistingIsShared(dir) {
|
|
80
|
+
for (let p = (0, path_1.resolve)(dir);; p = (0, path_1.dirname)(p)) {
|
|
81
|
+
try {
|
|
82
|
+
return ((0, fs_1.statSync)(p).mode & 0o002) !== 0;
|
|
83
|
+
}
|
|
84
|
+
catch { }
|
|
85
|
+
if ((0, path_1.dirname)(p) === p) {
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function isWithin(path, root) {
|
|
91
|
+
const rel = (0, path_1.relative)(root, path);
|
|
92
|
+
return !rel.startsWith('..') && !(0, path_1.isAbsolute)(rel);
|
|
93
|
+
}
|
|
94
|
+
function untrustedReason(path, isLeaf, trusted) {
|
|
95
|
+
let stats;
|
|
96
|
+
try {
|
|
97
|
+
stats = (0, fs_1.lstatSync)(path);
|
|
98
|
+
}
|
|
99
|
+
catch {
|
|
100
|
+
return undefined;
|
|
101
|
+
}
|
|
102
|
+
if (!trusted.has(stats.uid)) {
|
|
103
|
+
return `${path} is owned by uid ${stats.uid}`;
|
|
104
|
+
}
|
|
105
|
+
if (!stats.isDirectory() || !(stats.mode & 0o002)) {
|
|
106
|
+
return undefined;
|
|
107
|
+
}
|
|
108
|
+
if (isLeaf) {
|
|
109
|
+
return `${path} is writable by other users`;
|
|
110
|
+
}
|
|
111
|
+
return stats.mode & S_ISVTX
|
|
112
|
+
? undefined
|
|
113
|
+
: `${path} is writable by other users and not sticky`;
|
|
114
|
+
}
|
|
19
115
|
function absolutePath(root, path) {
|
|
20
116
|
if ((0, path_1.isAbsolute)(path)) {
|
|
21
117
|
return path;
|
|
@@ -30,7 +126,7 @@ function cacheDirectory(root, cacheDirectory) {
|
|
|
30
126
|
cacheDirectory = cacheDirFromEnv;
|
|
31
127
|
}
|
|
32
128
|
if (cacheDirectory) {
|
|
33
|
-
return absolutePath(root, cacheDirectory);
|
|
129
|
+
return ensureTrustedConfiguredDir(absolutePath(root, cacheDirectory), root, 'cache');
|
|
34
130
|
}
|
|
35
131
|
else {
|
|
36
132
|
return defaultCacheDirectory(root);
|
|
@@ -81,30 +177,12 @@ const SHARED_SEGMENT = {
|
|
|
81
177
|
'workspace-data': 'databases',
|
|
82
178
|
};
|
|
83
179
|
const SHARED_DATA_KINDS = Object.keys(SHARED_SEGMENT);
|
|
84
|
-
/**
|
|
85
|
-
* Whether `~/.nx` is somewhere other than the shared container.
|
|
86
|
-
*
|
|
87
|
-
* `homedir()` honours `$HOME`, so with `HOME=/tmp` the two are one path -- and
|
|
88
|
-
* that container is deliberately world-writable (`1777`) so peers can each
|
|
89
|
-
* create their own subtree under it. Build outputs and the graph DB get
|
|
90
|
-
* replayed into the workspace and supply target commands, so they cannot live
|
|
91
|
-
* anywhere a peer can replace them.
|
|
92
|
-
*
|
|
93
|
-
* `daemon/tmp-dir.ts` makes the same check for the socket tier. It cannot be
|
|
94
|
-
* shared from there: that module imports this one.
|
|
95
|
-
*/
|
|
96
|
-
function homeDirIsDistinctFromSharedTmp() {
|
|
97
|
-
if (!nx_tmp_dir_1.NX_HOME_TMP_DIR) {
|
|
98
|
-
return false;
|
|
99
|
-
}
|
|
100
|
-
const home = (0, owned_private_dir_1.canonicalDir)(nx_tmp_dir_1.NX_HOME_TMP_DIR);
|
|
101
|
-
return ![nx_tmp_dir_1.NX_TMP_DIR, nx_tmp_dir_1.NX_USER_TMP_DIR].some((shared) => (0, owned_private_dir_1.canonicalDir)(shared) === home);
|
|
102
|
-
}
|
|
103
180
|
/** Memoizes the verdict below, per repository. */
|
|
104
181
|
const sharedRootUsable = new Map();
|
|
105
182
|
/** The establish verdict is cached per process; tests need it cleared. */
|
|
106
183
|
function resetSharedRootCacheForTesting() {
|
|
107
184
|
sharedRootUsable.clear();
|
|
185
|
+
trustedConfiguredDirs.clear();
|
|
108
186
|
workspaceIds.clear();
|
|
109
187
|
resolvedLocations.clear();
|
|
110
188
|
}
|
|
@@ -116,7 +194,7 @@ function resetSharedRootCacheForTesting() {
|
|
|
116
194
|
* it never wrote. One answer serves both.
|
|
117
195
|
*/
|
|
118
196
|
function establishUserRoot(workspaceId) {
|
|
119
|
-
if (!nx_tmp_dir_1.NX_HOME_TMP_DIR || !homeDirIsDistinctFromSharedTmp()) {
|
|
197
|
+
if (!nx_tmp_dir_1.NX_HOME_TMP_DIR || !(0, nx_tmp_dir_1.homeDirIsDistinctFromSharedTmp)()) {
|
|
120
198
|
return { kind: 'not-a-directory', dir: nx_tmp_dir_1.NX_HOME_TMP_DIR ?? '~/.nx' };
|
|
121
199
|
}
|
|
122
200
|
const repoRoot = (0, path_1.join)(nx_tmp_dir_1.NX_HOME_TMP_DIR, sharedDirName(workspaceId));
|
|
@@ -331,7 +409,9 @@ function cacheDirectoryForWorkspace(root) {
|
|
|
331
409
|
*/
|
|
332
410
|
exports.workspaceDataDirectory = workspaceDataDirectoryForWorkspace(workspace_root_1.workspaceRoot);
|
|
333
411
|
function workspaceDataDirectoryForWorkspace(workspaceRoot) {
|
|
334
|
-
|
|
335
|
-
process.env.NX_PROJECT_GRAPH_CACHE_DIRECTORY
|
|
336
|
-
|
|
412
|
+
const configured = process.env.NX_WORKSPACE_DATA_DIRECTORY ??
|
|
413
|
+
process.env.NX_PROJECT_GRAPH_CACHE_DIRECTORY;
|
|
414
|
+
return configured !== undefined
|
|
415
|
+
? ensureTrustedConfiguredDir(absolutePath(workspaceRoot, configured), workspaceRoot, 'workspace data')
|
|
416
|
+
: defaultWorkspaceDataDirectory(workspaceRoot);
|
|
337
417
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ExecOptions, type ExecSyncOptions, type SpawnSyncOptions } from 'child_process';
|
|
1
|
+
import { type ChildProcess as NodeChildProcess, type ExecOptions, type ExecSyncOptions, type SpawnSyncOptions } from 'child_process';
|
|
2
2
|
import { PackageManagerCommands } from './package-manager';
|
|
3
3
|
import { ChildProcess } from '../native';
|
|
4
4
|
export declare function getRunNxBaseCommand(packageManagerCommand?: PackageManagerCommands, cwd?: string): string;
|
|
@@ -41,6 +41,13 @@ export declare function runNxAsync(cmd: string, options?: ExecOptions & {
|
|
|
41
41
|
silent?: boolean;
|
|
42
42
|
packageManagerCommand?: PackageManagerCommands;
|
|
43
43
|
}): Promise<void>;
|
|
44
|
+
export declare function hasExited(child: NodeChildProcess): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Settles once `child`'s stdio has closed, which Node reports after 'exit'.
|
|
47
|
+
* Call it at spawn time: a 'close' emitted before the call is missed. Gives up
|
|
48
|
+
* 1s after 'exit', since a descendant can keep the pipes open indefinitely.
|
|
49
|
+
*/
|
|
50
|
+
export declare function whenStdioClosed(child: NodeChildProcess): Promise<void>;
|
|
44
51
|
export declare class PseudoTtyProcess {
|
|
45
52
|
private childProcess;
|
|
46
53
|
isAlive: boolean;
|
|
@@ -7,6 +7,8 @@ exports.readInstalledNxBin = readInstalledNxBin;
|
|
|
7
7
|
exports.runNxArgvSync = runNxArgvSync;
|
|
8
8
|
exports.runNxSync = runNxSync;
|
|
9
9
|
exports.runNxAsync = runNxAsync;
|
|
10
|
+
exports.hasExited = hasExited;
|
|
11
|
+
exports.whenStdioClosed = whenStdioClosed;
|
|
10
12
|
const child_process_1 = require("child_process");
|
|
11
13
|
const fs_1 = require("fs");
|
|
12
14
|
const path_1 = require("path");
|
|
@@ -160,6 +162,28 @@ async function runNxAsync(cmd, options) {
|
|
|
160
162
|
}
|
|
161
163
|
});
|
|
162
164
|
}
|
|
165
|
+
function hasExited(child) {
|
|
166
|
+
return child.exitCode !== null || child.signalCode !== null;
|
|
167
|
+
}
|
|
168
|
+
/**
|
|
169
|
+
* Settles once `child`'s stdio has closed, which Node reports after 'exit'.
|
|
170
|
+
* Call it at spawn time: a 'close' emitted before the call is missed. Gives up
|
|
171
|
+
* 1s after 'exit', since a descendant can keep the pipes open indefinitely.
|
|
172
|
+
*/
|
|
173
|
+
function whenStdioClosed(child) {
|
|
174
|
+
return new Promise((resolve) => {
|
|
175
|
+
let timeout;
|
|
176
|
+
child.once('close', () => {
|
|
177
|
+
clearTimeout(timeout);
|
|
178
|
+
resolve();
|
|
179
|
+
});
|
|
180
|
+
child.once('exit', () => {
|
|
181
|
+
// Node runs expired timers before it reads the pipes, so a blocked event
|
|
182
|
+
// loop would otherwise give up on output that is already there.
|
|
183
|
+
timeout = setTimeout(() => setImmediate(resolve), 1000);
|
|
184
|
+
});
|
|
185
|
+
});
|
|
186
|
+
}
|
|
163
187
|
class PseudoTtyProcess {
|
|
164
188
|
constructor(childProcess) {
|
|
165
189
|
this.childProcess = childProcess;
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Enables V8's on-disk bytecode cache for the current process.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* The cache lives in the current user's owner-only Nx tmp directory, because
|
|
5
|
+
* Node's default location is a shared `os.tmpdir()` path whose contents are
|
|
6
|
+
* loaded regardless of who created them. If that directory cannot be
|
|
7
|
+
* established securely, the cache stays off. Node's env vars still apply:
|
|
8
|
+
* - `NODE_COMPILE_CACHE=<dir>` — the user's chosen directory wins.
|
|
7
9
|
* - `NODE_DISABLE_COMPILE_CACHE=1` — disable entirely.
|
|
8
10
|
*
|
|
9
|
-
* The default location lives under the OS temp dir keyed by V8 version, so
|
|
10
|
-
* the cache is shared across workspaces and self-invalidates on Node
|
|
11
|
-
* upgrades — no nx-specific cleanup needed.
|
|
12
|
-
*
|
|
13
11
|
* Called at the entry point of every long-lived nx process (main CLI,
|
|
14
12
|
* daemon, plugin workers) via `enable-compile-cache.ts`, which side-effects
|
|
15
13
|
* this on import.
|
|
@@ -21,4 +19,4 @@
|
|
|
21
19
|
* Errors are swallowed — the compile cache is a pure performance
|
|
22
20
|
* optimization and must never break the CLI.
|
|
23
21
|
*/
|
|
24
|
-
export declare function enableCompileCache(
|
|
22
|
+
export declare function enableCompileCache(impl?: unknown, cacheDir?: string): boolean;
|
|
@@ -3,18 +3,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.enableCompileCache = enableCompileCache;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const nodeModule = tslib_1.__importStar(require("node:module"));
|
|
6
|
+
const node_path_1 = require("node:path");
|
|
7
|
+
const nx_tmp_dir_1 = require("./nx-tmp-dir");
|
|
8
|
+
const owned_private_dir_1 = require("./owned-private-dir");
|
|
9
|
+
const COMPILE_CACHE_DIR = (0, node_path_1.join)(nx_tmp_dir_1.NX_USER_TMP_DIR, 'compile-cache');
|
|
6
10
|
/**
|
|
7
11
|
* Enables V8's on-disk bytecode cache for the current process.
|
|
8
12
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
13
|
+
* The cache lives in the current user's owner-only Nx tmp directory, because
|
|
14
|
+
* Node's default location is a shared `os.tmpdir()` path whose contents are
|
|
15
|
+
* loaded regardless of who created them. If that directory cannot be
|
|
16
|
+
* established securely, the cache stays off. Node's env vars still apply:
|
|
17
|
+
* - `NODE_COMPILE_CACHE=<dir>` — the user's chosen directory wins.
|
|
12
18
|
* - `NODE_DISABLE_COMPILE_CACHE=1` — disable entirely.
|
|
13
19
|
*
|
|
14
|
-
* The default location lives under the OS temp dir keyed by V8 version, so
|
|
15
|
-
* the cache is shared across workspaces and self-invalidates on Node
|
|
16
|
-
* upgrades — no nx-specific cleanup needed.
|
|
17
|
-
*
|
|
18
20
|
* Called at the entry point of every long-lived nx process (main CLI,
|
|
19
21
|
* daemon, plugin workers) via `enable-compile-cache.ts`, which side-effects
|
|
20
22
|
* this on import.
|
|
@@ -27,20 +29,25 @@ const nodeModule = tslib_1.__importStar(require("node:module"));
|
|
|
27
29
|
* optimization and must never break the CLI.
|
|
28
30
|
*/
|
|
29
31
|
function enableCompileCache(
|
|
30
|
-
// Test
|
|
31
|
-
//
|
|
32
|
-
|
|
33
|
-
// read `arguments.length` so callers can *explicitly* pass `undefined`.
|
|
34
|
-
...override) {
|
|
32
|
+
// Test seams: production callers omit both. A non-function `impl` simulates
|
|
33
|
+
// pre-22.8 Node, where `module.enableCompileCache` is missing.
|
|
34
|
+
impl = nodeModule.enableCompileCache, cacheDir = COMPILE_CACHE_DIR) {
|
|
35
35
|
if (process.env.NX_COMPILE_CACHE === 'false')
|
|
36
36
|
return false;
|
|
37
|
-
const impl = override.length === 0
|
|
38
|
-
? nodeModule.enableCompileCache
|
|
39
|
-
: override[0];
|
|
40
37
|
if (typeof impl !== 'function')
|
|
41
38
|
return false;
|
|
42
39
|
try {
|
|
43
|
-
|
|
40
|
+
if (process.env.NODE_COMPILE_CACHE) {
|
|
41
|
+
impl();
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
const userRoot = (0, node_path_1.dirname)(cacheDir);
|
|
45
|
+
if ((0, owned_private_dir_1.ensureSafeSharedRoot)((0, node_path_1.dirname)(userRoot)).status !== 'ok' ||
|
|
46
|
+
(0, owned_private_dir_1.ensureOwnedPrivateDir)(userRoot).status !== 'ok' ||
|
|
47
|
+
(0, owned_private_dir_1.ensureOwnedPrivateDir)(cacheDir).status !== 'ok') {
|
|
48
|
+
return false;
|
|
49
|
+
}
|
|
50
|
+
impl(cacheDir);
|
|
44
51
|
return true;
|
|
45
52
|
}
|
|
46
53
|
catch {
|
|
@@ -8,6 +8,7 @@ export interface RegistryMetadata {
|
|
|
8
8
|
* Fetches the full packument for a package and normalizes the quirks of
|
|
9
9
|
* `npm view --json`: `versions` may be a scalar when a single version exists,
|
|
10
10
|
* `time` may be absent (third-party registries) and is exposed as null,
|
|
11
|
-
* `dist-tags` carries a hyphen.
|
|
11
|
+
* `dist-tags` carries a hyphen. Entries that are not versions are dropped,
|
|
12
|
+
* because a pick is reused after `<pkg>@` in a package manager command.
|
|
12
13
|
*/
|
|
13
14
|
export declare function fetchRegistryMetadata(pkg: string): Promise<RegistryMetadata>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.fetchRegistryMetadata = fetchRegistryMetadata;
|
|
4
|
+
const semver_1 = require("semver");
|
|
4
5
|
const package_manager_1 = require("../package-manager");
|
|
5
6
|
// `npm view <pkg> --json` collapses single-element fields to scalars.
|
|
6
7
|
function toArray(value) {
|
|
@@ -13,7 +14,8 @@ function toArray(value) {
|
|
|
13
14
|
* Fetches the full packument for a package and normalizes the quirks of
|
|
14
15
|
* `npm view --json`: `versions` may be a scalar when a single version exists,
|
|
15
16
|
* `time` may be absent (third-party registries) and is exposed as null,
|
|
16
|
-
* `dist-tags` carries a hyphen.
|
|
17
|
+
* `dist-tags` carries a hyphen. Entries that are not versions are dropped,
|
|
18
|
+
* because a pick is reused after `<pkg>@` in a package manager command.
|
|
17
19
|
*/
|
|
18
20
|
async function fetchRegistryMetadata(pkg) {
|
|
19
21
|
const raw = await (0, package_manager_1.packageRegistryView)(pkg, '', ['--json']);
|
|
@@ -27,8 +29,8 @@ async function fetchRegistryMetadata(pkg) {
|
|
|
27
29
|
}
|
|
28
30
|
return {
|
|
29
31
|
name: parsed.name ?? pkg,
|
|
30
|
-
versions: toArray(parsed.versions),
|
|
32
|
+
versions: toArray(parsed.versions).filter((v) => (0, semver_1.valid)(v)),
|
|
31
33
|
time,
|
|
32
|
-
distTags: parsed['dist-tags'] ?? {},
|
|
34
|
+
distTags: Object.fromEntries(Object.entries(parsed['dist-tags'] ?? {}).filter(([, v]) => (0, semver_1.valid)(v))),
|
|
33
35
|
};
|
|
34
36
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Stable root for Nx runtime artifacts that need an OS tmp location. On POSIX a
|
|
3
3
|
* literal `/tmp`, not `os.tmpdir()`, which honours `$TMPDIR` — per-user on
|
|
4
|
-
* macOS, rewritten by sandboxes,
|
|
5
|
-
* daemon would disagree. Windows has no `/tmp`, and `%TMP%` is already per-user
|
|
4
|
+
* macOS, rewritten by sandboxes, fixed in the daemon at spawn and never
|
|
5
|
+
* reflected from later clients, so client and daemon would disagree. Windows has no `/tmp`, and `%TMP%` is already per-user
|
|
6
6
|
* and stable, so it keeps `os.tmpdir()`.
|
|
7
7
|
*
|
|
8
8
|
* Consumed by the native binding loader, so keep this file limited to local
|
|
@@ -21,3 +21,15 @@ export declare const NX_TMP_DIR: string;
|
|
|
21
21
|
export declare const NX_USER_TMP_DIR: string;
|
|
22
22
|
/** Runtime root under the user's home, used when the shared container cannot be established. */
|
|
23
23
|
export declare const NX_HOME_TMP_DIR: string;
|
|
24
|
+
/**
|
|
25
|
+
* Whether the home directory lies outside the shared temp dir.
|
|
26
|
+
*
|
|
27
|
+
* `homedir()` honours `$HOME`, so `HOME=/tmp` or `HOME=/tmp/foo` puts `~/.nx`
|
|
28
|
+
* at or under a directory every user can write to (`1777`). Peers can plant
|
|
29
|
+
* files in its ancestors and, at `HOME=/tmp`, own the `.nx` container itself.
|
|
30
|
+
* Nothing that Nx later executes, installs into, or replays into the workspace
|
|
31
|
+
* can live there.
|
|
32
|
+
*
|
|
33
|
+
* `native/utils/socket_path.rs` makes only the same-path check, for sockets.
|
|
34
|
+
*/
|
|
35
|
+
export declare function homeDirIsDistinctFromSharedTmp(): boolean;
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NX_HOME_TMP_DIR = exports.NX_USER_TMP_DIR = exports.NX_TMP_DIR = exports.NX_TMP_DIR_POSIX = void 0;
|
|
4
|
+
exports.homeDirIsDistinctFromSharedTmp = homeDirIsDistinctFromSharedTmp;
|
|
4
5
|
const node_os_1 = require("node:os");
|
|
5
6
|
const node_path_1 = require("node:path");
|
|
6
7
|
const owned_private_dir_1 = require("./owned-private-dir");
|
|
7
8
|
/**
|
|
8
9
|
* Stable root for Nx runtime artifacts that need an OS tmp location. On POSIX a
|
|
9
10
|
* literal `/tmp`, not `os.tmpdir()`, which honours `$TMPDIR` — per-user on
|
|
10
|
-
* macOS, rewritten by sandboxes,
|
|
11
|
-
* daemon would disagree. Windows has no `/tmp`, and `%TMP%` is already per-user
|
|
11
|
+
* macOS, rewritten by sandboxes, fixed in the daemon at spawn and never
|
|
12
|
+
* reflected from later clients, so client and daemon would disagree. Windows has no `/tmp`, and `%TMP%` is already per-user
|
|
12
13
|
* and stable, so it keeps `os.tmpdir()`.
|
|
13
14
|
*
|
|
14
15
|
* Consumed by the native binding loader, so keep this file limited to local
|
|
@@ -43,3 +44,26 @@ function resolveHomeTmpDir() {
|
|
|
43
44
|
return undefined;
|
|
44
45
|
}
|
|
45
46
|
}
|
|
47
|
+
/**
|
|
48
|
+
* Whether the home directory lies outside the shared temp dir.
|
|
49
|
+
*
|
|
50
|
+
* `homedir()` honours `$HOME`, so `HOME=/tmp` or `HOME=/tmp/foo` puts `~/.nx`
|
|
51
|
+
* at or under a directory every user can write to (`1777`). Peers can plant
|
|
52
|
+
* files in its ancestors and, at `HOME=/tmp`, own the `.nx` container itself.
|
|
53
|
+
* Nothing that Nx later executes, installs into, or replays into the workspace
|
|
54
|
+
* can live there.
|
|
55
|
+
*
|
|
56
|
+
* `native/utils/socket_path.rs` makes only the same-path check, for sockets.
|
|
57
|
+
*/
|
|
58
|
+
function homeDirIsDistinctFromSharedTmp() {
|
|
59
|
+
if (!exports.NX_HOME_TMP_DIR) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
const home = (0, owned_private_dir_1.canonicalDir)((0, node_path_1.dirname)(exports.NX_HOME_TMP_DIR));
|
|
63
|
+
const fromSharedTmp = (0, node_path_1.relative)((0, owned_private_dir_1.canonicalDir)((0, node_path_1.dirname)(exports.NX_TMP_DIR)), home);
|
|
64
|
+
const atOrUnderSharedTmp = fromSharedTmp === '' ||
|
|
65
|
+
(fromSharedTmp !== '..' &&
|
|
66
|
+
!fromSharedTmp.startsWith('..' + node_path_1.sep) &&
|
|
67
|
+
!(0, node_path_1.isAbsolute)(fromSharedTmp));
|
|
68
|
+
return !atOrUnderSharedTmp;
|
|
69
|
+
}
|
|
@@ -46,10 +46,18 @@ export type DirRefusal = {
|
|
|
46
46
|
kind: 'foreign-shared-container';
|
|
47
47
|
dir: string;
|
|
48
48
|
uid: number;
|
|
49
|
+
} | {
|
|
50
|
+
kind: 'foreign-ancestor';
|
|
51
|
+
dir: string;
|
|
52
|
+
uid: number;
|
|
49
53
|
} | {
|
|
50
54
|
kind: 'not-tightenable';
|
|
51
55
|
dir: string;
|
|
52
56
|
mode: number;
|
|
57
|
+
} | {
|
|
58
|
+
kind: 'not-private';
|
|
59
|
+
dir: string;
|
|
60
|
+
mode: number;
|
|
53
61
|
} | {
|
|
54
62
|
kind: 'peer-writable-not-sticky';
|
|
55
63
|
dir: string;
|
|
@@ -113,6 +121,20 @@ export declare function ensureSafeSharedRoot(dir: string): GuardResult<Establish
|
|
|
113
121
|
* that only want to know whether a path is safe to act on, such as deleting.
|
|
114
122
|
*/
|
|
115
123
|
export declare function isOwnedRealDirectory(dir: string): OwnedRealDir | null;
|
|
124
|
+
/**
|
|
125
|
+
* The verdict of `ensureOwnedPrivateDir` with nothing created and nothing
|
|
126
|
+
* re-locked, for callers about to trust what is already inside. Tightening a
|
|
127
|
+
* directory that was open a moment ago says nothing about who filled it.
|
|
128
|
+
*/
|
|
129
|
+
export declare function isOwnedPrivateDir(dir: string): GuardResult<OwnedPrivateDir>;
|
|
130
|
+
/**
|
|
131
|
+
* Create `dir` and any missing level above it, judging every level from the
|
|
132
|
+
* filesystem root down. For a location the user configured, where any level
|
|
133
|
+
* may have been created first by someone else.
|
|
134
|
+
*/
|
|
135
|
+
export declare function ensureSafeAncestry(dir: string): GuardResult<string>;
|
|
136
|
+
/** `ensureSafeAncestry` without creating anything, for the delete path. */
|
|
137
|
+
export declare function isSafeAncestry(dir: string): GuardResult<string>;
|
|
116
138
|
/** The path segment separating one user's Nx runtime state from another's. */
|
|
117
139
|
export declare function getUserSegment(): string;
|
|
118
140
|
/**
|
|
@@ -6,6 +6,9 @@ exports.canonicalDir = canonicalDir;
|
|
|
6
6
|
exports.isSafeSharedRoot = isSafeSharedRoot;
|
|
7
7
|
exports.ensureSafeSharedRoot = ensureSafeSharedRoot;
|
|
8
8
|
exports.isOwnedRealDirectory = isOwnedRealDirectory;
|
|
9
|
+
exports.isOwnedPrivateDir = isOwnedPrivateDir;
|
|
10
|
+
exports.ensureSafeAncestry = ensureSafeAncestry;
|
|
11
|
+
exports.isSafeAncestry = isSafeAncestry;
|
|
9
12
|
exports.getUserSegment = getUserSegment;
|
|
10
13
|
exports.ensureOwnedPrivateDir = ensureOwnedPrivateDir;
|
|
11
14
|
/**
|
|
@@ -50,8 +53,12 @@ function describeRefusal(r) {
|
|
|
50
53
|
return `${r.dir} is owned by uid ${r.uid}, not by you`;
|
|
51
54
|
case 'foreign-shared-container':
|
|
52
55
|
return `${r.dir} belongs to another user (uid ${r.uid}) rather than to you or to root`;
|
|
56
|
+
case 'foreign-ancestor':
|
|
57
|
+
return `${r.dir} sits above the configured directory and belongs to another user (uid ${r.uid}) rather than to you or to root`;
|
|
53
58
|
case 'not-tightenable':
|
|
54
59
|
return `${r.dir} is reachable by other users (mode ${asMode(r.mode)}) and could not be tightened to 0700`;
|
|
60
|
+
case 'not-private':
|
|
61
|
+
return `${r.dir} is reachable by other users (mode ${asMode(r.mode)})`;
|
|
55
62
|
case 'peer-writable-not-sticky':
|
|
56
63
|
return `${r.dir} is writable by other users but not sticky (mode ${asMode(r.mode)}), so a peer could replace directories inside it`;
|
|
57
64
|
default: {
|
|
@@ -238,6 +245,147 @@ function isOwnedRealDirectory(dir) {
|
|
|
238
245
|
return null;
|
|
239
246
|
}
|
|
240
247
|
}
|
|
248
|
+
/**
|
|
249
|
+
* The verdict of `ensureOwnedPrivateDir` with nothing created and nothing
|
|
250
|
+
* re-locked, for callers about to trust what is already inside. Tightening a
|
|
251
|
+
* directory that was open a moment ago says nothing about who filled it.
|
|
252
|
+
*/
|
|
253
|
+
function isOwnedPrivateDir(dir) {
|
|
254
|
+
try {
|
|
255
|
+
const stats = (0, node_fs_1.lstatSync)(dir);
|
|
256
|
+
if (!stats.isDirectory()) {
|
|
257
|
+
return deny(notADirectory(dir, stats));
|
|
258
|
+
}
|
|
259
|
+
if (typeof process.getuid !== 'function') {
|
|
260
|
+
return allow(dir);
|
|
261
|
+
}
|
|
262
|
+
if (stats.uid !== process.getuid()) {
|
|
263
|
+
return deny({ kind: 'foreign-owner', dir, uid: stats.uid });
|
|
264
|
+
}
|
|
265
|
+
return stats.mode & 0o077
|
|
266
|
+
? deny({ kind: 'not-private', dir, mode: stats.mode })
|
|
267
|
+
: allow(dir);
|
|
268
|
+
}
|
|
269
|
+
catch (e) {
|
|
270
|
+
return deny({ kind: 'not-inspectable', dir, code: e?.code });
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
/** The kernel's own limit on links followed in one lookup. */
|
|
274
|
+
const MAX_LINKS = 40;
|
|
275
|
+
/**
|
|
276
|
+
* Whether a level above a configured directory is safe to look the next name up
|
|
277
|
+
* in. Owned by us or root, and not writable by other users unless sticky. Group
|
|
278
|
+
* write on a level of ours is the user's own grant and is accepted.
|
|
279
|
+
*/
|
|
280
|
+
function isSafeAncestor(dir, stats) {
|
|
281
|
+
const ours = stats.uid === process.getuid();
|
|
282
|
+
if (!ours && stats.uid !== 0) {
|
|
283
|
+
return { kind: 'foreign-ancestor', dir, uid: stats.uid };
|
|
284
|
+
}
|
|
285
|
+
const peerWrite = ours ? 0o002 : 0o022;
|
|
286
|
+
return !(stats.mode & peerWrite) || stats.mode & S_ISVTX
|
|
287
|
+
? null
|
|
288
|
+
: { kind: 'peer-writable-not-sticky', dir, mode: stats.mode };
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Walked one name at a time from the filesystem root rather than canonicalized:
|
|
292
|
+
* each name is looked up only in a level already judged, and a link is followed
|
|
293
|
+
* only when it is ours or root's.
|
|
294
|
+
*/
|
|
295
|
+
function walkAncestry(dir, create) {
|
|
296
|
+
if (typeof process.getuid !== 'function') {
|
|
297
|
+
if (create) {
|
|
298
|
+
try {
|
|
299
|
+
(0, node_fs_1.mkdirSync)(dir, { recursive: true });
|
|
300
|
+
}
|
|
301
|
+
catch (e) {
|
|
302
|
+
return { kind: 'not-created', dir, code: e?.code };
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
return null;
|
|
306
|
+
}
|
|
307
|
+
let judged = node_path_1.sep;
|
|
308
|
+
try {
|
|
309
|
+
const refusal = isSafeAncestor(judged, (0, node_fs_1.lstatSync)(judged));
|
|
310
|
+
if (refusal) {
|
|
311
|
+
return refusal;
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
catch (e) {
|
|
315
|
+
return { kind: 'not-inspectable', dir: judged, code: e?.code };
|
|
316
|
+
}
|
|
317
|
+
const pending = (0, node_path_1.resolve)(dir).split(node_path_1.sep).filter(Boolean);
|
|
318
|
+
let links = 0;
|
|
319
|
+
while (pending.length) {
|
|
320
|
+
const name = pending.shift();
|
|
321
|
+
if (name === '.') {
|
|
322
|
+
continue;
|
|
323
|
+
}
|
|
324
|
+
if (name === '..') {
|
|
325
|
+
judged = (0, node_path_1.dirname)(judged);
|
|
326
|
+
continue;
|
|
327
|
+
}
|
|
328
|
+
const next = (0, node_path_1.join)(judged, name);
|
|
329
|
+
if (create) {
|
|
330
|
+
try {
|
|
331
|
+
// An explicit mode, so a level made under umask `000` is not
|
|
332
|
+
// world-writable and refused by the check below.
|
|
333
|
+
(0, node_fs_1.mkdirSync)(next, { mode: 0o755 });
|
|
334
|
+
}
|
|
335
|
+
catch (e) {
|
|
336
|
+
if (e?.code !== 'EEXIST') {
|
|
337
|
+
return { kind: 'not-created', dir: next, code: e?.code };
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
let stats;
|
|
342
|
+
try {
|
|
343
|
+
stats = (0, node_fs_1.lstatSync)(next);
|
|
344
|
+
}
|
|
345
|
+
catch (e) {
|
|
346
|
+
return { kind: 'not-inspectable', dir: next, code: e?.code };
|
|
347
|
+
}
|
|
348
|
+
if (stats.isDirectory()) {
|
|
349
|
+
const refusal = isSafeAncestor(next, stats);
|
|
350
|
+
if (refusal) {
|
|
351
|
+
return refusal;
|
|
352
|
+
}
|
|
353
|
+
judged = next;
|
|
354
|
+
continue;
|
|
355
|
+
}
|
|
356
|
+
if (!stats.isSymbolicLink() ||
|
|
357
|
+
(stats.uid !== process.getuid() && stats.uid !== 0) ||
|
|
358
|
+
++links > MAX_LINKS) {
|
|
359
|
+
return notADirectory(next, stats);
|
|
360
|
+
}
|
|
361
|
+
let target;
|
|
362
|
+
try {
|
|
363
|
+
target = (0, node_fs_1.readlinkSync)(next);
|
|
364
|
+
}
|
|
365
|
+
catch (e) {
|
|
366
|
+
return { kind: 'not-inspectable', dir: next, code: e?.code };
|
|
367
|
+
}
|
|
368
|
+
if ((0, node_path_1.isAbsolute)(target)) {
|
|
369
|
+
judged = node_path_1.sep;
|
|
370
|
+
}
|
|
371
|
+
pending.unshift(...target.split(node_path_1.sep).filter(Boolean));
|
|
372
|
+
}
|
|
373
|
+
return null;
|
|
374
|
+
}
|
|
375
|
+
/**
|
|
376
|
+
* Create `dir` and any missing level above it, judging every level from the
|
|
377
|
+
* filesystem root down. For a location the user configured, where any level
|
|
378
|
+
* may have been created first by someone else.
|
|
379
|
+
*/
|
|
380
|
+
function ensureSafeAncestry(dir) {
|
|
381
|
+
const refusal = walkAncestry(dir, true);
|
|
382
|
+
return refusal ? deny(refusal) : allow(dir);
|
|
383
|
+
}
|
|
384
|
+
/** `ensureSafeAncestry` without creating anything, for the delete path. */
|
|
385
|
+
function isSafeAncestry(dir) {
|
|
386
|
+
const refusal = walkAncestry(dir, false);
|
|
387
|
+
return refusal ? deny(refusal) : allow(dir);
|
|
388
|
+
}
|
|
241
389
|
/** The path segment separating one user's Nx runtime state from another's. */
|
|
242
390
|
function getUserSegment() {
|
|
243
391
|
try {
|