htmljs-parser 5.5.2 → 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 +14 -3
- package/dist/index.mjs +14 -3
- package/dist/states/EXPRESSION.d.ts +1 -0
- package/package.json +11 -11
package/dist/index.js
CHANGED
|
@@ -1626,7 +1626,13 @@ var unaryKeywords = [
|
|
|
1626
1626
|
"typeof",
|
|
1627
1627
|
"void"
|
|
1628
1628
|
];
|
|
1629
|
-
var binaryKeywords = [
|
|
1629
|
+
var binaryKeywords = [
|
|
1630
|
+
"instanceof",
|
|
1631
|
+
"in",
|
|
1632
|
+
"as",
|
|
1633
|
+
"extends",
|
|
1634
|
+
"satisfies"
|
|
1635
|
+
];
|
|
1630
1636
|
var EXPRESSION = {
|
|
1631
1637
|
name: "EXPRESSION",
|
|
1632
1638
|
enter(parent, start) {
|
|
@@ -1638,6 +1644,7 @@ var EXPRESSION = {
|
|
|
1638
1644
|
groupStack: [],
|
|
1639
1645
|
shouldTerminate,
|
|
1640
1646
|
operators: false,
|
|
1647
|
+
wasComment: false,
|
|
1641
1648
|
terminatedByEOL: false,
|
|
1642
1649
|
terminatedByWhitespace: false
|
|
1643
1650
|
};
|
|
@@ -1734,9 +1741,10 @@ var EXPRESSION = {
|
|
|
1734
1741
|
}
|
|
1735
1742
|
},
|
|
1736
1743
|
eol(_, expression) {
|
|
1737
|
-
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))) {
|
|
1738
1745
|
this.exitState();
|
|
1739
1746
|
}
|
|
1747
|
+
expression.wasComment = false;
|
|
1740
1748
|
},
|
|
1741
1749
|
eof(expression) {
|
|
1742
1750
|
if (!expression.groupStack.length && (this.isConcise || expression.terminatedByEOL)) {
|
|
@@ -1779,7 +1787,10 @@ var EXPRESSION = {
|
|
|
1779
1787
|
);
|
|
1780
1788
|
}
|
|
1781
1789
|
},
|
|
1782
|
-
return() {
|
|
1790
|
+
return(child, expression) {
|
|
1791
|
+
if (child.state === states_exports.JS_COMMENT_LINE) {
|
|
1792
|
+
expression.wasComment = true;
|
|
1793
|
+
}
|
|
1783
1794
|
}
|
|
1784
1795
|
};
|
|
1785
1796
|
function checkForOperators(parser, expression, eol) {
|
package/dist/index.mjs
CHANGED
|
@@ -1601,7 +1601,13 @@ var unaryKeywords = [
|
|
|
1601
1601
|
"typeof",
|
|
1602
1602
|
"void"
|
|
1603
1603
|
];
|
|
1604
|
-
var binaryKeywords = [
|
|
1604
|
+
var binaryKeywords = [
|
|
1605
|
+
"instanceof",
|
|
1606
|
+
"in",
|
|
1607
|
+
"as",
|
|
1608
|
+
"extends",
|
|
1609
|
+
"satisfies"
|
|
1610
|
+
];
|
|
1605
1611
|
var EXPRESSION = {
|
|
1606
1612
|
name: "EXPRESSION",
|
|
1607
1613
|
enter(parent, start) {
|
|
@@ -1613,6 +1619,7 @@ var EXPRESSION = {
|
|
|
1613
1619
|
groupStack: [],
|
|
1614
1620
|
shouldTerminate,
|
|
1615
1621
|
operators: false,
|
|
1622
|
+
wasComment: false,
|
|
1616
1623
|
terminatedByEOL: false,
|
|
1617
1624
|
terminatedByWhitespace: false
|
|
1618
1625
|
};
|
|
@@ -1709,9 +1716,10 @@ var EXPRESSION = {
|
|
|
1709
1716
|
}
|
|
1710
1717
|
},
|
|
1711
1718
|
eol(_, expression) {
|
|
1712
|
-
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))) {
|
|
1713
1720
|
this.exitState();
|
|
1714
1721
|
}
|
|
1722
|
+
expression.wasComment = false;
|
|
1715
1723
|
},
|
|
1716
1724
|
eof(expression) {
|
|
1717
1725
|
if (!expression.groupStack.length && (this.isConcise || expression.terminatedByEOL)) {
|
|
@@ -1754,7 +1762,10 @@ var EXPRESSION = {
|
|
|
1754
1762
|
);
|
|
1755
1763
|
}
|
|
1756
1764
|
},
|
|
1757
|
-
return() {
|
|
1765
|
+
return(child, expression) {
|
|
1766
|
+
if (child.state === states_exports.JS_COMMENT_LINE) {
|
|
1767
|
+
expression.wasComment = true;
|
|
1768
|
+
}
|
|
1758
1769
|
}
|
|
1759
1770
|
};
|
|
1760
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,32 +1,32 @@
|
|
|
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.
|
|
4
|
+
"version": "5.5.4",
|
|
5
5
|
"devDependencies": {
|
|
6
6
|
"@changesets/changelog-github": "^0.5.0",
|
|
7
7
|
"@changesets/cli": "^2.27.1",
|
|
8
8
|
"@types/degit": "^2.8.6",
|
|
9
9
|
"@types/mocha": "^10.0.6",
|
|
10
|
-
"@types/node": "^20.
|
|
11
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
|
12
|
-
"@typescript-eslint/parser": "^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
|
+
"esbuild": "0.20.0",
|
|
16
16
|
"eslint": "^8.56.0",
|
|
17
17
|
"eslint-config-prettier": "^9.1.0",
|
|
18
18
|
"eslint-import-resolver-typescript": "^3.6.1",
|
|
19
19
|
"eslint-plugin-import": "^2.29.1",
|
|
20
20
|
"fast-glob": "^3.3.2",
|
|
21
21
|
"fixpack": "^4.0.0",
|
|
22
|
-
"husky": "^
|
|
23
|
-
"lint-staged": "^15.2.
|
|
24
|
-
"mitata": "^0.1.
|
|
22
|
+
"husky": "^9.0.10",
|
|
23
|
+
"lint-staged": "^15.2.2",
|
|
24
|
+
"mitata": "^0.1.8",
|
|
25
25
|
"mocha": "^10.2.0",
|
|
26
26
|
"mocha-snap": "^5.0.0",
|
|
27
27
|
"nyc": "^15.1.0",
|
|
28
|
-
"prettier": "^3.
|
|
29
|
-
"tsx": "^4.
|
|
28
|
+
"prettier": "^3.2.5",
|
|
29
|
+
"tsx": "^4.19.2",
|
|
30
30
|
"typescript": "^5.3.3"
|
|
31
31
|
},
|
|
32
32
|
"exports": {
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"lint:eslint": "eslint -f visualstudio .",
|
|
70
70
|
"lint:prettier": "prettier \"./**/*{.ts,.js,.json,.md,.yml,rc}\"",
|
|
71
71
|
"mocha": "cross-env NODE_ENV=test mocha \"./src/**/__tests__/*.test.ts\"",
|
|
72
|
-
"prepare": "husky
|
|
72
|
+
"prepare": "husky",
|
|
73
73
|
"release": "npm run build && changeset publish",
|
|
74
74
|
"report": "open ./coverage/lcov-report/index.html",
|
|
75
75
|
"test": "npm run mocha -- --watch",
|