forked from laptou/astro
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
032ad1c
commit af23bdd
Showing
14 changed files
with
95 additions
and
99 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,17 @@ | ||
import Counter from '../components/Counter.jsx' | ||
import Title from '../components/Title.astro' | ||
export const components = { h1: Title } | ||
import Counter from '../components/Counter.jsx'; | ||
import Title from '../components/Title.astro'; | ||
export const components = { h1: Title }; | ||
|
||
# Hello world! | ||
|
||
export const authors = [ | ||
{name: 'Jane', email: 'hi@jane.com'}, | ||
{name: 'John', twitter: '@john2002'} | ||
] | ||
export const published = new Date('2022-02-01') | ||
{ name: 'Jane', email: 'hi@jane.com' }, | ||
{ name: 'John', twitter: '@john2002' }, | ||
]; | ||
export const published = new Date('2022-02-01'); | ||
|
||
Written by: {new Intl.ListFormat('en').format(authors.map(d => d.name))}. | ||
|
||
Published on: {new Intl.DateTimeFormat('en', {dateStyle: 'long'}).format(published)}. | ||
|
||
<Counter client:idle> | ||
## Counter | ||
</Counter> | ||
<Counter client:idle>## Counter</Counter> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,39 @@ | ||
import type { AstroIntegration } from 'astro'; | ||
import mdxPlugin from '@mdx-js/rollup'; | ||
import type { AstroIntegration } from 'astro'; | ||
|
||
export default function mdx(): AstroIntegration { | ||
return { | ||
name: '@astrojs/mdx', | ||
hooks: { | ||
'astro:config:setup': ({ updateConfig, addPageExtension, command }: any) => { | ||
addPageExtension('.mdx'); | ||
updateConfig({ | ||
vite: { | ||
plugins: [ | ||
{ | ||
enforce: 'pre', | ||
...mdxPlugin({ | ||
jsx: true, | ||
jsxImportSource: 'astro', | ||
// Note: disable `.md` support | ||
format: 'mdx', | ||
mdExtensions: [] | ||
}) | ||
}, | ||
command === 'dev' && { | ||
name: '@astrojs/mdx', | ||
transform(code: string, id: string) { | ||
if (!id.endsWith('.mdx')) return; | ||
// TODO: decline HMR updates until we have a stable approach | ||
return `${code}\nif (import.meta.hot) { | ||
name: '@astrojs/mdx', | ||
hooks: { | ||
'astro:config:setup': ({ updateConfig, addPageExtension, command }: any) => { | ||
addPageExtension('.mdx'); | ||
updateConfig({ | ||
vite: { | ||
plugins: [ | ||
{ | ||
enforce: 'pre', | ||
...mdxPlugin({ | ||
jsx: true, | ||
jsxImportSource: 'astro', | ||
// Note: disable `.md` support | ||
format: 'mdx', | ||
mdExtensions: [], | ||
}), | ||
}, | ||
command === 'dev' && { | ||
name: '@astrojs/mdx', | ||
transform(code: string, id: string) { | ||
if (!id.endsWith('.mdx')) return; | ||
// TODO: decline HMR updates until we have a stable approach | ||
return `${code}\nif (import.meta.hot) { | ||
import.meta.hot.decline(); | ||
}` | ||
} | ||
} | ||
] | ||
} | ||
}) | ||
} | ||
} | ||
} | ||
}`; | ||
}, | ||
}, | ||
], | ||
}, | ||
}); | ||
}, | ||
}, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.