deps: upgrade to aegir v48#3495
Draft
tabcat wants to merge 6 commits into
Draft
Conversation
aegir 48 ships TypeScript 6.x with a generic `Uint8Array` and runs Node tests directly against `.ts` sources without a build step. Rewrite relative `.js` imports to `.ts`, cast `Uint8Array` at WebCrypto / WebSocket / DataChannel / X509 boundaries, and drop the node webcrypto type leak in @libp2p/crypto. Logger now imports `Debugger` from weald (the @types/debug ambient namespace is no longer auto-included), and the OpenTelemetry generator wrappers expose `[Symbol.dispose]` / `[Symbol.asyncDispose]` to satisfy TS 6's tighter Generator interfaces. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The previous commit's import-rewrite script only matched `import ... from` forms, missing bare `import './foo.js'` side-effect imports. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The node-side import existed only because Electron 18 lacked `globalThis.crypto`. Aegir 48 ships Electron 41/42 (Node 22-based) so the workaround is obsolete. Both files now collapse to a single module that returns `globalThis.crypto`, keeping the browser-side insecure-context check. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The previous Symbol.dispose impl delegated to the inner iterator's dispose without running the wrapper's return path, leaving the span unended when callers used `using gen = ...` or called `gen.return()` directly. return() now ends the span with OK status, and dispose funnels through return() for consistent cleanup. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
…ose" This reverts commit 52c446e.
# Conflicts: # interop/package.json # packages/connection-encrypter-plaintext/package.json # packages/connection-encrypter-tls/package.json # packages/keychain/package.json # packages/libp2p-daemon-client/package.json # packages/logger/package.json # packages/metrics-opentelemetry/package.json # packages/metrics-prometheus/package.json # packages/peer-discovery-bootstrap/package.json # packages/peer-discovery-mdns/package.json # packages/protocol-autonat-v2/package.json # packages/protocol-autonat/package.json # packages/protocol-fetch/package.json # packages/protocol-identify/package.json # packages/protocol-perf/package.json # packages/protocol-ping/package.json # packages/stream-multiplexer-mplex/package.json # packages/transport-circuit-relay-v2/package.json # packages/transport-memory/package.json # packages/upnp-nat/package.json
Member
Author
|
@dozyio could split this up into separate prs, lmk |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
aegir 48 ships TypeScript 6.x with a generic
Uint8Arrayand runs Node tests directly against.tssources without a build step.Changes in this PR:
^48.0.4across allpackage.jsonfiles (51).jsimports to.tsin.tssources — Node strip-types resolves paths literally, so.json a TS source breaks tests when no build step has run@libp2p/crypto's node and browser webcrypto shims into one file usingglobalThis.crypto— the Electron 18 workaround that motivated splitting them is obsolete now that aegir ships Electron 41/42Uint8Arrayat WebCrypto / WebSocket / RTCDataChannel / X509 / WebTransport boundaries — TS 6's defaultUint8Array<ArrayBufferLike>is no longer assignable toBufferSourceDebuggerfromwealdin@libp2p/logger— the ambient@types/debugnamespace is no longer auto-included now that aegir restrictstypes: ["@types/mocha", "@types/node"][Symbol.dispose]/[Symbol.asyncDispose]on the OpenTelemetry generator wrappers — TS 6'sGenerator/AsyncGeneratorinterfaces require themThe bulk of the diff (~700 lines) is the mechanical
.js→.tsimport rewrite. Code changes are concentrated in@libp2p/crypto,@libp2p/keychain,@libp2p/logger,@libp2p/metrics-opentelemetry,@libp2p/connection-encrypter-tls,@libp2p/transport-{websockets,webrtc,webtransport}.Notes & open questions
There are 28
as Uint8Array<ArrayBuffer>casts at WebCrypto / native-API call sites. Eliminating them would require either (a) tightening the function/iterator input type (e.g.msg: Uint8Array<ArrayBuffer> | Uint8ArrayListinhashAndSign, orUint8ArrayListitself yieldingUint8Array<ArrayBuffer>from upstream) — a breaking change for callers that currently pass a genericUint8Array<ArrayBufferLike>— or (b) copying vianew Uint8Array(buf), which adds a memcpy in hot paths (websocket/datachannel send, signing). Casts are the pragmatic answer; runtime is correct because libp2p never usesSharedArrayBuffer.A follow-up PR will tighten
@libp2p/crypto's output types (e.g.privateKeyToProtobuf) to returnUint8Array<ArrayBuffer>— non-breaking (subtype) and lets downstream consumers drop@ts-expect-errorworkarounds when feeding crypto outputs into native APIs likenew Blob([...]).Change checklist