mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-03 23:03:09 +00:00
refactor: drop unused exports detected by fallow auto-fix
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).
This commit is contained in:
@@ -191,7 +191,7 @@ export const DEFAULT_CONTAINER: CaptionContainerStyle = {
|
||||
boxShadow: "none",
|
||||
};
|
||||
|
||||
export const DEFAULT_ANIMATION: CaptionAnimation = {
|
||||
const DEFAULT_ANIMATION: CaptionAnimation = {
|
||||
preset: "fade",
|
||||
duration: 0.2,
|
||||
ease: "power2.out",
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useState, useRef, useEffect, type ReactNode } from "react";
|
||||
import { Zap } from "../../icons/SystemIcons";
|
||||
|
||||
export const FIELD =
|
||||
const FIELD =
|
||||
"min-w-0 rounded-xl border border-neutral-800 bg-neutral-900/95 px-3 py-2 text-neutral-100 shadow-[inset_0_1px_0_rgba(255,255,255,0.03)] transition-colors focus-within:border-neutral-600";
|
||||
export const LABEL = "text-[11px] font-medium uppercase tracking-[0.18em] text-neutral-500";
|
||||
export const RESPONSIVE_GRID = "grid grid-cols-[repeat(auto-fit,minmax(118px,1fr))] gap-3";
|
||||
@@ -30,7 +30,7 @@ export function parsePlainNumber(value: string): number | null {
|
||||
|
||||
// ── CommitField ──
|
||||
|
||||
export function CommitField({
|
||||
function CommitField({
|
||||
value,
|
||||
disabled,
|
||||
onCommit,
|
||||
|
||||
@@ -10,7 +10,7 @@ import type { GroupOverlayItem } from "./domEditOverlayGeometry";
|
||||
export type GestureKind = "drag" | "resize" | "rotate";
|
||||
|
||||
export const BLOCKED_MOVE_THRESHOLD_PX = 4;
|
||||
export const MIN_RESIZE_EDGE_PX = 20;
|
||||
const MIN_RESIZE_EDGE_PX = 20;
|
||||
const ROTATION_COMMIT_EPSILON_DEGREES = 0.05;
|
||||
const ROTATION_SNAP_DEGREES = 15;
|
||||
|
||||
|
||||
@@ -163,7 +163,7 @@ export function normalizeTimelineCompositionSource(value: string | undefined): s
|
||||
|
||||
// ─── CSS escaping ─────────────────────────────────────────────────────────────
|
||||
|
||||
export function escapeCssIdentifier(value: string): string {
|
||||
function escapeCssIdentifier(value: string): string {
|
||||
const css = globalThis.CSS as { escape?: (input: string) => string } | undefined;
|
||||
if (typeof css?.escape === "function") return css.escape(value);
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ const FONT_EXT_RE = /\.(eot|otf|ttc|ttf|woff2?)$/i;
|
||||
const FONT_STYLE_SUFFIX_RE =
|
||||
/\s+(thin|extralight|extra light|light|regular|roman|medium|semibold|semi bold|bold|extrabold|extra bold|black|italic|oblique|variable)$/i;
|
||||
|
||||
export function cssString(value: string): string {
|
||||
function cssString(value: string): string {
|
||||
return JSON.stringify(value);
|
||||
}
|
||||
|
||||
|
||||
@@ -370,7 +370,7 @@ function formatHex(channel: number): string {
|
||||
return channel.toString(16).padStart(2, "0");
|
||||
}
|
||||
|
||||
export function interpolateGradientStopColor(model: GradientModel, position: number): string {
|
||||
function interpolateGradientStopColor(model: GradientModel, position: number): string {
|
||||
const clampedPosition = clamp(position, 0, 100);
|
||||
const sortedStops = [...model.stops].sort((a, b) => a.position - b.position);
|
||||
const exact = sortedStops.find((stop) => Math.abs(stop.position - clampedPosition) < 0.001);
|
||||
|
||||
@@ -256,7 +256,7 @@ export function createManualOffsetDragMember(input: {
|
||||
};
|
||||
}
|
||||
|
||||
export function resolveManualOffsetDragMemberOffset(
|
||||
function resolveManualOffsetDragMemberOffset(
|
||||
member: ManualOffsetDragMember,
|
||||
dx: number,
|
||||
dy: number,
|
||||
@@ -289,7 +289,7 @@ export function applyManualOffsetDragCommit(
|
||||
return offset;
|
||||
}
|
||||
|
||||
export function restoreManualOffsetDragMember(member: ManualOffsetDragMember): void {
|
||||
function restoreManualOffsetDragMember(member: ManualOffsetDragMember): void {
|
||||
restoreStudioPathOffset(member.element, member.initialPathOffset);
|
||||
endStudioManualEditGesture(member.element, member.gestureToken);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ const COLOR_PICKER_SIZE = { width: 292, height: 386 };
|
||||
/* ColorSlider */
|
||||
/* ------------------------------------------------------------------ */
|
||||
|
||||
export function ColorSlider({
|
||||
function ColorSlider({
|
||||
label,
|
||||
value,
|
||||
min,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useCallback, useEffect, useRef, useState, type ReactNode } from "react";
|
||||
import { adjustNumericToken, FIELD, LABEL, parseNumericToken } from "./propertyPanelHelpers";
|
||||
|
||||
export function CommitField({
|
||||
function CommitField({
|
||||
value,
|
||||
disabled,
|
||||
liveCommit,
|
||||
|
||||
@@ -129,7 +129,7 @@ export function buildStudioGsapPresetMotion(
|
||||
|
||||
// ── Manifest parse/serialize ──
|
||||
|
||||
export function parseMotionValues(value: unknown): StudioGsapMotionValues | null {
|
||||
function parseMotionValues(value: unknown): StudioGsapMotionValues | null {
|
||||
if (!value || typeof value !== "object") return null;
|
||||
const record = value as Record<string, unknown>;
|
||||
const parsed: StudioGsapMotionValues = {};
|
||||
|
||||
@@ -16,7 +16,7 @@ interface CompositionThumbnailProps {
|
||||
|
||||
const CLIP_HEIGHT = 66;
|
||||
const THUMBNAIL_URL_VERSION = "v3";
|
||||
export const COMPOSITION_THUMBNAIL_LABEL_Z_INDEX = 10;
|
||||
const COMPOSITION_THUMBNAIL_LABEL_Z_INDEX = 10;
|
||||
|
||||
export function buildCompositionThumbnailUrl({
|
||||
previewUrl,
|
||||
|
||||
@@ -7,7 +7,7 @@ export const TRACK_H = 72;
|
||||
export const RULER_H = 24;
|
||||
export const CLIP_Y = 3;
|
||||
export const CLIP_HANDLE_W = 18;
|
||||
export const TIMELINE_SCROLL_BUFFER = 20;
|
||||
const TIMELINE_SCROLL_BUFFER = 20;
|
||||
|
||||
/* ── Tick generation ──────────────────────────────────────────────── */
|
||||
function getMajorTickInterval(duration: number, pixelsPerSecond?: number): number {
|
||||
|
||||
@@ -20,7 +20,7 @@ export function isFinitePositive(value: number): boolean {
|
||||
return Number.isFinite(value) && value > 0;
|
||||
}
|
||||
|
||||
export function clampTime(time: number, duration: number): number {
|
||||
function clampTime(time: number, duration: number): number {
|
||||
const safeDuration = Math.max(0, Number.isFinite(duration) ? duration : 0);
|
||||
const safeTime = Math.max(0, Number.isFinite(time) ? time : 0);
|
||||
return safeDuration > 0 ? Math.min(safeTime, safeDuration) : safeTime;
|
||||
|
||||
@@ -15,7 +15,7 @@ import { isFinitePositive } from "./playbackAdapter";
|
||||
// Duration attribute helpers
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export function readDurationAttribute(el: Element | null | undefined): number {
|
||||
function readDurationAttribute(el: Element | null | undefined): number {
|
||||
if (!el) return 0;
|
||||
const duration =
|
||||
Number.parseFloat(el.getAttribute("data-duration") ?? "") ||
|
||||
@@ -42,7 +42,7 @@ export function readTimelineDurationFromDocument(doc: Document | null | undefine
|
||||
// DOM element type guards
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export function isHtmlElement(el: Element): el is HTMLElement {
|
||||
function isHtmlElement(el: Element): el is HTMLElement {
|
||||
const HtmlElementCtor = el.ownerDocument.defaultView?.HTMLElement ?? globalThis.HTMLElement;
|
||||
return typeof HtmlElementCtor !== "undefined" && el instanceof HtmlElementCtor;
|
||||
}
|
||||
@@ -113,7 +113,7 @@ export function getTimelineElementDisplayLabel(input: {
|
||||
return tag ? `${tag} clip` : "Timeline clip";
|
||||
}
|
||||
|
||||
export const IMPLICIT_TIMELINE_LAYER_SKIP_TAGS = new Set([
|
||||
const IMPLICIT_TIMELINE_LAYER_SKIP_TAGS = new Set([
|
||||
"base",
|
||||
"link",
|
||||
"meta",
|
||||
@@ -123,7 +123,7 @@ export const IMPLICIT_TIMELINE_LAYER_SKIP_TAGS = new Set([
|
||||
"template",
|
||||
]);
|
||||
|
||||
export function humanizeTimelineIdentifier(value: string): string {
|
||||
function humanizeTimelineIdentifier(value: string): string {
|
||||
return value
|
||||
.trim()
|
||||
.replace(/[_-]+/g, " ")
|
||||
@@ -239,7 +239,7 @@ export function getTimelineElementIdentity(element: TimelineElement): string {
|
||||
// DOM node querying
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
export function getTimelineDomNodes(doc: Document): Element[] {
|
||||
function getTimelineDomNodes(doc: Document): Element[] {
|
||||
const rootComp = doc.querySelector("[data-composition-id]");
|
||||
return Array.from(doc.querySelectorAll("[data-start]")).filter((node) => node !== rootComp);
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ const GENERIC_FONT_FAMILIES = new Set([
|
||||
"fangsong",
|
||||
]);
|
||||
|
||||
export function primaryFontFamilyFromCss(value: string): string {
|
||||
function primaryFontFamilyFromCss(value: string): string {
|
||||
const first = value.split(",")[0] ?? "";
|
||||
return first.trim().replace(/^["']|["']$/g, "");
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ function normalizeSelection(params: URLSearchParams): StudioUrlSelectionState |
|
||||
};
|
||||
}
|
||||
|
||||
export function defaultStudioUrlState(): StudioUrlState {
|
||||
function defaultStudioUrlState(): StudioUrlState {
|
||||
return {
|
||||
activeCompPath: null,
|
||||
currentTime: null,
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import type { TimelineElement } from "../player";
|
||||
|
||||
export const TIMELINE_INSPECTOR_BOUNDARY_EPSILON_SECONDS = 0.08;
|
||||
const TIMELINE_INSPECTOR_BOUNDARY_EPSILON_SECONDS = 0.08;
|
||||
|
||||
const AUDIO_TIMELINE_TAGS = new Set(["audio", "music", "sfx", "sound", "narration"]);
|
||||
const AUDIO_SOURCE_EXT_RE = /\.(aac|flac|m4a|mp3|ogg|opus|wav)(?:[?#].*)?$/i;
|
||||
|
||||
@@ -20,7 +20,7 @@ const CHROME_PATHS = [
|
||||
"/usr/bin/chromium-browser",
|
||||
];
|
||||
|
||||
export async function getSharedBrowser(): Promise<import("puppeteer-core").Browser | null> {
|
||||
async function getSharedBrowser(): Promise<import("puppeteer-core").Browser | null> {
|
||||
if (_browser?.connected) return _browser;
|
||||
if (_browserLaunchPromise) return _browserLaunchPromise;
|
||||
_browserLaunchPromise = (async () => {
|
||||
|
||||
Reference in New Issue
Block a user