File tree Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -10,7 +10,6 @@ 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"
1413
1514const transforms = [
1615 transformPreviews ,
@@ -21,10 +20,21 @@ const transforms = [
2120 transformInlineCodes ,
2221 transformCodes ,
2322]
24- export const attacher : Attacher <
25- [ CodeHikeConfig ?]
26- > = unsafeConfig => {
27- return async ( tree : SuperNode , file : any ) => {
23+
24+ type VFile = {
25+ history : string [ ]
26+ cwd : string
27+ }
28+
29+ type Transformer = (
30+ node : SuperNode ,
31+ file : VFile
32+ ) => Promise < void >
33+
34+ type Plugin = ( config : CodeHikeConfig ) => Transformer
35+
36+ export const attacher : Plugin = unsafeConfig => {
37+ return async ( tree : SuperNode , file : VFile ) => {
2838 const config = addConfigDefaults (
2939 unsafeConfig ,
3040 file ?. cwd ,
You can’t perform that action at this time.
0 commit comments