-
Notifications
You must be signed in to change notification settings - Fork 33
feat: update to new libp2p interfaces #134
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: update to new libp2p interfaces #134
Conversation
Updates this module to use the `@libp2p/*` set of modules as part of the typescript port. - Renames imports to add .js suffix - Renames bundled `@types/*.d.ts` to `@types/*.ts` because tsc ignores `.d.ts` which masks errors - Updates project config to output ESM instead of CJS code - Updates all deps to lastest versions including ones that have gone ESM-only - Re-generates protobuf code with the ES6 target N.b. `pbjs` generates invalid imports for bundler-less ESM - the `.js` suffix has to be added to the import manually so it's best not rebuild the protobuf generated code unless you know something has changed. BREAKING CHANGE: This module now outputs ESM code only
Running the benchmarks the performance is similar, slightly slower: New:
Old:
|
Codecov Report
@@ Coverage Diff @@
## master #134 +/- ##
==========================================
- Coverage 85.91% 81.21% -4.71%
==========================================
Files 16 26 +10
Lines 1839 2864 +1025
Branches 235 279 +44
==========================================
+ Hits 1580 2326 +746
- Misses 259 538 +279
Continue to review full report at Codecov.
|
Thank you so much! before merging this Lodestar must switch to ESM too, so we'll wait for that to happen |
I'm not sure it's necessary to wait, this can (and should) be published as a major, Lodestar can use the previous version until it's ready to upgrade? |
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.
Looks good to me! @achingbrain yeah you are right we can merge this and keep using the current version is Lodestar. And backport fixes if necessary.
(source: Iterable<Uint8Array>): AsyncIterableIterator<Uint8Array> | ||
} | ||
import type { Transform } from 'it-stream-types' | ||
import type { IHandshake } from './@types/handshake-interface.js' |
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.
This is so weird. Is there a reason why .d.ts is not ok anymore
like it should not be compiled to js
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.
From the way I understand it, .d.ts
files are meant to be machine generated so they aren't parsed and validated like regular .ts
files.
We've certainly shipped a lot of broken types in the past due to hand-rolled .d.ts
files - things like import paths being wrong etc don't trigger errors so it's a lot safer this way.
Will this get a release soon? It's the last piece of the puzzle before I can open the ts PR for libp2p itself. |
will do now |
https://github.com/ChainSafe/js-libp2p-noise/releases/tag/v6.0.0 |
Updates this module to use the
@libp2p/*
set of modules as part of the typescript port.@types/*.d.ts
to@types/*.ts
because tsc ignores.d.ts
which masks errorsbl
forUint8ArrayList
N.b.
pbjs
generates invalid imports for bundler-less ESM - the.js
suffix has to be added to the import manually so it's best not rebuild the protobuf generated code unless you know something has changed.BREAKING CHANGE: This module now outputs ESM code only