docs: function resolveVersion(plugin) {
      var npmId = Plugin.nameToNpmID(plugin.getName());
      var requiredVersion = plugin.getVersion();
  
      if (plugin.isGitDependency()) {
          return Promise.resolve(requiredVersion);
      }
  
      return initNPM()
      .then(function() {
          return Promise.nfcall(npm.commands.view, [npmId + '@' + requiredVersion, 'engines'], true);
      })
      .then(function(versions) {
          versions = Immutable.Map(versions).entrySeq();
  
          var result = versions
              .map(function(entry) {
                  return {
                      version: entry[0],
                      gitbook: (entry[1].engines || {}).gitbook
                  };
              })
              .filter(function(v) {
                  return v.gitbook && gitbook.satisfies(v.gitbook);
              })
              .sort(function(v1, v2) {
                  return semver.lt(v1.version, v2.version)? 1 : -1;
              })
              .get(0);
  
          if (!result) {
              return undefined;
          } else {
              return result.version;
          }
      });
  }