octane 0.2.4 → 0.2.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.
- package/dist/cjs/constants.cjs +9 -0
- package/dist/cjs/error-codes.client.generated.cjs +2 -0
- package/dist/cjs/host-property-diagnostics.cjs +2 -0
- package/dist/cjs/index.cjs +2 -0
- package/dist/cjs/runtime.cjs +482 -51
- package/dist/cjs/runtime.server.cjs +23 -6
- package/dist/cjs/version.cjs +1 -1
- package/dist/compiler/bundler.js +7 -1
- package/dist/compiler/compile.js +12 -0
- package/dist/compiler/hook-methods.js +164 -0
- package/dist/compiler/parser-output.js +37 -0
- package/dist/compiler/parser.browser.js +145 -1
- package/dist/compiler/parser.node.js +1 -35
- package/dist/compiler/plain-hook-memo.js +37 -0
- package/dist/compiler/slot-hooks.js +129 -5
- package/dist/compiler/volar.LICENSES.txt +1 -1
- package/dist/compiler/volar.js +186 -43
- package/dist/constants.d.ts +3 -0
- package/dist/constants.js +6 -0
- package/dist/error-codes.client.generated.d.ts +1 -0
- package/dist/error-codes.client.generated.js +2 -0
- package/dist/host-property-diagnostics.js +2 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -0
- package/dist/runtime.d.ts +16 -12
- package/dist/runtime.js +483 -51
- package/dist/runtime.server.d.ts +2 -0
- package/dist/runtime.server.js +25 -6
- package/dist/version.js +1 -1
- package/package.json +5 -5
package/dist/runtime.d.ts
CHANGED
|
@@ -619,6 +619,8 @@ interface OffscreenCapture {
|
|
|
619
619
|
}
|
|
620
620
|
/** @internal Preserve the owning renderer's scheduler without racing a staged commit. */
|
|
621
621
|
export declare function scheduleRenderCleanup(schedule: (callback: () => void) => void, receiver: unknown, cleanup: () => void, onDiscard?: () => void): void;
|
|
622
|
+
/** Whether a testing helper is executing within an active act callback. */
|
|
623
|
+
export declare function isInActScope(): boolean;
|
|
622
624
|
/**
|
|
623
625
|
* Test-environment opt-in. When true, scheduleRender() calls that happen
|
|
624
626
|
* outside a flushSync or an act() callback emit a console.error mirroring
|
|
@@ -677,17 +679,17 @@ export declare function drainPassiveEffects(): void;
|
|
|
677
679
|
*/
|
|
678
680
|
export declare function hasPendingWork(): boolean;
|
|
679
681
|
/**
|
|
680
|
-
*
|
|
682
|
+
* Wrap test code that triggers updates so all of
|
|
681
683
|
* the scheduled work commits before the assertion phase runs.
|
|
682
684
|
*
|
|
683
|
-
*
|
|
685
|
+
* Two callback modes:
|
|
684
686
|
* - SYNC callback → all scheduled work (renders + INSERTION/LAYOUT/PASSIVE
|
|
685
687
|
* effects) is flushed SYNCHRONOUSLY before act returns, so
|
|
686
688
|
* `act(() => setState(...)); expect(...)` works WITHOUT awaiting — the
|
|
687
|
-
* dominant pattern in ported React test suites.
|
|
688
|
-
*
|
|
689
|
-
*
|
|
690
|
-
*
|
|
689
|
+
* dominant pattern in ported React test suites. Nested callbacks join the
|
|
690
|
+
* outer callback's transaction. The returned promise also drains promise
|
|
691
|
+
* work and carries the callback's result. Callback and render errors reject
|
|
692
|
+
* it rather than escaping through the scheduler.
|
|
691
693
|
* - ASYNC callback (returns a thenable) → awaited, then the scheduler is
|
|
692
694
|
* drained across microtask ticks until quiescent (renders, effects, and
|
|
693
695
|
* microtask chains from `use(promise)` / transition retries).
|
|
@@ -696,7 +698,7 @@ export declare function hasPendingWork(): boolean;
|
|
|
696
698
|
* dev warning is suppressed (see `IS_OCTANE_ACT_ENVIRONMENT` and
|
|
697
699
|
* `setIsOctaneActEnvironment`).
|
|
698
700
|
*
|
|
699
|
-
*
|
|
701
|
+
* Complete promise checkpoints, bounded by ACT_DRAIN_LIMIT iterations,
|
|
700
702
|
* drains cascades like `use(promise)` → status flip → retry → renderBlock
|
|
701
703
|
* that wouldn't settle in a single tick.
|
|
702
704
|
*/
|
|
@@ -708,6 +710,8 @@ declare const SLOT_FLAG_TEARDOWN: number;
|
|
|
708
710
|
export declare function invokeManualHook<T>(fn: (...args: any[]) => T, receiver: unknown, args: IArguments): T;
|
|
709
711
|
/** @internal Adapt an expression provider that owns the trailing hook-slot ABI. */
|
|
710
712
|
export declare function manualHook<F extends (...args: any[]) => any>(fn: F, name?: string): F;
|
|
713
|
+
/** Invoke a cached optional-chain method without consulting its call/bind properties. */
|
|
714
|
+
export declare function callWithReceiver<T>(fn: (...args: any[]) => T, receiver: unknown, ...args: any[]): T;
|
|
711
715
|
export declare function withSlot<T>(sym: symbol, fn: (...a: any[]) => T, ...args: any[]): T;
|
|
712
716
|
/** @internal Optional native hooks use the existing compiler slot and Scope lifetime. */
|
|
713
717
|
export declare function nativeLocalHook<T>(name: string, initialize: () => T, dispose: (value: T) => void, slot?: HookSlot): T;
|
|
@@ -1581,7 +1585,7 @@ export declare function setFormControlSources(el: Element, sources: ReadonlyArra
|
|
|
1581
1585
|
interface PortalSlot {
|
|
1582
1586
|
__kind: 'portalSlotSlot';
|
|
1583
1587
|
block: Block | null;
|
|
1584
|
-
target: Element | null;
|
|
1588
|
+
target: Element | DocumentFragment | null;
|
|
1585
1589
|
key: string | null;
|
|
1586
1590
|
host: Node;
|
|
1587
1591
|
start: Comment | null;
|
|
@@ -1597,7 +1601,7 @@ interface PortalSlot {
|
|
|
1597
1601
|
* the portal body in place. Unmounting the enclosing Block tears the portal
|
|
1598
1602
|
* down and removes its DOM from `target`.
|
|
1599
1603
|
*/
|
|
1600
|
-
export declare function portal(parentScope: Scope, slotKey: number, target: Element, body: ComponentBody, props: any, host?: Node, env?: any[], fragmentOwners?: FragmentInstance | readonly FragmentInstance[], fragmentAnchor?: Node): void;
|
|
1604
|
+
export declare function portal(parentScope: Scope, slotKey: number, target: Element | DocumentFragment, body: ComponentBody, props: any, host?: Node, env?: any[], fragmentOwners?: FragmentInstance | readonly FragmentInstance[], fragmentAnchor?: Node): void;
|
|
1601
1605
|
/**
|
|
1602
1606
|
* `createPortal(children, target, keyOrProps?)`. A string/number third argument
|
|
1603
1607
|
* is a reconciliation key. An object remains Octane's optional props for a
|
|
@@ -1612,10 +1616,10 @@ export interface PortalDescriptor {
|
|
|
1612
1616
|
$$kind: typeof PORTAL_TAG;
|
|
1613
1617
|
key: string | null;
|
|
1614
1618
|
body: ComponentBody | ElementDescriptor | unknown;
|
|
1615
|
-
target: Element;
|
|
1619
|
+
target: Element | DocumentFragment;
|
|
1616
1620
|
props: any;
|
|
1617
1621
|
}
|
|
1618
|
-
export declare function createPortal(body: ComponentBody | ElementDescriptor | unknown, target: Element, props?: any): PortalDescriptor;
|
|
1622
|
+
export declare function createPortal(body: ComponentBody | ElementDescriptor | unknown, target: Element | DocumentFragment, props?: any): PortalDescriptor;
|
|
1619
1623
|
declare const ELEMENT_TAG: unique symbol;
|
|
1620
1624
|
export interface ElementDescriptor<P = any> {
|
|
1621
1625
|
$$kind: typeof ELEMENT_TAG;
|
|
@@ -1941,7 +1945,7 @@ interface ForSlot {
|
|
|
1941
1945
|
plainDeopt: boolean;
|
|
1942
1946
|
selectionItems?: ArrayLike<any>;
|
|
1943
1947
|
}
|
|
1944
|
-
export declare function forBlock<T>(parentScope: Scope, slotKey: number, domParent: Node,
|
|
1948
|
+
export declare function forBlock<T>(parentScope: Scope, slotKey: number, domParent: Node, inputItems: ArrayLike<T> | Iterable<T>, getKey: (item: T, index: number) => any, itemBody: (item: T, scope: Scope) => void, flags?: number, deps?: any[], emptyBody?: ComponentBody | null, anchor?: Node | null, ownEnd?: boolean): void;
|
|
1945
1949
|
/**
|
|
1946
1950
|
* Compiler-only keyed-selection entry. Keeping the specialization outside
|
|
1947
1951
|
* forBlock lets applications without a proven selection tree-shake its cost.
|