osra 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/build/index.d.ts +75 -54
- package/build/index.js +219 -192
- package/build/index.js.map +1 -1
- package/package.json +1 -1
package/build/index.d.ts
CHANGED
|
@@ -58,14 +58,20 @@ declare const box_2: <T extends Date, T2 extends RevivableContext>(value: T, _co
|
|
|
58
58
|
__OSRA_BOX__: "revivable";
|
|
59
59
|
};
|
|
60
60
|
|
|
61
|
-
declare const box_3: <T extends
|
|
61
|
+
declare const box_3: <T extends Headers, T2 extends RevivableContext>(value: T, _context: T2) => {
|
|
62
|
+
type: "headers";
|
|
63
|
+
entries: [string, string][];
|
|
64
|
+
__OSRA_BOX__: "revivable";
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
declare const box_4: <T extends Error, T2 extends RevivableContext>(value: T, _context: T2) => {
|
|
62
68
|
type: "error";
|
|
63
69
|
message: string;
|
|
64
70
|
stack: string;
|
|
65
71
|
__OSRA_BOX__: "revivable";
|
|
66
72
|
};
|
|
67
73
|
|
|
68
|
-
declare const
|
|
74
|
+
declare const box_5: <T extends TypedArray, T2 extends RevivableContext>(value: T, context: T2) => {
|
|
69
75
|
type: "typedArray";
|
|
70
76
|
typedArrayType: string;
|
|
71
77
|
__OSRA_BOX__: "revivable";
|
|
@@ -81,7 +87,7 @@ declare const box_4: <T extends TypedArray, T2 extends RevivableContext>(value:
|
|
|
81
87
|
[UnderlyingType]: T;
|
|
82
88
|
};
|
|
83
89
|
|
|
84
|
-
declare const
|
|
90
|
+
declare const box_6: <T, T2 extends RevivableContext = RevivableContext>(value: StructurableTransferablePort<T>, context: T2) => ({
|
|
85
91
|
type: "messagePort";
|
|
86
92
|
portId: `${string}-${string}-${string}-${string}-${string}`;
|
|
87
93
|
__OSRA_BOX__: "revivable";
|
|
@@ -95,11 +101,11 @@ declare const box_5: <T, T2 extends RevivableContext = RevivableContext>(value:
|
|
|
95
101
|
[UnderlyingType]: StrictMessagePort<ExtractStructurableTransferable<T>>;
|
|
96
102
|
});
|
|
97
103
|
|
|
98
|
-
declare const
|
|
104
|
+
declare const box_7: <T, T2 extends RevivableContext>(value: CapablePromise<T>, context: T2) => BoxedPromise<ExtractCapable<T>>;
|
|
99
105
|
|
|
100
|
-
declare const
|
|
106
|
+
declare const box_8: <T extends (...args: any[]) => any, T2 extends RevivableContext>(value: T & CapableFunction<T>, context: T2) => BoxedFunction<T>;
|
|
101
107
|
|
|
102
|
-
declare const
|
|
108
|
+
declare const box_9: <T extends ReadableStream, T2 extends RevivableContext>(value: T, context: T2) => BoxedReadableStream<T>;
|
|
103
109
|
|
|
104
110
|
export declare const BoxBase: {
|
|
105
111
|
readonly __OSRA_BOX__: "revivable";
|
|
@@ -110,13 +116,13 @@ export declare type BoxBase<T extends string = string> = typeof BoxBase & {
|
|
|
110
116
|
type: T;
|
|
111
117
|
};
|
|
112
118
|
|
|
113
|
-
declare type BoxedFunction<T extends (...args: any[]) => any = (...args: any[]) => any> = BoxBase<typeof
|
|
119
|
+
declare type BoxedFunction<T extends (...args: any[]) => any = (...args: any[]) => any> = BoxBase<typeof type_7> & {
|
|
114
120
|
port: BoxedMessagePort;
|
|
115
121
|
} & {
|
|
116
122
|
[UnderlyingType]: (...args: Parameters<T>) => Promise<Awaited<ReturnType<T>>>;
|
|
117
123
|
};
|
|
118
124
|
|
|
119
|
-
declare type BoxedMessagePort<T extends StructurableTransferable = StructurableTransferable> = BoxBase<typeof
|
|
125
|
+
declare type BoxedMessagePort<T extends StructurableTransferable = StructurableTransferable> = BoxBase<typeof type_8> & ({
|
|
120
126
|
portId: string;
|
|
121
127
|
} | {
|
|
122
128
|
port: StrictMessagePort<T>;
|
|
@@ -126,14 +132,14 @@ declare type BoxedMessagePort<T extends StructurableTransferable = StructurableT
|
|
|
126
132
|
|
|
127
133
|
declare type BoxedPromise<T extends Capable = Capable> = {
|
|
128
134
|
__OSRA_BOX__: 'revivable';
|
|
129
|
-
type: typeof
|
|
130
|
-
port: ReturnType<typeof
|
|
135
|
+
type: typeof type_6;
|
|
136
|
+
port: ReturnType<typeof box_6>;
|
|
131
137
|
[UnderlyingType]: T;
|
|
132
138
|
};
|
|
133
139
|
|
|
134
140
|
declare type BoxedReadableStream<T extends ReadableStream = ReadableStream> = {
|
|
135
141
|
__OSRA_BOX__: 'revivable';
|
|
136
|
-
type: typeof
|
|
142
|
+
type: typeof type_9;
|
|
137
143
|
port: BoxedMessagePort;
|
|
138
144
|
[UnderlyingType]: T;
|
|
139
145
|
};
|
|
@@ -190,7 +196,7 @@ declare namespace date {
|
|
|
190
196
|
|
|
191
197
|
declare type DefaultRevivableModules = typeof defaultRevivableModules;
|
|
192
198
|
|
|
193
|
-
declare const defaultRevivableModules: readonly [typeof arrayBuffer, typeof date, typeof error, typeof typedArray, typeof promise, typeof func, typeof messagePort, typeof readableStream];
|
|
199
|
+
declare const defaultRevivableModules: readonly [typeof arrayBuffer, typeof date, typeof headers, typeof error, typeof typedArray, typeof promise, typeof func, typeof messagePort, typeof readableStream];
|
|
194
200
|
|
|
195
201
|
declare type EmitJsonPlatformTransport = WebSocket | WebExtPort;
|
|
196
202
|
|
|
@@ -198,10 +204,10 @@ declare type EmitPlatformTransport = EmitJsonPlatformTransport | Window | Servic
|
|
|
198
204
|
|
|
199
205
|
declare namespace error {
|
|
200
206
|
export {
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
207
|
+
type_4 as type,
|
|
208
|
+
isType_4 as isType,
|
|
209
|
+
box_4 as box,
|
|
210
|
+
revive_4 as revive
|
|
205
211
|
}
|
|
206
212
|
}
|
|
207
213
|
|
|
@@ -236,12 +242,21 @@ declare type ExtractType<T> = T extends {
|
|
|
236
242
|
|
|
237
243
|
declare namespace func {
|
|
238
244
|
export {
|
|
239
|
-
|
|
245
|
+
type_7 as type,
|
|
240
246
|
CallContext,
|
|
241
247
|
BoxedFunction,
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
248
|
+
isType_7 as isType,
|
|
249
|
+
box_8 as box,
|
|
250
|
+
revive_7 as revive
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
declare namespace headers {
|
|
255
|
+
export {
|
|
256
|
+
type_3 as type,
|
|
257
|
+
isType_3 as isType,
|
|
258
|
+
box_3 as box,
|
|
259
|
+
revive_3 as revive
|
|
245
260
|
}
|
|
246
261
|
}
|
|
247
262
|
|
|
@@ -253,17 +268,19 @@ declare const isType: (value: unknown) => value is ArrayBuffer;
|
|
|
253
268
|
|
|
254
269
|
declare const isType_2: (value: unknown) => value is Date;
|
|
255
270
|
|
|
256
|
-
declare const isType_3: (value: unknown) => value is
|
|
271
|
+
declare const isType_3: (value: unknown) => value is Headers;
|
|
272
|
+
|
|
273
|
+
declare const isType_4: (value: unknown) => value is Error;
|
|
257
274
|
|
|
258
|
-
declare const
|
|
275
|
+
declare const isType_5: (value: unknown) => value is TypedArray;
|
|
259
276
|
|
|
260
|
-
declare const
|
|
277
|
+
declare const isType_6: (value: unknown) => value is Promise<any>;
|
|
261
278
|
|
|
262
|
-
declare const
|
|
279
|
+
declare const isType_7: (value: unknown) => value is (...args: any[]) => any;
|
|
263
280
|
|
|
264
|
-
declare const
|
|
281
|
+
declare const isType_8: (value: unknown) => value is MessagePort;
|
|
265
282
|
|
|
266
|
-
declare const
|
|
283
|
+
declare const isType_9: (value: unknown) => value is ReadableStream;
|
|
267
284
|
|
|
268
285
|
declare type Jsonable = boolean | null | number | string | {
|
|
269
286
|
[key: string]: Jsonable;
|
|
@@ -322,11 +339,11 @@ declare type MessageEventTarget_2 = TypedEventTarget<MessageEventMap>;
|
|
|
322
339
|
|
|
323
340
|
declare namespace messagePort {
|
|
324
341
|
export {
|
|
325
|
-
|
|
342
|
+
type_8 as type,
|
|
326
343
|
BoxedMessagePort,
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
344
|
+
isType_8 as isType,
|
|
345
|
+
box_6 as box,
|
|
346
|
+
revive_8 as revive
|
|
330
347
|
}
|
|
331
348
|
}
|
|
332
349
|
|
|
@@ -346,12 +363,12 @@ declare type PlatformTransport = EmitPlatformTransport | ReceivePlatformTranspor
|
|
|
346
363
|
|
|
347
364
|
declare namespace promise {
|
|
348
365
|
export {
|
|
349
|
-
|
|
366
|
+
type_6 as type,
|
|
350
367
|
Context,
|
|
351
368
|
BoxedPromise,
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
369
|
+
isType_6 as isType,
|
|
370
|
+
box_7 as box,
|
|
371
|
+
revive_6 as revive
|
|
355
372
|
}
|
|
356
373
|
}
|
|
357
374
|
|
|
@@ -374,12 +391,12 @@ declare type PullContext = {
|
|
|
374
391
|
|
|
375
392
|
declare namespace readableStream {
|
|
376
393
|
export {
|
|
377
|
-
|
|
394
|
+
type_9 as type,
|
|
378
395
|
PullContext,
|
|
379
396
|
BoxedReadableStream,
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
397
|
+
isType_9 as isType,
|
|
398
|
+
box_9 as box,
|
|
399
|
+
revive_9 as revive
|
|
383
400
|
}
|
|
384
401
|
}
|
|
385
402
|
|
|
@@ -409,17 +426,19 @@ declare const revive: <T extends ReturnType<typeof box>, T2 extends RevivableCon
|
|
|
409
426
|
|
|
410
427
|
declare const revive_2: <T extends ReturnType<typeof box_2>, T2 extends RevivableContext>(value: T, _context: T2) => Date;
|
|
411
428
|
|
|
412
|
-
declare const revive_3: <T extends ReturnType<typeof box_3>, T2 extends RevivableContext>(value: T, _context: T2) =>
|
|
429
|
+
declare const revive_3: <T extends ReturnType<typeof box_3>, T2 extends RevivableContext>(value: T, _context: T2) => Headers;
|
|
413
430
|
|
|
414
|
-
declare const revive_4: <T extends ReturnType<typeof box_4>, T2 extends RevivableContext>(value: T,
|
|
431
|
+
declare const revive_4: <T extends ReturnType<typeof box_4>, T2 extends RevivableContext>(value: T, _context: T2) => Error;
|
|
415
432
|
|
|
416
|
-
declare const revive_5: <T extends
|
|
433
|
+
declare const revive_5: <T extends ReturnType<typeof box_5>, T2 extends RevivableContext>(value: T, context: T2) => T[UnderlyingType];
|
|
417
434
|
|
|
418
|
-
declare const revive_6: <T extends
|
|
435
|
+
declare const revive_6: <T extends BoxedPromise, T2 extends RevivableContext>(value: T, context: T2) => Promise<T[typeof UnderlyingType]>;
|
|
419
436
|
|
|
420
|
-
declare const revive_7: <T extends
|
|
437
|
+
declare const revive_7: <T extends BoxedFunction, T2 extends RevivableContext>(value: T, context: T2) => T[UnderlyingType];
|
|
421
438
|
|
|
422
|
-
declare const revive_8: <T extends
|
|
439
|
+
declare const revive_8: <T extends StructurableTransferable, T2 extends RevivableContext>(value: BoxedMessagePort<T>, context: T2) => StrictMessagePort<T>;
|
|
440
|
+
|
|
441
|
+
declare const revive_9: <T extends BoxedReadableStream, T2 extends RevivableContext>(value: T, context: T2) => T[UnderlyingType];
|
|
423
442
|
|
|
424
443
|
/**
|
|
425
444
|
* A type-safe MessagePort wrapper that provides generic typing for messages.
|
|
@@ -465,31 +484,33 @@ declare const type: "arrayBuffer";
|
|
|
465
484
|
|
|
466
485
|
declare const type_2: "date";
|
|
467
486
|
|
|
468
|
-
declare const type_3: "
|
|
487
|
+
declare const type_3: "headers";
|
|
488
|
+
|
|
489
|
+
declare const type_4: "error";
|
|
469
490
|
|
|
470
|
-
declare const
|
|
491
|
+
declare const type_5: "typedArray";
|
|
471
492
|
|
|
472
|
-
declare const
|
|
493
|
+
declare const type_6: "promise";
|
|
473
494
|
|
|
474
|
-
declare const
|
|
495
|
+
declare const type_7: "function";
|
|
475
496
|
|
|
476
|
-
declare const
|
|
497
|
+
declare const type_8: "messagePort";
|
|
477
498
|
|
|
478
|
-
declare const
|
|
499
|
+
declare const type_9: "readableStream";
|
|
479
500
|
|
|
480
501
|
declare type TypedArray = typeof typedArrays[number];
|
|
481
502
|
|
|
482
503
|
declare namespace typedArray {
|
|
483
504
|
export {
|
|
484
|
-
|
|
505
|
+
type_5 as type,
|
|
485
506
|
TypedArrayConstructor,
|
|
486
507
|
TypedArray,
|
|
487
508
|
typedArrayToType,
|
|
488
509
|
TypedArrayType,
|
|
489
510
|
typedArrayTypeToTypedArrayConstructor,
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
511
|
+
isType_5 as isType,
|
|
512
|
+
box_5 as box,
|
|
513
|
+
revive_5 as revive
|
|
493
514
|
}
|
|
494
515
|
}
|
|
495
516
|
|