Skip to content

Commit 5dd4218

Browse files
committed
Update @types/hast, utilities
1 parent 8876c24 commit 5dd4218

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

lib/index.js

+8-10
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,12 @@
33
// passed tree.
44

55
/**
6-
* @typedef {import('hast').Root} Root
7-
* @typedef {import('hast').Content} Content
6+
* @typedef {import('hast').RootContent} RootContent
7+
* @typedef {import('hast').Nodes} Nodes
88
* @typedef {import('hast').Text} Text
99
*/
1010

1111
/**
12-
* @typedef {Root | Content} Node
13-
*
1412
* @typedef Options
1513
* Configuration.
1614
* @property {number | null | undefined} [size=140]
@@ -32,7 +30,7 @@
3230
* If `maxCharacterStrip` characters are walked back and no nice break point
3331
* is found, the bad break point is used.
3432
* Set `maxCharacterStrip: 0` to not find a nice break.
35-
* @property {Array<Content> | null | undefined} [ignore=[]]
33+
* @property {Array<RootContent> | null | undefined} [ignore=[]]
3634
* Nodes to exclude from the resulting tree.
3735
* These are not counted towards `size`.
3836
*/
@@ -45,7 +43,7 @@ const empty = []
4543
/**
4644
* Truncate the tree to a certain number of characters.
4745
*
48-
* @template {Node} Tree
46+
* @template {Nodes} Tree
4947
* Type of tree.
5048
* @param {Tree} tree
5149
* Tree to truncate.
@@ -111,9 +109,9 @@ export function truncate(tree, options) {
111109
/**
112110
* Transform in `preorder`.
113111
*
114-
* @param {Node} node
112+
* @param {Nodes} node
115113
* Node to truncate.
116-
* @returns {Node}
114+
* @returns {Nodes}
117115
* Shallow copy of `node`.
118116
*/
119117
function preorder(node) {
@@ -126,11 +124,11 @@ export function truncate(tree, options) {
126124
searchSize += node.value.length
127125
}
128126

129-
/** @type {Node} */
127+
/** @type {Nodes} */
130128
const replacement = {...node}
131129

132130
if ('children' in node) {
133-
/** @type {Array<Content>} */
131+
/** @type {Array<RootContent>} */
134132
const children = []
135133
let index = -1
136134

package.json

+4-4
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@
3434
"index.js"
3535
],
3636
"dependencies": {
37-
"@types/hast": "^2.0.0",
38-
"micromark-util-character": "^1.0.0"
37+
"@types/hast": "^3.0.0",
38+
"micromark-util-character": "^2.0.0"
3939
},
4040
"devDependencies": {
4141
"@types/node": "^20.0.0",
4242
"c8": "^8.0.0",
43-
"hast-util-select": "^5.0.0",
44-
"hastscript": "^7.0.0",
43+
"hast-util-select": "^6.0.0",
44+
"hastscript": "^8.0.0",
4545
"prettier": "^3.0.0",
4646
"remark-cli": "^11.0.0",
4747
"remark-preset-wooorm": "^9.0.0",

0 commit comments

Comments
 (0)