@astrojs/mdx 1.0.0 → 1.0.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.
- package/dist/index.js +26 -18
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -92,24 +92,32 @@ function mdx(partialMdxOptions = {}) {
|
|
|
92
92
|
const { fileId } = getFileInfo(id, config);
|
|
93
93
|
const code = await fs.readFile(fileId, "utf-8");
|
|
94
94
|
const { data: frontmatter, content: pageContent } = parseFrontmatter(code, id);
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
95
|
+
try {
|
|
96
|
+
const compiled = await mdxCompile(new VFile({ value: pageContent, path: id }), {
|
|
97
|
+
...mdxPluginOpts,
|
|
98
|
+
elementAttributeNameCase: "html",
|
|
99
|
+
remarkPlugins: [
|
|
100
|
+
// Ensure `data.astro` is available to all remark plugins
|
|
101
|
+
toRemarkInitializeAstroData({ userFrontmatter: frontmatter }),
|
|
102
|
+
...mdxPluginOpts.remarkPlugins ?? []
|
|
103
|
+
],
|
|
104
|
+
recmaPlugins: [
|
|
105
|
+
...mdxPluginOpts.recmaPlugins ?? [],
|
|
106
|
+
() => recmaInjectImportMetaEnvPlugin({ importMetaEnv })
|
|
107
|
+
],
|
|
108
|
+
SourceMapGenerator: config.vite.build?.sourcemap ? SourceMapGenerator : void 0
|
|
109
|
+
});
|
|
110
|
+
return {
|
|
111
|
+
code: escapeViteEnvReferences(String(compiled.value)),
|
|
112
|
+
map: compiled.map
|
|
113
|
+
};
|
|
114
|
+
} catch (e) {
|
|
115
|
+
const err = e;
|
|
116
|
+
err.name = "MDXError";
|
|
117
|
+
err.loc = { file: fileId, line: e.line, column: e.column };
|
|
118
|
+
Error.captureStackTrace(err);
|
|
119
|
+
throw err;
|
|
120
|
+
}
|
|
113
121
|
}
|
|
114
122
|
},
|
|
115
123
|
{
|
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": "1.0.
|
|
4
|
+
"version": "1.0.2",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"author": "withastro",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@astrojs/prism": "3.0.0"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"astro": "^3.0.
|
|
50
|
+
"astro": "^3.0.10"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@types/chai": "^4.3.5",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"remark-shiki-twoslash": "^3.1.3",
|
|
70
70
|
"remark-toc": "^8.0.1",
|
|
71
71
|
"vite": "^4.4.9",
|
|
72
|
-
"astro": "3.0.
|
|
72
|
+
"astro": "3.0.10",
|
|
73
73
|
"astro-scripts": "0.0.14"
|
|
74
74
|
},
|
|
75
75
|
"engines": {
|