@staticbolt/core 1.0.0-beta.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 +22 -0
- package/README.md +70 -0
- package/lib/cli/index.d.mts +1 -0
- package/lib/cli/index.mjs +177 -0
- package/lib/cli/index.mjs.map +1 -0
- package/lib/dependency-tracker-BuZfopIj.mjs +485 -0
- package/lib/dependency-tracker-BuZfopIj.mjs.map +1 -0
- package/lib/index.d.mts +1734 -0
- package/lib/index.d.mts.map +1 -0
- package/lib/index.mjs +11 -0
- package/lib/index.mjs.map +1 -0
- package/lib/logger-BuxMGhij.mjs +190 -0
- package/lib/logger-BuxMGhij.mjs.map +1 -0
- package/lib/plugins/index.d.mts +1181 -0
- package/lib/plugins/index.d.mts.map +1 -0
- package/lib/plugins/index.mjs +8559 -0
- package/lib/plugins/index.mjs.map +1 -0
- package/package.json +112 -0
package/lib/index.d.mts
ADDED
|
@@ -0,0 +1,1734 @@
|
|
|
1
|
+
import { basename, extname, isAbsolute, parse, resolve } from "node:path";
|
|
2
|
+
import { Document, HTMLElement, HTMLElement as HTMLElement$1, Node } from "@staticbolt/node-html-parser";
|
|
3
|
+
import postcss, { Node as Node$1, Postcss } from "postcss";
|
|
4
|
+
import { NodePath as NodePath$1 } from "@babel/traverse";
|
|
5
|
+
import { ObjectEncodingOptions, OpenMode, PathLike, PathOrFileDescriptor } from "node:fs";
|
|
6
|
+
import { FileHandle } from "node:fs/promises";
|
|
7
|
+
import * as t from "@babel/types";
|
|
8
|
+
import { Node as Node$2 } from "@babel/types";
|
|
9
|
+
import { ParseResult } from "@babel/parser";
|
|
10
|
+
import { onRequestHookHandler } from "fastify";
|
|
11
|
+
import { FSWatcher } from "chokidar";
|
|
12
|
+
import * as z from "zod";
|
|
13
|
+
import * as _$_staticbolt_args_parser0 from "@staticbolt/args-parser";
|
|
14
|
+
import { Argument, Option, Subcommand, defineArguments, defineOptions, defineSubcommand } from "@staticbolt/args-parser";
|
|
15
|
+
import { App as App$1, AppConfig as AppConfig$1, BabelAst as BabelAst$1, BinaryAssetMetadata as BinaryAssetMetadata$1, CliProgram as CliProgram$1, Document as Document$1, HTMLElement as HTMLElement$2, HtmlMetadata as HtmlMetadata$1, MarkdownAst as MarkdownAst$1, MarkdownMetadata as MarkdownMetadata$1, MetadataBase as MetadataBase$1, MetadataSource as MetadataSource$1, PackageMetadata as PackageMetadata$1, Plugin as Plugin$1, PostcssAst as PostcssAst$1, ScriptMetadata as ScriptMetadata$1, ServerReply as ServerReply$1, ServerRequest as ServerRequest$1, StyleMetadata as StyleMetadata$1, SvgMetadata as SvgMetadata$1, TextAssetMetadata as TextAssetMetadata$1, WebManifestMetadata as WebManifestMetadata$1 } from "@staticbolt/core";
|
|
16
|
+
import { ImageResource, WebAppManifest } from "web-app-manifest";
|
|
17
|
+
import { Abortable } from "node:events";
|
|
18
|
+
|
|
19
|
+
//#region ../../node_modules/@types/unist/index.d.ts
|
|
20
|
+
// ## Interfaces
|
|
21
|
+
/**
|
|
22
|
+
* Info associated with nodes by the ecosystem.
|
|
23
|
+
*
|
|
24
|
+
* This space is guaranteed to never be specified by unist or specifications
|
|
25
|
+
* implementing unist.
|
|
26
|
+
* But you can use it in utilities and plugins to store data.
|
|
27
|
+
*
|
|
28
|
+
* This type can be augmented to register custom data.
|
|
29
|
+
* For example:
|
|
30
|
+
*
|
|
31
|
+
* ```ts
|
|
32
|
+
* declare module 'unist' {
|
|
33
|
+
* interface Data {
|
|
34
|
+
* // `someNode.data.myId` is typed as `number | undefined`
|
|
35
|
+
* myId?: number | undefined
|
|
36
|
+
* }
|
|
37
|
+
* }
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
40
|
+
interface Data$1 {}
|
|
41
|
+
/**
|
|
42
|
+
* One place in a source file.
|
|
43
|
+
*/
|
|
44
|
+
interface Point {
|
|
45
|
+
/**
|
|
46
|
+
* Line in a source file (1-indexed integer).
|
|
47
|
+
*/
|
|
48
|
+
line: number;
|
|
49
|
+
/**
|
|
50
|
+
* Column in a source file (1-indexed integer).
|
|
51
|
+
*/
|
|
52
|
+
column: number;
|
|
53
|
+
/**
|
|
54
|
+
* Character in a source file (0-indexed integer).
|
|
55
|
+
*/
|
|
56
|
+
offset?: number | undefined;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Position of a node in a source document.
|
|
60
|
+
*
|
|
61
|
+
* A position is a range between two points.
|
|
62
|
+
*/
|
|
63
|
+
interface Position {
|
|
64
|
+
/**
|
|
65
|
+
* Place of the first character of the parsed source region.
|
|
66
|
+
*/
|
|
67
|
+
start: Point;
|
|
68
|
+
/**
|
|
69
|
+
* Place of the first character after the parsed source region.
|
|
70
|
+
*/
|
|
71
|
+
end: Point;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Abstract unist node.
|
|
75
|
+
*
|
|
76
|
+
* The syntactic unit in unist syntax trees are called nodes.
|
|
77
|
+
*
|
|
78
|
+
* This interface is supposed to be extended.
|
|
79
|
+
* If you can use {@link Literal} or {@link Parent}, you should.
|
|
80
|
+
* But for example in markdown, a `thematicBreak` (`***`), is neither literal
|
|
81
|
+
* nor parent, but still a node.
|
|
82
|
+
*/
|
|
83
|
+
interface Node$5 {
|
|
84
|
+
/**
|
|
85
|
+
* Node type.
|
|
86
|
+
*/
|
|
87
|
+
type: string;
|
|
88
|
+
/**
|
|
89
|
+
* Info from the ecosystem.
|
|
90
|
+
*/
|
|
91
|
+
data?: Data$1 | undefined;
|
|
92
|
+
/**
|
|
93
|
+
* Position of a node in a source document.
|
|
94
|
+
*
|
|
95
|
+
* Nodes that are generated (not in the original source document) must not
|
|
96
|
+
* have a position.
|
|
97
|
+
*/
|
|
98
|
+
position?: Position | undefined;
|
|
99
|
+
}
|
|
100
|
+
//#endregion
|
|
101
|
+
//#region ../../node_modules/@types/mdast/index.d.ts
|
|
102
|
+
// ## Enumeration
|
|
103
|
+
/**
|
|
104
|
+
* How phrasing content is aligned
|
|
105
|
+
* ({@link https://drafts.csswg.org/css-text/ | [CSSTEXT]}).
|
|
106
|
+
*
|
|
107
|
+
* * `'left'`: See the
|
|
108
|
+
* {@link https://drafts.csswg.org/css-text/#valdef-text-align-left | left}
|
|
109
|
+
* value of the `text-align` CSS property
|
|
110
|
+
* * `'right'`: See the
|
|
111
|
+
* {@link https://drafts.csswg.org/css-text/#valdef-text-align-right | right}
|
|
112
|
+
* value of the `text-align` CSS property
|
|
113
|
+
* * `'center'`: See the
|
|
114
|
+
* {@link https://drafts.csswg.org/css-text/#valdef-text-align-center | center}
|
|
115
|
+
* value of the `text-align` CSS property
|
|
116
|
+
* * `null`: phrasing content is aligned as defined by the host environment
|
|
117
|
+
*
|
|
118
|
+
* Used in GFM tables.
|
|
119
|
+
*/
|
|
120
|
+
type AlignType = "center" | "left" | "right" | null;
|
|
121
|
+
/**
|
|
122
|
+
* Explicitness of a reference.
|
|
123
|
+
*
|
|
124
|
+
* `'shortcut'`: the reference is implicit, its identifier inferred from its
|
|
125
|
+
* content
|
|
126
|
+
* `'collapsed'`: the reference is explicit, its identifier inferred from its
|
|
127
|
+
* content
|
|
128
|
+
* `'full'`: the reference is explicit, its identifier explicitly set
|
|
129
|
+
*/
|
|
130
|
+
type ReferenceType = "shortcut" | "collapsed" | "full";
|
|
131
|
+
// ## Mixin
|
|
132
|
+
/**
|
|
133
|
+
* Node with a fallback.
|
|
134
|
+
*/
|
|
135
|
+
interface Alternative {
|
|
136
|
+
/**
|
|
137
|
+
* Equivalent content for environments that cannot represent the node as
|
|
138
|
+
* intended.
|
|
139
|
+
*/
|
|
140
|
+
alt?: string | null | undefined;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Internal relation from one node to another.
|
|
144
|
+
*
|
|
145
|
+
* Whether the value of `identifier` is expected to be a unique identifier or
|
|
146
|
+
* not depends on the type of node including the Association.
|
|
147
|
+
* An example of this is that they should be unique on {@link Definition},
|
|
148
|
+
* whereas multiple {@link LinkReference}s can be non-unique to be associated
|
|
149
|
+
* with one definition.
|
|
150
|
+
*/
|
|
151
|
+
interface Association {
|
|
152
|
+
/**
|
|
153
|
+
* Relation of association.
|
|
154
|
+
*
|
|
155
|
+
* `identifier` is a source value: character escapes and character
|
|
156
|
+
* references are not parsed.
|
|
157
|
+
*
|
|
158
|
+
* It can match another node.
|
|
159
|
+
*
|
|
160
|
+
* Its value must be normalized.
|
|
161
|
+
* To normalize a value, collapse markdown whitespace (`[\t\n\r ]+`) to a space,
|
|
162
|
+
* trim the optional initial and/or final space, and perform Unicode-aware
|
|
163
|
+
* case-folding.
|
|
164
|
+
*/
|
|
165
|
+
identifier: string;
|
|
166
|
+
/**
|
|
167
|
+
* Relation of association, in parsed form.
|
|
168
|
+
*
|
|
169
|
+
* `label` is a `string` value: it works just like `title` on {@link Link}
|
|
170
|
+
* or a `lang` on {@link Code}: character escapes and character references
|
|
171
|
+
* are parsed.
|
|
172
|
+
*
|
|
173
|
+
* It can match another node.
|
|
174
|
+
*/
|
|
175
|
+
label?: string | null | undefined;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Marker that is associated to another node.
|
|
179
|
+
*/
|
|
180
|
+
interface Reference extends Association {
|
|
181
|
+
/**
|
|
182
|
+
* Explicitness of the reference.
|
|
183
|
+
*/
|
|
184
|
+
referenceType: ReferenceType;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Reference to resource.
|
|
188
|
+
*/
|
|
189
|
+
interface Resource {
|
|
190
|
+
/**
|
|
191
|
+
* URL to the referenced resource.
|
|
192
|
+
*/
|
|
193
|
+
url: string;
|
|
194
|
+
/**
|
|
195
|
+
* Advisory information for the resource, such as would be appropriate for
|
|
196
|
+
* a tooltip.
|
|
197
|
+
*/
|
|
198
|
+
title?: string | null | undefined;
|
|
199
|
+
}
|
|
200
|
+
// ## Interfaces
|
|
201
|
+
/**
|
|
202
|
+
* Info associated with mdast nodes by the ecosystem.
|
|
203
|
+
*
|
|
204
|
+
* This space is guaranteed to never be specified by unist or mdast.
|
|
205
|
+
* But you can use it in utilities and plugins to store data.
|
|
206
|
+
*
|
|
207
|
+
* This type can be augmented to register custom data.
|
|
208
|
+
* For example:
|
|
209
|
+
*
|
|
210
|
+
* ```ts
|
|
211
|
+
* declare module 'mdast' {
|
|
212
|
+
* interface Data {
|
|
213
|
+
* // `someNode.data.myId` is typed as `number | undefined`
|
|
214
|
+
* myId?: number | undefined
|
|
215
|
+
* }
|
|
216
|
+
* }
|
|
217
|
+
* ```
|
|
218
|
+
*/
|
|
219
|
+
interface Data extends Data$1 {}
|
|
220
|
+
// ## Content maps
|
|
221
|
+
/**
|
|
222
|
+
* Union of registered mdast nodes that can occur where block content is
|
|
223
|
+
* expected.
|
|
224
|
+
*
|
|
225
|
+
* To register custom mdast nodes, add them to {@link BlockContentMap}.
|
|
226
|
+
* They will be automatically added here.
|
|
227
|
+
*/
|
|
228
|
+
type BlockContent = BlockContentMap[keyof BlockContentMap];
|
|
229
|
+
/**
|
|
230
|
+
* Registry of all mdast nodes that can occur where {@link BlockContent} is
|
|
231
|
+
* expected.
|
|
232
|
+
*
|
|
233
|
+
* This interface can be augmented to register custom node types:
|
|
234
|
+
*
|
|
235
|
+
* ```ts
|
|
236
|
+
* declare module 'mdast' {
|
|
237
|
+
* interface BlockContentMap {
|
|
238
|
+
* // Allow using MDX ESM nodes defined by `remark-mdx`.
|
|
239
|
+
* mdxjsEsm: MdxjsEsm;
|
|
240
|
+
* }
|
|
241
|
+
* }
|
|
242
|
+
* ```
|
|
243
|
+
*
|
|
244
|
+
* For a union of all block content, see {@link RootContent}.
|
|
245
|
+
*/
|
|
246
|
+
interface BlockContentMap {
|
|
247
|
+
blockquote: Blockquote;
|
|
248
|
+
code: Code;
|
|
249
|
+
heading: Heading;
|
|
250
|
+
html: Html;
|
|
251
|
+
list: List;
|
|
252
|
+
paragraph: Paragraph;
|
|
253
|
+
table: Table;
|
|
254
|
+
thematicBreak: ThematicBreak;
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Union of registered mdast nodes that can occur where definition content is
|
|
258
|
+
* expected.
|
|
259
|
+
*
|
|
260
|
+
* To register custom mdast nodes, add them to {@link DefinitionContentMap}.
|
|
261
|
+
* They will be automatically added here.
|
|
262
|
+
*/
|
|
263
|
+
type DefinitionContent = DefinitionContentMap[keyof DefinitionContentMap];
|
|
264
|
+
/**
|
|
265
|
+
* Registry of all mdast nodes that can occur where {@link DefinitionContent}
|
|
266
|
+
* is expected.
|
|
267
|
+
*
|
|
268
|
+
* This interface can be augmented to register custom node types:
|
|
269
|
+
*
|
|
270
|
+
* ```ts
|
|
271
|
+
* declare module 'mdast' {
|
|
272
|
+
* interface DefinitionContentMap {
|
|
273
|
+
* custom: Custom;
|
|
274
|
+
* }
|
|
275
|
+
* }
|
|
276
|
+
* ```
|
|
277
|
+
*
|
|
278
|
+
* For a union of all definition content, see {@link RootContent}.
|
|
279
|
+
*/
|
|
280
|
+
interface DefinitionContentMap {
|
|
281
|
+
definition: Definition;
|
|
282
|
+
footnoteDefinition: FootnoteDefinition;
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Union of registered mdast nodes that can occur where list content is
|
|
286
|
+
* expected.
|
|
287
|
+
*
|
|
288
|
+
* To register custom mdast nodes, add them to {@link ListContentMap}.
|
|
289
|
+
* They will be automatically added here.
|
|
290
|
+
*/
|
|
291
|
+
type ListContent = ListContentMap[keyof ListContentMap];
|
|
292
|
+
/**
|
|
293
|
+
* Registry of all mdast nodes that can occur where {@link ListContent}
|
|
294
|
+
* is expected.
|
|
295
|
+
*
|
|
296
|
+
* This interface can be augmented to register custom node types:
|
|
297
|
+
*
|
|
298
|
+
* ```ts
|
|
299
|
+
* declare module 'mdast' {
|
|
300
|
+
* interface ListContentMap {
|
|
301
|
+
* custom: Custom;
|
|
302
|
+
* }
|
|
303
|
+
* }
|
|
304
|
+
* ```
|
|
305
|
+
*
|
|
306
|
+
* For a union of all list content, see {@link RootContent}.
|
|
307
|
+
*/
|
|
308
|
+
interface ListContentMap {
|
|
309
|
+
listItem: ListItem;
|
|
310
|
+
}
|
|
311
|
+
/**
|
|
312
|
+
* Union of registered mdast nodes that can occur where phrasing content is
|
|
313
|
+
* expected.
|
|
314
|
+
*
|
|
315
|
+
* To register custom mdast nodes, add them to {@link PhrasingContentMap}.
|
|
316
|
+
* They will be automatically added here.
|
|
317
|
+
*/
|
|
318
|
+
type PhrasingContent = PhrasingContentMap[keyof PhrasingContentMap];
|
|
319
|
+
/**
|
|
320
|
+
* Registry of all mdast nodes that can occur where {@link PhrasingContent}
|
|
321
|
+
* is expected.
|
|
322
|
+
*
|
|
323
|
+
* This interface can be augmented to register custom node types:
|
|
324
|
+
*
|
|
325
|
+
* ```ts
|
|
326
|
+
* declare module 'mdast' {
|
|
327
|
+
* interface PhrasingContentMap {
|
|
328
|
+
* // Allow using MDX JSX (text) nodes defined by `remark-mdx`.
|
|
329
|
+
* mdxJsxTextElement: MDXJSXTextElement;
|
|
330
|
+
* }
|
|
331
|
+
* }
|
|
332
|
+
* ```
|
|
333
|
+
*
|
|
334
|
+
* For a union of all phrasing content, see {@link RootContent}.
|
|
335
|
+
*/
|
|
336
|
+
interface PhrasingContentMap {
|
|
337
|
+
break: Break;
|
|
338
|
+
delete: Delete;
|
|
339
|
+
emphasis: Emphasis;
|
|
340
|
+
footnoteReference: FootnoteReference;
|
|
341
|
+
html: Html;
|
|
342
|
+
image: Image;
|
|
343
|
+
imageReference: ImageReference;
|
|
344
|
+
inlineCode: InlineCode;
|
|
345
|
+
link: Link;
|
|
346
|
+
linkReference: LinkReference;
|
|
347
|
+
strong: Strong;
|
|
348
|
+
text: Text;
|
|
349
|
+
}
|
|
350
|
+
/**
|
|
351
|
+
* Union of registered mdast nodes that can occur in {@link Root}.
|
|
352
|
+
*
|
|
353
|
+
* To register custom mdast nodes, add them to {@link RootContentMap}.
|
|
354
|
+
* They will be automatically added here.
|
|
355
|
+
*/
|
|
356
|
+
type RootContent = RootContentMap[keyof RootContentMap];
|
|
357
|
+
/**
|
|
358
|
+
* Registry of all mdast nodes that can occur as children of {@link Root}.
|
|
359
|
+
*
|
|
360
|
+
* > **Note**: {@link Root} does not need to be an entire document.
|
|
361
|
+
* > it can also be a fragment.
|
|
362
|
+
*
|
|
363
|
+
* This interface can be augmented to register custom node types:
|
|
364
|
+
*
|
|
365
|
+
* ```ts
|
|
366
|
+
* declare module 'mdast' {
|
|
367
|
+
* interface RootContentMap {
|
|
368
|
+
* // Allow using toml nodes defined by `remark-frontmatter`.
|
|
369
|
+
* toml: TOML;
|
|
370
|
+
* }
|
|
371
|
+
* }
|
|
372
|
+
* ```
|
|
373
|
+
*
|
|
374
|
+
* For a union of all {@link Root} children, see {@link RootContent}.
|
|
375
|
+
*/
|
|
376
|
+
interface RootContentMap {
|
|
377
|
+
blockquote: Blockquote;
|
|
378
|
+
break: Break;
|
|
379
|
+
code: Code;
|
|
380
|
+
definition: Definition;
|
|
381
|
+
delete: Delete;
|
|
382
|
+
emphasis: Emphasis;
|
|
383
|
+
footnoteDefinition: FootnoteDefinition;
|
|
384
|
+
footnoteReference: FootnoteReference;
|
|
385
|
+
heading: Heading;
|
|
386
|
+
html: Html;
|
|
387
|
+
image: Image;
|
|
388
|
+
imageReference: ImageReference;
|
|
389
|
+
inlineCode: InlineCode;
|
|
390
|
+
link: Link;
|
|
391
|
+
linkReference: LinkReference;
|
|
392
|
+
list: List;
|
|
393
|
+
listItem: ListItem;
|
|
394
|
+
paragraph: Paragraph;
|
|
395
|
+
strong: Strong;
|
|
396
|
+
table: Table;
|
|
397
|
+
tableCell: TableCell;
|
|
398
|
+
tableRow: TableRow;
|
|
399
|
+
text: Text;
|
|
400
|
+
thematicBreak: ThematicBreak;
|
|
401
|
+
yaml: Yaml;
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* Union of registered mdast nodes that can occur where row content is
|
|
405
|
+
* expected.
|
|
406
|
+
*
|
|
407
|
+
* To register custom mdast nodes, add them to {@link RowContentMap}.
|
|
408
|
+
* They will be automatically added here.
|
|
409
|
+
*/
|
|
410
|
+
type RowContent = RowContentMap[keyof RowContentMap];
|
|
411
|
+
/**
|
|
412
|
+
* Registry of all mdast nodes that can occur where {@link RowContent}
|
|
413
|
+
* is expected.
|
|
414
|
+
*
|
|
415
|
+
* This interface can be augmented to register custom node types:
|
|
416
|
+
*
|
|
417
|
+
* ```ts
|
|
418
|
+
* declare module 'mdast' {
|
|
419
|
+
* interface RowContentMap {
|
|
420
|
+
* custom: Custom;
|
|
421
|
+
* }
|
|
422
|
+
* }
|
|
423
|
+
* ```
|
|
424
|
+
*
|
|
425
|
+
* For a union of all row content, see {@link RootContent}.
|
|
426
|
+
*/
|
|
427
|
+
interface RowContentMap {
|
|
428
|
+
tableCell: TableCell;
|
|
429
|
+
}
|
|
430
|
+
/**
|
|
431
|
+
* Union of registered mdast nodes that can occur where table content is
|
|
432
|
+
* expected.
|
|
433
|
+
*
|
|
434
|
+
* To register custom mdast nodes, add them to {@link TableContentMap}.
|
|
435
|
+
* They will be automatically added here.
|
|
436
|
+
*/
|
|
437
|
+
type TableContent = TableContentMap[keyof TableContentMap];
|
|
438
|
+
/**
|
|
439
|
+
* Registry of all mdast nodes that can occur where {@link TableContent}
|
|
440
|
+
* is expected.
|
|
441
|
+
*
|
|
442
|
+
* This interface can be augmented to register custom node types:
|
|
443
|
+
*
|
|
444
|
+
* ```ts
|
|
445
|
+
* declare module 'mdast' {
|
|
446
|
+
* interface TableContentMap {
|
|
447
|
+
* custom: Custom;
|
|
448
|
+
* }
|
|
449
|
+
* }
|
|
450
|
+
* ```
|
|
451
|
+
*
|
|
452
|
+
* For a union of all table content, see {@link RootContent}.
|
|
453
|
+
*/
|
|
454
|
+
interface TableContentMap {
|
|
455
|
+
tableRow: TableRow;
|
|
456
|
+
}
|
|
457
|
+
// ## Abstract nodes
|
|
458
|
+
/**
|
|
459
|
+
* Abstract mdast node that contains the smallest possible value.
|
|
460
|
+
*
|
|
461
|
+
* This interface is supposed to be extended if you make custom mdast nodes.
|
|
462
|
+
*
|
|
463
|
+
* For a union of all registered mdast literals, see {@link Literals}.
|
|
464
|
+
*/
|
|
465
|
+
interface Literal extends Node$4 {
|
|
466
|
+
/**
|
|
467
|
+
* Plain-text value.
|
|
468
|
+
*/
|
|
469
|
+
value: string;
|
|
470
|
+
}
|
|
471
|
+
/**
|
|
472
|
+
* Abstract mdast node.
|
|
473
|
+
*
|
|
474
|
+
* This interface is supposed to be extended.
|
|
475
|
+
* If you can use {@link Literal} or {@link Parent}, you should.
|
|
476
|
+
* But for example in markdown, a thematic break (`***`) is neither literal nor
|
|
477
|
+
* parent, but still a node.
|
|
478
|
+
*
|
|
479
|
+
* To register custom mdast nodes, add them to {@link RootContentMap} and other
|
|
480
|
+
* places where relevant (such as {@link ElementContentMap}).
|
|
481
|
+
*
|
|
482
|
+
* For a union of all registered mdast nodes, see {@link Nodes}.
|
|
483
|
+
*/
|
|
484
|
+
interface Node$4 extends Node$5 {
|
|
485
|
+
/**
|
|
486
|
+
* Info from the ecosystem.
|
|
487
|
+
*/
|
|
488
|
+
data?: Data | undefined;
|
|
489
|
+
}
|
|
490
|
+
/**
|
|
491
|
+
* Abstract mdast node that contains other mdast nodes (*children*).
|
|
492
|
+
*
|
|
493
|
+
* This interface is supposed to be extended if you make custom mdast nodes.
|
|
494
|
+
*
|
|
495
|
+
* For a union of all registered mdast parents, see {@link Parents}.
|
|
496
|
+
*/
|
|
497
|
+
interface Parent extends Node$4 {
|
|
498
|
+
/**
|
|
499
|
+
* List of children.
|
|
500
|
+
*/
|
|
501
|
+
children: RootContent[];
|
|
502
|
+
}
|
|
503
|
+
// ## Concrete nodes
|
|
504
|
+
/**
|
|
505
|
+
* Markdown block quote.
|
|
506
|
+
*/
|
|
507
|
+
interface Blockquote extends Parent {
|
|
508
|
+
/**
|
|
509
|
+
* Node type of mdast block quote.
|
|
510
|
+
*/
|
|
511
|
+
type: "blockquote";
|
|
512
|
+
/**
|
|
513
|
+
* Children of block quote.
|
|
514
|
+
*/
|
|
515
|
+
children: Array<BlockContent | DefinitionContent>;
|
|
516
|
+
/**
|
|
517
|
+
* Data associated with the mdast block quote.
|
|
518
|
+
*/
|
|
519
|
+
data?: BlockquoteData | undefined;
|
|
520
|
+
}
|
|
521
|
+
/**
|
|
522
|
+
* Info associated with mdast block quote nodes by the ecosystem.
|
|
523
|
+
*/
|
|
524
|
+
interface BlockquoteData extends Data {}
|
|
525
|
+
/**
|
|
526
|
+
* Markdown break.
|
|
527
|
+
*/
|
|
528
|
+
interface Break extends Node$4 {
|
|
529
|
+
/**
|
|
530
|
+
* Node type of mdast break.
|
|
531
|
+
*/
|
|
532
|
+
type: "break";
|
|
533
|
+
/**
|
|
534
|
+
* Data associated with the mdast break.
|
|
535
|
+
*/
|
|
536
|
+
data?: BreakData | undefined;
|
|
537
|
+
}
|
|
538
|
+
/**
|
|
539
|
+
* Info associated with mdast break nodes by the ecosystem.
|
|
540
|
+
*/
|
|
541
|
+
interface BreakData extends Data {}
|
|
542
|
+
/**
|
|
543
|
+
* Markdown code (flow) (block).
|
|
544
|
+
*/
|
|
545
|
+
interface Code extends Literal {
|
|
546
|
+
/**
|
|
547
|
+
* Node type of mdast code (flow).
|
|
548
|
+
*/
|
|
549
|
+
type: "code";
|
|
550
|
+
/**
|
|
551
|
+
* Language of computer code being marked up.
|
|
552
|
+
*/
|
|
553
|
+
lang?: string | null | undefined;
|
|
554
|
+
/**
|
|
555
|
+
* Custom information relating to the node.
|
|
556
|
+
*
|
|
557
|
+
* If the lang field is present, a meta field can be present.
|
|
558
|
+
*/
|
|
559
|
+
meta?: string | null | undefined;
|
|
560
|
+
/**
|
|
561
|
+
* Data associated with the mdast code (flow).
|
|
562
|
+
*/
|
|
563
|
+
data?: CodeData | undefined;
|
|
564
|
+
}
|
|
565
|
+
/**
|
|
566
|
+
* Info associated with mdast code (flow) (block) nodes by the ecosystem.
|
|
567
|
+
*/
|
|
568
|
+
interface CodeData extends Data {}
|
|
569
|
+
/**
|
|
570
|
+
* Markdown definition.
|
|
571
|
+
*/
|
|
572
|
+
interface Definition extends Node$4, Association, Resource {
|
|
573
|
+
/**
|
|
574
|
+
* Node type of mdast definition.
|
|
575
|
+
*/
|
|
576
|
+
type: "definition";
|
|
577
|
+
/**
|
|
578
|
+
* Data associated with the mdast definition.
|
|
579
|
+
*/
|
|
580
|
+
data?: DefinitionData | undefined;
|
|
581
|
+
}
|
|
582
|
+
/**
|
|
583
|
+
* Info associated with mdast definition nodes by the ecosystem.
|
|
584
|
+
*/
|
|
585
|
+
interface DefinitionData extends Data {}
|
|
586
|
+
/**
|
|
587
|
+
* Markdown GFM delete (strikethrough).
|
|
588
|
+
*/
|
|
589
|
+
interface Delete extends Parent {
|
|
590
|
+
/**
|
|
591
|
+
* Node type of mdast GFM delete.
|
|
592
|
+
*/
|
|
593
|
+
type: "delete";
|
|
594
|
+
/**
|
|
595
|
+
* Children of GFM delete.
|
|
596
|
+
*/
|
|
597
|
+
children: PhrasingContent[];
|
|
598
|
+
/**
|
|
599
|
+
* Data associated with the mdast GFM delete.
|
|
600
|
+
*/
|
|
601
|
+
data?: DeleteData | undefined;
|
|
602
|
+
}
|
|
603
|
+
/**
|
|
604
|
+
* Info associated with mdast GFM delete nodes by the ecosystem.
|
|
605
|
+
*/
|
|
606
|
+
interface DeleteData extends Data {}
|
|
607
|
+
/**
|
|
608
|
+
* Markdown emphasis.
|
|
609
|
+
*/
|
|
610
|
+
interface Emphasis extends Parent {
|
|
611
|
+
/**
|
|
612
|
+
* Node type of mdast emphasis.
|
|
613
|
+
*/
|
|
614
|
+
type: "emphasis";
|
|
615
|
+
/**
|
|
616
|
+
* Children of emphasis.
|
|
617
|
+
*/
|
|
618
|
+
children: PhrasingContent[];
|
|
619
|
+
/**
|
|
620
|
+
* Data associated with the mdast emphasis.
|
|
621
|
+
*/
|
|
622
|
+
data?: EmphasisData | undefined;
|
|
623
|
+
}
|
|
624
|
+
/**
|
|
625
|
+
* Info associated with mdast emphasis nodes by the ecosystem.
|
|
626
|
+
*/
|
|
627
|
+
interface EmphasisData extends Data {}
|
|
628
|
+
/**
|
|
629
|
+
* Markdown GFM footnote definition.
|
|
630
|
+
*/
|
|
631
|
+
interface FootnoteDefinition extends Parent, Association {
|
|
632
|
+
/**
|
|
633
|
+
* Node type of mdast GFM footnote definition.
|
|
634
|
+
*/
|
|
635
|
+
type: "footnoteDefinition";
|
|
636
|
+
/**
|
|
637
|
+
* Children of GFM footnote definition.
|
|
638
|
+
*/
|
|
639
|
+
children: Array<BlockContent | DefinitionContent>;
|
|
640
|
+
/**
|
|
641
|
+
* Data associated with the mdast GFM footnote definition.
|
|
642
|
+
*/
|
|
643
|
+
data?: FootnoteDefinitionData | undefined;
|
|
644
|
+
}
|
|
645
|
+
/**
|
|
646
|
+
* Info associated with mdast GFM footnote definition nodes by the ecosystem.
|
|
647
|
+
*/
|
|
648
|
+
interface FootnoteDefinitionData extends Data {}
|
|
649
|
+
/**
|
|
650
|
+
* Markdown GFM footnote reference.
|
|
651
|
+
*/
|
|
652
|
+
interface FootnoteReference extends Association, Node$4 {
|
|
653
|
+
/**
|
|
654
|
+
* Node type of mdast GFM footnote reference.
|
|
655
|
+
*/
|
|
656
|
+
type: "footnoteReference";
|
|
657
|
+
/**
|
|
658
|
+
* Data associated with the mdast GFM footnote reference.
|
|
659
|
+
*/
|
|
660
|
+
data?: FootnoteReferenceData | undefined;
|
|
661
|
+
}
|
|
662
|
+
/**
|
|
663
|
+
* Info associated with mdast GFM footnote reference nodes by the ecosystem.
|
|
664
|
+
*/
|
|
665
|
+
interface FootnoteReferenceData extends Data {}
|
|
666
|
+
/**
|
|
667
|
+
* Markdown heading.
|
|
668
|
+
*/
|
|
669
|
+
interface Heading extends Parent {
|
|
670
|
+
/**
|
|
671
|
+
* Node type of mdast heading.
|
|
672
|
+
*/
|
|
673
|
+
type: "heading";
|
|
674
|
+
/**
|
|
675
|
+
* Heading rank.
|
|
676
|
+
*
|
|
677
|
+
* A value of `1` is said to be the highest rank and `6` the lowest.
|
|
678
|
+
*/
|
|
679
|
+
depth: 1 | 2 | 3 | 4 | 5 | 6;
|
|
680
|
+
/**
|
|
681
|
+
* Children of heading.
|
|
682
|
+
*/
|
|
683
|
+
children: PhrasingContent[];
|
|
684
|
+
/**
|
|
685
|
+
* Data associated with the mdast heading.
|
|
686
|
+
*/
|
|
687
|
+
data?: HeadingData | undefined;
|
|
688
|
+
}
|
|
689
|
+
/**
|
|
690
|
+
* Info associated with mdast heading nodes by the ecosystem.
|
|
691
|
+
*/
|
|
692
|
+
interface HeadingData extends Data {}
|
|
693
|
+
/**
|
|
694
|
+
* Markdown HTML.
|
|
695
|
+
*/
|
|
696
|
+
interface Html extends Literal {
|
|
697
|
+
/**
|
|
698
|
+
* Node type of mdast HTML.
|
|
699
|
+
*/
|
|
700
|
+
type: "html";
|
|
701
|
+
/**
|
|
702
|
+
* Data associated with the mdast HTML.
|
|
703
|
+
*/
|
|
704
|
+
data?: HtmlData | undefined;
|
|
705
|
+
}
|
|
706
|
+
/**
|
|
707
|
+
* Info associated with mdast HTML nodes by the ecosystem.
|
|
708
|
+
*/
|
|
709
|
+
interface HtmlData extends Data {}
|
|
710
|
+
/**
|
|
711
|
+
* Markdown image.
|
|
712
|
+
*/
|
|
713
|
+
interface Image extends Alternative, Node$4, Resource {
|
|
714
|
+
/**
|
|
715
|
+
* Node type of mdast image.
|
|
716
|
+
*/
|
|
717
|
+
type: "image";
|
|
718
|
+
/**
|
|
719
|
+
* Data associated with the mdast image.
|
|
720
|
+
*/
|
|
721
|
+
data?: ImageData | undefined;
|
|
722
|
+
}
|
|
723
|
+
/**
|
|
724
|
+
* Info associated with mdast image nodes by the ecosystem.
|
|
725
|
+
*/
|
|
726
|
+
interface ImageData extends Data {}
|
|
727
|
+
/**
|
|
728
|
+
* Markdown image reference.
|
|
729
|
+
*/
|
|
730
|
+
interface ImageReference extends Alternative, Node$4, Reference {
|
|
731
|
+
/**
|
|
732
|
+
* Node type of mdast image reference.
|
|
733
|
+
*/
|
|
734
|
+
type: "imageReference";
|
|
735
|
+
/**
|
|
736
|
+
* Data associated with the mdast image reference.
|
|
737
|
+
*/
|
|
738
|
+
data?: ImageReferenceData | undefined;
|
|
739
|
+
}
|
|
740
|
+
/**
|
|
741
|
+
* Info associated with mdast image reference nodes by the ecosystem.
|
|
742
|
+
*/
|
|
743
|
+
interface ImageReferenceData extends Data {}
|
|
744
|
+
/**
|
|
745
|
+
* Markdown code (text) (inline).
|
|
746
|
+
*/
|
|
747
|
+
interface InlineCode extends Literal {
|
|
748
|
+
/**
|
|
749
|
+
* Node type of mdast code (text).
|
|
750
|
+
*/
|
|
751
|
+
type: "inlineCode";
|
|
752
|
+
/**
|
|
753
|
+
* Data associated with the mdast code (text).
|
|
754
|
+
*/
|
|
755
|
+
data?: InlineCodeData | undefined;
|
|
756
|
+
}
|
|
757
|
+
/**
|
|
758
|
+
* Info associated with mdast code (text) (inline) nodes by the ecosystem.
|
|
759
|
+
*/
|
|
760
|
+
interface InlineCodeData extends Data {}
|
|
761
|
+
/**
|
|
762
|
+
* Markdown link.
|
|
763
|
+
*/
|
|
764
|
+
interface Link extends Parent, Resource {
|
|
765
|
+
/**
|
|
766
|
+
* Node type of mdast link.
|
|
767
|
+
*/
|
|
768
|
+
type: "link";
|
|
769
|
+
/**
|
|
770
|
+
* Children of link.
|
|
771
|
+
*/
|
|
772
|
+
children: PhrasingContent[];
|
|
773
|
+
/**
|
|
774
|
+
* Data associated with the mdast link.
|
|
775
|
+
*/
|
|
776
|
+
data?: LinkData | undefined;
|
|
777
|
+
}
|
|
778
|
+
/**
|
|
779
|
+
* Info associated with mdast link nodes by the ecosystem.
|
|
780
|
+
*/
|
|
781
|
+
interface LinkData extends Data {}
|
|
782
|
+
/**
|
|
783
|
+
* Markdown link reference.
|
|
784
|
+
*/
|
|
785
|
+
interface LinkReference extends Parent, Reference {
|
|
786
|
+
/**
|
|
787
|
+
* Node type of mdast link reference.
|
|
788
|
+
*/
|
|
789
|
+
type: "linkReference";
|
|
790
|
+
/**
|
|
791
|
+
* Children of link reference.
|
|
792
|
+
*/
|
|
793
|
+
children: PhrasingContent[];
|
|
794
|
+
/**
|
|
795
|
+
* Data associated with the mdast link reference.
|
|
796
|
+
*/
|
|
797
|
+
data?: LinkReferenceData | undefined;
|
|
798
|
+
}
|
|
799
|
+
/**
|
|
800
|
+
* Info associated with mdast link reference nodes by the ecosystem.
|
|
801
|
+
*/
|
|
802
|
+
interface LinkReferenceData extends Data {}
|
|
803
|
+
/**
|
|
804
|
+
* Markdown list.
|
|
805
|
+
*/
|
|
806
|
+
interface List extends Parent {
|
|
807
|
+
/**
|
|
808
|
+
* Node type of mdast list.
|
|
809
|
+
*/
|
|
810
|
+
type: "list";
|
|
811
|
+
/**
|
|
812
|
+
* Whether the items have been intentionally ordered (when `true`), or that
|
|
813
|
+
* the order of items is not important (when `false` or not present).
|
|
814
|
+
*/
|
|
815
|
+
ordered?: boolean | null | undefined;
|
|
816
|
+
/**
|
|
817
|
+
* The starting number of the list, when the `ordered` field is `true`.
|
|
818
|
+
*/
|
|
819
|
+
start?: number | null | undefined;
|
|
820
|
+
/**
|
|
821
|
+
* Whether one or more of the children are separated with a blank line from
|
|
822
|
+
* its siblings (when `true`), or not (when `false` or not present).
|
|
823
|
+
*/
|
|
824
|
+
spread?: boolean | null | undefined;
|
|
825
|
+
/**
|
|
826
|
+
* Children of list.
|
|
827
|
+
*/
|
|
828
|
+
children: ListContent[];
|
|
829
|
+
/**
|
|
830
|
+
* Data associated with the mdast list.
|
|
831
|
+
*/
|
|
832
|
+
data?: ListData | undefined;
|
|
833
|
+
}
|
|
834
|
+
/**
|
|
835
|
+
* Info associated with mdast list nodes by the ecosystem.
|
|
836
|
+
*/
|
|
837
|
+
interface ListData extends Data {}
|
|
838
|
+
/**
|
|
839
|
+
* Markdown list item.
|
|
840
|
+
*/
|
|
841
|
+
interface ListItem extends Parent {
|
|
842
|
+
/**
|
|
843
|
+
* Node type of mdast list item.
|
|
844
|
+
*/
|
|
845
|
+
type: "listItem";
|
|
846
|
+
/**
|
|
847
|
+
* Whether the item is a tasklist item (when `boolean`).
|
|
848
|
+
*
|
|
849
|
+
* When `true`, the item is complete.
|
|
850
|
+
* When `false`, the item is incomplete.
|
|
851
|
+
*/
|
|
852
|
+
checked?: boolean | null | undefined;
|
|
853
|
+
/**
|
|
854
|
+
* Whether one or more of the children are separated with a blank line from
|
|
855
|
+
* its siblings (when `true`), or not (when `false` or not present).
|
|
856
|
+
*/
|
|
857
|
+
spread?: boolean | null | undefined;
|
|
858
|
+
/**
|
|
859
|
+
* Children of list item.
|
|
860
|
+
*/
|
|
861
|
+
children: Array<BlockContent | DefinitionContent>;
|
|
862
|
+
/**
|
|
863
|
+
* Data associated with the mdast list item.
|
|
864
|
+
*/
|
|
865
|
+
data?: ListItemData | undefined;
|
|
866
|
+
}
|
|
867
|
+
/**
|
|
868
|
+
* Info associated with mdast list item nodes by the ecosystem.
|
|
869
|
+
*/
|
|
870
|
+
interface ListItemData extends Data {}
|
|
871
|
+
/**
|
|
872
|
+
* Markdown paragraph.
|
|
873
|
+
*/
|
|
874
|
+
interface Paragraph extends Parent {
|
|
875
|
+
/**
|
|
876
|
+
* Node type of mdast paragraph.
|
|
877
|
+
*/
|
|
878
|
+
type: "paragraph";
|
|
879
|
+
/**
|
|
880
|
+
* Children of paragraph.
|
|
881
|
+
*/
|
|
882
|
+
children: PhrasingContent[];
|
|
883
|
+
/**
|
|
884
|
+
* Data associated with the mdast paragraph.
|
|
885
|
+
*/
|
|
886
|
+
data?: ParagraphData | undefined;
|
|
887
|
+
}
|
|
888
|
+
/**
|
|
889
|
+
* Info associated with mdast paragraph nodes by the ecosystem.
|
|
890
|
+
*/
|
|
891
|
+
interface ParagraphData extends Data {}
|
|
892
|
+
/**
|
|
893
|
+
* Document fragment or a whole document.
|
|
894
|
+
*
|
|
895
|
+
* Should be used as the root of a tree and must not be used as a child.
|
|
896
|
+
*/
|
|
897
|
+
interface Root extends Parent {
|
|
898
|
+
/**
|
|
899
|
+
* Node type of mdast root.
|
|
900
|
+
*/
|
|
901
|
+
type: "root";
|
|
902
|
+
/**
|
|
903
|
+
* Data associated with the mdast root.
|
|
904
|
+
*/
|
|
905
|
+
data?: RootData | undefined;
|
|
906
|
+
}
|
|
907
|
+
/**
|
|
908
|
+
* Info associated with mdast root nodes by the ecosystem.
|
|
909
|
+
*/
|
|
910
|
+
interface RootData extends Data {}
|
|
911
|
+
/**
|
|
912
|
+
* Markdown strong.
|
|
913
|
+
*/
|
|
914
|
+
interface Strong extends Parent {
|
|
915
|
+
/**
|
|
916
|
+
* Node type of mdast strong.
|
|
917
|
+
*/
|
|
918
|
+
type: "strong";
|
|
919
|
+
/**
|
|
920
|
+
* Children of strong.
|
|
921
|
+
*/
|
|
922
|
+
children: PhrasingContent[];
|
|
923
|
+
/**
|
|
924
|
+
* Data associated with the mdast strong.
|
|
925
|
+
*/
|
|
926
|
+
data?: StrongData | undefined;
|
|
927
|
+
}
|
|
928
|
+
/**
|
|
929
|
+
* Info associated with mdast strong nodes by the ecosystem.
|
|
930
|
+
*/
|
|
931
|
+
interface StrongData extends Data {}
|
|
932
|
+
/**
|
|
933
|
+
* Markdown GFM table.
|
|
934
|
+
*/
|
|
935
|
+
interface Table extends Parent {
|
|
936
|
+
/**
|
|
937
|
+
* Node type of mdast GFM table.
|
|
938
|
+
*/
|
|
939
|
+
type: "table";
|
|
940
|
+
/**
|
|
941
|
+
* How cells in columns are aligned.
|
|
942
|
+
*/
|
|
943
|
+
align?: AlignType[] | null | undefined;
|
|
944
|
+
/**
|
|
945
|
+
* Children of GFM table.
|
|
946
|
+
*/
|
|
947
|
+
children: TableContent[];
|
|
948
|
+
/**
|
|
949
|
+
* Data associated with the mdast GFM table.
|
|
950
|
+
*/
|
|
951
|
+
data?: TableData | undefined;
|
|
952
|
+
}
|
|
953
|
+
/**
|
|
954
|
+
* Info associated with mdast GFM table nodes by the ecosystem.
|
|
955
|
+
*/
|
|
956
|
+
interface TableData extends Data {}
|
|
957
|
+
/**
|
|
958
|
+
* Markdown GFM table row.
|
|
959
|
+
*/
|
|
960
|
+
interface TableRow extends Parent {
|
|
961
|
+
/**
|
|
962
|
+
* Node type of mdast GFM table row.
|
|
963
|
+
*/
|
|
964
|
+
type: "tableRow";
|
|
965
|
+
/**
|
|
966
|
+
* Children of GFM table row.
|
|
967
|
+
*/
|
|
968
|
+
children: RowContent[];
|
|
969
|
+
/**
|
|
970
|
+
* Data associated with the mdast GFM table row.
|
|
971
|
+
*/
|
|
972
|
+
data?: TableRowData | undefined;
|
|
973
|
+
}
|
|
974
|
+
/**
|
|
975
|
+
* Info associated with mdast GFM table row nodes by the ecosystem.
|
|
976
|
+
*/
|
|
977
|
+
interface TableRowData extends Data {}
|
|
978
|
+
/**
|
|
979
|
+
* Markdown GFM table cell.
|
|
980
|
+
*/
|
|
981
|
+
interface TableCell extends Parent {
|
|
982
|
+
/**
|
|
983
|
+
* Node type of mdast GFM table cell.
|
|
984
|
+
*/
|
|
985
|
+
type: "tableCell";
|
|
986
|
+
/**
|
|
987
|
+
* Children of GFM table cell.
|
|
988
|
+
*/
|
|
989
|
+
children: PhrasingContent[];
|
|
990
|
+
/**
|
|
991
|
+
* Data associated with the mdast GFM table cell.
|
|
992
|
+
*/
|
|
993
|
+
data?: TableCellData | undefined;
|
|
994
|
+
}
|
|
995
|
+
/**
|
|
996
|
+
* Info associated with mdast GFM table cell nodes by the ecosystem.
|
|
997
|
+
*/
|
|
998
|
+
interface TableCellData extends Data {}
|
|
999
|
+
/**
|
|
1000
|
+
* Markdown text.
|
|
1001
|
+
*/
|
|
1002
|
+
interface Text extends Literal {
|
|
1003
|
+
/**
|
|
1004
|
+
* Node type of mdast text.
|
|
1005
|
+
*/
|
|
1006
|
+
type: "text";
|
|
1007
|
+
/**
|
|
1008
|
+
* Data associated with the mdast text.
|
|
1009
|
+
*/
|
|
1010
|
+
data?: TextData | undefined;
|
|
1011
|
+
}
|
|
1012
|
+
/**
|
|
1013
|
+
* Info associated with mdast text nodes by the ecosystem.
|
|
1014
|
+
*/
|
|
1015
|
+
interface TextData extends Data {}
|
|
1016
|
+
/**
|
|
1017
|
+
* Markdown thematic break (horizontal rule).
|
|
1018
|
+
*/
|
|
1019
|
+
interface ThematicBreak extends Node$4 {
|
|
1020
|
+
/**
|
|
1021
|
+
* Node type of mdast thematic break.
|
|
1022
|
+
*/
|
|
1023
|
+
type: "thematicBreak";
|
|
1024
|
+
/**
|
|
1025
|
+
* Data associated with the mdast thematic break.
|
|
1026
|
+
*/
|
|
1027
|
+
data?: ThematicBreakData | undefined;
|
|
1028
|
+
}
|
|
1029
|
+
/**
|
|
1030
|
+
* Info associated with mdast thematic break nodes by the ecosystem.
|
|
1031
|
+
*/
|
|
1032
|
+
interface ThematicBreakData extends Data {}
|
|
1033
|
+
/**
|
|
1034
|
+
* Markdown YAML.
|
|
1035
|
+
*/
|
|
1036
|
+
interface Yaml extends Literal {
|
|
1037
|
+
/**
|
|
1038
|
+
* Node type of mdast YAML.
|
|
1039
|
+
*/
|
|
1040
|
+
type: "yaml";
|
|
1041
|
+
/**
|
|
1042
|
+
* Data associated with the mdast YAML.
|
|
1043
|
+
*/
|
|
1044
|
+
data?: YamlData | undefined;
|
|
1045
|
+
}
|
|
1046
|
+
/**
|
|
1047
|
+
* Info associated with mdast YAML nodes by the ecosystem.
|
|
1048
|
+
*/
|
|
1049
|
+
interface YamlData extends Data {}
|
|
1050
|
+
//#endregion
|
|
1051
|
+
//#region src/types/common.d.ts
|
|
1052
|
+
type NodePath<T = t.Node | null | undefined> = NodePath$1<T>;
|
|
1053
|
+
type BabelAst = ParseResult;
|
|
1054
|
+
type PostcssAst = postcss.Root;
|
|
1055
|
+
interface MarkdownAst {
|
|
1056
|
+
root: Root;
|
|
1057
|
+
frontmatter: Record<string, string>;
|
|
1058
|
+
render(): Promise<string>;
|
|
1059
|
+
}
|
|
1060
|
+
declare const CUSTOM_ATTRIBUTES: Readonly<{
|
|
1061
|
+
/** For script and style tags to grab the metadata */MetadataID: "data-metadata-id";
|
|
1062
|
+
}>;
|
|
1063
|
+
declare const CONFIG_FILE_NAME = ".staticbolt.ts";
|
|
1064
|
+
interface AppConfig {
|
|
1065
|
+
root?: string;
|
|
1066
|
+
plugins?: (Plugin$1[] | Plugin$1)[];
|
|
1067
|
+
outdir?: string;
|
|
1068
|
+
production?: boolean;
|
|
1069
|
+
browserslist?: string[];
|
|
1070
|
+
}
|
|
1071
|
+
//#endregion
|
|
1072
|
+
//#region src/resolver/resolver.d.ts
|
|
1073
|
+
type ResolveResult$1 = {
|
|
1074
|
+
path: string;
|
|
1075
|
+
suffix: string;
|
|
1076
|
+
isDirAlias?: boolean;
|
|
1077
|
+
isFileAlias?: boolean;
|
|
1078
|
+
isPackage?: boolean;
|
|
1079
|
+
exists: boolean;
|
|
1080
|
+
};
|
|
1081
|
+
declare class Resolver {
|
|
1082
|
+
root: string;
|
|
1083
|
+
aliases: Record<string, string>;
|
|
1084
|
+
notFound: Set<string>;
|
|
1085
|
+
files: Set<string>;
|
|
1086
|
+
directories: Set<string>;
|
|
1087
|
+
static JS_EXTENSIONS: Set<string>;
|
|
1088
|
+
static HTML_EXTENSIONS: Set<string>;
|
|
1089
|
+
constructor(root: string);
|
|
1090
|
+
resolve(sourceOrLink: string, filePath: string): ResolveResult$1 | undefined;
|
|
1091
|
+
resolveAlias(source: string): string | undefined;
|
|
1092
|
+
normalize(filePath: string): string;
|
|
1093
|
+
static isFile(filePath: string): boolean;
|
|
1094
|
+
/** Aliased path to path */
|
|
1095
|
+
static resolvePathAlias(filePath: string, aliases: Record<string, string>): string | undefined;
|
|
1096
|
+
/** Path to aliased path */
|
|
1097
|
+
static resolveAliasPath(filePath: string, aliases: Record<string, string>): string;
|
|
1098
|
+
/** Path to aliased path */
|
|
1099
|
+
aliasPath(filePath: string): string;
|
|
1100
|
+
findFile(filePath: string, checkDirectory?: boolean): string | undefined;
|
|
1101
|
+
}
|
|
1102
|
+
//#endregion
|
|
1103
|
+
//#region src/main.d.ts
|
|
1104
|
+
declare class App {
|
|
1105
|
+
readonly configPath: string;
|
|
1106
|
+
/** The absolute path to the project root. */
|
|
1107
|
+
readonly root: string;
|
|
1108
|
+
/** The absolute path to the output directory. */
|
|
1109
|
+
readonly outdir: string;
|
|
1110
|
+
/** Whether the application is running in production mode. */
|
|
1111
|
+
readonly production: boolean;
|
|
1112
|
+
/** A list of browsers to target. */
|
|
1113
|
+
readonly browserslist: string[];
|
|
1114
|
+
readonly metadataList: MetadataBase$1[];
|
|
1115
|
+
private readonly plugins;
|
|
1116
|
+
readonly resolver: Resolver;
|
|
1117
|
+
log: {
|
|
1118
|
+
(...messages: unknown[]): void;
|
|
1119
|
+
warn(...messages: string[]): void;
|
|
1120
|
+
success(...messages: string[]): void;
|
|
1121
|
+
error(...messages: string[]): void;
|
|
1122
|
+
fatal(...messages: string[]): never;
|
|
1123
|
+
info(...messages: string[]): void;
|
|
1124
|
+
tip(...messages: string[]): void;
|
|
1125
|
+
debug(...messages: string[]): void;
|
|
1126
|
+
enableVerbose(enabled: boolean): void;
|
|
1127
|
+
setVerboseFilter(filter: RegExp): void;
|
|
1128
|
+
};
|
|
1129
|
+
/** File paths to load as sources. */
|
|
1130
|
+
readonly entryPoints: Set<string>;
|
|
1131
|
+
/** Any type of data for plugins to use. */
|
|
1132
|
+
readonly pluginData: Record<string, unknown>;
|
|
1133
|
+
/** Exclude paths from being emitted. */
|
|
1134
|
+
readonly emitExclude: Set<MetadataBase$1>;
|
|
1135
|
+
/** Chokidar watcher. */
|
|
1136
|
+
readonly watcher: FSWatcher | undefined;
|
|
1137
|
+
private isPluginInitialized;
|
|
1138
|
+
private measureExecutionTime;
|
|
1139
|
+
private executionTime;
|
|
1140
|
+
readonly pluginIndex: number;
|
|
1141
|
+
readonly pluginName: string;
|
|
1142
|
+
constructor(options: AppConfig$1 | undefined, configPath: string);
|
|
1143
|
+
private bindPlugin;
|
|
1144
|
+
private callPluginMethod;
|
|
1145
|
+
private emitFileChange;
|
|
1146
|
+
run(): Promise<void>;
|
|
1147
|
+
process(id: string): Promise<void>;
|
|
1148
|
+
resolve(metadata: MetadataBase$1): Promise<Set<string>>;
|
|
1149
|
+
/**
|
|
1150
|
+
* Resolve and load recursively
|
|
1151
|
+
*
|
|
1152
|
+
* 1. Resolves given metadata item or list
|
|
1153
|
+
* 2. Loads discovered dependencies if not already loaded skipping entry points
|
|
1154
|
+
* 3. Returns metadata list
|
|
1155
|
+
*/
|
|
1156
|
+
resolveAndLoad(metadataItemOrList: MetadataBase$1 | MetadataBase$1[]): Promise<MetadataBase$1[]>;
|
|
1157
|
+
transform(metadataItemOrList: MetadataBase$1 | MetadataBase$1[]): Promise<void>;
|
|
1158
|
+
transformAndSync(metadataItemOrList: MetadataBase$1 | MetadataBase$1[]): Promise<void>;
|
|
1159
|
+
rebase(metadata: MetadataBase$1, newAbsolutePath: string): Promise<void>;
|
|
1160
|
+
writeFiles(metadataItemOrList: MetadataBase$1 | MetadataBase$1[]): Promise<void>;
|
|
1161
|
+
read(filePath: string): Promise<string | undefined>;
|
|
1162
|
+
load(relativePath: string, options?: {
|
|
1163
|
+
code?: string;
|
|
1164
|
+
type?: string;
|
|
1165
|
+
}): Promise<MetadataBase$1 | undefined>;
|
|
1166
|
+
requestSources(metadata: MetadataBase$1): Promise<MetadataSource$1[]>;
|
|
1167
|
+
stringify(metadata: MetadataBase$1, options?: {
|
|
1168
|
+
minify?: boolean;
|
|
1169
|
+
format?: boolean;
|
|
1170
|
+
}): Promise<string>;
|
|
1171
|
+
getCompileList(event: "change" | "add" | "unlink", filePath: string): Promise<Set<string>>;
|
|
1172
|
+
handleRequest(requestPath: string, reply: ServerReply$1, request: ServerRequest$1): Promise<true | undefined>;
|
|
1173
|
+
resolveRequestPath(requestPath: string): Promise<string>;
|
|
1174
|
+
clone<T extends MetadataBase$1>(metadata: T): T;
|
|
1175
|
+
addMetadata(itemOrList: MetadataBase$1 | MetadataBase$1[]): void;
|
|
1176
|
+
removeMetadata(metadataOrIndex: MetadataBase$1 | MetadataBase$1[] | number): void;
|
|
1177
|
+
findMetadata<T extends MetadataBase$1>(metadataFilter: Partial<T>): T | undefined;
|
|
1178
|
+
filterMetadata<T extends MetadataBase$1>(metadataFilter: Partial<T>): T[];
|
|
1179
|
+
}
|
|
1180
|
+
//#endregion
|
|
1181
|
+
//#region src/types/plugin.d.ts
|
|
1182
|
+
type FastifyHandlerParameters = Parameters<onRequestHookHandler>;
|
|
1183
|
+
type ServerReply = FastifyHandlerParameters[1];
|
|
1184
|
+
type ServerRequest = FastifyHandlerParameters[0];
|
|
1185
|
+
interface MetadataSource {
|
|
1186
|
+
get source(): string;
|
|
1187
|
+
set source(value: string);
|
|
1188
|
+
node?: HTMLElement$1 | NodePath$1 | Postcss["AtRule"] | Postcss["Declaration"] | ImageResource | object;
|
|
1189
|
+
}
|
|
1190
|
+
interface ResolveResult {
|
|
1191
|
+
source: string;
|
|
1192
|
+
dependencyID?: string;
|
|
1193
|
+
}
|
|
1194
|
+
interface Plugin {
|
|
1195
|
+
name: string;
|
|
1196
|
+
setup?: (this: App$1) => void | Promise<void>;
|
|
1197
|
+
read?: (this: App$1, absolutePath: string) => string | void | Promise<string | void>;
|
|
1198
|
+
load?: (this: App$1, content: string, relativePath: string, options: {
|
|
1199
|
+
type?: string;
|
|
1200
|
+
}) => MetadataBase$1 | null | void | Promise<MetadataBase$1 | null | void>;
|
|
1201
|
+
resolveSource?: (this: App$1, source: string, filePath: string, parentMetadata: MetadataBase$1) => ResolveResult | void | Promise<ResolveResult | void>;
|
|
1202
|
+
transformSource?: (this: App$1, source: string, filePath: string, parentMetadata: MetadataBase$1) => string | void | Promise<string | void>;
|
|
1203
|
+
preTransform?: (this: App$1) => void | Promise<void>;
|
|
1204
|
+
transform?: (this: App$1, metadata: MetadataBase$1) => void | Promise<void>;
|
|
1205
|
+
postTransform?: (this: App$1) => void | Promise<void>;
|
|
1206
|
+
write?: (this: App$1, metadata: MetadataBase$1) => void | Promise<void>;
|
|
1207
|
+
postBuild?: (this: App$1) => void | Promise<void>;
|
|
1208
|
+
clone?: (this: App$1, metadata: MetadataBase$1) => void | MetadataBase$1;
|
|
1209
|
+
stringify?: (this: App$1, metadata: MetadataBase$1, options: {
|
|
1210
|
+
minify?: boolean;
|
|
1211
|
+
format?: boolean;
|
|
1212
|
+
}) => void | string | Promise<string | void>;
|
|
1213
|
+
sourcesProvider?: (this: App$1, metadata: MetadataBase$1) => MetadataSource[] | void | Promise<MetadataSource[] | void>;
|
|
1214
|
+
rebaseSource?: (this: App$1, source: string, filePath: string, newAbsolutePath: string) => string | void | Promise<string | void>;
|
|
1215
|
+
onMetadataRebase?: (this: App$1, metadata: MetadataBase$1, oldAbsolutePath: string, newAbsolutePath: string) => void | Promise<void>;
|
|
1216
|
+
handleRequest?: (this: App$1, requestPath: string, reply: ServerReply, request: ServerRequest) => boolean | void | Promise<boolean | void>;
|
|
1217
|
+
resolveRequestPath?: (this: App$1, requestPath: string) => string | void | Promise<string | void>;
|
|
1218
|
+
onFileEvent?: (this: App$1, event: "change" | "add" | "unlink", filePath: string) => void | Promise<void>;
|
|
1219
|
+
resolveCompileList?: (this: App$1, compileSet: Set<string>, event: "change" | "add" | "unlink", filePath: string) => void | Promise<void>;
|
|
1220
|
+
cli?: (this: CliProgram$1, config: AppConfig$1, configPath: string) => void | Promise<void>;
|
|
1221
|
+
}
|
|
1222
|
+
type RemoveThis<T> = Required<{ [K in keyof T]: T[K] extends ((this: App$1, ...arguments_: infer A) => infer R) | undefined ? (...arguments_: A) => R : T[K] }>;
|
|
1223
|
+
type BoundPlugin = RemoveThis<Plugin>;
|
|
1224
|
+
//#endregion
|
|
1225
|
+
//#region src/types/metadata.d.ts
|
|
1226
|
+
declare const METADATA_TYPES: Readonly<{
|
|
1227
|
+
Script: "Script";
|
|
1228
|
+
HTML: "Html";
|
|
1229
|
+
Markdown: "Markdown";
|
|
1230
|
+
CSS: "Style";
|
|
1231
|
+
SVG: "Svg";
|
|
1232
|
+
Package: "Package";
|
|
1233
|
+
TextAsset: "TextAsset";
|
|
1234
|
+
BinaryAsset: "BinaryAsset";
|
|
1235
|
+
WebAppManifest: "WebAppManifest";
|
|
1236
|
+
}>;
|
|
1237
|
+
type MetadataTypes = (typeof METADATA_TYPES)[keyof typeof METADATA_TYPES];
|
|
1238
|
+
interface MetadataBase {
|
|
1239
|
+
readonly type: `${Capitalize<string>}${string}`;
|
|
1240
|
+
/**
|
|
1241
|
+
* Relative path of the source file.
|
|
1242
|
+
*
|
|
1243
|
+
* Initially identical to `originalSource` when the metadata is created. During the build process, this value may change (e.g.,
|
|
1244
|
+
* if the file is moved to a different location and its links are rebased).
|
|
1245
|
+
*/
|
|
1246
|
+
filePath: string;
|
|
1247
|
+
/**
|
|
1248
|
+
* Original relative path of the source file.
|
|
1249
|
+
*
|
|
1250
|
+
* Set when the metadata is created and never modified.
|
|
1251
|
+
*/
|
|
1252
|
+
readonly id: string;
|
|
1253
|
+
readonly directDependencies: Set<string>;
|
|
1254
|
+
}
|
|
1255
|
+
interface ScriptMetadata extends MetadataBase {
|
|
1256
|
+
readonly type: (typeof METADATA_TYPES)["Script"];
|
|
1257
|
+
/**
|
|
1258
|
+
* The Babel AST for the script.
|
|
1259
|
+
*
|
|
1260
|
+
* Mutated during the build process and always represents the file's current transformed state.
|
|
1261
|
+
*/
|
|
1262
|
+
ast: BabelAst$1;
|
|
1263
|
+
/** Whether the script is a module or global */
|
|
1264
|
+
module: boolean;
|
|
1265
|
+
}
|
|
1266
|
+
interface StyleMetadata extends MetadataBase {
|
|
1267
|
+
readonly type: (typeof METADATA_TYPES)["CSS"];
|
|
1268
|
+
/**
|
|
1269
|
+
* The PostCSS root after transformation
|
|
1270
|
+
*
|
|
1271
|
+
* Mutated during the build process and always represents the file's current transformed state.
|
|
1272
|
+
*/
|
|
1273
|
+
ast: PostcssAst$1;
|
|
1274
|
+
}
|
|
1275
|
+
interface HtmlMetadata extends MetadataBase {
|
|
1276
|
+
type: (typeof METADATA_TYPES)["HTML"];
|
|
1277
|
+
/**
|
|
1278
|
+
* The HTML AST (root element).
|
|
1279
|
+
*
|
|
1280
|
+
* Mutated during the build process and always represents the file's current transformed state
|
|
1281
|
+
*/
|
|
1282
|
+
ast: Document$1;
|
|
1283
|
+
/** The transformed ASTs from script tags. The key is the UUID */
|
|
1284
|
+
scriptsMetadataList: Map<string, ScriptMetadata>;
|
|
1285
|
+
/** The transformed ASTs from script tags. The key is the UUID */
|
|
1286
|
+
stylesMetadataList: Map<string, StyleMetadata>;
|
|
1287
|
+
}
|
|
1288
|
+
interface SvgMetadata extends MetadataBase {
|
|
1289
|
+
type: (typeof METADATA_TYPES)["SVG"];
|
|
1290
|
+
/**
|
|
1291
|
+
* The HTML AST (root element).
|
|
1292
|
+
*
|
|
1293
|
+
* Mutated during the build process and always represents the file's current transformed state
|
|
1294
|
+
*/
|
|
1295
|
+
ast: Document$1;
|
|
1296
|
+
/** The transformed ASTs from script tags. The key is the UUID */
|
|
1297
|
+
stylesMetadataList: Map<string, StyleMetadata>;
|
|
1298
|
+
}
|
|
1299
|
+
interface MarkdownMetadata extends MetadataBase {
|
|
1300
|
+
type: (typeof METADATA_TYPES)["Markdown"];
|
|
1301
|
+
/**
|
|
1302
|
+
* Markdown tokens and frontmatter.
|
|
1303
|
+
*
|
|
1304
|
+
* Mutated during the build process and always represents the file's current transformed state
|
|
1305
|
+
*/
|
|
1306
|
+
ast: MarkdownAst$1;
|
|
1307
|
+
}
|
|
1308
|
+
interface WebManifestMetadata extends MetadataBase {
|
|
1309
|
+
type: (typeof METADATA_TYPES)["WebAppManifest"];
|
|
1310
|
+
ast: WebAppManifest;
|
|
1311
|
+
}
|
|
1312
|
+
interface PackageMetadata extends MetadataBase {
|
|
1313
|
+
type: (typeof METADATA_TYPES)["Package"];
|
|
1314
|
+
/** Metadata code */
|
|
1315
|
+
code: string;
|
|
1316
|
+
packageName: string;
|
|
1317
|
+
}
|
|
1318
|
+
interface TextAssetMetadata extends MetadataBase {
|
|
1319
|
+
type: (typeof METADATA_TYPES)["TextAsset"];
|
|
1320
|
+
/** Metadata code */
|
|
1321
|
+
code: string;
|
|
1322
|
+
}
|
|
1323
|
+
interface BinaryAssetMetadata extends MetadataBase {
|
|
1324
|
+
type: (typeof METADATA_TYPES)["BinaryAsset"];
|
|
1325
|
+
/** Raw binary content — images, fonts, wasm, etc. */
|
|
1326
|
+
data?: Uint8Array;
|
|
1327
|
+
}
|
|
1328
|
+
//#endregion
|
|
1329
|
+
//#region src/cli/cli.d.ts
|
|
1330
|
+
declare class CliProgram {
|
|
1331
|
+
#private;
|
|
1332
|
+
program: {
|
|
1333
|
+
cliName: "staticbolt";
|
|
1334
|
+
meta: {
|
|
1335
|
+
description: string;
|
|
1336
|
+
example: string;
|
|
1337
|
+
};
|
|
1338
|
+
options: {
|
|
1339
|
+
help: {
|
|
1340
|
+
aliases: string[];
|
|
1341
|
+
schema: z.ZodOptional<z.ZodBoolean>;
|
|
1342
|
+
coerce: {
|
|
1343
|
+
<T extends boolean | undefined>(terminalInput: string): T;
|
|
1344
|
+
type: string;
|
|
1345
|
+
};
|
|
1346
|
+
meta: {
|
|
1347
|
+
description: string;
|
|
1348
|
+
};
|
|
1349
|
+
};
|
|
1350
|
+
version: {
|
|
1351
|
+
aliases: string[];
|
|
1352
|
+
schema: z.ZodOptional<z.ZodBoolean>;
|
|
1353
|
+
coerce: {
|
|
1354
|
+
<T extends boolean | undefined>(terminalInput: string): T;
|
|
1355
|
+
type: string;
|
|
1356
|
+
};
|
|
1357
|
+
meta: {
|
|
1358
|
+
description: string;
|
|
1359
|
+
};
|
|
1360
|
+
};
|
|
1361
|
+
};
|
|
1362
|
+
onExecute: (handler: (data: {
|
|
1363
|
+
subcommand: undefined;
|
|
1364
|
+
options: {
|
|
1365
|
+
help?: boolean | undefined;
|
|
1366
|
+
version?: boolean | undefined;
|
|
1367
|
+
};
|
|
1368
|
+
arguments: never;
|
|
1369
|
+
positionals: never;
|
|
1370
|
+
context: {
|
|
1371
|
+
subcommand: undefined;
|
|
1372
|
+
options: {
|
|
1373
|
+
help: _$_staticbolt_args_parser0.OptionContext<z.ZodOptional<z.ZodBoolean>>;
|
|
1374
|
+
version: _$_staticbolt_args_parser0.OptionContext<z.ZodOptional<z.ZodBoolean>>;
|
|
1375
|
+
};
|
|
1376
|
+
arguments: never;
|
|
1377
|
+
positionals: never;
|
|
1378
|
+
};
|
|
1379
|
+
}) => void) => () => void;
|
|
1380
|
+
execute: (input?: {
|
|
1381
|
+
options?: {
|
|
1382
|
+
help?: boolean | undefined;
|
|
1383
|
+
version?: boolean | undefined;
|
|
1384
|
+
} | undefined;
|
|
1385
|
+
arguments?: undefined;
|
|
1386
|
+
positionals?: undefined;
|
|
1387
|
+
} | undefined) => void;
|
|
1388
|
+
executeAsync: (input?: {
|
|
1389
|
+
options?: {
|
|
1390
|
+
help?: boolean | undefined;
|
|
1391
|
+
version?: boolean | undefined;
|
|
1392
|
+
} | undefined;
|
|
1393
|
+
arguments?: undefined;
|
|
1394
|
+
positionals?: undefined;
|
|
1395
|
+
} | undefined) => Promise<void>;
|
|
1396
|
+
generateCliHelpMessage?: ((options?: _$_staticbolt_args_parser0.PrintHelpOptions) => string) | undefined;
|
|
1397
|
+
generateSubcommandHelpMessage?: ((subcommandName: string & {}, options?: _$_staticbolt_args_parser0.PrintHelpOptions) => string) | undefined;
|
|
1398
|
+
run: (input: string | string[]) => _$_staticbolt_args_parser0.CliParseResult<{
|
|
1399
|
+
cliName: "staticbolt";
|
|
1400
|
+
meta: {
|
|
1401
|
+
description: string;
|
|
1402
|
+
example: string;
|
|
1403
|
+
};
|
|
1404
|
+
options: {
|
|
1405
|
+
help: {
|
|
1406
|
+
aliases: string[];
|
|
1407
|
+
schema: z.ZodOptional<z.ZodBoolean>;
|
|
1408
|
+
coerce: {
|
|
1409
|
+
<T extends boolean | undefined>(terminalInput: string): T;
|
|
1410
|
+
type: string;
|
|
1411
|
+
};
|
|
1412
|
+
meta: {
|
|
1413
|
+
description: string;
|
|
1414
|
+
};
|
|
1415
|
+
};
|
|
1416
|
+
version: {
|
|
1417
|
+
aliases: string[];
|
|
1418
|
+
schema: z.ZodOptional<z.ZodBoolean>;
|
|
1419
|
+
coerce: {
|
|
1420
|
+
<T extends boolean | undefined>(terminalInput: string): T;
|
|
1421
|
+
type: string;
|
|
1422
|
+
};
|
|
1423
|
+
meta: {
|
|
1424
|
+
description: string;
|
|
1425
|
+
};
|
|
1426
|
+
};
|
|
1427
|
+
};
|
|
1428
|
+
}>;
|
|
1429
|
+
runAsync: (input: string | string[]) => Promise<_$_staticbolt_args_parser0.CliParseResult<{
|
|
1430
|
+
cliName: "staticbolt";
|
|
1431
|
+
meta: {
|
|
1432
|
+
description: string;
|
|
1433
|
+
example: string;
|
|
1434
|
+
};
|
|
1435
|
+
options: {
|
|
1436
|
+
help: {
|
|
1437
|
+
aliases: string[];
|
|
1438
|
+
schema: z.ZodOptional<z.ZodBoolean>;
|
|
1439
|
+
coerce: {
|
|
1440
|
+
<T extends boolean | undefined>(terminalInput: string): T;
|
|
1441
|
+
type: string;
|
|
1442
|
+
};
|
|
1443
|
+
meta: {
|
|
1444
|
+
description: string;
|
|
1445
|
+
};
|
|
1446
|
+
};
|
|
1447
|
+
version: {
|
|
1448
|
+
aliases: string[];
|
|
1449
|
+
schema: z.ZodOptional<z.ZodBoolean>;
|
|
1450
|
+
coerce: {
|
|
1451
|
+
<T extends boolean | undefined>(terminalInput: string): T;
|
|
1452
|
+
type: string;
|
|
1453
|
+
};
|
|
1454
|
+
meta: {
|
|
1455
|
+
description: string;
|
|
1456
|
+
};
|
|
1457
|
+
};
|
|
1458
|
+
};
|
|
1459
|
+
}>>;
|
|
1460
|
+
};
|
|
1461
|
+
constructor();
|
|
1462
|
+
initializePlugins(config: AppConfig$1, configPath: string): Promise<void>;
|
|
1463
|
+
static init(config: AppConfig$1, configPath: string): Promise<CliProgram>;
|
|
1464
|
+
run(cliArguments: string[]): _$_staticbolt_args_parser0.CliParseResult<{
|
|
1465
|
+
cliName: "staticbolt";
|
|
1466
|
+
meta: {
|
|
1467
|
+
description: string;
|
|
1468
|
+
example: string;
|
|
1469
|
+
};
|
|
1470
|
+
options: {
|
|
1471
|
+
help: {
|
|
1472
|
+
aliases: string[];
|
|
1473
|
+
schema: z.ZodOptional<z.ZodBoolean>;
|
|
1474
|
+
coerce: {
|
|
1475
|
+
<T extends boolean | undefined>(terminalInput: string): T;
|
|
1476
|
+
type: string;
|
|
1477
|
+
};
|
|
1478
|
+
meta: {
|
|
1479
|
+
description: string;
|
|
1480
|
+
};
|
|
1481
|
+
};
|
|
1482
|
+
version: {
|
|
1483
|
+
aliases: string[];
|
|
1484
|
+
schema: z.ZodOptional<z.ZodBoolean>;
|
|
1485
|
+
coerce: {
|
|
1486
|
+
<T extends boolean | undefined>(terminalInput: string): T;
|
|
1487
|
+
type: string;
|
|
1488
|
+
};
|
|
1489
|
+
meta: {
|
|
1490
|
+
description: string;
|
|
1491
|
+
};
|
|
1492
|
+
};
|
|
1493
|
+
};
|
|
1494
|
+
}>;
|
|
1495
|
+
readonly defineSubcommand: typeof defineSubcommand;
|
|
1496
|
+
readonly defineOptions: typeof defineOptions;
|
|
1497
|
+
readonly defineArguments: typeof defineArguments;
|
|
1498
|
+
readonly coerce: {
|
|
1499
|
+
string: <T extends string | undefined>(terminalInput: string) => T;
|
|
1500
|
+
boolean: {
|
|
1501
|
+
<T extends boolean | undefined>(terminalInput: string): T;
|
|
1502
|
+
type: string;
|
|
1503
|
+
};
|
|
1504
|
+
number: <T extends number | undefined>(terminalInput: string) => T;
|
|
1505
|
+
bigint: <T extends bigint | undefined>(terminalInput: string) => T;
|
|
1506
|
+
object: (options?: _$_staticbolt_args_parser0.ObjectCoerceMethodOptions) => <T extends Record<string, unknown> | undefined>(terminalInput: string) => T;
|
|
1507
|
+
stringArray: (separator: string) => <T extends string[] | undefined>(terminalInput: string) => T;
|
|
1508
|
+
numberArray: (separator: string) => <T extends number[] | undefined>(terminalInput: string) => T;
|
|
1509
|
+
booleanArray: (separator: string) => <T extends boolean[] | undefined>(terminalInput: string) => T;
|
|
1510
|
+
stringSet: (separator: string) => <T extends Set<string> | undefined>(terminalInput: string) => T;
|
|
1511
|
+
numberSet: (separator: string) => <T extends Set<number> | undefined>(terminalInput: string) => T;
|
|
1512
|
+
booleanSet: (separator: string) => <T extends Set<boolean> | undefined>(terminalInput: string) => T;
|
|
1513
|
+
json: <T>(terminalInput: string) => T;
|
|
1514
|
+
};
|
|
1515
|
+
addCommand(newSubcommand: Subcommand): number | undefined;
|
|
1516
|
+
addOptions(newOptions: Record<string, Option>): (Record<string, Option<_$_staticbolt_args_parser0.SchemaType<unknown>>> & Record<string, Option>) | undefined;
|
|
1517
|
+
addArguments(newArguments: Record<string, Argument>): (Record<string, Argument<_$_staticbolt_args_parser0.SchemaType<unknown>>> & Record<string, Argument>) | undefined;
|
|
1518
|
+
addOptionsToCommand(commandName: string, newOptions: Record<string, Option>): (Record<string, Option<_$_staticbolt_args_parser0.SchemaType<unknown>>> & Record<string, Option>) | undefined;
|
|
1519
|
+
addArgumentsToCommand(commandName: string, newArguments: Record<string, Argument>): (Record<string, Argument<_$_staticbolt_args_parser0.SchemaType<unknown>>> & Record<string, Argument>) | undefined;
|
|
1520
|
+
}
|
|
1521
|
+
//#endregion
|
|
1522
|
+
//#region src/utilities/path.d.ts
|
|
1523
|
+
declare const join: (...arguments_: string[]) => string;
|
|
1524
|
+
declare const relative: (from: string, to: string) => string;
|
|
1525
|
+
declare const dirname: (path: string) => string;
|
|
1526
|
+
declare const normalize: (path: string) => string;
|
|
1527
|
+
/**
|
|
1528
|
+
* Recalculates the relative path for a resource after a file has been moved.
|
|
1529
|
+
*
|
|
1530
|
+
* @param source - The source found in the `oldPath` file.
|
|
1531
|
+
* @param oldPath - Absolute or relative original path of the file.
|
|
1532
|
+
* @param newPath - Absolute or relative new path of the file.
|
|
1533
|
+
* @returns The updated relative path from the new file's directory to the same resource.
|
|
1534
|
+
*/
|
|
1535
|
+
declare function rebaseRelativePath(source: string, oldPath: string, newPath: string): string;
|
|
1536
|
+
/**
|
|
1537
|
+
* Checks if a path (child) is a subpath of another (parent).
|
|
1538
|
+
*
|
|
1539
|
+
* Note: both paths must be of the same type — either both absolute or both relative. Mixing them will produce incorrect results.
|
|
1540
|
+
*
|
|
1541
|
+
* @param parentDirectory - The parent directory.
|
|
1542
|
+
* @param childPath - The child path (file or directory).
|
|
1543
|
+
*/
|
|
1544
|
+
declare function isSubpath(parentDirectory: string, childPath: string): boolean;
|
|
1545
|
+
interface SourceRelativeToRootOptions {
|
|
1546
|
+
/** The root directory (absolute or resolvable) */
|
|
1547
|
+
root: string;
|
|
1548
|
+
/** The file path that contains the source path */
|
|
1549
|
+
filePath: string;
|
|
1550
|
+
/** The source path */
|
|
1551
|
+
sourcePath: string;
|
|
1552
|
+
}
|
|
1553
|
+
/** Calculates the relative path of a source path to the root. */
|
|
1554
|
+
declare function sourceRelativeToRoot({
|
|
1555
|
+
root,
|
|
1556
|
+
filePath,
|
|
1557
|
+
sourcePath
|
|
1558
|
+
}: SourceRelativeToRootOptions): string;
|
|
1559
|
+
/** Replaces the extension of a given path. */
|
|
1560
|
+
declare function replaceExtension(filePath: string, extension: string): string;
|
|
1561
|
+
/** Appends a forward slash to the end of a path if it doesn't already end with one. */
|
|
1562
|
+
declare const appendForwardSlash: (path: string) => string;
|
|
1563
|
+
/** Removes the leading `./` from a path. */
|
|
1564
|
+
declare const trimDotPrefix: (path: string) => string;
|
|
1565
|
+
/** Returns the first segment of a path. */
|
|
1566
|
+
declare function firstPart(path: string): string;
|
|
1567
|
+
interface MatchPathOptions {
|
|
1568
|
+
include: string | string[];
|
|
1569
|
+
ignore?: string | string[];
|
|
1570
|
+
root: string;
|
|
1571
|
+
}
|
|
1572
|
+
/** Checks if a file path matches a set of patterns. */
|
|
1573
|
+
declare function matchPath(filePath: string, {
|
|
1574
|
+
include,
|
|
1575
|
+
ignore,
|
|
1576
|
+
root
|
|
1577
|
+
}: MatchPathOptions): boolean;
|
|
1578
|
+
//#endregion
|
|
1579
|
+
//#region src/utilities/metadata-utilities.d.ts
|
|
1580
|
+
declare function isScriptMetadata(metadata: MetadataBase$1 | undefined): metadata is ScriptMetadata$1;
|
|
1581
|
+
declare function isPackageMetadata(metadata: MetadataBase$1 | undefined): metadata is PackageMetadata$1;
|
|
1582
|
+
declare function isHtmlMetadata(metadata: MetadataBase$1 | undefined): metadata is HtmlMetadata$1;
|
|
1583
|
+
declare function isStyleMetadata(metadata: MetadataBase$1 | undefined): metadata is StyleMetadata$1;
|
|
1584
|
+
declare function isSvgMetadata(metadata: MetadataBase$1 | undefined): metadata is SvgMetadata$1;
|
|
1585
|
+
declare function isMarkdownMetadata(metadata: MetadataBase$1 | undefined): metadata is MarkdownMetadata$1;
|
|
1586
|
+
declare function isTextAssetMetadata(metadata: MetadataBase$1 | undefined): metadata is TextAssetMetadata$1;
|
|
1587
|
+
declare function isBinaryAssetMetadata(metadata: MetadataBase$1 | undefined): metadata is BinaryAssetMetadata$1;
|
|
1588
|
+
declare function isWebManifestMetadata(metadata: MetadataBase$1): metadata is WebManifestMetadata$1;
|
|
1589
|
+
/**
|
|
1590
|
+
* Returns script-related metadata entries.
|
|
1591
|
+
*
|
|
1592
|
+
* - If the input is ScriptMetadata, it returns it directly.
|
|
1593
|
+
* - If the input is HtmlMetadata, it scans <script> tags in the AST and resolves their associated ScriptMetadata using the metadata
|
|
1594
|
+
* ID attribute.
|
|
1595
|
+
*/
|
|
1596
|
+
declare function filterScriptMetadata(metadata: MetadataBase$1): {
|
|
1597
|
+
metadata: ScriptMetadata$1;
|
|
1598
|
+
tag?: HTMLElement$2;
|
|
1599
|
+
htmlMetadata?: HtmlMetadata$1;
|
|
1600
|
+
}[];
|
|
1601
|
+
/**
|
|
1602
|
+
* Returns style-related metadata entries.
|
|
1603
|
+
*
|
|
1604
|
+
* - If the input is StyleMetadata, it returns it directly.
|
|
1605
|
+
* - If the input is HtmlMetadata, it scans <style> tags in the AST and resolves their associated StyleMetadata using the metadata
|
|
1606
|
+
* ID attribute.
|
|
1607
|
+
*/
|
|
1608
|
+
declare function filterStyleMetadata(metadata: MetadataBase$1): {
|
|
1609
|
+
metadata: StyleMetadata$1;
|
|
1610
|
+
tag?: HTMLElement$2;
|
|
1611
|
+
htmlMetadata?: HtmlMetadata$1;
|
|
1612
|
+
}[];
|
|
1613
|
+
//#endregion
|
|
1614
|
+
//#region src/utilities/print-formatted-error.d.ts
|
|
1615
|
+
type Node$3 = Node$2 | Node$1 | Node;
|
|
1616
|
+
interface FormatErrorOptions {
|
|
1617
|
+
/** AST node (e.g., from Babel, PostCSS, or HTML) to convert and highlight */
|
|
1618
|
+
node?: Node$3;
|
|
1619
|
+
/** Source code to highlight (use instead of `node`) */
|
|
1620
|
+
code?: string;
|
|
1621
|
+
/** Language of the provided source code (required if `code` is set) */
|
|
1622
|
+
lang?: string;
|
|
1623
|
+
/** Path of the file where the error occurred */
|
|
1624
|
+
filePath?: string;
|
|
1625
|
+
/** Name of the function where the error originated */
|
|
1626
|
+
functionName?: string;
|
|
1627
|
+
level?: "error" | "warning";
|
|
1628
|
+
/** Function reference used to extract the function name */
|
|
1629
|
+
function?: (...arguments_: any[]) => any;
|
|
1630
|
+
}
|
|
1631
|
+
type MessageAndError = (string | Error)[];
|
|
1632
|
+
declare class PrintFormattedError {
|
|
1633
|
+
options: FormatErrorOptions;
|
|
1634
|
+
constructor(options?: FormatErrorOptions);
|
|
1635
|
+
static create(options?: FormatErrorOptions): (...messageAndErrorWithOptions: [...MessageAndError] | [...MessageAndError, FormatErrorOptions]) => void;
|
|
1636
|
+
print: (...messageAndErrorWithOptions: [...MessageAndError] | [...MessageAndError, FormatErrorOptions]) => void;
|
|
1637
|
+
}
|
|
1638
|
+
declare const printFmtError: (...messageAndErrorWithOptions: [...MessageAndError] | [...MessageAndError, FormatErrorOptions]) => void;
|
|
1639
|
+
//#endregion
|
|
1640
|
+
//#region src/utilities/value-or-error.d.ts
|
|
1641
|
+
type ValueOrError<T> = [T, null] | [null, Error];
|
|
1642
|
+
//#endregion
|
|
1643
|
+
//#region src/utilities/read-file.d.ts
|
|
1644
|
+
declare function safeReadFile(path: PathLike | FileHandle, options?: ({
|
|
1645
|
+
encoding?: null | undefined;
|
|
1646
|
+
flag?: OpenMode | undefined;
|
|
1647
|
+
} & Abortable) | null): Promise<ValueOrError<Buffer>>;
|
|
1648
|
+
declare function safeReadFile(path: PathLike | FileHandle, options: ({
|
|
1649
|
+
encoding: BufferEncoding;
|
|
1650
|
+
flag?: OpenMode | undefined;
|
|
1651
|
+
} & Abortable) | BufferEncoding): Promise<ValueOrError<string>>;
|
|
1652
|
+
declare function safeReadFile(path: PathLike | FileHandle, options?: (ObjectEncodingOptions & Abortable & {
|
|
1653
|
+
flag?: OpenMode | undefined;
|
|
1654
|
+
}) | BufferEncoding | null): Promise<ValueOrError<string | Buffer>>;
|
|
1655
|
+
declare function safeReadFileSync(path: PathOrFileDescriptor, options?: {
|
|
1656
|
+
encoding?: null | undefined;
|
|
1657
|
+
flag?: string | undefined;
|
|
1658
|
+
} | null): ValueOrError<NonSharedBuffer>;
|
|
1659
|
+
declare function safeReadFileSync(path: PathOrFileDescriptor, options: {
|
|
1660
|
+
encoding: BufferEncoding;
|
|
1661
|
+
flag?: string | undefined;
|
|
1662
|
+
} | BufferEncoding): ValueOrError<string>;
|
|
1663
|
+
declare function safeReadFileSync(path: PathOrFileDescriptor, options?: (ObjectEncodingOptions & {
|
|
1664
|
+
flag?: string | undefined;
|
|
1665
|
+
}) | BufferEncoding | null): ValueOrError<string | NonSharedBuffer>;
|
|
1666
|
+
//#endregion
|
|
1667
|
+
//#region src/utilities/utilities.d.ts
|
|
1668
|
+
/** `process.stdout.write` */
|
|
1669
|
+
declare function print(...input: string[]): void;
|
|
1670
|
+
/** - Clear the line in the terminal */
|
|
1671
|
+
declare function clearLn(): void;
|
|
1672
|
+
/** Used to assign a computed value to a variable */
|
|
1673
|
+
declare function assign<T>(function_: () => T): T;
|
|
1674
|
+
/** Check if the value is an object */
|
|
1675
|
+
declare function isObject(value: unknown): value is Record<string, unknown>;
|
|
1676
|
+
declare function kebabToCamelCase(string_: string): string;
|
|
1677
|
+
declare function camelCaseToKebabCase(string_: string): string;
|
|
1678
|
+
declare function capitalize(string_: string): string;
|
|
1679
|
+
/**
|
|
1680
|
+
* - Get line and column number from first match index
|
|
1681
|
+
*
|
|
1682
|
+
* @param code - Code string
|
|
1683
|
+
* @param matchIndex - Matching index
|
|
1684
|
+
* @returns - `[line, column]`
|
|
1685
|
+
*/
|
|
1686
|
+
declare function getLineColumn(code: string, matchIndex: number): [number, number];
|
|
1687
|
+
/** - Human readable bytes, E.g: `1024 => 1KB` */
|
|
1688
|
+
declare function humanReadableBytes(bytes: number): string;
|
|
1689
|
+
declare function bytesToKB(bytes: number): number;
|
|
1690
|
+
/** - Clamp a numeric value between min and max values. */
|
|
1691
|
+
declare function clamp(value: number, min: number, max: number): number;
|
|
1692
|
+
declare function isDefined<T>(value: T | undefined): value is T;
|
|
1693
|
+
/**
|
|
1694
|
+
* Merges all entries from `source` into `target`, mutating `target` in place.
|
|
1695
|
+
*
|
|
1696
|
+
* - Existing keys in `target` are overwritten by `source` values.
|
|
1697
|
+
* - Values are **not** cloned — object references are shared between both maps after the merge.
|
|
1698
|
+
*
|
|
1699
|
+
* @param target - The map to be mutated with new/updated entries.
|
|
1700
|
+
* @param source - The map whose entries are read and applied to `target`.
|
|
1701
|
+
* @returns The mutated `target` map.
|
|
1702
|
+
*/
|
|
1703
|
+
declare function mergeMaps<K, V>(target: Map<K, V>, source: Map<K, V>): Map<K, V>;
|
|
1704
|
+
/** - Download from CDN */
|
|
1705
|
+
declare function downloadContent(url: string): Promise<ValueOrError<string>>;
|
|
1706
|
+
declare function isURL(url: string): boolean;
|
|
1707
|
+
/** Creates a shallow clone of an object while preserving its prototype and property descriptors. */
|
|
1708
|
+
declare function cloneObject<T extends object>(object: T): T;
|
|
1709
|
+
declare function hashContent(content: string): string;
|
|
1710
|
+
declare function escapeHtml(input: string): string;
|
|
1711
|
+
//#endregion
|
|
1712
|
+
//#region src/helpers/dependency-tracker.d.ts
|
|
1713
|
+
/**
|
|
1714
|
+
* Tracks bidirectional dependencies between importers and their sources.\
|
|
1715
|
+
* Handles reconciliation when dependencies change, so stale entries are automatically removed when an importer stops referencing
|
|
1716
|
+
* a source.
|
|
1717
|
+
*/
|
|
1718
|
+
declare class DependencyTracker {
|
|
1719
|
+
#private;
|
|
1720
|
+
/** Updates the full set of sources for a given importer, reconciling any stale entries from previous calls. */
|
|
1721
|
+
update(importer: string, sources: Iterable<string>): void;
|
|
1722
|
+
/** Deletes all dependency data for a given id, whether it's acting as an importer, a source, or both (e.g. on file unlink). */
|
|
1723
|
+
delete(id: string): void;
|
|
1724
|
+
/** Returns all importers that depend on a given source, or an empty set. */
|
|
1725
|
+
getImporters(source: string): ReadonlySet<string>;
|
|
1726
|
+
/** Returns all sources that a given importer depends on, or an empty set. */
|
|
1727
|
+
getSources(importer: string): ReadonlySet<string>;
|
|
1728
|
+
}
|
|
1729
|
+
//#endregion
|
|
1730
|
+
//#region src/index.d.ts
|
|
1731
|
+
declare function defineConfig(config: AppConfig): AppConfig;
|
|
1732
|
+
//#endregion
|
|
1733
|
+
export { type App, AppConfig, BabelAst, BinaryAssetMetadata, BoundPlugin, CONFIG_FILE_NAME, CUSTOM_ATTRIBUTES, CliProgram, DependencyTracker, type Document, type HTMLElement, HtmlMetadata, METADATA_TYPES, MarkdownAst, MarkdownMetadata, MetadataBase, MetadataSource, MetadataTypes, NodePath, PackageMetadata, Plugin, PostcssAst, PrintFormattedError, ResolveResult, ScriptMetadata, ServerReply, ServerRequest, StyleMetadata, SvgMetadata, TextAssetMetadata, WebManifestMetadata, appendForwardSlash, assign, basename, bytesToKB, camelCaseToKebabCase, capitalize, clamp, clearLn, cloneObject, defineConfig, dirname, downloadContent, escapeHtml, extname, filterScriptMetadata, filterStyleMetadata, firstPart, getLineColumn, hashContent, humanReadableBytes, isAbsolute, isBinaryAssetMetadata, isDefined, isHtmlMetadata, isMarkdownMetadata, isObject, isPackageMetadata, isScriptMetadata, isStyleMetadata, isSubpath, isSvgMetadata, isTextAssetMetadata, isURL, isWebManifestMetadata, join, kebabToCamelCase, matchPath, mergeMaps, normalize, parse, print, printFmtError, rebaseRelativePath, relative, replaceExtension, resolve, safeReadFile, safeReadFileSync, sourceRelativeToRoot, trimDotPrefix };
|
|
1734
|
+
//# sourceMappingURL=index.d.mts.map
|