Skip to content

fix(plugin-playground): include source path in mdx parse errors - #3486

Merged
SoonIter merged 1 commit into
mainfrom
fix/playground-mdx-error-context
Jul 1, 2026
Merged

fix(plugin-playground): include source path in mdx parse errors#3486
SoonIter merged 1 commit into
mainfrom
fix/playground-mdx-error-context

Conversation

@SoonIter

Copy link
Copy Markdown
Member

Summary

This PR improves @rspress/plugin-playground diagnostics when its MDX pre-scan fails. Instead of rethrowing the parser error without context, the plugin now includes the source file path while preserving the original parser message.

Related Issue

Fixes #2238

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

Copilot AI review requested due to automatic review settings June 29, 2026 09:06

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

Improves @rspress/plugin-playground diagnostics when MDX pre-scan/parsing fails by attaching the source file path to the thrown error, and adds a regression test to validate the new message shape.

Changes:

  • Wrap MDX parse failures with an error message that includes the failing source file path while preserving the original parser message.
  • Add a unit test that exercises the plugin hook and asserts the thrown error includes the source file path.

Reviewed changes

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

File Description
packages/plugin-playground/src/cli/index.ts Enhances thrown parse errors to include the source path (and retains original message via wrapping).
packages/plugin-playground/tests/error.test.ts Adds a regression test for the improved error message when MDX parsing fails.

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

Comment thread packages/plugin-playground/tests/error.test.ts
Comment thread packages/plugin-playground/src/cli/index.ts Outdated
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Jun 29, 2026

Copy link
Copy Markdown

Deploying rspress-v2 with  Cloudflare Pages  Cloudflare Pages

Latest commit: 21b2e14
Status: ✅  Deploy successful!
Preview URL: https://dabf1402.rspress-v2.pages.dev
Branch Preview URL: https://fix-playground-mdx-error-con.rspress-v2.pages.dev

View logs

@SoonIter
SoonIter force-pushed the fix/playground-mdx-error-context branch from 13301bb to 636f91d Compare July 1, 2026 09:48
@SoonIter
SoonIter force-pushed the fix/playground-mdx-error-context branch from 636f91d to 21b2e14 Compare July 1, 2026 09:50
@SoonIter
SoonIter enabled auto-merge (squash) July 1, 2026 09:56
@SoonIter
SoonIter requested a review from Timeless0911 July 1, 2026 09:57
@SoonIter
SoonIter merged commit 1a63076 into main Jul 1, 2026
7 checks passed
@SoonIter
SoonIter deleted the fix/playground-mdx-error-context branch July 1, 2026 11:27
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]: Improved error message for invalid syntax when using @rspress/plugin-playground

3 participants