File tree 7 files changed +21
-5
lines changed
7 files changed +21
-5
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ yarn-error.log
11
11
storybook-static
12
12
packages /playground /out
13
13
packages /starter
14
+ packages /mdx /components.d.ts
14
15
15
16
# Contentlayer
16
17
.contentlayer
Original file line number Diff line number Diff line change 2
2
"name" : " @code-hike/mdx" ,
3
3
"version" : " 0.7.2" ,
4
4
"files" : [
5
- " dist"
5
+ " dist" ,
6
+ " components.d.ts"
6
7
],
7
8
"main" : " ./dist/index.cjs.js" ,
8
9
"module" : " ./dist/index.esm.mjs" ,
9
10
"types" : " ./dist/index.d.ts" ,
10
11
"exports" : {
11
12
"." : {
13
+ "types" : " ./dist/index.d.ts" ,
12
14
"import" : " ./dist/index.esm.mjs" ,
13
15
"require" : " ./dist/index.cjs.js" ,
14
16
"style" : " ./dist/index.css"
15
17
},
16
18
"./components" : {
19
+ "types" : " ./dist/components.d.ts" ,
17
20
"import" : " ./dist/components.esm.mjs" ,
18
21
"require" : " ./dist/components.cjs.js" ,
19
22
"default" : " ./dist/components.cjs.js"
23
26
"./styles.css" : " ./dist/index.css" ,
24
27
"./dist/index.css" : " ./dist/index.css" ,
25
28
"./dist/components.cjs.js" : {
29
+ "types" : " ./dist/components.d.ts" ,
26
30
"import" : " ./dist/components.esm.mjs" ,
27
31
"require" : " ./dist/components.cjs.js" ,
28
32
"default" : " ./dist/components.cjs.js"
Original file line number Diff line number Diff line change @@ -136,6 +136,8 @@ export default function makeConfig(commandOptions) {
136
136
input : `src/components.tsx` ,
137
137
output : [
138
138
{ file : `./dist/components.d.ts` , format : "es" } ,
139
+ // because of typescript not following package.json exports sometimes
140
+ { file : `./components.d.ts` , format : "es" } ,
139
141
] ,
140
142
external : clientExternal ,
141
143
plugins : [ dts ( ) ] ,
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import {
14
14
} from "./mdx-client/annotations"
15
15
import { Preview } from "./mdx-client/preview"
16
16
import { InlineCode } from "./mdx-client/inline-code"
17
+ import type { MDXComponents } from "mdx/types"
17
18
18
19
export {
19
20
Code ,
@@ -31,7 +32,7 @@ export {
31
32
PreviewSlot ,
32
33
}
33
34
34
- export const CH = {
35
+ export const CH : MDXComponents = {
35
36
Code,
36
37
Section,
37
38
SectionLink,
Original file line number Diff line number Diff line change 1
- export { transform as remarkCodeHike } from "./remark/transform"
1
+ export { attacher as remarkCodeHike } from "./remark/transform"
2
2
3
3
export { highlight } from "./highlighter"
Original file line number Diff line number Diff line change @@ -3,7 +3,12 @@ import { CodeAnnotation } from "../smooth-code"
3
3
import { getColor , transparent , ColorName } from "../utils"
4
4
5
5
export function Annotation ( ) {
6
- return "error: code hike remark plugin not running or annotation isn't at the right place"
6
+ return (
7
+ < div >
8
+ "error: code hike remark plugin not running or
9
+ annotation isn't at the right place"
10
+ </ div >
11
+ )
7
12
}
8
13
9
14
export const annotationsMap : Record <
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import { valueToEstree } from "./to-estree"
10
10
import { CH_CODE_CONFIG_VAR_NAME } from "./unist-utils"
11
11
import { JsxNode , SuperNode , visit } from "./nodes"
12
12
import { addConfigDefaults , CodeHikeConfig } from "./config"
13
+ import { Attacher } from "unified"
13
14
14
15
const transforms = [
15
16
transformPreviews ,
@@ -20,7 +21,9 @@ const transforms = [
20
21
transformInlineCodes ,
21
22
transformCodes ,
22
23
]
23
- export function transform ( unsafeConfig : CodeHikeConfig ) {
24
+ export const attacher : Attacher <
25
+ [ CodeHikeConfig ?]
26
+ > = unsafeConfig => {
24
27
return async ( tree : SuperNode , file : any ) => {
25
28
const config = addConfigDefaults (
26
29
unsafeConfig ,
You can’t perform that action at this time.
0 commit comments