diff --git a/lib/index.js b/lib/index.js index 7ce114d..4f322bb 100644 --- a/lib/index.js +++ b/lib/index.js @@ -125,7 +125,6 @@ export function raw(tree, file, options) { } } - // @ts-expect-error: update `vfile`. const result = fromParse5(documentMode(tree) ? document() : fragment(), file) if (stitches) { @@ -506,5 +505,5 @@ function createParse5Location(node) { * @return {value is Options} */ function isOptions(value) { - return Boolean(value && !('contents' in value)) + return Boolean(value && !('message' in value && 'messages' in value)) } diff --git a/package.json b/package.json index ccac43d..a41257f 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,7 @@ "parse5": "^6.0.0", "unist-util-position": "^4.0.0", "unist-util-visit": "^3.0.0", - "vfile": "^4.0.0", + "vfile": "^5.0.0", "web-namespaces": "^2.0.0", "zwitch": "^2.0.0" }, @@ -61,7 +61,7 @@ "tape": "^5.0.0", "type-coverage": "^2.0.0", "typescript": "^4.0.0", - "unified": "^9.0.0", + "unified": "^10.0.0", "unist-builder": "^3.0.0", "xo": "^0.39.0" }, diff --git a/test.js b/test.js index 714c930..3a61b36 100644 --- a/test.js +++ b/test.js @@ -1,7 +1,7 @@ import test from 'tape' import {u} from 'unist-builder' import {h} from 'hastscript' -import unified from 'unified' +import {unified} from 'unified' import remarkParse from 'remark-parse' import remarkRehype from 'remark-rehype' import rehypeStringify from 'rehype-stringify' @@ -288,10 +288,11 @@ test('integration', (t) => { unified() .use(remarkParse) .use(remarkRehype, {allowDangerousHtml: true}) - .use(() => { - // @ts-expect-error hast is more specific than unist. - return (tree, file) => raw(tree, file) - }) + .use( + () => (tree, file) => + // @ts-expect-error hast is more specific than unist. + raw(tree, file) + ) .use(() => { return transformer function transformer(/** @type {import('unist').Node} */ tree) {