nx 22.7.1 → 22.7.2
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.d.ts +1 -0
- package/dist/bin/nx.js +3 -0
- package/dist/src/ai/clone-ai-config-repo.js +20 -3
- package/dist/src/analytics/analytics.js +10 -1
- package/dist/src/command-line/graph/graph.js +0 -1
- package/dist/src/command-line/release/config/use-legacy-versioning.d.ts +2 -0
- package/dist/src/command-line/release/config/use-legacy-versioning.js +8 -0
- package/dist/src/config/misc-interfaces.d.ts +6 -0
- package/dist/src/core/graph/main.js +1 -1
- package/dist/src/core/graph/styles.css +1 -1
- package/dist/src/daemon/server/latest-nx.js +2 -0
- package/dist/src/daemon/server/start.d.ts +1 -1
- package/dist/src/daemon/server/start.js +2 -0
- package/dist/src/native/nx.wasm32-wasi.debug.wasm +0 -0
- package/dist/src/native/nx.wasm32-wasi.wasm +0 -0
- package/dist/src/plugins/js/lock-file/npm-parser.js +37 -19
- package/dist/src/plugins/js/lock-file/pnpm-parser.js +51 -4
- package/dist/src/plugins/js/lock-file/project-graph-pruning.js +12 -4
- package/dist/src/project-graph/plugins/isolation/plugin-worker.d.ts +1 -0
- package/dist/src/project-graph/plugins/isolation/plugin-worker.js +2 -0
- package/dist/src/tasks-runner/life-cycles/task-history-life-cycle-old.js +13 -2
- package/dist/src/tasks-runner/life-cycles/task-history-life-cycle.js +16 -5
- package/dist/src/tasks-runner/life-cycles/tui-summary-life-cycle.js +11 -2
- package/dist/src/tasks-runner/run-command.js +8 -1
- package/dist/src/tasks-runner/task-orchestrator.js +20 -4
- package/dist/src/utils/ab-testing.js +12 -0
- package/dist/src/utils/compile-cache.d.ts +24 -0
- package/dist/src/utils/compile-cache.js +49 -0
- package/dist/src/utils/enable-compile-cache.d.ts +1 -0
- package/dist/src/utils/enable-compile-cache.js +7 -0
- package/dist/src/utils/has-nx-js-plugin.d.ts +9 -0
- package/dist/src/utils/has-nx-js-plugin.js +24 -0
- package/dist/src/utils/logger.d.ts +12 -1
- package/dist/src/utils/logger.js +57 -36
- package/dist/src/utils/nx-key.d.ts +0 -1
- package/dist/src/utils/nx-key.js +20 -23
- package/dist/src/utils/output.d.ts +3 -2
- package/dist/src/utils/output.js +29 -28
- package/dist/src/utils/package-json.js +2 -13
- package/dist/src/utils/perf-logging.js +3 -1
- package/package.json +22 -15
package/dist/bin/nx.d.ts
CHANGED
package/dist/bin/nx.js
CHANGED
|
@@ -8,6 +8,8 @@ if (process.env.FORCE_COLOR === '0') {
|
|
|
8
8
|
process.env.NO_COLOR = '1';
|
|
9
9
|
delete process.env.FORCE_COLOR;
|
|
10
10
|
}
|
|
11
|
+
// Must be the first import — see enable-compile-cache.ts.
|
|
12
|
+
require("../src/utils/enable-compile-cache");
|
|
11
13
|
const find_workspace_root_1 = require("../src/utils/find-workspace-root");
|
|
12
14
|
const pc = tslib_1.__importStar(require("picocolors"));
|
|
13
15
|
const output_1 = require("../src/utils/output");
|
|
@@ -52,6 +54,7 @@ async function main() {
|
|
|
52
54
|
process.argv[2] === '_migrate' ||
|
|
53
55
|
process.argv[2] === 'init' ||
|
|
54
56
|
process.argv[2] === 'configure-ai-agents' ||
|
|
57
|
+
process.argv[2] === 'mcp' ||
|
|
55
58
|
(process.argv[2] === 'graph' && !workspace)) {
|
|
56
59
|
process.env.NX_DAEMON = 'false';
|
|
57
60
|
(await import('nx/src/command-line/nx-commands')).commandsObject.argv;
|
|
@@ -125,14 +125,31 @@ function cleanupOldCaches(currentCommitHash) {
|
|
|
125
125
|
function getAiConfigRepoPath() {
|
|
126
126
|
// 1. Get latest commit hash (first 10 chars)
|
|
127
127
|
const commitHash = getLatestCommitHash();
|
|
128
|
-
// 2.
|
|
128
|
+
// 2. Reuse cached version if it still has content (macOS may have
|
|
129
|
+
// swept its files but left the directory tree).
|
|
129
130
|
const cachedPath = (0, path_1.join)(CACHE_DIR, commitHash);
|
|
130
|
-
if ((
|
|
131
|
+
if (hasRootFile(cachedPath)) {
|
|
131
132
|
return cachedPath;
|
|
132
133
|
}
|
|
133
|
-
// 3.
|
|
134
|
+
// 3. Wipe any empty skeleton, then clone fresh
|
|
135
|
+
if ((0, fs_1.existsSync)(cachedPath)) {
|
|
136
|
+
(0, fs_1.rmSync)(cachedPath, { recursive: true, force: true });
|
|
137
|
+
}
|
|
134
138
|
cloneRepo(cachedPath);
|
|
135
139
|
// 4. Clean up old cached versions
|
|
136
140
|
cleanupOldCaches(commitHash);
|
|
137
141
|
return cachedPath;
|
|
138
142
|
}
|
|
143
|
+
/**
|
|
144
|
+
* The repo always has at least one regular file at its root (e.g. README).
|
|
145
|
+
* If everything at the root is a directory, the cache was swept by macOS
|
|
146
|
+
* tmp cleanup and we should re-clone.
|
|
147
|
+
*/
|
|
148
|
+
function hasRootFile(dir) {
|
|
149
|
+
try {
|
|
150
|
+
return (0, fs_1.readdirSync)(dir, { withFileTypes: true }).some((e) => e.isFile());
|
|
151
|
+
}
|
|
152
|
+
catch {
|
|
153
|
+
return false;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
@@ -16,6 +16,7 @@ const native_1 = require("../native");
|
|
|
16
16
|
const package_manager_1 = require("../utils/package-manager");
|
|
17
17
|
const semver_1 = require("semver");
|
|
18
18
|
const os = tslib_1.__importStar(require("os"));
|
|
19
|
+
const crypto_1 = require("crypto");
|
|
19
20
|
const machine_id_cache_1 = require("../utils/machine-id-cache");
|
|
20
21
|
const is_ci_1 = require("../utils/is-ci");
|
|
21
22
|
const analytics_prompt_1 = require("../utils/analytics-prompt");
|
|
@@ -56,7 +57,7 @@ async function startAnalytics() {
|
|
|
56
57
|
return;
|
|
57
58
|
}
|
|
58
59
|
const isNxCloud = !!(nxJson?.nxCloudId ?? nxJson?.nxCloudAccessToken);
|
|
59
|
-
const userId = await (
|
|
60
|
+
const userId = await getTelemetryUserId(workspaceId);
|
|
60
61
|
const packageManagerInfo = getPackageManagerInfo();
|
|
61
62
|
const nodeVersion = (0, semver_1.parse)(process.version);
|
|
62
63
|
const nodeVersionString = nodeVersion
|
|
@@ -225,3 +226,11 @@ function isAnalyticsEnabled() {
|
|
|
225
226
|
const nxJson = (0, nx_json_1.readNxJson)(workspace_root_1.workspaceRoot);
|
|
226
227
|
return nxJson?.analytics === true;
|
|
227
228
|
}
|
|
229
|
+
// Mix workspace id in: shared Docker images (Gitpod, Cypress, etc.) bake
|
|
230
|
+
// in /etc/machine-id, so machine-id alone collapses many users into one.
|
|
231
|
+
async function getTelemetryUserId(workspaceId) {
|
|
232
|
+
const machineId = await (0, machine_id_cache_1.getCurrentMachineId)();
|
|
233
|
+
return (0, crypto_1.createHash)('sha256')
|
|
234
|
+
.update(`${machineId}|${workspaceId}`)
|
|
235
|
+
.digest('hex');
|
|
236
|
+
}
|
|
@@ -402,7 +402,6 @@ async function startServer(html, environmentJs, host, port = 4211, watchForChang
|
|
|
402
402
|
// Avoid https://en.wikipedia.org/wiki/Directory_traversal_attack
|
|
403
403
|
// e.g curl --path-as-is http://localhost:9000/../fileInDanger.txt
|
|
404
404
|
// by limiting the path to current directory only
|
|
405
|
-
res.setHeader('Access-Control-Allow-Origin', '*');
|
|
406
405
|
const sanitizePath = (0, node_path_1.basename)(parsedUrl.pathname);
|
|
407
406
|
if (sanitizePath === 'project-graph.json') {
|
|
408
407
|
const requestFull = parsedUrl.searchParams.get('full') === 'true';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.shouldUseLegacyVersioning = shouldUseLegacyVersioning;
|
|
4
|
+
// TODO(v23): remove — kept only so `@nx/js@21`'s library generator can load via `ensurePackage`.
|
|
5
|
+
/** @deprecated Compat shim for `@nx/js@21`. */
|
|
6
|
+
function shouldUseLegacyVersioning(releaseConfig) {
|
|
7
|
+
return releaseConfig?.version?.useLegacyVersioning ?? false;
|
|
8
|
+
}
|
|
@@ -148,6 +148,12 @@ export type TaskResult = {
|
|
|
148
148
|
terminalOutput: string;
|
|
149
149
|
startTime?: number;
|
|
150
150
|
endTime?: number;
|
|
151
|
+
/**
|
|
152
|
+
* Explicit status. When set, takes precedence over `success`. Required for
|
|
153
|
+
* batch executors that need to distinguish `'skipped'` peers (tasks that
|
|
154
|
+
* never ran because a sibling failed) from real failures.
|
|
155
|
+
*/
|
|
156
|
+
status?: 'success' | 'failure' | 'skipped';
|
|
151
157
|
};
|
|
152
158
|
export type BatchExecutorResult = Record<string, TaskResult>;
|
|
153
159
|
export type BatchExecutorTaskResult = {
|