@songtonyli/dsh-cli 0.1.84 → 0.1.86
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/bin/dsh.mjs +1 -1
- package/node_modules/@deepseek-ai/dsh-client-modules/lib/index.js +1 -1
- package/node_modules/@deepseek-ai/dsh-client-ui-sidebar/lib/client.js +1 -1
- package/node_modules/@deepseek-ai/dsh-experimental-tool-agent-team/README.i18n.yaml +14 -14
- package/node_modules/@deepseek-ai/dsh-experimental-tool-agent-team/README.md +7 -7
- package/node_modules/@deepseek-ai/dsh-experimental-tool-agent-team/README.zh.md +7 -7
- package/node_modules/@deepseek-ai/dsh-experimental-tool-agent-team/lib/index.js +28 -4
- package/node_modules/@deepseek-ai/dsh-llm-pi-ai/lib/index.js +39 -52
- package/node_modules/@deepseek-ai/dsh-subagent/README.i18n.yaml +4 -4
- package/node_modules/@deepseek-ai/dsh-subagent/README.md +3 -3
- package/node_modules/@deepseek-ai/dsh-subagent/README.zh.md +3 -3
- package/node_modules/@deepseek-ai/dsh-subagent/lib/index.js +8 -5
- package/node_modules/@deepseek-ai/dsh-subagent/lib/types/child-agent.js +9 -4
- package/node_modules/@deepseek-ai/dsh-tui-app/README.i18n.yaml +10 -10
- package/node_modules/@deepseek-ai/dsh-tui-app/README.md +16 -11
- package/node_modules/@deepseek-ai/dsh-tui-app/README.zh.md +16 -11
- package/node_modules/@deepseek-ai/dsh-tui-app/lib/index.js +1938 -1409
- package/node_modules/execa/package.json +1 -1
- package/node_modules/unist-util-visit/lib/index.js +173 -161
- package/node_modules/unist-util-visit/license +1 -1
- package/node_modules/unist-util-visit/package.json +46 -56
- package/node_modules/unist-util-visit/readme.md +87 -27
- package/node_modules/unist-util-visit-parents/lib/color.js +4 -0
- package/node_modules/unist-util-visit-parents/lib/color.node.js +4 -0
- package/node_modules/unist-util-visit-parents/lib/index.js +235 -52
- package/node_modules/unist-util-visit-parents/license +1 -1
- package/node_modules/unist-util-visit-parents/package.json +44 -54
- package/node_modules/unist-util-visit-parents/readme.md +185 -74
- package/package.json +4 -4
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @import {Node as UnistNode, Parent as UnistParent} from 'unist'
|
|
3
|
-
* @import {
|
|
3
|
+
* @import {
|
|
4
|
+
* InclusiveDescendant,
|
|
5
|
+
* Matches,
|
|
6
|
+
* Visitors as ParentsVisitors,
|
|
7
|
+
* VisitorResult,
|
|
8
|
+
* VisitorResultExit
|
|
9
|
+
* } from 'unist-util-visit-parents'
|
|
4
10
|
*/
|
|
5
11
|
|
|
6
12
|
/**
|
|
@@ -12,67 +18,6 @@
|
|
|
12
18
|
* which doesn’t work when publishing on npm.
|
|
13
19
|
*/
|
|
14
20
|
|
|
15
|
-
// To do: use types from `unist-util-visit-parents` when it’s released.
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @typedef {(
|
|
19
|
-
* Fn extends (value: any) => value is infer Thing
|
|
20
|
-
* ? Thing
|
|
21
|
-
* : Fallback
|
|
22
|
-
* )} Predicate
|
|
23
|
-
* Get the value of a type guard `Fn`.
|
|
24
|
-
* @template Fn
|
|
25
|
-
* Value; typically function that is a type guard (such as `(x): x is Y`).
|
|
26
|
-
* @template Fallback
|
|
27
|
-
* Value to yield if `Fn` is not a type guard.
|
|
28
|
-
*/
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* @typedef {(
|
|
32
|
-
* Check extends null | undefined // No test.
|
|
33
|
-
* ? Value
|
|
34
|
-
* : Value extends {type: Check} // String (type) test.
|
|
35
|
-
* ? Value
|
|
36
|
-
* : Value extends Check // Partial test.
|
|
37
|
-
* ? Value
|
|
38
|
-
* : Check extends Function // Function test.
|
|
39
|
-
* ? Predicate<Check, Value> extends Value
|
|
40
|
-
* ? Predicate<Check, Value>
|
|
41
|
-
* : never
|
|
42
|
-
* : never // Some other test?
|
|
43
|
-
* )} MatchesOne
|
|
44
|
-
* Check whether a node matches a primitive check in the type system.
|
|
45
|
-
* @template Value
|
|
46
|
-
* Value; typically unist `Node`.
|
|
47
|
-
* @template Check
|
|
48
|
-
* Value; typically `unist-util-is`-compatible test, but not arrays.
|
|
49
|
-
*/
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* @typedef {(
|
|
53
|
-
* Check extends ReadonlyArray<any>
|
|
54
|
-
* ? MatchesOne<Value, Check[number]>
|
|
55
|
-
* : MatchesOne<Value, Check>
|
|
56
|
-
* )} Matches
|
|
57
|
-
* Check whether a node matches a check in the type system.
|
|
58
|
-
* @template Value
|
|
59
|
-
* Value; typically unist `Node`.
|
|
60
|
-
* @template Check
|
|
61
|
-
* Value; typically `unist-util-is`-compatible test.
|
|
62
|
-
*/
|
|
63
|
-
|
|
64
|
-
/**
|
|
65
|
-
* @typedef {0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10} Uint
|
|
66
|
-
* Number; capped reasonably.
|
|
67
|
-
*/
|
|
68
|
-
|
|
69
|
-
/**
|
|
70
|
-
* @typedef {I extends 0 ? 1 : I extends 1 ? 2 : I extends 2 ? 3 : I extends 3 ? 4 : I extends 4 ? 5 : I extends 5 ? 6 : I extends 6 ? 7 : I extends 7 ? 8 : I extends 8 ? 9 : 10} Increment
|
|
71
|
-
* Increment a number in the type system.
|
|
72
|
-
* @template {Uint} [I=0]
|
|
73
|
-
* Index.
|
|
74
|
-
*/
|
|
75
|
-
|
|
76
21
|
/**
|
|
77
22
|
* @typedef {(
|
|
78
23
|
* Node extends UnistParent
|
|
@@ -98,89 +43,64 @@
|
|
|
98
43
|
*/
|
|
99
44
|
|
|
100
45
|
/**
|
|
101
|
-
* @
|
|
102
|
-
*
|
|
103
|
-
* ? never
|
|
104
|
-
* :
|
|
105
|
-
* | InternalParent<Node, Child>
|
|
106
|
-
* | InternalAncestor<Node, InternalParent<Node, Child>, Max, Increment<Depth>>
|
|
107
|
-
* )} InternalAncestor
|
|
108
|
-
* Collect nodes in `Tree` that can be ancestors of `Child`.
|
|
109
|
-
* @template {UnistNode} Node
|
|
110
|
-
* All node types in a tree.
|
|
111
|
-
* @template {UnistNode} Child
|
|
112
|
-
* Node to search for.
|
|
113
|
-
* @template {Uint} [Max=10]
|
|
114
|
-
* Max; searches up to this depth.
|
|
115
|
-
* @template {Uint} [Depth=0]
|
|
116
|
-
* Current depth.
|
|
117
|
-
*/
|
|
118
|
-
|
|
119
|
-
/**
|
|
120
|
-
* @typedef {(
|
|
121
|
-
* Tree extends UnistParent
|
|
122
|
-
* ? Depth extends Max
|
|
123
|
-
* ? Tree
|
|
124
|
-
* : Tree | InclusiveDescendant<Tree['children'][number], Max, Increment<Depth>>
|
|
125
|
-
* : Tree
|
|
126
|
-
* )} InclusiveDescendant
|
|
127
|
-
* Collect all (inclusive) descendants of `Tree`.
|
|
46
|
+
* @callback Visitor
|
|
47
|
+
* Handle a node (matching `test`, if given) before its children.
|
|
128
48
|
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
132
|
-
*
|
|
133
|
-
*
|
|
134
|
-
*
|
|
135
|
-
*
|
|
136
|
-
*
|
|
137
|
-
*
|
|
138
|
-
*
|
|
139
|
-
* @
|
|
140
|
-
*
|
|
141
|
-
* @template {
|
|
142
|
-
*
|
|
49
|
+
* Like `Visitor` in `unist-util-visit-parents`,
|
|
50
|
+
* but with `index` and `parent` instead of `parents`.
|
|
51
|
+
* @param {Visited} node
|
|
52
|
+
* Found node.
|
|
53
|
+
* @param {Visited extends UnistNode ? number | undefined : never} index
|
|
54
|
+
* Index of `node` in `parent`,
|
|
55
|
+
* or `undefined` for the tree itself.
|
|
56
|
+
* @param {Ancestor extends UnistParent ? Ancestor | undefined : never} parent
|
|
57
|
+
* Parent of `node`,
|
|
58
|
+
* or `undefined` for the tree itself.
|
|
59
|
+
* @returns {VisitorResult}
|
|
60
|
+
* What to do next.
|
|
61
|
+
* @template {UnistNode} [Visited=UnistNode]
|
|
62
|
+
* Visited node type.
|
|
63
|
+
* @template {UnistParent} [Ancestor=UnistParent]
|
|
64
|
+
* Ancestor type.
|
|
143
65
|
*/
|
|
144
66
|
|
|
145
67
|
/**
|
|
146
|
-
* @callback
|
|
147
|
-
* Handle a node (matching `test`, if given).
|
|
148
|
-
*
|
|
149
|
-
* Visitors are free to transform `node`.
|
|
150
|
-
* They can also transform `parent`.
|
|
151
|
-
*
|
|
152
|
-
* Replacing `node` itself, if `SKIP` is not returned, still causes its
|
|
153
|
-
* descendants to be walked (which is a bug).
|
|
154
|
-
*
|
|
155
|
-
* When adding or removing previous siblings of `node` (or next siblings, in
|
|
156
|
-
* case of reverse), the `Visitor` should return a new `Index` to specify the
|
|
157
|
-
* sibling to traverse after `node` is traversed.
|
|
158
|
-
* Adding or removing next siblings of `node` (or previous siblings, in case
|
|
159
|
-
* of reverse) is handled as expected without needing to return a new `Index`.
|
|
68
|
+
* @callback VisitorExit
|
|
69
|
+
* Handle a node (matching `test`, if given) after its children.
|
|
160
70
|
*
|
|
161
|
-
*
|
|
162
|
-
*
|
|
71
|
+
* Like `VisitorExit` in `unist-util-visit-parents`,
|
|
72
|
+
* but with `index` and `parent` instead of `parents`.
|
|
163
73
|
* @param {Visited} node
|
|
164
74
|
* Found node.
|
|
165
75
|
* @param {Visited extends UnistNode ? number | undefined : never} index
|
|
166
|
-
* Index of `node` in `parent
|
|
76
|
+
* Index of `node` in `parent`,
|
|
77
|
+
* or `undefined` for the tree itself.
|
|
167
78
|
* @param {Ancestor extends UnistParent ? Ancestor | undefined : never} parent
|
|
168
|
-
* Parent of `node
|
|
169
|
-
*
|
|
79
|
+
* Parent of `node`,
|
|
80
|
+
* or `undefined` for the tree itself.
|
|
81
|
+
* @returns {VisitorResultExit}
|
|
170
82
|
* What to do next.
|
|
171
|
-
*
|
|
172
|
-
* An `Index` is treated as a tuple of `[CONTINUE, Index]`.
|
|
173
|
-
* An `Action` is treated as a tuple of `[Action]`.
|
|
174
|
-
*
|
|
175
|
-
* Passing a tuple back only makes sense if the `Action` is `SKIP`.
|
|
176
|
-
* When the `Action` is `EXIT`, that action can be returned.
|
|
177
|
-
* When the `Action` is `CONTINUE`, `Index` can be returned.
|
|
178
83
|
* @template {UnistNode} [Visited=UnistNode]
|
|
179
84
|
* Visited node type.
|
|
180
85
|
* @template {UnistParent} [Ancestor=UnistParent]
|
|
181
86
|
* Ancestor type.
|
|
182
87
|
*/
|
|
183
88
|
|
|
89
|
+
/**
|
|
90
|
+
* @template {UnistNode} [Visited=UnistNode]
|
|
91
|
+
* Visited node type.
|
|
92
|
+
* @template {UnistParent} [Ancestor=UnistParent]
|
|
93
|
+
* Ancestor type.
|
|
94
|
+
* @typedef Visitors
|
|
95
|
+
* Handle nodes when entering and exiting them.
|
|
96
|
+
*
|
|
97
|
+
* Like `Visitors` in `unist-util-visit-parents`.
|
|
98
|
+
* @property {Visitor<Visited, Ancestor> | null | undefined} [enter]
|
|
99
|
+
* Handle a node before its children (optional).
|
|
100
|
+
* @property {VisitorExit<Visited, Ancestor>} exit
|
|
101
|
+
* Handle a node after its children.
|
|
102
|
+
*/
|
|
103
|
+
|
|
184
104
|
/**
|
|
185
105
|
* @typedef {Visitor<Visited, Parent<Ancestor, Visited>>} BuildVisitorFromMatch
|
|
186
106
|
* Build a typed `Visitor` function from a node and all possible parents.
|
|
@@ -224,6 +144,25 @@
|
|
|
224
144
|
* Test type.
|
|
225
145
|
*/
|
|
226
146
|
|
|
147
|
+
/**
|
|
148
|
+
* @typedef {(
|
|
149
|
+
* Visitors<
|
|
150
|
+
* Matches<InclusiveDescendant<Tree>, Check>,
|
|
151
|
+
* Parent<
|
|
152
|
+
* Extract<InclusiveDescendant<Tree>, UnistParent>,
|
|
153
|
+
* Matches<InclusiveDescendant<Tree>, Check>
|
|
154
|
+
* >
|
|
155
|
+
* >
|
|
156
|
+
* )} BuildVisitors
|
|
157
|
+
* Build typed `Visitors` from a tree and a test.
|
|
158
|
+
*
|
|
159
|
+
* It will infer which values are passed as `node` and which as `parent`.
|
|
160
|
+
* @template {UnistNode} [Tree=UnistNode]
|
|
161
|
+
* Node type.
|
|
162
|
+
* @template {Test} [Check=Test]
|
|
163
|
+
* Test type.
|
|
164
|
+
*/
|
|
165
|
+
|
|
227
166
|
import {visitParents} from 'unist-util-visit-parents'
|
|
228
167
|
|
|
229
168
|
export {CONTINUE, EXIT, SKIP} from 'unist-util-visit-parents'
|
|
@@ -232,10 +171,13 @@ export {CONTINUE, EXIT, SKIP} from 'unist-util-visit-parents'
|
|
|
232
171
|
* Visit nodes.
|
|
233
172
|
*
|
|
234
173
|
* This algorithm performs *depth-first* *tree traversal* in *preorder*
|
|
235
|
-
* (**NLR**) or if `reverse` is given,
|
|
174
|
+
* (**NLR**) or if `reverse` is given,
|
|
175
|
+
* in *reverse preorder* (**NRL**).
|
|
176
|
+
* An `exit` visitor is called in *postorder* (**LRN**)
|
|
177
|
+
* or if `reverse` is given, in *reverse postorder* (**RLN**).
|
|
236
178
|
*
|
|
237
|
-
* You can choose
|
|
238
|
-
* For complex tests, you should test yourself in
|
|
179
|
+
* You can choose which nodes are visited by passing a `test`.
|
|
180
|
+
* For complex tests, you should test yourself in a visitor, as it will be
|
|
239
181
|
* faster and will have improved type information.
|
|
240
182
|
*
|
|
241
183
|
* Walking the tree is an intensive task.
|
|
@@ -244,29 +186,48 @@ export {CONTINUE, EXIT, SKIP} from 'unist-util-visit-parents'
|
|
|
244
186
|
* to check if a node matches, and then perform different operations.
|
|
245
187
|
*
|
|
246
188
|
* You can change the tree.
|
|
247
|
-
*
|
|
189
|
+
* Changes inside a node made when entering it are walked,
|
|
190
|
+
* changes made when exiting it are not.
|
|
191
|
+
* See `Visitor` and `VisitorExit` for more info.
|
|
248
192
|
*
|
|
249
193
|
* @overload
|
|
250
194
|
* @param {Tree} tree
|
|
195
|
+
* Tree to traverse.
|
|
251
196
|
* @param {Check} check
|
|
252
|
-
*
|
|
197
|
+
* `unist-util-is`-compatible test.
|
|
198
|
+
* @param {BuildVisitor<Tree, Check> | BuildVisitors<Tree, Check>} visitors
|
|
199
|
+
* Handle each node when entering it,
|
|
200
|
+
* or `{enter, exit}` to also handle it when exiting it.
|
|
253
201
|
* @param {boolean | null | undefined} [reverse]
|
|
202
|
+
* Walk children from last to first;
|
|
203
|
+
* for `enter`, reverse preorder (NRL) instead of preorder (NLR);
|
|
204
|
+
* for `exit`, reverse postorder (RLN) instead of postorder (LRN).
|
|
254
205
|
* @returns {undefined}
|
|
206
|
+
* Nothing.
|
|
255
207
|
*
|
|
256
208
|
* @overload
|
|
257
209
|
* @param {Tree} tree
|
|
258
|
-
*
|
|
210
|
+
* Tree to traverse.
|
|
211
|
+
* @param {BuildVisitor<Tree> | BuildVisitors<Tree>} visitors
|
|
212
|
+
* Handle each node when entering it,
|
|
213
|
+
* or `{enter, exit}` to also handle it when exiting it.
|
|
259
214
|
* @param {boolean | null | undefined} [reverse]
|
|
215
|
+
* Walk children from last to first;
|
|
216
|
+
* for `enter`, reverse preorder (NRL) instead of preorder (NLR);
|
|
217
|
+
* for `exit`, reverse postorder (RLN) instead of postorder (LRN).
|
|
260
218
|
* @returns {undefined}
|
|
219
|
+
* Nothing.
|
|
261
220
|
*
|
|
262
221
|
* @param {UnistNode} tree
|
|
263
222
|
* Tree to traverse.
|
|
264
|
-
* @param {Visitor | Test}
|
|
265
|
-
* `unist-util-is`-compatible test
|
|
266
|
-
* @param {Visitor | boolean | null | undefined} [
|
|
267
|
-
*
|
|
268
|
-
* @param {boolean | null | undefined} [maybeReverse
|
|
269
|
-
*
|
|
223
|
+
* @param {Visitor | Visitors | Test} testOrEnterOrVisitors
|
|
224
|
+
* `unist-util-is`-compatible test, `enter`, or `visitors`.
|
|
225
|
+
* @param {Visitor | Visitors | boolean | null | undefined} [enterOrVisitorsOrReverse]
|
|
226
|
+
* `enter`, `visitors`, or `reverse` after a test.
|
|
227
|
+
* @param {boolean | null | undefined} [maybeReverse]
|
|
228
|
+
* Walk children from last to first;
|
|
229
|
+
* for `enter`, reverse preorder (NRL) instead of preorder (NLR);
|
|
230
|
+
* for `exit`, reverse postorder (RLN) instead of postorder (LRN).
|
|
270
231
|
* @returns {undefined}
|
|
271
232
|
* Nothing.
|
|
272
233
|
*
|
|
@@ -275,38 +236,89 @@ export {CONTINUE, EXIT, SKIP} from 'unist-util-visit-parents'
|
|
|
275
236
|
* @template {Test} Check
|
|
276
237
|
* `unist-util-is`-compatible test.
|
|
277
238
|
*/
|
|
278
|
-
export function visit(
|
|
239
|
+
export function visit(
|
|
240
|
+
tree,
|
|
241
|
+
testOrEnterOrVisitors,
|
|
242
|
+
enterOrVisitorsOrReverse,
|
|
243
|
+
maybeReverse
|
|
244
|
+
) {
|
|
245
|
+
/** @type {Test} */
|
|
246
|
+
let check
|
|
247
|
+
/** @type {Visitor | Visitors} */
|
|
248
|
+
let visitors
|
|
279
249
|
/** @type {boolean | null | undefined} */
|
|
280
250
|
let reverse
|
|
281
|
-
/** @type {Test} */
|
|
282
|
-
let test
|
|
283
|
-
/** @type {Visitor} */
|
|
284
|
-
let visitor
|
|
285
251
|
|
|
252
|
+
// Third parameter is an enter visitor or a visitors object, so expect a `test` too.
|
|
286
253
|
if (
|
|
287
|
-
typeof
|
|
288
|
-
typeof
|
|
254
|
+
typeof enterOrVisitorsOrReverse === 'function' ||
|
|
255
|
+
(enterOrVisitorsOrReverse && typeof enterOrVisitorsOrReverse === 'object')
|
|
289
256
|
) {
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
reverse = visitorOrReverse
|
|
293
|
-
} else {
|
|
294
|
-
// @ts-expect-error: assume the overload with test was given.
|
|
295
|
-
test = testOrVisitor
|
|
296
|
-
// @ts-expect-error: assume the overload with test was given.
|
|
297
|
-
visitor = visitorOrReverse
|
|
257
|
+
check = /** @type {Test} */ (testOrEnterOrVisitors)
|
|
258
|
+
visitors = enterOrVisitorsOrReverse
|
|
298
259
|
reverse = maybeReverse
|
|
299
260
|
}
|
|
261
|
+
// Assume no test.
|
|
262
|
+
else {
|
|
263
|
+
visitors = /** @type {Visitor | Visitors} */ (testOrEnterOrVisitors)
|
|
264
|
+
reverse = enterOrVisitorsOrReverse
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
if (typeof visitors === 'function') {
|
|
268
|
+
visitParents(tree, check, wrap(visitors), reverse)
|
|
269
|
+
} else {
|
|
270
|
+
visitParents(tree, check, wrapVisitors(visitors), reverse)
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
/**
|
|
275
|
+
* Turn `visit` visitors into `visitParents` visitors.
|
|
276
|
+
*
|
|
277
|
+
* @param {Visitors} visitors
|
|
278
|
+
* Visitors for `visit`.
|
|
279
|
+
* @returns {ParentsVisitors}
|
|
280
|
+
* Visitors for `visitParents`.
|
|
281
|
+
*/
|
|
282
|
+
function wrapVisitors(visitors) {
|
|
283
|
+
// Pass anything else straight to `visitParents` to get its errors.
|
|
284
|
+
if (!visitors || typeof visitors !== 'object') return visitors
|
|
300
285
|
|
|
301
|
-
|
|
286
|
+
return {
|
|
287
|
+
enter:
|
|
288
|
+
typeof visitors.enter === 'function'
|
|
289
|
+
? wrap(visitors.enter)
|
|
290
|
+
: visitors.enter,
|
|
291
|
+
exit:
|
|
292
|
+
typeof visitors.exit === 'function' ? wrap(visitors.exit) : visitors.exit
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
/**
|
|
297
|
+
* Turn a `visit` visitor into a `visitParents` one.
|
|
298
|
+
*
|
|
299
|
+
* @template {VisitorResult} Result
|
|
300
|
+
* Result type.
|
|
301
|
+
* @param {(node: UnistNode, index: number | undefined, parent: UnistParent | undefined) => Result} visitor
|
|
302
|
+
* Visitor for `visit`.
|
|
303
|
+
* @returns {(node: UnistNode, parents: Array<UnistParent>, index: number | undefined) => Result}
|
|
304
|
+
* Visitor for `visitParents`.
|
|
305
|
+
*/
|
|
306
|
+
function wrap(visitor) {
|
|
307
|
+
return overload
|
|
302
308
|
|
|
303
309
|
/**
|
|
310
|
+
* Call `visitor` with `index` and `parent` instead of `parents`.
|
|
311
|
+
*
|
|
304
312
|
* @param {UnistNode} node
|
|
313
|
+
* Visited node.
|
|
305
314
|
* @param {Array<UnistParent>} parents
|
|
315
|
+
* Ancestors of `node`.
|
|
316
|
+
* @param {number | undefined} index
|
|
317
|
+
* Index of `node` in its parent.
|
|
318
|
+
* @returns {Result}
|
|
319
|
+
* What to do next.
|
|
306
320
|
*/
|
|
307
|
-
function overload(node, parents) {
|
|
308
|
-
|
|
309
|
-
const index = parent ? parent.children.indexOf(node) : undefined
|
|
310
|
-
return visitor(node, index, parent)
|
|
321
|
+
function overload(node, parents, index) {
|
|
322
|
+
return visitor(node, index, parents[parents.length - 1])
|
|
311
323
|
}
|
|
312
324
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
(The MIT License)
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) Titus Wormer <tituswormer@gmail.com>
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
6
|
a copy of this software and associated documentation files (the
|
|
@@ -1,61 +1,21 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "unist-util-visit",
|
|
3
|
-
"version": "5.1.0",
|
|
4
|
-
"description": "unist utility to visit nodes",
|
|
5
|
-
"license": "MIT",
|
|
6
|
-
"keywords": [
|
|
7
|
-
"unist",
|
|
8
|
-
"unist-util",
|
|
9
|
-
"util",
|
|
10
|
-
"utility",
|
|
11
|
-
"remark",
|
|
12
|
-
"retext",
|
|
13
|
-
"rehype",
|
|
14
|
-
"mdast",
|
|
15
|
-
"hast",
|
|
16
|
-
"xast",
|
|
17
|
-
"nlcst",
|
|
18
|
-
"natural",
|
|
19
|
-
"language",
|
|
20
|
-
"markdown",
|
|
21
|
-
"html",
|
|
22
|
-
"xml",
|
|
23
|
-
"tree",
|
|
24
|
-
"ast",
|
|
25
|
-
"node",
|
|
26
|
-
"visit",
|
|
27
|
-
"walk"
|
|
28
|
-
],
|
|
29
|
-
"repository": "syntax-tree/unist-util-visit",
|
|
30
|
-
"bugs": "https://github.com/syntax-tree/unist-util-visit/issues",
|
|
31
|
-
"funding": {
|
|
32
|
-
"type": "opencollective",
|
|
33
|
-
"url": "https://opencollective.com/unified"
|
|
34
|
-
},
|
|
35
2
|
"author": "Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
|
|
3
|
+
"bugs": "https://github.com/syntax-tree/unist-util-visit/issues",
|
|
36
4
|
"contributors": [
|
|
37
5
|
"Titus Wormer <tituswormer@gmail.com> (https://wooorm.com)",
|
|
38
6
|
"Eugene Sharygin <eush77@gmail.com>",
|
|
39
7
|
"Richard Gibson <richard.gibson@gmail.com>"
|
|
40
8
|
],
|
|
41
|
-
"sideEffects": false,
|
|
42
|
-
"type": "module",
|
|
43
|
-
"exports": "./index.js",
|
|
44
|
-
"files": [
|
|
45
|
-
"lib/",
|
|
46
|
-
"index.d.ts.map",
|
|
47
|
-
"index.d.ts",
|
|
48
|
-
"index.js"
|
|
49
|
-
],
|
|
50
9
|
"dependencies": {
|
|
51
10
|
"@types/unist": "^3.0.0",
|
|
52
11
|
"unist-util-is": "^6.0.0",
|
|
53
|
-
"unist-util-visit-parents": "^6.
|
|
12
|
+
"unist-util-visit-parents": "^6.1.0"
|
|
54
13
|
},
|
|
14
|
+
"description": "unist utility to visit nodes",
|
|
55
15
|
"devDependencies": {
|
|
56
16
|
"@types/mdast": "^4.0.0",
|
|
57
|
-
"@types/node": "^
|
|
58
|
-
"c8": "^
|
|
17
|
+
"@types/node": "^26.0.0",
|
|
18
|
+
"c8": "^12.0.0",
|
|
59
19
|
"mdast-util-from-markdown": "^2.0.0",
|
|
60
20
|
"mdast-util-gfm": "^3.0.0",
|
|
61
21
|
"micromark-extension-gfm": "^3.0.0",
|
|
@@ -64,9 +24,44 @@
|
|
|
64
24
|
"remark-preset-wooorm": "^11.0.0",
|
|
65
25
|
"tsd": "^0.33.0",
|
|
66
26
|
"type-coverage": "^2.0.0",
|
|
67
|
-
"typescript": "^
|
|
68
|
-
"xo": "^
|
|
27
|
+
"typescript": "^6.0.0",
|
|
28
|
+
"xo": "^5.0.0"
|
|
69
29
|
},
|
|
30
|
+
"exports": "./index.js",
|
|
31
|
+
"files": [
|
|
32
|
+
"lib/",
|
|
33
|
+
"index.d.ts",
|
|
34
|
+
"index.js"
|
|
35
|
+
],
|
|
36
|
+
"funding": {
|
|
37
|
+
"type": "opencollective",
|
|
38
|
+
"url": "https://opencollective.com/unified"
|
|
39
|
+
},
|
|
40
|
+
"keywords": [
|
|
41
|
+
"ast",
|
|
42
|
+
"hast",
|
|
43
|
+
"html",
|
|
44
|
+
"language",
|
|
45
|
+
"markdown",
|
|
46
|
+
"mdast",
|
|
47
|
+
"natural",
|
|
48
|
+
"nlcst",
|
|
49
|
+
"node",
|
|
50
|
+
"rehype",
|
|
51
|
+
"remark",
|
|
52
|
+
"retext",
|
|
53
|
+
"tree",
|
|
54
|
+
"unist-util",
|
|
55
|
+
"unist",
|
|
56
|
+
"utility",
|
|
57
|
+
"util",
|
|
58
|
+
"visit",
|
|
59
|
+
"walk",
|
|
60
|
+
"xast",
|
|
61
|
+
"xml"
|
|
62
|
+
],
|
|
63
|
+
"license": "MIT",
|
|
64
|
+
"name": "unist-util-visit",
|
|
70
65
|
"prettier": {
|
|
71
66
|
"bracketSpacing": false,
|
|
72
67
|
"semi": false,
|
|
@@ -80,21 +75,16 @@
|
|
|
80
75
|
"remark-preset-wooorm"
|
|
81
76
|
]
|
|
82
77
|
},
|
|
78
|
+
"repository": "syntax-tree/unist-util-visit",
|
|
79
|
+
"sideEffects": false,
|
|
83
80
|
"typeCoverage": {
|
|
84
81
|
"atLeast": 100,
|
|
85
|
-
"detail": true,
|
|
86
82
|
"#": "needed `any`s",
|
|
87
83
|
"ignoreFiles": [
|
|
88
84
|
"lib/index.d.ts"
|
|
89
85
|
],
|
|
90
|
-
"ignoreCatch": true,
|
|
91
86
|
"strict": true
|
|
92
87
|
},
|
|
93
|
-
"
|
|
94
|
-
|
|
95
|
-
"prettier": true,
|
|
96
|
-
"rules": {
|
|
97
|
-
"unicorn/prefer-at": "off"
|
|
98
|
-
}
|
|
99
|
-
}
|
|
88
|
+
"type": "module",
|
|
89
|
+
"version": "5.2.0"
|
|
100
90
|
}
|