Skip to content

Commit f6938cf

Browse files
committed
Add server entry point for @json-render/remotion
The main package entry includes React components that require client-side context (React.createContext). This causes build failures when importing in server-side API routes. Added `@json-render/remotion/server` entry point that exports only schema and catalog definitions without React dependencies: - schema, RemotionSchema, RemotionSpec - standardComponentDefinitions, standardTransitionDefinitions - standardEffectDefinitions - Type exports for catalogs Updated remotion example to import from /server in catalog.ts
1 parent 30a49d8 commit f6938cf

File tree

7 files changed

+51
-5
lines changed

7 files changed

+51
-5
lines changed

examples/dashboard/next-env.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/// <reference types="next" />
22
/// <reference types="next/image-types/global" />
3-
import "./.next/dev/types/routes.d.ts";
3+
import "./.next/types/routes.d.ts";
44

55
// NOTE: This file should not be edited
66
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

examples/remotion/lib/catalog.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
standardComponentDefinitions,
55
standardTransitionDefinitions,
66
standardEffectDefinitions,
7-
} from "@json-render/remotion";
7+
} from "@json-render/remotion/server";
88

99
/**
1010
* Remotion video catalog

examples/remotion/next-env.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/// <reference types="next" />
22
/// <reference types="next/image-types/global" />
3-
import "./.next/dev/types/routes.d.ts";
3+
import "./.next/types/routes.d.ts";
44

55
// NOTE: This file should not be edited
66
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

examples/remotion/tsconfig.tsbuildinfo

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

packages/remotion/package.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,11 @@
3434
"types": "./dist/index.d.ts",
3535
"import": "./dist/index.mjs",
3636
"require": "./dist/index.js"
37+
},
38+
"./server": {
39+
"types": "./dist/server.d.ts",
40+
"import": "./dist/server.mjs",
41+
"require": "./dist/server.js"
3742
}
3843
},
3944
"files": [

packages/remotion/src/server.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/**
2+
* Server-safe exports for @json-render/remotion
3+
*
4+
* This entry point only exports schema and catalog definitions,
5+
* without any React or Remotion runtime dependencies.
6+
* Use this in server components, API routes, and build scripts.
7+
*
8+
* @example
9+
* ```ts
10+
* // In an API route or server component
11+
* import { schema, standardComponentDefinitions } from "@json-render/remotion/server";
12+
* ```
13+
*/
14+
15+
// Schema (no React dependencies)
16+
export { schema, type RemotionSchema, type RemotionSpec } from "./schema";
17+
18+
// Catalog definitions (no React dependencies)
19+
export {
20+
standardComponentDefinitions,
21+
standardTransitionDefinitions,
22+
standardEffectDefinitions,
23+
type ComponentDefinition,
24+
type TransitionDefinition,
25+
type EffectDefinition,
26+
} from "./catalog";
27+
28+
// Catalog types (type-only exports)
29+
export type {
30+
FrameContext,
31+
VideoComponentContext,
32+
VideoComponentFn,
33+
VideoComponents,
34+
TransitionFn,
35+
BuiltInTransition,
36+
EffectFn,
37+
Effects,
38+
} from "./catalog-types";
39+
40+
// Core types (re-exported for convenience)
41+
export type { Spec } from "@json-render/core";

packages/remotion/tsup.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { defineConfig } from "tsup";
22

33
export default defineConfig({
4-
entry: ["src/index.ts"],
4+
entry: ["src/index.ts", "src/server.ts"],
55
format: ["cjs", "esm"],
66
dts: true,
77
sourcemap: true,

0 commit comments

Comments
 (0)