You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(mdx): implement AST Bridge architecture for high-performance compilation
- Add mdx-rs-parser package for native Rust MDX parsing and generation
- Implement AST Bridge processor combining Rust performance with JS plugin compatibility
- Add experimental mdxCompiler config option for compiler selection
- Update MDX integration with compiler router for multiple compilation strategies
- Add type definitions for mdx-hybrid Rust engine support
Performance improvements:
- 12.8x faster compilation compared to JS with plugins
- Only 8.3% overhead vs pure Rust while maintaining plugin compatibility
- Parse with Rust → Transform with JS plugins → Generate with Rust
Co-authored-by: Claude <noreply@anthropic.com>
`Invalid or outdated experimental feature.\nCheck for incorrect spelling or outdated Astro version.\nSee https://docs.astro.build/en/reference/experimental-flags/ for a list of all current experiments.`,
* See the [experimental raw environment variables guide](https://docs.astro.build/en/reference/experimental-flags/raw-env-values/) for more information.
2459
2531
*/
2460
2532
rawEnvValues?: boolean;
2533
+
2534
+
/**
2535
+
* @docs
2536
+
* @name experimental.mdxCompiler
2537
+
* @type {'js' | 'rs'}
2538
+
* @default `'js'`
2539
+
* @description
2540
+
* Select the MDX compiler to use for processing MDX files.
2541
+
*
2542
+
* - `'js'` - Use the standard @mdx-js/mdx JavaScript compiler (default)
Copy file name to clipboardExpand all lines: packages/integrations/mdx/README.md
+50Lines changed: 50 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,10 +2,60 @@
2
2
3
3
This **[Astro integration][astro-integration]** enables the usage of [MDX](https://mdxjs.com/) components and allows you to create pages as `.mdx` files.
4
4
5
+
## Features
6
+
7
+
- 📝 Use MDX components and create pages as `.mdx` files
8
+
- 🚀 **Experimental:** Rust-powered compilation mode for improved performance
9
+
- 🔌 Full support for remark and rehype plugins
10
+
- ⚡ Automatic performance optimization based on configuration
11
+
5
12
## Documentation
6
13
7
14
Read the [`@astrojs/mdx` docs][docs]
8
15
16
+
## Experimental: RS Compiler Mode
17
+
18
+
The MDX integration now includes an experimental Rust-powered compiler mode that can provide 2-3× faster compilation:
19
+
20
+
```js
21
+
// astro.config.mjs
22
+
import { defineConfig } from'astro/config';
23
+
importmdxfrom'@astrojs/mdx';
24
+
25
+
exportdefaultdefineConfig({
26
+
experimental: {
27
+
// Choose your compiler:
28
+
// 'js' - Standard JavaScript compiler (default)
29
+
// 'rs' - Rust-powered compiler with automatic optimization
30
+
mdxCompiler:'rs',
31
+
},
32
+
integrations: [mdx()],
33
+
});
34
+
```
35
+
36
+
### How it works
37
+
38
+
The `rs` mode intelligently selects the best compilation strategy:
-**Without plugins**: Uses pure Rust compilation for maximum performance
42
+
43
+
### Requirements
44
+
45
+
For the `rs` mode to work optimally, install the `mdx-hybrid` package:
46
+
47
+
```bash
48
+
pnpm add mdx-hybrid
49
+
```
50
+
51
+
### Performance Monitoring
52
+
53
+
Enable performance logging to see compilation metrics:
54
+
55
+
```bash
56
+
MDX_PERF_LOG=1 pnpm build
57
+
```
58
+
9
59
## Support
10
60
11
61
- Get help in the [Astro Discord][discord]. Post questions in our `#support` forum, or visit our dedicated `#dev` channel to discuss current development and more!
0 commit comments