Skip to content

Commit a1fe2b1

Browse files
committed
refactor: remove legacy manual edits JSON manifest render script
Remove the old `.hyperframes/studio-manual-edits.json` sidecar approach that injected a manifest-based runtime into rendered HTML to apply position/rotation/size edits. This was replaced by the seek-reapply script that reads positions directly from HTML data attributes and CSS custom properties (shipped in v0.6.7). Removed: `createStudioManualEditsRenderBodyScript`, `studioManualEditsRenderRuntime`, `STUDIO_MANUAL_EDITS_PATH`, and all references in CLI server, studio vite plugins, and thumbnail routes. Kept: `createStudioPositionSeekReapplyScript` (active render script), all motion panel code, all manual edits DOM code.
1 parent e8e2e81 commit a1fe2b1

9 files changed

Lines changed: 26 additions & 867 deletions

File tree

packages/cli/src/server/studioServer.ts

Lines changed: 0 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import { createProjectWatcher, type ProjectWatcher } from "./fileWatcher.js";
1313
import { loadRuntimeSource } from "./runtimeSource.js";
1414
import { VERSION as version } from "../version.js";
1515
import {
16-
createStudioManualEditsRenderBodyScript,
1716
createStudioApi,
1817
createProjectSignature,
1918
getMimeType,
@@ -24,8 +23,6 @@ import {
2423
import { getElementScreenshotClip } from "@hyperframes/core/studio-api/screenshot-clip";
2524
import type { ScreenshotClip } from "@hyperframes/core/studio-api/screenshot-clip";
2625

27-
const STUDIO_MANUAL_EDITS_PATH = ".hyperframes/studio-manual-edits.json";
28-
2926
// ── Path resolution ─────────────────────────────────────────────────────────
3027

3128
function resolveDistDir(): string {
@@ -81,38 +78,6 @@ function resolveRuntimePath(): string {
8178
return builtPath;
8279
}
8380

84-
function readStudioManualEditManifestContent(projectDir: string): string {
85-
const manifestPath = join(projectDir, STUDIO_MANUAL_EDITS_PATH);
86-
if (!existsSync(manifestPath)) return "";
87-
try {
88-
return readFileSync(manifestPath, "utf-8");
89-
} catch {
90-
return "";
91-
}
92-
}
93-
94-
async function applyStudioManualEditsToThumbnailPage(
95-
page: import("puppeteer-core").Page,
96-
manifestContent: string,
97-
activeCompositionPath: string,
98-
): Promise<void> {
99-
const script = createStudioManualEditsRenderBodyScript(manifestContent, {
100-
activeCompositionPath,
101-
});
102-
if (!script) return;
103-
await page.addScriptTag({ content: script });
104-
}
105-
106-
async function reapplyStudioManualEditsToThumbnailPage(
107-
page: import("puppeteer-core").Page,
108-
): Promise<void> {
109-
await page.evaluate(() => {
110-
const apply = (window as Window & { __hfStudioManualEditsApply?: () => number })
111-
.__hfStudioManualEditsApply;
112-
if (typeof apply === "function") apply();
113-
});
114-
}
115-
11681
// ── Shared thumbnail browser (singleton per process) ────────────────────────
11782
// One browser instance is reused across all composition thumbnail requests.
11883
// Spawning a new Puppeteer process per request adds 2-5s overhead and causes
@@ -253,16 +218,13 @@ export function createStudioServer(options: StudioServerOptions): StudioServer {
253218
// Continue without — acquireBrowser will try its own resolution
254219
}
255220

256-
const manifestContent = readStudioManualEditManifestContent(opts.project.dir);
257-
const manualEditsRenderScript = createStudioManualEditsRenderBodyScript(manifestContent);
258221
const job = createRenderJob({
259222
// opts.fps is already an Fps rational — see vite-config-studio
260223
// adapter for the same convention.
261224
fps: opts.fps,
262225
quality: opts.quality as "draft" | "standard" | "high",
263226
format: opts.format,
264227
outputResolution: opts.outputResolution,
265-
...(manualEditsRenderScript ? { renderBodyScripts: [manualEditsRenderScript] } : {}),
266228
});
267229
const startTime = Date.now();
268230
const onProgress = (j: { progress: number; currentStage?: string }) => {
@@ -319,11 +281,8 @@ export function createStudioServer(options: StudioServerOptions): StudioServer {
319281
win.__timeline.seek(t);
320282
}
321283
}, opts.seekTime);
322-
const manifestContent = readStudioManualEditManifestContent(opts.project.dir);
323-
await applyStudioManualEditsToThumbnailPage(page, manifestContent, opts.compPath);
324284
// Let the seek render settle.
325285
await new Promise((r) => setTimeout(r, 200));
326-
await reapplyStudioManualEditsToThumbnailPage(page);
327286
let clip: ScreenshotClip | undefined;
328287
if (opts.selector) {
329288
clip = await page.evaluate(getElementScreenshotClip, opts.selector, opts.selectorIndex);

0 commit comments

Comments
 (0)