marko 6.0.0-next.3.69 → 6.0.0-next.3.71

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.
@@ -2067,7 +2067,7 @@ function tryCatch(content, catchContent) {
2067
2067
  catchChunk.render(catchContent, catchBoundary.signal.reason);
2068
2068
  state.reorder(catchChunk);
2069
2069
  boundary.endAsync();
2070
- } else if (catchBoundary.done) {
2070
+ } else if (!catchBoundary.count) {
2071
2071
  boundary.endAsync();
2072
2072
  } else {
2073
2073
  boundary.onNext();
@@ -2092,6 +2092,7 @@ var State2 = class {
2092
2092
  hasReorderRuntime = false;
2093
2093
  hasWrittenResume = false;
2094
2094
  trailerHTML = "";
2095
+ resumes = "";
2095
2096
  nonceAttr = "";
2096
2097
  serializer = new Serializer();
2097
2098
  writeReorders = null;
@@ -2155,7 +2156,8 @@ var Boundary = class extends AbortController {
2155
2156
  onNext = NOOP;
2156
2157
  count = 0;
2157
2158
  get done() {
2158
- return this.count === 0;
2159
+ flushSerializer(this);
2160
+ return !this.count;
2159
2161
  }
2160
2162
  startAsync() {
2161
2163
  if (!this.signal.aborted) {
@@ -2261,145 +2263,152 @@ var Chunk = class {
2261
2263
  $chunk = prev;
2262
2264
  }
2263
2265
  }
2264
- };
2265
- function prepareChunk(chunk) {
2266
- const head = chunk.consume();
2267
- const { boundary, effects } = head;
2268
- const { state } = boundary;
2269
- const { $global: $global2, runtimePrefix, serializer, nonceAttr } = state;
2270
- let { html, scripts } = head;
2271
- let hasWalk = false;
2272
- head.effects = "";
2273
- if (state.needsMainRuntime && !state.hasMainRuntime) {
2274
- state.hasMainRuntime = true;
2275
- scripts = concatScripts(
2276
- scripts,
2277
- WALKER_RUNTIME_CODE + '("' + $global2.runtimeId + '")("' + $global2.renderId + '")'
2278
- );
2279
- }
2280
- let resumes = "";
2281
- if (state.writeScopes || serializer.flushed) {
2282
- let { lastSerializedScopeId } = state;
2283
- const serializeData = [];
2284
- if (!state.hasGlobals) {
2285
- state.hasGlobals = true;
2286
- serializeData.push(getFilteredGlobals(state.$global));
2287
- }
2288
- for (const key in state.writeScopes) {
2289
- const scope = state.writeScopes[key];
2290
- const scopeId = getScopeId(scope);
2291
- const scopeIdDelta = scopeId - lastSerializedScopeId;
2292
- lastSerializedScopeId = scopeId + 1;
2293
- if (scopeIdDelta) serializeData.push(scopeIdDelta);
2294
- serializeData.push(scope);
2295
- }
2296
- resumes = state.serializer.stringify(serializeData, boundary);
2297
- state.writeScopes = null;
2298
- state.lastSerializedScopeId = lastSerializedScopeId;
2299
- }
2300
- if (effects) {
2301
- hasWalk = true;
2302
- resumes = resumes ? resumes + "," + effects : effects;
2303
- }
2304
- if (resumes) {
2305
- if (state.hasWrittenResume) {
2266
+ flushScript() {
2267
+ flushSerializer(this.boundary);
2268
+ const { boundary, effects } = this;
2269
+ const { state } = boundary;
2270
+ const { $global: $global2, runtimePrefix, nonceAttr } = state;
2271
+ let { resumes } = state;
2272
+ let { html, scripts } = this;
2273
+ let hasWalk = false;
2274
+ if (state.needsMainRuntime && !state.hasMainRuntime) {
2275
+ state.hasMainRuntime = true;
2306
2276
  scripts = concatScripts(
2307
2277
  scripts,
2308
- runtimePrefix + ".r.push(" + resumes + ")"
2309
- );
2310
- } else {
2311
- state.hasWrittenResume = true;
2312
- scripts = concatScripts(
2313
- scripts,
2314
- runtimePrefix + ".r=[" + resumes + "]"
2278
+ WALKER_RUNTIME_CODE + '("' + $global2.runtimeId + '")("' + $global2.renderId + '")'
2315
2279
  );
2316
2280
  }
2317
- }
2318
- if (state.writeReorders) {
2319
- hasWalk = true;
2320
- if (!state.hasReorderRuntime) {
2321
- state.hasReorderRuntime = true;
2322
- html += "<style " + state.commentPrefix + nonceAttr + ">t{display:none}</style>";
2323
- scripts = concatScripts(
2324
- scripts,
2325
- REORDER_RUNTIME_CODE + "(" + runtimePrefix + ")"
2326
- );
2281
+ if (effects) {
2282
+ hasWalk = true;
2283
+ resumes = resumes ? resumes + "," + effects : effects;
2327
2284
  }
2328
- for (const reorderedChunk of state.writeReorders) {
2329
- const { reorderId } = reorderedChunk;
2330
- let reorderHTML = "";
2331
- let reorderEffects = "";
2332
- let reorderScripts = "";
2333
- let cur = reorderedChunk;
2334
- reorderedChunk.reorderId = null;
2335
- for (; ; ) {
2336
- cur.flushPlaceholder();
2337
- const { next } = cur;
2338
- cur.consumed = true;
2339
- reorderHTML += cur.html;
2340
- reorderEffects = concatEffects(reorderEffects, cur.effects);
2341
- reorderScripts = concatScripts(reorderScripts, cur.scripts);
2342
- if (cur.async) {
2343
- reorderHTML += state.mark(
2344
- "#" /* ReorderMarker */,
2345
- cur.reorderId = state.nextReorderId()
2346
- );
2347
- cur.html = cur.effects = cur.scripts = "";
2348
- cur.next = null;
2349
- }
2350
- if (next) {
2351
- cur = next;
2352
- } else {
2353
- break;
2354
- }
2285
+ if (resumes) {
2286
+ if (state.hasWrittenResume) {
2287
+ scripts = concatScripts(
2288
+ scripts,
2289
+ runtimePrefix + ".r.push(" + resumes + ")"
2290
+ );
2291
+ } else {
2292
+ state.hasWrittenResume = true;
2293
+ scripts = concatScripts(
2294
+ scripts,
2295
+ runtimePrefix + ".r=[" + resumes + "]"
2296
+ );
2355
2297
  }
2356
- if (reorderEffects) {
2357
- if (!state.hasWrittenResume) {
2358
- state.hasWrittenResume = true;
2359
- scripts = concatScripts(
2360
- scripts,
2361
- runtimePrefix + ".r=[]"
2298
+ }
2299
+ if (state.writeReorders) {
2300
+ hasWalk = true;
2301
+ if (!state.hasReorderRuntime) {
2302
+ state.hasReorderRuntime = true;
2303
+ html += "<style " + state.commentPrefix + nonceAttr + ">t{display:none}</style>";
2304
+ scripts = concatScripts(
2305
+ scripts,
2306
+ REORDER_RUNTIME_CODE + "(" + runtimePrefix + ")"
2307
+ );
2308
+ }
2309
+ for (const reorderedChunk of state.writeReorders) {
2310
+ const { reorderId } = reorderedChunk;
2311
+ let reorderHTML = "";
2312
+ let reorderEffects = "";
2313
+ let reorderScripts = "";
2314
+ let cur = reorderedChunk;
2315
+ reorderedChunk.reorderId = null;
2316
+ for (; ; ) {
2317
+ cur.flushPlaceholder();
2318
+ const { next } = cur;
2319
+ cur.consumed = true;
2320
+ reorderHTML += cur.html;
2321
+ reorderEffects = concatEffects(reorderEffects, cur.effects);
2322
+ reorderScripts = concatScripts(reorderScripts, cur.scripts);
2323
+ if (cur.async) {
2324
+ reorderHTML += state.mark(
2325
+ "#" /* ReorderMarker */,
2326
+ cur.reorderId = state.nextReorderId()
2327
+ );
2328
+ cur.html = cur.effects = cur.scripts = "";
2329
+ cur.next = null;
2330
+ }
2331
+ if (next) {
2332
+ cur = next;
2333
+ } else {
2334
+ break;
2335
+ }
2336
+ }
2337
+ if (reorderEffects) {
2338
+ if (!state.hasWrittenResume) {
2339
+ state.hasWrittenResume = true;
2340
+ scripts = concatScripts(
2341
+ scripts,
2342
+ runtimePrefix + ".r=[]"
2343
+ );
2344
+ }
2345
+ reorderScripts = concatScripts(
2346
+ reorderScripts,
2347
+ "_.push(" + reorderEffects + ")"
2362
2348
  );
2363
2349
  }
2364
- reorderScripts = concatScripts(
2365
- reorderScripts,
2366
- "_.push(" + reorderEffects + ")"
2350
+ scripts = concatScripts(
2351
+ scripts,
2352
+ reorderScripts && runtimePrefix + ".j." + reorderId + "=_=>{" + reorderScripts + "}"
2367
2353
  );
2354
+ html += "<t " + state.commentPrefix + "=" + reorderId + ">" + reorderHTML + "</t>";
2368
2355
  }
2369
- scripts = concatScripts(
2370
- scripts,
2371
- reorderScripts && runtimePrefix + ".j." + reorderId + "=_=>{" + reorderScripts + "}"
2372
- );
2373
- html += "<t " + state.commentPrefix + "=" + reorderId + ">" + reorderHTML + "</t>";
2356
+ state.writeReorders = null;
2374
2357
  }
2375
- state.writeReorders = null;
2358
+ if (hasWalk) {
2359
+ scripts = concatScripts(scripts, runtimePrefix + ".w()");
2360
+ }
2361
+ this.effects = state.resumes = "";
2362
+ this.html = html;
2363
+ this.scripts = scripts;
2364
+ return this;
2376
2365
  }
2377
- if (hasWalk) {
2378
- scripts = concatScripts(scripts, runtimePrefix + ".w()");
2366
+ flushHTML() {
2367
+ this.flushScript();
2368
+ const { boundary, scripts } = this;
2369
+ const { state } = boundary;
2370
+ const { $global: $global2, nonceAttr } = state;
2371
+ const { __flush__ } = $global2;
2372
+ let { html } = this;
2373
+ this.html = this.scripts = "";
2374
+ if (scripts) {
2375
+ html += "<script" + nonceAttr + ">" + scripts + "</script>";
2376
+ }
2377
+ if (__flush__) {
2378
+ $global2.__flush__ = void 0;
2379
+ html = __flush__($global2, html);
2380
+ }
2381
+ if (!boundary.count) {
2382
+ html += state.trailerHTML;
2383
+ }
2384
+ return html;
2379
2385
  }
2380
- head.html = html;
2381
- head.scripts = scripts;
2382
- return head;
2383
- }
2384
- function flushChunk(head, last) {
2385
- const { boundary } = head;
2386
+ };
2387
+ function flushSerializer(boundary) {
2386
2388
  const { state } = boundary;
2387
- const { html, scripts } = head;
2388
- const { $global: $global2 } = state;
2389
- const { __flush__ } = $global2;
2390
- let result = html;
2391
- head.html = head.scripts = "";
2392
- if (scripts) {
2393
- result += "<script" + state.nonceAttr + ">" + scripts + "</script>";
2394
- }
2395
- if (__flush__) {
2396
- $global2.__flush__ = void 0;
2397
- result = __flush__($global2, result);
2398
- }
2399
- if (last && state.trailerHTML) {
2400
- result += state.trailerHTML;
2389
+ const { writeScopes, serializer } = state;
2390
+ if (writeScopes || serializer.flushed) {
2391
+ const serializeData = [];
2392
+ let { lastSerializedScopeId } = state;
2393
+ if (!state.hasGlobals) {
2394
+ state.hasGlobals = true;
2395
+ serializeData.push(getFilteredGlobals(state.$global));
2396
+ }
2397
+ for (const key in writeScopes) {
2398
+ const scope = writeScopes[key];
2399
+ const scopeId = getScopeId(scope);
2400
+ const scopeIdDelta = scopeId - lastSerializedScopeId;
2401
+ lastSerializedScopeId = scopeId + 1;
2402
+ if (scopeIdDelta) serializeData.push(scopeIdDelta);
2403
+ serializeData.push(scope);
2404
+ }
2405
+ state.resumes = concatEffects(
2406
+ state.resumes,
2407
+ serializer.stringify(serializeData, boundary)
2408
+ );
2409
+ state.lastSerializedScopeId = lastSerializedScopeId;
2410
+ state.writeScopes = null;
2401
2411
  }
2402
- return result;
2403
2412
  }
2404
2413
  function writeTrailers(html) {
2405
2414
  $chunk.boundary.state.trailerHTML += html;
@@ -2879,7 +2888,7 @@ var compat = {
2879
2888
  $global2[K_TAGS_API_STATE] = state = new State2($global2);
2880
2889
  }
2881
2890
  const boundary = new Boundary(state);
2882
- let head = new Chunk(
2891
+ const head = new Chunk(
2883
2892
  boundary,
2884
2893
  null,
2885
2894
  null
@@ -2900,24 +2909,18 @@ var compat = {
2900
2909
  renderer(normalizedInput);
2901
2910
  });
2902
2911
  const asyncOut = classAPIOut.beginAsync();
2903
- (boundary.onNext = () => {
2904
- if (boundary.done) {
2912
+ queueMicrotask(
2913
+ boundary.onNext = () => {
2905
2914
  if (boundary.signal.aborted) {
2906
2915
  asyncOut.error(boundary.signal.reason);
2907
- } else {
2908
- queueMicrotask(() => {
2909
- head = prepareChunk(head);
2910
- if (boundary.done) {
2911
- const { scripts, html } = head;
2912
- asyncOut.script(scripts);
2913
- asyncOut.write(html);
2914
- asyncOut.end();
2915
- head.html = head.scripts = "";
2916
- }
2917
- });
2916
+ } else if (boundary.done) {
2917
+ const { scripts, html } = head.consume().flushScript();
2918
+ asyncOut.script(scripts);
2919
+ asyncOut.write(html);
2920
+ asyncOut.end();
2918
2921
  }
2919
2922
  }
2920
- })();
2923
+ );
2921
2924
  },
2922
2925
  registerRenderer(renderer, id) {
2923
2926
  return register(
@@ -2978,10 +2981,7 @@ function render(input = {}) {
2978
2981
  ...$global2
2979
2982
  };
2980
2983
  } else {
2981
- $global2 = {
2982
- runtimeId: DEFAULT_RUNTIME_ID,
2983
- renderId: DEFAULT_RENDER_ID
2984
- };
2984
+ $global2 = { runtimeId: DEFAULT_RUNTIME_ID, renderId: DEFAULT_RENDER_ID };
2985
2985
  }
2986
2986
  const head = new Chunk(
2987
2987
  new Boundary(new State2($global2), $global2.signal),
@@ -3045,19 +3045,13 @@ var ServerRenderResult = class {
3045
3045
  if (!(done || aborted)) {
3046
3046
  boundary?.abort(error);
3047
3047
  }
3048
- return Promise.resolve({
3049
- value: "",
3050
- done: true
3051
- });
3048
+ return Promise.resolve({ value: "", done: true });
3052
3049
  },
3053
3050
  return(value2) {
3054
3051
  if (!(done || aborted)) {
3055
3052
  boundary?.abort(new Error("Iterator returned before consumed."));
3056
3053
  }
3057
- return Promise.resolve({
3058
- value: value2,
3059
- done: true
3060
- });
3054
+ return Promise.resolve({ value: value2, done: true });
3061
3055
  }
3062
3056
  };
3063
3057
  function exec(_resolve, _reject) {
@@ -3112,7 +3106,7 @@ var ServerRenderResult = class {
3112
3106
  }
3113
3107
  #promise() {
3114
3108
  return this.#cachedPromise ||= new Promise((resolve, reject) => {
3115
- let head = this.#head;
3109
+ const head = this.#head;
3116
3110
  this.#head = null;
3117
3111
  if (!head) {
3118
3112
  return reject(new Error("Cannot read from a consumed render result"));
@@ -3123,10 +3117,7 @@ var ServerRenderResult = class {
3123
3117
  boundary.onNext = NOOP2;
3124
3118
  reject(boundary.signal.reason);
3125
3119
  } else if (boundary.done) {
3126
- head = prepareChunk(head);
3127
- if (boundary.done) {
3128
- resolve(flushChunk(head, true));
3129
- }
3120
+ resolve(head.consume().flushHTML());
3130
3121
  }
3131
3122
  })();
3132
3123
  });
@@ -3146,13 +3137,11 @@ var ServerRenderResult = class {
3146
3137
  boundary.onNext = NOOP2;
3147
3138
  onAbort(boundary.signal.reason);
3148
3139
  } else {
3149
- if (write2 || boundary.done) {
3150
- head = prepareChunk(head);
3151
- }
3152
- if (write2 || boundary.done) {
3153
- const html = flushChunk(head, boundary.done);
3140
+ const { done } = boundary;
3141
+ if (done || write2) {
3142
+ const html = (head = head.consume()).flushHTML();
3154
3143
  if (html) onWrite(html);
3155
- if (boundary.done) {
3144
+ if (done) {
3156
3145
  if (!tick2) offTick(onNext);
3157
3146
  onClose();
3158
3147
  } else {
@@ -3169,10 +3158,10 @@ var ServerRenderResult = class {
3169
3158
  }
3170
3159
  toString() {
3171
3160
  const head = this.#head;
3172
- if (!head) throw new Error("Cannot read from a consumed render result");
3173
- if (head.next) throw new Error("Cannot fork in sync mode");
3174
3161
  this.#head = null;
3175
- return flushChunk(prepareChunk(head), true);
3162
+ if (!head) throw new Error("Cannot read from a consumed render result");
3163
+ if (!head.boundary.done) throw new Error("Cannot fork in sync mode");
3164
+ return head.consume().flushHTML();
3176
3165
  }
3177
3166
  };
3178
3167
  function NOOP2() {
package/dist/dom.js CHANGED
@@ -1097,50 +1097,53 @@ function awaitTag(nodeAccessor, renderer) {
1097
1097
  scope,
1098
1098
  "d" /* PlaceholderContent */
1099
1099
  ), awaitBranch = scope[branchAccessor], referenceNode = scope[nodeAccessor], namespaceNode = (awaitBranch?.h ?? referenceNode).parentNode, thisPromise = scope[promiseAccessor] = promise.then((data2) => {
1100
- if (!(scope.k?.p || scope[promiseAccessor] !== thisPromise) && (scope[promiseAccessor] = void 0, runEffects(
1101
- prepareEffects(() => {
1102
- tryWithPlaceholder && placeholderShown.add(pendingEffects), (!awaitBranch || !tryWithPlaceholder) && (insertBranchBefore(
1103
- awaitBranch ??= scope[branchAccessor] = createAndSetupBranch(
1104
- scope.$global,
1105
- renderer,
1106
- scope,
1107
- namespaceNode
1108
- ),
1109
- referenceNode.parentNode,
1110
- referenceNode
1111
- ), referenceNode.remove()), renderer.l?.(awaitBranch, [data2]);
1112
- })
1113
- ), tryWithPlaceholder && !--tryWithPlaceholder.q)) {
1100
+ if (thisPromise === scope[promiseAccessor] && !scope.k?.p && (scope[promiseAccessor] = 0, renderImmediate(() => {
1101
+ tryWithPlaceholder && placeholderShown.add(pendingEffects), (!awaitBranch || !tryWithPlaceholder) && (insertBranchBefore(
1102
+ awaitBranch ??= scope[branchAccessor] = createAndSetupBranch(
1103
+ scope.$global,
1104
+ renderer,
1105
+ scope,
1106
+ namespaceNode
1107
+ ),
1108
+ referenceNode.parentNode,
1109
+ referenceNode
1110
+ ), referenceNode.remove()), renderer.l?.(awaitBranch, [data2]);
1111
+ }), tryWithPlaceholder && !--tryWithPlaceholder.q)) {
1114
1112
  let placeholderBranch = tryWithPlaceholder.c;
1115
- tryWithPlaceholder.c = void 0, placeholderBranch && (insertBranchBefore(
1113
+ tryWithPlaceholder.c = 0, placeholderBranch && (insertBranchBefore(
1116
1114
  tryWithPlaceholder,
1117
1115
  placeholderBranch.h.parentNode,
1118
1116
  placeholderBranch.h
1119
1117
  ), removeAndDestroyBranch(placeholderBranch)), tryWithPlaceholder.H && runEffects(tryWithPlaceholder.H, !0);
1120
1118
  }
1121
- }).catch((error) => {
1122
- renderCatch(scope, error, !0);
1123
- });
1124
- tryWithPlaceholder ? (placeholderShown.add(pendingEffects), tryWithPlaceholder.q || (tryWithPlaceholder.q = 0, requestAnimationFrame(() => {
1125
- if (tryWithPlaceholder.q && !tryWithPlaceholder.p) {
1126
- let placeholderBranch = tryWithPlaceholder.c = createAndSetupBranch(
1127
- scope.$global,
1128
- tryWithPlaceholder.d,
1129
- tryWithPlaceholder._,
1130
- tryWithPlaceholder.h.parentNode
1131
- );
1132
- insertBranchBefore(
1133
- placeholderBranch,
1134
- tryWithPlaceholder.h.parentNode,
1135
- tryWithPlaceholder.h
1136
- ), tempDetatchBranch(tryWithPlaceholder);
1137
- }
1138
- })), tryWithPlaceholder.q++) : awaitBranch && (awaitBranch.h.parentNode.insertBefore(
1119
+ }).catch(
1120
+ (error) => renderImmediate(() => renderCatch(scope, error, !0))
1121
+ );
1122
+ tryWithPlaceholder ? (placeholderShown.add(pendingEffects), tryWithPlaceholder.q || (tryWithPlaceholder.q = 0, requestAnimationFrame(
1123
+ () => renderImmediate(() => {
1124
+ if (tryWithPlaceholder.q && !tryWithPlaceholder.p) {
1125
+ let placeholderBranch = tryWithPlaceholder.c = createAndSetupBranch(
1126
+ scope.$global,
1127
+ tryWithPlaceholder.d,
1128
+ tryWithPlaceholder._,
1129
+ tryWithPlaceholder.h.parentNode
1130
+ );
1131
+ insertBranchBefore(
1132
+ placeholderBranch,
1133
+ tryWithPlaceholder.h.parentNode,
1134
+ tryWithPlaceholder.h
1135
+ ), tempDetatchBranch(tryWithPlaceholder);
1136
+ }
1137
+ })
1138
+ )), tryWithPlaceholder.q++) : awaitBranch && (awaitBranch.h.parentNode.insertBefore(
1139
1139
  referenceNode,
1140
1140
  awaitBranch.h
1141
1141
  ), tempDetatchBranch(awaitBranch));
1142
1142
  };
1143
1143
  }
1144
+ function renderImmediate(cb) {
1145
+ return runEffects(prepareEffects(cb));
1146
+ }
1144
1147
  function createTry(nodeAccessor, tryContent) {
1145
1148
  let branchAccessor = "d" /* ConditionalScope */ + nodeAccessor;
1146
1149
  return (scope, input) => {
@@ -1234,10 +1237,7 @@ var dynamicTag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
1234
1237
  normalizedRenderer._ ? args[0] : args
1235
1238
  );
1236
1239
  else {
1237
- let inputWithContent = getContent ? {
1238
- ...args,
1239
- content: getContent(scope)
1240
- } : args || {};
1240
+ let inputWithContent = getContent ? { ...args, content: getContent(scope) } : args || {};
1241
1241
  normalizedRenderer.l(
1242
1242
  scope[childScopeAccessor],
1243
1243
  normalizedRenderer._ ? inputWithContent : [inputWithContent]
package/dist/dom.mjs CHANGED
@@ -1012,50 +1012,53 @@ function awaitTag(nodeAccessor, renderer) {
1012
1012
  scope,
1013
1013
  "d" /* PlaceholderContent */
1014
1014
  ), awaitBranch = scope[branchAccessor], referenceNode = scope[nodeAccessor], namespaceNode = (awaitBranch?.h ?? referenceNode).parentNode, thisPromise = scope[promiseAccessor] = promise.then((data2) => {
1015
- if (!(scope.k?.p || scope[promiseAccessor] !== thisPromise) && (scope[promiseAccessor] = void 0, runEffects(
1016
- prepareEffects(() => {
1017
- tryWithPlaceholder && placeholderShown.add(pendingEffects), (!awaitBranch || !tryWithPlaceholder) && (insertBranchBefore(
1018
- awaitBranch ??= scope[branchAccessor] = createAndSetupBranch(
1019
- scope.$global,
1020
- renderer,
1021
- scope,
1022
- namespaceNode
1023
- ),
1024
- referenceNode.parentNode,
1025
- referenceNode
1026
- ), referenceNode.remove()), renderer.l?.(awaitBranch, [data2]);
1027
- })
1028
- ), tryWithPlaceholder && !--tryWithPlaceholder.q)) {
1015
+ if (thisPromise === scope[promiseAccessor] && !scope.k?.p && (scope[promiseAccessor] = 0, renderImmediate(() => {
1016
+ tryWithPlaceholder && placeholderShown.add(pendingEffects), (!awaitBranch || !tryWithPlaceholder) && (insertBranchBefore(
1017
+ awaitBranch ??= scope[branchAccessor] = createAndSetupBranch(
1018
+ scope.$global,
1019
+ renderer,
1020
+ scope,
1021
+ namespaceNode
1022
+ ),
1023
+ referenceNode.parentNode,
1024
+ referenceNode
1025
+ ), referenceNode.remove()), renderer.l?.(awaitBranch, [data2]);
1026
+ }), tryWithPlaceholder && !--tryWithPlaceholder.q)) {
1029
1027
  let placeholderBranch = tryWithPlaceholder.c;
1030
- tryWithPlaceholder.c = void 0, placeholderBranch && (insertBranchBefore(
1028
+ tryWithPlaceholder.c = 0, placeholderBranch && (insertBranchBefore(
1031
1029
  tryWithPlaceholder,
1032
1030
  placeholderBranch.h.parentNode,
1033
1031
  placeholderBranch.h
1034
1032
  ), removeAndDestroyBranch(placeholderBranch)), tryWithPlaceholder.H && runEffects(tryWithPlaceholder.H, !0);
1035
1033
  }
1036
- }).catch((error) => {
1037
- renderCatch(scope, error, !0);
1038
- });
1039
- tryWithPlaceholder ? (placeholderShown.add(pendingEffects), tryWithPlaceholder.q || (tryWithPlaceholder.q = 0, requestAnimationFrame(() => {
1040
- if (tryWithPlaceholder.q && !tryWithPlaceholder.p) {
1041
- let placeholderBranch = tryWithPlaceholder.c = createAndSetupBranch(
1042
- scope.$global,
1043
- tryWithPlaceholder.d,
1044
- tryWithPlaceholder._,
1045
- tryWithPlaceholder.h.parentNode
1046
- );
1047
- insertBranchBefore(
1048
- placeholderBranch,
1049
- tryWithPlaceholder.h.parentNode,
1050
- tryWithPlaceholder.h
1051
- ), tempDetatchBranch(tryWithPlaceholder);
1052
- }
1053
- })), tryWithPlaceholder.q++) : awaitBranch && (awaitBranch.h.parentNode.insertBefore(
1034
+ }).catch(
1035
+ (error) => renderImmediate(() => renderCatch(scope, error, !0))
1036
+ );
1037
+ tryWithPlaceholder ? (placeholderShown.add(pendingEffects), tryWithPlaceholder.q || (tryWithPlaceholder.q = 0, requestAnimationFrame(
1038
+ () => renderImmediate(() => {
1039
+ if (tryWithPlaceholder.q && !tryWithPlaceholder.p) {
1040
+ let placeholderBranch = tryWithPlaceholder.c = createAndSetupBranch(
1041
+ scope.$global,
1042
+ tryWithPlaceholder.d,
1043
+ tryWithPlaceholder._,
1044
+ tryWithPlaceholder.h.parentNode
1045
+ );
1046
+ insertBranchBefore(
1047
+ placeholderBranch,
1048
+ tryWithPlaceholder.h.parentNode,
1049
+ tryWithPlaceholder.h
1050
+ ), tempDetatchBranch(tryWithPlaceholder);
1051
+ }
1052
+ })
1053
+ )), tryWithPlaceholder.q++) : awaitBranch && (awaitBranch.h.parentNode.insertBefore(
1054
1054
  referenceNode,
1055
1055
  awaitBranch.h
1056
1056
  ), tempDetatchBranch(awaitBranch));
1057
1057
  };
1058
1058
  }
1059
+ function renderImmediate(cb) {
1060
+ return runEffects(prepareEffects(cb));
1061
+ }
1059
1062
  function createTry(nodeAccessor, tryContent) {
1060
1063
  let branchAccessor = "d" /* ConditionalScope */ + nodeAccessor;
1061
1064
  return (scope, input) => {
@@ -1149,10 +1152,7 @@ var dynamicTag = function(nodeAccessor, getContent, getTagVar, inputIsArgs) {
1149
1152
  normalizedRenderer._ ? args[0] : args
1150
1153
  );
1151
1154
  else {
1152
- let inputWithContent = getContent ? {
1153
- ...args,
1154
- content: getContent(scope)
1155
- } : args || {};
1155
+ let inputWithContent = getContent ? { ...args, content: getContent(scope) } : args || {};
1156
1156
  normalizedRenderer.l(
1157
1157
  scope[childScopeAccessor],
1158
1158
  normalizedRenderer._ ? inputWithContent : [inputWithContent]
@@ -71,6 +71,7 @@ export declare class State {
71
71
  hasReorderRuntime: boolean;
72
72
  hasWrittenResume: boolean;
73
73
  trailerHTML: string;
74
+ resumes: string;
74
75
  nonceAttr: string;
75
76
  serializer: Serializer;
76
77
  writeReorders: Chunk[] | null;
@@ -89,7 +90,7 @@ export declare class State {
89
90
  export declare class Boundary extends AbortController {
90
91
  state: State;
91
92
  onNext: () => void;
92
- private count;
93
+ count: number;
93
94
  constructor(state: State, parent?: AbortSignal);
94
95
  get done(): boolean;
95
96
  startAsync(): void;
@@ -116,9 +117,9 @@ export declare class Chunk {
116
117
  consume(): Chunk;
117
118
  render(content: () => void): Chunk;
118
119
  render<T>(content: (val: T) => void, val: T): Chunk;
120
+ flushScript(): this;
121
+ flushHTML(): string;
119
122
  }
120
- export declare function prepareChunk(chunk: Chunk): Chunk;
121
- export declare function flushChunk(head: Chunk, last: boolean): string;
122
123
  export declare function writeTrailers(html: string): void;
123
124
  type QueueCallback = (ticked: true) => void;
124
125
  export declare function queueTick(cb: QueueCallback): void;