nx 22.7.7 → 22.7.9

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.
Files changed (52) hide show
  1. package/dist/src/ai/set-up-ai-agents/set-up-ai-agents.js +2 -1
  2. package/dist/src/command-line/configure-ai-agents/configure-ai-agents.js +1 -1
  3. package/dist/src/command-line/init/init-v2.js +1 -1
  4. package/dist/src/command-line/migrate/migrate-ui-api.js +17 -12
  5. package/dist/src/command-line/reset/reset.js +6 -1
  6. package/dist/src/daemon/client/client.d.ts +45 -3
  7. package/dist/src/daemon/client/client.js +138 -42
  8. package/dist/src/daemon/client/daemon-socket-messenger.js +4 -0
  9. package/dist/src/daemon/message-types/daemon-message.d.ts +33 -0
  10. package/dist/src/daemon/message-types/daemon-message.js +48 -0
  11. package/dist/src/daemon/server/latest-nx.js +3 -1
  12. package/dist/src/daemon/server/server.js +22 -0
  13. package/dist/src/daemon/server/shutdown-utils.d.ts +5 -0
  14. package/dist/src/daemon/server/shutdown-utils.js +11 -4
  15. package/dist/src/daemon/socket-utils.d.ts +1 -0
  16. package/dist/src/daemon/socket-utils.js +24 -3
  17. package/dist/src/daemon/tmp-dir.d.ts +43 -3
  18. package/dist/src/daemon/tmp-dir.js +437 -15
  19. package/dist/src/devkit-internals.d.ts +1 -0
  20. package/dist/src/devkit-internals.js +4 -1
  21. package/dist/src/native/index.js +71 -28
  22. package/dist/src/native/native-file-cache-location.d.ts +17 -1
  23. package/dist/src/native/native-file-cache-location.js +86 -12
  24. package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
  25. package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
  26. package/dist/src/project-graph/file-utils.js +5 -1
  27. package/dist/src/project-graph/plugins/isolation/isolated-plugin.d.ts +1 -0
  28. package/dist/src/project-graph/plugins/isolation/isolated-plugin.js +18 -1
  29. package/dist/src/project-graph/plugins/isolation/messaging.d.ts +16 -3
  30. package/dist/src/project-graph/plugins/isolation/messaging.js +3 -0
  31. package/dist/src/project-graph/plugins/isolation/plugin-worker.js +58 -8
  32. package/dist/src/project-graph/project-graph.js +20 -0
  33. package/dist/src/utils/command-line-utils.js +30 -20
  34. package/dist/src/utils/git-revision.d.ts +12 -0
  35. package/dist/src/utils/git-revision.js +25 -0
  36. package/dist/src/utils/git-utils.d.ts +1 -3
  37. package/dist/src/utils/git-utils.js +83 -47
  38. package/dist/src/utils/nx-tmp-dir.d.ts +18 -0
  39. package/dist/src/utils/nx-tmp-dir.js +40 -0
  40. package/dist/src/utils/owned-private-dir.d.ts +132 -0
  41. package/dist/src/utils/owned-private-dir.js +323 -0
  42. package/dist/src/utils/package-json.d.ts +3 -3
  43. package/dist/src/utils/package-json.js +30 -12
  44. package/dist/src/utils/package-manager.d.ts +13 -0
  45. package/dist/src/utils/package-manager.js +27 -0
  46. package/dist/src/utils/safe-spawn.d.ts +24 -0
  47. package/dist/src/utils/safe-spawn.js +104 -0
  48. package/dist/src/utils/shell-quoting.d.ts +15 -0
  49. package/dist/src/utils/shell-quoting.js +35 -0
  50. package/dist/src/utils/wait-for-socket-connection.d.ts +11 -0
  51. package/dist/src/utils/wait-for-socket-connection.js +14 -8
  52. package/package.json +17 -13
@@ -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 socket = await tryConnect(path);
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(null);
52
+ resolve({ error });
47
53
  });
48
54
  }
49
- catch {
50
- resolve(null);
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.7",
3
+ "version": "22.7.9",
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.",
@@ -55,16 +55,17 @@
55
55
  "@tybys/wasm-util": "0.9.0",
56
56
  "@yarnpkg/lockfile": "1.1.0",
57
57
  "@zkochan/js-yaml": "0.0.7",
58
+ "agent-base": "6.0.2",
58
59
  "ansi-colors": "4.1.3",
59
60
  "ansi-regex": "5.0.1",
60
61
  "ansi-styles": "4.3.0",
61
62
  "argparse": "2.0.1",
62
63
  "asynckit": "0.4.0",
63
- "axios": "1.16.0",
64
+ "axios": "1.18.1",
64
65
  "balanced-match": "4.0.3",
65
66
  "base64-js": "1.5.1",
66
67
  "bl": "4.1.0",
67
- "brace-expansion": "5.0.6",
68
+ "brace-expansion": "5.0.8",
68
69
  "buffer": "5.7.1",
69
70
  "call-bind-apply-helpers": "1.0.2",
70
71
  "chalk": "4.1.2",
@@ -75,6 +76,7 @@
75
76
  "color-convert": "2.0.1",
76
77
  "color-name": "1.1.4",
77
78
  "combined-stream": "1.0.8",
79
+ "debug": "4.4.3",
78
80
  "defaults": "1.0.4",
79
81
  "define-lazy-prop": "2.0.0",
80
82
  "delayed-stream": "1.0.0",
@@ -105,6 +107,7 @@
105
107
  "has-symbols": "1.1.0",
106
108
  "has-tostringtag": "1.0.2",
107
109
  "hasown": "2.0.4",
110
+ "https-proxy-agent": "5.0.1",
108
111
  "ieee754": "1.2.1",
109
112
  "ignore": "7.0.5",
110
113
  "inherits": "2.0.4",
@@ -123,6 +126,7 @@
123
126
  "mimic-fn": "2.1.0",
124
127
  "minimatch": "10.2.5",
125
128
  "minimist": "1.2.8",
129
+ "ms": "2.1.3",
126
130
  "npm-run-path": "4.0.1",
127
131
  "once": "1.4.0",
128
132
  "onetime": "5.1.2",
@@ -171,16 +175,16 @@
171
175
  }
172
176
  },
173
177
  "optionalDependencies": {
174
- "@nx/nx-darwin-arm64": "22.7.7",
175
- "@nx/nx-darwin-x64": "22.7.7",
176
- "@nx/nx-freebsd-x64": "22.7.7",
177
- "@nx/nx-linux-arm-gnueabihf": "22.7.7",
178
- "@nx/nx-linux-arm64-gnu": "22.7.7",
179
- "@nx/nx-linux-arm64-musl": "22.7.7",
180
- "@nx/nx-linux-x64-gnu": "22.7.7",
181
- "@nx/nx-linux-x64-musl": "22.7.7",
182
- "@nx/nx-win32-arm64-msvc": "22.7.7",
183
- "@nx/nx-win32-x64-msvc": "22.7.7"
178
+ "@nx/nx-darwin-arm64": "22.7.9",
179
+ "@nx/nx-darwin-x64": "22.7.9",
180
+ "@nx/nx-freebsd-x64": "22.7.9",
181
+ "@nx/nx-linux-arm-gnueabihf": "22.7.9",
182
+ "@nx/nx-linux-arm64-gnu": "22.7.9",
183
+ "@nx/nx-linux-arm64-musl": "22.7.9",
184
+ "@nx/nx-linux-x64-gnu": "22.7.9",
185
+ "@nx/nx-linux-x64-musl": "22.7.9",
186
+ "@nx/nx-win32-arm64-msvc": "22.7.9",
187
+ "@nx/nx-win32-x64-msvc": "22.7.9"
184
188
  },
185
189
  "nx-migrations": {
186
190
  "migrations": "./migrations.json",