svg-eslint-parser 0.0.0 → 0.0.2
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 +7 -1
- package/dist/index.cjs +265 -46
- package/dist/index.d.cts +78 -9
- package/dist/index.d.ts +78 -9
- package/dist/index.js +250 -46
- package/package.json +5 -2
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
> [!IMPORTANT]
|
|
12
12
|
> Status: Work In Progress, not ready for production.
|
|
13
13
|
>
|
|
14
|
-
>
|
|
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/)
|
package/dist/index.cjs
CHANGED
|
@@ -20,10 +20,25 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/index.ts
|
|
21
21
|
var index_exports = {};
|
|
22
22
|
__export(index_exports, {
|
|
23
|
+
COMMENT_END: () => COMMENT_END,
|
|
24
|
+
COMMENT_START: () => COMMENT_START,
|
|
25
|
+
ConstructTreeContextTypes: () => ConstructTreeContextTypes,
|
|
26
|
+
DEPRECATED_SVG_ELEMENTS: () => DEPRECATED_SVG_ELEMENTS,
|
|
27
|
+
NodeTypes: () => NodeTypes,
|
|
23
28
|
ParseError: () => ParseError,
|
|
29
|
+
RE_CLOSE_TAG_NAME: () => RE_CLOSE_TAG_NAME,
|
|
30
|
+
RE_INCOMPLETE_CLOSING_TAG: () => RE_INCOMPLETE_CLOSING_TAG,
|
|
31
|
+
RE_OPEN_TAG_NAME: () => RE_OPEN_TAG_NAME,
|
|
32
|
+
RE_OPEN_TAG_START: () => RE_OPEN_TAG_START,
|
|
33
|
+
SELF_CLOSING_ELEMENTS: () => SELF_CLOSING_ELEMENTS,
|
|
34
|
+
SPECIAL_CHAR: () => SPECIAL_CHAR,
|
|
35
|
+
SVG_ELEMENTS: () => SVG_ELEMENTS,
|
|
36
|
+
TokenTypes: () => TokenTypes,
|
|
37
|
+
TokenizerContextTypes: () => TokenizerContextTypes,
|
|
24
38
|
VisitorKeys: () => VisitorKeys,
|
|
25
39
|
meta: () => meta,
|
|
26
40
|
name: () => name2,
|
|
41
|
+
parse: () => parse17,
|
|
27
42
|
parseForESLint: () => parseForESLint,
|
|
28
43
|
parseSVG: () => parseSVG
|
|
29
44
|
});
|
|
@@ -31,7 +46,7 @@ module.exports = __toCommonJS(index_exports);
|
|
|
31
46
|
|
|
32
47
|
// package.json
|
|
33
48
|
var name = "svg-eslint-parser";
|
|
34
|
-
var version = "0.0.
|
|
49
|
+
var version = "0.0.2";
|
|
35
50
|
|
|
36
51
|
// src/meta.ts
|
|
37
52
|
var meta = {
|
|
@@ -53,22 +68,178 @@ var ParseError = class extends SyntaxError {
|
|
|
53
68
|
}
|
|
54
69
|
};
|
|
55
70
|
|
|
56
|
-
// src/constants/char.ts
|
|
57
|
-
var SPECIAL_CHAR = {
|
|
58
|
-
newline: "\n",
|
|
59
|
-
return: "\r",
|
|
60
|
-
space: " ",
|
|
61
|
-
tab: " "
|
|
62
|
-
};
|
|
63
|
-
|
|
64
71
|
// src/constants/parse.ts
|
|
65
72
|
var COMMENT_START = "<!--";
|
|
66
73
|
var COMMENT_END = "-->";
|
|
67
74
|
var RE_OPEN_TAG_START = /^<\w/;
|
|
68
75
|
var RE_OPEN_TAG_NAME = /^<(\S+)/;
|
|
69
76
|
var RE_CLOSE_TAG_NAME = /^<\/((?:.|\n)*)>$/;
|
|
77
|
+
var RE_INCOMPLETE_CLOSING_TAG = /<\/[^>]+$/;
|
|
78
|
+
|
|
79
|
+
// src/constants/nodeTypes.ts
|
|
80
|
+
var NodeTypes = /* @__PURE__ */ ((NodeTypes2) => {
|
|
81
|
+
NodeTypes2["Program"] = "Program";
|
|
82
|
+
NodeTypes2["Document"] = "Document";
|
|
83
|
+
NodeTypes2["Text"] = "Text";
|
|
84
|
+
NodeTypes2["XMLDeclaration"] = "XMLDeclaration";
|
|
85
|
+
NodeTypes2["Doctype"] = "Doctype";
|
|
86
|
+
NodeTypes2["DoctypeOpen"] = "DoctypeOpen";
|
|
87
|
+
NodeTypes2["DoctypeClose"] = "DoctypeClose";
|
|
88
|
+
NodeTypes2["DoctypeAttribute"] = "DoctypeAttribute";
|
|
89
|
+
NodeTypes2["DoctypeAttributeValue"] = "DoctypeAttributeValue";
|
|
90
|
+
NodeTypes2["DoctypeAttributeWrapperEnd"] = "DoctypeAttributeWrapperEnd";
|
|
91
|
+
NodeTypes2["DoctypeAttributeWrapperStart"] = "DoctypeAttributeWrapperStart";
|
|
92
|
+
NodeTypes2["Tag"] = "Tag";
|
|
93
|
+
NodeTypes2["OpenTagStart"] = "OpenTagStart";
|
|
94
|
+
NodeTypes2["OpenTagEnd"] = "OpenTagEnd";
|
|
95
|
+
NodeTypes2["CloseTag"] = "CloseTag";
|
|
96
|
+
NodeTypes2["Comment"] = "Comment";
|
|
97
|
+
NodeTypes2["CommentOpen"] = "CommentOpen";
|
|
98
|
+
NodeTypes2["CommentClose"] = "CommentClose";
|
|
99
|
+
NodeTypes2["CommentContent"] = "CommentContent";
|
|
100
|
+
NodeTypes2["Attribute"] = "Attribute";
|
|
101
|
+
NodeTypes2["AttributeKey"] = "AttributeKey";
|
|
102
|
+
NodeTypes2["AttributeValue"] = "AttributeValue";
|
|
103
|
+
NodeTypes2["AttributeValueWrapperStart"] = "AttributeValueWrapperStart";
|
|
104
|
+
NodeTypes2["AttributeValueWrapperEnd"] = "AttributeValueWrapperEnd";
|
|
105
|
+
return NodeTypes2;
|
|
106
|
+
})(NodeTypes || {});
|
|
107
|
+
|
|
108
|
+
// src/constants/tokenTypes.ts
|
|
109
|
+
var TokenTypes = /* @__PURE__ */ ((TokenTypes2) => {
|
|
110
|
+
TokenTypes2["Program"] = "Program";
|
|
111
|
+
TokenTypes2["Document"] = "Document";
|
|
112
|
+
TokenTypes2["Text"] = "Text";
|
|
113
|
+
TokenTypes2["Doctype"] = "Doctype";
|
|
114
|
+
TokenTypes2["DoctypeOpen"] = "DoctypeOpen";
|
|
115
|
+
TokenTypes2["DoctypeClose"] = "DoctypeClose";
|
|
116
|
+
TokenTypes2["DoctypeAttributeValue"] = "DoctypeAttributeValue";
|
|
117
|
+
TokenTypes2["DoctypeAttributeWrapperStart"] = "DoctypeAttributeWrapperStart";
|
|
118
|
+
TokenTypes2["DoctypeAttributeWrapperEnd"] = "DoctypeAttributeWrapperEnd";
|
|
119
|
+
TokenTypes2["Tag"] = "Tag";
|
|
120
|
+
TokenTypes2["OpenTagStart"] = "OpenTagStart";
|
|
121
|
+
TokenTypes2["OpenTagEnd"] = "OpenTagEnd";
|
|
122
|
+
TokenTypes2["CloseTag"] = "CloseTag";
|
|
123
|
+
TokenTypes2["Comment"] = "Comment";
|
|
124
|
+
TokenTypes2["CommentOpen"] = "CommentOpen";
|
|
125
|
+
TokenTypes2["CommentClose"] = "CommentClose";
|
|
126
|
+
TokenTypes2["CommentContent"] = "CommentContent";
|
|
127
|
+
TokenTypes2["Attribute"] = "Attribute";
|
|
128
|
+
TokenTypes2["AttributeKey"] = "AttributeKey";
|
|
129
|
+
TokenTypes2["AttributeValue"] = "AttributeValue";
|
|
130
|
+
TokenTypes2["AttributeAssignment"] = "AttributeAssignment";
|
|
131
|
+
TokenTypes2["AttributeValueWrapperStart"] = "AttributeValueWrapperStart";
|
|
132
|
+
TokenTypes2["AttributeValueWrapperEnd"] = "AttributeValueWrapperEnd";
|
|
133
|
+
return TokenTypes2;
|
|
134
|
+
})(TokenTypes || {});
|
|
135
|
+
|
|
136
|
+
// src/constants/specialChar.ts
|
|
137
|
+
var SPECIAL_CHAR = {
|
|
138
|
+
closingCorner: `>`,
|
|
139
|
+
colon: `:`,
|
|
140
|
+
comma: `,`,
|
|
141
|
+
doubleQuote: `"`,
|
|
142
|
+
equal: `=`,
|
|
143
|
+
exclamation: `!`,
|
|
144
|
+
hyphen: `-`,
|
|
145
|
+
newline: `
|
|
146
|
+
`,
|
|
147
|
+
openingCorner: `<`,
|
|
148
|
+
question: `?`,
|
|
149
|
+
return: `\r`,
|
|
150
|
+
singleQuote: `'`,
|
|
151
|
+
slash: `/`,
|
|
152
|
+
space: ` `,
|
|
153
|
+
tab: ` `
|
|
154
|
+
};
|
|
70
155
|
|
|
71
156
|
// src/constants/svgElements.ts
|
|
157
|
+
var SVG_ELEMENTS = /* @__PURE__ */ new Set([
|
|
158
|
+
"a",
|
|
159
|
+
"animate",
|
|
160
|
+
"animateMotion",
|
|
161
|
+
"animateTransform",
|
|
162
|
+
"circle",
|
|
163
|
+
"clipPath",
|
|
164
|
+
// not listed in mdn docs
|
|
165
|
+
"color-profile",
|
|
166
|
+
"defs",
|
|
167
|
+
"desc",
|
|
168
|
+
"ellipse",
|
|
169
|
+
"feBlend",
|
|
170
|
+
"feColorMatrix",
|
|
171
|
+
"feComponentTransfer",
|
|
172
|
+
"feComposite",
|
|
173
|
+
"feConvolveMatrix",
|
|
174
|
+
"feDiffuseLighting",
|
|
175
|
+
"feDisplacementMap",
|
|
176
|
+
"feDistantLight",
|
|
177
|
+
"feDropShadow",
|
|
178
|
+
"feFlood",
|
|
179
|
+
"feFuncA",
|
|
180
|
+
"feFuncB",
|
|
181
|
+
"feFuncG",
|
|
182
|
+
"feFuncR",
|
|
183
|
+
"feGaussianBlur",
|
|
184
|
+
"feImage",
|
|
185
|
+
"feMerge",
|
|
186
|
+
"feMergeNode",
|
|
187
|
+
"feMorphology",
|
|
188
|
+
"feOffset",
|
|
189
|
+
"fePointLight",
|
|
190
|
+
"feSpecularLighting",
|
|
191
|
+
"feSpotLight",
|
|
192
|
+
"feTile",
|
|
193
|
+
"feTurbulence",
|
|
194
|
+
"filter",
|
|
195
|
+
"foreignObject",
|
|
196
|
+
"g",
|
|
197
|
+
"image",
|
|
198
|
+
"line",
|
|
199
|
+
"linearGradient",
|
|
200
|
+
"marker",
|
|
201
|
+
"mask",
|
|
202
|
+
"metadata",
|
|
203
|
+
"mpath",
|
|
204
|
+
"path",
|
|
205
|
+
"pattern",
|
|
206
|
+
"polygon",
|
|
207
|
+
"polyline",
|
|
208
|
+
"radialGradient",
|
|
209
|
+
"rect",
|
|
210
|
+
"script",
|
|
211
|
+
"set",
|
|
212
|
+
"stop",
|
|
213
|
+
"style",
|
|
214
|
+
"svg",
|
|
215
|
+
"switch",
|
|
216
|
+
"symbol",
|
|
217
|
+
"text",
|
|
218
|
+
"textPath",
|
|
219
|
+
"title",
|
|
220
|
+
"tspan",
|
|
221
|
+
"use",
|
|
222
|
+
"view"
|
|
223
|
+
]);
|
|
224
|
+
var DEPRECATED_SVG_ELEMENTS = /* @__PURE__ */ new Set([
|
|
225
|
+
"altGlyph",
|
|
226
|
+
"altGlyphDef",
|
|
227
|
+
"altGlyphItem",
|
|
228
|
+
"animateColor",
|
|
229
|
+
"cursor",
|
|
230
|
+
"font",
|
|
231
|
+
"font-face",
|
|
232
|
+
"font-face-format",
|
|
233
|
+
"font-face-name",
|
|
234
|
+
"font-face-src",
|
|
235
|
+
"font-face-uri",
|
|
236
|
+
"glyph",
|
|
237
|
+
"glyphRef",
|
|
238
|
+
"hkern",
|
|
239
|
+
"missing-glyph",
|
|
240
|
+
"tref",
|
|
241
|
+
"vkern"
|
|
242
|
+
]);
|
|
72
243
|
var SELF_CLOSING_ELEMENTS = /* @__PURE__ */ new Set([
|
|
73
244
|
"animate",
|
|
74
245
|
"animateMotion",
|
|
@@ -104,6 +275,43 @@ var SELF_CLOSING_ELEMENTS = /* @__PURE__ */ new Set([
|
|
|
104
275
|
"view"
|
|
105
276
|
]);
|
|
106
277
|
|
|
278
|
+
// src/constants/tokenizerContextTypes.ts
|
|
279
|
+
var TokenizerContextTypes = /* @__PURE__ */ ((TokenizerContextTypes2) => {
|
|
280
|
+
TokenizerContextTypes2["Data"] = "Data";
|
|
281
|
+
TokenizerContextTypes2["OpenTagStart"] = "OpenTagStart";
|
|
282
|
+
TokenizerContextTypes2["OpenTagEnd"] = "OpenTagEnd";
|
|
283
|
+
TokenizerContextTypes2["CloseTag"] = "CloseTag";
|
|
284
|
+
TokenizerContextTypes2["Attributes"] = "Attributes";
|
|
285
|
+
TokenizerContextTypes2["AttributeKey"] = "AttributeKey";
|
|
286
|
+
TokenizerContextTypes2["AttributeValue"] = "AttributeValue";
|
|
287
|
+
TokenizerContextTypes2["AttributeValueBare"] = "AttributeValueBare";
|
|
288
|
+
TokenizerContextTypes2["AttributeValueWrapped"] = "AttributeValueWrapped";
|
|
289
|
+
TokenizerContextTypes2["CommentContent"] = "CommentContent";
|
|
290
|
+
TokenizerContextTypes2["CommentOpen"] = "CommentOpen";
|
|
291
|
+
TokenizerContextTypes2["CommentClose"] = "CommentClose";
|
|
292
|
+
TokenizerContextTypes2["DoctypeOpen"] = "DoctypeOpen";
|
|
293
|
+
TokenizerContextTypes2["DoctypeClose"] = "DoctypeClose";
|
|
294
|
+
TokenizerContextTypes2["DoctypeAttributes"] = "DoctypeAttributes";
|
|
295
|
+
TokenizerContextTypes2["DoctypeAttributeBare"] = "DoctypeAttributeBare";
|
|
296
|
+
TokenizerContextTypes2["DoctypeAttributeWrapped"] = "DoctypeAttributeWrapped";
|
|
297
|
+
return TokenizerContextTypes2;
|
|
298
|
+
})(TokenizerContextTypes || {});
|
|
299
|
+
|
|
300
|
+
// src/constants/constructTreeContextTypes.ts
|
|
301
|
+
var ConstructTreeContextTypes = /* @__PURE__ */ ((ConstructTreeContextTypes2) => {
|
|
302
|
+
ConstructTreeContextTypes2["Tag"] = "Tag";
|
|
303
|
+
ConstructTreeContextTypes2["TagName"] = "TagName";
|
|
304
|
+
ConstructTreeContextTypes2["TagContent"] = "TagContent";
|
|
305
|
+
ConstructTreeContextTypes2["Attribute"] = "Attribute";
|
|
306
|
+
ConstructTreeContextTypes2["Attributes"] = "Attributes";
|
|
307
|
+
ConstructTreeContextTypes2["AttributeValue"] = "AttributeValue";
|
|
308
|
+
ConstructTreeContextTypes2["Doctype"] = "Doctype";
|
|
309
|
+
ConstructTreeContextTypes2["DoctypeAttribute"] = "DoctypeAttribute";
|
|
310
|
+
ConstructTreeContextTypes2["DoctypeAttributes"] = "DoctypeAttributes";
|
|
311
|
+
ConstructTreeContextTypes2["Comment"] = "Comment";
|
|
312
|
+
return ConstructTreeContextTypes2;
|
|
313
|
+
})(ConstructTreeContextTypes || {});
|
|
314
|
+
|
|
107
315
|
// src/utils/firstLast.ts
|
|
108
316
|
function first(items) {
|
|
109
317
|
return items[0];
|
|
@@ -206,6 +414,12 @@ function createNodeFrom(token) {
|
|
|
206
414
|
return result;
|
|
207
415
|
}
|
|
208
416
|
|
|
417
|
+
// src/utils/getLastAttribute.ts
|
|
418
|
+
function getLastAttribute(state) {
|
|
419
|
+
const attributes = state.currentNode.attributes;
|
|
420
|
+
return last(attributes);
|
|
421
|
+
}
|
|
422
|
+
|
|
209
423
|
// src/utils/parseOpenTagName.ts
|
|
210
424
|
function parseOpenTagName(openTagStartTokenContent) {
|
|
211
425
|
const match = openTagStartTokenContent.match(RE_OPEN_TAG_NAME);
|
|
@@ -242,12 +456,12 @@ function calculateTokenLocation(source, range) {
|
|
|
242
456
|
function calculateTokenCharactersRange(state, options) {
|
|
243
457
|
const startPosition = state.sourceCode.index() - (state.accumulatedContent.length() - 1) - state.decisionBuffer.length();
|
|
244
458
|
let endPosition;
|
|
245
|
-
if (options.keepBuffer) {
|
|
459
|
+
if (!options.keepBuffer) {
|
|
246
460
|
endPosition = state.sourceCode.index() - state.decisionBuffer.length();
|
|
247
461
|
} else {
|
|
248
462
|
endPosition = state.sourceCode.index();
|
|
249
463
|
}
|
|
250
|
-
return [startPosition, endPosition];
|
|
464
|
+
return [startPosition, endPosition + 1];
|
|
251
465
|
}
|
|
252
466
|
|
|
253
467
|
// src/utils/calculateTokenPosition.ts
|
|
@@ -441,10 +655,6 @@ function construct5(token, state) {
|
|
|
441
655
|
state.caretPosition++;
|
|
442
656
|
return state;
|
|
443
657
|
}
|
|
444
|
-
function getLastAttribute(state) {
|
|
445
|
-
const attributes = state.currentNode.attributes;
|
|
446
|
-
return last(attributes);
|
|
447
|
-
}
|
|
448
658
|
function handleOpenTagEnd2(state) {
|
|
449
659
|
state.currentContext = state.currentContext.parentRef;
|
|
450
660
|
return state;
|
|
@@ -626,23 +836,19 @@ function construct8(token, state) {
|
|
|
626
836
|
state.caretPosition++;
|
|
627
837
|
return state;
|
|
628
838
|
}
|
|
629
|
-
function getLastAttribute2(state) {
|
|
630
|
-
const attributes = state.currentNode.attributes;
|
|
631
|
-
return last(attributes);
|
|
632
|
-
}
|
|
633
839
|
function handleValueEnd(state) {
|
|
634
840
|
state.currentContext = state.currentContext.parentRef;
|
|
635
841
|
return state;
|
|
636
842
|
}
|
|
637
843
|
function handleAttributeValue(state, token) {
|
|
638
|
-
const attribute =
|
|
844
|
+
const attribute = getLastAttribute(state);
|
|
639
845
|
attribute.value = createNodeFrom(token);
|
|
640
846
|
updateNodeEnd(attribute, token);
|
|
641
847
|
state.caretPosition++;
|
|
642
848
|
return state;
|
|
643
849
|
}
|
|
644
850
|
function handleAttributeValueWrapperStart(state, token) {
|
|
645
|
-
const attribute =
|
|
851
|
+
const attribute = getLastAttribute(state);
|
|
646
852
|
attribute.startWrapper = createNodeFrom(token);
|
|
647
853
|
if (!attribute.key) {
|
|
648
854
|
attribute.range = cloneRange(token.range);
|
|
@@ -652,7 +858,7 @@ function handleAttributeValueWrapperStart(state, token) {
|
|
|
652
858
|
return state;
|
|
653
859
|
}
|
|
654
860
|
function handleAttributeValueWrapperEnd(state, token) {
|
|
655
|
-
const attribute =
|
|
861
|
+
const attribute = getLastAttribute(state);
|
|
656
862
|
attribute.endWrapper = createNodeFrom(token);
|
|
657
863
|
updateNodeEnd(attribute, token);
|
|
658
864
|
state.caretPosition++;
|
|
@@ -680,16 +886,12 @@ function construct9(token, state) {
|
|
|
680
886
|
state.caretPosition++;
|
|
681
887
|
return state;
|
|
682
888
|
}
|
|
683
|
-
function getLastAttribute3(state) {
|
|
684
|
-
const attributes = state.currentNode.attributes;
|
|
685
|
-
return last(attributes);
|
|
686
|
-
}
|
|
687
889
|
function handleDoctypeClose2(state) {
|
|
688
890
|
state.currentContext = state.currentContext.parentRef;
|
|
689
891
|
return state;
|
|
690
892
|
}
|
|
691
893
|
function handleDoctypeAttributeWrapperStart(state, token) {
|
|
692
|
-
const attribute =
|
|
894
|
+
const attribute = getLastAttribute(state);
|
|
693
895
|
if (attribute.value !== void 0) {
|
|
694
896
|
state.currentContext = state.currentContext.parentRef;
|
|
695
897
|
return state;
|
|
@@ -700,7 +902,7 @@ function handleDoctypeAttributeWrapperStart(state, token) {
|
|
|
700
902
|
return state;
|
|
701
903
|
}
|
|
702
904
|
function handleDoctypeAttributeWrapperEnd(state, token) {
|
|
703
|
-
const attribute =
|
|
905
|
+
const attribute = getLastAttribute(state);
|
|
704
906
|
attribute.endWrapper = createNodeFrom(token);
|
|
705
907
|
updateNodeEnd(attribute, token);
|
|
706
908
|
state.currentContext = state.currentContext.parentRef;
|
|
@@ -708,7 +910,7 @@ function handleDoctypeAttributeWrapperEnd(state, token) {
|
|
|
708
910
|
return state;
|
|
709
911
|
}
|
|
710
912
|
function handleDoctypeAttributeValue(state, token) {
|
|
711
|
-
const attribute =
|
|
913
|
+
const attribute = getLastAttribute(state);
|
|
712
914
|
if (attribute.value !== void 0) {
|
|
713
915
|
state.currentContext = state.currentContext.parentRef;
|
|
714
916
|
return state;
|
|
@@ -880,7 +1082,7 @@ function parse(chars, state) {
|
|
|
880
1082
|
if (value === "</") {
|
|
881
1083
|
return parseOpeningCornerBraceWithSlash(state);
|
|
882
1084
|
}
|
|
883
|
-
if (value ===
|
|
1085
|
+
if (value === SPECIAL_CHAR.openingCorner || value === "<!" || value === "<!-") {
|
|
884
1086
|
return state.sourceCode.next();
|
|
885
1087
|
}
|
|
886
1088
|
if (value === COMMENT_START) {
|
|
@@ -977,7 +1179,7 @@ __export(closeTag_exports, {
|
|
|
977
1179
|
});
|
|
978
1180
|
function parse2(chars, state) {
|
|
979
1181
|
const value = chars.value();
|
|
980
|
-
if (value ===
|
|
1182
|
+
if (value === SPECIAL_CHAR.closingCorner) {
|
|
981
1183
|
return parseClosingCornerBrace(state);
|
|
982
1184
|
}
|
|
983
1185
|
state.accumulatedContent.concatBuffer(state.decisionBuffer);
|
|
@@ -1005,10 +1207,10 @@ __export(attributes_exports2, {
|
|
|
1005
1207
|
});
|
|
1006
1208
|
function parse3(chars, state) {
|
|
1007
1209
|
const value = chars.value();
|
|
1008
|
-
if (value ===
|
|
1210
|
+
if (value === SPECIAL_CHAR.closingCorner || value === SPECIAL_CHAR.slash) {
|
|
1009
1211
|
return parseTagEnd(state);
|
|
1010
1212
|
}
|
|
1011
|
-
if (value ===
|
|
1213
|
+
if (value === SPECIAL_CHAR.equal) {
|
|
1012
1214
|
return parseEqual(state);
|
|
1013
1215
|
}
|
|
1014
1216
|
if (!isWhitespace(value)) {
|
|
@@ -1051,7 +1253,7 @@ __export(openTagEnd_exports, {
|
|
|
1051
1253
|
parse: () => parse4
|
|
1052
1254
|
});
|
|
1053
1255
|
function parse4(chars, state) {
|
|
1054
|
-
if (chars.value() ===
|
|
1256
|
+
if (chars.value() === SPECIAL_CHAR.closingCorner) {
|
|
1055
1257
|
return parseClosingCornerBrace2(state);
|
|
1056
1258
|
}
|
|
1057
1259
|
state.accumulatedContent.concatBuffer(state.decisionBuffer);
|
|
@@ -1083,7 +1285,7 @@ function parse5(chars, state) {
|
|
|
1083
1285
|
if (isWhitespace(value)) {
|
|
1084
1286
|
return parseWhitespace(state);
|
|
1085
1287
|
}
|
|
1086
|
-
if (value ===
|
|
1288
|
+
if (value === SPECIAL_CHAR.closingCorner) {
|
|
1087
1289
|
return parseClosingCornerBrace3(state);
|
|
1088
1290
|
}
|
|
1089
1291
|
state.decisionBuffer.clear();
|
|
@@ -1146,7 +1348,7 @@ function parse7(chars, state) {
|
|
|
1146
1348
|
}
|
|
1147
1349
|
function isKeyBreak(chars) {
|
|
1148
1350
|
const value = chars.value();
|
|
1149
|
-
return value ===
|
|
1351
|
+
return value === SPECIAL_CHAR.equal || value === SPECIAL_CHAR.slash || value === SPECIAL_CHAR.closingCorner || isWhitespace(value);
|
|
1150
1352
|
}
|
|
1151
1353
|
function parseKeyEnd(state) {
|
|
1152
1354
|
const position = calculateTokenPosition(state, { keepBuffer: false });
|
|
@@ -1167,10 +1369,11 @@ __export(openTagStart_exports, {
|
|
|
1167
1369
|
parse: () => parse8
|
|
1168
1370
|
});
|
|
1169
1371
|
function parse8(chars, state) {
|
|
1170
|
-
|
|
1372
|
+
const value = chars.value();
|
|
1373
|
+
if (value === SPECIAL_CHAR.closingCorner || value === SPECIAL_CHAR.slash) {
|
|
1171
1374
|
return parseTagEnd2(state);
|
|
1172
1375
|
}
|
|
1173
|
-
if (isWhitespace(
|
|
1376
|
+
if (isWhitespace(value)) {
|
|
1174
1377
|
return parseWhitespace2(state);
|
|
1175
1378
|
}
|
|
1176
1379
|
state.accumulatedContent.concatBuffer(state.decisionBuffer);
|
|
@@ -1214,10 +1417,10 @@ __export(attributeValue_exports2, {
|
|
|
1214
1417
|
});
|
|
1215
1418
|
function parse9(chars, state) {
|
|
1216
1419
|
const value = chars.value();
|
|
1217
|
-
if (value ===
|
|
1420
|
+
if (value === SPECIAL_CHAR.doubleQuote || value === SPECIAL_CHAR.singleQuote) {
|
|
1218
1421
|
return parseWrapper(state);
|
|
1219
1422
|
}
|
|
1220
|
-
if (value ===
|
|
1423
|
+
if (value === SPECIAL_CHAR.closingCorner || value === SPECIAL_CHAR.slash) {
|
|
1221
1424
|
return parseTagEnd3(state);
|
|
1222
1425
|
}
|
|
1223
1426
|
if (!isWhitespace(value)) {
|
|
@@ -1262,7 +1465,7 @@ __export(commentContent_exports, {
|
|
|
1262
1465
|
});
|
|
1263
1466
|
function parse10(chars, state) {
|
|
1264
1467
|
const value = chars.value();
|
|
1265
|
-
if (value ===
|
|
1468
|
+
if (value === SPECIAL_CHAR.hyphen || value === "--") {
|
|
1266
1469
|
return state.sourceCode.next();
|
|
1267
1470
|
}
|
|
1268
1471
|
if (value === COMMENT_END) {
|
|
@@ -1300,10 +1503,10 @@ __export(doctypeAttributes_exports2, {
|
|
|
1300
1503
|
});
|
|
1301
1504
|
function parse11(chars, state) {
|
|
1302
1505
|
const value = chars.value();
|
|
1303
|
-
if (value ===
|
|
1506
|
+
if (value === SPECIAL_CHAR.doubleQuote || value === SPECIAL_CHAR.singleQuote) {
|
|
1304
1507
|
return parseWrapper2(state);
|
|
1305
1508
|
}
|
|
1306
|
-
if (value ===
|
|
1509
|
+
if (value === SPECIAL_CHAR.closingCorner) {
|
|
1307
1510
|
return parseClosingCornerBrace4(state);
|
|
1308
1511
|
}
|
|
1309
1512
|
if (!isWhitespace(value)) {
|
|
@@ -1348,7 +1551,7 @@ __export(attributeValueBare_exports, {
|
|
|
1348
1551
|
});
|
|
1349
1552
|
function parse12(chars, state) {
|
|
1350
1553
|
const value = chars.value();
|
|
1351
|
-
if (isWhitespace(value) || value ===
|
|
1554
|
+
if (isWhitespace(value) || value === SPECIAL_CHAR.closingCorner || value === SPECIAL_CHAR.slash) {
|
|
1352
1555
|
return parseValueEnd(state);
|
|
1353
1556
|
}
|
|
1354
1557
|
state.accumulatedContent.concatBuffer(state.decisionBuffer);
|
|
@@ -1375,7 +1578,7 @@ __export(doctypeAttributeBare_exports, {
|
|
|
1375
1578
|
});
|
|
1376
1579
|
function parse13(chars, state) {
|
|
1377
1580
|
const value = chars.value();
|
|
1378
|
-
if (isWhitespace(value) || value ===
|
|
1581
|
+
if (isWhitespace(value) || value === SPECIAL_CHAR.closingCorner) {
|
|
1379
1582
|
return parseAttributeEnd(state);
|
|
1380
1583
|
}
|
|
1381
1584
|
state.accumulatedContent.concatBuffer(state.decisionBuffer);
|
|
@@ -1603,11 +1806,11 @@ var import_eslint_visitor_keys = require("eslint-visitor-keys");
|
|
|
1603
1806
|
var keys = {
|
|
1604
1807
|
Program: ["body"],
|
|
1605
1808
|
Document: ["children"],
|
|
1809
|
+
XMLDeclaration: [],
|
|
1606
1810
|
Doctype: ["open", "close", "attributes"],
|
|
1607
1811
|
DoctypeOpen: [],
|
|
1608
1812
|
DoctypeClose: [],
|
|
1609
1813
|
DoctypeAttribute: ["key"],
|
|
1610
|
-
DoctypeAttributeKey: [],
|
|
1611
1814
|
DoctypeAttributeValue: [],
|
|
1612
1815
|
DoctypeAttributeWrapperEnd: [],
|
|
1613
1816
|
DoctypeAttributeWrapperStart: [],
|
|
@@ -1696,12 +1899,28 @@ function parseSVG(code, options = {}) {
|
|
|
1696
1899
|
}
|
|
1697
1900
|
var name2 = meta.name;
|
|
1698
1901
|
var VisitorKeys = visitorKeys;
|
|
1902
|
+
var parse17 = parseSVG;
|
|
1699
1903
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1700
1904
|
0 && (module.exports = {
|
|
1905
|
+
COMMENT_END,
|
|
1906
|
+
COMMENT_START,
|
|
1907
|
+
ConstructTreeContextTypes,
|
|
1908
|
+
DEPRECATED_SVG_ELEMENTS,
|
|
1909
|
+
NodeTypes,
|
|
1701
1910
|
ParseError,
|
|
1911
|
+
RE_CLOSE_TAG_NAME,
|
|
1912
|
+
RE_INCOMPLETE_CLOSING_TAG,
|
|
1913
|
+
RE_OPEN_TAG_NAME,
|
|
1914
|
+
RE_OPEN_TAG_START,
|
|
1915
|
+
SELF_CLOSING_ELEMENTS,
|
|
1916
|
+
SPECIAL_CHAR,
|
|
1917
|
+
SVG_ELEMENTS,
|
|
1918
|
+
TokenTypes,
|
|
1919
|
+
TokenizerContextTypes,
|
|
1702
1920
|
VisitorKeys,
|
|
1703
1921
|
meta,
|
|
1704
1922
|
name,
|
|
1923
|
+
parse,
|
|
1705
1924
|
parseForESLint,
|
|
1706
1925
|
parseSVG
|
|
1707
1926
|
});
|