Skip to content

Add Node build for Firebase Storage #5468

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 7 commits into from
Oct 20, 2021
Merged

Conversation

schmidt-sebastian
Copy link
Contributor

This adds a Node and a Browser specific build so we can have getStream() in Node and getBlob() in browsers

This reduces the diff for #4973.

@changeset-bot
Copy link

changeset-bot bot commented Sep 9, 2021

⚠️ No Changeset found

Latest commit: 1fa7ce9

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

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

@github-actions
Copy link
Contributor

github-actions bot commented Sep 9, 2021

Changeset File Check ✅

  • No modified packages are missing from the changeset file.
  • No changeset formatting errors detected.

This adds a Node and a Browser specific build so we can have getStream() in Node and getBlob() in browsers
* limitations under the License.
*/

// TODO(mrschmidt): Add getStream()
Copy link
Member

@Feiyang1 Feiyang1 Sep 20, 2021

Choose a reason for hiding this comment

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

Not a big fan of having different API for browser and node.
It makes it harder for developers to write isomorphic code for use cases like SSR. It also makes documentation harder, as we need to document the differences. We will also need to provide 2 typing files.

What does getStream do? Is it possible to make it part of getBlob with a flag?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't think we can combine getBlob and getStream. The Blob API is not available in Node, and Streams are not available for Browsers.

I have two suggestions:

  • Remove getStream()
  • Export getBytes()/getBlob() for all platforms, but make it throw for platforms that are not supported.

I updated the PR to throw.

Copy link
Member

Choose a reason for hiding this comment

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

Okay. I agree with throwing and keeping the same API for browser and node. We have taken the same approach in Auth to keep their node and browser API consistent.

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Oct 14, 2021

Binary Size Report

Affected SDKs

  • @firebase/storage

    Type Base (b6f30c2) Head (bda2c21) Diff
    main 53.6 kB 53.6 kB -51 B (-0.1%)

Test Logs

@google-oss-bot
Copy link
Contributor

google-oss-bot commented Oct 14, 2021

Size Analysis Report

Affected Products

No changes between base commit (b6f30c2) and head commit (bda2c21).

@google-oss-bot google-oss-bot added the doc-changes PRs that affect docs label Oct 14, 2021
* retrieve.
* @returns A Promise that resolves with a Blob containing the object's bytes
*/
function getBlob(
Copy link
Member

Choose a reason for hiding this comment

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

Should it be exported here and in api.node.ts?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That would immediately add it to the public API. Let me suppress the warning for now.

@egilmorez egilmorez requested a review from markarndt October 18, 2021 18:34
@Feiyang1 Feiyang1 removed their assignment Oct 20, 2021
@schmidt-sebastian schmidt-sebastian merged commit fc9ec0f into master Oct 20, 2021
@schmidt-sebastian schmidt-sebastian deleted the mrschmidt/nodebuild branch October 20, 2021 16:39
@firebase firebase locked and limited conversation to collaborators Nov 20, 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.

5 participants