Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
22ac6cc
Updated bundled SQLite to v3.42.0
daniellockyer May 29, 2023
cdf78bf
- Extensively utilized automatic type deduction for improved code rea…
zenon8adams May 14, 2023
dfbe3ba
Removed unused variable
daniellockyer May 29, 2023
44e570a
Update actions/checkout action to v4
renovate[bot] Sep 4, 2023
7552aa0
Update actions/setup-node action to v4
renovate[bot] Oct 23, 2023
3aeb548
Revert "Update actions/setup-node action to v4"
daniellockyer Dec 22, 2023
8d78ce7
Updated bundled SQLite to v3.44.2
daniellockyer Dec 22, 2023
56ad63c
Added myself to contributors list
daniellockyer Dec 22, 2023
10f38fe
Removed useless try-catch
daniellockyer Dec 22, 2023
080c0d1
Installed setuptools in CI workflow
daniellockyer Dec 23, 2023
93ed997
Condensed npm scripts
daniellockyer Dec 23, 2023
cff38a3
Added CI step to check semver compatibility
daniellockyer Dec 23, 2023
9e8b2ee
Reworked CI versions
daniellockyer Dec 23, 2023
c74f267
Update docker/setup-qemu-action action to v3
renovate[bot] Sep 12, 2023
8482aaf
Update docker/setup-buildx-action action to v3
renovate[bot] Sep 12, 2023
83e282d
Update actions/checkout digest to b4ffde6
renovate[bot] Dec 24, 2023
7674271
Update dependency eslint to v8
renovate[bot] Dec 24, 2023
a2cee71
Update dependency mocha to v10
renovate[bot] Dec 24, 2023
605c7f9
Replaced `@mapbox/node-pre-gyp` in favor of `prebuild` + `prebuild-in…
daniellockyer Dec 23, 2023
2595304
Updated list of supported targets
daniellockyer Dec 24, 2023
c775b81
Extracted common Node-API queuing code into macro
daniellockyer May 28, 2022
aabd297
Update actions/setup-node action to v4
renovate[bot] Dec 24, 2023
5809f62
Fixed uploading prebuilt binaries from Docker
daniellockyer Dec 24, 2023
8bda876
Refactored Database to use macros for method definitions
daniellockyer Dec 27, 2023
603e468
Fixed minor linting warning
daniellockyer Dec 27, 2023
77b327c
Increased number of rows inserted into benchmark database
daniellockyer Dec 27, 2023
3372130
Improved `RowToJS` performance by removing `Napi::String::New` instan…
daniellockyer Dec 27, 2023
e99160a
Inlined `init()` functions into class header files
daniellockyer Dec 27, 2023
4ef11bf
Removed extraneous parameter to event emit function
daniellockyer Dec 27, 2023
f792f69
Update dependency node-addon-api to v7
renovate[bot] Dec 29, 2023
83c8c0a
Configured releases to be created as prereleases
daniellockyer Dec 29, 2023
8b86e41
Fixed uploading release assets on Windows
daniellockyer Dec 29, 2023
8398daa
Fixed uploading assets from Docker
daniellockyer Dec 29, 2023
03d6e75
v5.1.7-rc.0
daniellockyer Dec 29, 2023
d04c1fb
Removed Node version from matrix title
daniellockyer Dec 30, 2023
ba4ba07
v5.1.7
daniellockyer Jan 5, 2024
1609684
Updated bundled SQLite to v3.45.0
daniellockyer Jan 16, 2024
2f0c799
Updated `actions/upload-artifact` to v4
daniellockyer Nov 6, 2024
528e15a
2025
JohnONolan Jan 20, 2025
a85f9e8
Mark repository as unmaintained (#1844)
lsinger Dec 11, 2025
66d054a
2026
JohnONolan Jan 21, 2026
a962b72
Bumped all dependencies and modernised CI for Node 20+/22+/24+
jonatansberg Mar 12, 2026
d808e57
Bumped bundled SQLite from 3.45.0 to 3.52.0
jonatansberg Mar 12, 2026
20a3bd2
v6.0.0
jonatansberg Mar 12, 2026
0ed0c97
Fixed Alpine/musl builds, replaced QEMU with native ARM runners
jonatansberg Mar 12, 2026
a7badce
v6.0.1
jonatansberg Mar 12, 2026
4cd320b
Lock file maintenance (#1860)
renovate[bot] Mar 17, 2026
d00660c
Lock file maintenance (#1862)
renovate[bot] Mar 24, 2026
12760c1
Lock file maintenance (#1865)
renovate[bot] Mar 31, 2026
235c0e6
Lock file maintenance (#1866)
renovate[bot] Apr 7, 2026
2dd39af
Lock file maintenance (#1867)
renovate[bot] Apr 14, 2026
637bb31
Lock file maintenance (#1870)
renovate[bot] Apr 21, 2026
31e8349
Lock file maintenance (#1871)
renovate[bot] Apr 28, 2026
8fcb74f
Lock file maintenance (#1872)
renovate[bot] May 5, 2026
100b799
Lock file maintenance (#1874)
renovate[bot] May 12, 2026
509e528
Lock file maintenance (#1876)
renovate[bot] May 19, 2026
81c20e1
Lock file maintenance (#1878)
renovate[bot] May 26, 2026
3c138cf
Lock file maintenance (#1883)
renovate[bot] Jun 9, 2026
62a7366
Lock file maintenance (#1885)
renovate[bot] Jun 16, 2026
b0e3ed2
Lock file maintenance (#1887)
renovate[bot] Jun 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
141 changes: 66 additions & 75 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,43 +20,54 @@ jobs:
matrix:
os:
- macos-latest
- ubuntu-20.04
- ubuntu-24.04
- windows-latest
host:
- x64
target:
- x64
node:
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 20
- 22
- 24
exclude:
# Node 20 x64 crashes under Rosetta 2 on ARM64 macOS runners
- os: macos-latest
node: 20
host: x64
include:
- os: windows-latest
node: 16
host: x86
target: x86
- os: macos-m1
node: 16
- os: macos-latest
node: 20
host: arm64
target: arm64
- os: macos-latest
node: 22
host: arm64
target: arm64
- os: macos-latest
node: 24
host: arm64
target: arm64
- os: ubuntu-24.04-arm
node: 20
host: arm64
target: arm64
- os: ubuntu-24.04-arm
node: 22
host: arm64
target: arm64
- os: ubuntu-24.04-arm
node: 24
host: arm64
target: arm64
name: ${{ matrix.os }} (node=${{ matrix.node }}, host=${{ matrix.host }}, target=${{ matrix.target }})
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v6
- uses: actions/setup-node@v6
with:
node-version: ${{ matrix.node }}
architecture: ${{ matrix.host }}

- name: Add yarn (self-hosted)
if: matrix.os == 'macos-m1'
run: npm install -g yarn

- name: Add msbuild to PATH
uses: microsoft/setup-msbuild@v1.3
if: contains(matrix.os, 'windows')
Expand All @@ -66,6 +77,9 @@ jobs:
- name: Install dependencies
run: yarn install --ignore-scripts

- name: Check Node compatibility
run: node tools/semver-check.js

- name: Add env vars
shell: bash
run: |
Expand All @@ -83,92 +97,69 @@ jobs:
echo "CFLAGS=${CFLAGS:-} -include ../src/gcc-preinclude.h" >> $GITHUB_ENV
echo "CXXFLAGS=${CXXFLAGS:-} -include ../src/gcc-preinclude.h" >> $GITHUB_ENV

- name: Configure build
run: yarn node-pre-gyp configure --target_arch=${{ env.TARGET }}

- name: Build binaries
run: yarn node-pre-gyp build --target_arch=${{ env.TARGET }}
run: yarn prebuild -a ${{ env.TARGET }}

- name: Print binary info
if: contains(matrix.os, 'ubuntu')
run: |
ldd lib/binding/*/node_sqlite3.node
ldd build/**/node_sqlite3.node
echo "---"
nm lib/binding/*/node_sqlite3.node | grep "GLIBC_" | c++filt || true
nm build/**/node_sqlite3.node | grep "GLIBC_" | c++filt || true
echo "---"
file lib/binding/napi-v*/*
file build/**/node_sqlite3.node

- name: Run tests
run: yarn test

- name: Package prebuilt binaries
run: yarn node-pre-gyp package --target_arch=${{ env.TARGET }}

- name: Upload binaries to commit artifacts
uses: actions/upload-artifact@v3
if: matrix.node == 16
uses: actions/upload-artifact@v7
if: matrix.node == 24
with:
name: prebuilt-binaries
path: build/stage/*/*
name: prebuilt-binaries-${{ matrix.os }}-${{ matrix.host }}
path: prebuilds/*
retention-days: 7

- name: Upload binaries to GitHub Release
run: yarn node-pre-gyp-github publish
if: matrix.node == 16 && startsWith(github.ref, 'refs/tags/')
env:
NODE_PRE_GYP_GITHUB_TOKEN: ${{ github.token }}
build-qemu:
runs-on: ubuntu-latest
run: yarn upload --upload-all ${{ github.token }}
if: matrix.node == 24 && startsWith(github.ref, 'refs/tags/')

build-musl:
if: github.event_name == 'workflow_dispatch' || startsWith(github.ref, 'refs/tags/')
strategy:
fail-fast: false
matrix:
node:
- 16
target:
- linux/arm64
variant:
- bullseye
- alpine3.15
include:
# musl x64 builds
- target: linux/amd64
variant: alpine3.15
node: 16
name: ${{ matrix.variant }} (node=${{ matrix.node }}, target=${{ matrix.target }})
- runner: ubuntu-24.04-arm
platform: linux/arm64
arch: arm64
- runner: ubuntu-24.04
platform: linux/amd64
arch: amd64
runs-on: ${{ matrix.runner }}
name: musl ${{ matrix.arch }}
steps:
- uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2
- uses: actions/checkout@v6

- name: Build binaries and test
run: |
docker buildx build \
docker build \
--file ./tools/BinaryBuilder.Dockerfile \
--load \
--tag sqlite-builder \
--platform ${{ matrix.target }} \
--no-cache \
--build-arg VARIANT=${{ matrix.variant }} \
--build-arg NODE_VERSION=${{ matrix.node }} \
--build-arg VARIANT=alpine3.20 \
--build-arg NODE_VERSION=24 \
.
CONTAINER_ID=$(docker create -it sqlite-builder)
docker cp $CONTAINER_ID:/usr/src/build/build/ ./build
docker cp $CONTAINER_ID:/usr/src/build/prebuilds/ ./prebuilds

- name: Upload binaries to commit artifacts
uses: actions/upload-artifact@v3
if: matrix.node == 16
uses: actions/upload-artifact@v7
with:
name: prebuilt-binaries
path: build/stage/*/*
name: prebuilt-binaries-musl-${{ matrix.arch }}
path: prebuilds/*
retention-days: 7

- name: Upload binaries to GitHub Release
run: yarn install --ignore-scripts && yarn node-pre-gyp-github publish
if: matrix.node == 16 && startsWith(github.ref, 'refs/tags/')
env:
NODE_PRE_GYP_GITHUB_TOKEN: ${{ github.token }}
run: yarn install --ignore-scripts && yarn upload --upload-all ${{ github.token }}
if: startsWith(github.ref, 'refs/tags/')
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,4 @@ setup.sh
/build-tmp-napi-v6
*.tgz
package-lock.json
yarn.lock
prebuilds
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright (c) MapBox
Copyright (c) 2013-2026 Mapbox & Ghost Foundation
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
Expand Down
46 changes: 19 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# ⚙️ node-sqlite3
# :no_entry: [DEPRECATED] node-sqlite3

**Note:** This repository is currently unmaintained. We will not update any of its issues or pull requests.

---
Asynchronous, non-blocking [SQLite3](https://sqlite.org/) bindings for [Node.js](http://nodejs.org/).

[![Latest release](https://img.shields.io/github/release/TryGhost/node-sqlite3.svg)](https://www.npmjs.com/package/sqlite3)
Expand All @@ -17,7 +20,7 @@ Asynchronous, non-blocking [SQLite3](https://sqlite.org/) bindings for [Node.js]
- [Extension support](https://github.com/TryGhost/node-sqlite3/wiki/API#databaseloadextensionpath-callback), including bundled support for the [json1 extension](https://www.sqlite.org/json1.html)
- Big test suite
- Written in modern C++ and tested for memory leaks
- Bundles SQLite v3.41.1, or you can build using a local SQLite
- Bundles SQLite v3.52.0, or you can build using a local SQLite

# Installing

Expand All @@ -33,34 +36,23 @@ yarn add sqlite3

### Prebuilt binaries

`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 v10+.

The module uses [node-pre-gyp](https://github.com/mapbox/node-pre-gyp) 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:
`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+.

Format: `napi-v{napi_build_version}-{platform}-{libc}-{arch}`
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:

* `napi-v3-darwin-unknown-arm64`
* `napi-v3-darwin-unknown-x64`
* `napi-v3-linux-glibc-arm64`
* `napi-v3-linux-glibc-x64`
* `napi-v3-linux-musl-arm64`
* `napi-v3-linux-musl-x64`
* `napi-v3-win32-unknown-ia32`
* `napi-v3-win32-unknown-x64`
* `napi-v6-darwin-unknown-arm64`
* `napi-v6-darwin-unknown-x64`
* `napi-v6-linux-glibc-arm64`
* `napi-v6-linux-glibc-x64`
* `napi-v6-linux-musl-arm64`
* `napi-v6-linux-musl-x64`
* `napi-v6-win32-unknown-ia32`
* `napi-v6-win32-unknown-x64`
* `darwin-arm64`
* `darwin-x64`
* `linux-arm64`
* `linux-x64`
* `linuxmusl-arm64`
* `linuxmusl-x64`
* `win32-x64`

Unfortunately, [node-pre-gyp](https://github.com/mapbox/node-pre-gyp) cannot differentiate between `armv6` and `armv7`, and instead uses `arm` as the `{arch}`. Until that is fixed, you will still need to install `sqlite3` from [source](#source-install).
Unfortunately, [prebuild](https://github.com/prebuild/prebuild/issues/174) cannot differentiate between `armv6` and `armv7`, and instead uses `arm` as the `{arch}`. Until that is fixed, you will still need to install `sqlite3` from [source](#source-install).

Support for other platforms and architectures may be added in the future if CI supports building on them.

If your environment isn't supported, it'll use `node-gyp` to build SQLite but you will need to install a C++ compiler and linker.
If your environment isn't supported, it'll use `node-gyp` to build SQLite, but you will need to install a C++ compiler and linker.

### Other ways to install

Expand Down Expand Up @@ -148,8 +140,6 @@ NODE_WEBKIT_VERSION="0.8.6" # see latest version at https://github.com/rogerwang
npm install sqlite3 --build-from-source --runtime=node-webkit --target_arch=ia32 --target=$(NODE_WEBKIT_VERSION)
```

This command internally calls out to [`node-pre-gyp`](https://github.com/mapbox/node-pre-gyp) which itself calls out to [`nw-gyp`](https://github.com/rogerwang/nw-gyp) when the `--runtime=node-webkit` option is passed.

You can also run this command from within a `sqlite3` checkout:

```bash
Expand Down Expand Up @@ -254,7 +244,9 @@ This module was originally created by [Mapbox](https://mapbox.com/) & is now mai

We use [GitHub releases](https://github.com/TryGhost/node-sqlite3/releases) for notes on the latest versions. See [CHANGELOG.md](https://github.com/TryGhost/node-sqlite3/blob/b05f4594cf8b0de64743561fcd2cfe6f4571754d/CHANGELOG.md) in git history for details on older versions.

# License
# Copyright & license

Copyright (c) 2013-2026 Mapbox & Ghost Foundation

`node-sqlite3` is [BSD licensed](https://github.com/tryghost/node-sqlite3/raw/master/LICENSE).

Expand Down
14 changes: 2 additions & 12 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"includes": [ "deps/common-sqlite.gypi" ],
"variables": {
"sqlite%":"internal",
"sqlite_libname%":"sqlite3"
"sqlite_libname%":"sqlite3",
"module_name": "node_sqlite3",
},
"targets": [
{
Expand Down Expand Up @@ -52,17 +53,6 @@
"src/statement.cc"
],
"defines": [ "NAPI_VERSION=<(napi_build_version)", "NAPI_DISABLE_CPP_EXCEPTIONS=1" ]
},
{
"target_name": "action_after_build",
"type": "none",
"dependencies": [ "<(module_name)" ],
"copies": [
{
"files": [ "<(PRODUCT_DIR)/<(module_name).node" ],
"destination": "<(module_path)"
}
]
}
]
}
2 changes: 1 addition & 1 deletion deps/common-sqlite.gypi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
'variables': {
'sqlite_version%':'3410100',
'sqlite_version%':'3520000',
"toolset%":'',
},
'target_defaults': {
Expand Down
9 changes: 9 additions & 0 deletions deps/extract.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const tar = require("tar");
const fs = require("fs");
const path = require("path");
const tarball = path.resolve(process.argv[2]);
const dirname = path.resolve(process.argv[3]);
Expand All @@ -8,3 +9,11 @@ tar.extract({
file: tarball,
cwd: dirname,
});

// SQLite >= 3.49 ships a VERSION file that conflicts with the C++20 <version>
// header on case-insensitive filesystems (macOS/Windows).
const base = path.basename(tarball, ".tar.gz");
const versionFile = path.join(dirname, base, "VERSION");
if (fs.existsSync(versionFile)) {
fs.unlinkSync(versionFile);
}
Binary file removed deps/sqlite-autoconf-3410100.tar.gz
Binary file not shown.
Binary file added deps/sqlite-autoconf-3520000.tar.gz
Binary file not shown.
6 changes: 1 addition & 5 deletions lib/sqlite3-binding.js
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
const binary = require('@mapbox/node-pre-gyp');
const path = require('path');
const binding_path = binary.find(path.resolve(path.join(__dirname,'../package.json')));
const binding = require(binding_path);
module.exports = exports = binding;
module.exports = require('bindings')('node_sqlite3.node');
Loading