@remotion/bundler 4.1.0-alpha1 → 4.1.0-alpha10

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.
package/dist/bundle.js CHANGED
@@ -187,6 +187,7 @@ async function bundle(...args) {
187
187
  onSymlinkDetected: showSymlinkWarning,
188
188
  onProgress: (prog) => { var _a; return (_a = options.onPublicDirCopyProgress) === null || _a === void 0 ? void 0 : _a.call(options, prog); },
189
189
  copied: 0,
190
+ lastReportedProgress: 0,
190
191
  });
191
192
  }
192
193
  const html = (0, index_html_1.indexHtml)({
@@ -1,9 +1,10 @@
1
1
  /// <reference types="node" />
2
2
  import fs from 'node:fs';
3
- export declare function copyDir({ src, dest, onSymlinkDetected, onProgress, copied, }: {
3
+ export declare function copyDir({ src, dest, onSymlinkDetected, onProgress, copied, lastReportedProgress, }: {
4
4
  src: string;
5
5
  dest: string;
6
6
  onSymlinkDetected: (entry: fs.Dirent, dir: string) => void;
7
7
  onProgress: (bytes: number) => void;
8
8
  copied: number;
9
+ lastReportedProgress: number;
9
10
  }): Promise<void>;
package/dist/copy-dir.js CHANGED
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.copyDir = void 0;
7
7
  const node_fs_1 = __importDefault(require("node:fs"));
8
8
  const node_path_1 = __importDefault(require("node:path"));
9
- async function copyDir({ src, dest, onSymlinkDetected, onProgress, copied = 0, }) {
9
+ async function copyDir({ src, dest, onSymlinkDetected, onProgress, copied = 0, lastReportedProgress = 0, }) {
10
10
  await node_fs_1.default.promises.mkdir(dest, { recursive: true });
11
11
  const entries = await node_fs_1.default.promises.readdir(src, { withFileTypes: true });
12
12
  for (const entry of entries) {
@@ -19,6 +19,7 @@ async function copyDir({ src, dest, onSymlinkDetected, onProgress, copied = 0, }
19
19
  onSymlinkDetected,
20
20
  onProgress,
21
21
  copied,
22
+ lastReportedProgress,
22
23
  });
23
24
  }
24
25
  else if (entry.isSymbolicLink()) {
@@ -32,7 +33,10 @@ async function copyDir({ src, dest, onSymlinkDetected, onProgress, copied = 0, }
32
33
  node_fs_1.default.promises.stat(srcPath),
33
34
  ]);
34
35
  copied += size;
35
- onProgress(copied);
36
+ if (copied - lastReportedProgress > 1024 * 1024 * 10) {
37
+ onProgress(copied);
38
+ lastReportedProgress = copied;
39
+ }
36
40
  }
37
41
  }
38
42
  }
@@ -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
- defaultProps: state.compositionDefaultProps,
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 = '5';
253
+ window.siteVersion = '9';
227
254
  window.remotion_version = remotion_1.VERSION;
228
255
  window.remotion_setBundleMode = exports.setBundleModeAndUpdate;
229
256
  }
@@ -53,6 +53,7 @@ function truthy(value) {
53
53
  return Boolean(value);
54
54
  }
55
55
  const webpackConfig = ({ entry, userDefinedComponent, outDir, environment, webpackOverride = (f) => f, onProgress, enableCaching = true, maxTimelineTracks, entryPoints, remotionRoot, keyboardShortcutsEnabled, poll, }) => {
56
+ let lastProgress = 0;
56
57
  const conf = webpackOverride({
57
58
  optimization: {
58
59
  minimize: false,
@@ -97,7 +98,10 @@ const webpackConfig = ({ entry, userDefinedComponent, outDir, environment, webpa
97
98
  : [
98
99
  new webpack_1.ProgressPlugin((p) => {
99
100
  if (onProgress) {
100
- onProgress(Number((p * 100).toFixed(2)));
101
+ if (p === 1 || p - lastProgress > 0.05) {
102
+ lastProgress = p;
103
+ onProgress(Number((p * 100).toFixed(2)));
104
+ }
101
105
  }
102
106
  }),
103
107
  new optional_dependencies_1.AllowOptionalDependenciesPlugin(),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/bundler",
3
- "version": "4.1.0-alpha1",
3
+ "version": "4.1.0-alpha10",
4
4
  "description": "Bundler for Remotion",
5
5
  "main": "dist/index.js",
6
6
  "sideEffects": false,
@@ -18,11 +18,11 @@
18
18
  "license": "SEE LICENSE IN LICENSE.md",
19
19
  "dependencies": {
20
20
  "css-loader": "5.2.7",
21
- "esbuild": "0.16.12",
21
+ "esbuild": "0.18.6",
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-alpha1"
25
+ "remotion": "4.1.0-alpha10"
26
26
  },
27
27
  "peerDependencies": {
28
28
  "react": ">=16.8.0",
@@ -35,10 +35,10 @@
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
- "prettier-plugin-organize-imports": "^2.3.4",
41
+ "prettier-plugin-organize-imports": "^3.2.2",
42
42
  "react": "^18.0.0",
43
43
  "react-dom": "^18.0.0",
44
44
  "typescript": "4.9.5",