@xyd-js/plugins 0.0.0-build-2acf05c-20251207022018 → 0.0.0-build-83b15db-20251213220910
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/CHANGELOG.md +3 -3
- package/dist/index.d.ts +3491 -17
- package/package.json +3 -3
- package/src/index.ts +47 -16
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,3457 @@
|
|
|
1
|
-
import { Plugin as Plugin$
|
|
1
|
+
import { Plugin as Plugin$2 } from 'vite';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import React__default from 'react';
|
|
4
|
+
import * as unist from 'unist';
|
|
5
|
+
import { Node as Node$1, Point, Position } from 'unist';
|
|
4
6
|
import { UniformPlugin } from '@xyd-js/uniform';
|
|
5
7
|
|
|
8
|
+
/**
|
|
9
|
+
* Message.
|
|
10
|
+
*/
|
|
11
|
+
declare class VFileMessage extends Error {
|
|
12
|
+
/**
|
|
13
|
+
* Create a message for `reason`.
|
|
14
|
+
*
|
|
15
|
+
* > 🪦 **Note**: also has obsolete signatures.
|
|
16
|
+
*
|
|
17
|
+
* @overload
|
|
18
|
+
* @param {string} reason
|
|
19
|
+
* @param {Options | null | undefined} [options]
|
|
20
|
+
* @returns
|
|
21
|
+
*
|
|
22
|
+
* @overload
|
|
23
|
+
* @param {string} reason
|
|
24
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
25
|
+
* @param {string | null | undefined} [origin]
|
|
26
|
+
* @returns
|
|
27
|
+
*
|
|
28
|
+
* @overload
|
|
29
|
+
* @param {string} reason
|
|
30
|
+
* @param {Point | Position | null | undefined} place
|
|
31
|
+
* @param {string | null | undefined} [origin]
|
|
32
|
+
* @returns
|
|
33
|
+
*
|
|
34
|
+
* @overload
|
|
35
|
+
* @param {string} reason
|
|
36
|
+
* @param {string | null | undefined} [origin]
|
|
37
|
+
* @returns
|
|
38
|
+
*
|
|
39
|
+
* @overload
|
|
40
|
+
* @param {Error | VFileMessage} cause
|
|
41
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
42
|
+
* @param {string | null | undefined} [origin]
|
|
43
|
+
* @returns
|
|
44
|
+
*
|
|
45
|
+
* @overload
|
|
46
|
+
* @param {Error | VFileMessage} cause
|
|
47
|
+
* @param {Point | Position | null | undefined} place
|
|
48
|
+
* @param {string | null | undefined} [origin]
|
|
49
|
+
* @returns
|
|
50
|
+
*
|
|
51
|
+
* @overload
|
|
52
|
+
* @param {Error | VFileMessage} cause
|
|
53
|
+
* @param {string | null | undefined} [origin]
|
|
54
|
+
* @returns
|
|
55
|
+
*
|
|
56
|
+
* @param {Error | VFileMessage | string} causeOrReason
|
|
57
|
+
* Reason for message, should use markdown.
|
|
58
|
+
* @param {Node | NodeLike | Options | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
|
|
59
|
+
* Configuration (optional).
|
|
60
|
+
* @param {string | null | undefined} [origin]
|
|
61
|
+
* Place in code where the message originates (example:
|
|
62
|
+
* `'my-package:my-rule'` or `'my-rule'`).
|
|
63
|
+
* @returns
|
|
64
|
+
* Instance of `VFileMessage`.
|
|
65
|
+
*/
|
|
66
|
+
constructor(reason: string, options?: Options$3 | null | undefined);
|
|
67
|
+
/**
|
|
68
|
+
* Create a message for `reason`.
|
|
69
|
+
*
|
|
70
|
+
* > 🪦 **Note**: also has obsolete signatures.
|
|
71
|
+
*
|
|
72
|
+
* @overload
|
|
73
|
+
* @param {string} reason
|
|
74
|
+
* @param {Options | null | undefined} [options]
|
|
75
|
+
* @returns
|
|
76
|
+
*
|
|
77
|
+
* @overload
|
|
78
|
+
* @param {string} reason
|
|
79
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
80
|
+
* @param {string | null | undefined} [origin]
|
|
81
|
+
* @returns
|
|
82
|
+
*
|
|
83
|
+
* @overload
|
|
84
|
+
* @param {string} reason
|
|
85
|
+
* @param {Point | Position | null | undefined} place
|
|
86
|
+
* @param {string | null | undefined} [origin]
|
|
87
|
+
* @returns
|
|
88
|
+
*
|
|
89
|
+
* @overload
|
|
90
|
+
* @param {string} reason
|
|
91
|
+
* @param {string | null | undefined} [origin]
|
|
92
|
+
* @returns
|
|
93
|
+
*
|
|
94
|
+
* @overload
|
|
95
|
+
* @param {Error | VFileMessage} cause
|
|
96
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
97
|
+
* @param {string | null | undefined} [origin]
|
|
98
|
+
* @returns
|
|
99
|
+
*
|
|
100
|
+
* @overload
|
|
101
|
+
* @param {Error | VFileMessage} cause
|
|
102
|
+
* @param {Point | Position | null | undefined} place
|
|
103
|
+
* @param {string | null | undefined} [origin]
|
|
104
|
+
* @returns
|
|
105
|
+
*
|
|
106
|
+
* @overload
|
|
107
|
+
* @param {Error | VFileMessage} cause
|
|
108
|
+
* @param {string | null | undefined} [origin]
|
|
109
|
+
* @returns
|
|
110
|
+
*
|
|
111
|
+
* @param {Error | VFileMessage | string} causeOrReason
|
|
112
|
+
* Reason for message, should use markdown.
|
|
113
|
+
* @param {Node | NodeLike | Options | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
|
|
114
|
+
* Configuration (optional).
|
|
115
|
+
* @param {string | null | undefined} [origin]
|
|
116
|
+
* Place in code where the message originates (example:
|
|
117
|
+
* `'my-package:my-rule'` or `'my-rule'`).
|
|
118
|
+
* @returns
|
|
119
|
+
* Instance of `VFileMessage`.
|
|
120
|
+
*/
|
|
121
|
+
constructor(reason: string, parent: Node$1 | NodeLike$1 | null | undefined, origin?: string | null | undefined);
|
|
122
|
+
/**
|
|
123
|
+
* Create a message for `reason`.
|
|
124
|
+
*
|
|
125
|
+
* > 🪦 **Note**: also has obsolete signatures.
|
|
126
|
+
*
|
|
127
|
+
* @overload
|
|
128
|
+
* @param {string} reason
|
|
129
|
+
* @param {Options | null | undefined} [options]
|
|
130
|
+
* @returns
|
|
131
|
+
*
|
|
132
|
+
* @overload
|
|
133
|
+
* @param {string} reason
|
|
134
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
135
|
+
* @param {string | null | undefined} [origin]
|
|
136
|
+
* @returns
|
|
137
|
+
*
|
|
138
|
+
* @overload
|
|
139
|
+
* @param {string} reason
|
|
140
|
+
* @param {Point | Position | null | undefined} place
|
|
141
|
+
* @param {string | null | undefined} [origin]
|
|
142
|
+
* @returns
|
|
143
|
+
*
|
|
144
|
+
* @overload
|
|
145
|
+
* @param {string} reason
|
|
146
|
+
* @param {string | null | undefined} [origin]
|
|
147
|
+
* @returns
|
|
148
|
+
*
|
|
149
|
+
* @overload
|
|
150
|
+
* @param {Error | VFileMessage} cause
|
|
151
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
152
|
+
* @param {string | null | undefined} [origin]
|
|
153
|
+
* @returns
|
|
154
|
+
*
|
|
155
|
+
* @overload
|
|
156
|
+
* @param {Error | VFileMessage} cause
|
|
157
|
+
* @param {Point | Position | null | undefined} place
|
|
158
|
+
* @param {string | null | undefined} [origin]
|
|
159
|
+
* @returns
|
|
160
|
+
*
|
|
161
|
+
* @overload
|
|
162
|
+
* @param {Error | VFileMessage} cause
|
|
163
|
+
* @param {string | null | undefined} [origin]
|
|
164
|
+
* @returns
|
|
165
|
+
*
|
|
166
|
+
* @param {Error | VFileMessage | string} causeOrReason
|
|
167
|
+
* Reason for message, should use markdown.
|
|
168
|
+
* @param {Node | NodeLike | Options | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
|
|
169
|
+
* Configuration (optional).
|
|
170
|
+
* @param {string | null | undefined} [origin]
|
|
171
|
+
* Place in code where the message originates (example:
|
|
172
|
+
* `'my-package:my-rule'` or `'my-rule'`).
|
|
173
|
+
* @returns
|
|
174
|
+
* Instance of `VFileMessage`.
|
|
175
|
+
*/
|
|
176
|
+
constructor(reason: string, place: Point | Position | null | undefined, origin?: string | null | undefined);
|
|
177
|
+
/**
|
|
178
|
+
* Create a message for `reason`.
|
|
179
|
+
*
|
|
180
|
+
* > 🪦 **Note**: also has obsolete signatures.
|
|
181
|
+
*
|
|
182
|
+
* @overload
|
|
183
|
+
* @param {string} reason
|
|
184
|
+
* @param {Options | null | undefined} [options]
|
|
185
|
+
* @returns
|
|
186
|
+
*
|
|
187
|
+
* @overload
|
|
188
|
+
* @param {string} reason
|
|
189
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
190
|
+
* @param {string | null | undefined} [origin]
|
|
191
|
+
* @returns
|
|
192
|
+
*
|
|
193
|
+
* @overload
|
|
194
|
+
* @param {string} reason
|
|
195
|
+
* @param {Point | Position | null | undefined} place
|
|
196
|
+
* @param {string | null | undefined} [origin]
|
|
197
|
+
* @returns
|
|
198
|
+
*
|
|
199
|
+
* @overload
|
|
200
|
+
* @param {string} reason
|
|
201
|
+
* @param {string | null | undefined} [origin]
|
|
202
|
+
* @returns
|
|
203
|
+
*
|
|
204
|
+
* @overload
|
|
205
|
+
* @param {Error | VFileMessage} cause
|
|
206
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
207
|
+
* @param {string | null | undefined} [origin]
|
|
208
|
+
* @returns
|
|
209
|
+
*
|
|
210
|
+
* @overload
|
|
211
|
+
* @param {Error | VFileMessage} cause
|
|
212
|
+
* @param {Point | Position | null | undefined} place
|
|
213
|
+
* @param {string | null | undefined} [origin]
|
|
214
|
+
* @returns
|
|
215
|
+
*
|
|
216
|
+
* @overload
|
|
217
|
+
* @param {Error | VFileMessage} cause
|
|
218
|
+
* @param {string | null | undefined} [origin]
|
|
219
|
+
* @returns
|
|
220
|
+
*
|
|
221
|
+
* @param {Error | VFileMessage | string} causeOrReason
|
|
222
|
+
* Reason for message, should use markdown.
|
|
223
|
+
* @param {Node | NodeLike | Options | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
|
|
224
|
+
* Configuration (optional).
|
|
225
|
+
* @param {string | null | undefined} [origin]
|
|
226
|
+
* Place in code where the message originates (example:
|
|
227
|
+
* `'my-package:my-rule'` or `'my-rule'`).
|
|
228
|
+
* @returns
|
|
229
|
+
* Instance of `VFileMessage`.
|
|
230
|
+
*/
|
|
231
|
+
constructor(reason: string, origin?: string | null | undefined);
|
|
232
|
+
/**
|
|
233
|
+
* Create a message for `reason`.
|
|
234
|
+
*
|
|
235
|
+
* > 🪦 **Note**: also has obsolete signatures.
|
|
236
|
+
*
|
|
237
|
+
* @overload
|
|
238
|
+
* @param {string} reason
|
|
239
|
+
* @param {Options | null | undefined} [options]
|
|
240
|
+
* @returns
|
|
241
|
+
*
|
|
242
|
+
* @overload
|
|
243
|
+
* @param {string} reason
|
|
244
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
245
|
+
* @param {string | null | undefined} [origin]
|
|
246
|
+
* @returns
|
|
247
|
+
*
|
|
248
|
+
* @overload
|
|
249
|
+
* @param {string} reason
|
|
250
|
+
* @param {Point | Position | null | undefined} place
|
|
251
|
+
* @param {string | null | undefined} [origin]
|
|
252
|
+
* @returns
|
|
253
|
+
*
|
|
254
|
+
* @overload
|
|
255
|
+
* @param {string} reason
|
|
256
|
+
* @param {string | null | undefined} [origin]
|
|
257
|
+
* @returns
|
|
258
|
+
*
|
|
259
|
+
* @overload
|
|
260
|
+
* @param {Error | VFileMessage} cause
|
|
261
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
262
|
+
* @param {string | null | undefined} [origin]
|
|
263
|
+
* @returns
|
|
264
|
+
*
|
|
265
|
+
* @overload
|
|
266
|
+
* @param {Error | VFileMessage} cause
|
|
267
|
+
* @param {Point | Position | null | undefined} place
|
|
268
|
+
* @param {string | null | undefined} [origin]
|
|
269
|
+
* @returns
|
|
270
|
+
*
|
|
271
|
+
* @overload
|
|
272
|
+
* @param {Error | VFileMessage} cause
|
|
273
|
+
* @param {string | null | undefined} [origin]
|
|
274
|
+
* @returns
|
|
275
|
+
*
|
|
276
|
+
* @param {Error | VFileMessage | string} causeOrReason
|
|
277
|
+
* Reason for message, should use markdown.
|
|
278
|
+
* @param {Node | NodeLike | Options | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
|
|
279
|
+
* Configuration (optional).
|
|
280
|
+
* @param {string | null | undefined} [origin]
|
|
281
|
+
* Place in code where the message originates (example:
|
|
282
|
+
* `'my-package:my-rule'` or `'my-rule'`).
|
|
283
|
+
* @returns
|
|
284
|
+
* Instance of `VFileMessage`.
|
|
285
|
+
*/
|
|
286
|
+
constructor(cause: Error | VFileMessage, parent: Node$1 | NodeLike$1 | null | undefined, origin?: string | null | undefined);
|
|
287
|
+
/**
|
|
288
|
+
* Create a message for `reason`.
|
|
289
|
+
*
|
|
290
|
+
* > 🪦 **Note**: also has obsolete signatures.
|
|
291
|
+
*
|
|
292
|
+
* @overload
|
|
293
|
+
* @param {string} reason
|
|
294
|
+
* @param {Options | null | undefined} [options]
|
|
295
|
+
* @returns
|
|
296
|
+
*
|
|
297
|
+
* @overload
|
|
298
|
+
* @param {string} reason
|
|
299
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
300
|
+
* @param {string | null | undefined} [origin]
|
|
301
|
+
* @returns
|
|
302
|
+
*
|
|
303
|
+
* @overload
|
|
304
|
+
* @param {string} reason
|
|
305
|
+
* @param {Point | Position | null | undefined} place
|
|
306
|
+
* @param {string | null | undefined} [origin]
|
|
307
|
+
* @returns
|
|
308
|
+
*
|
|
309
|
+
* @overload
|
|
310
|
+
* @param {string} reason
|
|
311
|
+
* @param {string | null | undefined} [origin]
|
|
312
|
+
* @returns
|
|
313
|
+
*
|
|
314
|
+
* @overload
|
|
315
|
+
* @param {Error | VFileMessage} cause
|
|
316
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
317
|
+
* @param {string | null | undefined} [origin]
|
|
318
|
+
* @returns
|
|
319
|
+
*
|
|
320
|
+
* @overload
|
|
321
|
+
* @param {Error | VFileMessage} cause
|
|
322
|
+
* @param {Point | Position | null | undefined} place
|
|
323
|
+
* @param {string | null | undefined} [origin]
|
|
324
|
+
* @returns
|
|
325
|
+
*
|
|
326
|
+
* @overload
|
|
327
|
+
* @param {Error | VFileMessage} cause
|
|
328
|
+
* @param {string | null | undefined} [origin]
|
|
329
|
+
* @returns
|
|
330
|
+
*
|
|
331
|
+
* @param {Error | VFileMessage | string} causeOrReason
|
|
332
|
+
* Reason for message, should use markdown.
|
|
333
|
+
* @param {Node | NodeLike | Options | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
|
|
334
|
+
* Configuration (optional).
|
|
335
|
+
* @param {string | null | undefined} [origin]
|
|
336
|
+
* Place in code where the message originates (example:
|
|
337
|
+
* `'my-package:my-rule'` or `'my-rule'`).
|
|
338
|
+
* @returns
|
|
339
|
+
* Instance of `VFileMessage`.
|
|
340
|
+
*/
|
|
341
|
+
constructor(cause: Error | VFileMessage, place: Point | Position | null | undefined, origin?: string | null | undefined);
|
|
342
|
+
/**
|
|
343
|
+
* Create a message for `reason`.
|
|
344
|
+
*
|
|
345
|
+
* > 🪦 **Note**: also has obsolete signatures.
|
|
346
|
+
*
|
|
347
|
+
* @overload
|
|
348
|
+
* @param {string} reason
|
|
349
|
+
* @param {Options | null | undefined} [options]
|
|
350
|
+
* @returns
|
|
351
|
+
*
|
|
352
|
+
* @overload
|
|
353
|
+
* @param {string} reason
|
|
354
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
355
|
+
* @param {string | null | undefined} [origin]
|
|
356
|
+
* @returns
|
|
357
|
+
*
|
|
358
|
+
* @overload
|
|
359
|
+
* @param {string} reason
|
|
360
|
+
* @param {Point | Position | null | undefined} place
|
|
361
|
+
* @param {string | null | undefined} [origin]
|
|
362
|
+
* @returns
|
|
363
|
+
*
|
|
364
|
+
* @overload
|
|
365
|
+
* @param {string} reason
|
|
366
|
+
* @param {string | null | undefined} [origin]
|
|
367
|
+
* @returns
|
|
368
|
+
*
|
|
369
|
+
* @overload
|
|
370
|
+
* @param {Error | VFileMessage} cause
|
|
371
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
372
|
+
* @param {string | null | undefined} [origin]
|
|
373
|
+
* @returns
|
|
374
|
+
*
|
|
375
|
+
* @overload
|
|
376
|
+
* @param {Error | VFileMessage} cause
|
|
377
|
+
* @param {Point | Position | null | undefined} place
|
|
378
|
+
* @param {string | null | undefined} [origin]
|
|
379
|
+
* @returns
|
|
380
|
+
*
|
|
381
|
+
* @overload
|
|
382
|
+
* @param {Error | VFileMessage} cause
|
|
383
|
+
* @param {string | null | undefined} [origin]
|
|
384
|
+
* @returns
|
|
385
|
+
*
|
|
386
|
+
* @param {Error | VFileMessage | string} causeOrReason
|
|
387
|
+
* Reason for message, should use markdown.
|
|
388
|
+
* @param {Node | NodeLike | Options | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
|
|
389
|
+
* Configuration (optional).
|
|
390
|
+
* @param {string | null | undefined} [origin]
|
|
391
|
+
* Place in code where the message originates (example:
|
|
392
|
+
* `'my-package:my-rule'` or `'my-rule'`).
|
|
393
|
+
* @returns
|
|
394
|
+
* Instance of `VFileMessage`.
|
|
395
|
+
*/
|
|
396
|
+
constructor(cause: Error | VFileMessage, origin?: string | null | undefined);
|
|
397
|
+
/**
|
|
398
|
+
* Stack of ancestor nodes surrounding the message.
|
|
399
|
+
*
|
|
400
|
+
* @type {Array<Node> | undefined}
|
|
401
|
+
*/
|
|
402
|
+
ancestors: Array<Node$1> | undefined;
|
|
403
|
+
/**
|
|
404
|
+
* Starting column of message.
|
|
405
|
+
*
|
|
406
|
+
* @type {number | undefined}
|
|
407
|
+
*/
|
|
408
|
+
column: number | undefined;
|
|
409
|
+
/**
|
|
410
|
+
* State of problem.
|
|
411
|
+
*
|
|
412
|
+
* * `true` — error, file not usable
|
|
413
|
+
* * `false` — warning, change may be needed
|
|
414
|
+
* * `undefined` — change likely not needed
|
|
415
|
+
*
|
|
416
|
+
* @type {boolean | null | undefined}
|
|
417
|
+
*/
|
|
418
|
+
fatal: boolean | null | undefined;
|
|
419
|
+
/**
|
|
420
|
+
* Path of a file (used throughout the `VFile` ecosystem).
|
|
421
|
+
*
|
|
422
|
+
* @type {string | undefined}
|
|
423
|
+
*/
|
|
424
|
+
file: string | undefined;
|
|
425
|
+
/**
|
|
426
|
+
* Starting line of error.
|
|
427
|
+
*
|
|
428
|
+
* @type {number | undefined}
|
|
429
|
+
*/
|
|
430
|
+
line: number | undefined;
|
|
431
|
+
/**
|
|
432
|
+
* Place of message.
|
|
433
|
+
*
|
|
434
|
+
* @type {Point | Position | undefined}
|
|
435
|
+
*/
|
|
436
|
+
place: Point | Position | undefined;
|
|
437
|
+
/**
|
|
438
|
+
* Reason for message, should use markdown.
|
|
439
|
+
*
|
|
440
|
+
* @type {string}
|
|
441
|
+
*/
|
|
442
|
+
reason: string;
|
|
443
|
+
/**
|
|
444
|
+
* Category of message (example: `'my-rule'`).
|
|
445
|
+
*
|
|
446
|
+
* @type {string | undefined}
|
|
447
|
+
*/
|
|
448
|
+
ruleId: string | undefined;
|
|
449
|
+
/**
|
|
450
|
+
* Namespace of message (example: `'my-package'`).
|
|
451
|
+
*
|
|
452
|
+
* @type {string | undefined}
|
|
453
|
+
*/
|
|
454
|
+
source: string | undefined;
|
|
455
|
+
/**
|
|
456
|
+
* Specify the source value that’s being reported, which is deemed
|
|
457
|
+
* incorrect.
|
|
458
|
+
*
|
|
459
|
+
* @type {string | undefined}
|
|
460
|
+
*/
|
|
461
|
+
actual: string | undefined;
|
|
462
|
+
/**
|
|
463
|
+
* Suggest acceptable values that can be used instead of `actual`.
|
|
464
|
+
*
|
|
465
|
+
* @type {Array<string> | undefined}
|
|
466
|
+
*/
|
|
467
|
+
expected: Array<string> | undefined;
|
|
468
|
+
/**
|
|
469
|
+
* Long form description of the message (you should use markdown).
|
|
470
|
+
*
|
|
471
|
+
* @type {string | undefined}
|
|
472
|
+
*/
|
|
473
|
+
note: string | undefined;
|
|
474
|
+
/**
|
|
475
|
+
* Link to docs for the message.
|
|
476
|
+
*
|
|
477
|
+
* > 👉 **Note**: this must be an absolute URL that can be passed as `x`
|
|
478
|
+
* > to `new URL(x)`.
|
|
479
|
+
*
|
|
480
|
+
* @type {string | undefined}
|
|
481
|
+
*/
|
|
482
|
+
url: string | undefined;
|
|
483
|
+
}
|
|
484
|
+
type NodeLike$1 = object & {
|
|
485
|
+
type: string;
|
|
486
|
+
position?: Position | undefined;
|
|
487
|
+
};
|
|
488
|
+
/**
|
|
489
|
+
* Configuration.
|
|
490
|
+
*/
|
|
491
|
+
type Options$3 = {
|
|
492
|
+
/**
|
|
493
|
+
* Stack of (inclusive) ancestor nodes surrounding the message (optional).
|
|
494
|
+
*/
|
|
495
|
+
ancestors?: Array<Node$1> | null | undefined;
|
|
496
|
+
/**
|
|
497
|
+
* Original error cause of the message (optional).
|
|
498
|
+
*/
|
|
499
|
+
cause?: Error | null | undefined;
|
|
500
|
+
/**
|
|
501
|
+
* Place of message (optional).
|
|
502
|
+
*/
|
|
503
|
+
place?: Point | Position | null | undefined;
|
|
504
|
+
/**
|
|
505
|
+
* Category of message (optional, example: `'my-rule'`).
|
|
506
|
+
*/
|
|
507
|
+
ruleId?: string | null | undefined;
|
|
508
|
+
/**
|
|
509
|
+
* Namespace of who sent the message (optional, example: `'my-package'`).
|
|
510
|
+
*/
|
|
511
|
+
source?: string | null | undefined;
|
|
512
|
+
};
|
|
513
|
+
|
|
514
|
+
type Options$2 = Options$3;
|
|
515
|
+
|
|
516
|
+
// See: <https://github.com/sindresorhus/type-fest/blob/main/source/empty-object.d.ts>
|
|
517
|
+
declare const emptyObjectSymbol$3: unique symbol
|
|
518
|
+
|
|
519
|
+
|
|
520
|
+
/**
|
|
521
|
+
* Things that can be passed to the constructor.
|
|
522
|
+
*/
|
|
523
|
+
type Compatible$2 = Options$1 | URL | VFile | Value$2
|
|
524
|
+
|
|
525
|
+
/**
|
|
526
|
+
* Raw source map.
|
|
527
|
+
*
|
|
528
|
+
* See:
|
|
529
|
+
* <https://github.com/mozilla/source-map/blob/60adcb0/source-map.d.ts#L15-L23>.
|
|
530
|
+
*/
|
|
531
|
+
interface Map {
|
|
532
|
+
/**
|
|
533
|
+
* The generated file this source map is associated with.
|
|
534
|
+
*/
|
|
535
|
+
file: string
|
|
536
|
+
/**
|
|
537
|
+
* A string of base64 VLQs which contain the actual mappings.
|
|
538
|
+
*/
|
|
539
|
+
mappings: string
|
|
540
|
+
/**
|
|
541
|
+
* An array of identifiers which can be referenced by individual mappings.
|
|
542
|
+
*/
|
|
543
|
+
names: Array<string>
|
|
544
|
+
/**
|
|
545
|
+
* An array of contents of the original source files.
|
|
546
|
+
*/
|
|
547
|
+
sourcesContent?: Array<string> | undefined
|
|
548
|
+
/**
|
|
549
|
+
* The URL root from which all sources are relative.
|
|
550
|
+
*/
|
|
551
|
+
sourceRoot?: string | undefined
|
|
552
|
+
/**
|
|
553
|
+
* An array of URLs to the original source files.
|
|
554
|
+
*/
|
|
555
|
+
sources: Array<string>
|
|
556
|
+
/**
|
|
557
|
+
* Which version of the source map spec this map is following.
|
|
558
|
+
*/
|
|
559
|
+
version: number
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
/**
|
|
563
|
+
* This map registers the type of the `data` key of a `VFile`.
|
|
564
|
+
*
|
|
565
|
+
* This type can be augmented to register custom `data` types.
|
|
566
|
+
*
|
|
567
|
+
* @example
|
|
568
|
+
* declare module 'vfile' {
|
|
569
|
+
* interface DataMap {
|
|
570
|
+
* // `file.data.name` is typed as `string`
|
|
571
|
+
* name: string
|
|
572
|
+
* }
|
|
573
|
+
* }
|
|
574
|
+
*/
|
|
575
|
+
interface DataMap$1 {
|
|
576
|
+
[emptyObjectSymbol$3]?: never
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
/**
|
|
580
|
+
* Custom info.
|
|
581
|
+
*
|
|
582
|
+
* Known attributes can be added to {@linkcode DataMap}
|
|
583
|
+
*/
|
|
584
|
+
type Data$4 = Record<string, unknown> & Partial<DataMap$1>
|
|
585
|
+
|
|
586
|
+
/**
|
|
587
|
+
* Configuration.
|
|
588
|
+
*/
|
|
589
|
+
interface Options$1 {
|
|
590
|
+
/**
|
|
591
|
+
* Arbitrary fields that will be shallow copied over to the new file.
|
|
592
|
+
*/
|
|
593
|
+
[key: string]: unknown
|
|
594
|
+
/**
|
|
595
|
+
* Set `basename` (name).
|
|
596
|
+
*/
|
|
597
|
+
basename?: string | null | undefined
|
|
598
|
+
/**
|
|
599
|
+
* Set `cwd` (working directory).
|
|
600
|
+
*/
|
|
601
|
+
cwd?: string | null | undefined
|
|
602
|
+
/**
|
|
603
|
+
* Set `data` (associated info).
|
|
604
|
+
*/
|
|
605
|
+
data?: Data$4 | null | undefined
|
|
606
|
+
/**
|
|
607
|
+
* Set `dirname` (path w/o basename).
|
|
608
|
+
*/
|
|
609
|
+
dirname?: string | null | undefined
|
|
610
|
+
/**
|
|
611
|
+
* Set `extname` (extension with dot).
|
|
612
|
+
*/
|
|
613
|
+
extname?: string | null | undefined
|
|
614
|
+
/**
|
|
615
|
+
* Set `history` (paths the file moved between).
|
|
616
|
+
*/
|
|
617
|
+
history?: Array<string> | null | undefined
|
|
618
|
+
/**
|
|
619
|
+
* Set `path` (current path).
|
|
620
|
+
*/
|
|
621
|
+
path?: URL | string | null | undefined
|
|
622
|
+
/**
|
|
623
|
+
* Set `stem` (name without extension).
|
|
624
|
+
*/
|
|
625
|
+
stem?: string | null | undefined
|
|
626
|
+
/**
|
|
627
|
+
* Set `value` (the contents of the file).
|
|
628
|
+
*/
|
|
629
|
+
value?: Value$2 | null | undefined
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
/**
|
|
633
|
+
* Contents of the file.
|
|
634
|
+
*
|
|
635
|
+
* Can either be text or a `Uint8Array` structure.
|
|
636
|
+
*/
|
|
637
|
+
type Value$2 = Uint8Array | string
|
|
638
|
+
|
|
639
|
+
declare class VFile {
|
|
640
|
+
/**
|
|
641
|
+
* Create a new virtual file.
|
|
642
|
+
*
|
|
643
|
+
* `options` is treated as:
|
|
644
|
+
*
|
|
645
|
+
* * `string` or `Uint8Array` — `{value: options}`
|
|
646
|
+
* * `URL` — `{path: options}`
|
|
647
|
+
* * `VFile` — shallow copies its data over to the new file
|
|
648
|
+
* * `object` — all fields are shallow copied over to the new file
|
|
649
|
+
*
|
|
650
|
+
* Path related fields are set in the following order (least specific to
|
|
651
|
+
* most specific): `history`, `path`, `basename`, `stem`, `extname`,
|
|
652
|
+
* `dirname`.
|
|
653
|
+
*
|
|
654
|
+
* You cannot set `dirname` or `extname` without setting either `history`,
|
|
655
|
+
* `path`, `basename`, or `stem` too.
|
|
656
|
+
*
|
|
657
|
+
* @param {Compatible | null | undefined} [value]
|
|
658
|
+
* File value.
|
|
659
|
+
* @returns
|
|
660
|
+
* New instance.
|
|
661
|
+
*/
|
|
662
|
+
constructor(value?: Compatible$2 | null | undefined);
|
|
663
|
+
/**
|
|
664
|
+
* Base of `path` (default: `process.cwd()` or `'/'` in browsers).
|
|
665
|
+
*
|
|
666
|
+
* @type {string}
|
|
667
|
+
*/
|
|
668
|
+
cwd: string;
|
|
669
|
+
/**
|
|
670
|
+
* Place to store custom info (default: `{}`).
|
|
671
|
+
*
|
|
672
|
+
* It’s OK to store custom data directly on the file but moving it to
|
|
673
|
+
* `data` is recommended.
|
|
674
|
+
*
|
|
675
|
+
* @type {Data}
|
|
676
|
+
*/
|
|
677
|
+
data: Data$4;
|
|
678
|
+
/**
|
|
679
|
+
* List of file paths the file moved between.
|
|
680
|
+
*
|
|
681
|
+
* The first is the original path and the last is the current path.
|
|
682
|
+
*
|
|
683
|
+
* @type {Array<string>}
|
|
684
|
+
*/
|
|
685
|
+
history: Array<string>;
|
|
686
|
+
/**
|
|
687
|
+
* List of messages associated with the file.
|
|
688
|
+
*
|
|
689
|
+
* @type {Array<VFileMessage>}
|
|
690
|
+
*/
|
|
691
|
+
messages: Array<VFileMessage>;
|
|
692
|
+
/**
|
|
693
|
+
* Raw value.
|
|
694
|
+
*
|
|
695
|
+
* @type {Value}
|
|
696
|
+
*/
|
|
697
|
+
value: Value$2;
|
|
698
|
+
/**
|
|
699
|
+
* Source map.
|
|
700
|
+
*
|
|
701
|
+
* This type is equivalent to the `RawSourceMap` type from the `source-map`
|
|
702
|
+
* module.
|
|
703
|
+
*
|
|
704
|
+
* @type {Map | null | undefined}
|
|
705
|
+
*/
|
|
706
|
+
map: Map | null | undefined;
|
|
707
|
+
/**
|
|
708
|
+
* Custom, non-string, compiled, representation.
|
|
709
|
+
*
|
|
710
|
+
* This is used by unified to store non-string results.
|
|
711
|
+
* One example is when turning markdown into React nodes.
|
|
712
|
+
*
|
|
713
|
+
* @type {unknown}
|
|
714
|
+
*/
|
|
715
|
+
result: unknown;
|
|
716
|
+
/**
|
|
717
|
+
* Whether a file was saved to disk.
|
|
718
|
+
*
|
|
719
|
+
* This is used by vfile reporters.
|
|
720
|
+
*
|
|
721
|
+
* @type {boolean}
|
|
722
|
+
*/
|
|
723
|
+
stored: boolean;
|
|
724
|
+
/**
|
|
725
|
+
* Set basename (including extname) (`'index.min.js'`).
|
|
726
|
+
*
|
|
727
|
+
* Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\'`
|
|
728
|
+
* on windows).
|
|
729
|
+
* Cannot be nullified (use `file.path = file.dirname` instead).
|
|
730
|
+
*
|
|
731
|
+
* @param {string} basename
|
|
732
|
+
* Basename.
|
|
733
|
+
* @returns {undefined}
|
|
734
|
+
* Nothing.
|
|
735
|
+
*/
|
|
736
|
+
set basename(basename: string);
|
|
737
|
+
/**
|
|
738
|
+
* Get the basename (including extname) (example: `'index.min.js'`).
|
|
739
|
+
*
|
|
740
|
+
* @returns {string | undefined}
|
|
741
|
+
* Basename.
|
|
742
|
+
*/
|
|
743
|
+
get basename(): string | undefined;
|
|
744
|
+
/**
|
|
745
|
+
* Set the full path (example: `'~/index.min.js'`).
|
|
746
|
+
*
|
|
747
|
+
* Cannot be nullified.
|
|
748
|
+
* You can set a file URL (a `URL` object with a `file:` protocol) which will
|
|
749
|
+
* be turned into a path with `url.fileURLToPath`.
|
|
750
|
+
*
|
|
751
|
+
* @param {URL | string} path
|
|
752
|
+
* Path.
|
|
753
|
+
* @returns {undefined}
|
|
754
|
+
* Nothing.
|
|
755
|
+
*/
|
|
756
|
+
set path(path: string | URL);
|
|
757
|
+
/**
|
|
758
|
+
* Get the full path (example: `'~/index.min.js'`).
|
|
759
|
+
*
|
|
760
|
+
* @returns {string}
|
|
761
|
+
* Path.
|
|
762
|
+
*/
|
|
763
|
+
get path(): string;
|
|
764
|
+
/**
|
|
765
|
+
* Set the parent path (example: `'~'`).
|
|
766
|
+
*
|
|
767
|
+
* Cannot be set if there’s no `path` yet.
|
|
768
|
+
*
|
|
769
|
+
* @param {string | undefined} dirname
|
|
770
|
+
* Dirname.
|
|
771
|
+
* @returns {undefined}
|
|
772
|
+
* Nothing.
|
|
773
|
+
*/
|
|
774
|
+
set dirname(dirname: string | undefined);
|
|
775
|
+
/**
|
|
776
|
+
* Get the parent path (example: `'~'`).
|
|
777
|
+
*
|
|
778
|
+
* @returns {string | undefined}
|
|
779
|
+
* Dirname.
|
|
780
|
+
*/
|
|
781
|
+
get dirname(): string | undefined;
|
|
782
|
+
/**
|
|
783
|
+
* Set the extname (including dot) (example: `'.js'`).
|
|
784
|
+
*
|
|
785
|
+
* Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\'`
|
|
786
|
+
* on windows).
|
|
787
|
+
* Cannot be set if there’s no `path` yet.
|
|
788
|
+
*
|
|
789
|
+
* @param {string | undefined} extname
|
|
790
|
+
* Extname.
|
|
791
|
+
* @returns {undefined}
|
|
792
|
+
* Nothing.
|
|
793
|
+
*/
|
|
794
|
+
set extname(extname: string | undefined);
|
|
795
|
+
/**
|
|
796
|
+
* Get the extname (including dot) (example: `'.js'`).
|
|
797
|
+
*
|
|
798
|
+
* @returns {string | undefined}
|
|
799
|
+
* Extname.
|
|
800
|
+
*/
|
|
801
|
+
get extname(): string | undefined;
|
|
802
|
+
/**
|
|
803
|
+
* Set the stem (basename w/o extname) (example: `'index.min'`).
|
|
804
|
+
*
|
|
805
|
+
* Cannot contain path separators (`'/'` on unix, macOS, and browsers, `'\'`
|
|
806
|
+
* on windows).
|
|
807
|
+
* Cannot be nullified (use `file.path = file.dirname` instead).
|
|
808
|
+
*
|
|
809
|
+
* @param {string} stem
|
|
810
|
+
* Stem.
|
|
811
|
+
* @returns {undefined}
|
|
812
|
+
* Nothing.
|
|
813
|
+
*/
|
|
814
|
+
set stem(stem: string);
|
|
815
|
+
/**
|
|
816
|
+
* Get the stem (basename w/o extname) (example: `'index.min'`).
|
|
817
|
+
*
|
|
818
|
+
* @returns {string | undefined}
|
|
819
|
+
* Stem.
|
|
820
|
+
*/
|
|
821
|
+
get stem(): string | undefined;
|
|
822
|
+
/**
|
|
823
|
+
* Create a fatal message for `reason` associated with the file.
|
|
824
|
+
*
|
|
825
|
+
* The `fatal` field of the message is set to `true` (error; file not usable)
|
|
826
|
+
* and the `file` field is set to the current file path.
|
|
827
|
+
* The message is added to the `messages` field on `file`.
|
|
828
|
+
*
|
|
829
|
+
* > 🪦 **Note**: also has obsolete signatures.
|
|
830
|
+
*
|
|
831
|
+
* @overload
|
|
832
|
+
* @param {string} reason
|
|
833
|
+
* @param {MessageOptions | null | undefined} [options]
|
|
834
|
+
* @returns {never}
|
|
835
|
+
*
|
|
836
|
+
* @overload
|
|
837
|
+
* @param {string} reason
|
|
838
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
839
|
+
* @param {string | null | undefined} [origin]
|
|
840
|
+
* @returns {never}
|
|
841
|
+
*
|
|
842
|
+
* @overload
|
|
843
|
+
* @param {string} reason
|
|
844
|
+
* @param {Point | Position | null | undefined} place
|
|
845
|
+
* @param {string | null | undefined} [origin]
|
|
846
|
+
* @returns {never}
|
|
847
|
+
*
|
|
848
|
+
* @overload
|
|
849
|
+
* @param {string} reason
|
|
850
|
+
* @param {string | null | undefined} [origin]
|
|
851
|
+
* @returns {never}
|
|
852
|
+
*
|
|
853
|
+
* @overload
|
|
854
|
+
* @param {Error | VFileMessage} cause
|
|
855
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
856
|
+
* @param {string | null | undefined} [origin]
|
|
857
|
+
* @returns {never}
|
|
858
|
+
*
|
|
859
|
+
* @overload
|
|
860
|
+
* @param {Error | VFileMessage} cause
|
|
861
|
+
* @param {Point | Position | null | undefined} place
|
|
862
|
+
* @param {string | null | undefined} [origin]
|
|
863
|
+
* @returns {never}
|
|
864
|
+
*
|
|
865
|
+
* @overload
|
|
866
|
+
* @param {Error | VFileMessage} cause
|
|
867
|
+
* @param {string | null | undefined} [origin]
|
|
868
|
+
* @returns {never}
|
|
869
|
+
*
|
|
870
|
+
* @param {Error | VFileMessage | string} causeOrReason
|
|
871
|
+
* Reason for message, should use markdown.
|
|
872
|
+
* @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
|
|
873
|
+
* Configuration (optional).
|
|
874
|
+
* @param {string | null | undefined} [origin]
|
|
875
|
+
* Place in code where the message originates (example:
|
|
876
|
+
* `'my-package:my-rule'` or `'my-rule'`).
|
|
877
|
+
* @returns {never}
|
|
878
|
+
* Never.
|
|
879
|
+
* @throws {VFileMessage}
|
|
880
|
+
* Message.
|
|
881
|
+
*/
|
|
882
|
+
fail(reason: string, options?: Options$2 | null | undefined): never;
|
|
883
|
+
/**
|
|
884
|
+
* Create a fatal message for `reason` associated with the file.
|
|
885
|
+
*
|
|
886
|
+
* The `fatal` field of the message is set to `true` (error; file not usable)
|
|
887
|
+
* and the `file` field is set to the current file path.
|
|
888
|
+
* The message is added to the `messages` field on `file`.
|
|
889
|
+
*
|
|
890
|
+
* > 🪦 **Note**: also has obsolete signatures.
|
|
891
|
+
*
|
|
892
|
+
* @overload
|
|
893
|
+
* @param {string} reason
|
|
894
|
+
* @param {MessageOptions | null | undefined} [options]
|
|
895
|
+
* @returns {never}
|
|
896
|
+
*
|
|
897
|
+
* @overload
|
|
898
|
+
* @param {string} reason
|
|
899
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
900
|
+
* @param {string | null | undefined} [origin]
|
|
901
|
+
* @returns {never}
|
|
902
|
+
*
|
|
903
|
+
* @overload
|
|
904
|
+
* @param {string} reason
|
|
905
|
+
* @param {Point | Position | null | undefined} place
|
|
906
|
+
* @param {string | null | undefined} [origin]
|
|
907
|
+
* @returns {never}
|
|
908
|
+
*
|
|
909
|
+
* @overload
|
|
910
|
+
* @param {string} reason
|
|
911
|
+
* @param {string | null | undefined} [origin]
|
|
912
|
+
* @returns {never}
|
|
913
|
+
*
|
|
914
|
+
* @overload
|
|
915
|
+
* @param {Error | VFileMessage} cause
|
|
916
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
917
|
+
* @param {string | null | undefined} [origin]
|
|
918
|
+
* @returns {never}
|
|
919
|
+
*
|
|
920
|
+
* @overload
|
|
921
|
+
* @param {Error | VFileMessage} cause
|
|
922
|
+
* @param {Point | Position | null | undefined} place
|
|
923
|
+
* @param {string | null | undefined} [origin]
|
|
924
|
+
* @returns {never}
|
|
925
|
+
*
|
|
926
|
+
* @overload
|
|
927
|
+
* @param {Error | VFileMessage} cause
|
|
928
|
+
* @param {string | null | undefined} [origin]
|
|
929
|
+
* @returns {never}
|
|
930
|
+
*
|
|
931
|
+
* @param {Error | VFileMessage | string} causeOrReason
|
|
932
|
+
* Reason for message, should use markdown.
|
|
933
|
+
* @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
|
|
934
|
+
* Configuration (optional).
|
|
935
|
+
* @param {string | null | undefined} [origin]
|
|
936
|
+
* Place in code where the message originates (example:
|
|
937
|
+
* `'my-package:my-rule'` or `'my-rule'`).
|
|
938
|
+
* @returns {never}
|
|
939
|
+
* Never.
|
|
940
|
+
* @throws {VFileMessage}
|
|
941
|
+
* Message.
|
|
942
|
+
*/
|
|
943
|
+
fail(reason: string, parent: Node$1 | NodeLike | null | undefined, origin?: string | null | undefined): never;
|
|
944
|
+
/**
|
|
945
|
+
* Create a fatal message for `reason` associated with the file.
|
|
946
|
+
*
|
|
947
|
+
* The `fatal` field of the message is set to `true` (error; file not usable)
|
|
948
|
+
* and the `file` field is set to the current file path.
|
|
949
|
+
* The message is added to the `messages` field on `file`.
|
|
950
|
+
*
|
|
951
|
+
* > 🪦 **Note**: also has obsolete signatures.
|
|
952
|
+
*
|
|
953
|
+
* @overload
|
|
954
|
+
* @param {string} reason
|
|
955
|
+
* @param {MessageOptions | null | undefined} [options]
|
|
956
|
+
* @returns {never}
|
|
957
|
+
*
|
|
958
|
+
* @overload
|
|
959
|
+
* @param {string} reason
|
|
960
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
961
|
+
* @param {string | null | undefined} [origin]
|
|
962
|
+
* @returns {never}
|
|
963
|
+
*
|
|
964
|
+
* @overload
|
|
965
|
+
* @param {string} reason
|
|
966
|
+
* @param {Point | Position | null | undefined} place
|
|
967
|
+
* @param {string | null | undefined} [origin]
|
|
968
|
+
* @returns {never}
|
|
969
|
+
*
|
|
970
|
+
* @overload
|
|
971
|
+
* @param {string} reason
|
|
972
|
+
* @param {string | null | undefined} [origin]
|
|
973
|
+
* @returns {never}
|
|
974
|
+
*
|
|
975
|
+
* @overload
|
|
976
|
+
* @param {Error | VFileMessage} cause
|
|
977
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
978
|
+
* @param {string | null | undefined} [origin]
|
|
979
|
+
* @returns {never}
|
|
980
|
+
*
|
|
981
|
+
* @overload
|
|
982
|
+
* @param {Error | VFileMessage} cause
|
|
983
|
+
* @param {Point | Position | null | undefined} place
|
|
984
|
+
* @param {string | null | undefined} [origin]
|
|
985
|
+
* @returns {never}
|
|
986
|
+
*
|
|
987
|
+
* @overload
|
|
988
|
+
* @param {Error | VFileMessage} cause
|
|
989
|
+
* @param {string | null | undefined} [origin]
|
|
990
|
+
* @returns {never}
|
|
991
|
+
*
|
|
992
|
+
* @param {Error | VFileMessage | string} causeOrReason
|
|
993
|
+
* Reason for message, should use markdown.
|
|
994
|
+
* @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
|
|
995
|
+
* Configuration (optional).
|
|
996
|
+
* @param {string | null | undefined} [origin]
|
|
997
|
+
* Place in code where the message originates (example:
|
|
998
|
+
* `'my-package:my-rule'` or `'my-rule'`).
|
|
999
|
+
* @returns {never}
|
|
1000
|
+
* Never.
|
|
1001
|
+
* @throws {VFileMessage}
|
|
1002
|
+
* Message.
|
|
1003
|
+
*/
|
|
1004
|
+
fail(reason: string, place: Point | Position | null | undefined, origin?: string | null | undefined): never;
|
|
1005
|
+
/**
|
|
1006
|
+
* Create a fatal message for `reason` associated with the file.
|
|
1007
|
+
*
|
|
1008
|
+
* The `fatal` field of the message is set to `true` (error; file not usable)
|
|
1009
|
+
* and the `file` field is set to the current file path.
|
|
1010
|
+
* The message is added to the `messages` field on `file`.
|
|
1011
|
+
*
|
|
1012
|
+
* > 🪦 **Note**: also has obsolete signatures.
|
|
1013
|
+
*
|
|
1014
|
+
* @overload
|
|
1015
|
+
* @param {string} reason
|
|
1016
|
+
* @param {MessageOptions | null | undefined} [options]
|
|
1017
|
+
* @returns {never}
|
|
1018
|
+
*
|
|
1019
|
+
* @overload
|
|
1020
|
+
* @param {string} reason
|
|
1021
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
1022
|
+
* @param {string | null | undefined} [origin]
|
|
1023
|
+
* @returns {never}
|
|
1024
|
+
*
|
|
1025
|
+
* @overload
|
|
1026
|
+
* @param {string} reason
|
|
1027
|
+
* @param {Point | Position | null | undefined} place
|
|
1028
|
+
* @param {string | null | undefined} [origin]
|
|
1029
|
+
* @returns {never}
|
|
1030
|
+
*
|
|
1031
|
+
* @overload
|
|
1032
|
+
* @param {string} reason
|
|
1033
|
+
* @param {string | null | undefined} [origin]
|
|
1034
|
+
* @returns {never}
|
|
1035
|
+
*
|
|
1036
|
+
* @overload
|
|
1037
|
+
* @param {Error | VFileMessage} cause
|
|
1038
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
1039
|
+
* @param {string | null | undefined} [origin]
|
|
1040
|
+
* @returns {never}
|
|
1041
|
+
*
|
|
1042
|
+
* @overload
|
|
1043
|
+
* @param {Error | VFileMessage} cause
|
|
1044
|
+
* @param {Point | Position | null | undefined} place
|
|
1045
|
+
* @param {string | null | undefined} [origin]
|
|
1046
|
+
* @returns {never}
|
|
1047
|
+
*
|
|
1048
|
+
* @overload
|
|
1049
|
+
* @param {Error | VFileMessage} cause
|
|
1050
|
+
* @param {string | null | undefined} [origin]
|
|
1051
|
+
* @returns {never}
|
|
1052
|
+
*
|
|
1053
|
+
* @param {Error | VFileMessage | string} causeOrReason
|
|
1054
|
+
* Reason for message, should use markdown.
|
|
1055
|
+
* @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
|
|
1056
|
+
* Configuration (optional).
|
|
1057
|
+
* @param {string | null | undefined} [origin]
|
|
1058
|
+
* Place in code where the message originates (example:
|
|
1059
|
+
* `'my-package:my-rule'` or `'my-rule'`).
|
|
1060
|
+
* @returns {never}
|
|
1061
|
+
* Never.
|
|
1062
|
+
* @throws {VFileMessage}
|
|
1063
|
+
* Message.
|
|
1064
|
+
*/
|
|
1065
|
+
fail(reason: string, origin?: string | null | undefined): never;
|
|
1066
|
+
/**
|
|
1067
|
+
* Create a fatal message for `reason` associated with the file.
|
|
1068
|
+
*
|
|
1069
|
+
* The `fatal` field of the message is set to `true` (error; file not usable)
|
|
1070
|
+
* and the `file` field is set to the current file path.
|
|
1071
|
+
* The message is added to the `messages` field on `file`.
|
|
1072
|
+
*
|
|
1073
|
+
* > 🪦 **Note**: also has obsolete signatures.
|
|
1074
|
+
*
|
|
1075
|
+
* @overload
|
|
1076
|
+
* @param {string} reason
|
|
1077
|
+
* @param {MessageOptions | null | undefined} [options]
|
|
1078
|
+
* @returns {never}
|
|
1079
|
+
*
|
|
1080
|
+
* @overload
|
|
1081
|
+
* @param {string} reason
|
|
1082
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
1083
|
+
* @param {string | null | undefined} [origin]
|
|
1084
|
+
* @returns {never}
|
|
1085
|
+
*
|
|
1086
|
+
* @overload
|
|
1087
|
+
* @param {string} reason
|
|
1088
|
+
* @param {Point | Position | null | undefined} place
|
|
1089
|
+
* @param {string | null | undefined} [origin]
|
|
1090
|
+
* @returns {never}
|
|
1091
|
+
*
|
|
1092
|
+
* @overload
|
|
1093
|
+
* @param {string} reason
|
|
1094
|
+
* @param {string | null | undefined} [origin]
|
|
1095
|
+
* @returns {never}
|
|
1096
|
+
*
|
|
1097
|
+
* @overload
|
|
1098
|
+
* @param {Error | VFileMessage} cause
|
|
1099
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
1100
|
+
* @param {string | null | undefined} [origin]
|
|
1101
|
+
* @returns {never}
|
|
1102
|
+
*
|
|
1103
|
+
* @overload
|
|
1104
|
+
* @param {Error | VFileMessage} cause
|
|
1105
|
+
* @param {Point | Position | null | undefined} place
|
|
1106
|
+
* @param {string | null | undefined} [origin]
|
|
1107
|
+
* @returns {never}
|
|
1108
|
+
*
|
|
1109
|
+
* @overload
|
|
1110
|
+
* @param {Error | VFileMessage} cause
|
|
1111
|
+
* @param {string | null | undefined} [origin]
|
|
1112
|
+
* @returns {never}
|
|
1113
|
+
*
|
|
1114
|
+
* @param {Error | VFileMessage | string} causeOrReason
|
|
1115
|
+
* Reason for message, should use markdown.
|
|
1116
|
+
* @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
|
|
1117
|
+
* Configuration (optional).
|
|
1118
|
+
* @param {string | null | undefined} [origin]
|
|
1119
|
+
* Place in code where the message originates (example:
|
|
1120
|
+
* `'my-package:my-rule'` or `'my-rule'`).
|
|
1121
|
+
* @returns {never}
|
|
1122
|
+
* Never.
|
|
1123
|
+
* @throws {VFileMessage}
|
|
1124
|
+
* Message.
|
|
1125
|
+
*/
|
|
1126
|
+
fail(cause: Error | VFileMessage, parent: Node$1 | NodeLike | null | undefined, origin?: string | null | undefined): never;
|
|
1127
|
+
/**
|
|
1128
|
+
* Create a fatal message for `reason` associated with the file.
|
|
1129
|
+
*
|
|
1130
|
+
* The `fatal` field of the message is set to `true` (error; file not usable)
|
|
1131
|
+
* and the `file` field is set to the current file path.
|
|
1132
|
+
* The message is added to the `messages` field on `file`.
|
|
1133
|
+
*
|
|
1134
|
+
* > 🪦 **Note**: also has obsolete signatures.
|
|
1135
|
+
*
|
|
1136
|
+
* @overload
|
|
1137
|
+
* @param {string} reason
|
|
1138
|
+
* @param {MessageOptions | null | undefined} [options]
|
|
1139
|
+
* @returns {never}
|
|
1140
|
+
*
|
|
1141
|
+
* @overload
|
|
1142
|
+
* @param {string} reason
|
|
1143
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
1144
|
+
* @param {string | null | undefined} [origin]
|
|
1145
|
+
* @returns {never}
|
|
1146
|
+
*
|
|
1147
|
+
* @overload
|
|
1148
|
+
* @param {string} reason
|
|
1149
|
+
* @param {Point | Position | null | undefined} place
|
|
1150
|
+
* @param {string | null | undefined} [origin]
|
|
1151
|
+
* @returns {never}
|
|
1152
|
+
*
|
|
1153
|
+
* @overload
|
|
1154
|
+
* @param {string} reason
|
|
1155
|
+
* @param {string | null | undefined} [origin]
|
|
1156
|
+
* @returns {never}
|
|
1157
|
+
*
|
|
1158
|
+
* @overload
|
|
1159
|
+
* @param {Error | VFileMessage} cause
|
|
1160
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
1161
|
+
* @param {string | null | undefined} [origin]
|
|
1162
|
+
* @returns {never}
|
|
1163
|
+
*
|
|
1164
|
+
* @overload
|
|
1165
|
+
* @param {Error | VFileMessage} cause
|
|
1166
|
+
* @param {Point | Position | null | undefined} place
|
|
1167
|
+
* @param {string | null | undefined} [origin]
|
|
1168
|
+
* @returns {never}
|
|
1169
|
+
*
|
|
1170
|
+
* @overload
|
|
1171
|
+
* @param {Error | VFileMessage} cause
|
|
1172
|
+
* @param {string | null | undefined} [origin]
|
|
1173
|
+
* @returns {never}
|
|
1174
|
+
*
|
|
1175
|
+
* @param {Error | VFileMessage | string} causeOrReason
|
|
1176
|
+
* Reason for message, should use markdown.
|
|
1177
|
+
* @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
|
|
1178
|
+
* Configuration (optional).
|
|
1179
|
+
* @param {string | null | undefined} [origin]
|
|
1180
|
+
* Place in code where the message originates (example:
|
|
1181
|
+
* `'my-package:my-rule'` or `'my-rule'`).
|
|
1182
|
+
* @returns {never}
|
|
1183
|
+
* Never.
|
|
1184
|
+
* @throws {VFileMessage}
|
|
1185
|
+
* Message.
|
|
1186
|
+
*/
|
|
1187
|
+
fail(cause: Error | VFileMessage, place: Point | Position | null | undefined, origin?: string | null | undefined): never;
|
|
1188
|
+
/**
|
|
1189
|
+
* Create a fatal message for `reason` associated with the file.
|
|
1190
|
+
*
|
|
1191
|
+
* The `fatal` field of the message is set to `true` (error; file not usable)
|
|
1192
|
+
* and the `file` field is set to the current file path.
|
|
1193
|
+
* The message is added to the `messages` field on `file`.
|
|
1194
|
+
*
|
|
1195
|
+
* > 🪦 **Note**: also has obsolete signatures.
|
|
1196
|
+
*
|
|
1197
|
+
* @overload
|
|
1198
|
+
* @param {string} reason
|
|
1199
|
+
* @param {MessageOptions | null | undefined} [options]
|
|
1200
|
+
* @returns {never}
|
|
1201
|
+
*
|
|
1202
|
+
* @overload
|
|
1203
|
+
* @param {string} reason
|
|
1204
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
1205
|
+
* @param {string | null | undefined} [origin]
|
|
1206
|
+
* @returns {never}
|
|
1207
|
+
*
|
|
1208
|
+
* @overload
|
|
1209
|
+
* @param {string} reason
|
|
1210
|
+
* @param {Point | Position | null | undefined} place
|
|
1211
|
+
* @param {string | null | undefined} [origin]
|
|
1212
|
+
* @returns {never}
|
|
1213
|
+
*
|
|
1214
|
+
* @overload
|
|
1215
|
+
* @param {string} reason
|
|
1216
|
+
* @param {string | null | undefined} [origin]
|
|
1217
|
+
* @returns {never}
|
|
1218
|
+
*
|
|
1219
|
+
* @overload
|
|
1220
|
+
* @param {Error | VFileMessage} cause
|
|
1221
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
1222
|
+
* @param {string | null | undefined} [origin]
|
|
1223
|
+
* @returns {never}
|
|
1224
|
+
*
|
|
1225
|
+
* @overload
|
|
1226
|
+
* @param {Error | VFileMessage} cause
|
|
1227
|
+
* @param {Point | Position | null | undefined} place
|
|
1228
|
+
* @param {string | null | undefined} [origin]
|
|
1229
|
+
* @returns {never}
|
|
1230
|
+
*
|
|
1231
|
+
* @overload
|
|
1232
|
+
* @param {Error | VFileMessage} cause
|
|
1233
|
+
* @param {string | null | undefined} [origin]
|
|
1234
|
+
* @returns {never}
|
|
1235
|
+
*
|
|
1236
|
+
* @param {Error | VFileMessage | string} causeOrReason
|
|
1237
|
+
* Reason for message, should use markdown.
|
|
1238
|
+
* @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
|
|
1239
|
+
* Configuration (optional).
|
|
1240
|
+
* @param {string | null | undefined} [origin]
|
|
1241
|
+
* Place in code where the message originates (example:
|
|
1242
|
+
* `'my-package:my-rule'` or `'my-rule'`).
|
|
1243
|
+
* @returns {never}
|
|
1244
|
+
* Never.
|
|
1245
|
+
* @throws {VFileMessage}
|
|
1246
|
+
* Message.
|
|
1247
|
+
*/
|
|
1248
|
+
fail(cause: Error | VFileMessage, origin?: string | null | undefined): never;
|
|
1249
|
+
/**
|
|
1250
|
+
* Create an info message for `reason` associated with the file.
|
|
1251
|
+
*
|
|
1252
|
+
* The `fatal` field of the message is set to `undefined` (info; change
|
|
1253
|
+
* likely not needed) and the `file` field is set to the current file path.
|
|
1254
|
+
* The message is added to the `messages` field on `file`.
|
|
1255
|
+
*
|
|
1256
|
+
* > 🪦 **Note**: also has obsolete signatures.
|
|
1257
|
+
*
|
|
1258
|
+
* @overload
|
|
1259
|
+
* @param {string} reason
|
|
1260
|
+
* @param {MessageOptions | null | undefined} [options]
|
|
1261
|
+
* @returns {VFileMessage}
|
|
1262
|
+
*
|
|
1263
|
+
* @overload
|
|
1264
|
+
* @param {string} reason
|
|
1265
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
1266
|
+
* @param {string | null | undefined} [origin]
|
|
1267
|
+
* @returns {VFileMessage}
|
|
1268
|
+
*
|
|
1269
|
+
* @overload
|
|
1270
|
+
* @param {string} reason
|
|
1271
|
+
* @param {Point | Position | null | undefined} place
|
|
1272
|
+
* @param {string | null | undefined} [origin]
|
|
1273
|
+
* @returns {VFileMessage}
|
|
1274
|
+
*
|
|
1275
|
+
* @overload
|
|
1276
|
+
* @param {string} reason
|
|
1277
|
+
* @param {string | null | undefined} [origin]
|
|
1278
|
+
* @returns {VFileMessage}
|
|
1279
|
+
*
|
|
1280
|
+
* @overload
|
|
1281
|
+
* @param {Error | VFileMessage} cause
|
|
1282
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
1283
|
+
* @param {string | null | undefined} [origin]
|
|
1284
|
+
* @returns {VFileMessage}
|
|
1285
|
+
*
|
|
1286
|
+
* @overload
|
|
1287
|
+
* @param {Error | VFileMessage} cause
|
|
1288
|
+
* @param {Point | Position | null | undefined} place
|
|
1289
|
+
* @param {string | null | undefined} [origin]
|
|
1290
|
+
* @returns {VFileMessage}
|
|
1291
|
+
*
|
|
1292
|
+
* @overload
|
|
1293
|
+
* @param {Error | VFileMessage} cause
|
|
1294
|
+
* @param {string | null | undefined} [origin]
|
|
1295
|
+
* @returns {VFileMessage}
|
|
1296
|
+
*
|
|
1297
|
+
* @param {Error | VFileMessage | string} causeOrReason
|
|
1298
|
+
* Reason for message, should use markdown.
|
|
1299
|
+
* @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
|
|
1300
|
+
* Configuration (optional).
|
|
1301
|
+
* @param {string | null | undefined} [origin]
|
|
1302
|
+
* Place in code where the message originates (example:
|
|
1303
|
+
* `'my-package:my-rule'` or `'my-rule'`).
|
|
1304
|
+
* @returns {VFileMessage}
|
|
1305
|
+
* Message.
|
|
1306
|
+
*/
|
|
1307
|
+
info(reason: string, options?: Options$2 | null | undefined): VFileMessage;
|
|
1308
|
+
/**
|
|
1309
|
+
* Create an info message for `reason` associated with the file.
|
|
1310
|
+
*
|
|
1311
|
+
* The `fatal` field of the message is set to `undefined` (info; change
|
|
1312
|
+
* likely not needed) and the `file` field is set to the current file path.
|
|
1313
|
+
* The message is added to the `messages` field on `file`.
|
|
1314
|
+
*
|
|
1315
|
+
* > 🪦 **Note**: also has obsolete signatures.
|
|
1316
|
+
*
|
|
1317
|
+
* @overload
|
|
1318
|
+
* @param {string} reason
|
|
1319
|
+
* @param {MessageOptions | null | undefined} [options]
|
|
1320
|
+
* @returns {VFileMessage}
|
|
1321
|
+
*
|
|
1322
|
+
* @overload
|
|
1323
|
+
* @param {string} reason
|
|
1324
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
1325
|
+
* @param {string | null | undefined} [origin]
|
|
1326
|
+
* @returns {VFileMessage}
|
|
1327
|
+
*
|
|
1328
|
+
* @overload
|
|
1329
|
+
* @param {string} reason
|
|
1330
|
+
* @param {Point | Position | null | undefined} place
|
|
1331
|
+
* @param {string | null | undefined} [origin]
|
|
1332
|
+
* @returns {VFileMessage}
|
|
1333
|
+
*
|
|
1334
|
+
* @overload
|
|
1335
|
+
* @param {string} reason
|
|
1336
|
+
* @param {string | null | undefined} [origin]
|
|
1337
|
+
* @returns {VFileMessage}
|
|
1338
|
+
*
|
|
1339
|
+
* @overload
|
|
1340
|
+
* @param {Error | VFileMessage} cause
|
|
1341
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
1342
|
+
* @param {string | null | undefined} [origin]
|
|
1343
|
+
* @returns {VFileMessage}
|
|
1344
|
+
*
|
|
1345
|
+
* @overload
|
|
1346
|
+
* @param {Error | VFileMessage} cause
|
|
1347
|
+
* @param {Point | Position | null | undefined} place
|
|
1348
|
+
* @param {string | null | undefined} [origin]
|
|
1349
|
+
* @returns {VFileMessage}
|
|
1350
|
+
*
|
|
1351
|
+
* @overload
|
|
1352
|
+
* @param {Error | VFileMessage} cause
|
|
1353
|
+
* @param {string | null | undefined} [origin]
|
|
1354
|
+
* @returns {VFileMessage}
|
|
1355
|
+
*
|
|
1356
|
+
* @param {Error | VFileMessage | string} causeOrReason
|
|
1357
|
+
* Reason for message, should use markdown.
|
|
1358
|
+
* @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
|
|
1359
|
+
* Configuration (optional).
|
|
1360
|
+
* @param {string | null | undefined} [origin]
|
|
1361
|
+
* Place in code where the message originates (example:
|
|
1362
|
+
* `'my-package:my-rule'` or `'my-rule'`).
|
|
1363
|
+
* @returns {VFileMessage}
|
|
1364
|
+
* Message.
|
|
1365
|
+
*/
|
|
1366
|
+
info(reason: string, parent: Node$1 | NodeLike | null | undefined, origin?: string | null | undefined): VFileMessage;
|
|
1367
|
+
/**
|
|
1368
|
+
* Create an info message for `reason` associated with the file.
|
|
1369
|
+
*
|
|
1370
|
+
* The `fatal` field of the message is set to `undefined` (info; change
|
|
1371
|
+
* likely not needed) and the `file` field is set to the current file path.
|
|
1372
|
+
* The message is added to the `messages` field on `file`.
|
|
1373
|
+
*
|
|
1374
|
+
* > 🪦 **Note**: also has obsolete signatures.
|
|
1375
|
+
*
|
|
1376
|
+
* @overload
|
|
1377
|
+
* @param {string} reason
|
|
1378
|
+
* @param {MessageOptions | null | undefined} [options]
|
|
1379
|
+
* @returns {VFileMessage}
|
|
1380
|
+
*
|
|
1381
|
+
* @overload
|
|
1382
|
+
* @param {string} reason
|
|
1383
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
1384
|
+
* @param {string | null | undefined} [origin]
|
|
1385
|
+
* @returns {VFileMessage}
|
|
1386
|
+
*
|
|
1387
|
+
* @overload
|
|
1388
|
+
* @param {string} reason
|
|
1389
|
+
* @param {Point | Position | null | undefined} place
|
|
1390
|
+
* @param {string | null | undefined} [origin]
|
|
1391
|
+
* @returns {VFileMessage}
|
|
1392
|
+
*
|
|
1393
|
+
* @overload
|
|
1394
|
+
* @param {string} reason
|
|
1395
|
+
* @param {string | null | undefined} [origin]
|
|
1396
|
+
* @returns {VFileMessage}
|
|
1397
|
+
*
|
|
1398
|
+
* @overload
|
|
1399
|
+
* @param {Error | VFileMessage} cause
|
|
1400
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
1401
|
+
* @param {string | null | undefined} [origin]
|
|
1402
|
+
* @returns {VFileMessage}
|
|
1403
|
+
*
|
|
1404
|
+
* @overload
|
|
1405
|
+
* @param {Error | VFileMessage} cause
|
|
1406
|
+
* @param {Point | Position | null | undefined} place
|
|
1407
|
+
* @param {string | null | undefined} [origin]
|
|
1408
|
+
* @returns {VFileMessage}
|
|
1409
|
+
*
|
|
1410
|
+
* @overload
|
|
1411
|
+
* @param {Error | VFileMessage} cause
|
|
1412
|
+
* @param {string | null | undefined} [origin]
|
|
1413
|
+
* @returns {VFileMessage}
|
|
1414
|
+
*
|
|
1415
|
+
* @param {Error | VFileMessage | string} causeOrReason
|
|
1416
|
+
* Reason for message, should use markdown.
|
|
1417
|
+
* @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
|
|
1418
|
+
* Configuration (optional).
|
|
1419
|
+
* @param {string | null | undefined} [origin]
|
|
1420
|
+
* Place in code where the message originates (example:
|
|
1421
|
+
* `'my-package:my-rule'` or `'my-rule'`).
|
|
1422
|
+
* @returns {VFileMessage}
|
|
1423
|
+
* Message.
|
|
1424
|
+
*/
|
|
1425
|
+
info(reason: string, place: Point | Position | null | undefined, origin?: string | null | undefined): VFileMessage;
|
|
1426
|
+
/**
|
|
1427
|
+
* Create an info message for `reason` associated with the file.
|
|
1428
|
+
*
|
|
1429
|
+
* The `fatal` field of the message is set to `undefined` (info; change
|
|
1430
|
+
* likely not needed) and the `file` field is set to the current file path.
|
|
1431
|
+
* The message is added to the `messages` field on `file`.
|
|
1432
|
+
*
|
|
1433
|
+
* > 🪦 **Note**: also has obsolete signatures.
|
|
1434
|
+
*
|
|
1435
|
+
* @overload
|
|
1436
|
+
* @param {string} reason
|
|
1437
|
+
* @param {MessageOptions | null | undefined} [options]
|
|
1438
|
+
* @returns {VFileMessage}
|
|
1439
|
+
*
|
|
1440
|
+
* @overload
|
|
1441
|
+
* @param {string} reason
|
|
1442
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
1443
|
+
* @param {string | null | undefined} [origin]
|
|
1444
|
+
* @returns {VFileMessage}
|
|
1445
|
+
*
|
|
1446
|
+
* @overload
|
|
1447
|
+
* @param {string} reason
|
|
1448
|
+
* @param {Point | Position | null | undefined} place
|
|
1449
|
+
* @param {string | null | undefined} [origin]
|
|
1450
|
+
* @returns {VFileMessage}
|
|
1451
|
+
*
|
|
1452
|
+
* @overload
|
|
1453
|
+
* @param {string} reason
|
|
1454
|
+
* @param {string | null | undefined} [origin]
|
|
1455
|
+
* @returns {VFileMessage}
|
|
1456
|
+
*
|
|
1457
|
+
* @overload
|
|
1458
|
+
* @param {Error | VFileMessage} cause
|
|
1459
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
1460
|
+
* @param {string | null | undefined} [origin]
|
|
1461
|
+
* @returns {VFileMessage}
|
|
1462
|
+
*
|
|
1463
|
+
* @overload
|
|
1464
|
+
* @param {Error | VFileMessage} cause
|
|
1465
|
+
* @param {Point | Position | null | undefined} place
|
|
1466
|
+
* @param {string | null | undefined} [origin]
|
|
1467
|
+
* @returns {VFileMessage}
|
|
1468
|
+
*
|
|
1469
|
+
* @overload
|
|
1470
|
+
* @param {Error | VFileMessage} cause
|
|
1471
|
+
* @param {string | null | undefined} [origin]
|
|
1472
|
+
* @returns {VFileMessage}
|
|
1473
|
+
*
|
|
1474
|
+
* @param {Error | VFileMessage | string} causeOrReason
|
|
1475
|
+
* Reason for message, should use markdown.
|
|
1476
|
+
* @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
|
|
1477
|
+
* Configuration (optional).
|
|
1478
|
+
* @param {string | null | undefined} [origin]
|
|
1479
|
+
* Place in code where the message originates (example:
|
|
1480
|
+
* `'my-package:my-rule'` or `'my-rule'`).
|
|
1481
|
+
* @returns {VFileMessage}
|
|
1482
|
+
* Message.
|
|
1483
|
+
*/
|
|
1484
|
+
info(reason: string, origin?: string | null | undefined): VFileMessage;
|
|
1485
|
+
/**
|
|
1486
|
+
* Create an info message for `reason` associated with the file.
|
|
1487
|
+
*
|
|
1488
|
+
* The `fatal` field of the message is set to `undefined` (info; change
|
|
1489
|
+
* likely not needed) and the `file` field is set to the current file path.
|
|
1490
|
+
* The message is added to the `messages` field on `file`.
|
|
1491
|
+
*
|
|
1492
|
+
* > 🪦 **Note**: also has obsolete signatures.
|
|
1493
|
+
*
|
|
1494
|
+
* @overload
|
|
1495
|
+
* @param {string} reason
|
|
1496
|
+
* @param {MessageOptions | null | undefined} [options]
|
|
1497
|
+
* @returns {VFileMessage}
|
|
1498
|
+
*
|
|
1499
|
+
* @overload
|
|
1500
|
+
* @param {string} reason
|
|
1501
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
1502
|
+
* @param {string | null | undefined} [origin]
|
|
1503
|
+
* @returns {VFileMessage}
|
|
1504
|
+
*
|
|
1505
|
+
* @overload
|
|
1506
|
+
* @param {string} reason
|
|
1507
|
+
* @param {Point | Position | null | undefined} place
|
|
1508
|
+
* @param {string | null | undefined} [origin]
|
|
1509
|
+
* @returns {VFileMessage}
|
|
1510
|
+
*
|
|
1511
|
+
* @overload
|
|
1512
|
+
* @param {string} reason
|
|
1513
|
+
* @param {string | null | undefined} [origin]
|
|
1514
|
+
* @returns {VFileMessage}
|
|
1515
|
+
*
|
|
1516
|
+
* @overload
|
|
1517
|
+
* @param {Error | VFileMessage} cause
|
|
1518
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
1519
|
+
* @param {string | null | undefined} [origin]
|
|
1520
|
+
* @returns {VFileMessage}
|
|
1521
|
+
*
|
|
1522
|
+
* @overload
|
|
1523
|
+
* @param {Error | VFileMessage} cause
|
|
1524
|
+
* @param {Point | Position | null | undefined} place
|
|
1525
|
+
* @param {string | null | undefined} [origin]
|
|
1526
|
+
* @returns {VFileMessage}
|
|
1527
|
+
*
|
|
1528
|
+
* @overload
|
|
1529
|
+
* @param {Error | VFileMessage} cause
|
|
1530
|
+
* @param {string | null | undefined} [origin]
|
|
1531
|
+
* @returns {VFileMessage}
|
|
1532
|
+
*
|
|
1533
|
+
* @param {Error | VFileMessage | string} causeOrReason
|
|
1534
|
+
* Reason for message, should use markdown.
|
|
1535
|
+
* @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
|
|
1536
|
+
* Configuration (optional).
|
|
1537
|
+
* @param {string | null | undefined} [origin]
|
|
1538
|
+
* Place in code where the message originates (example:
|
|
1539
|
+
* `'my-package:my-rule'` or `'my-rule'`).
|
|
1540
|
+
* @returns {VFileMessage}
|
|
1541
|
+
* Message.
|
|
1542
|
+
*/
|
|
1543
|
+
info(cause: Error | VFileMessage, parent: Node$1 | NodeLike | null | undefined, origin?: string | null | undefined): VFileMessage;
|
|
1544
|
+
/**
|
|
1545
|
+
* Create an info message for `reason` associated with the file.
|
|
1546
|
+
*
|
|
1547
|
+
* The `fatal` field of the message is set to `undefined` (info; change
|
|
1548
|
+
* likely not needed) and the `file` field is set to the current file path.
|
|
1549
|
+
* The message is added to the `messages` field on `file`.
|
|
1550
|
+
*
|
|
1551
|
+
* > 🪦 **Note**: also has obsolete signatures.
|
|
1552
|
+
*
|
|
1553
|
+
* @overload
|
|
1554
|
+
* @param {string} reason
|
|
1555
|
+
* @param {MessageOptions | null | undefined} [options]
|
|
1556
|
+
* @returns {VFileMessage}
|
|
1557
|
+
*
|
|
1558
|
+
* @overload
|
|
1559
|
+
* @param {string} reason
|
|
1560
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
1561
|
+
* @param {string | null | undefined} [origin]
|
|
1562
|
+
* @returns {VFileMessage}
|
|
1563
|
+
*
|
|
1564
|
+
* @overload
|
|
1565
|
+
* @param {string} reason
|
|
1566
|
+
* @param {Point | Position | null | undefined} place
|
|
1567
|
+
* @param {string | null | undefined} [origin]
|
|
1568
|
+
* @returns {VFileMessage}
|
|
1569
|
+
*
|
|
1570
|
+
* @overload
|
|
1571
|
+
* @param {string} reason
|
|
1572
|
+
* @param {string | null | undefined} [origin]
|
|
1573
|
+
* @returns {VFileMessage}
|
|
1574
|
+
*
|
|
1575
|
+
* @overload
|
|
1576
|
+
* @param {Error | VFileMessage} cause
|
|
1577
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
1578
|
+
* @param {string | null | undefined} [origin]
|
|
1579
|
+
* @returns {VFileMessage}
|
|
1580
|
+
*
|
|
1581
|
+
* @overload
|
|
1582
|
+
* @param {Error | VFileMessage} cause
|
|
1583
|
+
* @param {Point | Position | null | undefined} place
|
|
1584
|
+
* @param {string | null | undefined} [origin]
|
|
1585
|
+
* @returns {VFileMessage}
|
|
1586
|
+
*
|
|
1587
|
+
* @overload
|
|
1588
|
+
* @param {Error | VFileMessage} cause
|
|
1589
|
+
* @param {string | null | undefined} [origin]
|
|
1590
|
+
* @returns {VFileMessage}
|
|
1591
|
+
*
|
|
1592
|
+
* @param {Error | VFileMessage | string} causeOrReason
|
|
1593
|
+
* Reason for message, should use markdown.
|
|
1594
|
+
* @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
|
|
1595
|
+
* Configuration (optional).
|
|
1596
|
+
* @param {string | null | undefined} [origin]
|
|
1597
|
+
* Place in code where the message originates (example:
|
|
1598
|
+
* `'my-package:my-rule'` or `'my-rule'`).
|
|
1599
|
+
* @returns {VFileMessage}
|
|
1600
|
+
* Message.
|
|
1601
|
+
*/
|
|
1602
|
+
info(cause: Error | VFileMessage, place: Point | Position | null | undefined, origin?: string | null | undefined): VFileMessage;
|
|
1603
|
+
/**
|
|
1604
|
+
* Create an info message for `reason` associated with the file.
|
|
1605
|
+
*
|
|
1606
|
+
* The `fatal` field of the message is set to `undefined` (info; change
|
|
1607
|
+
* likely not needed) and the `file` field is set to the current file path.
|
|
1608
|
+
* The message is added to the `messages` field on `file`.
|
|
1609
|
+
*
|
|
1610
|
+
* > 🪦 **Note**: also has obsolete signatures.
|
|
1611
|
+
*
|
|
1612
|
+
* @overload
|
|
1613
|
+
* @param {string} reason
|
|
1614
|
+
* @param {MessageOptions | null | undefined} [options]
|
|
1615
|
+
* @returns {VFileMessage}
|
|
1616
|
+
*
|
|
1617
|
+
* @overload
|
|
1618
|
+
* @param {string} reason
|
|
1619
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
1620
|
+
* @param {string | null | undefined} [origin]
|
|
1621
|
+
* @returns {VFileMessage}
|
|
1622
|
+
*
|
|
1623
|
+
* @overload
|
|
1624
|
+
* @param {string} reason
|
|
1625
|
+
* @param {Point | Position | null | undefined} place
|
|
1626
|
+
* @param {string | null | undefined} [origin]
|
|
1627
|
+
* @returns {VFileMessage}
|
|
1628
|
+
*
|
|
1629
|
+
* @overload
|
|
1630
|
+
* @param {string} reason
|
|
1631
|
+
* @param {string | null | undefined} [origin]
|
|
1632
|
+
* @returns {VFileMessage}
|
|
1633
|
+
*
|
|
1634
|
+
* @overload
|
|
1635
|
+
* @param {Error | VFileMessage} cause
|
|
1636
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
1637
|
+
* @param {string | null | undefined} [origin]
|
|
1638
|
+
* @returns {VFileMessage}
|
|
1639
|
+
*
|
|
1640
|
+
* @overload
|
|
1641
|
+
* @param {Error | VFileMessage} cause
|
|
1642
|
+
* @param {Point | Position | null | undefined} place
|
|
1643
|
+
* @param {string | null | undefined} [origin]
|
|
1644
|
+
* @returns {VFileMessage}
|
|
1645
|
+
*
|
|
1646
|
+
* @overload
|
|
1647
|
+
* @param {Error | VFileMessage} cause
|
|
1648
|
+
* @param {string | null | undefined} [origin]
|
|
1649
|
+
* @returns {VFileMessage}
|
|
1650
|
+
*
|
|
1651
|
+
* @param {Error | VFileMessage | string} causeOrReason
|
|
1652
|
+
* Reason for message, should use markdown.
|
|
1653
|
+
* @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
|
|
1654
|
+
* Configuration (optional).
|
|
1655
|
+
* @param {string | null | undefined} [origin]
|
|
1656
|
+
* Place in code where the message originates (example:
|
|
1657
|
+
* `'my-package:my-rule'` or `'my-rule'`).
|
|
1658
|
+
* @returns {VFileMessage}
|
|
1659
|
+
* Message.
|
|
1660
|
+
*/
|
|
1661
|
+
info(cause: Error | VFileMessage, origin?: string | null | undefined): VFileMessage;
|
|
1662
|
+
/**
|
|
1663
|
+
* Create a message for `reason` associated with the file.
|
|
1664
|
+
*
|
|
1665
|
+
* The `fatal` field of the message is set to `false` (warning; change may be
|
|
1666
|
+
* needed) and the `file` field is set to the current file path.
|
|
1667
|
+
* The message is added to the `messages` field on `file`.
|
|
1668
|
+
*
|
|
1669
|
+
* > 🪦 **Note**: also has obsolete signatures.
|
|
1670
|
+
*
|
|
1671
|
+
* @overload
|
|
1672
|
+
* @param {string} reason
|
|
1673
|
+
* @param {MessageOptions | null | undefined} [options]
|
|
1674
|
+
* @returns {VFileMessage}
|
|
1675
|
+
*
|
|
1676
|
+
* @overload
|
|
1677
|
+
* @param {string} reason
|
|
1678
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
1679
|
+
* @param {string | null | undefined} [origin]
|
|
1680
|
+
* @returns {VFileMessage}
|
|
1681
|
+
*
|
|
1682
|
+
* @overload
|
|
1683
|
+
* @param {string} reason
|
|
1684
|
+
* @param {Point | Position | null | undefined} place
|
|
1685
|
+
* @param {string | null | undefined} [origin]
|
|
1686
|
+
* @returns {VFileMessage}
|
|
1687
|
+
*
|
|
1688
|
+
* @overload
|
|
1689
|
+
* @param {string} reason
|
|
1690
|
+
* @param {string | null | undefined} [origin]
|
|
1691
|
+
* @returns {VFileMessage}
|
|
1692
|
+
*
|
|
1693
|
+
* @overload
|
|
1694
|
+
* @param {Error | VFileMessage} cause
|
|
1695
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
1696
|
+
* @param {string | null | undefined} [origin]
|
|
1697
|
+
* @returns {VFileMessage}
|
|
1698
|
+
*
|
|
1699
|
+
* @overload
|
|
1700
|
+
* @param {Error | VFileMessage} cause
|
|
1701
|
+
* @param {Point | Position | null | undefined} place
|
|
1702
|
+
* @param {string | null | undefined} [origin]
|
|
1703
|
+
* @returns {VFileMessage}
|
|
1704
|
+
*
|
|
1705
|
+
* @overload
|
|
1706
|
+
* @param {Error | VFileMessage} cause
|
|
1707
|
+
* @param {string | null | undefined} [origin]
|
|
1708
|
+
* @returns {VFileMessage}
|
|
1709
|
+
*
|
|
1710
|
+
* @param {Error | VFileMessage | string} causeOrReason
|
|
1711
|
+
* Reason for message, should use markdown.
|
|
1712
|
+
* @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
|
|
1713
|
+
* Configuration (optional).
|
|
1714
|
+
* @param {string | null | undefined} [origin]
|
|
1715
|
+
* Place in code where the message originates (example:
|
|
1716
|
+
* `'my-package:my-rule'` or `'my-rule'`).
|
|
1717
|
+
* @returns {VFileMessage}
|
|
1718
|
+
* Message.
|
|
1719
|
+
*/
|
|
1720
|
+
message(reason: string, options?: Options$2 | null | undefined): VFileMessage;
|
|
1721
|
+
/**
|
|
1722
|
+
* Create a message for `reason` associated with the file.
|
|
1723
|
+
*
|
|
1724
|
+
* The `fatal` field of the message is set to `false` (warning; change may be
|
|
1725
|
+
* needed) and the `file` field is set to the current file path.
|
|
1726
|
+
* The message is added to the `messages` field on `file`.
|
|
1727
|
+
*
|
|
1728
|
+
* > 🪦 **Note**: also has obsolete signatures.
|
|
1729
|
+
*
|
|
1730
|
+
* @overload
|
|
1731
|
+
* @param {string} reason
|
|
1732
|
+
* @param {MessageOptions | null | undefined} [options]
|
|
1733
|
+
* @returns {VFileMessage}
|
|
1734
|
+
*
|
|
1735
|
+
* @overload
|
|
1736
|
+
* @param {string} reason
|
|
1737
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
1738
|
+
* @param {string | null | undefined} [origin]
|
|
1739
|
+
* @returns {VFileMessage}
|
|
1740
|
+
*
|
|
1741
|
+
* @overload
|
|
1742
|
+
* @param {string} reason
|
|
1743
|
+
* @param {Point | Position | null | undefined} place
|
|
1744
|
+
* @param {string | null | undefined} [origin]
|
|
1745
|
+
* @returns {VFileMessage}
|
|
1746
|
+
*
|
|
1747
|
+
* @overload
|
|
1748
|
+
* @param {string} reason
|
|
1749
|
+
* @param {string | null | undefined} [origin]
|
|
1750
|
+
* @returns {VFileMessage}
|
|
1751
|
+
*
|
|
1752
|
+
* @overload
|
|
1753
|
+
* @param {Error | VFileMessage} cause
|
|
1754
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
1755
|
+
* @param {string | null | undefined} [origin]
|
|
1756
|
+
* @returns {VFileMessage}
|
|
1757
|
+
*
|
|
1758
|
+
* @overload
|
|
1759
|
+
* @param {Error | VFileMessage} cause
|
|
1760
|
+
* @param {Point | Position | null | undefined} place
|
|
1761
|
+
* @param {string | null | undefined} [origin]
|
|
1762
|
+
* @returns {VFileMessage}
|
|
1763
|
+
*
|
|
1764
|
+
* @overload
|
|
1765
|
+
* @param {Error | VFileMessage} cause
|
|
1766
|
+
* @param {string | null | undefined} [origin]
|
|
1767
|
+
* @returns {VFileMessage}
|
|
1768
|
+
*
|
|
1769
|
+
* @param {Error | VFileMessage | string} causeOrReason
|
|
1770
|
+
* Reason for message, should use markdown.
|
|
1771
|
+
* @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
|
|
1772
|
+
* Configuration (optional).
|
|
1773
|
+
* @param {string | null | undefined} [origin]
|
|
1774
|
+
* Place in code where the message originates (example:
|
|
1775
|
+
* `'my-package:my-rule'` or `'my-rule'`).
|
|
1776
|
+
* @returns {VFileMessage}
|
|
1777
|
+
* Message.
|
|
1778
|
+
*/
|
|
1779
|
+
message(reason: string, parent: Node$1 | NodeLike | null | undefined, origin?: string | null | undefined): VFileMessage;
|
|
1780
|
+
/**
|
|
1781
|
+
* Create a message for `reason` associated with the file.
|
|
1782
|
+
*
|
|
1783
|
+
* The `fatal` field of the message is set to `false` (warning; change may be
|
|
1784
|
+
* needed) and the `file` field is set to the current file path.
|
|
1785
|
+
* The message is added to the `messages` field on `file`.
|
|
1786
|
+
*
|
|
1787
|
+
* > 🪦 **Note**: also has obsolete signatures.
|
|
1788
|
+
*
|
|
1789
|
+
* @overload
|
|
1790
|
+
* @param {string} reason
|
|
1791
|
+
* @param {MessageOptions | null | undefined} [options]
|
|
1792
|
+
* @returns {VFileMessage}
|
|
1793
|
+
*
|
|
1794
|
+
* @overload
|
|
1795
|
+
* @param {string} reason
|
|
1796
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
1797
|
+
* @param {string | null | undefined} [origin]
|
|
1798
|
+
* @returns {VFileMessage}
|
|
1799
|
+
*
|
|
1800
|
+
* @overload
|
|
1801
|
+
* @param {string} reason
|
|
1802
|
+
* @param {Point | Position | null | undefined} place
|
|
1803
|
+
* @param {string | null | undefined} [origin]
|
|
1804
|
+
* @returns {VFileMessage}
|
|
1805
|
+
*
|
|
1806
|
+
* @overload
|
|
1807
|
+
* @param {string} reason
|
|
1808
|
+
* @param {string | null | undefined} [origin]
|
|
1809
|
+
* @returns {VFileMessage}
|
|
1810
|
+
*
|
|
1811
|
+
* @overload
|
|
1812
|
+
* @param {Error | VFileMessage} cause
|
|
1813
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
1814
|
+
* @param {string | null | undefined} [origin]
|
|
1815
|
+
* @returns {VFileMessage}
|
|
1816
|
+
*
|
|
1817
|
+
* @overload
|
|
1818
|
+
* @param {Error | VFileMessage} cause
|
|
1819
|
+
* @param {Point | Position | null | undefined} place
|
|
1820
|
+
* @param {string | null | undefined} [origin]
|
|
1821
|
+
* @returns {VFileMessage}
|
|
1822
|
+
*
|
|
1823
|
+
* @overload
|
|
1824
|
+
* @param {Error | VFileMessage} cause
|
|
1825
|
+
* @param {string | null | undefined} [origin]
|
|
1826
|
+
* @returns {VFileMessage}
|
|
1827
|
+
*
|
|
1828
|
+
* @param {Error | VFileMessage | string} causeOrReason
|
|
1829
|
+
* Reason for message, should use markdown.
|
|
1830
|
+
* @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
|
|
1831
|
+
* Configuration (optional).
|
|
1832
|
+
* @param {string | null | undefined} [origin]
|
|
1833
|
+
* Place in code where the message originates (example:
|
|
1834
|
+
* `'my-package:my-rule'` or `'my-rule'`).
|
|
1835
|
+
* @returns {VFileMessage}
|
|
1836
|
+
* Message.
|
|
1837
|
+
*/
|
|
1838
|
+
message(reason: string, place: Point | Position | null | undefined, origin?: string | null | undefined): VFileMessage;
|
|
1839
|
+
/**
|
|
1840
|
+
* Create a message for `reason` associated with the file.
|
|
1841
|
+
*
|
|
1842
|
+
* The `fatal` field of the message is set to `false` (warning; change may be
|
|
1843
|
+
* needed) and the `file` field is set to the current file path.
|
|
1844
|
+
* The message is added to the `messages` field on `file`.
|
|
1845
|
+
*
|
|
1846
|
+
* > 🪦 **Note**: also has obsolete signatures.
|
|
1847
|
+
*
|
|
1848
|
+
* @overload
|
|
1849
|
+
* @param {string} reason
|
|
1850
|
+
* @param {MessageOptions | null | undefined} [options]
|
|
1851
|
+
* @returns {VFileMessage}
|
|
1852
|
+
*
|
|
1853
|
+
* @overload
|
|
1854
|
+
* @param {string} reason
|
|
1855
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
1856
|
+
* @param {string | null | undefined} [origin]
|
|
1857
|
+
* @returns {VFileMessage}
|
|
1858
|
+
*
|
|
1859
|
+
* @overload
|
|
1860
|
+
* @param {string} reason
|
|
1861
|
+
* @param {Point | Position | null | undefined} place
|
|
1862
|
+
* @param {string | null | undefined} [origin]
|
|
1863
|
+
* @returns {VFileMessage}
|
|
1864
|
+
*
|
|
1865
|
+
* @overload
|
|
1866
|
+
* @param {string} reason
|
|
1867
|
+
* @param {string | null | undefined} [origin]
|
|
1868
|
+
* @returns {VFileMessage}
|
|
1869
|
+
*
|
|
1870
|
+
* @overload
|
|
1871
|
+
* @param {Error | VFileMessage} cause
|
|
1872
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
1873
|
+
* @param {string | null | undefined} [origin]
|
|
1874
|
+
* @returns {VFileMessage}
|
|
1875
|
+
*
|
|
1876
|
+
* @overload
|
|
1877
|
+
* @param {Error | VFileMessage} cause
|
|
1878
|
+
* @param {Point | Position | null | undefined} place
|
|
1879
|
+
* @param {string | null | undefined} [origin]
|
|
1880
|
+
* @returns {VFileMessage}
|
|
1881
|
+
*
|
|
1882
|
+
* @overload
|
|
1883
|
+
* @param {Error | VFileMessage} cause
|
|
1884
|
+
* @param {string | null | undefined} [origin]
|
|
1885
|
+
* @returns {VFileMessage}
|
|
1886
|
+
*
|
|
1887
|
+
* @param {Error | VFileMessage | string} causeOrReason
|
|
1888
|
+
* Reason for message, should use markdown.
|
|
1889
|
+
* @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
|
|
1890
|
+
* Configuration (optional).
|
|
1891
|
+
* @param {string | null | undefined} [origin]
|
|
1892
|
+
* Place in code where the message originates (example:
|
|
1893
|
+
* `'my-package:my-rule'` or `'my-rule'`).
|
|
1894
|
+
* @returns {VFileMessage}
|
|
1895
|
+
* Message.
|
|
1896
|
+
*/
|
|
1897
|
+
message(reason: string, origin?: string | null | undefined): VFileMessage;
|
|
1898
|
+
/**
|
|
1899
|
+
* Create a message for `reason` associated with the file.
|
|
1900
|
+
*
|
|
1901
|
+
* The `fatal` field of the message is set to `false` (warning; change may be
|
|
1902
|
+
* needed) and the `file` field is set to the current file path.
|
|
1903
|
+
* The message is added to the `messages` field on `file`.
|
|
1904
|
+
*
|
|
1905
|
+
* > 🪦 **Note**: also has obsolete signatures.
|
|
1906
|
+
*
|
|
1907
|
+
* @overload
|
|
1908
|
+
* @param {string} reason
|
|
1909
|
+
* @param {MessageOptions | null | undefined} [options]
|
|
1910
|
+
* @returns {VFileMessage}
|
|
1911
|
+
*
|
|
1912
|
+
* @overload
|
|
1913
|
+
* @param {string} reason
|
|
1914
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
1915
|
+
* @param {string | null | undefined} [origin]
|
|
1916
|
+
* @returns {VFileMessage}
|
|
1917
|
+
*
|
|
1918
|
+
* @overload
|
|
1919
|
+
* @param {string} reason
|
|
1920
|
+
* @param {Point | Position | null | undefined} place
|
|
1921
|
+
* @param {string | null | undefined} [origin]
|
|
1922
|
+
* @returns {VFileMessage}
|
|
1923
|
+
*
|
|
1924
|
+
* @overload
|
|
1925
|
+
* @param {string} reason
|
|
1926
|
+
* @param {string | null | undefined} [origin]
|
|
1927
|
+
* @returns {VFileMessage}
|
|
1928
|
+
*
|
|
1929
|
+
* @overload
|
|
1930
|
+
* @param {Error | VFileMessage} cause
|
|
1931
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
1932
|
+
* @param {string | null | undefined} [origin]
|
|
1933
|
+
* @returns {VFileMessage}
|
|
1934
|
+
*
|
|
1935
|
+
* @overload
|
|
1936
|
+
* @param {Error | VFileMessage} cause
|
|
1937
|
+
* @param {Point | Position | null | undefined} place
|
|
1938
|
+
* @param {string | null | undefined} [origin]
|
|
1939
|
+
* @returns {VFileMessage}
|
|
1940
|
+
*
|
|
1941
|
+
* @overload
|
|
1942
|
+
* @param {Error | VFileMessage} cause
|
|
1943
|
+
* @param {string | null | undefined} [origin]
|
|
1944
|
+
* @returns {VFileMessage}
|
|
1945
|
+
*
|
|
1946
|
+
* @param {Error | VFileMessage | string} causeOrReason
|
|
1947
|
+
* Reason for message, should use markdown.
|
|
1948
|
+
* @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
|
|
1949
|
+
* Configuration (optional).
|
|
1950
|
+
* @param {string | null | undefined} [origin]
|
|
1951
|
+
* Place in code where the message originates (example:
|
|
1952
|
+
* `'my-package:my-rule'` or `'my-rule'`).
|
|
1953
|
+
* @returns {VFileMessage}
|
|
1954
|
+
* Message.
|
|
1955
|
+
*/
|
|
1956
|
+
message(cause: Error | VFileMessage, parent: Node$1 | NodeLike | null | undefined, origin?: string | null | undefined): VFileMessage;
|
|
1957
|
+
/**
|
|
1958
|
+
* Create a message for `reason` associated with the file.
|
|
1959
|
+
*
|
|
1960
|
+
* The `fatal` field of the message is set to `false` (warning; change may be
|
|
1961
|
+
* needed) and the `file` field is set to the current file path.
|
|
1962
|
+
* The message is added to the `messages` field on `file`.
|
|
1963
|
+
*
|
|
1964
|
+
* > 🪦 **Note**: also has obsolete signatures.
|
|
1965
|
+
*
|
|
1966
|
+
* @overload
|
|
1967
|
+
* @param {string} reason
|
|
1968
|
+
* @param {MessageOptions | null | undefined} [options]
|
|
1969
|
+
* @returns {VFileMessage}
|
|
1970
|
+
*
|
|
1971
|
+
* @overload
|
|
1972
|
+
* @param {string} reason
|
|
1973
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
1974
|
+
* @param {string | null | undefined} [origin]
|
|
1975
|
+
* @returns {VFileMessage}
|
|
1976
|
+
*
|
|
1977
|
+
* @overload
|
|
1978
|
+
* @param {string} reason
|
|
1979
|
+
* @param {Point | Position | null | undefined} place
|
|
1980
|
+
* @param {string | null | undefined} [origin]
|
|
1981
|
+
* @returns {VFileMessage}
|
|
1982
|
+
*
|
|
1983
|
+
* @overload
|
|
1984
|
+
* @param {string} reason
|
|
1985
|
+
* @param {string | null | undefined} [origin]
|
|
1986
|
+
* @returns {VFileMessage}
|
|
1987
|
+
*
|
|
1988
|
+
* @overload
|
|
1989
|
+
* @param {Error | VFileMessage} cause
|
|
1990
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
1991
|
+
* @param {string | null | undefined} [origin]
|
|
1992
|
+
* @returns {VFileMessage}
|
|
1993
|
+
*
|
|
1994
|
+
* @overload
|
|
1995
|
+
* @param {Error | VFileMessage} cause
|
|
1996
|
+
* @param {Point | Position | null | undefined} place
|
|
1997
|
+
* @param {string | null | undefined} [origin]
|
|
1998
|
+
* @returns {VFileMessage}
|
|
1999
|
+
*
|
|
2000
|
+
* @overload
|
|
2001
|
+
* @param {Error | VFileMessage} cause
|
|
2002
|
+
* @param {string | null | undefined} [origin]
|
|
2003
|
+
* @returns {VFileMessage}
|
|
2004
|
+
*
|
|
2005
|
+
* @param {Error | VFileMessage | string} causeOrReason
|
|
2006
|
+
* Reason for message, should use markdown.
|
|
2007
|
+
* @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
|
|
2008
|
+
* Configuration (optional).
|
|
2009
|
+
* @param {string | null | undefined} [origin]
|
|
2010
|
+
* Place in code where the message originates (example:
|
|
2011
|
+
* `'my-package:my-rule'` or `'my-rule'`).
|
|
2012
|
+
* @returns {VFileMessage}
|
|
2013
|
+
* Message.
|
|
2014
|
+
*/
|
|
2015
|
+
message(cause: Error | VFileMessage, place: Point | Position | null | undefined, origin?: string | null | undefined): VFileMessage;
|
|
2016
|
+
/**
|
|
2017
|
+
* Create a message for `reason` associated with the file.
|
|
2018
|
+
*
|
|
2019
|
+
* The `fatal` field of the message is set to `false` (warning; change may be
|
|
2020
|
+
* needed) and the `file` field is set to the current file path.
|
|
2021
|
+
* The message is added to the `messages` field on `file`.
|
|
2022
|
+
*
|
|
2023
|
+
* > 🪦 **Note**: also has obsolete signatures.
|
|
2024
|
+
*
|
|
2025
|
+
* @overload
|
|
2026
|
+
* @param {string} reason
|
|
2027
|
+
* @param {MessageOptions | null | undefined} [options]
|
|
2028
|
+
* @returns {VFileMessage}
|
|
2029
|
+
*
|
|
2030
|
+
* @overload
|
|
2031
|
+
* @param {string} reason
|
|
2032
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
2033
|
+
* @param {string | null | undefined} [origin]
|
|
2034
|
+
* @returns {VFileMessage}
|
|
2035
|
+
*
|
|
2036
|
+
* @overload
|
|
2037
|
+
* @param {string} reason
|
|
2038
|
+
* @param {Point | Position | null | undefined} place
|
|
2039
|
+
* @param {string | null | undefined} [origin]
|
|
2040
|
+
* @returns {VFileMessage}
|
|
2041
|
+
*
|
|
2042
|
+
* @overload
|
|
2043
|
+
* @param {string} reason
|
|
2044
|
+
* @param {string | null | undefined} [origin]
|
|
2045
|
+
* @returns {VFileMessage}
|
|
2046
|
+
*
|
|
2047
|
+
* @overload
|
|
2048
|
+
* @param {Error | VFileMessage} cause
|
|
2049
|
+
* @param {Node | NodeLike | null | undefined} parent
|
|
2050
|
+
* @param {string | null | undefined} [origin]
|
|
2051
|
+
* @returns {VFileMessage}
|
|
2052
|
+
*
|
|
2053
|
+
* @overload
|
|
2054
|
+
* @param {Error | VFileMessage} cause
|
|
2055
|
+
* @param {Point | Position | null | undefined} place
|
|
2056
|
+
* @param {string | null | undefined} [origin]
|
|
2057
|
+
* @returns {VFileMessage}
|
|
2058
|
+
*
|
|
2059
|
+
* @overload
|
|
2060
|
+
* @param {Error | VFileMessage} cause
|
|
2061
|
+
* @param {string | null | undefined} [origin]
|
|
2062
|
+
* @returns {VFileMessage}
|
|
2063
|
+
*
|
|
2064
|
+
* @param {Error | VFileMessage | string} causeOrReason
|
|
2065
|
+
* Reason for message, should use markdown.
|
|
2066
|
+
* @param {Node | NodeLike | MessageOptions | Point | Position | string | null | undefined} [optionsOrParentOrPlace]
|
|
2067
|
+
* Configuration (optional).
|
|
2068
|
+
* @param {string | null | undefined} [origin]
|
|
2069
|
+
* Place in code where the message originates (example:
|
|
2070
|
+
* `'my-package:my-rule'` or `'my-rule'`).
|
|
2071
|
+
* @returns {VFileMessage}
|
|
2072
|
+
* Message.
|
|
2073
|
+
*/
|
|
2074
|
+
message(cause: Error | VFileMessage, origin?: string | null | undefined): VFileMessage;
|
|
2075
|
+
/**
|
|
2076
|
+
* Serialize the file.
|
|
2077
|
+
*
|
|
2078
|
+
* > **Note**: which encodings are supported depends on the engine.
|
|
2079
|
+
* > For info on Node.js, see:
|
|
2080
|
+
* > <https://nodejs.org/api/util.html#whatwg-supported-encodings>.
|
|
2081
|
+
*
|
|
2082
|
+
* @param {string | null | undefined} [encoding='utf8']
|
|
2083
|
+
* Character encoding to understand `value` as when it’s a `Uint8Array`
|
|
2084
|
+
* (default: `'utf-8'`).
|
|
2085
|
+
* @returns {string}
|
|
2086
|
+
* Serialized file.
|
|
2087
|
+
*/
|
|
2088
|
+
toString(encoding?: string | null | undefined): string;
|
|
2089
|
+
}
|
|
2090
|
+
type NodeLike = object & {
|
|
2091
|
+
type: string;
|
|
2092
|
+
position?: Position | undefined;
|
|
2093
|
+
};
|
|
2094
|
+
|
|
2095
|
+
// See: <https://github.com/sindresorhus/type-fest/blob/main/source/empty-object.d.ts>
|
|
2096
|
+
declare const emptyObjectSymbol$2: unique symbol
|
|
2097
|
+
|
|
2098
|
+
|
|
2099
|
+
/**
|
|
2100
|
+
* Things that can be passed to the constructor.
|
|
2101
|
+
*/
|
|
2102
|
+
type Compatible$1 = Options | URL | VFile | Value$1
|
|
2103
|
+
|
|
2104
|
+
/**
|
|
2105
|
+
* This map registers the type of the `data` key of a `VFile`.
|
|
2106
|
+
*
|
|
2107
|
+
* This type can be augmented to register custom `data` types.
|
|
2108
|
+
*
|
|
2109
|
+
* @example
|
|
2110
|
+
* declare module 'vfile' {
|
|
2111
|
+
* interface DataMap {
|
|
2112
|
+
* // `file.data.name` is typed as `string`
|
|
2113
|
+
* name: string
|
|
2114
|
+
* }
|
|
2115
|
+
* }
|
|
2116
|
+
*/
|
|
2117
|
+
interface DataMap {
|
|
2118
|
+
[emptyObjectSymbol$2]?: never
|
|
2119
|
+
}
|
|
2120
|
+
|
|
2121
|
+
/**
|
|
2122
|
+
* Custom info.
|
|
2123
|
+
*
|
|
2124
|
+
* Known attributes can be added to {@linkcode DataMap}
|
|
2125
|
+
*/
|
|
2126
|
+
type Data$3 = Record<string, unknown> & Partial<DataMap>
|
|
2127
|
+
|
|
2128
|
+
/**
|
|
2129
|
+
* Configuration.
|
|
2130
|
+
*/
|
|
2131
|
+
interface Options {
|
|
2132
|
+
/**
|
|
2133
|
+
* Arbitrary fields that will be shallow copied over to the new file.
|
|
2134
|
+
*/
|
|
2135
|
+
[key: string]: unknown
|
|
2136
|
+
/**
|
|
2137
|
+
* Set `basename` (name).
|
|
2138
|
+
*/
|
|
2139
|
+
basename?: string | null | undefined
|
|
2140
|
+
/**
|
|
2141
|
+
* Set `cwd` (working directory).
|
|
2142
|
+
*/
|
|
2143
|
+
cwd?: string | null | undefined
|
|
2144
|
+
/**
|
|
2145
|
+
* Set `data` (associated info).
|
|
2146
|
+
*/
|
|
2147
|
+
data?: Data$3 | null | undefined
|
|
2148
|
+
/**
|
|
2149
|
+
* Set `dirname` (path w/o basename).
|
|
2150
|
+
*/
|
|
2151
|
+
dirname?: string | null | undefined
|
|
2152
|
+
/**
|
|
2153
|
+
* Set `extname` (extension with dot).
|
|
2154
|
+
*/
|
|
2155
|
+
extname?: string | null | undefined
|
|
2156
|
+
/**
|
|
2157
|
+
* Set `history` (paths the file moved between).
|
|
2158
|
+
*/
|
|
2159
|
+
history?: Array<string> | null | undefined
|
|
2160
|
+
/**
|
|
2161
|
+
* Set `path` (current path).
|
|
2162
|
+
*/
|
|
2163
|
+
path?: URL | string | null | undefined
|
|
2164
|
+
/**
|
|
2165
|
+
* Set `stem` (name without extension).
|
|
2166
|
+
*/
|
|
2167
|
+
stem?: string | null | undefined
|
|
2168
|
+
/**
|
|
2169
|
+
* Set `value` (the contents of the file).
|
|
2170
|
+
*/
|
|
2171
|
+
value?: Value$1 | null | undefined
|
|
2172
|
+
}
|
|
2173
|
+
|
|
2174
|
+
/**
|
|
2175
|
+
* Contents of the file.
|
|
2176
|
+
*
|
|
2177
|
+
* Can either be text or a `Uint8Array` structure.
|
|
2178
|
+
*/
|
|
2179
|
+
type Value$1 = Uint8Array | string
|
|
2180
|
+
|
|
2181
|
+
// See: <https://github.com/sindresorhus/type-fest/blob/main/source/empty-object.d.ts>
|
|
2182
|
+
declare const emptyObjectSymbol$1: unique symbol
|
|
2183
|
+
|
|
2184
|
+
/**
|
|
2185
|
+
* Interface of known results from compilers.
|
|
2186
|
+
*
|
|
2187
|
+
* Normally, compilers result in text ({@linkcode Value} of `vfile`).
|
|
2188
|
+
* When you compile to something else, such as a React node (as in,
|
|
2189
|
+
* `rehype-react`), you can augment this interface to include that type.
|
|
2190
|
+
*
|
|
2191
|
+
* ```ts
|
|
2192
|
+
* import type {ReactNode} from 'somewhere'
|
|
2193
|
+
*
|
|
2194
|
+
* declare module 'unified' {
|
|
2195
|
+
* interface CompileResultMap {
|
|
2196
|
+
* // Register a new result (value is used, key should match it).
|
|
2197
|
+
* ReactNode: ReactNode
|
|
2198
|
+
* }
|
|
2199
|
+
* }
|
|
2200
|
+
*
|
|
2201
|
+
* export {} // You may not need this, but it makes sure the file is a module.
|
|
2202
|
+
* ```
|
|
2203
|
+
*
|
|
2204
|
+
* Use {@linkcode CompileResults} to access the values.
|
|
2205
|
+
*/
|
|
2206
|
+
interface CompileResultMap$1 {
|
|
2207
|
+
// Note: if `Value` from `VFile` is changed, this should too.
|
|
2208
|
+
Uint8Array: Uint8Array
|
|
2209
|
+
string: string
|
|
2210
|
+
}
|
|
2211
|
+
|
|
2212
|
+
/**
|
|
2213
|
+
* Interface of known data that can be supported by all plugins.
|
|
2214
|
+
*
|
|
2215
|
+
* Typically, options can be given to a specific plugin, but sometimes it makes
|
|
2216
|
+
* sense to have information shared with several plugins.
|
|
2217
|
+
* For example, a list of HTML elements that are self-closing, which is needed
|
|
2218
|
+
* during all phases.
|
|
2219
|
+
*
|
|
2220
|
+
* To type this, do something like:
|
|
2221
|
+
*
|
|
2222
|
+
* ```ts
|
|
2223
|
+
* declare module 'unified' {
|
|
2224
|
+
* interface Data {
|
|
2225
|
+
* htmlVoidElements?: Array<string> | undefined
|
|
2226
|
+
* }
|
|
2227
|
+
* }
|
|
2228
|
+
*
|
|
2229
|
+
* export {} // You may not need this, but it makes sure the file is a module.
|
|
2230
|
+
* ```
|
|
2231
|
+
*/
|
|
2232
|
+
interface Data$2 {
|
|
2233
|
+
settings?: Settings$3 | undefined
|
|
2234
|
+
}
|
|
2235
|
+
|
|
2236
|
+
/**
|
|
2237
|
+
* Interface of known extra options, that can be supported by parser and
|
|
2238
|
+
* compilers.
|
|
2239
|
+
*
|
|
2240
|
+
* This exists so that users can use packages such as `remark`, which configure
|
|
2241
|
+
* both parsers and compilers (in this case `remark-parse` and
|
|
2242
|
+
* `remark-stringify`), and still provide options for them.
|
|
2243
|
+
*
|
|
2244
|
+
* When you make parsers or compilers, that could be packaged up together,
|
|
2245
|
+
* you should support `this.data('settings')` as input and merge it with
|
|
2246
|
+
* explicitly passed `options`.
|
|
2247
|
+
* Then, to type it, using `remark-stringify` as an example, do something like:
|
|
2248
|
+
*
|
|
2249
|
+
* ```ts
|
|
2250
|
+
* declare module 'unified' {
|
|
2251
|
+
* interface Settings {
|
|
2252
|
+
* bullet: '*' | '+' | '-'
|
|
2253
|
+
* // …
|
|
2254
|
+
* }
|
|
2255
|
+
* }
|
|
2256
|
+
*
|
|
2257
|
+
* export {} // You may not need this, but it makes sure the file is a module.
|
|
2258
|
+
* ```
|
|
2259
|
+
*/
|
|
2260
|
+
interface Settings$3 {
|
|
2261
|
+
[emptyObjectSymbol$1]?: never
|
|
2262
|
+
}
|
|
2263
|
+
|
|
2264
|
+
/**
|
|
2265
|
+
* Ware.
|
|
2266
|
+
*/
|
|
2267
|
+
type Middleware = (...input: Array<any>) => any;
|
|
2268
|
+
/**
|
|
2269
|
+
* Pipeline.
|
|
2270
|
+
*/
|
|
2271
|
+
type Pipeline$2 = {
|
|
2272
|
+
/**
|
|
2273
|
+
* Run the pipeline.
|
|
2274
|
+
*/
|
|
2275
|
+
run: Run;
|
|
2276
|
+
/**
|
|
2277
|
+
* Add middleware.
|
|
2278
|
+
*/
|
|
2279
|
+
use: Use;
|
|
2280
|
+
};
|
|
2281
|
+
/**
|
|
2282
|
+
* Call all middleware.
|
|
2283
|
+
*
|
|
2284
|
+
* Calls `done` on completion with either an error or the output of the
|
|
2285
|
+
* last middleware.
|
|
2286
|
+
*
|
|
2287
|
+
* > 👉 **Note**: as the length of input defines whether async functions get a
|
|
2288
|
+
* > `next` function,
|
|
2289
|
+
* > it’s recommended to keep `input` at one value normally.
|
|
2290
|
+
*/
|
|
2291
|
+
type Run = (...input: Array<any>) => void;
|
|
2292
|
+
/**
|
|
2293
|
+
* Add middleware.
|
|
2294
|
+
*/
|
|
2295
|
+
type Use = (fn: Middleware) => Pipeline$2;
|
|
2296
|
+
|
|
2297
|
+
type Pipeline$1 = Pipeline$2;
|
|
2298
|
+
|
|
2299
|
+
// See: <https://github.com/sindresorhus/type-fest/blob/main/source/empty-object.d.ts>
|
|
2300
|
+
declare const emptyObjectSymbol: unique symbol
|
|
2301
|
+
|
|
2302
|
+
/**
|
|
2303
|
+
* Interface of known data that can be supported by all plugins.
|
|
2304
|
+
*
|
|
2305
|
+
* Typically, options can be given to a specific plugin, but sometimes it makes
|
|
2306
|
+
* sense to have information shared with several plugins.
|
|
2307
|
+
* For example, a list of HTML elements that are self-closing, which is needed
|
|
2308
|
+
* during all phases.
|
|
2309
|
+
*
|
|
2310
|
+
* To type this, do something like:
|
|
2311
|
+
*
|
|
2312
|
+
* ```ts
|
|
2313
|
+
* declare module 'unified' {
|
|
2314
|
+
* interface Data {
|
|
2315
|
+
* htmlVoidElements?: Array<string> | undefined
|
|
2316
|
+
* }
|
|
2317
|
+
* }
|
|
2318
|
+
*
|
|
2319
|
+
* export {} // You may not need this, but it makes sure the file is a module.
|
|
2320
|
+
* ```
|
|
2321
|
+
*/
|
|
2322
|
+
interface Data$1 {
|
|
2323
|
+
settings?: Settings$2 | undefined
|
|
2324
|
+
}
|
|
2325
|
+
|
|
2326
|
+
/**
|
|
2327
|
+
* Interface of known extra options, that can be supported by parser and
|
|
2328
|
+
* compilers.
|
|
2329
|
+
*
|
|
2330
|
+
* This exists so that users can use packages such as `remark`, which configure
|
|
2331
|
+
* both parsers and compilers (in this case `remark-parse` and
|
|
2332
|
+
* `remark-stringify`), and still provide options for them.
|
|
2333
|
+
*
|
|
2334
|
+
* When you make parsers or compilers, that could be packaged up together,
|
|
2335
|
+
* you should support `this.data('settings')` as input and merge it with
|
|
2336
|
+
* explicitly passed `options`.
|
|
2337
|
+
* Then, to type it, using `remark-stringify` as an example, do something like:
|
|
2338
|
+
*
|
|
2339
|
+
* ```ts
|
|
2340
|
+
* declare module 'unified' {
|
|
2341
|
+
* interface Settings {
|
|
2342
|
+
* bullet: '*' | '+' | '-'
|
|
2343
|
+
* // …
|
|
2344
|
+
* }
|
|
2345
|
+
* }
|
|
2346
|
+
*
|
|
2347
|
+
* export {} // You may not need this, but it makes sure the file is a module.
|
|
2348
|
+
* ```
|
|
2349
|
+
*/
|
|
2350
|
+
interface Settings$2 {
|
|
2351
|
+
[emptyObjectSymbol]?: never
|
|
2352
|
+
}
|
|
2353
|
+
|
|
2354
|
+
declare const CallableInstance: new <Parameters extends unknown[], Result>(property: string | symbol) => (...parameters: Parameters) => Result;
|
|
2355
|
+
|
|
2356
|
+
/**
|
|
2357
|
+
* @template {Node | undefined} [ParseTree=undefined]
|
|
2358
|
+
* Output of `parse` (optional).
|
|
2359
|
+
* @template {Node | undefined} [HeadTree=undefined]
|
|
2360
|
+
* Input for `run` (optional).
|
|
2361
|
+
* @template {Node | undefined} [TailTree=undefined]
|
|
2362
|
+
* Output for `run` (optional).
|
|
2363
|
+
* @template {Node | undefined} [CompileTree=undefined]
|
|
2364
|
+
* Input of `stringify` (optional).
|
|
2365
|
+
* @template {CompileResults | undefined} [CompileResult=undefined]
|
|
2366
|
+
* Output of `stringify` (optional).
|
|
2367
|
+
* @extends {CallableInstance<[], Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>>}
|
|
2368
|
+
*/
|
|
2369
|
+
declare class Processor<ParseTree extends unist.Node | undefined = undefined, HeadTree extends unist.Node | undefined = undefined, TailTree extends unist.Node | undefined = undefined, CompileTree extends unist.Node | undefined = undefined, CompileResult extends CompileResults | undefined = undefined> extends CallableInstance<[], Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>> {
|
|
2370
|
+
/**
|
|
2371
|
+
* Create a processor.
|
|
2372
|
+
*/
|
|
2373
|
+
constructor();
|
|
2374
|
+
/**
|
|
2375
|
+
* Compiler to use (deprecated).
|
|
2376
|
+
*
|
|
2377
|
+
* @deprecated
|
|
2378
|
+
* Use `compiler` instead.
|
|
2379
|
+
* @type {(
|
|
2380
|
+
* Compiler<
|
|
2381
|
+
* CompileTree extends undefined ? Node : CompileTree,
|
|
2382
|
+
* CompileResult extends undefined ? CompileResults : CompileResult
|
|
2383
|
+
* > |
|
|
2384
|
+
* undefined
|
|
2385
|
+
* )}
|
|
2386
|
+
*/
|
|
2387
|
+
Compiler: (Compiler<CompileTree extends undefined ? Node : CompileTree, CompileResult extends undefined ? CompileResults : CompileResult> | undefined);
|
|
2388
|
+
/**
|
|
2389
|
+
* Parser to use (deprecated).
|
|
2390
|
+
*
|
|
2391
|
+
* @deprecated
|
|
2392
|
+
* Use `parser` instead.
|
|
2393
|
+
* @type {(
|
|
2394
|
+
* Parser<ParseTree extends undefined ? Node : ParseTree> |
|
|
2395
|
+
* undefined
|
|
2396
|
+
* )}
|
|
2397
|
+
*/
|
|
2398
|
+
Parser: (Parser<ParseTree extends undefined ? Node : ParseTree> | undefined);
|
|
2399
|
+
/**
|
|
2400
|
+
* Internal list of configured plugins.
|
|
2401
|
+
*
|
|
2402
|
+
* @deprecated
|
|
2403
|
+
* This is a private internal property and should not be used.
|
|
2404
|
+
* @type {Array<PluginTuple<Array<unknown>>>}
|
|
2405
|
+
*/
|
|
2406
|
+
attachers: Array<[plugin: Plugin$1<unknown[], undefined, undefined>, ...parameters: unknown[]]>;
|
|
2407
|
+
/**
|
|
2408
|
+
* Compiler to use.
|
|
2409
|
+
*
|
|
2410
|
+
* @type {(
|
|
2411
|
+
* Compiler<
|
|
2412
|
+
* CompileTree extends undefined ? Node : CompileTree,
|
|
2413
|
+
* CompileResult extends undefined ? CompileResults : CompileResult
|
|
2414
|
+
* > |
|
|
2415
|
+
* undefined
|
|
2416
|
+
* )}
|
|
2417
|
+
*/
|
|
2418
|
+
compiler: (Compiler<CompileTree extends undefined ? Node : CompileTree, CompileResult extends undefined ? CompileResults : CompileResult> | undefined);
|
|
2419
|
+
/**
|
|
2420
|
+
* Internal state to track where we are while freezing.
|
|
2421
|
+
*
|
|
2422
|
+
* @deprecated
|
|
2423
|
+
* This is a private internal property and should not be used.
|
|
2424
|
+
* @type {number}
|
|
2425
|
+
*/
|
|
2426
|
+
freezeIndex: number;
|
|
2427
|
+
/**
|
|
2428
|
+
* Internal state to track whether we’re frozen.
|
|
2429
|
+
*
|
|
2430
|
+
* @deprecated
|
|
2431
|
+
* This is a private internal property and should not be used.
|
|
2432
|
+
* @type {boolean | undefined}
|
|
2433
|
+
*/
|
|
2434
|
+
frozen: boolean | undefined;
|
|
2435
|
+
/**
|
|
2436
|
+
* Internal state.
|
|
2437
|
+
*
|
|
2438
|
+
* @deprecated
|
|
2439
|
+
* This is a private internal property and should not be used.
|
|
2440
|
+
* @type {Data}
|
|
2441
|
+
*/
|
|
2442
|
+
namespace: Data;
|
|
2443
|
+
/**
|
|
2444
|
+
* Parser to use.
|
|
2445
|
+
*
|
|
2446
|
+
* @type {(
|
|
2447
|
+
* Parser<ParseTree extends undefined ? Node : ParseTree> |
|
|
2448
|
+
* undefined
|
|
2449
|
+
* )}
|
|
2450
|
+
*/
|
|
2451
|
+
parser: (Parser<ParseTree extends undefined ? Node : ParseTree> | undefined);
|
|
2452
|
+
/**
|
|
2453
|
+
* Internal list of configured transformers.
|
|
2454
|
+
*
|
|
2455
|
+
* @deprecated
|
|
2456
|
+
* This is a private internal property and should not be used.
|
|
2457
|
+
* @type {Pipeline}
|
|
2458
|
+
*/
|
|
2459
|
+
transformers: Pipeline;
|
|
2460
|
+
/**
|
|
2461
|
+
* Copy a processor.
|
|
2462
|
+
*
|
|
2463
|
+
* @deprecated
|
|
2464
|
+
* This is a private internal method and should not be used.
|
|
2465
|
+
* @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
|
|
2466
|
+
* New *unfrozen* processor ({@linkcode Processor}) that is
|
|
2467
|
+
* configured to work the same as its ancestor.
|
|
2468
|
+
* When the descendant processor is configured in the future it does not
|
|
2469
|
+
* affect the ancestral processor.
|
|
2470
|
+
*/
|
|
2471
|
+
copy(): Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>;
|
|
2472
|
+
/**
|
|
2473
|
+
* Configure the processor with info available to all plugins.
|
|
2474
|
+
* Information is stored in an object.
|
|
2475
|
+
*
|
|
2476
|
+
* Typically, options can be given to a specific plugin, but sometimes it
|
|
2477
|
+
* makes sense to have information shared with several plugins.
|
|
2478
|
+
* For example, a list of HTML elements that are self-closing, which is
|
|
2479
|
+
* needed during all phases.
|
|
2480
|
+
*
|
|
2481
|
+
* > **Note**: setting information cannot occur on *frozen* processors.
|
|
2482
|
+
* > Call the processor first to create a new unfrozen processor.
|
|
2483
|
+
*
|
|
2484
|
+
* > **Note**: to register custom data in TypeScript, augment the
|
|
2485
|
+
* > {@linkcode Data} interface.
|
|
2486
|
+
*
|
|
2487
|
+
* @example
|
|
2488
|
+
* This example show how to get and set info:
|
|
2489
|
+
*
|
|
2490
|
+
* ```js
|
|
2491
|
+
* import {unified} from 'unified'
|
|
2492
|
+
*
|
|
2493
|
+
* const processor = unified().data('alpha', 'bravo')
|
|
2494
|
+
*
|
|
2495
|
+
* processor.data('alpha') // => 'bravo'
|
|
2496
|
+
*
|
|
2497
|
+
* processor.data() // => {alpha: 'bravo'}
|
|
2498
|
+
*
|
|
2499
|
+
* processor.data({charlie: 'delta'})
|
|
2500
|
+
*
|
|
2501
|
+
* processor.data() // => {charlie: 'delta'}
|
|
2502
|
+
* ```
|
|
2503
|
+
*
|
|
2504
|
+
* @template {keyof Data} Key
|
|
2505
|
+
*
|
|
2506
|
+
* @overload
|
|
2507
|
+
* @returns {Data}
|
|
2508
|
+
*
|
|
2509
|
+
* @overload
|
|
2510
|
+
* @param {Data} dataset
|
|
2511
|
+
* @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
|
|
2512
|
+
*
|
|
2513
|
+
* @overload
|
|
2514
|
+
* @param {Key} key
|
|
2515
|
+
* @returns {Data[Key]}
|
|
2516
|
+
*
|
|
2517
|
+
* @overload
|
|
2518
|
+
* @param {Key} key
|
|
2519
|
+
* @param {Data[Key]} value
|
|
2520
|
+
* @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
|
|
2521
|
+
*
|
|
2522
|
+
* @param {Data | Key} [key]
|
|
2523
|
+
* Key to get or set, or entire dataset to set, or nothing to get the
|
|
2524
|
+
* entire dataset (optional).
|
|
2525
|
+
* @param {Data[Key]} [value]
|
|
2526
|
+
* Value to set (optional).
|
|
2527
|
+
* @returns {unknown}
|
|
2528
|
+
* The current processor when setting, the value at `key` when getting, or
|
|
2529
|
+
* the entire dataset when getting without key.
|
|
2530
|
+
*/
|
|
2531
|
+
data<Key extends keyof Data$1>(): Data;
|
|
2532
|
+
/**
|
|
2533
|
+
* Configure the processor with info available to all plugins.
|
|
2534
|
+
* Information is stored in an object.
|
|
2535
|
+
*
|
|
2536
|
+
* Typically, options can be given to a specific plugin, but sometimes it
|
|
2537
|
+
* makes sense to have information shared with several plugins.
|
|
2538
|
+
* For example, a list of HTML elements that are self-closing, which is
|
|
2539
|
+
* needed during all phases.
|
|
2540
|
+
*
|
|
2541
|
+
* > **Note**: setting information cannot occur on *frozen* processors.
|
|
2542
|
+
* > Call the processor first to create a new unfrozen processor.
|
|
2543
|
+
*
|
|
2544
|
+
* > **Note**: to register custom data in TypeScript, augment the
|
|
2545
|
+
* > {@linkcode Data} interface.
|
|
2546
|
+
*
|
|
2547
|
+
* @example
|
|
2548
|
+
* This example show how to get and set info:
|
|
2549
|
+
*
|
|
2550
|
+
* ```js
|
|
2551
|
+
* import {unified} from 'unified'
|
|
2552
|
+
*
|
|
2553
|
+
* const processor = unified().data('alpha', 'bravo')
|
|
2554
|
+
*
|
|
2555
|
+
* processor.data('alpha') // => 'bravo'
|
|
2556
|
+
*
|
|
2557
|
+
* processor.data() // => {alpha: 'bravo'}
|
|
2558
|
+
*
|
|
2559
|
+
* processor.data({charlie: 'delta'})
|
|
2560
|
+
*
|
|
2561
|
+
* processor.data() // => {charlie: 'delta'}
|
|
2562
|
+
* ```
|
|
2563
|
+
*
|
|
2564
|
+
* @template {keyof Data} Key
|
|
2565
|
+
*
|
|
2566
|
+
* @overload
|
|
2567
|
+
* @returns {Data}
|
|
2568
|
+
*
|
|
2569
|
+
* @overload
|
|
2570
|
+
* @param {Data} dataset
|
|
2571
|
+
* @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
|
|
2572
|
+
*
|
|
2573
|
+
* @overload
|
|
2574
|
+
* @param {Key} key
|
|
2575
|
+
* @returns {Data[Key]}
|
|
2576
|
+
*
|
|
2577
|
+
* @overload
|
|
2578
|
+
* @param {Key} key
|
|
2579
|
+
* @param {Data[Key]} value
|
|
2580
|
+
* @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
|
|
2581
|
+
*
|
|
2582
|
+
* @param {Data | Key} [key]
|
|
2583
|
+
* Key to get or set, or entire dataset to set, or nothing to get the
|
|
2584
|
+
* entire dataset (optional).
|
|
2585
|
+
* @param {Data[Key]} [value]
|
|
2586
|
+
* Value to set (optional).
|
|
2587
|
+
* @returns {unknown}
|
|
2588
|
+
* The current processor when setting, the value at `key` when getting, or
|
|
2589
|
+
* the entire dataset when getting without key.
|
|
2590
|
+
*/
|
|
2591
|
+
data<Key extends keyof Data$1>(dataset: Data): Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>;
|
|
2592
|
+
/**
|
|
2593
|
+
* Configure the processor with info available to all plugins.
|
|
2594
|
+
* Information is stored in an object.
|
|
2595
|
+
*
|
|
2596
|
+
* Typically, options can be given to a specific plugin, but sometimes it
|
|
2597
|
+
* makes sense to have information shared with several plugins.
|
|
2598
|
+
* For example, a list of HTML elements that are self-closing, which is
|
|
2599
|
+
* needed during all phases.
|
|
2600
|
+
*
|
|
2601
|
+
* > **Note**: setting information cannot occur on *frozen* processors.
|
|
2602
|
+
* > Call the processor first to create a new unfrozen processor.
|
|
2603
|
+
*
|
|
2604
|
+
* > **Note**: to register custom data in TypeScript, augment the
|
|
2605
|
+
* > {@linkcode Data} interface.
|
|
2606
|
+
*
|
|
2607
|
+
* @example
|
|
2608
|
+
* This example show how to get and set info:
|
|
2609
|
+
*
|
|
2610
|
+
* ```js
|
|
2611
|
+
* import {unified} from 'unified'
|
|
2612
|
+
*
|
|
2613
|
+
* const processor = unified().data('alpha', 'bravo')
|
|
2614
|
+
*
|
|
2615
|
+
* processor.data('alpha') // => 'bravo'
|
|
2616
|
+
*
|
|
2617
|
+
* processor.data() // => {alpha: 'bravo'}
|
|
2618
|
+
*
|
|
2619
|
+
* processor.data({charlie: 'delta'})
|
|
2620
|
+
*
|
|
2621
|
+
* processor.data() // => {charlie: 'delta'}
|
|
2622
|
+
* ```
|
|
2623
|
+
*
|
|
2624
|
+
* @template {keyof Data} Key
|
|
2625
|
+
*
|
|
2626
|
+
* @overload
|
|
2627
|
+
* @returns {Data}
|
|
2628
|
+
*
|
|
2629
|
+
* @overload
|
|
2630
|
+
* @param {Data} dataset
|
|
2631
|
+
* @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
|
|
2632
|
+
*
|
|
2633
|
+
* @overload
|
|
2634
|
+
* @param {Key} key
|
|
2635
|
+
* @returns {Data[Key]}
|
|
2636
|
+
*
|
|
2637
|
+
* @overload
|
|
2638
|
+
* @param {Key} key
|
|
2639
|
+
* @param {Data[Key]} value
|
|
2640
|
+
* @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
|
|
2641
|
+
*
|
|
2642
|
+
* @param {Data | Key} [key]
|
|
2643
|
+
* Key to get or set, or entire dataset to set, or nothing to get the
|
|
2644
|
+
* entire dataset (optional).
|
|
2645
|
+
* @param {Data[Key]} [value]
|
|
2646
|
+
* Value to set (optional).
|
|
2647
|
+
* @returns {unknown}
|
|
2648
|
+
* The current processor when setting, the value at `key` when getting, or
|
|
2649
|
+
* the entire dataset when getting without key.
|
|
2650
|
+
*/
|
|
2651
|
+
data<Key extends keyof Data$1>(key: Key): Data$1[Key];
|
|
2652
|
+
/**
|
|
2653
|
+
* Configure the processor with info available to all plugins.
|
|
2654
|
+
* Information is stored in an object.
|
|
2655
|
+
*
|
|
2656
|
+
* Typically, options can be given to a specific plugin, but sometimes it
|
|
2657
|
+
* makes sense to have information shared with several plugins.
|
|
2658
|
+
* For example, a list of HTML elements that are self-closing, which is
|
|
2659
|
+
* needed during all phases.
|
|
2660
|
+
*
|
|
2661
|
+
* > **Note**: setting information cannot occur on *frozen* processors.
|
|
2662
|
+
* > Call the processor first to create a new unfrozen processor.
|
|
2663
|
+
*
|
|
2664
|
+
* > **Note**: to register custom data in TypeScript, augment the
|
|
2665
|
+
* > {@linkcode Data} interface.
|
|
2666
|
+
*
|
|
2667
|
+
* @example
|
|
2668
|
+
* This example show how to get and set info:
|
|
2669
|
+
*
|
|
2670
|
+
* ```js
|
|
2671
|
+
* import {unified} from 'unified'
|
|
2672
|
+
*
|
|
2673
|
+
* const processor = unified().data('alpha', 'bravo')
|
|
2674
|
+
*
|
|
2675
|
+
* processor.data('alpha') // => 'bravo'
|
|
2676
|
+
*
|
|
2677
|
+
* processor.data() // => {alpha: 'bravo'}
|
|
2678
|
+
*
|
|
2679
|
+
* processor.data({charlie: 'delta'})
|
|
2680
|
+
*
|
|
2681
|
+
* processor.data() // => {charlie: 'delta'}
|
|
2682
|
+
* ```
|
|
2683
|
+
*
|
|
2684
|
+
* @template {keyof Data} Key
|
|
2685
|
+
*
|
|
2686
|
+
* @overload
|
|
2687
|
+
* @returns {Data}
|
|
2688
|
+
*
|
|
2689
|
+
* @overload
|
|
2690
|
+
* @param {Data} dataset
|
|
2691
|
+
* @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
|
|
2692
|
+
*
|
|
2693
|
+
* @overload
|
|
2694
|
+
* @param {Key} key
|
|
2695
|
+
* @returns {Data[Key]}
|
|
2696
|
+
*
|
|
2697
|
+
* @overload
|
|
2698
|
+
* @param {Key} key
|
|
2699
|
+
* @param {Data[Key]} value
|
|
2700
|
+
* @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
|
|
2701
|
+
*
|
|
2702
|
+
* @param {Data | Key} [key]
|
|
2703
|
+
* Key to get or set, or entire dataset to set, or nothing to get the
|
|
2704
|
+
* entire dataset (optional).
|
|
2705
|
+
* @param {Data[Key]} [value]
|
|
2706
|
+
* Value to set (optional).
|
|
2707
|
+
* @returns {unknown}
|
|
2708
|
+
* The current processor when setting, the value at `key` when getting, or
|
|
2709
|
+
* the entire dataset when getting without key.
|
|
2710
|
+
*/
|
|
2711
|
+
data<Key extends keyof Data$1>(key: Key, value: Data$1[Key]): Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>;
|
|
2712
|
+
/**
|
|
2713
|
+
* Freeze a processor.
|
|
2714
|
+
*
|
|
2715
|
+
* Frozen processors are meant to be extended and not to be configured
|
|
2716
|
+
* directly.
|
|
2717
|
+
*
|
|
2718
|
+
* When a processor is frozen it cannot be unfrozen.
|
|
2719
|
+
* New processors working the same way can be created by calling the
|
|
2720
|
+
* processor.
|
|
2721
|
+
*
|
|
2722
|
+
* It’s possible to freeze processors explicitly by calling `.freeze()`.
|
|
2723
|
+
* Processors freeze automatically when `.parse()`, `.run()`, `.runSync()`,
|
|
2724
|
+
* `.stringify()`, `.process()`, or `.processSync()` are called.
|
|
2725
|
+
*
|
|
2726
|
+
* @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
|
|
2727
|
+
* The current processor.
|
|
2728
|
+
*/
|
|
2729
|
+
freeze(): Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>;
|
|
2730
|
+
/**
|
|
2731
|
+
* Parse text to a syntax tree.
|
|
2732
|
+
*
|
|
2733
|
+
* > **Note**: `parse` freezes the processor if not already *frozen*.
|
|
2734
|
+
*
|
|
2735
|
+
* > **Note**: `parse` performs the parse phase, not the run phase or other
|
|
2736
|
+
* > phases.
|
|
2737
|
+
*
|
|
2738
|
+
* @param {Compatible | undefined} [file]
|
|
2739
|
+
* file to parse (optional); typically `string` or `VFile`; any value
|
|
2740
|
+
* accepted as `x` in `new VFile(x)`.
|
|
2741
|
+
* @returns {ParseTree extends undefined ? Node : ParseTree}
|
|
2742
|
+
* Syntax tree representing `file`.
|
|
2743
|
+
*/
|
|
2744
|
+
parse(file?: Compatible | undefined): ParseTree extends undefined ? Node : ParseTree;
|
|
2745
|
+
/**
|
|
2746
|
+
* Process the given file as configured on the processor.
|
|
2747
|
+
*
|
|
2748
|
+
* > **Note**: `process` freezes the processor if not already *frozen*.
|
|
2749
|
+
*
|
|
2750
|
+
* > **Note**: `process` performs the parse, run, and stringify phases.
|
|
2751
|
+
*
|
|
2752
|
+
* @overload
|
|
2753
|
+
* @param {Compatible | undefined} file
|
|
2754
|
+
* @param {ProcessCallback<VFileWithOutput<CompileResult>>} done
|
|
2755
|
+
* @returns {undefined}
|
|
2756
|
+
*
|
|
2757
|
+
* @overload
|
|
2758
|
+
* @param {Compatible | undefined} [file]
|
|
2759
|
+
* @returns {Promise<VFileWithOutput<CompileResult>>}
|
|
2760
|
+
*
|
|
2761
|
+
* @param {Compatible | undefined} [file]
|
|
2762
|
+
* File (optional); typically `string` or `VFile`]; any value accepted as
|
|
2763
|
+
* `x` in `new VFile(x)`.
|
|
2764
|
+
* @param {ProcessCallback<VFileWithOutput<CompileResult>> | undefined} [done]
|
|
2765
|
+
* Callback (optional).
|
|
2766
|
+
* @returns {Promise<VFile> | undefined}
|
|
2767
|
+
* Nothing if `done` is given.
|
|
2768
|
+
* Otherwise a promise, rejected with a fatal error or resolved with the
|
|
2769
|
+
* processed file.
|
|
2770
|
+
*
|
|
2771
|
+
* The parsed, transformed, and compiled value is available at
|
|
2772
|
+
* `file.value` (see note).
|
|
2773
|
+
*
|
|
2774
|
+
* > **Note**: unified typically compiles by serializing: most
|
|
2775
|
+
* > compilers return `string` (or `Uint8Array`).
|
|
2776
|
+
* > Some compilers, such as the one configured with
|
|
2777
|
+
* > [`rehype-react`][rehype-react], return other values (in this case, a
|
|
2778
|
+
* > React tree).
|
|
2779
|
+
* > If you’re using a compiler that doesn’t serialize, expect different
|
|
2780
|
+
* > result values.
|
|
2781
|
+
* >
|
|
2782
|
+
* > To register custom results in TypeScript, add them to
|
|
2783
|
+
* > {@linkcode CompileResultMap}.
|
|
2784
|
+
*
|
|
2785
|
+
* [rehype-react]: https://github.com/rehypejs/rehype-react
|
|
2786
|
+
*/
|
|
2787
|
+
process(file: Compatible | undefined, done: ProcessCallback<VFileWithOutput<CompileResult>>): undefined;
|
|
2788
|
+
/**
|
|
2789
|
+
* Process the given file as configured on the processor.
|
|
2790
|
+
*
|
|
2791
|
+
* > **Note**: `process` freezes the processor if not already *frozen*.
|
|
2792
|
+
*
|
|
2793
|
+
* > **Note**: `process` performs the parse, run, and stringify phases.
|
|
2794
|
+
*
|
|
2795
|
+
* @overload
|
|
2796
|
+
* @param {Compatible | undefined} file
|
|
2797
|
+
* @param {ProcessCallback<VFileWithOutput<CompileResult>>} done
|
|
2798
|
+
* @returns {undefined}
|
|
2799
|
+
*
|
|
2800
|
+
* @overload
|
|
2801
|
+
* @param {Compatible | undefined} [file]
|
|
2802
|
+
* @returns {Promise<VFileWithOutput<CompileResult>>}
|
|
2803
|
+
*
|
|
2804
|
+
* @param {Compatible | undefined} [file]
|
|
2805
|
+
* File (optional); typically `string` or `VFile`]; any value accepted as
|
|
2806
|
+
* `x` in `new VFile(x)`.
|
|
2807
|
+
* @param {ProcessCallback<VFileWithOutput<CompileResult>> | undefined} [done]
|
|
2808
|
+
* Callback (optional).
|
|
2809
|
+
* @returns {Promise<VFile> | undefined}
|
|
2810
|
+
* Nothing if `done` is given.
|
|
2811
|
+
* Otherwise a promise, rejected with a fatal error or resolved with the
|
|
2812
|
+
* processed file.
|
|
2813
|
+
*
|
|
2814
|
+
* The parsed, transformed, and compiled value is available at
|
|
2815
|
+
* `file.value` (see note).
|
|
2816
|
+
*
|
|
2817
|
+
* > **Note**: unified typically compiles by serializing: most
|
|
2818
|
+
* > compilers return `string` (or `Uint8Array`).
|
|
2819
|
+
* > Some compilers, such as the one configured with
|
|
2820
|
+
* > [`rehype-react`][rehype-react], return other values (in this case, a
|
|
2821
|
+
* > React tree).
|
|
2822
|
+
* > If you’re using a compiler that doesn’t serialize, expect different
|
|
2823
|
+
* > result values.
|
|
2824
|
+
* >
|
|
2825
|
+
* > To register custom results in TypeScript, add them to
|
|
2826
|
+
* > {@linkcode CompileResultMap}.
|
|
2827
|
+
*
|
|
2828
|
+
* [rehype-react]: https://github.com/rehypejs/rehype-react
|
|
2829
|
+
*/
|
|
2830
|
+
process(file?: Compatible | undefined): Promise<VFileWithOutput<CompileResult>>;
|
|
2831
|
+
/**
|
|
2832
|
+
* Process the given file as configured on the processor.
|
|
2833
|
+
*
|
|
2834
|
+
* An error is thrown if asynchronous transforms are configured.
|
|
2835
|
+
*
|
|
2836
|
+
* > **Note**: `processSync` freezes the processor if not already *frozen*.
|
|
2837
|
+
*
|
|
2838
|
+
* > **Note**: `processSync` performs the parse, run, and stringify phases.
|
|
2839
|
+
*
|
|
2840
|
+
* @param {Compatible | undefined} [file]
|
|
2841
|
+
* File (optional); typically `string` or `VFile`; any value accepted as
|
|
2842
|
+
* `x` in `new VFile(x)`.
|
|
2843
|
+
* @returns {VFileWithOutput<CompileResult>}
|
|
2844
|
+
* The processed file.
|
|
2845
|
+
*
|
|
2846
|
+
* The parsed, transformed, and compiled value is available at
|
|
2847
|
+
* `file.value` (see note).
|
|
2848
|
+
*
|
|
2849
|
+
* > **Note**: unified typically compiles by serializing: most
|
|
2850
|
+
* > compilers return `string` (or `Uint8Array`).
|
|
2851
|
+
* > Some compilers, such as the one configured with
|
|
2852
|
+
* > [`rehype-react`][rehype-react], return other values (in this case, a
|
|
2853
|
+
* > React tree).
|
|
2854
|
+
* > If you’re using a compiler that doesn’t serialize, expect different
|
|
2855
|
+
* > result values.
|
|
2856
|
+
* >
|
|
2857
|
+
* > To register custom results in TypeScript, add them to
|
|
2858
|
+
* > {@linkcode CompileResultMap}.
|
|
2859
|
+
*
|
|
2860
|
+
* [rehype-react]: https://github.com/rehypejs/rehype-react
|
|
2861
|
+
*/
|
|
2862
|
+
processSync(file?: Compatible | undefined): VFileWithOutput<CompileResult>;
|
|
2863
|
+
/**
|
|
2864
|
+
* Run *transformers* on a syntax tree.
|
|
2865
|
+
*
|
|
2866
|
+
* > **Note**: `run` freezes the processor if not already *frozen*.
|
|
2867
|
+
*
|
|
2868
|
+
* > **Note**: `run` performs the run phase, not other phases.
|
|
2869
|
+
*
|
|
2870
|
+
* @overload
|
|
2871
|
+
* @param {HeadTree extends undefined ? Node : HeadTree} tree
|
|
2872
|
+
* @param {RunCallback<TailTree extends undefined ? Node : TailTree>} done
|
|
2873
|
+
* @returns {undefined}
|
|
2874
|
+
*
|
|
2875
|
+
* @overload
|
|
2876
|
+
* @param {HeadTree extends undefined ? Node : HeadTree} tree
|
|
2877
|
+
* @param {Compatible | undefined} file
|
|
2878
|
+
* @param {RunCallback<TailTree extends undefined ? Node : TailTree>} done
|
|
2879
|
+
* @returns {undefined}
|
|
2880
|
+
*
|
|
2881
|
+
* @overload
|
|
2882
|
+
* @param {HeadTree extends undefined ? Node : HeadTree} tree
|
|
2883
|
+
* @param {Compatible | undefined} [file]
|
|
2884
|
+
* @returns {Promise<TailTree extends undefined ? Node : TailTree>}
|
|
2885
|
+
*
|
|
2886
|
+
* @param {HeadTree extends undefined ? Node : HeadTree} tree
|
|
2887
|
+
* Tree to transform and inspect.
|
|
2888
|
+
* @param {(
|
|
2889
|
+
* RunCallback<TailTree extends undefined ? Node : TailTree> |
|
|
2890
|
+
* Compatible
|
|
2891
|
+
* )} [file]
|
|
2892
|
+
* File associated with `node` (optional); any value accepted as `x` in
|
|
2893
|
+
* `new VFile(x)`.
|
|
2894
|
+
* @param {RunCallback<TailTree extends undefined ? Node : TailTree>} [done]
|
|
2895
|
+
* Callback (optional).
|
|
2896
|
+
* @returns {Promise<TailTree extends undefined ? Node : TailTree> | undefined}
|
|
2897
|
+
* Nothing if `done` is given.
|
|
2898
|
+
* Otherwise, a promise rejected with a fatal error or resolved with the
|
|
2899
|
+
* transformed tree.
|
|
2900
|
+
*/
|
|
2901
|
+
run(tree: HeadTree extends undefined ? Node : HeadTree, done: RunCallback<TailTree extends undefined ? Node : TailTree>): undefined;
|
|
2902
|
+
/**
|
|
2903
|
+
* Run *transformers* on a syntax tree.
|
|
2904
|
+
*
|
|
2905
|
+
* > **Note**: `run` freezes the processor if not already *frozen*.
|
|
2906
|
+
*
|
|
2907
|
+
* > **Note**: `run` performs the run phase, not other phases.
|
|
2908
|
+
*
|
|
2909
|
+
* @overload
|
|
2910
|
+
* @param {HeadTree extends undefined ? Node : HeadTree} tree
|
|
2911
|
+
* @param {RunCallback<TailTree extends undefined ? Node : TailTree>} done
|
|
2912
|
+
* @returns {undefined}
|
|
2913
|
+
*
|
|
2914
|
+
* @overload
|
|
2915
|
+
* @param {HeadTree extends undefined ? Node : HeadTree} tree
|
|
2916
|
+
* @param {Compatible | undefined} file
|
|
2917
|
+
* @param {RunCallback<TailTree extends undefined ? Node : TailTree>} done
|
|
2918
|
+
* @returns {undefined}
|
|
2919
|
+
*
|
|
2920
|
+
* @overload
|
|
2921
|
+
* @param {HeadTree extends undefined ? Node : HeadTree} tree
|
|
2922
|
+
* @param {Compatible | undefined} [file]
|
|
2923
|
+
* @returns {Promise<TailTree extends undefined ? Node : TailTree>}
|
|
2924
|
+
*
|
|
2925
|
+
* @param {HeadTree extends undefined ? Node : HeadTree} tree
|
|
2926
|
+
* Tree to transform and inspect.
|
|
2927
|
+
* @param {(
|
|
2928
|
+
* RunCallback<TailTree extends undefined ? Node : TailTree> |
|
|
2929
|
+
* Compatible
|
|
2930
|
+
* )} [file]
|
|
2931
|
+
* File associated with `node` (optional); any value accepted as `x` in
|
|
2932
|
+
* `new VFile(x)`.
|
|
2933
|
+
* @param {RunCallback<TailTree extends undefined ? Node : TailTree>} [done]
|
|
2934
|
+
* Callback (optional).
|
|
2935
|
+
* @returns {Promise<TailTree extends undefined ? Node : TailTree> | undefined}
|
|
2936
|
+
* Nothing if `done` is given.
|
|
2937
|
+
* Otherwise, a promise rejected with a fatal error or resolved with the
|
|
2938
|
+
* transformed tree.
|
|
2939
|
+
*/
|
|
2940
|
+
run(tree: HeadTree extends undefined ? Node : HeadTree, file: Compatible | undefined, done: RunCallback<TailTree extends undefined ? Node : TailTree>): undefined;
|
|
2941
|
+
/**
|
|
2942
|
+
* Run *transformers* on a syntax tree.
|
|
2943
|
+
*
|
|
2944
|
+
* > **Note**: `run` freezes the processor if not already *frozen*.
|
|
2945
|
+
*
|
|
2946
|
+
* > **Note**: `run` performs the run phase, not other phases.
|
|
2947
|
+
*
|
|
2948
|
+
* @overload
|
|
2949
|
+
* @param {HeadTree extends undefined ? Node : HeadTree} tree
|
|
2950
|
+
* @param {RunCallback<TailTree extends undefined ? Node : TailTree>} done
|
|
2951
|
+
* @returns {undefined}
|
|
2952
|
+
*
|
|
2953
|
+
* @overload
|
|
2954
|
+
* @param {HeadTree extends undefined ? Node : HeadTree} tree
|
|
2955
|
+
* @param {Compatible | undefined} file
|
|
2956
|
+
* @param {RunCallback<TailTree extends undefined ? Node : TailTree>} done
|
|
2957
|
+
* @returns {undefined}
|
|
2958
|
+
*
|
|
2959
|
+
* @overload
|
|
2960
|
+
* @param {HeadTree extends undefined ? Node : HeadTree} tree
|
|
2961
|
+
* @param {Compatible | undefined} [file]
|
|
2962
|
+
* @returns {Promise<TailTree extends undefined ? Node : TailTree>}
|
|
2963
|
+
*
|
|
2964
|
+
* @param {HeadTree extends undefined ? Node : HeadTree} tree
|
|
2965
|
+
* Tree to transform and inspect.
|
|
2966
|
+
* @param {(
|
|
2967
|
+
* RunCallback<TailTree extends undefined ? Node : TailTree> |
|
|
2968
|
+
* Compatible
|
|
2969
|
+
* )} [file]
|
|
2970
|
+
* File associated with `node` (optional); any value accepted as `x` in
|
|
2971
|
+
* `new VFile(x)`.
|
|
2972
|
+
* @param {RunCallback<TailTree extends undefined ? Node : TailTree>} [done]
|
|
2973
|
+
* Callback (optional).
|
|
2974
|
+
* @returns {Promise<TailTree extends undefined ? Node : TailTree> | undefined}
|
|
2975
|
+
* Nothing if `done` is given.
|
|
2976
|
+
* Otherwise, a promise rejected with a fatal error or resolved with the
|
|
2977
|
+
* transformed tree.
|
|
2978
|
+
*/
|
|
2979
|
+
run(tree: HeadTree extends undefined ? Node : HeadTree, file?: Compatible | undefined): Promise<TailTree extends undefined ? Node : TailTree>;
|
|
2980
|
+
/**
|
|
2981
|
+
* Run *transformers* on a syntax tree.
|
|
2982
|
+
*
|
|
2983
|
+
* An error is thrown if asynchronous transforms are configured.
|
|
2984
|
+
*
|
|
2985
|
+
* > **Note**: `runSync` freezes the processor if not already *frozen*.
|
|
2986
|
+
*
|
|
2987
|
+
* > **Note**: `runSync` performs the run phase, not other phases.
|
|
2988
|
+
*
|
|
2989
|
+
* @param {HeadTree extends undefined ? Node : HeadTree} tree
|
|
2990
|
+
* Tree to transform and inspect.
|
|
2991
|
+
* @param {Compatible | undefined} [file]
|
|
2992
|
+
* File associated with `node` (optional); any value accepted as `x` in
|
|
2993
|
+
* `new VFile(x)`.
|
|
2994
|
+
* @returns {TailTree extends undefined ? Node : TailTree}
|
|
2995
|
+
* Transformed tree.
|
|
2996
|
+
*/
|
|
2997
|
+
runSync(tree: HeadTree extends undefined ? Node : HeadTree, file?: Compatible | undefined): TailTree extends undefined ? Node : TailTree;
|
|
2998
|
+
/**
|
|
2999
|
+
* Compile a syntax tree.
|
|
3000
|
+
*
|
|
3001
|
+
* > **Note**: `stringify` freezes the processor if not already *frozen*.
|
|
3002
|
+
*
|
|
3003
|
+
* > **Note**: `stringify` performs the stringify phase, not the run phase
|
|
3004
|
+
* > or other phases.
|
|
3005
|
+
*
|
|
3006
|
+
* @param {CompileTree extends undefined ? Node : CompileTree} tree
|
|
3007
|
+
* Tree to compile.
|
|
3008
|
+
* @param {Compatible | undefined} [file]
|
|
3009
|
+
* File associated with `node` (optional); any value accepted as `x` in
|
|
3010
|
+
* `new VFile(x)`.
|
|
3011
|
+
* @returns {CompileResult extends undefined ? Value : CompileResult}
|
|
3012
|
+
* Textual representation of the tree (see note).
|
|
3013
|
+
*
|
|
3014
|
+
* > **Note**: unified typically compiles by serializing: most compilers
|
|
3015
|
+
* > return `string` (or `Uint8Array`).
|
|
3016
|
+
* > Some compilers, such as the one configured with
|
|
3017
|
+
* > [`rehype-react`][rehype-react], return other values (in this case, a
|
|
3018
|
+
* > React tree).
|
|
3019
|
+
* > If you’re using a compiler that doesn’t serialize, expect different
|
|
3020
|
+
* > result values.
|
|
3021
|
+
* >
|
|
3022
|
+
* > To register custom results in TypeScript, add them to
|
|
3023
|
+
* > {@linkcode CompileResultMap}.
|
|
3024
|
+
*
|
|
3025
|
+
* [rehype-react]: https://github.com/rehypejs/rehype-react
|
|
3026
|
+
*/
|
|
3027
|
+
stringify(tree: CompileTree extends undefined ? Node : CompileTree, file?: Compatible | undefined): CompileResult extends undefined ? Value : CompileResult;
|
|
3028
|
+
/**
|
|
3029
|
+
* Configure the processor to use a plugin, a list of usable values, or a
|
|
3030
|
+
* preset.
|
|
3031
|
+
*
|
|
3032
|
+
* If the processor is already using a plugin, the previous plugin
|
|
3033
|
+
* configuration is changed based on the options that are passed in.
|
|
3034
|
+
* In other words, the plugin is not added a second time.
|
|
3035
|
+
*
|
|
3036
|
+
* > **Note**: `use` cannot be called on *frozen* processors.
|
|
3037
|
+
* > Call the processor first to create a new unfrozen processor.
|
|
3038
|
+
*
|
|
3039
|
+
* @example
|
|
3040
|
+
* There are many ways to pass plugins to `.use()`.
|
|
3041
|
+
* This example gives an overview:
|
|
3042
|
+
*
|
|
3043
|
+
* ```js
|
|
3044
|
+
* import {unified} from 'unified'
|
|
3045
|
+
*
|
|
3046
|
+
* unified()
|
|
3047
|
+
* // Plugin with options:
|
|
3048
|
+
* .use(pluginA, {x: true, y: true})
|
|
3049
|
+
* // Passing the same plugin again merges configuration (to `{x: true, y: false, z: true}`):
|
|
3050
|
+
* .use(pluginA, {y: false, z: true})
|
|
3051
|
+
* // Plugins:
|
|
3052
|
+
* .use([pluginB, pluginC])
|
|
3053
|
+
* // Two plugins, the second with options:
|
|
3054
|
+
* .use([pluginD, [pluginE, {}]])
|
|
3055
|
+
* // Preset with plugins and settings:
|
|
3056
|
+
* .use({plugins: [pluginF, [pluginG, {}]], settings: {position: false}})
|
|
3057
|
+
* // Settings only:
|
|
3058
|
+
* .use({settings: {position: false}})
|
|
3059
|
+
* ```
|
|
3060
|
+
*
|
|
3061
|
+
* @template {Array<unknown>} [Parameters=[]]
|
|
3062
|
+
* @template {Node | string | undefined} [Input=undefined]
|
|
3063
|
+
* @template [Output=Input]
|
|
3064
|
+
*
|
|
3065
|
+
* @overload
|
|
3066
|
+
* @param {Preset | null | undefined} [preset]
|
|
3067
|
+
* @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
|
|
3068
|
+
*
|
|
3069
|
+
* @overload
|
|
3070
|
+
* @param {PluggableList} list
|
|
3071
|
+
* @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
|
|
3072
|
+
*
|
|
3073
|
+
* @overload
|
|
3074
|
+
* @param {Plugin<Parameters, Input, Output>} plugin
|
|
3075
|
+
* @param {...(Parameters | [boolean])} parameters
|
|
3076
|
+
* @returns {UsePlugin<ParseTree, HeadTree, TailTree, CompileTree, CompileResult, Input, Output>}
|
|
3077
|
+
*
|
|
3078
|
+
* @param {PluggableList | Plugin | Preset | null | undefined} value
|
|
3079
|
+
* Usable value.
|
|
3080
|
+
* @param {...unknown} parameters
|
|
3081
|
+
* Parameters, when a plugin is given as a usable value.
|
|
3082
|
+
* @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
|
|
3083
|
+
* Current processor.
|
|
3084
|
+
*/
|
|
3085
|
+
use<Parameters_1 extends unknown[] = [], Input extends string | unist.Node | undefined = undefined, Output = Input>(preset?: Preset | null | undefined): Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>;
|
|
3086
|
+
/**
|
|
3087
|
+
* Configure the processor to use a plugin, a list of usable values, or a
|
|
3088
|
+
* preset.
|
|
3089
|
+
*
|
|
3090
|
+
* If the processor is already using a plugin, the previous plugin
|
|
3091
|
+
* configuration is changed based on the options that are passed in.
|
|
3092
|
+
* In other words, the plugin is not added a second time.
|
|
3093
|
+
*
|
|
3094
|
+
* > **Note**: `use` cannot be called on *frozen* processors.
|
|
3095
|
+
* > Call the processor first to create a new unfrozen processor.
|
|
3096
|
+
*
|
|
3097
|
+
* @example
|
|
3098
|
+
* There are many ways to pass plugins to `.use()`.
|
|
3099
|
+
* This example gives an overview:
|
|
3100
|
+
*
|
|
3101
|
+
* ```js
|
|
3102
|
+
* import {unified} from 'unified'
|
|
3103
|
+
*
|
|
3104
|
+
* unified()
|
|
3105
|
+
* // Plugin with options:
|
|
3106
|
+
* .use(pluginA, {x: true, y: true})
|
|
3107
|
+
* // Passing the same plugin again merges configuration (to `{x: true, y: false, z: true}`):
|
|
3108
|
+
* .use(pluginA, {y: false, z: true})
|
|
3109
|
+
* // Plugins:
|
|
3110
|
+
* .use([pluginB, pluginC])
|
|
3111
|
+
* // Two plugins, the second with options:
|
|
3112
|
+
* .use([pluginD, [pluginE, {}]])
|
|
3113
|
+
* // Preset with plugins and settings:
|
|
3114
|
+
* .use({plugins: [pluginF, [pluginG, {}]], settings: {position: false}})
|
|
3115
|
+
* // Settings only:
|
|
3116
|
+
* .use({settings: {position: false}})
|
|
3117
|
+
* ```
|
|
3118
|
+
*
|
|
3119
|
+
* @template {Array<unknown>} [Parameters=[]]
|
|
3120
|
+
* @template {Node | string | undefined} [Input=undefined]
|
|
3121
|
+
* @template [Output=Input]
|
|
3122
|
+
*
|
|
3123
|
+
* @overload
|
|
3124
|
+
* @param {Preset | null | undefined} [preset]
|
|
3125
|
+
* @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
|
|
3126
|
+
*
|
|
3127
|
+
* @overload
|
|
3128
|
+
* @param {PluggableList} list
|
|
3129
|
+
* @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
|
|
3130
|
+
*
|
|
3131
|
+
* @overload
|
|
3132
|
+
* @param {Plugin<Parameters, Input, Output>} plugin
|
|
3133
|
+
* @param {...(Parameters | [boolean])} parameters
|
|
3134
|
+
* @returns {UsePlugin<ParseTree, HeadTree, TailTree, CompileTree, CompileResult, Input, Output>}
|
|
3135
|
+
*
|
|
3136
|
+
* @param {PluggableList | Plugin | Preset | null | undefined} value
|
|
3137
|
+
* Usable value.
|
|
3138
|
+
* @param {...unknown} parameters
|
|
3139
|
+
* Parameters, when a plugin is given as a usable value.
|
|
3140
|
+
* @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
|
|
3141
|
+
* Current processor.
|
|
3142
|
+
*/
|
|
3143
|
+
use<Parameters_1 extends unknown[] = [], Input extends string | unist.Node | undefined = undefined, Output = Input>(list: PluggableList): Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>;
|
|
3144
|
+
/**
|
|
3145
|
+
* Configure the processor to use a plugin, a list of usable values, or a
|
|
3146
|
+
* preset.
|
|
3147
|
+
*
|
|
3148
|
+
* If the processor is already using a plugin, the previous plugin
|
|
3149
|
+
* configuration is changed based on the options that are passed in.
|
|
3150
|
+
* In other words, the plugin is not added a second time.
|
|
3151
|
+
*
|
|
3152
|
+
* > **Note**: `use` cannot be called on *frozen* processors.
|
|
3153
|
+
* > Call the processor first to create a new unfrozen processor.
|
|
3154
|
+
*
|
|
3155
|
+
* @example
|
|
3156
|
+
* There are many ways to pass plugins to `.use()`.
|
|
3157
|
+
* This example gives an overview:
|
|
3158
|
+
*
|
|
3159
|
+
* ```js
|
|
3160
|
+
* import {unified} from 'unified'
|
|
3161
|
+
*
|
|
3162
|
+
* unified()
|
|
3163
|
+
* // Plugin with options:
|
|
3164
|
+
* .use(pluginA, {x: true, y: true})
|
|
3165
|
+
* // Passing the same plugin again merges configuration (to `{x: true, y: false, z: true}`):
|
|
3166
|
+
* .use(pluginA, {y: false, z: true})
|
|
3167
|
+
* // Plugins:
|
|
3168
|
+
* .use([pluginB, pluginC])
|
|
3169
|
+
* // Two plugins, the second with options:
|
|
3170
|
+
* .use([pluginD, [pluginE, {}]])
|
|
3171
|
+
* // Preset with plugins and settings:
|
|
3172
|
+
* .use({plugins: [pluginF, [pluginG, {}]], settings: {position: false}})
|
|
3173
|
+
* // Settings only:
|
|
3174
|
+
* .use({settings: {position: false}})
|
|
3175
|
+
* ```
|
|
3176
|
+
*
|
|
3177
|
+
* @template {Array<unknown>} [Parameters=[]]
|
|
3178
|
+
* @template {Node | string | undefined} [Input=undefined]
|
|
3179
|
+
* @template [Output=Input]
|
|
3180
|
+
*
|
|
3181
|
+
* @overload
|
|
3182
|
+
* @param {Preset | null | undefined} [preset]
|
|
3183
|
+
* @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
|
|
3184
|
+
*
|
|
3185
|
+
* @overload
|
|
3186
|
+
* @param {PluggableList} list
|
|
3187
|
+
* @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
|
|
3188
|
+
*
|
|
3189
|
+
* @overload
|
|
3190
|
+
* @param {Plugin<Parameters, Input, Output>} plugin
|
|
3191
|
+
* @param {...(Parameters | [boolean])} parameters
|
|
3192
|
+
* @returns {UsePlugin<ParseTree, HeadTree, TailTree, CompileTree, CompileResult, Input, Output>}
|
|
3193
|
+
*
|
|
3194
|
+
* @param {PluggableList | Plugin | Preset | null | undefined} value
|
|
3195
|
+
* Usable value.
|
|
3196
|
+
* @param {...unknown} parameters
|
|
3197
|
+
* Parameters, when a plugin is given as a usable value.
|
|
3198
|
+
* @returns {Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>}
|
|
3199
|
+
* Current processor.
|
|
3200
|
+
*/
|
|
3201
|
+
use<Parameters_1 extends unknown[] = [], Input extends string | unist.Node | undefined = undefined, Output = Input>(plugin: Plugin$1<Parameters_1, Input, Output>, ...parameters: Parameters_1 | [boolean]): UsePlugin<ParseTree, HeadTree, TailTree, CompileTree, CompileResult, Input, Output>;
|
|
3202
|
+
}
|
|
3203
|
+
type Pipeline = Pipeline$1;
|
|
3204
|
+
type Node = unist.Node;
|
|
3205
|
+
type Compatible = Compatible$1;
|
|
3206
|
+
type Value = Value$1;
|
|
3207
|
+
type CompileResultMap = CompileResultMap$1;
|
|
3208
|
+
type Data = Data$2;
|
|
3209
|
+
type Settings$1 = Settings$3;
|
|
3210
|
+
/**
|
|
3211
|
+
* Acceptable results from compilers.
|
|
3212
|
+
*
|
|
3213
|
+
* To register custom results, add them to
|
|
3214
|
+
* {@linkcode CompileResultMap }.
|
|
3215
|
+
*/
|
|
3216
|
+
type CompileResults = CompileResultMap[keyof CompileResultMap];
|
|
3217
|
+
/**
|
|
3218
|
+
* A **compiler** handles the compiling of a syntax tree to something else
|
|
3219
|
+
* (in most cases, text) (TypeScript type).
|
|
3220
|
+
*
|
|
3221
|
+
* It is used in the stringify phase and called with a {@linkcode Node }
|
|
3222
|
+
* and {@linkcode VFile } representation of the document to compile.
|
|
3223
|
+
* It should return the textual representation of the given tree (typically
|
|
3224
|
+
* `string`).
|
|
3225
|
+
*
|
|
3226
|
+
* > **Note**: unified typically compiles by serializing: most compilers
|
|
3227
|
+
* > return `string` (or `Uint8Array`).
|
|
3228
|
+
* > Some compilers, such as the one configured with
|
|
3229
|
+
* > [`rehype-react`][rehype-react], return other values (in this case, a
|
|
3230
|
+
* > React tree).
|
|
3231
|
+
* > If you’re using a compiler that doesn’t serialize, expect different
|
|
3232
|
+
* > result values.
|
|
3233
|
+
* >
|
|
3234
|
+
* > To register custom results in TypeScript, add them to
|
|
3235
|
+
* > {@linkcode CompileResultMap }.
|
|
3236
|
+
*
|
|
3237
|
+
* [rehype-react]: https://github.com/rehypejs/rehype-react
|
|
3238
|
+
*/
|
|
3239
|
+
type Compiler<Tree extends unist.Node = unist.Node, Result extends CompileResults = CompileResults> = (tree: Tree, file: VFile) => Result;
|
|
3240
|
+
/**
|
|
3241
|
+
* A **parser** handles the parsing of text to a syntax tree.
|
|
3242
|
+
*
|
|
3243
|
+
* It is used in the parse phase and is called with a `string` and
|
|
3244
|
+
* {@linkcode VFile } of the document to parse.
|
|
3245
|
+
* It must return the syntax tree representation of the given file
|
|
3246
|
+
* ({@linkcode Node }).
|
|
3247
|
+
*/
|
|
3248
|
+
type Parser<Tree extends unist.Node = unist.Node> = (document: string, file: VFile) => Tree;
|
|
3249
|
+
/**
|
|
3250
|
+
* Union of the different ways to add plugins and settings.
|
|
3251
|
+
*/
|
|
3252
|
+
type Pluggable = (Plugin$1<Array<any>, any, any> | PluginTuple<Array<any>, any, any> | Preset);
|
|
3253
|
+
/**
|
|
3254
|
+
* List of plugins and presets.
|
|
3255
|
+
*/
|
|
3256
|
+
type PluggableList = Array<Pluggable>;
|
|
3257
|
+
/**
|
|
3258
|
+
* Single plugin.
|
|
3259
|
+
*
|
|
3260
|
+
* Plugins configure the processors they are applied on in the following
|
|
3261
|
+
* ways:
|
|
3262
|
+
*
|
|
3263
|
+
* * they change the processor, such as the parser, the compiler, or by
|
|
3264
|
+
* configuring data
|
|
3265
|
+
* * they specify how to handle trees and files
|
|
3266
|
+
*
|
|
3267
|
+
* In practice, they are functions that can receive options and configure the
|
|
3268
|
+
* processor (`this`).
|
|
3269
|
+
*
|
|
3270
|
+
* > **Note**: plugins are called when the processor is *frozen*, not when
|
|
3271
|
+
* > they are applied.
|
|
3272
|
+
*/
|
|
3273
|
+
type Plugin$1<PluginParameters extends unknown[] = [], Input extends string | unist.Node | undefined = unist.Node, Output = Input> = ((this: Processor, ...parameters: PluginParameters) => Input extends string ? Output extends Node | undefined ? undefined | void : never : Output extends CompileResults ? Input extends Node | undefined ? undefined | void : never : Transformer<Input extends Node ? Input : Node, Output extends Node ? Output : Node> | undefined | void);
|
|
3274
|
+
/**
|
|
3275
|
+
* Tuple of a plugin and its configuration.
|
|
3276
|
+
*
|
|
3277
|
+
* The first item is a plugin, the rest are its parameters.
|
|
3278
|
+
*/
|
|
3279
|
+
type PluginTuple<TupleParameters extends unknown[] = [], Input extends string | unist.Node | undefined = undefined, Output = undefined> = ([
|
|
3280
|
+
plugin: Plugin$1<TupleParameters, Input, Output>,
|
|
3281
|
+
...parameters: TupleParameters
|
|
3282
|
+
]);
|
|
3283
|
+
/**
|
|
3284
|
+
* Sharable configuration.
|
|
3285
|
+
*
|
|
3286
|
+
* They can contain plugins and settings.
|
|
3287
|
+
*/
|
|
3288
|
+
type Preset = {
|
|
3289
|
+
/**
|
|
3290
|
+
* List of plugins and presets (optional).
|
|
3291
|
+
*/
|
|
3292
|
+
plugins?: PluggableList | undefined;
|
|
3293
|
+
/**
|
|
3294
|
+
* Shared settings for parsers and compilers (optional).
|
|
3295
|
+
*/
|
|
3296
|
+
settings?: Settings$1 | undefined;
|
|
3297
|
+
};
|
|
3298
|
+
/**
|
|
3299
|
+
* Callback called when the process is done.
|
|
3300
|
+
*
|
|
3301
|
+
* Called with either an error or a result.
|
|
3302
|
+
*/
|
|
3303
|
+
type ProcessCallback<File extends VFile = VFile> = (error?: Error | undefined, file?: File | undefined) => undefined;
|
|
3304
|
+
/**
|
|
3305
|
+
* Callback called when transformers are done.
|
|
3306
|
+
*
|
|
3307
|
+
* Called with either an error or results.
|
|
3308
|
+
*/
|
|
3309
|
+
type RunCallback<Tree extends unist.Node = unist.Node> = (error?: Error | undefined, tree?: Tree | undefined, file?: VFile | undefined) => undefined;
|
|
3310
|
+
/**
|
|
3311
|
+
* Callback passed to transforms.
|
|
3312
|
+
*
|
|
3313
|
+
* If the signature of a `transformer` accepts a third argument, the
|
|
3314
|
+
* transformer may perform asynchronous operations, and must call it.
|
|
3315
|
+
*/
|
|
3316
|
+
type TransformCallback<Output extends unist.Node = unist.Node> = (error?: Error | undefined, tree?: Output | undefined, file?: VFile | undefined) => undefined;
|
|
3317
|
+
/**
|
|
3318
|
+
* Transformers handle syntax trees and files.
|
|
3319
|
+
*
|
|
3320
|
+
* They are functions that are called each time a syntax tree and file are
|
|
3321
|
+
* passed through the run phase.
|
|
3322
|
+
* When an error occurs in them (either because it’s thrown, returned,
|
|
3323
|
+
* rejected, or passed to `next`), the process stops.
|
|
3324
|
+
*
|
|
3325
|
+
* The run phase is handled by [`trough`][trough], see its documentation for
|
|
3326
|
+
* the exact semantics of these functions.
|
|
3327
|
+
*
|
|
3328
|
+
* > **Note**: you should likely ignore `next`: don’t accept it.
|
|
3329
|
+
* > it supports callback-style async work.
|
|
3330
|
+
* > But promises are likely easier to reason about.
|
|
3331
|
+
*
|
|
3332
|
+
* [trough]: https://github.com/wooorm/trough#function-fninput-next
|
|
3333
|
+
*/
|
|
3334
|
+
type Transformer<Input extends unist.Node = unist.Node, Output extends unist.Node = Input> = (tree: Input, file: VFile, next: TransformCallback<Output>) => (Promise<Output | undefined | void> | Promise<never> | // For some reason this is needed separately.
|
|
3335
|
+
Output | Error | undefined | void);
|
|
3336
|
+
/**
|
|
3337
|
+
* Create a processor based on the input/output of a {@link Plugin plugin}.
|
|
3338
|
+
*/
|
|
3339
|
+
type UsePlugin<ParseTree extends unist.Node | undefined, HeadTree extends unist.Node | undefined, TailTree extends unist.Node | undefined, CompileTree extends unist.Node | undefined, CompileResult extends CompileResults | undefined, Input extends string | unist.Node | undefined, Output> = (Input extends string ? Output extends Node | undefined ? Processor<Output extends undefined ? ParseTree : Output, HeadTree, TailTree, CompileTree, CompileResult> : Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult> : Output extends CompileResults ? Input extends Node | undefined ? Processor<ParseTree, HeadTree, TailTree, Input extends undefined ? CompileTree : Input, Output extends undefined ? CompileResult : Output> : Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult> : Input extends Node | undefined ? Output extends Node | undefined ? Processor<ParseTree, HeadTree extends undefined ? Input : HeadTree, Output extends undefined ? TailTree : Output, CompileTree, CompileResult> : Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult> : Processor<ParseTree, HeadTree, TailTree, CompileTree, CompileResult>);
|
|
3340
|
+
/**
|
|
3341
|
+
* Type to generate a {@linkcode VFile } corresponding to a compiler result.
|
|
3342
|
+
*
|
|
3343
|
+
* If a result that is not acceptable on a `VFile` is used, that will
|
|
3344
|
+
* be stored on the `result` field of {@linkcode VFile }.
|
|
3345
|
+
*/
|
|
3346
|
+
type VFileWithOutput<Result extends CompileResults | undefined> = (Result extends Value | undefined ? VFile : VFile & {
|
|
3347
|
+
result: Result;
|
|
3348
|
+
});
|
|
3349
|
+
|
|
3350
|
+
/**
|
|
3351
|
+
* @todo rename to PageMeta
|
|
3352
|
+
*
|
|
3353
|
+
* Represents metadata for a content page.
|
|
3354
|
+
* Usually used as md/mdx frontmatter.
|
|
3355
|
+
*
|
|
3356
|
+
*/
|
|
3357
|
+
interface Metadata<P = void> {
|
|
3358
|
+
/** The main title of the content - by default visible in navigation and page title */
|
|
3359
|
+
title: string;
|
|
3360
|
+
/** Title to display in the sidebar navigation */
|
|
3361
|
+
sidebarTitle?: string;
|
|
3362
|
+
/** Display description for SEO/llms.txt purposes */
|
|
3363
|
+
description?: string;
|
|
3364
|
+
/** Icon identifier for the navigation item */
|
|
3365
|
+
icon?: string;
|
|
3366
|
+
/** Layout type for the content display */
|
|
3367
|
+
layout?: PageLayout;
|
|
3368
|
+
/** Max depth for table of contents */
|
|
3369
|
+
maxTocDepth?: number;
|
|
3370
|
+
/** External URL for the content */
|
|
3371
|
+
url?: string;
|
|
3372
|
+
/**
|
|
3373
|
+
* If false, hide the copy page button
|
|
3374
|
+
*/
|
|
3375
|
+
copyPage?: boolean;
|
|
3376
|
+
/**
|
|
3377
|
+
* @internal
|
|
3378
|
+
*
|
|
3379
|
+
* The type of component to render this content with
|
|
3380
|
+
*/
|
|
3381
|
+
component?: "docs" | "atlas" | "home" | "firstslide" | "bloghome" | "blogpost";
|
|
3382
|
+
/**
|
|
3383
|
+
* @internal
|
|
3384
|
+
*
|
|
3385
|
+
* Properties specific to the component type
|
|
3386
|
+
*/
|
|
3387
|
+
componentProps?: P;
|
|
3388
|
+
/**
|
|
3389
|
+
* @internal
|
|
3390
|
+
*
|
|
3391
|
+
* Group for sidebar navigation
|
|
3392
|
+
*/
|
|
3393
|
+
group?: string[];
|
|
3394
|
+
/**
|
|
3395
|
+
* Uniform for API Docs references
|
|
3396
|
+
*/
|
|
3397
|
+
uniform?: PageMetaUniform;
|
|
3398
|
+
/**
|
|
3399
|
+
* @internal
|
|
3400
|
+
*
|
|
3401
|
+
* used for graphql references
|
|
3402
|
+
*/
|
|
3403
|
+
graphql?: string;
|
|
3404
|
+
/**
|
|
3405
|
+
* @internal
|
|
3406
|
+
*
|
|
3407
|
+
* used for openapi references
|
|
3408
|
+
*/
|
|
3409
|
+
openapi?: string;
|
|
3410
|
+
/**
|
|
3411
|
+
* If true, hide from navigation
|
|
3412
|
+
*/
|
|
3413
|
+
hidden?: boolean;
|
|
3414
|
+
/**
|
|
3415
|
+
* Optional 'tocCard' for custom cards in the table of contents
|
|
3416
|
+
*
|
|
3417
|
+
* @example
|
|
3418
|
+
* ```
|
|
3419
|
+
* tocCard: {
|
|
3420
|
+
* link: "https://github.com/livesession/livesession-browser",
|
|
3421
|
+
* title: "Checkout the code",
|
|
3422
|
+
* description: "Check how to use the LiveSession Browser SDK",
|
|
3423
|
+
* icon: "github"
|
|
3424
|
+
* }
|
|
3425
|
+
* ```
|
|
3426
|
+
*/
|
|
3427
|
+
tocCard?: TocCard | TocCard[];
|
|
3428
|
+
}
|
|
3429
|
+
interface TocCard {
|
|
3430
|
+
/** 'link' to the card */
|
|
3431
|
+
link: string;
|
|
3432
|
+
/** 'title' of the card */
|
|
3433
|
+
title: string;
|
|
3434
|
+
/** 'description' of the card */
|
|
3435
|
+
description: string;
|
|
3436
|
+
/** 'icon' of the card */
|
|
3437
|
+
icon?: string;
|
|
3438
|
+
}
|
|
3439
|
+
type PageMetaUniform = string | PageMetaUniformDetails;
|
|
3440
|
+
/**
|
|
3441
|
+
* Uniform details allows to specify more options than just the path, for example eager loading
|
|
3442
|
+
*/
|
|
3443
|
+
type PageMetaUniformDetails = {
|
|
3444
|
+
/**
|
|
3445
|
+
* Path to the uniform file / url
|
|
3446
|
+
*/
|
|
3447
|
+
path: string;
|
|
3448
|
+
/**
|
|
3449
|
+
* If true, the uniform will be eagerly loaded
|
|
3450
|
+
*/
|
|
3451
|
+
eager?: boolean;
|
|
3452
|
+
};
|
|
3453
|
+
type PageLayout = "wide" | "page" | "reader";
|
|
3454
|
+
|
|
6
3455
|
type RawTheme = {
|
|
7
3456
|
name?: string;
|
|
8
3457
|
type?: string;
|
|
@@ -1205,27 +4654,48 @@ type PluginComponents = {
|
|
|
1205
4654
|
component: React__default.ComponentType<any>;
|
|
1206
4655
|
name?: string;
|
|
1207
4656
|
dist?: string;
|
|
4657
|
+
isInline?: boolean;
|
|
1208
4658
|
}[] | {
|
|
1209
4659
|
[component: string]: React__default.ComponentType<any>;
|
|
1210
4660
|
};
|
|
4661
|
+
interface HookCallbackArgs {
|
|
4662
|
+
metadata: Metadata<any>;
|
|
4663
|
+
}
|
|
1211
4664
|
/**
|
|
1212
4665
|
* Plugin interface
|
|
1213
4666
|
*
|
|
1214
4667
|
* @example
|
|
1215
4668
|
* ```ts
|
|
1216
4669
|
* function myPlugin(): Plugin {
|
|
1217
|
-
* return {
|
|
1218
|
-
*
|
|
1219
|
-
*
|
|
1220
|
-
*
|
|
1221
|
-
*
|
|
1222
|
-
*
|
|
1223
|
-
*
|
|
1224
|
-
*
|
|
1225
|
-
*
|
|
1226
|
-
*
|
|
1227
|
-
*
|
|
1228
|
-
* components:
|
|
4670
|
+
* return (settings) => {
|
|
4671
|
+
* return {
|
|
4672
|
+
* name: "my-plugin",
|
|
4673
|
+
* vite: [
|
|
4674
|
+
* {
|
|
4675
|
+
* name: "my-vite-plugin",
|
|
4676
|
+
* }
|
|
4677
|
+
* ],
|
|
4678
|
+
* uniform: [
|
|
4679
|
+
* pluginOpenAIMeta,
|
|
4680
|
+
* ],
|
|
4681
|
+
* components: [
|
|
4682
|
+
* {
|
|
4683
|
+
* component: MyComponent,
|
|
4684
|
+
* name: "MyComponent",
|
|
4685
|
+
* dist: "./dist/MyComponent.js"
|
|
4686
|
+
* }
|
|
4687
|
+
* ],
|
|
4688
|
+
* head: [
|
|
4689
|
+
* ["style", {}, "body { margin: 0; }"]
|
|
4690
|
+
* ],
|
|
4691
|
+
* markdown: {
|
|
4692
|
+
* remark: [remarkPlugin],
|
|
4693
|
+
* rehype: [rehypePlugin],
|
|
4694
|
+
* },
|
|
4695
|
+
* hooks: {
|
|
4696
|
+
* applyComponents(cfg) {
|
|
4697
|
+
* return cfg?.metadata?.component === "my-plugin";
|
|
4698
|
+
* }
|
|
1229
4699
|
* }
|
|
1230
4700
|
* }
|
|
1231
4701
|
* }
|
|
@@ -1234,15 +4704,19 @@ type PluginComponents = {
|
|
|
1234
4704
|
*/
|
|
1235
4705
|
interface PluginConfig {
|
|
1236
4706
|
name: string;
|
|
1237
|
-
vite?: Plugin$
|
|
4707
|
+
vite?: Plugin$2[];
|
|
1238
4708
|
uniform?: UniformPlugin<any>[];
|
|
1239
4709
|
components?: PluginComponents;
|
|
1240
4710
|
head?: HeadConfig[];
|
|
1241
4711
|
markdown?: {
|
|
1242
|
-
remark
|
|
1243
|
-
rehype
|
|
4712
|
+
remark?: Plugin$1[];
|
|
4713
|
+
rehype?: Plugin$1[];
|
|
4714
|
+
remarkRehypeHandlers?: any;
|
|
4715
|
+
};
|
|
4716
|
+
hooks?: {
|
|
4717
|
+
applyComponents?: (cfg: HookCallbackArgs) => boolean;
|
|
1244
4718
|
};
|
|
1245
4719
|
}
|
|
1246
4720
|
type Plugin = (settings: Readonly<Settings>) => PluginConfig;
|
|
1247
4721
|
|
|
1248
|
-
export type { Plugin, PluginComponents, PluginConfig };
|
|
4722
|
+
export type { HookCallbackArgs, Plugin, PluginComponents, PluginConfig };
|