From 67eab59f44c0609c7299dc7127d864b37d2d1715 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20=C3=81ngel?= Date: Thu, 16 Jul 2026 23:00:48 -0400 Subject: [PATCH] feat(studio-server): serve H.264 proxies from the preview route (#2590) * feat(studio-server): serve H.264 proxies from the preview route Wires the codec manifest and the transcoder into the preview surface: the route negotiates a proxy via a query param and serves it through the existing range and ETag machinery, composition HTML carries a codec map for the runtime, and hostile assets pre-warm so a first play does not wait on a cold transcode. Exposes the three subpath exports the CLI surfaces consume upstack. Drops the TEMP fallow entry added with the transcoder: it has real importers now. * fix(studio-server): publish media proxy exports * fix(parsers): scan HTML comments linearly --- .fallowrc.jsonc | 23 - packages/parsers/src/assetResolution.test.ts | 22 + packages/parsers/src/assetResolution.ts | 19 +- packages/studio-server/package.json | 30 ++ .../src/helpers/mediaProxyPreview.ts | 134 ++++++ packages/studio-server/src/index.ts | 1 + packages/studio-server/src/routes/files.ts | 7 +- .../studio-server/src/routes/preview.test.ts | 440 +++++++++++++++++- packages/studio-server/src/routes/preview.ts | 120 ++++- packages/studio-server/tsup.config.ts | 10 +- 10 files changed, 763 insertions(+), 43 deletions(-) create mode 100644 packages/parsers/src/assetResolution.test.ts create mode 100644 packages/studio-server/src/helpers/mediaProxyPreview.ts diff --git a/.fallowrc.jsonc b/.fallowrc.jsonc index d46ca2ae5..948c0d545 100644 --- a/.fallowrc.jsonc +++ b/.fallowrc.jsonc @@ -145,29 +145,6 @@ "file": "packages/studio/src/utils/studioHelpers.ts", "exports": ["resolveDroppedAssetDimensions"], }, - // TEMP (transparent-proxy stack): proxyTranscoder is carved in below its - // consumers, which land upstack (mediaProxyPreview + the preview route, - // then the CLI surfaces). With no importer yet, a per-PR audit against the - // merge base sees the module's whole export surface as unused. Same shape - // as the drawElementService entry below. Safe to drop once the preview - // weld lands; the stack's final slice greps for zero TEMP entries. - { - "file": "packages/studio-server/src/helpers/proxyTranscoder.ts", - "exports": [ - "PROXY_PARAMS_VERSION", - "TRANSCODE_TIMEOUT_MS", - "DEFAULT_PROXY_WAIT_TIMEOUT_MS", - "ProxyTranscodeError", - "FfmpegMissingFilterError", - "ProxyCapacityError", - "ProxySourceOutsideProjectError", - "ProxyWaitTimeoutError", - "waitForProxy", - "getProxyCachePath", - "clearFailedTranscodesForTest", - "resolveProxy", - ], - }, // drawElementService is the bottom of the fast-capture Graphite stack // (#1917): its consumers (frameCapture in #1919) land two PRs upstack, so // a per-PR audit diffing against the merge base sees these exports as diff --git a/packages/parsers/src/assetResolution.test.ts b/packages/parsers/src/assetResolution.test.ts new file mode 100644 index 000000000..8bc345cec --- /dev/null +++ b/packages/parsers/src/assetResolution.test.ts @@ -0,0 +1,22 @@ +import { describe, expect, it } from "vitest"; +import { maskNonScannableRanges } from "./assetResolution.js"; + +describe("maskNonScannableRanges", () => { + it("masks complete comments without changing offsets", () => { + const html = '