Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deps: [email protected], [email protected] #4616

Merged
merged 2 commits into from
Mar 28, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
262 changes: 219 additions & 43 deletions node_modules/lru-cache/index.js

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion node_modules/lru-cache/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "lru-cache",
"description": "A cache object that deletes the least-recently-used items.",
"version": "7.5.1",
"version": "7.7.1",
"author": "Isaac Z. Schlueter <[email protected]>",
"keywords": [
"mru",
Expand All @@ -22,6 +22,7 @@
"devDependencies": {
"@size-limit/preset-small-lib": "^7.0.8",
"benchmark": "^2.1.4",
"clock-mock": "^1.0.3",
"size-limit": "^7.0.8",
"tap": "^15.1.6"
},
Expand Down
5 changes: 5 additions & 0 deletions node_modules/make-fetch-happen/lib/agent.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
const LRU = require('lru-cache')
const url = require('url')
const isLambda = require('is-lambda')
const dns = require('./dns.js')

const AGENT_CACHE = new LRU({ max: 50 })
const HttpAgent = require('agentkeepalive')
Expand Down Expand Up @@ -77,11 +78,13 @@ function getAgent (uri, opts) {
rejectUnauthorized: opts.rejectUnauthorized,
timeout: agentTimeout,
freeSocketTimeout: 15000,
lookup: dns.getLookup(opts.dns),
}) : new HttpAgent({
maxSockets: agentMaxSockets,
localAddress: opts.localAddress,
timeout: agentTimeout,
freeSocketTimeout: 15000,
lookup: dns.getLookup(opts.dns),
})
AGENT_CACHE.set(key, agent)
return agent
Expand Down Expand Up @@ -171,6 +174,8 @@ const HttpsProxyAgent = require('https-proxy-agent')
const SocksProxyAgent = require('socks-proxy-agent')
module.exports.getProxy = getProxy
function getProxy (proxyUrl, opts, isHttps) {
// our current proxy agents do not support an overridden dns lookup method, so will not
// benefit from the dns cache
const popts = {
host: proxyUrl.hostname,
port: proxyUrl.port,
Expand Down
4 changes: 2 additions & 2 deletions node_modules/make-fetch-happen/lib/cache/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ const cacheFetch = async (request, options) => {

// otherwise, we make a request, store it and return it
const response = await remote(request, options)
const entry = new CacheEntry({ request, response, options })
return entry.store('miss')
const newEntry = new CacheEntry({ request, response, options })
return newEntry.store('miss')
}

// we have a cached response that satisfies this request, however if the cache
Expand Down
49 changes: 49 additions & 0 deletions node_modules/make-fetch-happen/lib/dns.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
const LRUCache = require('lru-cache')
const dns = require('dns')

const defaultOptions = exports.defaultOptions = {
family: undefined,
hints: dns.ADDRCONFIG,
all: false,
verbatim: true,
}

const lookupCache = exports.lookupCache = new LRUCache({ max: 50 })

// this is a factory so that each request can have its own opts (i.e. ttl)
// while still sharing the cache across all requests
exports.getLookup = (dnsOptions) => {
return (hostname, options, callback) => {
if (typeof options === 'function') {
callback = options
options = null
} else if (typeof options === 'number') {
options = { family: options }
}

options = { ...defaultOptions, ...options }

const key = JSON.stringify({
hostname,
family: options.family,
hints: options.hints,
all: options.all,
verbatim: options.verbatim,
})

if (lookupCache.has(key)) {
const [address, family] = lookupCache.get(key)
process.nextTick(callback, null, address, family)
return
}

dnsOptions.lookup(hostname, options, (err, address, family) => {
if (err) {
return callback(err)
}

lookupCache.set(key, [address, family], { ttl: dnsOptions.ttl })
return callback(null, address, family)
})
}
}
4 changes: 4 additions & 0 deletions node_modules/make-fetch-happen/lib/options.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const dns = require('dns')

const conditionalHeaders = [
'if-modified-since',
'if-none-match',
Expand Down Expand Up @@ -26,6 +28,8 @@ const configureOptions = (opts) => {
options.retry = { retries: 0, ...options.retry }
}

options.dns = { ttl: 5 * 60 * 1000, lookup: dns.lookup, ...options.dns }

options.cache = options.cache || 'default'
if (options.cache === 'default') {
const hasConditionalHeader = Object.keys(options.headers || {}).some((name) => {
Expand Down
32 changes: 18 additions & 14 deletions node_modules/make-fetch-happen/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "make-fetch-happen",
"version": "10.0.6",
"version": "10.1.0",
"description": "Opinionated, caching, retrying fetch client",
"main": "lib/index.js",
"files": [
"bin",
"lib"
"bin/",
"lib/"
],
"scripts": {
"preversion": "npm test",
Expand All @@ -14,13 +14,16 @@
"test": "tap",
"posttest": "npm run lint",
"eslint": "eslint",
"lint": "eslint '**/*.js'",
"lint": "eslint \"**/*.js\"",
"lintfix": "npm run lint -- --fix",
"postlint": "npm-template-check",
"postlint": "template-oss-check",
"snap": "tap",
"template-copy": "npm-template-copy --force"
"template-oss-apply": "template-oss-apply --force"
},
"repository": {
"type": "git",
"url": "https://github.com/npm/make-fetch-happen.git"
},
"repository": "https://github.com/npm/make-fetch-happen",
"keywords": [
"http",
"request",
Expand All @@ -34,12 +37,12 @@
"license": "ISC",
"dependencies": {
"agentkeepalive": "^4.2.1",
"cacache": "^16.0.0",
"cacache": "^16.0.2",
"http-cache-semantics": "^4.1.0",
"http-proxy-agent": "^5.0.0",
"https-proxy-agent": "^5.0.0",
"is-lambda": "^1.0.1",
"lru-cache": "^7.5.1",
"lru-cache": "^7.7.1",
"minipass": "^3.1.6",
"minipass-collect": "^1.0.2",
"minipass-fetch": "^2.0.3",
Expand All @@ -51,24 +54,25 @@
"ssri": "^8.0.1"
},
"devDependencies": {
"@npmcli/template-oss": "^2.9.2",
"eslint": "^8.11.0",
"@npmcli/eslint-config": "^3.0.1",
"@npmcli/template-oss": "3.1.2",
"mkdirp": "^1.0.4",
"nock": "^13.2.4",
"rimraf": "^3.0.2",
"safe-buffer": "^5.2.1",
"standard-version": "^9.3.2",
"tap": "^15.1.6"
"tap": "^16.0.0"
},
"engines": {
"node": "^12.13.0 || ^14.15.0 || >=16"
"node": "^12.13.0 || ^14.15.0 || >=16.0.0"
},
"tap": {
"color": 1,
"files": "test/*.js",
"check-coverage": true
},
"templateOSS": {
"version": "2.9.2"
"//@npmcli/template-oss": "This file is partially managed by @npmcli/template-oss. Edits may be overwritten.",
"version": "3.1.2"
}
}
36 changes: 18 additions & 18 deletions package-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@
"libnpmsearch": "^5.0.2",
"libnpmteam": "^4.0.2",
"libnpmversion": "^3.0.1",
"make-fetch-happen": "^10.0.6",
"make-fetch-happen": "^10.1.0",
"minipass": "^3.1.6",
"minipass-pipeline": "^1.2.4",
"mkdirp": "^1.0.4",
Expand Down Expand Up @@ -4828,9 +4828,9 @@
}
},
"node_modules/lru-cache": {
"version": "7.5.1",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.5.1.tgz",
"integrity": "sha512-q1TS8IqKvcg3aScamKCHpepSrHF537Ww7nHahBOxhDu9D2YoBXAsj/7uFdZFj1xJr9LmyeJ62AdyofCHafUbIA==",
"version": "7.7.1",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.7.1.tgz",
"integrity": "sha512-cRffBiTW8s73eH4aTXqBcTLU0xQnwGV3/imttRHGWCrbergmnK4D6JXQd8qin5z43HnDwRI+o7mVW0LEB+tpAw==",
"inBundle": true,
"engines": {
"node": ">=12"
Expand Down Expand Up @@ -4869,18 +4869,18 @@
"peer": true
},
"node_modules/make-fetch-happen": {
"version": "10.0.6",
"resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-10.0.6.tgz",
"integrity": "sha512-4Gfh6lV3TLXmj7qz79hBFuvVqjYSMW6v2+sxtdX4LFQU0rK3V/txRjE0DoZb7X0IF3t9f8NO3CxPSWlvdckhVA==",
"version": "10.1.0",
"resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-10.1.0.tgz",
"integrity": "sha512-HeP4QlkadP/Op+hE+Une1070kcyN85FshQObku3/rmzRh4zDcKXA19d2L3AQR6UoaX3uZmhSOpTLH15b1vOFvQ==",
"inBundle": true,
"dependencies": {
"agentkeepalive": "^4.2.1",
"cacache": "^16.0.0",
"cacache": "^16.0.2",
"http-cache-semantics": "^4.1.0",
"http-proxy-agent": "^5.0.0",
"https-proxy-agent": "^5.0.0",
"is-lambda": "^1.0.1",
"lru-cache": "^7.5.1",
"lru-cache": "^7.7.1",
"minipass": "^3.1.6",
"minipass-collect": "^1.0.2",
"minipass-fetch": "^2.0.3",
Expand All @@ -4892,7 +4892,7 @@
"ssri": "^8.0.1"
},
"engines": {
"node": "^12.13.0 || ^14.15.0 || >=16"
"node": "^12.13.0 || ^14.15.0 || >=16.0.0"
}
},
"node_modules/markdown-escapes": {
Expand Down Expand Up @@ -14464,9 +14464,9 @@
"dev": true
},
"lru-cache": {
"version": "7.5.1",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.5.1.tgz",
"integrity": "sha512-q1TS8IqKvcg3aScamKCHpepSrHF537Ww7nHahBOxhDu9D2YoBXAsj/7uFdZFj1xJr9LmyeJ62AdyofCHafUbIA=="
"version": "7.7.1",
"resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.7.1.tgz",
"integrity": "sha512-cRffBiTW8s73eH4aTXqBcTLU0xQnwGV3/imttRHGWCrbergmnK4D6JXQd8qin5z43HnDwRI+o7mVW0LEB+tpAw=="
},
"make-dir": {
"version": "3.1.0",
Expand Down Expand Up @@ -14494,17 +14494,17 @@
"peer": true
},
"make-fetch-happen": {
"version": "10.0.6",
"resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-10.0.6.tgz",
"integrity": "sha512-4Gfh6lV3TLXmj7qz79hBFuvVqjYSMW6v2+sxtdX4LFQU0rK3V/txRjE0DoZb7X0IF3t9f8NO3CxPSWlvdckhVA==",
"version": "10.1.0",
"resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-10.1.0.tgz",
"integrity": "sha512-HeP4QlkadP/Op+hE+Une1070kcyN85FshQObku3/rmzRh4zDcKXA19d2L3AQR6UoaX3uZmhSOpTLH15b1vOFvQ==",
"requires": {
"agentkeepalive": "^4.2.1",
"cacache": "^16.0.0",
"cacache": "^16.0.2",
"http-cache-semantics": "^4.1.0",
"http-proxy-agent": "^5.0.0",
"https-proxy-agent": "^5.0.0",
"is-lambda": "^1.0.1",
"lru-cache": "^7.5.1",
"lru-cache": "^7.7.1",
"minipass": "^3.1.6",
"minipass-collect": "^1.0.2",
"minipass-fetch": "^2.0.3",
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
"libnpmsearch": "^5.0.2",
"libnpmteam": "^4.0.2",
"libnpmversion": "^3.0.1",
"make-fetch-happen": "^10.0.6",
"make-fetch-happen": "^10.1.0",
"minipass": "^3.1.6",
"minipass-pipeline": "^1.2.4",
"mkdirp": "^1.0.4",
Expand Down