@hyperframes/studio-server 0.8.144 → 0.8.146
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-DG2VOIGR.js → chunk-3RUFN2CK.js} +1 -2
- package/dist/{chunk-RN33UALN.js → chunk-EJC7TX3O.js} +1 -2
- package/dist/{chunk-4ETS2LXI.js → chunk-L3HJVTQE.js} +0 -1
- package/dist/{chunk-DTKK7TKL.js → chunk-M62HDRLX.js} +2 -3
- package/dist/{chunk-IMG2GSY6.js → chunk-RGC6DKVM.js} +0 -1
- package/dist/{chunk-6XMC64FJ.js → chunk-SVQFE44C.js} +0 -1
- package/dist/{chunk-X62ASOGO.js → chunk-UEEXAVOA.js} +0 -1
- package/dist/{chunk-32IH7WBY.js → chunk-VMT4OC5B.js} +2 -3
- package/dist/{chunk-AZBGTB3N.js → chunk-XKBQOQFZ.js} +45 -10
- package/dist/{chunk-K3H6HTVC.js → chunk-Y7V6FJHS.js} +41 -16
- package/dist/{chunk-JJ4N3PXT.js → chunk-Z5UJMFO4.js} +1 -2
- package/dist/{chunk-VE2AOX4K.js → chunk-ZNRTEXK2.js} +2 -3
- package/dist/helpers/draftMarkers.js +0 -1
- package/dist/helpers/finiteMutation.js +1 -2
- package/dist/helpers/hfIdPersist.js +4 -5
- package/dist/helpers/loudness.js +4 -5
- package/dist/helpers/manualEditsRenderScript.js +1 -2
- package/dist/helpers/mediaCodecMap.js +4 -5
- package/dist/helpers/mediaProxyPreview.d.ts +2 -2
- package/dist/helpers/mediaProxyPreview.js +6 -7
- package/dist/helpers/proxyTranscoder.d.ts +16 -4
- package/dist/helpers/proxyTranscoder.js +9 -6
- package/dist/helpers/safePath.js +3 -4
- package/dist/helpers/screenshotClip.js +1 -2
- package/dist/helpers/sourceMutation.d.ts +0 -1
- package/dist/helpers/sourceMutation.js +1 -2
- package/dist/helpers/studioMotionRenderScript.js +1 -2
- package/dist/history/index.d.ts +2 -2
- package/dist/history/index.js +8 -7
- package/dist/index.d.ts +5 -4
- package/dist/index.js +31 -25
- package/dist/{mediaProxyPreview-ozy7FkMP.d.ts → mediaProxyPreview-BR7yXz2M.d.ts} +2 -1
- package/dist/{projectHistory-Cm8Mdmmv.d.ts → projectHistory-CyTVYz2y.d.ts} +9 -1
- package/package.json +3 -3
- package/dist/chunk-32IH7WBY.js.map +0 -1
- package/dist/chunk-4ETS2LXI.js.map +0 -1
- package/dist/chunk-6XMC64FJ.js.map +0 -1
- package/dist/chunk-AZBGTB3N.js.map +0 -1
- package/dist/chunk-DG2VOIGR.js.map +0 -1
- package/dist/chunk-DTKK7TKL.js.map +0 -1
- package/dist/chunk-IMG2GSY6.js.map +0 -1
- package/dist/chunk-JJ4N3PXT.js.map +0 -1
- package/dist/chunk-K3H6HTVC.js.map +0 -1
- package/dist/chunk-RN33UALN.js.map +0 -1
- package/dist/chunk-VE2AOX4K.js.map +0 -1
- package/dist/chunk-X62ASOGO.js.map +0 -1
- package/dist/helpers/draftMarkers.js.map +0 -1
- package/dist/helpers/finiteMutation.js.map +0 -1
- package/dist/helpers/hfIdPersist.js.map +0 -1
- package/dist/helpers/loudness.js.map +0 -1
- package/dist/helpers/manualEditsRenderScript.js.map +0 -1
- package/dist/helpers/mediaCodecMap.js.map +0 -1
- package/dist/helpers/mediaProxyPreview.js.map +0 -1
- package/dist/helpers/proxyTranscoder.js.map +0 -1
- package/dist/helpers/safePath.js.map +0 -1
- package/dist/helpers/screenshotClip.js.map +0 -1
- package/dist/helpers/sourceMutation.js.map +0 -1
- package/dist/helpers/studioMotionRenderScript.js.map +0 -1
- package/dist/history/index.js.map +0 -1
- package/dist/index.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/helpers/mediaProxyPreview.ts"],"sourcesContent":["import { resolve } from \"node:path\";\nimport { formatPreviewProxyBox, type PreviewProxyBox } from \"@hyperframes/core\";\nimport { insertBeforeCloseTag } from \"@hyperframes/core/compiler/html-document\";\nimport type { StudioApiAdapter } from \"../types.js\";\nimport {\n createMediaCodecProbeCache,\n proxyVariantFor,\n recordProxyPrewarm,\n scanProjectMediaCodecMap,\n shouldPrewarmProxy,\n type HtmlSourceLike,\n type MediaCodecMap,\n type MediaCodecProbeCache,\n} from \"./mediaCodecMap.js\";\nimport { resolveProxy, PROXY_PARAMS_VERSION } from \"./proxyTranscoder.js\";\n\n/**\n * Transparent-media-proxy wiring shared by `routes/preview.ts`\n * (docs/plans/2026-07-14-002-feat-transparent-media-proxies-plan.md, unit U3).\n * Split out of the route module to keep it under the repo's 600-line file cap.\n */\n\n/**\n * Preview-route-local adapter surface for the auto-proxy feature. Both\n * fields are optional so any existing `StudioApiAdapter` value remains\n * structurally assignable without editing the shared interface:\n * `autoProxy` defaults to true (on) when omitted — a later unit wires the\n * CLI `--no-proxy` flag / `hyperframes.json` setting through it;\n * `mediaCodecProbeCache` lets a host share one probe cache across\n * preview/play/static-server surfaces instead of each constructing its own.\n */\nexport type PreviewApiAdapter = StudioApiAdapter & {\n autoProxy?: boolean;\n mediaCodecProbeCache?: MediaCodecProbeCache;\n /** Keeps built preview documents across restarts, keyed by project id and preview ETag. */\n previewDocuments?: PreviewDocumentStore;\n};\n\nexport interface PreviewDocumentStore {\n read(key: string): string | null;\n write(key: string, html: string): void;\n}\n\nexport function isAutoProxyEnabled(adapter: PreviewApiAdapter): boolean {\n return adapter.autoProxy !== false;\n}\n\n/** One probe cache per server instance — construct once in `registerPreviewRoutes`\n * and reuse across every request so the mtime-cache benefit in\n * `scanProjectMediaCodecMap` actually applies. A host that wants to share the\n * cache across other surfaces (play, static project server) can pass its own\n * via `adapter.mediaCodecProbeCache`. */\nexport function resolvePreviewMediaCodecProbeCache(\n adapter: PreviewApiAdapter,\n): MediaCodecProbeCache {\n return adapter.mediaCodecProbeCache ?? createMediaCodecProbeCache();\n}\n\n/**\n * ETag salt for `?hf-proxy=` asset requests, mirroring `variablesEtagSalt` in\n * preview.ts: salted by the raw param value plus the transcoder's params\n * version, so a future proxy-recipe change (which bumps `PROXY_PARAMS_VERSION`)\n * or a different proxy variant invalidates cached 304s without needing to\n * touch the proxy file itself.\n */\nexport function proxyEtagSalt(raw: string | undefined, box?: PreviewProxyBox): string {\n if (raw === undefined) return \"\";\n return `:proxy:${raw}:${PROXY_PARAMS_VERSION}${box ? `:${formatPreviewProxyBox(box)}` : \"\"}`;\n}\n\n/**\n * Injects `window.__HF_MEDIA_CODEC_MAP__` (the U1 codec-facts scan) into\n * served composition HTML, and fire-and-forget pre-warms `resolveProxy` for\n * every entry whose codec no browser decodes, so an element's proactive swap\n * usually hits a warm cache (KTD: protects the per-origin connection budget\n * under held responses). Conditionally hostile codecs are injected but NOT\n * pre-warmed: the requesting browser usually plays them, and the transcode\n * runs concurrently with its first layout. No second concurrency limiter here\n * — the transcoder's own global bound throttles both pre-warm and\n * element-triggered calls. Pre-warm failures are swallowed; an actual\n * `?hf-proxy=` request surfaces them as a 502 and transcodes lazily.\n * Alpha-bearing entries pre-warm their VP8/WebM variant.\n *\n * The single shared implementation for every auto-proxy surface — the studio\n * preview route (via `injectMediaCodecMap` below) and the CLI's composition /\n * static project servers (via the `./media-proxy-preview` subpath export).\n * Empty maps leave HTML untouched, preserving the normal no-hostile-media\n * preview path. On-demand proxy requests enforce the same eligibility gate.\n */\nexport async function injectMediaCodecMapIntoHtml(\n html: string,\n projectDir: string,\n htmlSources: HtmlSourceLike[],\n probeCache?: MediaCodecProbeCache,\n prewarm = true,\n): Promise<string> {\n let map: MediaCodecMap;\n try {\n map = await scanProjectMediaCodecMap(\n projectDir,\n htmlSources,\n probeCache ? { cache: probeCache } : {},\n );\n } catch {\n // Best-effort: a scan failure must never block serving the page.\n return html;\n }\n if (Object.keys(map).length === 0) return html;\n for (const [rootRelativePathname, facts] of Object.entries(map)) {\n if (!prewarm || !shouldPrewarmProxy(facts)) continue;\n recordProxyPrewarm();\n resolveProxy(\n projectDir,\n resolve(projectDir, rootRelativePathname.replace(/^\\/+/, \"\")),\n proxyVariantFor(facts),\n ).catch(() => {\n // Swallowed: the pre-warm is best-effort. A real `?hf-proxy=` request\n // for this asset hears the remembered failure (502) or re-attempts it.\n });\n }\n // <-escape prevents a src path containing \"</script>\" from breaking out of\n // the injected tag, mirroring injectPreviewVariables in helpers/previewVariables.ts.\n const json = JSON.stringify(map)\n .replace(/</g, \"\\\\u003c\")\n .replace(/\\u2028/g, \"\\\\u2028\")\n .replace(/\\u2029/g, \"\\\\u2029\");\n const tag = `<script data-hf-media-codec-map>window.__HF_MEDIA_CODEC_MAP__=${json};</script>`;\n return insertBeforeCloseTag(html, \"head\", `${tag}\\n`) ?? `${tag}\\n${html}`;\n}\n\n/**\n * Adapter-aware wrapper used by the studio preview routes: skipped entirely\n * (no scan, no injection) when auto-proxy is off for this adapter.\n */\nexport async function injectMediaCodecMap(\n html: string,\n adapter: PreviewApiAdapter,\n projectDir: string,\n compSrcPath: string,\n probeCache: MediaCodecProbeCache,\n): Promise<string> {\n if (!isAutoProxyEnabled(adapter)) return html;\n return injectMediaCodecMapIntoHtml(html, projectDir, [{ html, compSrcPath }], probeCache, false);\n}\n"],"mappings":";;;;;;;;;;;;;AAAA,SAAS,eAAe;AACxB,SAAS,6BAAmD;AAC5D,SAAS,4BAA4B;AAyC9B,SAAS,mBAAmB,SAAqC;AACtE,SAAO,QAAQ,cAAc;AAC/B;AAOO,SAAS,mCACd,SACsB;AACtB,SAAO,QAAQ,wBAAwB,2BAA2B;AACpE;AASO,SAAS,cAAc,KAAyB,KAA+B;AACpF,MAAI,QAAQ,OAAW,QAAO;AAC9B,SAAO,UAAU,GAAG,IAAI,oBAAoB,GAAG,MAAM,IAAI,sBAAsB,GAAG,CAAC,KAAK,EAAE;AAC5F;AAqBA,eAAsB,4BACpB,MACA,YACA,aACA,YACA,UAAU,MACO;AACjB,MAAI;AACJ,MAAI;AACF,UAAM,MAAM;AAAA,MACV;AAAA,MACA;AAAA,MACA,aAAa,EAAE,OAAO,WAAW,IAAI,CAAC;AAAA,IACxC;AAAA,EACF,QAAQ;AAEN,WAAO;AAAA,EACT;AACA,MAAI,OAAO,KAAK,GAAG,EAAE,WAAW,EAAG,QAAO;AAC1C,aAAW,CAAC,sBAAsB,KAAK,KAAK,OAAO,QAAQ,GAAG,GAAG;AAC/D,QAAI,CAAC,WAAW,CAAC,mBAAmB,KAAK,EAAG;AAC5C,uBAAmB;AACnB;AAAA,MACE;AAAA,MACA,QAAQ,YAAY,qBAAqB,QAAQ,QAAQ,EAAE,CAAC;AAAA,MAC5D,gBAAgB,KAAK;AAAA,IACvB,EAAE,MAAM,MAAM;AAAA,IAGd,CAAC;AAAA,EACH;AAGA,QAAM,OAAO,KAAK,UAAU,GAAG,EAC5B,QAAQ,MAAM,SAAS,EACvB,QAAQ,WAAW,SAAS,EAC5B,QAAQ,WAAW,SAAS;AAC/B,QAAM,MAAM,iEAAiE,IAAI;AACjF,SAAO,qBAAqB,MAAM,QAAQ,GAAG,GAAG;AAAA,CAAI,KAAK,GAAG,GAAG;AAAA,EAAK,IAAI;AAC1E;AAMA,eAAsB,oBACpB,MACA,SACA,YACA,aACA,YACiB;AACjB,MAAI,CAAC,mBAAmB,OAAO,EAAG,QAAO;AACzC,SAAO,4BAA4B,MAAM,YAAY,CAAC,EAAE,MAAM,YAAY,CAAC,GAAG,YAAY,KAAK;AACjG;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/helpers/finiteMutation.ts"],"sourcesContent":["export interface UnsafeMutationValue {\n path: string;\n reason: \"non-finite-number\" | \"null\";\n}\n\ninterface FindUnsafeMutationValuesOptions {\n allowNullPath?: (path: string) => boolean;\n}\n\nexport function findUnsafeMutationValues(\n value: unknown,\n path = \"body\",\n options: FindUnsafeMutationValuesOptions = {},\n): UnsafeMutationValue[] {\n if (value === null) {\n return options.allowNullPath?.(path) ? [] : [{ path, reason: \"null\" }];\n }\n if (typeof value === \"number\") {\n return Number.isFinite(value) ? [] : [{ path, reason: \"non-finite-number\" }];\n }\n if (!value || typeof value !== \"object\") return [];\n if (Array.isArray(value)) {\n return value.flatMap((item, index) =>\n findUnsafeMutationValues(item, `${path}[${index}]`, options),\n );\n }\n return Object.entries(value).flatMap(([key, item]) =>\n findUnsafeMutationValues(item, `${path}.${key}`, options),\n );\n}\n\nconst DOM_PATCH_NULL_VALUE_PATH = /^body\\.operations\\[\\d+\\]\\.value$/;\n\nexport function findUnsafeDomPatchValues(value: unknown): UnsafeMutationValue[] {\n return findUnsafeMutationValues(value, \"body\", {\n allowNullPath: (path) => DOM_PATCH_NULL_VALUE_PATH.test(path),\n });\n}\n"],"mappings":";AASO,SAAS,yBACd,OACA,OAAO,QACP,UAA2C,CAAC,GACrB;AACvB,MAAI,UAAU,MAAM;AAClB,WAAO,QAAQ,gBAAgB,IAAI,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,QAAQ,OAAO,CAAC;AAAA,EACvE;AACA,MAAI,OAAO,UAAU,UAAU;AAC7B,WAAO,OAAO,SAAS,KAAK,IAAI,CAAC,IAAI,CAAC,EAAE,MAAM,QAAQ,oBAAoB,CAAC;AAAA,EAC7E;AACA,MAAI,CAAC,SAAS,OAAO,UAAU,SAAU,QAAO,CAAC;AACjD,MAAI,MAAM,QAAQ,KAAK,GAAG;AACxB,WAAO,MAAM;AAAA,MAAQ,CAAC,MAAM,UAC1B,yBAAyB,MAAM,GAAG,IAAI,IAAI,KAAK,KAAK,OAAO;AAAA,IAC7D;AAAA,EACF;AACA,SAAO,OAAO,QAAQ,KAAK,EAAE;AAAA,IAAQ,CAAC,CAAC,KAAK,IAAI,MAC9C,yBAAyB,MAAM,GAAG,IAAI,IAAI,GAAG,IAAI,OAAO;AAAA,EAC1D;AACF;AAEA,IAAM,4BAA4B;AAE3B,SAAS,yBAAyB,OAAuC;AAC9E,SAAO,yBAAyB,OAAO,QAAQ;AAAA,IAC7C,eAAe,CAAC,SAAS,0BAA0B,KAAK,IAAI;AAAA,EAC9D,CAAC;AACH;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/helpers/draftMarkers.ts"],"sourcesContent":["/**\n * Compatibility export for server consumers. The edit-protocol constants are\n * owned by core's dependency-free browser contract.\n */\nexport * from \"@hyperframes/core/editing/draft-markers\";\n"],"mappings":";AAIA,cAAc;","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|