htmljs-parser 5.5.1 → 5.5.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import { STATE, Range, ParserOptions as Options, ErrorCode } from "../internal";
1
+ import { STATE, type Range, type ParserOptions as Options, ErrorCode } from "../internal";
2
2
  export interface Meta extends Range {
3
3
  parent: Meta;
4
4
  state: StateDefinition;
package/dist/index.js CHANGED
@@ -136,6 +136,7 @@ function getPosAfterLine(lines, startLine, index) {
136
136
 
137
137
  // src/core/Parser.ts
138
138
  var Parser = class {
139
+ // Keeps track of line indexes to provide line/column info.
139
140
  constructor(options) {
140
141
  this.options = options;
141
142
  }
@@ -172,6 +173,9 @@ var Parser = class {
172
173
  activeState.exit.call(this, activeRange);
173
174
  this.activeState.return.call(this, activeRange, parent);
174
175
  }
176
+ /**
177
+ * Compare a position in the source to either another position, or a string.
178
+ */
175
179
  matchAtPos(a, b) {
176
180
  const aPos = a.start;
177
181
  const aLen = a.end - aPos;
@@ -201,6 +205,10 @@ var Parser = class {
201
205
  }
202
206
  return false;
203
207
  }
208
+ /**
209
+ * Look ahead to see if the given str matches the substring sequence
210
+ * beyond
211
+ */
204
212
  lookAheadFor(str, startPos = this.pos + 1) {
205
213
  let i = str.length;
206
214
  if (startPos + i <= this.maxPos) {
@@ -229,6 +237,12 @@ var Parser = class {
229
237
  this.textPos = -1;
230
238
  }
231
239
  }
240
+ /**
241
+ * This is used to enter into "HTML" parsing mode instead
242
+ * of concise HTML. We push a block on to the stack so that we know when
243
+ * return back to the previous parsing mode and to ensure that all
244
+ * tags within a block are properly closed.
245
+ */
232
246
  beginHtmlBlock(delimiter, singleLine) {
233
247
  var _a;
234
248
  const content = this.enterState(
@@ -265,6 +279,7 @@ var Parser = class {
265
279
  (_b = (_a = this.options).onCloseTagName) == null ? void 0 : _b.call(_a, name);
266
280
  (_d = (_c = this.options).onCloseTagEnd) == null ? void 0 : _d.call(_c, { start, end });
267
281
  }
282
+ // --------------------------
268
283
  consumeWhitespaceIfBefore(str, start = 0) {
269
284
  const { pos, data } = this;
270
285
  let cur = pos + start;
@@ -519,8 +534,8 @@ var OPEN_TAG = {
519
534
  }
520
535
  return;
521
536
  }
522
- if (code === 45 /* HTML_BLOCK_DELIMITER */) {
523
- if (this.lookAtCharCodeAhead(1) !== 45 /* HTML_BLOCK_DELIMITER */) {
537
+ if (code === 45 /* HYPHEN */) {
538
+ if (this.lookAtCharCodeAhead(1) !== 45 /* HYPHEN */) {
524
539
  this.emitError(
525
540
  tag,
526
541
  19 /* MALFORMED_OPEN_TAG */,
@@ -685,6 +700,7 @@ var OPEN_TAG = {
685
700
  }
686
701
  (_b = (_a = this.options).onTagVar) == null ? void 0 : _b.call(_a, {
687
702
  start: child.start - 1,
703
+ // include /,
688
704
  end: child.end,
689
705
  value: {
690
706
  start: child.start,
@@ -734,6 +750,7 @@ var OPEN_TAG = {
734
750
  const end = ++this.pos;
735
751
  const types = {
736
752
  start: child.start - 1,
753
+ // include <
737
754
  end,
738
755
  value: {
739
756
  start: child.start,
@@ -964,6 +981,7 @@ var ATTRIBUTE = {
964
981
  typeParams,
965
982
  body: {
966
983
  start: child.start - 1,
984
+ // include {
967
985
  end,
968
986
  value: {
969
987
  start: child.start,
@@ -1132,7 +1150,7 @@ var BEGIN_DELIMITED_HTML_BLOCK = {
1132
1150
  exit() {
1133
1151
  },
1134
1152
  char(code, block) {
1135
- if (code === 45 /* HTML_BLOCK_DELIMITER */) {
1153
+ if (code === 45 /* HYPHEN */) {
1136
1154
  block.delimiter += "-";
1137
1155
  } else {
1138
1156
  const startPos = this.pos;
@@ -1215,7 +1233,9 @@ var CDATA = {
1215
1233
  end: cdata.end,
1216
1234
  value: {
1217
1235
  start: cdata.start + 9,
1236
+ // strip <![CDATA[
1218
1237
  end: cdata.end - 3
1238
+ // strip ]]>
1219
1239
  }
1220
1240
  });
1221
1241
  },
@@ -1388,7 +1408,7 @@ var CONCISE_HTML_CONTENT = {
1388
1408
  }
1389
1409
  }
1390
1410
  if (parentTag) {
1391
- if (parentTag.type === 1 /* text */ && code !== 45 /* HTML_BLOCK_DELIMITER */) {
1411
+ if (parentTag.type === 1 /* text */ && code !== 45 /* HYPHEN */) {
1392
1412
  this.emitError(
1393
1413
  this.pos,
1394
1414
  8 /* INVALID_LINE_START */,
@@ -1420,8 +1440,8 @@ var CONCISE_HTML_CONTENT = {
1420
1440
  return;
1421
1441
  }
1422
1442
  break;
1423
- case 45 /* HTML_BLOCK_DELIMITER */:
1424
- if (this.lookAtCharCodeAhead(1) === 45 /* HTML_BLOCK_DELIMITER */) {
1443
+ case 45 /* HYPHEN */:
1444
+ if (this.lookAtCharCodeAhead(1) === 45 /* HYPHEN */) {
1425
1445
  this.enterState(states_exports.BEGIN_DELIMITED_HTML_BLOCK);
1426
1446
  this.pos--;
1427
1447
  } else {
@@ -1470,6 +1490,7 @@ var CONCISE_HTML_CONTENT = {
1470
1490
  end: child.end,
1471
1491
  value: {
1472
1492
  start: child.start + 2,
1493
+ // strip //
1473
1494
  end: child.end
1474
1495
  }
1475
1496
  });
@@ -1480,7 +1501,9 @@ var CONCISE_HTML_CONTENT = {
1480
1501
  end: child.end,
1481
1502
  value: {
1482
1503
  start: child.start + 2,
1504
+ // strip /*
1483
1505
  end: child.end - 2
1506
+ // strip */,
1484
1507
  }
1485
1508
  });
1486
1509
  if (!this.consumeWhitespaceOnLine(0)) {
@@ -1540,7 +1563,9 @@ function exitDeclaration(parser, declaration, closeOffset) {
1540
1563
  end: declaration.end,
1541
1564
  value: {
1542
1565
  start: declaration.start + 2,
1566
+ // strip <?
1543
1567
  end: declaration.end - closeOffset
1568
+ // > or ?>
1544
1569
  }
1545
1570
  });
1546
1571
  }
@@ -1564,7 +1589,9 @@ var DTD = {
1564
1589
  end: documentType.end,
1565
1590
  value: {
1566
1591
  start: documentType.start + 2,
1592
+ // strip <!
1567
1593
  end: documentType.end - 1
1594
+ // strip >
1568
1595
  }
1569
1596
  });
1570
1597
  },
@@ -1599,7 +1626,13 @@ var unaryKeywords = [
1599
1626
  "typeof",
1600
1627
  "void"
1601
1628
  ];
1602
- var binaryKeywords = ["instanceof", "in", "as", "extends"];
1629
+ var binaryKeywords = [
1630
+ "instanceof",
1631
+ "in",
1632
+ "as",
1633
+ "extends",
1634
+ "satisfies"
1635
+ ];
1603
1636
  var EXPRESSION = {
1604
1637
  name: "EXPRESSION",
1605
1638
  enter(parent, start) {
@@ -1972,7 +2005,9 @@ var HTML_COMMENT = {
1972
2005
  end: comment.end,
1973
2006
  value: {
1974
2007
  start: comment.start + 4,
2008
+ // strip <!--
1975
2009
  end: comment.end - 3
2010
+ // strip -->
1976
2011
  }
1977
2012
  });
1978
2013
  },
@@ -2098,6 +2133,7 @@ var HTML_CONTENT = {
2098
2133
  end: child.end,
2099
2134
  value: {
2100
2135
  start: child.start + 2,
2136
+ // strip //
2101
2137
  end: child.end
2102
2138
  }
2103
2139
  });
@@ -2108,7 +2144,9 @@ var HTML_CONTENT = {
2108
2144
  end: child.end,
2109
2145
  value: {
2110
2146
  start: child.start + 2,
2147
+ // strip /*
2111
2148
  end: child.end - 2
2149
+ // strip */,
2112
2150
  }
2113
2151
  });
2114
2152
  break;
@@ -2331,7 +2369,9 @@ var PLACEHOLDER = {
2331
2369
  escape: placeholder.escape,
2332
2370
  value: {
2333
2371
  start: placeholder.start + (placeholder.escape ? 2 : 3),
2372
+ // ignore ${ or $!{
2334
2373
  end: placeholder.end - 1
2374
+ // ignore }
2335
2375
  }
2336
2376
  });
2337
2377
  },
@@ -2700,15 +2740,27 @@ var PARSED_STRING = {
2700
2740
  function createParser(handlers) {
2701
2741
  const parser = new Parser(handlers);
2702
2742
  return {
2743
+ /**
2744
+ * Parses code and calls the provided handlers.
2745
+ */
2703
2746
  parse(code) {
2704
2747
  return parser.parse(code);
2705
2748
  },
2749
+ /**
2750
+ * Given an offset range in the current source code, reads and returns the substring in the input code.
2751
+ */
2706
2752
  read(range) {
2707
2753
  return parser.read(range);
2708
2754
  },
2755
+ /**
2756
+ * Given a offset in the current source code, returns a Position object with line & character information.
2757
+ */
2709
2758
  positionAt(offset) {
2710
2759
  return parser.positionAt(offset);
2711
2760
  },
2761
+ /**
2762
+ * Given a offset range in the current source code, returns a Location object with a start & end position information.
2763
+ */
2712
2764
  locationAt(range) {
2713
2765
  return parser.locationAt(range);
2714
2766
  }
package/dist/index.mjs CHANGED
@@ -111,6 +111,7 @@ function getPosAfterLine(lines, startLine, index) {
111
111
 
112
112
  // src/core/Parser.ts
113
113
  var Parser = class {
114
+ // Keeps track of line indexes to provide line/column info.
114
115
  constructor(options) {
115
116
  this.options = options;
116
117
  }
@@ -147,6 +148,9 @@ var Parser = class {
147
148
  activeState.exit.call(this, activeRange);
148
149
  this.activeState.return.call(this, activeRange, parent);
149
150
  }
151
+ /**
152
+ * Compare a position in the source to either another position, or a string.
153
+ */
150
154
  matchAtPos(a, b) {
151
155
  const aPos = a.start;
152
156
  const aLen = a.end - aPos;
@@ -176,6 +180,10 @@ var Parser = class {
176
180
  }
177
181
  return false;
178
182
  }
183
+ /**
184
+ * Look ahead to see if the given str matches the substring sequence
185
+ * beyond
186
+ */
179
187
  lookAheadFor(str, startPos = this.pos + 1) {
180
188
  let i = str.length;
181
189
  if (startPos + i <= this.maxPos) {
@@ -204,6 +212,12 @@ var Parser = class {
204
212
  this.textPos = -1;
205
213
  }
206
214
  }
215
+ /**
216
+ * This is used to enter into "HTML" parsing mode instead
217
+ * of concise HTML. We push a block on to the stack so that we know when
218
+ * return back to the previous parsing mode and to ensure that all
219
+ * tags within a block are properly closed.
220
+ */
207
221
  beginHtmlBlock(delimiter, singleLine) {
208
222
  var _a;
209
223
  const content = this.enterState(
@@ -240,6 +254,7 @@ var Parser = class {
240
254
  (_b = (_a = this.options).onCloseTagName) == null ? void 0 : _b.call(_a, name);
241
255
  (_d = (_c = this.options).onCloseTagEnd) == null ? void 0 : _d.call(_c, { start, end });
242
256
  }
257
+ // --------------------------
243
258
  consumeWhitespaceIfBefore(str, start = 0) {
244
259
  const { pos, data } = this;
245
260
  let cur = pos + start;
@@ -494,8 +509,8 @@ var OPEN_TAG = {
494
509
  }
495
510
  return;
496
511
  }
497
- if (code === 45 /* HTML_BLOCK_DELIMITER */) {
498
- if (this.lookAtCharCodeAhead(1) !== 45 /* HTML_BLOCK_DELIMITER */) {
512
+ if (code === 45 /* HYPHEN */) {
513
+ if (this.lookAtCharCodeAhead(1) !== 45 /* HYPHEN */) {
499
514
  this.emitError(
500
515
  tag,
501
516
  19 /* MALFORMED_OPEN_TAG */,
@@ -660,6 +675,7 @@ var OPEN_TAG = {
660
675
  }
661
676
  (_b = (_a = this.options).onTagVar) == null ? void 0 : _b.call(_a, {
662
677
  start: child.start - 1,
678
+ // include /,
663
679
  end: child.end,
664
680
  value: {
665
681
  start: child.start,
@@ -709,6 +725,7 @@ var OPEN_TAG = {
709
725
  const end = ++this.pos;
710
726
  const types = {
711
727
  start: child.start - 1,
728
+ // include <
712
729
  end,
713
730
  value: {
714
731
  start: child.start,
@@ -939,6 +956,7 @@ var ATTRIBUTE = {
939
956
  typeParams,
940
957
  body: {
941
958
  start: child.start - 1,
959
+ // include {
942
960
  end,
943
961
  value: {
944
962
  start: child.start,
@@ -1107,7 +1125,7 @@ var BEGIN_DELIMITED_HTML_BLOCK = {
1107
1125
  exit() {
1108
1126
  },
1109
1127
  char(code, block) {
1110
- if (code === 45 /* HTML_BLOCK_DELIMITER */) {
1128
+ if (code === 45 /* HYPHEN */) {
1111
1129
  block.delimiter += "-";
1112
1130
  } else {
1113
1131
  const startPos = this.pos;
@@ -1190,7 +1208,9 @@ var CDATA = {
1190
1208
  end: cdata.end,
1191
1209
  value: {
1192
1210
  start: cdata.start + 9,
1211
+ // strip <![CDATA[
1193
1212
  end: cdata.end - 3
1213
+ // strip ]]>
1194
1214
  }
1195
1215
  });
1196
1216
  },
@@ -1363,7 +1383,7 @@ var CONCISE_HTML_CONTENT = {
1363
1383
  }
1364
1384
  }
1365
1385
  if (parentTag) {
1366
- if (parentTag.type === 1 /* text */ && code !== 45 /* HTML_BLOCK_DELIMITER */) {
1386
+ if (parentTag.type === 1 /* text */ && code !== 45 /* HYPHEN */) {
1367
1387
  this.emitError(
1368
1388
  this.pos,
1369
1389
  8 /* INVALID_LINE_START */,
@@ -1395,8 +1415,8 @@ var CONCISE_HTML_CONTENT = {
1395
1415
  return;
1396
1416
  }
1397
1417
  break;
1398
- case 45 /* HTML_BLOCK_DELIMITER */:
1399
- if (this.lookAtCharCodeAhead(1) === 45 /* HTML_BLOCK_DELIMITER */) {
1418
+ case 45 /* HYPHEN */:
1419
+ if (this.lookAtCharCodeAhead(1) === 45 /* HYPHEN */) {
1400
1420
  this.enterState(states_exports.BEGIN_DELIMITED_HTML_BLOCK);
1401
1421
  this.pos--;
1402
1422
  } else {
@@ -1445,6 +1465,7 @@ var CONCISE_HTML_CONTENT = {
1445
1465
  end: child.end,
1446
1466
  value: {
1447
1467
  start: child.start + 2,
1468
+ // strip //
1448
1469
  end: child.end
1449
1470
  }
1450
1471
  });
@@ -1455,7 +1476,9 @@ var CONCISE_HTML_CONTENT = {
1455
1476
  end: child.end,
1456
1477
  value: {
1457
1478
  start: child.start + 2,
1479
+ // strip /*
1458
1480
  end: child.end - 2
1481
+ // strip */,
1459
1482
  }
1460
1483
  });
1461
1484
  if (!this.consumeWhitespaceOnLine(0)) {
@@ -1515,7 +1538,9 @@ function exitDeclaration(parser, declaration, closeOffset) {
1515
1538
  end: declaration.end,
1516
1539
  value: {
1517
1540
  start: declaration.start + 2,
1541
+ // strip <?
1518
1542
  end: declaration.end - closeOffset
1543
+ // > or ?>
1519
1544
  }
1520
1545
  });
1521
1546
  }
@@ -1539,7 +1564,9 @@ var DTD = {
1539
1564
  end: documentType.end,
1540
1565
  value: {
1541
1566
  start: documentType.start + 2,
1567
+ // strip <!
1542
1568
  end: documentType.end - 1
1569
+ // strip >
1543
1570
  }
1544
1571
  });
1545
1572
  },
@@ -1574,7 +1601,13 @@ var unaryKeywords = [
1574
1601
  "typeof",
1575
1602
  "void"
1576
1603
  ];
1577
- var binaryKeywords = ["instanceof", "in", "as", "extends"];
1604
+ var binaryKeywords = [
1605
+ "instanceof",
1606
+ "in",
1607
+ "as",
1608
+ "extends",
1609
+ "satisfies"
1610
+ ];
1578
1611
  var EXPRESSION = {
1579
1612
  name: "EXPRESSION",
1580
1613
  enter(parent, start) {
@@ -1947,7 +1980,9 @@ var HTML_COMMENT = {
1947
1980
  end: comment.end,
1948
1981
  value: {
1949
1982
  start: comment.start + 4,
1983
+ // strip <!--
1950
1984
  end: comment.end - 3
1985
+ // strip -->
1951
1986
  }
1952
1987
  });
1953
1988
  },
@@ -2073,6 +2108,7 @@ var HTML_CONTENT = {
2073
2108
  end: child.end,
2074
2109
  value: {
2075
2110
  start: child.start + 2,
2111
+ // strip //
2076
2112
  end: child.end
2077
2113
  }
2078
2114
  });
@@ -2083,7 +2119,9 @@ var HTML_CONTENT = {
2083
2119
  end: child.end,
2084
2120
  value: {
2085
2121
  start: child.start + 2,
2122
+ // strip /*
2086
2123
  end: child.end - 2
2124
+ // strip */,
2087
2125
  }
2088
2126
  });
2089
2127
  break;
@@ -2306,7 +2344,9 @@ var PLACEHOLDER = {
2306
2344
  escape: placeholder.escape,
2307
2345
  value: {
2308
2346
  start: placeholder.start + (placeholder.escape ? 2 : 3),
2347
+ // ignore ${ or $!{
2309
2348
  end: placeholder.end - 1
2349
+ // ignore }
2310
2350
  }
2311
2351
  });
2312
2352
  },
@@ -2675,15 +2715,27 @@ var PARSED_STRING = {
2675
2715
  function createParser(handlers) {
2676
2716
  const parser = new Parser(handlers);
2677
2717
  return {
2718
+ /**
2719
+ * Parses code and calls the provided handlers.
2720
+ */
2678
2721
  parse(code) {
2679
2722
  return parser.parse(code);
2680
2723
  },
2724
+ /**
2725
+ * Given an offset range in the current source code, reads and returns the substring in the input code.
2726
+ */
2681
2727
  read(range) {
2682
2728
  return parser.read(range);
2683
2729
  },
2730
+ /**
2731
+ * Given a offset in the current source code, returns a Position object with line & character information.
2732
+ */
2684
2733
  positionAt(offset) {
2685
2734
  return parser.positionAt(offset);
2686
2735
  },
2736
+ /**
2737
+ * Given a offset range in the current source code, returns a Location object with a start & end position information.
2738
+ */
2687
2739
  locationAt(range) {
2688
2740
  return parser.locationAt(range);
2689
2741
  }
@@ -1,4 +1,4 @@
1
- import { StateDefinition, Range, Ranges, Meta } from "../internal";
1
+ import { type StateDefinition, type Range, type Ranges, type Meta } from "../internal";
2
2
  declare const enum ATTR_STAGE {
3
3
  UNKNOWN = 0,
4
4
  NAME = 1,
@@ -1,4 +1,4 @@
1
- import { Parser, StateDefinition, STATE, Meta } from "../internal";
1
+ import { Parser, type StateDefinition, STATE, type Meta } from "../internal";
2
2
  export interface DelimitedHTMLBlockMeta extends Meta {
3
3
  delimiter: string;
4
4
  indent: string;
@@ -1,3 +1,3 @@
1
- import { Parser, StateDefinition } from "../internal";
1
+ import { Parser, type StateDefinition } from "../internal";
2
2
  export declare const CDATA: StateDefinition;
3
3
  export declare function checkForCDATA(parser: Parser): boolean;
@@ -1,3 +1,3 @@
1
- import { StateDefinition, Parser } from "../internal";
1
+ import { type StateDefinition, Parser } from "../internal";
2
2
  export declare const CLOSE_TAG: StateDefinition;
3
3
  export declare function checkForClosingTag(parser: Parser): boolean;
@@ -1,2 +1,2 @@
1
- import { StateDefinition } from "../internal";
1
+ import { type StateDefinition } from "../internal";
2
2
  export declare const CONCISE_HTML_CONTENT: StateDefinition;
@@ -1,2 +1,2 @@
1
- import { StateDefinition } from "../internal";
1
+ import { type StateDefinition } from "../internal";
2
2
  export declare const DECLARATION: StateDefinition;
@@ -1,2 +1,2 @@
1
- import { StateDefinition } from "../internal";
1
+ import { type StateDefinition } from "../internal";
2
2
  export declare const DTD: StateDefinition;
@@ -1,4 +1,4 @@
1
- import { StateDefinition, Meta } from "../internal";
1
+ import { type StateDefinition, type Meta } from "../internal";
2
2
  export interface ExpressionMeta extends Meta {
3
3
  groupStack: number[];
4
4
  operators: boolean;
@@ -1,2 +1,2 @@
1
- import { StateDefinition } from "../internal";
1
+ import { type StateDefinition } from "../internal";
2
2
  export declare const HTML_COMMENT: StateDefinition;
@@ -1,4 +1,4 @@
1
- import { StateDefinition, Meta } from "../internal";
1
+ import { type StateDefinition, type Meta } from "../internal";
2
2
  export interface HTMLContentMeta extends Meta {
3
3
  indent: string;
4
4
  singleLine: boolean;
@@ -1,4 +1,4 @@
1
- import { Range, StateDefinition, Meta } from "../internal";
1
+ import { type Range, type StateDefinition, type Meta } from "../internal";
2
2
  interface ScriptletMeta extends Meta {
3
3
  block: boolean;
4
4
  value: Range;
@@ -1,2 +1,2 @@
1
- import { StateDefinition } from "../internal";
1
+ import { type StateDefinition } from "../internal";
2
2
  export declare const JS_COMMENT_BLOCK: StateDefinition;
@@ -1,2 +1,2 @@
1
- import { StateDefinition } from "../internal";
1
+ import { type StateDefinition } from "../internal";
2
2
  export declare const JS_COMMENT_LINE: StateDefinition;
@@ -1,4 +1,4 @@
1
- import { StateDefinition, Ranges, Meta, TagType } from "../internal";
1
+ import { type StateDefinition, type Ranges, type Meta, TagType } from "../internal";
2
2
  export declare enum TAG_STAGE {
3
3
  UNKNOWN = 0,
4
4
  VAR = 1,
@@ -1,4 +1,4 @@
1
- import { StateDefinition, Meta } from "../internal";
1
+ import { type StateDefinition, type Meta } from "../internal";
2
2
  interface ParsedStringMeta extends Meta {
3
3
  quoteCharCode: number;
4
4
  }
@@ -1,4 +1,4 @@
1
- import { StateDefinition, Meta } from "../internal";
1
+ import { type StateDefinition, type Meta } from "../internal";
2
2
  export interface ParsedTextContentMeta extends Meta {
3
3
  indent: string;
4
4
  singleLine: boolean;
@@ -1,4 +1,4 @@
1
- import { Parser, StateDefinition, Meta } from "../internal";
1
+ import { Parser, type StateDefinition, type Meta } from "../internal";
2
2
  interface PlaceholderMeta extends Meta {
3
3
  escape: boolean;
4
4
  }
@@ -1,4 +1,4 @@
1
- import { StateDefinition, Meta } from "../internal";
1
+ import { type StateDefinition, type Meta } from "../internal";
2
2
  interface RegExpMeta extends Meta {
3
3
  isInCharSet: boolean;
4
4
  }
@@ -1,4 +1,4 @@
1
- import { StateDefinition, Meta } from "../internal";
1
+ import { type StateDefinition, type Meta } from "../internal";
2
2
  interface StringMeta extends Meta {
3
3
  quoteCharCode: number;
4
4
  }
@@ -1,4 +1,4 @@
1
- import { CODE, StateDefinition, Ranges, Meta } from "../internal";
1
+ import { CODE, type StateDefinition, type Ranges, type Meta } from "../internal";
2
2
  export interface TagNameMeta extends Meta, Ranges.Template {
3
3
  shorthandCode: -1 | CODE.NUMBER_SIGN | CODE.PERIOD;
4
4
  }
@@ -1,2 +1,2 @@
1
- import { StateDefinition } from "../internal";
1
+ import { type StateDefinition } from "../internal";
2
2
  export declare const TEMPLATE_STRING: StateDefinition;
@@ -23,7 +23,6 @@ export declare const enum CODE {
23
23
  CLOSE_CURLY_BRACE = 125,
24
24
  ASTERISK = 42,
25
25
  HYPHEN = 45,
26
- HTML_BLOCK_DELIMITER = 45,
27
26
  DOLLAR = 36,
28
27
  PERCENT = 37,
29
28
  PERIOD = 46,
@@ -1,5 +1,5 @@
1
1
  import { type Parser } from "../internal";
2
- import { Location, Position } from "./constants";
2
+ import { type Location, type Position } from "./constants";
3
3
  export declare function isWhitespaceCode(code: number): boolean;
4
4
  /**
5
5
  * Given a source code line offsets, a start offset and an end offset, returns a Location object with line & character information for the start and end offsets.
package/package.json CHANGED
@@ -1,31 +1,33 @@
1
1
  {
2
2
  "name": "htmljs-parser",
3
3
  "description": "An HTML parser recognizes content and string placeholders and allows JavaScript expressions as attribute values",
4
- "version": "5.5.1",
4
+ "version": "5.5.3",
5
5
  "devDependencies": {
6
- "@changesets/changelog-github": "^0.4.7",
7
- "@changesets/cli": "^2.25.2",
8
- "@types/degit": "^2.8.3",
9
- "@types/mocha": "^10.0.0",
10
- "@types/node": "^18.11.9",
11
- "@typescript-eslint/eslint-plugin": "^5.42.0",
12
- "@typescript-eslint/parser": "^5.42.0",
6
+ "@changesets/changelog-github": "^0.5.0",
7
+ "@changesets/cli": "^2.27.1",
8
+ "@types/degit": "^2.8.6",
9
+ "@types/mocha": "^10.0.6",
10
+ "@types/node": "^20.11.16",
11
+ "@typescript-eslint/eslint-plugin": "^6.21.0",
12
+ "@typescript-eslint/parser": "^6.21.0",
13
13
  "cross-env": "^7.0.3",
14
14
  "degit": "^2.8.4",
15
- "esbuild": "0.15.13",
16
- "eslint": "^8.26.0",
17
- "eslint-config-prettier": "^8.5.0",
18
- "fast-glob": "^3.2.12",
15
+ "esbuild": "0.20.0",
16
+ "eslint": "^8.56.0",
17
+ "eslint-config-prettier": "^9.1.0",
18
+ "eslint-import-resolver-typescript": "^3.6.1",
19
+ "eslint-plugin-import": "^2.29.1",
20
+ "fast-glob": "^3.3.2",
19
21
  "fixpack": "^4.0.0",
20
- "husky": "^8.0.1",
21
- "lint-staged": "^13.0.3",
22
- "mitata": "^0.1.6",
23
- "mocha": "^10.1.0",
24
- "mocha-snap": "^4.3.0",
22
+ "husky": "^9.0.10",
23
+ "lint-staged": "^15.2.2",
24
+ "mitata": "^0.1.8",
25
+ "mocha": "^10.2.0",
26
+ "mocha-snap": "^5.0.0",
25
27
  "nyc": "^15.1.0",
26
- "prettier": "^2.7.1",
27
- "tsx": "^3.11.0",
28
- "typescript": "^4.8.4"
28
+ "prettier": "^3.2.5",
29
+ "tsx": "^4.7.0",
30
+ "typescript": "^5.3.3"
29
31
  },
30
32
  "exports": {
31
33
  ".": {
@@ -67,7 +69,7 @@
67
69
  "lint:eslint": "eslint -f visualstudio .",
68
70
  "lint:prettier": "prettier \"./**/*{.ts,.js,.json,.md,.yml,rc}\"",
69
71
  "mocha": "cross-env NODE_ENV=test mocha \"./src/**/__tests__/*.test.ts\"",
70
- "prepare": "husky install",
72
+ "prepare": "husky",
71
73
  "release": "npm run build && changeset publish",
72
74
  "report": "open ./coverage/lcov-report/index.html",
73
75
  "test": "npm run mocha -- --watch",