octane 0.2.3 → 0.2.4

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.
@@ -136,6 +136,8 @@ __export(runtime_server_exports, {
136
136
  ssrValueAttr: () => ssrValueAttr,
137
137
  ssrVoidContent: () => ssrVoidContent,
138
138
  startTransition: () => startTransition,
139
+ styleMap: () => styleMap,
140
+ touchStyleMap: () => touchStyleMap,
139
141
  use: () => use,
140
142
  useActionState: () => useActionState,
141
143
  useCallback: () => useCallback,
@@ -1565,8 +1567,9 @@ function isAggregatedFormAttribute(tag, name) {
1565
1567
  function ssrAttrs(sources, tag, namespace = "html", skipFormControls = false) {
1566
1568
  namespace = resolveAttributeNamespace(namespace);
1567
1569
  const props = /* @__PURE__ */ new Map();
1570
+ let classMerges = null;
1568
1571
  let sourceOrder = 0;
1569
- const record = (rawName, value) => {
1572
+ function record(rawName, value) {
1570
1573
  if (typeof rawName !== "string") return;
1571
1574
  const order = sourceOrder++;
1572
1575
  const previous = props.get(rawName);
@@ -1576,9 +1579,17 @@ function ssrAttrs(sources, tag, namespace = "html", skipFormControls = false) {
1576
1579
  firstOrder: previous?.firstOrder ?? order,
1577
1580
  lastOrder: order
1578
1581
  });
1579
- };
1580
- for (const [isSpread, sourceOrName, directValue] of sources) {
1582
+ }
1583
+ for (const [isSpread, sourceOrName, directValue, merge] of sources) {
1581
1584
  if (!isSpread) {
1585
+ if (merge === true && typeof sourceOrName === "string" && (sourceOrName === "class" || sourceOrName === "className")) {
1586
+ (classMerges ??= []).push({
1587
+ rawName: sourceOrName,
1588
+ value: directValue,
1589
+ order: sourceOrder++
1590
+ });
1591
+ continue;
1592
+ }
1582
1593
  record(sourceOrName, directValue);
1583
1594
  continue;
1584
1595
  }
@@ -1590,6 +1601,24 @@ function ssrAttrs(sources, tag, namespace = "html", skipFormControls = false) {
1590
1601
  record(name, source[name]);
1591
1602
  }
1592
1603
  }
1604
+ if (process.env.NODE_ENV === "production") {
1605
+ let canonical = true;
1606
+ for (const name of props.keys()) {
1607
+ if (normalizeSsrAttributeName(name, tag, namespace) !== name || namespace === "html" && name.toLowerCase() !== name) {
1608
+ canonical = false;
1609
+ break;
1610
+ }
1611
+ }
1612
+ if (canonical) {
1613
+ let out2 = "";
1614
+ for (const { rawName, value } of props.values()) {
1615
+ if (rawName === "dangerouslySetInnerHTML" || skipFormControls && isAggregatedFormAttribute(tag, rawName))
1616
+ continue;
1617
+ out2 += ssrAttrEntry(rawName, value, tag, namespace);
1618
+ }
1619
+ return out2;
1620
+ }
1621
+ }
1593
1622
  const resolved = /* @__PURE__ */ new Map();
1594
1623
  let needsWinningOrderSort = false;
1595
1624
  for (const writer of props.values()) {
@@ -1616,6 +1645,24 @@ function ssrAttrs(sources, tag, namespace = "html", skipFormControls = false) {
1616
1645
  lastOrder
1617
1646
  ]);
1618
1647
  }
1648
+ if (classMerges !== null) {
1649
+ for (const extra of classMerges) {
1650
+ const name = normalizeSsrAttributeName(extra.rawName, tag, namespace);
1651
+ if (!import_constants.VALID_ATTR_NAME.test(name)) continue;
1652
+ const identity = namespace === "html" ? name.toLowerCase() : name;
1653
+ const previous = resolved.get(identity);
1654
+ if (previous !== void 0) {
1655
+ resolved.set(identity, [
1656
+ previous[0],
1657
+ (0, import_css.mergeClass)(previous[1], extra.value),
1658
+ previous[2],
1659
+ extra.order
1660
+ ]);
1661
+ continue;
1662
+ }
1663
+ resolved.set(identity, [name, extra.value, extra.order, extra.order]);
1664
+ }
1665
+ }
1619
1666
  let out = "";
1620
1667
  const ordered = [...resolved.values()];
1621
1668
  if (needsWinningOrderSort) ordered.sort((a, b) => a[2] - b[2]);
@@ -3654,6 +3701,28 @@ function isChildrenBlock(value) {
3654
3701
  function injectStyle(id, css, nonce) {
3655
3702
  if (CSS !== null) CSS.set(id, nonce === void 0 ? { css } : { css, nonce });
3656
3703
  }
3704
+ function styleMap(id, css, map, applied = []) {
3705
+ let touching = false;
3706
+ const touch = () => {
3707
+ if (CSS === null || touching) return;
3708
+ touching = true;
3709
+ try {
3710
+ for (const dependency of applied) touchStyleMap(dependency);
3711
+ if (id !== null && css !== null) injectStyle(id, css);
3712
+ } finally {
3713
+ touching = false;
3714
+ }
3715
+ };
3716
+ return new Proxy(map, {
3717
+ get(target, key, receiver) {
3718
+ touch();
3719
+ return Reflect.get(target, key, receiver);
3720
+ }
3721
+ });
3722
+ }
3723
+ function touchStyleMap(map) {
3724
+ if (map !== null && typeof map === "object") void map.$class;
3725
+ }
3657
3726
  const HEAD_VOID_ELEMENTS = /* @__PURE__ */ new Set(["meta", "link", "base"]);
3658
3727
  function ssrHeadEl(key, tag, attrs, text) {
3659
3728
  if (HEAD === null || FALLBACK_HOIST_DEPTH !== 0) return "";
@@ -5007,19 +5076,30 @@ async function runStream(component, props, options, sink, resolved) {
5007
5076
  };
5008
5077
  const injection = options?.injection;
5009
5078
  if (injection !== void 0) injection.done.then(NOOP, NOOP);
5079
+ let injectionCompleted = false;
5080
+ const completeInjection = injection === void 0 ? NOOP : () => {
5081
+ if (injectionCompleted) return;
5082
+ injectionCompleted = true;
5083
+ injection.renderComplete?.();
5084
+ };
5010
5085
  let injectionUnsubscribe;
5011
5086
  let injectionFailure;
5012
5087
  let injectionFailed = false;
5088
+ const unacceptedInjection = injection === void 0 ? void 0 : [];
5089
+ const rememberUnaccepted = injection === void 0 ? NOOP : (chunk) => {
5090
+ unacceptedInjection.push(chunk);
5091
+ };
5013
5092
  let signalInjectionFailure;
5014
5093
  const failInjection = (err) => {
5094
+ if (signal?.aborted && err === signal.reason) return;
5015
5095
  if (injectionFailed) return;
5016
5096
  injectionFailed = true;
5017
5097
  injectionFailure = err;
5018
5098
  signalInjectionFailure?.();
5019
5099
  };
5020
5100
  let writeChain = injection === void 0 ? null : Promise.resolve();
5021
- const write = injection === void 0 ? (chunk, terminal) => sink.write(chunk, terminal) : (chunk, terminal) => {
5022
- const operation = writeChain.then(() => sink.write(chunk, terminal));
5101
+ const write = injection === void 0 ? (chunk, terminal) => sink.write(chunk, terminal) : (chunk, terminal, onUnaccepted) => {
5102
+ const operation = writeChain.then(() => sink.write(chunk, terminal, onUnaccepted));
5023
5103
  writeChain = operation.then(NOOP, NOOP);
5024
5104
  return operation;
5025
5105
  };
@@ -5033,11 +5113,34 @@ async function runStream(component, props, options, sink, resolved) {
5033
5113
  return;
5034
5114
  }
5035
5115
  if (!html) return;
5036
- return write(html);
5116
+ return write(html, false, rememberUnaccepted);
5117
+ };
5118
+ const recoveryInjection = injection === void 0 ? void 0 : async () => {
5119
+ if (signal?.aborted) {
5120
+ await writeChain;
5121
+ for (const html of unacceptedInjection) {
5122
+ const replay = write(html, "recovery");
5123
+ if (replay !== void 0) await replay;
5124
+ }
5125
+ unacceptedInjection.length = 0;
5126
+ }
5127
+ if (injectionFailed) return "";
5128
+ let queued;
5129
+ try {
5130
+ queued = injection.take();
5131
+ } catch {
5132
+ return "";
5133
+ }
5134
+ if (queued !== "" && signal?.aborted) {
5135
+ const replay = write(queued, "recovery");
5136
+ if (replay !== void 0) await replay;
5137
+ return "";
5138
+ }
5139
+ return queued;
5037
5140
  };
5038
5141
  const notifyInjection = () => {
5039
5142
  const drained = drainInjection();
5040
- if (drained !== void 0) drained.catch(NOOP);
5143
+ if (drained !== void 0) drained.catch(failInjection);
5041
5144
  };
5042
5145
  const waitForInjectionDone = () => new Promise((resolve, reject) => {
5043
5146
  let settled = false;
@@ -5140,12 +5243,24 @@ async function runStream(component, props, options, sink, resolved) {
5140
5243
  }
5141
5244
  pruneStreamBoundariesAbsentFromShell(stream, shellBoundaryKeys);
5142
5245
  } catch (err) {
5246
+ try {
5247
+ completeInjection();
5248
+ } catch {
5249
+ }
5143
5250
  const reports = signal?.aborted ? Math.max(1, preShellSuspended.length) : 1;
5144
5251
  for (let i = 0; i < reports; i++) options?.onError?.(err);
5145
5252
  sink.shellError(err);
5146
5253
  return;
5147
5254
  }
5148
- reportRecoverableBoundaryErrors();
5255
+ try {
5256
+ reportRecoverableBoundaryErrors();
5257
+ } catch (err) {
5258
+ try {
5259
+ completeInjection();
5260
+ } catch {
5261
+ }
5262
+ throw err;
5263
+ }
5149
5264
  if (pass.sheets !== null) for (const key of pass.sheets.keys()) flushedSheets.add(key);
5150
5265
  let leadingStyles = "";
5151
5266
  for (const [hash, sheet] of pass.cssEntries) {
@@ -5153,7 +5268,17 @@ async function runStream(component, props, options, sink, resolved) {
5153
5268
  leadingStyles += '<style data-octane="' + hash + '"' + (sheet.nonce === void 0 ? nonceAttr : ' nonce="' + escapeAttr(sheet.nonce) + '"') + ">" + escapeEntireInlineStyleContent(sheet.css) + "</style>";
5154
5269
  }
5155
5270
  const separateHead = options?.headChannel === "separate";
5156
- if (separateHead) options?.onHeadReady?.(pass.vtCandidates ? vtSsrStrip(pass.head) : pass.head);
5271
+ if (separateHead) {
5272
+ try {
5273
+ options?.onHeadReady?.(pass.vtCandidates ? vtSsrStrip(pass.head) : pass.head);
5274
+ } catch (err) {
5275
+ try {
5276
+ completeInjection();
5277
+ } catch {
5278
+ }
5279
+ throw err;
5280
+ }
5281
+ }
5157
5282
  const shellHead = separateHead ? "" : pass.head;
5158
5283
  const documentRoot = isDocumentRoot(pass.body);
5159
5284
  let shell = documentRoot ? "<!DOCTYPE html>" : "";
@@ -5180,11 +5305,23 @@ async function runStream(component, props, options, sink, resolved) {
5180
5305
  const shellWrite = write(pass.vtCandidates ? vtSsrStrip(shell) : shell);
5181
5306
  if (shellWrite !== void 0) await shellWrite;
5182
5307
  } catch (err) {
5308
+ try {
5309
+ completeInjection();
5310
+ } catch {
5311
+ }
5183
5312
  options?.onError?.(err);
5184
5313
  sink.shellError(err);
5185
5314
  return;
5186
5315
  }
5187
- sink.shellReady();
5316
+ try {
5317
+ sink.shellReady();
5318
+ } catch (err) {
5319
+ try {
5320
+ completeInjection();
5321
+ } catch {
5322
+ }
5323
+ throw err;
5324
+ }
5188
5325
  if (injection !== void 0) {
5189
5326
  try {
5190
5327
  injectionUnsubscribe = injection.subscribe(notifyInjection);
@@ -5274,14 +5411,14 @@ async function runStream(component, props, options, sink, resolved) {
5274
5411
  injectionUnsubscribe?.();
5275
5412
  injectionUnsubscribe = void 0;
5276
5413
  try {
5277
- injection.renderComplete?.();
5414
+ completeInjection();
5278
5415
  } catch {
5279
5416
  }
5280
5417
  }
5281
5418
  let tail = "";
5282
- if (injection !== void 0 && !injectionFailed) {
5419
+ if (recoveryInjection !== void 0) {
5283
5420
  try {
5284
- tail += injection.take();
5421
+ tail = await recoveryInjection();
5285
5422
  } catch {
5286
5423
  }
5287
5424
  }
@@ -5301,7 +5438,7 @@ async function runStream(component, props, options, sink, resolved) {
5301
5438
  }
5302
5439
  if (injection !== void 0) {
5303
5440
  try {
5304
- injection.renderComplete?.();
5441
+ completeInjection();
5305
5442
  } catch (err) {
5306
5443
  failInjection(err);
5307
5444
  }
@@ -5309,11 +5446,14 @@ async function runStream(component, props, options, sink, resolved) {
5309
5446
  await waitForInjectionDone();
5310
5447
  const finalDrain = drainInjection();
5311
5448
  if (finalDrain !== void 0) await finalDrain;
5449
+ await writeChain;
5312
5450
  if (injectionFailed) throw injectionFailure;
5313
5451
  if (heldDocumentTail !== "") {
5314
5452
  const tailChunk = heldDocumentTail;
5315
5453
  heldDocumentTail = "";
5316
- const tailWrite = write(tailChunk);
5454
+ const tailWrite = write(tailChunk, false, (unaccepted) => {
5455
+ heldDocumentTail = unaccepted;
5456
+ });
5317
5457
  if (tailWrite !== void 0) await tailWrite;
5318
5458
  }
5319
5459
  } catch (err) {
@@ -5321,11 +5461,9 @@ async function runStream(component, props, options, sink, resolved) {
5321
5461
  injectionUnsubscribe?.();
5322
5462
  injectionUnsubscribe = void 0;
5323
5463
  let terminal = "";
5324
- if (!injectionFailed) {
5325
- try {
5326
- terminal = injection.take();
5327
- } catch {
5328
- }
5464
+ try {
5465
+ terminal = await recoveryInjection();
5466
+ } catch {
5329
5467
  }
5330
5468
  terminal += heldDocumentTail;
5331
5469
  if (terminal !== "") {
@@ -5390,7 +5528,8 @@ function renderToPipeableStream(entryComponent, props, options) {
5390
5528
  destinationFailure(err);
5391
5529
  }
5392
5530
  };
5393
- const waitForDrain = (dest) => {
5531
+ const waitForDrain = (dest, allowAborted = false) => {
5532
+ if (allowAborted && closed) return Promise.reject(new Error((0, import_error_codes_server_generated.formatServerError)(38)));
5394
5533
  if (dest.once === void 0) {
5395
5534
  return Promise.reject(new TypeError((0, import_error_codes_server_generated.formatServerError)(39)));
5396
5535
  }
@@ -5426,14 +5565,17 @@ function renderToPipeableStream(entryComponent, props, options) {
5426
5565
  dest.once("drain", onDrain);
5427
5566
  dest.once("error", onError);
5428
5567
  dest.once("close", onClose);
5429
- if (controller.signal.aborted) onAbort();
5430
- else controller.signal.addEventListener("abort", onAbort, { once: true });
5568
+ if (!allowAborted) {
5569
+ if (controller.signal.aborted) onAbort();
5570
+ else controller.signal.addEventListener("abort", onAbort, { once: true });
5571
+ }
5431
5572
  });
5432
5573
  };
5433
- const writeNow = (chunk, terminal) => {
5574
+ const writeNow = (chunk, terminal, onUnaccepted) => {
5434
5575
  const dest = destination;
5435
5576
  if (closed) return Promise.reject(new Error((0, import_error_codes_server_generated.formatServerError)(40)));
5436
- if (!terminal && controller.signal.aborted) {
5577
+ if (terminal === false && controller.signal.aborted) {
5578
+ onUnaccepted?.(chunk);
5437
5579
  return Promise.reject(controller.signal.reason);
5438
5580
  }
5439
5581
  let accepted;
@@ -5443,7 +5585,7 @@ function renderToPipeableStream(entryComponent, props, options) {
5443
5585
  destinationFailure(err);
5444
5586
  return Promise.reject(err);
5445
5587
  }
5446
- return accepted === false && !terminal ? waitForDrain(dest) : void 0;
5588
+ return accepted === false && terminal !== true ? waitForDrain(dest, terminal === "recovery") : void 0;
5447
5589
  };
5448
5590
  const trackWrite = (operation) => {
5449
5591
  const gate = operation.then(
@@ -5464,16 +5606,18 @@ function renderToPipeableStream(entryComponent, props, options) {
5464
5606
  });
5465
5607
  return operation;
5466
5608
  };
5467
- const queueWrite = (chunk, terminal = false) => {
5609
+ const queueWrite = (chunk, terminal = false, onUnaccepted) => {
5468
5610
  if (destination === null) {
5469
- buffered.push({ chunk, terminal });
5611
+ buffered.push(
5612
+ onUnaccepted === void 0 ? { chunk, terminal } : { chunk, terminal, onUnaccepted }
5613
+ );
5470
5614
  return;
5471
5615
  }
5472
5616
  if (writeGate !== null) {
5473
- const operation2 = writeGate.then(() => writeNow(chunk, terminal));
5617
+ const operation2 = writeGate.then(() => writeNow(chunk, terminal, onUnaccepted));
5474
5618
  return trackWrite(operation2);
5475
5619
  }
5476
- const operation = writeNow(chunk, terminal);
5620
+ const operation = writeNow(chunk, terminal, onUnaccepted);
5477
5621
  return operation === void 0 ? void 0 : trackWrite(operation);
5478
5622
  };
5479
5623
  const flushEnd = () => {
@@ -5493,8 +5637,8 @@ function renderToPipeableStream(entryComponent, props, options) {
5493
5637
  props,
5494
5638
  renderOptions,
5495
5639
  {
5496
- write(chunk, terminal) {
5497
- return queueWrite(chunk, terminal);
5640
+ write(chunk, terminal, onUnaccepted) {
5641
+ return queueWrite(chunk, terminal, onUnaccepted);
5498
5642
  },
5499
5643
  shellReady() {
5500
5644
  options?.onShellReady?.();
@@ -5538,7 +5682,11 @@ function renderToPipeableStream(entryComponent, props, options) {
5538
5682
  });
5539
5683
  }
5540
5684
  for (const item of buffered) {
5541
- queueWrite(item.chunk, item.terminal || controller.signal.aborted);
5685
+ queueWrite(
5686
+ item.chunk,
5687
+ item.terminal === "recovery" ? "recovery" : item.terminal || controller.signal.aborted,
5688
+ item.onUnaccepted
5689
+ );
5542
5690
  }
5543
5691
  buffered.length = 0;
5544
5692
  finishEnd();
@@ -5604,7 +5752,10 @@ function renderToReadableStream(entryComponent, props, options) {
5604
5752
  });
5605
5753
  stream.allReady = allReady;
5606
5754
  let shellDone = false;
5607
- const waitForDemand = () => new Promise((resolve, reject) => {
5755
+ let terminal = false;
5756
+ let released = false;
5757
+ let callbackFailure;
5758
+ const waitForDemand = (allowAborted = false) => new Promise((resolve, reject) => {
5608
5759
  let settled = false;
5609
5760
  const cleanup = () => {
5610
5761
  renderController.signal.removeEventListener("abort", onAbort);
@@ -5619,18 +5770,21 @@ function renderToReadableStream(entryComponent, props, options) {
5619
5770
  const onDemand = () => finish(resolve);
5620
5771
  const onAbort = () => finish(() => reject(renderController.signal.reason));
5621
5772
  wakeDemand = onDemand;
5622
- if (renderController.signal.aborted) onAbort();
5623
- else renderController.signal.addEventListener("abort", onAbort, { once: true });
5773
+ if (!allowAborted) {
5774
+ if (renderController.signal.aborted) onAbort();
5775
+ else renderController.signal.addEventListener("abort", onAbort, { once: true });
5776
+ }
5624
5777
  });
5625
- const writeReadable = (chunk, terminal = false) => {
5778
+ const writeReadable = (chunk, terminal2 = false, onUnaccepted) => {
5626
5779
  if (closed || consumerCancelled) {
5627
5780
  return Promise.reject(cancelReason ?? new Error((0, import_error_codes_server_generated.formatServerError)(44)));
5628
5781
  }
5629
- if (!terminal && renderController.signal.aborted) {
5782
+ if (terminal2 === false && renderController.signal.aborted) {
5783
+ onUnaccepted?.(chunk);
5630
5784
  return Promise.reject(renderController.signal.reason);
5631
5785
  }
5632
5786
  const bytes = encoder.encode(chunk);
5633
- if (terminal) {
5787
+ if (terminal2 === true) {
5634
5788
  readableController.enqueue(bytes);
5635
5789
  return;
5636
5790
  }
@@ -5639,13 +5793,18 @@ function renderToReadableStream(entryComponent, props, options) {
5639
5793
  return;
5640
5794
  }
5641
5795
  return (async () => {
5642
- while ((readableController.desiredSize ?? 0) <= 0) {
5643
- await waitForDemand();
5644
- if (closed || consumerCancelled) {
5645
- throw cancelReason ?? new Error((0, import_error_codes_server_generated.formatServerError)(44));
5796
+ try {
5797
+ while ((readableController.desiredSize ?? 0) <= 0) {
5798
+ await waitForDemand(terminal2 === "recovery");
5799
+ if (closed || consumerCancelled) {
5800
+ throw cancelReason ?? new Error((0, import_error_codes_server_generated.formatServerError)(44));
5801
+ }
5646
5802
  }
5803
+ readableController.enqueue(bytes);
5804
+ } catch (err) {
5805
+ if (!consumerCancelled && renderController.signal.aborted) onUnaccepted?.(chunk);
5806
+ throw err;
5647
5807
  }
5648
- readableController.enqueue(bytes);
5649
5808
  })();
5650
5809
  };
5651
5810
  const closeReadable = () => {
@@ -5659,46 +5818,80 @@ function renderToReadableStream(entryComponent, props, options) {
5659
5818
  }
5660
5819
  };
5661
5820
  const renderOptions = { ...options, signal: renderController.signal };
5821
+ if (options?.onError !== void 0) {
5822
+ renderOptions.onError = (error) => {
5823
+ try {
5824
+ options.onError(error);
5825
+ } catch (err) {
5826
+ callbackFailure ??= { error: err };
5827
+ }
5828
+ };
5829
+ }
5662
5830
  const resolved = newResolvedMap(renderOptions);
5831
+ const release = () => {
5832
+ if (released) return;
5833
+ released = true;
5834
+ releaseServerRenderResources(resolved);
5835
+ };
5836
+ const settleFailure = (error) => {
5837
+ if (terminal) return;
5838
+ terminal = true;
5839
+ try {
5840
+ release();
5841
+ } catch (err) {
5842
+ error = err;
5843
+ }
5844
+ const reason = callbackFailure === void 0 ? error : callbackFailure.error;
5845
+ if (!shellDone) rejectShell(reason);
5846
+ allReadyReject(reason);
5847
+ closeReadable();
5848
+ };
5663
5849
  runStream(
5664
5850
  component,
5665
5851
  props,
5666
5852
  renderOptions,
5667
5853
  {
5668
- write(chunk, terminal) {
5669
- return writeReadable(chunk, terminal);
5854
+ write(chunk, terminal2, onUnaccepted) {
5855
+ return writeReadable(chunk, terminal2, onUnaccepted);
5670
5856
  },
5671
5857
  shellReady() {
5672
- shellDone = true;
5673
5858
  options?.onShellReady?.();
5859
+ shellDone = true;
5674
5860
  resolveShell(stream);
5675
5861
  },
5676
5862
  shellError(err) {
5677
- releaseServerRenderResources(resolved);
5678
- options?.onShellError?.(err);
5679
- if (!shellDone) rejectShell(err);
5680
- allReadyReject(err);
5681
- closeReadable();
5863
+ try {
5864
+ release();
5865
+ options?.onShellError?.(err);
5866
+ } catch (callbackError) {
5867
+ settleFailure(callbackError);
5868
+ return;
5869
+ }
5870
+ settleFailure(err);
5682
5871
  },
5683
5872
  allReady() {
5684
- releaseServerRenderResources(resolved);
5685
- options?.onAllReady?.();
5686
- allReadyResolve();
5873
+ if (terminal) return;
5874
+ try {
5875
+ release();
5876
+ options?.onAllReady?.();
5877
+ } catch (err) {
5878
+ renderOptions.onError?.(err);
5879
+ settleFailure(err);
5880
+ return;
5881
+ }
5882
+ terminal = true;
5883
+ if (callbackFailure === void 0) allReadyResolve();
5884
+ else allReadyReject(callbackFailure.error);
5687
5885
  closeReadable();
5688
5886
  },
5689
5887
  fatal(err) {
5690
- releaseServerRenderResources(resolved);
5691
- allReadyReject(err);
5692
- closeReadable();
5888
+ settleFailure(err);
5693
5889
  }
5694
5890
  },
5695
5891
  resolved
5696
5892
  ).catch((err) => {
5697
- releaseServerRenderResources(resolved);
5698
- options?.onError?.(err);
5699
- if (!shellDone) rejectShell(err);
5700
- allReadyReject(err);
5701
- closeReadable();
5893
+ renderOptions.onError?.(err);
5894
+ settleFailure(err);
5702
5895
  });
5703
5896
  });
5704
5897
  }
@@ -6088,6 +6281,8 @@ function preinitModule(href, options) {
6088
6281
  ssrValueAttr,
6089
6282
  ssrVoidContent,
6090
6283
  startTransition,
6284
+ styleMap,
6285
+ touchStyleMap,
6091
6286
  use,
6092
6287
  useActionState,
6093
6288
  useCallback,
@@ -123,7 +123,9 @@ __export(server_exports, {
123
123
  ssrValueAttr: () => import_runtime_server.ssrValueAttr,
124
124
  ssrVoidContent: () => import_runtime_server.ssrVoidContent,
125
125
  startTransition: () => import_runtime_server.startTransition,
126
+ styleMap: () => import_runtime_server.styleMap,
126
127
  subSlot: () => import_sub_slot.subSlot,
128
+ touchStyleMap: () => import_runtime_server.touchStyleMap,
127
129
  unstable_Activity: () => import_runtime_server.Activity,
128
130
  unstable_ViewTransition: () => import_runtime_server.ViewTransition,
129
131
  unstable_addTransitionType: () => import_runtime_server.addTransitionType,
@@ -269,7 +271,9 @@ var import_runtime_server = require("../runtime.server.cjs");
269
271
  ssrValueAttr,
270
272
  ssrVoidContent,
271
273
  startTransition,
274
+ styleMap,
272
275
  subSlot,
276
+ touchStyleMap,
273
277
  unstable_Activity,
274
278
  unstable_ViewTransition,
275
279
  unstable_addTransitionType,
@@ -21,7 +21,7 @@ __export(version_exports, {
21
21
  version: () => version
22
22
  });
23
23
  module.exports = __toCommonJS(version_exports);
24
- const version = "0.2.3";
24
+ const version = "0.2.4";
25
25
  // Annotate the CommonJS export names for ESM import in node:
26
26
  0 && (module.exports = {
27
27
  version
@@ -471,6 +471,13 @@ export function findDescriptorChildrenImports(source, id) {
471
471
  if (jsxBindings.has(local)) candidates.push({ ...imported, local });
472
472
  }
473
473
  for (const node of ast.body || []) {
474
+ if (node.type === 'ExportDefaultDeclaration') {
475
+ if (node.declaration?.type === 'Identifier') {
476
+ const imported = importedBindings.get(node.declaration.name);
477
+ if (imported !== undefined) candidates.push({ ...imported, exported: 'default' });
478
+ }
479
+ continue;
480
+ }
474
481
  if (node.type !== 'ExportNamedDeclaration') continue;
475
482
  for (const specifier of node.specifiers || []) {
476
483
  const exported = specifier.exported?.name ?? specifier.exported?.value;