File tree Expand file tree Collapse file tree 7 files changed +21
-5
lines changed Expand file tree Collapse file tree 7 files changed +21
-5
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ yarn-error.log
1111storybook-static
1212packages /playground /out
1313packages /starter
14+ packages /mdx /components.d.ts
1415
1516# Contentlayer
1617.contentlayer
Original file line number Diff line number Diff line change 22 "name" : " @code-hike/mdx" ,
33 "version" : " 0.7.2" ,
44 "files" : [
5- " dist"
5+ " dist" ,
6+ " components.d.ts"
67 ],
78 "main" : " ./dist/index.cjs.js" ,
89 "module" : " ./dist/index.esm.mjs" ,
910 "types" : " ./dist/index.d.ts" ,
1011 "exports" : {
1112 "." : {
13+ "types" : " ./dist/index.d.ts" ,
1214 "import" : " ./dist/index.esm.mjs" ,
1315 "require" : " ./dist/index.cjs.js" ,
1416 "style" : " ./dist/index.css"
1517 },
1618 "./components" : {
19+ "types" : " ./dist/components.d.ts" ,
1720 "import" : " ./dist/components.esm.mjs" ,
1821 "require" : " ./dist/components.cjs.js" ,
1922 "default" : " ./dist/components.cjs.js"
2326 "./styles.css" : " ./dist/index.css" ,
2427 "./dist/index.css" : " ./dist/index.css" ,
2528 "./dist/components.cjs.js" : {
29+ "types" : " ./dist/components.d.ts" ,
2630 "import" : " ./dist/components.esm.mjs" ,
2731 "require" : " ./dist/components.cjs.js" ,
2832 "default" : " ./dist/components.cjs.js"
Original file line number Diff line number Diff line change @@ -136,6 +136,8 @@ export default function makeConfig(commandOptions) {
136136 input : `src/components.tsx` ,
137137 output : [
138138 { file : `./dist/components.d.ts` , format : "es" } ,
139+ // because of typescript not following package.json exports sometimes
140+ { file : `./components.d.ts` , format : "es" } ,
139141 ] ,
140142 external : clientExternal ,
141143 plugins : [ dts ( ) ] ,
Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ import {
1414} from "./mdx-client/annotations"
1515import { Preview } from "./mdx-client/preview"
1616import { InlineCode } from "./mdx-client/inline-code"
17+ import type { MDXComponents } from "mdx/types"
1718
1819export {
1920 Code ,
@@ -31,7 +32,7 @@ export {
3132 PreviewSlot ,
3233}
3334
34- export const CH = {
35+ export const CH : MDXComponents = {
3536 Code,
3637 Section,
3738 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"
22
33export { highlight } from "./highlighter"
Original file line number Diff line number Diff line change @@ -3,7 +3,12 @@ import { CodeAnnotation } from "../smooth-code"
33import { getColor , transparent , ColorName } from "../utils"
44
55export 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+ )
712}
813
914export const annotationsMap : Record <
Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import { valueToEstree } from "./to-estree"
1010import { CH_CODE_CONFIG_VAR_NAME } from "./unist-utils"
1111import { JsxNode , SuperNode , visit } from "./nodes"
1212import { addConfigDefaults , CodeHikeConfig } from "./config"
13+ import { Attacher } from "unified"
1314
1415const transforms = [
1516 transformPreviews ,
@@ -20,7 +21,9 @@ const transforms = [
2021 transformInlineCodes ,
2122 transformCodes ,
2223]
23- export function transform ( unsafeConfig : CodeHikeConfig ) {
24+ export const attacher : Attacher <
25+ [ CodeHikeConfig ?]
26+ > = unsafeConfig => {
2427 return async ( tree : SuperNode , file : any ) => {
2528 const config = addConfigDefaults (
2629 unsafeConfig ,
You can’t perform that action at this time.
0 commit comments