marko 6.0.86 → 6.0.88

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/html.mjs CHANGED
@@ -109,7 +109,7 @@ function forStepBy(by, index) {
109
109
  }
110
110
 
111
111
  // src/html/inlined-runtimes.ts
112
- var WALKER_RUNTIME_CODE = '(e=>(self[e]||(self[e]=(o,l=e+o,d=l.length,n={},f=[],s=document,a=s.createTreeWalker(s,129))=>s=self[e][o]={i:l,d:s,l:n,v:f,x(){},w(e,o,i){for(;e=a.nextNode();)s.x(o=(o=e.data)&&!o.indexOf(l)&&(n[i=o.slice(d+1)]=e,o[d]),i,e),o>"#"&&f.push(e)}})))', REORDER_RUNTIME_CODE = '(e=>{if(e.j)return;let i,o,l,r={},t=(e,i)=>{e.replaceWith(...i.childNodes),i.remove()};e.d.head.append(e.d.querySelector("style["+e.i+"]")||""),e.j={},e.x=(c,d,n,a,g)=>{"#"==c?(r[d]=o).i++:n==l&&i(),"T"==n.tagName&&(d=n.getAttribute(e.i))&&((a=e.l["^"+d])&&(r[d]={i:1,c(i=e.l[d]||n){for(;(l=i.previousSibling||a).remove(),a!=l;);t(i,n)}}),l=n.nextSibling,o=r[d],i=()=>{a||t(e.l[d],n),--o.i||o.c()},(c=e.j[d])&&(g=o.c,o.c=()=>g()+c(e.r)))}})';
112
+ var WALKER_RUNTIME_CODE = '(e=>(self[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]))', REORDER_RUNTIME_CODE = '(e=>{if(e.j)return;let i,r,l,t={},c=(i,r)=>e.l[i].replaceWith(...r.childNodes);e.d.head.append(e.d.querySelector("style["+e.i+"]")||""),e.j={},e.x=(a,d,n,o,u)=>{n==l&&i(),"#"==a?(t[d]=r).i++:"!"==a?e.l[d]&&t[d]&&t[d].c():"T"==n.tagName&&(d=n.getAttribute(e.i))&&(l=n.nextSibling,i=()=>{n.remove(),o||c(d,n),r.c()},r=t[d]||(o=t[d]={i:e.l[d]?1:2,c(i=e.l["^"+d]){if(--o.i)return 1;for(;(l=e.l[d].previousSibling||i).remove(),i!=l;);c(d,n)}}),(a=e.j[d])&&(u=r.c,r.c=()=>u()||a(e.r)))}})';
113
113
 
114
114
  // src/html/serializer.ts
115
115
  var kTouchedIterator = Symbol(), { hasOwnProperty } = {}, Generator = (function* () {
@@ -1375,7 +1375,7 @@ function tryCatch(content, catchContent) {
1375
1375
  let cur = body, writeMarker = !0;
1376
1376
  do {
1377
1377
  let next = cur.next;
1378
- cur.boundary !== catchBoundary && cur.boundary.abort(catchBoundary.signal.reason), writeMarker && !cur.consumed && (writeMarker = !1, cur.async = !1, cur.next = bodyNext, cur.html = endMarker, cur.scripts = cur.effects = cur.lastEffect = "", cur.placeholderBody = cur.placeholderRender = cur.reorderId = null), cur = next;
1378
+ cur.boundary !== catchBoundary && cur.boundary.abort(catchBoundary.signal.reason), writeMarker && !cur.consumed && (writeMarker = !1, cur.async = !1, cur.next = bodyNext, cur.needsWalk = !0, cur.html = endMarker, cur.scripts = cur.effects = cur.lastEffect = "", cur.placeholderBody = cur.placeholderRender = cur.reorderId = null), cur = next;
1379
1379
  } while (cur !== bodyNext);
1380
1380
  }
1381
1381
  let catchChunk = new Chunk(boundary, null, chunk.context);
@@ -1460,6 +1460,7 @@ var State2 = class {
1460
1460
  lastEffect = "";
1461
1461
  async = !1;
1462
1462
  consumed = !1;
1463
+ needsWalk = !1;
1463
1464
  reorderId = null;
1464
1465
  placeholderBody = null;
1465
1466
  placeholderRender = null;
@@ -1494,13 +1495,13 @@ var State2 = class {
1494
1495
  }
1495
1496
  }
1496
1497
  consume() {
1497
- let cur = this;
1498
+ let cur = this, needsWalk = cur.needsWalk;
1498
1499
  if (cur.next && !cur.async) {
1499
1500
  let html = "", effects = "", scripts = "", lastEffect = "";
1500
1501
  do
1501
- cur.flushPlaceholder(), html += cur.html, effects = concatEffects(effects, cur.effects), scripts = concatScripts(scripts, cur.scripts), lastEffect = cur.lastEffect || lastEffect, cur.consumed = !0, cur = cur.next;
1502
+ cur.flushPlaceholder(), needsWalk ||= cur.needsWalk, html += cur.html, effects = concatEffects(effects, cur.effects), scripts = concatScripts(scripts, cur.scripts), lastEffect = cur.lastEffect || lastEffect, cur.consumed = !0, cur = cur.next;
1502
1503
  while (cur.next && !cur.async);
1503
- cur.html = html + cur.html, cur.effects = concatEffects(effects, cur.effects), cur.scripts = concatScripts(scripts, cur.scripts), cur.lastEffect = lastEffect;
1504
+ cur.needsWalk = needsWalk, cur.html = html + cur.html, cur.effects = concatEffects(effects, cur.effects), cur.scripts = concatScripts(scripts, cur.scripts), cur.lastEffect = lastEffect;
1504
1505
  }
1505
1506
  return cur;
1506
1507
  }
@@ -1516,18 +1517,18 @@ var State2 = class {
1516
1517
  }
1517
1518
  }
1518
1519
  flushScript() {
1519
- let { boundary, effects } = this, { state } = boundary, { $global: $global2, runtimePrefix, nonceAttr } = state, { html, scripts } = this, hasWalk = state.walkOnNextFlush;
1520
- if (hasWalk && (state.walkOnNextFlush = !1), state.needsMainRuntime && !state.hasMainRuntime && (state.hasMainRuntime = !0, scripts = concatScripts(
1520
+ let { boundary, effects } = this, { state } = boundary, { $global: $global2, runtimePrefix, nonceAttr } = state, { html, scripts } = this, needsWalk = state.walkOnNextFlush;
1521
+ if (needsWalk && (state.walkOnNextFlush = !1), state.needsMainRuntime && !state.hasMainRuntime && (state.hasMainRuntime = !0, scripts = concatScripts(
1521
1522
  scripts,
1522
1523
  WALKER_RUNTIME_CODE + '("' + $global2.runtimeId + '")("' + $global2.renderId + '")'
1523
- )), effects && (hasWalk = !0, state.resumes = state.resumes ? state.resumes + "," + effects : effects), state.resumes && (state.hasWrittenResume ? scripts = concatScripts(
1524
+ )), effects && (needsWalk = !0, state.resumes = state.resumes ? state.resumes + "," + effects : effects), state.resumes && (state.hasWrittenResume ? scripts = concatScripts(
1524
1525
  scripts,
1525
1526
  runtimePrefix + ".r.push(" + state.resumes + ")"
1526
1527
  ) : (state.hasWrittenResume = !0, scripts = concatScripts(
1527
1528
  scripts,
1528
1529
  runtimePrefix + ".r=[" + state.resumes + "]"
1529
1530
  ))), state.writeReorders) {
1530
- hasWalk = !0, state.hasReorderRuntime || (state.hasReorderRuntime = !0, html += "<style " + state.commentPrefix + nonceAttr + ">t{display:none}</style>", scripts = concatScripts(
1531
+ needsWalk = !0, state.hasReorderRuntime || (state.hasReorderRuntime = !0, html += "<style " + state.commentPrefix + nonceAttr + ">t{display:none}</style>", scripts = concatScripts(
1531
1532
  scripts,
1532
1533
  REORDER_RUNTIME_CODE + "(" + runtimePrefix + ")"
1533
1534
  ));
@@ -1557,11 +1558,12 @@ var State2 = class {
1557
1558
  }
1558
1559
  state.writeReorders = null;
1559
1560
  }
1560
- return hasWalk && (scripts = concatScripts(scripts, runtimePrefix + ".w()")), this.html = html, this.scripts = scripts, this.effects = this.lastEffect = state.resumes = "", this;
1561
+ return needsWalk && (scripts = concatScripts(scripts, runtimePrefix + ".w()")), this.html = html, this.scripts = scripts, this.effects = this.lastEffect = state.resumes = "", this;
1561
1562
  }
1562
1563
  flushHTML() {
1563
- this.flushScript();
1564
- let { boundary, scripts } = this, { state } = boundary, { $global: $global2, nonceAttr } = state, { __flush__ } = $global2, { html } = this;
1564
+ let { boundary } = this, { state } = boundary;
1565
+ this.needsWalk && (this.needsWalk = !1, state.walkOnNextFlush = !0), this.flushScript();
1566
+ let { scripts } = this, { $global: $global2, nonceAttr } = state, { __flush__ } = $global2, { html } = this;
1565
1567
  return this.html = this.scripts = "", scripts && (html += "<script" + nonceAttr + ">" + scripts + "</script>"), __flush__ && ($global2.__flush__ = void 0, html = __flush__($global2, html)), boundary.count || (html += state.trailerHTML), html;
1566
1568
  }
1567
1569
  };
@@ -155,6 +155,7 @@ declare const _default: {
155
155
  }[];
156
156
  };
157
157
  "<style>": import("@marko/compiler/babel-utils").Tag;
158
+ "<textarea>": import("@marko/compiler/babel-utils").Tag;
158
159
  "<try>": import("@marko/compiler/babel-utils").Tag;
159
160
  };
160
161
  export default _default;
@@ -0,0 +1,3 @@
1
+ import type { Tag } from "@marko/compiler/babel-utils";
2
+ declare const _default: Tag;
3
+ export default _default;
@@ -161,6 +161,7 @@ export declare const taglibs: (string | {
161
161
  }[];
162
162
  };
163
163
  "<style>": import("@marko/compiler/babel-utils").Tag;
164
+ "<textarea>": import("@marko/compiler/babel-utils").Tag;
164
165
  "<try>": import("@marko/compiler/babel-utils").Tag;
165
166
  })[][];
166
167
  export declare function getRuntimeEntryFiles(output: Config["output"], optimize: boolean): string[];