virtualstate / navigation

Native JavaScript navigation [web api] implementation
MIT License
77 stars 5 forks source link

fix: remove platform-specific uuid code to prevent bundler errors #33

Closed EisenbergEffect closed 3 months ago

EisenbergEffect commented 3 months ago

Description

The Web Crypto API is available in all browsers, Node.js, and Deno. This PR assumes that covers the majority of the environments where this polyfill will be used. A simple semi-random v4 formatted string is provided for all other cases. These changes reduce the code and complexity, and should resolve bundler errors stemming from the platform-specific imports and top-level awaits that have now been removed.

Issues

Notes

I had trouble getting things setup on my machine, so I haven't run the tests, though I was able to build at some point along the way. I am currently relying on CI to tell me if I broke anything.

Checklist

Next Steps

Once some version of this PR is fixed, I'll follow up with a second PR to address the JSON parse ocde also reference in #32.

EisenbergEffect commented 3 months ago

Thanks for the fix @fabiancook! I wasn't aware that the Node implementation of randomUUID was unbound.