diff --git a/docs/guides/export-and-share.mdx b/docs/guides/export-and-share.mdx index 2f190c166d..197ae481f7 100644 --- a/docs/guides/export-and-share.mdx +++ b/docs/guides/export-and-share.mdx @@ -138,6 +138,10 @@ Local images outside the project referenced by an `` or `` element' `srcset` are included too. Their size or pixel-density descriptors are preserved, and your source files stay unchanged. +Only images, video, audio, fonts, CSS and JS files are copied from outside the +project. Any other outside file, such as a Lottie `.json` or a `.pdf`, is left +out with a warning naming it; move it into the project folder to include it. + Before sharing source, remove secrets and confirm that every included media file can be shared. Tell a reviewer whether you need feedback on story, visuals, timing, facts, or final approval. diff --git a/docs/packages/cli.mdx b/docs/packages/cli.mdx index be8e6eb376..befb985852 100644 --- a/docs/packages/cli.mdx +++ b/docs/packages/cli.mdx @@ -2674,13 +2674,16 @@ authenticating, uploading, or starting anything. If you are over, add only paths you have verified are unneeded to `.hyperframesignore`. A file outside the project folder that a composition points at is copied into -the zip, unless it sits in a private location (env files, Git data, hidden, -system and app-data folders) or is reached from a file that came in with an -imported project: then it is left out, with a warning naming it. Under -`--json`, the result lists those as `left_out`, each with the `file` that points -at it, the `reference` as written, its `path` from the project folder, the -`reason` (`blocklisted` or `received`) and `levels_up`, how many folders above -the project it is. A full run also prints each as a `{"event":"left_out",…}` +the zip only if it is an image, video, audio, font, CSS or JS file, judged by +its extension. Any other outside file (a Lottie `.json`, a `.pdf`, a file with +no extension), one in a private location (env files, Git data, hidden, system +and app-data folders), and one reached from a file that came in with an +imported project are left out, with a warning naming each. To include such a +file, move it into the project folder. Under `--json`, the result lists those +as `left_out`, each with the `file` that points at it, the `reference` as +written, its `path` from the project folder, the `reason` (`blocklisted`, +`received` or `file_type`) and `levels_up`, how many folders above the project +it is. A full run also prints each as a `{"event":"left_out",…}` line on stderr, so a wrapper can ask with `--dry-run --json` before uploading and still hear about each one during the run. diff --git a/packages/cli/src/cloud/mediaExtensions.ts b/packages/cli/src/cloud/mediaExtensions.ts new file mode 100644 index 0000000000..643fce0064 --- /dev/null +++ b/packages/cli/src/cloud/mediaExtensions.ts @@ -0,0 +1,32 @@ +export const VIDEO_EXTS = new Set([ + ".mp4", + ".m4v", + ".mov", + ".webm", + ".mkv", + ".avi", + ".mpg", + ".mpeg", + ".ts", + ".m2ts", + ".mts", + ".flv", + ".wmv", + ".ogv", + ".3gp", +]); +export const AUDIO_EXTS = new Set([ + ".wav", + ".mp3", + ".m4a", + ".aac", + ".ogg", + ".oga", + ".opus", + ".flac", + ".aif", + ".aiff", + ".wma", +]); +// Still images the API refuses; converted to PNG unless animated. +export const CONVERTIBLE_IMAGE_EXTS = new Set([".gif", ".avif", ".bmp", ".tif", ".tiff"]); diff --git a/packages/cli/src/cloud/offload.ts b/packages/cli/src/cloud/offload.ts index 24a705bbe3..a655cb503b 100644 --- a/packages/cli/src/cloud/offload.ts +++ b/packages/cli/src/cloud/offload.ts @@ -33,6 +33,7 @@ import { findFFmpeg, findFFprobe, getFFmpegInstallHint } from "../browser/ffmpeg import { probeAudio } from "../audio/analysis/decode.js"; import { formatBytes } from "../ui/format.js"; import { bytesMatchExtension } from "./offloadSniff.js"; +import { AUDIO_EXTS, CONVERTIBLE_IMAGE_EXTS, VIDEO_EXTS } from "./mediaExtensions.js"; import { type PlayedSegment, planTrim } from "./offloadTrim.js"; import { archiveKey, @@ -70,39 +71,6 @@ const ACCEPTED: Record = { ".mp3": { contentType: "audio/mpeg", maxBytes: AUDIO_MAX_BYTES }, }; -const VIDEO_EXTS = new Set([ - ".mp4", - ".m4v", - ".mov", - ".webm", - ".mkv", - ".avi", - ".mpg", - ".mpeg", - ".ts", - ".m2ts", - ".mts", - ".flv", - ".wmv", - ".ogv", - ".3gp", -]); -const AUDIO_EXTS = new Set([ - ".wav", - ".mp3", - ".m4a", - ".aac", - ".ogg", - ".oga", - ".opus", - ".flac", - ".aif", - ".aiff", - ".wma", -]); -// Still images the API refuses; converted to PNG unless animated. -const CONVERTIBLE_IMAGE_EXTS = new Set([".gif", ".avif", ".bmp", ".tif", ".tiff"]); - /** Visually lossless re-encodes for media the asset API refuses or caps. Quality lives here. */ const REENCODE_PRESETS = { video: { diff --git a/packages/cli/src/commands/cloud/render.leftOut.test.ts b/packages/cli/src/commands/cloud/render.leftOut.test.ts index 3438af2c29..9bedea3778 100644 --- a/packages/cli/src/commands/cloud/render.leftOut.test.ts +++ b/packages/cli/src/commands/cloud/render.leftOut.test.ts @@ -7,7 +7,7 @@ import { fileURLToPath } from "node:url"; const cliEntry = resolve(fileURLToPath(import.meta.url), "..", "..", "..", "cli.ts"); -/** `/p` whose received index.html points at `/notes.txt` and whose own page points at `/.env`. */ +/** `/p` whose received index.html points at `/notes.txt`; its own page points at `/.env` and `/data.json`. */ function importedProject(): string { const root = mkdtempSync(join(tmpdir(), "hf-cloud-left-out-")); onTestFinished(() => rmSync(root, { recursive: true, force: true })); @@ -15,11 +15,12 @@ function importedProject(): string { mkdirSync(join(dir, ".hyperframes"), { recursive: true }); writeFileSync(join(root, "notes.txt"), "outside"); writeFileSync(join(root, ".env"), "SECRET=1"); + writeFileSync(join(root, "data.json"), "{}"); writeFileSync( join(dir, "index.html"), `
`, ); - writeFileSync(join(dir, "mine.html"), ``); + writeFileSync(join(dir, "mine.html"), ``); writeFileSync( join(dir, ".hyperframes", "received-files.json"), JSON.stringify({ files: ["index.html"] }), @@ -64,8 +65,15 @@ describe("cloud render --dry-run --json lists what the upload leaves out", () => reason: "blocklisted", levels_up: 1, }, + { + file: "mine.html", + reference: "../data.json", + path: "../data.json", + reason: "file_type", + levels_up: 1, + }, ]; - expect(archive.left_out).toHaveLength(2); + expect(archive.left_out).toHaveLength(3); expect(archive.left_out).toEqual(expect.arrayContaining(expected)); const events = result.stderr .split("\n") diff --git a/packages/cli/src/telemetry/uploadLeftOut.test.ts b/packages/cli/src/telemetry/uploadLeftOut.test.ts index c99728a75a..0098d5d2cc 100644 --- a/packages/cli/src/telemetry/uploadLeftOut.test.ts +++ b/packages/cli/src/telemetry/uploadLeftOut.test.ts @@ -18,19 +18,29 @@ describe("cli_upload_left_out", () => { beforeEach(() => trackEvent.mockClear()); it("counts what was left out and how far above the project, and names nothing", () => { - trackUploadLeftOut("cloud_render", [at(1), at(1, "blocklisted"), at(2), at(5), at(null)], true); + const references = [ + at(1), + at(1, "blocklisted"), + at(2), + at(5), + at(null), + at(1, "file_type"), + at(2, "file_type"), + ]; + trackUploadLeftOut("cloud_render", references, true); expect(trackEvent).toHaveBeenCalledTimes(1); const [event, properties] = trackEvent.mock.calls[0]!; expect(event).toBe("cli_upload_left_out"); expect(properties).toEqual({ command: "cloud_render", dry_run: true, - left_out_count: 5, + left_out_count: 7, received_count: 4, blocklisted_count: 1, + file_type_count: 2, max_levels_up: 5, - levels_up_1: 2, - levels_up_2: 1, + levels_up_1: 3, + levels_up_2: 2, levels_up_3_plus: 1, other_drive: 1, }); diff --git a/packages/cli/src/telemetry/uploadLeftOut.ts b/packages/cli/src/telemetry/uploadLeftOut.ts index 510329dc11..b41f9573a5 100644 --- a/packages/cli/src/telemetry/uploadLeftOut.ts +++ b/packages/cli/src/telemetry/uploadLeftOut.ts @@ -11,6 +11,7 @@ function leftOutCounts(references: readonly LeftOutReference[]) { left_out_count: references.length, received_count: references.filter((reference) => reference.reason === "received").length, blocklisted_count: references.filter((reference) => reference.reason === "blocklisted").length, + file_type_count: references.filter((reference) => reference.reason === "file_type").length, max_levels_up: Math.max(0, ...levels.map((n) => n ?? 0)), levels_up_1: counted((n) => n === 1), levels_up_2: counted((n) => n === 2), diff --git a/packages/cli/src/utils/leftOutReference.ts b/packages/cli/src/utils/leftOutReference.ts index f2769251fa..efe7835dc1 100644 --- a/packages/cli/src/utils/leftOutReference.ts +++ b/packages/cli/src/utils/leftOutReference.ts @@ -1,8 +1,8 @@ import { isAbsolute, relative } from "node:path"; import { realFilePath } from "@hyperframes/studio-server/safe-path"; -/** `blocklisted`: a private location; `received`: reached from a file that came in with an imported project. */ -export type LeftOutReason = "blocklisted" | "received"; +/** `blocklisted`: a private location; `received`: reached from an imported file; `file_type`: not a type uploads copy. */ +export type LeftOutReason = "blocklisted" | "received" | "file_type"; /** One file an upload left out. `path` is from the project folder; `levels_up` is null on another drive. */ export interface LeftOutReference { @@ -15,6 +15,17 @@ export interface LeftOutReference { export type OnLeftOut = (warning: string, reference: LeftOutReference) => void; +const WHY: Record = { + blocklisted: "which is outside the project in a private location", + received: "which leads outside the project and came in with an imported project", + file_type: "which is outside the project and is not an image, video, audio, font, CSS or JS file", +}; + +export function leftOutWarning(file: string, reference: string, reason: LeftOutReason): string { + const warning = `${file} references ${reference}, ${WHY[reason]}; it was left out of the upload.`; + return reason === "file_type" ? `${warning} Move it into the project to include it.` : warning; +} + export function leftOutReference( projectDir: string, file: string, diff --git a/packages/cli/src/utils/outsideFileType.ts b/packages/cli/src/utils/outsideFileType.ts new file mode 100644 index 0000000000..b4f4123e9d --- /dev/null +++ b/packages/cli/src/utils/outsideFileType.ts @@ -0,0 +1,22 @@ +import { extname } from "node:path"; +import { MIME_TYPES } from "@hyperframes/studio-server/mime"; +import { realFilePath } from "@hyperframes/studio-server/safe-path"; +import { AUDIO_EXTS, CONVERTIBLE_IMAGE_EXTS, VIDEO_EXTS } from "../cloud/mediaExtensions.js"; + +const COPIED_TYPE = /^(?:image|video|audio|font)\/|^text\/(?:css|javascript);/; + +/** What an upload copies from outside the project: the preview server's image, video, audio, font, CSS and JS types, + * and the media cloud render re-encodes or converts. */ +export const OUTSIDE_FILE_EXTENSIONS: ReadonlySet = new Set([ + ...Object.entries(MIME_TYPES) + .filter(([, type]) => COPIED_TYPE.test(type)) + .map(([extension]) => extension), + ...VIDEO_EXTS, + ...AUDIO_EXTS, + ...CONVERTIBLE_IMAGE_EXTS, +]); + +const hasCopiedType = (path: string) => OUTSIDE_FILE_EXTENSIONS.has(extname(path).toLowerCase()); + +export const isCopiedOutsideFileType = (absPath: string): boolean => + hasCopiedType(absPath) && hasCopiedType(realFilePath(absPath)); diff --git a/packages/cli/src/utils/publishProject.fileType.test.ts b/packages/cli/src/utils/publishProject.fileType.test.ts new file mode 100644 index 0000000000..0af1d2abd6 --- /dev/null +++ b/packages/cli/src/utils/publishProject.fileType.test.ts @@ -0,0 +1,179 @@ +import { mkdirSync, mkdtempSync, rmSync, symlinkSync, writeFileSync } from "node:fs"; +import { tmpdir } from "node:os"; +import { dirname, join } from "node:path"; +import { afterEach, describe, expect, it } from "vitest"; +import type { LeftOutReference } from "./leftOutReference.js"; +import { OUTSIDE_FILE_EXTENSIONS } from "./outsideFileType.js"; +import { stagePublishFiles } from "./publishProject.js"; + +const dirs: string[] = []; +afterEach(() => dirs.splice(0).forEach((dir) => rmSync(dir, { recursive: true, force: true }))); + +/** Writes `files` under a fresh folder, stages its `p` project, and collects what was left out. */ +function stage(files: Record) { + const root = mkdtempSync(join(tmpdir(), "hf-file-type-")); + dirs.push(root); + for (const [name, body] of Object.entries(files)) { + mkdirSync(dirname(join(root, name)), { recursive: true }); + writeFileSync(join(root, name), body.replaceAll("", root)); + } + const warnings: string[] = []; + const leftOut: LeftOutReference[] = []; + const staged = stagePublishFiles(join(root, "p"), Infinity, (warning, reference) => { + warnings.push(warning); + leftOut.push(reference); + }); + const ext = [...staged.keys()].filter((key) => key.startsWith("_ext/")).sort(); + return { root, staged, warnings, leftOut, ext }; +} + +describe("a file outside the project", () => { + it("is still copied when it is an image, video, audio, font or stylesheet, without a warning", () => { + const { ext, warnings } = stage({ + "shared/logo.png": "png", + "shared/LOUD.PNG": "png", + "shared/clip.mp4": "mp4", + "shared/brand.woff2": "woff2", + "shared/theme.css": "body {}", + "shared/old.avi": "avi", + "shared/scan.tif": "tif", + "shared/take.aiff": "aiff", + "p/index.html": [ + ``, + ``, + ``, + ``, + ].join(""), + }); + expect(ext).toEqual([ + "_ext/shared/LOUD.PNG", + "_ext/shared/brand.woff2", + "_ext/shared/clip.mp4", + "_ext/shared/logo.png", + "_ext/shared/old.avi", + "_ext/shared/scan.tif", + "_ext/shared/take.aiff", + "_ext/shared/theme.css", + ]); + expect(warnings).toEqual([]); + }); + + it("is left out when it is any other type, for ../, absolute and percent-encoded spellings", () => { + const { root, staged, ext, warnings, leftOut } = stage({ + "shared/scene.json": "{}", + "shared/brief.pdf": "pdf", + "shared/notes": "text", + "p/index.html": [ + ``, + ``, + ``, + ].join(""), + }); + expect(ext).toEqual([]); + const tail = + "which is outside the project and is not an image, video, audio, font, CSS or JS file; it was left out of the upload. Move it into the project to include it."; + expect(warnings.sort()).toEqual( + [ + `index.html references ../shared/scene.json, ${tail}`, + `index.html references ${root}/shared/brief.pdf, ${tail}`, + `index.html references %2e%2e/shared/notes, ${tail}`, + ].sort(), + ); + const at = (reference: string, path: string) => ({ + file: "index.html", + reference, + path, + reason: "file_type", + levels_up: 1, + }); + expect(leftOut).toEqual( + expect.arrayContaining([ + at("../shared/scene.json", "../shared/scene.json"), + at(`${root}/shared/brief.pdf`, "../shared/brief.pdf"), + at("%2e%2e/shared/notes", "../shared/notes"), + ]), + ); + expect(leftOut).toHaveLength(3); + const index = staged.get("index.html")!.toString("utf-8"); + expect(index).toContain(`src="../shared/scene.json"`); + }); + + it("follows the same rule for CSS url() targets and @import", () => { + const { ext, warnings, leftOut } = stage({ + "shared/theme.css": "body {}", + "shared/data.json": "{}", + "p/style.css": `@import url("../shared/theme.css"); body { background: url("../shared/data.json"); }`, + "p/index.html": ``, + }); + expect(ext).toEqual(["_ext/shared/theme.css"]); + expect(warnings).toEqual([ + expect.stringMatching(/^style\.css references \.\.\/shared\/data\.json, which is outside/), + ]); + expect(leftOut.map((one) => one.reason)).toEqual(["file_type"]); + }); + + it("is left out when its name looks like an image but it links to another type", () => { + const root = mkdtempSync(join(tmpdir(), "hf-file-type-")); + dirs.push(root); + mkdirSync(join(root, "p")); + writeFileSync(join(root, "data.json"), "{}"); + symlinkSync(join(root, "data.json"), join(root, "logo.png")); + writeFileSync(join(root, "p", "index.html"), ``); + const reasons: string[] = []; + const staged = stagePublishFiles(join(root, "p"), Infinity, (_, one) => + reasons.push(one.reason), + ); + expect([...staged.keys()].some((key) => key.startsWith("_ext/"))).toBe(false); + expect(reasons).toEqual(["file_type"]); + }); + + it("is left out when its own name is another type, even if it links to an image", () => { + const root = mkdtempSync(join(tmpdir(), "hf-file-type-")); + dirs.push(root); + mkdirSync(join(root, "p")); + writeFileSync(join(root, "logo.png"), "png"); + symlinkSync(join(root, "logo.png"), join(root, "scene.json")); + writeFileSync(join(root, "p", "index.html"), ``); + const reasons: string[] = []; + const staged = stagePublishFiles(join(root, "p"), Infinity, (_, one) => + reasons.push(one.reason), + ); + expect([...staged.keys()].some((key) => key.startsWith("_ext/"))).toBe(false); + expect(reasons).toEqual(["file_type"]); + }); + + it("keeps the private-location reason ahead of the file type", () => { + const { ext, leftOut } = stage({ + "shared/.cache/state.json": "{}", + "p/index.html": ``, + }); + expect(ext).toEqual([]); + expect(leftOut.map((one) => one.reason)).toEqual(["blocklisted"]); + }); + + it("does not change what is copied from inside the project", () => { + const { staged, warnings } = stage({ + "p/data/scene.json": "{}", + "p/index.html": ``, + }); + expect(staged.has("data/scene.json")).toBe(true); + expect(warnings).toEqual([]); + }); +}); + +describe("the outside file types", () => { + it("are images, video, audio, fonts, CSS and JS, and nothing else", () => { + for (const extension of [".png", ".avif", ".svg", ".bmp", ".tif", ".mp4", ".mov", ".webm"]) { + expect(OUTSIDE_FILE_EXTENSIONS).toContain(extension); + } + for (const extension of [".avi", ".ogv", ".mp3", ".wav", ".aiff"]) { + expect(OUTSIDE_FILE_EXTENSIONS).toContain(extension); + } + for (const extension of [".woff", ".woff2", ".ttf", ".otf", ".css", ".js", ".mjs"]) { + expect(OUTSIDE_FILE_EXTENSIONS).toContain(extension); + } + for (const extension of [".json", ".html", ".txt", ".md", ".cube", ".pdf", ".key", ""]) { + expect(OUTSIDE_FILE_EXTENSIONS).not.toContain(extension); + } + }); +}); diff --git a/packages/cli/src/utils/publishProject.ts b/packages/cli/src/utils/publishProject.ts index 05c90c3282..5d7d164b40 100644 --- a/packages/cli/src/utils/publishProject.ts +++ b/packages/cli/src/utils/publishProject.ts @@ -29,7 +29,13 @@ import { linksToPrivateOutsideFile, receivedFiles, } from "./privateProjectFile.js"; -import { leftOutReference, type OnLeftOut } from "./leftOutReference.js"; +import { + leftOutReference, + leftOutWarning, + type LeftOutReason, + type OnLeftOut, +} from "./leftOutReference.js"; +import { isCopiedOutsideFileType } from "./outsideFileType.js"; const IGNORED_DIRS = new Set([".git", "node_modules", "dist", ".next", "coverage"]); const IGNORED_FILES = new Set([".DS_Store", "Thumbs.db"]); @@ -449,7 +455,7 @@ function includeReferencedProjectFile( if (staysOut(ctx, rel, absPath)) return; if (!existsSync(absPath)) continue; if (ctx.received(entryPath) && linksOutside(ctx.absProjectDir, absPath)) { - return leaveOut(ctx, entryPath, rawPath, absPath, RECEIVED); + return leaveOut(ctx, entryPath, rawPath, absPath, "received"); } if (statSync(absPath).isFile()) { ctx.fileContents.set(rel, stageFile(absPath, ctx.onDiskMinBytes)); @@ -466,20 +472,16 @@ const HARD_REFERENCES = new Set(["video[src]", "audio[src]", "img[src]", "video[ const relativeToProject = (ctx: ExternalAssetContext, absPath: string) => encodeUrlPath(relative(ctx.absProjectDir, absPath).replaceAll("\\", "/")); -const PRIVATE = "which is outside the project in a private location"; -const RECEIVED = "which leads outside the project and came in with an imported project"; - function leaveOut( ctx: ExternalAssetContext, entryPath: string, rawPath: string, absPath: string, - why = PRIVATE, + reason: LeftOutReason = "blocklisted", ): void { - const warning = `${entryPath} references ${rawPath}, ${why}; it was left out of the upload.`; + const warning = leftOutWarning(entryPath, rawPath, reason); if (ctx.leftOut.has(warning)) return; ctx.leftOut.add(warning); - const reason = why === RECEIVED ? "received" : "blocklisted"; ctx.onLeftOut?.( warning, leftOutReference(ctx.absProjectDir, entryPath, rawPath, absPath, reason), @@ -499,13 +501,17 @@ function archiveTargetOf( try { if (!existsSync(absPath) || !statSync(absPath).isFile()) return undefined; if (ctx.received(options.entryPath)) { - leaveOut(ctx, options.entryPath, rawPath, absPath, RECEIVED); + leaveOut(ctx, options.entryPath, rawPath, absPath, "received"); return undefined; } if (isPrivateOutsideFile(ctx.absProjectDir, absPath)) { leaveOut(ctx, options.entryPath, rawPath, absPath); return undefined; } + if (!isCopiedOutsideFileType(absPath)) { + leaveOut(ctx, options.entryPath, rawPath, absPath, "file_type"); + return undefined; + } } catch { return undefined; } diff --git a/packages/studio-server/package-subpaths.json b/packages/studio-server/package-subpaths.json index 4dc051c4a4..b2e2f91fc9 100644 --- a/packages/studio-server/package-subpaths.json +++ b/packages/studio-server/package-subpaths.json @@ -104,6 +104,12 @@ "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"] + }, "./media-range": { "source": "./src/helpers/mediaRange.ts", "runtime": "./dist/helpers/mediaRange.js", diff --git a/packages/studio-server/package.json b/packages/studio-server/package.json index 138493e0b2..d41728ab93 100644 --- a/packages/studio-server/package.json +++ b/packages/studio-server/package.json @@ -111,6 +111,12 @@ "import": "./src/helpers/encoderOptions.ts", "types": "./src/helpers/encoderOptions.ts" }, + "./mime": { + "bun": "./src/helpers/mime.ts", + "node": "./dist/helpers/mime.js", + "import": "./src/helpers/mime.ts", + "types": "./src/helpers/mime.ts" + }, "./media-range": { "bun": "./src/helpers/mediaRange.ts", "node": "./dist/helpers/mediaRange.js", @@ -186,6 +192,10 @@ "import": "./dist/helpers/encoderOptions.js", "types": "./dist/helpers/encoderOptions.d.ts" }, + "./mime": { + "import": "./dist/helpers/mime.js", + "types": "./dist/helpers/mime.d.ts" + }, "./media-range": { "import": "./dist/helpers/mediaRange.js", "types": "./dist/helpers/mediaRange.d.ts" diff --git a/packages/studio-server/src/helpers/mime.ts b/packages/studio-server/src/helpers/mime.ts index 3394f35795..2ef35faf3a 100644 --- a/packages/studio-server/src/helpers/mime.ts +++ b/packages/studio-server/src/helpers/mime.ts @@ -10,6 +10,7 @@ export const MIME_TYPES: Record = { ".jpeg": "image/jpeg", ".gif": "image/gif", ".webp": "image/webp", + ".avif": "image/avif", ".ico": "image/x-icon", ".mp4": "video/mp4", ".m4v": "video/mp4", diff --git a/packages/studio-server/tsup.config.ts b/packages/studio-server/tsup.config.ts index 6e94837b53..7e11506a19 100644 --- a/packages/studio-server/tsup.config.ts +++ b/packages/studio-server/tsup.config.ts @@ -18,6 +18,7 @@ export default defineConfig({ "helpers/hfIdPersist": "src/helpers/hfIdPersist.ts", "helpers/encoderOptions": "src/helpers/encoderOptions.ts", "helpers/mediaRange": "src/helpers/mediaRange.ts", + "helpers/mime": "src/helpers/mime.ts", "history/index": "src/history/index.ts", }, format: ["esm"],