Skip to content

Commit

Permalink
feat: revert mdx integration changes
Browse files Browse the repository at this point in the history
  • Loading branch information
HiDeoo committed Nov 26, 2024
1 parent b14aca5 commit 73d6e69
Show file tree
Hide file tree
Showing 11 changed files with 56 additions and 90 deletions.
4 changes: 0 additions & 4 deletions docs/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
// @ts-check
import { defineConfig } from 'astro/config';
// TODO(HiDeoo) Remove or keep depending on the final decision regarding the peer dep change
import mdx from '@astrojs/mdx';
import starlight from '@astrojs/starlight';
import starlightLinksValidator from 'starlight-links-validator';
import markdocGrammar from './grammars/markdoc.tmLanguage.json';
Expand Down Expand Up @@ -192,7 +190,5 @@ export default defineConfig({
]
: [],
}),
// TODO(HiDeoo) Remove or keep depending on the final decision regarding the peer dep change
mdx(),
],
});
1 change: 0 additions & 1 deletion docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
},
"dependencies": {
"@astro-community/astro-embed-youtube": "^0.5.6",
"@astrojs/mdx": "^4.0.0-beta.3",
"@astrojs/starlight": "workspace:*",
"@lunariajs/core": "^0.1.1",
"@types/culori": "^2.1.1",
Expand Down
4 changes: 0 additions & 4 deletions examples/basics/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// @ts-check
import { defineConfig } from 'astro/config';
import starlight from '@astrojs/starlight';
// TODO(HiDeoo) Remove or keep depending on the final decision regarding the peer dep change
import mdx from '@astrojs/mdx';

// https://astro.build/config
export default defineConfig({
Expand All @@ -26,7 +24,5 @@ export default defineConfig({
},
],
}),
// TODO(HiDeoo) Remove or keep depending on the final decision regarding the peer dep change
mdx(),
],
});
4 changes: 0 additions & 4 deletions examples/tailwind/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
import { defineConfig } from 'astro/config';
import starlight from '@astrojs/starlight';
import tailwind from '@astrojs/tailwind';
// TODO(HiDeoo) Remove or keep depending on the final decision regarding the peer dep change
import mdx from '@astrojs/mdx';

// https://astro.build/config
export default defineConfig({
Expand All @@ -28,8 +26,6 @@ export default defineConfig({
],
customCss: ['./src/tailwind.css'],
}),
// TODO(HiDeoo) Remove or keep depending on the final decision regarding the peer dep change
mdx(),
tailwind({ applyBaseStyles: false }),
],
});
1 change: 0 additions & 1 deletion examples/tailwind/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
"astro": "astro"
},
"dependencies": {
"@astrojs/mdx": "^4.0.0-beta.3",
"@astrojs/starlight": "^0.29.2",
"@astrojs/starlight-tailwind": "^2.0.3",
"@astrojs/tailwind": "^5.1.2",
Expand Down
4 changes: 0 additions & 4 deletions packages/starlight/__e2e__/fixtures/basics/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
// @ts-check
import starlight from '@astrojs/starlight';
import { defineConfig } from 'astro/config';
// TODO(HiDeoo) Remove or keep depending on the final decision regarding the peer dep change
import mdx from '@astrojs/mdx';

export default defineConfig({
integrations: [
starlight({
title: 'Basics',
pagefind: false,
}),
// TODO(HiDeoo) Remove or keep depending on the final decision regarding the peer dep change
mdx(),
],
});
4 changes: 0 additions & 4 deletions packages/starlight/__e2e__/fixtures/ssr/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
import { defineConfig } from 'astro/config';
import starlight from '@astrojs/starlight';
import node from '@astrojs/node';
// TODO(HiDeoo) Remove or keep depending on the final decision regarding the peer dep change
import mdx from '@astrojs/mdx';

const prerendering = process.env.STARLIGHT_PRERENDER === 'yes';

Expand All @@ -24,7 +22,5 @@ export default defineConfig({
prerender: prerendering,
pagefind: false,
}),
// TODO(HiDeoo) Remove or keep depending on the final decision regarding the peer dep change
mdx(),
],
});
1 change: 0 additions & 1 deletion packages/starlight/__e2e__/fixtures/ssr/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"version": "0.0.0",
"private": true,
"dependencies": {
"@astrojs/mdx": "^4.0.0-beta.3",
"@astrojs/node": "^9.0.0-beta.3",
"@astrojs/starlight": "workspace:*",
"astro": "^5.0.0-beta.11"
Expand Down
12 changes: 6 additions & 6 deletions packages/starlight/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
/// <reference path="./i18n.d.ts" />
/// <reference path="./virtual.d.ts" />

import mdx from '@astrojs/mdx';
import type { AstroIntegration } from 'astro';
import { spawn } from 'node:child_process';
import { dirname, relative } from 'node:path';
Expand Down Expand Up @@ -95,19 +96,18 @@ export default function StarlightIntegration({
if (!allIntegrations.find(({ name }) => name === '@astrojs/sitemap')) {
integrations.push(starlightSitemap(starlightConfig));
}
if (!allIntegrations.find(({ name }) => name === '@astrojs/mdx')) {
integrations.push(mdx({ optimize: true }));
}

// Add Starlight directives restoration integration at the end of the list so that remark
// plugins injected by Starlight plugins through Astro integrations can handle text and
// leaf directives before they are transformed back to their original form.
integrations.push(starlightDirectivesRestorationIntegration());

// TODO(HiDeoo) `astroExpressiveCode()` has to come before `mdx()` so if the peer dep
// change is persisted, we probably want to add some tests here with some clear instruction
// on how users should order their integrations.

// Add integrations immediately after Starlight in the config array.
// e.g. if a user has `integrations: [starlight(), mdx(), tailwind()]`, then the order will
// be `[starlight(), expressiveCode(), sitemap(), mdx(), tailwind()]`.
// e.g. if a user has `integrations: [starlight(), tailwind()]`, then the order will be
// `[starlight(), expressiveCode(), sitemap(), mdx(), tailwind()]`.
// This ensures users can add integrations before/after Starlight and we respect that order.
const selfIndex = config.integrations.findIndex((i) => i.name === '@astrojs/starlight');
config.integrations.splice(selfIndex + 1, 0, ...integrations);
Expand Down
1 change: 1 addition & 0 deletions packages/starlight/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@
"vitest": "^2.1.4"
},
"dependencies": {
"@astrojs/mdx": "^4.0.0-beta.4",
"@astrojs/sitemap": "^3.1.6",
"@pagefind/default-ui": "^1.0.3",
"@types/hast": "^3.0.4",
Expand Down
Loading

0 comments on commit 73d6e69

Please sign in to comment.