@fedify/sqlite 1.8.1-pr.318.1252 → 1.8.1-pr.347.1259

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 CHANGED
@@ -1,38 +1,48 @@
1
1
  @fedify/sqlite: SQLite drivers for Fedify
2
- ==============
2
+ =========================================
3
3
 
4
- This package provides a SQLite-based key–value store implementation.
4
+ [![JSR][JSR badge]][JSR]
5
+ [![npm][npm badge]][npm]
5
6
 
6
- ## Usage
7
+ This package provides a SQLite-based [`KvStore`] implementation for [Fedify].
7
8
 
8
- ### Node.js
9
+ [JSR]: https://jsr.io/@fedify/sqlite
10
+ [JSR badge]: https://jsr.io/badges/@fedify/sqlite
11
+ [npm]: https://www.npmjs.com/package/@fedify/sqlite
12
+ [npm badge]: https://img.shields.io/npm/v/@fedify/sqlite?logo=npm
13
+ [Fedify]: https://fedify.dev/
14
+ [`KvStore`]: https://jsr.io/@fedify/fedify/doc/federation/~/KvStore
15
+
16
+
17
+ Usage
18
+ -----
19
+
20
+ ### Deno
9
21
 
10
- ```typescript
22
+ ~~~~ typescript
11
23
  import { DatabaseSync } from 'node:sqlite';
12
24
  import { SqliteKvStore } from '@fedify/sqlite';
13
25
 
14
26
  const db = new DatabaseSync('./data.db');
15
27
  const store = new SqliteKvStore(db);
16
- ```
28
+ ~~~~
17
29
 
18
- ### Bun
30
+ ### Node.js
19
31
 
20
- ```typescript
21
- import { Database } from 'bun:sqlite';
32
+ ~~~~ typescript
33
+ import { DatabaseSync } from 'node:sqlite';
22
34
  import { SqliteKvStore } from '@fedify/sqlite';
23
35
 
24
- const db = new Database('./data.db');
36
+ const db = new DatabaseSync('./data.db');
25
37
  const store = new SqliteKvStore(db);
26
- ```
27
-
28
- ### Deno
38
+ ~~~~
29
39
 
30
- For Deno, you can directly import from `@fedify/sqlite` when using the import map in `deno.json`:
40
+ ### Bun
31
41
 
32
- ```typescript
33
- import { DB } from 'https://deno.land/x/sqlite@v3.7.0/mod.ts';
42
+ ~~~~ typescript
43
+ import { Database } from 'bun:sqlite';
34
44
  import { SqliteKvStore } from '@fedify/sqlite';
35
45
 
36
- const db = new DB('./data.db');
46
+ const db = new Database('./data.db');
37
47
  const store = new SqliteKvStore(db);
38
- ```
48
+ ~~~~
package/deno.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/sqlite",
3
- "version": "1.8.1-pr.318.1252+da9acceb",
3
+ "version": "1.8.1-pr.347.1259+fed6c010",
4
4
  "license": "MIT",
5
5
  "exports": {
6
6
  ".": "./mod.ts",
@@ -1,5 +1,5 @@
1
1
 
2
- import { Temporal } from "@js-temporal/polyfill";
2
+ import { Temporal } from "@js-temporal/polyfill";
3
3
 
4
4
  //#region rolldown:runtime
5
5
  var __create = Object.create;
package/dist/kv.d.ts CHANGED
@@ -40,6 +40,11 @@ declare class SqliteKvStore implements KvStore {
40
40
  #private;
41
41
  readonly db: PlatformDatabase;
42
42
  readonly options: SqliteKvStoreOptions;
43
+ /**
44
+ * Creates a new SQLite key–value store.
45
+ * @param db The SQLite database to use. Supports `node:sqlite` and `bun:sqlite`.
46
+ * @param options The options for the key–value store.
47
+ */
43
48
  constructor(db: PlatformDatabase, options?: SqliteKvStoreOptions);
44
49
  /**
45
50
  * {@inheritDoc KvStore.get}
package/dist/kv.js CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- import { Temporal } from "@js-temporal/polyfill";
2
+ import { Temporal } from "@js-temporal/polyfill";
3
3
 
4
4
  import { qi } from "./node_modules/.pnpm/@js-temporal_polyfill@0.5.1/node_modules/@js-temporal/polyfill/dist/index.esm.js";
5
5
  import { SqliteDatabase } from "#sqlite";
@@ -34,6 +34,11 @@ var SqliteKvStore = class SqliteKvStore {
34
34
  #db;
35
35
  #tableName;
36
36
  #initialized;
37
+ /**
38
+ * Creates a new SQLite key–value store.
39
+ * @param db The SQLite database to use. Supports `node:sqlite` and `bun:sqlite`.
40
+ * @param options The options for the key–value store.
41
+ */
37
42
  constructor(db, options = {}) {
38
43
  this.db = db;
39
44
  this.options = options;
package/dist/mod.js CHANGED
@@ -1,5 +1,5 @@
1
1
 
2
- import { Temporal } from "@js-temporal/polyfill";
2
+ import { Temporal } from "@js-temporal/polyfill";
3
3
 
4
4
  import { SqliteKvStore } from "./kv.js";
5
5
 
@@ -1,5 +1,5 @@
1
1
 
2
- import { Temporal } from "@js-temporal/polyfill";
2
+ import { Temporal } from "@js-temporal/polyfill";
3
3
 
4
4
  import { __toESM } from "../../../../../../../_virtual/rolldown_runtime.js";
5
5
  import { require_jsbi_cjs } from "../../../../../jsbi@4.3.2/node_modules/jsbi/dist/jsbi-cjs.js";
@@ -1,7 +1,7 @@
1
1
 
2
2
 
3
3
 
4
- import { Temporal } from "@js-temporal/polyfill";
4
+ import { Temporal } from "@js-temporal/polyfill";
5
5
 
6
6
  import { __commonJS } from "../../../../../../_virtual/rolldown_runtime.js";
7
7
 
@@ -1,5 +1,5 @@
1
1
 
2
- import { Temporal } from "@js-temporal/polyfill";
2
+ import { Temporal } from "@js-temporal/polyfill";
3
3
 
4
4
  import { Database } from "bun:sqlite";
5
5
 
@@ -1,5 +1,5 @@
1
1
 
2
- import { Temporal } from "@js-temporal/polyfill";
2
+ import { Temporal } from "@js-temporal/polyfill";
3
3
 
4
4
  import { DatabaseSync } from "node:sqlite";
5
5
 
package/kv.ts CHANGED
@@ -49,6 +49,11 @@ export class SqliteKvStore implements KvStore {
49
49
  readonly #tableName: string;
50
50
  #initialized: boolean;
51
51
 
52
+ /**
53
+ * Creates a new SQLite key–value store.
54
+ * @param db The SQLite database to use. Supports `node:sqlite` and `bun:sqlite`.
55
+ * @param options The options for the key–value store.
56
+ */
52
57
  constructor(
53
58
  readonly db: PlatformDatabase,
54
59
  readonly options: SqliteKvStoreOptions = {},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fedify/sqlite",
3
- "version": "1.8.1-pr.318.1252+da9acceb",
3
+ "version": "1.8.1-pr.347.1259+fed6c010",
4
4
  "description": "SQLite drivers for Fedify",
5
5
  "keywords": [
6
6
  "fedify",
@@ -51,7 +51,7 @@
51
51
  "es-toolkit": "^1.31.0"
52
52
  },
53
53
  "peerDependencies": {
54
- "@fedify/fedify": "1.8.1-pr.318.1252+da9acceb"
54
+ "@fedify/fedify": "1.8.1-pr.347.1259+fed6c010"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@js-temporal/polyfill": "^0.5.1",
package/tsdown.config.ts CHANGED
@@ -5,9 +5,20 @@ export default defineConfig({
5
5
  dts: true,
6
6
  unbundle: true,
7
7
  platform: "node",
8
+ inputOptions: {
9
+ onwarn(warning, defaultHandler) {
10
+ if (
11
+ warning.code === "UNRESOLVED_IMPORT" &&
12
+ ["#sqlite", "bun:sqlite"].includes(warning.exporter ?? "")
13
+ ) {
14
+ return;
15
+ }
16
+ defaultHandler(warning);
17
+ },
18
+ },
8
19
  outputOptions: {
9
20
  intro: `
10
- import { Temporal } from "@js-temporal/polyfill";
21
+ import { Temporal } from "@js-temporal/polyfill";
11
22
  `,
12
23
  },
13
24
  });