msgpackr 1.9.5 → 1.9.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 +25 -19
- 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 +25 -19
- 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 +25 -19
- package/dist/node.cjs.map +1 -1
- package/dist/test.js +25 -19
- package/dist/test.js.map +1 -1
- package/pack.js +25 -19
- package/package.json +1 -1
package/dist/test.js
CHANGED
|
@@ -1319,25 +1319,9 @@
|
|
|
1319
1319
|
return target.subarray(start, position) // position can change if we call pack again in saveStructures, so we get the buffer now
|
|
1320
1320
|
} finally {
|
|
1321
1321
|
if (structures) {
|
|
1322
|
-
|
|
1323
|
-
serializationsSinceTransitionRebuild++;
|
|
1324
|
-
let sharedLength = structures.sharedLength || 0;
|
|
1325
|
-
if (structures.length > sharedLength && !isSequential)
|
|
1326
|
-
structures.length = sharedLength;
|
|
1327
|
-
if (transitionsCount > 10000) {
|
|
1328
|
-
// force a rebuild occasionally after a lot of transitions so it can get cleaned up
|
|
1329
|
-
structures.transitions = null;
|
|
1330
|
-
serializationsSinceTransitionRebuild = 0;
|
|
1331
|
-
transitionsCount = 0;
|
|
1332
|
-
if (recordIdsToRemove.length > 0)
|
|
1333
|
-
recordIdsToRemove = [];
|
|
1334
|
-
} else if (recordIdsToRemove.length > 0 && !isSequential) {
|
|
1335
|
-
for (let i = 0, l = recordIdsToRemove.length; i < l; i++) {
|
|
1336
|
-
recordIdsToRemove[i][RECORD_SYMBOL] = 0;
|
|
1337
|
-
}
|
|
1338
|
-
recordIdsToRemove = [];
|
|
1339
|
-
}
|
|
1322
|
+
resetStructures();
|
|
1340
1323
|
if (hasSharedUpdate && packr.saveStructures) {
|
|
1324
|
+
let sharedLength = structures.sharedLength || 0;
|
|
1341
1325
|
// we can't rely on start/end with REUSE_BUFFER_MODE since they will (probably) change when we save
|
|
1342
1326
|
let returnBuffer = target.subarray(start, position);
|
|
1343
1327
|
let newSharedData = prepareStructures$1(structures, packr);
|
|
@@ -1353,6 +1337,26 @@
|
|
|
1353
1337
|
position = start;
|
|
1354
1338
|
}
|
|
1355
1339
|
};
|
|
1340
|
+
const resetStructures = () => {
|
|
1341
|
+
if (serializationsSinceTransitionRebuild < 10)
|
|
1342
|
+
serializationsSinceTransitionRebuild++;
|
|
1343
|
+
let sharedLength = structures.sharedLength || 0;
|
|
1344
|
+
if (structures.length > sharedLength && !isSequential)
|
|
1345
|
+
structures.length = sharedLength;
|
|
1346
|
+
if (transitionsCount > 10000) {
|
|
1347
|
+
// force a rebuild occasionally after a lot of transitions so it can get cleaned up
|
|
1348
|
+
structures.transitions = null;
|
|
1349
|
+
serializationsSinceTransitionRebuild = 0;
|
|
1350
|
+
transitionsCount = 0;
|
|
1351
|
+
if (recordIdsToRemove.length > 0)
|
|
1352
|
+
recordIdsToRemove = [];
|
|
1353
|
+
} else if (recordIdsToRemove.length > 0 && !isSequential) {
|
|
1354
|
+
for (let i = 0, l = recordIdsToRemove.length; i < l; i++) {
|
|
1355
|
+
recordIdsToRemove[i][RECORD_SYMBOL] = 0;
|
|
1356
|
+
}
|
|
1357
|
+
recordIdsToRemove = [];
|
|
1358
|
+
}
|
|
1359
|
+
};
|
|
1356
1360
|
const packArray = (value) => {
|
|
1357
1361
|
var length = value.length;
|
|
1358
1362
|
if (length < 0x10) {
|
|
@@ -1802,8 +1806,9 @@
|
|
|
1802
1806
|
}
|
|
1803
1807
|
// now write the values
|
|
1804
1808
|
for (let key in object)
|
|
1805
|
-
if (safePrototype || object.hasOwnProperty(key))
|
|
1809
|
+
if (safePrototype || object.hasOwnProperty(key)) {
|
|
1806
1810
|
pack(object[key]);
|
|
1811
|
+
}
|
|
1807
1812
|
};
|
|
1808
1813
|
|
|
1809
1814
|
// craete reference to useRecords if useRecords is a function
|
|
@@ -1922,6 +1927,7 @@
|
|
|
1922
1927
|
position = newPosition;
|
|
1923
1928
|
let startTarget = target;
|
|
1924
1929
|
pack(value);
|
|
1930
|
+
resetStructures();
|
|
1925
1931
|
if (startTarget !== target) {
|
|
1926
1932
|
return { position, targetView, target }; // indicate the buffer was re-allocated
|
|
1927
1933
|
}
|