@hyperframes/parsers 0.8.186 → 0.8.189

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/hfIds.js CHANGED
@@ -126,7 +126,6 @@ function inDocumentOrder(el) {
126
126
  var RAW_TEXT = /* @__PURE__ */ new Set(["script", "style", "textarea", "title", "xmp", "noembed", "noframes"]);
127
127
  var IMPLIED = /* @__PURE__ */ new Set(["html", "head", "body", "tbody"]);
128
128
  function startTags(html) {
129
- const lower = html.toLowerCase();
130
129
  const tags = [];
131
130
  let i = html.indexOf("<");
132
131
  while (i >= 0) {
@@ -139,18 +138,15 @@ function startTags(html) {
139
138
  if (end < 0) return null;
140
139
  const tag = name[1].toLowerCase();
141
140
  tags.push({ name: tag, nameEnd: i + name[0].length, bracket: end });
142
- const after = RAW_TEXT.has(tag) ? rawTextEnd(lower, tag, end) : end;
141
+ const after = RAW_TEXT.has(tag) ? rawTextEnd(html, tag, end) : end;
143
142
  i = after < 0 ? -1 : html.indexOf("<", after + 1);
144
143
  }
145
144
  return tags;
146
145
  }
147
- function rawTextEnd(lower, tag, from) {
148
- const marker = `</${tag}`;
149
- for (let at = lower.indexOf(marker, from); at >= 0; at = lower.indexOf(marker, at + marker.length)) {
150
- const next = lower[at + marker.length];
151
- if (next !== void 0 && /[\s/>]/.test(next)) return at;
152
- }
153
- return -1;
146
+ function rawTextEnd(html, tag, from) {
147
+ const endTag = new RegExp(`</${tag}(?=[\\s/>]|$)`, "gi");
148
+ endTag.lastIndex = from;
149
+ return endTag.exec(html)?.index ?? -1;
154
150
  }
155
151
  function nextTagAfter(html, lt) {
156
152
  const comment = html.startsWith("<!--", lt);
package/dist/index.js CHANGED
@@ -2516,7 +2516,6 @@ function inDocumentOrder(el) {
2516
2516
  var RAW_TEXT = /* @__PURE__ */ new Set(["script", "style", "textarea", "title", "xmp", "noembed", "noframes"]);
2517
2517
  var IMPLIED = /* @__PURE__ */ new Set(["html", "head", "body", "tbody"]);
2518
2518
  function startTags(html) {
2519
- const lower = html.toLowerCase();
2520
2519
  const tags = [];
2521
2520
  let i = html.indexOf("<");
2522
2521
  while (i >= 0) {
@@ -2529,18 +2528,15 @@ function startTags(html) {
2529
2528
  if (end < 0) return null;
2530
2529
  const tag = name[1].toLowerCase();
2531
2530
  tags.push({ name: tag, nameEnd: i + name[0].length, bracket: end });
2532
- const after = RAW_TEXT.has(tag) ? rawTextEnd(lower, tag, end) : end;
2531
+ const after = RAW_TEXT.has(tag) ? rawTextEnd(html, tag, end) : end;
2533
2532
  i = after < 0 ? -1 : html.indexOf("<", after + 1);
2534
2533
  }
2535
2534
  return tags;
2536
2535
  }
2537
- function rawTextEnd(lower, tag, from) {
2538
- const marker = `</${tag}`;
2539
- for (let at = lower.indexOf(marker, from); at >= 0; at = lower.indexOf(marker, at + marker.length)) {
2540
- const next = lower[at + marker.length];
2541
- if (next !== void 0 && /[\s/>]/.test(next)) return at;
2542
- }
2543
- return -1;
2536
+ function rawTextEnd(html, tag, from) {
2537
+ const endTag = new RegExp(`</${tag}(?=[\\s/>]|$)`, "gi");
2538
+ endTag.lastIndex = from;
2539
+ return endTag.exec(html)?.index ?? -1;
2544
2540
  }
2545
2541
  function nextTagAfter(html, lt) {
2546
2542
  const comment = html.startsWith("<!--", lt);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hyperframes/parsers",
3
- "version": "0.8.186",
3
+ "version": "0.8.189",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/heygen-com/hyperframes",
@@ -135,7 +135,7 @@
135
135
  "tsx": "^4.21.0",
136
136
  "typescript": "^5.0.0",
137
137
  "vitest": "^4.1.11",
138
- "@hyperframes/core": "0.8.186"
138
+ "@hyperframes/core": "0.8.189"
139
139
  },
140
140
  "scripts": {
141
141
  "build": "tsup",