commit 347863f03165383738e310d6ca5d61d12e17427d
parent 9f77904cce2a28d5908f15d3861190b2b99b2002
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date: Thu, 29 Oct 2026 00:23:28 -0400
umtool: presets.mjs opts its own-directory paths out of Turbopack's tracing
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Diffstat:
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/umtool/report-to-video/presets.mjs b/umtool/report-to-video/presets.mjs
@@ -25,10 +25,10 @@ import { fileURLToPath } from "node:url";
import { mergePatch } from "./montage-styles.mjs";
-const HERE = path.dirname(fileURLToPath(import.meta.url));
+const HERE = path.dirname(/* turbopackIgnore: true */ fileURLToPath(import.meta.url));
/** The directory the presets are read from (and `umtool preset save` writes to). */
-export const presetsDir = () => process.env.UMTOOL_PRESETS_DIR || path.resolve(HERE, "..", "presets");
+export const presetsDir = () => process.env.UMTOOL_PRESETS_DIR || path.resolve(/* turbopackIgnore: true */ HERE, "..", "presets");
export const PRESET_NAME_RE = /^[a-z][a-z0-9-]{0,47}$/;
@@ -50,17 +50,17 @@ export function presetErrors(doc, name = doc?.name) {
/** The preset by name: `{ name, description, render }`. Throws a sentence naming the presets on an unknown one. */
export function loadPreset(name, { dir = presetsDir() } = {}) {
if (typeof name !== "string" || !PRESET_NAME_RE.test(name)) throw new Error(`"${name}" is not a preset name (lower-case letters, digits and dashes)`);
- const file = path.join(dir, `${name}.json`);
+ const file = path.join(/* turbopackIgnore: true */ dir, `${name}.json`);
let st;
try {
- st = statSync(file);
+ st = statSync(/* turbopackIgnore: true */ file);
} catch {
const known = presetNames({ dir });
throw new Error(`no preset "${name}"${known.length ? ` — one of ${known.join(", ")}` : ` (no presets in ${dir})`}`);
}
const hit = cache.get(file);
if (hit && hit.mtime === st.mtimeMs) return structuredClone(hit.doc);
- const doc = JSON.parse(readFileSync(file, "utf8"));
+ const doc = JSON.parse(readFileSync(/* turbopackIgnore: true */ file, "utf8"));
const errors = presetErrors(doc, name);
if (errors.length) throw new Error(`preset ${name}: ${errors.join("; ")}`);
cache.set(file, { mtime: st.mtimeMs, doc });
@@ -69,8 +69,8 @@ export function loadPreset(name, { dir = presetsDir() } = {}) {
/** The presets on disk, by name. */
export function presetNames({ dir = presetsDir() } = {}) {
- if (!existsSync(dir)) return [];
- return readdirSync(dir).filter((f) => f.endsWith(".json")).map((f) => f.slice(0, -5)).filter((n) => PRESET_NAME_RE.test(n)).sort();
+ if (!existsSync(/* turbopackIgnore: true */ dir)) return [];
+ return readdirSync(/* turbopackIgnore: true */ dir).filter((f) => f.endsWith(".json")).map((f) => f.slice(0, -5)).filter((n) => PRESET_NAME_RE.test(n)).sort();
}
/** Every preset: `{ name, description }`, by name; an unreadable one with its `error`. */