remote.js 856 B

12345678910111213141516171819202122232425262728293031323334
  1. 'use strict'
  2. const BB = require('bluebird')
  3. const Fetcher = require('../fetch')
  4. const fetchRegistry = require('./registry')
  5. const fetchRemote = module.exports = Object.create(null)
  6. Fetcher.impl(fetchRemote, {
  7. packument (spec, opts) {
  8. return BB.reject(new Error('Not implemented yet'))
  9. },
  10. manifest (spec, opts) {
  11. // We can't get the manifest for a remote tarball until
  12. // we extract the tarball itself.
  13. // `finalize-manifest` takes care of this process of extracting
  14. // a manifest based on ./tarball.js
  15. return BB.resolve(null)
  16. },
  17. tarball (spec, opts) {
  18. const uri = spec._resolved || spec.fetchSpec
  19. return fetchRegistry.fromManifest({
  20. _resolved: uri,
  21. _integrity: opts.integrity
  22. }, spec, opts)
  23. },
  24. fromManifest (manifest, spec, opts) {
  25. return this.tarball(manifest || spec, opts)
  26. }
  27. })