Skip to content

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

Merged
merged 17 commits into from
Jul 8, 2020
Merged

Conversation

sam-gc
Copy link
Contributor

@sam-gc sam-gc commented Jun 25, 2020

Exporting consts 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 exported consts that the user can use, the classes themselves take on the shape of the externs.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.

@changeset-bot
Copy link

changeset-bot bot commented Jun 25, 2020

💥 No Changeset

Latest 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

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Jun 25, 2020

Binary Size Report

Affected SDKs

No changes between base commit (b9ece92) and head commit (2e6a6cd).

Test Logs

@avolkovi avolkovi assigned sam-gc and unassigned avolkovi Jul 7, 2020
@sam-gc sam-gc force-pushed the samgho/tree-shakeable-persistence branch from 2050942 to 9e4b6aa Compare July 8, 2020 16:54
@sam-gc sam-gc merged commit 2070553 into auth-next Jul 8, 2020
@sam-gc sam-gc deleted the samgho/tree-shakeable-persistence branch July 8, 2020 16:57
avolkovi pushed a commit that referenced this pull request Jul 8, 2020
* 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
avolkovi pushed a commit that referenced this pull request Aug 6, 2020
* 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
@firebase firebase locked and limited conversation to collaborators Aug 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants