From 0df60ff87cb9828247cdbf0c4cdd2067698dfef0 Mon Sep 17 00:00:00 2001 From: lifegpc Date: Mon, 28 Oct 2024 12:25:43 +0800 Subject: [PATCH] Migrate to deno v2.x --- db.ts | 8 ++++---- deno.json | 2 +- import_map.json | 2 +- server/SortableURLSearchParams.ts | 5 +++++ 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/db.ts b/db.ts index 73997e1..f6e2359 100644 --- a/db.ts +++ b/db.ts @@ -1081,19 +1081,19 @@ export class EhDb { } async flock() { if (!this.#file) return; - await eval(`Deno.flock(${this.#file.rid}, true);`); + await this.#file.lock(); } dblock() { if (!this.#dblock) return; - eval(`Deno.flockSync(${this.#dblock.rid}, true);`); + this.#dblock.lockSync(); } async funlock() { if (!this.#file) return; - await eval(`Deno.funlock(${this.#file.rid});`); + await this.#file.unlock(); } dbunlock() { if (!this.#dblock) return; - eval(`Deno.funlockSync(${this.#dblock.rid});`); + this.#dblock.unlockSync(); } get_client_config(uid: number | bigint, client: string, name: string) { const d = this.db.queryEntries( diff --git a/deno.json b/deno.json index d3d4be2..c6f7e56 100644 --- a/deno.json +++ b/deno.json @@ -35,5 +35,5 @@ }, "exclude": ["_fresh", "static/sw.js"] }, - "unstable": ["ffi", "fs"] + "unstable": ["ffi"] } diff --git a/import_map.json b/import_map.json index 340a61c..9d6159c 100644 --- a/import_map.json +++ b/import_map.json @@ -9,7 +9,7 @@ "@std/path": "jsr:/@std/path@0.225.1", "@std/semver": "jsr:/@std/semver@0.224.1", "deno_dom/": "jsr:/@b-fuze/deno-dom@0.1.47/", - "sqlite/": "https://deno.land/x/sqlite@v3.8/", + "sqlite/": "https://deno.land/x/sqlite@v3.9.1/", "zipjs/": "https://deno.land/x/zipjs@v2.7.45/", "$fresh/": "https://deno.land/x/fresh@1.6.8/", "preact": "https://esm.sh/preact@10.19.6", diff --git a/server/SortableURLSearchParams.ts b/server/SortableURLSearchParams.ts index 617573e..a3b2c5f 100644 --- a/server/SortableURLSearchParams.ts +++ b/server/SortableURLSearchParams.ts @@ -7,6 +7,7 @@ export class SortableURLSearchParams extends URLSearchParams { super(init); this.excludes = excludes; } + // @ts-ignore Fuck entries(): IterableIterator<[string, string]> { this.sort(); const a: [string, string][] = []; @@ -15,6 +16,7 @@ export class SortableURLSearchParams extends URLSearchParams { } return a.values(); } + // @ts-ignore Fuck forEach( callbackfn: (value: string, key: string, parent: this) => void, thisArg?: unknown, @@ -23,6 +25,7 @@ export class SortableURLSearchParams extends URLSearchParams { callbackfn.apply(thisArg, [v, k, this]); } } + // @ts-ignore Fuck keys(): IterableIterator { this.sort(); const a: string[] = []; @@ -31,6 +34,7 @@ export class SortableURLSearchParams extends URLSearchParams { } return a.values(); } + // @ts-ignore Fuck toString(): string { return Array.from(this.entries()).map((v) => `${encodeURIComponent(v[0])}=${encodeURIComponent(v[1])}` @@ -40,6 +44,7 @@ export class SortableURLSearchParams extends URLSearchParams { const s = this.toString(); return s.length ? `?${s}` : ""; } + // @ts-ignore Fuck values(): IterableIterator { return Array.from(this.entries()).map((v) => v[1]).values(); }