htmljs-parser 5.5.3 → 5.5.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/dist/index.js CHANGED
@@ -1644,6 +1644,7 @@ var EXPRESSION = {
1644
1644
  groupStack: [],
1645
1645
  shouldTerminate,
1646
1646
  operators: false,
1647
+ wasComment: false,
1647
1648
  terminatedByEOL: false,
1648
1649
  terminatedByWhitespace: false
1649
1650
  };
@@ -1740,9 +1741,10 @@ var EXPRESSION = {
1740
1741
  }
1741
1742
  },
1742
1743
  eol(_, expression) {
1743
- if (!expression.groupStack.length && (expression.terminatedByEOL || expression.terminatedByWhitespace) && !checkForOperators(this, expression, true)) {
1744
+ if (!expression.groupStack.length && (expression.terminatedByEOL || expression.terminatedByWhitespace) && (expression.wasComment || !checkForOperators(this, expression, true))) {
1744
1745
  this.exitState();
1745
1746
  }
1747
+ expression.wasComment = false;
1746
1748
  },
1747
1749
  eof(expression) {
1748
1750
  if (!expression.groupStack.length && (this.isConcise || expression.terminatedByEOL)) {
@@ -1785,7 +1787,10 @@ var EXPRESSION = {
1785
1787
  );
1786
1788
  }
1787
1789
  },
1788
- return() {
1790
+ return(child, expression) {
1791
+ if (child.state === states_exports.JS_COMMENT_LINE) {
1792
+ expression.wasComment = true;
1793
+ }
1789
1794
  }
1790
1795
  };
1791
1796
  function checkForOperators(parser, expression, eol) {
package/dist/index.mjs CHANGED
@@ -1619,6 +1619,7 @@ var EXPRESSION = {
1619
1619
  groupStack: [],
1620
1620
  shouldTerminate,
1621
1621
  operators: false,
1622
+ wasComment: false,
1622
1623
  terminatedByEOL: false,
1623
1624
  terminatedByWhitespace: false
1624
1625
  };
@@ -1715,9 +1716,10 @@ var EXPRESSION = {
1715
1716
  }
1716
1717
  },
1717
1718
  eol(_, expression) {
1718
- if (!expression.groupStack.length && (expression.terminatedByEOL || expression.terminatedByWhitespace) && !checkForOperators(this, expression, true)) {
1719
+ if (!expression.groupStack.length && (expression.terminatedByEOL || expression.terminatedByWhitespace) && (expression.wasComment || !checkForOperators(this, expression, true))) {
1719
1720
  this.exitState();
1720
1721
  }
1722
+ expression.wasComment = false;
1721
1723
  },
1722
1724
  eof(expression) {
1723
1725
  if (!expression.groupStack.length && (this.isConcise || expression.terminatedByEOL)) {
@@ -1760,7 +1762,10 @@ var EXPRESSION = {
1760
1762
  );
1761
1763
  }
1762
1764
  },
1763
- return() {
1765
+ return(child, expression) {
1766
+ if (child.state === states_exports.JS_COMMENT_LINE) {
1767
+ expression.wasComment = true;
1768
+ }
1764
1769
  }
1765
1770
  };
1766
1771
  function checkForOperators(parser, expression, eol) {
@@ -2,6 +2,7 @@ import { type StateDefinition, type Meta } from "../internal";
2
2
  export interface ExpressionMeta extends Meta {
3
3
  groupStack: number[];
4
4
  operators: boolean;
5
+ wasComment: boolean;
5
6
  terminatedByEOL: boolean;
6
7
  terminatedByWhitespace: boolean;
7
8
  shouldTerminate(code: number, data: string, pos: number): boolean;
package/package.json CHANGED
@@ -1,7 +1,7 @@
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.3",
4
+ "version": "5.5.4",
5
5
  "devDependencies": {
6
6
  "@changesets/changelog-github": "^0.5.0",
7
7
  "@changesets/cli": "^2.27.1",
@@ -26,7 +26,7 @@
26
26
  "mocha-snap": "^5.0.0",
27
27
  "nyc": "^15.1.0",
28
28
  "prettier": "^3.2.5",
29
- "tsx": "^4.7.0",
29
+ "tsx": "^4.19.2",
30
30
  "typescript": "^5.3.3"
31
31
  },
32
32
  "exports": {