Comparing version 2.3.2 to 2.4.0
@@ -5,2 +5,18 @@ # Change Log | ||
<a name="2.4.0"></a> | ||
# [2.4.0](https://github.com/zkat/pacote/compare/v2.3.2...v2.4.0) (2017-04-27) | ||
### Bug Fixes | ||
* **tests:** nicer error message on registry 404 ([e8e71c8](https://github.com/zkat/pacote/commit/e8e71c8)) | ||
### Features | ||
* **auth:** added basic auth and always-auth support ([548aeb5](https://github.com/zkat/pacote/commit/548aeb5)) | ||
* **proxy:** proxy support for registry and remote deps ([3766bbb](https://github.com/zkat/pacote/commit/3766bbb)) | ||
<a name="2.3.2"></a> | ||
@@ -7,0 +23,0 @@ ## [2.3.2](https://github.com/zkat/pacote/compare/v2.3.1...v2.3.2) (2017-04-26) |
'use strict' | ||
const Buffer = require('safe-buffer').Buffer | ||
const checkWarnings = require('./check-warning-header') | ||
@@ -18,2 +20,3 @@ const fetch = require('make-fetch-happen') | ||
integrity: opts.integrity, | ||
noProxy: opts.noProxy, | ||
proxy: opts.proxy, | ||
@@ -39,5 +42,9 @@ referer: opts.refer, | ||
if (res.status >= 400) { | ||
const err = new Error(`${res.statusText}: ${uri}`) | ||
const err = new Error(`${res.status} ${res.statusText}: ${ | ||
opts.spec ? opts.spec : uri | ||
}`) | ||
err.code = `E${res.status}` | ||
err.uri = uri | ||
err.response = res | ||
err.spec = opts.spec | ||
throw err | ||
@@ -76,4 +83,9 @@ } else { | ||
headers.authorization = `Bearer ${auth.token}` | ||
} else if (auth && opts.alwaysAuth && auth.username && auth.password) { | ||
const encoded = Buffer.from( | ||
`${auth.username}:${auth.password}`, 'utf8' | ||
).toString('base64') | ||
headers.authorization = `Basic ${encoded}` | ||
} | ||
return headers | ||
} |
@@ -84,3 +84,4 @@ 'use strict' | ||
accept: opts.fullMetadata ? JSON_DOC : CORGI_DOC | ||
} | ||
}, | ||
spec | ||
}, opts)).then(res => res.json().then(packument => { | ||
@@ -87,0 +88,0 @@ packument._cached = res.headers.has('x-local-cache') |
@@ -48,3 +48,4 @@ 'use strict' | ||
: 'sha1' | ||
] | ||
], | ||
spec | ||
}, opts)).then(res => { | ||
@@ -51,0 +52,0 @@ stream.emit('integrity', res.headers.get('x-local-cache-hash')) |
@@ -21,2 +21,3 @@ 'use strict' | ||
this.proxy = opts.proxy | ||
this.noProxy = opts.noProxy | ||
this.registry = opts.registry || 'https://registry.npmjs.org' | ||
@@ -38,2 +39,3 @@ this.retry = opts.retry // for npm-registry-client | ||
this.fullMetadata = opts.fullMetadata | ||
this.alwaysAuth = opts.alwaysAuth | ||
@@ -40,0 +42,0 @@ this.dirPacker = opts.dirPacker || null |
{ | ||
"name": "pacote", | ||
"version": "2.3.2", | ||
"version": "2.4.0", | ||
"description": "JavaScript package downloader", | ||
@@ -48,3 +48,3 @@ "main": "index.js", | ||
"lru-cache": "^4.0.2", | ||
"make-fetch-happen": "^2.2.6", | ||
"make-fetch-happen": "^2.3.0", | ||
"minimatch": "^3.0.3", | ||
@@ -59,2 +59,3 @@ "mississippi": "^1.2.0", | ||
"protoduck": "^4.0.0", | ||
"safe-buffer": "^5.0.1", | ||
"semver": "^5.3.0", | ||
@@ -61,0 +62,0 @@ "ssri": "^4.1.2", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
69850
1486
21
+ Addedsafe-buffer@^5.0.1
Updatedmake-fetch-happen@^2.3.0