octane 0.13.4 → 0.13.6

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.
Files changed (48) hide show
  1. package/README.md +35 -0
  2. package/dist/cjs/dom-bindings.cjs +11 -24
  3. package/dist/cjs/error-codes.client.generated.cjs +12 -0
  4. package/dist/cjs/error-codes.server.generated.cjs +12 -0
  5. package/dist/cjs/index.cjs +6 -0
  6. package/dist/cjs/runtime.cjs +96 -48
  7. package/dist/cjs/runtime.server.cjs +56 -4
  8. package/dist/cjs/server/index.cjs +6 -0
  9. package/dist/cjs/signals/native-read-seeds.cjs +4 -2
  10. package/dist/cjs/version.cjs +1 -1
  11. package/dist/compiler/bundler.js +20 -0
  12. package/dist/compiler/compile.js +119 -57
  13. package/dist/compiler/strong-diagnostics.js +81 -61
  14. package/dist/compiler/strong-html.js +5 -5
  15. package/dist/compiler/strong-mode.js +14 -0
  16. package/dist/compiler/strong-template-policy.js +89 -59
  17. package/dist/dom-binding-program.d.ts +1 -2
  18. package/dist/dom-binding-program.js +8 -23
  19. package/dist/dom-bindings.d.ts +2 -2
  20. package/dist/dom-bindings.js +11 -24
  21. package/dist/error-codes.client.generated.d.ts +3 -0
  22. package/dist/error-codes.client.generated.js +12 -0
  23. package/dist/error-codes.server.generated.d.ts +3 -0
  24. package/dist/error-codes.server.generated.js +12 -0
  25. package/dist/hydration/streamed-signals.js +2 -2
  26. package/dist/index.d.ts +1 -1
  27. package/dist/index.js +6 -0
  28. package/dist/node/dom-binding-program.js +8 -23
  29. package/dist/node/dom-bindings.js +11 -24
  30. package/dist/node/error-codes.client.generated.js +12 -0
  31. package/dist/node/error-codes.server.generated.js +12 -0
  32. package/dist/node/hydration/streamed-signals.js +2 -2
  33. package/dist/node/index.js +6 -0
  34. package/dist/node/runtime.js +93 -48
  35. package/dist/node/runtime.server.js +53 -4
  36. package/dist/node/server/index.js +6 -0
  37. package/dist/node/signals/native-read-seeds.js +2 -1
  38. package/dist/node/version.js +1 -1
  39. package/dist/runtime.d.ts +20 -0
  40. package/dist/runtime.js +93 -48
  41. package/dist/runtime.server.d.ts +12 -1
  42. package/dist/runtime.server.js +53 -4
  43. package/dist/server/index.d.ts +2 -1
  44. package/dist/server/index.js +6 -0
  45. package/dist/signals/native-read-seeds.d.ts +1 -0
  46. package/dist/signals/native-read-seeds.js +2 -1
  47. package/dist/version.js +1 -1
  48. package/package.json +1 -1
package/README.md CHANGED
@@ -31,6 +31,41 @@ Applications that use only the Octane runtime do not need this peer.
31
31
  scoped state, derived values, async resources, and native component reads.
32
32
  The standard compiler handles signals automatically; no extra option is needed.
33
33
 
34
+ ## Dynamically selected compiled views
35
+
36
+ In a template, use `CompiledOutlet` when all dynamically selected components
37
+ render compiled Octane output. It owns the selected view inside the surrounding
38
+ tree: hooks, contexts, hydration, and cleanup follow their usual lifetimes.
39
+
40
+ ```tsx
41
+ import { CompiledContext, CompiledOutlet, createCompiledContext, useContext } from 'octane';
42
+
43
+ const Route = createCompiledContext<string>('home');
44
+
45
+ function Page({ name }: { name: string }) @{
46
+ <h1>{name + ': ' + useContext(Route)}</h1>
47
+ }
48
+
49
+ export function Shell({ screen, name, route }) @{
50
+ <CompiledContext context={Route} value={route}>
51
+ <CompiledOutlet key={route} component={screen ?? Page} props={{ name }} />
52
+ </CompiledContext>
53
+ }
54
+ ```
55
+
56
+ An unchanged component and key retain state; changing either replaces the view
57
+ and runs its cleanups. Use `@try` / `@pending` around the outlet when the
58
+ selected component may suspend. The outlet accepts only a function whose output
59
+ is compiled; it throws for host strings or bodies that return descriptors or
60
+ plain text (including an explicit `null` return). Use an ordinary
61
+ dynamic JSX tag when arbitrary renderables are intentional.
62
+
63
+ `createCompiledContext` creates a context read by `use` or `useContext`.
64
+ Provide it through `CompiledContext` with children authored between the
65
+ template tags. Rendering the context itself as a provider is an error. Existing
66
+ `createContext` providers continue to accept both compiled and descriptor
67
+ children; compiled contexts are a separate, opt-in contract.
68
+
34
69
  Custom Node build pipelines can opt into project-aware string-child inference
35
70
  through `octane/compiler/typescript`. See the
36
71
  [type-aware text compilation guide](https://github.com/octanejs/octane/blob/main/docs/compiler-text-inference.md).
@@ -108,14 +108,7 @@ function assertBindingRoot(root, descriptor) {
108
108
  }
109
109
  function isTextLeaf(node) {
110
110
  const first = node.firstChild;
111
- return first === null || !first.nextSibling && (first.nodeType === 3 || first.localName === "font");
112
- }
113
- const htmlWhitespace = /^[\t\n\f\r ]*$/;
114
- function skipBindingWhitespace(node) {
115
- while (node !== null && node.nodeType === 3 && htmlWhitespace.test(node.nodeValue)) {
116
- node = node.nextSibling;
117
- }
118
- return node;
111
+ return first === null || !first.nextSibling && first.nodeType === 3;
119
112
  }
120
113
  function resolveFixedNodes(root, descriptor) {
121
114
  assertBindingRoot(root, descriptor);
@@ -129,12 +122,12 @@ function resolveFixedNodes(root, descriptor) {
129
122
  throw new Error(__octaneDev ? "DOM bindings cannot adopt a mismatched static element topology." : (0, import_error_message_no_arguments.formatNoArgumentErrorMessage)(318));
130
123
  }
131
124
  if (i !== 0) {
132
- cursors[parent] = skipBindingWhitespace(node.nextSibling);
125
+ cursors[parent] = node.nextSibling;
133
126
  childIndices[parent]++;
134
127
  }
135
128
  nodes.push(node);
136
129
  childIndices.push(0);
137
- cursors.push(text || children === null ? null : skipBindingWhitespace(node.firstChild));
130
+ cursors.push(text || children === null ? null : node.firstChild);
138
131
  }
139
132
  for (let i = 0; i < nodes.length; i++) {
140
133
  if (childIndices[i] !== (descriptor.nodes[i][3] ?? 0)) {
@@ -181,11 +174,9 @@ function resolveAddressedNodes(root, descriptor) {
181
174
  }
182
175
  if (parent !== -1) {
183
176
  childCounts[parent]++;
184
- if (cursors[parent] !== void 0) cursors[parent] = skipBindingWhitespace(node.nextSibling);
177
+ if (cursors[parent] !== void 0) cursors[parent] = node.nextSibling;
185
178
  }
186
- cursors.push(
187
- text || children === null || openChildren ? void 0 : skipBindingWhitespace(node.firstChild)
188
- );
179
+ cursors.push(text || children === null || openChildren ? void 0 : node.firstChild);
189
180
  }
190
181
  for (let i = 0; i < descriptor.nodes.length; i++) {
191
182
  if (childCounts[i] !== (descriptor.nodes[i][3] ?? 0)) {
@@ -217,16 +208,12 @@ function normalizeFixedScalar(binding, value) {
217
208
  (binding[2] === "start" || binding[2] === "rowspan") && Number.isNaN(Number(value))) ? null : String(value);
218
209
  }
219
210
  }
220
- function writeFixedScalar(node, binding, value, previous) {
211
+ function writeFixedScalar(node, binding, value) {
221
212
  const name = binding[2];
222
213
  if (binding[1] === "text") {
223
214
  const text = node.firstChild;
224
- const current = text?.nodeValue;
225
215
  if (text === null) node.appendChild(node.ownerDocument.createTextNode(value));
226
- else if (current !== value) {
227
- if (current !== null) text.nodeValue = value;
228
- else if (previous !== void 0) node.textContent = value;
229
- }
216
+ else if (text.nodeValue !== value) text.nodeValue = value;
230
217
  } else if (value === null) {
231
218
  if (node.hasAttribute(name)) node.removeAttribute(name);
232
219
  } else if (node.getAttribute(name) !== value) {
@@ -257,7 +244,7 @@ function normalize(binding, value) {
257
244
  return normalizeFixedScalar(binding, value);
258
245
  }
259
246
  }
260
- function write(node, binding, value, previous) {
247
+ function write(node, binding, value) {
261
248
  const name = binding[2];
262
249
  if (binding[1] === "classToken") {
263
250
  node.classList.toggle(name, value !== null);
@@ -283,7 +270,7 @@ function write(node, binding, value, previous) {
283
270
  if (style.getPropertyValue(name) !== text || style.getPropertyPriority(name) !== priority)
284
271
  style.setProperty(name, text, priority);
285
272
  }
286
- } else return writeFixedScalar(node, binding, value, previous);
273
+ } else return writeFixedScalar(node, binding, value);
287
274
  }
288
275
  const __bindingURL = [
289
276
  (binding) => binding[1] === "url" || isFixedScalarChannel(binding),
@@ -476,7 +463,7 @@ function __adoptBindings(root, descriptor, source, options) {
476
463
  if (!style)
477
464
  styles.set(i, style = __createBindingStyleRestoration(nodes[binding[0]], binding));
478
465
  style.write(prepared);
479
- } else written = write(nodes[binding[0]], binding, prepared, last);
466
+ } else written = write(nodes[binding[0]], binding, prepared);
480
467
  if (!disposed) {
481
468
  previous[i] = prepared;
482
469
  if (binding[1] === "attr" || binding[1] === "boolean" || binding[1] === "aria" || binding[1] === "class" || binding[1] === "url" || binding[1] === "styleProperty" || binding[1] === "styleObject" || binding[1] === "text") {
@@ -902,7 +889,7 @@ function __adoptScalarBindings(root, descriptor, source, options) {
902
889
  const last = previous[i];
903
890
  if (value === last) continue;
904
891
  const binding = bindings[i];
905
- const published = writeChannel(nodes[binding[0]], binding, value, last);
892
+ const published = writeChannel(nodes[binding[0]], binding, value);
906
893
  if (!disposed) {
907
894
  previous[i] = value;
908
895
  const node = owned[i][0];
@@ -1074,6 +1074,18 @@ function formatClientError(code, ...args) {
1074
1074
  "A keyed list rollback record restored a different shape than it recorded. This is a bug in Octane.",
1075
1075
  args
1076
1076
  );
1077
+ case 344:
1078
+ return (0, import_error_message.formatDevErrorMessage)(
1079
+ "Provide a compiled context with <CompiledContext context={context}>.",
1080
+ args
1081
+ );
1082
+ case 345:
1083
+ return (0, import_error_message.formatDevErrorMessage)("CompiledContext requires compiled template children.", args);
1084
+ case 346:
1085
+ return (0, import_error_message.formatDevErrorMessage)(
1086
+ "CompiledOutlet requires a compiled component function with no returned renderable.",
1087
+ args
1088
+ );
1077
1089
  default:
1078
1090
  return (0, import_error_message.formatUnknownDevErrorMessage)(code);
1079
1091
  }
@@ -769,6 +769,18 @@ function formatServerError(code, ...args) {
769
769
  "`<textarea>` children must be text: strings, numbers, or arrays of them. One child was %s. A textarea's content is its default value, so it cannot contain elements; render them outside the textarea or pass a string.",
770
770
  args
771
771
  );
772
+ case 344:
773
+ return (0, import_error_message.formatDevErrorMessage)(
774
+ "Provide a compiled context with <CompiledContext context={context}>.",
775
+ args
776
+ );
777
+ case 345:
778
+ return (0, import_error_message.formatDevErrorMessage)("CompiledContext requires compiled template children.", args);
779
+ case 346:
780
+ return (0, import_error_message.formatDevErrorMessage)(
781
+ "CompiledOutlet requires a compiled component function with no returned renderable.",
782
+ args
783
+ );
772
784
  default:
773
785
  return (0, import_error_message.formatUnknownDevErrorMessage)(code);
774
786
  }
@@ -20,6 +20,8 @@ var index_exports = {};
20
20
  __export(index_exports, {
21
21
  Activity: () => import_runtime.Activity,
22
22
  Children: () => import_runtime.Children,
23
+ CompiledContext: () => import_runtime.CompiledContext,
24
+ CompiledOutlet: () => import_runtime.CompiledOutlet,
23
25
  EXTERNAL_HYDRATION_PROMISE: () => import_runtime.EXTERNAL_HYDRATION_PROMISE,
24
26
  ErrorBoundary: () => import_runtime.ErrorBoundary,
25
27
  Fragment: () => import_runtime.Fragment,
@@ -83,6 +85,7 @@ __export(index_exports, {
83
85
  componentSlot: () => import_runtime.componentSlot,
84
86
  componentSlotLite: () => import_runtime.componentSlotLite,
85
87
  componentSlotVoid: () => import_runtime.componentSlotVoid,
88
+ createCompiledContext: () => import_runtime.createCompiledContext,
86
89
  createContext: () => import_runtime.createContext,
87
90
  createElement: () => import_runtime.createElement,
88
91
  createHostContextRequest: () => import_runtime.createHostContextRequest,
@@ -268,6 +271,8 @@ var import_method_dep = require("./method-dep.cjs");
268
271
  0 && (module.exports = {
269
272
  Activity,
270
273
  Children,
274
+ CompiledContext,
275
+ CompiledOutlet,
271
276
  EXTERNAL_HYDRATION_PROMISE,
272
277
  ErrorBoundary,
273
278
  Fragment,
@@ -331,6 +336,7 @@ var import_method_dep = require("./method-dep.cjs");
331
336
  componentSlot,
332
337
  componentSlotLite,
333
338
  componentSlotVoid,
339
+ createCompiledContext,
334
340
  createContext,
335
341
  createElement,
336
342
  createHostContextRequest,
@@ -20,6 +20,8 @@ var runtime_exports = {};
20
20
  __export(runtime_exports, {
21
21
  Activity: () => Activity,
22
22
  Children: () => Children,
23
+ CompiledContext: () => CompiledContext,
24
+ CompiledOutlet: () => CompiledOutlet,
23
25
  EXTERNAL_HYDRATION_PROMISE: () => import_constants.EXTERNAL_HYDRATION_PROMISE,
24
26
  ErrorBoundary: () => ErrorBoundary,
25
27
  Fragment: () => Fragment,
@@ -98,6 +100,7 @@ __export(runtime_exports, {
98
100
  componentSlot: () => componentSlot,
99
101
  componentSlotLite: () => componentSlotLite,
100
102
  componentSlotVoid: () => componentSlotVoid,
103
+ createCompiledContext: () => createCompiledContext,
101
104
  createContext: () => createContext,
102
105
  createElement: () => createElement,
103
106
  createElementAt: () => createElementAt,
@@ -9849,6 +9852,34 @@ function __createCompiledContext(defaultValue) {
9849
9852
  };
9850
9853
  return initializeContext(ctx, defaultValue);
9851
9854
  }
9855
+ function createCompiledContext(defaultValue) {
9856
+ const ctx = function CompiledProvider(_props, _scope) {
9857
+ throw new TypeError((0, import_error_codes_client_generated.formatClientError)(344));
9858
+ };
9859
+ return initializeContext(ctx, defaultValue);
9860
+ }
9861
+ function CompiledContext(props, scope) {
9862
+ provideContext(scope, props.context, props.value);
9863
+ const children = props.children;
9864
+ if (children == null) return;
9865
+ if (!isChildrenBlock(children)) {
9866
+ throw new TypeError((0, import_error_codes_client_generated.formatClientError)(345));
9867
+ }
9868
+ const dialect = children[CHILDREN_BODY] ?? children;
9869
+ const previous = scope.hooks?.get(CHILDREN_DIALECT_SLOT);
9870
+ if (previous !== dialect) {
9871
+ if (previous !== void 0) {
9872
+ invalidateSharedBodyOutput(scope);
9873
+ if (TRANSITION_JOURNAL !== null && !ROOT_RENDER_ROLLBACK) {
9874
+ const hooks = scope.hooks;
9875
+ journalUndo(() => hooks.set(CHILDREN_DIALECT_SLOT, previous));
9876
+ }
9877
+ }
9878
+ ensureHooks(scope).set(CHILDREN_DIALECT_SLOT, dialect);
9879
+ }
9880
+ const output = renderSharedBody(children, void 0, scope, void 0);
9881
+ if (output != null) throw new TypeError((0, import_error_codes_client_generated.formatClientError)(345));
9882
+ }
9852
9883
  function initializeContext(ctx, defaultValue) {
9853
9884
  ctx.$$kind = import_runtime_tags.CONTEXT_TAG;
9854
9885
  ctx.defaultValue = defaultValue;
@@ -9935,6 +9966,11 @@ function provideContext(scope, context, value) {
9935
9966
  const CHILDREN_BODY = /* @__PURE__ */ Symbol.for("octane.childrenBody");
9936
9967
  const CHILDREN_CAPTURES = /* @__PURE__ */ Symbol.for("octane.childrenCaptures");
9937
9968
  const CHILDREN_SIGNAL_OWNER = /* @__PURE__ */ Symbol();
9969
+ function sameRenderBody(previous, next) {
9970
+ const previousBody = previous[CHILDREN_BODY];
9971
+ const nextBody = next[CHILDREN_BODY];
9972
+ return previousBody === void 0 || nextBody === void 0 || previousBody === nextBody;
9973
+ }
9938
9974
  function markSingleRoot(component) {
9939
9975
  component.$$singleRoot = true;
9940
9976
  return component;
@@ -15987,17 +16023,7 @@ function updateTextValue(node, value) {
15987
16023
  }
15988
16024
  }
15989
16025
  function setText(node, value, host) {
15990
- if (host !== void 0) {
15991
- if (node === null) {
15992
- node = (STAGED_DOM ? STAGED_DOM.view(host) : host).firstChild;
15993
- if (node === null || node.nodeType !== 3) {
15994
- node = (STAGED_DOM ? STAGED_DOM.view(document) : document).createTextNode("");
15995
- resetOnlyChildHost(host, node);
15996
- }
15997
- } else if ((STAGED_DOM ? STAGED_DOM.view(node) : node).parentNode !== host)
15998
- resetOnlyChildHost(host, node);
15999
- }
16000
- const target = node;
16026
+ const target = node ?? (STAGED_DOM ? STAGED_DOM.view(host) : host).firstChild;
16001
16027
  if (VIEW_TRANSITION_DRIVER) VIEW_TRANSITION_DRIVER.markDirty();
16002
16028
  if (TRANSITION_JOURNAL !== null)
16003
16029
  journalText(target, (STAGED_DOM ? STAGED_DOM.view(target) : target).nodeValue);
@@ -16005,12 +16031,6 @@ function setText(node, value, host) {
16005
16031
  if (hiddenTextWriter !== null && hiddenTextWriter(target, text)) return;
16006
16032
  (STAGED_DOM ? STAGED_DOM.view(target) : target).nodeValue = text;
16007
16033
  }
16008
- function resetOnlyChildHost(host, node) {
16009
- if (ROOT_RENDER_TRANSACTION !== null) journalRootRange(host, null, null);
16010
- const view = STAGED_DOM ? STAGED_DOM.view(host) : host;
16011
- view.textContent = "";
16012
- if (node !== null) view.appendChild(node);
16013
- }
16014
16034
  const DIRECT_SIGNAL_BINDING = /* @__PURE__ */ Symbol("octane.direct-signal-binding");
16015
16035
  const CLAIMED_BINDING_VALUE = /* @__PURE__ */ Symbol("octane.claimed-binding-value");
16016
16036
  function hydrateClaimedBindingCaches(scope, fields) {
@@ -21691,6 +21711,29 @@ function componentSlotVoid(parentScope, slotKey, domParent, comp, props, invocat
21691
21711
  invocationSite
21692
21712
  );
21693
21713
  }
21714
+ function rejectCompiledReturn(_block, _out, reset) {
21715
+ if (reset !== true) {
21716
+ throw new TypeError((0, import_error_codes_client_generated.formatClientError)(346));
21717
+ }
21718
+ }
21719
+ function CompiledOutlet(props, scope) {
21720
+ const comp = props.component;
21721
+ if (typeof comp !== "function") {
21722
+ throw new TypeError((0, import_error_codes_client_generated.formatClientError)(346));
21723
+ }
21724
+ const block = scope.block;
21725
+ componentSlotImpl(
21726
+ rejectCompiledReturn,
21727
+ scope,
21728
+ 0,
21729
+ block.parentNode,
21730
+ comp,
21731
+ comp,
21732
+ props.props,
21733
+ props.props,
21734
+ block.endMarker
21735
+ );
21736
+ }
21694
21737
  function componentSlotImpl(outputHandler, parentScope, slotKey, domParent, body, identity, props, renderProps, anchor, key, singleRoot, inherit, hasKey, invocationSite) {
21695
21738
  if (CURRENT_BLOCK?.pending && !CURRENT_BLOCK.crossRenderUpdate) return;
21696
21739
  if (slotKey === 0 && parentScope !== RETURNED_OUTPUT_SCOPE) {
@@ -22536,8 +22579,6 @@ function hostComponent(scope, slot, tag, props, childrenBody, anchor) {
22536
22579
  anchor: null,
22537
22580
  ref: void 0,
22538
22581
  props: void 0,
22539
- body: void 0,
22540
- latest: void 0,
22541
22582
  childScope: void 0
22542
22583
  };
22543
22584
  scope.slots[slot] = state;
@@ -22553,13 +22594,7 @@ function hostComponent(scope, slot, tag, props, childrenBody, anchor) {
22553
22594
  }
22554
22595
  const el = state.el;
22555
22596
  applyHostProps(el, props, scope, state);
22556
- if (typeof childrenBody === "function") {
22557
- state.latest = childrenBody;
22558
- if (state.body === void 0) {
22559
- state.body = (props2, scope2, extra) => state.latest(props2, scope2, extra);
22560
- }
22561
- childSlot(state.childScope, 0, el, state.body, null, false, el);
22562
- } else if (childrenBody != null || state.childScope.slots[0] !== void 0) {
22597
+ if (childrenBody != null || state.childScope.slots[0] !== void 0) {
22563
22598
  childSlot(state.childScope, 0, el, childrenBody ?? null, null, false, el);
22564
22599
  }
22565
22600
  return el;
@@ -23505,7 +23540,23 @@ function renderHostTagChildren(d, block, el) {
23505
23540
  if (kids == null) return;
23506
23541
  if (typeof kids === "function") {
23507
23542
  let state = block.slots[0];
23508
- if (state === void 0) {
23543
+ if (state === void 0 || !sameRenderBody(state.block.body, kids)) {
23544
+ if (state !== void 0) {
23545
+ journalRootSlot(state, el, null, null);
23546
+ if (ROOT_RENDER_TRANSACTION !== null && !ROOT_RENDER_TRANSACTION.aborted && !ROOT_RENDER_ROLLBACK) {
23547
+ deferRootReplacement(
23548
+ state.block,
23549
+ el,
23550
+ getFirstChild(el),
23551
+ (STAGED_DOM ? STAGED_DOM.view(el) : el).lastChild
23552
+ );
23553
+ } else {
23554
+ unmountBlock(state.block, false);
23555
+ let child3;
23556
+ while ((child3 = getFirstChild(el)) !== null)
23557
+ (STAGED_DOM ? STAGED_DOM.view(el) : el).removeChild(child3);
23558
+ }
23559
+ }
23509
23560
  const child2 = createBlock(
23510
23561
  "dynamic",
23511
23562
  block,
@@ -23517,10 +23568,15 @@ function renderHostTagChildren(d, block, el) {
23517
23568
  void 0,
23518
23569
  renderReturnedValue
23519
23570
  );
23520
- state = { __kind: "hostTagChildrenSlot", block: child2 };
23521
- block.slots[0] = state;
23522
- registerSlot(block, state);
23571
+ if (state === void 0) {
23572
+ state = { __kind: "hostTagChildrenSlot", block: child2 };
23573
+ block.slots[0] = state;
23574
+ registerSlot(block, state);
23575
+ } else {
23576
+ state.block = child2;
23577
+ }
23523
23578
  } else {
23579
+ if (state.block.body !== kids) journalRootProperty(state.block, "body", state.block.body);
23524
23580
  state.block.body = kids;
23525
23581
  }
23526
23582
  renderBlock(state.block);
@@ -24076,12 +24132,7 @@ function bindSignalChild(parentScope, previous, slotKey, domParent, value, _site
24076
24132
  if (textToken && previous === value && !dangerouslySetInnerHTMLOwnsChild(domParent, value))
24077
24133
  return value;
24078
24134
  const prior = typeof previous === "object" && previous !== null && previous[DIRECT_SIGNAL_CHILD] === true ? previous : null;
24079
- let cachedText = prior?.text ?? (previous instanceof Text ? previous : null);
24080
- if (cachedText === null && textToken) {
24081
- const first = getFirstChild(domParent);
24082
- if (first !== null && first.nodeType === 3) cachedText = first;
24083
- else resetOnlyChildHost(domParent, null);
24084
- }
24135
+ const cachedText = prior?.text ?? (previous instanceof Text ? previous : textToken ? getFirstChild(domParent) : null);
24085
24136
  if (!isSignalHandle(value)) {
24086
24137
  const type = typeof value;
24087
24138
  const primitiveToken = slotKey !== 0 && !onlyChild && bindingMarker === void 0 && value !== null && type !== "object" && type !== "function" && !(CURRENT_BLOCK?.pending && !CURRENT_BLOCK.crossRenderUpdate);
@@ -24267,7 +24318,7 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
24267
24318
  if (state !== void 0 && ROOT_RENDER_TRANSACTION !== null) {
24268
24319
  const component = pureHost || preparedList !== null ? null : typeof elementType === "string" ? hostElementBody : valueComponent;
24269
24320
  const unchangedList = preparedList !== null && state.forSlot !== null;
24270
- const unchangedComponent = state.block !== null && component !== null && (component === state.currentComp || typeof value === "function" && state.currentIsBodyFn);
24321
+ const unchangedComponent = state.block !== null && component !== null && (component === state.currentComp || typeof value === "function" && state.currentIsBodyFn && sameRenderBody(state.currentComp, component));
24271
24322
  const unchangedHost = pureHost && state.hostNode !== null && state.block === null && state.hostNode.nodeType === 1 && isHostElementOfType(state.hostNode, elementType);
24272
24323
  const primitive = value == null || typeof value !== "object" && typeof value !== "function";
24273
24324
  const text = primitive ? coerceChildText(value) : null;
@@ -24582,7 +24633,7 @@ function childSlot(parentScope, slotKey, domParent, value, anchor, ownEnd, ownsH
24582
24633
  componentDescriptor = value;
24583
24634
  }
24584
24635
  if (comp !== null) {
24585
- if (isBodyFn && state.block !== null && state.currentIsBodyFn) {
24636
+ if (isBodyFn && state.block !== null && state.currentIsBodyFn && sameRenderBody(state.currentComp, comp)) {
24586
24637
  const taggedChildren = isChildrenBlock(comp);
24587
24638
  const wasImplicitlyArmed = state.block.$$implicitBail;
24588
24639
  if (taggedChildren && !wasImplicitlyArmed) {
@@ -24909,17 +24960,12 @@ function childTextHoleUpdate(parentScope, slotKey, domParent, value, cachedNode,
24909
24960
  if (!complex) {
24910
24961
  if (previous === value) return cachedNode;
24911
24962
  if (cachedNode != null && value !== null) {
24912
- setText(cachedNode, value === true ? "" : value, domParent);
24963
+ setText(cachedNode, value === true ? "" : value);
24913
24964
  return cachedNode;
24914
24965
  }
24915
24966
  }
24916
24967
  return childTextHole(parentScope, slotKey, domParent, value, cachedNode);
24917
24968
  }
24918
- function removeOnlyChildText(host, node) {
24919
- const view = STAGED_DOM ? STAGED_DOM.view(node) : node;
24920
- if (view.parentNode === host) view.remove();
24921
- else resetOnlyChildHost(host, null);
24922
- }
24923
24969
  function childTextHole(parentScope, slotKey, domParent, value, cachedNode) {
24924
24970
  if (domParent.nodeType === 1 && import_constants.VOID_ELEMENTS.has(domParent.localName) && !isPortalTarget(parentScope.block, domParent) && value != null) {
24925
24971
  throw new Error((0, import_error_codes_client_generated.formatClientError)(26, domParent.localName));
@@ -24949,12 +24995,10 @@ function childTextHole(parentScope, slotKey, domParent, value, cachedNode) {
24949
24995
  return null;
24950
24996
  return hydration3.hempty(domParent, vt === "string", siteLoc(parentScope, slotKey));
24951
24997
  }
24952
- removeOnlyChildText(domParent, cachedNode);
24998
+ (STAGED_DOM ? STAGED_DOM.view(cachedNode) : cachedNode).remove();
24953
24999
  return null;
24954
25000
  }
24955
25001
  if (cachedNode !== null) {
24956
- if ((STAGED_DOM ? STAGED_DOM.view(cachedNode) : cachedNode).parentNode !== domParent)
24957
- resetOnlyChildHost(domParent, cachedNode);
24958
25002
  updateTextValue(cachedNode, str);
24959
25003
  return cachedNode;
24960
25004
  }
@@ -24969,7 +25013,8 @@ function childTextHole(parentScope, slotKey, domParent, value, cachedNode) {
24969
25013
  if (!hydration2.framesSlotContent(domParent))
24970
25014
  return hydration2.htext(domParent, str, siteLoc(parentScope, slotKey));
24971
25015
  }
24972
- if (state === void 0 && cachedNode !== null) removeOnlyChildText(domParent, cachedNode);
25016
+ if (state === void 0 && cachedNode !== null)
25017
+ (STAGED_DOM ? STAGED_DOM.view(cachedNode) : cachedNode).remove();
24973
25018
  const hydration = import_hydration_flag.hydrating ? activeHydration() : null;
24974
25019
  if (hydration !== null && state === void 0)
24975
25020
  hydration.hydrateOnlyChild(
@@ -32504,6 +32549,8 @@ function scriptResource(attrs) {
32504
32549
  0 && (module.exports = {
32505
32550
  Activity,
32506
32551
  Children,
32552
+ CompiledContext,
32553
+ CompiledOutlet,
32507
32554
  EXTERNAL_HYDRATION_PROMISE,
32508
32555
  ErrorBoundary,
32509
32556
  Fragment,
@@ -32582,6 +32629,7 @@ function scriptResource(attrs) {
32582
32629
  componentSlot,
32583
32630
  componentSlotLite,
32584
32631
  componentSlotVoid,
32632
+ createCompiledContext,
32585
32633
  createContext,
32586
32634
  createElement,
32587
32635
  createElementAt,
@@ -30,6 +30,8 @@ var runtime_server_exports = {};
30
30
  __export(runtime_server_exports, {
31
31
  Activity: () => Activity,
32
32
  Children: () => Children,
33
+ CompiledContext: () => CompiledContext,
34
+ CompiledOutlet: () => CompiledOutlet,
33
35
  EXTERNAL_HYDRATION_PROMISE: () => import_constants.EXTERNAL_HYDRATION_PROMISE,
34
36
  ErrorBoundary: () => ErrorBoundary,
35
37
  Fragment: () => Fragment,
@@ -46,6 +48,7 @@ __export(runtime_server_exports, {
46
48
  bindPresentationView: () => bindPresentationView,
47
49
  callWithReceiver: () => callWithReceiver,
48
50
  cloneElement: () => cloneElement,
51
+ createCompiledContext: () => createCompiledContext,
49
52
  createContext: () => createContext,
50
53
  createElement: () => createElement,
51
54
  createElementAt: () => createElementAt,
@@ -3278,7 +3281,7 @@ function captureServerComponentContext() {
3278
3281
  previousOwner: void 0
3279
3282
  };
3280
3283
  }
3281
- function renderComponentFramed(comp, props, parent, frame, inherit, instanceKey, bindingMarker, rendererListKeys, enclosingOwner) {
3284
+ function renderComponentFramed(comp, props, parent, frame, inherit, instanceKey, bindingMarker, rendererListKeys, enclosingOwner, compiledOnly) {
3282
3285
  const previous = captureServerComponentContext();
3283
3286
  const parentScope = parent ?? previous.scope;
3284
3287
  const scope = ssrScope(parentScope);
@@ -3331,7 +3334,7 @@ function renderComponentFramed(comp, props, parent, frame, inherit, instanceKey,
3331
3334
  ACTIVE_PU_WARM_PLANS.length = warmPlanCheckpoint;
3332
3335
  HOOK_PASS = previousHookPass;
3333
3336
  }
3334
- const inner = serverComponentOutput(out, scope, previous.owner);
3337
+ const inner = compiledOnly ? checkedCompiledOutput(out) : serverComponentOutput(out, scope, previous.owner);
3335
3338
  nativeCompleted = true;
3336
3339
  if (!MARKERS || inherit) return inner;
3337
3340
  const marker = bindingMarker ?? (out !== null && typeof out === "object" ? out[BINDING_HTML_ROOT] : void 0);
@@ -3364,7 +3367,7 @@ function retainRendererJobListKeys(frame, keys) {
3364
3367
  }
3365
3368
  }
3366
3369
  }
3367
- function ssrComponent(parent, comp, props, inherit, key, identityScoped, invocationSite, bindingMarker) {
3370
+ function ssrComponent(parent, comp, props, inherit, key, identityScoped, invocationSite, bindingMarker, compiledOnly) {
3368
3371
  const activity = comp === Activity;
3369
3372
  if (activity && key === void 0) key = props?.key;
3370
3373
  const renderer = invocationSite === RENDERER_INVOCATION_SITE;
@@ -3444,7 +3447,8 @@ function ssrComponent(parent, comp, props, inherit, key, identityScoped, invocat
3444
3447
  bindingMarker,
3445
3448
  renderer ? SIGNAL_LIST_KEYS : void 0,
3446
3449
  // Only an enabled pass has instance declarations to resolve through it.
3447
- typeof signalInstanceKey !== "string" ? void 0 : invocationSite === TEMPLATE_INVOCATION_SITE ? serverSignalOwner(pf) : invocationSite === void 0 ? childrenSignalOwner(comp) : authorChildrenSignalOwner(comp, props)
3450
+ typeof signalInstanceKey !== "string" ? void 0 : invocationSite === TEMPLATE_INVOCATION_SITE ? serverSignalOwner(pf) : invocationSite === void 0 ? childrenSignalOwner(comp) : authorChildrenSignalOwner(comp, props),
3451
+ compiledOnly
3448
3452
  );
3449
3453
  } finally {
3450
3454
  if (identityScoped !== true) ASYNC_SCOPE = previousIdentityScope;
@@ -4081,6 +4085,51 @@ function createContext(defaultValue) {
4081
4085
  }
4082
4086
  return ctx;
4083
4087
  }
4088
+ function createCompiledContext(defaultValue) {
4089
+ const ctx = function CompiledProvider(_props, _scope) {
4090
+ throw new TypeError((0, import_error_codes_server_generated.formatServerError)(344));
4091
+ };
4092
+ ctx.$$kind = import_runtime_tags.CONTEXT_TAG;
4093
+ ctx.defaultValue = defaultValue;
4094
+ (0, import_context_identity.registerContext)(ctx);
4095
+ if (__octaneDev) (0, import_context_identity.defineRemovedContextMembers)(ctx);
4096
+ return ctx;
4097
+ }
4098
+ function CompiledContext(props, scope) {
4099
+ if (scope.$$ctxValues === null) scope.$$ctxValues = /* @__PURE__ */ new Map();
4100
+ scope.$$ctxValues.set(props.context, props.value);
4101
+ const children = props.children;
4102
+ if (children == null) return ssrHtml("");
4103
+ if (!isChildrenBlock(children)) {
4104
+ throw new TypeError((0, import_error_codes_server_generated.formatServerError)(345));
4105
+ }
4106
+ return ssrHtml(ssrChildrenHtml(children, scope));
4107
+ }
4108
+ function checkedCompiledOutput(out) {
4109
+ if (out === void 0) return "";
4110
+ if (out !== null && typeof out === "object" && SERVER_HTML in out) {
4111
+ return out[SERVER_HTML];
4112
+ }
4113
+ throw new TypeError((0, import_error_codes_server_generated.formatServerError)(346));
4114
+ }
4115
+ function CompiledOutlet(props, scope) {
4116
+ if (typeof props.component !== "function") {
4117
+ throw new TypeError((0, import_error_codes_server_generated.formatServerError)(346));
4118
+ }
4119
+ return ssrHtml(
4120
+ ssrComponent(
4121
+ scope,
4122
+ props.component,
4123
+ props.props,
4124
+ false,
4125
+ void 0,
4126
+ void 0,
4127
+ void 0,
4128
+ void 0,
4129
+ true
4130
+ )
4131
+ );
4132
+ }
4084
4133
  function renderServerContextProvider(context, props, renderScope) {
4085
4134
  const scope = renderScope;
4086
4135
  if (scope.$$ctxValues === null) scope.$$ctxValues = /* @__PURE__ */ new Map();
@@ -8355,6 +8404,8 @@ function preinitModule(href, options) {
8355
8404
  0 && (module.exports = {
8356
8405
  Activity,
8357
8406
  Children,
8407
+ CompiledContext,
8408
+ CompiledOutlet,
8358
8409
  EXTERNAL_HYDRATION_PROMISE,
8359
8410
  ErrorBoundary,
8360
8411
  Fragment,
@@ -8371,6 +8422,7 @@ function preinitModule(href, options) {
8371
8422
  bindPresentationView,
8372
8423
  callWithReceiver,
8373
8424
  cloneElement,
8425
+ createCompiledContext,
8374
8426
  createContext,
8375
8427
  createElement,
8376
8428
  createElementAt,
@@ -20,6 +20,8 @@ var server_exports = {};
20
20
  __export(server_exports, {
21
21
  Activity: () => import_runtime_server.Activity,
22
22
  Children: () => import_runtime_server.Children,
23
+ CompiledContext: () => import_runtime_server.CompiledContext,
24
+ CompiledOutlet: () => import_runtime_server.CompiledOutlet,
23
25
  EXTERNAL_HYDRATION_PROMISE: () => import_runtime_server.EXTERNAL_HYDRATION_PROMISE,
24
26
  ErrorBoundary: () => import_runtime_server.ErrorBoundary,
25
27
  Fragment: () => import_runtime_server.Fragment,
@@ -39,6 +41,7 @@ __export(server_exports, {
39
41
  batchServerCalls: () => import_rpc_batch.batchServerCalls,
40
42
  cloneElement: () => import_runtime_server.cloneElement,
41
43
  createAutomaticStreamedSignalInjection: () => import_streamed_signals.createAutomaticStreamedSignalInjection,
44
+ createCompiledContext: () => import_runtime_server.createCompiledContext,
42
45
  createContext: () => import_runtime_server.createContext,
43
46
  createElement: () => import_runtime_server.createElement,
44
47
  createPortal: () => import_runtime_server.createPortal,
@@ -202,6 +205,8 @@ var import_runtime_server = require("../runtime.server.cjs");
202
205
  0 && (module.exports = {
203
206
  Activity,
204
207
  Children,
208
+ CompiledContext,
209
+ CompiledOutlet,
205
210
  EXTERNAL_HYDRATION_PROMISE,
206
211
  ErrorBoundary,
207
212
  Fragment,
@@ -221,6 +226,7 @@ var import_runtime_server = require("../runtime.server.cjs");
221
226
  batchServerCalls,
222
227
  cloneElement,
223
228
  createAutomaticStreamedSignalInjection,
229
+ createCompiledContext,
224
230
  createContext,
225
231
  createElement,
226
232
  createPortal,
@@ -26,7 +26,8 @@ __export(native_read_seeds_exports, {
26
26
  mergeNativeSeedReads: () => mergeNativeSeedReads,
27
27
  parseNativeSignalManifest: () => parseNativeSignalManifest,
28
28
  rewindNativeSeedReads: () => rewindNativeSeedReads,
29
- serializeNativeSeedReads: () => serializeNativeSeedReads
29
+ serializeNativeSeedReads: () => serializeNativeSeedReads,
30
+ validateNativeSignalManifest: () => validateNativeSignalManifest
30
31
  });
31
32
  module.exports = __toCommonJS(native_read_seeds_exports);
32
33
  var import_error_codes_client_generated = require("../error-codes.client.generated.cjs");
@@ -273,5 +274,6 @@ function createNativeAdoptionState(manifest, initialDocumentSignals, initialScop
273
274
  mergeNativeSeedReads,
274
275
  parseNativeSignalManifest,
275
276
  rewindNativeSeedReads,
276
- serializeNativeSeedReads
277
+ serializeNativeSeedReads,
278
+ validateNativeSignalManifest
277
279
  });