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

modular autoinit #6526

Merged
merged 16 commits into from Sep 28, 2022
Merged

modular autoinit #6526

merged 16 commits into from Sep 28, 2022

Conversation

jamesdaniels
Copy link
Member

@jamesdaniels jamesdaniels commented Aug 12, 2022

@changeset-bot
Copy link

changeset-bot bot commented Aug 12, 2022

🦋 Changeset detected

Latest commit: 87c03a4

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 29 packages
Name Type
@firebase/app Minor
@firebase/app-types Minor
@firebase/util Minor
@firebase/auth Patch
@firebase/database Patch
@firebase/firestore Patch
@firebase/functions Patch
@firebase/storage Patch
firebase Minor
@firebase/analytics Patch
@firebase/app-check Patch
@firebase/app-compat Patch
@firebase/installations Patch
@firebase/messaging Patch
@firebase/performance Patch
@firebase/remote-config Patch
@firebase/database-types Patch
@firebase/analytics-compat Patch
@firebase/app-check-compat Patch
@firebase/auth-compat Patch
@firebase/component Patch
@firebase/database-compat Patch
@firebase/firestore-compat Patch
@firebase/functions-compat Patch
@firebase/installations-compat Patch
@firebase/messaging-compat Patch
@firebase/performance-compat Patch
@firebase/remote-config-compat Patch
@firebase/storage-compat Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@jamesdaniels jamesdaniels changed the title SSR/SSG autoconfig [DO NOT MERGE] autoinit for web frameworks proposal Aug 12, 2022
@google-oss-bot
Copy link
Contributor

google-oss-bot commented Aug 12, 2022

Size Report 1

Affected Products

  • @firebase/app

    TypeBase (c6ba6fc)Merge (c5d881a)Diff
    browser14.1 kB14.4 kB+285 B (+2.0%)
    esm518.4 kB18.7 kB+287 B (+1.6%)
    main19.3 kB19.6 kB+272 B (+1.4%)
    module14.1 kB14.4 kB+285 B (+2.0%)
  • @firebase/auth

    TypeBase (c6ba6fc)Merge (c5d881a)Diff
    browser155 kB156 kB+1.12 kB (+0.7%)
    esm5203 kB204 kB+1.40 kB (+0.7%)
    main148 kB148 kB+147 B (+0.1%)
    module155 kB156 kB+1.12 kB (+0.7%)
  • @firebase/auth/internal

    TypeBase (c6ba6fc)Merge (c5d881a)Diff
    browser166 kB167 kB+1.12 kB (+0.7%)
    esm5216 kB218 kB+1.40 kB (+0.6%)
    main184 kB184 kB+149 B (+0.1%)
    module166 kB167 kB+1.12 kB (+0.7%)
  • @firebase/database

    TypeBase (c6ba6fc)Merge (c5d881a)Diff
    browser248 kB248 kB+222 B (+0.1%)
    esm5276 kB276 kB+240 B (+0.1%)
    main281 kB281 kB+228 B (+0.1%)
    module248 kB248 kB+222 B (+0.1%)
  • @firebase/firestore

    TypeBase (c6ba6fc)Merge (c5d881a)Diff
    browser264 kB264 kB+152 B (+0.1%)
    esm5327 kB328 kB+154 B (+0.0%)
    main527 kB528 kB+233 B (+0.0%)
    module264 kB264 kB+152 B (+0.1%)
    react-native264 kB264 kB+191 B (+0.1%)
  • @firebase/firestore-lite

    TypeBase (c6ba6fc)Merge (c5d881a)Diff
    browser80.9 kB81.1 kB+147 B (+0.2%)
    esm596.8 kB97.0 kB+174 B (+0.2%)
    main136 kB136 kB+231 B (+0.2%)
    module80.9 kB81.1 kB+147 B (+0.2%)
    react-native81.1 kB81.3 kB+166 B (+0.2%)
  • @firebase/functions

    TypeBase (c6ba6fc)Merge (c5d881a)Diff
    browser9.39 kB9.62 kB+230 B (+2.5%)
    esm511.5 kB11.7 kB+240 B (+2.1%)
    main12.4 kB12.6 kB+222 B (+1.8%)
    module9.39 kB9.62 kB+230 B (+2.5%)
  • @firebase/storage

    TypeBase (c6ba6fc)Merge (c5d881a)Diff
    browser54.5 kB54.7 kB+218 B (+0.4%)
    esm560.5 kB60.7 kB+228 B (+0.4%)
    main57.4 kB57.6 kB+200 B (+0.3%)
    module54.5 kB54.7 kB+218 B (+0.4%)
  • @firebase/util

    TypeBase (c6ba6fc)Merge (c5d881a)Diff
    browser21.0 kB22.5 kB+1.50 kB (+7.1%)
    esm522.3 kB23.9 kB+1.54 kB (+6.9%)
    main27.3 kB29.5 kB+2.14 kB (+7.8%)
    module21.0 kB22.5 kB+1.50 kB (+7.1%)
  • bundle

    43 size changes

    TypeBase (c6ba6fc)Merge (c5d881a)Diff
    analytics (logEvent)41.9 kB43.2 kB+1.31 kB (+3.1%)
    app-check (CustomProvider)35.7 kB36.7 kB+988 B (+2.8%)
    app-check (ReCaptchaEnterpriseProvider)37.9 kB39.1 kB+1.11 kB (+2.9%)
    app-check (ReCaptchaV3Provider)37.9 kB39.0 kB+1.11 kB (+2.9%)
    auth (Anonymous)66.4 kB67.7 kB+1.27 kB (+1.9%)
    auth (EmailAndPassword)70.5 kB71.8 kB+1.27 kB (+1.8%)
    auth (GoogleFBTwitterGitHubPopup)90.4 kB94.1 kB+3.74 kB (+4.1%)
    auth (GooglePopup)90.1 kB91.4 kB+1.27 kB (+1.4%)
    auth (GoogleRedirect)90.3 kB91.6 kB+1.27 kB (+1.4%)
    auth (Phone)76.6 kB77.9 kB+1.27 kB (+1.7%)
    database (Append to a list of data)145 kB148 kB+2.78 kB (+1.9%)
    database (Filtering data)144 kB147 kB+2.78 kB (+1.9%)
    database (Listen for child events)160 kB163 kB+2.78 kB (+1.7%)
    database (Listen for value events + Detach listeners)160 kB163 kB+2.78 kB (+1.7%)
    database (Listen for value events)160 kB163 kB+2.78 kB (+1.7%)
    database (Read data once)159 kB162 kB+2.78 kB (+1.7%)
    database (Save data as transactions)162 kB165 kB+2.78 kB (+1.7%)
    database (Sort data)146 kB148 kB+2.78 kB (+1.9%)
    database (Write data)144 kB147 kB+2.78 kB (+1.9%)
    firestore (Persistence)273 kB276 kB+3.01 kB (+1.1%)
    firestore (Query Cursors)209 kB213 kB+3.00 kB (+1.4%)
    firestore (Query)211 kB214 kB+3.00 kB (+1.4%)
    firestore (Read data once)199 kB202 kB+3.00 kB (+1.5%)
    firestore (Realtime updates)201 kB204 kB+3.00 kB (+1.5%)
    firestore (Transaction)183 kB186 kB+3.00 kB (+1.6%)
    firestore (Write data)183 kB186 kB+3.00 kB (+1.6%)
    firestore-lite (Query Cursors)68.4 kB71.3 kB+2.99 kB (+4.4%)
    firestore-lite (Query)71.5 kB74.5 kB+2.99 kB (+4.2%)
    firestore-lite (Read data once)55.9 kB58.9 kB+2.99 kB (+5.3%)
    firestore-lite (Transaction)80.5 kB83.5 kB+2.99 kB (+3.7%)
    firestore-lite (Write data)65.7 kB68.7 kB+2.99 kB (+4.5%)
    functions (call)29.3 kB30.9 kB+1.58 kB (+5.4%)
    messaging (send + receive)45.3 kB46.6 kB+1.31 kB (+2.9%)
    performance (trace)49.7 kB51.0 kB+1.30 kB (+2.6%)
    remote-config (getAndFetch)44.3 kB45.7 kB+1.31 kB (+2.9%)
    storage (getBytes)37.6 kB39.9 kB+2.27 kB (+6.0%)
    storage (getDownloadURL)39.7 kB42.0 kB+2.27 kB (+5.7%)
    storage (getMetadata)39.1 kB41.4 kB+2.27 kB (+5.8%)
    storage (list + listAll)38.6 kB40.8 kB+2.27 kB (+5.9%)
    storage (updateMetadata)39.4 kB41.7 kB+2.27 kB (+5.8%)
    storage (uploadBytes)43.9 kB46.2 kB+2.27 kB (+5.2%)
    storage (uploadBytesResumable)53.4 kB55.6 kB+2.27 kB (+4.3%)
    storage (uploadString)44.2 kB46.4 kB+2.27 kB (+5.2%)

  • firebase

    13 size changes

    TypeBase (c6ba6fc)Merge (c5d881a)Diff
    firebase-app-compat.js27.8 kB29.0 kB+1.20 kB (+4.3%)
    firebase-app.js87.7 kB91.7 kB+3.98 kB (+4.5%)
    firebase-auth-compat.js125 kB126 kB+940 B (+0.8%)
    firebase-auth-react-native.js148 kB149 kB+962 B (+0.6%)
    firebase-auth.js116 kB118 kB+1.50 kB (+1.3%)
    firebase-compat.js738 kB739 kB+1.07 kB (+0.1%)
    firebase-database.js153 kB154 kB+1.04 kB (+0.7%)
    firebase-firestore-lite.js86.3 kB87.5 kB+1.16 kB (+1.3%)
    firebase-firestore.js311 kB313 kB+1.18 kB (+0.4%)
    firebase-functions.js6.93 kB10.9 kB+3.92 kB (+56.6%)
    firebase-performance-standalone-compat.es2017.js87.6 kB90.2 kB+2.52 kB (+2.9%)
    firebase-performance-standalone-compat.js65.4 kB66.7 kB+1.23 kB (+1.9%)
    firebase-storage.js36.7 kB37.8 kB+1.15 kB (+3.1%)

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/SKkoU6wEg2.html

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Aug 12, 2022

Size Analysis Report 1

This report is too large (1,423,165 characters) to be displayed here in a GitHub comment. Please use the below link to see the full report on Google Cloud Storage.

Test Logs

  1. https://storage.googleapis.com/firebase-sdk-metric-reports/BXViH0RJdP.html

@jamesdaniels
Copy link
Member Author

jamesdaniels commented Aug 15, 2022

FYI @hsubox76

Need to clean up but here's a first pass on an implementation. Any initial thoughts? We've started bashing on it go/web-frameworks-bug-bash-init-exp

jamesdaniels added a commit to FirebaseExtended/firebase-framework-tools that referenced this pull request Aug 16, 2022
* Addressed Angular not working, `defaultProject` is gone in new projects now
* Added more error logging to the Angular codepath
* `npm run dev` wasn't patching the globally installed CLI
* Bumped version
* Migrating to ESM
* Adding nuxt & nuxt3 to Github Actions
* Bumping deps
* Fix dynamic import paths in Windows with pathToFileURL
* Adding Windows tests to Actions
* Marked as compatible with Node 16, 18.
* Dropped Node 14 from Actions
* Pack filesystem NPM overrides
* Console log NPM install
* Integrate with [firebase-js-sdk#6526](firebase/firebase-js-sdk#6526) and [firebase-tools##4868](firebase/firebase-tools#4868)
* Next broke, `next export` no longer fails for fallbacks and api routes, detect these to determine if a Cloud Function should be spun up
* Fixed relative directory handling
* Silenced next export failures by spawning
* Rearranged framework detection order so custom servers are first
* Error if it could not determine the framework
* Next minimal mode
@jamesdaniels jamesdaniels changed the title [DO NOT MERGE] autoinit for web frameworks proposal modular autoinit Sep 17, 2022
packages/app/src/api.ts Outdated Show resolved Hide resolved
packages/app/src/api.ts Outdated Show resolved Hide resolved
import { Auth, User } from '../model/public_types';
import { getDefaultEmulatorHost, getExperimentalSetting } from '@firebase/util';

const ID_TOKEN_MAX_AGE = 5 * 60;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should put this into the configuration object

@github-actions github-actions bot added the doc-changes PRs that affect docs label Sep 27, 2022
Copy link
Contributor

@MarkDuckworth MarkDuckworth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM with respect to changes in firestore/, app/, and util/.

common/api-review/firestore.api.md Show resolved Hide resolved
Copy link
Contributor

@maneesht maneesht left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Member

@yuchenshi yuchenshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approval for auth, but see comments inline

@@ -195,6 +195,23 @@ export class FirebaseError extends Error {
// @public
export type FirebaseSignInProvider = 'custom' | 'email' | 'password' | 'phone' | 'anonymous' | 'google.com' | 'facebook.com' | 'github.com' | 'twitter.com' | 'microsoft.com' | 'apple.com';

// Warning: (ae-missing-release-tag) "getDefaultAppConfig" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please address these warnings

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added @public flag and added more comments to everything in defaults.ts.

if (authTokenSyncUrl) {
const mintCookie = mintCookieFactory(authTokenSyncUrl);
beforeAuthStateChanged(auth, mintCookie, () => {
void mintCookie(auth.currentUser);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the Promise ignored? Please add a comment.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like I fixed an eslint error the wrong way. beforeAuthStateChanged does seem to await its callbacks so returned the promise instead.

@@ -132,6 +140,12 @@ export function initializeApp(
});
}

options ||= getDefaultAppConfig();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That was James, heh.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Just mind that it overrides all falsy values—false, 0, "", null, undefined, NaN, etc. This can be surprise folk, especially with ints.

You can use the nullish form, ??= if you only want to override null & undefined.

Copy link
Contributor

@dwyfrequency dwyfrequency left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@hsubox76 hsubox76 merged commit fdd4ab4 into master Sep 28, 2022
@hsubox76 hsubox76 deleted the jamesdaniels_ssr_autoconfig branch September 28, 2022 18:32
@google-oss-bot google-oss-bot mentioned this pull request Sep 29, 2022
@firebase firebase locked and limited conversation to collaborators Oct 29, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
doc-changes PRs that affect docs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants