make-fetch-happen
Advanced tools
Comparing version 10.0.6 to 10.1.0
@@ -5,2 +5,3 @@ 'use strict' | ||
const isLambda = require('is-lambda') | ||
const dns = require('./dns.js') | ||
@@ -81,2 +82,3 @@ const AGENT_CACHE = new LRU({ max: 50 }) | ||
freeSocketTimeout: 15000, | ||
lookup: dns.getLookup(opts.dns), | ||
}) : new HttpAgent({ | ||
@@ -87,2 +89,3 @@ maxSockets: agentMaxSockets, | ||
freeSocketTimeout: 15000, | ||
lookup: dns.getLookup(opts.dns), | ||
}) | ||
@@ -177,2 +180,4 @@ AGENT_CACHE.set(key, agent) | ||
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 = { | ||
@@ -179,0 +184,0 @@ host: proxyUrl.hostname, |
@@ -17,4 +17,4 @@ const { NotCachedError } = require('./errors.js') | ||
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') | ||
} | ||
@@ -21,0 +21,0 @@ |
@@ -0,1 +1,3 @@ | ||
const dns = require('dns') | ||
const conditionalHeaders = [ | ||
@@ -29,2 +31,4 @@ 'if-modified-since', | ||
options.dns = { ttl: 5 * 60 * 1000, lookup: dns.lookup, ...options.dns } | ||
options.cache = options.cache || 'default' | ||
@@ -31,0 +35,0 @@ if (options.cache === 'default') { |
{ | ||
"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/" | ||
], | ||
@@ -17,9 +17,12 @@ "scripts": { | ||
"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": "https://github.com/npm/make-fetch-happen", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/npm/make-fetch-happen.git" | ||
}, | ||
"keywords": [ | ||
@@ -38,3 +41,3 @@ "http", | ||
"agentkeepalive": "^4.2.1", | ||
"cacache": "^16.0.0", | ||
"cacache": "^16.0.2", | ||
"http-cache-semantics": "^4.1.0", | ||
@@ -44,3 +47,3 @@ "http-proxy-agent": "^5.0.0", | ||
"is-lambda": "^1.0.1", | ||
"lru-cache": "^7.5.1", | ||
"lru-cache": "^7.7.1", | ||
"minipass": "^3.1.6", | ||
@@ -57,4 +60,4 @@ "minipass-collect": "^1.0.2", | ||
"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", | ||
@@ -65,6 +68,6 @@ "nock": "^13.2.4", | ||
"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" | ||
}, | ||
@@ -77,4 +80,5 @@ "tap": { | ||
"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" | ||
} | ||
} |
@@ -32,2 +32,3 @@ # make-fetch-happen | ||
* [`opts.integrity`](#opts-integrity) | ||
* [`opts.dns`](#opts-dns) | ||
* [Message From Our Sponsors](#wow) | ||
@@ -71,2 +72,3 @@ | ||
* Literally punches nazis | ||
* Built in DNS cache | ||
* (PENDING) Range request caching and resuming | ||
@@ -151,2 +153,3 @@ | ||
* [`opts.integrity`](#opts-integrity) - [Subresource Integrity](https://developer.mozilla.org/en-US/docs/Web/Security/Subresource_Integrity) metadata. | ||
* [`opts.dns`](#opts-dns) - DNS cache options | ||
@@ -393,1 +396,10 @@ #### <a name="opts-cache-path"></a> `> opts.cachePath` | ||
``` | ||
#### <a name="opts-dns"></a> `> opts.dns` | ||
An object that provides options for the built-in DNS cache. The following options are available: | ||
Note: Due to limitations in the current proxy agent implementation, users of proxies will not benefit from the DNS cache. | ||
* `ttl`: Milliseconds to keep cached DNS responses for. Defaults to `5 * 60 * 1000` (5 minutes) | ||
* `lookup`: A custom lookup function, see [`dns.lookup()`](https://nodejs.org/api/dns.html#dnslookuphostname-options-callback) for implementation details. Defaults to `require('dns').lookup`. |
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
Network access
Supply chain riskThis module accesses the network.
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
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
60264
14
1131
402
6
14
Updatedcacache@^16.0.2
Updatedlru-cache@^7.7.1