gatsby icon indicating copy to clipboard operation
gatsby copied to clipboard

BREAKING CHANGE(gatsby-plugin-mdx): MDX v2

Open axe312ger opened this issue 2 years ago • 4 comments

This PR replaces the old gatsby-plugin-mdx with a new version that is powered by MDX v2.

We won't be 100% backwards compatible, but most use cases will be covered. Simplification and better performance is the overall goal.

Separate PRs

  • https://github.com/gatsbyjs/gatsby/pull/35751
  • https://github.com/gatsbyjs/gatsby/pull/35752
  • https://github.com/gatsbyjs/gatsby/pull/35753
  • https://github.com/gatsbyjs/gatsby/pull/35888
  • https://github.com/gatsbyjs/gatsby/pull/35873
  • https://github.com/gatsbyjs/gatsby/pull/35983
  • https://github.com/gatsbyjs/gatsby/pull/35893
  • https://github.com/gatsbyjs/gatsby/pull/36009
  • https://github.com/gatsbyjs/gatsby/pull/36201
  • https://github.com/gatsbyjs/gatsby/pull/36118

Changes:

This is a complete rewrite of the plugin, so some old features might be gone.

New features

  • [x] Upgraded all dependencies including MDX to v2
  • [x] Per file tree-shaking and chunking via webpack
  • [x] MDXRenderer is no more needed.
  • [x] Similar or better performance than old plugin. (First tests on complex projects show similar performance)
  • [x] Extended e2e tests
  • [x] Simplified plugin configuration
  • [x] Via the mdxOptions config option you can pass any configuration to @mdx-js/js compile like remarkPlugins, rehypePlugins, recmaPlugins and more.
  • [x] Move away from react-test-renderer in tests
  • [x] Authored in TS

Kept features

  • [x] .mdx files from src/pages are turned into real pages
  • [x] .mdx files loaded via gatsby-source-filesystem or as component via createPage can be turned into real pages
  • [x] support for frontmatter (via GraphQL and page context)
  • [x] excerpt & table of contents support https://github.com/gatsbyjs/gatsby/pull/35873
  • [x] support for remark, rehype and most gatsby-remark-* plugins #35751

Removed features

  • [x] (compiled) MDX code won't be available anymore within GraphQL
  • [x] MD nodes are no more automatically turned into MDX
  • [x] config option defaultLayouts is gone
  • [x] config option lessBabel is gone
  • [x] config option mediaTypes is gone
  • [x] config option shouldBlockNodeFromTransformation is gone
  • [x] some GraphQL data is no more available in core and have to be implemented on project level (like time to read)

Post Release ToDos

Closes #25068 Closes #34421 Closes #35733 Closes #35732

axe312ger avatar May 13 '22 12:05 axe312ger

TODOs from other PR:

  • https://github.com/gatsbyjs/gatsby/pull/35751#issuecomment-1141859593
  • https://github.com/gatsbyjs/gatsby/pull/35751#discussion_r885381904
  • https://github.com/gatsbyjs/gatsby/pull/35751#discussion_r885662293

LekoArts avatar May 31 '22 13:05 LekoArts

I'm so excited about this! Great work @axe312ger 👏 👏

alvinometric avatar Jun 20 '22 11:06 alvinometric

I'm so excited about this! Great work @axe312ger 👏 👏

Thanks, not easy but we are getting there 🙈

axe312ger avatar Jun 28 '22 10:06 axe312ger

As some might follow just here: The RC is out! 🎉

https://github.com/gatsbyjs/gatsby/discussions/25068#discussioncomment-3100249

axe312ger avatar Jul 07 '22 16:07 axe312ger