@songtonyli/dsh-cli 0.1.85 → 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.
@@ -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.0.0"
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": "^25.0.0",
58
- "c8": "^10.0.0",
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": "^5.0.0",
68
- "xo": "^1.0.0"
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
- "xo": {
94
- "space": true,
95
- "prettier": true,
96
- "rules": {
97
- "unicorn/prefer-at": "off"
98
- }
99
- }
88
+ "type": "module",
89
+ "version": "5.2.0"
100
90
  }
@@ -14,17 +14,21 @@
14
14
  * [Install](#install)
15
15
  * [Use](#use)
16
16
  * [API](#api)
17
- * [`visit(tree[, test], visitor[, reverse])`](#visittree-test-visitor-reverse)
17
+ * [`visit(tree[, test], enter|visitors[, reverse])`](#visittree-test-entervisitors-reverse)
18
18
  * [`CONTINUE`](#continue)
19
19
  * [`EXIT`](#exit)
20
20
  * [`SKIP`](#skip)
21
21
  * [`Action`](#action)
22
22
  * [`ActionTuple`](#actiontuple)
23
23
  * [`BuildVisitor`](#buildvisitor)
24
+ * [`BuildVisitors`](#buildvisitors)
24
25
  * [`Index`](#index)
25
26
  * [`Test`](#test)
26
27
  * [`Visitor`](#visitor)
28
+ * [`VisitorExit`](#visitorexit)
27
29
  * [`VisitorResult`](#visitorresult)
30
+ * [`VisitorResultExit`](#visitorresultexit)
31
+ * [`Visitors`](#visitors)
28
32
  * [Compatibility](#compatibility)
29
33
  * [Related](#related)
30
34
  * [Contribute](#contribute)
@@ -100,17 +104,27 @@ It exports the [TypeScript][] types
100
104
  [`ActionTuple`][api-action-tuple],
101
105
  [`Action`][api-action],
102
106
  [`BuildVisitor`][api-build-visitor],
107
+ [`BuildVisitors`][api-build-visitors],
103
108
  [`Index`][api-index],
104
109
  [`Test`][api-test],
105
- [`VisitorResult`][api-visitor-result], and
110
+ [`VisitorExit`][api-visitor-exit],
111
+ [`VisitorResultExit`][api-visitor-result-exit],
112
+ [`VisitorResult`][api-visitor-result],
113
+ [`Visitors`][api-visitors], and
106
114
  [`Visitor`][api-visitor].
107
115
  There is no default export.
108
116
 
109
- ### `visit(tree[, test], visitor[, reverse])`
117
+ ### `visit(tree[, test], enter|visitors[, reverse])`
110
118
 
111
119
  This function works exactly the same as
112
120
  [`unist-util-visit-parents`][github-vp],
113
- but [`Visitor`][api-visitor] has a different signature.
121
+ but [`Visitor`][api-visitor] and [`VisitorExit`][api-visitor-exit] have a
122
+ different signature.
123
+
124
+ ###### Signatures
125
+
126
+ * `visit(tree[, test], enter[, reverse])`
127
+ * `visit(tree[, test], visitors[, reverse])`
114
128
 
115
129
  ### `CONTINUE`
116
130
 
@@ -139,6 +153,12 @@ See [`ActionTuple` in `unist-util-visit-parents`][github-vp-action-tuple].
139
153
  Build a typed `Visitor` function from a tree and a test (TypeScript type).
140
154
  See [`BuildVisitor` in `unist-util-visit-parents`][github-vp-build-visitor].
141
155
 
156
+ ### `BuildVisitors`
157
+
158
+ Build typed [`Visitors`][api-visitors] from a tree and a test (TypeScript
159
+ type).
160
+ See [`BuildVisitors` in `unist-util-visit-parents`][github-vp-build-visitors].
161
+
142
162
  ### `Index`
143
163
 
144
164
  Move to the sibling at `index` next (TypeScript type).
@@ -151,42 +171,46 @@ See [`Index` in `unist-util-visit-parents`][github-vp-index].
151
171
 
152
172
  ### `Visitor`
153
173
 
154
- Handle a node (matching `test`, if given) (TypeScript type).
174
+ Handle a node (matching `test`, if given) before its children (TypeScript
175
+ type).
176
+ Like [`Visitor` in `unist-util-visit-parents`][github-vp-visitor],
177
+ but with `index` and `parent` instead of `parents`.
155
178
 
156
- Visitors are free to transform `node`.
157
- They can also transform `parent`.
179
+ ###### Parameters
158
180
 
159
- Replacing `node` itself, if `SKIP` is not returned, still causes its
160
- descendants to be walked (which is a bug).
181
+ * `node` ([`Node`][github-unist-node])
182
+ — found node
183
+ * `index` (`number` or `undefined`)
184
+ — index of `node` in `parent`,
185
+ or `undefined` for the tree itself
186
+ * `parent` ([`Node`][github-unist-node] or `undefined`)
187
+ — parent of `node`,
188
+ or `undefined` for the tree itself
189
+
190
+ ###### Returns
191
+
192
+ What to do next ([`VisitorResult`][api-visitor-result]).
161
193
 
162
- When adding or removing previous siblings of `node` (or next siblings, in
163
- case of reverse), the `Visitor` should return a new `Index` to specify the
164
- sibling to traverse after `node` is traversed.
165
- Adding or removing next siblings of `node` (or previous siblings, in case
166
- of reverse) is handled as expected without needing to return a new `Index`.
194
+ ### `VisitorExit`
167
195
 
168
- Removing the children property of `parent` still results in them being
169
- traversed.
196
+ Handle a node (matching `test`, if given) after its children (TypeScript type).
197
+ Like [`VisitorExit` in `unist-util-visit-parents`][github-vp-visitor-exit],
198
+ but with `index` and `parent` instead of `parents`.
170
199
 
171
200
  ###### Parameters
172
201
 
173
202
  * `node` ([`Node`][github-unist-node])
174
203
  — found node
175
204
  * `index` (`number` or `undefined`)
176
- — index of `node` in `parent`
205
+ — index of `node` in `parent`,
206
+ or `undefined` for the tree itself
177
207
  * `parent` ([`Node`][github-unist-node] or `undefined`)
178
- — parent of `node`
208
+ — parent of `node`,
209
+ or `undefined` for the tree itself
179
210
 
180
211
  ###### Returns
181
212
 
182
- What to do next.
183
-
184
- An `Index` is treated as a tuple of `[CONTINUE, Index]`.
185
- An `Action` is treated as a tuple of `[Action]`.
186
-
187
- Passing a tuple back only makes sense if the `Action` is `SKIP`.
188
- When the `Action` is `EXIT`, that action can be returned.
189
- When the `Action` is `CONTINUE`, `Index` can be returned.
213
+ What to do next ([`VisitorResultExit`][api-visitor-result-exit]).
190
214
 
191
215
  ### `VisitorResult`
192
216
 
@@ -194,6 +218,24 @@ Any value that can be returned from a visitor (TypeScript type).
194
218
  See [`VisitorResult` in
195
219
  `unist-util-visit-parents`][github-vp-visitor-result].
196
220
 
221
+ ### `VisitorResultExit`
222
+
223
+ Any value that can be returned from an exit visitor (TypeScript type).
224
+ See [`VisitorResultExit` in
225
+ `unist-util-visit-parents`][github-vp-visitor-result-exit].
226
+
227
+ ### `Visitors`
228
+
229
+ Handle nodes when entering and exiting them (TypeScript type).
230
+ See [`Visitors` in `unist-util-visit-parents`][github-vp-visitors].
231
+
232
+ ###### Fields
233
+
234
+ * `enter` ([`Visitor`][api-visitor], optional)
235
+ — handle a node before its children
236
+ * `exit` ([`VisitorExit`][api-visitor-exit])
237
+ — handle a node after its children
238
+
197
239
  ## Compatibility
198
240
 
199
241
  Projects maintained by the unified collective are compatible with maintained
@@ -242,6 +284,8 @@ or community you agree to abide by its terms.
242
284
 
243
285
  [api-build-visitor]: #buildvisitor
244
286
 
287
+ [api-build-visitors]: #buildvisitors
288
+
245
289
  [api-continue]: #continue
246
290
 
247
291
  [api-exit]: #exit
@@ -252,12 +296,18 @@ or community you agree to abide by its terms.
252
296
 
253
297
  [api-test]: #test
254
298
 
255
- [api-visit]: #visittree-test-visitor-reverse
299
+ [api-visit]: #visittree-test-entervisitors-reverse
256
300
 
257
301
  [api-visitor]: #visitor
258
302
 
303
+ [api-visitor-exit]: #visitorexit
304
+
259
305
  [api-visitor-result]: #visitorresult
260
306
 
307
+ [api-visitor-result-exit]: #visitorresultexit
308
+
309
+ [api-visitors]: #visitors
310
+
261
311
  [badge-build-image]: https://github.com/syntax-tree/unist-util-visit/workflows/main/badge.svg
262
312
 
263
313
  [badge-build-url]: https://github.com/syntax-tree/unist-util-visit/actions
@@ -294,10 +344,20 @@ or community you agree to abide by its terms.
294
344
 
295
345
  [github-vp-build-visitor]: https://github.com/syntax-tree/unist-util-visit-parents#buildvisitor
296
346
 
347
+ [github-vp-build-visitors]: https://github.com/syntax-tree/unist-util-visit-parents#buildvisitors
348
+
297
349
  [github-vp-index]: https://github.com/syntax-tree/unist-util-visit-parents#index
298
350
 
351
+ [github-vp-visitor]: https://github.com/syntax-tree/unist-util-visit-parents#visitor
352
+
353
+ [github-vp-visitor-exit]: https://github.com/syntax-tree/unist-util-visit-parents#visitorexit
354
+
299
355
  [github-vp-visitor-result]: https://github.com/syntax-tree/unist-util-visit-parents#visitorresult
300
356
 
357
+ [github-vp-visitor-result-exit]: https://github.com/syntax-tree/unist-util-visit-parents#visitorresultexit
358
+
359
+ [github-vp-visitors]: https://github.com/syntax-tree/unist-util-visit-parents#visitors
360
+
301
361
  [health]: https://github.com/syntax-tree/.github
302
362
 
303
363
  [health-coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md
@@ -1,6 +1,10 @@
1
1
  /**
2
+ * Color a string.
3
+ *
2
4
  * @param {string} d
5
+ * Value.
3
6
  * @returns {string}
7
+ * Colored value.
4
8
  */
5
9
  export function color(d) {
6
10
  return d
@@ -1,6 +1,10 @@
1
1
  /**
2
+ * Color a string.
3
+ *
2
4
  * @param {string} d
5
+ * Value.
3
6
  * @returns {string}
7
+ * Colored value.
4
8
  */
5
9
  export function color(d) {
6
10
  return '\u001B[33m' + d + '\u001B[39m'