Skip to content

v9.0.0

Compare
Choose a tag to compare
@jaredwray jaredwray released this 13 Aug 16:00
· 319 commits to main since this release
364d726

v9 is now pure ESM 馃帀

cacheable-request is now pure ESM with version v9.0.0 and up. Version v.8.x.x is the supported commonjs version which will get only major security fixes moving forward until end of 2022. If you would like to learn about uprgrading / using ESM @sindresorhus has an amazing reference guide here: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c

Major thank you to @alphmth, @sindresorhus, @szmarczak, @jasonbaik, and everybody for help on this. 馃檶

Special call out to @CyberShadow as in the previous release we forgot to mention the work done on issue #28 as without their guidance and code we wouldn't have fixed it. 鉂わ笍

Typescript

In addition to pure ESM we are now fulling using Typescript moving forward on this project which means all type definitions are now native with the service. 馃ぉ

Hooks!

Hooks have been introduced for the response object that will run a processing function like so if you wanted to do compression:

CacheableRequest.addHook('response', async (response: any) => {
  const buffer = await pm(gunzip)(response);
  return buffer.toString();
});

const cacheableRequest = CacheableRequest(request, cache);

How to Add a Hook: https://github.com/jaredwray/cacheable-request#add-hooks
How to Remove a Hook: https://github.com/jaredwray/cacheable-request#remove-hooks

We would love some feedback on this feature!

Change Log

Full Changelog: v8.3.1...v9.0.0