Skip to content
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

Replace MDX ModuleType with MDX SourceTransform #8766

Merged
merged 2 commits into from
Jul 30, 2024

Conversation

mischnic
Copy link
Contributor

Description

Remove ModuleType::Mdx and instead handle mdx files using

                    ModuleRuleEffect::ModuleType(ModuleType::Typescript {
                        transforms: ts_app_transforms,
                        tsx: true,
                        analyze_types: enable_types,
                        options: ecmascript_options_vc,
                    }),
                    ModuleRuleEffect::SourceTransforms(Vc::cell(vec![Vc::upcast(
                        MdxTransform::new(mdx_transform_options),
                    )])),

Testing Instructions

I ran these Next.js tests, which appear to be all mdx related tests there are

  mdx with-mdx-rs
    app directory
      ✓ should work in initial html (1262 ms)
      ✓ should work using browser (1460 ms)
      ✓ should work in initial html with mdx import (145 ms)
      ✓ should work using browser with mdx import (1179 ms)
      ✓ should allow overriding components (1163 ms)
      ✓ should allow importing client components (26 ms)
      ✓ should work with next/image (424 ms)
    pages directory
      ✓ should work in initial html (1091 ms)
      ✓ should work using browser (1216 ms)
      ✓ should work in initial html with mdx import (147 ms)
      ✓ should work using browser with mdx import (1202 ms)
      ✓ should allow overriding components (1236 ms)

@mischnic mischnic requested a review from a team as a code owner July 16, 2024 14:15
@turbo-orchestrator turbo-orchestrator bot added the needs: triage New issues get this label. Remove it after triage label Jul 16, 2024
Copy link

vercel bot commented Jul 16, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
examples-nonmonorepo ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 30, 2024 0:55am
rust-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 30, 2024 0:55am
8 Skipped Deployments
Name Status Preview Comments Updated (UTC)
examples-basic-web ⬜️ Ignored (Inspect) Visit Preview Jul 30, 2024 0:55am
examples-designsystem-docs ⬜️ Ignored (Inspect) Visit Preview Jul 30, 2024 0:55am
examples-gatsby-web ⬜️ Ignored (Inspect) Visit Preview Jul 30, 2024 0:55am
examples-kitchensink-blog ⬜️ Ignored (Inspect) Visit Preview Jul 30, 2024 0:55am
examples-native-web ⬜️ Ignored (Inspect) Visit Preview Jul 30, 2024 0:55am
examples-svelte-web ⬜️ Ignored (Inspect) Visit Preview Jul 30, 2024 0:55am
examples-tailwind-web ⬜️ Ignored (Inspect) Visit Preview Jul 30, 2024 0:55am
examples-vite-web ⬜️ Ignored (Inspect) Visit Preview Jul 30, 2024 0:55am

Copy link
Contributor

github-actions bot commented Jul 16, 2024

⚠️ CI failed ⚠️

The following steps have failed in CI:

  • Turbopack Rust tests (mac/win, non-blocking)

See workflow summary for details

Copy link
Contributor

github-actions bot commented Jul 16, 2024

🟢 Turbopack Benchmark CI successful 🟢

Thanks

Copy link
Contributor

✅ This change can build next-swc

@mischnic mischnic force-pushed the mischnic/mdx-sourcetransform branch from 3f4d578 to db039d4 Compare July 16, 2024 16:24
@turbo-orchestrator turbo-orchestrator bot added created-by: turbopack and removed needs: triage New issues get this label. Remove it after triage labels Jul 16, 2024
@mischnic mischnic force-pushed the mischnic/mdx-sourcetransform branch from db039d4 to ff83eba Compare July 17, 2024 14:52
@mischnic mischnic force-pushed the mischnic/mdx-sourcetransform branch from 749b748 to c1b68b8 Compare July 25, 2024 15:45
@mischnic mischnic merged commit fb46445 into main Jul 30, 2024
58 of 60 checks passed
@mischnic mischnic deleted the mischnic/mdx-sourcetransform branch July 30, 2024 14:49
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Jul 30, 2024
### Description

Remove `ModuleType::Mdx` and instead handle mdx files using
```rust
                    ModuleRuleEffect::ModuleType(ModuleType::Typescript {
                        transforms: ts_app_transforms,
                        tsx: true,
                        analyze_types: enable_types,
                        options: ecmascript_options_vc,
                    }),
                    ModuleRuleEffect::SourceTransforms(Vc::cell(vec![Vc::upcast(
                        MdxTransform::new(mdx_transform_options),
                    )])),
```

### Testing Instructions

I ran these Next.js tests, which appear to be all mdx related tests
there are
```
  mdx with-mdx-rs
    app directory
      ✓ should work in initial html (1262 ms)
      ✓ should work using browser (1460 ms)
      ✓ should work in initial html with mdx import (145 ms)
      ✓ should work using browser with mdx import (1179 ms)
      ✓ should allow overriding components (1163 ms)
      ✓ should allow importing client components (26 ms)
      ✓ should work with next/image (424 ms)
    pages directory
      ✓ should work in initial html (1091 ms)
      ✓ should work using browser (1216 ms)
      ✓ should work in initial html with mdx import (147 ms)
      ✓ should work using browser with mdx import (1202 ms)
      ✓ should allow overriding components (1236 ms)
```
sokra pushed a commit that referenced this pull request Jul 31, 2024
Trying #8031 again

~~Depends on #8766

<img width="979" alt="Bildschirmfoto 2024-07-30 um 15 35 48"
src="https://github.com/user-attachments/assets/32d88ffc-c816-41fb-928b-79d27e89b56d">

---------

Co-authored-by: 강동윤 (Donny) <[email protected]>
sokra added a commit to vercel/next.js that referenced this pull request Jul 31, 2024
* vercel/turborepo#8875 <!-- Tobias Koppers -
improve test glob to exclude output folder -->
* vercel/turborepo#8874 <!-- Tobias Koppers - only
add import references when they are used -->
* vercel/turborepo#8766 <!-- Niklas Mischkulnig -
Replace MDX ModuleType with MDX SourceTransform -->
* vercel/turborepo#8090 <!-- DevMirza - fix(ci):
Trying to fix `benchmark-turbopack` workflow -->
* vercel/turborepo#8837 <!-- Niklas Mischkulnig -
Make JS Lints have lower severity -->
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Jul 31, 2024
Trying vercel/turborepo#8031 again

~~Depends on vercel/turborepo#8766

<img width="979" alt="Bildschirmfoto 2024-07-30 um 15 35 48"
src="https://github.com/user-attachments/assets/32d88ffc-c816-41fb-928b-79d27e89b56d">

---------

Co-authored-by: 강동윤 (Donny) <[email protected]>
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Aug 1, 2024
### Description

Remove `ModuleType::Mdx` and instead handle mdx files using
```rust
                    ModuleRuleEffect::ModuleType(ModuleType::Typescript {
                        transforms: ts_app_transforms,
                        tsx: true,
                        analyze_types: enable_types,
                        options: ecmascript_options_vc,
                    }),
                    ModuleRuleEffect::SourceTransforms(Vc::cell(vec![Vc::upcast(
                        MdxTransform::new(mdx_transform_options),
                    )])),
```

### Testing Instructions

I ran these Next.js tests, which appear to be all mdx related tests
there are
```
  mdx with-mdx-rs
    app directory
      ✓ should work in initial html (1262 ms)
      ✓ should work using browser (1460 ms)
      ✓ should work in initial html with mdx import (145 ms)
      ✓ should work using browser with mdx import (1179 ms)
      ✓ should allow overriding components (1163 ms)
      ✓ should allow importing client components (26 ms)
      ✓ should work with next/image (424 ms)
    pages directory
      ✓ should work in initial html (1091 ms)
      ✓ should work using browser (1216 ms)
      ✓ should work in initial html with mdx import (147 ms)
      ✓ should work using browser with mdx import (1202 ms)
      ✓ should allow overriding components (1236 ms)
```
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Aug 1, 2024
Trying vercel/turborepo#8031 again

~~Depends on vercel/turborepo#8766

<img width="979" alt="Bildschirmfoto 2024-07-30 um 15 35 48"
src="https://github.com/user-attachments/assets/32d88ffc-c816-41fb-928b-79d27e89b56d">

---------

Co-authored-by: 강동윤 (Donny) <[email protected]>
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Aug 16, 2024
* vercel/turborepo#8875 <!-- Tobias Koppers -
improve test glob to exclude output folder -->
* vercel/turborepo#8874 <!-- Tobias Koppers - only
add import references when they are used -->
* vercel/turborepo#8766 <!-- Niklas Mischkulnig -
Replace MDX ModuleType with MDX SourceTransform -->
* vercel/turborepo#8090 <!-- DevMirza - fix(ci):
Trying to fix `benchmark-turbopack` workflow -->
* vercel/turborepo#8837 <!-- Niklas Mischkulnig -
Make JS Lints have lower severity -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants