summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/pacote/lib/fetchers/registry/check-warning-header.js
diff options
context:
space:
mode:
authorKat Marchán <kzm@zkat.tech>2019-01-29 14:43:00 -0800
committerMyles Borins <mylesborins@google.com>2019-02-12 00:06:29 -0800
commit43dd49c9782848c25e5b03448c8a0f923f13c158 (patch)
treef7ac5d645019b2b844f26be66c291bbae734d097 /deps/npm/node_modules/pacote/lib/fetchers/registry/check-warning-header.js
parentb361f9577fbd72e518438d3fa0b01f7d34d814a5 (diff)
downloadandroid-node-v8-43dd49c9782848c25e5b03448c8a0f923f13c158.tar.gz
android-node-v8-43dd49c9782848c25e5b03448c8a0f923f13c158.tar.bz2
android-node-v8-43dd49c9782848c25e5b03448c8a0f923f13c158.zip
deps: upgrade npm to 6.7.0
PR-URL: https://github.com/nodejs/node/pull/25804 Reviewed-By: Myles Borins <myles.borins@gmail.com>
Diffstat (limited to 'deps/npm/node_modules/pacote/lib/fetchers/registry/check-warning-header.js')
-rw-r--r--deps/npm/node_modules/pacote/lib/fetchers/registry/check-warning-header.js39
1 files changed, 0 insertions, 39 deletions
diff --git a/deps/npm/node_modules/pacote/lib/fetchers/registry/check-warning-header.js b/deps/npm/node_modules/pacote/lib/fetchers/registry/check-warning-header.js
deleted file mode 100644
index b17a233d43..0000000000
--- a/deps/npm/node_modules/pacote/lib/fetchers/registry/check-warning-header.js
+++ /dev/null
@@ -1,39 +0,0 @@
-'use strict'
-
-const LRU = require('lru-cache')
-
-const WARNING_REGEXP = /^\s*(\d{3})\s+(\S+)\s+"(.*)"\s+"([^"]+)"/
-const BAD_HOSTS = new LRU({ max: 50 })
-
-module.exports = checkWarnings
-function checkWarnings (res, registry, opts) {
- if (res.headers.has('warning') && !BAD_HOSTS.has(registry)) {
- const warnings = {}
- res.headers.raw()['warning'].forEach(w => {
- const match = w.match(WARNING_REGEXP)
- if (match) {
- warnings[match[1]] = {
- code: match[1],
- host: match[2],
- message: match[3],
- date: new Date(match[4])
- }
- }
- })
- BAD_HOSTS.set(registry, true)
- if (warnings['199']) {
- if (warnings['199'].message.match(/ENOTFOUND/)) {
- opts.log.warn('registry', `Using stale data from ${registry} because the host is inaccessible -- are you offline?`)
- } else {
- opts.log.warn('registry', `Unexpected warning for ${registry}: ${warnings['199'].message}`)
- }
- }
- if (warnings['111']) {
- // 111 Revalidation failed -- we're using stale data
- opts.log.warn(
- 'registry',
- `Using stale package data from ${registry} due to a request error during revalidation.`
- )
- }
- }
-}