svg-eslint-parser 0.0.3 → 0.0.5
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 +3 -4
- package/dist/chunk-CzXV76rE.js +18 -0
- package/dist/index.d.ts +537 -0
- package/dist/index.js +1982 -0
- package/package.json +32 -40
- package/dist/index.d.mts +0 -575
- package/dist/index.mjs +0 -2183
package/package.json
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "svg-eslint-parser",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.0.
|
|
5
|
-
"packageManager": "pnpm@10.8.0",
|
|
4
|
+
"version": "0.0.5",
|
|
6
5
|
"description": "An SVG parser that produces output compatible with ESLint.",
|
|
7
6
|
"keywords": [
|
|
8
7
|
"eslint-parser",
|
|
@@ -22,56 +21,49 @@
|
|
|
22
21
|
"exports": {
|
|
23
22
|
"./package.json": "./package.json",
|
|
24
23
|
".": {
|
|
25
|
-
"types": "./dist/index.d.
|
|
26
|
-
"default": "./dist/index.
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"default": "./dist/index.js"
|
|
27
26
|
}
|
|
28
27
|
},
|
|
29
|
-
"main": "./dist/index.
|
|
30
|
-
"types": "./dist/index.d.
|
|
28
|
+
"main": "./dist/index.js",
|
|
29
|
+
"types": "./dist/index.d.ts",
|
|
31
30
|
"files": [
|
|
32
31
|
"dist"
|
|
33
32
|
],
|
|
34
33
|
"sideEffects": false,
|
|
34
|
+
"dependencies": {
|
|
35
|
+
"@ntnyq/utils": "^0.10.0",
|
|
36
|
+
"eslint-visitor-keys": "^5.0.0"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"@ntnyq/eslint-config": "^5.9.0",
|
|
40
|
+
"@ntnyq/prettier-config": "^3.0.1",
|
|
41
|
+
"@types/node": "^25.0.3",
|
|
42
|
+
"bumpp": "^10.3.2",
|
|
43
|
+
"eslint": "^9.39.2",
|
|
44
|
+
"husky": "^9.1.7",
|
|
45
|
+
"nano-staged": "^0.9.0",
|
|
46
|
+
"npm-run-all2": "^8.0.4",
|
|
47
|
+
"prettier": "^3.7.4",
|
|
48
|
+
"tsdown": "^0.19.0-beta.2",
|
|
49
|
+
"typescript": "^5.9.3",
|
|
50
|
+
"vitest": "^4.0.16"
|
|
51
|
+
},
|
|
52
|
+
"nano-staged": {
|
|
53
|
+
"*.{js,ts,mjs,cjs,vue,md,yml,yaml,json}": "eslint --fix",
|
|
54
|
+
"*.{css,scss,html}": "prettier -uw"
|
|
55
|
+
},
|
|
35
56
|
"scripts": {
|
|
36
|
-
"build": "
|
|
37
|
-
"coverage": "vitest --coverage",
|
|
57
|
+
"build": "tsdown",
|
|
38
58
|
"deploy": "run-s build docs:build",
|
|
39
|
-
"dev": "
|
|
59
|
+
"dev": "tsdown --watch",
|
|
40
60
|
"docs:build": "pnpm -C docs run build",
|
|
41
61
|
"docs:dev": "pnpm -C docs run dev",
|
|
42
62
|
"lint": "eslint",
|
|
43
|
-
"
|
|
44
|
-
"prepublishOnly": "pnpm run build",
|
|
45
|
-
"release": "run-s release:check release:publish",
|
|
63
|
+
"release": "run-s release:check release:version",
|
|
46
64
|
"release:check": "run-s lint typecheck test",
|
|
47
|
-
"release:
|
|
65
|
+
"release:version": "bumpp",
|
|
48
66
|
"test": "vitest",
|
|
49
67
|
"typecheck": "tsc --noEmit"
|
|
50
|
-
},
|
|
51
|
-
"dependencies": {
|
|
52
|
-
"@ntnyq/utils": "catalog:",
|
|
53
|
-
"eslint-visitor-keys": "catalog:"
|
|
54
|
-
},
|
|
55
|
-
"devDependencies": {
|
|
56
|
-
"@ntnyq/eslint-config": "catalog:",
|
|
57
|
-
"@ntnyq/prettier-config": "catalog:",
|
|
58
|
-
"@types/node": "catalog:",
|
|
59
|
-
"@vitest/coverage-v8": "catalog:",
|
|
60
|
-
"bumpp": "catalog:",
|
|
61
|
-
"eslint": "catalog:",
|
|
62
|
-
"husky": "catalog:",
|
|
63
|
-
"nano-staged": "catalog:",
|
|
64
|
-
"npm-run-all2": "catalog:",
|
|
65
|
-
"prettier": "catalog:",
|
|
66
|
-
"typescript": "catalog:",
|
|
67
|
-
"unbuild": "catalog:",
|
|
68
|
-
"vitest": "catalog:"
|
|
69
|
-
},
|
|
70
|
-
"engines": {
|
|
71
|
-
"node": ">=18.18.0"
|
|
72
|
-
},
|
|
73
|
-
"nano-staged": {
|
|
74
|
-
"*.{js,ts,mjs,cjs,vue,md,yml,yaml,json}": "eslint --fix",
|
|
75
|
-
"*.{css,scss,html}": "prettier -uw"
|
|
76
68
|
}
|
|
77
|
-
}
|
|
69
|
+
}
|
package/dist/index.d.mts
DELETED
|
@@ -1,575 +0,0 @@
|
|
|
1
|
-
import * as eslint from 'eslint';
|
|
2
|
-
import { SourceCode as SourceCode$1 } from 'eslint';
|
|
3
|
-
|
|
4
|
-
declare const meta: {
|
|
5
|
-
name: string;
|
|
6
|
-
version: string;
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
/**
|
|
10
|
-
* parse error
|
|
11
|
-
*/
|
|
12
|
-
declare class ParseError extends SyntaxError {
|
|
13
|
-
index: number;
|
|
14
|
-
lineNumber: number;
|
|
15
|
-
column: number;
|
|
16
|
-
constructor(message: string, offset: number, line: number, column: number);
|
|
17
|
-
}
|
|
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
|
-
|
|
56
|
-
declare enum NodeTypes {
|
|
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",
|
|
67
|
-
Doctype = "Doctype",
|
|
68
|
-
DoctypeAttribute = "DoctypeAttribute",
|
|
69
|
-
DoctypeAttributeValue = "DoctypeAttributeValue",
|
|
70
|
-
DoctypeAttributeWrapperEnd = "DoctypeAttributeWrapperEnd",
|
|
71
|
-
DoctypeAttributeWrapperStart = "DoctypeAttributeWrapperStart",
|
|
72
|
-
DoctypeClose = "DoctypeClose",
|
|
73
|
-
DoctypeOpen = "DoctypeOpen",
|
|
74
|
-
Document = "Document",
|
|
75
|
-
OpenTagEnd = "OpenTagEnd",
|
|
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 {
|
|
91
|
-
Attribute = "Attribute",
|
|
92
|
-
AttributeAssignment = "AttributeAssignment",
|
|
93
|
-
AttributeKey = "AttributeKey",
|
|
94
|
-
AttributeValue = "AttributeValue",
|
|
95
|
-
AttributeValueWrapperEnd = "AttributeValueWrapperEnd",
|
|
96
|
-
AttributeValueWrapperStart = "AttributeValueWrapperStart",
|
|
97
|
-
CloseTag = "CloseTag",
|
|
98
|
-
Comment = "Comment",
|
|
99
|
-
CommentClose = "CommentClose",
|
|
100
|
-
CommentContent = "CommentContent",
|
|
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"
|
|
122
|
-
}
|
|
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
|
-
|
|
158
|
-
declare enum TokenizerContextTypes {
|
|
159
|
-
AttributeKey = "AttributeKey",
|
|
160
|
-
Attributes = "Attributes",
|
|
161
|
-
AttributeValue = "AttributeValue",
|
|
162
|
-
AttributeValueBare = "AttributeValueBare",
|
|
163
|
-
AttributeValueWrapped = "AttributeValueWrapped",
|
|
164
|
-
CloseTag = "CloseTag",
|
|
165
|
-
CommentClose = "CommentClose",
|
|
166
|
-
CommentContent = "CommentContent",
|
|
167
|
-
CommentOpen = "CommentOpen",
|
|
168
|
-
Data = "Data",
|
|
169
|
-
DoctypeAttributeBare = "DoctypeAttributeBare",
|
|
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"
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
declare enum ConstructTreeContextTypes {
|
|
185
|
-
Attribute = "Attribute",
|
|
186
|
-
Attributes = "Attributes",
|
|
187
|
-
AttributeValue = "AttributeValue",
|
|
188
|
-
Comment = "Comment",
|
|
189
|
-
Doctype = "Doctype",
|
|
190
|
-
DoctypeAttribute = "DoctypeAttribute",
|
|
191
|
-
DoctypeAttributes = "DoctypeAttributes",
|
|
192
|
-
Tag = "Tag",
|
|
193
|
-
TagContent = "TagContent",
|
|
194
|
-
TagName = "TagName",
|
|
195
|
-
XMLDeclaration = "XMLDeclaration",
|
|
196
|
-
XMLDeclarationAttribute = "XMLDeclarationAttribute",
|
|
197
|
-
XMLDeclarationAttributes = "XMLDeclarationAttributes",
|
|
198
|
-
XMLDeclarationAttributeValue = "XMLDeclarationAttributeValue"
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
interface Locations {
|
|
202
|
-
loc: SourceLocation;
|
|
203
|
-
range: Range;
|
|
204
|
-
}
|
|
205
|
-
interface Position {
|
|
206
|
-
/**
|
|
207
|
-
* 0 based index (>= 0)
|
|
208
|
-
*/
|
|
209
|
-
column: number;
|
|
210
|
-
/**
|
|
211
|
-
* 1 based index (>= 1)
|
|
212
|
-
*/
|
|
213
|
-
line: number;
|
|
214
|
-
}
|
|
215
|
-
type Range = [number, number];
|
|
216
|
-
interface SourceLocation {
|
|
217
|
-
/**
|
|
218
|
-
* end position of source
|
|
219
|
-
*/
|
|
220
|
-
end: Position;
|
|
221
|
-
/**
|
|
222
|
-
* start position of source
|
|
223
|
-
*/
|
|
224
|
-
start: Position;
|
|
225
|
-
}
|
|
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>;
|
|
231
|
-
/**
|
|
232
|
-
* token
|
|
233
|
-
*/
|
|
234
|
-
interface Token<T extends TokenTypes> extends Locations {
|
|
235
|
-
/**
|
|
236
|
-
* node type
|
|
237
|
-
*/
|
|
238
|
-
type: T;
|
|
239
|
-
/**
|
|
240
|
-
* token value
|
|
241
|
-
*/
|
|
242
|
-
value: string;
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
interface BaseNode extends Locations {
|
|
246
|
-
type: NodeTypes;
|
|
247
|
-
}
|
|
248
|
-
interface SimpleNode<T extends NodeTypes> extends BaseNode {
|
|
249
|
-
type: T;
|
|
250
|
-
value: string;
|
|
251
|
-
}
|
|
252
|
-
type TextNode = SimpleNode<NodeTypes.Text>;
|
|
253
|
-
/**
|
|
254
|
-
* attribute
|
|
255
|
-
* @pg
|
|
256
|
-
*/
|
|
257
|
-
type AttributeKeyNode = SimpleNode<NodeTypes.AttributeKey>;
|
|
258
|
-
interface AttributeNode extends BaseNode {
|
|
259
|
-
key: AttributeKeyNode;
|
|
260
|
-
type: NodeTypes.Attribute;
|
|
261
|
-
value: AttributeValueNode;
|
|
262
|
-
endWrapper?: AttributeValueWrapperEndNode;
|
|
263
|
-
startWrapper?: AttributeValueWrapperStartNode;
|
|
264
|
-
}
|
|
265
|
-
type AttributeValueNode = SimpleNode<NodeTypes.AttributeValue>;
|
|
266
|
-
type AttributeValueWrapperEndNode = SimpleNode<NodeTypes.AttributeValueWrapperEnd>;
|
|
267
|
-
type AttributeValueWrapperStartNode = SimpleNode<NodeTypes.AttributeValueWrapperStart>;
|
|
268
|
-
/**
|
|
269
|
-
* comment
|
|
270
|
-
* @pg
|
|
271
|
-
*/
|
|
272
|
-
type CommentCloseNode = SimpleNode<NodeTypes.CommentClose>;
|
|
273
|
-
type CommentContentNode = SimpleNode<NodeTypes.CommentContent>;
|
|
274
|
-
interface CommentNode extends BaseNode {
|
|
275
|
-
close: CommentCloseNode;
|
|
276
|
-
open: CommentOpenNode;
|
|
277
|
-
type: NodeTypes.Comment;
|
|
278
|
-
value: CommentContentNode;
|
|
279
|
-
}
|
|
280
|
-
type CommentOpenNode = SimpleNode<NodeTypes.CommentOpen>;
|
|
281
|
-
/**
|
|
282
|
-
* doctype
|
|
283
|
-
* @pg
|
|
284
|
-
*/
|
|
285
|
-
interface DoctypeAttributeNode extends BaseNode {
|
|
286
|
-
type: NodeTypes.DoctypeAttribute;
|
|
287
|
-
endWrapper?: DoctypeAttributeWrapperEndNode;
|
|
288
|
-
startWrapper?: DoctypeAttributeWrapperStartNode;
|
|
289
|
-
value?: DoctypeAttributeValueNode;
|
|
290
|
-
}
|
|
291
|
-
type DoctypeAttributeValueNode = SimpleNode<NodeTypes.DoctypeAttributeValue>;
|
|
292
|
-
type DoctypeAttributeWrapperEndNode = SimpleNode<NodeTypes.DoctypeAttributeWrapperEnd>;
|
|
293
|
-
type DoctypeAttributeWrapperStartNode = SimpleNode<NodeTypes.DoctypeAttributeWrapperStart>;
|
|
294
|
-
type DoctypeCloseNode = SimpleNode<NodeTypes.DoctypeClose>;
|
|
295
|
-
interface DoctypeNode extends BaseNode {
|
|
296
|
-
attributes: DoctypeAttributeNode[];
|
|
297
|
-
close: DoctypeCloseNode;
|
|
298
|
-
open: DoctypeOpenNode;
|
|
299
|
-
type: NodeTypes.Doctype;
|
|
300
|
-
}
|
|
301
|
-
type DoctypeOpenNode = SimpleNode<NodeTypes.DoctypeOpen>;
|
|
302
|
-
/**
|
|
303
|
-
* tag
|
|
304
|
-
* @pg
|
|
305
|
-
*/
|
|
306
|
-
type CloseTagNode = SimpleNode<NodeTypes.CloseTag>;
|
|
307
|
-
type OpenTagEndNode = SimpleNode<NodeTypes.OpenTagEnd>;
|
|
308
|
-
type OpenTagStartNode = SimpleNode<NodeTypes.OpenTagStart>;
|
|
309
|
-
interface TagNode extends BaseNode {
|
|
310
|
-
attributes: AttributeNode[];
|
|
311
|
-
children: NestableNode[];
|
|
312
|
-
name: string;
|
|
313
|
-
openEnd: OpenTagEndNode;
|
|
314
|
-
openStart: OpenTagStartNode;
|
|
315
|
-
selfClosing: boolean;
|
|
316
|
-
type: NodeTypes.Tag;
|
|
317
|
-
close?: CloseTagNode;
|
|
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;
|
|
346
|
-
/**
|
|
347
|
-
* program
|
|
348
|
-
* @pg
|
|
349
|
-
*/
|
|
350
|
-
interface DocumentNode extends BaseNode {
|
|
351
|
-
children: NestableNode[];
|
|
352
|
-
type: NodeTypes.Document;
|
|
353
|
-
}
|
|
354
|
-
interface Program extends BaseNode {
|
|
355
|
-
body: DocumentNode[];
|
|
356
|
-
comments: CommentContentNode[];
|
|
357
|
-
tokens: AnyToken[];
|
|
358
|
-
type: NodeTypes.Program;
|
|
359
|
-
}
|
|
360
|
-
/**
|
|
361
|
-
* any node
|
|
362
|
-
* @pg
|
|
363
|
-
*/
|
|
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;
|
|
365
|
-
|
|
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;
|
|
380
|
-
}
|
|
381
|
-
/**
|
|
382
|
-
* @see {@link https://eslint.org/docs/latest/extend/custom-parsers#parseforeslint-return-object}
|
|
383
|
-
*/
|
|
384
|
-
interface ParseForESLintResult {
|
|
385
|
-
ast: Program;
|
|
386
|
-
scopeManager: any;
|
|
387
|
-
services: {
|
|
388
|
-
isSVG: boolean;
|
|
389
|
-
};
|
|
390
|
-
visitorKeys: SourceCode$1.VisitorKeys;
|
|
391
|
-
}
|
|
392
|
-
interface ParseResult {
|
|
393
|
-
ast: DocumentNode;
|
|
394
|
-
tokens: AnyToken[];
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
type AnyContextualNode = ContextualAttributeNode | ContextualCommentNode | ContextualDoctypeAttributeNode | ContextualDoctypeNode | ContextualDocumentNode | ContextualTagNode | ContextualXMLDeclarationAttributeNode | ContextuaLXMLDeclarationNode;
|
|
398
|
-
type ContextualAttributeNode = ContextualNode<AttributeNode, 'key' | 'value'>;
|
|
399
|
-
type ContextualCommentNode = ContextualNode<CommentNode, 'close' | 'open' | 'value'>;
|
|
400
|
-
type ContextualDoctypeAttributeNode = ContextualNode<DoctypeAttributeNode, 'value'>;
|
|
401
|
-
type ContextualDoctypeNode = ContextualNode<DoctypeNode, 'close' | 'open'> & {
|
|
402
|
-
attributes: ContextualDoctypeAttributeNode[];
|
|
403
|
-
};
|
|
404
|
-
type ContextualDocumentNode = Omit<ContextualNode<DocumentNode, never>, 'children'> & {
|
|
405
|
-
children: Array<DocumentNode['children'][number] | Exclude<AnyContextualNode, ContextualDoctypeNode>>;
|
|
406
|
-
};
|
|
407
|
-
type ContextualNode<T extends AnyNode, K extends keyof T> = PartialBy<T, K> & {
|
|
408
|
-
parentRef?: any;
|
|
409
|
-
};
|
|
410
|
-
type ContextualTagNode = ContextualNode<TagNode, 'close' | 'name' | 'openEnd' | 'openStart' | 'selfClosing'> & {
|
|
411
|
-
attributes: ContextualAttributeNode[];
|
|
412
|
-
children: Array<ContextualCommentNode | ContextualDoctypeNode | ContextualTagNode | TagNode['children'][number]>;
|
|
413
|
-
};
|
|
414
|
-
type ContextualXMLDeclarationAttributeNode = ContextualNode<XMLDeclarationAttributeNode, 'key' | 'value'>;
|
|
415
|
-
type ContextuaLXMLDeclarationNode = ContextualNode<XMLDeclarationNode, 'close' | 'open'> & {
|
|
416
|
-
attributes: ContextualXMLDeclarationAttributeNode[];
|
|
417
|
-
};
|
|
418
|
-
type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
|
|
419
|
-
|
|
420
|
-
declare class Chars {
|
|
421
|
-
value: string;
|
|
422
|
-
range: Range;
|
|
423
|
-
constructor(value: string, range: Range);
|
|
424
|
-
concat(chars: Chars): void;
|
|
425
|
-
equals(chars: string): boolean;
|
|
426
|
-
length(): number;
|
|
427
|
-
}
|
|
428
|
-
|
|
429
|
-
declare class CharsBuffer {
|
|
430
|
-
charsBuffer: Chars[];
|
|
431
|
-
concat(chars: Chars): void;
|
|
432
|
-
concatBuffer(buffer: CharsBuffer): void;
|
|
433
|
-
length(): number;
|
|
434
|
-
clear(): void;
|
|
435
|
-
value(): string;
|
|
436
|
-
last(): Chars;
|
|
437
|
-
first(): Chars;
|
|
438
|
-
removeLast(): void;
|
|
439
|
-
removeFirst(): void;
|
|
440
|
-
replace(other: CharsBuffer): void;
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
declare class SourceCode {
|
|
444
|
-
readonly source: string;
|
|
445
|
-
private charsList;
|
|
446
|
-
private charsIndex;
|
|
447
|
-
constructor(source: string);
|
|
448
|
-
getLocationOf(range: Range): SourceLocation;
|
|
449
|
-
current(): Chars;
|
|
450
|
-
next(): void;
|
|
451
|
-
prev(): void;
|
|
452
|
-
isEof(): boolean;
|
|
453
|
-
index(): number;
|
|
454
|
-
private createCharsList;
|
|
455
|
-
}
|
|
456
|
-
|
|
457
|
-
type TokenizerState = {
|
|
458
|
-
accumulatedContent: CharsBuffer;
|
|
459
|
-
contextParams: ContextParams;
|
|
460
|
-
currentContext: TokenizerContextTypes;
|
|
461
|
-
decisionBuffer: CharsBuffer;
|
|
462
|
-
sourceCode: SourceCode;
|
|
463
|
-
tokens: {
|
|
464
|
-
push(token: AnyToken): void;
|
|
465
|
-
};
|
|
466
|
-
};
|
|
467
|
-
type ContextParams = {
|
|
468
|
-
[TokenizerContextTypes.Attributes]?: {
|
|
469
|
-
tagName: string;
|
|
470
|
-
};
|
|
471
|
-
[TokenizerContextTypes.AttributeValueWrapped]?: {
|
|
472
|
-
wrapper: string;
|
|
473
|
-
};
|
|
474
|
-
[TokenizerContextTypes.DoctypeAttributeWrapped]?: {
|
|
475
|
-
wrapper: string;
|
|
476
|
-
};
|
|
477
|
-
[TokenizerContextTypes.OpenTagEnd]?: {
|
|
478
|
-
tagName: string;
|
|
479
|
-
};
|
|
480
|
-
[TokenizerContextTypes.XMLDeclarationAttributeValueWrapped]?: {
|
|
481
|
-
wrapper: string;
|
|
482
|
-
};
|
|
483
|
-
};
|
|
484
|
-
|
|
485
|
-
type ConstructTreeState<N extends AnyContextualNode> = {
|
|
486
|
-
caretPosition: number;
|
|
487
|
-
currentNode: N;
|
|
488
|
-
rootNode: DocumentNode;
|
|
489
|
-
currentContext: {
|
|
490
|
-
type: ConstructTreeContextTypes;
|
|
491
|
-
content?: any[];
|
|
492
|
-
parentRef?: any;
|
|
493
|
-
};
|
|
494
|
-
};
|
|
495
|
-
|
|
496
|
-
interface ConstructTreeHandler {
|
|
497
|
-
construct: (token: AnyToken, state: ConstructTreeState<any>) => ConstructTreeState<any>;
|
|
498
|
-
}
|
|
499
|
-
|
|
500
|
-
interface TokenizeHandler {
|
|
501
|
-
parse: (chars: CharsBuffer, state: TokenizerState) => void;
|
|
502
|
-
handleContentEnd?: (state: TokenizerState) => void;
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
type index_AnyContextualNode = AnyContextualNode;
|
|
506
|
-
type index_AnyNode = AnyNode;
|
|
507
|
-
type index_AnyToken = AnyToken;
|
|
508
|
-
type index_AttributeKeyNode = AttributeKeyNode;
|
|
509
|
-
type index_AttributeNode = AttributeNode;
|
|
510
|
-
type index_AttributeValueNode = AttributeValueNode;
|
|
511
|
-
type index_AttributeValueWrapperEndNode = AttributeValueWrapperEndNode;
|
|
512
|
-
type index_AttributeValueWrapperStartNode = AttributeValueWrapperStartNode;
|
|
513
|
-
type index_BaseNode = BaseNode;
|
|
514
|
-
type index_CloseTagNode = CloseTagNode;
|
|
515
|
-
type index_CommentCloseNode = CommentCloseNode;
|
|
516
|
-
type index_CommentContentNode = CommentContentNode;
|
|
517
|
-
type index_CommentNode = CommentNode;
|
|
518
|
-
type index_CommentOpenNode = CommentOpenNode;
|
|
519
|
-
type index_ConstructTreeHandler = ConstructTreeHandler;
|
|
520
|
-
type index_ConstructTreeState<N extends AnyContextualNode> = ConstructTreeState<N>;
|
|
521
|
-
type index_ContextuaLXMLDeclarationNode = ContextuaLXMLDeclarationNode;
|
|
522
|
-
type index_ContextualAttributeNode = ContextualAttributeNode;
|
|
523
|
-
type index_ContextualCommentNode = ContextualCommentNode;
|
|
524
|
-
type index_ContextualDoctypeAttributeNode = ContextualDoctypeAttributeNode;
|
|
525
|
-
type index_ContextualDoctypeNode = ContextualDoctypeNode;
|
|
526
|
-
type index_ContextualDocumentNode = ContextualDocumentNode;
|
|
527
|
-
type index_ContextualNode<T extends AnyNode, K extends keyof T> = ContextualNode<T, K>;
|
|
528
|
-
type index_ContextualTagNode = ContextualTagNode;
|
|
529
|
-
type index_ContextualXMLDeclarationAttributeNode = ContextualXMLDeclarationAttributeNode;
|
|
530
|
-
type index_DoctypeAttributeNode = DoctypeAttributeNode;
|
|
531
|
-
type index_DoctypeAttributeValueNode = DoctypeAttributeValueNode;
|
|
532
|
-
type index_DoctypeAttributeWrapperEndNode = DoctypeAttributeWrapperEndNode;
|
|
533
|
-
type index_DoctypeAttributeWrapperStartNode = DoctypeAttributeWrapperStartNode;
|
|
534
|
-
type index_DoctypeCloseNode = DoctypeCloseNode;
|
|
535
|
-
type index_DoctypeNode = DoctypeNode;
|
|
536
|
-
type index_DoctypeOpenNode = DoctypeOpenNode;
|
|
537
|
-
type index_DocumentNode = DocumentNode;
|
|
538
|
-
type index_Locations = Locations;
|
|
539
|
-
type index_NestableNode = NestableNode;
|
|
540
|
-
type index_OpenTagEndNode = OpenTagEndNode;
|
|
541
|
-
type index_OpenTagStartNode = OpenTagStartNode;
|
|
542
|
-
type index_Options = Options;
|
|
543
|
-
type index_ParseForESLintResult = ParseForESLintResult;
|
|
544
|
-
type index_ParseResult = ParseResult;
|
|
545
|
-
type index_PartialBy<T, K extends keyof T> = PartialBy<T, K>;
|
|
546
|
-
type index_Position = Position;
|
|
547
|
-
type index_Program = Program;
|
|
548
|
-
type index_Range = Range;
|
|
549
|
-
type index_SimpleNode<T extends NodeTypes> = SimpleNode<T>;
|
|
550
|
-
type index_SourceLocation = SourceLocation;
|
|
551
|
-
type index_TagNode = TagNode;
|
|
552
|
-
type index_TextNode = TextNode;
|
|
553
|
-
type index_Token<T extends TokenTypes> = Token<T>;
|
|
554
|
-
type index_TokenizeHandler = TokenizeHandler;
|
|
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;
|
|
562
|
-
type index_XMLDeclarationNode = XMLDeclarationNode;
|
|
563
|
-
type index_XMLDeclarationOpenNode = XMLDeclarationOpenNode;
|
|
564
|
-
declare namespace index {
|
|
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 };
|
|
566
|
-
}
|
|
567
|
-
|
|
568
|
-
declare function parseForESLint(source: string, options?: Options): ParseForESLintResult;
|
|
569
|
-
|
|
570
|
-
declare const name: string;
|
|
571
|
-
declare const VisitorKeys: eslint.SourceCode.VisitorKeys;
|
|
572
|
-
declare function parse(code: string, options?: Options): Program;
|
|
573
|
-
|
|
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 };
|