@astrojs/mdx 5.0.0-beta.6 → 5.0.0-beta.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.
@@ -122,11 +122,17 @@ function isMdxComponentNode(node) {
122
122
  return node.type === "mdxJsxFlowElement" || node.type === "mdxJsxTextElement";
123
123
  }
124
124
  function getExportConstComponentObjectKeys(node) {
125
- const exportNamedDeclaration = node.data?.estree?.body[0];
126
- if (exportNamedDeclaration?.type !== "ExportNamedDeclaration") return;
127
- const variableDeclaration = exportNamedDeclaration.declaration;
128
- if (variableDeclaration?.type !== "VariableDeclaration") return;
129
- const variableInit = variableDeclaration.declarations[0]?.init;
125
+ let variableInit;
126
+ for (const part of node.data?.estree?.body || []) {
127
+ if (part.type !== "ExportNamedDeclaration" || part.declaration?.type !== "VariableDeclaration") {
128
+ continue;
129
+ }
130
+ const declarator = part.declaration.declarations.find(({ id }) => id.name === "components");
131
+ if (declarator) {
132
+ variableInit = declarator.init;
133
+ break;
134
+ }
135
+ }
130
136
  if (variableInit?.type !== "ObjectExpression") return;
131
137
  const keys = [];
132
138
  for (const propertyNode of variableInit.properties) {
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": "5.0.0-beta.6",
4
+ "version": "5.0.0-beta.7",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.ts",
7
7
  "author": "withastro",
@@ -62,7 +62,7 @@
62
62
  "shiki": "^3.22.0",
63
63
  "unified": "^11.0.5",
64
64
  "vite": "^7.3.1",
65
- "astro": "6.0.0-beta.10",
65
+ "astro": "6.0.0-beta.11",
66
66
  "astro-scripts": "0.0.14"
67
67
  },
68
68
  "engines": {