@astrojs/mdx 0.8.1 → 0.8.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (59) hide show
  1. package/.turbo/turbo-build.log +5 -5
  2. package/CHANGELOG.md +6 -0
  3. package/README.md +4 -4
  4. package/dist/index.js +2 -2
  5. package/package.json +2 -2
  6. package/src/index.ts +2 -2
  7. package/test/fixtures/mdx-component/dist/index.html +3 -0
  8. package/test/fixtures/mdx-component/node_modules/.vite/deps_temp/package.json +1 -0
  9. package/test/fixtures/mdx-custom-frontmatter-name/dist/glob.json +1 -0
  10. package/test/fixtures/mdx-custom-frontmatter-name/dist/index.html +1 -0
  11. package/test/fixtures/mdx-custom-frontmatter-name/node_modules/.vite/deps_temp/package.json +1 -0
  12. package/test/fixtures/mdx-frontmatter/dist/glob.json +1 -0
  13. package/test/fixtures/mdx-frontmatter/dist/index.html +17 -0
  14. package/test/fixtures/mdx-frontmatter/dist/with-headings/index.html +18 -0
  15. package/test/fixtures/mdx-frontmatter/node_modules/.vite/deps_temp/package.json +1 -0
  16. package/test/fixtures/mdx-frontmatter-injection/node_modules/.bin/astro +2 -2
  17. package/test/fixtures/mdx-get-headings/dist/pages.json +1 -0
  18. package/test/fixtures/mdx-get-headings/dist/test/index.html +5 -0
  19. package/test/fixtures/mdx-get-headings/dist/test-with-jsx-expressions/index.html +3 -0
  20. package/test/fixtures/mdx-get-headings/node_modules/.vite/deps_temp/package.json +1 -0
  21. package/test/fixtures/mdx-get-static-paths/dist/one/index.html +13 -0
  22. package/test/fixtures/mdx-page/dist/index.html +1 -0
  23. package/test/fixtures/mdx-page/node_modules/.bin/astro +2 -2
  24. package/test/fixtures/mdx-page/node_modules/.vite/deps_temp/package.json +1 -0
  25. package/test/fixtures/mdx-plus-react/dist/client.0d691cb3.js +32 -0
  26. package/test/fixtures/mdx-plus-react/dist/index.html +8 -0
  27. package/test/fixtures/mdx-plus-react/node_modules/.bin/astro +2 -2
  28. package/test/fixtures/mdx-plus-react/node_modules/.vite/deps_temp/@astrojs_react_client__js.js +95 -0
  29. package/test/fixtures/mdx-plus-react/node_modules/.vite/deps_temp/@astrojs_react_client__js.js.map +7 -0
  30. package/test/fixtures/mdx-plus-react/node_modules/.vite/deps_temp/_metadata.json +47 -0
  31. package/test/fixtures/mdx-plus-react/node_modules/.vite/deps_temp/chunk-CDYRCHBX.js +7480 -0
  32. package/test/fixtures/mdx-plus-react/node_modules/.vite/deps_temp/chunk-CDYRCHBX.js.map +7 -0
  33. package/test/fixtures/mdx-plus-react/node_modules/.vite/deps_temp/chunk-RRXZ3AUC.js +326 -0
  34. package/test/fixtures/mdx-plus-react/node_modules/.vite/deps_temp/chunk-RRXZ3AUC.js.map +7 -0
  35. package/test/fixtures/mdx-plus-react/node_modules/.vite/deps_temp/chunk-TWLJ45QX.js +27 -0
  36. package/test/fixtures/mdx-plus-react/node_modules/.vite/deps_temp/chunk-TWLJ45QX.js.map +7 -0
  37. package/test/fixtures/mdx-plus-react/node_modules/.vite/deps_temp/package.json +1 -0
  38. package/test/fixtures/mdx-plus-react/node_modules/.vite/deps_temp/react-dom.js +12 -0
  39. package/test/fixtures/mdx-plus-react/node_modules/.vite/deps_temp/react-dom.js.map +7 -0
  40. package/test/fixtures/mdx-plus-react/node_modules/.vite/deps_temp/react.js +11 -0
  41. package/test/fixtures/mdx-plus-react/node_modules/.vite/deps_temp/react.js.map +7 -0
  42. package/test/fixtures/mdx-plus-react/node_modules/.vite/deps_temp/react_jsx-dev-runtime.js +41 -0
  43. package/test/fixtures/mdx-plus-react/node_modules/.vite/deps_temp/react_jsx-dev-runtime.js.map +7 -0
  44. package/test/fixtures/mdx-plus-react/node_modules/.vite/deps_temp/react_jsx-runtime.js +62 -0
  45. package/test/fixtures/mdx-plus-react/node_modules/.vite/deps_temp/react_jsx-runtime.js.map +7 -0
  46. package/test/fixtures/mdx-rehype-plugins/dist/reading-time.json +1 -0
  47. package/test/fixtures/mdx-rehype-plugins/dist/space-ipsum/index.html +13 -0
  48. package/test/fixtures/mdx-rehype-plugins/node_modules/.vite/deps_temp/package.json +1 -0
  49. package/test/fixtures/mdx-remark-plugins/dist/with-gfm/index.html +2 -0
  50. package/test/fixtures/mdx-remark-plugins/dist/with-toc/index.html +22 -0
  51. package/test/fixtures/mdx-remark-plugins/node_modules/.vite/deps_temp/package.json +1 -0
  52. package/test/fixtures/mdx-syntax-hightlighting/dist/index.html +6 -0
  53. package/test/fixtures/mdx-syntax-hightlighting/node_modules/.vite/deps_temp/package.json +1 -0
  54. package/test/fixtures/mdx-url-export/dist/pages.json +1 -0
  55. package/test/fixtures/mdx-url-export/dist/test-1/index.html +1 -0
  56. package/test/fixtures/mdx-url-export/dist/test-2/index.html +1 -0
  57. package/test/fixtures/mdx-url-export/dist/with-url-override/index.html +1 -0
  58. package/test/fixtures/mdx-url-export/node_modules/.vite/deps_temp/package.json +1 -0
  59. package/test/fixtures/node_modules/.vite/deps_temp/package.json +1 -0
@@ -1,5 +1,5 @@
1
- @astrojs/mdx:build: cache hit, replaying output 628f5c9b87587320
2
- @astrojs/mdx:build: 
3
- @astrojs/mdx:build: > @astrojs/mdx@0.8.1 build /home/runner/work/astro/astro/packages/integrations/mdx
4
- @astrojs/mdx:build: > astro-scripts build "src/**/*.ts" && tsc
5
- @astrojs/mdx:build: 
1
+ @astrojs/mdx:build: cache hit, replaying output 3036c715efc9fce9
2
+ @astrojs/mdx:build: 
3
+ @astrojs/mdx:build: > @astrojs/mdx@0.8.2 build /Users/matthew/dev/astro/packages/integrations/mdx
4
+ @astrojs/mdx:build: > astro-scripts build "src/**/*.ts" && tsc
5
+ @astrojs/mdx:build: 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @astrojs/mdx
2
2
 
3
+ ## 0.8.2
4
+
5
+ ### Patch Changes
6
+
7
+ - [#4237](https://github.com/withastro/astro/pull/4237) [`9d5ab5508`](https://github.com/withastro/astro/commit/9d5ab55086964fbede17da3d78c209c6d8d13711) Thanks [@bholmesdev](https://github.com/bholmesdev)! - Update "Astro.props.content" -> "Astro.props.frontmatter" in README
8
+
3
9
  ## 0.8.1
4
10
 
5
11
  ### Patch Changes
package/README.md CHANGED
@@ -195,19 +195,19 @@ title: 'My Blog Post'
195
195
  ---
196
196
  ```
197
197
 
198
- Then, you can retrieve all other frontmatter properties from your layout via the `content` property, and render your MDX using the default [`<slot />`](https://docs.astro.build/en/core-concepts/astro-components/#slots):
198
+ Then, you can retrieve all other frontmatter properties from your layout via the `frontmatter` property, and render your MDX using the default [`<slot />`](https://docs.astro.build/en/core-concepts/astro-components/#slots):
199
199
 
200
200
  ```astro
201
201
  ---
202
202
  // src/layouts/BaseLayout.astro
203
- const { content } = Astro.props;
203
+ const { frontmatter } = Astro.props;
204
204
  ---
205
205
  <html>
206
206
  <head>
207
- <title>{content.title}</title>
207
+ <title>{frontmatter.title}</title>
208
208
  </head>
209
209
  <body>
210
- <h1>{content.title}</h1>
210
+ <h1>{frontmatter.title}</h1>
211
211
  <!-- Rendered MDX will be passed into the default slot. -->
212
212
  <slot />
213
213
  </body>
package/dist/index.js CHANGED
@@ -37,9 +37,9 @@ function getRemarkPlugins(mdxOptions, config) {
37
37
  function getRehypePlugins(mdxOptions, config) {
38
38
  let rehypePlugins = handleExtends(mdxOptions.rehypePlugins, DEFAULT_REHYPE_PLUGINS);
39
39
  if (config.markdown.syntaxHighlight === "shiki" || config.markdown.syntaxHighlight === "prism") {
40
- rehypePlugins.push([rehypeRaw, { passThrough: nodeTypes }]);
40
+ rehypePlugins.unshift([rehypeRaw, { passThrough: nodeTypes }]);
41
41
  }
42
- rehypePlugins.push(rehypeCollectHeadings);
42
+ rehypePlugins.unshift(rehypeCollectHeadings);
43
43
  return rehypePlugins;
44
44
  }
45
45
  function mdx(mdxOptions = {}) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@astrojs/mdx",
3
3
  "description": "Use MDX within Astro",
4
- "version": "0.8.1",
4
+ "version": "0.8.2",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.ts",
7
7
  "author": "withastro",
@@ -43,7 +43,7 @@
43
43
  "@types/chai": "^4.3.1",
44
44
  "@types/mocha": "^9.1.1",
45
45
  "@types/yargs-parser": "^21.0.0",
46
- "astro": "1.0.0",
46
+ "astro": "1.0.2",
47
47
  "astro-scripts": "0.0.7",
48
48
  "chai": "^4.3.6",
49
49
  "linkedom": "^0.14.12",
package/src/index.ts CHANGED
@@ -62,10 +62,10 @@ function getRehypePlugins(
62
62
  let rehypePlugins = handleExtends(mdxOptions.rehypePlugins, DEFAULT_REHYPE_PLUGINS);
63
63
 
64
64
  if (config.markdown.syntaxHighlight === 'shiki' || config.markdown.syntaxHighlight === 'prism') {
65
- rehypePlugins.push([rehypeRaw, { passThrough: nodeTypes }]);
65
+ rehypePlugins.unshift([rehypeRaw, { passThrough: nodeTypes }]);
66
66
  }
67
67
  // getHeadings() is guaranteed by TS, so we can't allow user to override
68
- rehypePlugins.push(rehypeCollectHeadings);
68
+ rehypePlugins.unshift(rehypeCollectHeadings);
69
69
 
70
70
  return rehypePlugins;
71
71
  }
@@ -0,0 +1,3 @@
1
+ <!DOCTYPE html>
2
+ <h1 id="hello-component">Hello component!</h1>
3
+ <div id="foo">bar</div>
@@ -0,0 +1 @@
1
+ {"titles":["Using YAML frontmatter"]}
@@ -0,0 +1 @@
1
+ <!DOCTYPE html><h1 id="customfrontmatterillthrowifidontexist">Oh no, that&#39;s scary!</h1>
@@ -0,0 +1 @@
1
+ {"titles":["Using YAML frontmatter",null]}
@@ -0,0 +1,17 @@
1
+ <!DOCTYPE html><html lang="en">
2
+
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ </head>
8
+
9
+ <body>
10
+ <p data-content-title>Using YAML frontmatter</p>
11
+ <p data-frontmatter-title>Using YAML frontmatter</p>
12
+ <p data-layout-rendered>Layout rendered!</p>
13
+ <ul data-headings>
14
+
15
+ </ul>
16
+ Oh no, that&#39;s scary!
17
+ </body></html>
@@ -0,0 +1,18 @@
1
+ <!DOCTYPE html><html lang="en">
2
+
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta http-equiv="X-UA-Compatible" content="IE=edge">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ </head>
8
+
9
+ <body>
10
+ <p data-content-title></p>
11
+ <p data-frontmatter-title></p>
12
+ <p data-layout-rendered>Layout rendered!</p>
13
+ <ul data-headings>
14
+ <li>section-1</li><li>section-2</li>
15
+ </ul>
16
+ <h2 id="section-1">Section 1</h2>
17
+ <h2 id="section-2">Section 2</h2>
18
+ </body></html>
@@ -6,9 +6,9 @@ case `uname` in
6
6
  esac
7
7
 
8
8
  if [ -z "$NODE_PATH" ]; then
9
- export NODE_PATH="/home/runner/work/astro/astro/node_modules/.pnpm/node_modules"
9
+ export NODE_PATH="/Users/matthew/dev/astro/node_modules/.pnpm/node_modules"
10
10
  else
11
- export NODE_PATH="$NODE_PATH:/home/runner/work/astro/astro/node_modules/.pnpm/node_modules"
11
+ export NODE_PATH="$NODE_PATH:/Users/matthew/dev/astro/node_modules/.pnpm/node_modules"
12
12
  fi
13
13
  if [ -x "$basedir/node" ]; then
14
14
  exec "$basedir/node" "$basedir/../../../../../../../astro/astro.js" "$@"
@@ -0,0 +1 @@
1
+ {"headingsByPage":{"./test-with-jsx-expressions.mdx":[{"depth":1,"slug":"heading-test-with-jsx-expressions","text":"Heading test with JSX expressions"},{"depth":2,"slug":"h2title","text":"h2Title"},{"depth":3,"slug":"h3title","text":"h3Title"}],"./test.mdx":[{"depth":1,"slug":"heading-test","text":"Heading test"},{"depth":2,"slug":"section-1","text":"Section 1"},{"depth":3,"slug":"subsection-1","text":"Subsection 1"},{"depth":3,"slug":"subsection-2","text":"Subsection 2"},{"depth":2,"slug":"section-2","text":"Section 2"}]}}
@@ -0,0 +1,5 @@
1
+ <!DOCTYPE html><h1 id="heading-test">Heading test</h1>
2
+ <h2 id="section-1">Section 1</h2>
3
+ <h3 id="subsection-1">Subsection 1</h3>
4
+ <h3 id="subsection-2">Subsection 2</h3>
5
+ <h2 id="section-2">Section 2</h2>
@@ -0,0 +1,3 @@
1
+ <!DOCTYPE html><h1 id="heading-test-with-jsx-expressions">Heading test with JSX expressions</h1>
2
+ <h2 id="h2title">Section 1</h2>
3
+ <h3 id="h3title">Subsection 1</h3>
@@ -0,0 +1,13 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Page</title>
5
+ </head>
6
+ <body>
7
+ <p>First mdx file</p>
8
+
9
+ <div id="one">hello</div>
10
+ <div id="url">/src/content/1.mdx</div>
11
+ <div id="file">/Users/matthew/dev/astro/packages/integrations/mdx/test/fixtures/mdx-get-static-paths/src/content/1.mdx</div>
12
+ </body>
13
+ </html>
@@ -0,0 +1 @@
1
+ <!DOCTYPE html><h1 id="hello-page">Hello page!</h1>
@@ -6,9 +6,9 @@ case `uname` in
6
6
  esac
7
7
 
8
8
  if [ -z "$NODE_PATH" ]; then
9
- export NODE_PATH="/home/runner/work/astro/astro/node_modules/.pnpm/node_modules"
9
+ export NODE_PATH="/Users/matthew/dev/astro/node_modules/.pnpm/node_modules"
10
10
  else
11
- export NODE_PATH="$NODE_PATH:/home/runner/work/astro/astro/node_modules/.pnpm/node_modules"
11
+ export NODE_PATH="$NODE_PATH:/Users/matthew/dev/astro/node_modules/.pnpm/node_modules"
12
12
  fi
13
13
  if [ -x "$basedir/node" ]; then
14
14
  exec "$basedir/node" "$basedir/../../../../../../../astro/astro.js" "$@"