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
Add browser support #48
Conversation
Good work! I think we might want to support Vite too. I think we should not try to bundle https://github.com/mcollina/async-cache-dedupe/blob/main/src/storage/redis.js at all. |
Hey @mcollina, thanks for the pre-review 😁 I've added |
be0b053
to
2655505
Compare
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.
Can you just remove the skipped tests?
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.
A lot of tests here are duplication of the Node.js ones. Could they be imported/loaded instead of copying them over?
Oh, I've tried that way... but I realized there are no shims for |
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.
lgtm
let's see what @simone-sanfratello says! |
Nice work! Looks fine so far. |
All good with the latest changes! 👏 One last thing please: remove |
Hey, @simone-sanfratello. Thank you so much for the review and for your support. I've made all changes you requested. |
Well done! |
This PR would introduce the browser support for
async-cache-dedupe
as discussed in #47.Context
This library is designed to run on Node.js. With support for Chrome, Firefox, Safari, and Edge., the
async-cache-dedupe
module can be extended between platforms and, in the near future, to other runtimes.util
was not tested)Test
I've added a test system to run all tests in the following browsers: Chrome, Safari, Edge, and Firefox. I also add support for the following bundlers: Esbuild, Webpack, Browserify, and Rollup.
To test correctly each bundler you need to run the following commands:
This command will generate a JS file bundled and move it into a temporary folder.
To run the tests you should run the following command:
This gonna run an
index.html
file that imports the generated suites containing tests. All the output will be streamed from the console of the browser to your Node console.CI
The CI was added to run the browser tests in the following OS:
ubuntu
,windows
, andmacos
. Each OS tests all the supported browsers with the supported bundlers. I've skipped the Safari tests on Ubuntu and Windows.Caveats
There are some limitations to running this module on the client side.