diff options
Diffstat (limited to 'deps/npm/node_modules/pacote/packument.js')
-rw-r--r-- | deps/npm/node_modules/pacote/packument.js | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/deps/npm/node_modules/pacote/packument.js b/deps/npm/node_modules/pacote/packument.js new file mode 100644 index 0000000000..0606b266f9 --- /dev/null +++ b/deps/npm/node_modules/pacote/packument.js @@ -0,0 +1,29 @@ +'use strict' + +const fetchPackument = require('./lib/fetch').packument +const optCheck = require('./lib/util/opt-check') +const pinflight = require('promise-inflight') +const npa = require('npm-package-arg') + +module.exports = packument +function packument (spec, opts) { + opts = optCheck(opts) + spec = npa(spec, opts.where) + + const label = [ + spec.name, + spec.saveSpec || spec.fetchSpec, + spec.type, + opts.cache, + opts.registry, + opts.scope + ].join(':') + const startTime = Date.now() + return pinflight(label, () => { + return fetchPackument(spec, opts) + }).then(p => { + const elapsedTime = Date.now() - startTime + opts.log.silly('pacote', `${spec.registry ? 'registry' : spec.type} packument for ${spec.name}@${spec.saveSpec || spec.fetchSpec} fetched in ${elapsedTime}ms`) + return p + }) +} |