msgpackr 1.9.7 → 1.9.9
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 +6 -4
- 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 +6 -4
- 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 +26 -23
- package/dist/node.cjs.map +1 -1
- package/dist/test.js +26 -23
- package/dist/test.js.map +1 -1
- package/dist/unpack-no-eval.cjs +2 -2
- package/dist/unpack-no-eval.cjs.map +1 -1
- package/pack.js +4 -2
- package/package.json +1 -1
- package/struct.js +20 -19
- package/unpack.js +2 -2
package/dist/index.js
CHANGED
|
@@ -169,8 +169,8 @@
|
|
|
169
169
|
}
|
|
170
170
|
return this.structures = loadedStructures
|
|
171
171
|
}
|
|
172
|
-
decode(source,
|
|
173
|
-
return this.unpack(source,
|
|
172
|
+
decode(source, options) {
|
|
173
|
+
return this.unpack(source, options)
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
176
|
function checkedRead(options) {
|
|
@@ -1164,6 +1164,7 @@
|
|
|
1164
1164
|
} else
|
|
1165
1165
|
position = (position + 7) & 0x7ffffff8; // Word align to make any future copying of this buffer faster
|
|
1166
1166
|
start = position;
|
|
1167
|
+
if (encodeOptions & RESERVE_START_SPACE) position += (encodeOptions & 0xff);
|
|
1167
1168
|
referenceMap = packr.structuredClone ? new Map() : null;
|
|
1168
1169
|
if (packr.bundleStrings && typeof value !== 'string') {
|
|
1169
1170
|
bundledStrings = [];
|
|
@@ -1265,7 +1266,7 @@
|
|
|
1265
1266
|
let newSharedData = prepareStructures(structures, packr);
|
|
1266
1267
|
if (packr.saveStructures(newSharedData, newSharedData.isCompatible) === false) {
|
|
1267
1268
|
// get updated structures and try again if the update failed
|
|
1268
|
-
return packr.pack(value)
|
|
1269
|
+
return packr.pack(value, encodeOptions)
|
|
1269
1270
|
}
|
|
1270
1271
|
packr.lastNamedStructuresLength = sharedLength;
|
|
1271
1272
|
return returnBuffer
|
|
@@ -1859,7 +1860,7 @@
|
|
|
1859
1860
|
}
|
|
1860
1861
|
};
|
|
1861
1862
|
const writeStruct = (object, safePrototype) => {
|
|
1862
|
-
let newPosition = writeStructSlots(object, target, position, structures, makeRoom, (value, newPosition, notifySharedUpdate) => {
|
|
1863
|
+
let newPosition = writeStructSlots(object, target, start, position, structures, makeRoom, (value, newPosition, notifySharedUpdate) => {
|
|
1863
1864
|
if (notifySharedUpdate)
|
|
1864
1865
|
return hasSharedUpdate = true;
|
|
1865
1866
|
position = newPosition;
|
|
@@ -2127,6 +2128,7 @@
|
|
|
2127
2128
|
const { NEVER, ALWAYS, DECIMAL_ROUND, DECIMAL_FIT } = FLOAT32_OPTIONS;
|
|
2128
2129
|
const REUSE_BUFFER_MODE = 512;
|
|
2129
2130
|
const RESET_BUFFER_MODE = 1024;
|
|
2131
|
+
const RESERVE_START_SPACE = 2048;
|
|
2130
2132
|
|
|
2131
2133
|
/**
|
|
2132
2134
|
* Given an Iterable first argument, returns an Iterable where each value is packed as a Buffer
|