Skip to content

Commit 4812dec

Browse files
committed
Update vfile
1 parent 29ea36c commit 4812dec

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

lib/index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,6 @@ export function raw(tree, file, options) {
125125
}
126126
}
127127

128-
// @ts-expect-error: update `vfile`.
129128
const result = fromParse5(documentMode(tree) ? document() : fragment(), file)
130129

131130
if (stitches) {
@@ -506,5 +505,5 @@ function createParse5Location(node) {
506505
* @return {value is Options}
507506
*/
508507
function isOptions(value) {
509-
return Boolean(value && !('contents' in value))
508+
return Boolean(value && !('message' in value && 'messages' in value))
510509
}

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"parse5": "^6.0.0",
4444
"unist-util-position": "^4.0.0",
4545
"unist-util-visit": "^3.0.0",
46-
"vfile": "^4.0.0",
46+
"vfile": "^5.0.0",
4747
"web-namespaces": "^2.0.0",
4848
"zwitch": "^2.0.0"
4949
},
@@ -61,7 +61,7 @@
6161
"tape": "^5.0.0",
6262
"type-coverage": "^2.0.0",
6363
"typescript": "^4.0.0",
64-
"unified": "^9.0.0",
64+
"unified": "^10.0.0",
6565
"unist-builder": "^3.0.0",
6666
"xo": "^0.39.0"
6767
},

test.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import test from 'tape'
22
import {u} from 'unist-builder'
33
import {h} from 'hastscript'
4-
import unified from 'unified'
4+
import {unified} from 'unified'
55
import remarkParse from 'remark-parse'
66
import remarkRehype from 'remark-rehype'
77
import rehypeStringify from 'rehype-stringify'
@@ -288,10 +288,11 @@ test('integration', (t) => {
288288
unified()
289289
.use(remarkParse)
290290
.use(remarkRehype, {allowDangerousHtml: true})
291-
.use(() => {
292-
// @ts-expect-error hast is more specific than unist.
293-
return (tree, file) => raw(tree, file)
294-
})
291+
.use(
292+
() => (tree, file) =>
293+
// @ts-expect-error hast is more specific than unist.
294+
raw(tree, file)
295+
)
295296
.use(() => {
296297
return transformer
297298
function transformer(/** @type {import('unist').Node} */ tree) {

0 commit comments

Comments
 (0)