@remotion/renderer 4.0.59 → 4.0.60

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.
@@ -28,6 +28,7 @@ exports.CDPSession = exports.CDPSessionEmittedEvents = exports.Connection = void
28
28
  * See the License for the specific language governing permissions and
29
29
  * limitations under the License.
30
30
  */
31
+ const logger_1 = require("../logger");
31
32
  const assert_1 = require("./assert");
32
33
  const Errors_1 = require("./Errors");
33
34
  const EventEmitter_1 = require("./EventEmitter");
@@ -62,11 +63,14 @@ class Connection extends EventEmitter_1.EventEmitter {
62
63
  const params = paramArgs.length ? paramArgs[0] : undefined;
63
64
  const id = this._rawSend({ method, params });
64
65
  return new Promise((resolve, reject) => {
66
+ var _a;
65
67
  __classPrivateFieldGet(this, _Connection_callbacks, "f").set(id, {
66
68
  resolve,
67
69
  reject,
68
70
  method,
69
71
  returnSize: true,
72
+ stack: (_a = new Error().stack) !== null && _a !== void 0 ? _a : '',
73
+ fn: method + JSON.stringify(params),
70
74
  });
71
75
  });
72
76
  }
@@ -192,11 +196,20 @@ class CDPSession extends EventEmitter_1.EventEmitter {
192
196
  params,
193
197
  });
194
198
  return new Promise((resolve, reject) => {
199
+ var _a;
200
+ if (__classPrivateFieldGet(this, _CDPSession_callbacks, "f").size > 100) {
201
+ for (const callback of __classPrivateFieldGet(this, _CDPSession_callbacks, "f").values()) {
202
+ logger_1.Log.info(callback.fn);
203
+ }
204
+ throw new Error('Leak detected: Too many callbacks');
205
+ }
195
206
  __classPrivateFieldGet(this, _CDPSession_callbacks, "f").set(id, {
196
207
  resolve,
197
208
  reject,
198
209
  method,
199
210
  returnSize: true,
211
+ stack: (_a = new Error().stack) !== null && _a !== void 0 ? _a : '',
212
+ fn: method + JSON.stringify(params),
200
213
  });
201
214
  });
202
215
  }
@@ -34,8 +34,7 @@ export declare class DOMWorld {
34
34
  timeout: number | null;
35
35
  pageFunction: Function | string;
36
36
  title: string;
37
- }): Promise<JSHandle>;
38
- title(): Promise<string>;
37
+ }): WaitTask;
39
38
  }
40
39
  interface WaitTaskOptions {
41
40
  domWorld: DOMWorld;
@@ -99,11 +99,6 @@ class DOMWorld {
99
99
  timeout,
100
100
  args: [],
101
101
  browser,
102
- }).promise;
103
- }
104
- title() {
105
- return this.evaluate(() => {
106
- return document.title;
107
102
  });
108
103
  }
109
104
  }
@@ -244,6 +239,9 @@ _WaitTask_domWorld = new WeakMap(), _WaitTask_timeout = new WeakMap(), _WaitTask
244
239
  }
245
240
  __classPrivateFieldGet(this, _WaitTask_browser, "f").off("closed" /* BrowserEmittedEvents.Closed */, this.onBrowserClose);
246
241
  __classPrivateFieldGet(this, _WaitTask_browser, "f").off("closed-silent" /* BrowserEmittedEvents.ClosedSilent */, this.onBrowserCloseSilent);
242
+ if (__classPrivateFieldGet(this, _WaitTask_domWorld, "f")._waitTasks.size > 100) {
243
+ throw new Error('Leak detected: Too many WaitTasks');
244
+ }
247
245
  __classPrivateFieldGet(this, _WaitTask_domWorld, "f")._waitTasks.delete(this);
248
246
  };
249
247
  function waitForPredicatePageFunction(predicateBody, timeout, ...args) {
@@ -77,7 +77,7 @@ class JSHandle {
77
77
  const type = __classPrivateFieldGet(this, _JSHandle_remoteObject, "f").subtype || __classPrivateFieldGet(this, _JSHandle_remoteObject, "f").type;
78
78
  return 'JSHandle@' + type;
79
79
  }
80
- return 'JSHandle:' + (0, util_1.valueFromRemoteObject)(__classPrivateFieldGet(this, _JSHandle_remoteObject, "f"));
80
+ return (0, util_1.valueFromRemoteObject)(__classPrivateFieldGet(this, _JSHandle_remoteObject, "f"));
81
81
  }
82
82
  }
83
83
  exports.JSHandle = JSHandle;
@@ -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;
@@ -5,21 +5,55 @@ const symbolicateable_error_1 = require("./error-handling/symbolicateable-error"
5
5
  const logger_1 = require("./logger");
6
6
  const parse_browser_error_stack_1 = require("./parse-browser-error-stack");
7
7
  const puppeteer_evaluate_1 = require("./puppeteer-evaluate");
8
+ const cancelledToken = 'cancelled';
9
+ const readyToken = 'ready';
8
10
  const waitForReady = ({ page, timeoutInMilliseconds, frame, indent, logLevel, }) => {
11
+ const cleanups = [];
12
+ const retrieveErrorAndReject = () => {
13
+ return new Promise((_, reject) => {
14
+ (0, puppeteer_evaluate_1.puppeteerEvaluateWithCatch)({
15
+ pageFunction: () => window.remotion_cancelledError,
16
+ args: [],
17
+ frame: null,
18
+ page,
19
+ }).then(({ value: val }) => {
20
+ if (typeof val !== 'string') {
21
+ reject(val);
22
+ return;
23
+ }
24
+ reject(new symbolicateable_error_1.SymbolicateableError({
25
+ frame: null,
26
+ stack: val,
27
+ name: 'CancelledError',
28
+ message: val.split('\n')[0],
29
+ stackFrame: (0, parse_browser_error_stack_1.parseStack)(val.split('\n')),
30
+ }));
31
+ });
32
+ });
33
+ };
9
34
  const waitForReadyProm = new Promise((resolve, reject) => {
10
- page
11
- .mainFrame()
12
- ._mainWorld.waitForFunction({
35
+ const waitTask = page.mainFrame()._mainWorld.waitForFunction({
13
36
  browser: page.browser,
14
37
  // Increase timeout so the delayRender() timeout fires earlier
15
38
  timeout: timeoutInMilliseconds + 3000,
16
- pageFunction: 'window.remotion_renderReady === true',
39
+ pageFunction: `window.remotion_renderReady === true ? "${readyToken}" : window.remotion_cancelledError !== undefined ? "${cancelledToken}" : false`,
17
40
  title: frame === null
18
41
  ? 'the page to render the React component'
19
42
  : `the page to render the React component at frame ${frame}`,
20
- })
43
+ });
44
+ cleanups.push(() => {
45
+ waitTask.terminate(new Error('cleanup'));
46
+ });
47
+ waitTask.promise
21
48
  .then((a) => {
22
- return resolve(a);
49
+ const token = a.toString();
50
+ if (token === cancelledToken) {
51
+ return retrieveErrorAndReject();
52
+ }
53
+ if (token === readyToken) {
54
+ return resolve(a);
55
+ }
56
+ reject(new Error('Unexpected token ' + token));
23
57
  })
24
58
  .catch((err) => {
25
59
  if (err.message.includes('timeout') &&
@@ -54,46 +88,6 @@ const waitForReady = ({ page, timeoutInMilliseconds, frame, indent, logLevel, })
54
88
  }
55
89
  });
56
90
  });
57
- const waitForErrorProm = new Promise((_shouldNeverResolve, reject) => {
58
- page
59
- .mainFrame()
60
- ._mainWorld.waitForFunction({
61
- browser: page.browser,
62
- timeout: null,
63
- pageFunction: 'window.remotion_cancelledError !== undefined',
64
- title: 'remotion_cancelledError variable to appear on the page',
65
- })
66
- .then(() => {
67
- return (0, puppeteer_evaluate_1.puppeteerEvaluateWithCatch)({
68
- pageFunction: () => window.remotion_cancelledError,
69
- args: [],
70
- frame: null,
71
- page,
72
- });
73
- })
74
- .then(({ value: val }) => {
75
- if (typeof val !== 'string') {
76
- reject(val);
77
- return;
78
- }
79
- reject(new symbolicateable_error_1.SymbolicateableError({
80
- frame: null,
81
- stack: val,
82
- name: 'CancelledError',
83
- message: val.split('\n')[0],
84
- stackFrame: (0, parse_browser_error_stack_1.parseStack)(val.split('\n')),
85
- }));
86
- })
87
- .catch((err) => {
88
- if (err.message.includes('timeout') &&
89
- err.message.includes('exceeded')) {
90
- // Don't care if a error never appeared
91
- }
92
- else {
93
- reject(err);
94
- }
95
- });
96
- });
97
91
  return Promise.race([
98
92
  new Promise((_, reject) => {
99
93
  page.on("disposed" /* PageEmittedEvents.Disposed */, () => {
@@ -106,8 +100,11 @@ const waitForReady = ({ page, timeoutInMilliseconds, frame, indent, logLevel, })
106
100
  });
107
101
  }),
108
102
  waitForReadyProm,
109
- waitForErrorProm,
110
- ]);
103
+ ]).finally(() => {
104
+ cleanups.forEach((cleanup) => {
105
+ cleanup();
106
+ });
107
+ });
111
108
  };
112
109
  exports.waitForReady = waitForReady;
113
110
  const seekToFrame = async ({ frame, page, composition, timeoutInMilliseconds, logLevel, indent, }) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/renderer",
3
- "version": "4.0.59",
3
+ "version": "4.0.60",
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.59"
21
+ "remotion": "4.0.60"
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-linux-arm64-gnu": "4.0.59",
44
- "@remotion/compositor-darwin-x64": "4.0.59",
45
- "@remotion/compositor-darwin-arm64": "4.0.59",
46
- "@remotion/compositor-linux-x64-gnu": "4.0.59",
47
- "@remotion/compositor-win32-x64-msvc": "4.0.59",
48
- "@remotion/compositor-linux-arm64-musl": "4.0.59",
49
- "@remotion/compositor-linux-x64-musl": "4.0.59"
43
+ "@remotion/compositor-darwin-x64": "4.0.60",
44
+ "@remotion/compositor-linux-arm64-gnu": "4.0.60",
45
+ "@remotion/compositor-linux-x64-gnu": "4.0.60",
46
+ "@remotion/compositor-darwin-arm64": "4.0.60",
47
+ "@remotion/compositor-linux-arm64-musl": "4.0.60",
48
+ "@remotion/compositor-linux-x64-musl": "4.0.60",
49
+ "@remotion/compositor-win32-x64-msvc": "4.0.60"
50
50
  },
51
51
  "keywords": [
52
52
  "remotion",