Skip to content

Commit 49ad0ec

Browse files
committed
Better package exports
1 parent a65f3e2 commit 49ad0ec

File tree

7 files changed

+57
-14
lines changed

7 files changed

+57
-14
lines changed

examples/next-mdx-remote/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
{
2+
"name": "codehike-next-mdx-remote",
3+
"private": true,
4+
"version": "0.0.0",
25
"dependencies": {
3-
"@code-hike/mdx": "^0.3.0-next.27",
6+
"@code-hike/mdx": "^0.3.0",
47
"next": "^12.1.0",
58
"next-mdx-remote": "^4.0.0",
69
"react": "^17.0.2",

examples/next-mdx-remote/pages/_app.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import "@code-hike/mdx/dist/index.css"
1+
import "@code-hike/mdx/styles"
22

33
function MyApp({ Component, pageProps }) {
44
return <Component {...pageProps} />

examples/next-mdx-remote/pages/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { serialize } from "next-mdx-remote/serialize"
22
import { MDXRemote } from "next-mdx-remote"
33
import { remarkCodeHike } from "@code-hike/mdx"
4-
import { CH } from "@code-hike/mdx/dist/components.cjs"
4+
import { CH } from "@code-hike/mdx/components"
55
import theme from "shiki/themes/solarized-dark.json"
66
import fs from "fs"
77

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"workspaces": {
44
"packages": [
55
"packages/mdx",
6+
"examples/*",
67
"site"
78
]
89
},

packages/mdx/package.json

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,25 @@
44
"files": [
55
"dist"
66
],
7-
"main": "./dist/ch-core.umd.js",
8-
"module": "./dist/plugin.es.js",
7+
"main": "./dist/index.cjs.js",
8+
"module": "./dist/index.esm.js",
9+
"types": "./dist/index.d.ts",
910
"exports": {
1011
".": {
11-
"import": "./dist/plugin.es.js",
12-
"require": "./dist/plugin.umd.js",
13-
"style": "./dist/style.css"
12+
"import": "./dist/index.esm.js",
13+
"require": "./dist/index.cjs.js",
14+
"style": "./dist/index.css"
1415
},
15-
"./components": "./dist/components.es.js",
16-
"./dist/index.css": "./dist/style.css"
16+
"./components": {
17+
"import": "./dist/components.esm.js",
18+
"require": "./dist/components.cjs.js"
19+
},
20+
"./package.json": "./package.json",
21+
"./styles": "./dist/index.css",
22+
"./styles.css": "./dist/index.css",
23+
"./dist/index.css": "./dist/index.css",
24+
"./dist/components.cjs": "./dist/components.cjs.js"
1725
},
18-
"types": "./dist/types/index.d.ts",
1926
"scripts": {
2027
"dev": "next",
2128
"build": "rollup -c rollup.config.js",

packages/mdx/src/mdx-plugin/plugin.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ function addConfig(
105105
function addImportNode(tree: SuperNode) {
106106
tree.children.unshift({
107107
type: "mdxjsEsm",
108-
value: 'import { CH } from "@code-hike/mdx"',
108+
value: 'import { CH } from "@code-hike/mdx/components"',
109109
data: {
110110
estree: {
111111
type: "Program",

yarn.lock

Lines changed: 34 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -857,6 +857,14 @@
857857
unist-util-visit "^4.0.0"
858858
vfile "^5.0.0"
859859

860+
"@mdx-js/react@^2.0.0":
861+
version "2.0.0"
862+
resolved "https://registry.yarnpkg.com/@mdx-js/react/-/react-2.0.0.tgz#00a9f5467d2761fe3818222740f50403f83aee2c"
863+
integrity sha512-icpMd43xqORnHSVRwALZv3ELN3IS7VS3BL+FyH2FFergQPSQ21FX0lN+OMIs0X+3dGY1L0DLhBCkMfPO+yDG7Q==
864+
dependencies:
865+
"@types/mdx" "^2.0.0"
866+
"@types/react" ">=16"
867+
860868
861869
version "12.1.0"
862870
resolved "https://registry.yarnpkg.com/@next/env/-/env-12.1.0.tgz#73713399399b34aa5a01771fb73272b55b22c314"
@@ -1277,6 +1285,11 @@
12771285
resolved "https://registry.yarnpkg.com/@types/http-cache-semantics/-/http-cache-semantics-4.0.1.tgz#0ea7b61496902b95890dc4c3a116b60cb8dae812"
12781286
integrity sha512-SZs7ekbP8CN0txVG2xVRH6EgKmEm31BOxA07vkFaETzZz1xh+cbt8BcI0slpymvwhx5dlFnQG2rTlPVQn+iRPQ==
12791287

1288+
"@types/js-yaml@^4.0.0":
1289+
version "4.0.5"
1290+
resolved "https://registry.yarnpkg.com/@types/js-yaml/-/js-yaml-4.0.5.tgz#738dd390a6ecc5442f35e7f03fa1431353f7e138"
1291+
integrity sha512-FhpRzf927MNQdRZP0J5DLIdTXhjLYzeUTmLAu69mnVksLH9CJY3IuSeEgbKUki7GQZm0WqDkGzyxju2EZGD2wA==
1292+
12801293
"@types/keyv@*":
12811294
version "3.1.3"
12821295
resolved "https://registry.yarnpkg.com/@types/keyv/-/keyv-3.1.3.tgz#1c9aae32872ec1f20dcdaee89a9f3ba88f465e41"
@@ -1349,7 +1362,7 @@
13491362
resolved "https://registry.yarnpkg.com/@types/q/-/q-1.5.5.tgz#75a2a8e7d8ab4b230414505d92335d1dcb53a6df"
13501363
integrity sha512-L28j2FcJfSZOnL1WBjDYp2vUHCeIFlyYI/53EwD/rKUBQ7MtUUfbQWiyKJGpcnv4/WgrhWsFKrcPstcAt/J0tQ==
13511364

1352-
"@types/react@^17.0.39":
1365+
"@types/react@>=16", "@types/react@^17.0.39":
13531366
version "17.0.39"
13541367
resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.39.tgz#d0f4cde092502a6db00a1cded6e6bf2abb7633ce"
13551368
integrity sha512-UVavlfAxDd/AgAacMa60Azl7ygyQNRwC/DsHZmKgNvPmRR5p70AJ5Q9EAmL2NWOJmeV+vVUI4IAP7GZrN8h8Ug==
@@ -5594,6 +5607,16 @@ nested-error-stacks@~2.0.1:
55945607
resolved "https://registry.yarnpkg.com/nested-error-stacks/-/nested-error-stacks-2.0.1.tgz#d2cc9fc5235ddb371fc44d506234339c8e4b0a4b"
55955608
integrity sha512-SrQrok4CATudVzBS7coSz26QRSmlK9TzzoFbeKfcPBUFPjcQM9Rqvr/DlJkOrwI/0KcgvMub1n1g5Jt9EgRn4A==
55965609

5610+
next-mdx-remote@^4.0.0:
5611+
version "4.0.0"
5612+
resolved "https://registry.yarnpkg.com/next-mdx-remote/-/next-mdx-remote-4.0.0.tgz#f76e09344e1b8df9b71782df14dd1a0a442d30a2"
5613+
integrity sha512-WEEBe5OaIiiACvWsYwkf6uFnVcuam33dghDu2WpALE1BcH8Oozwvmjb0KFLURuAQsYL/yOZCTr8urmYtOZifRQ==
5614+
dependencies:
5615+
"@mdx-js/mdx" "^2.0.0"
5616+
"@mdx-js/react" "^2.0.0"
5617+
vfile "^5.3.0"
5618+
vfile-matter "^3.0.1"
5619+
55975620
next@^12.1.0:
55985621
version "12.1.0"
55995622
resolved "https://registry.yarnpkg.com/next/-/next-12.1.0.tgz#c33d753b644be92fc58e06e5a214f143da61dd5d"
@@ -8560,6 +8583,15 @@ [email protected]:
85608583
core-util-is "1.0.2"
85618584
extsprintf "^1.2.0"
85628585

8586+
vfile-matter@^3.0.1:
8587+
version "3.0.1"
8588+
resolved "https://registry.yarnpkg.com/vfile-matter/-/vfile-matter-3.0.1.tgz#85e26088e43aa85c04d42ffa3693635fa2bc5624"
8589+
integrity sha512-CAAIDwnh6ZdtrqAuxdElUqQRQDQgbbIrYtDYI8gCjXS1qQ+1XdLoK8FIZWxJwn0/I+BkSSZpar3SOgjemQz4fg==
8590+
dependencies:
8591+
"@types/js-yaml" "^4.0.0"
8592+
is-buffer "^2.0.0"
8593+
js-yaml "^4.0.0"
8594+
85638595
vfile-message@^2.0.0:
85648596
version "2.0.4"
85658597
resolved "https://registry.yarnpkg.com/vfile-message/-/vfile-message-2.0.4.tgz#5b43b88171d409eae58477d13f23dd41d52c371a"
@@ -8586,7 +8618,7 @@ vfile@^4.0.0:
85868618
unist-util-stringify-position "^2.0.0"
85878619
vfile-message "^2.0.0"
85888620

8589-
vfile@^5.0.0:
8621+
vfile@^5.0.0, vfile@^5.3.0:
85908622
version "5.3.2"
85918623
resolved "https://registry.yarnpkg.com/vfile/-/vfile-5.3.2.tgz#b499fbc50197ea50ad3749e9b60beb16ca5b7c54"
85928624
integrity sha512-w0PLIugRY3Crkgw89TeMvHCzqCs/zpreR31hl4D92y6SOE07+bfJe+dK5Q2akwS+i/c801kzjoOr9gMcTe6IAA==

0 commit comments

Comments
 (0)