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/server/index.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Public API (React `react-dom/server` parity): `renderToString(Component,
|
|
5
5
|
* props?, options?)` (a single sync pass; suspended boundaries render their
|
|
6
|
-
* fallback) and `renderToStaticMarkup` (
|
|
6
|
+
* fallback) and `renderToStaticMarkup` (non-hydratable HTML). Both return
|
|
7
7
|
* `{ html, css }`: hoisted head folds into `html` (plus the suspense seed script
|
|
8
8
|
* when anything resolved synchronously) and the deduped scoped-style tags are in
|
|
9
9
|
* `css`. The await-everything renderer is `prerender` in `octane/static`.
|
|
@@ -21,6 +21,8 @@
|
|
|
21
21
|
* should call them.
|
|
22
22
|
*/
|
|
23
23
|
export { executeServerFunction } from './rpc.js';
|
|
24
|
+
export { version } from '../version.js';
|
|
25
|
+
export { StrictMode, unstable_batchedUpdates } from '../compatibility.js';
|
|
24
26
|
export { createSubSlot, subSlot, type SubSlot, type SlotlessSubSlot, type SubSlotOptions, } from '../sub-slot.js';
|
|
25
27
|
export { __methodDep } from '../method-dep.js';
|
|
26
|
-
export { renderToString, renderToStaticMarkup, renderToPipeableStream, renderToReadableStream, type RenderResult, type RenderOptions, type StreamOptions, type StreamInjectionSource, setSsrSuspenseTimeout, getSsrSuspenseTimeout, EXTERNAL_HYDRATION_PROMISE, HYDRATION_RANGE_BOUNDARY, useState, useLinkedState, useReducer, __useStateWithGetter, __useLinkedStateWithGetter, __useReducerWithGetter, type LinkedStatePrevious, type LinkedStateOptions, useEffect, useLayoutEffect, useInsertionEffect, useImperativeHandle, useMemo, useCallback, useRef, useId, useEffectEvent, useTransition, useDeferredValue, useSyncExternalStore, useActionState, useFormStatus, useOptimistic, useDebugValue, memo, lazy, hookSlots, withSlot, startTransition, flushSync, isChildrenBlock, isValidElement, cloneElement, Children, createPortal, requestFormReset, preload, preinit, preloadModule, preinitModule, preconnect, prefetchDNS, Suspense, ErrorBoundary, Hydrate, Fragment, Activity, Activity as unstable_Activity, ViewTransition, ViewTransition as unstable_ViewTransition, addTransitionType, addTransitionType as unstable_addTransitionType, createContext, use, useContext, ssrIsSuspense, type Context, type FormStatus, markChildrenBlock, descriptorChildren, createElement, createScopedValue, createScopedElement, positionalChildren, escapeHtml, escapeAttr, ssrText, ssrTextPre, ssrNestingText, ssrChild, ssrChildText, ssrAttr, normalizeClass, ssrStyle, ssrClass, ssrAttrs, ssrSnapshotSpread, ssrSpread, ssrInnerHtml, ssrScriptInnerHtml, ssrChildrenSources, ssrSpreadContent, ssrVoidContent, ssrValueAttr, ssrCheckedAttr, ssrInputAttrs, ssrFormAuthoringDiagnostics, ssrTextareaValue, ssrTextareaValueSources, ssrSelectAttrs, ssrSelectScope, ssrSelectScopeSources, ssrOptionValueSources, ssrOption, ssrElement, ssrComponent, ssrComponentNS, ssrInNamespace, ssrBlock, ssrFragmentMarker, ssrActivity, ssrForBlock, mapSlot, ssrControl, ssrArm, ssrTry, ssrPortal, injectStyle, ssrHeadEl, ssrStylesheetResource, ssrStyleResource, ssrScriptResource, namespaceHead, namespaceHeadElement, puMemo, puBatch, warmMemo, warmChild, } from '../runtime.server.js';
|
|
28
|
+
export { renderToString, renderToStaticMarkup, renderToPipeableStream, renderToReadableStream, type RenderResult, type RenderOptions, type ServerRenderNode, type StreamOptions, type StreamInjectionSource, setSsrSuspenseTimeout, getSsrSuspenseTimeout, EXTERNAL_HYDRATION_PROMISE, HYDRATION_RANGE_BOUNDARY, useState, useLinkedState, useReducer, __useStateWithGetter, __useLinkedStateWithGetter, __useReducerWithGetter, type LinkedStatePrevious, type LinkedStateOptions, useEffect, useLayoutEffect, useInsertionEffect, useImperativeHandle, useMemo, useCallback, useRef, useId, useEffectEvent, useTransition, useDeferredValue, useSyncExternalStore, useActionState, useActionState as useFormState, useFormStatus, useOptimistic, useDebugValue, memo, lazy, hookSlots, withSlot, manualHook, invokeManualHook, startTransition, flushSync, isChildrenBlock, isValidElement, cloneElement, Children, createPortal, requestFormReset, preload, preinit, preloadModule, preinitModule, preconnect, prefetchDNS, Suspense, ErrorBoundary, Hydrate, Fragment, Activity, Activity as unstable_Activity, ViewTransition, ViewTransition as unstable_ViewTransition, addTransitionType, addTransitionType as unstable_addTransitionType, createContext, use, useContext, ssrIsSuspense, type Context, type FormStatus, markChildrenBlock, markWarm, ssrHtml, ssrChildTextPre, ssrChildPre, descriptorChildren, createElement, createScopedValue, createScopedElement, positionalChildren, escapeHtml, escapeAttr, ssrText, ssrTextPre, ssrNestingText, ssrChild, ssrChildText, ssrAttr, normalizeClass, ssrStyle, ssrClass, ssrAttrs, ssrSnapshotSpread, ssrSpread, ssrInnerHtml, ssrScriptInnerHtml, ssrChildrenSources, ssrSpreadContent, ssrVoidContent, ssrValueAttr, ssrCheckedAttr, ssrInputAttrs, ssrFormAuthoringDiagnostics, ssrTextareaValue, ssrTextareaValueSources, ssrSelectAttrs, ssrSelectScope, ssrSelectScopeSources, ssrOptionValueSources, ssrOption, ssrElement, ssrComponent, ssrComponentNS, ssrInNamespace, ssrBlock, ssrFragmentMarker, ssrActivity, ssrForBlock, mapSlot, ssrControl, ssrArm, ssrTry, ssrPortal, injectStyle, ssrHeadEl, ssrStylesheetResource, ssrStyleResource, ssrScriptResource, namespaceHead, namespaceHeadElement, puMemo, puBatch, warmMemo, warmChild, } from '../runtime.server.js';
|
package/dist/server/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { executeServerFunction } from "./rpc.js";
|
|
2
|
+
import { version } from "../version.js";
|
|
3
|
+
import { StrictMode, unstable_batchedUpdates } from "../compatibility.js";
|
|
2
4
|
import {
|
|
3
5
|
createSubSlot,
|
|
4
6
|
subSlot
|
|
@@ -32,6 +34,7 @@ import {
|
|
|
32
34
|
useDeferredValue,
|
|
33
35
|
useSyncExternalStore,
|
|
34
36
|
useActionState,
|
|
37
|
+
useActionState as useActionState2,
|
|
35
38
|
useFormStatus,
|
|
36
39
|
useOptimistic,
|
|
37
40
|
useDebugValue,
|
|
@@ -39,6 +42,8 @@ import {
|
|
|
39
42
|
lazy,
|
|
40
43
|
hookSlots,
|
|
41
44
|
withSlot,
|
|
45
|
+
manualHook,
|
|
46
|
+
invokeManualHook,
|
|
42
47
|
startTransition,
|
|
43
48
|
flushSync,
|
|
44
49
|
isChildrenBlock,
|
|
@@ -68,6 +73,10 @@ import {
|
|
|
68
73
|
useContext,
|
|
69
74
|
ssrIsSuspense,
|
|
70
75
|
markChildrenBlock,
|
|
76
|
+
markWarm,
|
|
77
|
+
ssrHtml,
|
|
78
|
+
ssrChildTextPre,
|
|
79
|
+
ssrChildPre,
|
|
71
80
|
descriptorChildren,
|
|
72
81
|
createElement,
|
|
73
82
|
createScopedValue,
|
|
@@ -136,6 +145,7 @@ export {
|
|
|
136
145
|
Fragment,
|
|
137
146
|
HYDRATION_RANGE_BOUNDARY,
|
|
138
147
|
Hydrate,
|
|
148
|
+
StrictMode,
|
|
139
149
|
Suspense,
|
|
140
150
|
ViewTransition,
|
|
141
151
|
__methodDep,
|
|
@@ -158,11 +168,14 @@ export {
|
|
|
158
168
|
getSsrSuspenseTimeout,
|
|
159
169
|
hookSlots,
|
|
160
170
|
injectStyle,
|
|
171
|
+
invokeManualHook,
|
|
161
172
|
isChildrenBlock,
|
|
162
173
|
isValidElement,
|
|
163
174
|
lazy,
|
|
175
|
+
manualHook,
|
|
164
176
|
mapSlot,
|
|
165
177
|
markChildrenBlock,
|
|
178
|
+
markWarm,
|
|
166
179
|
memo,
|
|
167
180
|
namespaceHead,
|
|
168
181
|
namespaceHeadElement,
|
|
@@ -189,7 +202,9 @@ export {
|
|
|
189
202
|
ssrBlock,
|
|
190
203
|
ssrCheckedAttr,
|
|
191
204
|
ssrChild,
|
|
205
|
+
ssrChildPre,
|
|
192
206
|
ssrChildText,
|
|
207
|
+
ssrChildTextPre,
|
|
193
208
|
ssrChildrenSources,
|
|
194
209
|
ssrClass,
|
|
195
210
|
ssrComponent,
|
|
@@ -200,6 +215,7 @@ export {
|
|
|
200
215
|
ssrFormAuthoringDiagnostics,
|
|
201
216
|
ssrFragmentMarker,
|
|
202
217
|
ssrHeadEl,
|
|
218
|
+
ssrHtml,
|
|
203
219
|
ssrInNamespace,
|
|
204
220
|
ssrInnerHtml,
|
|
205
221
|
ssrInputAttrs,
|
|
@@ -231,6 +247,7 @@ export {
|
|
|
231
247
|
Activity2 as unstable_Activity,
|
|
232
248
|
ViewTransition2 as unstable_ViewTransition,
|
|
233
249
|
addTransitionType2 as unstable_addTransitionType,
|
|
250
|
+
unstable_batchedUpdates,
|
|
234
251
|
use,
|
|
235
252
|
useActionState,
|
|
236
253
|
useCallback,
|
|
@@ -239,6 +256,7 @@ export {
|
|
|
239
256
|
useDeferredValue,
|
|
240
257
|
useEffect,
|
|
241
258
|
useEffectEvent,
|
|
259
|
+
useActionState2 as useFormState,
|
|
242
260
|
useFormStatus,
|
|
243
261
|
useId,
|
|
244
262
|
useImperativeHandle,
|
|
@@ -252,6 +270,7 @@ export {
|
|
|
252
270
|
useState,
|
|
253
271
|
useSyncExternalStore,
|
|
254
272
|
useTransition,
|
|
273
|
+
version,
|
|
255
274
|
warmChild,
|
|
256
275
|
warmMemo,
|
|
257
276
|
withSlot
|
package/dist/static/index.d.ts
CHANGED
|
@@ -18,4 +18,5 @@
|
|
|
18
18
|
* `postponed` field and the buffered `prerender` resolves `{ html, css }`
|
|
19
19
|
* rather than React's `{ prelude: ReadableStream }`.
|
|
20
20
|
*/
|
|
21
|
-
export {
|
|
21
|
+
export { version } from '../version.js';
|
|
22
|
+
export { prerender, prerenderToNodeStream, type RenderResult, type RenderOptions, type ServerRenderNode, } from '../runtime.server.js';
|
package/dist/static/index.js
CHANGED
package/dist/universal-core.d.ts
CHANGED
|
@@ -661,7 +661,11 @@ export declare function hasCrossRealmPlainPrototype(value: object): boolean;
|
|
|
661
661
|
*/
|
|
662
662
|
export declare function sameUniversalHostPropValue(left: unknown, right: unknown, depth?: number): boolean;
|
|
663
663
|
export declare function hookSlots(count: number): number;
|
|
664
|
-
|
|
664
|
+
/** @internal Invoke a provider that owns the trailing hook-slot ABI. */
|
|
665
|
+
export declare function invokeManualHook<T>(fn: (...args: any[]) => T, receiver: unknown, args: IArguments): T;
|
|
666
|
+
/** @internal Adapt an expression provider that owns the trailing hook-slot ABI. */
|
|
667
|
+
export declare function manualHook<F extends (...args: any[]) => any>(fn: F, name?: string): F;
|
|
668
|
+
export declare function withSlot<T>(sym: unknown, fn: (...a: any[]) => T, ...args: any[]): T;
|
|
665
669
|
export declare function useState<T>(initial: T | (() => T), slot?: unknown): [T, (value: T | ((previous: T) => T)) => void, () => T];
|
|
666
670
|
export declare const __useStateWithGetter: typeof useState;
|
|
667
671
|
export declare function useLinkedState<Source, Value>(source: Source, reconcile: (source: Source, previous: LinkedStatePrevious<Source, Value> | undefined) => Value, options?: LinkedStateOptions<Source, Value>, slot?: unknown): [Value, (next: Value | ((previous: Value) => Value)) => void, () => Value];
|
|
@@ -717,6 +721,8 @@ export declare function useContext<T>(context: UniversalContext<T>): T;
|
|
|
717
721
|
export declare function useBatch(items: any[], warm?: () => void): void;
|
|
718
722
|
/** Compiler ABI: cache one speculative creation per plan occurrence, slot, and deps. */
|
|
719
723
|
export declare function warmMemo(compute: () => any, deps: readonly any[], slot: unknown): void;
|
|
724
|
+
/** Keep compiler-owned plans from following static hoisting onto unrelated HOCs. */
|
|
725
|
+
export declare function markWarm<T extends Function>(component: T, plan: unknown): T;
|
|
720
726
|
/** Compiler ABI: recurse into a compiled child's statically attached warm plan. */
|
|
721
727
|
export declare function warmChild(component: any, props: any): void;
|
|
722
728
|
/**
|
|
@@ -737,6 +743,7 @@ export declare function useEffectEvent<T extends (...args: any[]) => any>(fn: T,
|
|
|
737
743
|
export declare function useDebugValue(): void;
|
|
738
744
|
export declare function startTransition(fn: () => void | Promise<unknown>): void;
|
|
739
745
|
export declare function requestFormReset(): void;
|
|
746
|
+
export declare function memo<C extends UniversalComponent<any>>(component: C, compare?: (previous: Readonly<Parameters<C>[0]>, next: Readonly<Parameters<C>[0]>) => boolean): C;
|
|
740
747
|
export declare function memo<P>(component: UniversalComponent<P>, compare?: (previous: Readonly<P>, next: Readonly<P>) => boolean): UniversalComponent<P>;
|
|
741
748
|
export declare function createPortal(children: UniversalRenderable, target: unknown): UniversalPortalValue;
|
|
742
749
|
/** Compiler sentinel for the supported universal Activity descriptor. */
|
package/dist/universal-core.js
CHANGED
|
@@ -655,7 +655,7 @@ function hmrUniversalComponent(renderer, component) {
|
|
|
655
655
|
__profileComponentSource(wrapper, next);
|
|
656
656
|
}
|
|
657
657
|
if (next.__warm === void 0) delete wrapper.__warm;
|
|
658
|
-
else wrapper
|
|
658
|
+
else markWarm(wrapper, next.__warm);
|
|
659
659
|
for (const owner of owners) {
|
|
660
660
|
if (owner.disposed) {
|
|
661
661
|
owners.delete(owner);
|
|
@@ -678,13 +678,17 @@ function hmrUniversalComponent(renderer, component) {
|
|
|
678
678
|
{ module: metadata.module }
|
|
679
679
|
);
|
|
680
680
|
Object.defineProperties(wrapper, {
|
|
681
|
-
[UNIVERSAL_HMR]: {
|
|
681
|
+
[UNIVERSAL_HMR]: {
|
|
682
|
+
get() {
|
|
683
|
+
return this === wrapper ? meta : void 0;
|
|
684
|
+
}
|
|
685
|
+
},
|
|
682
686
|
[UNIVERSAL_COMPONENT_REVISION]: { get: () => meta.revision }
|
|
683
687
|
});
|
|
684
688
|
if (typeof __OCTANE_PROFILE_ENABLED__ !== "undefined" && __OCTANE_PROFILE_ENABLED__) {
|
|
685
689
|
__profileComponentSource(wrapper, component);
|
|
686
690
|
}
|
|
687
|
-
if (component.__warm !== void 0) wrapper
|
|
691
|
+
if (component.__warm !== void 0) markWarm(wrapper, component.__warm);
|
|
688
692
|
return wrapper;
|
|
689
693
|
}
|
|
690
694
|
function getComponentMetadata(component) {
|
|
@@ -2833,12 +2837,66 @@ function hookSlots(count) {
|
|
|
2833
2837
|
NEXT_HOOK_SLOT += count;
|
|
2834
2838
|
return base;
|
|
2835
2839
|
}
|
|
2836
|
-
|
|
2837
|
-
|
|
2840
|
+
let MANUAL_HOOK_DRIVER = null;
|
|
2841
|
+
function invokeManualHook(fn, receiver, args) {
|
|
2842
|
+
const driver = MANUAL_HOOK_DRIVER ??= {
|
|
2843
|
+
pending: UNIVERSAL_SLOT_STACK[UNIVERSAL_SLOT_STACK.length - 1],
|
|
2844
|
+
active: false
|
|
2845
|
+
};
|
|
2846
|
+
const pending = driver.pending;
|
|
2847
|
+
const active = driver.active;
|
|
2848
|
+
driver.pending = void 0;
|
|
2849
|
+
driver.active = true;
|
|
2850
|
+
try {
|
|
2851
|
+
if (pending === void 0) return Reflect.apply(fn, receiver, args);
|
|
2852
|
+
switch (args.length) {
|
|
2853
|
+
case 0:
|
|
2854
|
+
return fn.call(receiver, pending);
|
|
2855
|
+
case 1:
|
|
2856
|
+
return fn.call(receiver, args[0], pending);
|
|
2857
|
+
case 2:
|
|
2858
|
+
return fn.call(receiver, args[0], args[1], pending);
|
|
2859
|
+
case 3:
|
|
2860
|
+
return fn.call(receiver, args[0], args[1], args[2], pending);
|
|
2861
|
+
case 4:
|
|
2862
|
+
return fn.call(receiver, args[0], args[1], args[2], args[3], pending);
|
|
2863
|
+
default: {
|
|
2864
|
+
const forwarded = new Array(args.length + 1);
|
|
2865
|
+
for (let index = 0; index < args.length; index++) forwarded[index] = args[index];
|
|
2866
|
+
forwarded[args.length] = pending;
|
|
2867
|
+
return fn.apply(receiver, forwarded);
|
|
2868
|
+
}
|
|
2869
|
+
}
|
|
2870
|
+
} finally {
|
|
2871
|
+
driver.pending = pending;
|
|
2872
|
+
driver.active = active;
|
|
2873
|
+
}
|
|
2874
|
+
}
|
|
2875
|
+
function manualHook(fn, name) {
|
|
2876
|
+
function provider() {
|
|
2877
|
+
return invokeManualHook(fn, this, arguments);
|
|
2878
|
+
}
|
|
2879
|
+
Object.defineProperty(provider, "name", { value: name ?? fn.name, configurable: true });
|
|
2880
|
+
Object.defineProperty(provider, "length", { value: fn.length, configurable: true });
|
|
2881
|
+
return provider;
|
|
2882
|
+
}
|
|
2883
|
+
function withSlot(sym, fn, ...args) {
|
|
2884
|
+
const driver = MANUAL_HOOK_DRIVER;
|
|
2885
|
+
const pending = driver?.pending;
|
|
2886
|
+
const active = driver?.active ?? false;
|
|
2887
|
+
if (driver !== null) {
|
|
2888
|
+
driver.pending = sym;
|
|
2889
|
+
driver.active = false;
|
|
2890
|
+
}
|
|
2891
|
+
UNIVERSAL_SLOT_STACK.push(sym);
|
|
2838
2892
|
try {
|
|
2839
2893
|
return fn(...args);
|
|
2840
2894
|
} finally {
|
|
2841
2895
|
UNIVERSAL_SLOT_STACK.pop();
|
|
2896
|
+
if (MANUAL_HOOK_DRIVER !== null) {
|
|
2897
|
+
MANUAL_HOOK_DRIVER.pending = driver === null ? UNIVERSAL_SLOT_STACK[UNIVERSAL_SLOT_STACK.length - 1] : pending;
|
|
2898
|
+
MANUAL_HOOK_DRIVER.active = active;
|
|
2899
|
+
}
|
|
2842
2900
|
}
|
|
2843
2901
|
}
|
|
2844
2902
|
function createUniversalTransitionBatch() {
|
|
@@ -3135,6 +3193,10 @@ function visibleStateValue(record, slot, fallback) {
|
|
|
3135
3193
|
return value;
|
|
3136
3194
|
}
|
|
3137
3195
|
function useState(initial, slot) {
|
|
3196
|
+
if (slot === void 0 && typeof initial === "symbol" && arguments.length === 1 && MANUAL_HOOK_DRIVER?.active === true) {
|
|
3197
|
+
slot = initial;
|
|
3198
|
+
initial = void 0;
|
|
3199
|
+
}
|
|
3138
3200
|
const owner = currentDraftOwner();
|
|
3139
3201
|
const resolved = resolveHookSlot(slot);
|
|
3140
3202
|
let hook = cloneStateHook(owner, resolved);
|
|
@@ -3449,6 +3511,10 @@ function useCallback(callback, deps, slot) {
|
|
|
3449
3511
|
return memoHookValue(callback, false, deps, slot);
|
|
3450
3512
|
}
|
|
3451
3513
|
function useRef(initial, slot) {
|
|
3514
|
+
if (slot === void 0 && typeof initial === "symbol" && arguments.length === 1 && MANUAL_HOOK_DRIVER?.active === true) {
|
|
3515
|
+
slot = initial;
|
|
3516
|
+
initial = void 0;
|
|
3517
|
+
}
|
|
3452
3518
|
const owner = currentDraftOwner();
|
|
3453
3519
|
const resolved = resolveHookSlot(slot);
|
|
3454
3520
|
let hook = owner.hooks.get(resolved);
|
|
@@ -3860,6 +3926,15 @@ function warmMemo(compute, deps, slot) {
|
|
|
3860
3926
|
entries.push(entry);
|
|
3861
3927
|
CURRENT_UNIVERSAL_WARM_CLAIMS?.add(entry);
|
|
3862
3928
|
}
|
|
3929
|
+
function markWarm(component, plan) {
|
|
3930
|
+
Object.defineProperty(component, "__warm", {
|
|
3931
|
+
configurable: true,
|
|
3932
|
+
get() {
|
|
3933
|
+
return this === component ? plan : void 0;
|
|
3934
|
+
}
|
|
3935
|
+
});
|
|
3936
|
+
return component;
|
|
3937
|
+
}
|
|
3863
3938
|
function warmChild(component, props) {
|
|
3864
3939
|
if (CURRENT_UNIVERSAL_WARM === null || component == null) return;
|
|
3865
3940
|
const plan = component.__warm;
|
|
@@ -3940,9 +4015,13 @@ function lazy(load) {
|
|
|
3940
4015
|
throw new UniversalSuspense(thenable);
|
|
3941
4016
|
});
|
|
3942
4017
|
Object.defineProperties(wrapper, {
|
|
3943
|
-
[LAZY_COMPONENT]: {
|
|
3944
|
-
|
|
4018
|
+
[LAZY_COMPONENT]: {
|
|
4019
|
+
get() {
|
|
4020
|
+
return this === wrapper;
|
|
4021
|
+
}
|
|
4022
|
+
}
|
|
3945
4023
|
});
|
|
4024
|
+
markWarm(wrapper, initialize);
|
|
3946
4025
|
return wrapper;
|
|
3947
4026
|
}
|
|
3948
4027
|
function use(usable) {
|
|
@@ -4124,7 +4203,11 @@ function memo(component, compare) {
|
|
|
4124
4203
|
let wrapper;
|
|
4125
4204
|
if (metadata === UNIVERSAL_LAZY_METADATA) {
|
|
4126
4205
|
wrapper = renderMemo;
|
|
4127
|
-
Object.defineProperty(wrapper, LAZY_COMPONENT, {
|
|
4206
|
+
Object.defineProperty(wrapper, LAZY_COMPONENT, {
|
|
4207
|
+
get() {
|
|
4208
|
+
return this === wrapper;
|
|
4209
|
+
}
|
|
4210
|
+
});
|
|
4128
4211
|
} else {
|
|
4129
4212
|
wrapper = defineUniversalComponent(metadata.id, renderMemo, { module: metadata.module });
|
|
4130
4213
|
}
|
|
@@ -4134,7 +4217,7 @@ function memo(component, compare) {
|
|
|
4134
4217
|
if (typeof __OCTANE_PROFILE_ENABLED__ !== "undefined" && __OCTANE_PROFILE_ENABLED__) {
|
|
4135
4218
|
__profileComponentSource(wrapper, component);
|
|
4136
4219
|
}
|
|
4137
|
-
if (component.__warm !== void 0) wrapper
|
|
4220
|
+
if (component.__warm !== void 0) markWarm(wrapper, component.__warm);
|
|
4138
4221
|
return wrapper;
|
|
4139
4222
|
}
|
|
4140
4223
|
function createPortal(children, target) {
|
|
@@ -9320,9 +9403,12 @@ export {
|
|
|
9320
9403
|
hasCrossRealmPlainPrototype,
|
|
9321
9404
|
hmrUniversalComponent,
|
|
9322
9405
|
hookSlots,
|
|
9406
|
+
invokeManualHook,
|
|
9323
9407
|
isRendererRegion,
|
|
9324
9408
|
lazy,
|
|
9409
|
+
manualHook,
|
|
9325
9410
|
markUniversalHostComponent,
|
|
9411
|
+
markWarm,
|
|
9326
9412
|
memo,
|
|
9327
9413
|
rendererRegion,
|
|
9328
9414
|
requestFormReset,
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "octane",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": [
|
|
@@ -157,6 +157,7 @@
|
|
|
157
157
|
"@volar/typescript": "2.4.28",
|
|
158
158
|
"alien-signals": "3.2.0",
|
|
159
159
|
"devalue": "^5.8.2",
|
|
160
|
+
"entities": "7.0.1",
|
|
160
161
|
"es-module-lexer": "^1.7.0",
|
|
161
162
|
"esrap": "^2.3.2",
|
|
162
163
|
"oxc-tsrx": "0.5.0"
|