Skip to content

fix(core): fall back to AST for unusable sourcemaps - #1934

Merged
yifancong merged 3 commits into
mainfrom
fix/sourcemap-ast-fallback
Aug 26, 2026
Merged

fix(core): fall back to AST for unusable sourcemaps#1934
yifancong merged 3 commits into
mainfrom
fix/sourcemap-ast-fallback

Conversation

@yifancong

Copy link
Copy Markdown
Contributor

Summary

This PR ensures JS/CSS assets with missing or unreadable related sourcemaps fall back to AST parsing, preserving module source and size data when other sourcemaps are available. It also handles invalid related sourcemap JSON without failing the build.

Related Links

#1922 (comment)

Copilot AI lite review requested due to automatic review settings August 21, 2026 06:47
@pkg-pr-new

pkg-pr-new Bot commented Aug 21, 2026

Copy link
Copy Markdown
@rsdoctor/agent-cli

npm i https://pkg.pr.new/@rsdoctor/agent-cli@1934

@rsdoctor/cli

npm i https://pkg.pr.new/@rsdoctor/cli@1934

@rsdoctor/client

npm i https://pkg.pr.new/@rsdoctor/client@1934

@rsdoctor/core

npm i https://pkg.pr.new/@rsdoctor/core@1934

@rsdoctor/shared

npm i https://pkg.pr.new/@rsdoctor/shared@1934

commit: a6b7974

@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: b131108ccd

ℹ️ 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 packages/core/src/inner-plugins/plugins/sourcemapTool.ts

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 improves Rsdoctor core’s sourcemap collection so that JS/CSS assets with missing, source-less, or invalid related sourcemaps don’t crash processing and can be flagged for AST-based fallback parsing, preserving module/source metrics when other sourcemaps are still usable.

Changes:

  • Add a small helper to consistently mark JS/CSS assets as “without sourcemap” for AST fallback.
  • Wrap related sourcemap JSON parsing in a try/catch and treat failures (including missing sourcemap source) as “no sourcemap”, avoiding hard failures.
  • Add regression tests for “related sourcemap asset has no source” and “related sourcemap JSON is invalid”.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/core/src/inner-plugins/plugins/sourcemapTool.ts Adds safe parsing for related sourcemaps and marks assets for AST fallback when related sourcemaps are missing/unreadable.
packages/core/tests/plugins/sourcemapTool.test.ts Adds coverage for missing source in related sourcemap assets and invalid related sourcemap JSON.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 21, 2026

Copy link
Copy Markdown

Deploying rsdoctor-v1 with  Cloudflare Pages  Cloudflare Pages

Latest commit: a6b7974
Status: ✅  Deploy successful!
Preview URL: https://ce6aa9d8.rsdoctor-v1.pages.dev
Branch Preview URL: https://fix-sourcemap-ast-fallback.rsdoctor-v1.pages.dev

View logs

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 25, 2026

Copy link
Copy Markdown

Deploying rsdoctor with  Cloudflare Pages  Cloudflare Pages

Latest commit: a6b7974
Status: ✅  Deploy successful!
Preview URL: https://a93eab9f.rsdoctor.pages.dev
Branch Preview URL: https://fix-sourcemap-ast-fallback.rsdoctor.pages.dev

View logs

@yifancong
yifancong merged commit 35aef3e into main Aug 26, 2026
10 checks passed
@yifancong
yifancong deleted the fix/sourcemap-ast-fallback branch August 26, 2026 11:44
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.

2 participants