v0.5.0
Pre-release-
BREAKING CHANGES: require TypeScript 5.7 or above
JavaScript has two buffer types:
ArrayBufferandSharedArrayBuffer.
Before ES2024, TypeScript treated them as a single type.
ES2024 introduced distinct features forArrayBufferandSharedArrayBuffer.
To take this divergence into account, TypeScript 5.7 added a generic parameter to buffer views.
By default, it is set toArrayBufferLikethat is a supertype toArrayBufferandSharedArrayBuffer.
This change is backward compatible.TypeScript 5.9 went beyond and introduced a breaking change:
Buffer's views no longer extendArrayBuffer.
Moreover,ArrayBufferLikecannot be assigned toArrayBuffer.To accommodate with this change, all BARE
readfunctions now return a view parametrized withArrayBuffer.
For example,readU8ArrayreturnsUint8Array<ArrayBuffer>.
Because we now use parametrized views likeUint8Array<ArrayBuffer>, you have to use TypeScript 5.7 or above.BARE
writefunctions still accept view with any buffer types. -
Export the default bare configuration
import * as bare from "@bare-ts/lib" const config: bare.Config = bare.DEFAULT_CONFIG
-
Support
require(esm)in Node.js v22.10 and aboveThis package now has the new exports condition
module-sync.
It allows users of Node.js v22.10 and above to import the ESM version of the package usingrequire.
It avoids the issues of dual-package hazard. -
Remove
package.jsonmainandmodulefieldsThe
mainandmodulefields supplemented by theexportsfields.
exportsis supported since Node.js v12.7.0
Since we require a version above, we can safely removemain.All major bundlers now support
exports.
Hence, we can also remove themodulefield.