findVersionOnRegistry(pattern) {
    var _this = this;

    return (0, (_asyncToGenerator2 || _load_asyncToGenerator()).default)(function* () {
      var _ref = yield _this.normalize(pattern);

      const range = _ref.range,
            name = _ref.name;


      const exoticResolver = (0, (_index || _load_index()).getExoticResolver)(range);
      if (exoticResolver) {
        let data = yield _this.findExoticVersionInfo(exoticResolver, range);

        // clone data as we're manipulating it in place and this could be resolved multiple
        // times
        data = Object.assign({}, data);

        // this is so the returned package response uses the overridden name. ie. if the
        // package's actual name is `bar`, but it's been specified in the manifest like:
        //   "foo": "http://foo.com/bar.tar.gz"
        // then we use the foo name
        data.name = name;
        return data;
      }

      const Resolver = _this.getRegistryResolver();
      const resolver = new Resolver(_this, name, range);
      try {
        return yield resolver.resolve();
      } catch (err) {
        // if it is not an error thrown by yarn and it has a parent request,
        // thow a more readable error
        if (!(err instanceof (_errors || _load_errors()).MessageError) && _this.parentRequest && _this.parentRequest.pattern) {
          throw new (_errors || _load_errors()).MessageError(_this.reporter.lang('requiredPackageNotFoundRegistry', pattern, _this.parentRequest.pattern, _this.registry));
        }
        throw err;
      }
    })();
  }
If the input pattern matches a registry one then attempt to find it on the registry.
Otherwise fork off to an exotic resolver if one matches.