-
Notifications
You must be signed in to change notification settings - Fork 667
Pull out MDX to be opt-in #2288
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
Changes from all commits
45fdbd4
e095f9d
dedd49a
8bcf74d
5b67351
a2c97d0
b2c1b1c
16067b8
b129213
b44a213
3320ffd
2cfa6d7
f4788ec
593f42a
624eb7c
dd48909
d054596
9c390b7
1ebcb7a
a588ef0
501325f
753d6b8
3fd69e6
9885ef1
38269bd
3c8d848
6078dbf
ee64f37
b4b835c
3ca2687
9fc6ac9
e1205b4
ef60f60
49443e0
2cd3462
3a54f91
bf6f0f1
37876e5
ad75610
2c1a420
e89f3b5
111027e
404a7ad
4dc030b
e261376
53270c1
43b508c
08ea652
1e50846
398f486
d3baceb
0921ad1
ab199c5
40437f4
26f4866
35b16cd
0b1ac70
05ddf0a
ae521ed
0170cae
1fa5159
4ef36b8
0deef03
1e607dc
f7807d9
c2aadf9
1e8f0e4
acb5191
1b2d488
f8c7349
e319b24
3f84d43
c6d176c
0e3572a
e854ff2
e20f263
3327c85
437d974
7c3bc63
f01ced7
eecb97f
e9285a3
21f1aca
397cef5
31297b3
93a65b0
703775d
2fb274a
847343a
6b6008c
d28e67e
c5a8f35
c410ad9
30328e3
0782785
6389148
cd66918
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| auto-install-peers=true | ||
| public-hoist-pattern[]='*eslint*' | ||
| public-hoist-pattern[]='*prettier*' | ||
| public-hoist-pattern[]='@emotion/react' |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| 18 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| const PACKAGES_WITH_ENFORCED_SINGLE_VERSION = ['@emotion/react'] | ||
|
|
||
| /** | ||
| * @author remorses | ||
| * @see https://github.com/pnpm/pnpm/issues/2713#issuecomment-1141000426 | ||
| */ | ||
| function afterAllResolved(lockfile, context) { | ||
| context.log('Checking duplicate packages...') | ||
|
|
||
| const packagesKeys = Object.keys(lockfile.packages) | ||
| const found = {} | ||
| for (let p of packagesKeys) { | ||
| for (let x of PACKAGES_WITH_ENFORCED_SINGLE_VERSION) { | ||
| if (p.startsWith(`/${x}/`)) { | ||
| if (found[x]) { | ||
| found[x] += 1 | ||
| } else { | ||
| found[x] = 1 | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| let msg = '' | ||
|
|
||
| for (let p in found) { | ||
| const count = found[p] | ||
| if (count > 1) { | ||
| msg += `${p} found ${count} times\n` | ||
| } | ||
| } | ||
|
|
||
| if (msg) console.warn('\n\n\n🔥\n', '🔥', msg, '\n🔥\n\n\n') | ||
|
|
||
| return lockfile | ||
| } | ||
|
|
||
| module.exports = { | ||
| hooks: { | ||
| afterAllResolved, | ||
| }, | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,7 @@ | |
| public | ||
| package-lock.json | ||
| yarn.lock | ||
| pnpm-lock.yaml | ||
| node_modules | ||
| dist | ||
| coverage | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,66 @@ | ||
| # Migration Guides | ||
|
|
||
| ## v0.15 | ||
|
|
||
| **MDX is now opt-in.** | ||
|
|
||
| _If your project is not using MDX or importing `Themed`, you shouldn't need to | ||
| change anything._ | ||
|
|
||
| If you are using MDX, this change enables you to use Theme UI together with | ||
| [MDX v2](https://mdxjs.com/blog/v2/). | ||
|
|
||
| - `MDXProvider` is no longer included in Theme UI `ThemeProvider`, and has been | ||
| removed in favour of an `useThemedStylesWithMdx` hook. | ||
|
|
||
| **Migration:** Use `useThemedStylesWithMdx` together with `MDXProvider` and | ||
| `useMDXComponents` from `@mdx-js/react`. | ||
|
|
||
| ```tsx | ||
| import { | ||
| MDXProvider, | ||
| useMDXComponents, | ||
| Components as MDXComponents, | ||
| MergeComponents as MergeMDXComponents, | ||
| } from '@mdx-js/react' | ||
| import { useThemedStylesWithMdx } from '@theme-ui/mdx' | ||
| import { ThemeProvider, Theme } from 'theme-ui' | ||
|
|
||
| interface MyProviderProps { | ||
| theme: Theme | ||
| components?: MDXComponents | MergeMDXComponents | ||
| children: React.ReactNode | ||
| } | ||
| function MyProvider({ theme, components, children }: MyProviderProps) { | ||
| const componentsWithStyles = useThemedStylesWithMdx( | ||
| useMDXComponents(components) | ||
| ) | ||
|
|
||
| return ( | ||
| <ThemeProvider theme={theme}> | ||
| <MDXProvider components={componentsWithStyles}>{children}</MDXProvider> | ||
| </ThemeProvider> | ||
| ) | ||
| } | ||
| ``` | ||
|
|
||
| - `Themed` components dict and other exports from `@theme-ui/mdx` are no longer | ||
| reexported from `theme-ui`. | ||
|
|
||
| **Migration:** Import it from `@theme-ui/mdx` instead. | ||
|
|
||
| ```diff | ||
| - import { Themed } from 'theme-ui' | ||
| + import { Themed } from '@theme-ui/mdx' | ||
| ``` | ||
|
|
||
| **`Themed` object is no longer a component** | ||
|
|
||
| _Previously, it was an alias for `Themed.div`._ | ||
|
|
||
| - **Migration:** Whenever you're using `<Themed />`, use `<Themed.div />` | ||
| instead. | ||
|
|
||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Based on the changes to the example projects, seems like we're supporting MDX v2 as well, so let's mention that here since it's important news, & link to https://mdxjs.com/blog/v2/ so people know what's new/what's involved if they want to take on upgrading that too |
||
| ## v0.14 | ||
|
|
||
| - `theme-ui`, `@theme-ui/components` and `@theme-ui/mdx` packages no longer | ||
|
|
||
This file was deleted.
This file was deleted.
This file was deleted.
Uh oh!
There was an error while loading. Please reload this page.