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

fix: remove reliance on top level await and external polyfill/helper #35

Merged
merged 9 commits into from
Oct 16, 2024

Conversation

EisenbergEffect
Copy link
Contributor

@EisenbergEffect EisenbergEffect commented Sep 25, 2024

This PR reworks the serialization code to use JSON.stringify and JSON.parse instead of structured clone and a third-party serialization polyfill/helper. A new function called configureSerialization(...) has been added to provide developers with a way to plug back in the more advanced serialization approach if they want/need it for their app.

Checklist

Issues

Notes

A couple of critical things are left undone. I'm looking for some help/feedback on:

  • I am still unable to run the build on Windows out-of-the-box, so I didn't verify by running the build or tests. We'll see what happens with CI.
  • I didn't make changes to the custom build scripts for rollup, etc. There was a lot of code there and I'm not very familiar with custom rollup solutions in general. Perhaps someone else can remove the vestiges of the old polyfill system that are still there.
  • Please let me know where you want me to document configureSerialization(...) and I'll amend this PR with that (assuming you support the approach I took).

…lyfills/helpers

This PR reworks the serialization code to use JSON.stringify and JSON.parse instead of structured clone and a third-party serialization polyfill/helper. A new function to configure serialization has been added to provide developers with a way to plug back in the more advanced serialization approach if they want/need it for their app.
@EisenbergEffect EisenbergEffect marked this pull request as ready for review October 9, 2024 10:56
@fabiancook
Copy link
Contributor

Beyond the rollup issue, were you having any specific issues with windows? I checked through the scripts and they are all node based for this project, so should be okay.

@fabiancook
Copy link
Contributor

Also having a think about the serializer, its reasonable to configure a serialiser. I've updated the code slightly so that a single object can be passed for it. Being able to use JSON by default will be a lot cleaner upfront.

If someone needs a complex state serializer, they can with no concern now.

@fabiancook fabiancook merged commit 2fb3801 into virtualstate:main Oct 16, 2024
5 checks passed
@fabiancook
Copy link
Contributor

I have released this as 1.0.1-alpha.206

@EisenbergEffect
Copy link
Contributor Author

Awesome! Thank you @fabiancook !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

bug: use of top level awaits and node modules causes bunding errors
2 participants