nx 22.3.0-canary.20251215-e864b6a → 22.3.0-canary.20251216-71bfc21
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/executors.json +16 -16
- package/generators.json +13 -13
- package/migrations.json +138 -138
- package/package.json +14 -11
- package/presets/npm.json +4 -4
- package/schemas/nx-schema.json +1285 -1285
- package/schemas/project-schema.json +359 -359
- package/schemas/workspace-schema.json +165 -165
- package/src/ai/set-up-ai-agents/schema.json +31 -31
- package/src/executors/noop/schema.json +8 -8
- package/src/executors/run-commands/schema.json +187 -187
- package/src/executors/run-script/schema.json +25 -25
- package/src/native/index.d.ts +1 -1
- package/src/native/nx.wasm32-wasi.wasm +0 -0
- package/src/nx-cloud/generators/connect-to-nx-cloud/schema.json +38 -38
- package/src/plugins/js/lock-file/pnpm-parser.d.ts.map +1 -1
- package/src/plugins/js/lock-file/pnpm-parser.js +84 -21
- package/src/plugins/js/project-graph/affected/npm-packages.d.ts.map +1 -1
- package/src/plugins/js/project-graph/affected/npm-packages.js +25 -0
- package/src/tasks-runner/cache.d.ts.map +1 -1
- package/src/tasks-runner/cache.js +1 -1
|
@@ -13,6 +13,7 @@ const catalog_1 = require("../../../utils/catalog");
|
|
|
13
13
|
const project_graph_pruning_1 = require("./project-graph-pruning");
|
|
14
14
|
const path_1 = require("path");
|
|
15
15
|
const get_workspace_packages_from_graph_1 = require("../utils/get-workspace-packages-from-graph");
|
|
16
|
+
const semver_1 = require("semver");
|
|
16
17
|
let currentLockFileHash;
|
|
17
18
|
let parsedLockFile;
|
|
18
19
|
function parsePnpmLockFile(lockFileContent, lockFileHash) {
|
|
@@ -63,18 +64,79 @@ function matchedDependencyName(importer, key, originalPackageName) {
|
|
|
63
64
|
matchPropValue(importer.optionalDependencies, key, originalPackageName, 'optionalDependencies') ||
|
|
64
65
|
matchPropValue(importer.peerDependencies, key, originalPackageName, 'peerDependencies'));
|
|
65
66
|
}
|
|
66
|
-
function createHashFromSnapshot(snapshot) {
|
|
67
|
-
|
|
67
|
+
function createHashFromSnapshot(snapshot, patchHash) {
|
|
68
|
+
const baseHash = snapshot.resolution?.['integrity'] ||
|
|
68
69
|
(snapshot.resolution?.['tarball']
|
|
69
70
|
? (0, file_hasher_1.hashArray)([snapshot.resolution['tarball']])
|
|
70
|
-
: undefined)
|
|
71
|
+
: undefined);
|
|
72
|
+
// If there's a patch hash, combine it with the base hash
|
|
73
|
+
if (patchHash && baseHash) {
|
|
74
|
+
return (0, file_hasher_1.hashArray)([baseHash, patchHash]);
|
|
75
|
+
}
|
|
76
|
+
return baseHash ?? patchHash;
|
|
71
77
|
}
|
|
72
78
|
function isAliasVersion(depVersion) {
|
|
73
79
|
return depVersion.startsWith('/') || depVersion.includes('@');
|
|
74
80
|
}
|
|
81
|
+
/**
|
|
82
|
+
* Finds the appropriate patch hash for a package based on its name and version.
|
|
83
|
+
* Follows PNPM's priority order (https://pnpm.io/settings#patcheddependencies):
|
|
84
|
+
* 1. Exact version match (e.g., "vitest@3.2.4") - highest priority
|
|
85
|
+
* 2. Version range match (e.g., "vitest@^3.0.0")
|
|
86
|
+
* 3. Name-only match (e.g., "vitest") - lowest priority
|
|
87
|
+
*/
|
|
88
|
+
function findPatchHash(patchEntriesByPackage, packageName, version) {
|
|
89
|
+
const entries = patchEntriesByPackage.get(packageName);
|
|
90
|
+
if (!entries) {
|
|
91
|
+
return undefined; // No patches for this package
|
|
92
|
+
}
|
|
93
|
+
// Check for exact version match first (highest priority)
|
|
94
|
+
const exactMatch = entries.find((entry) => entry.versionSpecifier === version);
|
|
95
|
+
if (exactMatch) {
|
|
96
|
+
return exactMatch.hash;
|
|
97
|
+
}
|
|
98
|
+
// Check for version range matches
|
|
99
|
+
for (const entry of entries) {
|
|
100
|
+
// Skip name-only entries (will be handled at the end with lowest priority)
|
|
101
|
+
if (entry.versionSpecifier === null) {
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
if ((0, semver_1.validRange)(entry.versionSpecifier)) {
|
|
105
|
+
try {
|
|
106
|
+
if ((0, semver_1.satisfies)(version, entry.versionSpecifier)) {
|
|
107
|
+
return entry.hash;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
catch {
|
|
111
|
+
// Invalid semver range, skip
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
// Fall back to name-only match (lowest priority)
|
|
116
|
+
const nameOnlyMatch = entries.find((entry) => entry.versionSpecifier === null);
|
|
117
|
+
return nameOnlyMatch?.hash;
|
|
118
|
+
}
|
|
75
119
|
function getNodes(data, isV5) {
|
|
76
120
|
const keyMap = new Map();
|
|
77
121
|
const nodes = new Map();
|
|
122
|
+
// Extract and pre-parse patch information from patchedDependencies section
|
|
123
|
+
const patchEntriesByPackage = new Map();
|
|
124
|
+
if (data.patchedDependencies) {
|
|
125
|
+
for (const specifier of Object.keys(data.patchedDependencies)) {
|
|
126
|
+
const patchInfo = data.patchedDependencies[specifier];
|
|
127
|
+
if (patchInfo && typeof patchInfo === 'object' && 'hash' in patchInfo) {
|
|
128
|
+
const packageName = extractNameFromKey(specifier, false);
|
|
129
|
+
const versionSpecifier = getVersion(specifier, packageName) || null;
|
|
130
|
+
if (!patchEntriesByPackage.has(packageName)) {
|
|
131
|
+
patchEntriesByPackage.set(packageName, []);
|
|
132
|
+
}
|
|
133
|
+
patchEntriesByPackage.get(packageName).push({
|
|
134
|
+
versionSpecifier,
|
|
135
|
+
hash: patchInfo.hash,
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
78
140
|
const maybeAliasedPackageVersions = new Map(); // <version, alias>
|
|
79
141
|
if (data.importers['.'].optionalDependencies) {
|
|
80
142
|
for (const [depName, depVersion] of Object.entries(data.importers['.'].optionalDependencies)) {
|
|
@@ -104,7 +166,14 @@ function getNodes(data, isV5) {
|
|
|
104
166
|
if (!originalPackageName) {
|
|
105
167
|
continue;
|
|
106
168
|
}
|
|
107
|
-
|
|
169
|
+
// Extract version from the key to match against patch specifiers
|
|
170
|
+
const versionFromKey = getVersion(key, originalPackageName);
|
|
171
|
+
// Parse the base version (without peer dependency info, etc.)
|
|
172
|
+
const baseVersion = parseBaseVersion(versionFromKey, isV5);
|
|
173
|
+
// Find the appropriate patch hash using PNPM's priority order:
|
|
174
|
+
// 1. Exact version match, 2. Version range match, 3. Name-only match
|
|
175
|
+
const patchHash = findPatchHash(patchEntriesByPackage, originalPackageName, baseVersion);
|
|
176
|
+
const hash = createHashFromSnapshot(snapshot, patchHash);
|
|
108
177
|
// snapshot already has a name
|
|
109
178
|
if (snapshot.name) {
|
|
110
179
|
packageNameObj = {
|
|
@@ -122,14 +191,14 @@ function getNodes(data, isV5) {
|
|
|
122
191
|
packageNameObj = {
|
|
123
192
|
key,
|
|
124
193
|
packageName: rootDependencyName,
|
|
125
|
-
hash
|
|
194
|
+
hash,
|
|
126
195
|
};
|
|
127
196
|
}
|
|
128
197
|
if (!snapshot.name && !rootDependencyName) {
|
|
129
198
|
packageNameObj = {
|
|
130
199
|
key,
|
|
131
200
|
packageName: originalPackageName,
|
|
132
|
-
hash
|
|
201
|
+
hash,
|
|
133
202
|
};
|
|
134
203
|
}
|
|
135
204
|
if (snapshot.peerDependencies) {
|
|
@@ -512,23 +581,17 @@ function getVersion(key, packageName) {
|
|
|
512
581
|
return key.slice(packageName.length + 1);
|
|
513
582
|
}
|
|
514
583
|
function extractNameFromKey(key, isV5) {
|
|
515
|
-
|
|
584
|
+
const versionSeparator = isV5 ? '/' : '@';
|
|
516
585
|
if (key.startsWith('@')) {
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
// find the position of the '@'
|
|
523
|
-
return key.slice(0, key.indexOf('@', 1));
|
|
524
|
-
}
|
|
525
|
-
}
|
|
526
|
-
if (isV5) {
|
|
527
|
-
// if package has just a name e.g. "react/7.12.5..."
|
|
528
|
-
return key.slice(0, key.indexOf('/', 1));
|
|
586
|
+
// Scoped package (e.g., "@babel/core@7.12.5" or "@babel/core/7.12.5")
|
|
587
|
+
// Find the end of scope, then look for the first version separator after that
|
|
588
|
+
const scopeEnd = key.indexOf('/');
|
|
589
|
+
const sepIndex = scopeEnd === -1 ? -1 : key.indexOf(versionSeparator, scopeEnd + 1);
|
|
590
|
+
return sepIndex === -1 ? key : key.slice(0, sepIndex);
|
|
529
591
|
}
|
|
530
592
|
else {
|
|
531
|
-
//
|
|
532
|
-
|
|
593
|
+
// Non-scoped package (e.g., "react@7.12.5" or "react/7.12.5")
|
|
594
|
+
const sepIndex = key.indexOf(versionSeparator);
|
|
595
|
+
return sepIndex === -1 ? key : key.slice(0, sepIndex);
|
|
533
596
|
}
|
|
534
597
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"npm-packages.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/nx/src/plugins/js/project-graph/affected/npm-packages.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EAChB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAGL,UAAU,EACX,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAE,qBAAqB,EAAE,MAAM,kEAAkE,CAAC;AAQzG,eAAO,MAAM,qBAAqB,EAAE,qBAAqB,CACvD,eAAe,GAAG,UAAU,
|
|
1
|
+
{"version":3,"file":"npm-packages.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/nx/src/plugins/js/project-graph/affected/npm-packages.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,eAAe,EAChB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAGL,UAAU,EACX,MAAM,6BAA6B,CAAC;AAErC,OAAO,EAAE,qBAAqB,EAAE,MAAM,kEAAkE,CAAC;AAQzG,eAAO,MAAM,qBAAqB,EAAE,qBAAqB,CACvD,eAAe,GAAG,UAAU,CAmG7B,CAAC"}
|
|
@@ -49,6 +49,31 @@ const getTouchedNpmPackages = (touchedFiles, _, nxJson, packageJson, projectGrap
|
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
|
+
else if ((0, json_diff_1.isJsonChange)(c) &&
|
|
53
|
+
(c.path[0] === 'overrides' ||
|
|
54
|
+
c.path[0] === 'resolutions' ||
|
|
55
|
+
(c.path[0] === 'pnpm' && c.path[1] === 'overrides'))) {
|
|
56
|
+
// Changes to overrides, resolutions, or pnpm.overrides
|
|
57
|
+
// Find which package was changed and mark projects that depend on it as affected
|
|
58
|
+
const packageName = c.path[0] === 'pnpm' ? c.path[2] : c.path[1];
|
|
59
|
+
if (packageName) {
|
|
60
|
+
// Look for the npm package in external nodes
|
|
61
|
+
let npmPackage = npmPackages.find((pkg) => pkg.data.packageName === packageName);
|
|
62
|
+
if (npmPackage) {
|
|
63
|
+
touched.push(npmPackage.name);
|
|
64
|
+
// If it's a global package, all projects are affected
|
|
65
|
+
if ('packageName' in npmPackage.data &&
|
|
66
|
+
globalPackages.has(npmPackage.data.packageName)) {
|
|
67
|
+
return Object.keys(projectGraph.nodes);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
// If the package isn't found in external nodes, it might affect all projects
|
|
72
|
+
// since overrides can affect transitive dependencies
|
|
73
|
+
return Object.keys(projectGraph.nodes);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
52
77
|
else if ((0, file_utils_1.isWholeFileChange)(c)) {
|
|
53
78
|
// Whole file was touched, so all npm packages are touched.
|
|
54
79
|
touched = npmPackages.map((pkg) => pkg.name);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../../../../packages/nx/src/tasks-runner/cache.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,yBAAyB,EACzB,WAAW,EAEZ,MAAM,wBAAwB,CAAC;AAKhC,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAW5C,OAAO,EAAE,mBAAmB,EAAc,MAAM,mB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AM,EAAE;IAoBnB,mBAAmB,CAAC,IAAI,EAAE,IAAI;YAIhB,wBAAwB;YAIxB,oBAAoB;YAOpB,cAAc;YAiBd,IAAI;YAiBJ,MAAM;YAYN,eAAe;YAwBf,wBAAwB;IAyBtC,OAAO,CAAC,cAAc;IAKtB,OAAO,CAAC,wBAAwB;CAKjC;AA0BD;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,mBAAmB,GAAG,MAAM,CAKvE;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAC/B,YAAY,EAAE,MAAM,GAAG,MAAM,GAC5B,MAAM,GAAG,SAAS,CAqCpB;AAED,wBAAgB,eAAe,CAAC,YAAY,EAAE,MAAM,EAAE,QAAQ,SAAI,GAAG,MAAM,CAS1E"}
|
|
@@ -56,7 +56,7 @@ class DbCache {
|
|
|
56
56
|
constructor(options) {
|
|
57
57
|
this.options = options;
|
|
58
58
|
this.nxJson = (0, nx_json_1.readNxJson)();
|
|
59
|
-
this.cache = new native_1.NxCache(workspace_root_1.workspaceRoot, cache_directory_1.cacheDir, (0, db_connection_1.getDbConnection)(), resolveMaxCacheSize(this.nxJson));
|
|
59
|
+
this.cache = new native_1.NxCache(workspace_root_1.workspaceRoot, cache_directory_1.cacheDir, (0, db_connection_1.getDbConnection)(), undefined, resolveMaxCacheSize(this.nxJson));
|
|
60
60
|
this.isVerbose = process.env.NX_VERBOSE_LOGGING === 'true';
|
|
61
61
|
}
|
|
62
62
|
async init() {
|