-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Error handling improvements to esbuild plugin #2595
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2595 +/- ##
=========================================
Coverage 100.00% 100.00%
=========================================
Files 23 21 -2
Lines 2693 2647 -46
Branches 2 2
=========================================
- Hits 2693 2647 -46 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
packages/esbuild/lib/index.js
Outdated
| source: '@mdx-js/esbuild' | ||
| }) | ||
| new VFileMessage( | ||
| `Cannot process MDX file with esbuild:\n ${error_}`, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| `Cannot process MDX file with esbuild:\n ${error_}`, { | |
| 'Cannot process MDX file with esbuild', { |
The point of cause, I believe, is to be an alternative to copying it into the reason.
I’m fine with always making a new error, a vfile message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay, I changed it to not concatenate the message at this point, and instead walk the cause chain and concatenate the text when creating the esbuild message.
In theory the cause chain is available in the esbuild message via the detail field, but, that's a very generic field and basically nothing seems to look at it-- certainly esbuild itself doesn't print it out when reporting errors.
as suggested Co-authored-by: Titus <[email protected]> Signed-off-by: Daniel Egnor <[email protected]>
As suggested Co-authored-by: Titus <[email protected]> Signed-off-by: Daniel Egnor <[email protected]>
As suggested Co-authored-by: Titus <[email protected]> Signed-off-by: Daniel Egnor <[email protected]>
… creating VFileMessage
|
Ready for another look! |
| while (exc.cause instanceof Error) { | ||
| exc = exc.cause | ||
| text = `${text}:\n ${exc}` | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these lines because otherwise the “cause” is lost? That ESBuild doesn’t print them?
Is that something that ESbuild should fix? Upstream?
Or, if indeed needed here, perhaps you could use vfile-reporter I linked above, or, perhaps you could use inspect from util: https://nodejs.org/api/util.html#utilinspectobject-options. I believe that it serializes recursive causes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay yes this is the tricky bit.
In esbuild you can report errors by just throwing an exception, or by adding to a list of messages using their own Message class (which is what we're doing). That class includes a detail field which can be an exception but could also be anything else, and in any case doesn't get printed in esbuild's output, it seems to be for custom API use; it's not really comparable to cause.
Alternatives
- use
vfile-reporter-- this does a fine job and does chase cause chains, unfortunately this wants an entireVFile, I don't see a way to format a singleVFileMessage(though you could imagine exposing that)? - use
util.inspect-- this has a lovely formatter forErrorobjects, but even for subclasses likeVFileMessagereverts to its default printer which just dumps the fields and does not print error messages or chase cause chains? - just let the error get thrown rather than catching it and adding it to
messages-- this does get handled by esbuild gracefully (including plugin attribution), but the extra location information inVFileMessageis lost - add
VFileMessage-shaped exceptions directly tomessages(no wrapping), re-throw everything else, remove all cause-chain-processing -- this could work??
For now I simplified the cause processing to not try to walk the whole cause chain but just include the string representation of the cause if one exists.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good points, I appreciate that you came up with alternatives & discussed trade offs.
I could see an reportError in vfile-reporter, which can then be used here.
The no-wrapping idea could also perhaps work.
But this is probably fine to start with!
This comment has been minimized.
This comment has been minimized.
|
Thanks! :) |
|
Released in |
 <h3>Snyk has created this PR to upgrade @mdx-js/react from 3.1.0 to 3.1.1.</h3> :information_source: Keep your dependencies up-to-date. This makes it easier to fix existing vulnerabilities and to more quickly identify and fix newly disclosed vulnerabilities when they affect your project. <hr/> - The recommended version is **1 version** ahead of your current version. - The recommended version was released **a month ago**. <details> <summary><b>Release notes</b></summary> <br/> <details> <summary>Package name: <b>@mdx-js/react</b></summary> <ul> <li> <b>3.1.1</b> - <a href="https://redirect.github.com/mdx-js/mdx/releases/tag/3.1.1">2025-08-29</a></br><h4>Fix</h4> <ul> <li><a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/mdx-js/mdx/commit/3cad7d7ebadc9efe5e3ccf1b0348a039e85bd42f/hovercard" href="https://redirect.github.com/mdx-js/mdx/commit/3cad7d7ebadc9efe5e3ccf1b0348a039e85bd42f"><tt>3cad7d7</tt></a> <code>@ mdx-js/mdx</code>: add dependency on <code>acorn</code></li> <li><a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/mdx-js/mdx/commit/0dc4472f62338a24517eeaa3d66fd5c6ea2ac80a/hovercard" href="https://redirect.github.com/mdx-js/mdx/commit/0dc4472f62338a24517eeaa3d66fd5c6ea2ac80a"><tt>0dc4472</tt></a> <code>@ mdx-js/esbuild</code>: fix crash with esbuild loader and <code>jsx</code> option<br> by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/egnor/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://redirect.github.com/egnor">@ egnor</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2868235490" data-permission-text="Title is private" data-url="mdx-js/mdx#2593" data-hovercard-type="pull_request" data-hovercard-url="/mdx-js/mdx/pull/2593/hovercard" href="https://redirect.github.com/mdx-js/mdx/pull/2593">#2593</a></li> <li><a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/mdx-js/mdx/commit/84ec66ef529496535dc26ba5a8c3d55c85d78f25/hovercard" href="https://redirect.github.com/mdx-js/mdx/commit/84ec66ef529496535dc26ba5a8c3d55c85d78f25"><tt>84ec66e</tt></a> <code>@ mdx-js/esbuild</code>: refactor to improve error conversion in esbuild<br> by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/egnor/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://redirect.github.com/egnor">@ egnor</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2890010912" data-permission-text="Title is private" data-url="mdx-js/mdx#2595" data-hovercard-type="pull_request" data-hovercard-url="/mdx-js/mdx/pull/2595/hovercard" href="https://redirect.github.com/mdx-js/mdx/pull/2595">#2595</a></li> <li><a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/mdx-js/mdx/commit/2b3381a8962dc888c0f2ed181cf80c6a1140b662/hovercard" href="https://redirect.github.com/mdx-js/mdx/commit/2b3381a8962dc888c0f2ed181cf80c6a1140b662"><tt>2b3381a</tt></a> <code>@ mdx-js/rollup</code>: fix support for query parameters in Vite<br> by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/markdalgleish/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://redirect.github.com/markdalgleish">@ markdalgleish</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="3299267528" data-permission-text="Title is private" data-url="mdx-js/mdx#2629" data-hovercard-type="pull_request" data-hovercard-url="/mdx-js/mdx/pull/2629/hovercard" href="https://redirect.github.com/mdx-js/mdx/pull/2629">#2629</a></li> </ul> <h4>Types</h4> <ul> <li><a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/mdx-js/mdx/commit/933ab4442a648ff70aa15e66a023980d1531202e/hovercard" href="https://redirect.github.com/mdx-js/mdx/commit/933ab4442a648ff70aa15e66a023980d1531202e"><tt>933ab44</tt></a> <code>@ mdx-js/mdx</code>: add <code>attributes</code> to export/import declarations</li> </ul> <h4>Docs</h4> <ul> <li><a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/mdx-js/mdx/commit/c156a1f680cb3ea2f72f24b9b3746a73791531f1/hovercard" href="https://redirect.github.com/mdx-js/mdx/commit/c156a1f680cb3ea2f72f24b9b3746a73791531f1"><tt>c156a1f</tt></a> Add <code>rehype-mdx-toc</code> to list of plugin<br> by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/boning-w/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://redirect.github.com/boning-w">@ boning-w</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="3204153379" data-permission-text="Title is private" data-url="mdx-js/mdx#2622" data-hovercard-type="pull_request" data-hovercard-url="/mdx-js/mdx/pull/2622/hovercard" href="https://redirect.github.com/mdx-js/mdx/pull/2622">#2622</a></li> <li><a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/mdx-js/mdx/commit/913659c84b1a56655a73577b7ab940f5b52e3e17/hovercard" href="https://redirect.github.com/mdx-js/mdx/commit/913659c84b1a56655a73577b7ab940f5b52e3e17"><tt>913659c</tt></a> Add <code>recma-module-to-function</code> to list of plugins<br> by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/remcohaszing/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://redirect.github.com/remcohaszing">@ remcohaszing</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2967340496" data-permission-text="Title is private" data-url="mdx-js/mdx#2605" data-hovercard-type="pull_request" data-hovercard-url="/mdx-js/mdx/pull/2605/hovercard" href="https://redirect.github.com/mdx-js/mdx/pull/2605">#2605</a></li> <li><a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/mdx-js/mdx/commit/67fb1d07d9b648d953d93d063a6eb5588d6c6d58/hovercard" href="https://redirect.github.com/mdx-js/mdx/commit/67fb1d07d9b648d953d93d063a6eb5588d6c6d58"><tt>67fb1d0</tt></a> Remove unneeded JSX type casting in docs, tests</li> <li><a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/mdx-js/mdx/commit/f0d20da86dcc8d78b90daddae7ae8ef1fcb5eacb/hovercard" href="https://redirect.github.com/mdx-js/mdx/commit/f0d20da86dcc8d78b90daddae7ae8ef1fcb5eacb"><tt>f0d20da</tt></a> Remove local use of <code>JSX</code><br> by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/remcohaszing/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://redirect.github.com/remcohaszing">@ remcohaszing</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2967327907" data-permission-text="Title is private" data-url="mdx-js/mdx#2604" data-hovercard-type="pull_request" data-hovercard-url="/mdx-js/mdx/pull/2604/hovercard" href="https://redirect.github.com/mdx-js/mdx/pull/2604">#2604</a></li> <li><a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/mdx-js/mdx/commit/63f39cea9d48db8e2544b6f357d4dde5d3caafbc/hovercard" href="https://redirect.github.com/mdx-js/mdx/commit/63f39cea9d48db8e2544b6f357d4dde5d3caafbc"><tt>63f39ce</tt></a> Remove references to twitter</li> <li><a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/mdx-js/mdx/commit/35ac59ddd5b5b5b32626a59dcb2f9a3c8a00953c/hovercard" href="https://redirect.github.com/mdx-js/mdx/commit/35ac59ddd5b5b5b32626a59dcb2f9a3c8a00953c"><tt>35ac59d</tt></a> Refactor some docs regarding recma plugins</li> </ul> <p><strong>Full Changelog</strong>: <a class="commit-link" href="https://redirect.github.com/mdx-js/mdx/compare/3.1.0...3.1.1"><tt>3.1.0...3.1.1</tt></a></p> </li> <li> <b>3.1.0</b> - <a href="https://redirect.github.com/mdx-js/mdx/releases/tag/3.1.0">2024-10-18</a></br><h4>Add</h4> <ul> <li><a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/mdx-js/mdx/commit/715ddd96475bed90126bb2a34a97eac89bf73793/hovercard" href="https://redirect.github.com/mdx-js/mdx/commit/715ddd96475bed90126bb2a34a97eac89bf73793"><tt>715ddd9</tt></a> <strong><code>@ mdx-js/esbuild</code></strong>: add source maps<br> by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/remcohaszing/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://redirect.github.com/remcohaszing">@ remcohaszing</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2227911609" data-permission-text="Title is private" data-url="mdx-js/mdx#2464" data-hovercard-type="pull_request" data-hovercard-url="/mdx-js/mdx/pull/2464/hovercard" href="https://redirect.github.com/mdx-js/mdx/pull/2464">#2464</a></li> <li><a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/mdx-js/mdx/commit/d58672037af4a8c520f9e4708a9ca73785a16877/hovercard" href="https://redirect.github.com/mdx-js/mdx/commit/d58672037af4a8c520f9e4708a9ca73785a16877"><tt>d586720</tt></a> <strong><code>@ mdx-js/node-loader</code></strong>: add support for options w/ <code>initialize</code></li> <li><a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/mdx-js/mdx/commit/cd2907dd6f62441526669c052394b022b6e9668f/hovercard" href="https://redirect.github.com/mdx-js/mdx/commit/cd2907dd6f62441526669c052394b022b6e9668f"><tt>cd2907d</tt></a> <strong><code>@ mdx-js/node-loader</code></strong>: add support showing messages</li> <li><a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/mdx-js/mdx/commit/ceea80ddece2503d0e1793a8c010b781d0758a27/hovercard" href="https://redirect.github.com/mdx-js/mdx/commit/ceea80ddece2503d0e1793a8c010b781d0758a27"><tt>ceea80d</tt></a> <strong><code>@ mdx-js/node-loader</code></strong>: add source maps<br> by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/remcohaszing/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://redirect.github.com/remcohaszing">@ remcohaszing</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2181698596" data-permission-text="Title is private" data-url="mdx-js/mdx#2458" data-hovercard-type="pull_request" data-hovercard-url="/mdx-js/mdx/pull/2458/hovercard" href="https://redirect.github.com/mdx-js/mdx/pull/2458">#2458</a></li> </ul> <h4>Fix</h4> <ul> <li><a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/mdx-js/mdx/commit/d306f87042c8b203fb70dd14f5e450414a4c44eb/hovercard" href="https://redirect.github.com/mdx-js/mdx/commit/d306f87042c8b203fb70dd14f5e450414a4c44eb"><tt>d306f87</tt></a> <strong><code>@ mdx-js/core</code></strong>: replace <code>periscopic</code> with <code>estree-util-scope</code></li> <li><a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/mdx-js/mdx/commit/c747990530d67dc2eca2dce05bda5ce60c80409e/hovercard" href="https://redirect.github.com/mdx-js/mdx/commit/c747990530d67dc2eca2dce05bda5ce60c80409e"><tt>c747990</tt></a> <strong><code>@ mdx-js/core</code></strong>: fix injecting providers for jsx in esm, expressions</li> <li><a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/mdx-js/mdx/commit/3a794ab5d167932702a9b55f6d76f3aeea9fade4/hovercard" href="https://redirect.github.com/mdx-js/mdx/commit/3a794ab5d167932702a9b55f6d76f3aeea9fade4"><tt>3a794ab</tt></a> <strong><code>@ mdx-js/loader</code></strong>: fix ESM type import<br> by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/remcohaszing/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://redirect.github.com/remcohaszing">@ remcohaszing</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2169240735" data-permission-text="Title is private" data-url="mdx-js/mdx#2452" data-hovercard-type="pull_request" data-hovercard-url="/mdx-js/mdx/pull/2452/hovercard" href="https://redirect.github.com/mdx-js/mdx/pull/2452">#2452</a></li> <li><a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/mdx-js/mdx/commit/be79212a2015a8c445c141e0508e50054865a718/hovercard" href="https://redirect.github.com/mdx-js/mdx/commit/be79212a2015a8c445c141e0508e50054865a718"><tt>be79212</tt></a> <strong><code>@ mdx-js/loader</code></strong>: change webpack peer dependency to optional<br> by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/chenjiahan/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://redirect.github.com/chenjiahan">@ chenjiahan</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2131353848" data-permission-text="Title is private" data-url="mdx-js/mdx#2440" data-hovercard-type="pull_request" data-hovercard-url="/mdx-js/mdx/pull/2440/hovercard" href="https://redirect.github.com/mdx-js/mdx/pull/2440">#2440</a></li> </ul> <h4>Types</h4> <ul> <li><a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/mdx-js/mdx/commit/f12afda2435e46324966e641ec5e415f8e54b784/hovercard" href="https://redirect.github.com/mdx-js/mdx/commit/f12afda2435e46324966e641ec5e415f8e54b784"><tt>f12afda</tt></a> Refactor to use <code>@ import</code> JSDoc tags<br> by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/remcohaszing/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://redirect.github.com/remcohaszing">@ remcohaszing</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2372773595" data-permission-text="Title is private" data-url="mdx-js/mdx#2498" data-hovercard-type="pull_request" data-hovercard-url="/mdx-js/mdx/pull/2498/hovercard" href="https://redirect.github.com/mdx-js/mdx/pull/2498">#2498</a></li> </ul> <h4>Miscellaneous</h4> <ul> <li><a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/mdx-js/mdx/commit/77158cdb12b80c007bdae05a5a58af80889f93ef/hovercard" href="https://redirect.github.com/mdx-js/mdx/commit/77158cdb12b80c007bdae05a5a58af80889f93ef"><tt>77158cd</tt></a> Refactor to externalize recma packages</li> </ul> <h4>Site</h4> <ul> <li><a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/mdx-js/mdx/commit/67500792d99a8eb5bdcd0c3fa16e853011fb3f1c/hovercard" href="https://redirect.github.com/mdx-js/mdx/commit/67500792d99a8eb5bdcd0c3fa16e853011fb3f1c"><tt>6750079</tt></a> Add link to <code>parcel-transformer-mdx</code> in docs</li> <li><a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/mdx-js/mdx/commit/3f8344b3a21425a6ebd908599d88b0b6a5bbdb79/hovercard" href="https://redirect.github.com/mdx-js/mdx/commit/3f8344b3a21425a6ebd908599d88b0b6a5bbdb79"><tt>3f8344b</tt></a> Add search to site</li> <li><a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/mdx-js/mdx/commit/05ecf65f1943e6810b21e40e19354210aa9abefb/hovercard" href="https://redirect.github.com/mdx-js/mdx/commit/05ecf65f1943e6810b21e40e19354210aa9abefb"><tt>05ecf65</tt></a> Fix example</li> <li><a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/mdx-js/mdx/commit/f864886113f73f4d474f5c5a357576a2f4b57edb/hovercard" href="https://redirect.github.com/mdx-js/mdx/commit/f864886113f73f4d474f5c5a357576a2f4b57edb"><tt>f864886</tt></a> Fix types, lints in example<br> by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/karlhorky/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://redirect.github.com/karlhorky">@ karlhorky</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2424855117" data-permission-text="Title is private" data-url="mdx-js/mdx#2518" data-hovercard-type="pull_request" data-hovercard-url="/mdx-js/mdx/pull/2518/hovercard" href="https://redirect.github.com/mdx-js/mdx/pull/2518">#2518</a></li> <li><a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/mdx-js/mdx/commit/37318def5fc581a7a0b7b2763bbe1c3f8b0447b4/hovercard" href="https://redirect.github.com/mdx-js/mdx/commit/37318def5fc581a7a0b7b2763bbe1c3f8b0447b4"><tt>37318de</tt></a> Add Bun section to Getting started<br> by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/karlhorky/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://redirect.github.com/karlhorky">@ karlhorky</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2423037473" data-permission-text="Title is private" data-url="mdx-js/mdx#2517" data-hovercard-type="pull_request" data-hovercard-url="/mdx-js/mdx/pull/2517/hovercard" href="https://redirect.github.com/mdx-js/mdx/pull/2517">#2517</a></li> <li><a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/mdx-js/mdx/commit/07d5e2fcf304ee94dae397c7ba0b3e6776f33c34/hovercard" href="https://redirect.github.com/mdx-js/mdx/commit/07d5e2fcf304ee94dae397c7ba0b3e6776f33c34"><tt>07d5e2f</tt></a> Refactor to improve wording<br> by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/filippovd20/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://redirect.github.com/filippovd20">@ filippovd20</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2407521548" data-permission-text="Title is private" data-url="mdx-js/mdx#2513" data-hovercard-type="pull_request" data-hovercard-url="/mdx-js/mdx/pull/2513/hovercard" href="https://redirect.github.com/mdx-js/mdx/pull/2513">#2513</a></li> <li><a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/mdx-js/mdx/commit/95ba33e154cbd2095593afbb710507e718dce601/hovercard" href="https://redirect.github.com/mdx-js/mdx/commit/95ba33e154cbd2095593afbb710507e718dce601"><tt>95ba33e</tt></a> Add notes on how to type props and components<br> by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/karlhorky/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://redirect.github.com/karlhorky">@ karlhorky</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2395331504" data-permission-text="Title is private" data-url="mdx-js/mdx#2510" data-hovercard-type="pull_request" data-hovercard-url="/mdx-js/mdx/pull/2510/hovercard" href="https://redirect.github.com/mdx-js/mdx/pull/2510">#2510</a></li> <li><a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/mdx-js/mdx/commit/044e8b2a272186be04d16c270f5621718cc8a57e/hovercard" href="https://redirect.github.com/mdx-js/mdx/commit/044e8b2a272186be04d16c270f5621718cc8a57e"><tt>044e8b2</tt></a> Add example illustrating JSX literals, references</li> <li><a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/mdx-js/mdx/commit/1d0a9b68971dceaa6d1cb8123a28e4dfdd0a19aa/hovercard" href="https://redirect.github.com/mdx-js/mdx/commit/1d0a9b68971dceaa6d1cb8123a28e4dfdd0a19aa"><tt>1d0a9b6</tt></a> Add more links across docs</li> <li><a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/mdx-js/mdx/commit/716ab3c8031d2663711daf864ffb816991f0719a/hovercard" href="https://redirect.github.com/mdx-js/mdx/commit/716ab3c8031d2663711daf864ffb816991f0719a"><tt>716ab3c</tt></a> Fix link for MDX Analyzer<br> by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/karlhorky/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://redirect.github.com/karlhorky">@ karlhorky</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2395282696" data-permission-text="Title is private" data-url="mdx-js/mdx#2509" data-hovercard-type="pull_request" data-hovercard-url="/mdx-js/mdx/pull/2509/hovercard" href="https://redirect.github.com/mdx-js/mdx/pull/2509">#2509</a></li> <li><a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/mdx-js/mdx/commit/f1ca4b2f248a4a5dbb92e452ea5f59f277ee30c9/hovercard" href="https://redirect.github.com/mdx-js/mdx/commit/f1ca4b2f248a4a5dbb92e452ea5f59f277ee30c9"><tt>f1ca4b2</tt></a> Fix link<br> by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/artola/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://redirect.github.com/artola">@ artola</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2393972194" data-permission-text="Title is private" data-url="mdx-js/mdx#2508" data-hovercard-type="pull_request" data-hovercard-url="/mdx-js/mdx/pull/2508/hovercard" href="https://redirect.github.com/mdx-js/mdx/pull/2508">#2508</a></li> <li><a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/mdx-js/mdx/commit/11ac939bc3d86fefafcc940da98df0e402455672/hovercard" href="https://redirect.github.com/mdx-js/mdx/commit/11ac939bc3d86fefafcc940da98df0e402455672"><tt>11ac939</tt></a> Add <code>rehype-twoslash</code></li> <li><a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/mdx-js/mdx/commit/b749d38fd3671cfb2c0f82c20ed9bfd8f9e3cd1a/hovercard" href="https://redirect.github.com/mdx-js/mdx/commit/b749d38fd3671cfb2c0f82c20ed9bfd8f9e3cd1a"><tt>b749d38</tt></a> Add <code>rehype-starry-night</code> to website</li> <li><a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/mdx-js/mdx/commit/dfdcb502f5fed67fad3301729324388026375a56/hovercard" href="https://redirect.github.com/mdx-js/mdx/commit/dfdcb502f5fed67fad3301729324388026375a56"><tt>dfdcb50</tt></a> Fix to recommend <code>rehype-mdx-code-props</code><br> by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/karlhorky/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://redirect.github.com/karlhorky">@ karlhorky</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2381815195" data-permission-text="Title is private" data-url="mdx-js/mdx#2501" data-hovercard-type="pull_request" data-hovercard-url="/mdx-js/mdx/pull/2501/hovercard" href="https://redirect.github.com/mdx-js/mdx/pull/2501">#2501</a></li> <li><a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/mdx-js/mdx/commit/ad6c69660fe93376d7b87a81cc3ffd52a6fb22ea/hovercard" href="https://redirect.github.com/mdx-js/mdx/commit/ad6c69660fe93376d7b87a81cc3ffd52a6fb22ea"><tt>ad6c696</tt></a> Fix size of hero heading in some cases<br> by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/yamanidev/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://redirect.github.com/yamanidev">@ yamanidev</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2285750474" data-permission-text="Title is private" data-url="mdx-js/mdx#2481" data-hovercard-type="pull_request" data-hovercard-url="/mdx-js/mdx/pull/2481/hovercard" href="https://redirect.github.com/mdx-js/mdx/pull/2481">#2481</a></li> <li><a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/mdx-js/mdx/commit/d3398fe3dab226aa5ba64a35299f191d8ceb4bdb/hovercard" href="https://redirect.github.com/mdx-js/mdx/commit/d3398fe3dab226aa5ba64a35299f191d8ceb4bdb"><tt>d3398fe</tt></a> Update link in docs</li> <li><a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/mdx-js/mdx/commit/51500e2be516144c45e2df339b7cba0371abb356/hovercard" href="https://redirect.github.com/mdx-js/mdx/commit/51500e2be516144c45e2df339b7cba0371abb356"><tt>51500e2</tt></a> Add HMR to example of MDX w/ Vite<br> by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/dan-lee/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://redirect.github.com/dan-lee">@ dan-lee</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2247913458" data-permission-text="Title is private" data-url="mdx-js/mdx#2474" data-hovercard-type="pull_request" data-hovercard-url="/mdx-js/mdx/pull/2474/hovercard" href="https://redirect.github.com/mdx-js/mdx/pull/2474">#2474</a></li> <li><a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/mdx-js/mdx/commit/0c7605c8da00eb4c639dade8ee5cf44047e01bc8/hovercard" href="https://redirect.github.com/mdx-js/mdx/commit/0c7605c8da00eb4c639dade8ee5cf44047e01bc8"><tt>0c7605c</tt></a> Add <code>rehype-mdx-import-media</code> to list of plugins<br> by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/remcohaszing/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://redirect.github.com/remcohaszing">@ remcohaszing</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2243232655" data-permission-text="Title is private" data-url="mdx-js/mdx#2472" data-hovercard-type="pull_request" data-hovercard-url="/mdx-js/mdx/pull/2472/hovercard" href="https://redirect.github.com/mdx-js/mdx/pull/2472">#2472</a></li> <li><a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/mdx-js/mdx/commit/8f754f707207915bd34c3af8f9064e367c125a58/hovercard" href="https://redirect.github.com/mdx-js/mdx/commit/8f754f707207915bd34c3af8f9064e367c125a58"><tt>8f754f7</tt></a> Add <code>recma-mdx-change-props</code>, <code>recma-mdx-escape-missing-components</code> to list of plugins<br> by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/talatkuyuk/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://redirect.github.com/talatkuyuk">@ talatkuyuk</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2142364809" data-permission-text="Title is private" data-url="mdx-js/mdx#2442" data-hovercard-type="pull_request" data-hovercard-url="/mdx-js/mdx/pull/2442/hovercard" href="https://redirect.github.com/mdx-js/mdx/pull/2442">#2442</a></li> <li><a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/mdx-js/mdx/commit/6cd9ae4f7761bfe88fd6a455e17682678a6fc92e/hovercard" href="https://redirect.github.com/mdx-js/mdx/commit/6cd9ae4f7761bfe88fd6a455e17682678a6fc92e"><tt>6cd9ae4</tt></a> Add <code>rel=sponsored</code> to sponsor links<br> by <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/ChristianMurphy/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://redirect.github.com/ChristianMurphy">@ ChristianMurphy</a> in <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="2130883305" data-permission-text="Title is private" data-url="mdx-js/mdx#2439" data-hovercard-type="pull_request" data-hovercard-url="/mdx-js/mdx/pull/2439/hovercard" href="https://redirect.github.com/mdx-js/mdx/pull/2439">#2439</a></li> <li><a class="commit-link" data-hovercard-type="commit" data-hovercard-url="https://github.com/mdx-js/mdx/commit/53f6955339ee68414f9e1434ca874c1ca54d93f2/hovercard" href="https://redirect.github.com/mdx-js/mdx/commit/53f6955339ee68414f9e1434ca874c1ca54d93f2"><tt>53f6955</tt></a> Fix esbuild for website</li> </ul> <p><strong>Full Changelog</strong>: <a class="commit-link" href="https://redirect.github.com/mdx-js/mdx/compare/3.0.1...3.1.0"><tt>3.0.1...3.1.0</tt></a></p> </li> </ul> from <a href="https://redirect.github.com/mdx-js/mdx/releases">@mdx-js/react GitHub release notes</a> </details> </details> --- > [!IMPORTANT] > > - Check the changes in this PR to ensure they won't cause issues with your project. > - This PR was automatically created by Snyk using the credentials of a real user. --- **Note:** _You are seeing this because you or someone else with access to this repository has authorized Snyk to open upgrade PRs._ **For more information:** <img src="https://api.segment.io/v1/pixel/track?data=eyJ3cml0ZUtleSI6InJyWmxZcEdHY2RyTHZsb0lYd0dUcVg4WkFRTnNCOUEwIiwiYW5vbnltb3VzSWQiOiJmYzRkNDhjOC1iMWYyLTQ5ZmYtYmFlNy1iZjRjMzgxNDViNzAiLCJldmVudCI6IlBSIHZpZXdlZCIsInByb3BlcnRpZXMiOnsicHJJZCI6ImZjNGQ0OGM4LWIxZjItNDlmZi1iYWU3LWJmNGMzODE0NWI3MCJ9fQ==" width="0" height="0"/> > - 🧐 [View latest project report](https://app.snyk.io/org/spencercjh/project/8341455d-cf41-4254-8553-0b053a83d852?utm_source=github&utm_medium=referral&page=upgrade-pr) > - 📜 [Customise PR templates](https://docs.snyk.io/scan-using-snyk/pull-requests/snyk-fix-pull-or-merge-requests/customize-pr-templates?utm_source=&utm_content=fix-pr-template) > - 🛠 [Adjust upgrade PR settings](https://app.snyk.io/org/spencercjh/project/8341455d-cf41-4254-8553-0b053a83d852/settings/integration?utm_source=github&utm_medium=referral&page=upgrade-pr) > - 🔕 [Ignore this dependency or unsubscribe from future upgrade PRs](https://app.snyk.io/org/spencercjh/project/8341455d-cf41-4254-8553-0b053a83d852/settings/integration?pkg=@mdx-js/react&utm_source=github&utm_medium=referral&page=upgrade-pr#auto-dep-upgrades) [//]: # 'snyk:metadata:{"breakingChangeRiskLevel":null,"FF_showPullRequestBreakingChanges":null,"FF_showPullRequestBreakingChangesWebSearch":null,"customTemplate":{"variablesUsed":[],"fieldsUsed":[]},"dependencies":[{"name":"@mdx-js/react","from":"3.1.0","to":"3.1.1"}],"env":"prod","hasFixes":false,"isBreakingChange":false,"isMajorUpgrade":false,"issuesToFix":[],"prId":"fc4d48c8-b1f2-49ff-bae7-bf4c38145b70","prPublicId":"fc4d48c8-b1f2-49ff-bae7-bf4c38145b70","packageManager":"npm","priorityScoreList":[],"projectPublicId":"8341455d-cf41-4254-8553-0b053a83d852","projectUrl":"https://app.snyk.io/org/spencercjh/project/8341455d-cf41-4254-8553-0b053a83d852?utm_source=github&utm_medium=referral&page=upgrade-pr","prType":"upgrade","templateFieldSources":{"branchName":"default","commitMessage":"default","description":"default","title":"default"},"templateVariants":[],"type":"auto","upgrade":[],"upgradeInfo":{"versionsDiff":1,"publishedDate":"2025-08-29T18:02:56.462Z"},"vulns":[]}' Co-authored-by: snyk-bot <[email protected]>
## Version 11.5.0 ### ✨ New & Improved * add MCPIntro component ([#1219](#1219)) ([352fb99](352fb99)) * add support for converting recipe ([#1221](#1221)) ([16db568](16db568)) ### 🛠 Fixes & Updates * **deps:** bump @mdx-js/mdx from 3.1.0 to 3.1.1 ([#1186](#1186)) ([36ba199](36ba199)), closes [mdx-js/mdx#2593](mdx-js/mdx#2593) [mdx-js/mdx#2595](mdx-js/mdx#2595) [mdx-js/mdx#2629](mdx-js/mdx#2629) [mdx-js/mdx#2622](mdx-js/mdx#2622) [mdx-js/mdx#2605](mdx-js/mdx#2605) [mdx-js/mdx#2604](mdx-js/mdx#2604) * **deps:** bump estree-util-value-to-estree from 3.4.0 to 3.5.0 ([#1214](#1214)) ([c953372](c953372)), closes [remcohaszing/estree-util-value-to-estree#6](remcohaszing/estree-util-value-to-estree#6) [#6](#6) * **deps:** bump postcss from 8.5.3 to 8.5.6 ([#1128](#1128)) ([2731484](2731484)), closes [#2052](https://github.com/readmeio/markdown/issues/2052) * **deps:** bump remark-mdx from 3.1.0 to 3.1.1 ([#1185](#1185)) ([bc7f79a](bc7f79a)), closes [mdx-js/mdx#2593](mdx-js/mdx#2593) [mdx-js/mdx#2595](mdx-js/mdx#2595) [mdx-js/mdx#2629](mdx-js/mdx#2629) [mdx-js/mdx#2622](mdx-js/mdx#2622) [mdx-js/mdx#2605](mdx-js/mdx#2605) [mdx-js/mdx#2604](mdx-js/mdx#2604) * **deps:** dependabot updates ([#1217](#1217)) ([b8b0b78](b8b0b78)) <!--SKIP CI-->
Initial checklist
Description of changes
This change improves(?) error conversion in the esbuild plugin, with no change to non-error function.
Previously, if a non-
VFileMessageerror was thrown by the MDX conversion process (eg. a simple nodejs runtime Error thrown by a plugin or the core), it would be wrapped as thecausein aVFileMessagewith generic "Cannot process MDX file..." text, and re-thrown by theonloadhandler. This makes sense! However, when that message is converted invfileMessageToEsbuild, thecausewas completely ignored, so all information about that underlying error was lost, which makes debugging harder (especially debugging plugins).Also previously, even when the original error thrown was a
VFileMessage, if the optionalplace.start.offset(orplace.offset) isn't defined, all place information was lost. This.offsetfield is optional (though set in most common paths).This change revises things:
In the
onloadhandler, always throw a newVFileMessagewith the original exception attached. Hoist location information to the outer exception, if the inner exception appears to be aVFileMessageitself. Include the inner exception's text rendering in the outer's text (after a colon).In
vfileMessageToEsbuild, handle the case where offset information isn't present, working with whatever information is present.The changes to the unit test are a decent way to see the effect of all this.