From 7c109208e7363db195527a26d08e172fcf0d4a04 Mon Sep 17 00:00:00 2001 From: Filip Skokan Date: Sun, 16 Oct 2022 12:42:27 +0200 Subject: [PATCH] refactor!: removed default outgoing cacheable-lookup use BREAKING CHANGE: `httpOptions` no longer defaults to using the npm module `cacheable-lookup` as its `dnsLookup` option. It defaults to `node:dns` module's `lookup` export instead. --- docs/README.md | 2 +- lib/helpers/defaults.js | 2 +- lib/helpers/request.js | 7 ------- package.json | 1 - 4 files changed, 2 insertions(+), 10 deletions(-) diff --git a/docs/README.md b/docs/README.md index 398f9e1bd..5ae634c25 100644 --- a/docs/README.md +++ b/docs/README.md @@ -2330,7 +2330,7 @@ function httpOptions(url) { return { timeout: 2500, agent: undefined, // defaults to node's global agents (https.globalAgent or http.globalAgent) - lookup: undefined, // defaults to CacheableLookup (https://github.com/szmarczak/cacheable-lookup) + lookup: undefined, // defaults to `dns.lookup()` (https://nodejs.org/api/dns.html#dnslookuphostname-options-callback) }; } ``` diff --git a/lib/helpers/defaults.js b/lib/helpers/defaults.js index 24868cd7e..1adcc0ca3 100644 --- a/lib/helpers/defaults.js +++ b/lib/helpers/defaults.js @@ -221,7 +221,7 @@ function httpOptions(url) { return { timeout: 2500, agent: undefined, // defaults to node's global agents (https.globalAgent or http.globalAgent) - lookup: undefined, // defaults to CacheableLookup (https://github.com/szmarczak/cacheable-lookup) + lookup: undefined, // defaults to `dns.lookup()` (https://nodejs.org/api/dns.html#dnslookuphostname-options-callback) }; } diff --git a/lib/helpers/request.js b/lib/helpers/request.js index c686da1dd..52bc82e32 100644 --- a/lib/helpers/request.js +++ b/lib/helpers/request.js @@ -1,14 +1,8 @@ const got = require('got'); -const CacheableLookup = require('cacheable-lookup'); -const QuickLRU = require('quick-lru'); const pickBy = require('./_/pick_by'); const instance = require('./weak_cache'); -const cacheable = new CacheableLookup({ - cache: new QuickLRU({ maxSize: 1000 }), -}); - module.exports = async function request(options) { Object.assign(options, { url: new URL(options.url), @@ -37,7 +31,6 @@ module.exports = async function request(options) { retry: 0, throwHttpErrors: false, timeout: 2500, - lookup: cacheable.lookup, ...helperOptions, }); }; diff --git a/package.json b/package.json index 74700524f..d4a1a552c 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,6 @@ }, "dependencies": { "@koa/cors": "^3.3.0", - "cacheable-lookup": "^6.0.4", "debug": "^4.3.4", "ejs": "^3.1.8", "got": "^11.8.5",