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