@remotion/bundler 4.1.0-alpha5 → 4.1.0-alpha8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,6 @@
1
+ import type { SerializedJSONWithCustomFields } from 'remotion';
2
+ export declare const serializeJSONWithDate: ({ data, indent, staticBase, }: {
3
+ data: Record<string, unknown>;
4
+ indent: number | undefined;
5
+ staticBase: string | null;
6
+ }) => SerializedJSONWithCustomFields;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.serializeJSONWithDate = void 0;
4
+ // Keep in sync with /packages/core/src/input-props-serialization.ts
5
+ const DATE_TOKEN = 'remotion-date:';
6
+ const FILE_TOKEN = 'remotion-file:';
7
+ const serializeJSONWithDate = ({ data, indent, staticBase, }) => {
8
+ let customDateUsed = false;
9
+ let customFileUsed = false;
10
+ let mapUsed = false;
11
+ let setUsed = false;
12
+ const serializedString = JSON.stringify(data, function (key, value) {
13
+ const item = this[key];
14
+ if (item instanceof Date) {
15
+ customDateUsed = true;
16
+ return `${DATE_TOKEN}${item.toISOString()}`;
17
+ }
18
+ if (item instanceof Map) {
19
+ mapUsed = true;
20
+ return value;
21
+ }
22
+ if (item instanceof Set) {
23
+ setUsed = true;
24
+ return value;
25
+ }
26
+ if (typeof item === 'string' &&
27
+ staticBase !== null &&
28
+ item.startsWith(staticBase)) {
29
+ customFileUsed = true;
30
+ return `${FILE_TOKEN}${item.replace(staticBase + '/', '')}`;
31
+ }
32
+ return value;
33
+ }, indent);
34
+ return { serializedString, customDateUsed, customFileUsed, mapUsed, setUsed };
35
+ };
36
+ exports.serializeJSONWithDate = serializeJSONWithDate;
@@ -50,7 +50,7 @@ const GetVideo = ({ state }) => {
50
50
  }
51
51
  compositions.setCurrentComposition((_a = foundComposition === null || foundComposition === void 0 ? void 0 : foundComposition.id) !== null && _a !== void 0 ? _a : null);
52
52
  compositions.setCurrentCompositionMetadata({
53
- props: state.props,
53
+ props: remotion_1.Internals.deserializeJSONWithCustomFields(state.serializedResolvedPropsWithSchema),
54
54
  durationInFrames: state.compositionDurationInFrames,
55
55
  fps: state.compositionFps,
56
56
  height: state.compositionHeight,
@@ -191,13 +191,20 @@ if (typeof window !== 'undefined') {
191
191
  return compositions;
192
192
  };
193
193
  window.getStaticCompositions = () => {
194
+ var _a;
194
195
  const compositions = getUnevaluatedComps();
196
+ const inputProps = typeof window === 'undefined' ||
197
+ remotion_1.Internals.getRemotionEnvironment() === 'player-development' ||
198
+ remotion_1.Internals.getRemotionEnvironment() === 'player-production'
199
+ ? {}
200
+ : (_a = (0, remotion_1.getInputProps)()) !== null && _a !== void 0 ? _a : {};
195
201
  return Promise.all(compositions.map(async (c) => {
196
202
  const handle = (0, remotion_1.delayRender)(`Running calculateMetadata() for composition ${c.id}. If you didn't want to evaluate this composition, use "selectComposition()" instead of "getCompositions()"`);
197
203
  const comp = remotion_1.Internals.resolveVideoConfig({
198
204
  composition: c,
199
205
  editorProps: {},
200
206
  signal: new AbortController().signal,
207
+ inputProps,
201
208
  });
202
209
  const resolved = await Promise.resolve(comp);
203
210
  (0, remotion_1.continueRender)(handle);
@@ -208,6 +215,7 @@ if (typeof window !== 'undefined') {
208
215
  return getUnevaluatedComps().map((c) => c.id);
209
216
  };
210
217
  window.remotion_calculateComposition = async (compId) => {
218
+ var _a;
211
219
  const compositions = getUnevaluatedComps();
212
220
  const selectedComp = compositions.find((c) => c.id === compId);
213
221
  if (!selectedComp) {
@@ -215,15 +223,34 @@ if (typeof window !== 'undefined') {
215
223
  }
216
224
  const abortController = new AbortController();
217
225
  const handle = (0, remotion_1.delayRender)(`Running the calculateMetadata() function for composition ${compId}`);
226
+ const inputProps = typeof window === 'undefined' ||
227
+ remotion_1.Internals.getRemotionEnvironment() === 'player-development' ||
228
+ remotion_1.Internals.getRemotionEnvironment() === 'player-production'
229
+ ? {}
230
+ : (_a = (0, remotion_1.getInputProps)()) !== null && _a !== void 0 ? _a : {};
218
231
  const prom = await Promise.resolve(remotion_1.Internals.resolveVideoConfig({
219
232
  composition: selectedComp,
220
233
  editorProps: {},
221
234
  signal: abortController.signal,
235
+ inputProps,
222
236
  }));
223
237
  (0, remotion_1.continueRender)(handle);
224
- return prom;
238
+ const { props, defaultProps, ...data } = prom;
239
+ return {
240
+ ...data,
241
+ serializedResolvedPropsWithCustomSchema: remotion_1.Internals.serializeJSONWithDate({
242
+ data: props,
243
+ indent: undefined,
244
+ staticBase: null,
245
+ }).serializedString,
246
+ serializedDefaultPropsWithCustomSchema: remotion_1.Internals.serializeJSONWithDate({
247
+ data: defaultProps,
248
+ indent: undefined,
249
+ staticBase: null,
250
+ }).serializedString,
251
+ };
225
252
  };
226
- window.siteVersion = '6';
253
+ window.siteVersion = '8';
227
254
  window.remotion_version = remotion_1.VERSION;
228
255
  window.remotion_setBundleMode = exports.setBundleModeAndUpdate;
229
256
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/bundler",
3
- "version": "4.1.0-alpha5",
3
+ "version": "4.1.0-alpha8",
4
4
  "description": "Bundler for Remotion",
5
5
  "main": "dist/index.js",
6
6
  "sideEffects": false,
@@ -22,7 +22,7 @@
22
22
  "react-refresh": "0.9.0",
23
23
  "style-loader": "2.0.0",
24
24
  "webpack": "5.83.1",
25
- "remotion": "4.1.0-alpha5"
25
+ "remotion": "4.1.0-alpha8"
26
26
  },
27
27
  "peerDependencies": {
28
28
  "react": ">=16.8.0",
@@ -35,7 +35,7 @@
35
35
  "@types/react-dom": "18.0.10",
36
36
  "eslint": "8.42.0",
37
37
  "eslint-plugin-10x": "1.5.2",
38
- "eslint-plugin-react": "7.29.4",
38
+ "eslint-plugin-react": "7.32.2",
39
39
  "eslint-plugin-react-hooks": "4.4.0",
40
40
  "prettier": "^2.7.1",
41
41
  "prettier-plugin-organize-imports": "^2.3.4",