marko 6.3.37 → 6.3.39

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.
@@ -1895,12 +1895,15 @@ const REORDER_RUNTIME_CODE = `((runtime) => {
1895
1895
  (placeholderRoot = placeholders[id] =
1896
1896
  {
1897
1897
  i: runtime.l[id] ? 1 : 2,
1898
- c(start = runtime.l["^" + id]) {
1898
+ // Resume may still walk markers inside the dropped placeholder, so
1899
+ // park it in any detached parent (a bare <t> clone is the cheapest).
1900
+ c(start = runtime.l["^" + id], removed = node.cloneNode()) {
1899
1901
  if (--placeholderRoot.i) return 1;
1900
1902
  for (
1901
1903
  ;
1902
- (nextSibling =
1903
- runtime.l[id].previousSibling || start).remove(),
1904
+ removed.prepend(
1905
+ (nextSibling = runtime.l[id].previousSibling || start),
1906
+ ),
1904
1907
  start != nextSibling;
1905
1908
 
1906
1909
  );
@@ -1893,12 +1893,15 @@ const REORDER_RUNTIME_CODE = `((runtime) => {
1893
1893
  (placeholderRoot = placeholders[id] =
1894
1894
  {
1895
1895
  i: runtime.l[id] ? 1 : 2,
1896
- c(start = runtime.l["^" + id]) {
1896
+ // Resume may still walk markers inside the dropped placeholder, so
1897
+ // park it in any detached parent (a bare <t> clone is the cheapest).
1898
+ c(start = runtime.l["^" + id], removed = node.cloneNode()) {
1897
1899
  if (--placeholderRoot.i) return 1;
1898
1900
  for (
1899
1901
  ;
1900
- (nextSibling =
1901
- runtime.l[id].previousSibling || start).remove(),
1902
+ removed.prepend(
1903
+ (nextSibling = runtime.l[id].previousSibling || start),
1904
+ ),
1902
1905
  start != nextSibling;
1903
1906
 
1904
1907
  );
@@ -1,2 +1,2 @@
1
1
  export declare const WALKER_RUNTIME_CODE = "(e=>(self[e]||=(l,f=e+l,s=f.length,a={},d=[],t=document,n=t.createTreeWalker(t,129))=>t=self[e][l]={i:f,d:t,l:a,v:d,x(){},w(e,l,r){for(;e=n.nextNode();)t.x(l=(l=e.data)&&!l.indexOf(f)&&(a[r=l.slice(s+1)]=e,l[s]),r,e),l>\"#\"&&d.push(e)}},self[e]))";
2
- export declare const REORDER_RUNTIME_CODE = "(e=>{if(e.j)return;let i,l,r,t=e.p={},c=(i,l)=>e.l[i].replaceWith(...l.childNodes);e.j={},e.x=(n,a,d,o,g)=>{d==r&&i(),\"#\"==n?(t[a]=l).i++:\"!\"==n?e.l[a]&&t[a]&&(r=d.nextSibling,i=()=>t[a].c()):\"T\"==d.tagName&&(a=d.getAttribute(e.i))&&(r=d.nextSibling,i=()=>{d.remove(),o||c(a,d),l.c()},l=t[a]||(o=t[a]={i:e.l[a]?1:2,c(i=e.l[\"^\"+a]){if(--o.i)return 1;for(;(r=e.l[a].previousSibling||i).remove(),i!=r;);c(a,d)}}),(n=e.j[a])&&(g=l.c,l.c=()=>g()||n(e.r)))}})";
2
+ export declare const REORDER_RUNTIME_CODE = "(e=>{if(e.j)return;let i,l,r,t=e.p={},c=(i,l)=>e.l[i].replaceWith(...l.childNodes);e.j={},e.x=(n,a,d,o,g)=>{d==r&&i(),\"#\"==n?(t[a]=l).i++:\"!\"==n?e.l[a]&&t[a]&&(r=d.nextSibling,i=()=>t[a].c()):\"T\"==d.tagName&&(a=d.getAttribute(e.i))&&(r=d.nextSibling,i=()=>{d.remove(),o||c(a,d),l.c()},l=t[a]||(o=t[a]={i:e.l[a]?1:2,c(i=e.l[\"^\"+a],f=d.cloneNode()){if(--o.i)return 1;for(;f.prepend(r=e.l[a].previousSibling||i),i!=r;);c(a,d)}}),(n=e.j[a])&&(g=l.c,l.c=()=>g()||n(e.r)))}})";
@@ -1,2 +1,2 @@
1
1
  export declare const WALKER_RUNTIME_CODE = "((runtimeId) => (self[runtimeId] ||= (\n renderId,\n prefix = runtimeId + renderId,\n prefixLen = prefix.length,\n lookup = {},\n visits = [],\n doc = document,\n walker = doc.createTreeWalker(\n doc,\n 129 /* NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_ELEMENT */,\n ),\n) =>\n doc = (self[runtimeId][renderId] = {\n i: prefix,\n d: doc,\n l: lookup,\n v: visits,\n x() {},\n w(node, op, id) {\n while ((node = walker.nextNode())) {\n doc.x(\n (op =\n (op = node.data) &&\n !op.indexOf(prefix) &&\n ((lookup[(id = op.slice(prefixLen + 1))] = node), op[prefixLen])),\n id,\n node,\n );\n\n if (op > \"#\") {\n visits.push(node);\n }\n }\n },\n })\n, self[runtimeId]))";
2
- export declare const REORDER_RUNTIME_CODE = "((runtime) => {\n if (runtime.j) return;\n let onNextSibling,\n placeholder,\n nextSibling,\n placeholders = runtime.p = {},\n replace = (id, container) => runtime.l[id].replaceWith(...container.childNodes);\n runtime.j = {};\n runtime.x = (op, id, node, placeholderRoot, placeholderCb) => {\n if (node == nextSibling) {\n onNextSibling();\n }\n\n if (op == \"#\") {\n (placeholders[id] = placeholder).i++;\n } else if (op == \"!\") {\n if (runtime.l[id] && placeholders[id]) {\n nextSibling = node.nextSibling;\n onNextSibling = () => placeholders[id].c();\n }\n } else if (node.tagName == \"T\" && (id = node.getAttribute(runtime.i))) {\n nextSibling = node.nextSibling;\n onNextSibling = () => {\n node.remove();\n placeholderRoot || replace(id, node);\n placeholder.c();\n };\n placeholder =\n placeholders[id] ||\n (placeholderRoot = placeholders[id] =\n {\n i: runtime.l[id] ? 1 : 2,\n c(start = runtime.l[\"^\" + id]) {\n if (--placeholderRoot.i) return 1;\n for (\n ;\n (nextSibling =\n runtime.l[id].previousSibling || start).remove(),\n start != nextSibling;\n\n );\n replace(id, node);\n },\n });\n // repurpose \"op\" for callbacks ...carefully\n if ((op = runtime.j[id])) {\n placeholderCb = placeholder.c;\n placeholder.c = () => placeholderCb() || op(runtime.r);\n }\n }\n };\n})";
2
+ export declare const REORDER_RUNTIME_CODE = "((runtime) => {\n if (runtime.j) return;\n let onNextSibling,\n placeholder,\n nextSibling,\n placeholders = runtime.p = {},\n replace = (id, container) => runtime.l[id].replaceWith(...container.childNodes);\n runtime.j = {};\n runtime.x = (op, id, node, placeholderRoot, placeholderCb) => {\n if (node == nextSibling) {\n onNextSibling();\n }\n\n if (op == \"#\") {\n (placeholders[id] = placeholder).i++;\n } else if (op == \"!\") {\n if (runtime.l[id] && placeholders[id]) {\n nextSibling = node.nextSibling;\n onNextSibling = () => placeholders[id].c();\n }\n } else if (node.tagName == \"T\" && (id = node.getAttribute(runtime.i))) {\n nextSibling = node.nextSibling;\n onNextSibling = () => {\n node.remove();\n placeholderRoot || replace(id, node);\n placeholder.c();\n };\n placeholder =\n placeholders[id] ||\n (placeholderRoot = placeholders[id] =\n {\n i: runtime.l[id] ? 1 : 2,\n // Resume may still walk markers inside the dropped placeholder, so\n // park it in any detached parent (a bare <t> clone is the cheapest).\n c(start = runtime.l[\"^\" + id], removed = node.cloneNode()) {\n if (--placeholderRoot.i) return 1;\n for (\n ;\n removed.prepend(\n (nextSibling = runtime.l[id].previousSibling || start),\n ),\n start != nextSibling;\n\n );\n replace(id, node);\n },\n });\n // repurpose \"op\" for callbacks ...carefully\n if ((op = runtime.j[id])) {\n placeholderCb = placeholder.c;\n placeholder.c = () => placeholderCb() || op(runtime.r);\n }\n }\n };\n})";
package/dist/html.js CHANGED
@@ -1732,7 +1732,7 @@ var State = class {
1732
1732
  }
1733
1733
  reorderedChunk.async = !1;
1734
1734
  }
1735
- needsWalk = !0, state.hasReorderRuntime || (state.hasReorderRuntime = !0, scripts = concatScripts(scripts, "(e=>{if(e.j)return;let i,l,r,t=e.p={},c=(i,l)=>e.l[i].replaceWith(...l.childNodes);e.j={},e.x=(n,a,d,o,g)=>{d==r&&i(),\"#\"==n?(t[a]=l).i++:\"!\"==n?e.l[a]&&t[a]&&(r=d.nextSibling,i=()=>t[a].c()):\"T\"==d.tagName&&(a=d.getAttribute(e.i))&&(r=d.nextSibling,i=()=>{d.remove(),o||c(a,d),l.c()},l=t[a]||(o=t[a]={i:e.l[a]?1:2,c(i=e.l[\"^\"+a]){if(--o.i)return 1;for(;(r=e.l[a].previousSibling||i).remove(),i!=r;);c(a,d)}}),(n=e.j[a])&&(g=l.c,l.c=()=>g()||n(e.r)))}})(" + runtimePrefix + ")"));
1735
+ needsWalk = !0, state.hasReorderRuntime || (state.hasReorderRuntime = !0, scripts = concatScripts(scripts, "(e=>{if(e.j)return;let i,l,r,t=e.p={},c=(i,l)=>e.l[i].replaceWith(...l.childNodes);e.j={},e.x=(n,a,d,o,g)=>{d==r&&i(),\"#\"==n?(t[a]=l).i++:\"!\"==n?e.l[a]&&t[a]&&(r=d.nextSibling,i=()=>t[a].c()):\"T\"==d.tagName&&(a=d.getAttribute(e.i))&&(r=d.nextSibling,i=()=>{d.remove(),o||c(a,d),l.c()},l=t[a]||(o=t[a]={i:e.l[a]?1:2,c(i=e.l[\"^\"+a],f=d.cloneNode()){if(--o.i)return 1;for(;f.prepend(r=e.l[a].previousSibling||i),i!=r;);c(a,d)}}),(n=e.j[a])&&(g=l.c,l.c=()=>g()||n(e.r)))}})(" + runtimePrefix + ")"));
1736
1736
  let { reorderId } = reorderedChunk, readyReservations = [], reorderHTML = "", reorderEffects = "", reorderScripts = "", cur = reorderedChunk;
1737
1737
  for (reorderedChunk.reorderId = null;;) {
1738
1738
  cur.flushPlaceholder(), cur.deferOwnReady();
package/dist/html.mjs CHANGED
@@ -1731,7 +1731,7 @@ var State = class {
1731
1731
  }
1732
1732
  reorderedChunk.async = !1;
1733
1733
  }
1734
- needsWalk = !0, state.hasReorderRuntime || (state.hasReorderRuntime = !0, scripts = concatScripts(scripts, "(e=>{if(e.j)return;let i,l,r,t=e.p={},c=(i,l)=>e.l[i].replaceWith(...l.childNodes);e.j={},e.x=(n,a,d,o,g)=>{d==r&&i(),\"#\"==n?(t[a]=l).i++:\"!\"==n?e.l[a]&&t[a]&&(r=d.nextSibling,i=()=>t[a].c()):\"T\"==d.tagName&&(a=d.getAttribute(e.i))&&(r=d.nextSibling,i=()=>{d.remove(),o||c(a,d),l.c()},l=t[a]||(o=t[a]={i:e.l[a]?1:2,c(i=e.l[\"^\"+a]){if(--o.i)return 1;for(;(r=e.l[a].previousSibling||i).remove(),i!=r;);c(a,d)}}),(n=e.j[a])&&(g=l.c,l.c=()=>g()||n(e.r)))}})(" + runtimePrefix + ")"));
1734
+ needsWalk = !0, state.hasReorderRuntime || (state.hasReorderRuntime = !0, scripts = concatScripts(scripts, "(e=>{if(e.j)return;let i,l,r,t=e.p={},c=(i,l)=>e.l[i].replaceWith(...l.childNodes);e.j={},e.x=(n,a,d,o,g)=>{d==r&&i(),\"#\"==n?(t[a]=l).i++:\"!\"==n?e.l[a]&&t[a]&&(r=d.nextSibling,i=()=>t[a].c()):\"T\"==d.tagName&&(a=d.getAttribute(e.i))&&(r=d.nextSibling,i=()=>{d.remove(),o||c(a,d),l.c()},l=t[a]||(o=t[a]={i:e.l[a]?1:2,c(i=e.l[\"^\"+a],f=d.cloneNode()){if(--o.i)return 1;for(;f.prepend(r=e.l[a].previousSibling||i),i!=r;);c(a,d)}}),(n=e.j[a])&&(g=l.c,l.c=()=>g()||n(e.r)))}})(" + runtimePrefix + ")"));
1735
1735
  let { reorderId } = reorderedChunk, readyReservations = [], reorderHTML = "", reorderEffects = "", reorderScripts = "", cur = reorderedChunk;
1736
1736
  for (reorderedChunk.reorderId = null;;) {
1737
1737
  cur.flushPlaceholder(), cur.deferOwnReady();
@@ -7619,13 +7619,20 @@ function finalizeReferences() {
7619
7619
  intersections.sort((a, b) => {
7620
7620
  const aAnchor = sectionAnchors.get(a);
7621
7621
  const bAnchor = sectionAnchors.get(b);
7622
- return aAnchor ? bAnchor ? bindingUtil.compare(aAnchor, bAnchor) : -1 : bAnchor ? 1 : 0;
7622
+ return aAnchor ? bAnchor ? bindingUtil.compare(aAnchor, bAnchor) : 1 : bAnchor ? -1 : 0;
7623
7623
  });
7624
7624
  }
7625
7625
  let intersectionIndex = 0;
7626
7626
  let nextId = 0;
7627
7627
  let intersection;
7628
7628
  forEach(ownedBindings, (binding) => {
7629
+ if (binding.type !== 0) while (intersectionIndex < intersections.length && !anchors.get(intersection = intersections[intersectionIndex])) {
7630
+ intersectionIndex++;
7631
+ intersectionMeta.set(intersection, {
7632
+ id: nextId++,
7633
+ scopeOffset: getMaxOwnSourceOffset(intersection, section)
7634
+ });
7635
+ }
7629
7636
  binding.id = nextId++;
7630
7637
  nextId += binding.reserveSize;
7631
7638
  while (intersectionIndex < intersections.length && anchors.get(intersection = intersections[intersectionIndex]) === binding) {
@@ -8048,7 +8055,7 @@ function pruneBinding(binding) {
8048
8055
  while (upstream && !upstream.reads.has(read)) upstream = upstream.upstreamAlias;
8049
8056
  if (upstream) binding.reads.delete(read);
8050
8057
  }
8051
- let shouldPrune = !binding.reads.size;
8058
+ let shouldPrune = !binding.reads.size && !binding.reserveSize;
8052
8059
  for (const alias of binding.aliases) if (pruneBinding(alias)) binding.aliases.delete(alias);
8053
8060
  else if (alias.type !== 6) shouldPrune = false;
8054
8061
  for (const [key, alias] of binding.propertyAliases) if (pruneBinding(alias)) binding.propertyAliases.delete(key);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "marko",
3
- "version": "6.3.37",
3
+ "version": "6.3.39",
4
4
  "description": "Optimized runtime for Marko templates.",
5
5
  "keywords": [
6
6
  "api",
@@ -54,8 +54,8 @@
54
54
  "magic-string": "^0.30.21"
55
55
  },
56
56
  "devDependencies": {
57
- "@marko/runtime-tags": "npm:marko@6.3.37",
58
- "marko": "5.39.34"
57
+ "marko": "5.39.34",
58
+ "@marko/runtime-tags": "npm:marko@6.3.39"
59
59
  },
60
60
  "engines": {
61
61
  "node": ">=22"