-
Notifications
You must be signed in to change notification settings - Fork 26
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
feat(js-client): Update libp2p ecosystem [fixes DXJ-551] #393
Conversation
formats: ["es"], | ||
}, | ||
outDir: "./dist/browser", | ||
rollupOptions: { | ||
plugins: [ | ||
{ | ||
// @ts-ignore | ||
// @ts-expect-error Types doesn't work here. Hack |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried in my VSCode and I don't even see any TS error here to disable
But I see enforce: "post",
down below has error though
Are you sure enforce: "post",
is working. I don't even know what it's doing.
Either way for me pnpm -r build
works even if I remove this comment completely. The message in the comment doesn't give any value for the reader anyway in my opinion
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My IDE show the error here for some reason. Looks like it doesn't affect anything, so yeah, i removed comment there.
const buffer = Uint8Array.from(atob(wasmContent), (m) => { | ||
return m.codePointAt(0) ?? 0; | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
are you sure this operation is correct and safe? Looks a bit sketchy, I would at least move it to a separate function and give it a readable name so at least it's easier to understand what is happening really. Also you have several variables that contain the word buffer
. Maybe rename it to something more useful (and it's not buffer anymore as well)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it's still buffer. Buffer is an array of bytes and instances of Uint8Array are buffers.
Regarding this line: codePointAt
can return undefined
there if m
variable is an empty string. But this should be impossible here, as a callback iterates over symbols. I will add comment there to make it clearer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for not noticing the comment. In Node.js terms actually the reverse is true: https://nodejs.org/api/buffer.html#buffer
Buffer is a subclass of Uint8Array - basically this is the reason I suggested the change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense i think. I can use different naming to separate it from node:buffer
No description provided.