@astrojs/mdx 3.1.5 → 3.1.7
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.
|
@@ -19,7 +19,10 @@ const rehypeOptimizeStatic = (options) => {
|
|
|
19
19
|
const elementStack = [];
|
|
20
20
|
const elementMetadatas = /* @__PURE__ */ new WeakMap();
|
|
21
21
|
const isNodeNonStatic = (node) => {
|
|
22
|
-
return node.type.startsWith("mdx") ||
|
|
22
|
+
return node.type.startsWith("mdx") || // @ts-expect-error `node` should never have `type: 'root'`, but in some cases plugins may inject it as children,
|
|
23
|
+
// which MDX will render as a fragment instead (an MDX fragment is a `mdxJsxFlowElement` type).
|
|
24
|
+
node.type === "root" || // @ts-expect-error Access `.tagName` naively for perf
|
|
25
|
+
ignoreElementNames.has(node.tagName);
|
|
23
26
|
};
|
|
24
27
|
visit(tree, {
|
|
25
28
|
// @ts-expect-error Force coerce node as hast node
|
package/dist/vite-plugin-mdx.js
CHANGED
|
@@ -5,6 +5,7 @@ import { createMdxProcessor } from "./plugins.js";
|
|
|
5
5
|
import { parseFrontmatter } from "./utils.js";
|
|
6
6
|
function vitePluginMdx(mdxOptions) {
|
|
7
7
|
let processor;
|
|
8
|
+
let sourcemapEnabled;
|
|
8
9
|
return {
|
|
9
10
|
name: "@mdx-js/rollup",
|
|
10
11
|
enforce: "pre",
|
|
@@ -12,10 +13,7 @@ function vitePluginMdx(mdxOptions) {
|
|
|
12
13
|
processor = void 0;
|
|
13
14
|
},
|
|
14
15
|
configResolved(resolved) {
|
|
15
|
-
|
|
16
|
-
processor = createMdxProcessor(mdxOptions, {
|
|
17
|
-
sourcemap: !!resolved.build.sourcemap
|
|
18
|
-
});
|
|
16
|
+
sourcemapEnabled = !!resolved.build.sourcemap;
|
|
19
17
|
const jsxPluginIndex = resolved.plugins.findIndex((p) => p.name === "astro:jsx");
|
|
20
18
|
if (jsxPluginIndex !== -1) {
|
|
21
19
|
resolved.plugins.splice(jsxPluginIndex, 1);
|
|
@@ -37,9 +35,7 @@ function vitePluginMdx(mdxOptions) {
|
|
|
37
35
|
const vfile = new VFile({ value: frontmatterLines + pageContent, path: id });
|
|
38
36
|
setVfileFrontmatter(vfile, frontmatter);
|
|
39
37
|
if (!processor) {
|
|
40
|
-
|
|
41
|
-
"MDX processor is not initialized. This is an internal error. Please file an issue."
|
|
42
|
-
);
|
|
38
|
+
processor = createMdxProcessor(mdxOptions, { sourcemap: sourcemapEnabled });
|
|
43
39
|
}
|
|
44
40
|
try {
|
|
45
41
|
const compiled = await processor.process(vfile);
|
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.7",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"author": "withastro",
|
|
@@ -55,15 +55,15 @@
|
|
|
55
55
|
"mdast-util-mdx-jsx": "^3.1.3",
|
|
56
56
|
"mdast-util-to-string": "^4.0.0",
|
|
57
57
|
"rehype-mathjax": "^6.0.0",
|
|
58
|
-
"rehype-pretty-code": "^0.
|
|
58
|
+
"rehype-pretty-code": "^0.14.0",
|
|
59
59
|
"remark-math": "^6.0.0",
|
|
60
60
|
"remark-rehype": "^11.1.0",
|
|
61
61
|
"remark-shiki-twoslash": "^3.1.3",
|
|
62
62
|
"remark-toc": "^9.0.0",
|
|
63
|
-
"shiki": "^1.
|
|
63
|
+
"shiki": "^1.16.2",
|
|
64
64
|
"unified": "^11.0.5",
|
|
65
|
-
"vite": "^5.4.
|
|
66
|
-
"astro": "4.
|
|
65
|
+
"vite": "^5.4.3",
|
|
66
|
+
"astro": "4.15.8",
|
|
67
67
|
"astro-scripts": "0.0.14"
|
|
68
68
|
},
|
|
69
69
|
"engines": {
|