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

refactor(sdk): Replace quick-lru with lru-cache #2924

Open
wants to merge 31 commits into
base: main
Choose a base branch
from

Conversation

mondoreale
Copy link
Contributor

@mondoreale mondoreale commented Dec 2, 2024

(Hopefully one of many small PRs.)

Summary

quick-lru is an ES-only package and in order to build with it for CJS we currently move it (raw ESM) over (to /vendor) and transform to CommonJS as part of SDK's build process.

lru-cache is already being used by DHT and it organically comes in 2 flavours: CJS and ESM. No magic required, and no magic = less maintenance.

Changes

  • Replace references.
  • Address differences in tests, in types, and in logic.
  • Fix and annotate tests for Mapping.
  • Remove "vendor" magic (no longer required).

Checklist before requesting a review

  • Is this a breaking change? If it is, be clear in summary.
  • Read through code myself one more time.
  • Make sure any and all TODO comments left behind are meant to be left in.
  • Has reasonable passing test coverage?
  • Updated changelog if applicable.
  • Updated documentation if applicable.

Remaining todos

  • Fix tests

@github-actions github-actions bot added the sdk label Dec 2, 2024
@mondoreale mondoreale changed the base branch from main to sdk-use-Mapping-instead-of-CacheMap-in-registries December 2, 2024 23:18
@github-actions github-actions bot added the dht Related to DHT package label Dec 3, 2024
teogeb and others added 6 commits December 3, 2024 13:26
The motivation here is that unlike `quick-lru` `lru-cache` comes in 2 formats we're interested in: cjs and esm.

Plus, DHT already uses `lru-cache` so it already fits the stack.
Incorrect param!
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me revert this one. Most likely node v18 vs v20 issue.

Copy link
Contributor Author

@mondoreale mondoreale Dec 3, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't get this to pass locally. "Me" problem, it seems. CI sees no issues.

Locally it fails. Let's push it and see if it's a "me" problem.
Base automatically changed from sdk-use-Mapping-instead-of-CacheMap-in-registries to main December 4, 2024 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dht Related to DHT package sdk
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants