| author | |
| committer | |
| log | 10eaddedc5136acd4d7f8ac8276c4c8e90905703 |
| tree | 84f8d1ea7f67c1546469363d02936d6336c22a43 |
| parent | f813b9c7cef18191915ed92fb4564d8faeda0175 |
| signature | Commit is signed but in an unrecognized format. |
5 files changed, 20 insertions(+), 15 deletions(-)
framework/font.ts+6-2| ... | ... | @@ -19,7 +19,10 @@ export async function buildFonts(p: progress.Ref, fonts: sg.Font[]) { |
| 19 | 19 | ]); |
| 20 | 20 | } |
| 21 | 21 | |
| 22 | const instances = new async.OnceMap<void>(); | |
| 22 | const instances = new async.OnceMap( | |
| 23 | (_: string, x: () => Promise<void>) => x(), | |
| 24 | (x) => x[0], | |
| 25 | ); | |
| 23 | 26 | function getArgs(vars: sg.FontVars) { |
| 24 | 27 | return Object.entries(vars).map((x) => { |
| 25 | 28 | const lower = x[0].toLowerCase(); |
| ... | ... | @@ -42,7 +45,7 @@ export async function buildFonts(p: progress.Ref, fonts: sg.Font[]) { |
| 42 | 45 | const args = getArgs(vars); |
| 43 | 46 | const hash = getHash(input, args); |
| 44 | 47 | const outfile = path.join(temp, `${hash}${path.extname(input)}`); |
| 45 | await instances.get(outfile, async () => { | |
| 48 | await instances.getOrRun(outfile, async () => { | |
| 46 | 49 | await fs.rm(outfile, { force: true }); |
| 47 | 50 | await subprocess.exec(path.join(bin, "fonttools"), [ |
| 48 | 51 | "varLib.instancer", |
| ... | ... | @@ -212,3 +215,4 @@ import * as crypto from "node:crypto"; |
| 212 | 215 | import * as async from "lib/async.ts"; |
| 213 | 216 | import * as error from "lib/error.ts"; |
| 214 | 217 | import * as progress from "../lib/log/progress.ts"; |
| 218 | import { ASSERT } from "lib/assert.ts"; |
lib/log/stack.ts+9-4| ... | ... | @@ -88,11 +88,11 @@ export function capture(trimStart = 2): Frame[] { |
| 88 | 88 | export function format(error: Error, colors = false): string { |
| 89 | 89 | const { name, message, stack: _, ...payload } = error; |
| 90 | 90 | |
| 91 | const headingLine = (colors ? ansi.fgRed : "") + | |
| 91 | let out = (colors ? ansi.fgRed : "") + | |
| 92 | 92 | (name && name !== "Error" ? `[${name}] ` : "") + |
| 93 | 93 | message + (colors ? ansi.fgReset : "") + "\n"; |
| 94 | 94 | |
| 95 | const payloadLines = Object.entries(payload) | |
| 95 | out += Object.entries(payload) | |
| 96 | 96 | .map(([k, v]) => |
| 97 | 97 | " " + k + |
| 98 | 98 | (colors ? ansi.style(ansi.dim, ":") : ":") + |
| ... | ... | @@ -111,11 +111,16 @@ export function format(error: Error, colors = false): string { |
| 111 | 111 | ].includes(frame.fn ?? "") |
| 112 | 112 | ); |
| 113 | 113 | } |
| 114 | if (error instanceof AggregateError) { | |
| 115 | for (const err of error.errors) { | |
| 116 | out += format(err, true); | |
| 117 | } | |
| 118 | } | |
| 114 | 119 | if (frames.length) { |
| 115 | frameLines = frames.map((frame) => formatFrame(frame, colors)).join("\n"); | |
| 120 | out += frames.map((frame) => formatFrame(frame, colors)).join("\n"); | |
| 116 | 121 | } |
| 117 | 122 | |
| 118 | return headingLine + payloadLines + frameLines + "\n"; | |
| 123 | return out + "\n"; | |
| 119 | 124 | } |
| 120 | 125 | |
| 121 | 126 | /** format a single stack trace frame. see `format` for more details. */ |
src/file-viewer/bin/scan3.ts+3-7| ... | ... | @@ -376,12 +376,9 @@ export async function main() { |
| 376 | 376 | cwd: process.cwd(), |
| 377 | 377 | }); |
| 378 | 378 | await rsync.spawn({ |
| 379 | cwd: Path.resolve(import.meta.dirname).parent!.toString(), | |
| 380 | 379 | args: [ |
| 381 | "-a", | |
| 382 | "--progress", | |
| 383 | "clo@paperclover.net:~/paperclover.net/.clover/questions.sqlite", | |
| 384 | ".clover/", | |
| 380 | MediaFile.db.file, | |
| 381 | "clo@paperclover.net:paperclover.net/.clover/cache.sqlite", | |
| 385 | 382 | ], |
| 386 | 383 | progress: progress.start("Uploading database (web node)"), |
| 387 | 384 | }); |
| ... | ... | @@ -398,7 +395,6 @@ export async function main() { |
| 398 | 395 | ); |
| 399 | 396 | } |
| 400 | 397 | } else console.warn("Missing SOT token"); |
| 401 | // TODO: signal to web node(s) | |
| 402 | 398 | |
| 403 | 399 | console.info( |
| 404 | 400 | "Updated file viewer index in \x1b[1m" + |
| ... | ... | @@ -601,7 +597,7 @@ const procImageSubsets: Process = { |
| 601 | 597 | }, |
| 602 | 598 | }; |
| 603 | 599 | |
| 604 | const videoArgsCache = new async.OnceMap2(transcodeRules.getVideoInputArgs); | |
| 600 | const videoArgsCache = new async.OnceMap(transcodeRules.getVideoInputArgs); | |
| 605 | 601 | |
| 606 | 602 | const qualityMap: Record<string, string> = { |
| 607 | 603 | u: "ultra-high", |
src/file-viewer/models/derived.ts+1-1| ... | ... | @@ -201,4 +201,4 @@ import * as fs from "node:fs"; |
| 201 | 201 | import * as crypto from "node:crypto"; |
| 202 | 202 | import * as queue from "lib/queue.ts"; |
| 203 | 203 | import * as progress from "lib/log/progress.ts"; |
| 204 | import { derivedFileRoot } from "../paths.ts"; | |
| 204 | import { ASSERT } from "lib/assert.ts"; |
src/file-viewer/rsync.ts+1-1| ... | ... | @@ -75,7 +75,7 @@ export async function spawn(options: SpawnOptions) { |
| 75 | 75 | ? `${currentFile.slice(0, 3)}..${currentFile.slice(-15)}` |
| 76 | 76 | : currentFile; |
| 77 | 77 | node.text = `${title} - ${fileName}${ |
| 78 | extras.length > 0 ? `( ${extras})` : "" | |
| 78 | extras.length > 0 ? ` (${extras})` : "" | |
| 79 | 79 | }`; |
| 80 | 80 | } else result satisfies never; |
| 81 | 81 | }; |