Files
hyperframes/packages/studio-server/package-subpaths.json
T
James RussoandClaude Opus 5.5 2c2b399bfa fix(producer): local renders bring in only media, font, CSS and JS from outside the project (#7647)
* fix(producer): local renders bring in only media, font, CSS and JS from outside the project

Local renders (`render`, range render, `benchmark`, the Studio server and the
Vite Studio adapter) run with allowOutsideProjectAssets, which copied every
existing file that markup named outside the project into compiled/hf-ext, of
any type and from any folder, and served project links that lead outside
without looking at where they lead. Publish already applies a policy here:
outside references are kept, private locations are left out, and only image,
video, audio, font, CSS and JS files are copied. Local renders now follow the
same policy.

The publish predicates (private location, copied file type, left-out wording)
move from the CLI to a new `@hyperframes/studio-server/outside-file` subpath,
since the producer cannot import the CLI and already depends on studio-server.
The CLI re-exports them, so publish behaves as before. The media extension
sets move with them because the copied-type list includes them.

The producer decides with one predicate, `outsideAssetRefusal` in
utils/paths.ts, and applies it wherever allowOutsideProjectAssets lets an
outside file in, so no entry point can skip it:
- collectExternalAssets: src/href/url() references, which covers <a href> and
  <link href>
- dropMediaOutsideProject: video/audio/image sources in any spelling the media
  resolver accepts (file: URLs, percent-encoding), so nothing probes or
  extracts them
- the render file server: project links that lead outside
- the distributed plan's project copy: the same links (range render)
- GIF/HEIC prep and sub-composition links: private locations only, since
  those inputs are converted or compiled rather than copied as they are

Each left-out file logs the publish wording with "left out of the render".

To reproduce on main: a project whose index.html references
../../.ssh/id_key through <link href>, <a href> and url(), with a project
link to a file in .ssh, rendered locally, gets those files copied into
compiled/hf-ext and served.

Comment lines: the four in studio-server's outsideFile.ts moved verbatim from
the CLI files they replace. Two are new, in utils/paths.ts. The one on
outsideAssetRefusal states the policy once, so its six call sites carry no
comment. The one on refusesOutsideLink says its boolean means "refused, and
already warned", which the name alone does not say. Comment ratchet is clean.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(cli): keep outsideFileType as a re-export of the shared module

The base repository's deletion guard rejects removing a file that exists on
main unless git pairs it as a rename. outsideFileType.ts moved into
studio-server/outside-file with enough added around it that git no longer
pairs the two, so CI's "Reject accidental file deletions" step failed.

The file stays as a two-name re-export and publish keeps importing from it,
so publishProject.ts and its file-type test are back to main.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore(producer): raise the unpacked size budgets for the outside-file policy

CI's packed-manifest check measured @hyperframes/producer at 3,244,665 bytes
unpacked (budget 3,210,000) and @hyperframes/studio-server at 653,506
(budget 646,000), both just past the 1% tolerance.

Both packages were already at the edge on main. Measured locally with
npm pack --dry-run, main is 3,237,162 for producer and 652,502 for
studio-server, so studio-server on main is already at its ceiling. This
branch adds about 7.9 KB unpacked to producer, because the new checks sit in
the compiler, render stages and file server, which each producer entry
bundles. It adds about 5.5 KB to studio-server for the new outside-file
entry and its declarations. No source maps, tests or assets were added to
either tarball.

The budgets go to 3,245,000 and 654,000, just above CI's measurements, the
same way #7579 raised producer's budget for the project-folder checks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(producer): apply the outside-file policy to embedded local fonts

A project font file that links outside the project is now left out of
font embedding with the same warning the file server gives, instead of
being inlined into the compiled HTML.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-13 16:26:19 +00:00

127 lines
4.4 KiB
JSON

{
"package": "@hyperframes/studio-server",
"localNodeRuntime": true,
"subpaths": {
".": {
"source": "./src/index.ts",
"runtime": "./dist/index.js",
"types": "./dist/index.d.ts",
"environments": ["bun", "node"]
},
"./package.json": {
"source": "./package.json",
"runtime": "./package.json",
"types": null,
"environments": ["bun", "node"]
},
"./screenshot-clip": {
"source": "./src/helpers/screenshotClip.ts",
"runtime": "./dist/helpers/screenshotClip.js",
"types": "./dist/helpers/screenshotClip.d.ts",
"environments": ["bun", "node"]
},
"./safe-path": {
"source": "./src/helpers/safePath.ts",
"runtime": "./dist/helpers/safePath.js",
"types": "./dist/helpers/safePath.d.ts",
"environments": ["bun", "node"]
},
"./request-identity": {
"source": "./src/helpers/requestIdentity.ts",
"runtime": "./dist/helpers/requestIdentity.js",
"types": "./dist/helpers/requestIdentity.d.ts",
"environments": ["bun", "node"]
},
"./hf-ids": {
"source": "./src/helpers/hfIdPersist.ts",
"runtime": "./dist/helpers/hfIdPersist.js",
"types": "./dist/helpers/hfIdPersist.d.ts",
"environments": ["bun", "node"]
},
"./history": {
"source": "./src/history/index.ts",
"runtime": "./dist/history/index.js",
"types": "./dist/history/index.d.ts",
"environments": ["bun", "node"]
},
"./manual-edits-render-script": {
"source": "./src/helpers/manualEditsRenderScript.ts",
"runtime": "./dist/helpers/manualEditsRenderScript.js",
"types": "./dist/helpers/manualEditsRenderScript.d.ts",
"environments": ["bun", "node"]
},
"./studio-motion-render-script": {
"source": "./src/helpers/studioMotionRenderScript.ts",
"runtime": "./dist/helpers/studioMotionRenderScript.js",
"types": "./dist/helpers/studioMotionRenderScript.d.ts",
"environments": ["bun", "node"]
},
"./draft-markers": {
"source": "./src/helpers/draftMarkers.ts",
"runtime": "./dist/helpers/draftMarkers.js",
"types": "./dist/helpers/draftMarkers.d.ts",
"environments": ["browser", "bun", "node"]
},
"./finite-mutation": {
"source": "./src/helpers/finiteMutation.ts",
"runtime": "./dist/helpers/finiteMutation.js",
"types": "./dist/helpers/finiteMutation.d.ts",
"environments": ["bun", "node"]
},
"./source-mutation": {
"source": "./src/helpers/sourceMutation.ts",
"runtime": "./dist/helpers/sourceMutation.js",
"types": "./dist/helpers/sourceMutation.d.ts",
"environments": ["browser", "bun", "node"]
},
"./media-codec-map": {
"source": "./src/helpers/mediaCodecMap.ts",
"runtime": "./dist/helpers/mediaCodecMap.js",
"types": "./dist/helpers/mediaCodecMap.d.ts",
"environments": ["bun", "node"]
},
"./proxy-transcoder": {
"source": "./src/helpers/proxyTranscoder.ts",
"runtime": "./dist/helpers/proxyTranscoder.js",
"types": "./dist/helpers/proxyTranscoder.d.ts",
"environments": ["bun", "node"]
},
"./loudness": {
"source": "./src/helpers/loudness.ts",
"runtime": "./dist/helpers/loudness.js",
"types": "./dist/helpers/loudness.d.ts",
"environments": ["bun", "node"]
},
"./media-proxy-preview": {
"source": "./src/helpers/mediaProxyPreview.ts",
"runtime": "./dist/helpers/mediaProxyPreview.js",
"types": "./dist/helpers/mediaProxyPreview.d.ts",
"environments": ["bun", "node"]
},
"./encoder-options": {
"source": "./src/helpers/encoderOptions.ts",
"runtime": "./dist/helpers/encoderOptions.js",
"types": "./dist/helpers/encoderOptions.d.ts",
"environments": ["bun", "node"]
},
"./mime": {
"source": "./src/helpers/mime.ts",
"runtime": "./dist/helpers/mime.js",
"types": "./dist/helpers/mime.d.ts",
"environments": ["bun", "node"]
},
"./outside-file": {
"source": "./src/helpers/outsideFile.ts",
"runtime": "./dist/helpers/outsideFile.js",
"types": "./dist/helpers/outsideFile.d.ts",
"environments": ["bun", "node"]
},
"./media-range": {
"source": "./src/helpers/mediaRange.ts",
"runtime": "./dist/helpers/mediaRange.js",
"types": "./dist/helpers/mediaRange.d.ts",
"environments": ["bun", "node"]
}
}
}