Stub polyfill for summaryDelayLoadedModule for cases where the client never summarizes#27611
Open
TommyBrosman wants to merge 3 commits into
Open
Stub polyfill for summaryDelayLoadedModule for cases where the client never summarizes#27611TommyBrosman wants to merge 3 commits into
TommyBrosman wants to merge 3 commits into
Conversation
Contributor
|
Hi! Thank you for opening this PR. Want me to review it? Based on the diff (131 lines, 2 files), I've queued these reviewers:
How this works
|
Contributor
Bundle size comparisonBase commit: Notable changesNo bundles changed by ≥ 500 bytes parsed. Per-bundle deltas
|
TommyBrosman
added a commit
to TommyBrosman/FluidFramework
that referenced
this pull request
Jun 30, 2026
The summarizer is already factored into a delay-loaded leaf module (summary/summaryDelayLoadedModule/index.js), but its implementation classes (Summarizer, RunningSummarizer, ...) are also part of the package's public API, so the ~28 KB subgraph is pinned into every bundle that touches that API. For a single-chunk mobile bundle that summarizes server-side and never instantiates a client summarizer, this is dead weight. Add the stub-polyfill (the "summarizer approach"): - summary/summaryDelayLoadedModuleStub.ts: re-exports the same value symbols; the classes throw on construction (fail fast), constants keep real values. From PR microsoft#27611. - test/summary/summaryDelayLoadedModuleStub.spec.ts: compile-time requireAssignableTo (both directions) keeping the stub's value exports in sync with the real module. - Wire NormalModuleReplacementPlugin into the encapsulated-no-tree scenario to redirect both the await-import seam and the public-API value re-exports to the stub, so the real subgraph never enters the bundle. Public API names remain exported (as throwing stubs). Bundle impact (encapsulated-no-tree, single chunk): 585,184 -> 546,425 B parsed (-38,759), 151,269 -> 142,246 B gzip (-9,023). The 28,215 B summaryDelayLoadedModule subgraph plus ~10 KB of terser dead-code elimination of now-unreachable code. 957 container-runtime tests pass (the real module is unchanged and still exercised by the test suite). Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.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.
There are cases where a particular client will never summarize (for example, if summarization occurs on the server). We can provide a polyfill for these cases, which can save > 39 KiB parse size.
Related: #27597 enforces the fact that summaryDelayLoadedModule's declarations are only used in the delay-load path. This is an important invariant that allows us to safely polyfill the module without the risk of code outside of the guarded delay load path consuming declarations from summaryDelayLoadedModule.
Description
Reviewer Guidance
Todo