diff --git a/.changeset/smart-hairs-lick.md b/.changeset/smart-hairs-lick.md new file mode 100644 index 000000000..43a2017b6 --- /dev/null +++ b/.changeset/smart-hairs-lick.md @@ -0,0 +1,6 @@ +--- +'@astrojs/markdoc': patch +'astro': patch +--- + +Fix Markdoc integration not being able to import `emitESMImage` from Astro diff --git a/packages/astro/package.json b/packages/astro/package.json index ba115f188..c325b40a2 100644 --- a/packages/astro/package.json +++ b/packages/astro/package.json @@ -52,6 +52,7 @@ "./components": "./components/index.ts", "./components/*": "./components/*", "./assets": "./dist/assets/index.js", + "./assets/utils": "./dist/assets/utils/index.js", "./assets/image-endpoint": "./dist/assets/image-endpoint.js", "./assets/services/sharp": "./dist/assets/services/sharp.js", "./assets/services/squoosh": "./dist/assets/services/squoosh.js", diff --git a/packages/astro/src/assets/utils/index.ts b/packages/astro/src/assets/utils/index.ts new file mode 100644 index 000000000..d82c5a6e6 --- /dev/null +++ b/packages/astro/src/assets/utils/index.ts @@ -0,0 +1 @@ +export { emitESMImage } from './emitAsset.js'; diff --git a/packages/integrations/markdoc/src/content-entry-type.ts b/packages/integrations/markdoc/src/content-entry-type.ts index 348c8a882..bb62a2035 100644 --- a/packages/integrations/markdoc/src/content-entry-type.ts +++ b/packages/integrations/markdoc/src/content-entry-type.ts @@ -6,9 +6,9 @@ import fs from 'node:fs'; import { fileURLToPath } from 'node:url'; import type { ErrorPayload as ViteErrorPayload } from 'vite'; import type { ComponentConfig } from './config.js'; -import { isComponentConfig, isValidUrl, MarkdocError, prependForwardSlash } from './utils.js'; -// @ts-expect-error Cannot find module 'astro/assets' or its corresponding type declarations. -import { emitESMImage } from 'astro/assets'; +import { MarkdocError, isComponentConfig, isValidUrl, prependForwardSlash } from './utils.js'; +// @ts-expect-error Cannot get the types here without `moduleResolution: 'nodenext'` +import { emitESMImage } from 'astro/assets/utils'; import path from 'node:path'; import type * as rollup from 'rollup'; import type { MarkdocConfigResult } from './load-config.js';