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

Drop node-fetch and bump engines.node to >= 18 #37

Merged
merged 2 commits into from
May 13, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
strategy:
matrix:
os: ["ubuntu-latest", "macos-latest", "windows-latest"]
node: ["14", "16", "18"]
node: ["18", "20"]
name: Node.js ${{ matrix.node }} on ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# eleventy-fetch

_Requires Node 14+_
_Requires Node 18+_

Formerly known as [`@11ty/eleventy-cache-assets`](https://www.npmjs.com/package/@11ty/eleventy-cache-assets).

Expand Down
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"eleventy-fetch.js"
],
"engines": {
"node": ">=14"
"node": ">=18"
},
"funding": {
"type": "opencollective",
Expand All @@ -45,7 +45,6 @@
"dependencies": {
"debug": "^4.3.4",
"flat-cache": "^3.0.4",
"node-fetch": "^2.6.7",
"p-queue": "^6.6.2"
},
"ava": {
Expand Down
3 changes: 1 addition & 2 deletions src/RemoteAssetCache.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
const fs = require("fs");
const fsp = fs.promises; // Node 10+

const fetch = require("node-fetch");
const AssetCache = require("./AssetCache");
const debug = require("debug")("EleventyCacheAssets");

Expand Down Expand Up @@ -55,7 +54,7 @@ class RemoteAssetCache extends AssetCache {
} else if(type === "text") {
return response.text();
}
return response.buffer();
return Buffer.from(await response.arrayBuffer());
}

async fetch(optionsOverride = {}) {
Expand Down