MCPcopy Index your code
hub / github.com/ember-cli/ember-cli / _checkManifest

Method _checkManifest

tests/helpers/package-cache.js:477–505  ·  view source on GitHub ↗

* The `_checkManifest` method compares the desired manifest to that which * exists in the cache. * * @private * @method _checkManifest * @param {String} label The label for the cache. * @param {String} type The type of package cache. * @param {String} manifest The contents of th

(label, type, manifest)

Source from the content-addressed store, hash-verified

475 * @return {Boolean} `true` if identical.
476 */
477 _checkManifest(label, type, manifest) {
478 let cachedManifest = this._readManifest(label, type);
479
480 if (cachedManifest === null) {
481 return false;
482 }
483
484 let parsedCached = JSON.parse(cachedManifest);
485 let parsedNew = JSON.parse(manifest);
486
487 // Only inspect the keys we care about.
488 // Invalidate the cache based off the private _packageCache key as well.
489 let keys = [].concat(DEPENDENCY_KEYS, '_packageCache');
490
491 let key, before, after;
492 for (let i = 0; i < keys.length; i++) {
493 key = keys[i];
494
495 // Empty keys are identical to undefined keys.
496 before = stableStringify(parsedCached[key]) || '{}';
497 after = stableStringify(parsedNew[key]) || '{}';
498
499 if (before !== after) {
500 return false;
501 }
502 }
503
504 return true;
505 }
506
507 /**
508 * The `_install` method installs the contents of the manifest into the

Callers 2

createMethod · 0.95

Calls 1

_readManifestMethod · 0.95

Tested by

no test coverage detected