osra 0.3.3 → 0.4.0
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/build/connections/bidirectional.d.ts +20 -7
- package/build/connections/index.d.ts +1 -1
- package/build/connections/utils.d.ts +10 -3
- package/build/index.d.ts +15 -6
- package/build/index.js +591 -518
- package/build/index.js.map +1 -1
- package/build/revivables/abort-signal.d.ts +2 -5
- package/build/revivables/array-buffer.d.ts +6 -10
- package/build/revivables/bigint.d.ts +6 -11
- package/build/revivables/blob.d.ts +17 -0
- package/build/revivables/error.d.ts +8 -6
- package/build/revivables/event-target.d.ts +14 -25
- package/build/revivables/event.d.ts +15 -0
- package/build/revivables/fallbacks.d.ts +136 -0
- package/build/revivables/function.d.ts +3 -16
- package/build/revivables/identity.d.ts +8 -14
- package/build/revivables/index.d.ts +21 -1
- package/build/revivables/message-port.d.ts +6 -38
- package/build/revivables/symbol.d.ts +11 -0
- package/build/revivables/transfer.d.ts +4 -19
- package/build/revivables/utils.d.ts +10 -8
- package/build/types.d.ts +11 -5
- package/build/utils/gc-tracker.d.ts +19 -0
- package/build/utils/index.d.ts +1 -0
- package/build/utils/transferable.d.ts +6 -17
- package/build/utils/type-guards.d.ts +4 -4
- package/package.json +4 -3
|
@@ -1,20 +1,9 @@
|
|
|
1
1
|
import { transfer } from '../revivables/transfer';
|
|
2
2
|
export { transfer };
|
|
3
|
-
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* included — structured clone cannot represent them.
|
|
10
|
-
* 2. Clonable types (SharedArrayBuffer) are skipped entirely.
|
|
11
|
-
* 3. Other Transferable types (ArrayBuffer, ImageBitmap) are included only
|
|
12
|
-
* when the walker is inside a non-degraded transfer box — i.e. when the
|
|
13
|
-
* user explicitly opted into move semantics at the send site via
|
|
14
|
-
* transfer() AND the platform supports transferring.
|
|
15
|
-
*
|
|
16
|
-
* The transfer intent is carried on the wire by the transfer revivable box;
|
|
17
|
-
* recognising it structurally here (without importing the module) is all the
|
|
18
|
-
* coupling this file needs.
|
|
19
|
-
*/
|
|
3
|
+
/** Walk a boxed message and collect Transferables to move (rather than copy)
|
|
4
|
+
* on postMessage:
|
|
5
|
+
* 1. Must-transfer types are always included.
|
|
6
|
+
* 2. Clonable types (SharedArrayBuffer) are skipped.
|
|
7
|
+
* 3. Other Transferables are included only inside a non-degraded transfer
|
|
8
|
+
* box (user opted in AND the platform supports transferring). */
|
|
20
9
|
export declare const getTransferableObjects: (value: unknown) => Transferable[];
|
|
@@ -9,14 +9,14 @@ declare const typedArrayConstructorsByName: {
|
|
|
9
9
|
readonly Uint16Array: Uint16ArrayConstructor;
|
|
10
10
|
readonly Int32Array: Int32ArrayConstructor;
|
|
11
11
|
readonly Uint32Array: Uint32ArrayConstructor;
|
|
12
|
-
readonly Float16Array: Float16ArrayConstructor;
|
|
12
|
+
readonly Float16Array: Float16ArrayConstructor | undefined;
|
|
13
13
|
readonly Float32Array: Float32ArrayConstructor;
|
|
14
14
|
readonly Float64Array: Float64ArrayConstructor;
|
|
15
15
|
readonly BigInt64Array: BigInt64ArrayConstructor;
|
|
16
16
|
readonly BigUint64Array: BigUint64ArrayConstructor;
|
|
17
17
|
};
|
|
18
18
|
export type TypedArrayType = keyof typeof typedArrayConstructorsByName;
|
|
19
|
-
export type TypedArrayConstructor = (typeof typedArrayConstructorsByName)[TypedArrayType]
|
|
19
|
+
export type TypedArrayConstructor = NonNullable<(typeof typedArrayConstructorsByName)[TypedArrayType]>;
|
|
20
20
|
export type TypedArray = InstanceType<TypedArrayConstructor>;
|
|
21
21
|
export declare const typedArrayToType: (value: TypedArray) => TypedArrayType;
|
|
22
22
|
export declare const typedArrayTypeToTypedArrayConstructor: (value: TypedArrayType) => TypedArrayConstructor;
|
|
@@ -28,8 +28,8 @@ export declare const isDedicatedWorker: (value: unknown) => value is DedicatedWo
|
|
|
28
28
|
export declare const isSharedWorker: (value: unknown) => value is SharedWorker;
|
|
29
29
|
export declare const isOsraMessage: (value: unknown) => value is Message;
|
|
30
30
|
type AnyConstructor = abstract new (...args: any[]) => unknown;
|
|
31
|
-
/** True if `value` is an instance of any of the given
|
|
32
|
-
*
|
|
31
|
+
/** True if `value` is an instance of any of the given constructors.
|
|
32
|
+
* Tolerates undefined entries (constructors missing on this platform). */
|
|
33
33
|
export declare const instanceOfAny: (value: unknown, ctors: readonly (AnyConstructor | undefined)[]) => boolean;
|
|
34
34
|
export declare const isClonable: (value: unknown) => boolean;
|
|
35
35
|
export declare const isTransferable: (value: unknown) => value is Transferable;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "osra",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Easy communication between workers",
|
|
5
5
|
"files": [
|
|
6
6
|
"build"
|
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
"scripts": {
|
|
11
11
|
"build": "vite build && tsgo --declaration --emitDeclarationOnly",
|
|
12
12
|
"build-watch": "vite build --watch",
|
|
13
|
+
"clean": "rimraf build",
|
|
14
|
+
"prepublishOnly": "npm run clean && npm run build",
|
|
13
15
|
"build-test": "vite build --config vite.test.config.ts",
|
|
14
16
|
"build-test-watch": "vite build --config vite.test.config.ts --watch",
|
|
15
17
|
"dev": "concurrently \"npm run build-test-watch\"",
|
|
@@ -23,8 +25,7 @@
|
|
|
23
25
|
"clean-coverage": "rimraf .nyc_output coverage",
|
|
24
26
|
"type-check": "tsgo --noEmit && tsgo --noEmit -p tsconfig.tests.json",
|
|
25
27
|
"start-server": "http-server -p 3000",
|
|
26
|
-
"build-extension-test": "
|
|
27
|
-
"build-extension-test-watch": "vite build --config vite.extension-test.config.ts --watch",
|
|
28
|
+
"build-extension-test": "node build-extension-test.mjs",
|
|
28
29
|
"test-extension": "npm run build-extension-test && npx playwright test -c playwright.extension.config.ts"
|
|
29
30
|
},
|
|
30
31
|
"repository": {
|