maybeReadManifest(dir, priorityRegistry, isRoot = false) {
    var _this5 = this;

    return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () {
      const metadataLoc = path.join(dir, (_constants || _load_constants()).METADATA_FILENAME);

      if (yield (_fs || _load_fs()).exists(metadataLoc)) {
        const metadata = yield _this5.readJson(metadataLoc);

        if (!priorityRegistry) {
          priorityRegistry = metadata.priorityRegistry;
        }

        if (typeof metadata.manifest !== 'undefined') {
          return metadata.manifest;
        }
      }

      if (priorityRegistry) {
        const file = yield _this5.tryManifest(dir, priorityRegistry, isRoot);
        if (file) {
          return file;
        }
      }

      for (var _iterator5 = Object.keys((_index2 || _load_index2()).registries), _isArray5 = Array.isArray(_iterator5), _i6 = 0, _iterator5 = _isArray5 ? _iterator5 : _iterator5[Symbol.iterator]();;) {
        var _ref7;

        if (_isArray5) {
          if (_i6 >= _iterator5.length) break;
          _ref7 = _iterator5[_i6++];
        } else {
          _i6 = _iterator5.next();
          if (_i6.done) break;
          _ref7 = _i6.value;
        }

        const registry = _ref7;

        if (priorityRegistry === registry) {
          continue;
        }

        const file = yield _this5.tryManifest(dir, registry, isRoot);
        if (file) {
          return file;
        }
      }

      return null;
    })();
  }
try get the manifest file by looking
1. manifest file in cache
2. manifest file in registry