Skip to content

Commit f80bfd0

Browse files
authored
Merge pull request #6546 from remotion-dev/upgrade-zod
`remotion`: Allow Zod v4 schemas to be used, `@remotion/zod-types-v3` backwards compatibility package
2 parents 9b8600e + 68daead commit f80bfd0

File tree

122 files changed

+4227
-3367
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+4227
-3367
lines changed

bun.lock

Lines changed: 57 additions & 38 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@
9595
"react-dom": "19.2.3",
9696
"eslint": "9.19.0",
9797
"prettier": "3.8.1",
98-
"zod": "3.22.3",
98+
"zod": "4.3.6",
9999
"@types/react": "19.2.7",
100100
"@types/react-dom": "19.2.3",
101101
"@types/node": "20.12.14",

packages/STATS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,3 +61,4 @@ Monthly downloads of Remotion packages
6161
[![NPM Downloads](https://img.shields.io/npm/dm/@remotion/webcodecs.svg?style=flat&color=black&label=@remotion/webcodecs)](https://npmcharts.com/compare/@remotion/webcodecs?minimal=true)
6262
[![NPM Downloads](https://img.shields.io/npm/dm/@remotion/whisper-web.svg?style=flat&color=black&label=@remotion/whisper-web)](https://npmcharts.com/compare/@remotion/whisper-web?minimal=true)
6363
[![NPM Downloads](https://img.shields.io/npm/dm/@remotion/zod-types.svg?style=flat&color=black&label=@remotion/zod-types)](https://npmcharts.com/compare/@remotion/zod-types?minimal=true)
64+
[![NPM Downloads](https://img.shields.io/npm/dm/@remotion/zod-types-v3.svg?style=flat&color=black&label=@remotion/zod-types-v3)](https://npmcharts.com/compare/@remotion/zod-types-v3?minimal=true)

packages/cli/src/extra-packages.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
export const EXTRA_PACKAGES: Record<string, string> = {
2-
zod: '3.22.3',
32
mediabunny: '1.34.4',
3+
zod: '4.3.6',
44
};
55

66
export const EXTRA_PACKAGES_DOCS: Record<string, string> = {
7-
zod: 'https://www.remotion.dev/docs/schemas#prerequisites',
87
mediabunny: 'https://www.remotion.dev/docs/mediabunny/version',
8+
zod: 'https://zod.dev',
99
};

packages/cli/src/list-of-remotion-packages.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ export const listOfRemotionPackages = [
7272
'@remotion/transitions',
7373
'@remotion/media-parser',
7474
'@remotion/zod-types',
75+
'@remotion/zod-types-v3',
7576
'@remotion/webcodecs',
7677
'@remotion/convert',
7778
'@remotion/captions',

packages/cloudrun/src/functions/helpers/payloads.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export const CloudRunPayload = z.discriminatedUnion('type', [
5959
.tuple([z.number(), z.number().nullable()])
6060
.or(z.number())
6161
.nullable(),
62-
envVariables: z.record(z.string()),
62+
envVariables: z.record(z.string(), z.string()),
6363
chromiumOptions: chromiumOptions.optional(),
6464
muted: z.boolean(),
6565
outputBucket: z.string(),
@@ -76,12 +76,12 @@ export const CloudRunPayload = z.discriminatedUnion('type', [
7676
colorSpace: z.enum(BrowserSafeApis.validColorSpaces).nullable(),
7777
clientVersion: z.string(),
7878
downloadBehavior,
79-
metadata: z.record(z.string()).optional().nullable(),
79+
metadata: z.record(z.string(), z.string()).optional().nullable(),
8080
renderIdOverride: z.string().optional().nullable(),
8181
renderStatusWebhook: z
8282
.object({
8383
url: z.string(),
84-
headers: z.record(z.string()),
84+
headers: z.record(z.string(), z.string()),
8585
data: z.any(),
8686
webhookProgressInterval: z.number().min(0).max(1).optional().nullable(),
8787
})
@@ -101,7 +101,7 @@ export const CloudRunPayload = z.discriminatedUnion('type', [
101101
imageFormat: stillImageFormat,
102102
scale: z.number(),
103103
privacy: z.enum(['public', 'private', 'no-acl']),
104-
envVariables: z.record(z.string()),
104+
envVariables: z.record(z.string(), z.string()),
105105
chromiumOptions: chromiumOptions.optional(),
106106
outputBucket: z.string(),
107107
outName: z.string().nullable(),
@@ -113,12 +113,12 @@ export const CloudRunPayload = z.discriminatedUnion('type', [
113113
offthreadVideoThreads: z.number().nullable(),
114114
clientVersion: z.string(),
115115
downloadBehavior,
116-
metadata: z.record(z.string()).optional().nullable(),
116+
metadata: z.record(z.string(), z.string()).optional().nullable(),
117117
renderIdOverride: z.string().optional().nullable(),
118118
renderStatusWebhook: z
119119
.object({
120120
url: z.string(),
121-
headers: z.record(z.string()),
121+
headers: z.record(z.string(), z.string()),
122122
data: z.any(),
123123
webhookProgressInterval: z.number().min(0).max(1).optional().nullable(),
124124
})

packages/core/src/Composition.tsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,16 @@
11
import type {ComponentType} from 'react';
22
import React, {Suspense, useContext, useEffect} from 'react';
33
import {createPortal} from 'react-dom';
4-
import type {AnyZodObject, z} from 'zod';
4+
import type {z} from 'zod';
5+
import type {AnyZodObject} from './any-zod-type.js';
56
import {
67
CanUseRemotionHooks,
78
CanUseRemotionHooksProvider,
89
} from './CanUseRemotionHooks.js';
10+
import type {Codec} from './codec.js';
11+
import type {TComposition} from './CompositionManager.js';
912
import {CompositionSetters} from './CompositionManagerContext.js';
1013
import {FolderContext} from './Folder.js';
11-
import {
12-
PROPS_UPDATED_EXTERNALLY,
13-
useResolvedVideoConfig,
14-
} from './ResolveCompositionConfig.js';
15-
import type {Codec} from './codec.js';
1614
import {serializeThenDeserializeInStudio} from './input-props-serialization.js';
1715
import {useIsPlayer} from './is-player.js';
1816
import {Loading} from './loading-indicator.js';
@@ -21,6 +19,10 @@ import {portalNode} from './portal-node.js';
2119
import type {InferProps, PropsIfHasProps} from './props-if-has-props.js';
2220
import type {ProResProfile} from './prores-profile.js';
2321
import type {PixelFormat, VideoImageFormat} from './render-types.js';
22+
import {
23+
PROPS_UPDATED_EXTERNALLY,
24+
useResolvedVideoConfig,
25+
} from './ResolveCompositionConfig.js';
2426
import {useDelayRender} from './use-delay-render.js';
2527
import {useLazyComponent} from './use-lazy-component.js';
2628
import {useRemotionEnvironment} from './use-remotion-environment.js';
@@ -196,12 +198,12 @@ const InnerComposition = <
196198
component: lazy,
197199
defaultProps: serializeThenDeserializeInStudio(
198200
(defaultProps ?? {}) as z.output<Schema> & Props,
199-
) as z.output<Schema> & Props,
201+
) as InferProps<Schema, Props>,
200202
nonce,
201203
parentFolderName: parentName,
202204
schema: schema ?? null,
203205
calculateMetadata: compProps.calculateMetadata ?? null,
204-
});
206+
} as TComposition<Schema, Props>);
205207

206208
return () => {
207209
unregisterComposition(id);

packages/core/src/CompositionManager.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type {ComponentType, LazyExoticComponent} from 'react';
22
import React from 'react';
3-
import type {AnyZodObject} from 'zod';
3+
import type {AnyZodObject} from './any-zod-type.js';
44
import type {CalculateMetadataFunction} from './Composition.js';
55
import type {DownloadBehavior} from './download-behavior.js';
66
import type {InferProps, PropsIfHasProps} from './props-if-has-props.js';

packages/core/src/CompositionManagerContext.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import type React from 'react';
22
import {createContext} from 'react';
3-
import type {AnyZodObject} from 'zod';
3+
import type {AnyZodObject} from './any-zod-type.js';
44
import type {AnyComposition, TComposition} from './CompositionManager.js';
55
import type {TFolder} from './Folder.js';
66
import type {VideoConfig} from './video-config.js';

packages/core/src/CompositionManagerProvider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
useRef,
66
useState,
77
} from 'react';
8-
import type {AnyZodObject} from 'zod';
8+
import type {AnyZodObject} from './any-zod-type.js';
99
import type {TComposition} from './CompositionManager';
1010
import {compositionsRef, type AnyComposition} from './CompositionManager';
1111
import type {

0 commit comments

Comments
 (0)