-
Notifications
You must be signed in to change notification settings - Fork 945
Tree shakeable persistence #3288
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
Conversation
💥 No ChangesetLatest commit: 088cb6b Merging this PR will not cause any packages to be released. If these changes should not cause updates to packages in this repo, this is fine 🙂 If these changes should be published to npm, you need to add a changeset. Click here to learn what changesets are, and how to add one. Click here if you're a maintainer who wants to add a changeset to this PR |
Binary Size ReportAffected SDKsNo changes between base commit (b9ece92) and head commit (2e6a6cd). Test Logs
|
2050942
to
9e4b6aa
Compare
* Make the persistence objects tree-shakeable * Formatting * Updated to stop using casts everywhere * Formatting * Make the browser impls tree shakeable * Formatting * Fix the react native implementation in auth-compat-exp * Formatting * Make the react native class wrapped in a closure, to avoid the prototype nonsense * Formatting * Fix index.rn.ts * Formatting * PR feedback * Fix ordering in index.ts * Formatting * Fix test * Formatting
* Make the persistence objects tree-shakeable * Formatting * Updated to stop using casts everywhere * Formatting * Make the browser impls tree shakeable * Formatting * Fix the react native implementation in auth-compat-exp * Formatting * Make the react native class wrapped in a closure, to avoid the prototype nonsense * Formatting * Fix index.rn.ts * Formatting * PR feedback * Fix ordering in index.ts * Formatting * Fix test * Formatting
Exporting
const
s that are instantiated using a function call (like a constructor) can't be tree shaken since the tools don't know whether or not the function side-effects. To get around this while keeping the appearance of exportedconst
s that the user can use, the classes themselves take on the shape of theexterns.Persistence
interface, and provide internal static methods for instantiation.I've verified in the demo build that this will indeed allow all of these persistence classes to be tree-shaken. This also does not change the API surface at all as far as the user is concerned.