File tree 1 file changed +15
-5
lines changed
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"
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"
14
13
15
14
const transforms = [
16
15
transformPreviews ,
@@ -21,10 +20,21 @@ const transforms = [
21
20
transformInlineCodes ,
22
21
transformCodes ,
23
22
]
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 ) => {
28
38
const config = addConfigDefaults (
29
39
unsafeConfig ,
30
40
file ?. cwd ,
You can’t perform that action at this time.
0 commit comments