@statewalker/webrun-msgpack 0.2.2 → 0.3.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/LICENSE +45 -0
- package/README.md +152 -33
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +540 -12
- package/dist/msgpack-core.d.ts +70 -0
- package/dist/msgpack-core.d.ts.map +1 -0
- package/dist/msgpack.d.ts +12 -4
- package/dist/msgpack.d.ts.map +1 -1
- package/dist/port-codec.d.ts.map +1 -1
- package/package.json +3 -3
- package/src/index.ts +8 -0
- package/src/msgpack-core.ts +617 -0
- package/src/msgpack.ts +18 -12
- package/src/port-codec.ts +1 -3
package/dist/msgpack.d.ts
CHANGED
|
@@ -1,20 +1,28 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Encode each value as a length-prefixed msgpack frame.
|
|
3
3
|
* Frame format: [4-byte big-endian length][msgpack bytes]
|
|
4
|
+
*
|
|
5
|
+
* The input may be synchronous (an array, a generator) or asynchronous.
|
|
4
6
|
*/
|
|
5
|
-
export declare function encodeMsgpack<T>(input: AsyncIterable<T>): AsyncGenerator<Uint8Array>;
|
|
7
|
+
export declare function encodeMsgpack<T>(input: Iterable<T> | AsyncIterable<T>): AsyncGenerator<Uint8Array>;
|
|
6
8
|
/**
|
|
7
9
|
* Decode length-prefixed msgpack frames, reassembling across chunk boundaries.
|
|
10
|
+
*
|
|
11
|
+
* The input may be synchronous (an array of chunks) or asynchronous.
|
|
8
12
|
*/
|
|
9
|
-
export declare function decodeMsgpack<T>(input: AsyncIterable<Uint8Array>): AsyncGenerator<T>;
|
|
13
|
+
export declare function decodeMsgpack<T>(input: Iterable<Uint8Array> | AsyncIterable<Uint8Array>): AsyncGenerator<T>;
|
|
10
14
|
/**
|
|
11
15
|
* Encode each Float32Array as a msgpack frame.
|
|
12
16
|
* The Float32Array is converted to a Uint8Array view (zero-copy) before encoding as msgpack bin.
|
|
17
|
+
*
|
|
18
|
+
* The input may be synchronous (an array, a generator) or asynchronous.
|
|
13
19
|
*/
|
|
14
|
-
export declare function encodeFloat32Arrays(input: AsyncIterable<Float32Array>): AsyncGenerator<Uint8Array>;
|
|
20
|
+
export declare function encodeFloat32Arrays(input: Iterable<Float32Array> | AsyncIterable<Float32Array>): AsyncGenerator<Uint8Array>;
|
|
15
21
|
/**
|
|
16
22
|
* Decode msgpack frames back to Float32Array.
|
|
17
23
|
* Each frame contains a msgpack bin value (Uint8Array), reinterpreted as Float32Array.
|
|
24
|
+
*
|
|
25
|
+
* The input may be synchronous (an array of chunks) or asynchronous.
|
|
18
26
|
*/
|
|
19
|
-
export declare function decodeFloat32Arrays(input: AsyncIterable<Uint8Array>): AsyncGenerator<Float32Array>;
|
|
27
|
+
export declare function decodeFloat32Arrays(input: Iterable<Uint8Array> | AsyncIterable<Uint8Array>): AsyncGenerator<Float32Array>;
|
|
20
28
|
//# sourceMappingURL=msgpack.d.ts.map
|
package/dist/msgpack.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"msgpack.d.ts","sourceRoot":"","sources":["../src/msgpack.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"msgpack.d.ts","sourceRoot":"","sources":["../src/msgpack.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,wBAAuB,aAAa,CAAC,CAAC,EACpC,KAAK,EAAE,QAAQ,CAAC,CAAC,CAAC,GAAG,aAAa,CAAC,CAAC,CAAC,GACpC,cAAc,CAAC,UAAU,CAAC,CAS5B;AAED;;;;GAIG;AACH,wBAAuB,aAAa,CAAC,CAAC,EACpC,KAAK,EAAE,QAAQ,CAAC,UAAU,CAAC,GAAG,aAAa,CAAC,UAAU,CAAC,GACtD,cAAc,CAAC,CAAC,CAAC,CAgBnB;AAED;;;;;GAKG;AACH,wBAAuB,mBAAmB,CACxC,KAAK,EAAE,QAAQ,CAAC,YAAY,CAAC,GAAG,aAAa,CAAC,YAAY,CAAC,GAC1D,cAAc,CAAC,UAAU,CAAC,CAU5B;AAED;;;;;GAKG;AACH,wBAAuB,mBAAmB,CACxC,KAAK,EAAE,QAAQ,CAAC,UAAU,CAAC,GAAG,aAAa,CAAC,UAAU,CAAC,GACtD,cAAc,CAAC,YAAY,CAAC,CAK9B"}
|
package/dist/port-codec.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"port-codec.d.ts","sourceRoot":"","sources":["../src/port-codec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAgB,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"port-codec.d.ts","sourceRoot":"","sources":["../src/port-codec.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAgB,MAAM,yBAAyB,CAAC;AA2BvE;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,YAAY,EAAE,SAmB1B,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@statewalker/webrun-msgpack",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
|
-
"description": "MessagePack
|
|
6
|
+
"description": "MessagePack for the wire, with no runtime dependencies: serialize/deserialize (a TypeScript port of msgpack.js), a length-prefixed stream codec for iterables (values and Float32Arrays), and msgpackCodec, a PortCodec that carries webrun-rpc port envelopes over a byte transport.",
|
|
7
7
|
"homepage": "https://github.com/statewalker/webrun-wire",
|
|
8
8
|
"author": {
|
|
9
9
|
"name": "Mikhail Kotelnikov",
|
|
@@ -26,10 +26,10 @@
|
|
|
26
26
|
"src"
|
|
27
27
|
],
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@ygoe/msgpack": "^1.0.3",
|
|
30
29
|
"@statewalker/webrun-rpc": "0.4.0"
|
|
31
30
|
},
|
|
32
31
|
"devDependencies": {
|
|
32
|
+
"@biomejs/biome": "^2.5.8",
|
|
33
33
|
"rimraf": "^6.1.3",
|
|
34
34
|
"rolldown": "^1.2.4",
|
|
35
35
|
"typescript": "^7.0.2",
|
package/src/index.ts
CHANGED
|
@@ -4,4 +4,12 @@ export {
|
|
|
4
4
|
encodeFloat32Arrays,
|
|
5
5
|
encodeMsgpack,
|
|
6
6
|
} from "./msgpack.js";
|
|
7
|
+
export {
|
|
8
|
+
type DeserializeOptions,
|
|
9
|
+
deserialize,
|
|
10
|
+
type MsgpackExtension,
|
|
11
|
+
type MsgpackInput,
|
|
12
|
+
type SerializeOptions,
|
|
13
|
+
serialize,
|
|
14
|
+
} from "./msgpack-core.js";
|
|
7
15
|
export { msgpackCodec } from "./port-codec.js";
|