@starkeep/storage-sqlite 0.3.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +4 -4
- package/dist/adapter-DoVOV6K-.d.cts +126 -0
- package/dist/adapter-DoVOV6K-.d.ts +126 -0
- package/dist/index.cjs +617 -214
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +172 -71
- package/dist/index.d.ts +172 -71
- package/dist/index.js +645 -193
- package/dist/index.js.map +1 -1
- package/dist/node-entry.cjs +45 -0
- package/dist/node-entry.cjs.map +1 -0
- package/dist/node-entry.d.cts +32 -0
- package/dist/node-entry.d.ts +32 -0
- package/dist/node-entry.js +18 -0
- package/dist/node-entry.js.map +1 -0
- package/package.json +10 -5
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
// src/node-driver.ts
|
|
2
|
+
import { DatabaseSync } from "node:sqlite";
|
|
3
|
+
import { mkdirSync, existsSync } from "node:fs";
|
|
4
|
+
import { dirname } from "node:path";
|
|
5
|
+
var nodeSqliteDriver = {
|
|
6
|
+
open: (path) => {
|
|
7
|
+
if (path !== ":memory:") {
|
|
8
|
+
const dir = dirname(path);
|
|
9
|
+
if (!existsSync(dir)) mkdirSync(dir, { recursive: true });
|
|
10
|
+
}
|
|
11
|
+
return new DatabaseSync(path);
|
|
12
|
+
},
|
|
13
|
+
close: (db) => db.close()
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
nodeSqliteDriver
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=node-entry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/node-driver.ts"],"sourcesContent":["/**\n * The Node driver, and the only file in this package that names `node:sqlite`.\n *\n * ## Why it is not in the barrel\n *\n * A static `import { DatabaseSync } from \"node:sqlite\"` at module scope does not\n * merely fail on React Native — it makes the whole package unbundleable there.\n * Metro resolves the import graph eagerly, so the specifier has to resolve even\n * when nothing calls the thing behind it. Injecting an op-sqlite driver does not\n * help: by the time the adapter is constructed, the barrel has already dragged\n * `node:sqlite` in.\n *\n * That is the same failure `@starkeep/storage-adapter` had with `node:crypto`\n * for its content hashing, and the resolution is the same in spirit: the shared\n * entry point stays portable, and the platform-specific implementation is\n * something a Node caller opts into. The difference is that a SHA-256 has a\n * portable default and a SQLite connection does not, so this cannot be a default\n * at all — hence `driver` being a required option rather than one with a\n * fallback that only works on half the platforms.\n *\n * Import it from `@starkeep/storage-sqlite/node`. The main entry has no `node:`\n * imports and is safe to bundle for a handset.\n */\n\nimport { DatabaseSync } from \"node:sqlite\";\nimport { mkdirSync, existsSync } from \"node:fs\";\nimport { dirname } from \"node:path\";\nimport type { SqliteDriver } from \"./adapter.js\";\n\n/** Node's built-in SQLite. The default everywhere except React Native. */\nexport const nodeSqliteDriver: SqliteDriver = {\n open: (path) => {\n // Node's SQLite will not create a missing parent directory, so this driver\n // must. op-sqlite manages its own location and does not want this done for\n // it — which is why it lives here rather than in the adapter.\n if (path !== \":memory:\") {\n const dir = dirname(path);\n if (!existsSync(dir)) mkdirSync(dir, { recursive: true });\n }\n return new DatabaseSync(path);\n },\n close: (db) => (db as unknown as DatabaseSync).close(),\n};\n"],"mappings":";AAwBA,SAAS,oBAAoB;AAC7B,SAAS,WAAW,kBAAkB;AACtC,SAAS,eAAe;AAIjB,IAAM,mBAAiC;AAAA,EAC5C,MAAM,CAAC,SAAS;AAId,QAAI,SAAS,YAAY;AACvB,YAAM,MAAM,QAAQ,IAAI;AACxB,UAAI,CAAC,WAAW,GAAG,EAAG,WAAU,KAAK,EAAE,WAAW,KAAK,CAAC;AAAA,IAC1D;AACA,WAAO,IAAI,aAAa,IAAI;AAAA,EAC9B;AAAA,EACA,OAAO,CAAC,OAAQ,GAA+B,MAAM;AACvD;","names":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@starkeep/storage-sqlite",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
@@ -9,8 +9,13 @@
|
|
|
9
9
|
"exports": {
|
|
10
10
|
".": {
|
|
11
11
|
"types": "./dist/index.d.ts",
|
|
12
|
-
"import": "./
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
13
|
"require": "./dist/index.cjs"
|
|
14
|
+
},
|
|
15
|
+
"./node": {
|
|
16
|
+
"types": "./dist/node-entry.d.ts",
|
|
17
|
+
"import": "./dist/node-entry.js",
|
|
18
|
+
"require": "./dist/node-entry.cjs"
|
|
14
19
|
}
|
|
15
20
|
},
|
|
16
21
|
"files": [
|
|
@@ -28,9 +33,9 @@
|
|
|
28
33
|
"homepage": "https://github.com/starkeep-org/starkeep-core/tree/main/packages/storage-sqlite",
|
|
29
34
|
"dependencies": {
|
|
30
35
|
"kysely": "^0.28.17",
|
|
31
|
-
"@starkeep/protocol-primitives": "0.
|
|
32
|
-
"@starkeep/storage-adapter": "0.
|
|
33
|
-
"@starkeep/shared-space-api": "0.
|
|
36
|
+
"@starkeep/protocol-primitives": "0.5.0",
|
|
37
|
+
"@starkeep/storage-adapter": "0.5.0",
|
|
38
|
+
"@starkeep/shared-space-api": "0.5.0"
|
|
34
39
|
},
|
|
35
40
|
"devDependencies": {
|
|
36
41
|
"@types/node": "^25.4.0",
|