Skip to content

Commit 1aa4ca6

Browse files
feat(node:sqlite): add node:sqlite driver
1 parent dfe5c50 commit 1aa4ca6

File tree

7 files changed

+450
-13
lines changed

7 files changed

+450
-13
lines changed

.github/workflows/publish.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,12 @@ jobs:
2424
- name: Setup bun
2525
uses: oven-sh/setup-bun@v1
2626
with:
27-
bun-version: 1.1.40
27+
bun-version: 1.1.42
2828

2929
- name: Setup Node.js
3030
uses: actions/setup-node@v4
3131
with:
32-
node-version: '22'
32+
node-version: '22.12.0'
3333
registry-url: 'https://registry.npmjs.org'
3434

3535
- name: Install dependencies

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
`cachified-adapter-sqlite` is an adapter for [@epic-web/cachified](https://github.com/epicweb-dev/cachified) that allows you to use SQLite as a cache backend.
88

9-
It supports [`better-sqlite3`](https://github.com/WiseLibs/better-sqlite3), [`sqlite`](https://github.com/kriasoft/node-sqlite), [`sqlite3`](https://github.com/TryGhost/node-sqlite3), and [`bun:sqlite`](https://bun.sh/docs/api/sqlite).
9+
It supports [`better-sqlite3`](https://github.com/WiseLibs/better-sqlite3), [`sqlite`](https://github.com/kriasoft/node-sqlite), [`sqlite3`](https://github.com/TryGhost/node-sqlite3), [`bun:sqlite`](https://bun.sh/docs/api/sqlite), and [`node:sqlite`](https://nodejs.org/docs/latest-v22.x/api/sqlite.html).
1010

1111

1212
## Installation
@@ -51,6 +51,7 @@ import Database from "better-sqlite3"
5151
import { sqliteCacheAdapter, createSqliteCacheTable } from "cachified-adapter-sqlite/sqlite" // sqlite
5252
import { sqlite3CacheAdapter, createSqlite3CacheTable } from "cachified-adapter-sqlite/sqlite3" // sqlite3
5353
import { bunSqliteCacheAdapter, createBunSqliteCacheTable } from "cachified-adapter-sqlite/bun" // bun:sqlite
54+
import { nodeSqliteCacheAdapter, createNodeSqliteCacheTable } from "cachified-adapter-sqlite/node-sqlite" // node:sqlite
5455
5556
const TABLE_NAME = "cache"
5657
const database = new Database(":memory:") // create a database using your library of choice

bun.lockb

10.8 KB
Binary file not shown.

package.json

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,19 @@
11
{
22
"name": "cachified-adapter-sqlite",
33
"version": "1.0.2",
4-
"description": "SQLite adapter for @epic-web/cachified. Compatible with better-sqlite3, sqlite, sqlite3, and Bun SQLite.",
4+
"description": "SQLite adapter for @epic-web/cachified. Compatible with better-sqlite3, sqlite, sqlite3, node:sqlite, and bun:sqlite.",
55
"sideEffects": false,
66
"type": "module",
7-
"packageManager": "[email protected].40",
7+
"packageManager": "[email protected].42",
88
"keywords": [
99
"cache",
1010
"@epic-web/cachified",
1111
"cachified",
1212
"sqlite",
1313
"bun-sqlite",
1414
"better-sqlite3",
15-
"sqlite3"
15+
"sqlite3",
16+
"node-sqlite"
1617
],
1718
"homepage": "https://github.com/MonsterDeveloper/cachified-adapter-sqlite",
1819
"repository": {
@@ -50,6 +51,10 @@
5051
"./bun": {
5152
"import": "./dist/bun.js",
5253
"types": "./dist/bun.d.ts"
54+
},
55+
"./node-sqlite": {
56+
"import": "./dist/node-sqlite.js",
57+
"types": "./dist/node-sqlite.d.ts"
5358
}
5459
},
5560
"publishConfig": {
@@ -61,17 +66,19 @@
6166
"@changesets/cli": "^2.27.11",
6267
"@commitlint/cli": "^19.6.1",
6368
"@commitlint/config-conventional": "^19.6.0",
69+
"@epic-web/cachified": "^5.2.0",
6470
"@types/better-sqlite3": "^7.6.12",
6571
"@types/bun": "latest",
72+
"@types/node": "^22.10.2",
73+
"better-sqlite3": "^11.7.0",
6674
"husky": "^9.1.7",
75+
"sqlite": "^5.1.1",
76+
"sqlite3": "^5.1.7",
77+
"tsx": "^4.19.2",
6778
"typescript": "^5.7.2",
6879
"vite-plugin-dts": "^4.4.0",
6980
"vite-tsconfig-paths": "^5.1.4",
70-
"vitest": "^2.1.8",
71-
"@epic-web/cachified": "^5.2.0",
72-
"better-sqlite3": "^11.7.0",
73-
"sqlite": "^5.1.1",
74-
"sqlite3": "^5.1.7"
81+
"vitest": "^2.1.8"
7582
},
7683
"peerDependencies": {
7784
"@epic-web/cachified": "^5.2.0",
@@ -93,7 +100,10 @@
93100
"scripts": {
94101
"prepare": "husky",
95102
"build": "vite build",
96-
"test": "vitest run && bun test bun.test.ts",
103+
"test:vitest": "vitest run",
104+
"test:bun": "bun test bun.test.ts",
105+
"test:node": "node --import tsx --test --experimental-sqlite src/__tests__/node-sqlite.test.ts",
106+
"test": "bun test:vitest && bun test:bun && bun test:node",
97107
"check": "biome check",
98108
"check-exports": "attw --pack . --ignore-rules=cjs-resolves-to-esm --profile node16",
99109
"typecheck": "tsc",

0 commit comments

Comments
 (0)