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

better meta url polyfill #5738

Merged
merged 3 commits into from
Nov 17, 2021
Merged

better meta url polyfill #5738

merged 3 commits into from
Nov 17, 2021

Conversation

Feiyang1
Copy link
Member

@Feiyang1 Feiyang1 commented Nov 16, 2021

Generate polyfill for Nodejs only.
Partially fixes #5687 (or rather just hide the problem that Jest will load Nodejs bundles as if it is testing in browser)

@changeset-bot
Copy link

changeset-bot bot commented Nov 16, 2021

🦋 Changeset detected

Latest commit: 48ffb4e

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

This PR includes changesets to release 3 packages
Name Type
@firebase/firestore Patch
firebase Patch
@firebase/firestore-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

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Nov 16, 2021

Size Analysis Report

Affected Products

  • @firebase/app-check

    • CustomProvider

      Size Table

      TypeBase (acc5810)Head (b9e890e)Diff
      size
      7.24 kB
      7.47 kB
      +230 B (+3.2%)
      size-with-ext-deps
      16.9 kB
      17.1 kB
      +233 B (+1.4%)

      Dependency Table

      TypeBase (acc5810)Head (b9e890e)Diff
      functions

      20 dependencies

      addTokenListener
      computeKey
      createTokenRefresher
      ensureActivated
      factory
      formatDummyToken
      getDBPromise
      getState
      getToken$2
      internalFactory
      isValid
      makeDummyTokenResult
      notifyTokenListeners
      registerAppCheck
      removeTokenListener
      setState
      sleep
      write
      writeTokenToIndexedDB
      writeTokenToStorage
      

      21 dependencies

      addTokenListener
      computeKey
      createTokenRefresher
      ensureActivated
      factory
      formatDummyToken
      getDBPromise
      getState
      getToken$2
      initTokenRefresher
      internalFactory
      isValid
      makeDummyTokenResult
      notifyTokenListeners
      registerAppCheck
      removeTokenListener
      setState
      sleep
      write
      writeTokenToIndexedDB
      writeTokenToStorage
      

      + initTokenRefresher

    • ReCaptchaEnterpriseProvider

      Size Table

      TypeBase (acc5810)Head (b9e890e)Diff
      size
      9.51 kB
      10.9 kB
      +1.39 kB (+14.7%)
      size-with-ext-deps
      18.7 kB
      20.3 kB
      +1.55 kB (+8.3%)

      Dependency Table

      TypeBase (acc5810)Head (b9e890e)Diff
      functions

      29 dependencies

      addTokenListener
      computeKey
      createTokenRefresher
      ensureActivated
      exchangeToken
      factory
      formatDummyToken
      getDBPromise
      getExchangeRecaptchaEnterpriseTokenRequest
      getRecaptcha
      getState
      getToken$1
      getToken$2
      initializeEnterprise
      internalFactory
      isValid
      loadReCAPTCHAEnterpriseScript
      makeDiv
      makeDummyTokenResult
      notifyTokenListeners
      queueWidgetRender
      registerAppCheck
      removeTokenListener
      renderInvisibleWidget
      setState
      sleep
      write
      writeTokenToIndexedDB
      writeTokenToStorage
      

      34 dependencies

      addTokenListener
      computeKey
      createTokenRefresher
      ensureActivated
      exchangeToken
      factory
      formatDummyToken
      getDBPromise
      getDurationString
      getExchangeRecaptchaEnterpriseTokenRequest
      getRecaptcha
      getState
      getToken$1
      getToken$2
      initTokenRefresher
      initializeEnterprise
      internalFactory
      isValid
      loadReCAPTCHAEnterpriseScript
      makeDiv
      makeDummyTokenResult
      notifyTokenListeners
      pad
      queueWidgetRender
      registerAppCheck
      removeTokenListener
      renderInvisibleWidget
      setBackoff
      setState
      sleep
      throwIfThrottled
      write
      writeTokenToIndexedDB
      writeTokenToStorage
      

      + getDurationString
      + initTokenRefresher
      + pad
      + setBackoff
      + throwIfThrottled

      variables

      18 dependencies

      APP_CHECK_NAME
      APP_CHECK_NAME_INTERNAL
      APP_CHECK_STATES
      BASE_ENDPOINT
      DB_NAME
      DB_VERSION
      DEFAULT_STATE
      ERRORS
      ERROR_FACTORY
      EXCHANGE_RECAPTCHA_ENTERPRISE_TOKEN_METHOD
      RECAPTCHA_ENTERPRISE_URL
      STORE_NAME
      TOKEN_REFRESH_TIME
      dbPromise
      defaultTokenErrorData
      logger
      name
      version
      

      19 dependencies

      APP_CHECK_NAME
      APP_CHECK_NAME_INTERNAL
      APP_CHECK_STATES
      BASE_ENDPOINT
      DB_NAME
      DB_VERSION
      DEFAULT_STATE
      ERRORS
      ERROR_FACTORY
      EXCHANGE_RECAPTCHA_ENTERPRISE_TOKEN_METHOD
      ONE_DAY
      RECAPTCHA_ENTERPRISE_URL
      STORE_NAME
      TOKEN_REFRESH_TIME
      dbPromise
      defaultTokenErrorData
      logger
      name
      version
      

      + ONE_DAY

      External Dependency Table

      ModuleBase (acc5810)Head (b9e890e)Diff
      @firebase/util

      Deferred
      ErrorFactory
      base64
      isIndexedDBAvailable
      

      Deferred
      ErrorFactory
      base64
      calculateBackoffMillis
      isIndexedDBAvailable
      

      + calculateBackoffMillis

    • ReCaptchaV3Provider

      Size Table

      TypeBase (acc5810)Head (b9e890e)Diff
      size
      9.48 kB
      10.9 kB
      +1.39 kB (+14.7%)
      size-with-ext-deps
      18.7 kB
      20.2 kB
      +1.55 kB (+8.3%)

      Dependency Table

      TypeBase (acc5810)Head (b9e890e)Diff
      functions

      29 dependencies

      addTokenListener
      computeKey
      createTokenRefresher
      ensureActivated
      exchangeToken
      factory
      formatDummyToken
      getDBPromise
      getExchangeRecaptchaV3TokenRequest
      getRecaptcha
      getState
      getToken$1
      getToken$2
      initializeV3
      internalFactory
      isValid
      loadReCAPTCHAV3Script
      makeDiv
      makeDummyTokenResult
      notifyTokenListeners
      queueWidgetRender
      registerAppCheck
      removeTokenListener
      renderInvisibleWidget
      setState
      sleep
      write
      writeTokenToIndexedDB
      writeTokenToStorage
      

      34 dependencies

      addTokenListener
      computeKey
      createTokenRefresher
      ensureActivated
      exchangeToken
      factory
      formatDummyToken
      getDBPromise
      getDurationString
      getExchangeRecaptchaV3TokenRequest
      getRecaptcha
      getState
      getToken$1
      getToken$2
      initTokenRefresher
      initializeV3
      internalFactory
      isValid
      loadReCAPTCHAV3Script
      makeDiv
      makeDummyTokenResult
      notifyTokenListeners
      pad
      queueWidgetRender
      registerAppCheck
      removeTokenListener
      renderInvisibleWidget
      setBackoff
      setState
      sleep
      throwIfThrottled
      write
      writeTokenToIndexedDB
      writeTokenToStorage
      

      + getDurationString
      + initTokenRefresher
      + pad
      + setBackoff
      + throwIfThrottled

      variables

      18 dependencies

      APP_CHECK_NAME
      APP_CHECK_NAME_INTERNAL
      APP_CHECK_STATES
      BASE_ENDPOINT
      DB_NAME
      DB_VERSION
      DEFAULT_STATE
      ERRORS
      ERROR_FACTORY
      EXCHANGE_RECAPTCHA_TOKEN_METHOD
      RECAPTCHA_URL
      STORE_NAME
      TOKEN_REFRESH_TIME
      dbPromise
      defaultTokenErrorData
      logger
      name
      version
      

      19 dependencies

      APP_CHECK_NAME
      APP_CHECK_NAME_INTERNAL
      APP_CHECK_STATES
      BASE_ENDPOINT
      DB_NAME
      DB_VERSION
      DEFAULT_STATE
      ERRORS
      ERROR_FACTORY
      EXCHANGE_RECAPTCHA_TOKEN_METHOD
      ONE_DAY
      RECAPTCHA_URL
      STORE_NAME
      TOKEN_REFRESH_TIME
      dbPromise
      defaultTokenErrorData
      logger
      name
      version
      

      + ONE_DAY

      External Dependency Table

      ModuleBase (acc5810)Head (b9e890e)Diff
      @firebase/util

      Deferred
      ErrorFactory
      base64
      isIndexedDBAvailable
      

      Deferred
      ErrorFactory
      base64
      calculateBackoffMillis
      isIndexedDBAvailable
      

      + calculateBackoffMillis

    • getToken

      Size Table

      TypeBase (acc5810)Head (b9e890e)Diff
      size
      6.87 kB
      7.10 kB
      +230 B (+3.3%)
      size-with-ext-deps
      16.0 kB
      16.3 kB
      +233 B (+1.5%)

      Dependency Table

      TypeBase (acc5810)Head (b9e890e)Diff
      functions

      21 dependencies

      addTokenListener
      computeKey
      createTokenRefresher
      ensureActivated
      factory
      formatDummyToken
      getDBPromise
      getState
      getToken
      getToken$2
      internalFactory
      isValid
      makeDummyTokenResult
      notifyTokenListeners
      registerAppCheck
      removeTokenListener
      setState
      sleep
      write
      writeTokenToIndexedDB
      writeTokenToStorage
      

      22 dependencies

      addTokenListener
      computeKey
      createTokenRefresher
      ensureActivated
      factory
      formatDummyToken
      getDBPromise
      getState
      getToken
      getToken$2
      initTokenRefresher
      internalFactory
      isValid
      makeDummyTokenResult
      notifyTokenListeners
      registerAppCheck
      removeTokenListener
      setState
      sleep
      write
      writeTokenToIndexedDB
      writeTokenToStorage
      

      + initTokenRefresher

    • initializeAppCheck

      Size Table

      TypeBase (acc5810)Head (b9e890e)Diff
      size
      10.6 kB
      11.0 kB
      +449 B (+4.3%)
      size-with-ext-deps
      20.1 kB
      20.6 kB
      +453 B (+2.3%)

      Dependency Table

      TypeBase (acc5810)Head (b9e890e)Diff
      functions

      35 dependencies

      _activate
      addTokenListener
      computeKey
      createTokenRefresher
      ensureActivated
      exchangeToken
      factory
      formatDummyToken
      getDBPromise
      getDebugState
      getDebugToken
      getExchangeDebugTokenRequest
      getState
      getToken$2
      initializeAppCheck
      initializeDebugMode
      internalFactory
      isDebugMode
      isValid
      makeDummyTokenResult
      notifyTokenListeners
      read
      readDebugTokenFromIndexedDB
      readOrCreateDebugTokenFromStorage
      readTokenFromIndexedDB
      readTokenFromStorage
      registerAppCheck
      removeTokenListener
      setState
      sleep
      uuidv4
      write
      writeDebugTokenToIndexedDB
      writeTokenToIndexedDB
      writeTokenToStorage
      

      36 dependencies

      _activate
      addTokenListener
      computeKey
      createTokenRefresher
      ensureActivated
      exchangeToken
      factory
      formatDummyToken
      getDBPromise
      getDebugState
      getDebugToken
      getExchangeDebugTokenRequest
      getState
      getToken$2
      initTokenRefresher
      initializeAppCheck
      initializeDebugMode
      internalFactory
      isDebugMode
      isValid
      makeDummyTokenResult
      notifyTokenListeners
      read
      readDebugTokenFromIndexedDB
      readOrCreateDebugTokenFromStorage
      readTokenFromIndexedDB
      readTokenFromStorage
      registerAppCheck
      removeTokenListener
      setState
      sleep
      uuidv4
      write
      writeDebugTokenToIndexedDB
      writeTokenToIndexedDB
      writeTokenToStorage
      

      + initTokenRefresher

    • onTokenChanged

      Size Table

      TypeBase (acc5810)Head (b9e890e)Diff
      size
      6.97 kB
      7.20 kB
      +230 B (+3.3%)
      size-with-ext-deps
      16.1 kB
      16.4 kB
      +233 B (+1.4%)

      Dependency Table

      TypeBase (acc5810)Head (b9e890e)Diff
      functions

      21 dependencies

      addTokenListener
      computeKey
      createTokenRefresher
      ensureActivated
      factory
      formatDummyToken
      getDBPromise
      getState
      getToken$2
      internalFactory
      isValid
      makeDummyTokenResult
      notifyTokenListeners
      onTokenChanged
      registerAppCheck
      removeTokenListener
      setState
      sleep
      write
      writeTokenToIndexedDB
      writeTokenToStorage
      

      22 dependencies

      addTokenListener
      computeKey
      createTokenRefresher
      ensureActivated
      factory
      formatDummyToken
      getDBPromise
      getState
      getToken$2
      initTokenRefresher
      internalFactory
      isValid
      makeDummyTokenResult
      notifyTokenListeners
      onTokenChanged
      registerAppCheck
      removeTokenListener
      setState
      sleep
      write
      writeTokenToIndexedDB
      writeTokenToStorage
      

      + initTokenRefresher

    • setTokenAutoRefreshEnabled

      Size Table

      TypeBase (acc5810)Head (b9e890e)Diff
      size
      7.00 kB
      7.23 kB
      +230 B (+3.3%)
      size-with-ext-deps
      16.2 kB
      16.4 kB
      +233 B (+1.4%)

      Dependency Table

      TypeBase (acc5810)Head (b9e890e)Diff
      functions

      21 dependencies

      addTokenListener
      computeKey
      createTokenRefresher
      ensureActivated
      factory
      formatDummyToken
      getDBPromise
      getState
      getToken$2
      internalFactory
      isValid
      makeDummyTokenResult
      notifyTokenListeners
      registerAppCheck
      removeTokenListener
      setState
      setTokenAutoRefreshEnabled
      sleep
      write
      writeTokenToIndexedDB
      writeTokenToStorage
      

      22 dependencies

      addTokenListener
      computeKey
      createTokenRefresher
      ensureActivated
      factory
      formatDummyToken
      getDBPromise
      getState
      getToken$2
      initTokenRefresher
      internalFactory
      isValid
      makeDummyTokenResult
      notifyTokenListeners
      registerAppCheck
      removeTokenListener
      setState
      setTokenAutoRefreshEnabled
      sleep
      write
      writeTokenToIndexedDB
      writeTokenToStorage
      

      + initTokenRefresher

resolveImportMeta(property, { moduleId }) {
if (property === 'url') {
// copied from rollup output
return `new (require('u' + 'rl').URL)('file:' + __filename).href`;
Copy link
Contributor

Choose a reason for hiding this comment

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

what does separating the string do?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's what rollup outputs. I don't think it matters though. Updated

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Nov 17, 2021

Binary Size Report

Affected SDKs

  • @firebase/app-check

    Type Base (acc5810) Head (b9e890e) Diff
    browser 22.3 kB 25.1 kB +2.80 kB (+12.5%)
    esm5 26.6 kB 29.7 kB +3.05 kB (+11.4%)
    main 27.8 kB 30.9 kB +3.03 kB (+10.9%)
    module 22.3 kB 25.1 kB +2.80 kB (+12.5%)
  • @firebase/firestore

    Type Base (acc5810) Head (b9e890e) Diff
    main 423 kB 423 kB -541 B (-0.1%)
  • bundle

    Type Base (acc5810) Head (b9e890e) Diff
    app-check (CustomProvider) 26.9 kB 27.4 kB +453 B (+1.7%)
    app-check (ReCaptchaEnterpriseProvider) 27.8 kB 29.6 kB +1.77 kB (+6.3%)
    app-check (ReCaptchaV3Provider) 27.8 kB 29.6 kB +1.77 kB (+6.4%)
  • firebase

    Type Base (acc5810) Head (b9e890e) Diff
    firebase-app-check-compat.js 20.8 kB 22.7 kB +1.90 kB (+9.1%)
    firebase-app-check.js 80.4 kB 89.8 kB +9.41 kB (+11.7%)
    firebase-compat.js 749 kB 751 kB +1.81 kB (+0.2%)

Test Logs

Copy link
Contributor

@schmidt-sebastian schmidt-sebastian left a comment

Choose a reason for hiding this comment

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

FYI I don't think I have enough context to provide a meaningful review. Please ping me if you need input.

@Feiyang1 Feiyang1 merged commit ce39a1a into master Nov 17, 2021
@Feiyang1 Feiyang1 deleted the fei-require branch November 17, 2021 19:43
@google-oss-bot google-oss-bot mentioned this pull request Nov 17, 2021
@firebase firebase locked and limited conversation to collaborators Dec 18, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Upgrade to 9.2.0 gives error in jest unit tests
4 participants