@@ -40805,46 +40805,55 @@ class InstallationIntegrityChecker {
40805
40805
this.config = config;
40806
40806
}
40807
40807
40808
+ _getModuleLocation(usedRegistries) {
40809
+ var _this = this;
40810
+
40811
+ return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () {
40812
+ // build up possible folders
40813
+ let registries = (_index || _load_index()).registryNames;
40814
+ if (usedRegistries && usedRegistries.size > 0) {
40815
+ registries = usedRegistries;
40816
+ }
40817
+ const possibleFolders = [];
40818
+ if (_this.config.modulesFolder) {
40819
+ possibleFolders.push(_this.config.modulesFolder);
40820
+ }
40821
+
40822
+ // ensure we only write to a registry folder that was used
40823
+ for (const name of registries) {
40824
+ const loc = path.join(_this.config.cwd, _this.config.registries[name].folder);
40825
+ possibleFolders.push(loc);
40826
+ }
40827
+
40828
+ // if we already have an integrity hash in one of these folders then use it's location otherwise use the
40829
+ // first folder
40830
+ let loc;
40831
+ for (const possibleLoc of possibleFolders) {
40832
+ if (yield (_fs || _load_fs()).exists(path.join(possibleLoc, (_constants || _load_constants()).INTEGRITY_FILENAME))) {
40833
+ loc = possibleLoc;
40834
+ break;
40835
+ }
40836
+ }
40837
+
40838
+ return loc || possibleFolders[0];
40839
+ })();
40840
+ }
40841
+
40808
40842
/**
40809
40843
* Get the location of an existing integrity hash. If none exists then return the location where we should
40810
40844
* write a new one.
40811
40845
*/
40812
40846
40813
40847
_getIntegrityHashLocation(usedRegistries) {
40814
- var _this = this;
40848
+ var _this2 = this;
40815
40849
40816
40850
return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () {
40817
40851
let locationFolder;
40818
40852
40819
- if (_this .config.enableMetaFolder) {
40820
- locationFolder = path.join(_this .config.cwd, (_constants || _load_constants()).META_FOLDER);
40853
+ if (_this2 .config.enableMetaFolder) {
40854
+ locationFolder = path.join(_this2 .config.cwd, (_constants || _load_constants()).META_FOLDER);
40821
40855
} else {
40822
- // build up possible folders
40823
- let registries = (_index || _load_index()).registryNames;
40824
- if (usedRegistries && usedRegistries.size > 0) {
40825
- registries = usedRegistries;
40826
- }
40827
- const possibleFolders = [];
40828
- if (_this.config.modulesFolder) {
40829
- possibleFolders.push(_this.config.modulesFolder);
40830
- }
40831
-
40832
- // ensure we only write to a registry folder that was used
40833
- for (const name of registries) {
40834
- const loc = path.join(_this.config.cwd, _this.config.registries[name].folder);
40835
- possibleFolders.push(loc);
40836
- }
40837
-
40838
- // if we already have an integrity hash in one of these folders then use it's location otherwise use the
40839
- // first folder
40840
- let loc;
40841
- for (const possibleLoc of possibleFolders) {
40842
- if (yield (_fs || _load_fs()).exists(path.join(possibleLoc, (_constants || _load_constants()).INTEGRITY_FILENAME))) {
40843
- loc = possibleLoc;
40844
- break;
40845
- }
40846
- }
40847
- locationFolder = loc || possibleFolders[0];
40856
+ locationFolder = yield _this2._getModuleLocation(usedRegistries);
40848
40857
}
40849
40858
40850
40859
const locationPath = path.join(locationFolder, (_constants || _load_constants()).INTEGRITY_FILENAME);
@@ -40894,7 +40903,7 @@ class InstallationIntegrityChecker {
40894
40903
*/
40895
40904
40896
40905
_generateIntegrityFile(lockfile, patterns, flags, modulesFolder, artifacts) {
40897
- var _this2 = this;
40906
+ var _this3 = this;
40898
40907
40899
40908
return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () {
40900
40909
@@ -40916,11 +40925,11 @@ class InstallationIntegrityChecker {
40916
40925
result.flags.push('ignoreScripts');
40917
40926
}
40918
40927
40919
- if (_this2 .config.production) {
40928
+ if (_this3 .config.production) {
40920
40929
result.flags.push('production');
40921
40930
}
40922
40931
40923
- const linkedModules = _this2 .config.linkedModules;
40932
+ const linkedModules = _this3 .config.linkedModules;
40924
40933
if (linkedModules.length) {
40925
40934
result.linkedModules = linkedModules.sort((_misc || _load_misc()).sortAlpha);
40926
40935
}
@@ -40930,7 +40939,7 @@ class InstallationIntegrityChecker {
40930
40939
});
40931
40940
40932
40941
if (flags.checkFiles) {
40933
- result.files = yield _this2 ._getFilesDeep(modulesFolder);
40942
+ result.files = yield _this3 ._getFilesDeep(modulesFolder);
40934
40943
}
40935
40944
40936
40945
return result;
@@ -40950,7 +40959,7 @@ class InstallationIntegrityChecker {
40950
40959
}
40951
40960
40952
40961
_compareIntegrityFiles(actual, expected, checkFiles, locationFolder) {
40953
- var _this3 = this;
40962
+ var _this4 = this;
40954
40963
40955
40964
return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () {
40956
40965
if (!expected) {
@@ -40976,7 +40985,7 @@ class InstallationIntegrityChecker {
40976
40985
if (expected.files.length === 0) {
40977
40986
// edge case handling - --check-fies is passed but .yarn-integrity does not contain any files
40978
40987
// check and fail if there are file in node_modules after all.
40979
- const actualFiles = yield _this3 ._getFilesDeep(locationFolder);
40988
+ const actualFiles = yield _this4 ._getFilesDeep(locationFolder);
40980
40989
if (actualFiles.length > 0) {
40981
40990
return 'FILES_MISSING';
40982
40991
}
@@ -40994,25 +41003,26 @@ class InstallationIntegrityChecker {
40994
41003
}
40995
41004
40996
41005
check(patterns, lockfile, flags) {
40997
- var _this4 = this;
41006
+ var _this5 = this;
40998
41007
40999
41008
return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () {
41000
41009
// check if patterns exist in lockfile
41001
41010
const missingPatterns = patterns.filter(function (p) {
41002
41011
return !lockfile[p];
41003
41012
});
41004
- const loc = yield _this4._getIntegrityHashLocation();
41013
+
41014
+ const loc = yield _this5._getIntegrityHashLocation();
41005
41015
if (missingPatterns.length || !loc.exists) {
41006
41016
return {
41007
41017
integrityFileMissing: !loc.exists,
41008
41018
missingPatterns
41009
41019
};
41010
41020
}
41011
41021
41012
- const actual = yield _this4 ._generateIntegrityFile(lockfile, patterns, Object.assign({}, { checkFiles: false }, flags), // don't generate files when checking, we check the files below
41013
- loc.locationFolder );
41014
- const expected = yield _this4 ._getIntegrityFile(loc.locationPath);
41015
- const integrityMatches = yield _this4 ._compareIntegrityFiles(actual, expected, flags.checkFiles, loc.locationFolder);
41022
+ const actual = yield _this5 ._generateIntegrityFile(lockfile, patterns, Object.assign({}, flags, { checkFiles: false }), ( // don't generate files when checking, we check the files below
41023
+ yield _this5._getModuleLocation()) );
41024
+ const expected = yield _this5 ._getIntegrityFile(loc.locationPath);
41025
+ const integrityMatches = yield _this5 ._compareIntegrityFiles(actual, expected, flags.checkFiles, loc.locationFolder);
41016
41026
41017
41027
return {
41018
41028
integrityFileMissing: false,
@@ -41027,10 +41037,10 @@ class InstallationIntegrityChecker {
41027
41037
* Get artifacts from integrity file if it exists.
41028
41038
*/
41029
41039
getArtifacts() {
41030
- var _this5 = this;
41040
+ var _this6 = this;
41031
41041
41032
41042
return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () {
41033
- const loc = yield _this5 ._getIntegrityHashLocation();
41043
+ const loc = yield _this6 ._getIntegrityHashLocation();
41034
41044
if (!loc.exists) {
41035
41045
return null;
41036
41046
}
@@ -41051,22 +41061,25 @@ class InstallationIntegrityChecker {
41051
41061
* Write the integrity hash of the current install to disk.
41052
41062
*/
41053
41063
save(patterns, lockfile, flags, usedRegistries, artifacts) {
41054
- var _this6 = this;
41064
+ var _this7 = this;
41055
41065
41056
41066
return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () {
41057
- const loc = yield _this6._getIntegrityHashLocation(usedRegistries);
41067
+ const moduleFolder = yield _this7._getModuleLocation(usedRegistries);
41068
+ const integrityFile = yield _this7._generateIntegrityFile(lockfile, patterns, flags, moduleFolder, artifacts);
41069
+
41070
+ const loc = yield _this7._getIntegrityHashLocation(usedRegistries);
41058
41071
invariant(loc.locationPath, 'expected integrity hash location');
41072
+
41059
41073
yield (_fs || _load_fs()).mkdirp(path.dirname(loc.locationPath));
41060
- const integrityFile = yield _this6._generateIntegrityFile(lockfile, patterns, flags, loc.locationFolder, artifacts);
41061
41074
yield (_fs || _load_fs()).writeFile(loc.locationPath, JSON.stringify(integrityFile, null, 2));
41062
41075
})();
41063
41076
}
41064
41077
41065
41078
removeIntegrityFile() {
41066
- var _this7 = this;
41079
+ var _this8 = this;
41067
41080
41068
41081
return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () {
41069
- const loc = yield _this7 ._getIntegrityHashLocation();
41082
+ const loc = yield _this8 ._getIntegrityHashLocation();
41070
41083
if (loc.exists) {
41071
41084
yield (_fs || _load_fs()).unlink(loc.locationPath);
41072
41085
}
@@ -54896,7 +54909,7 @@ class TarballFetcher extends (_baseFetcher || _load_baseFetcher()).default {
54896
54909
const cachedStream = fs.createReadStream(tarballPath);
54897
54910
54898
54911
cachedStream.pipe(validateStream).pipe(extractorStream).on('error', function (err) {
54899
- reject(new (_errors || _load_errors()).MessageError(this .config.reporter.lang('fetchErrorCorrupt', err.message, tarballPath)));
54912
+ reject(new (_errors || _load_errors()).MessageError(_this3 .config.reporter.lang('fetchErrorCorrupt', err.message, tarballPath)));
54900
54913
});
54901
54914
});
54902
54915
})();
@@ -65126,7 +65139,7 @@ function extend() {
65126
65139
module.exports = {
65127
65140
"name": "yarn",
65128
65141
"installationMethod": "unknown",
65129
- "version": "0.25.1 ",
65142
+ "version": "0.25.3 ",
65130
65143
"license": "BSD-2-Clause",
65131
65144
"preferGlobal": true,
65132
65145
"description": "📦🐈 Fast, reliable, and secure dependency management.",
@@ -75498,9 +75511,13 @@ class GitFetcher extends (_baseFetcher || _load_baseFetcher()).default {
75498
75511
75499
75512
const cachedStream = fs.createReadStream(tarballPath);
75500
75513
cachedStream.pipe(hashStream).pipe(untarStream).on('finish', function () {
75514
+
75501
75515
const expectHash = _this2.hash;
75502
75516
const actualHash = hashStream.getHash();
75503
- if (!expectHash || expectHash === actualHash) {
75517
+
75518
+ // This condition is disabled because "expectHash" actually is the commit hash
75519
+ // This is a design issue that we'll need to fix (https://github.com/yarnpkg/yarn/pull/3449)
75520
+ if (true) {
75504
75521
resolve({
75505
75522
hash: actualHash
75506
75523
});
0 commit comments