octane 0.2.2 → 0.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/compatibility.cjs +35 -0
- package/dist/cjs/component-flags.cjs +8 -1
- package/dist/cjs/dom-tables.cjs +2 -0
- package/dist/cjs/error-codes.client.generated.cjs +15 -2
- package/dist/cjs/error-codes.server.generated.cjs +5 -0
- package/dist/cjs/event-names.cjs +39 -0
- package/dist/cjs/index.cjs +13 -0
- package/dist/cjs/runtime.cjs +1223 -332
- package/dist/cjs/runtime.server.cjs +362 -120
- package/dist/cjs/server/index.cjs +22 -0
- package/dist/cjs/version.cjs +1 -1
- package/dist/compatibility.d.ts +7 -0
- package/dist/compatibility.js +10 -0
- package/dist/compiler/bundler.js +13 -30
- package/dist/compiler/compile-renderer-boundaries.js +1 -0
- package/dist/compiler/compile-universal.js +3 -0
- package/dist/compiler/compile.js +619 -99
- package/dist/compiler/hook-deps.js +100 -3
- package/dist/compiler/hook-names.js +1 -0
- package/dist/compiler/manual-hooks.js +171 -0
- package/dist/compiler/plain-hook-memo.js +54 -5
- package/dist/compiler/slot-hooks.d.ts +43 -0
- package/dist/compiler/slot-hooks.js +154 -35
- package/dist/component-flags.d.ts +1 -1
- package/dist/component-flags.js +8 -1
- package/dist/dom-tables.js +2 -0
- package/dist/error-codes.client.generated.d.ts +3 -1
- package/dist/error-codes.client.generated.js +15 -2
- package/dist/error-codes.server.generated.d.ts +1 -0
- package/dist/error-codes.server.generated.js +5 -0
- package/dist/event-names.d.ts +1 -0
- package/dist/event-names.js +15 -0
- package/dist/html-tree-validation.d.ts +17 -34
- package/dist/index.d.ts +3 -1
- package/dist/index.js +12 -1
- package/dist/jsx-runtime.d.ts +6 -1
- package/dist/public-types.d.ts +188 -0
- package/dist/public-types.js +0 -0
- package/dist/runtime.d.ts +109 -66
- package/dist/runtime.js +1220 -332
- package/dist/runtime.server.d.ts +39 -14
- package/dist/runtime.server.js +356 -120
- package/dist/server/index.d.ts +4 -2
- package/dist/server/index.js +19 -0
- package/dist/static/index.d.ts +2 -1
- package/dist/static/index.js +3 -1
- package/dist/universal-core.d.ts +8 -1
- package/dist/universal-core.js +95 -9
- package/dist/version.js +1 -1
- package/package.json +2 -1
package/dist/runtime.server.d.ts
CHANGED
|
@@ -43,6 +43,7 @@ type ServerComponent = (props: any, scope: SSRScope, extra?: any) => string;
|
|
|
43
43
|
* authored component type and trust the build for the server shape.
|
|
44
44
|
*/
|
|
45
45
|
export type ServerEntryComponent = ServerComponent | ((props: any) => unknown);
|
|
46
|
+
export type ServerRenderNode = ServerEntryComponent | ElementDescriptor | Iterable<unknown> | PromiseLike<unknown> | Context<unknown> | string | number | bigint | boolean | null | undefined;
|
|
46
47
|
/** @internal Enable invocation collection before an opted-in module renders. */
|
|
47
48
|
export declare function enableNativeReadCollection(abi?: number): void;
|
|
48
49
|
/** @internal Compiler/runtime native-read capability version 1. */
|
|
@@ -130,6 +131,8 @@ export declare const Children: {
|
|
|
130
131
|
only<T>(children: T): T;
|
|
131
132
|
};
|
|
132
133
|
export declare function createPortal(body: unknown, target: unknown, props?: any): unknown;
|
|
134
|
+
/** @internal Brand the final serialized output of a compiled server body. */
|
|
135
|
+
export declare function ssrHtml(html: string): string;
|
|
133
136
|
export declare function escapeHtml(v: unknown): string;
|
|
134
137
|
export declare function escapeAttr(v: unknown): string;
|
|
135
138
|
/** A dynamic text hole. null/false/undefined render as empty (React parity). */
|
|
@@ -151,6 +154,10 @@ export declare function ssrTextPre(v: unknown): string;
|
|
|
151
154
|
*/
|
|
152
155
|
export declare function ssrChild(v: unknown, scope: SSRScope): string;
|
|
153
156
|
export declare function ssrChildText(v: unknown, scope: SSRScope): string;
|
|
157
|
+
/** @internal First-child renderable hole in a newline-eating HTML element. */
|
|
158
|
+
export declare function ssrChildTextPre(v: unknown, scope: SSRScope): string;
|
|
159
|
+
/** @internal First renderable child when static output has no shielding markers. */
|
|
160
|
+
export declare function ssrChildPre(v: unknown, scope: SSRScope): string;
|
|
154
161
|
/**
|
|
155
162
|
* Wrap a control-flow branch / for-item's HTML in hydration block markers
|
|
156
163
|
* (`<!--[-->` … `<!--]-->`), so a future client hydrate cursor can find the
|
|
@@ -335,7 +342,8 @@ export declare const Hydrate: ServerComponent;
|
|
|
335
342
|
* branch's inner `ssrBlock`, so the client's `<Suspense>` (componentSlot →
|
|
336
343
|
* tryBlock) adopts it byte-for-byte. A descendant `use(thenable)` that hasn't
|
|
337
344
|
* resolved throws `SSR_SUSPENSE` → the `fallback` renders for this pass and
|
|
338
|
-
* render()'s loop awaits + re-renders
|
|
345
|
+
* render()'s loop awaits + re-renders. A render error publishes the fallback,
|
|
346
|
+
* reports onError, and leaves the boundary ready for a fresh client render.
|
|
339
347
|
*/
|
|
340
348
|
export declare const Suspense: (props: {
|
|
341
349
|
fallback?: unknown;
|
|
@@ -474,7 +482,9 @@ export declare function warmChild(comp: any, props: any): void;
|
|
|
474
482
|
*/
|
|
475
483
|
export declare function lazy<C>(load: () => PromiseLike<{
|
|
476
484
|
default: C;
|
|
477
|
-
} | C>): C
|
|
485
|
+
} | C>): C & {
|
|
486
|
+
displayName?: string;
|
|
487
|
+
};
|
|
478
488
|
export declare function useState<T = undefined>(): [
|
|
479
489
|
T | undefined,
|
|
480
490
|
(next: T | undefined | ((value: T | undefined) => T | undefined)) => void,
|
|
@@ -526,12 +536,21 @@ export declare function useActionState<S>(_action: unknown, initialState: S): [S
|
|
|
526
536
|
export interface FormStatus {
|
|
527
537
|
pending: boolean;
|
|
528
538
|
data: FormData | null;
|
|
529
|
-
method: string;
|
|
539
|
+
method: string | null;
|
|
530
540
|
action: ((formData: FormData) => unknown) | string | null;
|
|
531
541
|
}
|
|
532
542
|
export declare function useFormStatus(): FormStatus;
|
|
533
543
|
export declare function useOptimistic<S, V = S>(state: S): [S, (value: V) => void];
|
|
534
|
-
export declare function memo<
|
|
544
|
+
export declare function memo<C extends (...args: any[]) => any>(component: C): C & {
|
|
545
|
+
readonly type: C;
|
|
546
|
+
displayName?: string;
|
|
547
|
+
};
|
|
548
|
+
/** @internal Keep a copied static descriptor from warming an unrelated wrapper. */
|
|
549
|
+
export declare function markWarm<T extends Function>(component: T, plan: unknown): T;
|
|
550
|
+
/** @internal Invoke a provider that owns the trailing hook-slot ABI. */
|
|
551
|
+
export declare function invokeManualHook<T>(fn: (...args: any[]) => T, receiver: unknown, args: IArguments): T;
|
|
552
|
+
/** @internal Adapt an expression provider that owns the trailing hook-slot ABI. */
|
|
553
|
+
export declare function manualHook<F extends (...args: any[]) => any>(fn: F, name?: string): F;
|
|
535
554
|
export declare function withSlot<T>(sym: symbol, fn: (...a: any[]) => T, ...args: any[]): T;
|
|
536
555
|
export declare function startTransition(fn: () => void | Promise<unknown>): void;
|
|
537
556
|
export declare function flushSync<T>(fn: () => T): T;
|
|
@@ -641,6 +660,11 @@ type SuspenseOutcome = SuspenseResult & {
|
|
|
641
660
|
thenable: PromiseLike<unknown>;
|
|
642
661
|
};
|
|
643
662
|
type ResolvedMap = Map<string, SuspenseOutcome> & {
|
|
663
|
+
/** Recoverable buffered-boundary errors are reported once across async retries. */
|
|
664
|
+
bufferedErrors?: Map<string, {
|
|
665
|
+
error: unknown;
|
|
666
|
+
reported: boolean;
|
|
667
|
+
}>;
|
|
644
668
|
/** Undefined for externally hosted passes whose request lifetime is not owned here. */
|
|
645
669
|
resourceOptions?: RenderOptions | null;
|
|
646
670
|
/** Optional renderer resources; allocated only by a participating adapter. */
|
|
@@ -699,7 +723,7 @@ export declare function getServerRenderResourceContext(): ServerRenderResourceCo
|
|
|
699
723
|
* for SSG / any place that wants fully-resolved HTML with no client fallback.
|
|
700
724
|
* This is the buffered, await-everything behaviour of the old `render()`.
|
|
701
725
|
*/
|
|
702
|
-
export declare function prerender(entryComponent:
|
|
726
|
+
export declare function prerender(entryComponent: ServerRenderNode, props?: any, options?: RenderOptions): Promise<RenderResult>;
|
|
703
727
|
/**
|
|
704
728
|
* Stream variant of {@link prerender}, mirroring React's `prerenderToNodeStream`
|
|
705
729
|
* semantics: the promise resolves only after the await-everything render fully
|
|
@@ -711,7 +735,7 @@ export declare function prerender(entryComponent: ServerEntryComponent, props?:
|
|
|
711
735
|
* `headChannel: 'separate'` has no channel to land in here and is ignored
|
|
712
736
|
* (the head folds), with a development diagnostic.
|
|
713
737
|
*/
|
|
714
|
-
export declare function prerenderToNodeStream(entryComponent:
|
|
738
|
+
export declare function prerenderToNodeStream(entryComponent: ServerRenderNode, props?: any, options?: RenderOptions): Promise<{
|
|
715
739
|
prelude: import('node:stream').Readable;
|
|
716
740
|
}>;
|
|
717
741
|
/** @internal hosted-host ABI. Opaque outside octane/react/server. */
|
|
@@ -753,17 +777,17 @@ export declare function renderHostedAttempt(session: HostedServerSession, compon
|
|
|
753
777
|
/**
|
|
754
778
|
* React `react-dom/server` `renderToString` — a SINGLE synchronous pass, no
|
|
755
779
|
* awaiting. A Suspense boundary that suspends renders its fallback (the inline
|
|
756
|
-
* `@try`/`@pending` arm); a bare `use(thenable)` with no enclosing boundary
|
|
757
|
-
*
|
|
780
|
+
* `@try`/`@pending` arm); a bare `use(thenable)` with no enclosing boundary throws
|
|
781
|
+
* instead of returning an incomplete document. Synchronously-resolved
|
|
758
782
|
* `use()` in the shell still seeds. Use `prerender` when you need the data awaited.
|
|
759
783
|
*/
|
|
760
|
-
export declare function renderToString(entryComponent:
|
|
784
|
+
export declare function renderToString(entryComponent: ServerRenderNode, props?: any, options?: RenderOptions): RenderResult;
|
|
761
785
|
/**
|
|
762
786
|
* React `react-dom/server` `renderToStaticMarkup` — a single synchronous pass
|
|
763
787
|
* producing clean, NON-hydratable HTML: no `<!--[-->`/`<!--]-->` block markers,
|
|
764
788
|
* no head-adoption markers, no suspense seed script. For static pages / email.
|
|
765
789
|
*/
|
|
766
|
-
export declare function renderToStaticMarkup(entryComponent:
|
|
790
|
+
export declare function renderToStaticMarkup(entryComponent: ServerRenderNode, props?: any, options?: RenderOptions): RenderResult;
|
|
767
791
|
/**
|
|
768
792
|
* Compiled `@try` / JSX `<Suspense>` boundary. `siteKey` is the compiler's
|
|
769
793
|
* source-position hash; combined with the frame path + per-frame occurrence it
|
|
@@ -773,12 +797,13 @@ export declare function renderToStaticMarkup(entryComponent: ServerEntryComponen
|
|
|
773
797
|
* suspend, @pending → ssrBlock(ssrBlock(pendingHtml))
|
|
774
798
|
* suspend, no arm → ssrBlock('')
|
|
775
799
|
* error, @catch → ssrBlock(ssrBlock(catchHtml))
|
|
776
|
-
* error, no @catch → rethrow
|
|
800
|
+
* error, no @catch → rethrow for authored buffered @try; JSX Suspense and
|
|
801
|
+
* streamed boundaries publish fallback for client recovery
|
|
777
802
|
* In streaming mode a suspended boundary additionally carries the
|
|
778
803
|
* `<template data-oct-b>` sentinel, and a REGISTERED boundary keeps returning
|
|
779
804
|
* its pending form (content ships via its segment).
|
|
780
805
|
*/
|
|
781
|
-
export declare function ssrTry(scope: SSRScope, siteKey: string, tryFn: (arg: unknown, scope: SSRScope) => string, pendFn: ((arg: unknown, scope: SSRScope) => string) | null, catchFn: ((err: unknown, scope: SSRScope, reset: () => void) => string) | null, namespace?: 'html' | 'svg' | 'mathml', propagateSuspense?: boolean): string;
|
|
806
|
+
export declare function ssrTry(scope: SSRScope, siteKey: string, tryFn: (arg: unknown, scope: SSRScope) => string, pendFn: ((arg: unknown, scope: SSRScope) => string) | null, catchFn: ((err: unknown, scope: SSRScope, reset: () => void) => string) | null, namespace?: 'html' | 'svg' | 'mathml', propagateSuspense?: boolean, recoverErrors?: boolean): string;
|
|
782
807
|
/**
|
|
783
808
|
* A live source of externally-produced HTML (typically framework data
|
|
784
809
|
* `<script>` tags materializing as loaders settle) merged natively into a
|
|
@@ -849,7 +874,7 @@ export interface StreamOptions extends RenderOptions {
|
|
|
849
874
|
* `onAllReady` once every boundary has streamed. Octane signature convention:
|
|
850
875
|
* `(Component, props?, options?)`.
|
|
851
876
|
*/
|
|
852
|
-
export declare function renderToPipeableStream(entryComponent:
|
|
877
|
+
export declare function renderToPipeableStream(entryComponent: ServerRenderNode, props?: any, options?: StreamOptions): {
|
|
853
878
|
pipe: <T extends {
|
|
854
879
|
write(chunk: string): unknown;
|
|
855
880
|
end(): unknown;
|
|
@@ -863,7 +888,7 @@ export declare function renderToPipeableStream(entryComponent: ServerEntryCompon
|
|
|
863
888
|
* accepted under consumer backpressure. A consumer that pauses pulling also
|
|
864
889
|
* pauses `allReady`; read concurrently when waiting for it.
|
|
865
890
|
*/
|
|
866
|
-
export declare function renderToReadableStream(entryComponent:
|
|
891
|
+
export declare function renderToReadableStream(entryComponent: ServerRenderNode, props?: any, options?: StreamOptions): Promise<ReadableStream<Uint8Array> & {
|
|
867
892
|
allReady: Promise<void>;
|
|
868
893
|
}>;
|
|
869
894
|
/** React DOM `preload(href, {as, …})`. */
|