fix(core): fall back to AST for unusable sourcemaps - #1934
Conversation
@rsdoctor/agent-cli
@rsdoctor/cli
@rsdoctor/client
@rsdoctor/core
@rsdoctor/shared
commit: |
There was a problem hiding this comment.
💡 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".
There was a problem hiding this comment.
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/catchand treat failures (including missing sourcemapsource) 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.
Deploying rsdoctor-v1 with
|
| 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 |
Deploying rsdoctor with
|
| Latest commit: |
a6b7974
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://a93eab9f.rsdoctor.pages.dev |
| Branch Preview URL: | https://fix-sourcemap-ast-fallback.rsdoctor.pages.dev |
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)