htmljs-parser 3.2.2 → 3.3.1

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
@@ -1097,9 +1097,9 @@ var EXPRESSION = {
1097
1097
  }
1098
1098
  };
1099
1099
  function buildOperatorPattern(isConcise) {
1100
- const binary = `[!~*%&^|?:]+|(?<=[!=<>&^~|/*?%+-])=|=(?=[!=<>&^~|/*?%+-])|(?<!\\+)\\s*\\+(?:\\s*\\+\\s*\\+)*\\s*(?!\\+)|(?<!^\\s*|-)-${isConcise ? "" : "(?:\\s*-\\s*-)*\\s*"}(?!-)|(?<![/*])/(?![/*${isConcise ? "" : ">"}])|(?<!${isConcise ? "^\\s*|" : ""}\\.)\\.(?!\\.)|<${isConcise ? "{2,}|(?<!^\\s*)<" : "+"}|>${isConcise ? "+" : "{2,}"}|\\bin(?:stanceof)?(?=\\s+[^=/,;:>])`;
1101
- const unary = "\\b(?:a(?:sync|wait)|class|function|new|typeof|void)\\b";
1102
- const lookAheadPattern = "\\s*(?:" + binary + `)\\s*|\\s+(?=[${isConcise ? "" : "["}{(])`;
1100
+ const binary = `[!~*%&^|?:<]+|(?<=[!=<>&^~|/*?%+-])=|=(?=[!=<>&^~|/*?%+-])|(?<!\\+)[ \\t]*\\+(?:[ \\t]*\\+[ \\t]*\\+)*[ \\t]*(?!\\+)|(?<!-)-${isConcise ? "" : "(?:[ \\t]*-[ \\t]*-)*[ \\t]*"}(?!-)|(?<![/*])/(?![/*${isConcise ? "" : ">"}])|(?<!\\.)\\.(?!\\.)|>${isConcise ? "+" : "{2,}"}|\\b(?:in(?:stanceof)?|as|extends)(?=[ \\t]+[^=/,;:>])`;
1101
+ const unary = "\\b(?:a(?:sync|wait)|keyof|class|function|new|typeof|void)\\b";
1102
+ const lookAheadPattern = "[ \\t]*(?:" + binary + `)[ \\t]*|[ \\t]+(?=[{(])`;
1103
1103
  const lookBehindPattern = `(?<=${unary}|${binary})`;
1104
1104
  return new RegExp(`${lookAheadPattern}|${lookBehindPattern}`, "ym");
1105
1105
  }
@@ -1107,7 +1107,7 @@ function checkForOperators(parser, expression) {
1107
1107
  if (expression.skipOperators) {
1108
1108
  return false;
1109
1109
  }
1110
- const pattern = parser.isConcise ? conciseOperatorPattern : htmlOperatorPattern;
1110
+ const pattern = parser.isConcise || expression.terminatedByEOL ? conciseOperatorPattern : htmlOperatorPattern;
1111
1111
  pattern.lastIndex = parser.pos;
1112
1112
  const matches = pattern.exec(parser.data);
1113
1113
  if (matches) {
package/dist/index.mjs CHANGED
@@ -1076,9 +1076,9 @@ var EXPRESSION = {
1076
1076
  }
1077
1077
  };
1078
1078
  function buildOperatorPattern(isConcise) {
1079
- const binary = `[!~*%&^|?:]+|(?<=[!=<>&^~|/*?%+-])=|=(?=[!=<>&^~|/*?%+-])|(?<!\\+)\\s*\\+(?:\\s*\\+\\s*\\+)*\\s*(?!\\+)|(?<!^\\s*|-)-${isConcise ? "" : "(?:\\s*-\\s*-)*\\s*"}(?!-)|(?<![/*])/(?![/*${isConcise ? "" : ">"}])|(?<!${isConcise ? "^\\s*|" : ""}\\.)\\.(?!\\.)|<${isConcise ? "{2,}|(?<!^\\s*)<" : "+"}|>${isConcise ? "+" : "{2,}"}|\\bin(?:stanceof)?(?=\\s+[^=/,;:>])`;
1080
- const unary = "\\b(?:a(?:sync|wait)|class|function|new|typeof|void)\\b";
1081
- const lookAheadPattern = "\\s*(?:" + binary + `)\\s*|\\s+(?=[${isConcise ? "" : "["}{(])`;
1079
+ const binary = `[!~*%&^|?:<]+|(?<=[!=<>&^~|/*?%+-])=|=(?=[!=<>&^~|/*?%+-])|(?<!\\+)[ \\t]*\\+(?:[ \\t]*\\+[ \\t]*\\+)*[ \\t]*(?!\\+)|(?<!-)-${isConcise ? "" : "(?:[ \\t]*-[ \\t]*-)*[ \\t]*"}(?!-)|(?<![/*])/(?![/*${isConcise ? "" : ">"}])|(?<!\\.)\\.(?!\\.)|>${isConcise ? "+" : "{2,}"}|\\b(?:in(?:stanceof)?|as|extends)(?=[ \\t]+[^=/,;:>])`;
1080
+ const unary = "\\b(?:a(?:sync|wait)|keyof|class|function|new|typeof|void)\\b";
1081
+ const lookAheadPattern = "[ \\t]*(?:" + binary + `)[ \\t]*|[ \\t]+(?=[{(])`;
1082
1082
  const lookBehindPattern = `(?<=${unary}|${binary})`;
1083
1083
  return new RegExp(`${lookAheadPattern}|${lookBehindPattern}`, "ym");
1084
1084
  }
@@ -1086,7 +1086,7 @@ function checkForOperators(parser, expression) {
1086
1086
  if (expression.skipOperators) {
1087
1087
  return false;
1088
1088
  }
1089
- const pattern = parser.isConcise ? conciseOperatorPattern : htmlOperatorPattern;
1089
+ const pattern = parser.isConcise || expression.terminatedByEOL ? conciseOperatorPattern : htmlOperatorPattern;
1090
1090
  pattern.lastIndex = parser.pos;
1091
1091
  const matches = pattern.exec(parser.data);
1092
1092
  if (matches) {
package/package.json CHANGED
@@ -1,34 +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": "3.2.2",
5
- "author": "Phillip Gates-Idem <phillip.idem@gmail.com>",
4
+ "version": "3.3.1",
6
5
  "devDependencies": {
7
- "@commitlint/cli": "^16.2.3",
8
- "@commitlint/config-conventional": "^16.2.1",
6
+ "@changesets/changelog-github": "^0.4.4",
7
+ "@changesets/cli": "^2.22.0",
9
8
  "@types/benchmark": "^2.1.1",
10
9
  "@types/degit": "^2.8.3",
11
- "@types/mocha": "^9.1.0",
12
- "@types/node": "^17.0.22",
13
- "@typescript-eslint/eslint-plugin": "^5.16.0",
14
- "@typescript-eslint/parser": "^5.16.0",
10
+ "@types/mocha": "^9.1.1",
11
+ "@types/node": "^17.0.27",
12
+ "@typescript-eslint/eslint-plugin": "^5.21.0",
13
+ "@typescript-eslint/parser": "^5.21.0",
15
14
  "benchmark": "^2.1.4",
16
15
  "cross-env": "^7.0.3",
17
16
  "degit": "^2.8.4",
18
- "esbuild": "0.14.27",
17
+ "esbuild": "0.14.38",
19
18
  "esbuild-register": "^3.3.2",
20
- "eslint": "^8.11.0",
19
+ "eslint": "^8.14.0",
21
20
  "eslint-config-prettier": "^8.5.0",
22
21
  "fast-glob": "^3.2.11",
23
22
  "fixpack": "^4.0.0",
24
23
  "husky": "^7.0.4",
25
- "lint-staged": "^12.3.7",
24
+ "lint-staged": "^12.4.1",
26
25
  "mocha": "^9.2.2",
27
26
  "mocha-snap": "^4.3.0",
28
27
  "nyc": "^15.1.0",
29
- "prettier": "^2.6.0",
30
- "semantic-release": "^19.0.2",
31
- "typescript": "^4.6.2"
28
+ "prettier": "^2.6.2",
29
+ "typescript": "^4.6.3"
32
30
  },
33
31
  "exports": {
34
32
  ".": {
@@ -71,11 +69,12 @@
71
69
  "mocha": "cross-env NODE_ENV=test mocha \"./src/**/__tests__/*.test.ts\"",
72
70
  "prepare": "husky install",
73
71
  "prepublishOnly": "npm run build",
74
- "release": "semantic-release",
72
+ "publish": "npm run build && changeset publish",
75
73
  "report": "open ./coverage/lcov-report/index.html",
76
74
  "test": "npm run mocha -- --watch",
77
75
  "test:inspect": "npm test -- --inspect",
78
- "test:update": "npm run mocha -- --update"
76
+ "test:update": "npm run mocha -- --update",
77
+ "version": "changeset version"
79
78
  },
80
79
  "types": "dist/index.d.ts"
81
80
  }