@remotion/renderer 4.0.0-alpha13 → 4.0.0-alpha16

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.
Files changed (103) hide show
  1. package/dist/assets/download-and-map-assets-to-file.d.ts +6 -4
  2. package/dist/assets/download-and-map-assets-to-file.js +30 -6
  3. package/dist/assets/download-file.d.ts +2 -2
  4. package/dist/assets/download-map.d.ts +3 -3
  5. package/dist/assets/ffmpeg-volume-expression.d.ts +2 -2
  6. package/dist/assets/get-audio-channels.d.ts +1 -0
  7. package/dist/assets/get-audio-channels.js +10 -5
  8. package/dist/assets/read-file.js +1 -1
  9. package/dist/assets/types.d.ts +4 -4
  10. package/dist/audio-codec.d.ts +2 -2
  11. package/dist/browser/Browser.d.ts +9 -9
  12. package/dist/browser/Browser.js +26 -32
  13. package/dist/browser/BrowserFetcher.d.ts +1 -1
  14. package/dist/browser/BrowserPage.d.ts +11 -2
  15. package/dist/browser/BrowserPage.js +47 -12
  16. package/dist/browser/BrowserRunner.js +19 -2
  17. package/dist/browser/ConsoleMessage.d.ts +1 -1
  18. package/dist/browser/DOMWorld.js +8 -8
  19. package/dist/browser/EvalTypes.d.ts +7 -7
  20. package/dist/browser/FrameManager.js +11 -11
  21. package/dist/browser/JSHandle.js +14 -14
  22. package/dist/browser/LaunchOptions.d.ts +1 -1
  23. package/dist/browser/Launcher.js +0 -1
  24. package/dist/browser/LifecycleWatcher.d.ts +1 -1
  25. package/dist/browser/NetworkEventManager.d.ts +4 -4
  26. package/dist/browser/NodeWebSocketTransport.js +16 -16
  27. package/dist/browser/Product.d.ts +1 -1
  28. package/dist/browser/Target.d.ts +2 -1
  29. package/dist/browser/Target.js +8 -2
  30. package/dist/browser/devtools-types.d.ts +10 -10
  31. package/dist/browser/mitt/index.d.ts +6 -6
  32. package/dist/browser/revisions.d.ts +1 -1
  33. package/dist/browser/should-log-message.d.ts +24 -0
  34. package/dist/browser/should-log-message.js +72 -0
  35. package/dist/browser-executable.d.ts +1 -1
  36. package/dist/browser-log.d.ts +1 -1
  37. package/dist/browser.d.ts +1 -1
  38. package/dist/chalk/index.d.ts +4 -4
  39. package/dist/codec-supports-media.d.ts +1 -1
  40. package/dist/codec.d.ts +2 -2
  41. package/dist/combine-videos.d.ts +1 -1
  42. package/dist/compositor/compose.d.ts +11 -2
  43. package/dist/compositor/compose.js +15 -4
  44. package/dist/compositor/compositor.d.ts +1 -1
  45. package/dist/compositor/compositor.js +19 -7
  46. package/dist/compositor/payloads.d.ts +5 -5
  47. package/dist/crf.d.ts +1 -1
  48. package/dist/error-handling/symbolicate-error.js +4 -2
  49. package/dist/ffmpeg-override.d.ts +1 -1
  50. package/dist/file-extensions.d.ts +1 -1
  51. package/dist/frame-range.d.ts +1 -1
  52. package/dist/get-browser-instance.d.ts +6 -1
  53. package/dist/get-browser-instance.js +9 -4
  54. package/dist/get-compositions.d.ts +18 -11
  55. package/dist/get-compositions.js +66 -49
  56. package/dist/get-frame-padded-index.d.ts +1 -1
  57. package/dist/image-format.d.ts +3 -3
  58. package/dist/index.d.ts +106 -16
  59. package/dist/index.js +25 -13
  60. package/dist/jpeg-quality.d.ts +1 -0
  61. package/dist/jpeg-quality.js +2 -1
  62. package/dist/log-level.d.ts +1 -1
  63. package/dist/logger.d.ts +5 -3
  64. package/dist/logger.js +12 -5
  65. package/dist/make-cancel-signal.d.ts +2 -2
  66. package/dist/merge-audio-track.d.ts +1 -1
  67. package/dist/mime-types.js +1 -1
  68. package/dist/offthread-video-server.d.ts +36 -4
  69. package/dist/offthread-video-server.js +48 -4
  70. package/dist/open-browser.d.ts +19 -10
  71. package/dist/open-browser.js +34 -21
  72. package/dist/options/option.d.ts +1 -1
  73. package/dist/parse-browser-error-stack.d.ts +1 -1
  74. package/dist/perf.d.ts +1 -1
  75. package/dist/pixel-format.d.ts +1 -1
  76. package/dist/prepare-server.d.ts +20 -8
  77. package/dist/prepare-server.js +52 -8
  78. package/dist/preprocess-audio-track.d.ts +2 -2
  79. package/dist/prespawn-ffmpeg.d.ts +1 -1
  80. package/dist/prespawn-ffmpeg.js +7 -7
  81. package/dist/prores-profile.d.ts +1 -1
  82. package/dist/puppeteer-screenshot.js +1 -2
  83. package/dist/render-frames.d.ts +32 -11
  84. package/dist/render-frames.js +112 -77
  85. package/dist/render-media.d.ts +50 -21
  86. package/dist/render-media.js +249 -197
  87. package/dist/render-still.d.ts +33 -18
  88. package/dist/render-still.js +71 -43
  89. package/dist/replace-browser.d.ts +1 -1
  90. package/dist/select-composition.d.ts +19 -11
  91. package/dist/select-composition.js +79 -42
  92. package/dist/serve-static.d.ts +2 -3
  93. package/dist/serve-static.js +2 -4
  94. package/dist/set-props-and-env.d.ts +1 -1
  95. package/dist/stitch-frames-to-video.d.ts +32 -10
  96. package/dist/stitch-frames-to-video.js +121 -99
  97. package/dist/stringify-ffmpeg-filter.d.ts +2 -2
  98. package/dist/symbolicate-stacktrace.d.ts +16 -3
  99. package/dist/symbolicate-stacktrace.js +49 -24
  100. package/dist/truthy.d.ts +1 -1
  101. package/dist/types.d.ts +2 -2
  102. package/dist/validate-opengl-renderer.d.ts +1 -1
  103. package/package.json +11 -11
@@ -14,17 +14,17 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
18
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
19
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
20
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
21
+ };
17
22
  var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
18
23
  if (kind === "m") throw new TypeError("Private method is not writable");
19
24
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
20
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");
21
26
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
22
27
  };
23
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
24
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
25
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
26
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
27
- };
28
28
  var _DOMWorld_frame, _DOMWorld_timeoutSettings, _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;
@@ -32,6 +32,9 @@ const assert_1 = require("./assert");
32
32
  const Errors_1 = require("./Errors");
33
33
  const util_1 = require("./util");
34
34
  class DOMWorld {
35
+ get _waitTasks() {
36
+ return __classPrivateFieldGet(this, _DOMWorld_waitTasks, "f");
37
+ }
35
38
  constructor(frame, timeoutSettings) {
36
39
  _DOMWorld_frame.set(this, void 0);
37
40
  _DOMWorld_timeoutSettings.set(this, void 0);
@@ -45,9 +48,6 @@ class DOMWorld {
45
48
  __classPrivateFieldSet(this, _DOMWorld_timeoutSettings, timeoutSettings, "f");
46
49
  this._setContext(null);
47
50
  }
48
- get _waitTasks() {
49
- return __classPrivateFieldGet(this, _DOMWorld_waitTasks, "f");
50
- }
51
51
  frame() {
52
52
  return __classPrivateFieldGet(this, _DOMWorld_frame, "f");
53
53
  }
@@ -14,14 +14,14 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  import type { JSHandle } from './JSHandle';
17
- export declare type EvaluateFn<T = any, U = any, V = any> = string | ((arg1: T, ...args: U[]) => V);
18
- export declare type UnwrapPromiseLike<T> = T extends PromiseLike<infer U> ? U : T;
19
- export declare type EvaluateFnReturnType<T extends EvaluateFn> = T extends (...args: any[]) => infer R ? R : any;
20
- export declare type EvaluateHandleFn = string | ((...args: any[]) => any);
21
- declare type Serializable = number | string | boolean | null | bigint | JSONArray | JSONObject;
22
- declare type JSONArray = readonly Serializable[];
17
+ export type EvaluateFn<T = any, U = any, V = any> = string | ((arg1: T, ...args: U[]) => V);
18
+ export type UnwrapPromiseLike<T> = T extends PromiseLike<infer U> ? U : T;
19
+ export type EvaluateFnReturnType<T extends EvaluateFn> = T extends (...args: any[]) => infer R ? R : any;
20
+ export type EvaluateHandleFn = string | ((...args: any[]) => any);
21
+ type Serializable = number | string | boolean | null | bigint | JSONArray | JSONObject;
22
+ type JSONArray = readonly Serializable[];
23
23
  interface JSONObject {
24
24
  [key: string]: Serializable;
25
25
  }
26
- export declare type SerializableOrJSHandle = Serializable | JSHandle;
26
+ export type SerializableOrJSHandle = Serializable | JSHandle;
27
27
  export {};
@@ -14,17 +14,17 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
18
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
19
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
20
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
21
+ };
17
22
  var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
18
23
  if (kind === "m") throw new TypeError("Private method is not writable");
19
24
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
20
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");
21
26
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
22
27
  };
23
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
24
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
25
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
26
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
27
- };
28
28
  var _FrameManager_instances, _FrameManager_page, _FrameManager_networkManager, _FrameManager_timeoutSettings, _FrameManager_frames, _FrameManager_contextIdToContext, _FrameManager_isolatedWorlds, _FrameManager_mainFrame, _FrameManager_client, _FrameManager_onAttachedToTarget, _FrameManager_onDetachedFromTarget, _FrameManager_onLifecycleEvent, _FrameManager_onFrameStartedLoading, _FrameManager_onFrameStoppedLoading, _FrameManager_handleFrameTree, _FrameManager_onFrameAttached, _FrameManager_onFrameNavigated, _FrameManager_onFrameNavigatedWithinDocument, _FrameManager_onFrameDetached, _FrameManager_onExecutionContextCreated, _FrameManager_onExecutionContextDestroyed, _FrameManager_onExecutionContextsCleared, _FrameManager_removeFramesRecursively, _Frame_parentFrame, _Frame_url, _Frame_client;
29
29
  Object.defineProperty(exports, "__esModule", { value: true });
30
30
  exports.Frame = exports.FrameManager = exports.FrameManagerEmittedEvents = void 0;
@@ -48,6 +48,12 @@ exports.FrameManagerEmittedEvents = {
48
48
  ExecutionContextDestroyed: Symbol('FrameManager.ExecutionContextDestroyed'),
49
49
  };
50
50
  class FrameManager extends EventEmitter_1.EventEmitter {
51
+ get _timeoutSettings() {
52
+ return __classPrivateFieldGet(this, _FrameManager_timeoutSettings, "f");
53
+ }
54
+ get _client() {
55
+ return __classPrivateFieldGet(this, _FrameManager_client, "f");
56
+ }
51
57
  constructor(client, page, timeoutSettings) {
52
58
  super();
53
59
  _FrameManager_instances.add(this);
@@ -65,12 +71,6 @@ class FrameManager extends EventEmitter_1.EventEmitter {
65
71
  __classPrivateFieldSet(this, _FrameManager_timeoutSettings, timeoutSettings, "f");
66
72
  this.setupEventListeners(__classPrivateFieldGet(this, _FrameManager_client, "f"));
67
73
  }
68
- get _timeoutSettings() {
69
- return __classPrivateFieldGet(this, _FrameManager_timeoutSettings, "f");
70
- }
71
- get _client() {
72
- return __classPrivateFieldGet(this, _FrameManager_client, "f");
73
- }
74
74
  setupEventListeners(session) {
75
75
  session.on('Page.frameAttached', (event) => {
76
76
  __classPrivateFieldGet(this, _FrameManager_instances, "m", _FrameManager_onFrameAttached).call(this, session, event.frameId, event.parentFrameId);
@@ -14,17 +14,17 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
+ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
18
+ if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
19
+ if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
20
+ return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
21
+ };
17
22
  var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
18
23
  if (kind === "m") throw new TypeError("Private method is not writable");
19
24
  if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
20
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");
21
26
  return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
22
27
  };
23
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
24
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
25
- if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
26
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
27
- };
28
28
  var _JSHandle_client, _JSHandle_disposed, _JSHandle_context, _JSHandle_remoteObject;
29
29
  Object.defineProperty(exports, "__esModule", { value: true });
30
30
  exports.ElementHandle = exports.JSHandle = exports._createJSHandle = void 0;
@@ -38,15 +38,6 @@ function _createJSHandle(context, remoteObject) {
38
38
  }
39
39
  exports._createJSHandle = _createJSHandle;
40
40
  class JSHandle {
41
- constructor(context, client, remoteObject) {
42
- _JSHandle_client.set(this, void 0);
43
- _JSHandle_disposed.set(this, false);
44
- _JSHandle_context.set(this, void 0);
45
- _JSHandle_remoteObject.set(this, void 0);
46
- __classPrivateFieldSet(this, _JSHandle_context, context, "f");
47
- __classPrivateFieldSet(this, _JSHandle_client, client, "f");
48
- __classPrivateFieldSet(this, _JSHandle_remoteObject, remoteObject, "f");
49
- }
50
41
  get _disposed() {
51
42
  return __classPrivateFieldGet(this, _JSHandle_disposed, "f");
52
43
  }
@@ -56,6 +47,15 @@ class JSHandle {
56
47
  get _context() {
57
48
  return __classPrivateFieldGet(this, _JSHandle_context, "f");
58
49
  }
50
+ constructor(context, client, remoteObject) {
51
+ _JSHandle_client.set(this, void 0);
52
+ _JSHandle_disposed.set(this, false);
53
+ _JSHandle_context.set(this, void 0);
54
+ _JSHandle_remoteObject.set(this, void 0);
55
+ __classPrivateFieldSet(this, _JSHandle_context, context, "f");
56
+ __classPrivateFieldSet(this, _JSHandle_client, client, "f");
57
+ __classPrivateFieldSet(this, _JSHandle_remoteObject, remoteObject, "f");
58
+ }
59
59
  executionContext() {
60
60
  return __classPrivateFieldGet(this, _JSHandle_context, "f");
61
61
  }
@@ -30,4 +30,4 @@ export interface LaunchOptions {
30
30
  product?: Product;
31
31
  indent: boolean;
32
32
  }
33
- export declare type PuppeteerNodeLaunchOptions = BrowserLaunchArgumentOptions & LaunchOptions & BrowserConnectOptions;
33
+ export type PuppeteerNodeLaunchOptions = BrowserLaunchArgumentOptions & LaunchOptions & BrowserConnectOptions;
@@ -93,7 +93,6 @@ class ChromeLauncher {
93
93
  });
94
94
  browser = await Browser_1.HeadlessBrowser._create({
95
95
  connection,
96
- contextIds: [],
97
96
  defaultViewport,
98
97
  closeCallback: runner.close.bind(runner),
99
98
  });
@@ -16,7 +16,7 @@
16
16
  import { TimeoutError } from './Errors';
17
17
  import type { Frame, FrameManager } from './FrameManager';
18
18
  import type { HTTPResponse } from './HTTPResponse';
19
- export declare type PuppeteerLifeCycleEvent = 'load';
19
+ export type PuppeteerLifeCycleEvent = 'load';
20
20
  export declare class LifecycleWatcher {
21
21
  #private;
22
22
  constructor(frameManager: FrameManager, frame: Frame, waitUntil: PuppeteerLifeCycleEvent, timeout: number);
@@ -1,13 +1,13 @@
1
1
  import type { LoadingFailedEvent, LoadingFinishedEvent, RequestPausedEvent, RequestWillBeSentEvent, ResponseReceivedEvent, ResponseReceivedExtraInfoEvent } from './devtools-types';
2
2
  import type { HTTPRequest } from './HTTPRequest';
3
- declare type QueuedEventGroup = {
3
+ type QueuedEventGroup = {
4
4
  responseReceivedEvent: ResponseReceivedEvent;
5
5
  loadingFinishedEvent?: LoadingFinishedEvent;
6
6
  loadingFailedEvent?: LoadingFailedEvent;
7
7
  };
8
- export declare type FetchRequestId = string;
9
- declare type NetworkRequestId = string;
10
- declare type RedirectInfo = {
8
+ export type FetchRequestId = string;
9
+ type NetworkRequestId = string;
10
+ type RedirectInfo = {
11
11
  event: RequestWillBeSentEvent;
12
12
  fetchRequestId?: FetchRequestId;
13
13
  };
@@ -32,22 +32,6 @@ const node_dns_1 = require("node:dns");
32
32
  const node_url_1 = require("node:url");
33
33
  const ws_types_1 = require("../ws/ws-types");
34
34
  class NodeWebSocketTransport {
35
- constructor(ws) {
36
- _NodeWebSocketTransport_ws.set(this, void 0);
37
- __classPrivateFieldSet(this, _NodeWebSocketTransport_ws, ws, "f");
38
- __classPrivateFieldGet(this, _NodeWebSocketTransport_ws, "f").addEventListener('message', (event) => {
39
- if (this.onmessage) {
40
- this.onmessage.call(null, event.data);
41
- }
42
- });
43
- __classPrivateFieldGet(this, _NodeWebSocketTransport_ws, "f").addEventListener('close', () => {
44
- if (this.onclose) {
45
- this.onclose.call(null);
46
- }
47
- });
48
- // Silently ignore all errors - we don't know what to do with them.
49
- __classPrivateFieldGet(this, _NodeWebSocketTransport_ws, "f").addEventListener('error', () => undefined);
50
- }
51
35
  static async create(urlString) {
52
36
  // Starting in Node 17, IPv6 is favoured over IPv4 due to a change
53
37
  // in a default option:
@@ -76,6 +60,22 @@ class NodeWebSocketTransport {
76
60
  ws.addEventListener('error', reject);
77
61
  });
78
62
  }
63
+ constructor(ws) {
64
+ _NodeWebSocketTransport_ws.set(this, void 0);
65
+ __classPrivateFieldSet(this, _NodeWebSocketTransport_ws, ws, "f");
66
+ __classPrivateFieldGet(this, _NodeWebSocketTransport_ws, "f").addEventListener('message', (event) => {
67
+ if (this.onmessage) {
68
+ this.onmessage.call(null, event.data);
69
+ }
70
+ });
71
+ __classPrivateFieldGet(this, _NodeWebSocketTransport_ws, "f").addEventListener('close', () => {
72
+ if (this.onclose) {
73
+ this.onclose.call(null);
74
+ }
75
+ });
76
+ // Silently ignore all errors - we don't know what to do with them.
77
+ __classPrivateFieldGet(this, _NodeWebSocketTransport_ws, "f").addEventListener('error', () => undefined);
78
+ }
79
79
  send(message) {
80
80
  __classPrivateFieldGet(this, _NodeWebSocketTransport_ws, "f").send(message);
81
81
  }
@@ -13,4 +13,4 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- export declare type Product = 'chrome' | 'firefox';
16
+ export type Product = 'chrome' | 'firefox';
@@ -13,6 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
+ import type { AnySourceMapConsumer } from '../symbolicate-stacktrace';
16
17
  import type { BrowserContext, HeadlessBrowser } from './Browser';
17
18
  import { Page } from './BrowserPage';
18
19
  import type { CDPSession } from './Connection';
@@ -35,7 +36,7 @@ export declare class Target {
35
36
  /**
36
37
  * If the target is not of type `"page"` or `"background_page"`, returns `null`.
37
38
  */
38
- page(): Promise<Page | null>;
39
+ page(sourcemapContext: AnySourceMapConsumer | null): Promise<Page | null>;
39
40
  url(): string;
40
41
  /**
41
42
  * Identifies what kind of target this is.
@@ -79,12 +79,18 @@ class Target {
79
79
  /**
80
80
  * If the target is not of type `"page"` or `"background_page"`, returns `null`.
81
81
  */
82
- async page() {
82
+ async page(sourcemapContext) {
83
83
  var _a;
84
84
  if (isPagetTarget(__classPrivateFieldGet(this, _Target_targetInfo, "f")) && !__classPrivateFieldGet(this, _Target_pagePromise, "f")) {
85
85
  __classPrivateFieldSet(this, _Target_pagePromise, __classPrivateFieldGet(this, _Target_sessionFactory, "f").call(this).then((client) => {
86
86
  var _a;
87
- return BrowserPage_1.Page._create(client, this, (_a = __classPrivateFieldGet(this, _Target_defaultViewport, "f")) !== null && _a !== void 0 ? _a : null, this.browser());
87
+ return BrowserPage_1.Page._create({
88
+ client,
89
+ target: this,
90
+ defaultViewport: (_a = __classPrivateFieldGet(this, _Target_defaultViewport, "f")) !== null && _a !== void 0 ? _a : null,
91
+ browser: this.browser(),
92
+ sourcemapContext,
93
+ });
88
94
  }), "f");
89
95
  }
90
96
  return (_a = (await __classPrivateFieldGet(this, _Target_pagePromise, "f"))) !== null && _a !== void 0 ? _a : null;
@@ -1,4 +1,4 @@
1
- declare type RemoteObjectId = string;
1
+ type RemoteObjectId = string;
2
2
  interface WebDriverValue {
3
3
  /**
4
4
  * (WebDriverValueType enum)
@@ -7,7 +7,7 @@ interface WebDriverValue {
7
7
  value?: any;
8
8
  objectId?: string;
9
9
  }
10
- declare type UnserializableValue = string;
10
+ type UnserializableValue = string;
11
11
  export interface DevtoolsRemoteObject {
12
12
  /**
13
13
  * Object type. (RemoteObjectType enum)
@@ -45,7 +45,7 @@ export interface DevtoolsRemoteObject {
45
45
  */
46
46
  objectId?: RemoteObjectId;
47
47
  }
48
- declare type TargetID = string;
48
+ type TargetID = string;
49
49
  export interface TargetInfo {
50
50
  targetId: TargetID;
51
51
  type: string;
@@ -264,7 +264,7 @@ export interface CallFunctionOnResponse {
264
264
  */
265
265
  exceptionDetails?: ExceptionDetails;
266
266
  }
267
- declare type ExecutionContextId = number;
267
+ type ExecutionContextId = number;
268
268
  export interface EvaluateResponse {
269
269
  /**
270
270
  * Evaluation result.
@@ -291,8 +291,8 @@ export interface FrameTree {
291
291
  */
292
292
  childFrames?: FrameTree[];
293
293
  }
294
- declare type FrameId = string;
295
- declare type LoaderId = string;
294
+ type FrameId = string;
295
+ type LoaderId = string;
296
296
  export interface Frame {
297
297
  /**
298
298
  * Frame unique identifier.
@@ -419,7 +419,7 @@ export interface AttachedToTargetEvent {
419
419
  targetInfo: TargetInfo;
420
420
  waitingForDebugger: boolean;
421
421
  }
422
- declare type SessionID = string;
422
+ type SessionID = string;
423
423
  export interface DetachedFromTargetEvent {
424
424
  /**
425
425
  * Detached session identifier.
@@ -462,7 +462,7 @@ export interface AddScriptToEvaluateOnNewDocumentResponse {
462
462
  */
463
463
  identifier: ScriptIdentifier;
464
464
  }
465
- declare type ScriptIdentifier = string;
465
+ type ScriptIdentifier = string;
466
466
  export interface CreateIsolatedWorldRequest {
467
467
  /**
468
468
  * Id of the frame in which the isolated world should be created.
@@ -695,8 +695,8 @@ interface Initiator {
695
695
  */
696
696
  requestId?: RequestId;
697
697
  }
698
- declare type ResourceType = 'Document' | 'Stylesheet' | 'Image' | 'Media' | 'Font' | 'Script' | 'TextTrack' | 'XHR' | 'Fetch' | 'EventSource' | 'WebSocket' | 'Manifest' | 'SignedExchange' | 'Ping' | 'CSPViolationReport' | 'Preflight' | 'Other';
699
- declare type RequestId = string;
698
+ type ResourceType = 'Document' | 'Stylesheet' | 'Image' | 'Media' | 'Font' | 'Script' | 'TextTrack' | 'XHR' | 'Fetch' | 'EventSource' | 'WebSocket' | 'Manifest' | 'SignedExchange' | 'Ping' | 'CSPViolationReport' | 'Preflight' | 'Other';
699
+ type RequestId = string;
700
700
  export interface ActivateTargetRequest {
701
701
  targetId: TargetID;
702
702
  }
@@ -1,9 +1,9 @@
1
- export declare type EventType = string | symbol;
2
- export declare type Handler<T = any> = (event?: T) => void;
3
- declare type WildcardHandler = (type: EventType, event?: any) => void;
4
- declare type EventHandlerList = Array<Handler>;
5
- declare type WildCardEventHandlerList = Array<WildcardHandler>;
6
- declare type EventHandlerMap = Map<EventType, EventHandlerList | WildCardEventHandlerList>;
1
+ export type EventType = string | symbol;
2
+ export type Handler<T = any> = (event?: T) => void;
3
+ type WildcardHandler = (type: EventType, event?: any) => void;
4
+ type EventHandlerList = Array<Handler>;
5
+ type WildCardEventHandlerList = Array<WildcardHandler>;
6
+ type EventHandlerMap = Map<EventType, EventHandlerList | WildCardEventHandlerList>;
7
7
  export interface Emitter {
8
8
  all: EventHandlerMap;
9
9
  on<T = any>(type: EventType, handler: Handler<T>): void;
@@ -13,7 +13,7 @@
13
13
  * See the License for the specific language governing permissions and
14
14
  * limitations under the License.
15
15
  */
16
- declare type Revisions = Readonly<{
16
+ type Revisions = Readonly<{
17
17
  readonly chromium: string;
18
18
  }>;
19
19
  export declare const PUPPETEER_REVISIONS: Revisions;
@@ -0,0 +1,24 @@
1
+ export declare const shouldLogBrowserMessage: (message: string) => boolean;
2
+ type ParsedBrowserLogMessage = {
3
+ day: number;
4
+ month: number;
5
+ hour: number;
6
+ minute: number;
7
+ seconds: number;
8
+ microseconds: number;
9
+ level: string;
10
+ location: string;
11
+ lineNumber: number;
12
+ message: string;
13
+ };
14
+ export declare const parseBrowserLogMessage: (input: string) => ParsedBrowserLogMessage | null;
15
+ export declare const formatChromeMessage: (input: string) => {
16
+ output: string;
17
+ tag: string;
18
+ } | null;
19
+ type ChromeLogLocation = {
20
+ location: string;
21
+ lineNumber: number;
22
+ };
23
+ export declare const parseChromeLogLocation: (message: string) => ChromeLogLocation | null;
24
+ export {};
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.parseChromeLogLocation = exports.formatChromeMessage = exports.parseBrowserLogMessage = exports.shouldLogBrowserMessage = void 0;
4
+ const shouldLogBrowserMessage = (message) => {
5
+ // Not relevant for the user
6
+ if (message.startsWith('DevTools listening on')) {
7
+ return false;
8
+ }
9
+ // Noisy but harmless warning
10
+ if (message.includes('Failed to send GpuControl.CreateCommandBuffer')) {
11
+ return false;
12
+ }
13
+ return true;
14
+ };
15
+ exports.shouldLogBrowserMessage = shouldLogBrowserMessage;
16
+ const parseBrowserLogMessage = (input) => {
17
+ const format = /^\[([0-9]{4})\/([0-9]{6})\.([0-9]{6}):([A-Z]+):(.*)\(([0-9]+)\)\](.*)/;
18
+ const match = input.match(format);
19
+ if (!match) {
20
+ return null;
21
+ }
22
+ const date = match[1];
23
+ const day = parseInt(date.slice(0, 2), 10);
24
+ const month = parseInt(date.slice(2, 4), 10);
25
+ const time = match[2];
26
+ const hour = parseInt(time.slice(0, 2), 10);
27
+ const minute = parseInt(time.slice(2, 4), 10);
28
+ const seconds = parseInt(time.slice(4, 6), 10);
29
+ const microseconds = parseInt(match[3], 10);
30
+ const level = match[4];
31
+ const location = match[5];
32
+ const lineNumber = parseInt(match[6], 10);
33
+ const message = match[7].trim();
34
+ return {
35
+ day,
36
+ month,
37
+ hour,
38
+ minute,
39
+ seconds,
40
+ microseconds,
41
+ level,
42
+ location,
43
+ lineNumber,
44
+ message,
45
+ };
46
+ };
47
+ exports.parseBrowserLogMessage = parseBrowserLogMessage;
48
+ const formatChromeMessage = (input) => {
49
+ const parsed = (0, exports.parseBrowserLogMessage)(input);
50
+ if (!parsed) {
51
+ return { output: input, tag: 'chrome' };
52
+ }
53
+ const { location, lineNumber, message } = parsed;
54
+ // Don't print console.log's, these are handled through the WebSocket
55
+ if (location === 'CONSOLE') {
56
+ return null;
57
+ }
58
+ return { output: `${location}:${lineNumber}: ${message}`, tag: 'chrome' };
59
+ };
60
+ exports.formatChromeMessage = formatChromeMessage;
61
+ const parseChromeLogLocation = (message) => {
62
+ const regex = /(.*), source: (.*) \(([0-9]+)\)/;
63
+ const match = message.match(regex);
64
+ if (!match) {
65
+ return null;
66
+ }
67
+ return {
68
+ lineNumber: parseInt(match[3], 10),
69
+ location: match[2],
70
+ };
71
+ };
72
+ exports.parseChromeLogLocation = parseChromeLogLocation;
@@ -1 +1 @@
1
- export declare type BrowserExecutable = string | null;
1
+ export type BrowserExecutable = string | null;
@@ -1,5 +1,5 @@
1
1
  import type { ConsoleMessageLocation, ConsoleMessageType } from './browser/ConsoleMessage';
2
- export declare type BrowserLog = {
2
+ export type BrowserLog = {
3
3
  text: string;
4
4
  stackTrace: ConsoleMessageLocation[];
5
5
  type: ConsoleMessageType;
package/dist/browser.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare type Browser = 'chrome' | 'firefox';
1
+ export type Browser = 'chrome' | 'firefox';
2
2
  export declare const DEFAULT_BROWSER: Browser;
@@ -1,17 +1,17 @@
1
- declare type Style = {
1
+ type Style = {
2
2
  codes: [number, number];
3
3
  name: string;
4
4
  wrap?: (input: string, newline: boolean) => string;
5
5
  };
6
- declare type Method = (str: string) => string;
7
- declare type Colors = {
6
+ type Method = (str: string) => string;
7
+ type Colors = {
8
8
  enabled: boolean;
9
9
  visible: boolean;
10
10
  styles: Record<string, Style>;
11
11
  keys: Record<string, string[]>;
12
12
  alias?: (name: string, col: string) => void;
13
13
  };
14
- declare type ColorsWithMethods = Colors & {
14
+ type ColorsWithMethods = Colors & {
15
15
  reset: Method;
16
16
  bold: Method;
17
17
  dim: Method;
@@ -1,5 +1,5 @@
1
1
  import type { Codec } from './codec';
2
- declare type MediaSupport = {
2
+ type MediaSupport = {
3
3
  video: boolean;
4
4
  audio: boolean;
5
5
  };
package/dist/codec.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export declare const validCodecs: readonly ["h264", "h265", "vp8", "vp9", "mp3", "aac", "wav", "prores", "h264-mkv", "gif"];
2
- export declare type Codec = typeof validCodecs[number];
3
- export declare type CodecOrUndefined = Codec | undefined;
2
+ export type Codec = typeof validCodecs[number];
3
+ export type CodecOrUndefined = Codec | undefined;
4
4
  export declare const DEFAULT_CODEC: Codec;
@@ -1,6 +1,6 @@
1
1
  import type { AudioCodec } from './audio-codec';
2
2
  import type { Codec } from './codec';
3
- declare type Options = {
3
+ type Options = {
4
4
  files: string[];
5
5
  filelistDir: string;
6
6
  output: string;
@@ -1,17 +1,26 @@
1
1
  import type { DownloadMap } from '../assets/download-map';
2
2
  import type { Compositor } from './compositor';
3
3
  import type { CompositorCommand, CompositorCommandSerialized, CompositorImageFormat, Layer } from './payloads';
4
- declare type CompositorInput = {
4
+ type CompositorInput = {
5
5
  height: number;
6
6
  width: number;
7
7
  layers: Layer[];
8
8
  imageFormat: CompositorImageFormat;
9
9
  };
10
+ type ComposeInput = CompositorInput & {
11
+ output: string;
12
+ compositor: Compositor;
13
+ };
10
14
  export declare const serializeCommand: <Type extends keyof CompositorCommand>(command: Type, params: CompositorCommand[Type]) => CompositorCommandSerialized<Type>;
15
+ export declare const composeWithoutCache: ({ height, width, layers, output, imageFormat, compositor, }: CompositorInput & {
16
+ output: string;
17
+ compositor: Compositor;
18
+ }) => Promise<void>;
11
19
  export declare const compose: ({ height, width, layers, output, downloadMap, imageFormat, compositor, }: CompositorInput & {
12
- downloadMap: DownloadMap;
13
20
  output: string;
14
21
  compositor: Compositor;
22
+ } & {
23
+ downloadMap: DownloadMap;
15
24
  }) => Promise<void>;
16
25
  export declare const callCompositor: (payload: string) => Promise<void>;
17
26
  export {};
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.callCompositor = exports.compose = exports.serializeCommand = void 0;
3
+ exports.callCompositor = exports.compose = exports.composeWithoutCache = exports.serializeCommand = void 0;
4
4
  const node_child_process_1 = require("node:child_process");
5
5
  const node_crypto_1 = require("node:crypto");
6
6
  const node_fs_1 = require("node:fs");
@@ -21,18 +21,29 @@ const serializeCommand = (command, params) => {
21
21
  };
22
22
  };
23
23
  exports.serializeCommand = serializeCommand;
24
+ const composeWithoutCache = async ({ height, width, layers, output, imageFormat, compositor, }) => {
25
+ await compositor.executeCommand('Compose', {
26
+ height,
27
+ width,
28
+ layers,
29
+ output,
30
+ output_format: imageFormat,
31
+ });
32
+ };
33
+ exports.composeWithoutCache = composeWithoutCache;
24
34
  const compose = async ({ height, width, layers, output, downloadMap, imageFormat, compositor, }) => {
25
35
  const hash = getCompositorHash({ height, width, layers, imageFormat });
26
36
  if (downloadMap.compositorCache[hash]) {
27
37
  await (0, promises_1.copyFile)(downloadMap.compositorCache[hash], output);
28
38
  return;
29
39
  }
30
- await compositor.executeCommand('Compose', {
40
+ await (0, exports.composeWithoutCache)({
41
+ compositor,
31
42
  height,
32
- width,
43
+ imageFormat,
33
44
  layers,
34
45
  output,
35
- output_format: imageFormat,
46
+ width,
36
47
  });
37
48
  downloadMap.compositorCache[hash] = output;
38
49
  };