-
-
Notifications
You must be signed in to change notification settings - Fork 428
feat: remove Buffer dependency #740
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
Draft
billiegoose
wants to merge
5
commits into
main
Choose a base branch
from
feat/no-buffer
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Thank you wmhilton! I auto-formatted the code using prettier-standard. 🤖 |
Test Results for 4079e47:
|
Test Results for 4079e47:
|
Test Results for 4079e47:
|
Test Results for f072726:
|
Test Results for f072726:
|
Test Results for f072726:
|
Closed
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I'm making a BREAKING CHANGE
Relax! I won't merge this for a while. And it's not really that big a change. In fact it's possible that it won't be a breaking change on Node, since Node
Buffer
s are instances ofArrayBuffer
, you'd still be able to pass inBuffer
s to all the APIs. And depending on where the internalArrayBuffer
s are sourced from (i.e. a call tofs.readFile
), the processed objects might still beBuffer
instances when they get returned from the APIs.Background
I really want

isomorphic-git
to be used in PWAs. I really think that git provides an excellent backbone for making some really interesting P2P social networking apps. So I really want the library to provide a good experience on mobile, which means fast to download (among other things). I'm really close to under 1 second download over 3G internet connections:but the low-hanging fruit to trim off is mostly gone. Unless there's a replacement for
pako
(native zlib in the browser please?!) or I remove full error messages from the production bundle similar to React, it's gonna be hard to get the bundle size smaller. The last low-hanging fruit is the Node.jsBuffer
polyfill that is provided by Webpack - a polyfill so huge largely because it still supports ancient browsers that the rest ofisomorphic-git
doesn't work on anyway.That juicy almost-9% has been tempting me for almost half a year now, ever since I wrote
lightning-fs@3.0
which provides a browser filesystem that doesn't use theBuffer
polyfill at all.I'm not 100% sure that none of my dependencies aren't using Buffer though. :-( So it's possible that even after eliminating Buffer from my code it'll still be present in the bundle. So this is a WIP / experiment.
Edit: Oh eliminating
Buffer
also gets us closer to a good experience for Angular users (#597) and other environments (#698).