Release v2.0.0
·
63 commits
to main
since this release
Immutable
release. Only release title and notes can be modified.
API compatible with node:sqlite from Node.js v26.4.0.
Added
DatabaseSync.prototype.serialize([dbName])andDatabaseSync.prototype.deserialize(buffer, [options]): Serialize a database to aUint8Arrayand load one back, matching thenode:sqliteAPIs added in Node.js PR #59967. Wrapssqlite3_serialize/sqlite3_deserializeand finalizes any open prepared statements before replacing database content.
Changed
- BREAKING: Dropped support for Node.js 20 (end-of-life April 2026);
@photostructure/sqlitenow requires Node.js 22 or newer (package.jsonenginesis>=22). This is why this release is 2.0.0 rather than a 1.x minor. - SQLite 3.53.3: Updated from 3.53.0. Three patch releases (3.53.1–3.53.3), bug fixes only, no API impact (release notes).
- Upstream sync: Node.js
v25.x-staging@ffa9b8f→v26.x-staging@c96c838. Beyondserialize()/deserialize(), upstream added a column-name caching path and asimdutffast path for ASCII column text inStatementSync— both V8/internal-only optimizations with no N-API equivalent, so not ported. Subsequentnode:sqlitebug fixes — closing the connection after a failedopen(), changesetxFilter/callback-lifetime hardening, and reading the column count after the firststep()inall()— are already covered by our port's structure and needed no change. - Statement finalization on
db.close(): LiveStatementSyncinstances are now eagerly detached when their database closes, so further method calls throwERR_INVALID_STATEwith"statement has been finalized"(matchingnode:sqlite) instead of"Database connection is closed". Statement error messages were also normalized to lowercase"statement has been finalized"throughout. - Build hardening (
SQLITE_ENABLE_API_ARMOR): The bundled SQLite is now compiled with API armor, so misuse of the C API — for example by a loaded extension such as sqlite-vec — returnsSQLITE_MISUSEinstead of risking undefined behavior or a process abort the caller cannot catch. Negligible runtime cost; the public JavaScript API is unaffected. - Callback reentrancy hardening: operations SQLite forbids from inside its own callbacks (notably
close/deserialize, plusprepare/exec/step/serialize/setAuthorizerfrom an authorizer) now throwERR_INVALID_STATEinstead of corrupting connection state. Intentional divergence fromnode:sqlite(nodejs/node#63207). - Config setters frozen mid-step:
setReadBigInts,setReturnArrays, and thesetAllow*parameter setters throwERR_INVALID_STATEif called while the statement is executing.
Fixed
- Backup teardown stability: In-flight
backup()operations are now safe when a Node environment is shutting down. Backup jobs avoid resolving/rejecting promises or routing expected SQLite failures through node-addon-api's async worker error path after teardown begins. - Authorizer error identity: the exact value thrown by an authorizer callback (subclass,
code, message, thrown primitives) now propagates unchanged through prepare/exec/step/serialize/deserialize/changeset/extension load, instead of being replaced by a generic error. - TEXT with embedded NUL bytes: returned in full via byte-length conversion instead of being truncated at the first NUL.
Performance
- Faster multi-row reads: per-statement column-key caching, byte-length string conversion, per-column exception checks removed from the row builder, and a native iterator fast path for flat/raw modes.
-fno-plton Linux removes PLT indirection from Node-API calls in the hot path.
Internal
- Docs: bulk-read performance tradeoff documented honestly; Node 22 requirement propagated across docs and examples.
- Benchmark suite reworked for fair, reproducible driver comparison (deterministic workloads, median confidence intervals, per-scenario ratios, SVG charts) plus correlation-gated memory-leak detection.
- Dependencies: node-addon-api 8.9.0, TypeScript 6, ESLint 10, prettier 3.8.5,
@types/node26. - CI: pinned-action updates (CodeQL, TruffleHog, OSV-Scanner, actions/checkout).
Commits
Full Changelog: v1.2.1...v2.0.0