Skip to content

Add TextDecoder polyfill with tests#138

Merged
CedricGuillemet merged 9 commits intoBabylonJS:mainfrom
CedricGuillemet:TextDecoder
Feb 25, 2026
Merged

Add TextDecoder polyfill with tests#138
CedricGuillemet merged 9 commits intoBabylonJS:mainfrom
CedricGuillemet:TextDecoder

Conversation

@CedricGuillemet
Copy link
Contributor

Used by GaussianSplatting for parsing ply/compressed ply headers

CedricGuillemet and others added 2 commits February 24, 2026 16:16
- Add Polyfills/TextDecoder with CMakeLists.txt, public header, and implementation
- Register JSRUNTIMEHOST_POLYFILL_TEXTDECODER option in root CMakeLists.txt
- Add TextDecoder subdirectory to Polyfills/CMakeLists.txt
- Initialize TextDecoder in Tests/UnitTests/Shared/Shared.cpp
- Link TextDecoder in Tests/UnitTests/CMakeLists.txt
- Add TextDecoder decode tests in Tests/UnitTests/Scripts/tests.ts

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings February 24, 2026 15:24
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a TextDecoder polyfill to the JsRuntimeHost polyfills set so GaussianSplatting can parse PLY / compressed PLY headers in environments lacking a native TextDecoder.

Changes:

  • Introduce new Polyfills/TextDecoder library and CMake option JSRUNTIMEHOST_POLYFILL_TEXTDECODER.
  • Register the polyfill in unit test runtime initialization.
  • Add mocha tests covering basic TextDecoder.decode() behavior for Uint8Array and ArrayBuffer.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
Tests/UnitTests/Shared/Shared.cpp Initializes the new TextDecoder polyfill in the JS test runtime.
Tests/UnitTests/Scripts/tests.ts Adds mocha coverage for basic TextDecoder.decode() usage.
Tests/UnitTests/CMakeLists.txt Links UnitTests target against the new TextDecoder library.
Polyfills/TextDecoder/Source/TextDecoder.cpp Implements the TextDecoder global and decode() in C++ via N-API.
Polyfills/TextDecoder/Include/Babylon/Polyfills/TextDecoder.h Declares the polyfill Initialize entry point.
Polyfills/TextDecoder/CMakeLists.txt Adds build target for the TextDecoder polyfill.
Polyfills/CMakeLists.txt Adds conditional subdirectory inclusion for TextDecoder.
CMakeLists.txt Adds JSRUNTIMEHOST_POLYFILL_TEXTDECODER option.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@CedricGuillemet CedricGuillemet merged commit fe50276 into BabylonJS:main Feb 25, 2026
19 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants