Skip to content

Commit 696709f

Browse files
committed
update docs
1 parent d855c81 commit 696709f

2 files changed

Lines changed: 38 additions & 3 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ yarn add @homeofthings/sqlite3
3636

3737
### Prebuilt binaries
3838

39-
`sqlite3` v5+ was rewritten to use [Node-API](https://nodejs.org/api/n-api.html) so prebuilt binaries do not need to be built for specific Node versions. `sqlite3` currently builds for both Node-API v3 and v6. Check the [Node-API version matrix](https://nodejs.org/api/n-api.html#node-api-version-matrix) to ensure your Node version supports one of these. The prebuilt binaries should be supported on Node v20.17.0+.
39+
`@homeofthings/sqlite3` uses [Node-API](https://nodejs.org/api/n-api.html) so prebuilt binaries do not need to be built for specific Node versions. Prebuilt binaries are available for Node-API v3 and v6. Check the [Node-API version matrix](https://nodejs.org/api/n-api.html#node-api-version-matrix) to ensure your Node version supports one of these. Requires Node.js v20.17.0 or later.
4040

41-
The module uses [`prebuild-install`](https://github.com/prebuild/prebuild-install) to download the prebuilt binary for your platform, if it exists. These binaries are hosted on GitHub Releases for `sqlite3` versions above 5.0.2, and they are hosted on S3 otherwise. The following targets are currently provided:
41+
The module uses [`prebuild-install`](https://github.com/prebuild/prebuild-install) to download the prebuilt binary for your platform, if it exists. These binaries are hosted on GitHub Releases. The following targets are currently provided:
4242

4343
* `darwin-arm64`
4444
* `darwin-x64`

memory-bank/build-system.md

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,42 @@ The `NAPI_VERSION` define is set via `napi_build_version` variable in binding.gy
127127
- For local builds, it's stored in `build/config.gypi` (e.g., `"napi_build_version": "9"`)
128128
- For prebuilds, the `prebuild` package passes it via `--napi_build_version=<version>` flag
129129

130-
**Prebuilt binaries**: Available for NAPI versions 3 and 6 (see `package.json` `binary.napi_versions`).
130+
### NAPI Versions Configuration
131+
132+
The `package.json` specifies which NAPI versions to build prebuilt binaries for:
133+
134+
```json
135+
"binary": {
136+
"napi_versions": [3, 6]
137+
}
138+
```
139+
140+
**Why multiple versions?**
141+
142+
NAPI versions are independent of Node.js versions - they represent API feature tiers, not Node.js version numbers. Each NAPI version adds new capabilities:
143+
144+
| NAPI Version | Key Features Added |
145+
|--------------|-----------------------------------------|
146+
| v3 | Instance data, cleanup hooks |
147+
| v4 | Thread-safe functions |
148+
| v5 | BigInt support |
149+
| v6 | Instance data with finalizer hints |
150+
| v7 | ArrayBuffer detaching |
151+
| v8 | Type tagging, async cleanup |
152+
| v9 | External strings, syntax error creation |
153+
| v10 | Latin1 external strings |
154+
155+
**Backward Compatibility**:
156+
157+
NAPI is backward compatible - a binary built for NAPI v3 will run on any Node.js that supports v3 or higher. Since Node.js 20.17.0+ supports NAPI v9, it can run binaries built for v3, v6, or v9.
158+
159+
**Code Conditionals**:
160+
161+
The source code uses `#if NAPI_VERSION < 6` conditionals in [`src/database.h`](../src/database.h) and [`src/database.cc`](../src/database.cc) to provide backward compatibility for NAPI versions below v6. When building for NAPI v6+, these conditionals are disabled.
162+
163+
**Current Configuration Rationale**:
164+
165+
The `[3, 6]` configuration is historical from when this fork supported older Node.js versions. Since the project now requires Node.js >= 20.17.0 (which supports NAPI v9), both prebuilt variants work correctly. Future versions could simplify to a single NAPI version (e.g., v6 or v9).
131166

132167
## Assert Control
133168

0 commit comments

Comments
 (0)