ipld / js-ipld-block

Implementation of the Block data structure in JavaScript.
MIT License
13 stars 16 forks source link

fix: add buffer #50

Closed hugomrdias closed 4 years ago

codecov[bot] commented 4 years ago

Codecov Report

Merging #50 into master will increase coverage by 1.09%. The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #50      +/-   ##
==========================================
+ Coverage   84.61%   85.71%   +1.09%     
==========================================
  Files           1        1              
  Lines          13       14       +1     
==========================================
+ Hits           11       12       +1     
  Misses          2        2              
Impacted Files Coverage Δ
src/index.js 85.71% <100.00%> (+1.09%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 856bd53...658e2d4. Read the comment docs.

mikeal commented 4 years ago

What does this fix?

Isn’t the buffer module already pulled in to polyfill the Buffer API by bundlers? This potentially introduces a condition in which there is more than one Buffer module in a bundle due to version discrepancies.

hugomrdias commented 4 years ago

Isn’t the buffer module already pulled in to polyfill the Buffer API by bundlers?

this will be removed by bundlers plus current polyfill are outdated

This potentially introduces a condition in which there is more than one Buffer module in a bundle due to version discrepancies.

this was already happening cause same module explicitly require others don't

mikeal commented 4 years ago

sigh...

I’d love to get off of Buffer but it’s proving to be much more difficult than I had anticipated. The vast majority of the polyfill is never used but actually removing an interface that is passed around so much has proven impractical.

hugomrdias commented 4 years ago

me too i have being looking at your bytesish module a lot, but as you said its hard plus we are now using bufferlist in multiple places. would love to brainstorm this

mikeal commented 4 years ago

ya, i’ve used bytesish all over the place but it doesn’t quite solve the problem, it just moves around the responsibility and makes it a little easier to not rely on anything.

maybe we should start a thread somewhere about all the different approaches we might consider. i’m sure @rvagg has thought about this quite a bit as well, and there are a few things that bl does that are missing from all the binary interfaces we have available.