Polyfills cleanup - #2254
Merged
Merged
Conversation
XP 8 runs on GraalVM 25, which lets us drop most of the hand-rolled SSR polyfills: - TextEncoder: enable GraalJS's native TextEncoder/TextDecoder via the stable js.text-encoding option in EngineFactory; drop the @sinonjs/text-encoding polyfill and dependency. - console: GraalJS provides a native console by default — the shim in polyfillBasics.js was dead code. - polyfillBasics.js: move the remaining minimal process shim into nodePolyfills.ts and delete the file (one less asset to load into every SSR context). - timers: replace timers.ts with inline one-line no-op shims in nodePolyfills.ts, preserving return values and the don't-overwrite guard. Fixes #2253 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #2254 +/- ##
=======================================
Coverage 22.85% 22.85%
=======================================
Files 1 1
Lines 35 35
=======================================
Hits 8 8
Misses 27 27 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
anatol-sialitski
approved these changes
Aug 6, 2026
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.
Fixes #2253
XP 8 runs on GraalVM 25, which lets us drop most of the hand-rolled SSR polyfills:
TextEncoder/TextDecodervia thejs.text-encodingoption (stable in GraalJS 25, default off). It is now enabled inEngineFactory, and the@sinonjs/text-encodingpolyfill and dependency are removed. Bonus: SSR contexts also get a nativeTextDecoder, which the old polyfill never provided.consoleby default (js.console, stable, default on) with a fuller method set (log,debug,info,warn,error,assert,time,group, …) than the oldprint-based mapping — the shim inpolyfillBasics.jswas dead code.processshim remained — moved intonodePolyfills.tsand the file is deleted, so every SSR context loads one asset less.timers.ts(branded types, exported no-op functions,@ts-expect-errorsuppressions) is replaced with inline one-line??=no-op shims innodePolyfills.ts. Behavior preserved:setTimeout/setIntervalstill return0, existing globals are never overwritten.@rollup/plugin-aliasdependency and its stale@sinonjs/text-encodingalias fromrollup.config.nodePolyfills.mjs.Verification
./gradlew testpasses, includingRendererTest.render_real_react_component_via_server_edge, which renders real React 19 throughreact-dom/server.edgeagainst the production-compiled polyfill bundle —server.edgelooks upTextEncoderat module-load time, so this exercises the native GraalJS implementation.check:types:graalall pass.🤖 Generated with Claude Code