refactor(net): fold the UTF-8 codecs into bytes.ts and make mount a droppable feature - #253
Merged
Merged
Conversation
…roppable feature Two alignment moves from the #246 review, matching the conventions the data modules pinned: - framework/src/bytes.ts is the one home for module-SDK byte codecs: it gains stringToUtf8 (lone surrogates become U+FFFD), and net-api.ts plus hosts/sim/net.ts drop their hand-rolled UTF-8 encoder/decoder/length copies for the shared spellings. - pocket-net follows the pocket-fs feature split: `mount` (default) carries the pocket-mod adapter and NetSurface; `default-features = false` drops pocket-mod and compiles NetCore alone for firmware with its own QuickJS wiring. The unused direct rquickjs dependency is gone (the adapter uses pocket_mod::qjs). Verified: gate 11/11, tsc clean, cargo test -p pocket-net 5/5, clippy -D warnings clean with and without default features, cargo check --workspace clean. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
The two follow-ups recorded in the #246 review, aligning the net module with the conventions the data modules (#231/#238) pinned:
Shared codecs
framework/src/bytes.tsis the one home for module-SDK byte codecs. It gainsstringToUtf8(lone surrogates become U+FFFD, so output is always well-formed UTF-8), andframework/src/net-api.ts+hosts/sim/net.tsdrop their hand-rolled UTF-8 encoder/decoder/length copies for the shared spellings.PocketResponse.text()keeps itsnet:-prefixed error message.mountas a droppable featurepocket-netfollows thepocket-fspattern: featuremount(default) carries the pocket-mod adapter andNetSurface;default-features = falsedrops pocket-mod and compilesNetCorealone for firmware with its own QuickJS wiring. The unused directrquickjsdependency is removed — the adapter reaches QuickJS throughpocket_mod::qjs.docs/NET.mddocuments the split the waydocs/FS.mddoes.Verified
bun run test— 11/11 stages greenbunx tsc --noEmit— cleancargo test -p pocket-net— 5/5 (mount round-trip included)cargo check -p pocket-net --no-default-features— cleancargo clippy -p pocket-net --all-targets -- -D warnings— clean, both feature setscargo check --workspace— clean🤖 Generated with Claude Code