octane 0.3.0 → 0.3.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.
@@ -33,6 +33,7 @@ __export(index_exports, {
33
33
  TsrxErrorBoundary: () => import_runtime.TsrxErrorBoundary,
34
34
  ViewTransition: () => import_runtime.ViewTransition,
35
35
  ViewTransitionPseudoElement: () => import_runtime.ViewTransitionPseudoElement,
36
+ __HydrateCompiled: () => import_runtime.__HydrateCompiled,
36
37
  __createVoidRoot: () => import_runtime.__createVoidRoot,
37
38
  __hydrateVoidRoot: () => import_runtime.__hydrateVoidRoot,
38
39
  __methodDep: () => import_method_dep.__methodDep,
@@ -272,6 +273,7 @@ var import_method_dep = require("./method-dep.cjs");
272
273
  TsrxErrorBoundary,
273
274
  ViewTransition,
274
275
  ViewTransitionPseudoElement,
276
+ __HydrateCompiled,
275
277
  __createVoidRoot,
276
278
  __hydrateVoidRoot,
277
279
  __methodDep,
@@ -31,6 +31,8 @@ __export(runtime_exports, {
31
31
  TsrxErrorBoundary: () => TsrxErrorBoundary,
32
32
  ViewTransition: () => ViewTransition,
33
33
  ViewTransitionPseudoElement: () => ViewTransitionPseudoElement,
34
+ __HydrateCompiled: () => __HydrateCompiled,
35
+ __createCompiledContext: () => __createCompiledContext,
34
36
  __createVoidRoot: () => __createVoidRoot,
35
37
  __hydrateVoidRoot: () => __hydrateVoidRoot,
36
38
  __useLinkedStateWithGetter: () => __useLinkedStateWithGetter,
@@ -8407,6 +8409,34 @@ function createContext(defaultValue) {
8407
8409
  const ctx = function ProviderBody(props, scope) {
8408
8410
  return renderClientContextProvider(ctx, props, scope);
8409
8411
  };
8412
+ return initializeContext(ctx, defaultValue);
8413
+ }
8414
+ // @__NO_SIDE_EFFECTS__
8415
+ function __createCompiledContext(defaultValue) {
8416
+ const ctx = function ProviderBody(props, scope) {
8417
+ provideContext(scope, ctx, props.value);
8418
+ const children = props.children;
8419
+ if (children == null) return;
8420
+ const dialect = children[CHILDREN_BODY] ?? children;
8421
+ const previous = scope.hooks?.get(CHILDREN_DIALECT_SLOT);
8422
+ if (previous !== dialect) {
8423
+ if (previous !== void 0 && (previous === 2 || dialect === 2)) {
8424
+ resetScopeChildren(scope);
8425
+ if (scope.block.disposed) return;
8426
+ } else if (previous !== void 0) {
8427
+ invalidateSharedBodyOutput(scope);
8428
+ if (TRANSITION_JOURNAL !== null && !ROOT_RENDER_ROLLBACK) {
8429
+ const hooks = scope.hooks;
8430
+ journalUndo(() => hooks.set(CHILDREN_DIALECT_SLOT, previous));
8431
+ }
8432
+ }
8433
+ ensureHooks(scope).set(CHILDREN_DIALECT_SLOT, dialect);
8434
+ }
8435
+ renderSharedBody(children, void 0, scope, void 0);
8436
+ };
8437
+ return initializeContext(ctx, defaultValue);
8438
+ }
8439
+ function initializeContext(ctx, defaultValue) {
8410
8440
  ctx.$$kind = CONTEXT_TAG;
8411
8441
  ctx.defaultValue = defaultValue;
8412
8442
  ctx.$$version = 0;
@@ -8785,7 +8815,23 @@ function renderHydrateChild(state, scope, extra) {
8785
8815
  }
8786
8816
  childrenAsBody(state.props.children)(void 0, scope, extra);
8787
8817
  }
8818
+ function renderCompiledHydrateChild(state, scope, extra) {
8819
+ if (state.loadedBody !== null) {
8820
+ state.loadedBody(state.props.__data, scope, extra);
8821
+ } else {
8822
+ state.props.children(void 0, scope, extra);
8823
+ }
8824
+ }
8825
+ const EMPTY_HYDRATE_PENDING = () => void 0;
8788
8826
  function hydrateBoundaryBody(state) {
8827
+ return createHydrateBoundaryBody(state, renderHydrateChild, (_props, scope) => {
8828
+ childSlot(scope, 0, scope.block.parentNode, state.props.fallback, scope.block.endMarker);
8829
+ });
8830
+ }
8831
+ function compiledHydrateBoundaryBody(state) {
8832
+ return createHydrateBoundaryBody(state, renderCompiledHydrateChild, EMPTY_HYDRATE_PENDING);
8833
+ }
8834
+ function createHydrateBoundaryBody(state, renderChild, pendingBody) {
8789
8835
  const contentBody = (_props, scope, extra) => {
8790
8836
  try {
8791
8837
  if (state.loadedBody === null) {
@@ -8797,7 +8843,7 @@ function hydrateBoundaryBody(state) {
8797
8843
  if (thenable.status !== "fulfilled") throw new SuspenseException(thenable);
8798
8844
  }
8799
8845
  }
8800
- renderHydrateChild(state, scope, extra);
8846
+ renderChild(state, scope, extra);
8801
8847
  } catch (error) {
8802
8848
  const hydration = activeHydration();
8803
8849
  if (!state.serverPreserved || state.hydrated || hydration === null || !isSuspenseException(error)) {
@@ -8809,9 +8855,6 @@ function hydrateBoundaryBody(state) {
8809
8855
  state.hydrated = true;
8810
8856
  useEffect(notifyHydrateBoundary, [state, scope], HYDRATE_NOTIFY_SLOT);
8811
8857
  };
8812
- const pendingBody = (_props, scope) => {
8813
- childSlot(scope, 0, scope.block.parentNode, state.props.fallback, scope.block.endMarker);
8814
- };
8815
8858
  return (_props, scope) => {
8816
8859
  tryBlock(
8817
8860
  scope,
@@ -9207,7 +9250,7 @@ function findHydrateSeedSidecar(wrapper, attribute = import_constants.HYDRATE_SE
9207
9250
  }
9208
9251
  return null;
9209
9252
  }
9210
- function createHydrateSlot(props, scope, boundaryId) {
9253
+ function createHydrateSlot(props, scope, boundaryId, boundaryBody) {
9211
9254
  const parentBlock = scope.block;
9212
9255
  const parentNode = parentBlock.parentNode;
9213
9256
  const hydration = activeHydration();
@@ -9325,7 +9368,7 @@ function createHydrateSlot(props, scope, boundaryId) {
9325
9368
  scope.slots[0] = state;
9326
9369
  registerSlot(scope, state);
9327
9370
  if (!state.independent) (0, import_event_capture.registerHydrationIntentBoundary)(wrapper, intentBoundary);
9328
- block.body = hydrateBoundaryBody(state);
9371
+ block.body = boundaryBody(state);
9329
9372
  const initialStrategy = resolveHydrateStrategy(state);
9330
9373
  const pendingIntents = state.independent ? void 0 : (0, import_event_capture.takePendingHydrationIntents)(wrapper);
9331
9374
  if (state.independent) {
@@ -9582,7 +9625,7 @@ function notifyHydrateBoundary(state, scope) {
9582
9625
  }
9583
9626
  }
9584
9627
  }
9585
- function initializeHydrateComponent() {
9628
+ function initializeHydrateComponent(boundaryBody) {
9586
9629
  const hydrate = (0, import_component_flags.markComponentFlags)(
9587
9630
  function Hydrate2(rawProps, scope) {
9588
9631
  const props = rawProps;
@@ -9590,7 +9633,7 @@ function initializeHydrateComponent() {
9590
9633
  let state = scope.slots[0];
9591
9634
  let renderedChild = false;
9592
9635
  if (state === void 0) {
9593
- state = createHydrateSlot(props, scope, boundaryId);
9636
+ state = createHydrateSlot(props, scope, boundaryId, boundaryBody);
9594
9637
  } else {
9595
9638
  if (state.independent !== (props.__independent !== void 0)) {
9596
9639
  throw new Error((0, import_error_codes_client_generated.formatClientError)(66));
@@ -9639,7 +9682,8 @@ function initializeHydrateComponent() {
9639
9682
  Object.defineProperty(hydrate, "__octanePermanentStatic", { value: permanentStatic });
9640
9683
  return hydrate;
9641
9684
  }
9642
- const Hydrate = /* @__PURE__ */ initializeHydrateComponent();
9685
+ const Hydrate = /* @__PURE__ */ initializeHydrateComponent(hydrateBoundaryBody);
9686
+ const __HydrateCompiled = /* @__PURE__ */ initializeHydrateComponent(compiledHydrateBoundaryBody);
9643
9687
  const Suspense = /* @__PURE__ */ (0, import_component_flags.markComponentFlags)(
9644
9688
  function Suspense2(props, scope) {
9645
9689
  const block = scope.block;
@@ -12877,6 +12921,8 @@ function bindSignalText(scope, previous, position, value, site, onlyChild = fals
12877
12921
  );
12878
12922
  }
12879
12923
  function bindSignalAttribute(scope, previous, element, name, value, site, attributeKind = "attr") {
12924
+ if (previous === value && value !== void 0 && (value === null || typeof value !== "object" && typeof value !== "function"))
12925
+ return previous;
12880
12926
  return bindDirectSignal(
12881
12927
  scope,
12882
12928
  previous,
@@ -14148,7 +14194,14 @@ function setStyleProperty(el, name, value, staticCss, previous) {
14148
14194
  }
14149
14195
  const remove = value == null || typeof value === "boolean";
14150
14196
  if (remove && previous === CURRENT_SCOPE) return;
14151
- if (TRANSITION_JOURNAL !== null) journalAttr(el, "style");
14197
+ if (TRANSITION_JOURNAL !== null) {
14198
+ const log = TRANSITION_JOURNAL;
14199
+ let tail = log.length - 4;
14200
+ if (log[tail] === JOURNAL_BAG && log[tail + 1] === CURRENT_SCOPE?.slots[0]) tail -= 4;
14201
+ if (tail < TRANSITION_JOURNAL_CHECKPOINT || log[tail] !== JOURNAL_ATTR || log[tail + 1] !== el || log[tail + 2] !== "style")
14202
+ journalAttr(el, "style");
14203
+ else journalBag();
14204
+ }
14152
14205
  if (hiddenStyleWriter !== null && hiddenStyleWriter(el, value, previous, name)) return;
14153
14206
  const style = (STAGED_DOM?.view(el) ?? el).style;
14154
14207
  if (remove) style.removeProperty((0, import_css.styleName)(name));
@@ -15189,14 +15242,16 @@ function setEventHandler(el, key, handler) {
15189
15242
  SCOPE_SIGNAL_OWNERS.set(owner, false);
15190
15243
  const owners = SIGNAL_EVENT_OWNERS ??= /* @__PURE__ */ new WeakMap();
15191
15244
  if (STAGED_COMMIT_CAPTURE !== null)
15192
- DEFERRED_LAYOUT_DRIVER.stageAction(() => owners.set(el, owner));
15245
+ DEFERRED_LAYOUT_DRIVER.stageAction(() => {
15246
+ if (owners.get(el) !== owner) owners.set(el, owner);
15247
+ });
15193
15248
  else {
15194
- if (TRANSITION_JOURNAL !== null) {
15195
- const previous = owners.get(el);
15196
- if (previous !== owner)
15249
+ const previous = owners.get(el);
15250
+ if (previous !== owner) {
15251
+ if (TRANSITION_JOURNAL !== null)
15197
15252
  TRANSITION_JOURNAL.push(JOURNAL_EVENT_OWNER, owners, el, previous);
15253
+ owners.set(el, owner);
15198
15254
  }
15199
- owners.set(el, owner);
15200
15255
  }
15201
15256
  }
15202
15257
  }
@@ -15208,9 +15263,11 @@ function evt0(el, key, fn) {
15208
15263
  }
15209
15264
  function evt0u(d, fn) {
15210
15265
  if (STAGED_COMMIT_CAPTURE !== null) d = DEFERRED_LAYOUT_DRIVER.projectEventBundle(d);
15211
- if (_dispatchDepth !== 0) preserveDispatchedBundle(d);
15212
- if (TRANSITION_JOURNAL !== null) journalObjectOnce(d);
15213
- d.fn = fn;
15266
+ if (d.fn !== fn) {
15267
+ if (_dispatchDepth !== 0) preserveDispatchedBundle(d);
15268
+ if (TRANSITION_JOURNAL !== null) journalObjectOnce(d);
15269
+ d.fn = fn;
15270
+ }
15214
15271
  if ((SIGNAL_BINDINGS_ENABLED || import_document_owner.signalDocumentEnabled || import_owner_context.activeSynchronousSignalOwner !== null || import_owner_context.activeSignalOwnerEnvironment !== void 0 || SIGNAL_EVENT_OWNERS !== null) && (import_owner_context.activeSynchronousSignalOwner !== null || import_owner_context.activeSignalOwnerEnvironment !== void 0 || STAGED_COMMIT_CAPTURE !== null || import_document_owner.signalDocumentEnabled || CURRENT_SCOPE?.block.idState.renderOwner?.signalOwner !== void 0 || SIGNAL_EVENT_OWNERS?.get(d.el) !== CURRENT_SCOPE))
15215
15272
  setEventHandler(d.el);
15216
15273
  }
@@ -15221,10 +15278,12 @@ function evt1(el, key, fn, a0) {
15221
15278
  }
15222
15279
  function evt1u(d, fn, a0) {
15223
15280
  if (STAGED_COMMIT_CAPTURE !== null) d = DEFERRED_LAYOUT_DRIVER.projectEventBundle(d);
15224
- if (_dispatchDepth !== 0) preserveDispatchedBundle(d);
15225
- if (TRANSITION_JOURNAL !== null) journalObjectOnce(d);
15226
- d.fn = fn;
15227
- d.a0 = a0;
15281
+ if (d.fn !== fn || !Object.is(d.a0, a0)) {
15282
+ if (_dispatchDepth !== 0) preserveDispatchedBundle(d);
15283
+ if (TRANSITION_JOURNAL !== null) journalObjectOnce(d);
15284
+ d.fn = fn;
15285
+ d.a0 = a0;
15286
+ }
15228
15287
  if ((SIGNAL_BINDINGS_ENABLED || import_document_owner.signalDocumentEnabled || import_owner_context.activeSynchronousSignalOwner !== null || import_owner_context.activeSignalOwnerEnvironment !== void 0 || SIGNAL_EVENT_OWNERS !== null) && (import_owner_context.activeSynchronousSignalOwner !== null || import_owner_context.activeSignalOwnerEnvironment !== void 0 || STAGED_COMMIT_CAPTURE !== null || import_document_owner.signalDocumentEnabled || CURRENT_SCOPE?.block.idState.renderOwner?.signalOwner !== void 0 || SIGNAL_EVENT_OWNERS?.get(d.el) !== CURRENT_SCOPE))
15229
15288
  setEventHandler(d.el);
15230
15289
  }
@@ -15235,11 +15294,13 @@ function evt2(el, key, fn, a0, a1) {
15235
15294
  }
15236
15295
  function evt2u(d, fn, a0, a1) {
15237
15296
  if (STAGED_COMMIT_CAPTURE !== null) d = DEFERRED_LAYOUT_DRIVER.projectEventBundle(d);
15238
- if (_dispatchDepth !== 0) preserveDispatchedBundle(d);
15239
- if (TRANSITION_JOURNAL !== null) journalObjectOnce(d);
15240
- d.fn = fn;
15241
- d.a0 = a0;
15242
- d.a1 = a1;
15297
+ if (d.fn !== fn || !Object.is(d.a0, a0) || !Object.is(d.a1, a1)) {
15298
+ if (_dispatchDepth !== 0) preserveDispatchedBundle(d);
15299
+ if (TRANSITION_JOURNAL !== null) journalObjectOnce(d);
15300
+ d.fn = fn;
15301
+ d.a0 = a0;
15302
+ d.a1 = a1;
15303
+ }
15243
15304
  if ((SIGNAL_BINDINGS_ENABLED || import_document_owner.signalDocumentEnabled || import_owner_context.activeSynchronousSignalOwner !== null || import_owner_context.activeSignalOwnerEnvironment !== void 0 || SIGNAL_EVENT_OWNERS !== null) && (import_owner_context.activeSynchronousSignalOwner !== null || import_owner_context.activeSignalOwnerEnvironment !== void 0 || STAGED_COMMIT_CAPTURE !== null || import_document_owner.signalDocumentEnabled || CURRENT_SCOPE?.block.idState.renderOwner?.signalOwner !== void 0 || SIGNAL_EVENT_OWNERS?.get(d.el) !== CURRENT_SCOPE))
15244
15305
  setEventHandler(d.el);
15245
15306
  }
@@ -15260,10 +15321,12 @@ function evtN(el, key, fn, args) {
15260
15321
  }
15261
15322
  function evtNu(d, fn, args) {
15262
15323
  if (STAGED_COMMIT_CAPTURE !== null) d = DEFERRED_LAYOUT_DRIVER.projectEventBundle(d);
15263
- if (_dispatchDepth !== 0) preserveDispatchedBundle(d);
15264
- if (TRANSITION_JOURNAL !== null) journalObjectOnce(d);
15265
- d.fn = fn;
15266
- d.args = args;
15324
+ if (d.fn !== fn || d.args !== args) {
15325
+ if (_dispatchDepth !== 0) preserveDispatchedBundle(d);
15326
+ if (TRANSITION_JOURNAL !== null) journalObjectOnce(d);
15327
+ d.fn = fn;
15328
+ d.args = args;
15329
+ }
15267
15330
  if ((SIGNAL_BINDINGS_ENABLED || import_document_owner.signalDocumentEnabled || import_owner_context.activeSynchronousSignalOwner !== null || import_owner_context.activeSignalOwnerEnvironment !== void 0 || SIGNAL_EVENT_OWNERS !== null) && (import_owner_context.activeSynchronousSignalOwner !== null || import_owner_context.activeSignalOwnerEnvironment !== void 0 || STAGED_COMMIT_CAPTURE !== null || import_document_owner.signalDocumentEnabled || CURRENT_SCOPE?.block.idState.renderOwner?.signalOwner !== void 0 || SIGNAL_EVENT_OWNERS?.get(d.el) !== CURRENT_SCOPE))
15268
15331
  setEventHandler(d.el);
15269
15332
  }
@@ -25090,6 +25153,7 @@ function forBlock(parentScope, slotKey, domParent, inputItems, getKey, itemBody,
25090
25153
  parentScope.slots[slotKey] = state;
25091
25154
  registerSlot(parentScope, state);
25092
25155
  }
25156
+ if (hydration !== null && state.size === 0) hydration.node = getNextSibling(state.start);
25093
25157
  const serverMarkerState = hydration?.markerState(state.start) ?? -1;
25094
25158
  if (ROOT_RENDER_TRANSACTION !== null && state.env !== deps)
25095
25159
  journalRootProperty(state, "env", state.env);
@@ -25183,6 +25247,7 @@ function forBlock(parentScope, slotKey, domParent, inputItems, getKey, itemBody,
25183
25247
  (f & 2) !== 0,
25184
25248
  (f & 16) !== 0
25185
25249
  );
25250
+ if (hydration !== null) discardLeftoverHydrationItems(state.end, hydration);
25186
25251
  } else {
25187
25252
  reconcileKeyed(
25188
25253
  parentBlock,
@@ -25197,10 +25262,7 @@ function forBlock(parentScope, slotKey, domParent, inputItems, getKey, itemBody,
25197
25262
  (f & 16) !== 0
25198
25263
  );
25199
25264
  }
25200
- if (hydration !== null) {
25201
- discardLeftoverHydrationItems(state.end, hydration);
25202
- hydration.node = getNextSibling(state.end);
25203
- }
25265
+ if (hydration !== null) hydration.node = getNextSibling(state.end);
25204
25266
  }
25205
25267
  function keyedForBlock(parentScope, slotKey, domParent, items, getKey, itemBody, flags, deps, emptyBody, anchor, ownEnd, selectionBody) {
25206
25268
  if (CURRENT_BLOCK?.pending && !CURRENT_BLOCK.crossRenderUpdate) return;
@@ -27959,6 +28021,8 @@ function scriptResource(attrs) {
27959
28021
  TsrxErrorBoundary,
27960
28022
  ViewTransition,
27961
28023
  ViewTransitionPseudoElement,
28024
+ __HydrateCompiled,
28025
+ __createCompiledContext,
27962
28026
  __createVoidRoot,
27963
28027
  __hydrateVoidRoot,
27964
28028
  __useLinkedStateWithGetter,
@@ -372,7 +372,7 @@ let SIGNAL_COMPONENT_INSTANCE_KEY = "";
372
372
  let SERVER_SIGNAL_OWNER_ACTIVE = false;
373
373
  let SIGNAL_CONTROL_SITE = "";
374
374
  const EMPTY_SIGNAL_LIST_KEYS = [];
375
- let SIGNAL_LIST_KEYS = EMPTY_SIGNAL_LIST_KEYS;
375
+ let SIGNAL_LIST_KEYS = null;
376
376
  function newStyleCollector() {
377
377
  const collector = /* @__PURE__ */ new Map();
378
378
  collector.replay = null;
@@ -1751,10 +1751,7 @@ function enterAsyncArm(armKey, mapped = false) {
1751
1751
  const occurrence = frame === null ? 0 : nextFrameOccurrence(frame, "@arm-position:");
1752
1752
  const fallbackPosition = armKey !== null && (typeof armKey === "object" || typeof armKey === "function" || typeof armKey === "symbol") ? previous + "|@arm-position:" + occurrence : void 0;
1753
1753
  if (SERVER_SIGNAL_BINDINGS_POTENTIAL && SIGNAL_CONTROL_SITE.charCodeAt(0) === 102) {
1754
- SIGNAL_LIST_KEYS = [
1755
- ...SIGNAL_LIST_KEYS,
1756
- signalIdentityKey(mapped ? "k" + String(armKey) : armKey)
1757
- ];
1754
+ SIGNAL_LIST_KEYS = { parent: SIGNAL_LIST_KEYS, key: armKey, mapped, values: null };
1758
1755
  }
1759
1756
  ASYNC_SCOPE = previous + "|@arm:" + asyncIdentityKey(armKey, false, fallbackPosition);
1760
1757
  }
@@ -2823,10 +2820,27 @@ function signalIdentityKey(value) {
2823
2820
  function serverStructuralSignalInstanceKey(invocationSite, key) {
2824
2821
  return resolveServerSignalInstanceKey(SIGNAL_COMPONENT_INSTANCE_KEY) + JSON.stringify([
2825
2822
  invocationSite ?? "legacy",
2826
- SIGNAL_LIST_KEYS,
2823
+ resolveServerSignalListKeys(SIGNAL_LIST_KEYS),
2827
2824
  key != null ? signalIdentityKey(key) : ""
2828
2825
  ]);
2829
2826
  }
2827
+ function resolveServerSignalListKeys(keys) {
2828
+ if (keys === null) return EMPTY_SIGNAL_LIST_KEYS;
2829
+ if (keys.values !== null) return keys.values;
2830
+ const pending = [];
2831
+ let parent = keys;
2832
+ while (parent !== null && parent.values === null) {
2833
+ pending.push(parent);
2834
+ parent = parent.parent;
2835
+ }
2836
+ let values = parent?.values ?? EMPTY_SIGNAL_LIST_KEYS;
2837
+ for (let index = pending.length - 1; index >= 0; index--) {
2838
+ const entry = pending[index];
2839
+ values = [...values, signalIdentityKey(entry.mapped ? "k" + String(entry.key) : entry.key)];
2840
+ entry.values = values;
2841
+ }
2842
+ return values;
2843
+ }
2830
2844
  function resolveServerSignalInstanceKey(identity) {
2831
2845
  if (typeof identity === "string") return identity;
2832
2846
  if (identity.signalInstanceKey !== void 0) return identity.signalInstanceKey;
@@ -2843,8 +2857,8 @@ function resolveServerSignalInstanceKey(identity) {
2843
2857
  const frame = pending[index];
2844
2858
  identity += JSON.stringify([
2845
2859
  frame.signalInvocationSite ?? "legacy",
2846
- frame.signalListKeys,
2847
- frame.signalKey
2860
+ resolveServerSignalListKeys(frame.signalListKeys ?? null),
2861
+ frame.signalKey != null ? signalIdentityKey(frame.signalKey) : ""
2848
2862
  ]);
2849
2863
  frame.signalInstanceKey = identity;
2850
2864
  }
@@ -2949,7 +2963,7 @@ function renderComponentFramed(comp, props, parent, frame, inherit, instanceKey,
2949
2963
  ASYNC_SCOPE = frame.asyncScope;
2950
2964
  if (instanceKey !== void 0) SIGNAL_COMPONENT_INSTANCE_KEY = instanceKey;
2951
2965
  SIGNAL_CONTROL_SITE = "";
2952
- SIGNAL_LIST_KEYS = EMPTY_SIGNAL_LIST_KEYS;
2966
+ SIGNAL_LIST_KEYS = null;
2953
2967
  const nativeToken = NATIVE_READ_COLLECTOR === null ? -1 : beginActiveNativeReadScope(scope);
2954
2968
  let nativeCompleted = false;
2955
2969
  try {
@@ -3048,34 +3062,36 @@ function ssrComponent(parent, comp, props, inherit, key, identityScoped, invocat
3048
3062
  });
3049
3063
  }
3050
3064
  const pf = FRAME;
3051
- const frame = pf === null ? {
3052
- parent: null,
3053
- seg: 0,
3065
+ const seg = pf === null ? 0 : nextChildSegment(pf);
3066
+ const namespace = explicitNamespace ?? pf?.namespace;
3067
+ const potentialSignalKey = signalInstanceKey === void 0 && SERVER_SIGNAL_BINDINGS_POTENTIAL;
3068
+ const frame = potentialSignalKey ? {
3069
+ parent: pf,
3070
+ seg,
3054
3071
  nextChild: 0,
3055
3072
  scopedChildren: null,
3056
3073
  occ: null,
3057
3074
  path: null,
3058
3075
  deferred: false,
3059
3076
  asyncScope: ASYNC_SCOPE,
3060
- namespace: explicitNamespace ?? void 0
3077
+ namespace,
3078
+ signalParentKey: SIGNAL_COMPONENT_INSTANCE_KEY,
3079
+ signalInvocationSite: invocationSite,
3080
+ signalListKeys: SIGNAL_LIST_KEYS,
3081
+ signalKey: key,
3082
+ signalInstanceKey: void 0
3061
3083
  } : {
3062
3084
  parent: pf,
3063
- seg: nextChildSegment(pf),
3085
+ seg,
3064
3086
  nextChild: 0,
3065
3087
  scopedChildren: null,
3066
3088
  occ: null,
3067
3089
  path: null,
3068
3090
  deferred: false,
3069
3091
  asyncScope: ASYNC_SCOPE,
3070
- namespace: explicitNamespace ?? pf.namespace
3092
+ namespace
3071
3093
  };
3072
- if (signalInstanceKey === void 0 && SERVER_SIGNAL_BINDINGS_POTENTIAL) {
3073
- frame.signalParentKey = SIGNAL_COMPONENT_INSTANCE_KEY;
3074
- frame.signalInvocationSite = invocationSite;
3075
- frame.signalListKeys = SIGNAL_LIST_KEYS;
3076
- frame.signalKey = key != null ? signalIdentityKey(key) : "";
3077
- signalInstanceKey = frame;
3078
- }
3094
+ if (potentialSignalKey) signalInstanceKey = frame;
3079
3095
  return renderComponentFramed(
3080
3096
  comp,
3081
3097
  props,
@@ -3158,7 +3174,7 @@ function withServerIndependentIdentity(prefix, idSeed, render) {
3158
3174
  SIGNAL_INSTANCE_PREFIX = prefix;
3159
3175
  SIGNAL_COMPONENT_INSTANCE_KEY = JSON.stringify([prefix, "root"]);
3160
3176
  SIGNAL_CONTROL_SITE = "";
3161
- SIGNAL_LIST_KEYS = EMPTY_SIGNAL_LIST_KEYS;
3177
+ SIGNAL_LIST_KEYS = null;
3162
3178
  ID_PREFIX = prefix + "-";
3163
3179
  ID_COUNTER = idSeed;
3164
3180
  try {
@@ -5050,7 +5066,7 @@ function runFullFramedPass(component, props, resolved, nonceAttr = "", identifie
5050
5066
  SIGNAL_COMPONENT_INSTANCE_KEY = JSON.stringify([identifierPrefix, "root"]);
5051
5067
  SERVER_SIGNAL_OWNER_ACTIVE = false;
5052
5068
  SIGNAL_CONTROL_SITE = "";
5053
- SIGNAL_LIST_KEYS = EMPTY_SIGNAL_LIST_KEYS;
5069
+ SIGNAL_LIST_KEYS = null;
5054
5070
  NONCE_ATTR = nonceAttr;
5055
5071
  ASYNC_SCOPE = "";
5056
5072
  MARKERS = markers;
@@ -5172,7 +5188,7 @@ function runDiscoveryRound(jobs, resolved, identifierPrefix) {
5172
5188
  SIGNAL_COMPONENT_INSTANCE_KEY = JSON.stringify([identifierPrefix, "root"]);
5173
5189
  SERVER_SIGNAL_OWNER_ACTIVE = false;
5174
5190
  SIGNAL_CONTROL_SITE = "";
5175
- SIGNAL_LIST_KEYS = EMPTY_SIGNAL_LIST_KEYS;
5191
+ SIGNAL_LIST_KEYS = null;
5176
5192
  NONCE_ATTR = "";
5177
5193
  ASYNC_SCOPE = "";
5178
5194
  MARKERS = true;
@@ -6523,7 +6539,19 @@ function boundaryErrorChunk(b, nonceAttr) {
6523
6539
  const serverOwnedStatic = b.serverOwnedStatic ? ",1" : "";
6524
6540
  return "<script " + import_constants.STREAM_SCRIPT_ATTR + nonceAttr + ">$OCTRX(" + JSON.stringify(b.id).replace(/</g, "\\u003c") + serverOwnedStatic + ")</script>";
6525
6541
  }
6526
- async function runStream(component, props, options, sink, resolved) {
6542
+ function createInjectionCanceler(injection) {
6543
+ if (injection === void 0) return NOOP;
6544
+ let cancelled = false;
6545
+ return (error) => {
6546
+ if (cancelled) return;
6547
+ cancelled = true;
6548
+ try {
6549
+ injection.cancel?.(error);
6550
+ } catch {
6551
+ }
6552
+ };
6553
+ }
6554
+ async function runStream(component, props, options, sink, resolved, cancelInjection) {
6527
6555
  const timeoutMs = options?.timeoutMs ?? SUSPENSE_TIMEOUT_MS;
6528
6556
  const signal = options?.signal;
6529
6557
  const nonceAttr = nonceAttrOf(options);
@@ -6605,7 +6633,15 @@ async function runStream(component, props, options, sink, resolved) {
6605
6633
  injection.accepted?.();
6606
6634
  });
6607
6635
  };
6608
- const recoveryInjection = injection === void 0 ? void 0 : async () => {
6636
+ const recoveryInjection = injection === void 0 ? void 0 : async (error) => {
6637
+ let queued = "";
6638
+ if (!injectionFailed) {
6639
+ try {
6640
+ queued = injection.take();
6641
+ } catch {
6642
+ }
6643
+ }
6644
+ cancelInjection(error);
6609
6645
  if (signal?.aborted) {
6610
6646
  await writeChain;
6611
6647
  for (const html of unacceptedInjection) {
@@ -6614,13 +6650,6 @@ async function runStream(component, props, options, sink, resolved) {
6614
6650
  }
6615
6651
  unacceptedInjection.length = 0;
6616
6652
  }
6617
- if (injectionFailed) return "";
6618
- let queued;
6619
- try {
6620
- queued = injection.take();
6621
- } catch {
6622
- return "";
6623
- }
6624
6653
  if (queued !== "" && signal?.aborted) {
6625
6654
  const replay = write(queued, "recovery");
6626
6655
  if (replay !== void 0) await replay;
@@ -6936,7 +6965,7 @@ async function runStream(component, props, options, sink, resolved) {
6936
6965
  let tail = "";
6937
6966
  if (recoveryInjection !== void 0) {
6938
6967
  try {
6939
- tail = await recoveryInjection();
6968
+ tail = await recoveryInjection(err);
6940
6969
  } catch {
6941
6970
  }
6942
6971
  }
@@ -6980,7 +7009,7 @@ async function runStream(component, props, options, sink, resolved) {
6980
7009
  injectionUnsubscribe = void 0;
6981
7010
  let terminal = "";
6982
7011
  try {
6983
- terminal = await recoveryInjection();
7012
+ terminal = await recoveryInjection(err);
6984
7013
  } catch {
6985
7014
  }
6986
7015
  terminal += heldDocumentTail;
@@ -7148,6 +7177,7 @@ function renderToPipeableStream(entryComponent, props, options) {
7148
7177
  const beginRender = (preparedOptions) => {
7149
7178
  const renderOptions = { ...preparedOptions, signal: controller.signal };
7150
7179
  const resolved = newResolvedMap(renderOptions);
7180
+ const cancelInjection = createInjectionCanceler(renderOptions.injection);
7151
7181
  void runStream(
7152
7182
  component,
7153
7183
  props,
@@ -7160,6 +7190,7 @@ function renderToPipeableStream(entryComponent, props, options) {
7160
7190
  options?.onShellReady?.();
7161
7191
  },
7162
7192
  shellError(err) {
7193
+ cancelInjection(err);
7163
7194
  releaseServerRenderResources(resolved);
7164
7195
  shellFailure = { error: err };
7165
7196
  options?.onShellError?.(err);
@@ -7170,14 +7201,17 @@ function renderToPipeableStream(entryComponent, props, options) {
7170
7201
  options?.onAllReady?.();
7171
7202
  flushEnd();
7172
7203
  },
7173
- fatal() {
7204
+ fatal(err) {
7205
+ cancelInjection(err);
7174
7206
  releaseServerRenderResources(resolved);
7175
7207
  options?.onAllReady?.();
7176
7208
  flushEnd();
7177
7209
  }
7178
7210
  },
7179
- resolved
7211
+ resolved,
7212
+ cancelInjection
7180
7213
  ).catch((err) => {
7214
+ cancelInjection(err);
7181
7215
  releaseServerRenderResources(resolved);
7182
7216
  options?.onError?.(err);
7183
7217
  flushEnd();
@@ -7361,6 +7395,7 @@ function renderToReadableStream(entryComponent, props, options) {
7361
7395
  };
7362
7396
  }
7363
7397
  const resolved = newResolvedMap(renderOptions);
7398
+ const cancelInjection = createInjectionCanceler(renderOptions.injection);
7364
7399
  const release = () => {
7365
7400
  if (released) return;
7366
7401
  released = true;
@@ -7369,6 +7404,7 @@ function renderToReadableStream(entryComponent, props, options) {
7369
7404
  const settleFailure = (error) => {
7370
7405
  if (terminal) return;
7371
7406
  terminal = true;
7407
+ cancelInjection(error);
7372
7408
  try {
7373
7409
  release();
7374
7410
  } catch (err) {
@@ -7421,7 +7457,8 @@ function renderToReadableStream(entryComponent, props, options) {
7421
7457
  settleFailure(err);
7422
7458
  }
7423
7459
  },
7424
- resolved
7460
+ resolved,
7461
+ cancelInjection
7425
7462
  ).catch((err) => {
7426
7463
  renderOptions.onError?.(err);
7427
7464
  settleFailure(err);