@remotion/renderer 4.0.36 → 4.0.38

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.
@@ -66,7 +66,6 @@ class Connection extends EventEmitter_1.EventEmitter {
66
66
  __classPrivateFieldGet(this, _Connection_callbacks, "f").set(id, {
67
67
  resolve,
68
68
  reject,
69
- error: new Errors_1.ProtocolError(),
70
69
  method,
71
70
  returnSize: true,
72
71
  });
@@ -136,7 +135,7 @@ _Connection_transport = new WeakMap(), _Connection_lastId = new WeakMap(), _Conn
136
135
  if (callback) {
137
136
  __classPrivateFieldGet(this, _Connection_callbacks, "f").delete(object.id);
138
137
  if (object.error) {
139
- callback.reject(createProtocolError(callback.error, callback.method, object));
138
+ callback.reject(createProtocolError(callback.method, object));
140
139
  }
141
140
  else if (callback.returnSize) {
142
141
  callback.resolve({ value: object.result, size: message.length });
@@ -156,7 +155,7 @@ _Connection_transport = new WeakMap(), _Connection_lastId = new WeakMap(), _Conn
156
155
  __classPrivateFieldGet(this, _Connection_transport, "f").onmessage = undefined;
157
156
  __classPrivateFieldGet(this, _Connection_transport, "f").onclose = undefined;
158
157
  for (const callback of __classPrivateFieldGet(this, _Connection_callbacks, "f").values()) {
159
- callback.reject(rewriteError(callback.error, `Protocol error (${callback.method}): Target closed. https://www.remotion.dev/docs/target-closed`));
158
+ callback.reject(rewriteError(new Errors_1.ProtocolError(), `Protocol error (${callback.method}): Target closed. https://www.remotion.dev/docs/target-closed`));
160
159
  }
161
160
  __classPrivateFieldGet(this, _Connection_callbacks, "f").clear();
162
161
  for (const session of __classPrivateFieldGet(this, _Connection_sessions, "f").values()) {
@@ -197,7 +196,6 @@ class CDPSession extends EventEmitter_1.EventEmitter {
197
196
  __classPrivateFieldGet(this, _CDPSession_callbacks, "f").set(id, {
198
197
  resolve,
199
198
  reject,
200
- error: new Errors_1.ProtocolError(),
201
199
  method,
202
200
  returnSize: true,
203
201
  });
@@ -208,7 +206,7 @@ class CDPSession extends EventEmitter_1.EventEmitter {
208
206
  if (object.id && callback) {
209
207
  __classPrivateFieldGet(this, _CDPSession_callbacks, "f").delete(object.id);
210
208
  if (object.error) {
211
- callback.reject(createProtocolError(callback.error, callback.method, object));
209
+ callback.reject(createProtocolError(callback.method, object));
212
210
  }
213
211
  else if (callback.returnSize) {
214
212
  callback.resolve({ value: object.result, size });
@@ -225,7 +223,7 @@ class CDPSession extends EventEmitter_1.EventEmitter {
225
223
  _onClosed() {
226
224
  __classPrivateFieldSet(this, _CDPSession_connection, undefined, "f");
227
225
  for (const callback of __classPrivateFieldGet(this, _CDPSession_callbacks, "f").values()) {
228
- callback.reject(rewriteError(callback.error, `Protocol error (${callback.method}): Target closed. https://www.remotion.dev/docs/target-closed`));
226
+ callback.reject(rewriteError(new Errors_1.ProtocolError(), `Protocol error (${callback.method}): Target closed. https://www.remotion.dev/docs/target-closed`));
229
227
  }
230
228
  __classPrivateFieldGet(this, _CDPSession_callbacks, "f").clear();
231
229
  this.emit(exports.CDPSessionEmittedEvents.Disconnected);
@@ -236,12 +234,12 @@ class CDPSession extends EventEmitter_1.EventEmitter {
236
234
  }
237
235
  exports.CDPSession = CDPSession;
238
236
  _CDPSession_sessionId = new WeakMap(), _CDPSession_targetType = new WeakMap(), _CDPSession_callbacks = new WeakMap(), _CDPSession_connection = new WeakMap();
239
- function createProtocolError(error, method, object) {
237
+ function createProtocolError(method, object) {
240
238
  let message = `Protocol error (${method}): ${object.error.message}`;
241
239
  if ('data' in object.error) {
242
240
  message += ` ${object.error.data}`;
243
241
  }
244
- return rewriteError(error, message, object.error.message);
242
+ return rewriteError(new Errors_1.ProtocolError(), message, object.error.message);
245
243
  }
246
244
  function rewriteError(error, message, originalMessage) {
247
245
  error.message = message;
@@ -20,6 +20,7 @@ export declare class HTTPRequest {
20
20
  #private;
21
21
  _requestId: string;
22
22
  _response: HTTPResponse | null;
23
+ _url: string | null;
23
24
  _fromMemoryCache: boolean;
24
25
  constructor(frame: Frame | null, event: RequestWillBeSentEvent);
25
26
  response(): HTTPResponse | null;
@@ -16,12 +16,14 @@ exports.HTTPRequest = void 0;
16
16
  class HTTPRequest {
17
17
  constructor(frame, event) {
18
18
  this._response = null;
19
+ this._url = null;
19
20
  this._fromMemoryCache = false;
20
21
  _HTTPRequest_isNavigationRequest.set(this, void 0);
21
22
  _HTTPRequest_frame.set(this, void 0);
22
23
  this._requestId = event.requestId;
23
24
  __classPrivateFieldSet(this, _HTTPRequest_isNavigationRequest, event.requestId === event.loaderId && event.type === 'Document', "f");
24
25
  __classPrivateFieldSet(this, _HTTPRequest_frame, frame, "f");
26
+ this._url = event.request.url;
25
27
  }
26
28
  response() {
27
29
  return this._response;
@@ -28,6 +28,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
28
28
  var _NetworkManager_instances, _NetworkManager_client, _NetworkManager_frameManager, _NetworkManager_networkEventManager, _NetworkManager_onRequestWillBeSent, _NetworkManager_onRequestPaused, _NetworkManager_patchRequestEventHeaders, _NetworkManager_onRequest, _NetworkManager_onRequestServedFromCache, _NetworkManager_handleRequestRedirect, _NetworkManager_emitResponseEvent, _NetworkManager_onResponseReceived, _NetworkManager_onResponseReceivedExtraInfo, _NetworkManager_forgetRequest, _NetworkManager_onLoadingFinished, _NetworkManager_emitLoadingFinished, _NetworkManager_onLoadingFailed, _NetworkManager_emitLoadingFailed;
29
29
  Object.defineProperty(exports, "__esModule", { value: true });
30
30
  exports.NetworkManager = exports.NetworkManagerEmittedEvents = void 0;
31
+ const logger_1 = require("../logger");
31
32
  const EventEmitter_1 = require("./EventEmitter");
32
33
  const HTTPRequest_1 = require("./HTTPRequest");
33
34
  const HTTPResponse_1 = require("./HTTPResponse");
@@ -227,5 +228,6 @@ _NetworkManager_client = new WeakMap(), _NetworkManager_frameManager = new WeakM
227
228
  if (!request) {
228
229
  return;
229
230
  }
231
+ logger_1.Log.warn(`Browser failed to load ${request._url}: ${event.errorText}`);
230
232
  __classPrivateFieldGet(this, _NetworkManager_instances, "m", _NetworkManager_forgetRequest).call(this, request, true);
231
233
  };
@@ -9,7 +9,7 @@ const node_os_1 = require("node:os");
9
9
  // We also get it from nproc and use the minimum of the two.
10
10
  const getConcurrencyFromNProc = () => {
11
11
  try {
12
- return parseInt((0, node_child_process_1.execSync)('nproc').toString().trim(), 10);
12
+ return parseInt((0, node_child_process_1.execSync)('nproc', { stdio: 'pipe' }).toString().trim(), 10);
13
13
  }
14
14
  catch (error) {
15
15
  return null;
@@ -71,7 +71,7 @@ const getBrowserStatus = (browserExecutablePath) => {
71
71
  const ensureLocalBrowser = async (preferredBrowserExecutable) => {
72
72
  const status = getBrowserStatus(preferredBrowserExecutable);
73
73
  if (status.type === 'no-browser') {
74
- logger_1.Log.info('No local browser could be found. Downloading Thorium https://www.remotion.dev/docs/thorium-browser');
74
+ logger_1.Log.info('No local browser could be found. Downloading Thorium https://www.remotion.dev/docs/miscellaneous/thorium-browser');
75
75
  await (0, BrowserFetcher_1.downloadBrowser)();
76
76
  }
77
77
  };
@@ -1,10 +1,16 @@
1
1
  import type { Page } from './browser/BrowserPage';
2
- export declare function puppeteerEvaluateWithCatch<ReturnType>({ page, pageFunction, frame, args, }: {
2
+ type PuppeteerCatchOptions = {
3
3
  page: Page;
4
4
  pageFunction: Function | string;
5
5
  frame: number | null;
6
6
  args: unknown[];
7
- }): Promise<{
7
+ };
8
+ export declare function puppeteerEvaluateWithCatchAndTimeout<ReturnType>({ args, frame, page, pageFunction, }: PuppeteerCatchOptions): Promise<{
8
9
  value: ReturnType;
9
10
  size: number;
10
11
  }>;
12
+ export declare function puppeteerEvaluateWithCatch<ReturnType>({ page, pageFunction, frame, args, }: PuppeteerCatchOptions): Promise<{
13
+ value: ReturnType;
14
+ size: number;
15
+ }>;
16
+ export {};
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.puppeteerEvaluateWithCatch = void 0;
3
+ exports.puppeteerEvaluateWithCatch = exports.puppeteerEvaluateWithCatchAndTimeout = void 0;
4
4
  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");
@@ -29,6 +29,22 @@ function valueFromRemoteObject(remoteObject) {
29
29
  function isString(obj) {
30
30
  return typeof obj === 'string' || obj instanceof String;
31
31
  }
32
+ function puppeteerEvaluateWithCatchAndTimeout({ args, frame, page, pageFunction, }) {
33
+ return Promise.race([
34
+ new Promise((_, reject) => {
35
+ setTimeout(() => {
36
+ reject(new Error('timeout exceeded'));
37
+ }, 5000);
38
+ }),
39
+ puppeteerEvaluateWithCatch({
40
+ args,
41
+ frame,
42
+ page,
43
+ pageFunction,
44
+ }),
45
+ ]);
46
+ }
47
+ exports.puppeteerEvaluateWithCatchAndTimeout = puppeteerEvaluateWithCatchAndTimeout;
32
48
  async function puppeteerEvaluateWithCatch({ page, pageFunction, frame, args, }) {
33
49
  var _a, _b, _c, _d, _e, _f, _g, _h;
34
50
  const contextId = (await page.mainFrame().executionContext())._contextId;
@@ -95,8 +111,9 @@ async function puppeteerEvaluateWithCatch({ page, pageFunction, frame, args, })
95
111
  }
96
112
  catch (error) {
97
113
  if (error instanceof TypeError &&
98
- error.message.startsWith('Converting circular structure to JSON'))
114
+ error.message.startsWith('Converting circular structure to JSON')) {
99
115
  error.message += ' Are you passing a nested JSHandle?';
116
+ }
100
117
  throw error;
101
118
  }
102
119
  try {
@@ -19,11 +19,13 @@ const waitForReady = ({ page, timeoutInMilliseconds, frame, }) => {
19
19
  : `the page to render the React component at frame ${frame}`,
20
20
  shouldClosePage: false,
21
21
  })
22
- .then((a) => resolve(a))
22
+ .then((a) => {
23
+ return resolve(a);
24
+ })
23
25
  .catch((err) => {
24
26
  if (err.message.includes('timeout') &&
25
27
  err.message.includes('exceeded')) {
26
- (0, puppeteer_evaluate_1.puppeteerEvaluateWithCatch)({
28
+ (0, puppeteer_evaluate_1.puppeteerEvaluateWithCatchAndTimeout)({
27
29
  pageFunction: () => {
28
30
  return Object.keys(window.remotion_delayRenderTimeouts)
29
31
  .map((id, i) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/renderer",
3
- "version": "4.0.36",
3
+ "version": "4.0.38",
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.36"
21
+ "remotion": "4.0.38"
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-x64": "4.0.36",
44
- "@remotion/compositor-linux-arm64-gnu": "4.0.36",
45
- "@remotion/compositor-linux-arm64-musl": "4.0.36",
46
- "@remotion/compositor-linux-x64-gnu": "4.0.36",
47
- "@remotion/compositor-linux-x64-musl": "4.0.36",
48
- "@remotion/compositor-win32-x64-msvc": "4.0.36",
49
- "@remotion/compositor-darwin-arm64": "4.0.36"
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"
50
50
  },
51
51
  "keywords": [
52
52
  "remotion",
@@ -1,16 +0,0 @@
1
- /**
2
- * Copyright 2020 Google Inc. All rights reserved.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- export type Product = 'chrome' | 'firefox';
@@ -1,17 +0,0 @@
1
- "use strict";
2
- /**
3
- * Copyright 2020 Google Inc. All rights reserved.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1,17 +0,0 @@
1
- /**
2
- * Copyright 2020 Google Inc. All rights reserved.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- import type { Product } from './Product';
17
- export declare function downloadBrowser(product: Product): Promise<void>;
@@ -1,58 +0,0 @@
1
- "use strict";
2
- /**
3
- * Copyright 2020 Google Inc. All rights reserved.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.downloadBrowser = void 0;
19
- const BrowserFetcher_1 = require("./BrowserFetcher");
20
- const revisions_1 = require("./revisions");
21
- const supportedProducts = {
22
- chrome: 'Chromium',
23
- firefox: 'Firefox Nightly',
24
- };
25
- function getRevision(product) {
26
- if (product === 'chrome') {
27
- return revisions_1.PUPPETEER_REVISIONS.chromium;
28
- }
29
- throw new Error(`Unsupported product ${product}`);
30
- }
31
- async function downloadBrowser(product) {
32
- const revision = getRevision(product);
33
- const revisionInfo = (0, BrowserFetcher_1.getRevisionInfo)(revision, product);
34
- await (0, BrowserFetcher_1.download)({
35
- revision: revisionInfo.revision,
36
- progressCallback: (downloadedBytes, totalBytes) => {
37
- console.log('Downloading', supportedProducts[product], toMegabytes(downloadedBytes) + '/' + toMegabytes(totalBytes));
38
- },
39
- product,
40
- platform: (0, BrowserFetcher_1.getPlatform)(product),
41
- downloadHost: (0, BrowserFetcher_1.getDownloadHost)(product),
42
- downloadsFolder: (0, BrowserFetcher_1.getDownloadsFolder)(product),
43
- });
44
- const _localRevisions = await (0, BrowserFetcher_1.localRevisions)((0, BrowserFetcher_1.getDownloadsFolder)(product), product, (0, BrowserFetcher_1.getPlatform)(product));
45
- console.log(`${supportedProducts[product]} (${revisionInfo.revision}) downloaded to ${revisionInfo.folderPath}`);
46
- await Promise.all(_localRevisions
47
- .filter((__revision) => {
48
- return __revision !== revisionInfo.revision;
49
- })
50
- .map((__revision) => {
51
- return (0, BrowserFetcher_1.removeBrowser)(__revision, (0, BrowserFetcher_1.getFolderPath)(revision, (0, BrowserFetcher_1.getDownloadsFolder)(product), (0, BrowserFetcher_1.getPlatform)(product)));
52
- }));
53
- }
54
- exports.downloadBrowser = downloadBrowser;
55
- function toMegabytes(bytes) {
56
- const mb = bytes / 1024 / 1024;
57
- return `${Math.round(mb * 10) / 10} Mb`;
58
- }
@@ -1,20 +0,0 @@
1
- /**
2
- * Copyright 2020 Google Inc. All rights reserved.
3
- *
4
- * Licensed under the Apache License, Version 2.0 (the "License");
5
- * you may not use this file except in compliance with the License.
6
- * You may obtain a copy of the License at
7
- *
8
- * http://www.apache.org/licenses/LICENSE-2.0
9
- *
10
- * Unless required by applicable law or agreed to in writing, software
11
- * distributed under the License is distributed on an "AS IS" BASIS,
12
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- * See the License for the specific language governing permissions and
14
- * limitations under the License.
15
- */
16
- type Revisions = Readonly<{
17
- readonly chromium: string;
18
- }>;
19
- export declare const PUPPETEER_REVISIONS: Revisions;
20
- export {};
@@ -1,21 +0,0 @@
1
- "use strict";
2
- /**
3
- * Copyright 2020 Google Inc. All rights reserved.
4
- *
5
- * Licensed under the Apache License, Version 2.0 (the "License");
6
- * you may not use this file except in compliance with the License.
7
- * You may obtain a copy of the License at
8
- *
9
- * http://www.apache.org/licenses/LICENSE-2.0
10
- *
11
- * Unless required by applicable law or agreed to in writing, software
12
- * distributed under the License is distributed on an "AS IS" BASIS,
13
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
- * See the License for the specific language governing permissions and
15
- * limitations under the License.
16
- */
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.PUPPETEER_REVISIONS = void 0;
19
- exports.PUPPETEER_REVISIONS = {
20
- chromium: '1002410',
21
- };