pacote
Advanced tools
Comparing version 2.1.2 to 2.2.0
@@ -5,2 +5,18 @@ # Change Log | ||
<a name="2.2.0"></a> | ||
# [2.2.0](https://github.com/zkat/pacote/compare/v2.1.2...v2.2.0) (2017-04-22) | ||
### Bug Fixes | ||
* **git:** fix shortcut fallback order again ([5759d40](https://github.com/zkat/pacote/commit/5759d40)) | ||
* **registry:** fix infinite manifetch loop ([6c6a62b](https://github.com/zkat/pacote/commit/6c6a62b)) | ||
### Features | ||
* **manifest:** opts.fullMetadata to get unfiltered manifests ([ff2945b](https://github.com/zkat/pacote/commit/ff2945b)) | ||
<a name="2.1.2"></a> | ||
@@ -7,0 +23,0 @@ ## [2.1.2](https://github.com/zkat/pacote/compare/v2.1.1...v2.1.2) (2017-04-20) |
@@ -39,3 +39,3 @@ 'use strict' | ||
const cachedManifest = (opts.cache && key && !opts.preferOnline) | ||
const cachedManifest = (opts.cache && key && !opts.preferOnline && !opts.fullMetadata) | ||
? cache.get.info(opts.cache, key, opts) | ||
@@ -50,4 +50,4 @@ : BB.resolve(null) | ||
return pkg && pkg.name | ||
? new Manifest(pkg, props) | ||
: new Manifest(props) | ||
? new Manifest(pkg, props, opts.fullMetadata) | ||
: new Manifest(props, null, opts.fullMetadata) | ||
}).then(manifest => { | ||
@@ -73,4 +73,7 @@ const cacheKey = key || finalKey(manifest, spec) | ||
module.exports.Manifest = Manifest | ||
function Manifest (pkg, fromTarball) { | ||
function Manifest (pkg, fromTarball, fullMetadata) { | ||
fromTarball = fromTarball || {} | ||
if (fullMetadata) { | ||
Object.assign(this, pkg) | ||
} | ||
this.name = pkg.name | ||
@@ -77,0 +80,0 @@ this.version = pkg.version |
@@ -23,2 +23,10 @@ 'use strict' | ||
return BB.resolve(null).then(() => { | ||
if (!spec.hosted.git()) { | ||
throw new Error(`No git url for ${spec}`) | ||
} | ||
return plainManifest(spec.hosted.git(), spec, opts) | ||
}).catch(err => { | ||
if (!spec.hosted.https()) { | ||
throw err | ||
} | ||
return plainManifest(spec.hosted.https(), spec, opts) | ||
@@ -30,7 +38,2 @@ }).catch(err => { | ||
return plainManifest(spec.hosted.sshurl(), spec, opts) | ||
}).catch(err => { | ||
if (!spec.hosted.git()) { | ||
throw err | ||
} | ||
return plainManifest(spec.hosted.git(), spec, opts) | ||
}) | ||
@@ -37,0 +40,0 @@ } |
@@ -35,4 +35,10 @@ 'use strict' | ||
) | ||
opts.preferOffline = false | ||
opts.preferOnline = true | ||
return manifest(spec, opts) | ||
return fetchPackument(uri, spec, registry, opts).then(packument => { | ||
return pickManifest(packument, spec, { | ||
engineFilter: opts.engineFilter, | ||
defaultTag: opts.defaultTag | ||
}) | ||
}) | ||
} | ||
@@ -77,2 +83,9 @@ throw err | ||
const memo = opts.memoize && opts.memoize.get // `memoize` is a Map-like | ||
const cacheMode = opts.offline | ||
? 'only-if-cached' | ||
: opts.preferOffline | ||
? 'force-cache' | ||
: opts.preferOnline | ||
? 'no-cache' | ||
: 'default' | ||
return memo && memo.has(uri) ? BB.resolve(memo.get(uri)).then(p => { | ||
@@ -83,13 +96,9 @@ opts.log.http('registry:manifest', `MEMOIZED ${uri}`) | ||
agent: opts.agent, | ||
cache: opts.offline | ||
? 'only-if-cached' | ||
: opts.preferOffline | ||
? 'force-cache' | ||
: opts.preferOnline | ||
? 'no-cache' | ||
: 'default', | ||
cache: cacheMode, | ||
cacheManager: opts.cache, | ||
headers: { | ||
accept: opts.fullMetadata | ||
? 'application/json' | ||
// Corgis are cute. 🐕🐶 | ||
accept: 'application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*', | ||
: 'application/vnd.npm.install-v1+json; q=1.0, application/json; q=0.8, */*', | ||
authorization: (auth && auth.token && `Bearer ${auth.token}`) || '', | ||
@@ -96,0 +105,0 @@ 'npm-in-ci': opts.isFromCI, |
@@ -37,2 +37,3 @@ 'use strict' | ||
this.projectScope = opts.projectScope | ||
this.fullMetadata = opts.fullMetadata | ||
@@ -39,0 +40,0 @@ this.dirPacker = opts.dirPacker || null |
{ | ||
"name": "pacote", | ||
"version": "2.1.2", | ||
"version": "2.2.0", | ||
"description": "JavaScript package downloader", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
67508
1471