@salesforce-ux/eslint-plugin-slds 0.0.2 → 0.0.4

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/build/index.js CHANGED
@@ -1,18 +1,18 @@
1
1
  'use strict';
2
2
 
3
- var require$$0 = require('fs');
3
+ var require$$0$1 = require('fs');
4
4
  var require$$1 = require('path');
5
5
 
6
6
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
7
7
 
8
- var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0);
8
+ var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0$1);
9
9
  var require$$1__default = /*#__PURE__*/_interopDefaultLegacy(require$$1);
10
10
 
11
11
  function getDefaultExportFromCjs (x) {
12
12
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
13
13
  }
14
14
 
15
- var dist$1 = {};
15
+ var lib = {exports: {}};
16
16
 
17
17
  var parser$1 = {};
18
18
 
@@ -35,19 +35,18 @@ var hasRequiredAstTypes;
35
35
  function requireAstTypes () {
36
36
  if (hasRequiredAstTypes) return astTypes;
37
37
  hasRequiredAstTypes = 1;
38
- (function (exports) {
39
- Object.defineProperty(exports, "__esModule", { value: true });
40
- exports.AstTypes = void 0;
41
- (function (AstTypes) {
42
- AstTypes["Document"] = "Document";
43
- AstTypes["Tag"] = "Tag";
44
- AstTypes["Text"] = "Text";
45
- AstTypes["Doctype"] = "Doctype";
46
- AstTypes["Comment"] = "Comment";
47
- AstTypes["Script"] = "Script";
48
- AstTypes["Style"] = "Style";
49
- })(exports.AstTypes || (exports.AstTypes = {}));
50
- } (astTypes));
38
+ Object.defineProperty(astTypes, "__esModule", { value: true });
39
+ astTypes.AstTypes = void 0;
40
+ var AstTypes;
41
+ (function (AstTypes) {
42
+ AstTypes["Document"] = "Document";
43
+ AstTypes["Tag"] = "Tag";
44
+ AstTypes["Text"] = "Text";
45
+ AstTypes["Doctype"] = "Doctype";
46
+ AstTypes["Comment"] = "Comment";
47
+ AstTypes["Script"] = "Script";
48
+ AstTypes["Style"] = "Style";
49
+ })(AstTypes || (astTypes.AstTypes = AstTypes = {}));
51
50
  return astTypes;
52
51
  }
53
52
 
@@ -58,31 +57,30 @@ var hasRequiredTokenizerContextTypes;
58
57
  function requireTokenizerContextTypes () {
59
58
  if (hasRequiredTokenizerContextTypes) return tokenizerContextTypes;
60
59
  hasRequiredTokenizerContextTypes = 1;
61
- (function (exports) {
62
- Object.defineProperty(exports, "__esModule", { value: true });
63
- exports.TokenizerContextTypes = void 0;
64
- (function (TokenizerContextTypes) {
65
- TokenizerContextTypes["Data"] = "Data";
66
- TokenizerContextTypes["OpenTagStart"] = "OpenTagStart";
67
- TokenizerContextTypes["CloseTag"] = "CloseTag";
68
- TokenizerContextTypes["Attributes"] = "Attributes";
69
- TokenizerContextTypes["OpenTagEnd"] = "OpenTagEnd";
70
- TokenizerContextTypes["AttributeKey"] = "AttributeKey";
71
- TokenizerContextTypes["AttributeValue"] = "AttributeValue";
72
- TokenizerContextTypes["AttributeValueBare"] = "AttributeValueBare";
73
- TokenizerContextTypes["AttributeValueWrapped"] = "AttributeValueWrapped";
74
- TokenizerContextTypes["ScriptContent"] = "ScriptContent";
75
- TokenizerContextTypes["StyleContent"] = "StyleContent";
76
- TokenizerContextTypes["DoctypeOpen"] = "DoctypeOpen";
77
- TokenizerContextTypes["DoctypeClose"] = "DoctypeClose";
78
- TokenizerContextTypes["DoctypeAttributes"] = "DoctypeAttributes";
79
- TokenizerContextTypes["DoctypeAttributeWrapped"] = "DoctypeAttributeWrapped";
80
- TokenizerContextTypes["DoctypeAttributeBare"] = "DoctypeAttributeBare";
81
- TokenizerContextTypes["CommentOpen"] = "CommentOpen";
82
- TokenizerContextTypes["CommentContent"] = "CommentContent";
83
- TokenizerContextTypes["CommentClose"] = "CommentClose";
84
- })(exports.TokenizerContextTypes || (exports.TokenizerContextTypes = {}));
85
- } (tokenizerContextTypes));
60
+ Object.defineProperty(tokenizerContextTypes, "__esModule", { value: true });
61
+ tokenizerContextTypes.TokenizerContextTypes = void 0;
62
+ var TokenizerContextTypes;
63
+ (function (TokenizerContextTypes) {
64
+ TokenizerContextTypes["Data"] = "Data";
65
+ TokenizerContextTypes["OpenTagStart"] = "OpenTagStart";
66
+ TokenizerContextTypes["CloseTag"] = "CloseTag";
67
+ TokenizerContextTypes["Attributes"] = "Attributes";
68
+ TokenizerContextTypes["OpenTagEnd"] = "OpenTagEnd";
69
+ TokenizerContextTypes["AttributeKey"] = "AttributeKey";
70
+ TokenizerContextTypes["AttributeValue"] = "AttributeValue";
71
+ TokenizerContextTypes["AttributeValueBare"] = "AttributeValueBare";
72
+ TokenizerContextTypes["AttributeValueWrapped"] = "AttributeValueWrapped";
73
+ TokenizerContextTypes["ScriptContent"] = "ScriptContent";
74
+ TokenizerContextTypes["StyleContent"] = "StyleContent";
75
+ TokenizerContextTypes["DoctypeOpen"] = "DoctypeOpen";
76
+ TokenizerContextTypes["DoctypeClose"] = "DoctypeClose";
77
+ TokenizerContextTypes["DoctypeAttributes"] = "DoctypeAttributes";
78
+ TokenizerContextTypes["DoctypeAttributeWrapped"] = "DoctypeAttributeWrapped";
79
+ TokenizerContextTypes["DoctypeAttributeBare"] = "DoctypeAttributeBare";
80
+ TokenizerContextTypes["CommentOpen"] = "CommentOpen";
81
+ TokenizerContextTypes["CommentContent"] = "CommentContent";
82
+ TokenizerContextTypes["CommentClose"] = "CommentClose";
83
+ })(TokenizerContextTypes || (tokenizerContextTypes.TokenizerContextTypes = TokenizerContextTypes = {}));
86
84
  return tokenizerContextTypes;
87
85
  }
88
86
 
@@ -110,86 +108,84 @@ var hasRequiredTokenTypes;
110
108
  function requireTokenTypes () {
111
109
  if (hasRequiredTokenTypes) return tokenTypes;
112
110
  hasRequiredTokenTypes = 1;
113
- (function (exports) {
114
- Object.defineProperty(exports, "__esModule", { value: true });
115
- exports.TokenTypes = void 0;
116
- (function (TokenTypes) {
117
- TokenTypes["Text"] = "Text";
118
- TokenTypes["OpenTagStart"] = "OpenTagStart";
119
- TokenTypes["OpenTagEnd"] = "OpenTagEnd";
120
- TokenTypes["CloseTag"] = "CloseTag";
121
- TokenTypes["AttributeKey"] = "AttributeKey";
122
- TokenTypes["AttributeAssignment"] = "AttributeAssignment";
123
- TokenTypes["AttributeValueWrapperStart"] = "AttributeValueWrapperStart";
124
- TokenTypes["AttributeValue"] = "AttributeValue";
125
- TokenTypes["AttributeValueWrapperEnd"] = "AttributeValueWrapperEnd";
126
- TokenTypes["DoctypeOpen"] = "DoctypeOpen";
127
- TokenTypes["DoctypeAttributeValue"] = "DoctypeAttributeValue";
128
- TokenTypes["DoctypeAttributeWrapperStart"] = "DoctypeAttributeWrapperStart";
129
- TokenTypes["DoctypeAttributeWrapperEnd"] = "DoctypeAttributeWrapperEnd";
130
- TokenTypes["DoctypeClose"] = "DoctypeClose";
131
- TokenTypes["CommentOpen"] = "CommentOpen";
132
- TokenTypes["CommentContent"] = "CommentContent";
133
- TokenTypes["CommentClose"] = "CommentClose";
134
- TokenTypes["OpenScriptTagStart"] = "OpenScriptTagStart";
135
- TokenTypes["OpenScriptTagEnd"] = "OpenScriptTagEnd";
136
- TokenTypes["ScriptTagContent"] = "ScriptTagContent";
137
- TokenTypes["CloseScriptTag"] = "CloseScriptTag";
138
- TokenTypes["OpenStyleTagStart"] = "OpenStyleTagStart";
139
- TokenTypes["OpenStyleTagEnd"] = "OpenStyleTagEnd";
140
- TokenTypes["StyleTagContent"] = "StyleTagContent";
141
- TokenTypes["CloseStyleTag"] = "CloseStyleTag";
142
- })(exports.TokenTypes || (exports.TokenTypes = {}));
143
- } (tokenTypes));
111
+ Object.defineProperty(tokenTypes, "__esModule", { value: true });
112
+ tokenTypes.TokenTypes = void 0;
113
+ var TokenTypes;
114
+ (function (TokenTypes) {
115
+ TokenTypes["Text"] = "Text";
116
+ TokenTypes["OpenTagStart"] = "OpenTagStart";
117
+ TokenTypes["OpenTagEnd"] = "OpenTagEnd";
118
+ TokenTypes["CloseTag"] = "CloseTag";
119
+ TokenTypes["AttributeKey"] = "AttributeKey";
120
+ TokenTypes["AttributeAssignment"] = "AttributeAssignment";
121
+ TokenTypes["AttributeValueWrapperStart"] = "AttributeValueWrapperStart";
122
+ TokenTypes["AttributeValue"] = "AttributeValue";
123
+ TokenTypes["AttributeValueWrapperEnd"] = "AttributeValueWrapperEnd";
124
+ TokenTypes["DoctypeOpen"] = "DoctypeOpen";
125
+ TokenTypes["DoctypeAttributeValue"] = "DoctypeAttributeValue";
126
+ TokenTypes["DoctypeAttributeWrapperStart"] = "DoctypeAttributeWrapperStart";
127
+ TokenTypes["DoctypeAttributeWrapperEnd"] = "DoctypeAttributeWrapperEnd";
128
+ TokenTypes["DoctypeClose"] = "DoctypeClose";
129
+ TokenTypes["CommentOpen"] = "CommentOpen";
130
+ TokenTypes["CommentContent"] = "CommentContent";
131
+ TokenTypes["CommentClose"] = "CommentClose";
132
+ TokenTypes["OpenScriptTagStart"] = "OpenScriptTagStart";
133
+ TokenTypes["OpenScriptTagEnd"] = "OpenScriptTagEnd";
134
+ TokenTypes["ScriptTagContent"] = "ScriptTagContent";
135
+ TokenTypes["CloseScriptTag"] = "CloseScriptTag";
136
+ TokenTypes["OpenStyleTagStart"] = "OpenStyleTagStart";
137
+ TokenTypes["OpenStyleTagEnd"] = "OpenStyleTagEnd";
138
+ TokenTypes["StyleTagContent"] = "StyleTagContent";
139
+ TokenTypes["CloseStyleTag"] = "CloseStyleTag";
140
+ })(TokenTypes || (tokenTypes.TokenTypes = TokenTypes = {}));
144
141
  return tokenTypes;
145
142
  }
146
143
 
147
- var nodeTypes = {};
148
-
149
- var hasRequiredNodeTypes;
150
-
151
- function requireNodeTypes () {
152
- if (hasRequiredNodeTypes) return nodeTypes;
153
- hasRequiredNodeTypes = 1;
154
- (function (exports) {
155
- Object.defineProperty(exports, "__esModule", { value: true });
156
- exports.NodeTypes = void 0;
157
- (function (NodeTypes) {
158
- NodeTypes["Document"] = "Document";
159
- NodeTypes["Tag"] = "Tag";
160
- NodeTypes["Text"] = "Text";
161
- NodeTypes["Doctype"] = "Doctype";
162
- NodeTypes["Comment"] = "Comment";
163
- NodeTypes["CommentOpen"] = "CommentOpen";
164
- NodeTypes["CommentClose"] = "CommentClose";
165
- NodeTypes["CommentContent"] = "CommentContent";
166
- NodeTypes["Attribute"] = "Attribute";
167
- NodeTypes["AttributeKey"] = "AttributeKey";
168
- NodeTypes["AttributeValue"] = "AttributeValue";
169
- NodeTypes["AttributeValueWrapperStart"] = "AttributeValueWrapperStart";
170
- NodeTypes["AttributeValueWrapperEnd"] = "AttributeValueWrapperEnd";
171
- NodeTypes["CloseTag"] = "CloseTag";
172
- NodeTypes["OpenTagEnd"] = "OpenTagEnd";
173
- NodeTypes["OpenTagStart"] = "OpenTagStart";
174
- NodeTypes["DoctypeOpen"] = "DoctypeOpen";
175
- NodeTypes["DoctypeAttribute"] = "DoctypeAttribute";
176
- NodeTypes["DoctypeClose"] = "DoctypeClose";
177
- NodeTypes["ScriptTag"] = "ScriptTag";
178
- NodeTypes["OpenScriptTagStart"] = "OpenScriptTagStart";
179
- NodeTypes["OpenScriptTagEnd"] = "OpenScriptTagEnd";
180
- NodeTypes["ScriptTagContent"] = "ScriptTagContent";
181
- NodeTypes["StyleTag"] = "StyleTag";
182
- NodeTypes["OpenStyleTagStart"] = "OpenStyleTagStart";
183
- NodeTypes["OpenStyleTagEnd"] = "OpenStyleTagEnd";
184
- NodeTypes["StyleTagContent"] = "StyleTagContent";
185
- NodeTypes["CloseStyleTag"] = "CloseStyleTag";
186
- NodeTypes["CloseScriptTag"] = "CloseScriptTag";
187
- NodeTypes["DoctypeAttributeValue"] = "DoctypeAttributeValue";
188
- NodeTypes["DoctypeAttributeWrapperStart"] = "DoctypeAttributeWrapperStart";
189
- NodeTypes["DoctypeAttributeWrapperEnd"] = "DoctypeAttributeWrapperEnd";
190
- })(exports.NodeTypes || (exports.NodeTypes = {}));
191
- } (nodeTypes));
192
- return nodeTypes;
144
+ var nodeTypes$1 = {};
145
+
146
+ var hasRequiredNodeTypes$1;
147
+
148
+ function requireNodeTypes$1 () {
149
+ if (hasRequiredNodeTypes$1) return nodeTypes$1;
150
+ hasRequiredNodeTypes$1 = 1;
151
+ Object.defineProperty(nodeTypes$1, "__esModule", { value: true });
152
+ nodeTypes$1.NodeTypes = void 0;
153
+ var NodeTypes;
154
+ (function (NodeTypes) {
155
+ NodeTypes["Document"] = "Document";
156
+ NodeTypes["Tag"] = "Tag";
157
+ NodeTypes["Text"] = "Text";
158
+ NodeTypes["Doctype"] = "Doctype";
159
+ NodeTypes["Comment"] = "Comment";
160
+ NodeTypes["CommentOpen"] = "CommentOpen";
161
+ NodeTypes["CommentClose"] = "CommentClose";
162
+ NodeTypes["CommentContent"] = "CommentContent";
163
+ NodeTypes["Attribute"] = "Attribute";
164
+ NodeTypes["AttributeKey"] = "AttributeKey";
165
+ NodeTypes["AttributeValue"] = "AttributeValue";
166
+ NodeTypes["AttributeValueWrapperStart"] = "AttributeValueWrapperStart";
167
+ NodeTypes["AttributeValueWrapperEnd"] = "AttributeValueWrapperEnd";
168
+ NodeTypes["CloseTag"] = "CloseTag";
169
+ NodeTypes["OpenTagEnd"] = "OpenTagEnd";
170
+ NodeTypes["OpenTagStart"] = "OpenTagStart";
171
+ NodeTypes["DoctypeOpen"] = "DoctypeOpen";
172
+ NodeTypes["DoctypeAttribute"] = "DoctypeAttribute";
173
+ NodeTypes["DoctypeClose"] = "DoctypeClose";
174
+ NodeTypes["ScriptTag"] = "ScriptTag";
175
+ NodeTypes["OpenScriptTagStart"] = "OpenScriptTagStart";
176
+ NodeTypes["OpenScriptTagEnd"] = "OpenScriptTagEnd";
177
+ NodeTypes["ScriptTagContent"] = "ScriptTagContent";
178
+ NodeTypes["StyleTag"] = "StyleTag";
179
+ NodeTypes["OpenStyleTagStart"] = "OpenStyleTagStart";
180
+ NodeTypes["OpenStyleTagEnd"] = "OpenStyleTagEnd";
181
+ NodeTypes["StyleTagContent"] = "StyleTagContent";
182
+ NodeTypes["CloseStyleTag"] = "CloseStyleTag";
183
+ NodeTypes["CloseScriptTag"] = "CloseScriptTag";
184
+ NodeTypes["DoctypeAttributeValue"] = "DoctypeAttributeValue";
185
+ NodeTypes["DoctypeAttributeWrapperStart"] = "DoctypeAttributeWrapperStart";
186
+ NodeTypes["DoctypeAttributeWrapperEnd"] = "DoctypeAttributeWrapperEnd";
187
+ })(NodeTypes || (nodeTypes$1.NodeTypes = NodeTypes = {}));
188
+ return nodeTypes$1;
193
189
  }
194
190
 
195
191
  var constructTreeContextTypes = {};
@@ -199,24 +195,23 @@ var hasRequiredConstructTreeContextTypes;
199
195
  function requireConstructTreeContextTypes () {
200
196
  if (hasRequiredConstructTreeContextTypes) return constructTreeContextTypes;
201
197
  hasRequiredConstructTreeContextTypes = 1;
202
- (function (exports) {
203
- Object.defineProperty(exports, "__esModule", { value: true });
204
- exports.ConstructTreeContextTypes = void 0;
205
- (function (ConstructTreeContextTypes) {
206
- ConstructTreeContextTypes["TagContent"] = "TagContent";
207
- ConstructTreeContextTypes["Tag"] = "Tag";
208
- ConstructTreeContextTypes["TagName"] = "TagName";
209
- ConstructTreeContextTypes["Attributes"] = "Attributes";
210
- ConstructTreeContextTypes["Attribute"] = "Attribute";
211
- ConstructTreeContextTypes["AttributeValue"] = "AttributeValue";
212
- ConstructTreeContextTypes["Comment"] = "Comment";
213
- ConstructTreeContextTypes["Doctype"] = "Doctype";
214
- ConstructTreeContextTypes["DoctypeAttributes"] = "DoctypeAttributes";
215
- ConstructTreeContextTypes["DoctypeAttribute"] = "DoctypeAttribute";
216
- ConstructTreeContextTypes["ScriptTag"] = "ScriptTag";
217
- ConstructTreeContextTypes["StyleTag"] = "StyleTag";
218
- })(exports.ConstructTreeContextTypes || (exports.ConstructTreeContextTypes = {}));
219
- } (constructTreeContextTypes));
198
+ Object.defineProperty(constructTreeContextTypes, "__esModule", { value: true });
199
+ constructTreeContextTypes.ConstructTreeContextTypes = void 0;
200
+ var ConstructTreeContextTypes;
201
+ (function (ConstructTreeContextTypes) {
202
+ ConstructTreeContextTypes["TagContent"] = "TagContent";
203
+ ConstructTreeContextTypes["Tag"] = "Tag";
204
+ ConstructTreeContextTypes["TagName"] = "TagName";
205
+ ConstructTreeContextTypes["Attributes"] = "Attributes";
206
+ ConstructTreeContextTypes["Attribute"] = "Attribute";
207
+ ConstructTreeContextTypes["AttributeValue"] = "AttributeValue";
208
+ ConstructTreeContextTypes["Comment"] = "Comment";
209
+ ConstructTreeContextTypes["Doctype"] = "Doctype";
210
+ ConstructTreeContextTypes["DoctypeAttributes"] = "DoctypeAttributes";
211
+ ConstructTreeContextTypes["DoctypeAttribute"] = "DoctypeAttribute";
212
+ ConstructTreeContextTypes["ScriptTag"] = "ScriptTag";
213
+ ConstructTreeContextTypes["StyleTag"] = "StyleTag";
214
+ })(ConstructTreeContextTypes || (constructTreeContextTypes.ConstructTreeContextTypes = ConstructTreeContextTypes = {}));
220
215
  return constructTreeContextTypes;
221
216
  }
222
217
 
@@ -245,7 +240,7 @@ function requireConstants () {
245
240
  __exportStar(requireTokenizerContextTypes(), exports);
246
241
  __exportStar(requireRegex(), exports);
247
242
  __exportStar(requireTokenTypes(), exports);
248
- __exportStar(requireNodeTypes(), exports);
243
+ __exportStar(requireNodeTypes$1(), exports);
249
244
  __exportStar(requireConstructTreeContextTypes(), exports);
250
245
  } (constants));
251
246
  return constants;
@@ -261,21 +256,20 @@ function requireCalculateTokenCharactersRange () {
261
256
  if (hasRequiredCalculateTokenCharactersRange) return calculateTokenCharactersRange;
262
257
  hasRequiredCalculateTokenCharactersRange = 1;
263
258
  Object.defineProperty(calculateTokenCharactersRange, "__esModule", { value: true });
264
- calculateTokenCharactersRange.calculateTokenCharactersRange = void 0;
259
+ calculateTokenCharactersRange.calculateTokenCharactersRange = calculateTokenCharactersRange$1;
265
260
  function calculateTokenCharactersRange$1(state, { keepBuffer }) {
266
- const startPosition = state.caretPosition -
267
- (state.accumulatedContent.length - 1) -
268
- state.decisionBuffer.length;
261
+ const startPosition = state.sourceCode.index() -
262
+ (state.accumulatedContent.length() - 1) -
263
+ state.decisionBuffer.length();
269
264
  let endPosition;
270
265
  if (!keepBuffer) {
271
- endPosition = state.caretPosition - state.decisionBuffer.length;
266
+ endPosition = state.sourceCode.index() - state.decisionBuffer.length();
272
267
  }
273
268
  else {
274
- endPosition = state.caretPosition;
269
+ endPosition = state.sourceCode.index();
275
270
  }
276
271
  return [startPosition, endPosition + 1];
277
272
  }
278
- calculateTokenCharactersRange.calculateTokenCharactersRange = calculateTokenCharactersRange$1;
279
273
  return calculateTokenCharactersRange;
280
274
  }
281
275
 
@@ -287,11 +281,10 @@ function requireIsWhitespace () {
287
281
  if (hasRequiredIsWhitespace) return isWhitespace;
288
282
  hasRequiredIsWhitespace = 1;
289
283
  Object.defineProperty(isWhitespace, "__esModule", { value: true });
290
- isWhitespace.isWhitespace = void 0;
284
+ isWhitespace.isWhitespace = isWhitespace$1;
291
285
  function isWhitespace$1(char) {
292
286
  return char === " " || char === "\n" || char === "\t" || char === "\r";
293
287
  }
294
- isWhitespace.isWhitespace = isWhitespace$1;
295
288
  return isWhitespace;
296
289
  }
297
290
 
@@ -303,7 +296,7 @@ function requireParseOpenTagName () {
303
296
  if (hasRequiredParseOpenTagName) return parseOpenTagName;
304
297
  hasRequiredParseOpenTagName = 1;
305
298
  Object.defineProperty(parseOpenTagName, "__esModule", { value: true });
306
- parseOpenTagName.parseOpenTagName = void 0;
299
+ parseOpenTagName.parseOpenTagName = parseOpenTagName$1;
307
300
  const constants_1 = requireConstants();
308
301
  function parseOpenTagName$1(openTagStartTokenContent) {
309
302
  const match = openTagStartTokenContent.match(constants_1.OPEN_TAG_NAME_PATTERN);
@@ -313,7 +306,6 @@ function requireParseOpenTagName () {
313
306
  }
314
307
  return match[1].toLowerCase();
315
308
  }
316
- parseOpenTagName.parseOpenTagName = parseOpenTagName$1;
317
309
  return parseOpenTagName;
318
310
  }
319
311
 
@@ -325,7 +317,7 @@ function requireParseCloseTagName () {
325
317
  if (hasRequiredParseCloseTagName) return parseCloseTagName;
326
318
  hasRequiredParseCloseTagName = 1;
327
319
  Object.defineProperty(parseCloseTagName, "__esModule", { value: true });
328
- parseCloseTagName.parseCloseTagName = void 0;
320
+ parseCloseTagName.parseCloseTagName = parseCloseTagName$1;
329
321
  const constants_1 = requireConstants();
330
322
  function parseCloseTagName$1(closeTagTokenContent) {
331
323
  const match = closeTagTokenContent.match(constants_1.CLOSE_TAG_NAME_PATTERN);
@@ -335,7 +327,6 @@ function requireParseCloseTagName () {
335
327
  }
336
328
  return match[1].trim().toLowerCase();
337
329
  }
338
- parseCloseTagName.parseCloseTagName = parseCloseTagName$1;
339
330
  return parseCloseTagName;
340
331
  }
341
332
 
@@ -347,7 +338,7 @@ function requireClearParent () {
347
338
  if (hasRequiredClearParent) return clearParent;
348
339
  hasRequiredClearParent = 1;
349
340
  Object.defineProperty(clearParent, "__esModule", { value: true });
350
- clearParent.clearParent = void 0;
341
+ clearParent.clearParent = clearParent$1;
351
342
  function clearParent$1(ast) {
352
343
  const cleanAst = ast;
353
344
  delete cleanAst.parentRef;
@@ -359,7 +350,6 @@ function requireClearParent () {
359
350
  }
360
351
  return cleanAst;
361
352
  }
362
- clearParent.clearParent = clearParent$1;
363
353
  return clearParent;
364
354
  }
365
355
 
@@ -374,7 +364,7 @@ function requireGetLineInfo () {
374
364
  hasRequiredGetLineInfo = 1;
375
365
  //https://github.com/acornjs/acorn/blob/master/acorn/src/whitespace.js
376
366
  Object.defineProperty(getLineInfo, "__esModule", { value: true });
377
- getLineInfo.getLineInfo = void 0;
367
+ getLineInfo.getLineInfo = getLineInfo$1;
378
368
  function isNewLine(code) {
379
369
  return code === 10 || code === 13 || code === 0x2028 || code === 0x2029;
380
370
  }
@@ -397,7 +387,6 @@ function requireGetLineInfo () {
397
387
  cur = nextBreak;
398
388
  }
399
389
  }
400
- getLineInfo.getLineInfo = getLineInfo$1;
401
390
  return getLineInfo;
402
391
  }
403
392
 
@@ -407,7 +396,7 @@ function requireCalculateTokenLocation () {
407
396
  if (hasRequiredCalculateTokenLocation) return calculateTokenLocation;
408
397
  hasRequiredCalculateTokenLocation = 1;
409
398
  Object.defineProperty(calculateTokenLocation, "__esModule", { value: true });
410
- calculateTokenLocation.calculateTokenLocation = void 0;
399
+ calculateTokenLocation.calculateTokenLocation = calculateTokenLocation$1;
411
400
  const get_line_info_1 = requireGetLineInfo();
412
401
  function calculateTokenLocation$1(source, range) {
413
402
  return {
@@ -415,7 +404,6 @@ function requireCalculateTokenLocation () {
415
404
  end: (0, get_line_info_1.getLineInfo)(source, range[1]),
416
405
  };
417
406
  }
418
- calculateTokenLocation.calculateTokenLocation = calculateTokenLocation$1;
419
407
  return calculateTokenLocation;
420
408
  }
421
409
 
@@ -427,18 +415,17 @@ function requireCalculateTokenPosition () {
427
415
  if (hasRequiredCalculateTokenPosition) return calculateTokenPosition;
428
416
  hasRequiredCalculateTokenPosition = 1;
429
417
  Object.defineProperty(calculateTokenPosition, "__esModule", { value: true });
430
- calculateTokenPosition.calculateTokenPosition = void 0;
418
+ calculateTokenPosition.calculateTokenPosition = calculateTokenPosition$1;
431
419
  const calculate_token_characters_range_1 = requireCalculateTokenCharactersRange();
432
420
  const calculate_token_location_1 = requireCalculateTokenLocation();
433
421
  function calculateTokenPosition$1(state, options) {
434
422
  const range = (0, calculate_token_characters_range_1.calculateTokenCharactersRange)(state, options);
435
- const loc = (0, calculate_token_location_1.calculateTokenLocation)(state.source, range);
423
+ const loc = (0, calculate_token_location_1.calculateTokenLocation)(state.sourceCode.source, range);
436
424
  return {
437
425
  range,
438
426
  loc,
439
427
  };
440
428
  }
441
- calculateTokenPosition.calculateTokenPosition = calculateTokenPosition$1;
442
429
  return calculateTokenPosition;
443
430
  }
444
431
 
@@ -450,11 +437,10 @@ function requireLast () {
450
437
  if (hasRequiredLast) return last;
451
438
  hasRequiredLast = 1;
452
439
  Object.defineProperty(last, "__esModule", { value: true });
453
- last.last = void 0;
440
+ last.last = last$1;
454
441
  function last$1(items) {
455
442
  return items[items.length - 1];
456
443
  }
457
- last.last = last$1;
458
444
  return last;
459
445
  }
460
446
 
@@ -466,11 +452,10 @@ function requireCloneRange () {
466
452
  if (hasRequiredCloneRange) return cloneRange;
467
453
  hasRequiredCloneRange = 1;
468
454
  Object.defineProperty(cloneRange, "__esModule", { value: true });
469
- cloneRange.cloneRange = void 0;
455
+ cloneRange.cloneRange = cloneRange$1;
470
456
  function cloneRange$1(range) {
471
457
  return [range[0], range[1]];
472
458
  }
473
- cloneRange.cloneRange = cloneRange$1;
474
459
  return cloneRange;
475
460
  }
476
461
 
@@ -484,7 +469,7 @@ function requireCloneLocation () {
484
469
  if (hasRequiredCloneLocation) return cloneLocation;
485
470
  hasRequiredCloneLocation = 1;
486
471
  Object.defineProperty(cloneLocation, "__esModule", { value: true });
487
- cloneLocation.cloneLocation = void 0;
472
+ cloneLocation.cloneLocation = cloneLocation$1;
488
473
  function cloneLocation$1(loc) {
489
474
  return {
490
475
  start: {
@@ -497,7 +482,6 @@ function requireCloneLocation () {
497
482
  },
498
483
  };
499
484
  }
500
- cloneLocation.cloneLocation = cloneLocation$1;
501
485
  return cloneLocation;
502
486
  }
503
487
 
@@ -507,20 +491,30 @@ function requireCreateNodeFrom () {
507
491
  if (hasRequiredCreateNodeFrom) return createNodeFrom;
508
492
  hasRequiredCreateNodeFrom = 1;
509
493
  Object.defineProperty(createNodeFrom, "__esModule", { value: true });
510
- createNodeFrom.createNodeFrom = void 0;
494
+ createNodeFrom.createNodeFrom = createNodeFrom$1;
511
495
  const clone_location_1 = requireCloneLocation();
512
496
  const clone_range_1 = requireCloneRange();
513
497
  function createNodeFrom$1(token) {
514
498
  const loc = (0, clone_location_1.cloneLocation)(token.loc);
515
499
  const range = (0, clone_range_1.cloneRange)(token.range);
516
- return {
500
+ const ret = {
517
501
  type: token.type,
518
502
  value: token.value,
519
503
  loc,
520
504
  range,
521
505
  };
506
+ // @ts-ignore
507
+ if (token.templates) {
508
+ // @ts-ignore
509
+ ret.templates = token.templates;
510
+ }
511
+ // @ts-ignore
512
+ if (token.isTemplate) {
513
+ // @ts-ignore
514
+ ret.isTemplate = token.isTemplate;
515
+ }
516
+ return ret;
522
517
  }
523
- createNodeFrom.createNodeFrom = createNodeFrom$1;
524
518
  return createNodeFrom;
525
519
  }
526
520
 
@@ -532,12 +526,11 @@ function requireUpdateNodeEnd () {
532
526
  if (hasRequiredUpdateNodeEnd) return updateNodeEnd;
533
527
  hasRequiredUpdateNodeEnd = 1;
534
528
  Object.defineProperty(updateNodeEnd, "__esModule", { value: true });
535
- updateNodeEnd.updateNodeEnd = void 0;
529
+ updateNodeEnd.updateNodeEnd = updateNodeEnd$1;
536
530
  function updateNodeEnd$1(node, token) {
537
531
  node.range[1] = token.range[1];
538
532
  node.loc.end = Object.assign({}, token.loc.end);
539
533
  }
540
- updateNodeEnd.updateNodeEnd = updateNodeEnd$1;
541
534
  return updateNodeEnd;
542
535
  }
543
536
 
@@ -549,11 +542,10 @@ function requireFirst () {
549
542
  if (hasRequiredFirst) return first;
550
543
  hasRequiredFirst = 1;
551
544
  Object.defineProperty(first, "__esModule", { value: true });
552
- first.first = void 0;
545
+ first.first = first$1;
553
546
  function first$1(items) {
554
547
  return items[0];
555
548
  }
556
- first.first = first$1;
557
549
  return first;
558
550
  }
559
551
 
@@ -565,21 +557,20 @@ function requireInitIfNone () {
565
557
  if (hasRequiredInitIfNone) return initIfNone;
566
558
  hasRequiredInitIfNone = 1;
567
559
  Object.defineProperty(initIfNone, "__esModule", { value: true });
568
- initIfNone.initAttributesIfNone = initIfNone.initChildrenIfNone = void 0;
560
+ initIfNone.initChildrenIfNone = initChildrenIfNone;
561
+ initIfNone.initAttributesIfNone = initAttributesIfNone;
569
562
  function initChildrenIfNone(node) {
570
563
  /* istanbul ignore next */
571
564
  if (!node.children) {
572
565
  node.children = [];
573
566
  }
574
567
  }
575
- initIfNone.initChildrenIfNone = initChildrenIfNone;
576
568
  function initAttributesIfNone(node) {
577
569
  /* istanbul ignore next */
578
570
  if (!node.attributes) {
579
571
  node.attributes = [];
580
572
  }
581
573
  }
582
- initIfNone.initAttributesIfNone = initAttributesIfNone;
583
574
  return initIfNone;
584
575
  }
585
576
 
@@ -633,7 +624,7 @@ function requireAttributeValue$1 () {
633
624
  if (hasRequiredAttributeValue$1) return attributeValue$1;
634
625
  hasRequiredAttributeValue$1 = 1;
635
626
  Object.defineProperty(attributeValue$1, "__esModule", { value: true });
636
- attributeValue$1.construct = void 0;
627
+ attributeValue$1.construct = construct;
637
628
  const constants_1 = requireConstants();
638
629
  const utils_1 = requireUtils();
639
630
  const VALUE_END_TOKENS = [
@@ -654,6 +645,7 @@ function requireAttributeValue$1 () {
654
645
  function handleAttributeValue(state, token) {
655
646
  const attribute = getLastAttribute(state);
656
647
  attribute.value = (0, utils_1.createNodeFrom)(token);
648
+ (0, utils_1.updateNodeEnd)(attribute, token);
657
649
  state.caretPosition++;
658
650
  return state;
659
651
  }
@@ -690,7 +682,6 @@ function requireAttributeValue$1 () {
690
682
  state.caretPosition++;
691
683
  return state;
692
684
  }
693
- attributeValue$1.construct = construct;
694
685
  return attributeValue$1;
695
686
  }
696
687
 
@@ -702,7 +693,7 @@ function requireAttributes$1 () {
702
693
  if (hasRequiredAttributes$1) return attributes$1;
703
694
  hasRequiredAttributes$1 = 1;
704
695
  Object.defineProperty(attributes$1, "__esModule", { value: true });
705
- attributes$1.construct = void 0;
696
+ attributes$1.construct = construct;
706
697
  const constants_1 = requireConstants();
707
698
  const utils_1 = requireUtils();
708
699
  const ATTRIBUTE_START_TOKENS = [
@@ -742,7 +733,6 @@ function requireAttributes$1 () {
742
733
  state.caretPosition++;
743
734
  return state;
744
735
  }
745
- attributes$1.construct = construct;
746
736
  return attributes$1;
747
737
  }
748
738
 
@@ -754,7 +744,7 @@ function requireAttribute () {
754
744
  if (hasRequiredAttribute) return attribute;
755
745
  hasRequiredAttribute = 1;
756
746
  Object.defineProperty(attribute, "__esModule", { value: true });
757
- attribute.construct = void 0;
747
+ attribute.construct = construct;
758
748
  const constants_1 = requireConstants();
759
749
  const utils_1 = requireUtils();
760
750
  const OPEN_TAG_END_TOKENS = [
@@ -806,7 +796,6 @@ function requireAttribute () {
806
796
  state.caretPosition++;
807
797
  return state;
808
798
  }
809
- attribute.construct = construct;
810
799
  return attribute;
811
800
  }
812
801
 
@@ -818,7 +807,7 @@ function requireComment () {
818
807
  if (hasRequiredComment) return comment;
819
808
  hasRequiredComment = 1;
820
809
  Object.defineProperty(comment, "__esModule", { value: true });
821
- comment.construct = void 0;
810
+ comment.construct = construct;
822
811
  const constants_1 = requireConstants();
823
812
  const utils_1 = requireUtils();
824
813
  function handleCommentOpen(state, token) {
@@ -852,7 +841,6 @@ function requireComment () {
852
841
  state.caretPosition++;
853
842
  return state;
854
843
  }
855
- comment.construct = construct;
856
844
  return comment;
857
845
  }
858
846
 
@@ -864,7 +852,7 @@ function requireDoctypeAttribute () {
864
852
  if (hasRequiredDoctypeAttribute) return doctypeAttribute;
865
853
  hasRequiredDoctypeAttribute = 1;
866
854
  Object.defineProperty(doctypeAttribute, "__esModule", { value: true });
867
- doctypeAttribute.construct = void 0;
855
+ doctypeAttribute.construct = construct;
868
856
  const constants_1 = requireConstants();
869
857
  const utils_1 = requireUtils();
870
858
  function getLastAttribute(state) {
@@ -923,7 +911,6 @@ function requireDoctypeAttribute () {
923
911
  state.caretPosition++;
924
912
  return state;
925
913
  }
926
- doctypeAttribute.construct = construct;
927
914
  return doctypeAttribute;
928
915
  }
929
916
 
@@ -935,7 +922,7 @@ function requireDoctypeAttributes$1 () {
935
922
  if (hasRequiredDoctypeAttributes$1) return doctypeAttributes$1;
936
923
  hasRequiredDoctypeAttributes$1 = 1;
937
924
  Object.defineProperty(doctypeAttributes$1, "__esModule", { value: true });
938
- doctypeAttributes$1.construct = void 0;
925
+ doctypeAttributes$1.construct = construct;
939
926
  const constants_1 = requireConstants();
940
927
  const utils_1 = requireUtils();
941
928
  const ATTRIBUTE_START_TOKENS = [
@@ -970,7 +957,6 @@ function requireDoctypeAttributes$1 () {
970
957
  state.caretPosition++;
971
958
  return state;
972
959
  }
973
- doctypeAttributes$1.construct = construct;
974
960
  return doctypeAttributes$1;
975
961
  }
976
962
 
@@ -982,7 +968,7 @@ function requireDoctype () {
982
968
  if (hasRequiredDoctype) return doctype;
983
969
  hasRequiredDoctype = 1;
984
970
  Object.defineProperty(doctype, "__esModule", { value: true });
985
- doctype.construct = void 0;
971
+ doctype.construct = construct;
986
972
  const constants_1 = requireConstants();
987
973
  const utils_1 = requireUtils();
988
974
  const ATTRIBUTES_START_TOKENS = [
@@ -1022,7 +1008,6 @@ function requireDoctype () {
1022
1008
  state.caretPosition++;
1023
1009
  return state;
1024
1010
  }
1025
- doctype.construct = construct;
1026
1011
  return doctype;
1027
1012
  }
1028
1013
 
@@ -1034,7 +1019,7 @@ function requireScriptTag () {
1034
1019
  if (hasRequiredScriptTag) return scriptTag;
1035
1020
  hasRequiredScriptTag = 1;
1036
1021
  Object.defineProperty(scriptTag, "__esModule", { value: true });
1037
- scriptTag.construct = void 0;
1022
+ scriptTag.construct = construct;
1038
1023
  const constants_1 = requireConstants();
1039
1024
  const utils_1 = requireUtils();
1040
1025
  const ATTRIBUTE_START_TOKENS = [
@@ -1093,7 +1078,6 @@ function requireScriptTag () {
1093
1078
  state.caretPosition++;
1094
1079
  return state;
1095
1080
  }
1096
- scriptTag.construct = construct;
1097
1081
  return scriptTag;
1098
1082
  }
1099
1083
 
@@ -1105,7 +1089,7 @@ function requireStyleTag () {
1105
1089
  if (hasRequiredStyleTag) return styleTag;
1106
1090
  hasRequiredStyleTag = 1;
1107
1091
  Object.defineProperty(styleTag, "__esModule", { value: true });
1108
- styleTag.construct = void 0;
1092
+ styleTag.construct = construct;
1109
1093
  const constants_1 = requireConstants();
1110
1094
  const utils_1 = requireUtils();
1111
1095
  const ATTRIBUTE_START_TOKENS = [
@@ -1164,7 +1148,6 @@ function requireStyleTag () {
1164
1148
  state.caretPosition++;
1165
1149
  return state;
1166
1150
  }
1167
- styleTag.construct = construct;
1168
1151
  return styleTag;
1169
1152
  }
1170
1153
 
@@ -1176,7 +1159,7 @@ function requireTagContent () {
1176
1159
  if (hasRequiredTagContent) return tagContent;
1177
1160
  hasRequiredTagContent = 1;
1178
1161
  Object.defineProperty(tagContent, "__esModule", { value: true });
1179
- tagContent.construct = void 0;
1162
+ tagContent.construct = construct;
1180
1163
  const constants_1 = requireConstants();
1181
1164
  const utils_1 = requireUtils();
1182
1165
  function handleOpenTagStart(state, token) {
@@ -1309,7 +1292,6 @@ function requireTagContent () {
1309
1292
  state.caretPosition++;
1310
1293
  return state;
1311
1294
  }
1312
- tagContent.construct = construct;
1313
1295
  return tagContent;
1314
1296
  }
1315
1297
 
@@ -1321,7 +1303,7 @@ function requireTagName () {
1321
1303
  if (hasRequiredTagName) return tagName;
1322
1304
  hasRequiredTagName = 1;
1323
1305
  Object.defineProperty(tagName, "__esModule", { value: true });
1324
- tagName.construct = void 0;
1306
+ tagName.construct = construct;
1325
1307
  const constants_1 = requireConstants();
1326
1308
  const utils_1 = requireUtils();
1327
1309
  function handleTagOpenStart(state, token) {
@@ -1336,7 +1318,6 @@ function requireTagName () {
1336
1318
  state.caretPosition++;
1337
1319
  return state;
1338
1320
  }
1339
- tagName.construct = construct;
1340
1321
  return tagName;
1341
1322
  }
1342
1323
 
@@ -1348,7 +1329,7 @@ function requireTag () {
1348
1329
  if (hasRequiredTag) return tag;
1349
1330
  hasRequiredTag = 1;
1350
1331
  Object.defineProperty(tag, "__esModule", { value: true });
1351
- tag.construct = void 0;
1332
+ tag.construct = construct;
1352
1333
  const constants_1 = requireConstants();
1353
1334
  const utils_1 = requireUtils();
1354
1335
  const ATTRIBUTE_START_TOKENS = [
@@ -1431,7 +1412,6 @@ function requireTag () {
1431
1412
  state.caretPosition++;
1432
1413
  return state;
1433
1414
  }
1434
- tag.construct = construct;
1435
1415
  return tag;
1436
1416
  }
1437
1417
 
@@ -1486,7 +1466,7 @@ function requireConstructTree () {
1486
1466
  if (hasRequiredConstructTree) return constructTree;
1487
1467
  hasRequiredConstructTree = 1;
1488
1468
  Object.defineProperty(constructTree, "__esModule", { value: true });
1489
- constructTree.constructTree = void 0;
1469
+ constructTree.constructTree = constructTree$1;
1490
1470
  const constants_1 = requireConstants();
1491
1471
  const utils_1 = requireUtils();
1492
1472
  const clone_location_1 = requireCloneLocation();
@@ -1516,47 +1496,44 @@ function requireConstructTree () {
1516
1496
  column: 0,
1517
1497
  },
1518
1498
  };
1519
- function constructTree$1(tokens, existingState) {
1520
- let state = existingState;
1521
- if (existingState === undefined) {
1522
- const rootContext = {
1523
- type: constants_1.ConstructTreeContextTypes.TagContent,
1524
- parentRef: undefined,
1525
- content: [],
1526
- };
1527
- const lastToken = (0, utils_1.last)(tokens);
1528
- const firstToken = (0, utils_1.first)(tokens);
1529
- const range = lastToken ? [0, lastToken.range[1]] : EMPTY_RANGE;
1530
- const loc = lastToken
1531
- ? {
1532
- start: (0, clone_location_1.cloneLocation)(firstToken.loc).start,
1533
- end: (0, clone_location_1.cloneLocation)(lastToken.loc).end,
1534
- }
1535
- : EMPTY_LOC;
1536
- loc.start.line = 1;
1537
- const rootNode = {
1538
- type: constants_1.NodeTypes.Document,
1539
- range,
1540
- children: [],
1541
- loc,
1542
- };
1543
- state = {
1544
- caretPosition: 0,
1545
- currentContext: rootContext,
1546
- currentNode: rootNode,
1547
- rootNode,
1548
- };
1549
- }
1499
+ function constructTree$1(tokens) {
1500
+ const rootContext = {
1501
+ type: constants_1.ConstructTreeContextTypes.TagContent,
1502
+ parentRef: undefined,
1503
+ content: [],
1504
+ };
1505
+ const lastToken = (0, utils_1.last)(tokens);
1506
+ const firstToken = (0, utils_1.first)(tokens);
1507
+ const range = lastToken ? [0, lastToken.range[1]] : EMPTY_RANGE;
1508
+ const loc = lastToken
1509
+ ? {
1510
+ start: (0, clone_location_1.cloneLocation)(firstToken.loc).start,
1511
+ end: (0, clone_location_1.cloneLocation)(lastToken.loc).end,
1512
+ }
1513
+ : EMPTY_LOC;
1514
+ loc.start.line = 1;
1515
+ const rootNode = {
1516
+ type: constants_1.NodeTypes.Document,
1517
+ range,
1518
+ children: [],
1519
+ loc,
1520
+ };
1521
+ const state = {
1522
+ caretPosition: 0,
1523
+ currentContext: rootContext,
1524
+ currentNode: rootNode,
1525
+ rootNode,
1526
+ };
1550
1527
  const positionOffset = state.caretPosition;
1551
1528
  processTokens(tokens, state, positionOffset);
1552
1529
  return { state, ast: state.rootNode };
1553
1530
  }
1554
- constructTree.constructTree = constructTree$1;
1555
1531
  function processTokens(tokens, state, positionOffset) {
1556
1532
  let tokenIndex = state.caretPosition - positionOffset;
1557
1533
  while (tokenIndex < tokens.length) {
1558
1534
  const token = tokens[tokenIndex];
1559
1535
  const handler = contextHandlers[state.currentContext.type].construct;
1536
+ // @ts-ignore
1560
1537
  state = handler(token, state);
1561
1538
  tokenIndex = state.caretPosition - positionOffset;
1562
1539
  }
@@ -1587,38 +1564,66 @@ var handlers = {};
1587
1564
 
1588
1565
  var attributeKey = {};
1589
1566
 
1567
+ var createTemplates = {};
1568
+
1569
+ var hasRequiredCreateTemplates;
1570
+
1571
+ function requireCreateTemplates () {
1572
+ if (hasRequiredCreateTemplates) return createTemplates;
1573
+ hasRequiredCreateTemplates = 1;
1574
+ Object.defineProperty(createTemplates, "__esModule", { value: true });
1575
+ createTemplates.createTemplates = createTemplates$1;
1576
+ function createTemplates$1(state, type) {
1577
+ return state.mode === "template" && state.accumulatedContent.hasTemplate()
1578
+ ? state.accumulatedContent.getTemplates().map((chars) => {
1579
+ const token = {
1580
+ type: type,
1581
+ range: chars.range,
1582
+ loc: state.sourceCode.getLocationOf(chars.range),
1583
+ isTemplate: chars.isTemplate,
1584
+ value: chars.value,
1585
+ };
1586
+ return Object.assign(Object.assign({}, token), { range: state.tokenAdapter.finalizeRange(token), loc: state.tokenAdapter.finalizeLocation(token) });
1587
+ })
1588
+ : [];
1589
+ }
1590
+ return createTemplates;
1591
+ }
1592
+
1590
1593
  var hasRequiredAttributeKey;
1591
1594
 
1592
1595
  function requireAttributeKey () {
1593
1596
  if (hasRequiredAttributeKey) return attributeKey;
1594
1597
  hasRequiredAttributeKey = 1;
1595
1598
  Object.defineProperty(attributeKey, "__esModule", { value: true });
1596
- attributeKey.parse = void 0;
1599
+ attributeKey.parse = parse;
1597
1600
  const constants_1 = requireConstants();
1598
1601
  const token_types_1 = requireTokenTypes();
1599
1602
  const utils_1 = requireUtils();
1600
- function parse(chars, state, tokens) {
1603
+ const create_templates_1 = requireCreateTemplates();
1604
+ function parse(chars, state) {
1601
1605
  if (isKeyBreak(chars)) {
1602
- return parseKeyEnd(state, tokens);
1606
+ return parseKeyEnd(state);
1603
1607
  }
1604
- state.accumulatedContent += state.decisionBuffer;
1605
- state.decisionBuffer = "";
1606
- state.caretPosition++;
1608
+ state.accumulatedContent.concatBuffer(state.decisionBuffer);
1609
+ state.decisionBuffer.clear();
1610
+ state.sourceCode.next();
1607
1611
  }
1608
- attributeKey.parse = parse;
1609
1612
  function isKeyBreak(chars) {
1610
- return chars === "=" || chars === "/" || chars === ">" || (0, utils_1.isWhitespace)(chars);
1613
+ const value = chars.value();
1614
+ return value === "=" || value === "/" || value === ">" || (0, utils_1.isWhitespace)(value);
1611
1615
  }
1612
- function parseKeyEnd(state, tokens) {
1616
+ function parseKeyEnd(state) {
1613
1617
  const position = (0, utils_1.calculateTokenPosition)(state, { keepBuffer: false });
1614
- tokens.push({
1618
+ state.tokens.push({
1615
1619
  type: token_types_1.TokenTypes.AttributeKey,
1616
- value: state.accumulatedContent,
1620
+ value: state.accumulatedContent.value(),
1617
1621
  range: position.range,
1618
1622
  loc: position.loc,
1623
+ templates: (0, create_templates_1.createTemplates)(state, token_types_1.TokenTypes.AttributeKey),
1619
1624
  });
1620
- state.accumulatedContent = "";
1621
- state.decisionBuffer = "";
1625
+ state.accumulatedContent.clear();
1626
+ state.decisionBuffer.clear();
1622
1627
  state.currentContext = constants_1.TokenizerContextTypes.Attributes;
1623
1628
  }
1624
1629
  return attributeKey;
@@ -1632,31 +1637,34 @@ function requireAttributeValueBare () {
1632
1637
  if (hasRequiredAttributeValueBare) return attributeValueBare;
1633
1638
  hasRequiredAttributeValueBare = 1;
1634
1639
  Object.defineProperty(attributeValueBare, "__esModule", { value: true });
1635
- attributeValueBare.parse = attributeValueBare.parseValueEnd = void 0;
1640
+ attributeValueBare.parseValueEnd = parseValueEnd;
1641
+ attributeValueBare.parse = parse;
1636
1642
  const constants_1 = requireConstants();
1637
1643
  const utils_1 = requireUtils();
1638
- function parseValueEnd(state, tokens) {
1644
+ const create_templates_1 = requireCreateTemplates();
1645
+ function parseValueEnd(state) {
1639
1646
  const position = (0, utils_1.calculateTokenPosition)(state, { keepBuffer: false });
1640
- tokens.push({
1647
+ state.tokens.push({
1641
1648
  type: constants_1.TokenTypes.AttributeValue,
1642
- value: state.accumulatedContent,
1649
+ value: state.accumulatedContent.value(),
1643
1650
  range: position.range,
1644
1651
  loc: position.loc,
1652
+ templates: (0, create_templates_1.createTemplates)(state, constants_1.TokenTypes.AttributeValue),
1645
1653
  });
1646
- state.accumulatedContent = "";
1647
- state.decisionBuffer = "";
1654
+ state.accumulatedContent.clear();
1655
+ state.decisionBuffer.clear();
1648
1656
  state.currentContext = constants_1.TokenizerContextTypes.Attributes;
1649
1657
  }
1650
- attributeValueBare.parseValueEnd = parseValueEnd;
1651
- function parse(chars, state, tokens) {
1652
- if ((0, utils_1.isWhitespace)(chars) || chars === ">" || chars === "/") {
1653
- return parseValueEnd(state, tokens);
1658
+ function parse(chars, state) {
1659
+ if ((0, utils_1.isWhitespace)(chars.value()) ||
1660
+ chars.value() === ">" ||
1661
+ chars.value() === "/") {
1662
+ return parseValueEnd(state);
1654
1663
  }
1655
- state.accumulatedContent += state.decisionBuffer;
1656
- state.decisionBuffer = "";
1657
- state.caretPosition++;
1664
+ state.accumulatedContent.concatBuffer(state.decisionBuffer);
1665
+ state.decisionBuffer.clear();
1666
+ state.sourceCode.next();
1658
1667
  }
1659
- attributeValueBare.parse = parse;
1660
1668
  return attributeValueBare;
1661
1669
  }
1662
1670
 
@@ -1668,41 +1676,41 @@ function requireAttributeValueWrapped () {
1668
1676
  if (hasRequiredAttributeValueWrapped) return attributeValueWrapped;
1669
1677
  hasRequiredAttributeValueWrapped = 1;
1670
1678
  Object.defineProperty(attributeValueWrapped, "__esModule", { value: true });
1671
- attributeValueWrapped.parse = void 0;
1679
+ attributeValueWrapped.parse = parse;
1672
1680
  const constants_1 = requireConstants();
1673
1681
  const utils_1 = requireUtils();
1674
- function parse(chars, state, tokens) {
1682
+ const create_templates_1 = requireCreateTemplates();
1683
+ function parse(chars, state) {
1675
1684
  var _a;
1676
1685
  const wrapperChar = (_a = state.contextParams[constants_1.TokenizerContextTypes.AttributeValueWrapped]) === null || _a === void 0 ? void 0 : _a.wrapper;
1677
- if (chars === wrapperChar) {
1678
- return parseWrapper(state, tokens);
1686
+ if (chars.value() === wrapperChar) {
1687
+ return parseWrapper(state);
1679
1688
  }
1680
- state.accumulatedContent += state.decisionBuffer;
1681
- state.decisionBuffer = "";
1682
- state.caretPosition++;
1689
+ state.accumulatedContent.concatBuffer(state.decisionBuffer);
1690
+ state.decisionBuffer.clear();
1691
+ state.sourceCode.next();
1683
1692
  }
1684
- attributeValueWrapped.parse = parse;
1685
- function parseWrapper(state, tokens) {
1693
+ function parseWrapper(state) {
1686
1694
  const position = (0, utils_1.calculateTokenPosition)(state, { keepBuffer: false });
1687
1695
  const endWrapperPosition = position.range[1];
1688
- tokens.push({
1696
+ state.tokens.push({
1689
1697
  type: constants_1.TokenTypes.AttributeValue,
1690
- value: state.accumulatedContent,
1698
+ value: state.accumulatedContent.value(),
1691
1699
  range: position.range,
1692
1700
  loc: position.loc,
1701
+ templates: (0, create_templates_1.createTemplates)(state, constants_1.TokenTypes.AttributeValue),
1693
1702
  });
1694
1703
  const range = [endWrapperPosition, endWrapperPosition + 1];
1695
- const loc = (0, utils_1.calculateTokenLocation)(state.source, range);
1696
- tokens.push({
1704
+ state.tokens.push({
1697
1705
  type: constants_1.TokenTypes.AttributeValueWrapperEnd,
1698
- value: state.decisionBuffer,
1706
+ value: state.decisionBuffer.value(),
1699
1707
  range,
1700
- loc,
1708
+ loc: state.sourceCode.getLocationOf(range),
1701
1709
  });
1702
- state.accumulatedContent = "";
1703
- state.decisionBuffer = "";
1710
+ state.accumulatedContent.clear();
1711
+ state.decisionBuffer.clear();
1704
1712
  state.currentContext = constants_1.TokenizerContextTypes.Attributes;
1705
- state.caretPosition++;
1713
+ state.sourceCode.next();
1706
1714
  state.contextParams[constants_1.TokenizerContextTypes.AttributeValueWrapped] = undefined;
1707
1715
  }
1708
1716
  return attributeValueWrapped;
@@ -1716,50 +1724,49 @@ function requireAttributeValue () {
1716
1724
  if (hasRequiredAttributeValue) return attributeValue;
1717
1725
  hasRequiredAttributeValue = 1;
1718
1726
  Object.defineProperty(attributeValue, "__esModule", { value: true });
1719
- attributeValue.parse = void 0;
1727
+ attributeValue.parse = parse;
1720
1728
  const constants_1 = requireConstants();
1721
1729
  const utils_1 = requireUtils();
1722
- function parse(chars, state, tokens) {
1723
- if (chars === '"' || chars === "'") {
1724
- return parseWrapper(state, tokens);
1730
+ function parse(chars, state) {
1731
+ const value = chars.value();
1732
+ if (value === '"' || value === "'") {
1733
+ return parseWrapper(state);
1725
1734
  }
1726
- if (chars === ">" || chars === "/") {
1735
+ if (value === ">" || value === "/") {
1727
1736
  return parseTagEnd(state);
1728
1737
  }
1729
- if (!(0, utils_1.isWhitespace)(chars)) {
1738
+ if (!(0, utils_1.isWhitespace)(value)) {
1730
1739
  return parseBare(state);
1731
1740
  }
1732
- state.decisionBuffer = "";
1733
- state.caretPosition++;
1741
+ state.decisionBuffer.clear();
1742
+ state.sourceCode.next();
1734
1743
  }
1735
- attributeValue.parse = parse;
1736
- function parseWrapper(state, tokens) {
1737
- const wrapper = state.decisionBuffer;
1738
- const range = [state.caretPosition, state.caretPosition + 1];
1739
- const loc = (0, utils_1.calculateTokenLocation)(state.source, range);
1740
- tokens.push({
1744
+ function parseWrapper(state) {
1745
+ const wrapper = state.decisionBuffer.value();
1746
+ const range = [state.sourceCode.index(), state.sourceCode.index() + 1];
1747
+ state.tokens.push({
1741
1748
  type: constants_1.TokenTypes.AttributeValueWrapperStart,
1742
1749
  value: wrapper,
1743
1750
  range,
1744
- loc,
1751
+ loc: state.sourceCode.getLocationOf(range),
1745
1752
  });
1746
- state.accumulatedContent = "";
1747
- state.decisionBuffer = "";
1753
+ state.accumulatedContent.clear();
1754
+ state.decisionBuffer.clear();
1748
1755
  state.currentContext = constants_1.TokenizerContextTypes.AttributeValueWrapped;
1749
1756
  state.contextParams[constants_1.TokenizerContextTypes.AttributeValueWrapped] = {
1750
- wrapper,
1757
+ wrapper: wrapper,
1751
1758
  };
1752
- state.caretPosition++;
1759
+ state.sourceCode.next();
1753
1760
  }
1754
1761
  function parseBare(state) {
1755
- state.accumulatedContent = state.decisionBuffer;
1756
- state.decisionBuffer = "";
1762
+ state.accumulatedContent.replace(state.decisionBuffer);
1763
+ state.decisionBuffer.clear();
1757
1764
  state.currentContext = constants_1.TokenizerContextTypes.AttributeValueBare;
1758
- state.caretPosition++;
1765
+ state.sourceCode.next();
1759
1766
  }
1760
1767
  function parseTagEnd(state) {
1761
- state.accumulatedContent = "";
1762
- state.decisionBuffer = "";
1768
+ state.accumulatedContent.clear();
1769
+ state.decisionBuffer.clear();
1763
1770
  state.currentContext = constants_1.TokenizerContextTypes.Attributes;
1764
1771
  }
1765
1772
  return attributeValue;
@@ -1773,50 +1780,50 @@ function requireAttributes () {
1773
1780
  if (hasRequiredAttributes) return attributes;
1774
1781
  hasRequiredAttributes = 1;
1775
1782
  Object.defineProperty(attributes, "__esModule", { value: true });
1776
- attributes.parse = void 0;
1783
+ attributes.parse = parse;
1777
1784
  const constants_1 = requireConstants();
1778
1785
  const utils_1 = requireUtils();
1779
- function parse(chars, state, tokens) {
1780
- if (chars === ">" || chars === "/") {
1786
+ function parse(chars, state) {
1787
+ const value = chars.value();
1788
+ if (value === ">" || value === "/") {
1781
1789
  return parseTagEnd(state);
1782
1790
  }
1783
- if (chars === "=") {
1784
- return parseEqual(state, tokens);
1791
+ if (value === "=") {
1792
+ return parseEqual(state);
1785
1793
  }
1786
- if (!(0, utils_1.isWhitespace)(chars)) {
1787
- return parseNoneWhitespace(state);
1794
+ if (!(0, utils_1.isWhitespace)(value)) {
1795
+ return parseNoneWhitespace(chars, state);
1788
1796
  }
1789
- state.decisionBuffer = "";
1790
- state.caretPosition++;
1797
+ state.decisionBuffer.clear();
1798
+ state.sourceCode.next();
1791
1799
  }
1792
- attributes.parse = parse;
1793
1800
  function parseTagEnd(state) {
1794
1801
  var _a;
1795
1802
  const tagName = (_a = state.contextParams[constants_1.TokenizerContextTypes.Attributes]) === null || _a === void 0 ? void 0 : _a.tagName;
1796
- state.accumulatedContent = "";
1797
- state.decisionBuffer = "";
1803
+ state.accumulatedContent.clear();
1804
+ state.decisionBuffer.clear();
1798
1805
  state.currentContext = constants_1.TokenizerContextTypes.OpenTagEnd;
1799
1806
  state.contextParams[constants_1.TokenizerContextTypes.OpenTagEnd] = { tagName: tagName };
1800
1807
  state.contextParams[constants_1.TokenizerContextTypes.Attributes] = undefined;
1801
1808
  }
1802
- function parseNoneWhitespace(state) {
1803
- state.accumulatedContent = state.decisionBuffer;
1804
- state.decisionBuffer = "";
1809
+ function parseNoneWhitespace(chars, state) {
1810
+ state.accumulatedContent.replace(state.decisionBuffer);
1805
1811
  state.currentContext = constants_1.TokenizerContextTypes.AttributeKey;
1806
- state.caretPosition++;
1812
+ state.sourceCode.next();
1813
+ state.decisionBuffer.clear();
1807
1814
  }
1808
- function parseEqual(state, tokens) {
1815
+ function parseEqual(state) {
1809
1816
  const position = (0, utils_1.calculateTokenPosition)(state, { keepBuffer: true });
1810
- tokens.push({
1817
+ state.tokens.push({
1811
1818
  type: constants_1.TokenTypes.AttributeAssignment,
1812
- value: state.decisionBuffer,
1819
+ value: state.decisionBuffer.value(),
1813
1820
  range: position.range,
1814
1821
  loc: position.loc,
1815
1822
  });
1816
- state.accumulatedContent = "";
1817
- state.decisionBuffer = "";
1823
+ state.accumulatedContent.clear();
1824
+ state.decisionBuffer.clear();
1818
1825
  state.currentContext = constants_1.TokenizerContextTypes.AttributeValue;
1819
- state.caretPosition++;
1826
+ state.sourceCode.next();
1820
1827
  }
1821
1828
  return attributes;
1822
1829
  }
@@ -1829,30 +1836,30 @@ function requireCloseTag () {
1829
1836
  if (hasRequiredCloseTag) return closeTag;
1830
1837
  hasRequiredCloseTag = 1;
1831
1838
  Object.defineProperty(closeTag, "__esModule", { value: true });
1832
- closeTag.parse = void 0;
1839
+ closeTag.parse = parse;
1833
1840
  const constants_1 = requireConstants();
1834
1841
  const utils_1 = requireUtils();
1835
- function parse(chars, state, tokens) {
1836
- if (chars === ">") {
1837
- return parseClosingCornerBrace(state, tokens);
1842
+ function parse(chars, state) {
1843
+ const value = chars.value();
1844
+ if (value === ">") {
1845
+ return parseClosingCornerBrace(state);
1838
1846
  }
1839
- state.accumulatedContent += state.decisionBuffer;
1840
- state.decisionBuffer = "";
1841
- state.caretPosition++;
1847
+ state.accumulatedContent.concatBuffer(state.decisionBuffer);
1848
+ state.decisionBuffer.clear();
1849
+ state.sourceCode.next();
1842
1850
  }
1843
- closeTag.parse = parse;
1844
- function parseClosingCornerBrace(state, tokens) {
1851
+ function parseClosingCornerBrace(state) {
1845
1852
  const position = (0, utils_1.calculateTokenPosition)(state, { keepBuffer: true });
1846
- tokens.push({
1853
+ state.tokens.push({
1847
1854
  type: constants_1.TokenTypes.CloseTag,
1848
- value: state.accumulatedContent + state.decisionBuffer,
1855
+ value: state.accumulatedContent.value() + state.decisionBuffer.value(),
1849
1856
  range: position.range,
1850
1857
  loc: position.loc,
1851
1858
  });
1852
- state.accumulatedContent = "";
1853
- state.decisionBuffer = "";
1859
+ state.accumulatedContent.clear();
1860
+ state.decisionBuffer.clear();
1854
1861
  state.currentContext = constants_1.TokenizerContextTypes.Data;
1855
- state.caretPosition++;
1862
+ state.sourceCode.next();
1856
1863
  }
1857
1864
  return closeTag;
1858
1865
  }
@@ -1865,45 +1872,47 @@ function requireCommentContent () {
1865
1872
  if (hasRequiredCommentContent) return commentContent;
1866
1873
  hasRequiredCommentContent = 1;
1867
1874
  Object.defineProperty(commentContent, "__esModule", { value: true });
1868
- commentContent.parse = void 0;
1875
+ commentContent.parse = parse;
1869
1876
  const constants_1 = requireConstants();
1870
1877
  const utils_1 = requireUtils();
1878
+ const create_templates_1 = requireCreateTemplates();
1871
1879
  const COMMENT_END = "-->";
1872
- function parse(chars, state, tokens) {
1873
- if (chars === "-" || chars === "--") {
1874
- state.caretPosition++;
1880
+ function parse(chars, state) {
1881
+ const value = chars.value();
1882
+ if (value === "-" || value === "--") {
1883
+ state.sourceCode.next();
1875
1884
  return;
1876
1885
  }
1877
- if (chars === COMMENT_END) {
1878
- return parseCommentClose(state, tokens);
1886
+ if (value === COMMENT_END) {
1887
+ return parseCommentClose(state);
1879
1888
  }
1880
- state.accumulatedContent += state.decisionBuffer;
1881
- state.decisionBuffer = "";
1882
- state.caretPosition++;
1889
+ state.accumulatedContent.concatBuffer(state.decisionBuffer);
1890
+ state.decisionBuffer.clear();
1891
+ state.sourceCode.next();
1883
1892
  }
1884
- commentContent.parse = parse;
1885
- function parseCommentClose(state, tokens) {
1893
+ function parseCommentClose(state) {
1886
1894
  const position = (0, utils_1.calculateTokenPosition)(state, { keepBuffer: false });
1887
1895
  const endRange = [
1888
1896
  position.range[1],
1889
1897
  position.range[1] + COMMENT_END.length,
1890
1898
  ];
1891
- const endLoc = (0, utils_1.calculateTokenLocation)(state.source, endRange);
1892
- tokens.push({
1899
+ state.tokens.push({
1893
1900
  type: constants_1.TokenTypes.CommentContent,
1894
- value: state.accumulatedContent,
1901
+ value: state.accumulatedContent.value(),
1895
1902
  range: position.range,
1896
1903
  loc: position.loc,
1897
- }, {
1904
+ templates: (0, create_templates_1.createTemplates)(state, constants_1.TokenTypes.CommentContent),
1905
+ });
1906
+ state.tokens.push({
1898
1907
  type: constants_1.TokenTypes.CommentClose,
1899
- value: state.decisionBuffer,
1908
+ value: state.decisionBuffer.value(),
1900
1909
  range: endRange,
1901
- loc: endLoc,
1910
+ loc: state.sourceCode.getLocationOf(endRange),
1902
1911
  });
1903
- state.accumulatedContent = "";
1904
- state.decisionBuffer = "";
1912
+ state.accumulatedContent.clear();
1913
+ state.decisionBuffer.clear();
1905
1914
  state.currentContext = constants_1.TokenizerContextTypes.Data;
1906
- state.caretPosition++;
1915
+ state.sourceCode.next();
1907
1916
  }
1908
1917
  return commentContent;
1909
1918
  }
@@ -1916,76 +1925,79 @@ function requireData () {
1916
1925
  if (hasRequiredData) return data;
1917
1926
  hasRequiredData = 1;
1918
1927
  Object.defineProperty(data, "__esModule", { value: true });
1919
- data.handleContentEnd = data.parse = void 0;
1928
+ data.parse = parse;
1929
+ data.handleContentEnd = handleContentEnd;
1920
1930
  const constants_1 = requireConstants();
1921
1931
  const utils_1 = requireUtils();
1932
+ const create_templates_1 = requireCreateTemplates();
1922
1933
  const COMMENT_START = "<!--";
1923
1934
  const OPEN_TAG_START_PATTERN = /^<\w/;
1924
- function parse(chars, state, tokens) {
1925
- if (OPEN_TAG_START_PATTERN.test(chars)) {
1926
- return parseOpeningCornerBraceWithText(state, tokens);
1935
+ function parse(chars, state) {
1936
+ const value = chars.value();
1937
+ if (OPEN_TAG_START_PATTERN.test(value)) {
1938
+ return parseOpeningCornerBraceWithText(state);
1927
1939
  }
1928
- if (chars === "</") {
1929
- return parseOpeningCornerBraceWithSlash(state, tokens);
1940
+ if (value === "</") {
1941
+ return parseOpeningCornerBraceWithSlash(state);
1930
1942
  }
1931
- if (chars === "<" || chars === "<!" || chars === "<!-") {
1932
- state.caretPosition++;
1943
+ if (value === "<" || value === "<!" || value === "<!-") {
1944
+ state.sourceCode.next();
1933
1945
  return;
1934
1946
  }
1935
- if (chars === COMMENT_START) {
1936
- return parseCommentOpen(state, tokens);
1947
+ if (value === COMMENT_START) {
1948
+ return parseCommentOpen(state);
1937
1949
  }
1938
- if (isIncompleteDoctype(chars)) {
1939
- state.caretPosition++;
1950
+ if (isIncompleteDoctype(value)) {
1951
+ state.sourceCode.next();
1940
1952
  return;
1941
1953
  }
1942
- if (chars.toUpperCase() === "<!DOCTYPE") {
1943
- return parseDoctypeOpen(state, tokens);
1954
+ if (value.toUpperCase() === "<!DOCTYPE") {
1955
+ return parseDoctypeOpen(state);
1944
1956
  }
1945
- state.accumulatedContent += state.decisionBuffer;
1946
- state.decisionBuffer = "";
1947
- state.caretPosition++;
1957
+ state.accumulatedContent.concatBuffer(state.decisionBuffer);
1958
+ state.decisionBuffer.clear();
1959
+ state.sourceCode.next();
1948
1960
  }
1949
- data.parse = parse;
1950
- function handleContentEnd(state, tokens) {
1951
- const textContent = state.accumulatedContent + state.decisionBuffer;
1961
+ function handleContentEnd(state) {
1962
+ const textContent = state.accumulatedContent.value() + state.decisionBuffer.value();
1952
1963
  if (textContent.length !== 0) {
1953
1964
  const position = (0, utils_1.calculateTokenPosition)(state, { keepBuffer: false });
1954
- tokens.push({
1965
+ state.tokens.push({
1955
1966
  type: constants_1.TokenTypes.Text,
1956
1967
  value: textContent,
1957
1968
  range: position.range,
1958
1969
  loc: position.loc,
1970
+ templates: (0, create_templates_1.createTemplates)(state, constants_1.TokenTypes.Text),
1959
1971
  });
1960
1972
  }
1961
1973
  }
1962
- data.handleContentEnd = handleContentEnd;
1963
1974
  function generateTextToken(state) {
1964
1975
  const position = (0, utils_1.calculateTokenPosition)(state, { keepBuffer: false });
1965
1976
  return {
1966
1977
  type: constants_1.TokenTypes.Text,
1967
- value: state.accumulatedContent,
1978
+ value: state.accumulatedContent.value(),
1968
1979
  range: position.range,
1969
1980
  loc: position.loc,
1981
+ templates: (0, create_templates_1.createTemplates)(state, constants_1.TokenTypes.Text),
1970
1982
  };
1971
1983
  }
1972
- function parseOpeningCornerBraceWithText(state, tokens) {
1973
- if (state.accumulatedContent.length !== 0) {
1974
- tokens.push(generateTextToken(state));
1984
+ function parseOpeningCornerBraceWithText(state) {
1985
+ if (state.accumulatedContent.length() !== 0) {
1986
+ state.tokens.push(generateTextToken(state));
1975
1987
  }
1976
- state.accumulatedContent = state.decisionBuffer;
1977
- state.decisionBuffer = "";
1988
+ state.accumulatedContent.replace(state.decisionBuffer);
1989
+ state.decisionBuffer.clear();
1978
1990
  state.currentContext = constants_1.TokenizerContextTypes.OpenTagStart;
1979
- state.caretPosition++;
1991
+ state.sourceCode.next();
1980
1992
  }
1981
- function parseOpeningCornerBraceWithSlash(state, tokens) {
1982
- if (state.accumulatedContent.length !== 0) {
1983
- tokens.push(generateTextToken(state));
1993
+ function parseOpeningCornerBraceWithSlash(state) {
1994
+ if (state.accumulatedContent.length() !== 0) {
1995
+ state.tokens.push(generateTextToken(state));
1984
1996
  }
1985
- state.accumulatedContent = state.decisionBuffer;
1986
- state.decisionBuffer = "";
1997
+ state.accumulatedContent.replace(state.decisionBuffer);
1998
+ state.decisionBuffer.clear();
1987
1999
  state.currentContext = constants_1.TokenizerContextTypes.CloseTag;
1988
- state.caretPosition++;
2000
+ state.sourceCode.next();
1989
2001
  }
1990
2002
  function isIncompleteDoctype(chars) {
1991
2003
  const charsUpperCase = chars.toUpperCase();
@@ -1997,34 +2009,33 @@ function requireData () {
1997
2009
  charsUpperCase === "<!DOCTY" ||
1998
2010
  charsUpperCase === "<!DOCTYP");
1999
2011
  }
2000
- function parseCommentOpen(state, tokens) {
2001
- if (state.accumulatedContent.length !== 0) {
2002
- tokens.push(generateTextToken(state));
2012
+ function parseCommentOpen(state) {
2013
+ if (state.accumulatedContent.length() !== 0) {
2014
+ state.tokens.push(generateTextToken(state));
2003
2015
  }
2004
2016
  const range = [
2005
- state.caretPosition - (COMMENT_START.length - 1),
2006
- state.caretPosition + 1,
2017
+ state.sourceCode.index() - (COMMENT_START.length - 1),
2018
+ state.sourceCode.index() + 1,
2007
2019
  ];
2008
- const loc = (0, utils_1.calculateTokenLocation)(state.source, range);
2009
- tokens.push({
2020
+ state.tokens.push({
2010
2021
  type: constants_1.TokenTypes.CommentOpen,
2011
- value: state.decisionBuffer,
2022
+ value: state.decisionBuffer.value(),
2012
2023
  range: range,
2013
- loc,
2024
+ loc: state.sourceCode.getLocationOf(range),
2014
2025
  });
2015
- state.accumulatedContent = "";
2016
- state.decisionBuffer = "";
2026
+ state.accumulatedContent.clear();
2027
+ state.decisionBuffer.clear();
2017
2028
  state.currentContext = constants_1.TokenizerContextTypes.CommentContent;
2018
- state.caretPosition++;
2029
+ state.sourceCode.next();
2019
2030
  }
2020
- function parseDoctypeOpen(state, tokens) {
2021
- if (state.accumulatedContent.length !== 0) {
2022
- tokens.push(generateTextToken(state));
2031
+ function parseDoctypeOpen(state) {
2032
+ if (state.accumulatedContent.length() !== 0) {
2033
+ state.tokens.push(generateTextToken(state));
2023
2034
  }
2024
- state.accumulatedContent = state.decisionBuffer;
2025
- state.decisionBuffer = "";
2035
+ state.accumulatedContent.replace(state.decisionBuffer);
2036
+ state.decisionBuffer.clear();
2026
2037
  state.currentContext = constants_1.TokenizerContextTypes.DoctypeOpen;
2027
- state.caretPosition++;
2038
+ state.sourceCode.next();
2028
2039
  }
2029
2040
  return data;
2030
2041
  }
@@ -2037,28 +2048,27 @@ function requireDoctypeAttributeBare () {
2037
2048
  if (hasRequiredDoctypeAttributeBare) return doctypeAttributeBare;
2038
2049
  hasRequiredDoctypeAttributeBare = 1;
2039
2050
  Object.defineProperty(doctypeAttributeBare, "__esModule", { value: true });
2040
- doctypeAttributeBare.parse = void 0;
2051
+ doctypeAttributeBare.parse = parse;
2041
2052
  const constants_1 = requireConstants();
2042
2053
  const utils_1 = requireUtils();
2043
- function parse(chars, state, tokens) {
2044
- if ((0, utils_1.isWhitespace)(chars) || chars === ">") {
2045
- return parseAttributeEnd(state, tokens);
2054
+ function parse(chars, state) {
2055
+ if ((0, utils_1.isWhitespace)(chars.value()) || chars.value() === ">") {
2056
+ return parseAttributeEnd(state);
2046
2057
  }
2047
- state.accumulatedContent += state.decisionBuffer;
2048
- state.decisionBuffer = "";
2049
- state.caretPosition++;
2058
+ state.accumulatedContent.concatBuffer(state.decisionBuffer);
2059
+ state.decisionBuffer.clear();
2060
+ state.sourceCode.next();
2050
2061
  }
2051
- doctypeAttributeBare.parse = parse;
2052
- function parseAttributeEnd(state, tokens) {
2062
+ function parseAttributeEnd(state) {
2053
2063
  const position = (0, utils_1.calculateTokenPosition)(state, { keepBuffer: false });
2054
- tokens.push({
2064
+ state.tokens.push({
2055
2065
  type: constants_1.TokenTypes.DoctypeAttributeValue,
2056
- value: state.accumulatedContent,
2066
+ value: state.accumulatedContent.value(),
2057
2067
  range: position.range,
2058
2068
  loc: position.loc,
2059
2069
  });
2060
- state.accumulatedContent = "";
2061
- state.decisionBuffer = "";
2070
+ state.accumulatedContent.clear();
2071
+ state.decisionBuffer.clear();
2062
2072
  state.currentContext = constants_1.TokenizerContextTypes.DoctypeAttributes;
2063
2073
  }
2064
2074
  return doctypeAttributeBare;
@@ -2072,41 +2082,39 @@ function requireDoctypeAttributeWrapped () {
2072
2082
  if (hasRequiredDoctypeAttributeWrapped) return doctypeAttributeWrapped;
2073
2083
  hasRequiredDoctypeAttributeWrapped = 1;
2074
2084
  Object.defineProperty(doctypeAttributeWrapped, "__esModule", { value: true });
2075
- doctypeAttributeWrapped.parse = void 0;
2085
+ doctypeAttributeWrapped.parse = parse;
2076
2086
  const constants_1 = requireConstants();
2077
2087
  const utils_1 = requireUtils();
2078
- function parse(chars, state, tokens) {
2088
+ function parse(chars, state) {
2079
2089
  var _a;
2080
2090
  const wrapperChar = (_a = state.contextParams[constants_1.TokenizerContextTypes.DoctypeAttributeWrapped]) === null || _a === void 0 ? void 0 : _a.wrapper;
2081
- if (chars === wrapperChar) {
2082
- return parseWrapper(state, tokens);
2091
+ if (chars.value() === wrapperChar) {
2092
+ return parseWrapper(state);
2083
2093
  }
2084
- state.accumulatedContent += state.decisionBuffer;
2085
- state.decisionBuffer = "";
2086
- state.caretPosition++;
2094
+ state.accumulatedContent.concatBuffer(state.decisionBuffer);
2095
+ state.decisionBuffer.clear();
2096
+ state.sourceCode.next();
2087
2097
  }
2088
- doctypeAttributeWrapped.parse = parse;
2089
- function parseWrapper(state, tokens) {
2098
+ function parseWrapper(state) {
2090
2099
  const position = (0, utils_1.calculateTokenPosition)(state, { keepBuffer: false });
2091
2100
  const endWrapperPosition = position.range[1];
2092
- tokens.push({
2101
+ state.tokens.push({
2093
2102
  type: constants_1.TokenTypes.DoctypeAttributeValue,
2094
- value: state.accumulatedContent,
2103
+ value: state.accumulatedContent.value(),
2095
2104
  range: position.range,
2096
2105
  loc: position.loc,
2097
2106
  });
2098
2107
  const range = [endWrapperPosition, endWrapperPosition + 1];
2099
- const loc = (0, utils_1.calculateTokenLocation)(state.source, range);
2100
- tokens.push({
2108
+ state.tokens.push({
2101
2109
  type: constants_1.TokenTypes.DoctypeAttributeWrapperEnd,
2102
- value: state.decisionBuffer,
2110
+ value: state.decisionBuffer.value(),
2103
2111
  range,
2104
- loc,
2112
+ loc: state.sourceCode.getLocationOf(range),
2105
2113
  });
2106
- state.accumulatedContent = "";
2107
- state.decisionBuffer = "";
2114
+ state.accumulatedContent.clear();
2115
+ state.decisionBuffer.clear();
2108
2116
  state.currentContext = constants_1.TokenizerContextTypes.DoctypeAttributes;
2109
- state.caretPosition++;
2117
+ state.sourceCode.next();
2110
2118
  state.contextParams[constants_1.TokenizerContextTypes.DoctypeAttributeWrapped] =
2111
2119
  undefined;
2112
2120
  }
@@ -2121,53 +2129,51 @@ function requireDoctypeAttributes () {
2121
2129
  if (hasRequiredDoctypeAttributes) return doctypeAttributes;
2122
2130
  hasRequiredDoctypeAttributes = 1;
2123
2131
  Object.defineProperty(doctypeAttributes, "__esModule", { value: true });
2124
- doctypeAttributes.parse = void 0;
2132
+ doctypeAttributes.parse = parse;
2125
2133
  const constants_1 = requireConstants();
2126
2134
  const utils_1 = requireUtils();
2127
- function parse(chars, state, tokens) {
2128
- if (chars === '"' || chars === "'") {
2129
- return parseWrapper(state, tokens);
2135
+ function parse(chars, state) {
2136
+ if (chars.value() === '"' || chars.value() === "'") {
2137
+ return parseWrapper(state);
2130
2138
  }
2131
- if (chars === ">") {
2139
+ if (chars.value() === ">") {
2132
2140
  return parseClosingCornerBrace(state);
2133
2141
  }
2134
- if (!(0, utils_1.isWhitespace)(chars)) {
2142
+ if (!(0, utils_1.isWhitespace)(chars.value())) {
2135
2143
  return parseBare(state);
2136
2144
  }
2137
- state.decisionBuffer = "";
2138
- state.caretPosition++;
2145
+ state.decisionBuffer.clear();
2146
+ state.sourceCode.next();
2139
2147
  }
2140
- doctypeAttributes.parse = parse;
2141
- function parseWrapper(state, tokens) {
2142
- const wrapper = state.decisionBuffer;
2148
+ function parseWrapper(state) {
2149
+ const wrapper = state.decisionBuffer.value();
2143
2150
  const range = [
2144
- state.caretPosition,
2145
- state.caretPosition + wrapper.length,
2151
+ state.sourceCode.index(),
2152
+ state.sourceCode.index() + wrapper.length,
2146
2153
  ];
2147
- const loc = (0, utils_1.calculateTokenLocation)(state.source, range);
2148
- tokens.push({
2154
+ state.tokens.push({
2149
2155
  type: constants_1.TokenTypes.DoctypeAttributeWrapperStart,
2150
2156
  value: wrapper,
2151
2157
  range,
2152
- loc,
2158
+ loc: state.sourceCode.getLocationOf(range),
2153
2159
  });
2154
- state.accumulatedContent = "";
2155
- state.decisionBuffer = "";
2160
+ state.accumulatedContent.clear();
2161
+ state.decisionBuffer.clear();
2156
2162
  state.currentContext = constants_1.TokenizerContextTypes.DoctypeAttributeWrapped;
2157
2163
  state.contextParams[constants_1.TokenizerContextTypes.DoctypeAttributeWrapped] = {
2158
- wrapper,
2164
+ wrapper: wrapper,
2159
2165
  };
2160
- state.caretPosition++;
2166
+ state.sourceCode.next();
2161
2167
  }
2162
2168
  function parseBare(state) {
2163
- state.accumulatedContent = state.decisionBuffer;
2164
- state.decisionBuffer = "";
2169
+ state.accumulatedContent.replace(state.decisionBuffer);
2170
+ state.decisionBuffer.clear();
2165
2171
  state.currentContext = constants_1.TokenizerContextTypes.DoctypeAttributeBare;
2166
- state.caretPosition++;
2172
+ state.sourceCode.next();
2167
2173
  }
2168
2174
  function parseClosingCornerBrace(state) {
2169
- state.accumulatedContent = "";
2170
- state.decisionBuffer = "";
2175
+ state.accumulatedContent.clear();
2176
+ state.decisionBuffer.clear();
2171
2177
  state.currentContext = constants_1.TokenizerContextTypes.DoctypeClose;
2172
2178
  }
2173
2179
  return doctypeAttributes;
@@ -2181,23 +2187,22 @@ function requireDoctypeEnd () {
2181
2187
  if (hasRequiredDoctypeEnd) return doctypeEnd;
2182
2188
  hasRequiredDoctypeEnd = 1;
2183
2189
  Object.defineProperty(doctypeEnd, "__esModule", { value: true });
2184
- doctypeEnd.parse = void 0;
2190
+ doctypeEnd.parse = parse;
2185
2191
  const constants_1 = requireConstants();
2186
2192
  const utils_1 = requireUtils();
2187
- function parse(chars, state, tokens) {
2193
+ function parse(chars, state) {
2188
2194
  const position = (0, utils_1.calculateTokenPosition)(state, { keepBuffer: true });
2189
- tokens.push({
2195
+ state.tokens.push({
2190
2196
  type: constants_1.TokenTypes.DoctypeClose,
2191
- value: state.decisionBuffer,
2197
+ value: state.decisionBuffer.value(),
2192
2198
  range: position.range,
2193
2199
  loc: position.loc,
2194
2200
  });
2195
- state.accumulatedContent = "";
2196
- state.decisionBuffer = "";
2201
+ state.accumulatedContent.clear();
2202
+ state.decisionBuffer.clear();
2197
2203
  state.currentContext = constants_1.TokenizerContextTypes.Data;
2198
- state.caretPosition++;
2204
+ state.sourceCode.next();
2199
2205
  }
2200
- doctypeEnd.parse = parse;
2201
2206
  return doctypeEnd;
2202
2207
  }
2203
2208
 
@@ -2209,39 +2214,39 @@ function requireDoctypeStart () {
2209
2214
  if (hasRequiredDoctypeStart) return doctypeStart;
2210
2215
  hasRequiredDoctypeStart = 1;
2211
2216
  Object.defineProperty(doctypeStart, "__esModule", { value: true });
2212
- doctypeStart.parse = void 0;
2217
+ doctypeStart.parse = parse;
2213
2218
  const constants_1 = requireConstants();
2214
2219
  const utils_1 = requireUtils();
2215
- function parse(chars, state, tokens) {
2216
- if ((0, utils_1.isWhitespace)(chars)) {
2217
- return parseWhitespace(state, tokens);
2220
+ function parse(chars, state) {
2221
+ const value = chars.value();
2222
+ if ((0, utils_1.isWhitespace)(value)) {
2223
+ return parseWhitespace(state);
2218
2224
  }
2219
- if (chars === ">") {
2220
- return parseClosingCornerBrace(state, tokens);
2225
+ if (value === ">") {
2226
+ return parseClosingCornerBrace(state);
2221
2227
  }
2222
- state.decisionBuffer = "";
2223
- state.caretPosition++;
2228
+ state.decisionBuffer.clear();
2229
+ state.sourceCode.next();
2224
2230
  }
2225
- doctypeStart.parse = parse;
2226
2231
  function generateDoctypeOpenToken(state) {
2227
2232
  const position = (0, utils_1.calculateTokenPosition)(state, { keepBuffer: false });
2228
2233
  return {
2229
2234
  type: constants_1.TokenTypes.DoctypeOpen,
2230
- value: state.accumulatedContent,
2235
+ value: state.accumulatedContent.value(),
2231
2236
  range: position.range,
2232
2237
  loc: position.loc,
2233
2238
  };
2234
2239
  }
2235
- function parseWhitespace(state, tokens) {
2236
- tokens.push(generateDoctypeOpenToken(state));
2237
- state.accumulatedContent = "";
2238
- state.decisionBuffer = "";
2240
+ function parseWhitespace(state) {
2241
+ state.tokens.push(generateDoctypeOpenToken(state));
2242
+ state.accumulatedContent.clear();
2243
+ state.decisionBuffer.clear();
2239
2244
  state.currentContext = constants_1.TokenizerContextTypes.DoctypeAttributes;
2240
2245
  }
2241
- function parseClosingCornerBrace(state, tokens) {
2242
- tokens.push(generateDoctypeOpenToken(state));
2243
- state.accumulatedContent = "";
2244
- state.decisionBuffer = "";
2246
+ function parseClosingCornerBrace(state) {
2247
+ state.tokens.push(generateDoctypeOpenToken(state));
2248
+ state.accumulatedContent.clear();
2249
+ state.decisionBuffer.clear();
2245
2250
  state.currentContext = constants_1.TokenizerContextTypes.DoctypeClose;
2246
2251
  }
2247
2252
  return doctypeStart;
@@ -2255,7 +2260,7 @@ function requireOpenTagEnd () {
2255
2260
  if (hasRequiredOpenTagEnd) return openTagEnd;
2256
2261
  hasRequiredOpenTagEnd = 1;
2257
2262
  Object.defineProperty(openTagEnd, "__esModule", { value: true });
2258
- openTagEnd.parse = void 0;
2263
+ openTagEnd.parse = parse;
2259
2264
  const constants_1 = requireConstants();
2260
2265
  const utils_1 = requireUtils();
2261
2266
  const tokensMap = {
@@ -2268,30 +2273,29 @@ function requireOpenTagEnd () {
2268
2273
  style: constants_1.TokenizerContextTypes.StyleContent,
2269
2274
  default: constants_1.TokenizerContextTypes.Data,
2270
2275
  };
2271
- function parse(chars, state, tokens) {
2272
- if (chars === ">") {
2273
- return parseClosingCornerBrace(state, tokens);
2276
+ function parse(chars, state) {
2277
+ if (chars.value() === ">") {
2278
+ return parseClosingCornerBrace(state);
2274
2279
  }
2275
- state.accumulatedContent += state.decisionBuffer;
2276
- state.decisionBuffer = "";
2277
- state.caretPosition++;
2280
+ state.accumulatedContent.concatBuffer(state.decisionBuffer);
2281
+ state.decisionBuffer.clear();
2282
+ state.sourceCode.next();
2278
2283
  }
2279
- openTagEnd.parse = parse;
2280
- function parseClosingCornerBrace(state, tokens) {
2284
+ function parseClosingCornerBrace(state) {
2281
2285
  var _a;
2282
2286
  const position = (0, utils_1.calculateTokenPosition)(state, { keepBuffer: true });
2283
2287
  const tagName = (_a = state.contextParams[constants_1.TokenizerContextTypes.OpenTagEnd]) === null || _a === void 0 ? void 0 : _a.tagName;
2284
- tokens.push({
2288
+ state.tokens.push({
2285
2289
  type: tokensMap[tagName] || tokensMap.default,
2286
- value: state.accumulatedContent + state.decisionBuffer,
2290
+ value: state.accumulatedContent.value() + state.decisionBuffer.value(),
2287
2291
  range: position.range,
2288
2292
  loc: position.loc,
2289
2293
  });
2290
- state.accumulatedContent = "";
2291
- state.decisionBuffer = "";
2294
+ state.accumulatedContent.clear();
2295
+ state.decisionBuffer.clear();
2292
2296
  state.currentContext =
2293
2297
  contextsMap[tagName || "default"] || contextsMap["default"];
2294
- state.caretPosition++;
2298
+ state.sourceCode.next();
2295
2299
  state.contextParams[constants_1.TokenizerContextTypes.OpenTagEnd] = undefined;
2296
2300
  }
2297
2301
  return openTagEnd;
@@ -2305,7 +2309,7 @@ function requireOpenTagStart () {
2305
2309
  if (hasRequiredOpenTagStart) return openTagStart;
2306
2310
  hasRequiredOpenTagStart = 1;
2307
2311
  Object.defineProperty(openTagStart, "__esModule", { value: true });
2308
- openTagStart.parse = void 0;
2312
+ openTagStart.parse = parse;
2309
2313
  const constants_1 = requireConstants();
2310
2314
  const utils_1 = requireUtils();
2311
2315
  const tokensMap = {
@@ -2313,44 +2317,43 @@ function requireOpenTagStart () {
2313
2317
  style: constants_1.TokenTypes.OpenStyleTagStart,
2314
2318
  default: constants_1.TokenTypes.OpenTagStart,
2315
2319
  };
2316
- function parse(chars, state, tokens) {
2317
- if (chars === ">" || chars === "/") {
2318
- return parseTagEnd(state, tokens);
2320
+ function parse(chars, state) {
2321
+ if (chars.value() === ">" || chars.value() === "/") {
2322
+ return parseTagEnd(state);
2319
2323
  }
2320
- if ((0, utils_1.isWhitespace)(chars)) {
2321
- return parseWhitespace(state, tokens);
2324
+ if ((0, utils_1.isWhitespace)(chars.value())) {
2325
+ return parseWhitespace(state);
2322
2326
  }
2323
- state.accumulatedContent += state.decisionBuffer;
2324
- state.decisionBuffer = "";
2325
- state.caretPosition++;
2327
+ state.accumulatedContent.concatBuffer(state.decisionBuffer);
2328
+ state.decisionBuffer.clear();
2329
+ state.sourceCode.next();
2326
2330
  }
2327
- openTagStart.parse = parse;
2328
- function parseWhitespace(state, tokens) {
2329
- const tagName = (0, utils_1.parseOpenTagName)(state.accumulatedContent);
2331
+ function parseWhitespace(state) {
2332
+ const tagName = (0, utils_1.parseOpenTagName)(state.accumulatedContent.value());
2330
2333
  const position = (0, utils_1.calculateTokenPosition)(state, { keepBuffer: false });
2331
- tokens.push({
2334
+ state.tokens.push({
2332
2335
  type: tokensMap[tagName] || tokensMap.default,
2333
- value: state.accumulatedContent,
2336
+ value: state.accumulatedContent.value(),
2334
2337
  range: position.range,
2335
2338
  loc: position.loc,
2336
2339
  });
2337
- state.accumulatedContent = "";
2338
- state.decisionBuffer = "";
2340
+ state.accumulatedContent.clear();
2341
+ state.decisionBuffer.clear();
2339
2342
  state.currentContext = constants_1.TokenizerContextTypes.Attributes;
2340
2343
  state.contextParams[constants_1.TokenizerContextTypes.Attributes] = { tagName };
2341
- state.caretPosition++;
2344
+ state.sourceCode.next();
2342
2345
  }
2343
- function parseTagEnd(state, tokens) {
2344
- const tagName = (0, utils_1.parseOpenTagName)(state.accumulatedContent);
2346
+ function parseTagEnd(state) {
2347
+ const tagName = (0, utils_1.parseOpenTagName)(state.accumulatedContent.value());
2345
2348
  const position = (0, utils_1.calculateTokenPosition)(state, { keepBuffer: false });
2346
- tokens.push({
2349
+ state.tokens.push({
2347
2350
  type: tokensMap[tagName] || tokensMap.default,
2348
- value: state.accumulatedContent,
2351
+ value: state.accumulatedContent.value(),
2349
2352
  range: position.range,
2350
2353
  loc: position.loc,
2351
2354
  });
2352
- state.decisionBuffer = "";
2353
- state.accumulatedContent = "";
2355
+ state.decisionBuffer.clear();
2356
+ state.accumulatedContent.clear();
2354
2357
  state.currentContext = constants_1.TokenizerContextTypes.OpenTagEnd;
2355
2358
  state.contextParams[constants_1.TokenizerContextTypes.OpenTagEnd] = { tagName };
2356
2359
  }
@@ -2365,49 +2368,49 @@ function requireScriptTagContent () {
2365
2368
  if (hasRequiredScriptTagContent) return scriptTagContent;
2366
2369
  hasRequiredScriptTagContent = 1;
2367
2370
  Object.defineProperty(scriptTagContent, "__esModule", { value: true });
2368
- scriptTagContent.parse = void 0;
2371
+ scriptTagContent.parse = parse;
2369
2372
  const constants_1 = requireConstants();
2370
2373
  const utils_1 = requireUtils();
2371
- function parse(chars, state, tokens) {
2372
- if (chars === "<" ||
2373
- chars === "</" ||
2374
- constants_1.INCOMPLETE_CLOSING_TAG_PATTERN.test(chars)) {
2375
- state.caretPosition++;
2374
+ const create_templates_1 = requireCreateTemplates();
2375
+ function parse(chars, state) {
2376
+ if (chars.value() === "<" ||
2377
+ chars.value() === "</" ||
2378
+ constants_1.INCOMPLETE_CLOSING_TAG_PATTERN.test(chars.value())) {
2379
+ state.sourceCode.next();
2376
2380
  return;
2377
2381
  }
2378
- if (constants_1.CLOSING_SCRIPT_TAG_PATTERN.test(chars)) {
2379
- return parseClosingScriptTag(state, tokens);
2382
+ if (constants_1.CLOSING_SCRIPT_TAG_PATTERN.test(chars.value())) {
2383
+ return parseClosingScriptTag(state);
2380
2384
  }
2381
- state.accumulatedContent += state.decisionBuffer;
2382
- state.decisionBuffer = "";
2383
- state.caretPosition++;
2385
+ state.accumulatedContent.concatBuffer(state.decisionBuffer);
2386
+ state.decisionBuffer.clear();
2387
+ state.sourceCode.next();
2384
2388
  }
2385
- scriptTagContent.parse = parse;
2386
- function parseClosingScriptTag(state, tokens) {
2387
- if (state.accumulatedContent !== "") {
2389
+ function parseClosingScriptTag(state) {
2390
+ if (state.accumulatedContent.value() !== "") {
2388
2391
  const position = (0, utils_1.calculateTokenPosition)(state, { keepBuffer: false });
2389
- tokens.push({
2392
+ state.tokens.push({
2390
2393
  type: constants_1.TokenTypes.ScriptTagContent,
2391
- value: state.accumulatedContent,
2394
+ value: state.accumulatedContent.value(),
2392
2395
  range: position.range,
2393
2396
  loc: position.loc,
2397
+ templates: (0, create_templates_1.createTemplates)(state, constants_1.TokenTypes.ScriptTagContent),
2394
2398
  });
2395
2399
  }
2396
2400
  const range = [
2397
- state.caretPosition - (state.decisionBuffer.length - 1),
2398
- state.caretPosition + 1,
2401
+ state.sourceCode.index() - (state.decisionBuffer.length() - 1),
2402
+ state.sourceCode.index() + 1,
2399
2403
  ];
2400
- const loc = (0, utils_1.calculateTokenLocation)(state.source, range);
2401
- tokens.push({
2404
+ state.tokens.push({
2402
2405
  type: constants_1.TokenTypes.CloseScriptTag,
2403
- value: state.decisionBuffer,
2406
+ value: state.decisionBuffer.value(),
2404
2407
  range,
2405
- loc,
2408
+ loc: state.sourceCode.getLocationOf(range),
2406
2409
  });
2407
- state.accumulatedContent = "";
2408
- state.decisionBuffer = "";
2410
+ state.accumulatedContent.clear();
2411
+ state.decisionBuffer.clear();
2409
2412
  state.currentContext = constants_1.TokenizerContextTypes.Data;
2410
- state.caretPosition++;
2413
+ state.sourceCode.next();
2411
2414
  }
2412
2415
  return scriptTagContent;
2413
2416
  }
@@ -2420,50 +2423,50 @@ function requireStyleTagContent () {
2420
2423
  if (hasRequiredStyleTagContent) return styleTagContent;
2421
2424
  hasRequiredStyleTagContent = 1;
2422
2425
  Object.defineProperty(styleTagContent, "__esModule", { value: true });
2423
- styleTagContent.parse = void 0;
2426
+ styleTagContent.parse = parse;
2424
2427
  const constants_1 = requireConstants();
2425
2428
  const utils_1 = requireUtils();
2429
+ const create_templates_1 = requireCreateTemplates();
2426
2430
  const CLOSING_STYLE_TAG_PATTERN = /<\/style\s*>/i;
2427
- function parse(chars, state, tokens) {
2428
- if (chars === "<" ||
2429
- chars === "</" ||
2430
- constants_1.INCOMPLETE_CLOSING_TAG_PATTERN.test(chars)) {
2431
- state.caretPosition++;
2431
+ function parse(chars, state) {
2432
+ if (chars.value() === "<" ||
2433
+ chars.value() === "</" ||
2434
+ constants_1.INCOMPLETE_CLOSING_TAG_PATTERN.test(chars.value())) {
2435
+ state.sourceCode.next();
2432
2436
  return;
2433
2437
  }
2434
- if (CLOSING_STYLE_TAG_PATTERN.test(chars)) {
2435
- return parseClosingStyleTag(state, tokens);
2438
+ if (CLOSING_STYLE_TAG_PATTERN.test(chars.value())) {
2439
+ return parseClosingStyleTag(state);
2436
2440
  }
2437
- state.accumulatedContent += state.decisionBuffer;
2438
- state.decisionBuffer = "";
2439
- state.caretPosition++;
2441
+ state.accumulatedContent.concatBuffer(state.decisionBuffer);
2442
+ state.decisionBuffer.clear();
2443
+ state.sourceCode.next();
2440
2444
  }
2441
- styleTagContent.parse = parse;
2442
- function parseClosingStyleTag(state, tokens) {
2443
- if (state.accumulatedContent !== "") {
2445
+ function parseClosingStyleTag(state) {
2446
+ if (state.accumulatedContent.value() !== "") {
2444
2447
  const position = (0, utils_1.calculateTokenPosition)(state, { keepBuffer: false });
2445
- tokens.push({
2448
+ state.tokens.push({
2446
2449
  type: constants_1.TokenTypes.StyleTagContent,
2447
- value: state.accumulatedContent,
2450
+ value: state.accumulatedContent.value(),
2448
2451
  range: position.range,
2449
2452
  loc: position.loc,
2453
+ templates: (0, create_templates_1.createTemplates)(state, constants_1.TokenTypes.StyleTagContent),
2450
2454
  });
2451
2455
  }
2452
2456
  const range = [
2453
- state.caretPosition - (state.decisionBuffer.length - 1),
2454
- state.caretPosition + 1,
2457
+ state.sourceCode.index() - (state.decisionBuffer.length() - 1),
2458
+ state.sourceCode.index() + 1,
2455
2459
  ];
2456
- const loc = (0, utils_1.calculateTokenLocation)(state.source, range);
2457
- tokens.push({
2460
+ state.tokens.push({
2458
2461
  type: constants_1.TokenTypes.CloseStyleTag,
2459
- value: state.decisionBuffer,
2462
+ value: state.decisionBuffer.value(),
2460
2463
  range,
2461
- loc,
2464
+ loc: state.sourceCode.getLocationOf(range),
2462
2465
  });
2463
- state.accumulatedContent = "";
2464
- state.decisionBuffer = "";
2466
+ state.accumulatedContent.clear();
2467
+ state.decisionBuffer.clear();
2465
2468
  state.currentContext = constants_1.TokenizerContextTypes.Data;
2466
- state.caretPosition++;
2469
+ state.sourceCode.next();
2467
2470
  }
2468
2471
  return styleTagContent;
2469
2472
  }
@@ -2521,15 +2524,180 @@ function requireHandlers () {
2521
2524
  return handlers;
2522
2525
  }
2523
2526
 
2527
+ var sourceCode = {};
2528
+
2529
+ var chars = {};
2530
+
2531
+ var hasRequiredChars;
2532
+
2533
+ function requireChars () {
2534
+ if (hasRequiredChars) return chars;
2535
+ hasRequiredChars = 1;
2536
+ Object.defineProperty(chars, "__esModule", { value: true });
2537
+ chars.Chars = void 0;
2538
+ class Chars {
2539
+ constructor(value, range, isTemplate) {
2540
+ this.value = value;
2541
+ this.range = range;
2542
+ this.isTemplate = isTemplate;
2543
+ }
2544
+ concat(chars) {
2545
+ this.value += chars.value;
2546
+ this.range[1] = chars.range[1];
2547
+ }
2548
+ equals(chars) {
2549
+ return this.value === chars;
2550
+ }
2551
+ length() {
2552
+ return this.value.length;
2553
+ }
2554
+ }
2555
+ chars.Chars = Chars;
2556
+ return chars;
2557
+ }
2558
+
2559
+ var hasRequiredSourceCode;
2560
+
2561
+ function requireSourceCode () {
2562
+ if (hasRequiredSourceCode) return sourceCode;
2563
+ hasRequiredSourceCode = 1;
2564
+ Object.defineProperty(sourceCode, "__esModule", { value: true });
2565
+ sourceCode.SourceCode = void 0;
2566
+ const utils_1 = requireUtils();
2567
+ const chars_1 = requireChars();
2568
+ class SourceCode {
2569
+ constructor(source, templateRanges) {
2570
+ this.source = source;
2571
+ this.charsIndex = 0;
2572
+ this.charsList = this.createCharsList(templateRanges);
2573
+ }
2574
+ getLocationOf(range) {
2575
+ return {
2576
+ start: (0, utils_1.getLineInfo)(this.source, range[0]),
2577
+ end: (0, utils_1.getLineInfo)(this.source, range[1]),
2578
+ };
2579
+ }
2580
+ current() {
2581
+ return this.charsList[this.charsIndex];
2582
+ }
2583
+ next() {
2584
+ this.charsIndex++;
2585
+ }
2586
+ prev() {
2587
+ this.charsIndex--;
2588
+ }
2589
+ isEof() {
2590
+ return this.charsIndex >= this.charsList.length;
2591
+ }
2592
+ index() {
2593
+ const current = this.current();
2594
+ return current.range[1] - 1;
2595
+ }
2596
+ createCharsList(templateRanges) {
2597
+ const charsList = [];
2598
+ let sourceIndex = 0;
2599
+ let templateRangeIndex = 0;
2600
+ while (sourceIndex < this.source.length) {
2601
+ const templateRange = templateRanges[templateRangeIndex];
2602
+ if (templateRange &&
2603
+ templateRange[0] <= sourceIndex &&
2604
+ sourceIndex < templateRange[1]) {
2605
+ charsList.push(new chars_1.Chars(this.source.slice(templateRange[0], templateRange[1]), [templateRange[0], templateRange[1]], true));
2606
+ templateRangeIndex++;
2607
+ sourceIndex = templateRange[1];
2608
+ continue;
2609
+ }
2610
+ charsList.push(new chars_1.Chars(this.source[sourceIndex], [sourceIndex, sourceIndex + 1], false));
2611
+ sourceIndex++;
2612
+ }
2613
+ return charsList;
2614
+ }
2615
+ }
2616
+ sourceCode.SourceCode = SourceCode;
2617
+ return sourceCode;
2618
+ }
2619
+
2620
+ var charsBuffer = {};
2621
+
2622
+ var hasRequiredCharsBuffer;
2623
+
2624
+ function requireCharsBuffer () {
2625
+ if (hasRequiredCharsBuffer) return charsBuffer;
2626
+ hasRequiredCharsBuffer = 1;
2627
+ Object.defineProperty(charsBuffer, "__esModule", { value: true });
2628
+ charsBuffer.CharsBuffer = void 0;
2629
+ class CharsBuffer {
2630
+ constructor() {
2631
+ this.charsBuffer = [];
2632
+ }
2633
+ concat(chars) {
2634
+ const last = this.last();
2635
+ if (!last || last.isTemplate || chars.isTemplate) {
2636
+ this.charsBuffer.push(chars);
2637
+ }
2638
+ else {
2639
+ last.concat(chars);
2640
+ }
2641
+ }
2642
+ concatBuffer(buffer) {
2643
+ const last = this.last();
2644
+ const first = buffer.first();
2645
+ if ((last === null || last === void 0 ? void 0 : last.isTemplate) === false && (first === null || first === void 0 ? void 0 : first.isTemplate) === false) {
2646
+ last.concat(first);
2647
+ this.charsBuffer.push(...buffer.charsBuffer.slice(1));
2648
+ return;
2649
+ }
2650
+ this.charsBuffer.push(...buffer.charsBuffer);
2651
+ }
2652
+ hasTemplate() {
2653
+ return this.charsBuffer.some((char) => char.isTemplate);
2654
+ }
2655
+ getTemplates() {
2656
+ return [...this.charsBuffer];
2657
+ }
2658
+ length() {
2659
+ return this.charsBuffer
2660
+ .map((chars) => chars.length())
2661
+ .reduce((a, b) => a + b, 0);
2662
+ }
2663
+ clear() {
2664
+ this.charsBuffer = [];
2665
+ }
2666
+ value() {
2667
+ const v = this.charsBuffer.map((chars) => chars.value).join("");
2668
+ return v;
2669
+ }
2670
+ last() {
2671
+ return this.charsBuffer[this.charsBuffer.length - 1];
2672
+ }
2673
+ first() {
2674
+ return this.charsBuffer[0];
2675
+ }
2676
+ removeLast() {
2677
+ this.charsBuffer.splice(this.charsBuffer.length - 1, 1);
2678
+ }
2679
+ removeFirst() {
2680
+ this.charsBuffer.splice(0, 1);
2681
+ }
2682
+ replace(other) {
2683
+ this.charsBuffer = [...other.charsBuffer];
2684
+ }
2685
+ }
2686
+ charsBuffer.CharsBuffer = CharsBuffer;
2687
+ return charsBuffer;
2688
+ }
2689
+
2524
2690
  var hasRequiredTokenize;
2525
2691
 
2526
2692
  function requireTokenize () {
2527
2693
  if (hasRequiredTokenize) return tokenize;
2528
2694
  hasRequiredTokenize = 1;
2529
2695
  Object.defineProperty(tokenize, "__esModule", { value: true });
2530
- tokenize.tokenize = void 0;
2696
+ tokenize.tokenize = tokenize$1;
2531
2697
  const constants_1 = requireConstants();
2532
2698
  const handlers_1 = requireHandlers();
2699
+ const source_code_1 = requireSourceCode();
2700
+ const chars_buffer_1 = requireCharsBuffer();
2533
2701
  const contextHandlers = {
2534
2702
  [constants_1.TokenizerContextTypes.Data]: handlers_1.data,
2535
2703
  [constants_1.TokenizerContextTypes.OpenTagStart]: handlers_1.openTagStart,
@@ -2551,48 +2719,38 @@ function requireTokenize () {
2551
2719
  [constants_1.TokenizerContextTypes.CommentOpen]: handlers_1.noop,
2552
2720
  [constants_1.TokenizerContextTypes.CommentClose]: handlers_1.noop,
2553
2721
  };
2554
- function tokenizeChars(chars, state, tokens, { isFinalChunk, positionOffset, }) {
2555
- let charIndex = state.caretPosition - positionOffset;
2556
- let charIndexBefore = charIndex;
2557
- while (charIndex < chars.length) {
2722
+ function tokenizeChars(state) {
2723
+ while (!state.sourceCode.isEof()) {
2558
2724
  const handler = contextHandlers[state.currentContext];
2559
- state.decisionBuffer += chars[charIndex];
2560
- if (charIndexBefore !== charIndex && chars[charIndex] === "\n") {
2561
- state.linePosition++;
2562
- }
2563
- charIndexBefore = charIndex;
2564
- handler.parse(state.decisionBuffer, state, tokens);
2565
- charIndex = state.caretPosition - positionOffset;
2725
+ state.decisionBuffer.concat(state.sourceCode.current());
2726
+ handler.parse(state.decisionBuffer, state);
2566
2727
  }
2567
- if (isFinalChunk) {
2568
- const handler = contextHandlers[state.currentContext];
2569
- state.caretPosition--;
2570
- if (handler.handleContentEnd !== undefined) {
2571
- handler.handleContentEnd(state, tokens);
2572
- }
2728
+ const handler = contextHandlers[state.currentContext];
2729
+ state.sourceCode.prev();
2730
+ if (handler.handleContentEnd !== undefined) {
2731
+ handler.handleContentEnd(state);
2573
2732
  }
2574
2733
  }
2575
- function tokenize$1(source = "", { isFinalChunk, } = {}) {
2576
- isFinalChunk = isFinalChunk === undefined ? true : isFinalChunk;
2734
+ function tokenize$1(source = "", tokenAdapter, templateRanges) {
2735
+ const tokens = [];
2577
2736
  const state = {
2578
2737
  currentContext: constants_1.TokenizerContextTypes.Data,
2579
2738
  contextParams: {},
2580
- decisionBuffer: "",
2581
- accumulatedContent: "",
2582
- caretPosition: 0,
2583
- linePosition: 1,
2584
- source,
2739
+ mode: templateRanges ? "template" : "default",
2740
+ templateRanges: templateRanges || [],
2741
+ decisionBuffer: new chars_buffer_1.CharsBuffer(),
2742
+ accumulatedContent: new chars_buffer_1.CharsBuffer(),
2743
+ tokenAdapter,
2744
+ sourceCode: new source_code_1.SourceCode(source, templateRanges || []),
2745
+ tokens: {
2746
+ push(token) {
2747
+ tokens.push(Object.assign(Object.assign({}, token), { range: tokenAdapter.finalizeRange(token), loc: tokenAdapter.finalizeLocation(token) }));
2748
+ },
2749
+ },
2585
2750
  };
2586
- const chars = state.decisionBuffer + source;
2587
- const tokens = [];
2588
- const positionOffset = state.caretPosition - state.decisionBuffer.length;
2589
- tokenizeChars(chars, state, tokens, {
2590
- isFinalChunk,
2591
- positionOffset,
2592
- });
2751
+ tokenizeChars(state);
2593
2752
  return { state, tokens };
2594
2753
  }
2595
- tokenize.tokenize = tokenize$1;
2596
2754
  return tokenize;
2597
2755
  }
2598
2756
 
@@ -2610,25 +2768,62 @@ function requireTokenizer () {
2610
2768
  return tokenizer;
2611
2769
  }
2612
2770
 
2771
+ var tokenAdapter = {};
2772
+
2773
+ var defaultTokenAdapter = {};
2774
+
2775
+ var hasRequiredDefaultTokenAdapter;
2776
+
2777
+ function requireDefaultTokenAdapter () {
2778
+ if (hasRequiredDefaultTokenAdapter) return defaultTokenAdapter;
2779
+ hasRequiredDefaultTokenAdapter = 1;
2780
+ Object.defineProperty(defaultTokenAdapter, "__esModule", { value: true });
2781
+ defaultTokenAdapter.defaultTokenAdapter = void 0;
2782
+ defaultTokenAdapter.defaultTokenAdapter = {
2783
+ finalizeRange(token) {
2784
+ return token.range;
2785
+ },
2786
+ finalizeLocation(token) {
2787
+ return token.loc;
2788
+ },
2789
+ };
2790
+ return defaultTokenAdapter;
2791
+ }
2792
+
2793
+ var hasRequiredTokenAdapter;
2794
+
2795
+ function requireTokenAdapter () {
2796
+ if (hasRequiredTokenAdapter) return tokenAdapter;
2797
+ hasRequiredTokenAdapter = 1;
2798
+ (function (exports) {
2799
+ Object.defineProperty(exports, "__esModule", { value: true });
2800
+ exports.defaultTokenAdapter = void 0;
2801
+ var default_token_adapter_1 = requireDefaultTokenAdapter();
2802
+ Object.defineProperty(exports, "defaultTokenAdapter", { enumerable: true, get: function () { return default_token_adapter_1.defaultTokenAdapter; } });
2803
+ } (tokenAdapter));
2804
+ return tokenAdapter;
2805
+ }
2806
+
2613
2807
  var hasRequiredParse;
2614
2808
 
2615
2809
  function requireParse () {
2616
2810
  if (hasRequiredParse) return parse;
2617
2811
  hasRequiredParse = 1;
2618
2812
  Object.defineProperty(parse, "__esModule", { value: true });
2619
- parse.parse = void 0;
2813
+ parse.parse = parse$1;
2620
2814
  const tree_constructor_1 = requireTreeConstructor();
2621
2815
  const tokenizer_1 = requireTokenizer();
2622
2816
  const utils_1 = requireUtils();
2623
- function parse$1(html) {
2624
- const { tokens } = (0, tokenizer_1.tokenize)(html, undefined);
2625
- const { ast } = (0, tree_constructor_1.constructTree)(tokens, undefined);
2817
+ const token_adapter_1 = requireTokenAdapter();
2818
+ function parse$1(html, options) {
2819
+ const tokenAdapter = (options && options.tokenAdapter) || token_adapter_1.defaultTokenAdapter;
2820
+ const { tokens } = (0, tokenizer_1.tokenize)(html, tokenAdapter, options === null || options === void 0 ? void 0 : options.templateRanges);
2821
+ const { ast } = (0, tree_constructor_1.constructTree)(tokens);
2626
2822
  return {
2627
2823
  ast: (0, utils_1.clearParent)(ast),
2628
2824
  tokens,
2629
2825
  };
2630
2826
  }
2631
- parse.parse = parse$1;
2632
2827
  return parse;
2633
2828
  }
2634
2829
 
@@ -2669,11 +2864,11 @@ function requireNode$1 () {
2669
2864
  return node$1;
2670
2865
  }
2671
2866
 
2672
- var hasRequiredDist$1;
2867
+ var hasRequiredDist;
2673
2868
 
2674
- function requireDist$1 () {
2675
- if (hasRequiredDist$1) return dist;
2676
- hasRequiredDist$1 = 1;
2869
+ function requireDist () {
2870
+ if (hasRequiredDist) return dist;
2871
+ hasRequiredDist = 1;
2677
2872
  (function (exports) {
2678
2873
  var __createBinding = (dist && dist.__createBinding) || (Object.create ? (function(o, m, k, k2) {
2679
2874
  if (k2 === undefined) k2 = k;
@@ -2701,161 +2896,280 @@ function requireDist$1 () {
2701
2896
  return dist;
2702
2897
  }
2703
2898
 
2704
- var visitorKeys = {};
2899
+ var nodeTypes;
2900
+ var hasRequiredNodeTypes;
2901
+
2902
+ function requireNodeTypes () {
2903
+ if (hasRequiredNodeTypes) return nodeTypes;
2904
+ hasRequiredNodeTypes = 1;
2905
+ const { NodeTypes } = requireDist();
2906
+
2907
+ const NODE_TYPES = NodeTypes;
2908
+
2909
+ nodeTypes = {
2910
+ NODE_TYPES,
2911
+ };
2912
+ return nodeTypes;
2913
+ }
2705
2914
 
2915
+ var visitorKeys_1;
2706
2916
  var hasRequiredVisitorKeys;
2707
2917
 
2708
2918
  function requireVisitorKeys () {
2709
- if (hasRequiredVisitorKeys) return visitorKeys;
2919
+ if (hasRequiredVisitorKeys) return visitorKeys_1;
2710
2920
  hasRequiredVisitorKeys = 1;
2711
- Object.defineProperty(visitorKeys, "__esModule", { value: true });
2712
- visitorKeys.visitorKeys = void 0;
2713
- const es_html_parser_1 = requireDist$1();
2714
- visitorKeys.visitorKeys = {
2715
- Program: ["body"],
2716
- [es_html_parser_1.NodeTypes.Attribute]: ["key", "startWrapper", "endWrapper", "value"],
2717
- [es_html_parser_1.NodeTypes.AttributeKey]: [],
2718
- [es_html_parser_1.NodeTypes.AttributeValue]: [],
2719
- [es_html_parser_1.NodeTypes.AttributeValueWrapperEnd]: [],
2720
- [es_html_parser_1.NodeTypes.AttributeValueWrapperStart]: [],
2721
- [es_html_parser_1.NodeTypes.CloseScriptTag]: [],
2722
- [es_html_parser_1.NodeTypes.CloseStyleTag]: [],
2723
- [es_html_parser_1.NodeTypes.CloseTag]: [],
2724
- [es_html_parser_1.NodeTypes.Comment]: ["open", "close", "value"],
2725
- [es_html_parser_1.NodeTypes.CommentContent]: [],
2726
- [es_html_parser_1.NodeTypes.CommentOpen]: [],
2727
- [es_html_parser_1.NodeTypes.CommentClose]: [],
2728
- [es_html_parser_1.NodeTypes.Doctype]: ["open", "close", "attributes"],
2729
- [es_html_parser_1.NodeTypes.DoctypeAttribute]: ["startWrapper", "value", "endWrapper"],
2730
- [es_html_parser_1.NodeTypes.DoctypeAttributeValue]: [],
2731
- [es_html_parser_1.NodeTypes.DoctypeAttributeWrapperEnd]: [],
2732
- [es_html_parser_1.NodeTypes.DoctypeAttributeWrapperStart]: [],
2733
- [es_html_parser_1.NodeTypes.DoctypeOpen]: [],
2734
- [es_html_parser_1.NodeTypes.DoctypeClose]: [],
2735
- [es_html_parser_1.NodeTypes.Document]: [],
2736
- [es_html_parser_1.NodeTypes.OpenScriptTagEnd]: [],
2737
- [es_html_parser_1.NodeTypes.OpenScriptTagStart]: [],
2738
- [es_html_parser_1.NodeTypes.OpenStyleTagEnd]: [],
2739
- [es_html_parser_1.NodeTypes.OpenStyleTagStart]: [],
2740
- [es_html_parser_1.NodeTypes.OpenTagEnd]: [],
2741
- [es_html_parser_1.NodeTypes.OpenTagStart]: [],
2742
- [es_html_parser_1.NodeTypes.ScriptTag]: [
2743
- "attributes",
2744
- "openStart",
2745
- "openEnd",
2746
- "close",
2747
- "value",
2748
- ],
2749
- [es_html_parser_1.NodeTypes.ScriptTagContent]: [],
2750
- [es_html_parser_1.NodeTypes.StyleTag]: [
2751
- "attributes",
2752
- "openStart",
2753
- "openEnd",
2754
- "close",
2755
- "value",
2756
- ],
2757
- [es_html_parser_1.NodeTypes.StyleTagContent]: [],
2758
- [es_html_parser_1.NodeTypes.Tag]: ["openStart", "openEnd", "close", "children", "attributes"],
2759
- [es_html_parser_1.NodeTypes.Text]: [],
2921
+ const { NODE_TYPES } = requireNodeTypes();
2922
+
2923
+ const visitorKeys = {
2924
+ Program: ["body"],
2925
+ [NODE_TYPES.Document]: ["children"],
2926
+ [NODE_TYPES.Attribute]: ["key", "startWrapper", "endWrapper", "value"],
2927
+ [NODE_TYPES.AttributeKey]: [],
2928
+ [NODE_TYPES.AttributeValue]: [],
2929
+ [NODE_TYPES.AttributeValueWrapperEnd]: [],
2930
+ [NODE_TYPES.AttributeValueWrapperStart]: [],
2931
+ [NODE_TYPES.CloseScriptTag]: [],
2932
+ [NODE_TYPES.CloseStyleTag]: [],
2933
+ [NODE_TYPES.CloseTag]: [],
2934
+ [NODE_TYPES.Comment]: ["open", "close", "value"],
2935
+ [NODE_TYPES.CommentContent]: [],
2936
+ [NODE_TYPES.CommentOpen]: [],
2937
+ [NODE_TYPES.CommentClose]: [],
2938
+ [NODE_TYPES.Doctype]: ["open", "close", "attributes"],
2939
+ [NODE_TYPES.DoctypeAttribute]: ["startWrapper", "value", "endWrapper"],
2940
+ [NODE_TYPES.DoctypeAttributeValue]: [],
2941
+ [NODE_TYPES.DoctypeAttributeWrapperEnd]: [],
2942
+ [NODE_TYPES.DoctypeAttributeWrapperStart]: [],
2943
+ [NODE_TYPES.DoctypeOpen]: [],
2944
+ [NODE_TYPES.DoctypeClose]: [],
2945
+ [NODE_TYPES.OpenScriptTagEnd]: [],
2946
+ [NODE_TYPES.OpenScriptTagStart]: [],
2947
+ [NODE_TYPES.OpenStyleTagEnd]: [],
2948
+ [NODE_TYPES.OpenStyleTagStart]: [],
2949
+ [NODE_TYPES.OpenTagEnd]: [],
2950
+ [NODE_TYPES.OpenTagStart]: [],
2951
+ [NODE_TYPES.ScriptTag]: [
2952
+ "attributes",
2953
+ "openStart",
2954
+ "openEnd",
2955
+ "close",
2956
+ "value",
2957
+ ],
2958
+ [NODE_TYPES.ScriptTagContent]: [],
2959
+ [NODE_TYPES.StyleTag]: [
2960
+ "attributes",
2961
+ "openStart",
2962
+ "openEnd",
2963
+ "close",
2964
+ "value",
2965
+ ],
2966
+ [NODE_TYPES.StyleTagContent]: [],
2967
+ [NODE_TYPES.Tag]: ["openStart", "openEnd", "close", "children", "attributes"],
2968
+ [NODE_TYPES.Text]: [],
2969
+ };
2970
+
2971
+ visitorKeys_1 = {
2972
+ visitorKeys,
2760
2973
  };
2761
-
2762
- return visitorKeys;
2974
+ return visitorKeys_1;
2763
2975
  }
2764
2976
 
2765
- var traverse = {};
2977
+ /**
2978
+ * @typedef {import("./types").AnyHTMLNode} AnyHTMLNode
2979
+ */
2766
2980
 
2981
+ var traverse_1;
2767
2982
  var hasRequiredTraverse;
2768
2983
 
2769
2984
  function requireTraverse () {
2770
- if (hasRequiredTraverse) return traverse;
2985
+ if (hasRequiredTraverse) return traverse_1;
2771
2986
  hasRequiredTraverse = 1;
2772
- Object.defineProperty(traverse, "__esModule", { value: true });
2773
- traverse.traverse = void 0;
2774
- const visitor_keys_1 = requireVisitorKeys();
2775
- function traverse$1(node, visitor) {
2776
- if (!node) {
2777
- return;
2778
- }
2779
- visitor(node);
2780
- const type = node.type;
2781
- const keys = visitor_keys_1.visitorKeys[type];
2782
- if (!keys || keys.length <= 0) {
2783
- return;
2987
+ const { visitorKeys } = requireVisitorKeys();
2988
+
2989
+ /**
2990
+ *
2991
+ * @param {AnyHTMLNode} node
2992
+ * @param {(arg: AnyHTMLNode) => void} visitor
2993
+ * @returns {void}
2994
+ */
2995
+ function traverse(node, visitor) {
2996
+ if (!node) {
2997
+ return;
2998
+ }
2999
+ visitor(node);
3000
+ const type = node.type;
3001
+ const keys = visitorKeys[type];
3002
+
3003
+ if (!keys || keys.length <= 0) {
3004
+ return;
3005
+ }
3006
+
3007
+ keys.forEach((key) => {
3008
+ // @ts-ignore
3009
+ const value = node[key];
3010
+ if (value) {
3011
+ if (Array.isArray(value)) {
3012
+ value.forEach((n) => traverse(n, visitor));
3013
+ } else {
3014
+ traverse(value, visitor);
3015
+ }
2784
3016
  }
2785
- keys.forEach((key) => {
2786
- // @ts-ignore
2787
- const value = node[key];
2788
- if (value) {
2789
- if (Array.isArray(value)) {
2790
- value.forEach((n) => traverse$1(n, visitor));
2791
- }
2792
- else {
2793
- traverse$1(value, visitor);
2794
- }
2795
- }
2796
- });
3017
+ });
2797
3018
  }
2798
- traverse.traverse = traverse$1;
2799
-
2800
- return traverse;
3019
+
3020
+ traverse_1 = {
3021
+ traverse,
3022
+ };
3023
+ return traverse_1;
2801
3024
  }
2802
3025
 
3026
+ /**
3027
+ * @typedef {import("./types").ProgramNode} ProgramNode
3028
+ */
3029
+
2803
3030
  var hasRequiredParser;
2804
3031
 
2805
3032
  function requireParser () {
2806
3033
  if (hasRequiredParser) return parser$1;
2807
3034
  hasRequiredParser = 1;
2808
- Object.defineProperty(parser$1, "__esModule", { value: true });
2809
- parser$1.parseForESLint = void 0;
2810
- const es_html_parser_1 = requireDist$1();
2811
- const visitor_keys_1 = requireVisitorKeys();
2812
- const traverse_1 = requireTraverse();
2813
- function parseForESLint(code) {
2814
- const { ast, tokens } = (0, es_html_parser_1.parse)(code);
2815
- const programNode = {
2816
- type: "Program",
2817
- body: ast.children,
2818
- loc: ast.loc,
2819
- range: ast.range,
2820
- tokens: tokens.filter((token) => token.type !== "CommentContent" &&
2821
- token.type !== "CommentOpen" &&
2822
- token.type !== "CommentClose"),
2823
- comments: [],
2824
- };
2825
- (0, traverse_1.traverse)(programNode, (node) => {
2826
- if (node.type === "CommentContent") {
2827
- programNode.comments.push({
2828
- type: node.type,
2829
- range: node.range,
2830
- loc: node.loc,
2831
- value: node.value,
2832
- });
2833
- }
2834
- });
2835
- return {
2836
- ast: programNode,
2837
- visitorKeys: visitor_keys_1.visitorKeys,
2838
- scopeManager: null,
2839
- };
2840
- }
2841
- parser$1.parseForESLint = parseForESLint;
2842
-
3035
+ const { parse } = requireDist();
3036
+ const { visitorKeys } = requireVisitorKeys();
3037
+ const { traverse } = requireTraverse();
3038
+ const { NODE_TYPES } = requireNodeTypes();
3039
+
3040
+ /**
3041
+ * @param {string} code
3042
+ * @returns {ProgramNode}
3043
+ */
3044
+ parser$1.parseForESLint = function parseForESLint(code) {
3045
+ const { ast, tokens } = parse(code);
3046
+
3047
+ const programNode = {
3048
+ type: "Program",
3049
+ body: [ast],
3050
+ loc: ast.loc,
3051
+ range: ast.range,
3052
+ tokens: tokens.filter(
3053
+ (token) =>
3054
+ token.type !== NODE_TYPES.CommentContent &&
3055
+ token.type !== NODE_TYPES.CommentOpen &&
3056
+ token.type !== NODE_TYPES.CommentClose
3057
+ ),
3058
+ comments: [],
3059
+ };
3060
+
3061
+ traverse(programNode, (node) => {
3062
+ if (node.type === NODE_TYPES.CommentContent) {
3063
+ programNode.comments.push({
3064
+ type: node.type,
3065
+ range: node.range,
3066
+ loc: node.loc,
3067
+ value: node.value,
3068
+ });
3069
+ }
3070
+ });
3071
+
3072
+ return {
3073
+ ast: programNode,
3074
+ visitorKeys,
3075
+ scopeManager: null,
3076
+ };
3077
+ };
2843
3078
  return parser$1;
2844
3079
  }
2845
3080
 
2846
- var hasRequiredDist;
2847
-
2848
- function requireDist () {
2849
- if (hasRequiredDist) return dist$1;
2850
- hasRequiredDist = 1;
2851
- (function (exports) {
2852
- Object.defineProperty(exports, "__esModule", { value: true });
2853
- exports.parseForESLint = void 0;
2854
- var parser_1 = requireParser();
2855
- Object.defineProperty(exports, "parseForESLint", { enumerable: true, get: function () { return parser_1.parseForESLint; } });
2856
-
2857
- } (dist$1));
2858
- return dist$1;
3081
+ var name = "@html-eslint/parser";
3082
+ var version = "0.33.0";
3083
+ var description = "Parser for @html-eslint/eslint-plugin";
3084
+ var author = "yeonjuan";
3085
+ var homepage = "https://github.com/yeonjuan/html-eslint#readme";
3086
+ var license = "MIT";
3087
+ var main = "lib/index.js";
3088
+ var types = "types/lib/index.d.ts";
3089
+ var directories = {
3090
+ lib: "lib",
3091
+ types: "types",
3092
+ test: "__tests__"
3093
+ };
3094
+ var files = [
3095
+ "lib",
3096
+ "types"
3097
+ ];
3098
+ var publishConfig = {
3099
+ access: "public"
3100
+ };
3101
+ var repository = {
3102
+ type: "git",
3103
+ url: "git+https://github.com/yeonjuan/html-eslint.git"
3104
+ };
3105
+ var scripts = {
3106
+ test: "jest --coverage --updateSnapshot --passWithNoTests",
3107
+ ts: "tsc --noEmit",
3108
+ build: "tsc -p ./tsconfig.build.json"
3109
+ };
3110
+ var engines = {
3111
+ node: ">=8.10.0"
3112
+ };
3113
+ var bugs = {
3114
+ url: "https://github.com/yeonjuan/html-eslint/issues"
3115
+ };
3116
+ var dependencies = {
3117
+ "es-html-parser": "^1.0.0-alpha.4"
3118
+ };
3119
+ var devDependencies = {
3120
+ typescript: "^5.7.2"
3121
+ };
3122
+ var gitHead = "4a0ee932a671f8c54bf1a86849fe886e9628b777";
3123
+ var require$$0 = {
3124
+ name: name,
3125
+ version: version,
3126
+ description: description,
3127
+ author: author,
3128
+ homepage: homepage,
3129
+ license: license,
3130
+ main: main,
3131
+ types: types,
3132
+ directories: directories,
3133
+ files: files,
3134
+ publishConfig: publishConfig,
3135
+ repository: repository,
3136
+ scripts: scripts,
3137
+ engines: engines,
3138
+ bugs: bugs,
3139
+ dependencies: dependencies,
3140
+ devDependencies: devDependencies,
3141
+ gitHead: gitHead
3142
+ };
3143
+
3144
+ var meta;
3145
+ var hasRequiredMeta;
3146
+
3147
+ function requireMeta () {
3148
+ if (hasRequiredMeta) return meta;
3149
+ hasRequiredMeta = 1;
3150
+ const { name, version } = require$$0;
3151
+ meta = { name, version };
3152
+ return meta;
3153
+ }
3154
+
3155
+ var hasRequiredLib;
3156
+
3157
+ function requireLib () {
3158
+ if (hasRequiredLib) return lib.exports;
3159
+ hasRequiredLib = 1;
3160
+ const { parseForESLint } = requireParser();
3161
+ const meta = requireMeta();
3162
+ const { NODE_TYPES } = requireNodeTypes();
3163
+
3164
+ lib.exports.parseForESLint = parseForESLint;
3165
+ lib.exports.NODE_TYPES = NODE_TYPES;
3166
+
3167
+ lib.exports = {
3168
+ parseForESLint,
3169
+ NODE_TYPES,
3170
+ meta,
3171
+ };
3172
+ return lib.exports;
2859
3173
  }
2860
3174
 
2861
3175
  var node;
@@ -2866,7 +3180,7 @@ function requireNode () {
2866
3180
  hasRequiredNode = 1;
2867
3181
  // THIS IS TAKEN FROM html-eslint
2868
3182
 
2869
- const { NODE_TYPES } = requireDist();
3183
+ const { NODE_TYPES } = requireLib();
2870
3184
 
2871
3185
  /**
2872
3186
  * @param {TagNode | ScriptTagNode | StyleTagNode} node