Skip to content
This repository was archived by the owner on Jul 10, 2025. It is now read-only.

feat(js-client): Update libp2p ecosystem [fixes DXJ-551] #393

Merged
merged 7 commits into from
Dec 6, 2023
Merged

Conversation

akim-bow
Copy link
Contributor

@akim-bow akim-bow commented Dec 5, 2023

No description provided.

Copy link

linear bot commented Dec 5, 2023

formats: ["es"],
},
outDir: "./dist/browser",
rollupOptions: {
plugins: [
{
// @ts-ignore
// @ts-expect-error Types doesn't work here. Hack
Copy link
Contributor

@shamsartem shamsartem Dec 5, 2023

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

Copy link
Contributor Author

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.

Comment on lines 55 to 57
const buffer = Uint8Array.from(atob(wasmContent), (m) => {
return m.codePointAt(0) ?? 0;
});
Copy link
Contributor

@shamsartem shamsartem Dec 5, 2023

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)

Copy link
Contributor Author

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.

Copy link
Contributor

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

Copy link
Contributor Author

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

@fluencebot fluencebot mentioned this pull request Dec 6, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
e2e Run e2e workflow
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants