svg-eslint-parser 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  [![CI](https://github.com/ntnyq/svg-eslint-parser/workflows/CI/badge.svg)](https://github.com/ntnyq/svg-eslint-parser/actions)
4
4
  [![NPM VERSION](https://img.shields.io/npm/v/svg-eslint-parser.svg)](https://www.npmjs.com/package/svg-eslint-parser)
5
5
  [![NPM DOWNLOADS](https://img.shields.io/npm/dy/svg-eslint-parser.svg)](https://www.npmjs.com/package/svg-eslint-parser)
6
- [![CODECOV](https://codecov.io/github/ntnyq/svg-eslint-parser/branch/main/graph/badge.svg)](https://codecov.io/github/ntnyq/svg-eslint-parser)
6
+ [![CODECOV](https://codecov.io/github/ntnyq/svg-eslint-parser/branch/main/graph/badge.svg?token=ECHQ09F90X)](https://codecov.io/github/ntnyq/svg-eslint-parser)
7
7
  [![LICENSE](https://img.shields.io/github/license/ntnyq/svg-eslint-parser.svg)](https://github.com/ntnyq/svg-eslint-parser/blob/main/LICENSE)
8
8
 
9
9
  > :package: An SVG parser that produces output compatible with ESLint.
@@ -11,7 +11,7 @@
11
11
  > [!IMPORTANT]
12
12
  > Status: Work In Progress, not ready for production.
13
13
  >
14
- > Api may change every release, Use at your own risk.
14
+ > API is not stale now, Use at your own risk.
15
15
 
16
16
  ## Install
17
17
 
@@ -27,6 +27,12 @@ yarn add svg-eslint-parser -D
27
27
  pnpm add svg-eslint-parser -D
28
28
  ```
29
29
 
30
+ ## Playground
31
+
32
+ You can try the parser in [playground](https://svg-eslint-parser.ntnyq.com/play).
33
+
34
+ Feel free to open an issue if you have any suggestions or find any bugs.
35
+
30
36
  ## Links
31
37
 
32
38
  - [Scalable Vector Graphics (SVG) 2](https://www.w3.org/TR/SVG2/)
@@ -16,90 +16,186 @@ declare class ParseError extends SyntaxError {
16
16
  constructor(message: string, offset: number, line: number, column: number);
17
17
  }
18
18
 
19
+ /**
20
+ * svg comment start
21
+ */
22
+ declare const COMMENT_START = "<!--";
23
+ /**
24
+ * svg comment end
25
+ */
26
+ declare const COMMENT_END = "-->";
27
+ /**
28
+ * xml declaration start
29
+ */
30
+ declare const XML_DECLARATION_START = "<?xml";
31
+ /**
32
+ * xml declaration end
33
+ */
34
+ declare const XML_DECLARATION_END = "?>";
35
+ /**
36
+ * regexp for open tag start
37
+ * @regex101 https://regex101.com/?regex=%5E%3C%5Cw&flavor=javascript
38
+ */
39
+ declare const RE_OPEN_TAG_START: RegExp;
40
+ /**
41
+ * regexp for open tag name
42
+ * @regex101 https://regex101.com/?regex=%5E%3C%28%5CS%2B%29&flavor=javascript
43
+ */
44
+ declare const RE_OPEN_TAG_NAME: RegExp;
45
+ /**
46
+ * regexp for close tag name
47
+ * @regex101 https://regex101.com/?regex=%5E%3C%5C%2F%28%28%3F%3A.%7C%5Cn%29*%29%3E%24&flavor=javascript
48
+ */
49
+ declare const RE_CLOSE_TAG_NAME: RegExp;
50
+ /**
51
+ * regexp for incomplete closing tag
52
+ * @regex101 https://regex101.com/?regex=%3C%5C%2F%5B%5E%3E%5D%2B%24&flavor=javascript
53
+ */
54
+ declare const RE_INCOMPLETE_CLOSING_TAG: RegExp;
55
+
19
56
  declare enum NodeTypes {
20
- Program = "Program",
21
- Document = "Document",
22
- Text = "Text",
23
- XMLDeclaration = "XMLDeclaration",
57
+ Attribute = "Attribute",
58
+ AttributeKey = "AttributeKey",
59
+ AttributeValue = "AttributeValue",
60
+ AttributeValueWrapperEnd = "AttributeValueWrapperEnd",
61
+ AttributeValueWrapperStart = "AttributeValueWrapperStart",
62
+ CloseTag = "CloseTag",
63
+ Comment = "Comment",
64
+ CommentClose = "CommentClose",
65
+ CommentContent = "CommentContent",
66
+ CommentOpen = "CommentOpen",
24
67
  Doctype = "Doctype",
25
- DoctypeOpen = "DoctypeOpen",
26
- DoctypeClose = "DoctypeClose",
27
68
  DoctypeAttribute = "DoctypeAttribute",
28
69
  DoctypeAttributeValue = "DoctypeAttributeValue",
29
70
  DoctypeAttributeWrapperEnd = "DoctypeAttributeWrapperEnd",
30
71
  DoctypeAttributeWrapperStart = "DoctypeAttributeWrapperStart",
31
- Tag = "Tag",
32
- OpenTagStart = "OpenTagStart",
72
+ DoctypeClose = "DoctypeClose",
73
+ DoctypeOpen = "DoctypeOpen",
74
+ Document = "Document",
33
75
  OpenTagEnd = "OpenTagEnd",
34
- CloseTag = "CloseTag",
35
- Comment = "Comment",
36
- CommentOpen = "CommentOpen",
37
- CommentClose = "CommentClose",
38
- CommentContent = "CommentContent",
76
+ OpenTagStart = "OpenTagStart",
77
+ Program = "Program",
78
+ Tag = "Tag",
79
+ Text = "Text",
80
+ XMLDeclaration = "XMLDeclaration",
81
+ XMLDeclarationAttribute = "XMLDeclarationAttribute",
82
+ XMLDeclarationAttributeKey = "XMLDeclarationAttributeKey",
83
+ XMLDeclarationAttributeValue = "XMLDeclarationAttributeValue",
84
+ XMLDeclarationAttributeValueWrapperEnd = "XMLDeclarationAttributeValueWrapperEnd",
85
+ XMLDeclarationAttributeValueWrapperStart = "XMLDeclarationAttributeValueWrapperStart",
86
+ XMLDeclarationClose = "XMLDeclarationClose",
87
+ XMLDeclarationOpen = "XMLDeclarationOpen"
88
+ }
89
+
90
+ declare enum TokenTypes {
39
91
  Attribute = "Attribute",
92
+ AttributeAssignment = "AttributeAssignment",
40
93
  AttributeKey = "AttributeKey",
41
94
  AttributeValue = "AttributeValue",
95
+ AttributeValueWrapperEnd = "AttributeValueWrapperEnd",
42
96
  AttributeValueWrapperStart = "AttributeValueWrapperStart",
43
- AttributeValueWrapperEnd = "AttributeValueWrapperEnd"
44
- }
45
-
46
- declare enum TokenTypes {
47
- Program = "Program",
48
- Document = "Document",
49
- Text = "Text",
50
- Doctype = "Doctype",
51
- DoctypeOpen = "DoctypeOpen",
52
- DoctypeClose = "DoctypeClose",
53
- DoctypeAttributeValue = "DoctypeAttributeValue",
54
- DoctypeAttributeWrapperStart = "DoctypeAttributeWrapperStart",
55
- DoctypeAttributeWrapperEnd = "DoctypeAttributeWrapperEnd",
56
- Tag = "Tag",
57
- OpenTagStart = "OpenTagStart",
58
- OpenTagEnd = "OpenTagEnd",
59
97
  CloseTag = "CloseTag",
60
98
  Comment = "Comment",
61
- CommentOpen = "CommentOpen",
62
99
  CommentClose = "CommentClose",
63
100
  CommentContent = "CommentContent",
64
- Attribute = "Attribute",
65
- AttributeKey = "AttributeKey",
66
- AttributeValue = "AttributeValue",
67
- AttributeAssignment = "AttributeAssignment",
68
- AttributeValueWrapperStart = "AttributeValueWrapperStart",
69
- AttributeValueWrapperEnd = "AttributeValueWrapperEnd"
101
+ CommentOpen = "CommentOpen",
102
+ Doctype = "Doctype",
103
+ DoctypeAttributeValue = "DoctypeAttributeValue",
104
+ DoctypeAttributeWrapperEnd = "DoctypeAttributeWrapperEnd",
105
+ DoctypeAttributeWrapperStart = "DoctypeAttributeWrapperStart",
106
+ DoctypeClose = "DoctypeClose",
107
+ DoctypeOpen = "DoctypeOpen",
108
+ Document = "Document",
109
+ OpenTagEnd = "OpenTagEnd",
110
+ OpenTagStart = "OpenTagStart",
111
+ Program = "Program",
112
+ Tag = "Tag",
113
+ Text = "Text",
114
+ XMLDeclarationAttribute = "XMLDeclarationAttribute",
115
+ XMLDeclarationAttributeAssignment = "XMLDeclarationAttributeAssignment",
116
+ XMLDeclarationAttributeKey = "XMLDeclarationAttributeKey",
117
+ XMLDeclarationAttributeValue = "XMLDeclarationAttributeValue",
118
+ XMLDeclarationAttributeValueWrapperEnd = "XMLDeclarationAttributeValueWrapperEnd",
119
+ XMLDeclarationAttributeValueWrapperStart = "XMLDeclarationAttributeValueWrapperStart",
120
+ XMLDeclarationClose = "XMLDeclarationClose",
121
+ XMLDeclarationOpen = "XMLDeclarationOpen"
70
122
  }
71
123
 
124
+ declare const SPECIAL_CHAR: {
125
+ closingCorner: string;
126
+ colon: string;
127
+ comma: string;
128
+ doubleQuote: string;
129
+ equal: string;
130
+ exclamation: string;
131
+ hyphen: string;
132
+ newline: string;
133
+ openingCorner: string;
134
+ question: string;
135
+ return: string;
136
+ singleQuote: string;
137
+ slash: string;
138
+ space: string;
139
+ tab: string;
140
+ };
141
+
142
+ /**
143
+ * @copyright {@link https://github.com/davidohlin/svg-elements}
144
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Element}
145
+ */
146
+ declare const SVG_ELEMENTS: Set<string>;
147
+ /**
148
+ * obsolete and deprecated elements
149
+ *
150
+ * @see {@link https://developer.mozilla.org/en-US/docs/Web/SVG/Element#obsolete_and_deprecated_elements}
151
+ */
152
+ declare const DEPRECATED_SVG_ELEMENTS: Set<string>;
153
+ /**
154
+ * self closing svg elements
155
+ */
156
+ declare const SELF_CLOSING_ELEMENTS: Set<string>;
157
+
72
158
  declare enum TokenizerContextTypes {
73
- Data = "Data",
74
- OpenTagStart = "OpenTagStart",
75
- OpenTagEnd = "OpenTagEnd",
76
- CloseTag = "CloseTag",
77
- Attributes = "Attributes",
78
159
  AttributeKey = "AttributeKey",
160
+ Attributes = "Attributes",
79
161
  AttributeValue = "AttributeValue",
80
162
  AttributeValueBare = "AttributeValueBare",
81
163
  AttributeValueWrapped = "AttributeValueWrapped",
164
+ CloseTag = "CloseTag",
165
+ CommentClose = "CommentClose",
82
166
  CommentContent = "CommentContent",
83
167
  CommentOpen = "CommentOpen",
84
- CommentClose = "CommentClose",
85
- DoctypeOpen = "DoctypeOpen",
86
- DoctypeClose = "DoctypeClose",
87
- DoctypeAttributes = "DoctypeAttributes",
168
+ Data = "Data",
88
169
  DoctypeAttributeBare = "DoctypeAttributeBare",
89
- DoctypeAttributeWrapped = "DoctypeAttributeWrapped"
170
+ DoctypeAttributes = "DoctypeAttributes",
171
+ DoctypeAttributeWrapped = "DoctypeAttributeWrapped",
172
+ DoctypeClose = "DoctypeClose",
173
+ DoctypeOpen = "DoctypeOpen",
174
+ OpenTagEnd = "OpenTagEnd",
175
+ OpenTagStart = "OpenTagStart",
176
+ XMLDeclarationAttributeKey = "XMLDeclarationAttributeKey",
177
+ XMLDeclarationAttributes = "XMLDeclarationAttributes",
178
+ XMLDeclarationAttributeValue = "XMLDeclarationAttributeValue",
179
+ XMLDeclarationAttributeValueWrapped = "XMLDeclarationAttributeValueWrapped",
180
+ XMLDeclarationClose = "XMLDeclarationClose",
181
+ XMLDeclarationOpen = "XMLDeclarationOpen"
90
182
  }
91
183
 
92
184
  declare enum ConstructTreeContextTypes {
93
- Tag = "Tag",
94
- TagName = "TagName",
95
- TagContent = "TagContent",
96
185
  Attribute = "Attribute",
97
186
  Attributes = "Attributes",
98
187
  AttributeValue = "AttributeValue",
188
+ Comment = "Comment",
99
189
  Doctype = "Doctype",
100
190
  DoctypeAttribute = "DoctypeAttribute",
101
191
  DoctypeAttributes = "DoctypeAttributes",
102
- Comment = "Comment"
192
+ Tag = "Tag",
193
+ TagContent = "TagContent",
194
+ TagName = "TagName",
195
+ XMLDeclaration = "XMLDeclaration",
196
+ XMLDeclarationAttribute = "XMLDeclarationAttribute",
197
+ XMLDeclarationAttributes = "XMLDeclarationAttributes",
198
+ XMLDeclarationAttributeValue = "XMLDeclarationAttributeValue"
103
199
  }
104
200
 
105
201
  interface Locations {
@@ -128,6 +224,10 @@ interface SourceLocation {
128
224
  start: Position;
129
225
  }
130
226
 
227
+ /**
228
+ * any token
229
+ */
230
+ type AnyToken = Token<TokenTypes.Attribute> | Token<TokenTypes.AttributeAssignment> | Token<TokenTypes.AttributeKey> | Token<TokenTypes.AttributeValue> | Token<TokenTypes.AttributeValueWrapperEnd> | Token<TokenTypes.AttributeValueWrapperStart> | Token<TokenTypes.CloseTag> | Token<TokenTypes.Comment> | Token<TokenTypes.CommentClose> | Token<TokenTypes.CommentContent> | Token<TokenTypes.CommentOpen> | Token<TokenTypes.Doctype> | Token<TokenTypes.DoctypeAttributeValue> | Token<TokenTypes.DoctypeAttributeWrapperEnd> | Token<TokenTypes.DoctypeAttributeWrapperStart> | Token<TokenTypes.DoctypeClose> | Token<TokenTypes.DoctypeOpen> | Token<TokenTypes.Document> | Token<TokenTypes.OpenTagEnd> | Token<TokenTypes.OpenTagStart> | Token<TokenTypes.Program> | Token<TokenTypes.Tag> | Token<TokenTypes.Text> | Token<TokenTypes.XMLDeclarationAttribute> | Token<TokenTypes.XMLDeclarationAttributeAssignment> | Token<TokenTypes.XMLDeclarationAttributeKey> | Token<TokenTypes.XMLDeclarationAttributeValue> | Token<TokenTypes.XMLDeclarationAttributeValueWrapperEnd> | Token<TokenTypes.XMLDeclarationAttributeValueWrapperStart> | Token<TokenTypes.XMLDeclarationClose> | Token<TokenTypes.XMLDeclarationOpen>;
131
231
  /**
132
232
  * token
133
233
  */
@@ -141,10 +241,6 @@ interface Token<T extends TokenTypes> extends Locations {
141
241
  */
142
242
  value: string;
143
243
  }
144
- /**
145
- * any token
146
- */
147
- type AnyToken = Token<TokenTypes.Attribute> | Token<TokenTypes.AttributeAssignment> | Token<TokenTypes.AttributeKey> | Token<TokenTypes.AttributeValue> | Token<TokenTypes.AttributeValueWrapperEnd> | Token<TokenTypes.AttributeValueWrapperStart> | Token<TokenTypes.CloseTag> | Token<TokenTypes.Comment> | Token<TokenTypes.CommentClose> | Token<TokenTypes.CommentContent> | Token<TokenTypes.CommentOpen> | Token<TokenTypes.Doctype> | Token<TokenTypes.DoctypeAttributeValue> | Token<TokenTypes.DoctypeAttributeWrapperEnd> | Token<TokenTypes.DoctypeAttributeWrapperStart> | Token<TokenTypes.DoctypeClose> | Token<TokenTypes.DoctypeOpen> | Token<TokenTypes.Document> | Token<TokenTypes.OpenTagEnd> | Token<TokenTypes.OpenTagStart> | Token<TokenTypes.Program> | Token<TokenTypes.Tag> | Token<TokenTypes.Text>;
148
244
 
149
245
  interface BaseNode extends Locations {
150
246
  type: NodeTypes;
@@ -153,22 +249,25 @@ interface SimpleNode<T extends NodeTypes> extends BaseNode {
153
249
  type: T;
154
250
  value: string;
155
251
  }
252
+ type TextNode = SimpleNode<NodeTypes.Text>;
156
253
  /**
157
254
  * attribute
255
+ * @pg
158
256
  */
159
257
  type AttributeKeyNode = SimpleNode<NodeTypes.AttributeKey>;
160
258
  interface AttributeNode extends BaseNode {
161
259
  key: AttributeKeyNode;
162
260
  type: NodeTypes.Attribute;
261
+ value: AttributeValueNode;
163
262
  endWrapper?: AttributeValueWrapperEndNode;
164
263
  startWrapper?: AttributeValueWrapperStartNode;
165
- value?: AttributeValueNode;
166
264
  }
167
265
  type AttributeValueNode = SimpleNode<NodeTypes.AttributeValue>;
168
266
  type AttributeValueWrapperEndNode = SimpleNode<NodeTypes.AttributeValueWrapperEnd>;
169
267
  type AttributeValueWrapperStartNode = SimpleNode<NodeTypes.AttributeValueWrapperStart>;
170
268
  /**
171
269
  * comment
270
+ * @pg
172
271
  */
173
272
  type CommentCloseNode = SimpleNode<NodeTypes.CommentClose>;
174
273
  type CommentContentNode = SimpleNode<NodeTypes.CommentContent>;
@@ -181,6 +280,7 @@ interface CommentNode extends BaseNode {
181
280
  type CommentOpenNode = SimpleNode<NodeTypes.CommentOpen>;
182
281
  /**
183
282
  * doctype
283
+ * @pg
184
284
  */
185
285
  interface DoctypeAttributeNode extends BaseNode {
186
286
  type: NodeTypes.DoctypeAttribute;
@@ -199,20 +299,9 @@ interface DoctypeNode extends BaseNode {
199
299
  type: NodeTypes.Doctype;
200
300
  }
201
301
  type DoctypeOpenNode = SimpleNode<NodeTypes.DoctypeOpen>;
202
- interface DocumentNode extends BaseNode {
203
- children: NestableNode[];
204
- type: NodeTypes.Document;
205
- }
206
- type TextNode = SimpleNode<NodeTypes.Text>;
207
- interface XMLDeclarationNode extends BaseNode {
208
- /**
209
- * TODO: create XMLDeclarationAttributeNode
210
- */
211
- attributes: AttributeNode[];
212
- type: NodeTypes.XMLDeclaration;
213
- }
214
302
  /**
215
303
  * tag
304
+ * @pg
216
305
  */
217
306
  type CloseTagNode = SimpleNode<NodeTypes.CloseTag>;
218
307
  type OpenTagEndNode = SimpleNode<NodeTypes.OpenTagEnd>;
@@ -227,28 +316,74 @@ interface TagNode extends BaseNode {
227
316
  type: NodeTypes.Tag;
228
317
  close?: CloseTagNode;
229
318
  }
319
+ /**
320
+ * XML declaration
321
+ */
322
+ type XMLDeclarationAttributeKeyNode = SimpleNode<NodeTypes.XMLDeclarationAttributeKey>;
323
+ interface XMLDeclarationAttributeNode extends BaseNode {
324
+ key: XMLDeclarationAttributeKeyNode;
325
+ type: NodeTypes.XMLDeclarationAttribute;
326
+ value: XMLDeclarationAttributeValueNode;
327
+ endWrapper?: XMLDeclarationAttributeValueWrapperEndNode;
328
+ startWrapper?: XMLDeclarationAttributeValueWrapperStartNode;
329
+ }
330
+ type XMLDeclarationAttributeValueNode = SimpleNode<NodeTypes.XMLDeclarationAttributeValue>;
331
+ type XMLDeclarationAttributeValueWrapperEndNode = SimpleNode<NodeTypes.XMLDeclarationAttributeValueWrapperEnd>;
332
+ type XMLDeclarationAttributeValueWrapperStartNode = SimpleNode<NodeTypes.XMLDeclarationAttributeValueWrapperStart>;
333
+ type XMLDeclarationCloseNode = SimpleNode<NodeTypes.XMLDeclarationClose>;
334
+ interface XMLDeclarationNode extends BaseNode {
335
+ attributes: XMLDeclarationAttributeNode[];
336
+ close: XMLDeclarationCloseNode;
337
+ open: XMLDeclarationOpenNode;
338
+ type: NodeTypes.XMLDeclaration;
339
+ }
340
+ type XMLDeclarationOpenNode = SimpleNode<NodeTypes.XMLDeclarationOpen>;
341
+ /**
342
+ * nestable node
343
+ * @pg
344
+ */
345
+ type NestableNode = CommentNode | TagNode | TextNode | XMLDeclarationNode;
230
346
  /**
231
347
  * program
348
+ * @pg
232
349
  */
350
+ interface DocumentNode extends BaseNode {
351
+ children: NestableNode[];
352
+ type: NodeTypes.Document;
353
+ }
233
354
  interface Program extends BaseNode {
234
355
  body: DocumentNode[];
235
356
  comments: CommentContentNode[];
236
357
  tokens: AnyToken[];
237
358
  type: NodeTypes.Program;
238
359
  }
239
- /**
240
- * nestable node
241
- */
242
- type NestableNode = CommentNode | TagNode | TextNode | XMLDeclarationNode;
243
360
  /**
244
361
  * any node
362
+ * @pg
245
363
  */
246
- type AnyNode = AttributeKeyNode | AttributeNode | AttributeValueNode | AttributeValueWrapperEndNode | AttributeValueWrapperStartNode | CloseTagNode | CommentCloseNode | CommentContentNode | CommentNode | CommentOpenNode | DoctypeAttributeNode | DoctypeAttributeValueNode | DoctypeAttributeWrapperEndNode | DoctypeAttributeWrapperStartNode | DoctypeCloseNode | DoctypeNode | DoctypeOpenNode | DocumentNode | OpenTagEndNode | OpenTagStartNode | Program | TagNode | TextNode | XMLDeclarationNode;
364
+ type AnyNode = AttributeKeyNode | AttributeNode | AttributeValueNode | AttributeValueWrapperEndNode | AttributeValueWrapperStartNode | CloseTagNode | CommentCloseNode | CommentContentNode | CommentNode | CommentOpenNode | DoctypeAttributeNode | DoctypeAttributeValueNode | DoctypeAttributeWrapperEndNode | DoctypeAttributeWrapperStartNode | DoctypeCloseNode | DoctypeNode | DoctypeOpenNode | DocumentNode | OpenTagEndNode | OpenTagStartNode | Program | TagNode | TextNode | XMLDeclarationAttributeKeyNode | XMLDeclarationAttributeNode | XMLDeclarationAttributeValueNode | XMLDeclarationAttributeValueWrapperEndNode | XMLDeclarationAttributeValueWrapperStartNode | XMLDeclarationCloseNode | XMLDeclarationNode | XMLDeclarationOpenNode;
247
365
 
248
366
  interface Options {
367
+ comment?: boolean;
368
+ /**
369
+ * eslint features
370
+ */
371
+ eslintScopeManager?: boolean;
372
+ eslintVisitorKeys?: boolean;
373
+ filePath?: string;
374
+ /**
375
+ * required for eslint parse
376
+ */
377
+ loc?: boolean;
378
+ range?: boolean;
379
+ tokens?: boolean;
249
380
  }
381
+ /**
382
+ * @see {@link https://eslint.org/docs/latest/extend/custom-parsers#parseforeslint-return-object}
383
+ */
250
384
  interface ParseForESLintResult {
251
385
  ast: Program;
386
+ scopeManager: any;
252
387
  services: {
253
388
  isSVG: boolean;
254
389
  };
@@ -259,7 +394,7 @@ interface ParseResult {
259
394
  tokens: AnyToken[];
260
395
  }
261
396
 
262
- type AnyContextualNode = ContextualAttributeNode | ContextualCommentNode | ContextualDoctypeAttributeNode | ContextualDoctypeNode | ContextualDocumentNode | ContextualTagNode;
397
+ type AnyContextualNode = ContextualAttributeNode | ContextualCommentNode | ContextualDoctypeAttributeNode | ContextualDoctypeNode | ContextualDocumentNode | ContextualTagNode | ContextualXMLDeclarationAttributeNode | ContextuaLXMLDeclarationNode;
263
398
  type ContextualAttributeNode = ContextualNode<AttributeNode, 'key' | 'value'>;
264
399
  type ContextualCommentNode = ContextualNode<CommentNode, 'close' | 'open' | 'value'>;
265
400
  type ContextualDoctypeAttributeNode = ContextualNode<DoctypeAttributeNode, 'value'>;
@@ -276,6 +411,10 @@ type ContextualTagNode = ContextualNode<TagNode, 'close' | 'name' | 'openEnd' |
276
411
  attributes: ContextualAttributeNode[];
277
412
  children: Array<ContextualCommentNode | ContextualDoctypeNode | ContextualTagNode | TagNode['children'][number]>;
278
413
  };
414
+ type ContextualXMLDeclarationAttributeNode = ContextualNode<XMLDeclarationAttributeNode, 'key' | 'value'>;
415
+ type ContextuaLXMLDeclarationNode = ContextualNode<XMLDeclarationNode, 'close' | 'open'> & {
416
+ attributes: ContextualXMLDeclarationAttributeNode[];
417
+ };
279
418
  type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
280
419
 
281
420
  declare class Chars {
@@ -338,6 +477,9 @@ type ContextParams = {
338
477
  [TokenizerContextTypes.OpenTagEnd]?: {
339
478
  tagName: string;
340
479
  };
480
+ [TokenizerContextTypes.XMLDeclarationAttributeValueWrapped]?: {
481
+ wrapper: string;
482
+ };
341
483
  };
342
484
 
343
485
  type ConstructTreeState<N extends AnyContextualNode> = {
@@ -376,6 +518,7 @@ type index_CommentNode = CommentNode;
376
518
  type index_CommentOpenNode = CommentOpenNode;
377
519
  type index_ConstructTreeHandler = ConstructTreeHandler;
378
520
  type index_ConstructTreeState<N extends AnyContextualNode> = ConstructTreeState<N>;
521
+ type index_ContextuaLXMLDeclarationNode = ContextuaLXMLDeclarationNode;
379
522
  type index_ContextualAttributeNode = ContextualAttributeNode;
380
523
  type index_ContextualCommentNode = ContextualCommentNode;
381
524
  type index_ContextualDoctypeAttributeNode = ContextualDoctypeAttributeNode;
@@ -383,6 +526,7 @@ type index_ContextualDoctypeNode = ContextualDoctypeNode;
383
526
  type index_ContextualDocumentNode = ContextualDocumentNode;
384
527
  type index_ContextualNode<T extends AnyNode, K extends keyof T> = ContextualNode<T, K>;
385
528
  type index_ContextualTagNode = ContextualTagNode;
529
+ type index_ContextualXMLDeclarationAttributeNode = ContextualXMLDeclarationAttributeNode;
386
530
  type index_DoctypeAttributeNode = DoctypeAttributeNode;
387
531
  type index_DoctypeAttributeValueNode = DoctypeAttributeValueNode;
388
532
  type index_DoctypeAttributeWrapperEndNode = DoctypeAttributeWrapperEndNode;
@@ -409,15 +553,23 @@ type index_TextNode = TextNode;
409
553
  type index_Token<T extends TokenTypes> = Token<T>;
410
554
  type index_TokenizeHandler = TokenizeHandler;
411
555
  type index_TokenizerState = TokenizerState;
556
+ type index_XMLDeclarationAttributeKeyNode = XMLDeclarationAttributeKeyNode;
557
+ type index_XMLDeclarationAttributeNode = XMLDeclarationAttributeNode;
558
+ type index_XMLDeclarationAttributeValueNode = XMLDeclarationAttributeValueNode;
559
+ type index_XMLDeclarationAttributeValueWrapperEndNode = XMLDeclarationAttributeValueWrapperEndNode;
560
+ type index_XMLDeclarationAttributeValueWrapperStartNode = XMLDeclarationAttributeValueWrapperStartNode;
561
+ type index_XMLDeclarationCloseNode = XMLDeclarationCloseNode;
412
562
  type index_XMLDeclarationNode = XMLDeclarationNode;
563
+ type index_XMLDeclarationOpenNode = XMLDeclarationOpenNode;
413
564
  declare namespace index {
414
- export type { index_AnyContextualNode as AnyContextualNode, index_AnyNode as AnyNode, index_AnyToken as AnyToken, index_AttributeKeyNode as AttributeKeyNode, index_AttributeNode as AttributeNode, index_AttributeValueNode as AttributeValueNode, index_AttributeValueWrapperEndNode as AttributeValueWrapperEndNode, index_AttributeValueWrapperStartNode as AttributeValueWrapperStartNode, index_BaseNode as BaseNode, index_CloseTagNode as CloseTagNode, index_CommentCloseNode as CommentCloseNode, index_CommentContentNode as CommentContentNode, index_CommentNode as CommentNode, index_CommentOpenNode as CommentOpenNode, index_ConstructTreeHandler as ConstructTreeHandler, index_ConstructTreeState as ConstructTreeState, index_ContextualAttributeNode as ContextualAttributeNode, index_ContextualCommentNode as ContextualCommentNode, index_ContextualDoctypeAttributeNode as ContextualDoctypeAttributeNode, index_ContextualDoctypeNode as ContextualDoctypeNode, index_ContextualDocumentNode as ContextualDocumentNode, index_ContextualNode as ContextualNode, index_ContextualTagNode as ContextualTagNode, index_DoctypeAttributeNode as DoctypeAttributeNode, index_DoctypeAttributeValueNode as DoctypeAttributeValueNode, index_DoctypeAttributeWrapperEndNode as DoctypeAttributeWrapperEndNode, index_DoctypeAttributeWrapperStartNode as DoctypeAttributeWrapperStartNode, index_DoctypeCloseNode as DoctypeCloseNode, index_DoctypeNode as DoctypeNode, index_DoctypeOpenNode as DoctypeOpenNode, index_DocumentNode as DocumentNode, index_Locations as Locations, index_NestableNode as NestableNode, index_OpenTagEndNode as OpenTagEndNode, index_OpenTagStartNode as OpenTagStartNode, index_Options as Options, index_ParseForESLintResult as ParseForESLintResult, index_ParseResult as ParseResult, index_PartialBy as PartialBy, index_Position as Position, index_Program as Program, index_Range as Range, index_SimpleNode as SimpleNode, index_SourceLocation as SourceLocation, index_TagNode as TagNode, index_TextNode as TextNode, index_Token as Token, index_TokenizeHandler as TokenizeHandler, index_TokenizerState as TokenizerState, index_XMLDeclarationNode as XMLDeclarationNode };
565
+ export type { index_AnyContextualNode as AnyContextualNode, index_AnyNode as AnyNode, index_AnyToken as AnyToken, index_AttributeKeyNode as AttributeKeyNode, index_AttributeNode as AttributeNode, index_AttributeValueNode as AttributeValueNode, index_AttributeValueWrapperEndNode as AttributeValueWrapperEndNode, index_AttributeValueWrapperStartNode as AttributeValueWrapperStartNode, index_BaseNode as BaseNode, index_CloseTagNode as CloseTagNode, index_CommentCloseNode as CommentCloseNode, index_CommentContentNode as CommentContentNode, index_CommentNode as CommentNode, index_CommentOpenNode as CommentOpenNode, index_ConstructTreeHandler as ConstructTreeHandler, index_ConstructTreeState as ConstructTreeState, index_ContextuaLXMLDeclarationNode as ContextuaLXMLDeclarationNode, index_ContextualAttributeNode as ContextualAttributeNode, index_ContextualCommentNode as ContextualCommentNode, index_ContextualDoctypeAttributeNode as ContextualDoctypeAttributeNode, index_ContextualDoctypeNode as ContextualDoctypeNode, index_ContextualDocumentNode as ContextualDocumentNode, index_ContextualNode as ContextualNode, index_ContextualTagNode as ContextualTagNode, index_ContextualXMLDeclarationAttributeNode as ContextualXMLDeclarationAttributeNode, index_DoctypeAttributeNode as DoctypeAttributeNode, index_DoctypeAttributeValueNode as DoctypeAttributeValueNode, index_DoctypeAttributeWrapperEndNode as DoctypeAttributeWrapperEndNode, index_DoctypeAttributeWrapperStartNode as DoctypeAttributeWrapperStartNode, index_DoctypeCloseNode as DoctypeCloseNode, index_DoctypeNode as DoctypeNode, index_DoctypeOpenNode as DoctypeOpenNode, index_DocumentNode as DocumentNode, index_Locations as Locations, index_NestableNode as NestableNode, index_OpenTagEndNode as OpenTagEndNode, index_OpenTagStartNode as OpenTagStartNode, index_Options as Options, index_ParseForESLintResult as ParseForESLintResult, index_ParseResult as ParseResult, index_PartialBy as PartialBy, index_Position as Position, index_Program as Program, index_Range as Range, index_SimpleNode as SimpleNode, index_SourceLocation as SourceLocation, index_TagNode as TagNode, index_TextNode as TextNode, index_Token as Token, index_TokenizeHandler as TokenizeHandler, index_TokenizerState as TokenizerState, index_XMLDeclarationAttributeKeyNode as XMLDeclarationAttributeKeyNode, index_XMLDeclarationAttributeNode as XMLDeclarationAttributeNode, index_XMLDeclarationAttributeValueNode as XMLDeclarationAttributeValueNode, index_XMLDeclarationAttributeValueWrapperEndNode as XMLDeclarationAttributeValueWrapperEndNode, index_XMLDeclarationAttributeValueWrapperStartNode as XMLDeclarationAttributeValueWrapperStartNode, index_XMLDeclarationCloseNode as XMLDeclarationCloseNode, index_XMLDeclarationNode as XMLDeclarationNode, index_XMLDeclarationOpenNode as XMLDeclarationOpenNode };
415
566
  }
416
567
 
417
568
  declare function parseForESLint(source: string, options?: Options): ParseForESLintResult;
418
569
 
419
- declare function parseSVG(code: string, options?: Options): Program;
420
570
  declare const name: string;
421
571
  declare const VisitorKeys: eslint.SourceCode.VisitorKeys;
572
+ declare function parse(code: string, options?: Options): Program;
422
573
 
423
- export { index as AST, ParseError, VisitorKeys, meta, name, parseForESLint, parseSVG };
574
+ export { index as AST, COMMENT_END, COMMENT_START, ConstructTreeContextTypes, DEPRECATED_SVG_ELEMENTS, NodeTypes, ParseError, RE_CLOSE_TAG_NAME, RE_INCOMPLETE_CLOSING_TAG, RE_OPEN_TAG_NAME, RE_OPEN_TAG_START, SELF_CLOSING_ELEMENTS, SPECIAL_CHAR, SVG_ELEMENTS, TokenTypes, TokenizerContextTypes, VisitorKeys, XML_DECLARATION_END, XML_DECLARATION_START, meta, name, parse, parseForESLint };
575
+ export type { AnyContextualNode, AnyNode, AnyToken, AttributeKeyNode, AttributeNode, AttributeValueNode, AttributeValueWrapperEndNode, AttributeValueWrapperStartNode, BaseNode, CloseTagNode, CommentCloseNode, CommentContentNode, CommentNode, CommentOpenNode, ConstructTreeHandler, ConstructTreeState, ContextuaLXMLDeclarationNode, ContextualAttributeNode, ContextualCommentNode, ContextualDoctypeAttributeNode, ContextualDoctypeNode, ContextualDocumentNode, ContextualNode, ContextualTagNode, ContextualXMLDeclarationAttributeNode, DoctypeAttributeNode, DoctypeAttributeValueNode, DoctypeAttributeWrapperEndNode, DoctypeAttributeWrapperStartNode, DoctypeCloseNode, DoctypeNode, DoctypeOpenNode, DocumentNode, Locations, NestableNode, OpenTagEndNode, OpenTagStartNode, Options, ParseForESLintResult, ParseResult, PartialBy, Position, Program, Range, SimpleNode, SourceLocation, TagNode, TextNode, Token, TokenizeHandler, TokenizerState, XMLDeclarationAttributeKeyNode, XMLDeclarationAttributeNode, XMLDeclarationAttributeValueNode, XMLDeclarationAttributeValueWrapperEndNode, XMLDeclarationAttributeValueWrapperStartNode, XMLDeclarationCloseNode, XMLDeclarationNode, XMLDeclarationOpenNode };