htmljs-parser 5.10.1 → 5.10.2
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 +11 -2
- package/dist/index.mjs +11 -2
- package/dist/util/util.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -78,6 +78,15 @@ var TagType = /* @__PURE__ */ ((TagType2) => {
|
|
|
78
78
|
function isWhitespaceCode(code) {
|
|
79
79
|
return code <= 32 /* SPACE */;
|
|
80
80
|
}
|
|
81
|
+
function isLineCode(code) {
|
|
82
|
+
switch (code) {
|
|
83
|
+
case 10 /* NEWLINE */:
|
|
84
|
+
case 13 /* CARRIAGE_RETURN */:
|
|
85
|
+
return true;
|
|
86
|
+
default:
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
81
90
|
function isIndentCode(code) {
|
|
82
91
|
return code === 9 /* TAB */ || code === 32 /* SPACE */;
|
|
83
92
|
}
|
|
@@ -102,7 +111,7 @@ function htmlEOF() {
|
|
|
102
111
|
if (!this.activeTag || this.activeTag.concise) {
|
|
103
112
|
const pos = this.pos;
|
|
104
113
|
let cur = this.pos;
|
|
105
|
-
while (cur &&
|
|
114
|
+
while (cur && isLineCode(this.data.charCodeAt(cur - 1))) {
|
|
106
115
|
cur--;
|
|
107
116
|
}
|
|
108
117
|
this.pos = cur;
|
|
@@ -1242,7 +1251,7 @@ function handleDelimitedBlockEOL(parser, first, newLineLength, {
|
|
|
1242
1251
|
} else if (indent && !parser.onlyWhitespaceRemainsOnLine(newLineLength)) {
|
|
1243
1252
|
const pos = parser.pos;
|
|
1244
1253
|
let cur = parser.pos;
|
|
1245
|
-
while (cur &&
|
|
1254
|
+
while (cur && isLineCode(parser.data.charCodeAt(cur - 1))) {
|
|
1246
1255
|
cur--;
|
|
1247
1256
|
}
|
|
1248
1257
|
parser.pos = cur;
|
package/dist/index.mjs
CHANGED
|
@@ -49,6 +49,15 @@ var TagType = /* @__PURE__ */ ((TagType2) => {
|
|
|
49
49
|
function isWhitespaceCode(code) {
|
|
50
50
|
return code <= 32 /* SPACE */;
|
|
51
51
|
}
|
|
52
|
+
function isLineCode(code) {
|
|
53
|
+
switch (code) {
|
|
54
|
+
case 10 /* NEWLINE */:
|
|
55
|
+
case 13 /* CARRIAGE_RETURN */:
|
|
56
|
+
return true;
|
|
57
|
+
default:
|
|
58
|
+
return false;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
52
61
|
function isIndentCode(code) {
|
|
53
62
|
return code === 9 /* TAB */ || code === 32 /* SPACE */;
|
|
54
63
|
}
|
|
@@ -73,7 +82,7 @@ function htmlEOF() {
|
|
|
73
82
|
if (!this.activeTag || this.activeTag.concise) {
|
|
74
83
|
const pos = this.pos;
|
|
75
84
|
let cur = this.pos;
|
|
76
|
-
while (cur &&
|
|
85
|
+
while (cur && isLineCode(this.data.charCodeAt(cur - 1))) {
|
|
77
86
|
cur--;
|
|
78
87
|
}
|
|
79
88
|
this.pos = cur;
|
|
@@ -1213,7 +1222,7 @@ function handleDelimitedBlockEOL(parser, first, newLineLength, {
|
|
|
1213
1222
|
} else if (indent && !parser.onlyWhitespaceRemainsOnLine(newLineLength)) {
|
|
1214
1223
|
const pos = parser.pos;
|
|
1215
1224
|
let cur = parser.pos;
|
|
1216
|
-
while (cur &&
|
|
1225
|
+
while (cur && isLineCode(parser.data.charCodeAt(cur - 1))) {
|
|
1217
1226
|
cur--;
|
|
1218
1227
|
}
|
|
1219
1228
|
parser.pos = cur;
|
package/dist/util/util.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { CODE, type Parser } from "../internal";
|
|
2
2
|
import { type Location, type Position } from "./constants";
|
|
3
3
|
export declare function isWhitespaceCode(code: number): boolean;
|
|
4
|
+
export declare function isLineCode(code: number): boolean;
|
|
4
5
|
export declare function isIndentCode(code: number): code is CODE.SPACE | CODE.TAB;
|
|
5
6
|
/**
|
|
6
7
|
* 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,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.10.
|
|
4
|
+
"version": "5.10.2",
|
|
5
5
|
"devDependencies": {
|
|
6
6
|
"@changesets/changelog-github": "^0.5.0",
|
|
7
7
|
"@changesets/cli": "^2.27.1",
|