jaelis-node 1.3.1 → 1.4.1
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 +72 -2
- package/lib/JAELIS-VM/lib/adapters/evm-adapter.js +454 -0
- package/lib/JAELIS-VM/lib/adapters/index.js +411 -0
- package/lib/JAELIS-VM/lib/adapters/svm-adapter.js +457 -0
- package/lib/JAELIS-VM/lib/compiler/jir-compiler.js +1097 -0
- package/lib/JAELIS-VM/lib/execution/engine.js +1183 -0
- package/lib/JAELIS-VM/lib/index.js +440 -0
- package/lib/JAELIS-VM/lib/integration/jaelis-integration.js +543 -0
- package/lib/JAELIS-VM/lib/serialization/serializer.js +819 -0
- package/lib/JAELIS-VM/lib/state/state-manager.js +1116 -0
- package/lib/JAELIS-VM/lib/translator/bytecode-translator.js +1222 -0
- package/lib/JAELIS-VM/lib/unified/cross-chain-state.js +836 -0
- package/lib/JAELIS-VM/lib/unified/dynamic-contracts.js +1127 -0
- package/lib/JAELIS-VM/lib/unified/index.js +378 -0
- package/lib/JAELIS-VM/lib/unified/jaelis-abi.js +1150 -0
- package/lib/JAELIS-VM/lib/unified/unified-compiler.js +1350 -0
- package/lib/JAELIS-VM/node_modules/.bin/download-cbor-prebuilds +12 -0
- package/lib/JAELIS-VM/node_modules/.bin/download-cbor-prebuilds.cmd +17 -0
- package/lib/JAELIS-VM/node_modules/.bin/download-cbor-prebuilds.ps1 +28 -0
- package/lib/JAELIS-VM/node_modules/.bin/download-msgpackr-prebuilds +12 -0
- package/lib/JAELIS-VM/node_modules/.bin/download-msgpackr-prebuilds.cmd +17 -0
- package/lib/JAELIS-VM/node_modules/.bin/download-msgpackr-prebuilds.ps1 +28 -0
- package/lib/JAELIS-VM/node_modules/.bin/node-gyp-build-optional-packages +12 -0
- package/lib/JAELIS-VM/node_modules/.bin/node-gyp-build-optional-packages-optional +12 -0
- package/lib/JAELIS-VM/node_modules/.bin/node-gyp-build-optional-packages-optional.cmd +17 -0
- package/lib/JAELIS-VM/node_modules/.bin/node-gyp-build-optional-packages-optional.ps1 +28 -0
- package/lib/JAELIS-VM/node_modules/.bin/node-gyp-build-optional-packages-test +12 -0
- package/lib/JAELIS-VM/node_modules/.bin/node-gyp-build-optional-packages-test.cmd +17 -0
- package/lib/JAELIS-VM/node_modules/.bin/node-gyp-build-optional-packages-test.ps1 +28 -0
- package/lib/JAELIS-VM/node_modules/.bin/node-gyp-build-optional-packages.cmd +17 -0
- package/lib/JAELIS-VM/node_modules/.bin/node-gyp-build-optional-packages.ps1 +28 -0
- package/lib/JAELIS-VM/node_modules/.package-lock.json +127 -0
- package/lib/JAELIS-VM/node_modules/@cbor-extract/cbor-extract-win32-x64/README.md +1 -0
- package/lib/JAELIS-VM/node_modules/@cbor-extract/cbor-extract-win32-x64/index.js +0 -0
- package/lib/JAELIS-VM/node_modules/@cbor-extract/cbor-extract-win32-x64/node.abi115.node +0 -0
- package/lib/JAELIS-VM/node_modules/@cbor-extract/cbor-extract-win32-x64/node.napi.node +0 -0
- package/lib/JAELIS-VM/node_modules/@cbor-extract/cbor-extract-win32-x64/package.json +17 -0
- package/lib/JAELIS-VM/node_modules/@msgpackr-extract/msgpackr-extract-win32-x64/README.md +1 -0
- package/lib/JAELIS-VM/node_modules/@msgpackr-extract/msgpackr-extract-win32-x64/index.js +0 -0
- package/lib/JAELIS-VM/node_modules/@msgpackr-extract/msgpackr-extract-win32-x64/node.abi115.node +0 -0
- package/lib/JAELIS-VM/node_modules/@msgpackr-extract/msgpackr-extract-win32-x64/node.napi.node +0 -0
- package/lib/JAELIS-VM/node_modules/@msgpackr-extract/msgpackr-extract-win32-x64/package.json +17 -0
- package/lib/JAELIS-VM/node_modules/cbor-extract/LICENSE +21 -0
- package/lib/JAELIS-VM/node_modules/cbor-extract/README.md +5 -0
- package/lib/JAELIS-VM/node_modules/cbor-extract/bin/download-prebuilds.js +11 -0
- package/lib/JAELIS-VM/node_modules/cbor-extract/binding.gyp +60 -0
- package/lib/JAELIS-VM/node_modules/cbor-extract/index.js +1 -0
- package/lib/JAELIS-VM/node_modules/cbor-extract/package.json +50 -0
- package/lib/JAELIS-VM/node_modules/cbor-extract/src/extract.cpp +198 -0
- package/lib/JAELIS-VM/node_modules/cbor-x/LICENSE +21 -0
- package/lib/JAELIS-VM/node_modules/cbor-x/README.md +380 -0
- package/lib/JAELIS-VM/node_modules/cbor-x/SECURITY.md +11 -0
- package/lib/JAELIS-VM/node_modules/cbor-x/benchmark.md +73 -0
- package/lib/JAELIS-VM/node_modules/cbor-x/browser.js +11 -0
- package/lib/JAELIS-VM/node_modules/cbor-x/decode.d.ts +2 -0
- package/lib/JAELIS-VM/node_modules/cbor-x/decode.js +1300 -0
- package/lib/JAELIS-VM/node_modules/cbor-x/dist/decode-no-eval.cjs +1244 -0
- package/lib/JAELIS-VM/node_modules/cbor-x/dist/decode-no-eval.cjs.map +1 -0
- package/lib/JAELIS-VM/node_modules/cbor-x/dist/index-no-eval.cjs +2509 -0
- package/lib/JAELIS-VM/node_modules/cbor-x/dist/index-no-eval.cjs.map +1 -0
- package/lib/JAELIS-VM/node_modules/cbor-x/dist/index-no-eval.min.js +2 -0
- package/lib/JAELIS-VM/node_modules/cbor-x/dist/index-no-eval.min.js.map +1 -0
- package/lib/JAELIS-VM/node_modules/cbor-x/dist/index.js +2508 -0
- package/lib/JAELIS-VM/node_modules/cbor-x/dist/index.js.map +1 -0
- package/lib/JAELIS-VM/node_modules/cbor-x/dist/index.min.js +2 -0
- package/lib/JAELIS-VM/node_modules/cbor-x/dist/index.min.js.map +1 -0
- package/lib/JAELIS-VM/node_modules/cbor-x/dist/node.cjs +2629 -0
- package/lib/JAELIS-VM/node_modules/cbor-x/dist/node.cjs.map +1 -0
- package/lib/JAELIS-VM/node_modules/cbor-x/dist/test.js +3343 -0
- package/lib/JAELIS-VM/node_modules/cbor-x/dist/test.js.map +1 -0
- package/lib/JAELIS-VM/node_modules/cbor-x/encode.d.ts +1 -0
- package/lib/JAELIS-VM/node_modules/cbor-x/encode.js +1231 -0
- package/lib/JAELIS-VM/node_modules/cbor-x/index.d.ts +79 -0
- package/lib/JAELIS-VM/node_modules/cbor-x/index.js +3 -0
- package/lib/JAELIS-VM/node_modules/cbor-x/iterators.js +85 -0
- package/lib/JAELIS-VM/node_modules/cbor-x/node-index.js +24 -0
- package/lib/JAELIS-VM/node_modules/cbor-x/package.json +94 -0
- package/lib/JAELIS-VM/node_modules/cbor-x/rollup.config.js +88 -0
- package/lib/JAELIS-VM/node_modules/cbor-x/stream.js +61 -0
- package/lib/JAELIS-VM/node_modules/cbor-x/webpack.config.js +19 -0
- package/lib/JAELIS-VM/node_modules/detect-libc/LICENSE +201 -0
- package/lib/JAELIS-VM/node_modules/detect-libc/README.md +163 -0
- package/lib/JAELIS-VM/node_modules/detect-libc/index.d.ts +14 -0
- package/lib/JAELIS-VM/node_modules/detect-libc/lib/detect-libc.js +313 -0
- package/lib/JAELIS-VM/node_modules/detect-libc/lib/elf.js +39 -0
- package/lib/JAELIS-VM/node_modules/detect-libc/lib/filesystem.js +51 -0
- package/lib/JAELIS-VM/node_modules/detect-libc/lib/process.js +24 -0
- package/lib/JAELIS-VM/node_modules/detect-libc/package.json +44 -0
- package/lib/JAELIS-VM/node_modules/msgpackr/LICENSE +21 -0
- package/lib/JAELIS-VM/node_modules/msgpackr/README.md +372 -0
- package/lib/JAELIS-VM/node_modules/msgpackr/SECURITY.md +11 -0
- package/lib/JAELIS-VM/node_modules/msgpackr/benchmark.md +67 -0
- package/lib/JAELIS-VM/node_modules/msgpackr/dist/index-no-eval.cjs +2407 -0
- package/lib/JAELIS-VM/node_modules/msgpackr/dist/index-no-eval.cjs.map +1 -0
- package/lib/JAELIS-VM/node_modules/msgpackr/dist/index-no-eval.min.js +2 -0
- package/lib/JAELIS-VM/node_modules/msgpackr/dist/index-no-eval.min.js.map +1 -0
- package/lib/JAELIS-VM/node_modules/msgpackr/dist/index.js +2406 -0
- package/lib/JAELIS-VM/node_modules/msgpackr/dist/index.js.map +1 -0
- package/lib/JAELIS-VM/node_modules/msgpackr/dist/index.min.js +2 -0
- package/lib/JAELIS-VM/node_modules/msgpackr/dist/index.min.js.map +1 -0
- package/lib/JAELIS-VM/node_modules/msgpackr/dist/node.cjs +3320 -0
- package/lib/JAELIS-VM/node_modules/msgpackr/dist/node.cjs.map +1 -0
- package/lib/JAELIS-VM/node_modules/msgpackr/dist/test.js +4540 -0
- package/lib/JAELIS-VM/node_modules/msgpackr/dist/test.js.map +1 -0
- package/lib/JAELIS-VM/node_modules/msgpackr/dist/unpack-no-eval.cjs +1250 -0
- package/lib/JAELIS-VM/node_modules/msgpackr/dist/unpack-no-eval.cjs.map +1 -0
- package/lib/JAELIS-VM/node_modules/msgpackr/index.d.cts +91 -0
- package/lib/JAELIS-VM/node_modules/msgpackr/index.d.ts +91 -0
- package/lib/JAELIS-VM/node_modules/msgpackr/index.js +5 -0
- package/lib/JAELIS-VM/node_modules/msgpackr/iterators.js +87 -0
- package/lib/JAELIS-VM/node_modules/msgpackr/node-index.js +25 -0
- package/lib/JAELIS-VM/node_modules/msgpackr/pack.d.cts +1 -0
- package/lib/JAELIS-VM/node_modules/msgpackr/pack.d.ts +1 -0
- package/lib/JAELIS-VM/node_modules/msgpackr/pack.js +1141 -0
- package/lib/JAELIS-VM/node_modules/msgpackr/package.json +104 -0
- package/lib/JAELIS-VM/node_modules/msgpackr/rollup.config.js +88 -0
- package/lib/JAELIS-VM/node_modules/msgpackr/stream.js +57 -0
- package/lib/JAELIS-VM/node_modules/msgpackr/struct.js +815 -0
- package/lib/JAELIS-VM/node_modules/msgpackr/test-worker.js +3 -0
- package/lib/JAELIS-VM/node_modules/msgpackr/unpack.d.cts +2 -0
- package/lib/JAELIS-VM/node_modules/msgpackr/unpack.d.ts +2 -0
- package/lib/JAELIS-VM/node_modules/msgpackr/unpack.js +1221 -0
- package/lib/JAELIS-VM/node_modules/msgpackr-extract/LICENSE +21 -0
- package/lib/JAELIS-VM/node_modules/msgpackr-extract/README.md +5 -0
- package/lib/JAELIS-VM/node_modules/msgpackr-extract/bin/download-prebuilds.js +13 -0
- package/lib/JAELIS-VM/node_modules/msgpackr-extract/binding.gyp +63 -0
- package/lib/JAELIS-VM/node_modules/msgpackr-extract/index.js +1 -0
- package/lib/JAELIS-VM/node_modules/msgpackr-extract/node_modules/.bin/node-gyp-build-optional-packages +12 -0
- package/lib/JAELIS-VM/node_modules/msgpackr-extract/node_modules/.bin/node-gyp-build-optional-packages-optional +12 -0
- package/lib/JAELIS-VM/node_modules/msgpackr-extract/node_modules/.bin/node-gyp-build-optional-packages-optional.cmd +17 -0
- package/lib/JAELIS-VM/node_modules/msgpackr-extract/node_modules/.bin/node-gyp-build-optional-packages-optional.ps1 +28 -0
- package/lib/JAELIS-VM/node_modules/msgpackr-extract/node_modules/.bin/node-gyp-build-optional-packages-test +12 -0
- package/lib/JAELIS-VM/node_modules/msgpackr-extract/node_modules/.bin/node-gyp-build-optional-packages-test.cmd +17 -0
- package/lib/JAELIS-VM/node_modules/msgpackr-extract/node_modules/.bin/node-gyp-build-optional-packages-test.ps1 +28 -0
- package/lib/JAELIS-VM/node_modules/msgpackr-extract/node_modules/.bin/node-gyp-build-optional-packages.cmd +17 -0
- package/lib/JAELIS-VM/node_modules/msgpackr-extract/node_modules/.bin/node-gyp-build-optional-packages.ps1 +28 -0
- package/lib/JAELIS-VM/node_modules/msgpackr-extract/node_modules/node-gyp-build-optional-packages/LICENSE +21 -0
- package/lib/JAELIS-VM/node_modules/msgpackr-extract/node_modules/node-gyp-build-optional-packages/README.md +58 -0
- package/lib/JAELIS-VM/node_modules/msgpackr-extract/node_modules/node-gyp-build-optional-packages/bin.js +82 -0
- package/lib/JAELIS-VM/node_modules/msgpackr-extract/node_modules/node-gyp-build-optional-packages/build-test.js +19 -0
- package/lib/JAELIS-VM/node_modules/msgpackr-extract/node_modules/node-gyp-build-optional-packages/index.js +6 -0
- package/lib/JAELIS-VM/node_modules/msgpackr-extract/node_modules/node-gyp-build-optional-packages/node-gyp-build.js +236 -0
- package/lib/JAELIS-VM/node_modules/msgpackr-extract/node_modules/node-gyp-build-optional-packages/optional.js +7 -0
- package/lib/JAELIS-VM/node_modules/msgpackr-extract/node_modules/node-gyp-build-optional-packages/package.json +32 -0
- package/lib/JAELIS-VM/node_modules/msgpackr-extract/package.json +50 -0
- package/lib/JAELIS-VM/node_modules/msgpackr-extract/src/extract.cpp +274 -0
- package/lib/JAELIS-VM/node_modules/node-gyp-build-optional-packages/LICENSE +21 -0
- package/lib/JAELIS-VM/node_modules/node-gyp-build-optional-packages/README.md +58 -0
- package/lib/JAELIS-VM/node_modules/node-gyp-build-optional-packages/bin.js +77 -0
- package/lib/JAELIS-VM/node_modules/node-gyp-build-optional-packages/build-test.js +19 -0
- package/lib/JAELIS-VM/node_modules/node-gyp-build-optional-packages/index.js +224 -0
- package/lib/JAELIS-VM/node_modules/node-gyp-build-optional-packages/optional.js +7 -0
- package/lib/JAELIS-VM/node_modules/node-gyp-build-optional-packages/package.json +32 -0
- package/lib/JAELIS-VM/package-lock.json +284 -0
- package/lib/JAELIS-VM/package.json +38 -0
- package/lib/JAELIS-VM/test/comprehensive.test.js +267 -0
- package/lib/JAELIS-VM/test/cross-chain-test.js +470 -0
- package/lib/JAELIS-VM/test/unified-vm-test.js +459 -0
- package/lib/JAELIS-VM/test/unified.test.js +166 -0
- package/lib/JAELIS-VM/test/vm.test.js +599 -0
- package/lib/index.js +240 -4
- package/package.json +2 -2
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "msgpackr",
|
|
3
|
+
"author": "Kris Zyp",
|
|
4
|
+
"version": "1.11.8",
|
|
5
|
+
"description": "Ultra-fast MessagePack implementation with extensions for records and structured cloning",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"types": "./index.d.ts",
|
|
8
|
+
"main": "./dist/node.cjs",
|
|
9
|
+
"module": "./index.js",
|
|
10
|
+
"react-native": "./index.js",
|
|
11
|
+
"keywords": [
|
|
12
|
+
"MessagePack",
|
|
13
|
+
"msgpack",
|
|
14
|
+
"performance",
|
|
15
|
+
"structured",
|
|
16
|
+
"clone"
|
|
17
|
+
],
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "http://github.com/kriszyp/msgpackr"
|
|
21
|
+
},
|
|
22
|
+
"scripts": {
|
|
23
|
+
"benchmark": "node ./tests/benchmark.cjs",
|
|
24
|
+
"build": "rollup -c && cpy index.d.ts . --rename=index.d.cts && cpy pack.d.ts . --rename=pack.d.cts && cpy unpack.d.ts . --rename=unpack.d.cts",
|
|
25
|
+
"dry-run": "npm publish --dry-run",
|
|
26
|
+
"prepare": "npm run build",
|
|
27
|
+
"test": "mocha tests/test**.*js -u tdd --experimental-json-modules"
|
|
28
|
+
},
|
|
29
|
+
"type": "module",
|
|
30
|
+
"exports": {
|
|
31
|
+
".": {
|
|
32
|
+
"types": {
|
|
33
|
+
"require": "./index.d.cts",
|
|
34
|
+
"import": "./index.d.ts"
|
|
35
|
+
},
|
|
36
|
+
"browser": "./index.js",
|
|
37
|
+
"node": {
|
|
38
|
+
"require": "./dist/node.cjs",
|
|
39
|
+
"import": "./node-index.js"
|
|
40
|
+
},
|
|
41
|
+
"bun": {
|
|
42
|
+
"require": "./dist/node.cjs",
|
|
43
|
+
"import": "./node-index.js"
|
|
44
|
+
},
|
|
45
|
+
"default": "./index.js"
|
|
46
|
+
},
|
|
47
|
+
"./pack": {
|
|
48
|
+
"types": {
|
|
49
|
+
"require": "./pack.d.cts",
|
|
50
|
+
"import": "./pack.d.ts"
|
|
51
|
+
},
|
|
52
|
+
"browser": "./pack.js",
|
|
53
|
+
"node": {
|
|
54
|
+
"import": "./index.js",
|
|
55
|
+
"require": "./dist/node.cjs"
|
|
56
|
+
},
|
|
57
|
+
"bun": {
|
|
58
|
+
"import": "./index.js",
|
|
59
|
+
"require": "./dist/node.cjs"
|
|
60
|
+
},
|
|
61
|
+
"default": "./pack.js"
|
|
62
|
+
},
|
|
63
|
+
"./unpack": {
|
|
64
|
+
"types": {
|
|
65
|
+
"require": "./unpack.d.cts",
|
|
66
|
+
"import": "./unpack.d.ts"
|
|
67
|
+
},
|
|
68
|
+
"browser": "./unpack.js",
|
|
69
|
+
"node": {
|
|
70
|
+
"import": "./index.js",
|
|
71
|
+
"require": "./dist/node.cjs"
|
|
72
|
+
},
|
|
73
|
+
"bun": {
|
|
74
|
+
"import": "./index.js",
|
|
75
|
+
"require": "./dist/node.cjs"
|
|
76
|
+
},
|
|
77
|
+
"default": "./unpack.js"
|
|
78
|
+
},
|
|
79
|
+
"./unpack-no-eval": "./dist/unpack-no-eval.cjs",
|
|
80
|
+
"./index-no-eval": "./dist/index-no-eval.cjs"
|
|
81
|
+
},
|
|
82
|
+
"files": [
|
|
83
|
+
"/dist",
|
|
84
|
+
"*.md",
|
|
85
|
+
"/*.js",
|
|
86
|
+
"/*.ts",
|
|
87
|
+
"/*.cts"
|
|
88
|
+
],
|
|
89
|
+
"optionalDependencies": {
|
|
90
|
+
"msgpackr-extract": "^3.0.2"
|
|
91
|
+
},
|
|
92
|
+
"devDependencies": {
|
|
93
|
+
"@rollup/plugin-json": "^5.0.1",
|
|
94
|
+
"@rollup/plugin-replace": "^5.0.1",
|
|
95
|
+
"@types/node": "latest",
|
|
96
|
+
"async": "^3",
|
|
97
|
+
"chai": "^4.3.4",
|
|
98
|
+
"cpy-cli": "^4.1.0",
|
|
99
|
+
"esm": "^3.2.25",
|
|
100
|
+
"mocha": "^10.1.0",
|
|
101
|
+
"rollup": "^3.2.5",
|
|
102
|
+
"@rollup/plugin-terser": "^0.1.0"
|
|
103
|
+
}
|
|
104
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import terser from '@rollup/plugin-terser';
|
|
2
|
+
import json from "@rollup/plugin-json";
|
|
3
|
+
import replace from "@rollup/plugin-replace";
|
|
4
|
+
|
|
5
|
+
export default [
|
|
6
|
+
{
|
|
7
|
+
input: "node-index.js",
|
|
8
|
+
output: [
|
|
9
|
+
{
|
|
10
|
+
file: "dist/node.cjs",
|
|
11
|
+
format: "cjs",
|
|
12
|
+
sourcemap: true
|
|
13
|
+
}
|
|
14
|
+
]
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
input: "index.js",
|
|
18
|
+
output: {
|
|
19
|
+
file: "dist/index.js",
|
|
20
|
+
format: "umd",
|
|
21
|
+
name: "msgpackr",
|
|
22
|
+
sourcemap: true
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
input: "index.js",
|
|
27
|
+
plugins: [
|
|
28
|
+
replace({ Function: 'BlockedFunction '})
|
|
29
|
+
],
|
|
30
|
+
output: {
|
|
31
|
+
file: "dist/index-no-eval.cjs",
|
|
32
|
+
format: "umd",
|
|
33
|
+
name: "msgpackr",
|
|
34
|
+
sourcemap: true
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
input: "unpack.js",
|
|
39
|
+
plugins: [
|
|
40
|
+
replace({ Function: 'BlockedFunction '})
|
|
41
|
+
],
|
|
42
|
+
output: {
|
|
43
|
+
file: "dist/unpack-no-eval.cjs",
|
|
44
|
+
format: "umd",
|
|
45
|
+
name: "msgpackr",
|
|
46
|
+
sourcemap: true
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
input: "index.js",
|
|
51
|
+
plugins: [
|
|
52
|
+
terser({})
|
|
53
|
+
],
|
|
54
|
+
output: {
|
|
55
|
+
file: "dist/index.min.js",
|
|
56
|
+
format: "umd",
|
|
57
|
+
name: "msgpackr",
|
|
58
|
+
sourcemap: true
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
input: "index.js",
|
|
63
|
+
plugins: [
|
|
64
|
+
replace({ Function: 'BlockedFunction '}),
|
|
65
|
+
terser({})
|
|
66
|
+
],
|
|
67
|
+
output: {
|
|
68
|
+
file: "dist/index-no-eval.min.js",
|
|
69
|
+
format: "umd",
|
|
70
|
+
name: "msgpackr",
|
|
71
|
+
sourcemap: true
|
|
72
|
+
}
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
input: "tests/test.js",
|
|
76
|
+
plugins: [json()],
|
|
77
|
+
external: ['chai', '../index.js'],
|
|
78
|
+
output: {
|
|
79
|
+
file: "dist/test.js",
|
|
80
|
+
format: "iife",
|
|
81
|
+
sourcemap: true,
|
|
82
|
+
globals: {
|
|
83
|
+
chai: 'chai',
|
|
84
|
+
'./index.js': 'msgpackr',
|
|
85
|
+
},
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
];
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Transform } from 'stream'
|
|
2
|
+
import { Packr } from './pack.js'
|
|
3
|
+
import { Unpackr } from './unpack.js'
|
|
4
|
+
var DEFAULT_OPTIONS = {objectMode: true}
|
|
5
|
+
|
|
6
|
+
export class PackrStream extends Transform {
|
|
7
|
+
constructor(options) {
|
|
8
|
+
if (!options)
|
|
9
|
+
options = {}
|
|
10
|
+
options.writableObjectMode = true
|
|
11
|
+
super(options)
|
|
12
|
+
options.sequential = true
|
|
13
|
+
this.packr = options.packr || new Packr(options)
|
|
14
|
+
}
|
|
15
|
+
_transform(value, encoding, callback) {
|
|
16
|
+
this.push(this.packr.pack(value))
|
|
17
|
+
callback()
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export class UnpackrStream extends Transform {
|
|
22
|
+
constructor(options) {
|
|
23
|
+
if (!options)
|
|
24
|
+
options = {}
|
|
25
|
+
options.objectMode = true
|
|
26
|
+
super(options)
|
|
27
|
+
options.structures = []
|
|
28
|
+
this.unpackr = options.unpackr || new Unpackr(options)
|
|
29
|
+
}
|
|
30
|
+
_transform(chunk, encoding, callback) {
|
|
31
|
+
if (this.incompleteBuffer) {
|
|
32
|
+
chunk = Buffer.concat([this.incompleteBuffer, chunk])
|
|
33
|
+
this.incompleteBuffer = null
|
|
34
|
+
}
|
|
35
|
+
let values
|
|
36
|
+
try {
|
|
37
|
+
values = this.unpackr.unpackMultiple(chunk)
|
|
38
|
+
} catch(error) {
|
|
39
|
+
if (error.incomplete) {
|
|
40
|
+
this.incompleteBuffer = chunk.slice(error.lastPosition)
|
|
41
|
+
values = error.values
|
|
42
|
+
}
|
|
43
|
+
else
|
|
44
|
+
throw error
|
|
45
|
+
} finally {
|
|
46
|
+
for (let value of values || []) {
|
|
47
|
+
if (value === null)
|
|
48
|
+
value = this.getNullValue()
|
|
49
|
+
this.push(value)
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
if (callback) callback()
|
|
53
|
+
}
|
|
54
|
+
getNullValue() {
|
|
55
|
+
return Symbol.for(null)
|
|
56
|
+
}
|
|
57
|
+
}
|