Skip to content

Comments

fix: strip UTF-8 BOM when using text loader#7635

Merged
graphite-app[bot] merged 1 commit intomainfrom
12-22-fix_strip_utf-8_bom_when_using_text_loader
Dec 23, 2025
Merged

fix: strip UTF-8 BOM when using text loader#7635
graphite-app[bot] merged 1 commit intomainfrom
12-22-fix_strip_utf-8_bom_when_using_text_loader

Conversation

@sapphi-red
Copy link
Member

@sapphi-red sapphi-red commented Dec 23, 2025

Made text loader strip the UTF-8 BOM. This aligns with the behavior of esbuild and JSON modules in browsers.

Copy link
Member Author


How to use the Graphite Merge Queue

Add the label graphite: merge-when-ready to this PR to add it to the merge queue.

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@netlify
Copy link

netlify bot commented Dec 23, 2025

Deploy Preview for rolldown-rs canceled.

Name Link
🔨 Latest commit 9dc5f6d
🔍 Latest deploy log https://app.netlify.com/projects/rolldown-rs/deploys/694a79c64dfa3d0008ba5514

@sapphi-red sapphi-red marked this pull request as ready for review December 23, 2025 11:01
Copilot AI review requested due to automatic review settings December 23, 2025 11:01
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

This PR fixes the text loader to correctly strip UTF-8 BOM (Byte Order Mark) from text files, aligning rolldown's behavior with esbuild and browser JSON modules. The fix ensures that when text files start with a UTF-8 BOM (\uFEFF), it is removed before the content is processed.

Key changes:

  • Added UTF-8 BOM stripping logic in the text module type handler
  • Updated test metadata to reflect the now-passing loader_text_utf8_bom test

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
crates/rolldown/src/utils/parse_to_ecma_ast.rs Implements UTF-8 BOM stripping for text loader by checking for and removing the leading \uFEFF character before escaping
scripts/src/esbuild-tests/reasons.ts Removes the failed test reason entry for loader_text_utf8_bom
scripts/src/esbuild-tests/snap-diff/summary/loader.md Moves loader_text_utf8_bom from failed to passed test list
scripts/src/esbuild-tests/snap-diff/stats/stats.md Updates test pass statistics (passed count: 666→667, pass ratio: 96.10%→96.25%)
crates/rolldown/tests/esbuild/loader/loader_text_utf8_bom/diff.md Removes the diff file as the test now passes

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

Copy link
Member

hyf0 commented Dec 23, 2025

Merge activity

  • Dec 23, 11:08 AM UTC: The merge label 'graphite: merge-when-ready' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Dec 23, 11:11 AM UTC: The merge label 'graphite: merge-when-ready' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Dec 23, 11:12 AM UTC: The merge label 'graphite: merge-when-ready' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • Dec 23, 11:14 AM UTC: hyf0 added this pull request to the Graphite merge queue.
  • Dec 23, 11:26 AM UTC: Merged by the Graphite merge queue.

Made text loader strip the UTF-8 BOM. This aligns with the behavior of esbuild and JSON modules in browsers.
@graphite-app graphite-app bot force-pushed the 12-22-fix_strip_utf-8_bom_when_using_text_loader branch from 9c88984 to 9dc5f6d Compare December 23, 2025 11:15
@graphite-app graphite-app bot merged commit 9dc5f6d into main Dec 23, 2025
32 of 33 checks passed
@graphite-app graphite-app bot deleted the 12-22-fix_strip_utf-8_bom_when_using_text_loader branch December 23, 2025 11:26
This was referenced Dec 24, 2025
shulaoda added a commit that referenced this pull request Dec 24, 2025
## [1.0.0-beta.57] - 2025-12-24

✨ TypeScript Project References Support
- Rolldown now supports TypeScript project references when manually specifying a `tsconfig`
- See more details: https://rolldown.rs/options/tsconfig

💥 Rename `__export` to `__exportAll`
- Update `rolldown-plugin-dts` to the latest version for compatibility

### 💥 BREAKING CHANGES

- tsconfig: enable project references support in manual mode (#7545) by @shulaoda

### 🚀 Features

- add `CANNOT_CALL_NAMESPACE` warning (#7636) by @sapphi-red
- add import path for unresolved import diagnostics (#7625) by @sapphi-red
- optimize dynamic entry facade chunks by merging with common chunks when they are captured by common chunks (#7486) by @IWANABETHATGUY

### 🐛 Bug Fixes

- rename `__export` to `__exportAll` to be compatible with `cjs-module-lexer` (#7640) by @IWANABETHATGUY
- strip UTF-8 BOM when using text loader (#7635) by @sapphi-red
- rolldown_plugin_replace: avoid crashing with invalid delimiters (#7621) by @sapphi-red

### 🚜 Refactor

- export all filter functions (#7622) by @sxzz
- allow multiple help messages in diagnostics (#7624) by @sapphi-red

### 📚 Documentation

- add README.md to packages/rolldown (#7556) by @Copilot

### ⚡ Performance

- use fsevents on macOS for file watching (#7596) by @sapphi-red

### 🧪 Testing

- handle re-exports of external modules in CJS format (#7641) by @IWANABETHATGUY
- update integration to use vite's rolldown-canary branch (#7633) by @shulaoda

### ⚙️ Miscellaneous Tasks

- docs: fix Netlify ignore condition to detect docs changes across all PR commits (#7637) by @Copilot
- deps: update rollup submodule for tests to v4.54.0 (#7630) by @sapphi-red
- skip benchmarks for PRs with 'graphite: merge-when-ready' label (#7631) by @Boshen
- deps: update esbuild for tests to 0.27.2 (#7629) by @sapphi-red
- fix "update-test-dependencies" workflow (#7628) by @sapphi-red
- deps: update test262 submodule for tests (#7626) by @sapphi-red
- deps: update dependency oxlint to v1.35.0 (#7623) by @renovate[bot]

Co-authored-by: shulaoda <[email protected]>
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