@coana-tech/cli 14.12.27 → 14.12.29
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/cli.mjs +275 -411
- package/package.json +1 -1
- package/repos/coana-tech/alucard/alucard.jar +0 -0
- package/repos/coana-tech/goana/bin/goana-darwin-amd64.gz +0 -0
- package/repos/coana-tech/goana/bin/goana-darwin-arm64.gz +0 -0
- package/repos/coana-tech/goana/bin/goana-linux-amd64.gz +0 -0
- package/repos/coana-tech/goana/bin/goana-linux-arm64.gz +0 -0
package/cli.mjs
CHANGED
|
@@ -11905,15 +11905,15 @@ var require_file = __commonJS({
|
|
|
11905
11905
|
_incFile(callback) {
|
|
11906
11906
|
debug("_incFile", this.filename);
|
|
11907
11907
|
const ext2 = path2.extname(this._basename);
|
|
11908
|
-
const
|
|
11908
|
+
const basename11 = path2.basename(this._basename, ext2);
|
|
11909
11909
|
const tasks = [];
|
|
11910
11910
|
if (this.zippedArchive) {
|
|
11911
11911
|
tasks.push(
|
|
11912
11912
|
function(cb) {
|
|
11913
11913
|
const num = this._created > 0 && !this.tailable ? this._created : "";
|
|
11914
11914
|
this._compressFile(
|
|
11915
|
-
path2.join(this.dirname, `${
|
|
11916
|
-
path2.join(this.dirname, `${
|
|
11915
|
+
path2.join(this.dirname, `${basename11}${num}${ext2}`),
|
|
11916
|
+
path2.join(this.dirname, `${basename11}${num}${ext2}.gz`),
|
|
11917
11917
|
cb
|
|
11918
11918
|
);
|
|
11919
11919
|
}.bind(this)
|
|
@@ -11923,9 +11923,9 @@ var require_file = __commonJS({
|
|
|
11923
11923
|
function(cb) {
|
|
11924
11924
|
if (!this.tailable) {
|
|
11925
11925
|
this._created += 1;
|
|
11926
|
-
this._checkMaxFilesIncrementing(ext2,
|
|
11926
|
+
this._checkMaxFilesIncrementing(ext2, basename11, cb);
|
|
11927
11927
|
} else {
|
|
11928
|
-
this._checkMaxFilesTailable(ext2,
|
|
11928
|
+
this._checkMaxFilesTailable(ext2, basename11, cb);
|
|
11929
11929
|
}
|
|
11930
11930
|
}.bind(this)
|
|
11931
11931
|
);
|
|
@@ -11939,9 +11939,9 @@ var require_file = __commonJS({
|
|
|
11939
11939
|
*/
|
|
11940
11940
|
_getFile() {
|
|
11941
11941
|
const ext2 = path2.extname(this._basename);
|
|
11942
|
-
const
|
|
11942
|
+
const basename11 = path2.basename(this._basename, ext2);
|
|
11943
11943
|
const isRotation = this.rotationFormat ? this.rotationFormat() : this._created;
|
|
11944
|
-
return !this.tailable && this._created ? `${
|
|
11944
|
+
return !this.tailable && this._created ? `${basename11}${isRotation}${ext2}` : `${basename11}${ext2}`;
|
|
11945
11945
|
}
|
|
11946
11946
|
/**
|
|
11947
11947
|
* Increment the number of files created or checked by this instance.
|
|
@@ -11951,14 +11951,14 @@ var require_file = __commonJS({
|
|
|
11951
11951
|
* @returns {undefined}
|
|
11952
11952
|
* @private
|
|
11953
11953
|
*/
|
|
11954
|
-
_checkMaxFilesIncrementing(ext2,
|
|
11954
|
+
_checkMaxFilesIncrementing(ext2, basename11, callback) {
|
|
11955
11955
|
if (!this.maxFiles || this._created < this.maxFiles) {
|
|
11956
11956
|
return setImmediate(callback);
|
|
11957
11957
|
}
|
|
11958
11958
|
const oldest = this._created - this.maxFiles;
|
|
11959
11959
|
const isOldest = oldest !== 0 ? oldest : "";
|
|
11960
11960
|
const isZipped = this.zippedArchive ? ".gz" : "";
|
|
11961
|
-
const filePath = `${
|
|
11961
|
+
const filePath = `${basename11}${isOldest}${ext2}${isZipped}`;
|
|
11962
11962
|
const target = path2.join(this.dirname, filePath);
|
|
11963
11963
|
fs.unlink(target, callback);
|
|
11964
11964
|
}
|
|
@@ -11973,7 +11973,7 @@ var require_file = __commonJS({
|
|
|
11973
11973
|
* @returns {undefined}
|
|
11974
11974
|
* @private
|
|
11975
11975
|
*/
|
|
11976
|
-
_checkMaxFilesTailable(ext2,
|
|
11976
|
+
_checkMaxFilesTailable(ext2, basename11, callback) {
|
|
11977
11977
|
const tasks = [];
|
|
11978
11978
|
if (!this.maxFiles) {
|
|
11979
11979
|
return;
|
|
@@ -11981,21 +11981,21 @@ var require_file = __commonJS({
|
|
|
11981
11981
|
const isZipped = this.zippedArchive ? ".gz" : "";
|
|
11982
11982
|
for (let x2 = this.maxFiles - 1; x2 > 1; x2--) {
|
|
11983
11983
|
tasks.push(function(i6, cb) {
|
|
11984
|
-
let fileName3 = `${
|
|
11984
|
+
let fileName3 = `${basename11}${i6 - 1}${ext2}${isZipped}`;
|
|
11985
11985
|
const tmppath = path2.join(this.dirname, fileName3);
|
|
11986
11986
|
fs.exists(tmppath, (exists2) => {
|
|
11987
11987
|
if (!exists2) {
|
|
11988
11988
|
return cb(null);
|
|
11989
11989
|
}
|
|
11990
|
-
fileName3 = `${
|
|
11990
|
+
fileName3 = `${basename11}${i6}${ext2}${isZipped}`;
|
|
11991
11991
|
fs.rename(tmppath, path2.join(this.dirname, fileName3), cb);
|
|
11992
11992
|
});
|
|
11993
11993
|
}.bind(this, x2));
|
|
11994
11994
|
}
|
|
11995
11995
|
asyncSeries(tasks, () => {
|
|
11996
11996
|
fs.rename(
|
|
11997
|
-
path2.join(this.dirname, `${
|
|
11998
|
-
path2.join(this.dirname, `${
|
|
11997
|
+
path2.join(this.dirname, `${basename11}${ext2}${isZipped}`),
|
|
11998
|
+
path2.join(this.dirname, `${basename11}1${ext2}${isZipped}`),
|
|
11999
11999
|
callback
|
|
12000
12000
|
);
|
|
12001
12001
|
});
|
|
@@ -45334,7 +45334,7 @@ var require_mime_types = __commonJS({
|
|
|
45334
45334
|
"../../node_modules/.pnpm/mime-types@2.1.35/node_modules/mime-types/index.js"(exports2) {
|
|
45335
45335
|
"use strict";
|
|
45336
45336
|
var db = require_mime_db();
|
|
45337
|
-
var
|
|
45337
|
+
var extname2 = __require("path").extname;
|
|
45338
45338
|
var EXTRACT_TYPE_REGEXP = /^\s*([^;\s]*)(?:;|\s|$)/;
|
|
45339
45339
|
var TEXT_TYPE_REGEXP = /^text\//i;
|
|
45340
45340
|
exports2.charset = charset;
|
|
@@ -45388,7 +45388,7 @@ var require_mime_types = __commonJS({
|
|
|
45388
45388
|
if (!path2 || typeof path2 !== "string") {
|
|
45389
45389
|
return false;
|
|
45390
45390
|
}
|
|
45391
|
-
var extension2 =
|
|
45391
|
+
var extension2 = extname2("x." + path2).toLowerCase().substr(1);
|
|
45392
45392
|
if (!extension2) {
|
|
45393
45393
|
return false;
|
|
45394
45394
|
}
|
|
@@ -96473,7 +96473,7 @@ var require_parseParams = __commonJS({
|
|
|
96473
96473
|
var require_basename = __commonJS({
|
|
96474
96474
|
"../../node_modules/.pnpm/@fastify+busboy@2.1.1/node_modules/@fastify/busboy/lib/utils/basename.js"(exports2, module2) {
|
|
96475
96475
|
"use strict";
|
|
96476
|
-
module2.exports = function
|
|
96476
|
+
module2.exports = function basename11(path2) {
|
|
96477
96477
|
if (typeof path2 !== "string") {
|
|
96478
96478
|
return "";
|
|
96479
96479
|
}
|
|
@@ -96500,7 +96500,7 @@ var require_multipart = __commonJS({
|
|
|
96500
96500
|
var Dicer = require_Dicer();
|
|
96501
96501
|
var parseParams = require_parseParams();
|
|
96502
96502
|
var decodeText = require_decodeText();
|
|
96503
|
-
var
|
|
96503
|
+
var basename11 = require_basename();
|
|
96504
96504
|
var getLimit2 = require_getLimit();
|
|
96505
96505
|
var RE_BOUNDARY = /^boundary$/i;
|
|
96506
96506
|
var RE_FIELD = /^form-data$/i;
|
|
@@ -96617,7 +96617,7 @@ var require_multipart = __commonJS({
|
|
|
96617
96617
|
} else if (RE_FILENAME.test(parsed[i6][0])) {
|
|
96618
96618
|
filename = parsed[i6][1];
|
|
96619
96619
|
if (!preservePath) {
|
|
96620
|
-
filename =
|
|
96620
|
+
filename = basename11(filename);
|
|
96621
96621
|
}
|
|
96622
96622
|
}
|
|
96623
96623
|
}
|
|
@@ -115453,8 +115453,8 @@ var require_tmp = __commonJS({
|
|
|
115453
115453
|
if (option === "name") {
|
|
115454
115454
|
if (path2.isAbsolute(name))
|
|
115455
115455
|
throw new Error(`${option} option must not contain an absolute path, found "${name}".`);
|
|
115456
|
-
let
|
|
115457
|
-
if (
|
|
115456
|
+
let basename11 = path2.basename(name);
|
|
115457
|
+
if (basename11 === ".." || basename11 === "." || basename11 !== name)
|
|
115458
115458
|
throw new Error(`${option} option must not contain a path, found "${name}".`);
|
|
115459
115459
|
} else {
|
|
115460
115460
|
if (path2.isAbsolute(name) && !name.startsWith(tmpDir)) {
|
|
@@ -194030,11 +194030,10 @@ async function loadPom(rootDir, pomFile, validateFile, visited = /* @__PURE__ */
|
|
|
194030
194030
|
xml: xml2,
|
|
194031
194031
|
indentation,
|
|
194032
194032
|
sourceText,
|
|
194033
|
-
profiles: /* @__PURE__ */ new Map()
|
|
194034
|
-
visited
|
|
194033
|
+
profiles: /* @__PURE__ */ new Map()
|
|
194035
194034
|
};
|
|
194036
194035
|
const parentPomPath = getParentPomPath(pom);
|
|
194037
|
-
const parentPom = parentPomPath ? await loadPom(rootDir, parentPomPath, validateFile) : void 0;
|
|
194036
|
+
const parentPom = parentPomPath ? await loadPom(rootDir, parentPomPath, validateFile, visited) : void 0;
|
|
194038
194037
|
pom.profiles = extractProfilesFromPom(pom, parentPom?.profiles);
|
|
194039
194038
|
return pom;
|
|
194040
194039
|
}
|
|
@@ -194240,7 +194239,7 @@ function evaluate(expression, pom, profileId) {
|
|
|
194240
194239
|
if (property) {
|
|
194241
194240
|
return evaluateWithContext(property.text, depth + 1);
|
|
194242
194241
|
} else {
|
|
194243
|
-
logger.
|
|
194242
|
+
logger.debug(`Unknown property ${propertyName} for pom ${relative2(pom.rootDir, pom.validatedPomFile)}`);
|
|
194244
194243
|
return match2;
|
|
194245
194244
|
}
|
|
194246
194245
|
});
|
|
@@ -198810,12 +198809,18 @@ var MavenSocketUpgradeManager = class {
|
|
|
198810
198809
|
const patches = [];
|
|
198811
198810
|
for (const upgrade of upgrades) {
|
|
198812
198811
|
const artifact = artifacts[upgrade.idx];
|
|
198813
|
-
const
|
|
198814
|
-
|
|
198812
|
+
const manifestFilesForArtifact = i(
|
|
198813
|
+
(artifact.manifestFiles?.map((ref) => ref.file) ?? []).concat(
|
|
198814
|
+
artifact.toplevelAncestors?.flatMap(
|
|
198815
|
+
(ancestorId) => artifacts.find((a5) => a5.id === ancestorId)?.manifestFiles?.map((m3) => m3.file) ?? []
|
|
198816
|
+
) ?? []
|
|
198817
|
+
)
|
|
198818
|
+
);
|
|
198819
|
+
for (const manifestFile of manifestFilesForArtifact) {
|
|
198815
198820
|
if (this.pomMatcher(basename(manifestFile))) {
|
|
198816
198821
|
const project = await loadPom(this.rootDir, manifestFile, validateFile);
|
|
198817
198822
|
if (project) {
|
|
198818
|
-
for (const patch of await this.handlePom(project, upgrade, artifact, rangeStyle
|
|
198823
|
+
for (const patch of await this.handlePom(project, upgrade, artifact, rangeStyle)) {
|
|
198819
198824
|
patches.push(patch);
|
|
198820
198825
|
}
|
|
198821
198826
|
} else {
|
|
@@ -198828,43 +198833,7 @@ var MavenSocketUpgradeManager = class {
|
|
|
198828
198833
|
} else if (this.gradleLockfileMatcher(basename(manifestFile))) {
|
|
198829
198834
|
const lockFileContent = await loadLockFile(this.rootDir, manifestFile, validateFile);
|
|
198830
198835
|
if (lockFileContent) {
|
|
198831
|
-
for (const patch of await this.handleGradleLockfile(lockFileContent, upgrade, artifact
|
|
198832
|
-
patches.push(patch);
|
|
198833
|
-
}
|
|
198834
|
-
} else {
|
|
198835
|
-
patches.push({
|
|
198836
|
-
success: false,
|
|
198837
|
-
upgrades: [upgrade],
|
|
198838
|
-
reason: `Manifest file not valid for updates: ${manifestFile}`
|
|
198839
|
-
});
|
|
198840
|
-
}
|
|
198841
|
-
} else {
|
|
198842
|
-
logger.warn(`File does not match supported patterns for upgrading dependencies: ${manifestFile}`);
|
|
198843
|
-
}
|
|
198844
|
-
}
|
|
198845
|
-
const ancestorManifestFiles = i(
|
|
198846
|
-
artifact.toplevelAncestors?.flatMap(
|
|
198847
|
-
(ancestorId) => artifacts.find((a5) => a5.id === ancestorId)?.manifestFiles?.map((ref) => ref.file) ?? []
|
|
198848
|
-
) ?? []
|
|
198849
|
-
);
|
|
198850
|
-
for (const manifestFile of ancestorManifestFiles) {
|
|
198851
|
-
if (this.pomMatcher(basename(manifestFile))) {
|
|
198852
|
-
const project = await loadPom(this.rootDir, manifestFile, validateFile);
|
|
198853
|
-
if (project) {
|
|
198854
|
-
for (const patch of await this.handlePom(project, upgrade, artifact, rangeStyle, "ANCESTOR")) {
|
|
198855
|
-
patches.push(patch);
|
|
198856
|
-
}
|
|
198857
|
-
} else {
|
|
198858
|
-
patches.push({
|
|
198859
|
-
success: false,
|
|
198860
|
-
upgrades: [upgrade],
|
|
198861
|
-
reason: `Manifest file not valid for updates: ${manifestFile}`
|
|
198862
|
-
});
|
|
198863
|
-
}
|
|
198864
|
-
} else if (this.gradleLockfileMatcher(basename(manifestFile))) {
|
|
198865
|
-
const lockFile = await loadLockFile(this.rootDir, manifestFile, validateFile);
|
|
198866
|
-
if (lockFile) {
|
|
198867
|
-
for (const patch of await this.handleGradleLockfile(lockFile, upgrade, artifact, "ANCESTOR")) {
|
|
198836
|
+
for (const patch of await this.handleGradleLockfile(lockFileContent, upgrade, artifact)) {
|
|
198868
198837
|
patches.push(patch);
|
|
198869
198838
|
}
|
|
198870
198839
|
} else {
|
|
@@ -198884,7 +198853,7 @@ var MavenSocketUpgradeManager = class {
|
|
|
198884
198853
|
/**
|
|
198885
198854
|
* Handle POM files for updating existing dependencies/managed dependencies
|
|
198886
198855
|
*/
|
|
198887
|
-
async handlePom(pom, upgrade, artifact, rangeStyle
|
|
198856
|
+
async handlePom(pom, upgrade, artifact, rangeStyle) {
|
|
198888
198857
|
const patches = [];
|
|
198889
198858
|
assert3(artifact.namespace);
|
|
198890
198859
|
assert3(artifact.name);
|
|
@@ -198899,78 +198868,36 @@ var MavenSocketUpgradeManager = class {
|
|
|
198899
198868
|
new Restriction(upgradeMavenVersion, true, upgradeMavenVersion, true)
|
|
198900
198869
|
]);
|
|
198901
198870
|
const upgradeMavenRange = existingMavenVersion.compareTo(upgradeMavenVersion) <= 0 ? new VersionRange(null, [new Restriction(upgradeMavenVersion, true, null, false)]) : new VersionRange(null, [new Restriction(null, false, upgradeMavenVersion, true)]);
|
|
198902
|
-
|
|
198903
|
-
|
|
198904
|
-
|
|
198905
|
-
|
|
198906
|
-
|
|
198907
|
-
|
|
198908
|
-
|
|
198909
|
-
|
|
198910
|
-
|
|
198911
|
-
|
|
198912
|
-
|
|
198913
|
-
|
|
198914
|
-
|
|
198915
|
-
|
|
198916
|
-
|
|
198917
|
-
|
|
198918
|
-
|
|
198919
|
-
|
|
198920
|
-
|
|
198921
|
-
rangeStyle === "pin" || !existingVersionRange.containsVersion(upgradeMavenVersion) ? upgradeMavenRangePinned.toString() : existingVersionRange.hasRestrictions() ? upgradeMavenRange.restrict(existingVersionRange).toString() : upgradeMavenVersion.toString()
|
|
198922
|
-
)
|
|
198923
|
-
}
|
|
198924
|
-
});
|
|
198925
|
-
} else {
|
|
198926
|
-
patches.push({
|
|
198927
|
-
success: false,
|
|
198928
|
-
upgrades: [upgrade],
|
|
198929
|
-
reason: "Failed to create patch for direct dependency"
|
|
198930
|
-
});
|
|
198931
|
-
}
|
|
198932
|
-
} else {
|
|
198933
|
-
const foundManagedDep = profile.managedDependencies.reverse().concat(pom.profiles.get(void 0)?.managedDependencies.reverse() ?? []).find((dep) => {
|
|
198934
|
-
return groupId === evaluate(dep.groupId.text, pom, profileId) && artifactId === evaluate(dep.artifactId.text, pom, profileId) && (type ?? "jar") === evaluate(dep.type?.text ?? "jar", pom, profileId) && classifier === (dep.classifier && evaluate(dep.classifier.text, pom, profileId));
|
|
198935
|
-
});
|
|
198936
|
-
if (foundManagedDep) {
|
|
198937
|
-
const existingVersionRange = VersionRange.createFromVersionSpec(
|
|
198938
|
-
evaluate(foundManagedDep.version.text, pom)
|
|
198939
|
-
);
|
|
198940
|
-
const patchLocation = findPatchLocation(
|
|
198941
|
-
foundManagedDep.pom.validatedPomFile,
|
|
198942
|
-
foundManagedDep.version,
|
|
198943
|
-
pom,
|
|
198944
|
-
profileId
|
|
198945
|
-
);
|
|
198946
|
-
if (patchLocation?.offset !== void 0) {
|
|
198947
|
-
patches.push({
|
|
198948
|
-
success: true,
|
|
198949
|
-
upgrades: [upgrade],
|
|
198950
|
-
patch: {
|
|
198951
|
-
file: patchLocation.file,
|
|
198952
|
-
offset: patchLocation.offset,
|
|
198953
|
-
oldText: patchLocation.text,
|
|
198954
|
-
newText: (
|
|
198955
|
-
// Use pinned version if rangeStyle is set or if we break existing spec!
|
|
198956
|
-
rangeStyle === "pin" || !existingVersionRange.containsVersion(upgradeMavenVersion) ? upgradeMavenRangePinned.toString() : existingVersionRange.hasRestrictions() ? upgradeMavenRange.restrict(existingVersionRange).toString() : upgradeMavenVersion.toString()
|
|
198957
|
-
)
|
|
198958
|
-
}
|
|
198959
|
-
});
|
|
198960
|
-
} else {
|
|
198961
|
-
patches.push({
|
|
198962
|
-
success: false,
|
|
198963
|
-
upgrades: [upgrade],
|
|
198964
|
-
reason: "Failed to create patch for direct managed dependency"
|
|
198965
|
-
});
|
|
198966
|
-
}
|
|
198871
|
+
for (const [profileId, profile] of pom.profiles) {
|
|
198872
|
+
const foundDep = profile.dependencies.reverse().find((dep) => {
|
|
198873
|
+
return groupId === evaluate(dep.groupId.text, pom, profileId) && artifactId === evaluate(dep.artifactId.text, pom, profileId) && (type ?? "jar") === evaluate(dep.type?.text ?? "jar", pom, profileId) && classifier === (dep.classifier && evaluate(dep.classifier.text, pom, profileId));
|
|
198874
|
+
});
|
|
198875
|
+
if (foundDep?.version) {
|
|
198876
|
+
const existingVersionRange = VersionRange.createFromVersionSpec(evaluate(foundDep.version.text, pom));
|
|
198877
|
+
const patchLocation = findPatchLocation(foundDep.pom.validatedPomFile, foundDep.version, pom, profileId);
|
|
198878
|
+
if (patchLocation?.offset !== void 0) {
|
|
198879
|
+
patches.push({
|
|
198880
|
+
success: true,
|
|
198881
|
+
upgrades: [upgrade],
|
|
198882
|
+
patch: {
|
|
198883
|
+
file: patchLocation.file,
|
|
198884
|
+
offset: patchLocation.offset,
|
|
198885
|
+
oldText: patchLocation.text,
|
|
198886
|
+
newText: (
|
|
198887
|
+
// Use pinned version if rangeStyle is set or if we break existing spec!
|
|
198888
|
+
rangeStyle === "pin" || !existingVersionRange.containsVersion(upgradeMavenVersion) ? upgradeMavenRangePinned.toString() : existingVersionRange.hasRestrictions() ? upgradeMavenRange.restrict(existingVersionRange).toString() : upgradeMavenVersion.toString()
|
|
198889
|
+
)
|
|
198967
198890
|
}
|
|
198968
|
-
}
|
|
198891
|
+
});
|
|
198892
|
+
} else {
|
|
198893
|
+
patches.push({
|
|
198894
|
+
success: false,
|
|
198895
|
+
upgrades: [upgrade],
|
|
198896
|
+
reason: "Failed to create patch for direct dependency"
|
|
198897
|
+
});
|
|
198969
198898
|
}
|
|
198970
|
-
}
|
|
198971
|
-
|
|
198972
|
-
for (const [profileId, profile] of pom.profiles) {
|
|
198973
|
-
const foundManagedDep = profile.managedDependencies.reverse().find((dep) => {
|
|
198899
|
+
} else {
|
|
198900
|
+
const foundManagedDep = profile.managedDependencies.reverse().concat(pom.profiles.get(void 0)?.managedDependencies.reverse() ?? []).find((dep) => {
|
|
198974
198901
|
return groupId === evaluate(dep.groupId.text, pom, profileId) && artifactId === evaluate(dep.artifactId.text, pom, profileId) && (type ?? "jar") === evaluate(dep.type?.text ?? "jar", pom, profileId) && classifier === (dep.classifier && evaluate(dep.classifier.text, pom, profileId));
|
|
198975
198902
|
});
|
|
198976
198903
|
if (foundManagedDep) {
|
|
@@ -198999,7 +198926,7 @@ var MavenSocketUpgradeManager = class {
|
|
|
198999
198926
|
patches.push({
|
|
199000
198927
|
success: false,
|
|
199001
198928
|
upgrades: [upgrade],
|
|
199002
|
-
reason: "Failed to create patch for
|
|
198929
|
+
reason: "Failed to create patch for direct managed dependency"
|
|
199003
198930
|
});
|
|
199004
198931
|
}
|
|
199005
198932
|
}
|
|
@@ -199010,7 +198937,7 @@ var MavenSocketUpgradeManager = class {
|
|
|
199010
198937
|
/**
|
|
199011
198938
|
* Handle gradle.lockfile manifest files
|
|
199012
198939
|
*/
|
|
199013
|
-
async handleGradleLockfile(lockFile, upgrade, artifact
|
|
198940
|
+
async handleGradleLockfile(lockFile, upgrade, artifact) {
|
|
199014
198941
|
assert3(artifact.namespace);
|
|
199015
198942
|
assert3(artifact.name);
|
|
199016
198943
|
assert3(artifact.version);
|
|
@@ -199042,56 +198969,26 @@ var MavenSocketUpgradeManager = class {
|
|
|
199042
198969
|
*/
|
|
199043
198970
|
async collectFallbackPatches(upgrades, artifacts, rangeStyle, validateFile) {
|
|
199044
198971
|
const patches = [];
|
|
199045
|
-
const
|
|
199046
|
-
const ancestorUpgradesByManifestFile = {};
|
|
198972
|
+
const upgradesByManifestFile = {};
|
|
199047
198973
|
for (const upgrade of upgrades) {
|
|
199048
198974
|
const artifact = artifacts[upgrade.idx];
|
|
199049
|
-
const
|
|
199050
|
-
|
|
199051
|
-
|
|
199052
|
-
|
|
199053
|
-
|
|
199054
|
-
|
|
199055
|
-
(ancestorId) => artifacts.find((a5) => a5.id === ancestorId)?.manifestFiles?.map((ref) => ref.file) ?? []
|
|
199056
|
-
) ?? []
|
|
198975
|
+
const manifestFilesForArtifact = i(
|
|
198976
|
+
(artifact.manifestFiles?.map((ref) => ref.file) ?? []).concat(
|
|
198977
|
+
artifact.toplevelAncestors?.flatMap(
|
|
198978
|
+
(ancestorId) => artifacts.find((a5) => a5.id === ancestorId)?.manifestFiles?.map((m3) => m3.file) ?? []
|
|
198979
|
+
) ?? []
|
|
198980
|
+
)
|
|
199057
198981
|
);
|
|
199058
|
-
for (const manifestFile of
|
|
199059
|
-
(
|
|
199060
|
-
}
|
|
199061
|
-
}
|
|
199062
|
-
for (const [manifestFile, upgradeArtifactPairs] of Object.entries(directUpgradesByManifestFile)) {
|
|
199063
|
-
const fileName3 = basename(manifestFile);
|
|
199064
|
-
if (this.pomMatcher(fileName3)) {
|
|
199065
|
-
const project = await loadPom(this.rootDir, manifestFile, validateFile);
|
|
199066
|
-
if (project) {
|
|
199067
|
-
patches.push(...await this.handlePomFallback(project, upgradeArtifactPairs, rangeStyle, "DIRECT"));
|
|
199068
|
-
} else {
|
|
199069
|
-
patches.push({
|
|
199070
|
-
success: false,
|
|
199071
|
-
upgrades: upgradeArtifactPairs.map(({ upgrade }) => upgrade),
|
|
199072
|
-
reason: `Manifest file not valid for updates: ${manifestFile}`
|
|
199073
|
-
});
|
|
199074
|
-
}
|
|
199075
|
-
} else if (this.gradleLockfileMatcher(fileName3)) {
|
|
199076
|
-
patches.push({
|
|
199077
|
-
success: false,
|
|
199078
|
-
upgrades: upgradeArtifactPairs.map(({ upgrade }) => upgrade),
|
|
199079
|
-
reason: `Should have upgraded dependencies in grade lockfiles during first pass: ${manifestFile}`
|
|
199080
|
-
});
|
|
199081
|
-
} else {
|
|
199082
|
-
patches.push({
|
|
199083
|
-
success: false,
|
|
199084
|
-
upgrades: upgradeArtifactPairs.map(({ upgrade }) => upgrade),
|
|
199085
|
-
reason: `File does not match supported patterns: ${manifestFile}`
|
|
199086
|
-
});
|
|
198982
|
+
for (const manifestFile of manifestFilesForArtifact) {
|
|
198983
|
+
(upgradesByManifestFile[manifestFile] ??= []).push({ upgrade, artifact });
|
|
199087
198984
|
}
|
|
199088
198985
|
}
|
|
199089
|
-
for (const [manifestFile, upgradeArtifactPairs] of Object.entries(
|
|
198986
|
+
for (const [manifestFile, upgradeArtifactPairs] of Object.entries(upgradesByManifestFile)) {
|
|
199090
198987
|
const fileName3 = basename(manifestFile);
|
|
199091
198988
|
if (this.pomMatcher(fileName3)) {
|
|
199092
198989
|
const project = await loadPom(this.rootDir, manifestFile, validateFile);
|
|
199093
198990
|
if (project) {
|
|
199094
|
-
patches.push(...await this.handlePomFallback(project, upgradeArtifactPairs, rangeStyle
|
|
198991
|
+
patches.push(...await this.handlePomFallback(project, upgradeArtifactPairs, rangeStyle));
|
|
199095
198992
|
} else {
|
|
199096
198993
|
patches.push({
|
|
199097
198994
|
success: false,
|
|
@@ -199118,7 +199015,7 @@ var MavenSocketUpgradeManager = class {
|
|
|
199118
199015
|
/**
|
|
199119
199016
|
* Handle POM files for adding new managed dependencies
|
|
199120
199017
|
*/
|
|
199121
|
-
async handlePomFallback(pom, upgradeArtifactPairs, rangeStyle
|
|
199018
|
+
async handlePomFallback(pom, upgradeArtifactPairs, rangeStyle) {
|
|
199122
199019
|
const patches = [];
|
|
199123
199020
|
const dependencies = upgradeArtifactPairs.map(({ upgrade, artifact }) => {
|
|
199124
199021
|
assert3(artifact.namespace);
|
|
@@ -199136,36 +199033,19 @@ var MavenSocketUpgradeManager = class {
|
|
|
199136
199033
|
classifier: artifact.qualifiers?.classifier
|
|
199137
199034
|
};
|
|
199138
199035
|
});
|
|
199139
|
-
|
|
199140
|
-
|
|
199141
|
-
|
|
199142
|
-
|
|
199143
|
-
|
|
199144
|
-
|
|
199145
|
-
|
|
199146
|
-
});
|
|
199147
|
-
} else {
|
|
199148
|
-
patches.push({
|
|
199149
|
-
success: false,
|
|
199150
|
-
upgrades: upgradeArtifactPairs.map(({ upgrade }) => upgrade),
|
|
199151
|
-
reason: `Could not create dependency batch patch in ${relative4(pom.rootDir, pom.validatedPomFile)}`
|
|
199152
|
-
});
|
|
199153
|
-
}
|
|
199036
|
+
const patch = createDependenciesPatch(pom, dependencies);
|
|
199037
|
+
if (patch) {
|
|
199038
|
+
patches.push({
|
|
199039
|
+
success: true,
|
|
199040
|
+
upgrades: upgradeArtifactPairs.map(({ upgrade }) => upgrade),
|
|
199041
|
+
patch
|
|
199042
|
+
});
|
|
199154
199043
|
} else {
|
|
199155
|
-
|
|
199156
|
-
|
|
199157
|
-
|
|
199158
|
-
|
|
199159
|
-
|
|
199160
|
-
patch
|
|
199161
|
-
});
|
|
199162
|
-
} else {
|
|
199163
|
-
patches.push({
|
|
199164
|
-
success: false,
|
|
199165
|
-
upgrades: upgradeArtifactPairs.map(({ upgrade }) => upgrade),
|
|
199166
|
-
reason: `Could not create managed dependency batch patch in ${relative4(pom.rootDir, pom.validatedPomFile)}`
|
|
199167
|
-
});
|
|
199168
|
-
}
|
|
199044
|
+
patches.push({
|
|
199045
|
+
success: false,
|
|
199046
|
+
upgrades: upgradeArtifactPairs.map(({ upgrade }) => upgrade),
|
|
199047
|
+
reason: `Could not create dependency batch patch in ${relative4(pom.rootDir, pom.validatedPomFile)}`
|
|
199048
|
+
});
|
|
199169
199049
|
}
|
|
199170
199050
|
return patches;
|
|
199171
199051
|
}
|
|
@@ -207283,17 +207163,26 @@ var CargoFixingManager = class {
|
|
|
207283
207163
|
|
|
207284
207164
|
// ../fixing-management/src/fixing-management/nuget/nuget-socket-upgrade-manager.ts
|
|
207285
207165
|
var import_picomatch2 = __toESM(require_picomatch2(), 1);
|
|
207286
|
-
import { basename as
|
|
207166
|
+
import { basename as basename5, relative as relative10, resolve as resolve18 } from "node:path";
|
|
207287
207167
|
|
|
207288
207168
|
// ../fixing-management/src/fixing-management/nuget/nuget-project-utils.ts
|
|
207289
207169
|
var import_parse_xml3 = __toESM(require_dist(), 1);
|
|
207290
207170
|
import { readFile as readFile17 } from "node:fs/promises";
|
|
207291
|
-
import { dirname as dirname8, join as join12, relative as relative9, resolve as resolve17 } from "node:path";
|
|
207171
|
+
import { dirname as dirname8, join as join12, relative as relative9, resolve as resolve17, basename as basename4, extname } from "node:path";
|
|
207292
207172
|
import { existsSync as existsSync11 } from "node:fs";
|
|
207293
207173
|
function normalizeMSBuildPath(path2) {
|
|
207294
207174
|
return path2.replace(/\\/g, "/");
|
|
207295
207175
|
}
|
|
207296
|
-
async function loadNuGetProject(rootDir, projectFile, validateFile
|
|
207176
|
+
async function loadNuGetProject(rootDir, projectFile, validateFile) {
|
|
207177
|
+
return loadNuGetProjectOrTarget(
|
|
207178
|
+
rootDir,
|
|
207179
|
+
projectFile,
|
|
207180
|
+
void 0,
|
|
207181
|
+
new TransformMap((p3) => p3.toLocaleLowerCase()),
|
|
207182
|
+
validateFile
|
|
207183
|
+
);
|
|
207184
|
+
}
|
|
207185
|
+
async function loadNuGetProjectOrTarget(rootDir, projectFile, mainProject, visited, validateFile) {
|
|
207297
207186
|
const validatedProjectPath = validateFile(resolve17(rootDir, projectFile));
|
|
207298
207187
|
if (!validatedProjectPath || !existsSync11(validatedProjectPath)) return void 0;
|
|
207299
207188
|
if (visited.has(validatedProjectPath)) return void 0;
|
|
@@ -207301,7 +207190,7 @@ async function loadNuGetProject(rootDir, projectFile, validateFile, visited = ne
|
|
|
207301
207190
|
const sourceText = await readFile17(validatedProjectPath, "utf-8");
|
|
207302
207191
|
const xml2 = (0, import_parse_xml3.parseXml)(sourceText, { includeOffsets: true });
|
|
207303
207192
|
const indentation = inferIndentationFromParsedXml2(xml2, sourceText);
|
|
207304
|
-
const
|
|
207193
|
+
const currentProject = {
|
|
207305
207194
|
rootDir,
|
|
207306
207195
|
validatedProjectPath,
|
|
207307
207196
|
xml: xml2,
|
|
@@ -207309,34 +207198,44 @@ async function loadNuGetProject(rootDir, projectFile, validateFile, visited = ne
|
|
|
207309
207198
|
sourceText,
|
|
207310
207199
|
packageReferences: [],
|
|
207311
207200
|
packageVersions: [],
|
|
207312
|
-
properties: new TransformMap((p3) => p3.toLocaleLowerCase())
|
|
207313
|
-
visited
|
|
207201
|
+
properties: new TransformMap((p3) => p3.toLocaleLowerCase())
|
|
207314
207202
|
};
|
|
207315
|
-
|
|
207203
|
+
mainProject ??= currentProject;
|
|
207204
|
+
for (const directoryBuildPropsProject of await findDirectoryBuildPropsProjects(
|
|
207205
|
+
currentProject,
|
|
207206
|
+
mainProject,
|
|
207207
|
+
visited,
|
|
207208
|
+
validateFile
|
|
207209
|
+
)) {
|
|
207316
207210
|
for (const pkgRef of directoryBuildPropsProject.packageReferences) {
|
|
207317
|
-
|
|
207211
|
+
currentProject.packageReferences.push(pkgRef);
|
|
207318
207212
|
}
|
|
207319
207213
|
for (const pkgVer of directoryBuildPropsProject.packageVersions) {
|
|
207320
|
-
|
|
207214
|
+
currentProject.packageVersions.push(pkgVer);
|
|
207321
207215
|
}
|
|
207322
207216
|
for (const [name, property] of directoryBuildPropsProject.properties) {
|
|
207323
|
-
|
|
207217
|
+
currentProject.properties.set(name, property);
|
|
207324
207218
|
}
|
|
207325
207219
|
}
|
|
207326
|
-
const directoryPackagesPropsProject = await
|
|
207220
|
+
const directoryPackagesPropsProject = await findDirectoryPackagesPropsProject(
|
|
207221
|
+
currentProject,
|
|
207222
|
+
mainProject,
|
|
207223
|
+
visited,
|
|
207224
|
+
validateFile
|
|
207225
|
+
);
|
|
207327
207226
|
if (directoryPackagesPropsProject) {
|
|
207328
207227
|
for (const pkgRef of directoryPackagesPropsProject.packageReferences) {
|
|
207329
|
-
|
|
207228
|
+
currentProject.packageReferences.push(pkgRef);
|
|
207330
207229
|
}
|
|
207331
207230
|
for (const pkgVer of directoryPackagesPropsProject.packageVersions) {
|
|
207332
|
-
|
|
207231
|
+
currentProject.packageVersions.push(pkgVer);
|
|
207333
207232
|
}
|
|
207334
207233
|
for (const [name, property] of directoryPackagesPropsProject.properties) {
|
|
207335
|
-
|
|
207234
|
+
currentProject.properties.set(name, property);
|
|
207336
207235
|
}
|
|
207337
207236
|
}
|
|
207338
|
-
await extractProjectElements(
|
|
207339
|
-
return
|
|
207237
|
+
await extractProjectElements(currentProject, mainProject, visited, validateFile);
|
|
207238
|
+
return currentProject;
|
|
207340
207239
|
}
|
|
207341
207240
|
async function loadPackagesConfig(rootDir, file, validateFile) {
|
|
207342
207241
|
const validatedConfigPath = validateFile(resolve17(rootDir, file));
|
|
@@ -207378,18 +207277,19 @@ function extractPackagesFromXml(xmlDoc, fileContent) {
|
|
|
207378
207277
|
}
|
|
207379
207278
|
return packages;
|
|
207380
207279
|
}
|
|
207381
|
-
async function findDirectoryBuildPropsProjects(
|
|
207280
|
+
async function findDirectoryBuildPropsProjects(currentProject, mainProject, visited, validateFile) {
|
|
207382
207281
|
const projectsReverse = [];
|
|
207383
|
-
let currentDir = dirname8(
|
|
207384
|
-
while (currentDir.startsWith(
|
|
207282
|
+
let currentDir = dirname8(currentProject.validatedProjectPath);
|
|
207283
|
+
while (currentDir.startsWith(currentProject.rootDir) && currentDir !== dirname8(currentDir)) {
|
|
207385
207284
|
const unvalidatedPath = join12(currentDir, "Directory.Build.props");
|
|
207386
207285
|
const validatedPath = validateFile(unvalidatedPath);
|
|
207387
|
-
if (validatedPath && validatedPath !==
|
|
207388
|
-
const directoryBuildPropsProject = await
|
|
207389
|
-
|
|
207286
|
+
if (validatedPath && validatedPath !== currentProject.validatedProjectPath) {
|
|
207287
|
+
const directoryBuildPropsProject = await loadNuGetProjectOrTarget(
|
|
207288
|
+
currentProject.rootDir,
|
|
207390
207289
|
unvalidatedPath,
|
|
207391
|
-
|
|
207392
|
-
|
|
207290
|
+
mainProject,
|
|
207291
|
+
visited,
|
|
207292
|
+
validateFile
|
|
207393
207293
|
);
|
|
207394
207294
|
if (directoryBuildPropsProject) {
|
|
207395
207295
|
projectsReverse.push(directoryBuildPropsProject);
|
|
@@ -207399,53 +207299,93 @@ async function findDirectoryBuildPropsProjects(project, validateFile) {
|
|
|
207399
207299
|
}
|
|
207400
207300
|
return projectsReverse.reverse();
|
|
207401
207301
|
}
|
|
207402
|
-
async function
|
|
207403
|
-
let currentDir = dirname8(
|
|
207404
|
-
while (currentDir.startsWith(
|
|
207302
|
+
async function findDirectoryPackagesPropsProject(currentProject, mainProject, visited, validateFile) {
|
|
207303
|
+
let currentDir = dirname8(currentProject.validatedProjectPath);
|
|
207304
|
+
while (currentDir.startsWith(currentProject.rootDir) && currentDir !== dirname8(currentDir)) {
|
|
207405
207305
|
const unvalidatedPath = join12(currentDir, "Directory.Packages.props");
|
|
207406
207306
|
const validatedPath = validateFile(unvalidatedPath);
|
|
207407
207307
|
if (validatedPath) {
|
|
207408
|
-
return validatedPath !==
|
|
207308
|
+
return validatedPath !== currentProject.validatedProjectPath ? await loadNuGetProjectOrTarget(currentProject.rootDir, unvalidatedPath, mainProject, visited, validateFile) : void 0;
|
|
207409
207309
|
}
|
|
207410
207310
|
currentDir = dirname8(currentDir);
|
|
207411
207311
|
}
|
|
207412
207312
|
return void 0;
|
|
207413
207313
|
}
|
|
207414
|
-
|
|
207415
|
-
const
|
|
207314
|
+
function addReservedMSBuildProperties(currentProject, mainProject) {
|
|
207315
|
+
const reservedProperties = [
|
|
207316
|
+
// MSBuildProject* properties - always reference the main project file
|
|
207317
|
+
["MSBuildProjectDirectory", normalizeMSBuildPath(dirname8(mainProject.validatedProjectPath))],
|
|
207318
|
+
[
|
|
207319
|
+
"MSBuildProjectDirectoryNoRoot",
|
|
207320
|
+
normalizeMSBuildPath(dirname8(mainProject.validatedProjectPath)).replace(/^[A-Za-z]:/, "")
|
|
207321
|
+
],
|
|
207322
|
+
["MSBuildProjectExtension", extname(mainProject.validatedProjectPath)],
|
|
207323
|
+
["MSBuildProjectFile", basename4(mainProject.validatedProjectPath)],
|
|
207324
|
+
["MSBuildProjectFullPath", normalizeMSBuildPath(mainProject.validatedProjectPath)],
|
|
207325
|
+
["MSBuildProjectName", basename4(mainProject.validatedProjectPath, extname(mainProject.validatedProjectPath))],
|
|
207326
|
+
// MSBuildThisFile* properties - reference the current project being processed
|
|
207327
|
+
["MSBuildThisFile", basename4(currentProject.validatedProjectPath)],
|
|
207328
|
+
["MSBuildThisFileDirectory", normalizeMSBuildPath(dirname8(currentProject.validatedProjectPath)) + "/"],
|
|
207329
|
+
[
|
|
207330
|
+
"MSBuildThisFileDirectoryNoRoot",
|
|
207331
|
+
(normalizeMSBuildPath(dirname8(currentProject.validatedProjectPath)) + "/").replace(/^[A-Za-z]:/, "")
|
|
207332
|
+
],
|
|
207333
|
+
["MSBuildThisFileExtension", extname(currentProject.validatedProjectPath)],
|
|
207334
|
+
["MSBuildThisFileFullPath", normalizeMSBuildPath(currentProject.validatedProjectPath)],
|
|
207335
|
+
[
|
|
207336
|
+
"MSBuildThisFileName",
|
|
207337
|
+
basename4(currentProject.validatedProjectPath, extname(currentProject.validatedProjectPath))
|
|
207338
|
+
]
|
|
207339
|
+
];
|
|
207340
|
+
for (const [propertyName, propertyValue] of reservedProperties) {
|
|
207341
|
+
currentProject.properties.set(propertyName, {
|
|
207342
|
+
project: currentProject,
|
|
207343
|
+
text: propertyValue
|
|
207344
|
+
});
|
|
207345
|
+
}
|
|
207346
|
+
}
|
|
207347
|
+
async function extractProjectElements(currentProject, mainProject, visited, validateFile) {
|
|
207348
|
+
const projectElement = currentProject.xml.children.filter((child) => child instanceof import_parse_xml3.XmlElement).find((child) => child.name === "Project");
|
|
207416
207349
|
if (!projectElement) return;
|
|
207350
|
+
addReservedMSBuildProperties(currentProject, mainProject);
|
|
207417
207351
|
for (const element of projectElement.children.filter((child) => child instanceof import_parse_xml3.XmlElement)) {
|
|
207418
207352
|
switch (element.name) {
|
|
207419
207353
|
case "Import":
|
|
207420
|
-
await handleImportElement(
|
|
207354
|
+
await handleImportElement(currentProject, element, mainProject, visited, validateFile);
|
|
207421
207355
|
break;
|
|
207422
207356
|
case "ItemGroup":
|
|
207423
|
-
handleItemGroupElement(
|
|
207357
|
+
handleItemGroupElement(currentProject, element);
|
|
207424
207358
|
break;
|
|
207425
207359
|
case "PropertyGroup":
|
|
207426
|
-
handlePropertyGroupElement(
|
|
207360
|
+
handlePropertyGroupElement(currentProject, element);
|
|
207427
207361
|
break;
|
|
207428
207362
|
}
|
|
207429
207363
|
}
|
|
207430
207364
|
}
|
|
207431
|
-
async function handleImportElement(
|
|
207432
|
-
const projectValue = extractTextAndOffsetFromElementOrAttribute(
|
|
207365
|
+
async function handleImportElement(currentProject, importElement, mainProject, visited, validateFile) {
|
|
207366
|
+
const projectValue = extractTextAndOffsetFromElementOrAttribute(currentProject.sourceText, importElement, "Project");
|
|
207433
207367
|
if (!projectValue) return;
|
|
207434
|
-
const importPath = evaluate2(projectValue.text,
|
|
207368
|
+
const importPath = evaluate2(projectValue.text, currentProject);
|
|
207435
207369
|
if (!importPath) return;
|
|
207436
|
-
const resolvedPath = resolve17(dirname8(
|
|
207370
|
+
const resolvedPath = resolve17(dirname8(currentProject.validatedProjectPath), normalizeMSBuildPath(importPath));
|
|
207437
207371
|
const validatedPath = validateFile(resolvedPath);
|
|
207438
207372
|
if (!validatedPath || !existsSync11(validatedPath)) return;
|
|
207439
|
-
const importedProject = await
|
|
207373
|
+
const importedProject = await loadNuGetProjectOrTarget(
|
|
207374
|
+
currentProject.rootDir,
|
|
207375
|
+
resolvedPath,
|
|
207376
|
+
mainProject,
|
|
207377
|
+
visited,
|
|
207378
|
+
validateFile
|
|
207379
|
+
);
|
|
207440
207380
|
if (!importedProject) return;
|
|
207441
207381
|
for (const pkgRef of importedProject.packageReferences) {
|
|
207442
|
-
|
|
207382
|
+
currentProject.packageReferences.push(pkgRef);
|
|
207443
207383
|
}
|
|
207444
207384
|
for (const pkgVer of importedProject.packageVersions) {
|
|
207445
|
-
|
|
207385
|
+
currentProject.packageVersions.push(pkgVer);
|
|
207446
207386
|
}
|
|
207447
207387
|
for (const [name, property] of importedProject.properties) {
|
|
207448
|
-
|
|
207388
|
+
currentProject.properties.set(name, property);
|
|
207449
207389
|
}
|
|
207450
207390
|
}
|
|
207451
207391
|
function handleItemGroupElement(project, parent2) {
|
|
@@ -207504,14 +207444,11 @@ function handlePropertyGroupElement(project, propertyGroup) {
|
|
|
207504
207444
|
const propertyName = propertyElement.name;
|
|
207505
207445
|
const propertyValue = propertyElement.text;
|
|
207506
207446
|
if (propertyValue) {
|
|
207507
|
-
const openTagEnd = project.sourceText.indexOf(">", propertyElement.start) + 1;
|
|
207508
|
-
const closeTagStart = project.sourceText.lastIndexOf("<", propertyElement.end);
|
|
207509
|
-
const textRange = [openTagEnd, closeTagStart];
|
|
207510
207447
|
project.properties.set(propertyName, {
|
|
207511
207448
|
project,
|
|
207512
207449
|
parent: propertyGroup,
|
|
207513
207450
|
text: propertyValue,
|
|
207514
|
-
offset:
|
|
207451
|
+
offset: propertyElement.start + 2 + propertyName.length
|
|
207515
207452
|
});
|
|
207516
207453
|
}
|
|
207517
207454
|
}
|
|
@@ -207548,34 +207485,18 @@ function findPatchLocation2(file, textAndOffset, project) {
|
|
|
207548
207485
|
}
|
|
207549
207486
|
return chase(file, textAndOffset.text, textAndOffset.offset, 0);
|
|
207550
207487
|
}
|
|
207551
|
-
function
|
|
207552
|
-
|
|
207553
|
-
|
|
207554
|
-
const ancestorPackageReferences = project.packageReferences.filter(
|
|
207488
|
+
function findAncestorPackageReferenceDeclarations(project, ancestors) {
|
|
207489
|
+
return ancestors.flatMap(
|
|
207490
|
+
(ancestor) => project.packageReferences.filter(
|
|
207555
207491
|
(pkg) => evaluate2(pkg.name.text, project).toLowerCase() === ancestor.name.toLowerCase() && ancestor.version !== void 0 && (pkg.version === void 0 || versionSatisfiesSpecifier("NUGET", ancestor.version, evaluate2(pkg.version.text, project)))
|
|
207556
|
-
)
|
|
207557
|
-
for (const ancestorPackageReference of ancestorPackageReferences) {
|
|
207558
|
-
contexts.push(i3(ancestorPackageReference, ["project", "parent", "condition"]));
|
|
207559
|
-
}
|
|
207560
|
-
}
|
|
207561
|
-
return m(
|
|
207562
|
-
contexts,
|
|
207563
|
-
(a5, b) => a5.project.validatedProjectPath.toLocaleLowerCase() === b.project.validatedProjectPath.toLocaleLowerCase() && a5.parent === b.parent && a5.condition?.toLocaleLowerCase() === b.condition?.toLocaleLowerCase()
|
|
207492
|
+
)
|
|
207564
207493
|
);
|
|
207565
207494
|
}
|
|
207566
|
-
function
|
|
207567
|
-
|
|
207568
|
-
|
|
207569
|
-
const ancestorPackageVersions = project.packageVersions.filter(
|
|
207495
|
+
function findAncestorPackageVersionDeclarations(project, ancestors) {
|
|
207496
|
+
return ancestors.flatMap(
|
|
207497
|
+
(ancestor) => project.packageVersions.filter(
|
|
207570
207498
|
(pkg) => ancestor.version !== void 0 && evaluate2(pkg.name.text, project).toLowerCase() === ancestor.name.toLowerCase() && versionSatisfiesSpecifier("NUGET", ancestor.version, evaluate2(pkg.version.text, project))
|
|
207571
|
-
)
|
|
207572
|
-
for (const ancestorPackageVersion of ancestorPackageVersions) {
|
|
207573
|
-
contexts.push(i3(ancestorPackageVersion, ["project", "parent", "condition"]));
|
|
207574
|
-
}
|
|
207575
|
-
}
|
|
207576
|
-
return m(
|
|
207577
|
-
contexts,
|
|
207578
|
-
(a5, b) => a5.project.validatedProjectPath.toLocaleLowerCase() === b.project.validatedProjectPath.toLocaleLowerCase() && a5.parent === b.parent && a5.condition?.toLocaleLowerCase() === b.condition?.toLocaleLowerCase()
|
|
207499
|
+
)
|
|
207579
207500
|
);
|
|
207580
207501
|
}
|
|
207581
207502
|
function evaluate2(expression, project) {
|
|
@@ -207593,7 +207514,7 @@ function evaluate2(expression, project) {
|
|
|
207593
207514
|
if (property) {
|
|
207594
207515
|
return evaluateWithContext(property.text, depth + 1);
|
|
207595
207516
|
} else {
|
|
207596
|
-
logger.
|
|
207517
|
+
logger.debug(
|
|
207597
207518
|
`Unknown property ${propertyName} for project ${relative9(project.rootDir, project.validatedProjectPath)}`
|
|
207598
207519
|
);
|
|
207599
207520
|
return match2;
|
|
@@ -207663,7 +207584,7 @@ var NuGetSocketUpgradeManager = class {
|
|
|
207663
207584
|
lockFileMatcher = (0, import_picomatch2.default)("packages.lock.json");
|
|
207664
207585
|
truthyValues = ["true", "yes", "on"];
|
|
207665
207586
|
async applySocketArtifactUpgrades(manifestFiles, upgrades, artifacts, rangeStyle) {
|
|
207666
|
-
if (manifestFiles.find((f5) => this.lockFileMatcher(
|
|
207587
|
+
if (manifestFiles.find((f5) => this.lockFileMatcher(basename5(f5)))) {
|
|
207667
207588
|
throw Error(`Upgrading dependencies currently not supporte for NuGet projets with lockfiles`);
|
|
207668
207589
|
}
|
|
207669
207590
|
const caseInsensitiveManifestFileMap = new TransformMap((key) => key.toLowerCase());
|
|
@@ -207699,7 +207620,7 @@ var NuGetSocketUpgradeManager = class {
|
|
|
207699
207620
|
async collectPreparePatches(manifestFiles, validateFile) {
|
|
207700
207621
|
const patches = [];
|
|
207701
207622
|
for (const manifestFile of manifestFiles) {
|
|
207702
|
-
if (this.projectMatcher(
|
|
207623
|
+
if (this.projectMatcher(basename5(manifestFile))) {
|
|
207703
207624
|
const project = await loadNuGetProject(this.rootDir, manifestFile, validateFile);
|
|
207704
207625
|
if (project) {
|
|
207705
207626
|
for (const patch of await this.handleProjectPrepare(project)) {
|
|
@@ -207712,7 +207633,7 @@ var NuGetSocketUpgradeManager = class {
|
|
|
207712
207633
|
reason: `Manifest file not valid for updates: ${manifestFile}`
|
|
207713
207634
|
});
|
|
207714
207635
|
}
|
|
207715
|
-
} else if (this.packagesConfigMatcher(
|
|
207636
|
+
} else if (this.packagesConfigMatcher(basename5(manifestFile))) {
|
|
207716
207637
|
const packagesConfig = await loadPackagesConfig(this.rootDir, manifestFile, validateFile);
|
|
207717
207638
|
if (packagesConfig) {
|
|
207718
207639
|
for (const patch of await this.handlePackagesConfigPrepare(packagesConfig)) {
|
|
@@ -207767,12 +207688,12 @@ var NuGetSocketUpgradeManager = class {
|
|
|
207767
207688
|
}
|
|
207768
207689
|
}
|
|
207769
207690
|
} else {
|
|
207770
|
-
const patch = createPropertyPatch(
|
|
207691
|
+
const patch = centralPackageManagementProperty.parent ? createPropertyPatch(
|
|
207771
207692
|
centralPackageManagementProperty.project,
|
|
207772
207693
|
centralPackageManagementProperty.parent,
|
|
207773
207694
|
"CentralPackageTransitivePinningEnabled",
|
|
207774
207695
|
"true"
|
|
207775
|
-
);
|
|
207696
|
+
) : void 0;
|
|
207776
207697
|
if (patch) {
|
|
207777
207698
|
patches.push({
|
|
207778
207699
|
success: true,
|
|
@@ -207793,61 +207714,22 @@ var NuGetSocketUpgradeManager = class {
|
|
|
207793
207714
|
const patches = [];
|
|
207794
207715
|
return patches;
|
|
207795
207716
|
}
|
|
207796
|
-
/**
|
|
207797
|
-
* Collect patches for direct dependencies and Directory.Packages.props central management
|
|
207798
|
-
* This prioritizes updating existing dependencies and using central package management
|
|
207799
|
-
* Handles both direct dependencies (update existing) and transitive dependencies (add to Directory.Packages.props)
|
|
207800
|
-
*/
|
|
207801
207717
|
async collectUpdatePatches(upgrades, artifacts, rangeStyle, validateFile) {
|
|
207802
207718
|
const patches = [];
|
|
207803
207719
|
for (const upgrade of upgrades) {
|
|
207804
207720
|
const artifact = artifacts[upgrade.idx];
|
|
207805
|
-
const
|
|
207806
|
-
|
|
207807
|
-
|
|
207808
|
-
|
|
207809
|
-
|
|
207810
|
-
|
|
207811
|
-
patches.push(patch);
|
|
207812
|
-
}
|
|
207813
|
-
} else {
|
|
207814
|
-
patches.push({
|
|
207815
|
-
success: false,
|
|
207816
|
-
upgrades: [upgrade],
|
|
207817
|
-
reason: `Manifest file not valid for updates: ${manifestFile}`
|
|
207818
|
-
});
|
|
207819
|
-
}
|
|
207820
|
-
} else if (this.packagesConfigMatcher(basename4(manifestFile))) {
|
|
207821
|
-
const packagesConfig = await loadPackagesConfig(this.rootDir, manifestFile, validateFile);
|
|
207822
|
-
if (packagesConfig) {
|
|
207823
|
-
for (const patch of await this.handlePackagesConfig(packagesConfig, upgrade, artifact, "DIRECT")) {
|
|
207824
|
-
patches.push(patch);
|
|
207825
|
-
}
|
|
207826
|
-
} else {
|
|
207827
|
-
patches.push({
|
|
207828
|
-
success: false,
|
|
207829
|
-
upgrades: [upgrade],
|
|
207830
|
-
reason: `Manifest file not valid for updates: ${manifestFile}`
|
|
207831
|
-
});
|
|
207832
|
-
}
|
|
207833
|
-
} else {
|
|
207834
|
-
patches.push({
|
|
207835
|
-
success: false,
|
|
207836
|
-
upgrades: [upgrade],
|
|
207837
|
-
reason: `File does not match supported patterns: ${manifestFile}`
|
|
207838
|
-
});
|
|
207839
|
-
}
|
|
207840
|
-
}
|
|
207841
|
-
const ancestorManifestFiles = i(
|
|
207842
|
-
artifact.toplevelAncestors?.flatMap(
|
|
207843
|
-
(ancestorId) => artifacts.find((a5) => a5.id === ancestorId)?.manifestFiles?.map((m3) => m3.file) ?? []
|
|
207844
|
-
) ?? []
|
|
207721
|
+
const manifestFilesForArtifact = i(
|
|
207722
|
+
(artifact.manifestFiles?.map((ref) => ref.file) ?? []).concat(
|
|
207723
|
+
artifact.toplevelAncestors?.flatMap(
|
|
207724
|
+
(ancestorId) => artifacts.find((a5) => a5.id === ancestorId)?.manifestFiles?.map((m3) => m3.file) ?? []
|
|
207725
|
+
) ?? []
|
|
207726
|
+
)
|
|
207845
207727
|
);
|
|
207846
|
-
for (const manifestFile of
|
|
207847
|
-
if (this.projectMatcher(
|
|
207728
|
+
for (const manifestFile of manifestFilesForArtifact) {
|
|
207729
|
+
if (this.projectMatcher(basename5(manifestFile))) {
|
|
207848
207730
|
const project = await loadNuGetProject(this.rootDir, manifestFile, validateFile);
|
|
207849
207731
|
if (project) {
|
|
207850
|
-
for (const patch of await this.handleProject(project, upgrade, artifact, rangeStyle
|
|
207732
|
+
for (const patch of await this.handleProject(project, upgrade, artifact, rangeStyle)) {
|
|
207851
207733
|
patches.push(patch);
|
|
207852
207734
|
}
|
|
207853
207735
|
} else {
|
|
@@ -207857,10 +207739,10 @@ var NuGetSocketUpgradeManager = class {
|
|
|
207857
207739
|
reason: `Manifest file not valid for updates: ${manifestFile}`
|
|
207858
207740
|
});
|
|
207859
207741
|
}
|
|
207860
|
-
} else if (this.packagesConfigMatcher(
|
|
207742
|
+
} else if (this.packagesConfigMatcher(basename5(manifestFile))) {
|
|
207861
207743
|
const packagesConfig = await loadPackagesConfig(this.rootDir, manifestFile, validateFile);
|
|
207862
207744
|
if (packagesConfig) {
|
|
207863
|
-
for (const patch of await this.handlePackagesConfig(packagesConfig, upgrade, artifact
|
|
207745
|
+
for (const patch of await this.handlePackagesConfig(packagesConfig, upgrade, artifact)) {
|
|
207864
207746
|
patches.push(patch);
|
|
207865
207747
|
}
|
|
207866
207748
|
} else {
|
|
@@ -207881,7 +207763,7 @@ var NuGetSocketUpgradeManager = class {
|
|
|
207881
207763
|
}
|
|
207882
207764
|
return patches;
|
|
207883
207765
|
}
|
|
207884
|
-
async handleProject(project, upgrade, artifact, rangeStyle
|
|
207766
|
+
async handleProject(project, upgrade, artifact, rangeStyle) {
|
|
207885
207767
|
const patches = [];
|
|
207886
207768
|
assert5(artifact.name);
|
|
207887
207769
|
assert5(artifact.version);
|
|
@@ -207978,18 +207860,10 @@ var NuGetSocketUpgradeManager = class {
|
|
|
207978
207860
|
}
|
|
207979
207861
|
});
|
|
207980
207862
|
}
|
|
207981
|
-
if (kind === "DIRECT" && patches.length === 0) {
|
|
207982
|
-
patches.push({
|
|
207983
|
-
success: false,
|
|
207984
|
-
upgrades: [upgrade],
|
|
207985
|
-
reason: "Could not find patchable version location for direct dependency"
|
|
207986
|
-
});
|
|
207987
|
-
}
|
|
207988
207863
|
return patches;
|
|
207989
207864
|
}
|
|
207990
|
-
async handlePackagesConfig(packagesConfig, upgrade, artifact
|
|
207865
|
+
async handlePackagesConfig(packagesConfig, upgrade, artifact) {
|
|
207991
207866
|
const patches = [];
|
|
207992
|
-
if (kind === "ANCESTOR") return patches;
|
|
207993
207867
|
assert5(artifact.name);
|
|
207994
207868
|
assert5(artifact.version);
|
|
207995
207869
|
const packageName = artifact.name;
|
|
@@ -208016,22 +207890,8 @@ var NuGetSocketUpgradeManager = class {
|
|
|
208016
207890
|
});
|
|
208017
207891
|
}
|
|
208018
207892
|
});
|
|
208019
|
-
if (patches.length === 0) {
|
|
208020
|
-
patches.push({
|
|
208021
|
-
success: false,
|
|
208022
|
-
upgrades: [upgrade],
|
|
208023
|
-
reason: `Could not find patchable version location for packages.config file ${relative10(packagesConfig.rootDir, packagesConfig.validatedConfigPath)}`
|
|
208024
|
-
});
|
|
208025
|
-
}
|
|
208026
207893
|
return patches;
|
|
208027
207894
|
}
|
|
208028
|
-
/**
|
|
208029
|
-
* Collect fallback patches for remaining upgrades
|
|
208030
|
-
* This handles:
|
|
208031
|
-
* 1. Creating new PackageVersion entries in Directory.Packages.props for transitive dependencies
|
|
208032
|
-
* 2. Promoting remaining transitive dependencies to direct dependencies as a last resort
|
|
208033
|
-
* Groups multiple upgrades per manifest file for efficiency
|
|
208034
|
-
*/
|
|
208035
207895
|
async collectFallbackPatches(upgrades, artifacts, rangeStyle, validateFile) {
|
|
208036
207896
|
const patches = [];
|
|
208037
207897
|
for (const upgrade of upgrades) {
|
|
@@ -208039,7 +207899,7 @@ var NuGetSocketUpgradeManager = class {
|
|
|
208039
207899
|
const ancestors = (artifact.toplevelAncestors ?? []).map((ancestorId) => artifacts.find((a5) => a5.id === ancestorId)).filter((a5) => a5 !== void 0);
|
|
208040
207900
|
const ancestorManifestFiles = i(ancestors.flatMap((a5) => a5.manifestFiles?.map((m3) => m3.file) ?? []) ?? []);
|
|
208041
207901
|
for (const manifestFile of ancestorManifestFiles) {
|
|
208042
|
-
if (this.projectMatcher(
|
|
207902
|
+
if (this.projectMatcher(basename5(manifestFile))) {
|
|
208043
207903
|
const project = await loadNuGetProject(this.rootDir, manifestFile, validateFile);
|
|
208044
207904
|
if (project) {
|
|
208045
207905
|
for (const patch of await this.handleProjectFallback(project, upgrade, artifact, ancestors, rangeStyle)) {
|
|
@@ -208052,7 +207912,7 @@ var NuGetSocketUpgradeManager = class {
|
|
|
208052
207912
|
reason: `Manifest file not valid for updates: ${manifestFile}`
|
|
208053
207913
|
});
|
|
208054
207914
|
}
|
|
208055
|
-
} else if (this.packagesConfigMatcher(
|
|
207915
|
+
} else if (this.packagesConfigMatcher(basename5(manifestFile))) {
|
|
208056
207916
|
const packagesConfig = await loadPackagesConfig(this.rootDir, manifestFile, validateFile);
|
|
208057
207917
|
if (packagesConfig) {
|
|
208058
207918
|
for (const patch of await this.handlePackagesConfigFallback(packagesConfig, upgrade, artifact)) {
|
|
@@ -208080,16 +207940,19 @@ var NuGetSocketUpgradeManager = class {
|
|
|
208080
207940
|
const patches = [];
|
|
208081
207941
|
const centralPackageManagementProperty = project.properties.get("ManagePackageVersionsCentrally");
|
|
208082
207942
|
const centralPackageManagementEnabled = centralPackageManagementProperty && this.truthyValues.includes(evaluate2(centralPackageManagementProperty.text, project).toLowerCase());
|
|
208083
|
-
const [
|
|
207943
|
+
const [findAncestorDeclarations, createPatch] = centralPackageManagementEnabled ? [findAncestorPackageVersionDeclarations, createPackageVersionPatch] : [findAncestorPackageReferenceDeclarations, createPackageReferencePatch];
|
|
208084
207944
|
assert5(artifact.name);
|
|
208085
207945
|
assert5(artifact.version);
|
|
208086
207946
|
const nuGetVersion = NuGetVersion.parse(upgrade.upgradeVersion);
|
|
208087
207947
|
const nuGetRangePinned = new NuGetRange(nuGetVersion, true, nuGetVersion, true);
|
|
208088
207948
|
const versionSpec = rangeStyle === "pin" ? nuGetRangePinned.toString() : nuGetVersion.toString();
|
|
208089
|
-
const
|
|
208090
|
-
|
|
208091
|
-
|
|
208092
|
-
|
|
207949
|
+
const ancestorDeclarations = m(
|
|
207950
|
+
findAncestorDeclarations(project, ancestors),
|
|
207951
|
+
(a5, b) => a5.project.validatedProjectPath.toLocaleLowerCase() === b.project.validatedProjectPath.toLocaleLowerCase() && a5.parent === b.parent && a5.condition?.toLocaleLowerCase() === b.condition?.toLocaleLowerCase()
|
|
207952
|
+
);
|
|
207953
|
+
if (ancestorDeclarations.length > 0) {
|
|
207954
|
+
for (const decl of ancestorDeclarations) {
|
|
207955
|
+
const patch = createPatch(decl.project, decl.parent, artifact.name, versionSpec, decl.condition);
|
|
208093
207956
|
if (patch) {
|
|
208094
207957
|
patches.push({
|
|
208095
207958
|
success: true,
|
|
@@ -208108,7 +207971,7 @@ var NuGetSocketUpgradeManager = class {
|
|
|
208108
207971
|
patches.push({
|
|
208109
207972
|
success: false,
|
|
208110
207973
|
upgrades: [upgrade],
|
|
208111
|
-
reason: `Could not find
|
|
207974
|
+
reason: `Could not find declaration for top-level ancestor of transitive dependency in ${relative10(project.rootDir, project.validatedProjectPath)}`
|
|
208112
207975
|
});
|
|
208113
207976
|
}
|
|
208114
207977
|
return patches;
|
|
@@ -208142,28 +208005,33 @@ var NuGetSocketUpgradeManager = class {
|
|
|
208142
208005
|
};
|
|
208143
208006
|
|
|
208144
208007
|
// ../fixing-management/src/fixing-management/rust/cargo-socket-upgrade-manager.ts
|
|
208145
|
-
import { basename as
|
|
208008
|
+
import { basename as basename6, dirname as dirname9, join as join13, resolve as resolve19 } from "node:path";
|
|
208146
208009
|
var import_toml_eslint_parser2 = __toESM(require_lib10(), 1);
|
|
208147
208010
|
var import_picomatch3 = __toESM(require_picomatch2(), 1);
|
|
208148
208011
|
var import_semver3 = __toESM(require_semver2(), 1);
|
|
208149
208012
|
import assert6 from "node:assert";
|
|
208150
208013
|
import { readFile as readFile18 } from "node:fs/promises";
|
|
208014
|
+
import { existsSync as existsSync12 } from "node:fs";
|
|
208151
208015
|
var CargoSocketUpgradeManager = class {
|
|
208152
208016
|
constructor(rootDir) {
|
|
208153
208017
|
this.rootDir = rootDir;
|
|
208154
208018
|
}
|
|
208155
208019
|
cargoTomlMatcher = (0, import_picomatch3.default)("Cargo.toml");
|
|
208020
|
+
cargoLockMatcher = (0, import_picomatch3.default)("Cargo.lock");
|
|
208156
208021
|
async applySocketArtifactUpgrades(_manifestFiles, upgrades, artifacts, rangeStyle) {
|
|
208157
208022
|
const tomlPatches = await this.collectCargoTomlPatches(upgrades, artifacts, rangeStyle);
|
|
208158
208023
|
const lockPatches = await this.collectCargoLockPatches(upgrades, artifacts);
|
|
208159
208024
|
const successfulPatches = extractSuccessfulPatches(tomlPatches.concat(lockPatches));
|
|
208160
208025
|
await applySocketPatchResults("RUST", this.rootDir, successfulPatches);
|
|
208161
|
-
await asyncForEach(
|
|
208162
|
-
|
|
208163
|
-
|
|
208164
|
-
|
|
208026
|
+
await asyncForEach(
|
|
208027
|
+
i(successfulPatches.map((p3) => p3.patch.file)).filter((file) => this.cargoLockMatcher(basename6(file))),
|
|
208028
|
+
async (lockFile) => {
|
|
208029
|
+
const success = await execAndLogOnFailure(cmdt`cargo fetch`, dirname9(resolve19(this.rootDir, lockFile)));
|
|
208030
|
+
if (!success) {
|
|
208031
|
+
throw Error(`Could not update checksums in ${lockFile}`);
|
|
208032
|
+
}
|
|
208165
208033
|
}
|
|
208166
|
-
|
|
208034
|
+
);
|
|
208167
208035
|
}
|
|
208168
208036
|
/**
|
|
208169
208037
|
* Collect patches for Cargo.toml files (direct dependencies only)
|
|
@@ -208174,10 +208042,8 @@ var CargoSocketUpgradeManager = class {
|
|
|
208174
208042
|
assert6(artifact.name);
|
|
208175
208043
|
assert6(artifact.version);
|
|
208176
208044
|
const directManifestFiles = i(artifact.manifestFiles?.map((ref) => ref.file) ?? []);
|
|
208177
|
-
return asyncFlatMap(
|
|
208178
|
-
directManifestFiles.filter((manifestFile) =>
|
|
208179
|
-
return this.cargoTomlMatcher(basename5(manifestFile));
|
|
208180
|
-
}),
|
|
208045
|
+
return await asyncFlatMap(
|
|
208046
|
+
directManifestFiles.filter((manifestFile) => this.cargoTomlMatcher(basename6(manifestFile))),
|
|
208181
208047
|
async (manifestFile) => this.handleCargoToml(manifestFile, upgrade, artifact, rangeStyle)
|
|
208182
208048
|
);
|
|
208183
208049
|
});
|
|
@@ -208198,10 +208064,8 @@ var CargoSocketUpgradeManager = class {
|
|
|
208198
208064
|
)
|
|
208199
208065
|
);
|
|
208200
208066
|
return asyncFlatMap(
|
|
208201
|
-
ancestorManifestFiles.filter((manifestFile) =>
|
|
208202
|
-
|
|
208203
|
-
}),
|
|
208204
|
-
async (tomlFile) => this.handleCargoLock(join13(dirname9(tomlFile), "Cargo.lock"), upgrade, artifact)
|
|
208067
|
+
ancestorManifestFiles.filter((manifestFile) => this.cargoTomlMatcher(basename6(manifestFile))).map((tomlFile) => join13(dirname9(tomlFile), "Cargo.lock")).filter((lockFile) => existsSync12(resolve19(this.rootDir, lockFile))),
|
|
208068
|
+
async (lockFile) => this.handleCargoLock(lockFile, upgrade, artifact)
|
|
208205
208069
|
);
|
|
208206
208070
|
});
|
|
208207
208071
|
}
|
|
@@ -208343,7 +208207,7 @@ var CargoSocketUpgradeManager = class {
|
|
|
208343
208207
|
*/
|
|
208344
208208
|
createNewVersionString(currentVersion, newVersion, rangeStyle) {
|
|
208345
208209
|
if (rangeStyle === "pin") {
|
|
208346
|
-
return newVersion
|
|
208210
|
+
return `=${newVersion}`;
|
|
208347
208211
|
} else {
|
|
208348
208212
|
const specifierMatch = currentVersion.match(/^([^\d]*)/);
|
|
208349
208213
|
const specifier = specifierMatch ? specifierMatch[1] : "^";
|
|
@@ -208465,7 +208329,7 @@ async function applySocketUpgrades(ecosystem, rootDir, manifestFiles, upgrades,
|
|
|
208465
208329
|
|
|
208466
208330
|
// dist/cli-apply-fix.js
|
|
208467
208331
|
var import_lodash12 = __toESM(require_lodash(), 1);
|
|
208468
|
-
import { existsSync as
|
|
208332
|
+
import { existsSync as existsSync17 } from "fs";
|
|
208469
208333
|
|
|
208470
208334
|
// ../other-modules-communicator/src/other-modules-communicator.ts
|
|
208471
208335
|
import { execFileSync } from "child_process";
|
|
@@ -208482,9 +208346,9 @@ import { fileURLToPath as fileURLToPath3 } from "node:url";
|
|
|
208482
208346
|
// ../utils/dist/file-utils.js
|
|
208483
208347
|
var import_lodash5 = __toESM(require_lodash(), 1);
|
|
208484
208348
|
var import_micromatch = __toESM(require_micromatch(), 1);
|
|
208485
|
-
import { existsSync as
|
|
208349
|
+
import { existsSync as existsSync13 } from "fs";
|
|
208486
208350
|
import { access as access2, cp, readdir as readdir3, stat as stat2 } from "fs/promises";
|
|
208487
|
-
import { basename as
|
|
208351
|
+
import { basename as basename7, join as join14, relative as relative11, resolve as resolve20 } from "path";
|
|
208488
208352
|
var { uniq } = import_lodash5.default;
|
|
208489
208353
|
var { isMatch } = import_micromatch.default;
|
|
208490
208354
|
function* parents(dir) {
|
|
@@ -208497,7 +208361,7 @@ function* parents(dir) {
|
|
|
208497
208361
|
}
|
|
208498
208362
|
function findParent(dir, predicate, wholePath) {
|
|
208499
208363
|
for (const parent2 of parents(dir))
|
|
208500
|
-
if (predicate(wholePath ? parent2 :
|
|
208364
|
+
if (predicate(wholePath ? parent2 : basename7(parent2)))
|
|
208501
208365
|
return parent2;
|
|
208502
208366
|
}
|
|
208503
208367
|
|
|
@@ -209227,7 +209091,7 @@ async function detectVariantMaven(projectDir) {
|
|
|
209227
209091
|
}
|
|
209228
209092
|
|
|
209229
209093
|
// ../docker-management/src/maven/gradle-version-detector.ts
|
|
209230
|
-
import { existsSync as
|
|
209094
|
+
import { existsSync as existsSync14 } from "fs";
|
|
209231
209095
|
import { join as join17 } from "path";
|
|
209232
209096
|
import { readFile as readFile20 } from "fs/promises";
|
|
209233
209097
|
async function detectVariantGradle(projectDir) {
|
|
@@ -209235,7 +209099,7 @@ async function detectVariantGradle(projectDir) {
|
|
|
209235
209099
|
}
|
|
209236
209100
|
async function detect(projectDir) {
|
|
209237
209101
|
const gradleWrapperPropertiesPath = join17(projectDir, "gradle", "wrapper", "gradle-wrapper.properties");
|
|
209238
|
-
const gradleWrapperProperties =
|
|
209102
|
+
const gradleWrapperProperties = existsSync14(gradleWrapperPropertiesPath) ? (await readFile20(gradleWrapperPropertiesPath, "utf-8")).split("\n").map((line) => line.trim()).filter((line) => !line.startsWith("#")).filter((line) => line) : void 0;
|
|
209239
209103
|
if (!gradleWrapperProperties) return void 0;
|
|
209240
209104
|
const distributionUrlRegex = /.*gradle-(\d+(\.\d+(\.\d+)?)?)/;
|
|
209241
209105
|
for (const prop2 of gradleWrapperProperties) {
|
|
@@ -209249,7 +209113,7 @@ async function detect(projectDir) {
|
|
|
209249
209113
|
}
|
|
209250
209114
|
|
|
209251
209115
|
// ../docker-management/src/maven/sbt-version-detector.ts
|
|
209252
|
-
import { existsSync as
|
|
209116
|
+
import { existsSync as existsSync15 } from "fs";
|
|
209253
209117
|
import { join as join18 } from "path";
|
|
209254
209118
|
import { readFile as readFile21 } from "fs/promises";
|
|
209255
209119
|
async function detectVariantSbt(projectDir) {
|
|
@@ -209257,7 +209121,7 @@ async function detectVariantSbt(projectDir) {
|
|
|
209257
209121
|
}
|
|
209258
209122
|
async function detect2(projectDir) {
|
|
209259
209123
|
const sbtBuildPropertiesPath = join18(projectDir, "project", "build.properties");
|
|
209260
|
-
const sbtBuildProperties =
|
|
209124
|
+
const sbtBuildProperties = existsSync15(sbtBuildPropertiesPath) ? (await readFile21(sbtBuildPropertiesPath, "utf-8")).split("\n").map((line) => line.trim()).filter((line) => !line.startsWith("#")).filter((line) => line) : void 0;
|
|
209261
209125
|
if (!sbtBuildProperties) return void 0;
|
|
209262
209126
|
for (const prop2 of sbtBuildProperties) {
|
|
209263
209127
|
const [key, value] = prop2.split("=");
|
|
@@ -209378,9 +209242,9 @@ import { join as join21, posix as posix2, relative as relative13, sep as sep3 }
|
|
|
209378
209242
|
// ../utils/src/file-utils.ts
|
|
209379
209243
|
var import_lodash8 = __toESM(require_lodash(), 1);
|
|
209380
209244
|
var import_micromatch2 = __toESM(require_micromatch(), 1);
|
|
209381
|
-
import { existsSync as
|
|
209245
|
+
import { existsSync as existsSync16 } from "fs";
|
|
209382
209246
|
import { access as access3, cp as cp2, readdir as readdir4, stat as stat3 } from "fs/promises";
|
|
209383
|
-
import { basename as
|
|
209247
|
+
import { basename as basename8, join as join19, relative as relative12, resolve as resolve22 } from "path";
|
|
209384
209248
|
var { uniq: uniq2 } = import_lodash8.default;
|
|
209385
209249
|
var { isMatch: isMatch2 } = import_micromatch2.default;
|
|
209386
209250
|
function* parents2(dir) {
|
|
@@ -209393,7 +209257,7 @@ function* parents2(dir) {
|
|
|
209393
209257
|
}
|
|
209394
209258
|
function findParent2(dir, predicate, wholePath) {
|
|
209395
209259
|
for (const parent2 of parents2(dir))
|
|
209396
|
-
if (predicate(wholePath ? parent2 :
|
|
209260
|
+
if (predicate(wholePath ? parent2 : basename8(parent2))) return parent2;
|
|
209397
209261
|
}
|
|
209398
209262
|
async function getFilesRelative(dir, excludeDirs) {
|
|
209399
209263
|
async function helper(subDir, arrayOfFiles) {
|
|
@@ -210520,7 +210384,7 @@ async function verifyFixes(fixes, otherModulesCommunicator, rootPath) {
|
|
|
210520
210384
|
if (pathsForEachFixIdData.length !== new Set(pathsForEachFixIdData).size) {
|
|
210521
210385
|
throw new Error("Multiple fix IDs found for the same subproject, workspace and ecosystem");
|
|
210522
210386
|
}
|
|
210523
|
-
const subprojectsNotFound = uniq3(fixes.filter(({ vulnerabilityInstance: v }) => !
|
|
210387
|
+
const subprojectsNotFound = uniq3(fixes.filter(({ vulnerabilityInstance: v }) => !existsSync17(resolve24(rootPath, v.subprojectPath))).map(({ vulnerabilityInstance: v }) => `${v.subprojectPath}:${v.ecosystem}`));
|
|
210524
210388
|
if (subprojectsNotFound.length > 0) {
|
|
210525
210389
|
throw new Error(`Cannot find the following subprojects: ${subprojectsNotFound.join(", ")}`);
|
|
210526
210390
|
}
|
|
@@ -211326,12 +211190,12 @@ import { readdir as readdir6 } from "fs/promises";
|
|
|
211326
211190
|
import { join as join24, relative as relative14, resolve as resolve27 } from "path";
|
|
211327
211191
|
|
|
211328
211192
|
// ../project-management/src/project-management/ecosystem-management/ecosystem-specs.ts
|
|
211329
|
-
import { existsSync as
|
|
211193
|
+
import { existsSync as existsSync19 } from "fs";
|
|
211330
211194
|
import { readdir as readdir5, readFile as readFile25 } from "fs/promises";
|
|
211331
211195
|
import { join as join23, sep as sep4 } from "path";
|
|
211332
211196
|
|
|
211333
211197
|
// ../utils/src/pip-utils.ts
|
|
211334
|
-
import { existsSync as
|
|
211198
|
+
import { existsSync as existsSync18 } from "fs";
|
|
211335
211199
|
import { readFile as readFile24 } from "fs/promises";
|
|
211336
211200
|
import { resolve as resolve26 } from "path";
|
|
211337
211201
|
import util4 from "util";
|
|
@@ -211429,7 +211293,7 @@ function getEcosystemSpecs(ecosystems) {
|
|
|
211429
211293
|
}
|
|
211430
211294
|
function packageManagerIfPackageJSONExistsAndValid(packageManager) {
|
|
211431
211295
|
return async (projectDir) => {
|
|
211432
|
-
if (!
|
|
211296
|
+
if (!existsSync19(join23(projectDir, "package.json"))) return void 0;
|
|
211433
211297
|
const packageJSONPath = join23(projectDir, "package.json");
|
|
211434
211298
|
try {
|
|
211435
211299
|
JSON.parse(await readFile25(packageJSONPath, "utf-8"));
|
|
@@ -212117,16 +211981,16 @@ function isVulnChainWithParentsMap(v) {
|
|
|
212117
211981
|
var DEFAULT_REPORT_FILENAME_BASE = "coana-report";
|
|
212118
211982
|
|
|
212119
211983
|
// dist/internal/exclude-dirs-from-configuration-files.js
|
|
212120
|
-
import { existsSync as
|
|
211984
|
+
import { existsSync as existsSync20 } from "fs";
|
|
212121
211985
|
import { readFile as readFile26 } from "fs/promises";
|
|
212122
|
-
import { basename as
|
|
211986
|
+
import { basename as basename9, resolve as resolve29 } from "path";
|
|
212123
211987
|
var import_yaml2 = __toESM(require_dist11(), 1);
|
|
212124
211988
|
async function inferExcludeDirsFromConfigurationFiles(rootWorkingDir) {
|
|
212125
211989
|
const socketYmlConfigFile = resolve29(rootWorkingDir, "socket.yml");
|
|
212126
|
-
if (
|
|
211990
|
+
if (existsSync20(socketYmlConfigFile))
|
|
212127
211991
|
return inferExcludeDirsFromSocketConfig(socketYmlConfigFile);
|
|
212128
211992
|
const socketYamlConfigFile = resolve29(rootWorkingDir, "socket.yaml");
|
|
212129
|
-
if (
|
|
211993
|
+
if (existsSync20(socketYamlConfigFile))
|
|
212130
211994
|
return inferExcludeDirsFromSocketConfig(socketYamlConfigFile);
|
|
212131
211995
|
return void 0;
|
|
212132
211996
|
}
|
|
@@ -212139,7 +212003,7 @@ async function inferExcludeDirsFromSocketConfig(socketConfigFile) {
|
|
|
212139
212003
|
return void 0;
|
|
212140
212004
|
if (ignorePaths.some((ignorePath) => ignorePath.includes("!")))
|
|
212141
212005
|
return void 0;
|
|
212142
|
-
logger.info(`Inferring paths to exclude based on Socket config file: ${
|
|
212006
|
+
logger.info(`Inferring paths to exclude based on Socket config file: ${basename9(socketConfigFile)}`);
|
|
212143
212007
|
return config3.projectIgnorePaths;
|
|
212144
212008
|
} catch (e) {
|
|
212145
212009
|
return void 0;
|
|
@@ -212248,12 +212112,12 @@ function transformToVulnChainNode(dependencyTree) {
|
|
|
212248
212112
|
// dist/internal/socket-mode-helpers-socket-dependency-trees.js
|
|
212249
212113
|
var import_packageurl_js = __toESM(require_packageurl_js(), 1);
|
|
212250
212114
|
var import_picomatch4 = __toESM(require_picomatch2(), 1);
|
|
212251
|
-
import { basename as
|
|
212115
|
+
import { basename as basename10, dirname as dirname12, join as join25, sep as sep5 } from "path";
|
|
212252
212116
|
var REQUIREMENTS_FILES_SEARCH_DEPTH2 = 3;
|
|
212253
212117
|
function inferWorkspaceFromManifestPath(ecosystem, manifestPath, properPythonProjects) {
|
|
212254
212118
|
switch (ecosystem) {
|
|
212255
212119
|
case "NPM": {
|
|
212256
|
-
const base =
|
|
212120
|
+
const base = basename10(manifestPath);
|
|
212257
212121
|
const dir = dirname12(manifestPath);
|
|
212258
212122
|
return base === "package.json" ? dir || "." : void 0;
|
|
212259
212123
|
}
|
|
@@ -212261,7 +212125,7 @@ function inferWorkspaceFromManifestPath(ecosystem, manifestPath, properPythonPro
|
|
|
212261
212125
|
return ".";
|
|
212262
212126
|
}
|
|
212263
212127
|
case "PIP": {
|
|
212264
|
-
const base =
|
|
212128
|
+
const base = basename10(manifestPath);
|
|
212265
212129
|
const dir = dirname12(manifestPath);
|
|
212266
212130
|
const workspaceDir = dir === "" ? "." : dir;
|
|
212267
212131
|
if (properPythonProjects.includes(workspaceDir)) {
|
|
@@ -212287,7 +212151,7 @@ function inferWorkspaceFromManifestPath(ecosystem, manifestPath, properPythonPro
|
|
|
212287
212151
|
return dirname12(manifestPath) || ".";
|
|
212288
212152
|
}
|
|
212289
212153
|
case "GO": {
|
|
212290
|
-
const base =
|
|
212154
|
+
const base = basename10(manifestPath);
|
|
212291
212155
|
const dir = dirname12(manifestPath);
|
|
212292
212156
|
return base === "go.mod" ? dir || "." : void 0;
|
|
212293
212157
|
}
|
|
@@ -212299,7 +212163,7 @@ function inferWorkspaceFromManifestPath(ecosystem, manifestPath, properPythonPro
|
|
|
212299
212163
|
function inferProjectFromManifestPath(ecosystem, manifestPath) {
|
|
212300
212164
|
switch (ecosystem) {
|
|
212301
212165
|
case "NPM": {
|
|
212302
|
-
const filename =
|
|
212166
|
+
const filename = basename10(manifestPath);
|
|
212303
212167
|
if (["package-lock.json", "pnpm-lock.yaml", "pnpm-lock.yml", "yarn.lock"].includes(filename)) {
|
|
212304
212168
|
return dirname12(manifestPath) || ".";
|
|
212305
212169
|
}
|
|
@@ -212365,7 +212229,7 @@ async function fetchArtifactsFromSocket(rootWorkingDirectory, manifestsTarHash,
|
|
|
212365
212229
|
];
|
|
212366
212230
|
const allFiles = await getFilesRelative(rootWorkingDirectory, venvExcludes);
|
|
212367
212231
|
for (const file of allFiles) {
|
|
212368
|
-
const base =
|
|
212232
|
+
const base = basename10(file);
|
|
212369
212233
|
const workspaceDir = dirname12(file) || ".";
|
|
212370
212234
|
if (base === "pyproject.toml" || base === "setup.py" && await isSetupPySetuptools(join25(rootWorkingDirectory, file))) {
|
|
212371
212235
|
if (!properPythonProjects.includes(workspaceDir)) {
|
|
@@ -212389,11 +212253,11 @@ async function fetchArtifactsFromSocket(rootWorkingDirectory, manifestsTarHash,
|
|
|
212389
212253
|
const manifestFiles = [];
|
|
212390
212254
|
switch (ecosystem) {
|
|
212391
212255
|
case "MAVEN": {
|
|
212392
|
-
manifestFiles.push(...(await getFilesRelative(rootWorkingDirectory)).filter((file) => (0, import_picomatch4.default)("{{*-*.,}pom{.xml,},gradle.lockfile}")(
|
|
212256
|
+
manifestFiles.push(...(await getFilesRelative(rootWorkingDirectory)).filter((file) => (0, import_picomatch4.default)("{{*-*.,}pom{.xml,},gradle.lockfile}")(basename10(file))));
|
|
212393
212257
|
break;
|
|
212394
212258
|
}
|
|
212395
212259
|
case "NUGET": {
|
|
212396
|
-
manifestFiles.push(...(await getFilesRelative(rootWorkingDirectory)).filter((file) => (0, import_picomatch4.default)("{*.csproj,packages.lock.json}")(
|
|
212260
|
+
manifestFiles.push(...(await getFilesRelative(rootWorkingDirectory)).filter((file) => (0, import_picomatch4.default)("{*.csproj,packages.lock.json}")(basename10(file))));
|
|
212397
212261
|
break;
|
|
212398
212262
|
}
|
|
212399
212263
|
case "PIP": {
|
|
@@ -226222,7 +226086,7 @@ var { root: root2 } = static_exports;
|
|
|
226222
226086
|
|
|
226223
226087
|
// ../utils/src/maven-utils.ts
|
|
226224
226088
|
var import_lodash14 = __toESM(require_lodash(), 1);
|
|
226225
|
-
import { existsSync as
|
|
226089
|
+
import { existsSync as existsSync21, readdirSync as readdirSync4, statSync as statSync3 } from "fs";
|
|
226226
226090
|
import { join as join26 } from "path";
|
|
226227
226091
|
var { memoize: memoize3 } = import_lodash14.default;
|
|
226228
226092
|
var memoizedParseShellArgs = memoize3(parseShellArgs);
|
|
@@ -227594,7 +227458,7 @@ async function onlineScan(dependencyTree, apiKey, timeout) {
|
|
|
227594
227458
|
}
|
|
227595
227459
|
|
|
227596
227460
|
// dist/version.js
|
|
227597
|
-
var version2 = "14.12.
|
|
227461
|
+
var version2 = "14.12.29";
|
|
227598
227462
|
|
|
227599
227463
|
// dist/cli-core.js
|
|
227600
227464
|
var { mapValues, omit, partition, pick } = import_lodash15.default;
|