mirror of
https://github.com/withastro/astro.git
synced 2024-12-16 21:46:22 -05:00
Remove @mdx-js/rollup
dependency (#7191)
This commit is contained in:
parent
2bda7fb0bc
commit
27c6e01826
5 changed files with 10 additions and 27 deletions
5
.changeset/spotty-glasses-return.md
Normal file
5
.changeset/spotty-glasses-return.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'@astrojs/mdx': patch
|
||||
---
|
||||
|
||||
Remove `@mdx-js/rollup` dependency
|
|
@ -37,7 +37,6 @@
|
|||
"@astrojs/markdown-remark": "^2.2.1",
|
||||
"@astrojs/prism": "^2.1.2",
|
||||
"@mdx-js/mdx": "^2.3.0",
|
||||
"@mdx-js/rollup": "^2.3.0",
|
||||
"acorn": "^8.8.0",
|
||||
"es-module-lexer": "^1.1.1",
|
||||
"estree-util-visit": "^1.2.0",
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
import { markdownConfigDefaults } from '@astrojs/markdown-remark';
|
||||
import { toRemarkInitializeAstroData } from '@astrojs/markdown-remark/dist/internal.js';
|
||||
import { compile as mdxCompile } from '@mdx-js/mdx';
|
||||
import { compile as mdxCompile, type CompileOptions } from '@mdx-js/mdx';
|
||||
import type { PluggableList } from '@mdx-js/mdx/lib/core.js';
|
||||
import mdxPlugin, { type Options as MdxRollupPluginOptions } from '@mdx-js/rollup';
|
||||
import type { AstroIntegration, ContentEntryType, HookParameters } from 'astro';
|
||||
import { parse as parseESM } from 'es-module-lexer';
|
||||
import fs from 'node:fs/promises';
|
||||
|
@ -67,7 +66,7 @@ export default function mdx(partialMdxOptions: Partial<MdxOptions> = {}): AstroI
|
|||
),
|
||||
});
|
||||
|
||||
const mdxPluginOpts: MdxRollupPluginOptions = {
|
||||
const mdxPluginOpts: CompileOptions = {
|
||||
remarkPlugins: await getRemarkPlugins(mdxOptions, config),
|
||||
rehypePlugins: getRehypePlugins(mdxOptions),
|
||||
recmaPlugins: mdxOptions.recmaPlugins,
|
||||
|
@ -87,8 +86,8 @@ export default function mdx(partialMdxOptions: Partial<MdxOptions> = {}): AstroI
|
|||
vite: {
|
||||
plugins: [
|
||||
{
|
||||
name: '@mdx-js/rollup',
|
||||
enforce: 'pre',
|
||||
...mdxPlugin(mdxPluginOpts),
|
||||
configResolved(resolved) {
|
||||
importMetaEnv = { ...importMetaEnv, ...resolved.env };
|
||||
},
|
||||
|
|
|
@ -5,7 +5,6 @@ import {
|
|||
} from '@astrojs/markdown-remark/dist/internal.js';
|
||||
import { nodeTypes } from '@mdx-js/mdx';
|
||||
import type { PluggableList } from '@mdx-js/mdx/lib/core.js';
|
||||
import type { Options as MdxRollupPluginOptions } from '@mdx-js/rollup';
|
||||
import type { AstroConfig } from 'astro';
|
||||
import type { Literal, MemberExpression } from 'estree';
|
||||
import { visit as estreeVisit } from 'estree-util-visit';
|
||||
|
@ -99,7 +98,7 @@ export function rehypeApplyFrontmatterExport() {
|
|||
export async function getRemarkPlugins(
|
||||
mdxOptions: MdxOptions,
|
||||
config: AstroConfig
|
||||
): Promise<MdxRollupPluginOptions['remarkPlugins']> {
|
||||
): Promise<PluggableList> {
|
||||
let remarkPlugins: PluggableList = [
|
||||
...(config.experimental.assets ? [remarkCollectImages, remarkImageToComponent] : []),
|
||||
];
|
||||
|
@ -128,7 +127,7 @@ export async function getRemarkPlugins(
|
|||
return remarkPlugins;
|
||||
}
|
||||
|
||||
export function getRehypePlugins(mdxOptions: MdxOptions): MdxRollupPluginOptions['rehypePlugins'] {
|
||||
export function getRehypePlugins(mdxOptions: MdxOptions): PluggableList {
|
||||
let rehypePlugins: PluggableList = [
|
||||
// ensure `data.meta` is preserved in `properties.metastring` for rehype syntax highlighters
|
||||
rehypeMetaString,
|
||||
|
|
|
@ -4125,9 +4125,6 @@ importers:
|
|||
'@mdx-js/mdx':
|
||||
specifier: ^2.3.0
|
||||
version: 2.3.0
|
||||
'@mdx-js/rollup':
|
||||
specifier: ^2.3.0
|
||||
version: 2.3.0
|
||||
acorn:
|
||||
specifier: ^8.8.0
|
||||
version: 8.8.2
|
||||
|
@ -8089,22 +8086,6 @@ packages:
|
|||
- supports-color
|
||||
dev: false
|
||||
|
||||
/@mdx-js/rollup@2.3.0:
|
||||
resolution: {integrity: sha512-wLvRfJS/M4UmdqTd+WoaySEE7q4BIejYf1xAHXYvtT1du/1Tl/z2450Gg2+Hu7fh05KwRRiehiTP9Yc/Dtn0fA==}
|
||||
peerDependencies:
|
||||
rollup: '>=2'
|
||||
peerDependenciesMeta:
|
||||
rollup:
|
||||
optional: true
|
||||
dependencies:
|
||||
'@mdx-js/mdx': 2.3.0
|
||||
'@rollup/pluginutils': 5.0.2(rollup@3.20.1)
|
||||
source-map: 0.7.4
|
||||
vfile: 5.3.2
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
dev: false
|
||||
|
||||
/@miniflare/cache@2.14.0:
|
||||
resolution: {integrity: sha512-0mz0OCzTegiX75uMURLJpDo3DaOCSx9M0gv7NMFWDbK/XrvjoENiBZiKu98UBM5fts0qtK19a+MfB4aT0uBCFg==}
|
||||
engines: {node: '>=16.13'}
|
||||
|
|
Loading…
Reference in a new issue