nx 23.2.0-beta.2 → 23.2.0-beta.4
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 +1 -0
- package/dist/src/analytics/analytics.js +9 -7
- package/dist/src/command-line/graph/graph.d.ts +1 -0
- package/dist/src/command-line/graph/graph.js +15 -6
- package/dist/src/command-line/migrate/migrate.js +16 -1
- package/dist/src/command-line/nx-cloud/connect/connect-to-nx-cloud.js +1 -1
- package/dist/src/command-line/release/utils/remote-release-clients/github.js +1 -1
- package/dist/src/command-line/release/utils/remote-release-clients/gitlab.js +1 -1
- package/dist/src/config/nx-json.d.ts +4 -2
- package/dist/src/core/graph/main.js +1 -1
- package/dist/src/native/index.d.ts +2 -2
- 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/pnpm-parser.js +4 -2
- package/dist/src/plugins/js/project-graph/build-dependencies/target-project-locator.js +12 -4
- package/dist/src/project-graph/utils/project-configuration/name-substitution-manager.d.ts +1 -0
- package/dist/src/project-graph/utils/project-configuration/name-substitution-manager.js +16 -2
- package/dist/src/project-graph/utils/project-configuration/project-nodes-manager.d.ts +5 -8
- package/dist/src/project-graph/utils/project-configuration/project-nodes-manager.js +11 -14
- package/dist/src/project-graph/utils/project-configuration/source-maps.d.ts +12 -5
- package/dist/src/project-graph/utils/project-configuration/source-maps.js +21 -7
- package/dist/src/project-graph/utils/project-configuration/target-defaults.d.ts +1 -1
- package/dist/src/project-graph/utils/project-configuration/target-defaults.js +26 -27
- package/dist/src/project-graph/utils/project-configuration/target-merging.js +50 -8
- package/dist/src/project-graph/utils/project-configuration/target-normalization.js +16 -3
- package/dist/src/project-graph/utils/project-configuration/utils.d.ts +15 -0
- package/dist/src/project-graph/utils/project-configuration/utils.js +42 -6
- package/dist/src/project-graph/utils/project-configuration-utils.d.ts +15 -12
- package/dist/src/project-graph/utils/project-configuration-utils.js +79 -99
- package/dist/src/tasks-runner/task-env.d.ts +9 -0
- package/dist/src/tasks-runner/task-env.js +26 -2
- package/dist/src/tasks-runner/task-orchestrator.js +2 -6
- package/dist/src/utils/analytics-prompt.d.ts +0 -6
- package/dist/src/utils/analytics-prompt.js +0 -51
- package/dist/src/utils/catalog/bun-manager-utils.d.ts +8 -0
- package/dist/src/utils/catalog/bun-manager-utils.js +174 -0
- package/dist/src/utils/catalog/bun-manager.d.ts +28 -0
- package/dist/src/utils/catalog/bun-manager.js +130 -0
- package/dist/src/utils/catalog/index.d.ts +1 -1
- package/dist/src/utils/catalog/index.js +1 -1
- package/dist/src/utils/catalog/manager-factory.js +3 -0
- package/dist/src/utils/catalog/manager-utils.d.ts +8 -1
- package/dist/src/utils/catalog/manager-utils.js +9 -4
- package/dist/src/utils/catalog/manager.d.ts +13 -1
- package/dist/src/utils/catalog/manager.js +30 -0
- package/dist/src/utils/catalog/pnpm-manager.d.ts +2 -1
- package/dist/src/utils/catalog/pnpm-manager.js +3 -0
- package/dist/src/utils/catalog/types.d.ts +4 -0
- package/dist/src/utils/catalog/yarn-manager.d.ts +6 -2
- package/dist/src/utils/catalog/yarn-manager.js +23 -32
- package/dist/src/utils/git-utils.d.ts +15 -0
- package/dist/src/utils/git-utils.js +64 -6
- package/dist/src/utils/package-json.js +11 -7
- package/dist/src/utils/package-manager.d.ts +3 -1
- package/dist/src/utils/package-manager.js +22 -2
- package/dist/src/utils/workspace-id.d.ts +20 -0
- package/dist/src/utils/workspace-id.js +54 -0
- package/package.json +22 -17
package/dist/bin/nx.js
CHANGED
|
@@ -19,7 +19,7 @@ const os = tslib_1.__importStar(require("os"));
|
|
|
19
19
|
const crypto_1 = require("crypto");
|
|
20
20
|
const machine_id_cache_1 = require("../utils/machine-id-cache");
|
|
21
21
|
const is_ci_1 = require("../utils/is-ci");
|
|
22
|
-
const
|
|
22
|
+
const workspace_id_1 = require("../utils/workspace-id");
|
|
23
23
|
const db_connection_1 = require("../utils/db-connection");
|
|
24
24
|
// Conditionally import telemetry functions only on non-WASM platforms
|
|
25
25
|
let initializeTelemetry;
|
|
@@ -58,17 +58,20 @@ async function startAnalytics() {
|
|
|
58
58
|
// detection, machine id, telemetry init) may throw past this boundary -
|
|
59
59
|
// on any failure, continue without telemetry.
|
|
60
60
|
try {
|
|
61
|
-
|
|
61
|
+
const nxJson = (0, nx_json_1.readNxJson)(workspace_root_1.workspaceRoot);
|
|
62
|
+
if (!isAnalyticsEnabled(nxJson)) {
|
|
62
63
|
return;
|
|
63
64
|
}
|
|
64
|
-
const
|
|
65
|
-
const workspaceId = (0, analytics_prompt_1.generateWorkspaceId)();
|
|
65
|
+
const workspaceId = (0, workspace_id_1.generateWorkspaceId)(workspace_root_1.workspaceRoot, nxJson);
|
|
66
66
|
if (!workspaceId) {
|
|
67
67
|
// Not a git repo — no telemetry
|
|
68
68
|
return;
|
|
69
69
|
}
|
|
70
70
|
const isNxCloud = !!(nxJson?.nxCloudId ?? nxJson?.nxCloudAccessToken);
|
|
71
|
-
|
|
71
|
+
// A CI fleet is not a user: shared images bake in /etc/machine-id, so a
|
|
72
|
+
// uid would collapse whole fleets into one GA "user" (and trip per-user
|
|
73
|
+
// collection caps). GA falls back to cid = workspace for CI traffic.
|
|
74
|
+
const userId = (0, is_ci_1.isCI)() ? undefined : await getTelemetryUserId(workspaceId);
|
|
72
75
|
const packageManagerInfo = getPackageManagerInfo();
|
|
73
76
|
const nodeVersion = (0, semver_1.parse)(process.version);
|
|
74
77
|
const nodeVersionString = nodeVersion
|
|
@@ -232,8 +235,7 @@ function getPackageManagerInfo() {
|
|
|
232
235
|
version: (0, package_manager_1.getPackageManagerVersion)(pm),
|
|
233
236
|
};
|
|
234
237
|
}
|
|
235
|
-
function isAnalyticsEnabled() {
|
|
236
|
-
const nxJson = (0, nx_json_1.readNxJson)(workspace_root_1.workspaceRoot);
|
|
238
|
+
function isAnalyticsEnabled(nxJson) {
|
|
237
239
|
return nxJson?.analytics === true;
|
|
238
240
|
}
|
|
239
241
|
// Mix workspace id in: shared Docker images (Gitpod, Cypress, etc.) bake
|
|
@@ -50,6 +50,7 @@ export declare function generateGraph(args: {
|
|
|
50
50
|
exclude?: string[];
|
|
51
51
|
affected?: boolean;
|
|
52
52
|
}, affectedProjects: string[]): Promise<void>;
|
|
53
|
+
export declare function getExpandedTaskInputs(depGraphClientResponse: ProjectGraphClientResponse, expandedTaskInputsCache: Map<string, Record<string, string[]>>, taskId: string): Promise<Record<string, string[]>>;
|
|
53
54
|
/**
|
|
54
55
|
* The data type that `nx graph --file graph.json` or `nx build --graph graph.json` contains
|
|
55
56
|
*/
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.generateGraph = generateGraph;
|
|
4
|
+
exports.getExpandedTaskInputs = getExpandedTaskInputs;
|
|
4
5
|
const tslib_1 = require("tslib");
|
|
5
6
|
const crypto_1 = require("crypto");
|
|
6
7
|
const node_child_process_1 = require("node:child_process");
|
|
@@ -9,7 +10,6 @@ const daemon_socket_messenger_1 = require("../../daemon/client/daemon-socket-mes
|
|
|
9
10
|
const http = tslib_1.__importStar(require("node:http"));
|
|
10
11
|
const minimatch_1 = require("minimatch");
|
|
11
12
|
const node_url_1 = require("node:url");
|
|
12
|
-
const open_1 = tslib_1.__importDefault(require("open"));
|
|
13
13
|
const node_path_1 = require("node:path");
|
|
14
14
|
const net = tslib_1.__importStar(require("node:net"));
|
|
15
15
|
const node_perf_hooks_1 = require("node:perf_hooks");
|
|
@@ -34,6 +34,7 @@ const create_task_hasher_1 = require("../../hasher/create-task-hasher");
|
|
|
34
34
|
const task_env_1 = require("../../tasks-runner/task-env");
|
|
35
35
|
const error_types_1 = require("../../project-graph/error-types");
|
|
36
36
|
const nx_cloud_utils_1 = require("../../utils/nx-cloud-utils");
|
|
37
|
+
const split_target_1 = require("../../utils/split-target");
|
|
37
38
|
// maps file extention to MIME types
|
|
38
39
|
const mimeType = {
|
|
39
40
|
'.ico': 'image/x-icon',
|
|
@@ -349,7 +350,11 @@ async function generateGraph(args, affectedProjects) {
|
|
|
349
350
|
title: `Project graph started at ${url.toString()}`,
|
|
350
351
|
});
|
|
351
352
|
if (args.open) {
|
|
352
|
-
(
|
|
353
|
+
new Function('return import("open")')()
|
|
354
|
+
.then((m) => m.default(url.toString()))
|
|
355
|
+
.catch(() => {
|
|
356
|
+
// Ignore errors when opening browser (e.g. no browser available)
|
|
357
|
+
});
|
|
353
358
|
}
|
|
354
359
|
return new Promise((res) => {
|
|
355
360
|
app.once('close', res);
|
|
@@ -438,7 +443,7 @@ async function startServer(html, environmentJs, host, port = 4211, watchForChang
|
|
|
438
443
|
node_perf_hooks_1.performance.mark('task input generation:start');
|
|
439
444
|
const taskId = parsedUrl.searchParams.get('taskId');
|
|
440
445
|
res.writeHead(200, { 'Content-Type': 'application/json' });
|
|
441
|
-
const inputs = await getExpandedTaskInputs(taskId);
|
|
446
|
+
const inputs = await getExpandedTaskInputs(currentProjectGraphClientResponse, expandedTaskInputsCache, taskId);
|
|
442
447
|
node_perf_hooks_1.performance.mark('task input generation:end');
|
|
443
448
|
res.end(JSON.stringify({ [taskId]: inputs }));
|
|
444
449
|
node_perf_hooks_1.performance.measure('task input generation', 'task input generation:start', 'task input generation:end');
|
|
@@ -823,19 +828,23 @@ async function createTaskGraphForTargetsAndProjects(targetNames, projectNames, c
|
|
|
823
828
|
};
|
|
824
829
|
}
|
|
825
830
|
}
|
|
826
|
-
async function getExpandedTaskInputs(taskId) {
|
|
831
|
+
async function getExpandedTaskInputs(depGraphClientResponse, expandedTaskInputsCache, taskId) {
|
|
827
832
|
// Check cache first
|
|
828
833
|
if (expandedTaskInputsCache.has(taskId)) {
|
|
829
834
|
return expandedTaskInputsCache.get(taskId);
|
|
830
835
|
}
|
|
831
836
|
// Use the optimized version that only creates the specific task graph needed
|
|
832
|
-
|
|
837
|
+
// Use colon-aware splitting so that target names containing colons
|
|
838
|
+
// (e.g. "test:integration") are parsed correctly instead of being
|
|
839
|
+
// mistaken for a target + configuration pair.
|
|
840
|
+
const projectNodes = Object.fromEntries(depGraphClientResponse.projects.map((p) => [p.name, p]));
|
|
841
|
+
const [projectName, targetName, configuration] = (0, split_target_1.splitTargetFromNodes)(taskId, projectNodes, { silent: true });
|
|
833
842
|
const taskGraphResponse = await createTaskGraphForTargetsAndProjects([targetName], [projectName], configuration);
|
|
834
843
|
const allWorkspaceFiles = await (0, all_file_data_1.allFileData)();
|
|
835
844
|
const inputs = taskGraphResponse.plans?.[taskId];
|
|
836
845
|
let result = {};
|
|
837
846
|
if (inputs) {
|
|
838
|
-
result = expandInputs(inputs,
|
|
847
|
+
result = expandInputs(inputs, depGraphClientResponse.projects.find((p) => p.name === projectName), allWorkspaceFiles, depGraphClientResponse);
|
|
839
848
|
}
|
|
840
849
|
// Cache the result
|
|
841
850
|
expandedTaskInputsCache.set(taskId, result);
|
|
@@ -1047,6 +1047,15 @@ function createFetcher(pmc) {
|
|
|
1047
1047
|
migrationsCache[packageName + '-' + packageVersion] = migrations;
|
|
1048
1048
|
}
|
|
1049
1049
|
migrations = fetchMigrations(packageName, packageVersion, setCache).then((result) => {
|
|
1050
|
+
// An exact requested version must come back verbatim; a mismatch means
|
|
1051
|
+
// a config surface (registry proxy, override, cooldown gate) silently
|
|
1052
|
+
// substituted another version, which would corrupt the whole plan.
|
|
1053
|
+
if ((0, semver_1.valid)(packageVersion) &&
|
|
1054
|
+
result.version &&
|
|
1055
|
+
result.version !== packageVersion) {
|
|
1056
|
+
throw new Error(`Fetching ${packageName}@${packageVersion} resolved to version ${result.version}. ` +
|
|
1057
|
+
`Check for registry, override, or minimum-release-age configuration that hides the requested version.`);
|
|
1058
|
+
}
|
|
1050
1059
|
if (result.schematics) {
|
|
1051
1060
|
result.generators = { ...result.schematics, ...result.generators };
|
|
1052
1061
|
delete result.schematics;
|
|
@@ -1107,7 +1116,13 @@ async function downloadPackageMigrationsFromRegistry(packageName, packageVersion
|
|
|
1107
1116
|
const { dir, cleanup } = (0, package_manager_1.createTempNpmDirectory)();
|
|
1108
1117
|
let result;
|
|
1109
1118
|
try {
|
|
1110
|
-
const { tarballPath } = await (0, package_manager_1.packageRegistryPack)(dir, packageName, packageVersion
|
|
1119
|
+
const { tarballPath } = await (0, package_manager_1.packageRegistryPack)(dir, packageName, packageVersion,
|
|
1120
|
+
// packageVersion is exact and already resolved through the workspace
|
|
1121
|
+
// package manager's min-release-age policy by the fetcher. In an npm
|
|
1122
|
+
// workspace the pack gate IS that policy, so leave it enforcing; for
|
|
1123
|
+
// other package managers npm's gate is foreign config with no
|
|
1124
|
+
// exclusions and would wrongly re-judge the vetted version.
|
|
1125
|
+
{ bypassMinReleaseAge: (0, package_manager_1.detectPackageManager)() !== 'npm' });
|
|
1111
1126
|
const fullTarballPath = (0, path_1.join)(dir, tarballPath);
|
|
1112
1127
|
let migrations;
|
|
1113
1128
|
try {
|
|
@@ -26,7 +26,6 @@ const workspace_root_1 = require("../../../utils/workspace-root");
|
|
|
26
26
|
const git_utils_1 = require("../../../utils/git-utils");
|
|
27
27
|
const pc = tslib_1.__importStar(require("picocolors"));
|
|
28
28
|
const ora = require('ora');
|
|
29
|
-
const open = require('open');
|
|
30
29
|
function onlyDefaultRunnerIsUsed(nxJson) {
|
|
31
30
|
const defaultRunner = nxJson.tasksRunnerOptions?.default?.runner;
|
|
32
31
|
if (!defaultRunner) {
|
|
@@ -161,6 +160,7 @@ async function runConnectToNxCloud(options, command) {
|
|
|
161
160
|
try {
|
|
162
161
|
const cloudConnectSpinner = ora(`Opening Nx Cloud ${connectCloudUrl} in your browser to connect your workspace.`).start();
|
|
163
162
|
await sleep(2000);
|
|
163
|
+
const { default: open } = await new Function('return import("open")')();
|
|
164
164
|
await open(connectCloudUrl);
|
|
165
165
|
cloudConnectSpinner.succeed();
|
|
166
166
|
}
|
|
@@ -235,7 +235,7 @@ class GithubRemoteReleaseClient extends remote_release_client_1.RemoteReleaseCli
|
|
|
235
235
|
if (!shouldContinueInGitHub) {
|
|
236
236
|
return;
|
|
237
237
|
}
|
|
238
|
-
const open =
|
|
238
|
+
const { default: open } = await new Function('return import("open")')();
|
|
239
239
|
await open(result.url)
|
|
240
240
|
.then(() => {
|
|
241
241
|
console.info(`\nFollow up in the browser to manually create the release:\n\n` +
|
|
@@ -157,7 +157,7 @@ class GitLabRemoteReleaseClient extends remote_release_client_1.RemoteReleaseCli
|
|
|
157
157
|
if (!shouldContinueInGitLab) {
|
|
158
158
|
return;
|
|
159
159
|
}
|
|
160
|
-
const open =
|
|
160
|
+
const { default: open } = await new Function('return import("open")')();
|
|
161
161
|
await open(result.url)
|
|
162
162
|
.then(() => {
|
|
163
163
|
console.info(`\nFollow up in the browser to manually create the release:\n\n` +
|
|
@@ -54,8 +54,10 @@ export type TargetDefaultEntry = {
|
|
|
54
54
|
export type TargetDefaultFilter = {
|
|
55
55
|
/**
|
|
56
56
|
* Restrict the default to targets originated by a specific plugin
|
|
57
|
-
* (e.g. `@nx/vite`). Matches against the plugin
|
|
58
|
-
* `executor` or `command`.
|
|
57
|
+
* (e.g. `@nx/vite`). Matches against the plugin from nx.json's `plugins`
|
|
58
|
+
* that wrote the target's `executor` or `command`. Targets whose
|
|
59
|
+
* executor/command comes from `project.json` or `package.json` have no
|
|
60
|
+
* source plugin and never match.
|
|
59
61
|
*/
|
|
60
62
|
plugin?: string;
|
|
61
63
|
/**
|