// The media-metadata wait exists twice on purpose: once Node-side and once // inside a page.evaluate() body, which is serialized into the browser and // cannot import the Node helper. Line-level markers don't survive the clone // window drifting as the file is edited, hence the file-level suppression. // fallow-ignore-file code-duplication import { defineCommand } from "citty"; import { existsSync, mkdtempSync, readFileSync, rmSync } from "node:fs"; import { tmpdir } from "node:os"; import { join, dirname } from "node:path"; import { fileURLToPath } from "node:url"; import { resolveProject, type ProjectDir } from "../utils/project.js"; import { normalizeErrorMessage } from "../utils/errorMessage.js"; import type { ProjectLintResult } from "../utils/lintProject.js"; import { resolveCompositionViewportFromHtml } from "../utils/compositionViewport.js"; import { c } from "../ui/colors.js"; import { printDeprecationNotice, withMeta } from "../utils/updateCheck.js"; import { installPageFunctionGuard, resolveCliChromeGpuMode, seekCompositionTimeline, } from "../capture/captureCompositionFrame.js"; const __filename = fileURLToPath(import.meta.url); const __dirname = dirname(__filename); interface ConsoleEntry { level: "error" | "warning"; text: string; url?: string; line?: number; } interface ContrastEntry { time: number; selector: string; text: string; ratio: number; wcagAA: boolean; large: boolean; fg: string; bg: string; } const CONTRAST_SAMPLES = 5; const SEEK_SETTLE_MS = 150; const PREFERRED_SEEK_TARGET_WAIT_MS = 500; const MEDIA_EXTENSIONS = /\.(aac|flac|m4a|mov|mp3|mp4|oga|ogg|wav|webm)$/i; // Floor for the initial page navigation. A blocking external