Skip to content

Commit cb0bf76

Browse files
committed
clean up dependencies and restore changelog and readme
1 parent 5e49e0f commit cb0bf76

File tree

9 files changed

+119
-801
lines changed

9 files changed

+119
-801
lines changed

benchmarks/gabe-fs-mdx/gatsby-config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ module.exports = {
2020
},
2121
},
2222
},
23-
`gatsby-plugin-webpack-bundle-analyser-v2`,
24-
],
23+
!process.env.CI && `gatsby-plugin-webpack-bundle-analyser-v2`,
24+
].filter(Boolean),
2525
}

benchmarks/gabe-fs-mdx/package.json

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,12 @@
2929
"mdx"
3030
],
3131
"dependencies": {
32-
"@mdx-js/mdx": "^1",
33-
"@mdx-js/react": "^1",
32+
"@mdx-js/react": "^2",
3433
"faker": "^4.1.0",
35-
"gatsby": "^2",
36-
"gatsby-plugin-mdx": "^1",
37-
"gatsby-source-filesystem": "^2",
38-
"react": "^16.12.0",
39-
"react-dom": "^16.12.0"
34+
"gatsby": "^4",
35+
"gatsby-plugin-mdx": "^3",
36+
"gatsby-source-filesystem": "^4",
37+
"react": "^17",
38+
"react-dom": "^17"
4039
}
4140
}

e2e-tests/mdx/gatsby-config.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,8 @@ module.exports = {
2929
remarkPlugins: [remarkRequireFilePathPlugin],
3030
},
3131
},
32-
`gatsby-plugin-webpack-bundle-analyser-v2`,
33-
],
32+
!process.env.CI && `gatsby-plugin-webpack-bundle-analyser-v2`,
33+
].filter(Boolean),
3434
}
3535

3636
/**

e2e-tests/mdx/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
"description": "Gatsby MDX tester",
44
"version": "1.0.0",
55
"dependencies": {
6-
"@mdx-js/mdx": "^1.6.6",
7-
"@mdx-js/react": "^1.6.6",
6+
"@mdx-js/react": "^2",
87
"cypress": "^7.2.0",
98
"fs-extra": "^8.1.0",
10-
"gatsby": "^3.0.0",
11-
"gatsby-plugin-mdx": "^2.0.0",
12-
"gatsby-source-filesystem": "^3.0.0",
9+
"gatsby": "^4.0.0",
10+
"gatsby-plugin-mdx": "^3.0.0",
11+
"gatsby-plugin-webpack-bundle-analyser-v2": "^1.1.27",
12+
"gatsby-source-filesystem": "^4.0.0",
1313
"react": "^17.0.2",
1414
"react-dom": "^17.0.2",
1515
"theme-ui": "^0.3.1"

packages/gatsby-plugin-mdx-old/package.json

Lines changed: 0 additions & 83 deletions
This file was deleted.
File renamed without changes.
Lines changed: 11 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,19 @@ MDX seeks to make writing with Markdown and JSX simpler while being more express
3838
- [Gatsby remark plugins](#gatsby-remark-plugins)
3939
- [Remark plugins](#remark-plugins)
4040
- [Rehype plugins](#rehype-plugins)
41-
- [Media types](#media-types)
42-
- [Explanation](#explanation)
43-
- [shouldBlockNodeFromTransformation](#shouldblocknodefromtransformation)
4441
- [Components](#components)
4542
- [MDXProvider](#mdxprovider)
4643
- [Related](#related)
47-
- [MDXRenderer](#mdxrenderer)
44+
- [Troubleshooting](#troubleshooting)
45+
- [Excerpts for non-latin languages](#excerpts-for-non-latin-languages)
4846
- [License](#license)
4947

5048
## Installation
5149

5250
Install:
5351

5452
```shell
55-
npm install gatsby-plugin-mdx @mdx-js/mdx@v1 @mdx-js/react@v1
53+
npm install gatsby-plugin-mdx @mdx-js/react
5654
```
5755

5856
## Usage
@@ -113,16 +111,13 @@ module.exports = {
113111
any other Gatsby plugin. You can define MDX extensions, layouts, global
114112
scope, and more.
115113

116-
| Key | Default | Description |
117-
| ------------------------------------------------------------------------- | -------------------------------------- | --------------------------------------------------------------------- |
118-
| [`extensions`](#extensions) | `[".mdx"]` | Configure the file extensions that gatsby-plugin-mdx will process |
119-
| [`defaultLayouts`](#default-layouts) | `{}` | Set the layout components for MDX source types |
120-
| [`gatsbyRemarkPlugins`](#gatsby-remark-plugins) | `[]` | Use Gatsby-specific remark plugins |
121-
| [`remarkPlugins`](#remark-plugins) | `[]` | Specify remark plugins |
122-
| [`rehypePlugins`](#rehype-plugins) | `[]` | Specify rehype plugins |
123-
| [`mediaTypes`](#media-types) | `["text/markdown", "text/x-markdown"]` | Determine which media types are processed by MDX |
124-
| [`shouldBlockNodeFromTransformation`](#shouldblocknodefromtransformation) | `(node) => false` | Disable MDX transformation for nodes where this function returns true |
125-
| [`commonmark`](#commonmark) | `false` | Use CommonMark |
114+
| Key | Default | Description |
115+
| ----------------------------------------------- | ---------- | ----------------------------------------------------------------- |
116+
| [`extensions`](#extensions) | `[".mdx"]` | Configure the file extensions that gatsby-plugin-mdx will process |
117+
| [`defaultLayouts`](#default-layouts) | `{}` | Set the layout components for MDX source types |
118+
| [`gatsbyRemarkPlugins`](#gatsby-remark-plugins) | `[]` | Use Gatsby-specific remark plugins |
119+
| [`remarkPlugins`](#remark-plugins) | `[]` | Specify remark plugins |
120+
| [`rehypePlugins`](#rehype-plugins) | `[]` | Specify rehype plugins |
126121

127122
#### Extensions
128123

@@ -411,61 +406,6 @@ module.exports = {
411406
}
412407
```
413408

414-
#### Media types
415-
416-
Deciding what content gets processed by `gatsby-plugin-mdx`. This is an
417-
advanced option that is useful for dealing with specialized generated
418-
content. It is not intended to be configured for most users.
419-
420-
```js
421-
// gatsby-config.js
422-
module.exports = {
423-
plugins: [
424-
{
425-
resolve: `gatsby-plugin-mdx`,
426-
options: {
427-
mediaTypes: [`text/markdown`, `text/x-markdown`],
428-
},
429-
},
430-
],
431-
}
432-
```
433-
434-
##### Explanation
435-
436-
Gatsby includes the media-type of the content on any given node. For
437-
`file` nodes, we choose whether to process the content with MDX or not
438-
by the file extension. For remote content or generated content, we
439-
choose which nodes to process by looking at the media type.
440-
441-
#### shouldBlockNodeFromTransformation
442-
443-
Given a function `(node) => Boolean` allows you to decide for each node if it should be transformed or not.
444-
445-
```js
446-
// gatsby-config.js
447-
module.exports = {
448-
plugins: [
449-
{
450-
resolve: `gatsby-plugin-mdx`,
451-
options: {
452-
shouldBlockNodeFromTransformation(node) {
453-
return (
454-
[`NPMPackage`, `NPMPackageReadme`].includes(node.internal.type) ||
455-
(node.internal.type === `File` &&
456-
path.parse(node.dir).dir.endsWith(`packages`))
457-
)
458-
},
459-
},
460-
},
461-
],
462-
}
463-
```
464-
465-
#### CommonMark
466-
467-
MDX will be parsed using CommonMark.
468-
469409
### Components
470410

471411
MDX and `gatsby-plugin-mdx` use components for different things like rendering
@@ -541,41 +481,7 @@ You can also expose any custom component to every mdx file using
541481

542482
##### Related
543483

544-
- [MDX components](https://mdxjs.com/getting-started/#mdxprovider)
545-
546-
#### MDXRenderer
547-
548-
`MDXRenderer` is a React component that takes _compiled_ MDX content and
549-
renders it. You will need to use this if your MDX content is coming
550-
from a GraphQL page query or `StaticQuery`.
551-
552-
`MDXRenderer` takes any prop and passes it on to your MDX content,
553-
just like a normal React component.
554-
555-
```jsx
556-
<MDXRenderer title="My Stuff!">{mdx.body}</MDXRenderer>
557-
```
558-
559-
Using a page query:
560-
561-
```jsx
562-
import { MDXRenderer } from "gatsby-plugin-mdx"
563-
564-
export default class MyPageLayout {
565-
render() {
566-
return <MDXRenderer>{this.props.data.mdx.body}</MDXRenderer>
567-
}
568-
}
569-
570-
export const pageQuery = graphql`
571-
query MDXQuery($id: String!) {
572-
mdx(id: { eq: $id }) {
573-
id
574-
body
575-
}
576-
}
577-
`
578-
```
484+
- [React context for MDX](https://mdxjs.com/packages/react/#use)
579485

580486
## Troubleshooting
581487

packages/gatsby-plugin-mdx/package.json

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,20 +51,25 @@
5151
"dependencies": {
5252
"@mdx-js/loader": "^2.1.1",
5353
"@mdx-js/mdx": "^2.1.1",
54+
"change-case": "^4.1.2",
55+
"fs-extra": "^10.1.0",
56+
"gray-matter": "^4.0.3",
5457
"mdast-util-from-markdown": "^1.2.0",
55-
"mdast-util-mdxjs-esm": "^1.2.0",
58+
"mdast-util-mdx": "^2.0.0",
5659
"mdast-util-to-markdown": "^1.3.0",
57-
"micromark-extension-mdxjs-esm": "^1.0.3"
60+
"micromark-extension-mdxjs": "^1.0.0"
5861
},
5962
"devDependencies": {
6063
"babel-preset-gatsby-package": "2.15.0-next.0",
6164
"typescript": "^4.6.4"
6265
},
6366
"peerDependencies": {
64-
"@mdx-js/mdx": "^2.0.0",
6567
"@mdx-js/react": "^2.0.0",
6668
"gatsby": "^4.0.0-next",
69+
"gatsby-source-filesystem": "^4.0.0-next",
70+
"loader-utils": "^3.2.0",
6771
"react": "^16.9.0 || ^17.0.0 || ^18.0.0",
68-
"react-dom": "^16.9.0 || ^17.0.0 || ^18.0.0"
72+
"react-dom": "^16.9.0 || ^17.0.0 || ^18.0.0",
73+
"webpack": "^5.72.1"
6974
}
7075
}

0 commit comments

Comments
 (0)