From 7e0a44732584403c4380276c9346f8d4d7ee8103 Mon Sep 17 00:00:00 2001 From: James Date: Mon, 18 May 2026 21:24:42 +0000 Subject: [PATCH] refactor: drop unused exports detected by fallow auto-fix MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Run `fallow fix --auto-fixable` to remove `export` keywords from symbols fallow's reachability analysis identifies as unused. Keeps only the cases where the symbol is still referenced internally in its own file (so removing `export` doesn't surface a new oxlint `no-unused-vars` error). Result: fallow dead-code findings drop from 276 → 208 (68 fewer unused exports), with no behavior change — each symbol is still defined and used exactly the same way within its file. Reverted ~20 files where fallow's auto-fix would have created cascading "declared but never used" lint errors — those are cases where the symbol isn't used at all, and properly cleaning them up means deleting the declaration, not just dropping `export`. Better to land that as a separate, narrower PR rather than mixing it into a mechanical de-export. Also reverted four false positives where fallow missed real consumers: - `captureCost.ts` (renderOrchestrator has two separate import blocks from the same module; fallow only saw the first) - `propertyPanelHelpers.ts`, `domEditingLayers.ts` (real internal uses fallow's reachability missed) - `render.ts` (functions imported via `await import()` dynamic import, which fallow's static analysis doesn't follow) Test plan: bun run --filter '*' typecheck (clean), oxlint + oxfmt clean, cli/core/studio/engine vitest suites pass (335 + 917 + 576 + 605 tests). --- packages/cli/src/background-removal/pipeline.ts | 2 +- packages/cli/src/commands/compositions.ts | 2 +- packages/cli/src/commands/lambda/policies.ts | 2 +- packages/cli/src/commands/lambda/sam.ts | 4 ++-- packages/cli/src/tts/manager.ts | 2 +- packages/cli/src/utils/projectConfig.ts | 2 +- packages/cli/src/whisper/manager.ts | 2 +- packages/cli/src/whisper/transcribe.ts | 2 -- packages/core/src/lint/utils.ts | 4 ++-- packages/core/src/runtime/adapters/lottie.ts | 1 - packages/core/src/studio-api/helpers/waveform.ts | 2 +- packages/core/src/studio-api/routes/waveform.ts | 3 --- packages/engine/src/services/browserManager.ts | 2 +- packages/engine/src/services/screenshotService.ts | 2 +- packages/player/src/shader-options.ts | 12 ++++++------ packages/producer/src/services/compilationTester.ts | 2 +- packages/producer/src/services/distributed/shared.ts | 2 +- packages/producer/src/services/fileServer.ts | 2 +- .../src/services/render/stages/freezePlan.ts | 1 - packages/shader-transitions/src/capture.ts | 2 +- packages/studio/src/captions/types.ts | 2 +- .../src/components/editor/MotionPanelFields.tsx | 4 ++-- .../src/components/editor/domEditOverlayGestures.ts | 2 +- .../studio/src/components/editor/domEditingDom.ts | 2 +- packages/studio/src/components/editor/fontAssets.ts | 2 +- .../studio/src/components/editor/gradientValue.ts | 2 +- .../studio/src/components/editor/manualOffsetDrag.ts | 4 ++-- .../src/components/editor/propertyPanelColor.tsx | 2 +- .../components/editor/propertyPanelPrimitives.tsx | 2 +- .../studio/src/components/editor/studioMotionOps.ts | 2 +- .../src/player/components/CompositionThumbnail.tsx | 2 +- .../studio/src/player/components/timelineLayout.ts | 2 +- packages/studio/src/player/lib/playbackAdapter.ts | 2 +- .../studio/src/player/lib/timelineElementHelpers.ts | 10 +++++----- packages/studio/src/utils/studioFontHelpers.ts | 2 +- packages/studio/src/utils/studioUrlState.ts | 2 +- packages/studio/src/utils/timelineInspector.ts | 2 +- packages/studio/vite.browser.ts | 2 +- 38 files changed, 47 insertions(+), 54 deletions(-) diff --git a/packages/cli/src/background-removal/pipeline.ts b/packages/cli/src/background-removal/pipeline.ts index a0a0f3bfc..3136ba28d 100644 --- a/packages/cli/src/background-removal/pipeline.ts +++ b/packages/cli/src/background-removal/pipeline.ts @@ -20,7 +20,7 @@ import { type Device, type ModelId } from "./manager.js"; export type OutputFormat = "webm" | "mov" | "png"; -export const QUALITY_CRF = { +const QUALITY_CRF = { fast: 30, balanced: 18, best: 12, diff --git a/packages/cli/src/commands/compositions.ts b/packages/cli/src/commands/compositions.ts index 4dfee7284..b31645ee5 100644 --- a/packages/cli/src/commands/compositions.ts +++ b/packages/cli/src/commands/compositions.ts @@ -45,7 +45,7 @@ function estimateDurationFromScripts(root: ParentNode): number { return duration; } -export function parseCompositions(html: string, baseDir: string): CompositionInfo[] { +function parseCompositions(html: string, baseDir: string): CompositionInfo[] { const parser = new DOMParser(); const doc = parser.parseFromString(html, "text/html"); diff --git a/packages/cli/src/commands/lambda/policies.ts b/packages/cli/src/commands/lambda/policies.ts index 409873fd0..e22c44d4d 100644 --- a/packages/cli/src/commands/lambda/policies.ts +++ b/packages/cli/src/commands/lambda/policies.ts @@ -56,7 +56,7 @@ interface TrustPolicyDocument { * Actions the CLI needs to deploy/invoke/destroy the stack. Keep this * sorted alphabetically inside each service so diffs stay readable. */ -export const REQUIRED_ACTIONS = { +const REQUIRED_ACTIONS = { cloudformation: [ "cloudformation:CreateChangeSet", "cloudformation:CreateStack", diff --git a/packages/cli/src/commands/lambda/sam.ts b/packages/cli/src/commands/lambda/sam.ts index a1baf8497..c31f18de4 100644 --- a/packages/cli/src/commands/lambda/sam.ts +++ b/packages/cli/src/commands/lambda/sam.ts @@ -23,7 +23,7 @@ import { existsSync } from "node:fs"; import { join } from "node:path"; /** Throws with a clear hint when the SAM CLI is not on PATH. */ -export function assertSamAvailable(): void { +function assertSamAvailable(): void { try { execFileSync("sam", ["--version"], { stdio: "ignore" }); } catch { @@ -34,7 +34,7 @@ export function assertSamAvailable(): void { } /** Throws with a clear hint when the `aws` CLI is not on PATH. */ -export function assertAwsCliAvailable(): void { +function assertAwsCliAvailable(): void { try { execFileSync("aws", ["--version"], { stdio: "ignore" }); } catch { diff --git a/packages/cli/src/tts/manager.ts b/packages/cli/src/tts/manager.ts index fa7e3760f..317f8d307 100644 --- a/packages/cli/src/tts/manager.ts +++ b/packages/cli/src/tts/manager.ts @@ -145,4 +145,4 @@ export async function ensureVoices(options?: { return voicesPath; } -export { MODELS_DIR, VOICES_DIR, DEFAULT_MODEL }; +export { MODELS_DIR, DEFAULT_MODEL }; diff --git a/packages/cli/src/utils/projectConfig.ts b/packages/cli/src/utils/projectConfig.ts index b4c0451a4..90e44c135 100644 --- a/packages/cli/src/utils/projectConfig.ts +++ b/packages/cli/src/utils/projectConfig.ts @@ -12,7 +12,7 @@ import { join, resolve } from "node:path"; import { DEFAULT_REGISTRY_URL } from "../registry/index.js"; export const PROJECT_CONFIG_FILENAME = "hyperframes.json"; -export const PROJECT_CONFIG_SCHEMA_URL = "https://hyperframes.heygen.com/schema/hyperframes.json"; +const PROJECT_CONFIG_SCHEMA_URL = "https://hyperframes.heygen.com/schema/hyperframes.json"; export interface ProjectConfigPaths { /** Where `hyperframes:block` items land, relative to project root. */ diff --git a/packages/cli/src/whisper/manager.ts b/packages/cli/src/whisper/manager.ts index 4866c6c60..28070037d 100644 --- a/packages/cli/src/whisper/manager.ts +++ b/packages/cli/src/whisper/manager.ts @@ -131,7 +131,7 @@ export function findWhisper(): WhisperResult | undefined { return findFromEnv() ?? findFromSystem() ?? findBuiltBinary(); } -export function getInstallInstructions(): string { +function getInstallInstructions(): string { if (platform() === "darwin") { return "brew install whisper-cpp"; } diff --git a/packages/cli/src/whisper/transcribe.ts b/packages/cli/src/whisper/transcribe.ts index b812f4af1..e1be19824 100644 --- a/packages/cli/src/whisper/transcribe.ts +++ b/packages/cli/src/whisper/transcribe.ts @@ -299,5 +299,3 @@ export async function transcribe( speechOnsetSeconds, }; } - -export { isAudioFile, isVideoFile }; diff --git a/packages/core/src/lint/utils.ts b/packages/core/src/lint/utils.ts index 9090b36a4..b2ee9cdde 100644 --- a/packages/core/src/lint/utils.ts +++ b/packages/core/src/lint/utils.ts @@ -15,10 +15,10 @@ export type ExtractedBlock = { index: number; }; -export const TAG_PATTERN = /<([a-z][\w:-]*)(\s[^<>]*?)?>/gi; +const TAG_PATTERN = /<([a-z][\w:-]*)(\s[^<>]*?)?>/gi; export const STYLE_BLOCK_PATTERN = /]*)>([\s\S]*?)<\/style>/gi; export const SCRIPT_BLOCK_PATTERN = /]*)>([\s\S]*?)<\/script>/gi; -export const COMPOSITION_ID_IN_CSS_PATTERN = /\[data-composition-id=["']([^"']+)["']\]/g; +const COMPOSITION_ID_IN_CSS_PATTERN = /\[data-composition-id=["']([^"']+)["']\]/g; export const TIMELINE_REGISTRY_INIT_PATTERN = /window\.__timelines\s*=\s*window\.__timelines\s*\|\|\s*\{\}|window\.__timelines\s*=\s*\{\}|window\.__timelines\s*\?\?=\s*\{\}/i; export const TIMELINE_REGISTRY_ASSIGN_PATTERN = /window\.__timelines\[[^\]]+\]\s*=/i; diff --git a/packages/core/src/runtime/adapters/lottie.ts b/packages/core/src/runtime/adapters/lottie.ts index 88dc35c52..e304f61f7 100644 --- a/packages/core/src/runtime/adapters/lottie.ts +++ b/packages/core/src/runtime/adapters/lottie.ts @@ -1,6 +1,5 @@ import type { RuntimeDeterministicAdapter } from "../types"; import { swallow } from "../diagnostics"; -export { isLottieAnimationLoaded } from "../../lottieReadiness"; /** * Lottie adapter for HyperFrames diff --git a/packages/core/src/studio-api/helpers/waveform.ts b/packages/core/src/studio-api/helpers/waveform.ts index a81f9ddb3..ca42f3c7d 100644 --- a/packages/core/src/studio-api/helpers/waveform.ts +++ b/packages/core/src/studio-api/helpers/waveform.ts @@ -4,7 +4,7 @@ import { join } from "node:path"; const SAMPLE_RATE = 4000; const PEAK_COUNT = 4000; -export const WAVEFORM_CACHE_VERSION = "v2"; +const WAVEFORM_CACHE_VERSION = "v2"; export function buildWaveformCacheKey(assetPath: string): string { return `${WAVEFORM_CACHE_VERSION}_${assetPath.replace(/[/\\]/g, "_")}.json`; diff --git a/packages/core/src/studio-api/routes/waveform.ts b/packages/core/src/studio-api/routes/waveform.ts index 5e4123938..8677ef5bb 100644 --- a/packages/core/src/studio-api/routes/waveform.ts +++ b/packages/core/src/studio-api/routes/waveform.ts @@ -4,9 +4,6 @@ import type { Hono } from "hono"; import type { StudioApiAdapter } from "../types.js"; import { decodeAudioPeaks, buildWaveformCacheKey } from "../helpers/waveform.js"; -export { isAudioFile } from "../helpers/mime.js"; -export { generateWaveformCache } from "../helpers/waveform.js"; - export function registerWaveformRoutes(api: Hono, adapter: StudioApiAdapter): void { api.get("/projects/:id/waveform/*", async (c) => { const project = await adapter.resolveProject(c.req.param("id")); diff --git a/packages/engine/src/services/browserManager.ts b/packages/engine/src/services/browserManager.ts index 655b6f9d7..747f1f997 100644 --- a/packages/engine/src/services/browserManager.ts +++ b/packages/engine/src/services/browserManager.ts @@ -149,7 +149,7 @@ async function probeBeginFrameSupport(browser: Browser): Promise { * * Exported for tests; production callers go through `resolveBrowserGpuMode`. */ -export let _autoBrowserGpuModeCache: Promise<"software" | "hardware"> | undefined; +let _autoBrowserGpuModeCache: Promise<"software" | "hardware"> | undefined; /** Test-only: reset the cached probe result. */ export function _resetAutoBrowserGpuModeCacheForTests(): void { diff --git a/packages/engine/src/services/screenshotService.ts b/packages/engine/src/services/screenshotService.ts index acba0e500..712563a64 100644 --- a/packages/engine/src/services/screenshotService.ts +++ b/packages/engine/src/services/screenshotService.ts @@ -203,7 +203,7 @@ export async function captureScreenshotWithAlpha( * video itself is the backdrop, so DOM layers must only contribute their * foreground UI pixels — never a page-spanning solid backdrop. */ -export const TRANSPARENT_BG_STYLE_ID = "__hf_transparent_bg__"; +const TRANSPARENT_BG_STYLE_ID = "__hf_transparent_bg__"; export async function initTransparentBackground(page: Page): Promise { const client = await getCdpSession(page); diff --git a/packages/player/src/shader-options.ts b/packages/player/src/shader-options.ts index 2f0601873..ef7b4079f 100644 --- a/packages/player/src/shader-options.ts +++ b/packages/player/src/shader-options.ts @@ -6,8 +6,8 @@ export const SHADER_CAPTURE_SCALE_ATTR = "shader-capture-scale"; export const SHADER_LOADING_ATTR = "shader-loading"; -export const SHADER_CAPTURE_SCALE_PARAM = "__hf_shader_capture_scale"; -export const SHADER_LOADING_PARAM = "__hf_shader_loading"; +const SHADER_CAPTURE_SCALE_PARAM = "__hf_shader_capture_scale"; +const SHADER_LOADING_PARAM = "__hf_shader_loading"; export const SHADER_LOADING_PHRASES = [ "Preparing scene transitions", @@ -31,14 +31,14 @@ export interface ShaderTransitionState { loading?: boolean; } -export function normalizeShaderCaptureScale(value: string | null): string | null { +function normalizeShaderCaptureScale(value: string | null): string | null { if (value === null) return null; const parsed = Number(value); if (!Number.isFinite(parsed) || parsed <= 0) return null; return String(Math.min(1, Math.max(0.25, parsed))); } -export function normalizeShaderLoadingMode(value: string | null): ShaderLoadingMode { +function normalizeShaderLoadingMode(value: string | null): ShaderLoadingMode { if (value === null || value.trim() === "") return "composition"; const normalized = value.trim().toLowerCase(); if ( @@ -65,7 +65,7 @@ function setQueryParam(params: URLSearchParams, key: string, value: string | nul else params.set(key, value); } -export function withShaderQueryParams( +function withShaderQueryParams( src: string, scale: string | null, loadingMode: ShaderLoadingMode, @@ -83,7 +83,7 @@ export function withShaderQueryParams( return `${path}${nextQuery ? `?${nextQuery}` : ""}${hash}`; } -export function injectShaderOptionsIntoSrcdoc( +function injectShaderOptionsIntoSrcdoc( html: string, scale: string | null, loadingMode: ShaderLoadingMode, diff --git a/packages/producer/src/services/compilationTester.ts b/packages/producer/src/services/compilationTester.ts index 62f4d8310..1da9df238 100644 --- a/packages/producer/src/services/compilationTester.ts +++ b/packages/producer/src/services/compilationTester.ts @@ -39,7 +39,7 @@ const EPSILON = 0.001; // Tolerance for floating-point timing comparisons * Parse HTML and extract all elements with timing attributes. * Includes