Migrate to deno v2.x

This commit is contained in:
2024-10-28 12:25:43 +08:00
parent b959837f1b
commit 0df60ff87c
4 changed files with 11 additions and 6 deletions

8
db.ts
View File

@@ -1081,19 +1081,19 @@ export class EhDb {
} }
async flock() { async flock() {
if (!this.#file) return; if (!this.#file) return;
await eval(`Deno.flock(${this.#file.rid}, true);`); await this.#file.lock();
} }
dblock() { dblock() {
if (!this.#dblock) return; if (!this.#dblock) return;
eval(`Deno.flockSync(${this.#dblock.rid}, true);`); this.#dblock.lockSync();
} }
async funlock() { async funlock() {
if (!this.#file) return; if (!this.#file) return;
await eval(`Deno.funlock(${this.#file.rid});`); await this.#file.unlock();
} }
dbunlock() { dbunlock() {
if (!this.#dblock) return; if (!this.#dblock) return;
eval(`Deno.funlockSync(${this.#dblock.rid});`); this.#dblock.unlockSync();
} }
get_client_config(uid: number | bigint, client: string, name: string) { get_client_config(uid: number | bigint, client: string, name: string) {
const d = this.db.queryEntries<ClientConfig>( const d = this.db.queryEntries<ClientConfig>(

View File

@@ -35,5 +35,5 @@
}, },
"exclude": ["_fresh", "static/sw.js"] "exclude": ["_fresh", "static/sw.js"]
}, },
"unstable": ["ffi", "fs"] "unstable": ["ffi"]
} }

View File

@@ -9,7 +9,7 @@
"@std/path": "jsr:/@std/[email protected]", "@std/path": "jsr:/@std/[email protected]",
"@std/semver": "jsr:/@std/[email protected]", "@std/semver": "jsr:/@std/[email protected]",
"deno_dom/": "jsr:/@b-fuze/[email protected]/", "deno_dom/": "jsr:/@b-fuze/[email protected]/",
"sqlite/": "https://deno.land/x/sqlite@v3.8/", "sqlite/": "https://deno.land/x/sqlite@v3.9.1/",
"zipjs/": "https://deno.land/x/[email protected]/", "zipjs/": "https://deno.land/x/[email protected]/",
"$fresh/": "https://deno.land/x/[email protected]/", "$fresh/": "https://deno.land/x/[email protected]/",
"preact": "https://esm.sh/[email protected]", "preact": "https://esm.sh/[email protected]",

View File

@@ -7,6 +7,7 @@ export class SortableURLSearchParams extends URLSearchParams {
super(init); super(init);
this.excludes = excludes; this.excludes = excludes;
} }
// @ts-ignore Fuck
entries(): IterableIterator<[string, string]> { entries(): IterableIterator<[string, string]> {
this.sort(); this.sort();
const a: [string, string][] = []; const a: [string, string][] = [];
@@ -15,6 +16,7 @@ export class SortableURLSearchParams extends URLSearchParams {
} }
return a.values(); return a.values();
} }
// @ts-ignore Fuck
forEach( forEach(
callbackfn: (value: string, key: string, parent: this) => void, callbackfn: (value: string, key: string, parent: this) => void,
thisArg?: unknown, thisArg?: unknown,
@@ -23,6 +25,7 @@ export class SortableURLSearchParams extends URLSearchParams {
callbackfn.apply(thisArg, [v, k, this]); callbackfn.apply(thisArg, [v, k, this]);
} }
} }
// @ts-ignore Fuck
keys(): IterableIterator<string> { keys(): IterableIterator<string> {
this.sort(); this.sort();
const a: string[] = []; const a: string[] = [];
@@ -31,6 +34,7 @@ export class SortableURLSearchParams extends URLSearchParams {
} }
return a.values(); return a.values();
} }
// @ts-ignore Fuck
toString(): string { toString(): string {
return Array.from(this.entries()).map((v) => return Array.from(this.entries()).map((v) =>
`${encodeURIComponent(v[0])}=${encodeURIComponent(v[1])}` `${encodeURIComponent(v[0])}=${encodeURIComponent(v[1])}`
@@ -40,6 +44,7 @@ export class SortableURLSearchParams extends URLSearchParams {
const s = this.toString(); const s = this.toString();
return s.length ? `?${s}` : ""; return s.length ? `?${s}` : "";
} }
// @ts-ignore Fuck
values(): IterableIterator<string> { values(): IterableIterator<string> {
return Array.from(this.entries()).map((v) => v[1]).values(); return Array.from(this.entries()).map((v) => v[1]).values();
} }