Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update MDX integration to [email protected] #6296

Merged
merged 4 commits into from
Feb 23, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/integrations/mdx/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# @astrojs/mdx

## 0.17.1

- Updated to [email protected]

## 0.17.0

### Minor Changes
Expand Down
4 changes: 2 additions & 2 deletions packages/integrations/mdx/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@astrojs/mdx",
"description": "Use MDX within Astro",
"version": "0.17.0",
"version": "0.17.1",
"type": "module",
"types": "./dist/index.d.ts",
"author": "withastro",
Expand Down Expand Up @@ -35,7 +35,7 @@
"@mdx-js/mdx": "^2.3.0",
"@mdx-js/rollup": "^2.3.0",
"acorn": "^8.8.0",
"es-module-lexer": "^0.10.5",
"es-module-lexer": "^1.1.1",
"estree-util-visit": "^1.2.0",
"github-slugger": "^1.4.0",
"gray-matter": "^4.0.3",
Expand Down
6 changes: 3 additions & 3 deletions packages/integrations/mdx/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,13 @@ export default function mdx(partialMdxOptions: Partial<MdxOptions> = {}): AstroI
}

const { fileUrl, fileId } = getFileInfo(id, config);
if (!moduleExports.includes('url')) {
if (!moduleExports.find(({n}) => n === 'url')) {
code += `\nexport const url = ${JSON.stringify(fileUrl)};`;
}
if (!moduleExports.includes('file')) {
if (!moduleExports.find(({n}) => n === 'file')) {
code += `\nexport const file = ${JSON.stringify(fileId)};`;
}
if (!moduleExports.includes('Content')) {
if (!moduleExports.find(({n}) => n === 'Content')) {
// Make `Content` the default export so we can wrap `MDXContent` and pass in `Fragment`
code = code.replace('export default MDXContent;', '');
code += `\nexport const Content = (props = {}) => MDXContent({
Expand Down
8 changes: 2 additions & 6 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.