Skip to content

fix(sources): preserve missing source contents as null - #16366

Merged
SyMind merged 5 commits into
mainfrom
codex/fix-sourcemap-null-content
Nov 2, 2026
Merged

SyMind merged 5 commits into
mainfrom
codex/fix-sourcemap-null-content

Conversation

@SyMind

@SyMind SyMind commented Oct 30, 2026 •

Copy link
Copy Markdown
Member

Motivation

Fixes #16347.

When a loader omits source content and its map is combined with a map that includes content, Rspack emits "" for the missing entry. DevTools treats that entry as an empty file instead of loading the source URL. Missing content must remain distinct from an explicitly empty source.

Changes

Represent each SourceMap.sources_content entry as Option<Cow<str>>. Preserve None through both JSON parsing paths, map composition, serialization, and persistent cache, emitting null for missing entries while keeping Some("") as "". Pad mixed content arrays to match the source table and omit sourcesContent only when all entries are missing.

When intermediate source text is unavailable during map composition, use the existing outer-mapping fallback and honor remove_original_source without unwrapping missing content. Explicit original_source still takes precedence.

Update map producers and consumers and MappingSource JSON streaming. Add loader regression cases for regular and cheap module source maps covering missing, empty, and present content.

Validation:

  • Rebuilt the JavaScript packages and native development binding.
  • Source-map integration suite at 5397fc9: 136 passed.
  • rspack_sources --all-features: 77 tests and 11 doctests passed.
  • Clippy for the six initially affected crates passed; the composition fix also passed Clippy for rspack_sources and rspack_cacheable_test with --all-targets --all-features -- -D warnings.
  • Formatting and documentation spelling checks passed.

Chrome DevTools behavior was not tested interactively; validation covers the emitted source-map data.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Deploying rspack with  Cloudflare Pages  Cloudflare Pages

Latest commit: 3997e14
Status: ✅  Deploy successful!
Preview URL: https://9ec5c4c8.rspack-v2.pages.dev
Branch Preview URL: https://codex-fix-sourcemap-null-con.rspack-v2.pages.dev

View logs

@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

📦 Binary Size-limit

Comparing 3997e14 to fix(javascript): keep exports referenced through arguments in import().then callback (#16392) by ump45nose

❌ Size increased by 8.00KB from 67.91MB to 67.91MB (⬆️0.01%)

@SyMind

SyMind commented Oct 30, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-30T09:42:47.357596Z 3c87570 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Rsdoctor Bundle Diff Analysis

Found 5 projects in monorepo, 0 projects with changes.

📊 Quick Summary
Project Total Size Gzip Size Change Gzip Change
popular-libs 1.7 MB 541.6 KB 0 0
react-10k 5.4 MB 1.3 MB 0 0
react-5k 2.6 MB 670.6 KB 0 0
react-1k 827.5 KB 225.2 KB 0 0
ui-components 4.7 MB 1.4 MB 0 0

Generated by Rsdoctor GitHub Action

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5397fc9f59

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread crates/rspack_sources/src/source.rs Resolved
@codspeed

codspeed Bot commented Oct 30, 2026 •

Copy link
Copy Markdown
Contributor

Merging this PR will not alter performance

✅ 57 untouched benchmarks
⏩ 47 skipped benchmarks1


Comparing codex/fix-sourcemap-null-content (3997e14) with main (3a8a284)

Open in CodSpeed

Footnotes

  1. 47 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩

@SyMind

SyMind commented Oct 30, 2026

Copy link
Copy Markdown
Member Author

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. 👍

Reviewed commit: 3c8757025d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

📝 Rspack Ecosystem CI: Open

suite result
rsbuild-rsc-plugin ✅ success
modernjs ✅ success
examples ✅ success
devserver ✅ success
rslib ✅ success
extension-js ✅ success
plugin ✅ success
rstest ✅ success
rspress ✅ success
lynx-stack ✅ success
rsbuild ✅ success
rsdoctor ✅ success

@SyMind
SyMind merged commit b564a7f into main Nov 2, 2026
@SyMind
SyMind deleted the codex/fix-sourcemap-null-content branch November 2, 2026 05:41
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.

[Bug]: missing sourcesContent entries are emitted as "" instead of null

2 participants