@@ -40805,46 +40805,55 @@ class InstallationIntegrityChecker {
4080540805 this.config = config;
4080640806 }
4080740807
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+
4080840842 /**
4080940843 * Get the location of an existing integrity hash. If none exists then return the location where we should
4081040844 * write a new one.
4081140845 */
4081240846
4081340847 _getIntegrityHashLocation(usedRegistries) {
40814- var _this = this;
40848+ var _this2 = this;
4081540849
4081640850 return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () {
4081740851 let locationFolder;
4081840852
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);
4082140855 } 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);
4084840857 }
4084940858
4085040859 const locationPath = path.join(locationFolder, (_constants || _load_constants()).INTEGRITY_FILENAME);
@@ -40894,7 +40903,7 @@ class InstallationIntegrityChecker {
4089440903 */
4089540904
4089640905 _generateIntegrityFile(lockfile, patterns, flags, modulesFolder, artifacts) {
40897- var _this2 = this;
40906+ var _this3 = this;
4089840907
4089940908 return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () {
4090040909
@@ -40916,11 +40925,11 @@ class InstallationIntegrityChecker {
4091640925 result.flags.push('ignoreScripts');
4091740926 }
4091840927
40919- if (_this2 .config.production) {
40928+ if (_this3 .config.production) {
4092040929 result.flags.push('production');
4092140930 }
4092240931
40923- const linkedModules = _this2 .config.linkedModules;
40932+ const linkedModules = _this3 .config.linkedModules;
4092440933 if (linkedModules.length) {
4092540934 result.linkedModules = linkedModules.sort((_misc || _load_misc()).sortAlpha);
4092640935 }
@@ -40930,7 +40939,7 @@ class InstallationIntegrityChecker {
4093040939 });
4093140940
4093240941 if (flags.checkFiles) {
40933- result.files = yield _this2 ._getFilesDeep(modulesFolder);
40942+ result.files = yield _this3 ._getFilesDeep(modulesFolder);
4093440943 }
4093540944
4093640945 return result;
@@ -40950,7 +40959,7 @@ class InstallationIntegrityChecker {
4095040959 }
4095140960
4095240961 _compareIntegrityFiles(actual, expected, checkFiles, locationFolder) {
40953- var _this3 = this;
40962+ var _this4 = this;
4095440963
4095540964 return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () {
4095640965 if (!expected) {
@@ -40976,7 +40985,7 @@ class InstallationIntegrityChecker {
4097640985 if (expected.files.length === 0) {
4097740986 // edge case handling - --check-fies is passed but .yarn-integrity does not contain any files
4097840987 // 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);
4098040989 if (actualFiles.length > 0) {
4098140990 return 'FILES_MISSING';
4098240991 }
@@ -40994,25 +41003,26 @@ class InstallationIntegrityChecker {
4099441003 }
4099541004
4099641005 check(patterns, lockfile, flags) {
40997- var _this4 = this;
41006+ var _this5 = this;
4099841007
4099941008 return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () {
4100041009 // check if patterns exist in lockfile
4100141010 const missingPatterns = patterns.filter(function (p) {
4100241011 return !lockfile[p];
4100341012 });
41004- const loc = yield _this4._getIntegrityHashLocation();
41013+
41014+ const loc = yield _this5._getIntegrityHashLocation();
4100541015 if (missingPatterns.length || !loc.exists) {
4100641016 return {
4100741017 integrityFileMissing: !loc.exists,
4100841018 missingPatterns
4100941019 };
4101041020 }
4101141021
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);
4101641026
4101741027 return {
4101841028 integrityFileMissing: false,
@@ -41027,10 +41037,10 @@ class InstallationIntegrityChecker {
4102741037 * Get artifacts from integrity file if it exists.
4102841038 */
4102941039 getArtifacts() {
41030- var _this5 = this;
41040+ var _this6 = this;
4103141041
4103241042 return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () {
41033- const loc = yield _this5 ._getIntegrityHashLocation();
41043+ const loc = yield _this6 ._getIntegrityHashLocation();
4103441044 if (!loc.exists) {
4103541045 return null;
4103641046 }
@@ -41051,22 +41061,25 @@ class InstallationIntegrityChecker {
4105141061 * Write the integrity hash of the current install to disk.
4105241062 */
4105341063 save(patterns, lockfile, flags, usedRegistries, artifacts) {
41054- var _this6 = this;
41064+ var _this7 = this;
4105541065
4105641066 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);
4105841071 invariant(loc.locationPath, 'expected integrity hash location');
41072+
4105941073 yield (_fs || _load_fs()).mkdirp(path.dirname(loc.locationPath));
41060- const integrityFile = yield _this6._generateIntegrityFile(lockfile, patterns, flags, loc.locationFolder, artifacts);
4106141074 yield (_fs || _load_fs()).writeFile(loc.locationPath, JSON.stringify(integrityFile, null, 2));
4106241075 })();
4106341076 }
4106441077
4106541078 removeIntegrityFile() {
41066- var _this7 = this;
41079+ var _this8 = this;
4106741080
4106841081 return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () {
41069- const loc = yield _this7 ._getIntegrityHashLocation();
41082+ const loc = yield _this8 ._getIntegrityHashLocation();
4107041083 if (loc.exists) {
4107141084 yield (_fs || _load_fs()).unlink(loc.locationPath);
4107241085 }
@@ -54896,7 +54909,7 @@ class TarballFetcher extends (_baseFetcher || _load_baseFetcher()).default {
5489654909 const cachedStream = fs.createReadStream(tarballPath);
5489754910
5489854911 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)));
5490054913 });
5490154914 });
5490254915 })();
@@ -65126,7 +65139,7 @@ function extend() {
6512665139module.exports = {
6512765140 "name": "yarn",
6512865141 "installationMethod": "unknown",
65129- "version": "0.25.1 ",
65142+ "version": "0.25.3 ",
6513065143 "license": "BSD-2-Clause",
6513165144 "preferGlobal": true,
6513265145 "description": "📦🐈 Fast, reliable, and secure dependency management.",
@@ -75498,9 +75511,13 @@ class GitFetcher extends (_baseFetcher || _load_baseFetcher()).default {
7549875511
7549975512 const cachedStream = fs.createReadStream(tarballPath);
7550075513 cachedStream.pipe(hashStream).pipe(untarStream).on('finish', function () {
75514+
7550175515 const expectHash = _this2.hash;
7550275516 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) {
7550475521 resolve({
7550575522 hash: actualHash
7550675523 });
0 commit comments