@astrojs/markdoc 0.9.0 → 0.9.1

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.
@@ -1,9 +1,9 @@
1
- import Markdoc from "@markdoc/markdoc";
2
- import { emitESMImage } from "astro/assets/utils";
3
- import matter from "gray-matter";
4
1
  import fs from "node:fs";
5
2
  import path from "node:path";
6
3
  import { fileURLToPath } from "node:url";
4
+ import Markdoc from "@markdoc/markdoc";
5
+ import { emitESMImage } from "astro/assets/utils";
6
+ import matter from "gray-matter";
7
7
  import { htmlTokenTransform } from "./html/transform/html-token-transform.js";
8
8
  import { setupConfig } from "./runtime.js";
9
9
  import { getMarkdocTokenizer } from "./tokenizer.js";
@@ -148,7 +148,14 @@ async function emitOptimizedImages(nodeChildren, ctx) {
148
148
  ctx.pluginContext.meta.watchMode,
149
149
  ctx.pluginContext.emitFile
150
150
  );
151
- node.attributes[attributeName] = src;
151
+ const fsPath = resolved.id;
152
+ if (src) {
153
+ if (ctx.astroConfig.output === "static") {
154
+ if (globalThis.astroAsset.referencedImages)
155
+ globalThis.astroAsset.referencedImages.add(fsPath);
156
+ }
157
+ node.attributes[attributeName] = { ...src, fsPath };
158
+ }
152
159
  } else {
153
160
  throw new MarkdocError({
154
161
  message: `Could not resolve image ${JSON.stringify(
@@ -1,6 +1,6 @@
1
- import { build as esbuild } from "esbuild";
2
1
  import * as fs from "node:fs";
3
2
  import { fileURLToPath } from "node:url";
3
+ import { build as esbuild } from "esbuild";
4
4
  import { MarkdocError } from "./utils.js";
5
5
  const SUPPORTED_MARKDOC_CONFIG_FILES = [
6
6
  "markdoc.config.js",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@astrojs/markdoc",
3
3
  "description": "Add support for Markdoc in your Astro site",
4
- "version": "0.9.0",
4
+ "version": "0.9.1",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.ts",
7
7
  "author": "withastro",
@@ -74,10 +74,10 @@
74
74
  "@types/markdown-it": "^13.0.6",
75
75
  "devalue": "^4.3.2",
76
76
  "linkedom": "^0.16.4",
77
- "vite": "^5.0.12",
77
+ "vite": "^5.1.4",
78
78
  "@astrojs/markdown-remark": "4.2.1",
79
- "astro-scripts": "0.0.14",
80
- "astro": "4.3.6"
79
+ "astro": "4.4.9",
80
+ "astro-scripts": "0.0.14"
81
81
  },
82
82
  "engines": {
83
83
  "node": ">=18.14.1"