kkrpc 0.2.1 → 0.2.2

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/README.md CHANGED
@@ -58,6 +58,34 @@ class RPCChannel<
58
58
  > {}
59
59
  ```
60
60
 
61
+ ## Serialization
62
+
63
+ kkrpc supports two serialization formats for message transmission:
64
+
65
+ - `json`: Standard JSON serialization
66
+ - `superjson`: Enhanced JSON serialization with support for more data types like Date, Map, Set, BigInt, and Uint8Array (default since v0.2.0)
67
+
68
+ You can specify the serialization format when creating a new RPCChannel:
69
+
70
+ ```ts
71
+ // Using default serialization (superjson)
72
+ const rpc = new RPCChannel(io, { expose: apiImplementation })
73
+
74
+ // Explicitly using superjson serialization (recommended for clarity)
75
+ const rpc = new RPCChannel(io, {
76
+ expose: apiImplementation,
77
+ serialization: { version: "superjson" }
78
+ })
79
+
80
+ // Using standard JSON serialization (for backward compatibility)
81
+ const rpc = new RPCChannel(io, {
82
+ expose: apiImplementation,
83
+ serialization: { version: "json" }
84
+ })
85
+ ```
86
+
87
+ For backward compatibility, the receiving side will automatically detect the serialization format so older clients can communicate with newer servers and vice versa.
88
+
61
89
  ## Examples
62
90
 
63
91
  Below are simple examples.
@@ -39,10 +39,8 @@ __export(browser_mod_exports, {
39
39
  WorkerChildIO: () => WorkerChildIO,
40
40
  WorkerParentIO: () => WorkerParentIO,
41
41
  deserializeMessage: () => deserializeMessage,
42
- deserializeResponse: () => deserializeResponse,
43
42
  generateUUID: () => generateUUID,
44
- serializeMessage: () => serializeMessage,
45
- serializeResponse: () => serializeResponse
43
+ serializeMessage: () => serializeMessage
46
44
  });
47
45
  module.exports = __toCommonJS(browser_mod_exports);
48
46
 
@@ -369,30 +367,39 @@ var import_node_buffer = require("buffer");
369
367
 
370
368
  // src/serialization.ts
371
369
  var import_superjson = __toESM(require("superjson"), 1);
372
- function serializeMessage(message) {
373
- return import_superjson.default.stringify(message) + "\n";
370
+ function replacer(key, value) {
371
+ if (value instanceof Uint8Array) {
372
+ return {
373
+ type: "Uint8Array",
374
+ data: Array.from(value)
375
+ // Convert to regular array
376
+ };
377
+ }
378
+ return value;
374
379
  }
375
- function deserializeMessage(message) {
376
- return new Promise((resolve, reject) => {
377
- try {
378
- const parsed = import_superjson.default.parse(message);
379
- resolve(parsed);
380
- } catch (error) {
381
- console.error("failed to parse message", typeof message, message, error);
382
- reject(error);
383
- }
384
- });
380
+ function reviver(key, value) {
381
+ if (value && value.type === "Uint8Array" && Array.isArray(value.data)) {
382
+ return new Uint8Array(value.data);
383
+ }
384
+ return value;
385
385
  }
386
- function serializeResponse(response) {
387
- return import_superjson.default.stringify(response) + "\n";
386
+ function serializeMessage(message, options = {}) {
387
+ const version = options.version || "superjson";
388
+ const msgWithVersion = { ...message, version };
389
+ return version === "json" ? JSON.stringify(msgWithVersion, replacer) + "\n" : import_superjson.default.stringify(msgWithVersion) + "\n";
388
390
  }
389
- function deserializeResponse(response) {
391
+ function deserializeMessage(message) {
390
392
  return new Promise((resolve, reject) => {
391
393
  try {
392
- const parsed = import_superjson.default.parse(response);
393
- resolve(parsed);
394
+ if (message.startsWith('{"json":')) {
395
+ const parsed = import_superjson.default.parse(message);
396
+ resolve(parsed);
397
+ } else {
398
+ const parsed = JSON.parse(message, reviver);
399
+ resolve(parsed);
400
+ }
394
401
  } catch (error) {
395
- console.error("failed to parse response", response);
402
+ console.error("failed to parse message", typeof message, message, error);
396
403
  reject(error);
397
404
  }
398
405
  });
@@ -408,6 +415,7 @@ var RPCChannel = class {
408
415
  constructor(io, options) {
409
416
  this.io = io;
410
417
  this.apiImplementation = options?.expose;
418
+ this.serializationOptions = options?.serialization || {};
411
419
  this.listen();
412
420
  }
413
421
  pendingRequests = {};
@@ -416,6 +424,7 @@ var RPCChannel = class {
416
424
  count = 0;
417
425
  messageStr = "";
418
426
  apiImplementation;
427
+ serializationOptions;
419
428
  /**
420
429
  * Exposes a local API implementation that can be called remotely
421
430
  * @param api The local API implementation to expose
@@ -462,7 +471,7 @@ var RPCChannel = class {
462
471
  /**
463
472
  * Handles a single message string by parsing and routing it
464
473
  * @param messageStr The message string to handle
465
- * @private
474
+ * @private
466
475
  */
467
476
  async handleMessageStr(messageStr) {
468
477
  this.count++;
@@ -512,7 +521,7 @@ var RPCChannel = class {
512
521
  type: "request",
513
522
  callbackIds: callbackIds.length > 0 ? callbackIds : void 0
514
523
  };
515
- this.io.write(serializeMessage(message));
524
+ this.io.write(serializeMessage(message, this.serializationOptions));
516
525
  });
517
526
  }
518
527
  /**
@@ -586,7 +595,7 @@ var RPCChannel = class {
586
595
  args,
587
596
  type: "callback"
588
597
  };
589
- this.io.write(serializeMessage(message));
598
+ this.io.write(serializeMessage(message, this.serializationOptions));
590
599
  }
591
600
  /**
592
601
  * Handles callback invocations received from the remote endpoint
@@ -615,7 +624,7 @@ var RPCChannel = class {
615
624
  args: { result },
616
625
  type: "response"
617
626
  };
618
- this.io.write(serializeMessage(response));
627
+ this.io.write(serializeMessage(response, this.serializationOptions));
619
628
  }
620
629
  /**
621
630
  * Sends an error response back to the remote endpoint
@@ -630,7 +639,7 @@ var RPCChannel = class {
630
639
  args: { error },
631
640
  type: "response"
632
641
  };
633
- this.io.write(serializeMessage(response));
642
+ this.io.write(serializeMessage(response, this.serializationOptions));
634
643
  }
635
644
  /**
636
645
  * Creates a nested proxy object for chaining remote method calls
@@ -681,8 +690,6 @@ var RPCChannel = class {
681
690
  WorkerChildIO,
682
691
  WorkerParentIO,
683
692
  deserializeMessage,
684
- deserializeResponse,
685
693
  generateUUID,
686
- serializeMessage,
687
- serializeResponse
694
+ serializeMessage
688
695
  });
@@ -1,7 +1,7 @@
1
- export { T as TauriShellStdio, a as WorkerChildIO, W as WorkerParentIO } from './tauri-CRNRbu3f.cjs';
2
- export { ChromeBackgroundIO, ChromeContentIO, Message, Response, deserializeMessage, deserializeResponse, generateUUID, serializeMessage, serializeResponse } from './chrome.cjs';
3
- import { D as DestroyableIoInterface } from './channel-D6ZClufP.cjs';
4
- export { I as IoInterface, R as RPCChannel } from './channel-D6ZClufP.cjs';
1
+ export { T as TauriShellStdio, a as WorkerChildIO, W as WorkerParentIO } from './tauri-ohph68oo.cjs';
2
+ export { ChromeBackgroundIO, ChromeContentIO, generateUUID } from './chrome.cjs';
3
+ import { D as DestroyableIoInterface } from './channel-C01VCxab.cjs';
4
+ export { I as IoInterface, M as Message, R as RPCChannel, a as Response, S as SerializationOptions, d as deserializeMessage, s as serializeMessage } from './channel-C01VCxab.cjs';
5
5
  import '@tauri-apps/plugin-shell';
6
6
  import 'node:buffer';
7
7
 
@@ -1,7 +1,7 @@
1
- export { T as TauriShellStdio, a as WorkerChildIO, W as WorkerParentIO } from './tauri-PdcZTVUI.js';
2
- export { ChromeBackgroundIO, ChromeContentIO, Message, Response, deserializeMessage, deserializeResponse, generateUUID, serializeMessage, serializeResponse } from './chrome.js';
3
- import { D as DestroyableIoInterface } from './channel-D6ZClufP.js';
4
- export { I as IoInterface, R as RPCChannel } from './channel-D6ZClufP.js';
1
+ export { T as TauriShellStdio, a as WorkerChildIO, W as WorkerParentIO } from './tauri-pC0wuvjw.js';
2
+ export { ChromeBackgroundIO, ChromeContentIO, generateUUID } from './chrome.js';
3
+ import { D as DestroyableIoInterface } from './channel-C01VCxab.js';
4
+ export { I as IoInterface, M as Message, R as RPCChannel, a as Response, S as SerializationOptions, d as deserializeMessage, s as serializeMessage } from './channel-C01VCxab.js';
5
5
  import '@tauri-apps/plugin-shell';
6
6
  import 'node:buffer';
7
7
 
@@ -10,11 +10,9 @@ import {
10
10
  import {
11
11
  RPCChannel,
12
12
  deserializeMessage,
13
- deserializeResponse,
14
13
  generateUUID,
15
- serializeMessage,
16
- serializeResponse
17
- } from "./chunk-ZSSFWNSX.js";
14
+ serializeMessage
15
+ } from "./chunk-YIQVRWAJ.js";
18
16
 
19
17
  // src/adapters/iframe.ts
20
18
  var DESTROY_SIGNAL = "__DESTROY__";
@@ -159,8 +157,6 @@ export {
159
157
  WorkerChildIO,
160
158
  WorkerParentIO,
161
159
  deserializeMessage,
162
- deserializeResponse,
163
160
  generateUUID,
164
- serializeMessage,
165
- serializeResponse
161
+ serializeMessage
166
162
  };
@@ -21,6 +21,38 @@ interface DestroyableIoInterface extends IoInterface {
21
21
  signalDestroy(): void;
22
22
  }
23
23
 
24
+ /**
25
+ * This file contains the serialization and deserialization functions for the RPC protocol.
26
+ */
27
+ interface Message<T = any> {
28
+ id: string;
29
+ method: string;
30
+ args: T;
31
+ type: "request" | "response" | "callback";
32
+ callbackIds?: string[];
33
+ version?: "json" | "superjson";
34
+ }
35
+ interface Response<T = any> {
36
+ result?: T;
37
+ error?: string;
38
+ }
39
+ interface SerializationOptions {
40
+ version?: "json" | "superjson";
41
+ }
42
+ /**
43
+ * Serialize a message with superjson (supports all data types supported by superjson)
44
+ * @param message - The message to serialize, an object of any shape
45
+ * @param options - Serialization options, default to use superjson
46
+ * @returns The serialized message
47
+ */
48
+ declare function serializeMessage<T>(message: Message<T>, options?: SerializationOptions): string;
49
+ /**
50
+ * Deserialize a message with superjson (supports all data types supported by superjson)
51
+ * @param message - The serialized message
52
+ * @returns The deserialized message
53
+ */
54
+ declare function deserializeMessage<T>(message: string): Promise<Message<T>>;
55
+
24
56
  /**
25
57
  * A bidirectional Stdio IPC channel in RPC style.
26
58
  * This allows 2 JS/TS processes to call each other's API like using libraries in RPC style,
@@ -34,8 +66,10 @@ declare class RPCChannel<LocalAPI extends Record<string, any>, RemoteAPI extends
34
66
  private count;
35
67
  private messageStr;
36
68
  private apiImplementation?;
69
+ private serializationOptions;
37
70
  constructor(io: Io, options?: {
38
71
  expose?: LocalAPI;
72
+ serialization?: SerializationOptions;
39
73
  });
40
74
  /**
41
75
  * Exposes a local API implementation that can be called remotely
@@ -125,4 +159,4 @@ declare class RPCChannel<LocalAPI extends Record<string, any>, RemoteAPI extends
125
159
  freeCallbacks(): void;
126
160
  }
127
161
 
128
- export { type DestroyableIoInterface as D, type IoInterface as I, RPCChannel as R };
162
+ export { type DestroyableIoInterface as D, type IoInterface as I, type Message as M, RPCChannel as R, type SerializationOptions as S, type Response as a, deserializeMessage as d, serializeMessage as s };
@@ -21,6 +21,38 @@ interface DestroyableIoInterface extends IoInterface {
21
21
  signalDestroy(): void;
22
22
  }
23
23
 
24
+ /**
25
+ * This file contains the serialization and deserialization functions for the RPC protocol.
26
+ */
27
+ interface Message<T = any> {
28
+ id: string;
29
+ method: string;
30
+ args: T;
31
+ type: "request" | "response" | "callback";
32
+ callbackIds?: string[];
33
+ version?: "json" | "superjson";
34
+ }
35
+ interface Response<T = any> {
36
+ result?: T;
37
+ error?: string;
38
+ }
39
+ interface SerializationOptions {
40
+ version?: "json" | "superjson";
41
+ }
42
+ /**
43
+ * Serialize a message with superjson (supports all data types supported by superjson)
44
+ * @param message - The message to serialize, an object of any shape
45
+ * @param options - Serialization options, default to use superjson
46
+ * @returns The serialized message
47
+ */
48
+ declare function serializeMessage<T>(message: Message<T>, options?: SerializationOptions): string;
49
+ /**
50
+ * Deserialize a message with superjson (supports all data types supported by superjson)
51
+ * @param message - The serialized message
52
+ * @returns The deserialized message
53
+ */
54
+ declare function deserializeMessage<T>(message: string): Promise<Message<T>>;
55
+
24
56
  /**
25
57
  * A bidirectional Stdio IPC channel in RPC style.
26
58
  * This allows 2 JS/TS processes to call each other's API like using libraries in RPC style,
@@ -34,8 +66,10 @@ declare class RPCChannel<LocalAPI extends Record<string, any>, RemoteAPI extends
34
66
  private count;
35
67
  private messageStr;
36
68
  private apiImplementation?;
69
+ private serializationOptions;
37
70
  constructor(io: Io, options?: {
38
71
  expose?: LocalAPI;
72
+ serialization?: SerializationOptions;
39
73
  });
40
74
  /**
41
75
  * Exposes a local API implementation that can be called remotely
@@ -125,4 +159,4 @@ declare class RPCChannel<LocalAPI extends Record<string, any>, RemoteAPI extends
125
159
  freeCallbacks(): void;
126
160
  }
127
161
 
128
- export { type DestroyableIoInterface as D, type IoInterface as I, RPCChannel as R };
162
+ export { type DestroyableIoInterface as D, type IoInterface as I, type Message as M, RPCChannel as R, type SerializationOptions as S, type Response as a, deserializeMessage as d, serializeMessage as s };
package/dist/chrome.cjs CHANGED
@@ -34,10 +34,8 @@ __export(chrome_exports, {
34
34
  ChromeContentIO: () => ChromeContentIO,
35
35
  RPCChannel: () => RPCChannel,
36
36
  deserializeMessage: () => deserializeMessage,
37
- deserializeResponse: () => deserializeResponse,
38
37
  generateUUID: () => generateUUID,
39
- serializeMessage: () => serializeMessage,
40
- serializeResponse: () => serializeResponse
38
+ serializeMessage: () => serializeMessage
41
39
  });
42
40
  module.exports = __toCommonJS(chrome_exports);
43
41
 
@@ -126,30 +124,39 @@ var import_node_buffer = require("buffer");
126
124
 
127
125
  // src/serialization.ts
128
126
  var import_superjson = __toESM(require("superjson"), 1);
129
- function serializeMessage(message) {
130
- return import_superjson.default.stringify(message) + "\n";
127
+ function replacer(key, value) {
128
+ if (value instanceof Uint8Array) {
129
+ return {
130
+ type: "Uint8Array",
131
+ data: Array.from(value)
132
+ // Convert to regular array
133
+ };
134
+ }
135
+ return value;
131
136
  }
132
- function deserializeMessage(message) {
133
- return new Promise((resolve, reject) => {
134
- try {
135
- const parsed = import_superjson.default.parse(message);
136
- resolve(parsed);
137
- } catch (error) {
138
- console.error("failed to parse message", typeof message, message, error);
139
- reject(error);
140
- }
141
- });
137
+ function reviver(key, value) {
138
+ if (value && value.type === "Uint8Array" && Array.isArray(value.data)) {
139
+ return new Uint8Array(value.data);
140
+ }
141
+ return value;
142
142
  }
143
- function serializeResponse(response) {
144
- return import_superjson.default.stringify(response) + "\n";
143
+ function serializeMessage(message, options = {}) {
144
+ const version = options.version || "superjson";
145
+ const msgWithVersion = { ...message, version };
146
+ return version === "json" ? JSON.stringify(msgWithVersion, replacer) + "\n" : import_superjson.default.stringify(msgWithVersion) + "\n";
145
147
  }
146
- function deserializeResponse(response) {
148
+ function deserializeMessage(message) {
147
149
  return new Promise((resolve, reject) => {
148
150
  try {
149
- const parsed = import_superjson.default.parse(response);
150
- resolve(parsed);
151
+ if (message.startsWith('{"json":')) {
152
+ const parsed = import_superjson.default.parse(message);
153
+ resolve(parsed);
154
+ } else {
155
+ const parsed = JSON.parse(message, reviver);
156
+ resolve(parsed);
157
+ }
151
158
  } catch (error) {
152
- console.error("failed to parse response", response);
159
+ console.error("failed to parse message", typeof message, message, error);
153
160
  reject(error);
154
161
  }
155
162
  });
@@ -165,6 +172,7 @@ var RPCChannel = class {
165
172
  constructor(io, options) {
166
173
  this.io = io;
167
174
  this.apiImplementation = options?.expose;
175
+ this.serializationOptions = options?.serialization || {};
168
176
  this.listen();
169
177
  }
170
178
  pendingRequests = {};
@@ -173,6 +181,7 @@ var RPCChannel = class {
173
181
  count = 0;
174
182
  messageStr = "";
175
183
  apiImplementation;
184
+ serializationOptions;
176
185
  /**
177
186
  * Exposes a local API implementation that can be called remotely
178
187
  * @param api The local API implementation to expose
@@ -219,7 +228,7 @@ var RPCChannel = class {
219
228
  /**
220
229
  * Handles a single message string by parsing and routing it
221
230
  * @param messageStr The message string to handle
222
- * @private
231
+ * @private
223
232
  */
224
233
  async handleMessageStr(messageStr) {
225
234
  this.count++;
@@ -269,7 +278,7 @@ var RPCChannel = class {
269
278
  type: "request",
270
279
  callbackIds: callbackIds.length > 0 ? callbackIds : void 0
271
280
  };
272
- this.io.write(serializeMessage(message));
281
+ this.io.write(serializeMessage(message, this.serializationOptions));
273
282
  });
274
283
  }
275
284
  /**
@@ -343,7 +352,7 @@ var RPCChannel = class {
343
352
  args,
344
353
  type: "callback"
345
354
  };
346
- this.io.write(serializeMessage(message));
355
+ this.io.write(serializeMessage(message, this.serializationOptions));
347
356
  }
348
357
  /**
349
358
  * Handles callback invocations received from the remote endpoint
@@ -372,7 +381,7 @@ var RPCChannel = class {
372
381
  args: { result },
373
382
  type: "response"
374
383
  };
375
- this.io.write(serializeMessage(response));
384
+ this.io.write(serializeMessage(response, this.serializationOptions));
376
385
  }
377
386
  /**
378
387
  * Sends an error response back to the remote endpoint
@@ -387,7 +396,7 @@ var RPCChannel = class {
387
396
  args: { error },
388
397
  type: "response"
389
398
  };
390
- this.io.write(serializeMessage(response));
399
+ this.io.write(serializeMessage(response, this.serializationOptions));
391
400
  }
392
401
  /**
393
402
  * Creates a nested proxy object for chaining remote method calls
@@ -433,8 +442,6 @@ var RPCChannel = class {
433
442
  ChromeContentIO,
434
443
  RPCChannel,
435
444
  deserializeMessage,
436
- deserializeResponse,
437
445
  generateUUID,
438
- serializeMessage,
439
- serializeResponse
446
+ serializeMessage
440
447
  });
package/dist/chrome.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { D as DestroyableIoInterface } from './channel-D6ZClufP.cjs';
2
- export { I as IoInterface, R as RPCChannel } from './channel-D6ZClufP.cjs';
1
+ import { D as DestroyableIoInterface } from './channel-C01VCxab.cjs';
2
+ export { I as IoInterface, M as Message, R as RPCChannel, a as Response, S as SerializationOptions, d as deserializeMessage, s as serializeMessage } from './channel-C01VCxab.cjs';
3
3
  import 'node:buffer';
4
4
 
5
5
  /**
@@ -40,43 +40,4 @@ declare class ChromeContentIO implements DestroyableIoInterface {
40
40
  */
41
41
  declare function generateUUID(): string;
42
42
 
43
- /**
44
- * This file contains the serialization and deserialization functions for the RPC protocol.
45
- */
46
- interface Message<T = any> {
47
- id: string;
48
- method: string;
49
- args: T;
50
- type: "request" | "response" | "callback";
51
- callbackIds?: string[];
52
- }
53
- interface Response<T = any> {
54
- result?: T;
55
- error?: string;
56
- }
57
- /**
58
- * Serialize a message with superjson (supports all data types supported by superjson)
59
- * @param message - The message to serialize, an object of any shape
60
- * @returns The serialized message
61
- */
62
- declare function serializeMessage<T>(message: Message<T>): string;
63
- /**
64
- * Deserialize a message with superjson (supports all data types supported by superjson)
65
- * @param message - The serialized message
66
- * @returns The deserialized message
67
- */
68
- declare function deserializeMessage<T>(message: string): Promise<Message<T>>;
69
- /**
70
- * Serialize a response with JSON (only supports primitive types)
71
- * @param response - The response to serialize, an object of primitive types
72
- * @returns The serialized response
73
- */
74
- declare function serializeResponse<T>(response: Response<T>): string;
75
- /**
76
- * Deserialize a response with superjson (supports all data types supported by superjson)
77
- * @param response - The serialized response
78
- * @returns The deserialized response
79
- */
80
- declare function deserializeResponse<T>(response: string): Promise<Response<T>>;
81
-
82
- export { ChromeBackgroundIO, ChromeContentIO, DestroyableIoInterface, type Message, type Response, deserializeMessage, deserializeResponse, generateUUID, serializeMessage, serializeResponse };
43
+ export { ChromeBackgroundIO, ChromeContentIO, DestroyableIoInterface, generateUUID };
package/dist/chrome.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { D as DestroyableIoInterface } from './channel-D6ZClufP.js';
2
- export { I as IoInterface, R as RPCChannel } from './channel-D6ZClufP.js';
1
+ import { D as DestroyableIoInterface } from './channel-C01VCxab.js';
2
+ export { I as IoInterface, M as Message, R as RPCChannel, a as Response, S as SerializationOptions, d as deserializeMessage, s as serializeMessage } from './channel-C01VCxab.js';
3
3
  import 'node:buffer';
4
4
 
5
5
  /**
@@ -40,43 +40,4 @@ declare class ChromeContentIO implements DestroyableIoInterface {
40
40
  */
41
41
  declare function generateUUID(): string;
42
42
 
43
- /**
44
- * This file contains the serialization and deserialization functions for the RPC protocol.
45
- */
46
- interface Message<T = any> {
47
- id: string;
48
- method: string;
49
- args: T;
50
- type: "request" | "response" | "callback";
51
- callbackIds?: string[];
52
- }
53
- interface Response<T = any> {
54
- result?: T;
55
- error?: string;
56
- }
57
- /**
58
- * Serialize a message with superjson (supports all data types supported by superjson)
59
- * @param message - The message to serialize, an object of any shape
60
- * @returns The serialized message
61
- */
62
- declare function serializeMessage<T>(message: Message<T>): string;
63
- /**
64
- * Deserialize a message with superjson (supports all data types supported by superjson)
65
- * @param message - The serialized message
66
- * @returns The deserialized message
67
- */
68
- declare function deserializeMessage<T>(message: string): Promise<Message<T>>;
69
- /**
70
- * Serialize a response with JSON (only supports primitive types)
71
- * @param response - The response to serialize, an object of primitive types
72
- * @returns The serialized response
73
- */
74
- declare function serializeResponse<T>(response: Response<T>): string;
75
- /**
76
- * Deserialize a response with superjson (supports all data types supported by superjson)
77
- * @param response - The serialized response
78
- * @returns The deserialized response
79
- */
80
- declare function deserializeResponse<T>(response: string): Promise<Response<T>>;
81
-
82
- export { ChromeBackgroundIO, ChromeContentIO, DestroyableIoInterface, type Message, type Response, deserializeMessage, deserializeResponse, generateUUID, serializeMessage, serializeResponse };
43
+ export { ChromeBackgroundIO, ChromeContentIO, DestroyableIoInterface, generateUUID };
package/dist/chrome.js CHANGED
@@ -5,18 +5,14 @@ import {
5
5
  import {
6
6
  RPCChannel,
7
7
  deserializeMessage,
8
- deserializeResponse,
9
8
  generateUUID,
10
- serializeMessage,
11
- serializeResponse
12
- } from "./chunk-ZSSFWNSX.js";
9
+ serializeMessage
10
+ } from "./chunk-YIQVRWAJ.js";
13
11
  export {
14
12
  ChromeBackgroundIO,
15
13
  ChromeContentIO,
16
14
  RPCChannel,
17
15
  deserializeMessage,
18
- deserializeResponse,
19
16
  generateUUID,
20
- serializeMessage,
21
- serializeResponse
17
+ serializeMessage
22
18
  };
@@ -1,29 +1,38 @@
1
1
  // src/serialization.ts
2
2
  import superjson from "superjson";
3
- function serializeMessage(message) {
4
- return superjson.stringify(message) + "\n";
3
+ function replacer(key, value) {
4
+ if (value instanceof Uint8Array) {
5
+ return {
6
+ type: "Uint8Array",
7
+ data: Array.from(value)
8
+ // Convert to regular array
9
+ };
10
+ }
11
+ return value;
5
12
  }
6
- function deserializeMessage(message) {
7
- return new Promise((resolve, reject) => {
8
- try {
9
- const parsed = superjson.parse(message);
10
- resolve(parsed);
11
- } catch (error) {
12
- console.error("failed to parse message", typeof message, message, error);
13
- reject(error);
14
- }
15
- });
13
+ function reviver(key, value) {
14
+ if (value && value.type === "Uint8Array" && Array.isArray(value.data)) {
15
+ return new Uint8Array(value.data);
16
+ }
17
+ return value;
16
18
  }
17
- function serializeResponse(response) {
18
- return superjson.stringify(response) + "\n";
19
+ function serializeMessage(message, options = {}) {
20
+ const version = options.version || "superjson";
21
+ const msgWithVersion = { ...message, version };
22
+ return version === "json" ? JSON.stringify(msgWithVersion, replacer) + "\n" : superjson.stringify(msgWithVersion) + "\n";
19
23
  }
20
- function deserializeResponse(response) {
24
+ function deserializeMessage(message) {
21
25
  return new Promise((resolve, reject) => {
22
26
  try {
23
- const parsed = superjson.parse(response);
24
- resolve(parsed);
27
+ if (message.startsWith('{"json":')) {
28
+ const parsed = superjson.parse(message);
29
+ resolve(parsed);
30
+ } else {
31
+ const parsed = JSON.parse(message, reviver);
32
+ resolve(parsed);
33
+ }
25
34
  } catch (error) {
26
- console.error("failed to parse response", response);
35
+ console.error("failed to parse message", typeof message, message, error);
27
36
  reject(error);
28
37
  }
29
38
  });
@@ -39,6 +48,7 @@ var RPCChannel = class {
39
48
  constructor(io, options) {
40
49
  this.io = io;
41
50
  this.apiImplementation = options?.expose;
51
+ this.serializationOptions = options?.serialization || {};
42
52
  this.listen();
43
53
  }
44
54
  pendingRequests = {};
@@ -47,6 +57,7 @@ var RPCChannel = class {
47
57
  count = 0;
48
58
  messageStr = "";
49
59
  apiImplementation;
60
+ serializationOptions;
50
61
  /**
51
62
  * Exposes a local API implementation that can be called remotely
52
63
  * @param api The local API implementation to expose
@@ -93,7 +104,7 @@ var RPCChannel = class {
93
104
  /**
94
105
  * Handles a single message string by parsing and routing it
95
106
  * @param messageStr The message string to handle
96
- * @private
107
+ * @private
97
108
  */
98
109
  async handleMessageStr(messageStr) {
99
110
  this.count++;
@@ -143,7 +154,7 @@ var RPCChannel = class {
143
154
  type: "request",
144
155
  callbackIds: callbackIds.length > 0 ? callbackIds : void 0
145
156
  };
146
- this.io.write(serializeMessage(message));
157
+ this.io.write(serializeMessage(message, this.serializationOptions));
147
158
  });
148
159
  }
149
160
  /**
@@ -217,7 +228,7 @@ var RPCChannel = class {
217
228
  args,
218
229
  type: "callback"
219
230
  };
220
- this.io.write(serializeMessage(message));
231
+ this.io.write(serializeMessage(message, this.serializationOptions));
221
232
  }
222
233
  /**
223
234
  * Handles callback invocations received from the remote endpoint
@@ -246,7 +257,7 @@ var RPCChannel = class {
246
257
  args: { result },
247
258
  type: "response"
248
259
  };
249
- this.io.write(serializeMessage(response));
260
+ this.io.write(serializeMessage(response, this.serializationOptions));
250
261
  }
251
262
  /**
252
263
  * Sends an error response back to the remote endpoint
@@ -261,7 +272,7 @@ var RPCChannel = class {
261
272
  args: { error },
262
273
  type: "response"
263
274
  };
264
- this.io.write(serializeMessage(response));
275
+ this.io.write(serializeMessage(response, this.serializationOptions));
265
276
  }
266
277
  /**
267
278
  * Creates a nested proxy object for chaining remote method calls
@@ -305,8 +316,6 @@ var RPCChannel = class {
305
316
  export {
306
317
  serializeMessage,
307
318
  deserializeMessage,
308
- serializeResponse,
309
- deserializeResponse,
310
319
  generateUUID,
311
320
  RPCChannel
312
321
  };
package/dist/deno-mod.cjs CHANGED
@@ -61,14 +61,37 @@ var DenoIo = class {
61
61
 
62
62
  // src/serialization.ts
63
63
  var import_superjson = __toESM(require("superjson"), 1);
64
- function serializeMessage(message) {
65
- return import_superjson.default.stringify(message) + "\n";
64
+ function replacer(key, value) {
65
+ if (value instanceof Uint8Array) {
66
+ return {
67
+ type: "Uint8Array",
68
+ data: Array.from(value)
69
+ // Convert to regular array
70
+ };
71
+ }
72
+ return value;
73
+ }
74
+ function reviver(key, value) {
75
+ if (value && value.type === "Uint8Array" && Array.isArray(value.data)) {
76
+ return new Uint8Array(value.data);
77
+ }
78
+ return value;
79
+ }
80
+ function serializeMessage(message, options = {}) {
81
+ const version = options.version || "superjson";
82
+ const msgWithVersion = { ...message, version };
83
+ return version === "json" ? JSON.stringify(msgWithVersion, replacer) + "\n" : import_superjson.default.stringify(msgWithVersion) + "\n";
66
84
  }
67
85
  function deserializeMessage(message) {
68
86
  return new Promise((resolve, reject) => {
69
87
  try {
70
- const parsed = import_superjson.default.parse(message);
71
- resolve(parsed);
88
+ if (message.startsWith('{"json":')) {
89
+ const parsed = import_superjson.default.parse(message);
90
+ resolve(parsed);
91
+ } else {
92
+ const parsed = JSON.parse(message, reviver);
93
+ resolve(parsed);
94
+ }
72
95
  } catch (error) {
73
96
  console.error("failed to parse message", typeof message, message, error);
74
97
  reject(error);
@@ -86,6 +109,7 @@ var RPCChannel = class {
86
109
  constructor(io, options) {
87
110
  this.io = io;
88
111
  this.apiImplementation = options?.expose;
112
+ this.serializationOptions = options?.serialization || {};
89
113
  this.listen();
90
114
  }
91
115
  pendingRequests = {};
@@ -94,6 +118,7 @@ var RPCChannel = class {
94
118
  count = 0;
95
119
  messageStr = "";
96
120
  apiImplementation;
121
+ serializationOptions;
97
122
  /**
98
123
  * Exposes a local API implementation that can be called remotely
99
124
  * @param api The local API implementation to expose
@@ -140,7 +165,7 @@ var RPCChannel = class {
140
165
  /**
141
166
  * Handles a single message string by parsing and routing it
142
167
  * @param messageStr The message string to handle
143
- * @private
168
+ * @private
144
169
  */
145
170
  async handleMessageStr(messageStr) {
146
171
  this.count++;
@@ -190,7 +215,7 @@ var RPCChannel = class {
190
215
  type: "request",
191
216
  callbackIds: callbackIds.length > 0 ? callbackIds : void 0
192
217
  };
193
- this.io.write(serializeMessage(message));
218
+ this.io.write(serializeMessage(message, this.serializationOptions));
194
219
  });
195
220
  }
196
221
  /**
@@ -264,7 +289,7 @@ var RPCChannel = class {
264
289
  args,
265
290
  type: "callback"
266
291
  };
267
- this.io.write(serializeMessage(message));
292
+ this.io.write(serializeMessage(message, this.serializationOptions));
268
293
  }
269
294
  /**
270
295
  * Handles callback invocations received from the remote endpoint
@@ -293,7 +318,7 @@ var RPCChannel = class {
293
318
  args: { result },
294
319
  type: "response"
295
320
  };
296
- this.io.write(serializeMessage(response));
321
+ this.io.write(serializeMessage(response, this.serializationOptions));
297
322
  }
298
323
  /**
299
324
  * Sends an error response back to the remote endpoint
@@ -308,7 +333,7 @@ var RPCChannel = class {
308
333
  args: { error },
309
334
  type: "response"
310
335
  };
311
- this.io.write(serializeMessage(response));
336
+ this.io.write(serializeMessage(response, this.serializationOptions));
312
337
  }
313
338
  /**
314
339
  * Creates a nested proxy object for chaining remote method calls
@@ -1,6 +1,6 @@
1
1
  import { Buffer } from 'node:buffer';
2
- import { I as IoInterface } from './channel-D6ZClufP.cjs';
3
- export { R as RPCChannel } from './channel-D6ZClufP.cjs';
2
+ import { I as IoInterface } from './channel-C01VCxab.cjs';
3
+ export { R as RPCChannel } from './channel-C01VCxab.cjs';
4
4
 
5
5
  /**
6
6
  * Stdio implementation for Deno
@@ -1,6 +1,6 @@
1
1
  import { Buffer } from 'node:buffer';
2
- import { I as IoInterface } from './channel-D6ZClufP.js';
3
- export { R as RPCChannel } from './channel-D6ZClufP.js';
2
+ import { I as IoInterface } from './channel-C01VCxab.js';
3
+ export { R as RPCChannel } from './channel-C01VCxab.js';
4
4
 
5
5
  /**
6
6
  * Stdio implementation for Deno
package/dist/deno-mod.js CHANGED
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-GRCUBSPR.js";
4
4
  import {
5
5
  RPCChannel
6
- } from "./chunk-ZSSFWNSX.js";
6
+ } from "./chunk-YIQVRWAJ.js";
7
7
  export {
8
8
  DenoIo,
9
9
  RPCChannel
@@ -1,4 +1,4 @@
1
- import { I as IoInterface } from './channel-D6ZClufP.cjs';
1
+ import { I as IoInterface } from './channel-C01VCxab.cjs';
2
2
 
3
3
  interface HTTPClientOptions {
4
4
  url: string;
@@ -1,4 +1,4 @@
1
- import { I as IoInterface } from './channel-D6ZClufP.js';
1
+ import { I as IoInterface } from './channel-C01VCxab.js';
2
2
 
3
3
  interface HTTPClientOptions {
4
4
  url: string;
package/dist/http.cjs CHANGED
@@ -130,14 +130,37 @@ var HTTPServerIO = class {
130
130
 
131
131
  // src/serialization.ts
132
132
  var import_superjson2 = __toESM(require("superjson"), 1);
133
- function serializeMessage(message) {
134
- return import_superjson2.default.stringify(message) + "\n";
133
+ function replacer(key, value) {
134
+ if (value instanceof Uint8Array) {
135
+ return {
136
+ type: "Uint8Array",
137
+ data: Array.from(value)
138
+ // Convert to regular array
139
+ };
140
+ }
141
+ return value;
142
+ }
143
+ function reviver(key, value) {
144
+ if (value && value.type === "Uint8Array" && Array.isArray(value.data)) {
145
+ return new Uint8Array(value.data);
146
+ }
147
+ return value;
148
+ }
149
+ function serializeMessage(message, options = {}) {
150
+ const version = options.version || "superjson";
151
+ const msgWithVersion = { ...message, version };
152
+ return version === "json" ? JSON.stringify(msgWithVersion, replacer) + "\n" : import_superjson2.default.stringify(msgWithVersion) + "\n";
135
153
  }
136
154
  function deserializeMessage(message) {
137
155
  return new Promise((resolve, reject) => {
138
156
  try {
139
- const parsed = import_superjson2.default.parse(message);
140
- resolve(parsed);
157
+ if (message.startsWith('{"json":')) {
158
+ const parsed = import_superjson2.default.parse(message);
159
+ resolve(parsed);
160
+ } else {
161
+ const parsed = JSON.parse(message, reviver);
162
+ resolve(parsed);
163
+ }
141
164
  } catch (error) {
142
165
  console.error("failed to parse message", typeof message, message, error);
143
166
  reject(error);
@@ -155,6 +178,7 @@ var RPCChannel = class {
155
178
  constructor(io, options) {
156
179
  this.io = io;
157
180
  this.apiImplementation = options?.expose;
181
+ this.serializationOptions = options?.serialization || {};
158
182
  this.listen();
159
183
  }
160
184
  pendingRequests = {};
@@ -163,6 +187,7 @@ var RPCChannel = class {
163
187
  count = 0;
164
188
  messageStr = "";
165
189
  apiImplementation;
190
+ serializationOptions;
166
191
  /**
167
192
  * Exposes a local API implementation that can be called remotely
168
193
  * @param api The local API implementation to expose
@@ -209,7 +234,7 @@ var RPCChannel = class {
209
234
  /**
210
235
  * Handles a single message string by parsing and routing it
211
236
  * @param messageStr The message string to handle
212
- * @private
237
+ * @private
213
238
  */
214
239
  async handleMessageStr(messageStr) {
215
240
  this.count++;
@@ -259,7 +284,7 @@ var RPCChannel = class {
259
284
  type: "request",
260
285
  callbackIds: callbackIds.length > 0 ? callbackIds : void 0
261
286
  };
262
- this.io.write(serializeMessage(message));
287
+ this.io.write(serializeMessage(message, this.serializationOptions));
263
288
  });
264
289
  }
265
290
  /**
@@ -333,7 +358,7 @@ var RPCChannel = class {
333
358
  args,
334
359
  type: "callback"
335
360
  };
336
- this.io.write(serializeMessage(message));
361
+ this.io.write(serializeMessage(message, this.serializationOptions));
337
362
  }
338
363
  /**
339
364
  * Handles callback invocations received from the remote endpoint
@@ -362,7 +387,7 @@ var RPCChannel = class {
362
387
  args: { result },
363
388
  type: "response"
364
389
  };
365
- this.io.write(serializeMessage(response));
390
+ this.io.write(serializeMessage(response, this.serializationOptions));
366
391
  }
367
392
  /**
368
393
  * Sends an error response back to the remote endpoint
@@ -377,7 +402,7 @@ var RPCChannel = class {
377
402
  args: { error },
378
403
  type: "response"
379
404
  };
380
- this.io.write(serializeMessage(response));
405
+ this.io.write(serializeMessage(response, this.serializationOptions));
381
406
  }
382
407
  /**
383
408
  * Creates a nested proxy object for chaining remote method calls
package/dist/http.d.cts CHANGED
@@ -1,5 +1,5 @@
1
- import { R as RPCChannel, I as IoInterface } from './channel-D6ZClufP.cjs';
2
- export { H as HTTPClientIO, a as HTTPServerIO } from './http-CvGfNM3D.cjs';
1
+ import { R as RPCChannel, I as IoInterface } from './channel-C01VCxab.cjs';
2
+ export { H as HTTPClientIO, a as HTTPServerIO } from './http-D0k1TiAJ.cjs';
3
3
  import 'node:buffer';
4
4
 
5
5
  declare function createHttpClient<API extends Record<string, any>>(url: string): {
package/dist/http.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { R as RPCChannel, I as IoInterface } from './channel-D6ZClufP.js';
2
- export { H as HTTPClientIO, a as HTTPServerIO } from './http-Bz7mwStC.js';
1
+ import { R as RPCChannel, I as IoInterface } from './channel-C01VCxab.js';
2
+ export { H as HTTPClientIO, a as HTTPServerIO } from './http-D6N0U5-p.js';
3
3
  import 'node:buffer';
4
4
 
5
5
  declare function createHttpClient<API extends Record<string, any>>(url: string): {
package/dist/http.js CHANGED
@@ -4,7 +4,7 @@ import {
4
4
  } from "./chunk-SZGZ2RBM.js";
5
5
  import {
6
6
  RPCChannel
7
- } from "./chunk-ZSSFWNSX.js";
7
+ } from "./chunk-YIQVRWAJ.js";
8
8
 
9
9
  // http.ts
10
10
  function createHttpClient(url) {
package/dist/mod.cjs CHANGED
@@ -44,10 +44,8 @@ __export(mod_exports, {
44
44
  WorkerChildIO: () => WorkerChildIO,
45
45
  WorkerParentIO: () => WorkerParentIO,
46
46
  deserializeMessage: () => deserializeMessage,
47
- deserializeResponse: () => deserializeResponse,
48
47
  generateUUID: () => generateUUID,
49
- serializeMessage: () => serializeMessage,
50
- serializeResponse: () => serializeResponse
48
+ serializeMessage: () => serializeMessage
51
49
  });
52
50
  module.exports = __toCommonJS(mod_exports);
53
51
 
@@ -503,30 +501,39 @@ var TauriShellStdio = class {
503
501
 
504
502
  // src/serialization.ts
505
503
  var import_superjson2 = __toESM(require("superjson"), 1);
506
- function serializeMessage(message) {
507
- return import_superjson2.default.stringify(message) + "\n";
504
+ function replacer(key, value) {
505
+ if (value instanceof Uint8Array) {
506
+ return {
507
+ type: "Uint8Array",
508
+ data: Array.from(value)
509
+ // Convert to regular array
510
+ };
511
+ }
512
+ return value;
508
513
  }
509
- function deserializeMessage(message) {
510
- return new Promise((resolve, reject) => {
511
- try {
512
- const parsed = import_superjson2.default.parse(message);
513
- resolve(parsed);
514
- } catch (error) {
515
- console.error("failed to parse message", typeof message, message, error);
516
- reject(error);
517
- }
518
- });
514
+ function reviver(key, value) {
515
+ if (value && value.type === "Uint8Array" && Array.isArray(value.data)) {
516
+ return new Uint8Array(value.data);
517
+ }
518
+ return value;
519
519
  }
520
- function serializeResponse(response) {
521
- return import_superjson2.default.stringify(response) + "\n";
520
+ function serializeMessage(message, options = {}) {
521
+ const version = options.version || "superjson";
522
+ const msgWithVersion = { ...message, version };
523
+ return version === "json" ? JSON.stringify(msgWithVersion, replacer) + "\n" : import_superjson2.default.stringify(msgWithVersion) + "\n";
522
524
  }
523
- function deserializeResponse(response) {
525
+ function deserializeMessage(message) {
524
526
  return new Promise((resolve, reject) => {
525
527
  try {
526
- const parsed = import_superjson2.default.parse(response);
527
- resolve(parsed);
528
+ if (message.startsWith('{"json":')) {
529
+ const parsed = import_superjson2.default.parse(message);
530
+ resolve(parsed);
531
+ } else {
532
+ const parsed = JSON.parse(message, reviver);
533
+ resolve(parsed);
534
+ }
528
535
  } catch (error) {
529
- console.error("failed to parse response", response);
536
+ console.error("failed to parse message", typeof message, message, error);
530
537
  reject(error);
531
538
  }
532
539
  });
@@ -542,6 +549,7 @@ var RPCChannel = class {
542
549
  constructor(io, options) {
543
550
  this.io = io;
544
551
  this.apiImplementation = options?.expose;
552
+ this.serializationOptions = options?.serialization || {};
545
553
  this.listen();
546
554
  }
547
555
  pendingRequests = {};
@@ -550,6 +558,7 @@ var RPCChannel = class {
550
558
  count = 0;
551
559
  messageStr = "";
552
560
  apiImplementation;
561
+ serializationOptions;
553
562
  /**
554
563
  * Exposes a local API implementation that can be called remotely
555
564
  * @param api The local API implementation to expose
@@ -596,7 +605,7 @@ var RPCChannel = class {
596
605
  /**
597
606
  * Handles a single message string by parsing and routing it
598
607
  * @param messageStr The message string to handle
599
- * @private
608
+ * @private
600
609
  */
601
610
  async handleMessageStr(messageStr) {
602
611
  this.count++;
@@ -646,7 +655,7 @@ var RPCChannel = class {
646
655
  type: "request",
647
656
  callbackIds: callbackIds.length > 0 ? callbackIds : void 0
648
657
  };
649
- this.io.write(serializeMessage(message));
658
+ this.io.write(serializeMessage(message, this.serializationOptions));
650
659
  });
651
660
  }
652
661
  /**
@@ -720,7 +729,7 @@ var RPCChannel = class {
720
729
  args,
721
730
  type: "callback"
722
731
  };
723
- this.io.write(serializeMessage(message));
732
+ this.io.write(serializeMessage(message, this.serializationOptions));
724
733
  }
725
734
  /**
726
735
  * Handles callback invocations received from the remote endpoint
@@ -749,7 +758,7 @@ var RPCChannel = class {
749
758
  args: { result },
750
759
  type: "response"
751
760
  };
752
- this.io.write(serializeMessage(response));
761
+ this.io.write(serializeMessage(response, this.serializationOptions));
753
762
  }
754
763
  /**
755
764
  * Sends an error response back to the remote endpoint
@@ -764,7 +773,7 @@ var RPCChannel = class {
764
773
  args: { error },
765
774
  type: "response"
766
775
  };
767
- this.io.write(serializeMessage(response));
776
+ this.io.write(serializeMessage(response, this.serializationOptions));
768
777
  }
769
778
  /**
770
779
  * Creates a nested proxy object for chaining remote method calls
@@ -844,8 +853,6 @@ var DenoIo = class {
844
853
  WorkerChildIO,
845
854
  WorkerParentIO,
846
855
  deserializeMessage,
847
- deserializeResponse,
848
856
  generateUUID,
849
- serializeMessage,
850
- serializeResponse
857
+ serializeMessage
851
858
  });
package/dist/mod.d.cts CHANGED
@@ -1,10 +1,10 @@
1
- export { T as TauriShellStdio, a as WorkerChildIO, W as WorkerParentIO } from './tauri-CRNRbu3f.cjs';
2
- export { ChromeBackgroundIO, ChromeContentIO, Message, Response, deserializeMessage, deserializeResponse, generateUUID, serializeMessage, serializeResponse } from './chrome.cjs';
1
+ export { T as TauriShellStdio, a as WorkerChildIO, W as WorkerParentIO } from './tauri-ohph68oo.cjs';
2
+ export { ChromeBackgroundIO, ChromeContentIO, generateUUID } from './chrome.cjs';
3
3
  import { Buffer } from 'node:buffer';
4
- import { I as IoInterface, D as DestroyableIoInterface } from './channel-D6ZClufP.cjs';
5
- export { R as RPCChannel } from './channel-D6ZClufP.cjs';
4
+ import { I as IoInterface, D as DestroyableIoInterface } from './channel-C01VCxab.cjs';
5
+ export { M as Message, R as RPCChannel, a as Response, S as SerializationOptions, d as deserializeMessage, s as serializeMessage } from './channel-C01VCxab.cjs';
6
6
  import { Readable, Writable } from 'node:stream';
7
- export { H as HTTPClientIO, a as HTTPServerIO } from './http-CvGfNM3D.cjs';
7
+ export { H as HTTPClientIO, a as HTTPServerIO } from './http-D0k1TiAJ.cjs';
8
8
  export { DenoIo } from './deno-mod.cjs';
9
9
  import '@tauri-apps/plugin-shell';
10
10
 
package/dist/mod.d.ts CHANGED
@@ -1,10 +1,10 @@
1
- export { T as TauriShellStdio, a as WorkerChildIO, W as WorkerParentIO } from './tauri-PdcZTVUI.js';
2
- export { ChromeBackgroundIO, ChromeContentIO, Message, Response, deserializeMessage, deserializeResponse, generateUUID, serializeMessage, serializeResponse } from './chrome.js';
1
+ export { T as TauriShellStdio, a as WorkerChildIO, W as WorkerParentIO } from './tauri-pC0wuvjw.js';
2
+ export { ChromeBackgroundIO, ChromeContentIO, generateUUID } from './chrome.js';
3
3
  import { Buffer } from 'node:buffer';
4
- import { I as IoInterface, D as DestroyableIoInterface } from './channel-D6ZClufP.js';
5
- export { R as RPCChannel } from './channel-D6ZClufP.js';
4
+ import { I as IoInterface, D as DestroyableIoInterface } from './channel-C01VCxab.js';
5
+ export { M as Message, R as RPCChannel, a as Response, S as SerializationOptions, d as deserializeMessage, s as serializeMessage } from './channel-C01VCxab.js';
6
6
  import { Readable, Writable } from 'node:stream';
7
- export { H as HTTPClientIO, a as HTTPServerIO } from './http-Bz7mwStC.js';
7
+ export { H as HTTPClientIO, a as HTTPServerIO } from './http-D6N0U5-p.js';
8
8
  export { DenoIo } from './deno-mod.js';
9
9
  import '@tauri-apps/plugin-shell';
10
10
 
package/dist/mod.js CHANGED
@@ -17,11 +17,9 @@ import {
17
17
  import {
18
18
  RPCChannel,
19
19
  deserializeMessage,
20
- deserializeResponse,
21
20
  generateUUID,
22
- serializeMessage,
23
- serializeResponse
24
- } from "./chunk-ZSSFWNSX.js";
21
+ serializeMessage
22
+ } from "./chunk-YIQVRWAJ.js";
25
23
 
26
24
  // src/adapters/bun.ts
27
25
  import { Buffer } from "node:buffer";
@@ -206,8 +204,6 @@ export {
206
204
  WorkerChildIO,
207
205
  WorkerParentIO,
208
206
  deserializeMessage,
209
- deserializeResponse,
210
207
  generateUUID,
211
- serializeMessage,
212
- serializeResponse
208
+ serializeMessage
213
209
  };
@@ -1,4 +1,4 @@
1
- import { D as DestroyableIoInterface, I as IoInterface } from './channel-D6ZClufP.cjs';
1
+ import { D as DestroyableIoInterface, I as IoInterface } from './channel-C01VCxab.cjs';
2
2
  import { EventEmitter, OutputEvents, Child } from '@tauri-apps/plugin-shell';
3
3
 
4
4
  declare class WorkerParentIO implements DestroyableIoInterface {
@@ -1,4 +1,4 @@
1
- import { D as DestroyableIoInterface, I as IoInterface } from './channel-D6ZClufP.js';
1
+ import { D as DestroyableIoInterface, I as IoInterface } from './channel-C01VCxab.js';
2
2
  import { EventEmitter, OutputEvents, Child } from '@tauri-apps/plugin-shell';
3
3
 
4
4
  declare class WorkerParentIO implements DestroyableIoInterface {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kkrpc",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "type": "module",
5
5
  "repository": {
6
6
  "type": "git",