Replace got w/ node-fetch#110
Conversation
|
Can you rebase? I fixed the unrelated error on main |
ChristianMurphy
left a comment
There was a problem hiding this comment.
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.
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.
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.
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
gotpackage which is only used once, with an alternative (node-fetch, which against intuitions does not depend on@types/nodewheregotdid ).This means that there are now not any issues when running
tscin a Cloudflare Workers project which usesxdm. This came up specifically while building a Remix application, as@remix-run/devdepends onxdm.I made sure to replicate the existing caching set up, as that is not included in
node-fetch.Thanks for this awesome project 🙏