@astrojs/mdx 3.1.3 → 3.1.5
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.
|
@@ -17,24 +17,25 @@ function rehypeApplyFrontmatterExport() {
|
|
|
17
17
|
if (frontmatter.layout) {
|
|
18
18
|
exportNodes.unshift(
|
|
19
19
|
jsToTreeNode(
|
|
20
|
+
// NOTE: Use `__astro_*` import names to prevent conflicts with user code
|
|
20
21
|
/** @see 'vite-plugin-markdown' for layout props reference */
|
|
21
|
-
`import { jsx as
|
|
22
|
+
`import { jsx as __astro_layout_jsx__ } from 'astro/jsx-runtime';
|
|
23
|
+
import __astro_layout_component__ from ${JSON.stringify(frontmatter.layout)};
|
|
22
24
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
};`
|
|
25
|
+
export default function ({ children }) {
|
|
26
|
+
const { layout, ...content } = frontmatter;
|
|
27
|
+
content.file = file;
|
|
28
|
+
content.url = url;
|
|
29
|
+
return __astro_layout_jsx__(__astro_layout_component__, {
|
|
30
|
+
file,
|
|
31
|
+
url,
|
|
32
|
+
content,
|
|
33
|
+
frontmatter: content,
|
|
34
|
+
headings: getHeadings(),
|
|
35
|
+
'server:root': true,
|
|
36
|
+
children,
|
|
37
|
+
});
|
|
38
|
+
};`
|
|
38
39
|
)
|
|
39
40
|
);
|
|
40
41
|
}
|
package/dist/vite-plugin-mdx.js
CHANGED
|
@@ -32,8 +32,9 @@ function vitePluginMdx(mdxOptions) {
|
|
|
32
32
|
// ex. inject layouts
|
|
33
33
|
async transform(code, id) {
|
|
34
34
|
if (!id.endsWith(".mdx")) return;
|
|
35
|
-
const { data: frontmatter, content: pageContent } = parseFrontmatter(code, id);
|
|
36
|
-
const
|
|
35
|
+
const { data: frontmatter, content: pageContent, matter } = parseFrontmatter(code, id);
|
|
36
|
+
const frontmatterLines = matter ? matter.match(/\n/g)?.join("") + "\n\n" : "";
|
|
37
|
+
const vfile = new VFile({ value: frontmatterLines + pageContent, path: id });
|
|
37
38
|
setVfileFrontmatter(vfile, frontmatter);
|
|
38
39
|
if (!processor) {
|
|
39
40
|
return this.error(
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@astrojs/mdx",
|
|
3
3
|
"description": "Add support for MDX pages in your Astro site",
|
|
4
|
-
"version": "3.1.
|
|
4
|
+
"version": "3.1.5",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"author": "withastro",
|
|
@@ -31,16 +31,15 @@
|
|
|
31
31
|
"acorn": "^8.12.1",
|
|
32
32
|
"es-module-lexer": "^1.5.4",
|
|
33
33
|
"estree-util-visit": "^2.0.0",
|
|
34
|
-
"github-slugger": "^2.0.0",
|
|
35
34
|
"gray-matter": "^4.0.3",
|
|
36
|
-
"hast-util-to-html": "^9.0.
|
|
35
|
+
"hast-util-to-html": "^9.0.2",
|
|
37
36
|
"kleur": "^4.1.5",
|
|
38
37
|
"rehype-raw": "^7.0.0",
|
|
39
38
|
"remark-gfm": "^4.0.0",
|
|
40
39
|
"remark-smartypants": "^3.0.2",
|
|
41
40
|
"source-map": "^0.7.4",
|
|
42
41
|
"unist-util-visit": "^5.0.0",
|
|
43
|
-
"vfile": "^6.0.
|
|
42
|
+
"vfile": "^6.0.3",
|
|
44
43
|
"@astrojs/markdown-remark": "5.2.0"
|
|
45
44
|
},
|
|
46
45
|
"peerDependencies": {
|
|
@@ -50,22 +49,21 @@
|
|
|
50
49
|
"@types/estree": "^1.0.5",
|
|
51
50
|
"@types/hast": "^3.0.4",
|
|
52
51
|
"@types/mdast": "^4.0.4",
|
|
53
|
-
"
|
|
54
|
-
"cheerio": "1.0.0-rc.12",
|
|
52
|
+
"cheerio": "1.0.0",
|
|
55
53
|
"linkedom": "^0.18.4",
|
|
56
54
|
"mdast-util-mdx": "^3.0.0",
|
|
57
|
-
"mdast-util-mdx-jsx": "^3.1.
|
|
55
|
+
"mdast-util-mdx-jsx": "^3.1.3",
|
|
58
56
|
"mdast-util-to-string": "^4.0.0",
|
|
59
|
-
"reading-time": "^1.5.0",
|
|
60
57
|
"rehype-mathjax": "^6.0.0",
|
|
61
58
|
"rehype-pretty-code": "^0.13.2",
|
|
62
59
|
"remark-math": "^6.0.0",
|
|
63
60
|
"remark-rehype": "^11.1.0",
|
|
64
61
|
"remark-shiki-twoslash": "^3.1.3",
|
|
65
62
|
"remark-toc": "^9.0.0",
|
|
63
|
+
"shiki": "^1.14.1",
|
|
66
64
|
"unified": "^11.0.5",
|
|
67
|
-
"vite": "^5.
|
|
68
|
-
"astro": "4.
|
|
65
|
+
"vite": "^5.4.2",
|
|
66
|
+
"astro": "4.14.6",
|
|
69
67
|
"astro-scripts": "0.0.14"
|
|
70
68
|
},
|
|
71
69
|
"engines": {
|