realm-js
realm-js copied to clipboard
RJS-2765: Upgrade BSON
trafficstars
What, How & Why?
Upgrading packages to use BSON v6. There are several breaking changes (v5, v6) in the BSON package, some of which affect us.
Notes on breaking changes:
- Since we are reexporting the package, we should likely consider this a breaking change to our own packages as well.
Blocking:
- The BSON package is currently using top-level await which currently prevents us from bundling if don't enable that feature. @kraenhansen has contributed a PR to BSON to alleviate this for us (see Jira ticket).
This closes #6561
☑️ ToDos
- [ ] 📝 Changelog entry
- [ ] 📝
Compatibilitylabel is updated or copied from previous entry - [ ] 📝 Update
COMPATIBILITY.md - [ ] 🚦 Tests
- [ ] 📦 Updated internal package version in consuming
package.jsons (if updating internal packages) - [ ] 📱 Check the React Native/other sample apps work if necessary
- [ ] 💥
Breakinglabel has been applied or is not necessary
I've rebased on latest main to get b88a065cbd50cf1b84f381d1ab1a781d72bd4f2e and force-pushed to your branch 🤞
Latest React Native specific failure:
ReferenceError: Property 'btoa' doesn't exist
at webByteUtils.toBase64 (/Users/runner/work/realm-js/realm-js/node_modules/bson/lib/bson.cjs:387:15)
at Binary#toExtendedJSON (/Users/runner/work/realm-js/realm-js/node_modules/bson/lib/bson.cjs:549:47)
at serializeDocument (/Users/runner/work/realm-js/realm-js/node_modules/bson/lib/bson.cjs:4088:36)
at serializeValue (/Users/runner/work/realm-js/realm-js/node_modules/bson/lib/bson.cjs:4021:32)
at stringify (/Users/runner/work/realm-js/realm-js/node_modules/bson/lib/bson.cjs:4120:30)
Metro seems to pick up "bson/lib/bson.cjs" instead of the RN specific bundle that is included in bson 🤔