@remotion/renderer 4.0.38 → 4.0.39

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.
@@ -29,12 +29,11 @@ export declare class DOMWorld {
29
29
  executionContext(): Promise<ExecutionContext>;
30
30
  evaluateHandle<HandlerType extends JSHandle = JSHandle>(pageFunction: EvaluateHandleFn, ...args: SerializableOrJSHandle[]): Promise<HandlerType>;
31
31
  evaluate<T extends EvaluateFn>(pageFunction: T, ...args: SerializableOrJSHandle[]): Promise<UnwrapPromiseLike<EvaluateFnReturnType<T>>>;
32
- waitForFunction({ browser, timeout, pageFunction, title, shouldClosePage, }: {
32
+ waitForFunction({ browser, timeout, pageFunction, title, }: {
33
33
  browser: HeadlessBrowser;
34
34
  timeout: number | null;
35
35
  pageFunction: Function | string;
36
36
  title: string;
37
- shouldClosePage: boolean;
38
37
  }): Promise<JSHandle>;
39
38
  title(): Promise<string>;
40
39
  }
@@ -45,7 +44,6 @@ interface WaitTaskOptions {
45
44
  timeout: number | null;
46
45
  browser: HeadlessBrowser;
47
46
  args: SerializableOrJSHandle[];
48
- shouldClosePage: boolean;
49
47
  }
50
48
  declare class WaitTask {
51
49
  #private;
@@ -25,7 +25,7 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (
25
25
  if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
26
26
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
27
27
  };
28
- var _DOMWorld_frame, _DOMWorld_contextPromise, _DOMWorld_contextResolveCallback, _DOMWorld_detached, _DOMWorld_waitTasks, _WaitTask_instances, _WaitTask_domWorld, _WaitTask_timeout, _WaitTask_predicateBody, _WaitTask_args, _WaitTask_runCount, _WaitTask_resolve, _WaitTask_reject, _WaitTask_timeoutTimer, _WaitTask_terminated, _WaitTask_browser, _WaitTask_shouldClosePage, _WaitTask_cleanup;
28
+ var _DOMWorld_frame, _DOMWorld_contextPromise, _DOMWorld_contextResolveCallback, _DOMWorld_detached, _DOMWorld_waitTasks, _WaitTask_instances, _WaitTask_domWorld, _WaitTask_timeout, _WaitTask_predicateBody, _WaitTask_args, _WaitTask_runCount, _WaitTask_resolve, _WaitTask_reject, _WaitTask_timeoutTimer, _WaitTask_terminated, _WaitTask_browser, _WaitTask_cleanup;
29
29
  Object.defineProperty(exports, "__esModule", { value: true });
30
30
  exports.DOMWorld = void 0;
31
31
  const assert_1 = require("./assert");
@@ -91,7 +91,7 @@ class DOMWorld {
91
91
  const context = await this.executionContext();
92
92
  return context.evaluate(pageFunction, ...args);
93
93
  }
94
- waitForFunction({ browser, timeout, pageFunction, title, shouldClosePage, }) {
94
+ waitForFunction({ browser, timeout, pageFunction, title, }) {
95
95
  return new WaitTask({
96
96
  domWorld: this,
97
97
  predicateBody: pageFunction,
@@ -99,7 +99,6 @@ class DOMWorld {
99
99
  timeout,
100
100
  args: [],
101
101
  browser,
102
- shouldClosePage,
103
102
  }).promise;
104
103
  }
105
104
  title() {
@@ -124,7 +123,6 @@ class WaitTask {
124
123
  _WaitTask_timeoutTimer.set(this, void 0);
125
124
  _WaitTask_terminated.set(this, false);
126
125
  _WaitTask_browser.set(this, void 0);
127
- _WaitTask_shouldClosePage.set(this, void 0);
128
126
  this.onBrowserClose = () => {
129
127
  return this.terminate(new Error('Browser was closed'));
130
128
  };
@@ -142,7 +140,6 @@ class WaitTask {
142
140
  __classPrivateFieldSet(this, _WaitTask_predicateBody, getPredicateBody(options.predicateBody), "f");
143
141
  __classPrivateFieldSet(this, _WaitTask_args, options.args, "f");
144
142
  __classPrivateFieldSet(this, _WaitTask_runCount, 0, "f");
145
- __classPrivateFieldSet(this, _WaitTask_shouldClosePage, options.shouldClosePage, "f");
146
143
  __classPrivateFieldGet(this, _WaitTask_domWorld, "f")._waitTasks.add(this);
147
144
  this.promise = new Promise((resolve, reject) => {
148
145
  __classPrivateFieldSet(this, _WaitTask_resolve, resolve, "f");
@@ -153,9 +150,6 @@ class WaitTask {
153
150
  if (options.timeout) {
154
151
  const timeoutError = new Errors_1.TimeoutError(`waiting for ${options.title} failed: timeout ${options.timeout}ms exceeded`);
155
152
  __classPrivateFieldSet(this, _WaitTask_timeoutTimer, setTimeout(() => {
156
- if (__classPrivateFieldGet(this, _WaitTask_shouldClosePage, "f")) {
157
- return this.terminate(timeoutError);
158
- }
159
153
  return __classPrivateFieldGet(this, _WaitTask_reject, "f").call(this, timeoutError);
160
154
  }, options.timeout), "f");
161
155
  }
@@ -244,7 +238,7 @@ class WaitTask {
244
238
  __classPrivateFieldGet(this, _WaitTask_instances, "m", _WaitTask_cleanup).call(this);
245
239
  }
246
240
  }
247
- _WaitTask_domWorld = new WeakMap(), _WaitTask_timeout = new WeakMap(), _WaitTask_predicateBody = new WeakMap(), _WaitTask_args = new WeakMap(), _WaitTask_runCount = new WeakMap(), _WaitTask_resolve = new WeakMap(), _WaitTask_reject = new WeakMap(), _WaitTask_timeoutTimer = new WeakMap(), _WaitTask_terminated = new WeakMap(), _WaitTask_browser = new WeakMap(), _WaitTask_shouldClosePage = new WeakMap(), _WaitTask_instances = new WeakSet(), _WaitTask_cleanup = function _WaitTask_cleanup() {
241
+ _WaitTask_domWorld = new WeakMap(), _WaitTask_timeout = new WeakMap(), _WaitTask_predicateBody = new WeakMap(), _WaitTask_args = new WeakMap(), _WaitTask_runCount = new WeakMap(), _WaitTask_resolve = new WeakMap(), _WaitTask_reject = new WeakMap(), _WaitTask_timeoutTimer = new WeakMap(), _WaitTask_terminated = new WeakMap(), _WaitTask_browser = new WeakMap(), _WaitTask_instances = new WeakSet(), _WaitTask_cleanup = function _WaitTask_cleanup() {
248
242
  if (__classPrivateFieldGet(this, _WaitTask_timeoutTimer, "f") !== undefined) {
249
243
  clearTimeout(__classPrivateFieldGet(this, _WaitTask_timeoutTimer, "f"));
250
244
  }
@@ -228,6 +228,8 @@ _NetworkManager_client = new WeakMap(), _NetworkManager_frameManager = new WeakM
228
228
  if (!request) {
229
229
  return;
230
230
  }
231
- logger_1.Log.warn(`Browser failed to load ${request._url}: ${event.errorText}`);
231
+ if (!event.canceled) {
232
+ logger_1.Log.warn(`Browser failed to load ${request._url}: ${event.errorText}`);
233
+ }
232
234
  __classPrivateFieldGet(this, _NetworkManager_instances, "m", _NetworkManager_forgetRequest).call(this, request, true);
233
235
  };
@@ -0,0 +1,8 @@
1
+ export declare const deleteAfterOption: {
2
+ name: string;
3
+ cliFlag: "delete-after";
4
+ description: () => JSX.Element;
5
+ ssrName: "deleteAfter";
6
+ docLink: string;
7
+ type: number | null;
8
+ };
@@ -0,0 +1,14 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.deleteAfterOption = void 0;
4
+ const jsx_runtime_1 = require("react/jsx-runtime");
5
+ exports.deleteAfterOption = {
6
+ name: 'Render expiry days',
7
+ cliFlag: 'delete-after',
8
+ description: () => {
9
+ return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["Automatically delete the render after a certain period. Accepted values are ", (0, jsx_runtime_1.jsx)("code", { children: "1-day" }), ", ", (0, jsx_runtime_1.jsx)("code", { children: "3-days" }), ", ", (0, jsx_runtime_1.jsx)("code", { children: "7-days" }), " and", ' ', (0, jsx_runtime_1.jsx)("code", { children: "30-days" }), ".", (0, jsx_runtime_1.jsx)("br", {}), " For this to work, your bucket needs to have", ' ', (0, jsx_runtime_1.jsx)("a", { href: "/docs/lambda/autodelete", children: "lifecycles enabled" }), "."] }));
10
+ },
11
+ ssrName: 'deleteAfter',
12
+ docLink: 'https://www.remotion.dev/docs/autodelete',
13
+ type: 0,
14
+ };
@@ -0,0 +1,7 @@
1
+ import type { Codec } from './codec';
2
+ export declare const x264PresetOptions: readonly ["ultrafast", "superfast", "veryfast", "faster", "fast", "medium", "slow", "slower", "veryslow", "placebo"];
3
+ export type x264Preset = typeof x264PresetOptions[number];
4
+ export declare const validateSelectedCodecAndPresetCombination: ({ codec, x264Preset, }: {
5
+ codec: Codec;
6
+ x264Preset: "ultrafast" | "superfast" | "veryfast" | "faster" | "fast" | "medium" | "slow" | "slower" | "veryslow" | "placebo" | undefined;
7
+ }) => void;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.validateSelectedCodecAndPresetCombination = exports.x264PresetOptions = void 0;
4
+ exports.x264PresetOptions = [
5
+ 'ultrafast',
6
+ 'superfast',
7
+ 'veryfast',
8
+ 'faster',
9
+ 'fast',
10
+ 'medium',
11
+ 'slow',
12
+ 'slower',
13
+ 'veryslow',
14
+ 'placebo',
15
+ ];
16
+ const validateSelectedCodecAndPresetCombination = ({ codec, x264Preset, }) => {
17
+ if (typeof x264Preset !== 'undefined' && codec !== 'h264') {
18
+ throw new TypeError(`You have set a Preset profile but the codec is "${codec}". Set the codec to "h264" or remove the Preset profile.`);
19
+ }
20
+ if (x264Preset !== undefined &&
21
+ !exports.x264PresetOptions.includes(x264Preset)) {
22
+ throw new TypeError(`The Preset profile "${x264Preset}" is not valid. Valid options are ${exports.x264PresetOptions
23
+ .map((p) => `"${p}"`)
24
+ .join(', ')}`);
25
+ }
26
+ };
27
+ exports.validateSelectedCodecAndPresetCombination = validateSelectedCodecAndPresetCombination;
@@ -1,7 +1,7 @@
1
1
  import type { Page } from './browser/BrowserPage';
2
2
  type PuppeteerCatchOptions = {
3
3
  page: Page;
4
- pageFunction: Function | string;
4
+ pageFunction: Function;
5
5
  frame: number | null;
6
6
  args: unknown[];
7
7
  };
@@ -5,7 +5,6 @@ const JSHandle_1 = require("./browser/JSHandle");
5
5
  const symbolicateable_error_1 = require("./error-handling/symbolicateable-error");
6
6
  const parse_browser_error_stack_1 = require("./parse-browser-error-stack");
7
7
  const EVALUATION_SCRIPT_URL = '__puppeteer_evaluation_script__';
8
- const SOURCE_URL_REGEX = /^[\040\t]*\/\/[@#] sourceURL=\s*(\S*?)\s*$/m;
9
8
  function valueFromRemoteObject(remoteObject) {
10
9
  if (remoteObject.unserializableValue) {
11
10
  if (remoteObject.type === 'bigint' && typeof BigInt !== 'undefined')
@@ -26,14 +25,14 @@ function valueFromRemoteObject(remoteObject) {
26
25
  }
27
26
  return remoteObject.value;
28
27
  }
29
- function isString(obj) {
30
- return typeof obj === 'string' || obj instanceof String;
31
- }
32
28
  function puppeteerEvaluateWithCatchAndTimeout({ args, frame, page, pageFunction, }) {
33
29
  return Promise.race([
34
30
  new Promise((_, reject) => {
35
31
  setTimeout(() => {
36
- reject(new Error('timeout exceeded'));
32
+ reject(new Error(
33
+ // This means the page is not responding anymore
34
+ // This error message is retryable - sync it with packages/lambda/src/shared/is-flaky-error.ts
35
+ `Timed out evaluating page function "${pageFunction.toString()}"`));
37
36
  }, 5000);
38
37
  }),
39
38
  puppeteerEvaluateWithCatch({
@@ -46,34 +45,10 @@ function puppeteerEvaluateWithCatchAndTimeout({ args, frame, page, pageFunction,
46
45
  }
47
46
  exports.puppeteerEvaluateWithCatchAndTimeout = puppeteerEvaluateWithCatchAndTimeout;
48
47
  async function puppeteerEvaluateWithCatch({ page, pageFunction, frame, args, }) {
49
- var _a, _b, _c, _d, _e, _f, _g, _h;
48
+ var _a, _b, _c, _d, _e, _f;
50
49
  const contextId = (await page.mainFrame().executionContext())._contextId;
51
50
  const client = page._client();
52
51
  const suffix = `//# sourceURL=${EVALUATION_SCRIPT_URL}`;
53
- if (isString(pageFunction)) {
54
- const expression = pageFunction;
55
- const expressionWithSourceUrl = SOURCE_URL_REGEX.test(expression)
56
- ? expression
57
- : expression + '\n' + suffix;
58
- const { value: { exceptionDetails: exceptDetails, result: remotObject }, size, } = await client.send('Runtime.evaluate', {
59
- expression: expressionWithSourceUrl,
60
- contextId,
61
- returnByValue: true,
62
- awaitPromise: true,
63
- userGesture: true,
64
- });
65
- if (exceptDetails === null || exceptDetails === void 0 ? void 0 : exceptDetails.exception) {
66
- const err = new symbolicateable_error_1.SymbolicateableError({
67
- stack: exceptDetails.exception.description,
68
- name: exceptDetails.exception.className,
69
- message: (_b = (_a = exceptDetails.exception.description) === null || _a === void 0 ? void 0 : _a.split('\n')) === null || _b === void 0 ? void 0 : _b[0],
70
- frame,
71
- stackFrame: (0, parse_browser_error_stack_1.parseStack)(exceptDetails.exception.description.split('\n')),
72
- });
73
- throw err;
74
- }
75
- return { value: valueFromRemoteObject(remotObject), size };
76
- }
77
52
  if (typeof pageFunction !== 'function')
78
53
  throw new Error(`Expected to get |string| or |function| as the first argument, but got "${pageFunction}" instead.`);
79
54
  let functionText = pageFunction.toString();
@@ -120,18 +95,18 @@ async function puppeteerEvaluateWithCatch({ page, pageFunction, frame, args, })
120
95
  const { value: { exceptionDetails, result: remoteObject }, size, } = await callFunctionOnPromise;
121
96
  if (exceptionDetails) {
122
97
  const err = new symbolicateable_error_1.SymbolicateableError({
123
- stack: (_c = exceptionDetails.exception) === null || _c === void 0 ? void 0 : _c.description,
124
- name: (_d = exceptionDetails.exception) === null || _d === void 0 ? void 0 : _d.className,
125
- message: (_f = (_e = exceptionDetails.exception) === null || _e === void 0 ? void 0 : _e.description) === null || _f === void 0 ? void 0 : _f.split('\n')[0],
98
+ stack: (_a = exceptionDetails.exception) === null || _a === void 0 ? void 0 : _a.description,
99
+ name: (_b = exceptionDetails.exception) === null || _b === void 0 ? void 0 : _b.className,
100
+ message: (_d = (_c = exceptionDetails.exception) === null || _c === void 0 ? void 0 : _c.description) === null || _d === void 0 ? void 0 : _d.split('\n')[0],
126
101
  frame,
127
- stackFrame: (0, parse_browser_error_stack_1.parseStack)(((_g = exceptionDetails.exception) === null || _g === void 0 ? void 0 : _g.description).split('\n')),
102
+ stackFrame: (0, parse_browser_error_stack_1.parseStack)(((_e = exceptionDetails.exception) === null || _e === void 0 ? void 0 : _e.description).split('\n')),
128
103
  });
129
104
  throw err;
130
105
  }
131
106
  return { size, value: valueFromRemoteObject(remoteObject) };
132
107
  }
133
108
  catch (error) {
134
- if ((_h = error === null || error === void 0 ? void 0 : error.originalMessage) === null || _h === void 0 ? void 0 : _h.startsWith("Object couldn't be returned by value")) {
109
+ if ((_f = error === null || error === void 0 ? void 0 : error.originalMessage) === null || _f === void 0 ? void 0 : _f.startsWith("Object couldn't be returned by value")) {
135
110
  throw new Error('Could not serialize the return value of the function. Did you pass non-serializable values to defaultProps?');
136
111
  }
137
112
  throw error;
@@ -17,7 +17,6 @@ const waitForReady = ({ page, timeoutInMilliseconds, frame, }) => {
17
17
  title: frame === null
18
18
  ? 'the page to render the React component'
19
19
  : `the page to render the React component at frame ${frame}`,
20
- shouldClosePage: false,
21
20
  })
22
21
  .then((a) => {
23
22
  return resolve(a);
@@ -63,7 +62,6 @@ const waitForReady = ({ page, timeoutInMilliseconds, frame, }) => {
63
62
  timeout: null,
64
63
  pageFunction: 'window.remotion_cancelledError !== undefined',
65
64
  title: 'remotion_cancelledError variable to appear on the page',
66
- shouldClosePage: false,
67
65
  })
68
66
  .then(() => {
69
67
  return (0, puppeteer_evaluate_1.puppeteerEvaluateWithCatch)({
@@ -114,7 +112,7 @@ const waitForReady = ({ page, timeoutInMilliseconds, frame, }) => {
114
112
  exports.waitForReady = waitForReady;
115
113
  const seekToFrame = async ({ frame, page, composition, timeoutInMilliseconds, }) => {
116
114
  await (0, exports.waitForReady)({ page, timeoutInMilliseconds, frame: null });
117
- await (0, puppeteer_evaluate_1.puppeteerEvaluateWithCatch)({
115
+ await (0, puppeteer_evaluate_1.puppeteerEvaluateWithCatchAndTimeout)({
118
116
  pageFunction: (f, c) => {
119
117
  window.remotion_setFrame(f, c);
120
118
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/renderer",
3
- "version": "4.0.38",
3
+ "version": "4.0.39",
4
4
  "description": "Renderer for Remotion",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -18,7 +18,7 @@
18
18
  "extract-zip": "2.0.1",
19
19
  "source-map": "^0.8.0-beta.0",
20
20
  "ws": "8.7.0",
21
- "remotion": "4.0.38"
21
+ "remotion": "4.0.39"
22
22
  },
23
23
  "peerDependencies": {
24
24
  "react": ">=16.8.0",
@@ -40,13 +40,13 @@
40
40
  "vitest": "0.31.1"
41
41
  },
42
42
  "optionalDependencies": {
43
- "@remotion/compositor-darwin-arm64": "4.0.38",
44
- "@remotion/compositor-linux-arm64-gnu": "4.0.38",
45
- "@remotion/compositor-darwin-x64": "4.0.38",
46
- "@remotion/compositor-linux-arm64-musl": "4.0.38",
47
- "@remotion/compositor-linux-x64-gnu": "4.0.38",
48
- "@remotion/compositor-linux-x64-musl": "4.0.38",
49
- "@remotion/compositor-win32-x64-msvc": "4.0.38"
43
+ "@remotion/compositor-darwin-x64": "4.0.39",
44
+ "@remotion/compositor-darwin-arm64": "4.0.39",
45
+ "@remotion/compositor-linux-arm64-gnu": "4.0.39",
46
+ "@remotion/compositor-linux-arm64-musl": "4.0.39",
47
+ "@remotion/compositor-linux-x64-gnu": "4.0.39",
48
+ "@remotion/compositor-linux-x64-musl": "4.0.39",
49
+ "@remotion/compositor-win32-x64-msvc": "4.0.39"
50
50
  },
51
51
  "keywords": [
52
52
  "remotion",