Repository navigation
Conversation
Conditional export detection keeps the last matching assignment, even when its branch cannot run. This PoC makes final export outcomes conditional on control flow through an opt-in detection baseline. The third parse argument selects a versioned baseline that can combine detection rules. The default call retains its current behavior and result. This is a bounded syntax experiment. Unsupported syntax, opaque effects, and analysis limits produce unknown outcomes instead of speculative export lists. Synchronous ESM parsing includes the analyzer in the bundle, which adds about 18 KB. Refs: #99
Flow reports distinguish sequential replacements from conditional alternatives. Default calls defer the report until its first read so legacy consumers avoid control-flow parsing. Unsupported effects remain unknown. Reusing scalar lexer stacks reduces empty JavaScript parses from 4.05 us to 177 ns and from 4.32 us to 187 ns. Two fresh Node 22.23.3 processes use V8 12.4.254.21-node.57, 50k warmup iterations, and seven alternating 30k-iteration trials. Each result excludes the fastest and slowest trials. The Wasm counter adds a small cost without an additional host/guest call. Conditional reports can be slower because the lexer must establish the trigger first. Refs: #99
Conditional replacements lose live dependencies when only the last syntactic assignment is reported. Reexport groups separate alternative final values and combine dependencies spread into one value. The third argument retains an explicit legacy baseline. Flow analysis starts after two detected replacements and has one C owner for both parser entries. Unsupported effects produce incomplete results rather than guessed exports. Zero or one replacement retains the existing fast path. Against f580443, conditional analysis falls from 4.57 to 2.86 us in CommonJS and 4.23 to 1.90 us in Wasm. Straight replacements add about 0.90 us in CommonJS and 0.44 us in Wasm. The shared C owner keeps this bounded cost on the active path. Measurements use Node 22.23.3, V8 12.4.254.21-node.57, 50,000 warmups, 20,000 iterations per trial, seven alternating trials, and two fresh processes. Each run removes the best and worst trials. Refs: #99
Wrapping a single outcome changes the dependency shape for deterministic modules. Preserve their flat lists and nest only distinct conditional lists. The overloads reject undefined options although the runtime accepts them, which prevents callers from forwarding an optional third argument. Refs: #99
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.
Conditional export detection keeps the last matching assignment, even when its branch cannot run. This PoC makes final export outcomes conditional on control flow through an opt-in detection baseline.
The third
parseargument selects a versioned baseline that can combine detection rules. The default call retains its current behavior and result. This is a bounded syntax experiment. Unsupported syntax, opaque effects, and analysis limits produce unknown outcomes instead of speculative export lists.Synchronous ESM parsing includes the analyzer in the bundle, which adds about 18 KB.
Refs: #99