MCPcopy
hub / github.com/vercel/hyper / check

Method check

bin/yarn-standalone.js:48429–48481  ·  view source on GitHub ↗
(patterns, lockfile, flags, workspaceLayout)

Source from the content-addressed store, hash-verified

48427 }
48428
48429 check(patterns, lockfile, flags, workspaceLayout) {
48430 var _this4 = this;
48431
48432 return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () {
48433 // check if patterns exist in lockfile
48434 const missingPatterns = patterns.filter(function (p) {
48435 return !lockfile[p] && (!workspaceLayout || !workspaceLayout.getManifestByPattern(p));
48436 });
48437
48438 const loc = yield _this4._getIntegrityFileLocation();
48439 if (missingPatterns.length || !loc.exists) {
48440 return {
48441 integrityFileMissing: !loc.exists,
48442 missingPatterns
48443 };
48444 }
48445
48446 const actual = yield _this4._generateIntegrityFile(lockfile, patterns, flags, workspaceLayout);
48447
48448 const expected = yield _this4._getIntegrityFile(loc.locationPath);
48449 let integrityMatches = _this4._compareIntegrityFiles(actual, expected, flags.checkFiles, workspaceLayout);
48450
48451 if (integrityMatches === 'OK') {
48452 invariant(expected, "The integrity shouldn't pass without integrity file");
48453 for (var _iterator11 = expected.modulesFolders, _isArray11 = Array.isArray(_iterator11), _i11 = 0, _iterator11 = _isArray11 ? _iterator11 : _iterator11[Symbol.iterator]();;) {
48454 var _ref12;
48455
48456 if (_isArray11) {
48457 if (_i11 >= _iterator11.length) break;
48458 _ref12 = _iterator11[_i11++];
48459 } else {
48460 _i11 = _iterator11.next();
48461 if (_i11.done) break;
48462 _ref12 = _i11.value;
48463 }
48464
48465 const modulesFolder = _ref12;
48466
48467 if (!(yield (_fs || _load_fs()).exists(path.join(_this4.config.lockfileFolder, modulesFolder)))) {
48468 integrityMatches = 'MODULES_FOLDERS_MISSING';
48469 }
48470 }
48471 }
48472
48473 return {
48474 integrityFileMissing: false,
48475 integrityMatches: integrityMatches === 'OK',
48476 integrityError: integrityMatches === 'OK' ? undefined : integrityMatches,
48477 missingPatterns,
48478 hardRefreshRequired: integrityMatches === 'SYSTEM_PARAMS_DONT_MATCH'
48479 };
48480 })();
48481 }
48482
48483 /**
48484 * Get artifacts from integrity file if it exists.

Callers 7

_setExportsFunction · 0.80
bailoutMethod · 0.80
initMethod · 0.80
hydrateMethod · 0.80
bailoutMethod · 0.80
yarn-standalone.jsFile · 0.80
initMethod · 0.80

Calls 10

_load_asyncToGeneratorFunction · 0.85
invariantFunction · 0.85
_load_fsFunction · 0.85
filterMethod · 0.80
getManifestByPatternMethod · 0.80
_getIntegrityFileMethod · 0.80
nextMethod · 0.45

Tested by

no test coverage detected