From cdbb980c14a678ff73f0382b95c59db4c236874b Mon Sep 17 00:00:00 2001 From: Titus Wormer Date: Sat, 26 Aug 2023 11:29:26 +0200 Subject: [PATCH] Update `hast-util-raw`, `@types/hast` --- index.js | 8 ++++++-- package.json | 10 +++++----- test.js | 2 ++ 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/index.js b/index.js index a3d1d16..3731210 100644 --- a/index.js +++ b/index.js @@ -1,9 +1,13 @@ /** * @typedef {import('hast').Root} Root - * @typedef {import('hast-util-raw').Options} Options + * @typedef {import('hast-util-raw').Options} RawOptions * @typedef {import('hast-util-raw')} DoNotTouchAsThisImportIncludesRawInTree */ +/** + * @typedef {Omit} Options + */ + import {raw} from 'hast-util-raw' /** @@ -15,7 +19,7 @@ import {raw} from 'hast-util-raw' export default function rehypeRaw(options = {}) { return (tree, file) => { // Assume that when a root was given, it’s also returned. - const result = /** @type {Root} */ (raw(tree, file, options)) + const result = /** @type {Root} */ (raw(tree, {...options, file})) return result } } diff --git a/package.json b/package.json index 76d4721..c50a722 100644 --- a/package.json +++ b/package.json @@ -30,15 +30,15 @@ "index.js" ], "dependencies": { - "@types/hast": "^2.0.0", - "hast-util-raw": "^7.2.0", - "unified": "^10.0.0" + "@types/hast": "^3.0.0", + "hast-util-raw": "^9.0.0", + "unified": "^11.0.0" }, "devDependencies": { "@types/node": "^20.0.0", "c8": "^8.0.0", "prettier": "^3.0.0", - "rehype-stringify": "^9.0.0", + "rehype-stringify": "^10.0.0", "remark-cli": "^11.0.0", "remark-parse": "^10.0.0", "remark-preset-wooorm": "^9.0.0", @@ -46,7 +46,7 @@ "rimraf": "^3.0.0", "type-coverage": "^2.0.0", "typescript": "^5.0.0", - "unist-util-visit": "^4.0.0", + "unist-util-visit": "^5.0.0", "xo": "^0.56.0" }, "scripts": { diff --git a/test.js b/test.js index 1ef5f1c..fcdadd0 100644 --- a/test.js +++ b/test.js @@ -23,7 +23,9 @@ const html = `
test('rehypeRaw', async () => { const file = await unified() + // @ts-expect-error: to do: remove when remark is released. .use(remarkParse) + // @ts-expect-error: to do: remove when remark-rehype is released. .use(remarkRehype, {allowDangerousHtml: true}) .use(rehypeRaw) .use(