@remotion/bundler 4.1.0-alpha7 → 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,
@@ -235,9 +235,22 @@ if (typeof window !== 'undefined') {
235
235
  inputProps,
236
236
  }));
237
237
  (0, remotion_1.continueRender)(handle);
238
- 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
+ };
239
252
  };
240
- window.siteVersion = '7';
253
+ window.siteVersion = '8';
241
254
  window.remotion_version = remotion_1.VERSION;
242
255
  window.remotion_setBundleMode = exports.setBundleModeAndUpdate;
243
256
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/bundler",
3
- "version": "4.1.0-alpha7",
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-alpha7"
25
+ "remotion": "4.1.0-alpha8"
26
26
  },
27
27
  "peerDependencies": {
28
28
  "react": ">=16.8.0",