msgpackr 1.11.4 → 1.11.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/dist/index-no-eval.cjs +79 -26
- package/dist/index-no-eval.cjs.map +1 -1
- package/dist/index-no-eval.min.js +1 -1
- package/dist/index-no-eval.min.js.map +1 -1
- package/dist/index.js +79 -26
- package/dist/index.js.map +1 -1
- package/dist/index.min.js +1 -1
- package/dist/index.min.js.map +1 -1
- package/dist/node.cjs +84 -28
- package/dist/node.cjs.map +1 -1
- package/dist/test.js +117 -38
- package/dist/test.js.map +1 -1
- package/dist/unpack-no-eval.cjs +36 -10
- package/dist/unpack-no-eval.cjs.map +1 -1
- package/index.d.cts +1 -0
- package/index.d.ts +1 -0
- package/node-index.js +1 -1
- package/pack.d.cts +1 -1
- package/pack.d.ts +1 -1
- package/pack.js +44 -17
- package/package.json +1 -1
- package/struct.js +1 -1
- package/unpack.js +36 -10
package/unpack.js
CHANGED
|
@@ -999,21 +999,47 @@ const recordDefinition = (id, highByte) => {
|
|
|
999
999
|
currentExtensions[0] = () => {} // notepack defines extension 0 to mean undefined, so use that as the default here
|
|
1000
1000
|
currentExtensions[0].noBuffer = true
|
|
1001
1001
|
|
|
1002
|
-
currentExtensions[0x42] =
|
|
1003
|
-
|
|
1004
|
-
let
|
|
1005
|
-
let
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
value += BigInt(data[i]);
|
|
1002
|
+
currentExtensions[0x42] = data => {
|
|
1003
|
+
let headLength = (data.byteLength % 8) || 8
|
|
1004
|
+
let head = BigInt(data[0] & 0x80 ? data[0] - 0x100 : data[0])
|
|
1005
|
+
for (let i = 1; i < headLength; i++) {
|
|
1006
|
+
head <<= BigInt(8)
|
|
1007
|
+
head += BigInt(data[i])
|
|
1009
1008
|
}
|
|
1010
|
-
|
|
1009
|
+
if (data.byteLength !== headLength) {
|
|
1010
|
+
let view = new DataView(data.buffer, data.byteOffset, data.byteLength)
|
|
1011
|
+
let decode = (start, end) => {
|
|
1012
|
+
let length = end - start
|
|
1013
|
+
if (length <= 40) {
|
|
1014
|
+
let out = view.getBigUint64(start)
|
|
1015
|
+
for (let i = start + 8; i < end; i += 8) {
|
|
1016
|
+
out <<= BigInt(64n)
|
|
1017
|
+
out |= view.getBigUint64(i)
|
|
1018
|
+
}
|
|
1019
|
+
return out
|
|
1020
|
+
}
|
|
1021
|
+
// if (length === 8) return view.getBigUint64(start)
|
|
1022
|
+
let middle = start + (length >> 4 << 3)
|
|
1023
|
+
let left = decode(start, middle)
|
|
1024
|
+
let right = decode(middle, end)
|
|
1025
|
+
return (left << BigInt((end - middle) * 8)) | right
|
|
1026
|
+
}
|
|
1027
|
+
head = (head << BigInt((view.byteLength - headLength) * 8)) | decode(headLength, view.byteLength)
|
|
1028
|
+
}
|
|
1029
|
+
return head
|
|
1011
1030
|
}
|
|
1012
1031
|
|
|
1013
|
-
let errors = {
|
|
1032
|
+
let errors = {
|
|
1033
|
+
Error, EvalError, RangeError, ReferenceError, SyntaxError, TypeError, URIError, AggregateError: typeof AggregateError === 'function' ? AggregateError : null,
|
|
1034
|
+
}
|
|
1014
1035
|
currentExtensions[0x65] = () => {
|
|
1015
1036
|
let data = read()
|
|
1016
|
-
|
|
1037
|
+
if (!errors[data[0]]) {
|
|
1038
|
+
let error = Error(data[1], { cause: data[2] })
|
|
1039
|
+
error.name = data[0]
|
|
1040
|
+
return error
|
|
1041
|
+
}
|
|
1042
|
+
return errors[data[0]](data[1], { cause: data[2] })
|
|
1017
1043
|
}
|
|
1018
1044
|
|
|
1019
1045
|
currentExtensions[0x69] = (data) => {
|