nx 22.7.8 → 22.7.10
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/src/command-line/reset/reset.js +6 -1
- package/dist/src/daemon/client/client.d.ts +45 -3
- package/dist/src/daemon/client/client.js +138 -42
- package/dist/src/daemon/client/daemon-socket-messenger.js +4 -0
- package/dist/src/daemon/message-types/daemon-message.d.ts +33 -0
- package/dist/src/daemon/message-types/daemon-message.js +48 -0
- package/dist/src/daemon/server/server.js +22 -0
- package/dist/src/daemon/server/shutdown-utils.d.ts +5 -0
- package/dist/src/daemon/server/shutdown-utils.js +11 -4
- package/dist/src/daemon/socket-utils.d.ts +1 -0
- package/dist/src/daemon/socket-utils.js +24 -3
- package/dist/src/daemon/tmp-dir.d.ts +43 -3
- package/dist/src/daemon/tmp-dir.js +437 -15
- package/dist/src/devkit-internals.d.ts +1 -0
- package/dist/src/devkit-internals.js +4 -1
- package/dist/src/native/index.js +71 -28
- package/dist/src/native/native-file-cache-location.d.ts +17 -1
- package/dist/src/native/native-file-cache-location.js +86 -12
- package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
- package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
- package/dist/src/project-graph/plugins/isolation/isolated-plugin.d.ts +1 -0
- package/dist/src/project-graph/plugins/isolation/isolated-plugin.js +18 -1
- package/dist/src/project-graph/plugins/isolation/messaging.d.ts +16 -3
- package/dist/src/project-graph/plugins/isolation/messaging.js +3 -0
- package/dist/src/project-graph/plugins/isolation/plugin-worker.js +58 -8
- package/dist/src/project-graph/project-graph.js +20 -0
- package/dist/src/utils/nx-tmp-dir.d.ts +18 -0
- package/dist/src/utils/nx-tmp-dir.js +40 -0
- package/dist/src/utils/owned-private-dir.d.ts +132 -0
- package/dist/src/utils/owned-private-dir.js +323 -0
- package/dist/src/utils/package-json.js +13 -2
- package/dist/src/utils/path.d.ts +6 -0
- package/dist/src/utils/path.js +15 -0
- package/dist/src/utils/safe-spawn.d.ts +24 -0
- package/dist/src/utils/safe-spawn.js +104 -0
- package/dist/src/utils/shell-quoting.d.ts +15 -0
- package/dist/src/utils/shell-quoting.js +35 -0
- package/dist/src/utils/wait-for-socket-connection.d.ts +11 -0
- package/dist/src/utils/wait-for-socket-connection.js +14 -8
- package/package.json +11 -11
|
@@ -8,3 +8,18 @@ export declare function needsShellQuoting(str: string): boolean;
|
|
|
8
8
|
* Check if a string is already wrapped in matching quotes (single or double).
|
|
9
9
|
*/
|
|
10
10
|
export declare function isAlreadyQuoted(str: string): boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Quote a string so it survives being interpolated into a shell command line
|
|
13
|
+
* as a single argument.
|
|
14
|
+
*
|
|
15
|
+
* On Windows the safety boundary is one unbroken double-quoted run: it keeps
|
|
16
|
+
* `^`, `&`, `|`, `<` and `>` literal through cmd.exe's parse and a `.cmd`
|
|
17
|
+
* shim's re-parse of `%*`, but not `%`, which cmd.exe expands inside double
|
|
18
|
+
* quotes too.
|
|
19
|
+
*
|
|
20
|
+
* @throws on Windows when the argument contains a double quote, which ends that
|
|
21
|
+
* run, since cmd.exe recognizes no backslash escape. Carrying one means
|
|
22
|
+
* caret-escaping every metacharacter instead, doubled for a `.cmd` shim, which
|
|
23
|
+
* this path does not implement.
|
|
24
|
+
*/
|
|
25
|
+
export declare function quoteShellArg(arg: string): string;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.needsShellQuoting = needsShellQuoting;
|
|
4
4
|
exports.isAlreadyQuoted = isAlreadyQuoted;
|
|
5
|
+
exports.quoteShellArg = quoteShellArg;
|
|
5
6
|
/**
|
|
6
7
|
* Shell metacharacters that have special meaning and require quoting.
|
|
7
8
|
*
|
|
@@ -39,3 +40,37 @@ function isAlreadyQuoted(str) {
|
|
|
39
40
|
((str[0] === "'" && str[str.length - 1] === "'") ||
|
|
40
41
|
(str[0] === '"' && str[str.length - 1] === '"')));
|
|
41
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* Quote a string so it survives being interpolated into a shell command line
|
|
45
|
+
* as a single argument.
|
|
46
|
+
*
|
|
47
|
+
* On Windows the safety boundary is one unbroken double-quoted run: it keeps
|
|
48
|
+
* `^`, `&`, `|`, `<` and `>` literal through cmd.exe's parse and a `.cmd`
|
|
49
|
+
* shim's re-parse of `%*`, but not `%`, which cmd.exe expands inside double
|
|
50
|
+
* quotes too.
|
|
51
|
+
*
|
|
52
|
+
* @throws on Windows when the argument contains a double quote, which ends that
|
|
53
|
+
* run, since cmd.exe recognizes no backslash escape. Carrying one means
|
|
54
|
+
* caret-escaping every metacharacter instead, doubled for a `.cmd` shim, which
|
|
55
|
+
* this path does not implement.
|
|
56
|
+
*/
|
|
57
|
+
function quoteShellArg(arg) {
|
|
58
|
+
const isWindows = process.platform === 'win32';
|
|
59
|
+
if (isWindows && arg.includes('"')) {
|
|
60
|
+
throw new Error(`Cannot safely pass ${arg} to cmd.exe as a single argument: a double quote inside it would end the quoting and leave the rest of the argument to be read as commands. Remove the double quote and run the command again.`);
|
|
61
|
+
}
|
|
62
|
+
if (arg === '') {
|
|
63
|
+
// an unquoted empty string would vanish when joined into a command line
|
|
64
|
+
return isWindows ? '""' : "''";
|
|
65
|
+
}
|
|
66
|
+
// `^` is cmd.exe syntax rather than shell syntax, so it earns quoting only
|
|
67
|
+
// where cmd.exe parses the command line.
|
|
68
|
+
if (!needsShellQuoting(arg) && !(isWindows && arg.includes('^'))) {
|
|
69
|
+
return arg;
|
|
70
|
+
}
|
|
71
|
+
return isWindows
|
|
72
|
+
? // MSVCRT reads the backslashes that precede the closing quote as escapes,
|
|
73
|
+
// so they have to be doubled to survive as themselves.
|
|
74
|
+
`"${arg.replace(/(\\+)$/, '$1$1')}"`
|
|
75
|
+
: `'${arg.replace(/'/g, `'\\''`)}'`;
|
|
76
|
+
}
|
|
@@ -12,4 +12,15 @@ export declare function waitForSocketConnection(socketPath: string | (() => stri
|
|
|
12
12
|
signal?: AbortSignal;
|
|
13
13
|
maxAttempts?: number;
|
|
14
14
|
delayMs?: number;
|
|
15
|
+
/**
|
|
16
|
+
* Called with the errno of each failed connect and the path it was made
|
|
17
|
+
* against. Return `true` to stop polling: a permission refusal does not
|
|
18
|
+
* heal by retrying, and without a way out the caller waits the full budget
|
|
19
|
+
* and then cannot say why.
|
|
20
|
+
*
|
|
21
|
+
* The path is passed rather than left to the caller to recompute — with a
|
|
22
|
+
* resolver it can differ per attempt, and the caller that reports the
|
|
23
|
+
* refusal may no longer be able to resolve one at all.
|
|
24
|
+
*/
|
|
25
|
+
onConnectError?: (error: NodeJS.ErrnoException, socketPath: string) => boolean | void;
|
|
15
26
|
}): Promise<Socket | null>;
|
|
@@ -26,9 +26,15 @@ async function waitForSocketConnection(socketPath, options) {
|
|
|
26
26
|
return null;
|
|
27
27
|
const path = typeof socketPath === 'function' ? socketPath() : socketPath;
|
|
28
28
|
if (path) {
|
|
29
|
-
const
|
|
30
|
-
if (socket) {
|
|
31
|
-
return socket;
|
|
29
|
+
const result = await tryConnect(path);
|
|
30
|
+
if (result.socket) {
|
|
31
|
+
return result.socket;
|
|
32
|
+
}
|
|
33
|
+
// The caller may need the errno this attempt produced — a refused
|
|
34
|
+
// connection is reported very differently from a socket that is not
|
|
35
|
+
// there yet, and polling past it only delays the same answer.
|
|
36
|
+
if (result.error && options?.onConnectError?.(result.error, path)) {
|
|
37
|
+
return null;
|
|
32
38
|
}
|
|
33
39
|
}
|
|
34
40
|
attempts++;
|
|
@@ -39,15 +45,15 @@ function tryConnect(socketPath) {
|
|
|
39
45
|
return new Promise((resolve) => {
|
|
40
46
|
try {
|
|
41
47
|
const socket = (0, net_1.connect)(socketPath, () => {
|
|
42
|
-
resolve(socket);
|
|
48
|
+
resolve({ socket });
|
|
43
49
|
});
|
|
44
|
-
socket.once('error', () => {
|
|
50
|
+
socket.once('error', (error) => {
|
|
45
51
|
socket.destroy();
|
|
46
|
-
resolve(
|
|
52
|
+
resolve({ error });
|
|
47
53
|
});
|
|
48
54
|
}
|
|
49
|
-
catch {
|
|
50
|
-
resolve(
|
|
55
|
+
catch (error) {
|
|
56
|
+
resolve({ error: error });
|
|
51
57
|
}
|
|
52
58
|
});
|
|
53
59
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "nx",
|
|
3
|
-
"version": "22.7.
|
|
3
|
+
"version": "22.7.10",
|
|
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.",
|
|
@@ -175,16 +175,16 @@
|
|
|
175
175
|
}
|
|
176
176
|
},
|
|
177
177
|
"optionalDependencies": {
|
|
178
|
-
"@nx/nx-darwin-arm64": "22.7.
|
|
179
|
-
"@nx/nx-darwin-x64": "22.7.
|
|
180
|
-
"@nx/nx-freebsd-x64": "22.7.
|
|
181
|
-
"@nx/nx-linux-arm-gnueabihf": "22.7.
|
|
182
|
-
"@nx/nx-linux-arm64-gnu": "22.7.
|
|
183
|
-
"@nx/nx-linux-arm64-musl": "22.7.
|
|
184
|
-
"@nx/nx-linux-x64-gnu": "22.7.
|
|
185
|
-
"@nx/nx-linux-x64-musl": "22.7.
|
|
186
|
-
"@nx/nx-win32-arm64-msvc": "22.7.
|
|
187
|
-
"@nx/nx-win32-x64-msvc": "22.7.
|
|
178
|
+
"@nx/nx-darwin-arm64": "22.7.10",
|
|
179
|
+
"@nx/nx-darwin-x64": "22.7.10",
|
|
180
|
+
"@nx/nx-freebsd-x64": "22.7.10",
|
|
181
|
+
"@nx/nx-linux-arm-gnueabihf": "22.7.10",
|
|
182
|
+
"@nx/nx-linux-arm64-gnu": "22.7.10",
|
|
183
|
+
"@nx/nx-linux-arm64-musl": "22.7.10",
|
|
184
|
+
"@nx/nx-linux-x64-gnu": "22.7.10",
|
|
185
|
+
"@nx/nx-linux-x64-musl": "22.7.10",
|
|
186
|
+
"@nx/nx-win32-arm64-msvc": "22.7.10",
|
|
187
|
+
"@nx/nx-win32-x64-msvc": "22.7.10"
|
|
188
188
|
},
|
|
189
189
|
"nx-migrations": {
|
|
190
190
|
"migrations": "./migrations.json",
|