svelte-effect-runtime 1.1.0 → 1.1.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.
@@ -12578,7 +12578,7 @@ function transformEffectMarkup(content, options) {
12578
12578
  };
12579
12579
  }
12580
12580
  function createParseSafeMarkupSource(content) {
12581
- const excludedRanges = findExcludedRanges(content);
12581
+ const excludedRanges = findParseSafeMaskRanges(content);
12582
12582
  if (excludedRanges.length === 0) return content;
12583
12583
  let result = "";
12584
12584
  let cursor = 0;
@@ -12974,6 +12974,40 @@ function findExcludedRanges(content) {
12974
12974
  }
12975
12975
  return ranges.sort((left, right) => left.start - right.start);
12976
12976
  }
12977
+ function findParseSafeMaskRanges(content) {
12978
+ return [
12979
+ ...findTagBodyRanges(content, "script"),
12980
+ ...findTagBodyRanges(content, "style"),
12981
+ ...findCommentRanges(content)
12982
+ ].sort((left, right) => left.start - right.start);
12983
+ }
12984
+ function findTagBodyRanges(content, tagName) {
12985
+ const ranges = [];
12986
+ const pattern = new RegExp(`<${tagName}\\b[^>]*>([\\s\\S]*?)<\\/${tagName}\\s*>`, "gi");
12987
+ for (const match of content.matchAll(pattern)) {
12988
+ if (match.index === void 0) continue;
12989
+ const fullMatch = match[0];
12990
+ const body = match[1] ?? "";
12991
+ const openTagEnd = fullMatch.indexOf(">") + 1;
12992
+ const start = match.index + openTagEnd;
12993
+ ranges.push({
12994
+ start,
12995
+ end: start + body.length
12996
+ });
12997
+ }
12998
+ return ranges;
12999
+ }
13000
+ function findCommentRanges(content) {
13001
+ const ranges = [];
13002
+ for (const match of content.matchAll(/<!--[\s\S]*?-->/g)) {
13003
+ if (match.index === void 0) continue;
13004
+ ranges.push({
13005
+ start: match.index,
13006
+ end: match.index + match[0].length
13007
+ });
13008
+ }
13009
+ return ranges;
13010
+ }
12977
13011
  function findExcludedRangeAt(ranges, index) {
12978
13012
  return ranges.find((range) => range.start <= index && index < range.end);
12979
13013
  }
@@ -13312,4 +13346,4 @@ function indentBlock(text, indent) {
13312
13346
  //#endregion
13313
13347
  export { transformEffectMarkup as t };
13314
13348
 
13315
- //# sourceMappingURL=markup-DItLw1g8.js.map
13349
+ //# sourceMappingURL=markup-CNqU2j9U.js.map