osra 0.6.4 → 0.6.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.
@@ -16,6 +16,19 @@ export type BoxedTransfer<T extends Capable = Capable> = BoxBaseType<typeof type
16
16
  * copy when the platform/transport can't transfer the given type. Lies at
17
17
  * the type level - runtime value is a TransferWrapper<T> typed as T. */
18
18
  export declare const transfer: <T>(value: T) => T;
19
+ /** Whether boxing is happening inside a transfer() wrapper's extent. Streams read
20
+ * this at box time so transfer(stream) propagates move semantics to their chunks. */
21
+ export declare const isInTransfer: () => boolean;
22
+ /** Internal chunk marker: unlike the public transfer(), wraps containers too, so
23
+ * transferables nested anywhere inside a chunk move. Not part of the public API. */
24
+ export declare const forceTransfer: <T>(value: T) => T;
25
+ /** Runs fn with the ambient transfer extent suspended. Boxing at independent walk
26
+ * entry points (protocol ports, revived-function calls) can fire synchronously
27
+ * inside someone else's transfer() extent - an EventPort.start() flush during
28
+ * boxing, or user code (a getter) calling a revived function mid-walk. Those
29
+ * values are not part of the wrapper's graph, so their move semantics must come
30
+ * from a wrapper in their own data, never from the ambient counter. */
31
+ export declare const outsideTransfer: <T>(fn: () => T) => T;
19
32
  export declare const isType: (value: unknown) => value is TransferWrapper;
20
33
  export declare const box: <T extends Capable, TContext extends RevivableContext>(wrapper: TransferWrapper<T>, context: TContext) => BoxedTransfer<T>;
21
34
  export declare const revive: <T extends BoxedTransfer, TContext extends RevivableContext>(value: T, context: TContext) => T[UnderlyingType];
@@ -21,6 +21,7 @@ export type WriteAck = {
21
21
  export type Msg = WriteContext | WriteAck;
22
22
  export type BoxedWritableStream<T extends WritableStream = WritableStream> = BoxBaseType<typeof type> & {
23
23
  port: BoxedMessagePort<Msg>;
24
+ transferChunks?: true;
24
25
  } & {
25
26
  [UnderlyingType]: T;
26
27
  };
package/build/types.d.ts CHANGED
@@ -9,9 +9,7 @@ export type Uuid = `${string}-${string}-${string}-${string}-${string}`;
9
9
  export type Jsonable = boolean | null | number | string | {
10
10
  [key: string]: Jsonable;
11
11
  } | ReadonlyArray<Jsonable>;
12
- export type Structurable = Jsonable
13
- /** not really structureable but here for convenience */
14
- | void | undefined | bigint | Date | RegExp | Blob | File | FileList | ArrayBuffer | ArrayBufferView | ImageBitmap | ImageData | {
12
+ export type Structurable = Jsonable | void | undefined | bigint | Date | RegExp | Blob | File | FileList | ArrayBuffer | ArrayBufferView | ImageBitmap | ImageData | {
15
13
  [key: string]: Structurable;
16
14
  } | ReadonlyArray<Structurable> | Map<Structurable, Structurable> | Set<Structurable>;
17
15
  /** lib.dom declares some `Transferable` members as EMPTY interfaces
@@ -1,7 +1,6 @@
1
- /** Per-connection teardown registry. Revivables register cleanup for state
2
- * tied to a connection (pending RPC settlements, port routing, caches);
3
- * the connection layer runs it on protocol close or unregisterSignal abort.
4
- * Registering against an already-torn-down scope runs the callback
5
- * immediately so late registrations fail fast instead of leaking. */
6
1
  export declare const onTeardown: (scope: WeakKey, fn: () => void) => (() => void);
2
+ /** Whether a scope's teardown has already run. Callers use this to REFUSE work rather than start it:
3
+ * `onTeardown` against a dead scope runs the callback immediately, which is a footgun inside an
4
+ * initializer, and anything registered afterwards is state no teardown will ever visit again. */
5
+ export declare const isTornDown: (scope: WeakKey) => boolean;
7
6
  export declare const runTeardown: (scope: WeakKey) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "osra",
3
- "version": "0.6.4",
3
+ "version": "0.6.6",
4
4
  "description": "Easy communication between workers",
5
5
  "homepage": "https://github.com/Banou26/osra#readme",
6
6
  "bugs": {
@@ -57,19 +57,19 @@
57
57
  "docs-dev": "npm run dev -w docs",
58
58
  "docs-build": "npm run build -w docs",
59
59
  "docs-preview": "npm run preview -w docs",
60
+ "docs-gen-reference": "npm run gen:reference -w docs",
61
+ "docs-check-links": "npm run check-links -w docs",
60
62
  "docs-check-twoslash": "npm run check-twoslash -w docs"
61
63
  },
62
- "dependencies": {
63
- "@types/webextension-polyfill": "^0.12.4"
64
- },
65
64
  "devDependencies": {
66
65
  "@istanbuljs/nyc-config-typescript": "^1.0.2",
67
66
  "@playwright/test": "1.58.2",
68
67
  "@types/chai": "^5.2.3",
69
68
  "@types/chai-as-promised": "^8.0.2",
70
- "@types/chrome": "^0.1.27",
69
+ "@types/chrome": "^0.1.43",
71
70
  "@types/firefox-webext-browser": "^143.0.0",
72
71
  "@types/node": "^25.0.2",
72
+ "@types/webextension-polyfill": "^0.12.5",
73
73
  "chai": "^5.3.3",
74
74
  "chai-as-promised": "^8.0.1",
75
75
  "concurrently": "^9.1.0",