Repository navigation
feat(p2-shim): add buffered input stream helper for browser cli stdin - #2236
Merged
vados-cosmonic merged 1 commit intoOct 13, 2026
Merged
vados-cosmonic merged 1 commit into
vados-cosmonic merged 1 commit into
Conversation
eduardomourar
requested review from
andreiltd and
vados-cosmonic
as code owners
October 9, 2026 10:56
github-merge-queue
Bot
removed this pull request from the merge queue due to a conflict with the base branch
Oct 11, 2026
Collaborator
|
Hey @eduardomourar on second thought here -- would you mind moving this helper actually to a different file and exporting them from a new export like I want to improve the DX here like you have done but I'd like to separate the helpers from the actual implementation-specific code |
vados-cosmonic
force-pushed
the
fix-browser-cli-buffered-stdin
branch
4 times, most recently
from
October 13, 2026 14:58
2f16185 to
fa46c19
Compare
vados-cosmonic
previously approved these changes
Oct 13, 2026
vados-cosmonic
force-pushed
the
fix-browser-cli-buffered-stdin
branch
from
October 13, 2026 15:18
fa46c19 to
460f567
Compare
Collaborator
|
🎉 The code in this PR was made available in the following release: |
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.
Summary
Every host feeding a guest a fixed stdin buffer hand-rolls the same bounded
InputStreamHandler, and it's easy to get the"closed"transition or u64 length truncation subtly wrong.Changes
bufferedInputStream(bytes)in a newsrc/browser/helpers/cli.ts, so hosts can pass it straight tocreateCli({ stdin })(or_setStdin) instead of hand-rolling it.iopollables), so it is exposed from an explicitbrowser/helpers/clisubpath export rather than the platform-neutral./*wildcard. This keeps convenience helpers separate from the shim's implementation and the underscore-prefixed configuration surface, and makes the browser-only nature visible in the import path:docs/src/advanced/preview2-shim-helpers/cli.md), coveringcreateCli,WASIShim, and the global setter. The package README only mentions the helper and links to that page. feat(p2-shim): add host-side write/read helpers for browser preopens #2237 adds a siblingfilesystem.mdunder the same group, so whichever lands second has a one-lineSUMMARY.mdconflict.Node consumers now get the Node typings
The
.and./*exports had a top-leveltypespointing at the browser.d.tsahead of thenodeblock. TypeScript undernodenextincludesnodein its condition set but stops at the first matching condition, so Node consumers were typed against the browser build. Thetypesentries are now nested undernodeanddefaultwith no top-leveltypeskey, which oxfmt's package.json sorting leaves alone. Verified with a consumer project:moduleResolution: nodenextresolvesdist/nodejs/*.d.ts,moduleResolution: bundlerresolvesdist/browser/*.d.ts, and Node runtime resolution is unchanged. The same hunk is in #2237 so the two merge cleanly in either order.