Skip to content

v0.6.0

Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 16 Nov 21:38
· 16 commits to main since this release
v0.6.0
7217952
  • Support resizable ArrayBuffer and growable SharedArrayBuffer

    ES2024 introduced resizable ArrayBuffer and growable SharedArrayBuffer.
    @bare-ts/lib now handle these new features by resizing and growing in-place the buffer
    when it reserves space for writing.

    Note that the library still respects the maxBufferLength configuration.

    If maxBufferLength is greater than the buffer's maxByteLength, while a new
    buffer is allocated once maxByteLength is exceeded.

    In the following code, the buffer is resized in-place when writeFixedString is called.

    import * as bare from "@bare-ts/lib"
    
    const resizableBuffer = new ArrayBuffer(0, { maxByteLength: 10 })
    
    const config = bare.Config({ initialBufferLength: 0, maxBufferLength: 10 })
    const bc = new bare.ByteCursor(new Uint8Array(resizableBuffer), config)
    
    bare.writeFixedString(bc, "bare")
  • Export assert, DEV and integer validators

    @bare-ts/lib now exports an assert function and integer validators such as isI32.
    We plan to use these functions in a future version of @bare-ts/tools.

    The library also exports a DEV constant that is true if the development condition is passed,
    or if NODE_ENV is set to development under the node condition.
    Use the Node's CLI option --conditions to pass the development condition.

    These functions should only be used for validating arguments of BARE decoders and encoders.