Skip to content

Commit aefe40e

Browse files
committed
Change plugin type
1 parent 9683b5b commit aefe40e

File tree

1 file changed

+15
-5
lines changed

1 file changed

+15
-5
lines changed

packages/mdx/src/remark/transform.ts

+15-5
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ import { valueToEstree } from "./to-estree"
1010
import { CH_CODE_CONFIG_VAR_NAME } from "./unist-utils"
1111
import { JsxNode, SuperNode, visit } from "./nodes"
1212
import { addConfigDefaults, CodeHikeConfig } from "./config"
13-
import { Attacher } from "unified"
1413

1514
const 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,

0 commit comments

Comments
 (0)