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