Use LTS Node.js and drop HTTP request dependencies #21
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Node.js has had native
fetch
for a while now. I would recommend just using the latest LTS release (for all maintenance and security reasons), which also ships with nativefetch
.This drops
node-fetch
(as well asxmlhttprequest
that seemed to be unused?) and requires LTS Node.js as the engine.To make sure everything was still working I also updated tests.js to actually respond correctly. Previously it was not awaiting any of the Promises that were the result of
fetch
, so it was writing out “All tests passed!” before the requests had even finished.I think tests.js is still a little undercooked. E.g. I tried adding a Bluesky link to
urls
that I knew did not exist, and that still passed the test. This because the bsky.link error page actually resolves as an HTTP 200 page with anh-entry
. Is this expected?As the testing is the only thing that does mf2 parsing, I moved the mf2 parser dependency to
devDependencies
. I am not sure how bsky.link is currently served in production, but to not packagemicroformats-parser
I recommend installing dependencies with:npm ci --omit="dev"
.