xtuc / webassemblyjs

Toolchain for WebAssembly
https://webassembly.js.org
MIT License
779 stars 90 forks source link

use uint8array instead #1134

Closed jimmywarting closed 5 months ago

jimmywarting commented 1 year ago

just browsing the code and just having a look at it to see if it's something i would use...

something i notice right from the bat, is that you are using NodeJS specific stuff, and i'm targeting both browser and Deno, so i would prefer if you used uint8array + dataview instead.

Here is just one example... https://github.com/xtuc/webassemblyjs/blob/255ab4de257925d7893f0ad7223fdd29c873cd44/packages/leb128/src/bufs.js#L87

don't really wish to ship node specific stuff that works slower in the browser than using say eg TextEncoder/TextDecoder etc...

xtuc commented 1 year ago

Thanks for the report. Please feel free to send a change to fix

wikiwong commented 1 year ago

hey @xtuc , I've got a local branch to experiment with removing the node specific Buffer dependency. I'd like to test this by linking the project I'm importing @webassemblyjs/wasm-parser from to my local machine using npm link. Do you happen to know if there is an easy way to do this?

wikiwong commented 1 year ago

Opened a PR for this: https://github.com/xtuc/webassemblyjs/pull/1144