msgpackr 1.11.5 → 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/index.d.cts CHANGED
@@ -88,3 +88,4 @@ export class UnpackrStream extends Transform {
88
88
  export class PackrStream extends Transform {
89
89
  constructor(options?: Options | { highWaterMark: number, emitClose: boolean, allowHalfOpen: boolean })
90
90
  }
91
+ export { PackrStream as EncoderStream, UnpackrStream as DecoderStream };
package/index.d.ts CHANGED
@@ -88,3 +88,4 @@ export class UnpackrStream extends Transform {
88
88
  export class PackrStream extends Transform {
89
89
  constructor(options?: Options | { highWaterMark: number, emitClose: boolean, allowHalfOpen: boolean })
90
90
  }
91
+ export { PackrStream as EncoderStream, UnpackrStream as DecoderStream };
package/node-index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { Packr, Encoder, addExtension, pack, encode, NEVER, ALWAYS, DECIMAL_ROUND, DECIMAL_FIT } from './pack.js'
1
+ export { Packr, Encoder, addExtension, pack, encode, NEVER, ALWAYS, DECIMAL_ROUND, DECIMAL_FIT, REUSE_BUFFER_MODE, RESET_BUFFER_MODE, RESERVE_START_SPACE } from './pack.js'
2
2
  export { Unpackr, Decoder, C1, unpack, unpackMultiple, decode, FLOAT32_OPTIONS, clearSource, roundFloat32, isNativeAccelerationEnabled } from './unpack.js'
3
3
  import './struct.js'
4
4
  export { PackrStream, UnpackrStream, PackrStream as EncoderStream, UnpackrStream as DecoderStream } from './stream.js'
package/pack.d.cts CHANGED
@@ -1 +1 @@
1
- export { Unpackr, Decoder, Packr, Encoder, pack, encode, unpack, decode, addExtension, FLOAT32_OPTIONS } from '.'
1
+ export { Unpackr, Decoder, Packr, Encoder, pack, encode, unpack, decode, addExtension, FLOAT32_OPTIONS, REUSE_BUFFER_MODE, RESET_BUFFER_MODE, RESERVE_START_SPACE } from '.'
package/pack.d.ts CHANGED
@@ -1 +1 @@
1
- export { Unpackr, Decoder, Packr, Encoder, pack, encode, unpack, decode, addExtension, FLOAT32_OPTIONS } from '.'
1
+ export { Unpackr, Decoder, Packr, Encoder, pack, encode, unpack, decode, addExtension, FLOAT32_OPTIONS, REUSE_BUFFER_MODE, RESET_BUFFER_MODE, RESERVE_START_SPACE } from '.'
package/pack.js CHANGED
@@ -123,7 +123,8 @@ export class Packr extends Unpackr {
123
123
  hasSharedUpdate = false
124
124
  let encodingError;
125
125
  try {
126
- if (packr.randomAccessStructure && value && value.constructor && value.constructor === Object)
126
+ if (packr.randomAccessStructure && value && value.constructor && (value.constructor === Object ||
127
+ (value.constructor !== Map && !Array.isArray(value) && !extensionClasses.some(extClass => value instanceof extClass))))
127
128
  writeStruct(value);
128
129
  else
129
130
  pack(value)
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "msgpackr",
3
3
  "author": "Kris Zyp",
4
- "version": "1.11.5",
4
+ "version": "1.11.6",
5
5
  "description": "Ultra-fast MessagePack implementation with extensions for records and structured cloning",
6
6
  "license": "MIT",
7
7
  "types": "./index.d.ts",