@astrojs/mdx 4.0.2 → 4.0.4

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.
@@ -51,11 +51,12 @@ function getImageComponentAttributes(props) {
51
51
  }
52
52
  function rehypeImageToComponent() {
53
53
  return function(tree, file) {
54
- if (!file.data.astro?.imagePaths) return;
54
+ if (!file.data.astro?.imagePaths?.length) return;
55
55
  const importsStatements = [];
56
56
  const importedImages = /* @__PURE__ */ new Map();
57
57
  visit(tree, "element", (node, index, parent) => {
58
- if (!file.data.astro?.imagePaths || node.tagName !== "img" || !node.properties.src) return;
58
+ if (!file.data.astro?.imagePaths?.length || node.tagName !== "img" || !node.properties.src)
59
+ return;
59
60
  const src = decodeURI(String(node.properties.src));
60
61
  if (!file.data.astro.imagePaths?.includes(src)) return;
61
62
  let importName = importedImages.get(src);
package/dist/server.d.ts CHANGED
@@ -1,7 +1,5 @@
1
1
  import type { NamedSSRLoadedRendererValue } from 'astro';
2
- export declare function check(Component: any, props: any, { default: children, ...slotted }?: {
3
- default?: null | undefined;
4
- }): Promise<any>;
2
+ export declare function check(): Promise<boolean>;
5
3
  export declare function renderToStaticMarkup(this: any, Component: any, props?: {}, { default: children, ...slotted }?: {
6
4
  default?: null | undefined;
7
5
  }): Promise<{
package/dist/server.js CHANGED
@@ -1,20 +1,8 @@
1
1
  import { AstroError } from "astro/errors";
2
- import { AstroJSX, jsx } from "astro/jsx-runtime";
2
+ import { jsx } from "astro/jsx-runtime";
3
3
  import { renderJSX } from "astro/runtime/server/index.js";
4
4
  const slotName = (str) => str.trim().replace(/[-_]([a-z])/g, (_, w) => w.toUpperCase());
5
- async function check(Component, props, { default: children = null, ...slotted } = {}) {
6
- if (typeof Component !== "function") return false;
7
- const slots = {};
8
- for (const [key, value] of Object.entries(slotted)) {
9
- const name = slotName(key);
10
- slots[name] = value;
11
- }
12
- try {
13
- const result = await Component({ ...props, ...slots, children });
14
- return result[AstroJSX];
15
- } catch (e) {
16
- throwEnhancedErrorIfMdxComponent(e, Component);
17
- }
5
+ async function check() {
18
6
  return false;
19
7
  }
20
8
  async function renderToStaticMarkup(Component, props = {}, { default: children = null, ...slotted } = {}) {
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": "4.0.2",
4
+ "version": "4.0.4",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.ts",
7
7
  "author": "withastro",
@@ -62,8 +62,8 @@
62
62
  "remark-toc": "^9.0.0",
63
63
  "shiki": "^1.23.1",
64
64
  "unified": "^11.0.5",
65
- "vite": "^6.0.1",
66
- "astro": "5.0.4",
65
+ "vite": "^6.0.5",
66
+ "astro": "5.1.4",
67
67
  "astro-scripts": "0.0.14"
68
68
  },
69
69
  "engines": {