Repository navigation
feat: unevalStream - #218
Draft
elliott-with-the-longest-name-on-github wants to merge 4 commits into
Draft
elliott-with-the-longest-name-on-github wants to merge 4 commits into
elliott-with-the-longest-name-on-github wants to merge 4 commits into
Conversation
Synchronous unevalStream(value, replacer, options) returning { head, tail, id }, built on the uneval emitter. Adds an internal `enter` emitter hook so the session records client locations during the emitter's own walk, and moves the replacer result check to a shared `call_replacer` util.
Adds an expect_roundtrip harness that checks every case across settlement orders, separate and concatenated evaluation, identity, once-per-identity replacer calls, and session cleanup. Ports random-graph, UTF-8 transport and security regressions from elliott/warp. Tail blocks now end in a semicolon so they can be concatenated.
Exports UnevalStreamOptions and UnevalStreamResult and uses them in unevalStream's JSDoc. Documents usage, guarantees, options, constraints and custom thenables.
🦋 Changeset detectedLatest commit: f738f78 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
elliott-with-the-longest-name-on-github
added this pull request to stack #220
October 6, 2026 19:13
unevalStream
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.
Adds
unevalStream, a streaming version ofunevalfor values that contain promises. This is a much smaller alternative to #183, which had grown to ~3,450 lines plus ~9,500 lines of tests.headis an expression that recreates the value with every promise pending, no matter what has already settled, so the output is deterministic and doesn't depend on timing. Callers that want already-settled promises inlined can fold them in themselves with the replacer (js`Promise.resolve(${value})`).tailis an async iterable of statement blocks that settle those promises as they settle on the server. A settled value can contain more promises, which later blocks settle.headand every block, and the replacer is called at most once per object for the whole stream.id(stable session key, for when heads need to be byte-identical),scope(where the client session table lives,globalThis.__dby default),signalandonerror.It's built on the existing
unevalemitter. The emitter gets a few internal hooks (enter,replace,reference,retain), so the stream can record where each object lives on the client during the emitter's own walk and refer to it by path in later blocks.Tests are a table-driven round-trip harness. It checks every case across settlement orders, evaluating blocks separately vs. concatenated, identity, once-per-object replacer calls and session cleanup. On top of that are random-graph, UTF-8 transport and security regressions ported from #183.
Stack created with GitHub Stacks CLI • Give Feedback 💬