-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
Replace got
w/ node-fetch
#110
Conversation
Can you rebase? I fixed the unrelated error on main |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @jensmeindertsma!
const cachedContents = cache.get(href) | ||
if (cachedContents) { | ||
contents = cachedContents | ||
} else { | ||
contents = await (await fetch(href)).text() | ||
cache.set(href, contents) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This issue may have already existed before, but now is more visible.
It's a bit worrying that the caching system doesn't have memory management (max cached items, max memory usable, etc).
On massive projects, caching could become an issue exceeding the memory node is allowed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, not sure whether that should be improved as part of this PR though, might be better do to it in a separate PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’m not too worried about it. Could use something smarter in the future (an LRU cache?), but this is probably fine for now in build scripts
got
with Cloudflare-friendly alternativegot
w/ node-fetch
Released, thanks! |
This pull request fixes #109. It replaces the
got
package which is only used once, with an alternative (node-fetch
, which against intuitions does not depend on@types/node
wheregot
did ).This means that there are now not any issues when running
tsc
in a Cloudflare Workers project which usesxdm
. This came up specifically while building a Remix application, as@remix-run/dev
depends onxdm
.I made sure to replicate the existing caching set up, as that is not included in
node-fetch
.Thanks for this awesome project 🙏