Skip to content

Open source CapCut alternative.

TypeScript

fix(site): keep the engine library out of the hosted bundle [rebuild]

David Lef74cf72040b1
diff --git a/site/src/cut/server/cloud/library.ts b/site/src/cut/server/cloud/library.ts
index fb3113e2..05d9bb3e 100644
--- a/site/src/cut/server/cloud/library.ts
+++ b/site/src/cut/server/cloud/library.ts
@@ -11,7 +11,7 @@ import type {
TemplateLayer,
TemplateMedia,
} from "../library";
-import { templateExtras } from "../library";
+import { templateExtras } from "../templateExtras";
import { resolveParent } from "@/cut/lib/folderTree";
import type { StoredAsset } from "@/cut/lib/types";
import type { Prisma } from "@/generated/prisma/client";
diff --git a/site/src/cut/server/library.ts b/site/src/cut/server/library.ts
index c4681776..300ca9d0 100644
--- a/site/src/cut/server/library.ts
+++ b/site/src/cut/server/library.ts
@@ -6,6 +6,7 @@ import { resolveParent, settleParents } from "@/cut/lib/folderTree";
import { cutDataRoot } from "./dataDir";
import { assertLocalRuntime } from "./local-only";
import { mediaPath as projectMediaPath, readProject } from "./projects";
+import { templateExtras } from "./templateExtras";
import { exists, uniqueName, writeJsonAtomic } from "./util";
/** The Mac's library: reusable media that lives outside any project, shared by
@@ -123,19 +124,6 @@ export interface LibraryTemplate {
project?: unknown;
}
-/** The parts of a template the server carries whole. */
-export const templateExtras = (input: {
- transitions?: unknown[];
- stickers?: unknown[];
- captions?: unknown;
- project?: unknown;
-}) => ({
- ...(input.transitions?.length ? { transitions: input.transitions } : {}),
- ...(input.stickers?.length ? { stickers: input.stickers } : {}),
- ...(input.captions ? { captions: input.captions } : {}),
- ...(input.project ? { project: input.project } : {}),
-});
-
interface LibraryIndex {
assets: LibraryAsset[];
folders?: LibraryFolder[];
diff --git a/site/src/cut/server/templateExtras.ts b/site/src/cut/server/templateExtras.ts
new file mode 100644
index 00000000..b73446c9
--- /dev/null
+++ b/site/src/cut/server/templateExtras.ts
@@ -0,0 +1,18 @@
+// The parts of a template the server carries whole, shared by the engine's
+// on-disk library and its cloud twin. Kept free of filesystem imports so the
+// hosted bundle never traces the engine.
+export interface TemplateExtras {
+ /** Opaque, round-tripped for the client: transition bars, which texts are
+ * stickers drawn from media, the caption look, the source's frame. */
+ transitions?: unknown[];
+ stickers?: unknown[];
+ captions?: unknown;
+ project?: unknown;
+}
+
+export const templateExtras = (input: TemplateExtras): TemplateExtras => ({
+ ...(input.transitions?.length ? { transitions: input.transitions } : {}),
+ ...(input.stickers?.length ? { stickers: input.stickers } : {}),
+ ...(input.captions ? { captions: input.captions } : {}),
+ ...(input.project ? { project: input.project } : {}),
+});