@locker/near-membrane-base
Advanced tools
Comparing version 0.9.2 to 0.9.3
{ | ||
"name": "@locker/near-membrane-base", | ||
"version": "0.9.2", | ||
"version": "0.9.3", | ||
"license": "MIT", | ||
@@ -23,3 +23,3 @@ "author": "Caridy Patiño <caridy@gmail.com>", | ||
}, | ||
"gitHead": "f7e0f7854f5d81a1cc6b1ff027531a92d628526f" | ||
"gitHead": "e9bdefa82fbf61b917f651acd35ee149c6d9a082" | ||
} |
/** | ||
* This file contains an exportable (portable) function `init` used to initialize | ||
* one side of a membrane on any realm. The only prerequisite is the ability to evaluate | ||
* the sourceText of the `init` function there. Once evaluated, the function will return | ||
* a set of values that can be used to wire up the side of the membrane with another | ||
* existing `init` function from another realm, in which case they will exchange | ||
* callable functions that are required to connect the two realms via the membrane. | ||
* one side of a membrane on any realm. The only prerequisite is the ability to | ||
* evaluate the sourceText of the `init` function there. Once evaluated, the | ||
* function will return a set of values that can be used to wire up the side of | ||
* the membrane with another existing `init` function from another realm, in which | ||
* case they will exchange callable functions that are required to connect the | ||
* two realms via the membrane. | ||
* | ||
@@ -12,10 +13,13 @@ * About the mechanics of the membrane, there are few important considerations: | ||
* 1. Pointers are the way to pass reference to object and functions. | ||
* 2. A dedicated symbol (UNDEFINED_SYMBOL) is needed to represent the absence of a value. | ||
* 3. The realm that owns the object or function is responsible for projecting the proxy | ||
* onto the other side (via callablePushTarget), which returns a Pointer that can be | ||
* used by the realm to pass the reference to the same proxy over and over again. | ||
* 4. The realm that owns the proxy (after the other side projects it into it) will hold | ||
* a Pointer alongside the proxy to signal what original object or function should | ||
* the foreign operation operates, it is always the first argument of the foreign | ||
* callable for proxies, and the other side can use it via `getSelectedTarget`. | ||
* 2. A dedicated symbol (LOCKER_NEAR_MEMBRANE_UNDEFINED_VALUE_SYMBOL) is needed | ||
* to represent the absence of a value. | ||
* 3. The realm that owns the object or function is responsible for projecting | ||
* the proxy onto the other side (via callablePushTarget), which returns a | ||
* Pointer that can be used by the realm to pass the reference to the same | ||
* proxy over and over again. | ||
* 4. The realm that owns the proxy (after the other side projects it into it) | ||
* will hold a Pointer alongside the proxy to signal what original object or | ||
* function should the foreign operation operates, it is always the first | ||
* argument of the foreign callable for proxies, and the other side can use | ||
* it via `getSelectedTarget`. | ||
*/ | ||
@@ -38,4 +42,5 @@ import { InstrumentationHooks } from './instrumentation'; | ||
declare type CallableGetOwnPropertyDescriptors = (targetPointer: Pointer, foreignCallableDescriptorsCallback: CallableDescriptorsCallback) => void; | ||
declare type CallableGetSerializedValueOfTarget = (targetPointer: Pointer) => SerializedValue | undefined; | ||
declare type CallableGetTargetIntegrityTraits = (targetPointer: Pointer) => number; | ||
declare type CallableGetUnbrandedTag = (targetPointer: Pointer) => string | undefined; | ||
declare type CallableGetToStringTagOfTarget = (targetPointer: Pointer) => string; | ||
declare type CallableHasOwnProperty = (targetPointer: Pointer, key: string | symbol) => boolean; | ||
@@ -46,2 +51,3 @@ declare type CallableIsLiveTarget = (targetPointer: Pointer) => boolean; | ||
declare type PointerOrPrimitive = Pointer | Primitive; | ||
declare type SerializedValue = bigint | boolean | number | string | symbol; | ||
export declare type CallableDefineProperty = (targetPointer: Pointer, key: string | symbol, configurable: boolean | symbol, enumerable: boolean | symbol, writable: boolean | symbol, valuePointer: PointerOrPrimitive, getPointer: PointerOrPrimitive, setPointer: PointerOrPrimitive) => boolean; | ||
@@ -55,3 +61,3 @@ export declare type CallableEvaluate = (sourceText: string) => PointerOrPrimitive; | ||
export declare type GetTransferableValue = (value: any) => PointerOrPrimitive; | ||
export declare type HooksCallback = (globalThisPointer: Pointer, getSelectedTarget: GetSelectedTarget, getTransferableValue: GetTransferableValue, callableGetPropertyValuePointer: CallableGetPropertyValuePointer, callableEvaluate: CallableEvaluate, callableLinkPointers: CallableLinkPointers, callablePushTarget: CallablePushTarget, callableApply: CallableApply, callableConstruct: CallableConstruct, callableDefineProperty: CallableDefineProperty, callableDeleteProperty: CallableDeleteProperty, callableGet: CallableGet, callableGetOwnPropertyDescriptor: CallableGetOwnPropertyDescriptor, callableGetPrototypeOf: CallableGetPrototypeOf, callableHas: CallableHas, callableIsExtensible: CallableIsExtensible, callableOwnKeys: CallableOwnKeys, callablePreventExtensions: CallablePreventExtensions, callableSet: CallableSet, callableSetPrototypeOf: CallableSetPrototypeOf, callableGetOwnPropertyDescriptors: CallableGetOwnPropertyDescriptors, callableGetTargetIntegrityTraits: CallableGetTargetIntegrityTraits, callableGetUnbrandedTag: CallableGetUnbrandedTag, callableHasOwnProperty: CallableHasOwnProperty, callableIsLiveTarget: CallableIsLiveTarget, callableWarn: CallableWarn) => void; | ||
export declare type HooksCallback = (globalThisPointer: Pointer, getSelectedTarget: GetSelectedTarget, getTransferableValue: GetTransferableValue, callableGetPropertyValuePointer: CallableGetPropertyValuePointer, callableEvaluate: CallableEvaluate, callableLinkPointers: CallableLinkPointers, callablePushTarget: CallablePushTarget, callableApply: CallableApply, callableConstruct: CallableConstruct, callableDefineProperty: CallableDefineProperty, callableDeleteProperty: CallableDeleteProperty, callableGet: CallableGet, callableGetOwnPropertyDescriptor: CallableGetOwnPropertyDescriptor, callableGetPrototypeOf: CallableGetPrototypeOf, callableHas: CallableHas, callableIsExtensible: CallableIsExtensible, callableOwnKeys: CallableOwnKeys, callablePreventExtensions: CallablePreventExtensions, callableSet: CallableSet, callableSetPrototypeOf: CallableSetPrototypeOf, callableGetOwnPropertyDescriptors: CallableGetOwnPropertyDescriptors, callableGetSerializedValueOfTarget: CallableGetSerializedValueOfTarget, callableGetTargetIntegrityTraits: CallableGetTargetIntegrityTraits, callableGetToStringTagOfTarget: CallableGetToStringTagOfTarget, callableHasOwnProperty: CallableHasOwnProperty, callableIsLiveTarget: CallableIsLiveTarget, callableWarn: CallableWarn) => void; | ||
export interface InitLocalOptions { | ||
@@ -58,0 +64,0 @@ distortionCallback?: DistortionCallback; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
183211
3812