@astrojs/mdx 2.0.3 → 2.0.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.
package/dist/index.js
CHANGED
|
@@ -16,14 +16,7 @@ function mdx(partialMdxOptions = {}) {
|
|
|
16
16
|
name: "@astrojs/mdx",
|
|
17
17
|
hooks: {
|
|
18
18
|
"astro:config:setup": async (params) => {
|
|
19
|
-
const {
|
|
20
|
-
updateConfig,
|
|
21
|
-
config,
|
|
22
|
-
addPageExtension,
|
|
23
|
-
addContentEntryType,
|
|
24
|
-
command,
|
|
25
|
-
addRenderer
|
|
26
|
-
} = params;
|
|
19
|
+
const { updateConfig, config, addPageExtension, addContentEntryType, addRenderer } = params;
|
|
27
20
|
addRenderer(astroJSXRenderer);
|
|
28
21
|
addPageExtension(".mdx");
|
|
29
22
|
addContentEntryType({
|
|
@@ -89,7 +82,7 @@ function mdx(partialMdxOptions = {}) {
|
|
|
89
82
|
try {
|
|
90
83
|
const compiled = await processor.process(vfile);
|
|
91
84
|
return {
|
|
92
|
-
code:
|
|
85
|
+
code: String(compiled.value),
|
|
93
86
|
map: compiled.map
|
|
94
87
|
};
|
|
95
88
|
} catch (e) {
|
|
@@ -151,13 +144,7 @@ Content[Symbol.for('mdx-component')] = true`;
|
|
|
151
144
|
Content[Symbol.for('astro.needsHeadRendering')] = !Boolean(frontmatter.layout);`;
|
|
152
145
|
code += `
|
|
153
146
|
Content.moduleId = ${JSON.stringify(id)};`;
|
|
154
|
-
|
|
155
|
-
code += `
|
|
156
|
-
if (import.meta.hot) {
|
|
157
|
-
import.meta.hot.decline();
|
|
158
|
-
}`;
|
|
159
|
-
}
|
|
160
|
-
return { code: escapeViteEnvReferences(code), map: null };
|
|
147
|
+
return { code, map: null };
|
|
161
148
|
}
|
|
162
149
|
}
|
|
163
150
|
]
|
|
@@ -198,9 +185,6 @@ function applyDefaultOptions({
|
|
|
198
185
|
optimize: options.optimize ?? defaults.optimize
|
|
199
186
|
};
|
|
200
187
|
}
|
|
201
|
-
function escapeViteEnvReferences(code) {
|
|
202
|
-
return code.replace(/import\.meta\.env/g, "import\\u002Emeta.env");
|
|
203
|
-
}
|
|
204
188
|
export {
|
|
205
189
|
mdx as default
|
|
206
190
|
};
|
|
@@ -6,7 +6,7 @@ function recmaInjectImportMetaEnv({
|
|
|
6
6
|
estreeVisit(tree, (node) => {
|
|
7
7
|
if (node.type === "MemberExpression") {
|
|
8
8
|
const envVarName = getImportMetaEnvVariableName(node);
|
|
9
|
-
if (typeof envVarName === "string") {
|
|
9
|
+
if (typeof envVarName === "string" && importMetaEnv[envVarName] != null) {
|
|
10
10
|
for (const key in node) {
|
|
11
11
|
delete node[key];
|
|
12
12
|
}
|
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": "2.0.
|
|
4
|
+
"version": "2.0.5",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
7
7
|
"author": "withastro",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
"source-map": "^0.7.4",
|
|
42
42
|
"unist-util-visit": "^5.0.0",
|
|
43
43
|
"vfile": "^6.0.1",
|
|
44
|
-
"@astrojs/markdown-remark": "4.0
|
|
44
|
+
"@astrojs/markdown-remark": "4.1.0"
|
|
45
45
|
},
|
|
46
46
|
"peerDependencies": {
|
|
47
47
|
"astro": "^4.0.0"
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"remark-toc": "^9.0.0",
|
|
68
68
|
"unified": "^11.0.4",
|
|
69
69
|
"vite": "^5.0.10",
|
|
70
|
-
"astro": "4.0
|
|
70
|
+
"astro": "4.2.0",
|
|
71
71
|
"astro-scripts": "0.0.14"
|
|
72
72
|
},
|
|
73
73
|
"engines": {
|