@remotion/renderer 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.
Files changed (96) hide show
  1. package/dist/assets/download-and-map-assets-to-file.d.ts +2 -4
  2. package/dist/assets/download-and-map-assets-to-file.js +14 -10
  3. package/dist/assets/download-map.d.ts +4 -0
  4. package/dist/assets/download-map.js +3 -0
  5. package/dist/audio-codec.d.ts +1 -1
  6. package/dist/browser/Browser.d.ts +7 -6
  7. package/dist/browser/Browser.js +13 -13
  8. package/dist/browser/BrowserPage.d.ts +21 -6
  9. package/dist/browser/BrowserPage.js +80 -19
  10. package/dist/browser/BrowserRunner.d.ts +0 -1
  11. package/dist/browser/BrowserRunner.js +6 -6
  12. package/dist/browser/Connection.d.ts +9 -3
  13. package/dist/browser/Connection.js +11 -3
  14. package/dist/browser/ConsoleMessage.d.ts +8 -1
  15. package/dist/browser/ConsoleMessage.js +2 -1
  16. package/dist/browser/DOMWorld.d.ts +10 -4
  17. package/dist/browser/DOMWorld.js +16 -15
  18. package/dist/browser/ExecutionContext.js +4 -4
  19. package/dist/browser/FrameManager.d.ts +3 -6
  20. package/dist/browser/FrameManager.js +11 -16
  21. package/dist/browser/LaunchOptions.d.ts +2 -0
  22. package/dist/browser/Launcher.js +3 -3
  23. package/dist/browser/NetworkManager.d.ts +4 -1
  24. package/dist/browser/Target.d.ts +2 -1
  25. package/dist/browser/Target.js +3 -1
  26. package/dist/browser/create-browser-fetcher.js +19 -24
  27. package/dist/browser/devtools-types.d.ts +59 -0
  28. package/dist/browser/should-log-message.js +14 -0
  29. package/dist/chalk/index.d.ts +2 -1
  30. package/dist/chalk/index.js +3 -8
  31. package/dist/chalk/is-color-supported.d.ts +1 -1
  32. package/dist/chalk/is-color-supported.js +18 -10
  33. package/dist/client.d.ts +26 -31
  34. package/dist/compositor/compose.js +6 -1
  35. package/dist/compositor/compositor.d.ts +3 -2
  36. package/dist/compositor/compositor.js +10 -10
  37. package/dist/compositor/payloads.d.ts +15 -1
  38. package/dist/create-ffmpeg-merge-filter.js +1 -2
  39. package/dist/cycle-browser-tabs.d.ts +2 -1
  40. package/dist/cycle-browser-tabs.js +2 -2
  41. package/dist/format-logs.d.ts +3 -0
  42. package/dist/format-logs.js +207 -0
  43. package/dist/get-browser-instance.d.ts +3 -2
  44. package/dist/get-browser-instance.js +5 -5
  45. package/dist/get-bundle-url-from-serve-url.d.ts +2 -0
  46. package/dist/get-bundle-url-from-serve-url.js +30 -0
  47. package/dist/get-compositions.d.ts +7 -6
  48. package/dist/get-compositions.js +21 -11
  49. package/dist/get-extension-from-codec.d.ts +2 -2
  50. package/dist/get-local-browser-executable.js +15 -0
  51. package/dist/get-video-metadata.d.ts +2 -0
  52. package/dist/get-video-metadata.js +14 -0
  53. package/dist/index.d.ts +64 -61
  54. package/dist/index.js +3 -1
  55. package/dist/logger.d.ts +2 -2
  56. package/dist/logger.js +23 -18
  57. package/dist/offthread-video-server.d.ts +3 -3
  58. package/dist/offthread-video-server.js +65 -29
  59. package/dist/open-browser.d.ts +3 -2
  60. package/dist/open-browser.js +7 -5
  61. package/dist/options/crf.js +1 -1
  62. package/dist/options/video-codec.js +1 -1
  63. package/dist/perf.js +4 -2
  64. package/dist/prepare-server.d.ts +4 -5
  65. package/dist/prepare-server.js +16 -14
  66. package/dist/prespawn-ffmpeg.d.ts +2 -1
  67. package/dist/prespawn-ffmpeg.js +3 -31
  68. package/dist/puppeteer-evaluate.d.ts +4 -1
  69. package/dist/puppeteer-evaluate.js +5 -5
  70. package/dist/render-frames.d.ts +16 -8
  71. package/dist/render-frames.js +50 -22
  72. package/dist/render-media.d.ts +17 -9
  73. package/dist/render-media.js +41 -26
  74. package/dist/render-still.d.ts +13 -6
  75. package/dist/render-still.js +32 -17
  76. package/dist/replace-browser.d.ts +2 -1
  77. package/dist/replace-browser.js +2 -2
  78. package/dist/screenshot-task.js +4 -2
  79. package/dist/seek-to-frame.d.ts +8 -2
  80. package/dist/seek-to-frame.js +87 -25
  81. package/dist/select-composition.d.ts +10 -5
  82. package/dist/select-composition.js +39 -18
  83. package/dist/serialize-props.d.ts +6 -0
  84. package/dist/serialize-props.js +36 -0
  85. package/dist/serve-handler/index.js +1 -1
  86. package/dist/serve-static.d.ts +2 -3
  87. package/dist/serve-static.js +10 -4
  88. package/dist/set-props-and-env.d.ts +4 -1
  89. package/dist/set-props-and-env.js +52 -22
  90. package/dist/stitch-frames-to-video.d.ts +2 -1
  91. package/dist/stitch-frames-to-video.js +12 -22
  92. package/dist/symbolicate-stacktrace.d.ts +3 -2
  93. package/dist/symbolicate-stacktrace.js +14 -7
  94. package/dist/take-frame-and-compose.js +1 -1
  95. package/dist/validate-output-filename.d.ts +1 -1
  96. package/package.json +10 -10
@@ -29,11 +29,12 @@ var _ConsoleMessage_stackTraceLocations;
29
29
  Object.defineProperty(exports, "__esModule", { value: true });
30
30
  exports.ConsoleMessage = void 0;
31
31
  class ConsoleMessage {
32
- constructor(type, text, args, stackTraceLocations) {
32
+ constructor({ type, text, args, stackTraceLocations, previewString, }) {
33
33
  _ConsoleMessage_stackTraceLocations.set(this, void 0);
34
34
  this.type = type;
35
35
  this.text = text;
36
36
  this.args = args;
37
+ this.previewString = previewString;
37
38
  __classPrivateFieldSet(this, _ConsoleMessage_stackTraceLocations, stackTraceLocations, "f");
38
39
  }
39
40
  location() {
@@ -18,11 +18,10 @@ import type { EvaluateFn, EvaluateFnReturnType, EvaluateHandleFn, SerializableOr
18
18
  import type { ExecutionContext } from './ExecutionContext';
19
19
  import type { Frame } from './FrameManager';
20
20
  import type { JSHandle } from './JSHandle';
21
- import type { TimeoutSettings } from './TimeoutSettings';
22
21
  export declare class DOMWorld {
23
22
  #private;
24
23
  get _waitTasks(): Set<WaitTask>;
25
- constructor(frame: Frame, timeoutSettings: TimeoutSettings);
24
+ constructor(frame: Frame);
26
25
  frame(): Frame;
27
26
  _setContext(context: ExecutionContext | null): void;
28
27
  _hasContext(): boolean;
@@ -30,16 +29,23 @@ export declare class DOMWorld {
30
29
  executionContext(): Promise<ExecutionContext>;
31
30
  evaluateHandle<HandlerType extends JSHandle = JSHandle>(pageFunction: EvaluateHandleFn, ...args: SerializableOrJSHandle[]): Promise<HandlerType>;
32
31
  evaluate<T extends EvaluateFn>(pageFunction: T, ...args: SerializableOrJSHandle[]): Promise<UnwrapPromiseLike<EvaluateFnReturnType<T>>>;
33
- waitForFunction(browser: HeadlessBrowser, pageFunction: Function | string, ...args: SerializableOrJSHandle[]): Promise<JSHandle>;
32
+ waitForFunction({ browser, timeout, pageFunction, title, shouldClosePage, }: {
33
+ browser: HeadlessBrowser;
34
+ timeout: number | null;
35
+ pageFunction: Function | string;
36
+ title: string;
37
+ shouldClosePage: boolean;
38
+ }): Promise<JSHandle>;
34
39
  title(): Promise<string>;
35
40
  }
36
41
  interface WaitTaskOptions {
37
42
  domWorld: DOMWorld;
38
43
  predicateBody: Function | string;
39
44
  title: string;
40
- timeout: number;
45
+ timeout: number | null;
41
46
  browser: HeadlessBrowser;
42
47
  args: SerializableOrJSHandle[];
48
+ shouldClosePage: boolean;
43
49
  }
44
50
  declare class WaitTask {
45
51
  #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_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;
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;
29
29
  Object.defineProperty(exports, "__esModule", { value: true });
30
30
  exports.DOMWorld = void 0;
31
31
  const assert_1 = require("./assert");
@@ -35,9 +35,8 @@ class DOMWorld {
35
35
  get _waitTasks() {
36
36
  return __classPrivateFieldGet(this, _DOMWorld_waitTasks, "f");
37
37
  }
38
- constructor(frame, timeoutSettings) {
38
+ constructor(frame) {
39
39
  _DOMWorld_frame.set(this, void 0);
40
- _DOMWorld_timeoutSettings.set(this, void 0);
41
40
  _DOMWorld_contextPromise.set(this, null);
42
41
  _DOMWorld_contextResolveCallback.set(this, null);
43
42
  _DOMWorld_detached.set(this, false);
@@ -45,7 +44,6 @@ class DOMWorld {
45
44
  // Keep own reference to client because it might differ from the FrameManager's
46
45
  // client for OOP iframes.
47
46
  __classPrivateFieldSet(this, _DOMWorld_frame, frame, "f");
48
- __classPrivateFieldSet(this, _DOMWorld_timeoutSettings, timeoutSettings, "f");
49
47
  this._setContext(null);
50
48
  }
51
49
  frame() {
@@ -93,18 +91,16 @@ class DOMWorld {
93
91
  const context = await this.executionContext();
94
92
  return context.evaluate(pageFunction, ...args);
95
93
  }
96
- waitForFunction(browser, pageFunction, ...args) {
97
- const timeout = __classPrivateFieldGet(this, _DOMWorld_timeoutSettings, "f").timeout();
98
- const waitTaskOptions = {
94
+ waitForFunction({ browser, timeout, pageFunction, title, shouldClosePage, }) {
95
+ return new WaitTask({
99
96
  domWorld: this,
100
97
  predicateBody: pageFunction,
101
- title: 'function',
98
+ title,
102
99
  timeout,
103
- args,
100
+ args: [],
104
101
  browser,
105
- };
106
- const waitTask = new WaitTask(waitTaskOptions);
107
- return waitTask.promise;
102
+ shouldClosePage,
103
+ }).promise;
108
104
  }
109
105
  title() {
110
106
  return this.evaluate(() => {
@@ -113,7 +109,7 @@ class DOMWorld {
113
109
  }
114
110
  }
115
111
  exports.DOMWorld = DOMWorld;
116
- _DOMWorld_frame = new WeakMap(), _DOMWorld_timeoutSettings = new WeakMap(), _DOMWorld_contextPromise = new WeakMap(), _DOMWorld_contextResolveCallback = new WeakMap(), _DOMWorld_detached = new WeakMap(), _DOMWorld_waitTasks = new WeakMap();
112
+ _DOMWorld_frame = new WeakMap(), _DOMWorld_contextPromise = new WeakMap(), _DOMWorld_contextResolveCallback = new WeakMap(), _DOMWorld_detached = new WeakMap(), _DOMWorld_waitTasks = new WeakMap();
117
113
  const noop = () => undefined;
118
114
  class WaitTask {
119
115
  constructor(options) {
@@ -128,6 +124,7 @@ class WaitTask {
128
124
  _WaitTask_timeoutTimer.set(this, void 0);
129
125
  _WaitTask_terminated.set(this, false);
130
126
  _WaitTask_browser.set(this, void 0);
127
+ _WaitTask_shouldClosePage.set(this, void 0);
131
128
  this.onBrowserClose = () => {
132
129
  return this.terminate(new Error('Browser was closed'));
133
130
  };
@@ -145,6 +142,7 @@ class WaitTask {
145
142
  __classPrivateFieldSet(this, _WaitTask_predicateBody, getPredicateBody(options.predicateBody), "f");
146
143
  __classPrivateFieldSet(this, _WaitTask_args, options.args, "f");
147
144
  __classPrivateFieldSet(this, _WaitTask_runCount, 0, "f");
145
+ __classPrivateFieldSet(this, _WaitTask_shouldClosePage, options.shouldClosePage, "f");
148
146
  __classPrivateFieldGet(this, _WaitTask_domWorld, "f")._waitTasks.add(this);
149
147
  this.promise = new Promise((resolve, reject) => {
150
148
  __classPrivateFieldSet(this, _WaitTask_resolve, resolve, "f");
@@ -155,7 +153,10 @@ class WaitTask {
155
153
  if (options.timeout) {
156
154
  const timeoutError = new Errors_1.TimeoutError(`waiting for ${options.title} failed: timeout ${options.timeout}ms exceeded`);
157
155
  __classPrivateFieldSet(this, _WaitTask_timeoutTimer, setTimeout(() => {
158
- return this.terminate(timeoutError);
156
+ if (__classPrivateFieldGet(this, _WaitTask_shouldClosePage, "f")) {
157
+ return this.terminate(timeoutError);
158
+ }
159
+ return __classPrivateFieldGet(this, _WaitTask_reject, "f").call(this, timeoutError);
159
160
  }, options.timeout), "f");
160
161
  }
161
162
  __classPrivateFieldSet(this, _WaitTask_browser, options.browser, "f");
@@ -243,7 +244,7 @@ class WaitTask {
243
244
  __classPrivateFieldGet(this, _WaitTask_instances, "m", _WaitTask_cleanup).call(this);
244
245
  }
245
246
  }
246
- _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() {
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() {
247
248
  if (__classPrivateFieldGet(this, _WaitTask_timeoutTimer, "f") !== undefined) {
248
249
  clearTimeout(__classPrivateFieldGet(this, _WaitTask_timeoutTimer, "f"));
249
250
  }
@@ -55,7 +55,7 @@ _ExecutionContext_instances = new WeakSet(), _ExecutionContext_evaluate = async
55
55
  const expressionWithSourceUrl = SOURCE_URL_REGEX.test(expression)
56
56
  ? expression
57
57
  : expression + '\n' + suffix;
58
- const { exceptionDetails: _details, result: _remoteObject } = await this._client
58
+ const { value: { exceptionDetails: _details, result: _remoteObject }, } = await this._client
59
59
  .send('Runtime.evaluate', {
60
60
  expression: expressionWithSourceUrl,
61
61
  contextId,
@@ -114,7 +114,7 @@ _ExecutionContext_instances = new WeakSet(), _ExecutionContext_evaluate = async
114
114
  }
115
115
  throw error;
116
116
  }
117
- const { exceptionDetails, result: remoteObject } = await callFunctionOnPromise.catch(rewriteError);
117
+ const { value: { exceptionDetails, result: remoteObject }, } = await callFunctionOnPromise.catch(rewriteError);
118
118
  if (exceptionDetails) {
119
119
  throw new Error('Evaluation failed: ' + (0, util_1.getExceptionMessage)(exceptionDetails));
120
120
  }
@@ -160,10 +160,10 @@ _ExecutionContext_instances = new WeakSet(), _ExecutionContext_evaluate = async
160
160
  }
161
161
  function rewriteError(error) {
162
162
  if (error.message.includes('Object reference chain is too long')) {
163
- return { result: { type: 'undefined' } };
163
+ return { value: { result: { type: 'undefined' } }, size: 1 };
164
164
  }
165
165
  if (error.message.includes("Object couldn't be returned by value")) {
166
- return { result: { type: 'undefined' } };
166
+ return { value: { result: { type: 'undefined' } }, size: 1 };
167
167
  }
168
168
  if (error.message.endsWith('Cannot find context with specified id') ||
169
169
  error.message.endsWith('Inspected target navigated or closed')) {
@@ -24,7 +24,6 @@ import type { HTTPResponse } from './HTTPResponse';
24
24
  import type { JSHandle } from './JSHandle';
25
25
  import type { PuppeteerLifeCycleEvent } from './LifecycleWatcher';
26
26
  import { NetworkManager } from './NetworkManager';
27
- import type { TimeoutSettings } from './TimeoutSettings';
28
27
  export declare const FrameManagerEmittedEvents: {
29
28
  FrameNavigated: symbol;
30
29
  FrameDetached: symbol;
@@ -36,13 +35,12 @@ export declare const FrameManagerEmittedEvents: {
36
35
  };
37
36
  export declare class FrameManager extends EventEmitter {
38
37
  #private;
39
- get _timeoutSettings(): TimeoutSettings;
40
38
  get _client(): CDPSession;
41
- constructor(client: CDPSession, page: Page, timeoutSettings: TimeoutSettings);
39
+ constructor(client: CDPSession, page: Page);
42
40
  private setupEventListeners;
43
41
  initialize(client?: CDPSession): Promise<void>;
44
42
  networkManager(): NetworkManager;
45
- navigateFrame(frame: Frame, url: string, options?: {
43
+ navigateFrame(frame: Frame, url: string, timeout: number, options?: {
46
44
  referer?: string;
47
45
  timeout?: number;
48
46
  waitUntil?: PuppeteerLifeCycleEvent;
@@ -68,9 +66,8 @@ export declare class Frame {
68
66
  constructor(frameManager: FrameManager, parentFrame: Frame | null, frameId: string, client: CDPSession);
69
67
  _updateClient(client: CDPSession): void;
70
68
  isOOPFrame(): boolean;
71
- goto(url: string, options?: {
69
+ goto(url: string, timeout: number, options?: {
72
70
  referer?: string;
73
- timeout?: number;
74
71
  waitUntil?: PuppeteerLifeCycleEvent;
75
72
  }): Promise<HTTPResponse | null>;
76
73
  _client(): CDPSession;
@@ -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 _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;
28
+ var _FrameManager_instances, _FrameManager_page, _FrameManager_networkManager, _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;
31
31
  const assert_1 = require("./assert");
@@ -48,18 +48,14 @@ 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
51
  get _client() {
55
52
  return __classPrivateFieldGet(this, _FrameManager_client, "f");
56
53
  }
57
- constructor(client, page, timeoutSettings) {
54
+ constructor(client, page) {
58
55
  super();
59
56
  _FrameManager_instances.add(this);
60
57
  _FrameManager_page.set(this, void 0);
61
58
  _FrameManager_networkManager.set(this, void 0);
62
- _FrameManager_timeoutSettings.set(this, void 0);
63
59
  _FrameManager_frames.set(this, new Map());
64
60
  _FrameManager_contextIdToContext.set(this, new Map());
65
61
  _FrameManager_isolatedWorlds.set(this, new Set());
@@ -68,7 +64,6 @@ class FrameManager extends EventEmitter_1.EventEmitter {
68
64
  __classPrivateFieldSet(this, _FrameManager_client, client, "f");
69
65
  __classPrivateFieldSet(this, _FrameManager_page, page, "f");
70
66
  __classPrivateFieldSet(this, _FrameManager_networkManager, new NetworkManager_1.NetworkManager(client, this), "f");
71
- __classPrivateFieldSet(this, _FrameManager_timeoutSettings, timeoutSettings, "f");
72
67
  this.setupEventListeners(__classPrivateFieldGet(this, _FrameManager_client, "f"));
73
68
  }
74
69
  setupEventListeners(session) {
@@ -122,7 +117,7 @@ class FrameManager extends EventEmitter_1.EventEmitter {
122
117
  flatten: true,
123
118
  }),
124
119
  ]);
125
- const { frameTree } = result[1];
120
+ const { value: { frameTree }, } = result[1];
126
121
  __classPrivateFieldGet(this, _FrameManager_instances, "m", _FrameManager_handleFrameTree).call(this, client, frameTree);
127
122
  await Promise.all([
128
123
  client.send('Page.setLifecycleEventsEnabled', { enabled: true }),
@@ -145,8 +140,8 @@ class FrameManager extends EventEmitter_1.EventEmitter {
145
140
  networkManager() {
146
141
  return __classPrivateFieldGet(this, _FrameManager_networkManager, "f");
147
142
  }
148
- async navigateFrame(frame, url, options = {}) {
149
- const { referer = undefined, waitUntil = 'load', timeout = __classPrivateFieldGet(this, _FrameManager_timeoutSettings, "f").navigationTimeout(), } = options;
143
+ async navigateFrame(frame, url, timeout, options = {}) {
144
+ const { referer = undefined, waitUntil = 'load' } = options;
150
145
  const watcher = new LifecycleWatcher_1.LifecycleWatcher(this, frame, waitUntil, timeout);
151
146
  let error = await Promise.race([
152
147
  navigate(__classPrivateFieldGet(this, _FrameManager_client, "f"), url, referer, frame._id),
@@ -166,7 +161,7 @@ class FrameManager extends EventEmitter_1.EventEmitter {
166
161
  return watcher.navigationResponse();
167
162
  async function navigate(client, _url, referrer, frameId) {
168
163
  try {
169
- const response = await client.send('Page.navigate', {
164
+ const { value: response } = await client.send('Page.navigate', {
170
165
  url: _url,
171
166
  referrer,
172
167
  frameId,
@@ -229,7 +224,7 @@ class FrameManager extends EventEmitter_1.EventEmitter {
229
224
  }
230
225
  }
231
226
  exports.FrameManager = FrameManager;
232
- _FrameManager_page = new WeakMap(), _FrameManager_networkManager = new WeakMap(), _FrameManager_timeoutSettings = new WeakMap(), _FrameManager_frames = new WeakMap(), _FrameManager_contextIdToContext = new WeakMap(), _FrameManager_isolatedWorlds = new WeakMap(), _FrameManager_mainFrame = new WeakMap(), _FrameManager_client = new WeakMap(), _FrameManager_instances = new WeakSet(), _FrameManager_onAttachedToTarget = async function _FrameManager_onAttachedToTarget(event) {
227
+ _FrameManager_page = new WeakMap(), _FrameManager_networkManager = new WeakMap(), _FrameManager_frames = new WeakMap(), _FrameManager_contextIdToContext = new WeakMap(), _FrameManager_isolatedWorlds = new WeakMap(), _FrameManager_mainFrame = new WeakMap(), _FrameManager_client = new WeakMap(), _FrameManager_instances = new WeakSet(), _FrameManager_onAttachedToTarget = async function _FrameManager_onAttachedToTarget(event) {
233
228
  if (event.targetInfo.type !== 'iframe') {
234
229
  return;
235
230
  }
@@ -429,14 +424,14 @@ class Frame {
429
424
  }
430
425
  _updateClient(client) {
431
426
  __classPrivateFieldSet(this, _Frame_client, client, "f");
432
- this._mainWorld = new DOMWorld_1.DOMWorld(this, this._frameManager._timeoutSettings);
433
- this._secondaryWorld = new DOMWorld_1.DOMWorld(this, this._frameManager._timeoutSettings);
427
+ this._mainWorld = new DOMWorld_1.DOMWorld(this);
428
+ this._secondaryWorld = new DOMWorld_1.DOMWorld(this);
434
429
  }
435
430
  isOOPFrame() {
436
431
  return __classPrivateFieldGet(this, _Frame_client, "f") !== this._frameManager._client;
437
432
  }
438
- goto(url, options = {}) {
439
- return this._frameManager.navigateFrame(this, url, options);
433
+ goto(url, timeout, options = {}) {
434
+ return this._frameManager.navigateFrame(this, url, timeout, options);
440
435
  }
441
436
  _client() {
442
437
  return __classPrivateFieldGet(this, _Frame_client, "f");
@@ -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 { LogLevel } from '../log-level';
16
17
  import type { BrowserConnectOptions } from './BrowserConnector';
17
18
  import type { Product } from './Product';
18
19
  export interface BrowserLaunchArgumentOptions {
@@ -26,6 +27,7 @@ export interface LaunchOptions {
26
27
  executablePath?: string;
27
28
  timeout?: number;
28
29
  dumpio?: boolean;
30
+ logLevel: LogLevel;
29
31
  env?: Record<string, string | undefined>;
30
32
  product?: Product;
31
33
  indent: boolean;
@@ -84,12 +84,12 @@ class ChromeLauncher {
84
84
  dumpio,
85
85
  env,
86
86
  indent,
87
+ logLevel: options.logLevel,
87
88
  });
88
89
  let browser;
89
90
  try {
90
91
  const connection = await runner.setupConnection({
91
92
  timeout,
92
- preferredRevision: this._preferredRevision,
93
93
  });
94
94
  browser = await Browser_1.HeadlessBrowser._create({
95
95
  connection,
@@ -107,7 +107,7 @@ class ChromeLauncher {
107
107
  }, { timeout });
108
108
  }
109
109
  catch (error) {
110
- await browser.close(false);
110
+ await browser.close(false, options.logLevel, options.indent);
111
111
  throw error;
112
112
  }
113
113
  return browser;
@@ -125,7 +125,7 @@ function resolveExecutablePath(launcher) {
125
125
  const { product, _preferredRevision } = launcher;
126
126
  const revisionInfo = (0, BrowserFetcher_1.getRevisionInfo)(_preferredRevision, 'chrome');
127
127
  const firefoxHelp = `Run \`PUPPETEER_PRODUCT=firefox npm install\` to download a supported Firefox browser binary.`;
128
- const chromeHelp = `Run \`npm install\` to download the correct Chromium revision (${launcher._preferredRevision}).`;
128
+ const chromeHelp = `Run \`npm install\` to download the correct Chromium revision.`;
129
129
  const missingText = revisionInfo.local
130
130
  ? undefined
131
131
  : `Could not find expected browser (${product}) locally. ${product === 'chrome' ? chromeHelp : firefoxHelp}`;
@@ -20,7 +20,10 @@ export declare const NetworkManagerEmittedEvents: {
20
20
  readonly Request: symbol;
21
21
  };
22
22
  interface CDPSession extends EventEmitter {
23
- send<T extends keyof Commands>(method: T, ...paramArgs: Commands[T]['paramsType']): Promise<Commands[T]['returnType']>;
23
+ send<T extends keyof Commands>(method: T, ...paramArgs: Commands[T]['paramsType']): Promise<{
24
+ value: Commands[T]['returnType'];
25
+ size: number;
26
+ }>;
24
27
  }
25
28
  interface FrameManager {
26
29
  frame(frameId: string): Frame | null;
@@ -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 { LogLevel } from '../log-level';
16
17
  import type { AnySourceMapConsumer } from '../symbolicate-stacktrace';
17
18
  import type { BrowserContext, HeadlessBrowser } from './Browser';
18
19
  import { Page } from './BrowserPage';
@@ -36,7 +37,7 @@ export declare class Target {
36
37
  /**
37
38
  * If the target is not of type `"page"` or `"background_page"`, returns `null`.
38
39
  */
39
- page(sourcemapContext: AnySourceMapConsumer | null): Promise<Page | null>;
40
+ page(sourcemapContext: Promise<AnySourceMapConsumer | null>, logLevel: LogLevel, indent: boolean): Promise<Page | null>;
40
41
  url(): string;
41
42
  /**
42
43
  * Identifies what kind of target this is.
@@ -79,7 +79,7 @@ class Target {
79
79
  /**
80
80
  * If the target is not of type `"page"` or `"background_page"`, returns `null`.
81
81
  */
82
- async page(sourcemapContext) {
82
+ async page(sourcemapContext, logLevel, indent) {
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) => {
@@ -90,6 +90,8 @@ class Target {
90
90
  defaultViewport: (_a = __classPrivateFieldGet(this, _Target_defaultViewport, "f")) !== null && _a !== void 0 ? _a : null,
91
91
  browser: this.browser(),
92
92
  sourcemapContext,
93
+ logLevel,
94
+ indent,
93
95
  });
94
96
  }), "f");
95
97
  }
@@ -31,30 +31,25 @@ function getRevision(product) {
31
31
  async function downloadBrowser(product) {
32
32
  const revision = getRevision(product);
33
33
  const revisionInfo = (0, BrowserFetcher_1.getRevisionInfo)(revision, product);
34
- try {
35
- await (0, BrowserFetcher_1.download)({
36
- revision: revisionInfo.revision,
37
- progressCallback: (downloadedBytes, totalBytes) => {
38
- console.log('Downloading', supportedProducts[product], toMegabytes(downloadedBytes) + '/' + toMegabytes(totalBytes));
39
- },
40
- product,
41
- platform: (0, BrowserFetcher_1.getPlatform)(product),
42
- downloadHost: (0, BrowserFetcher_1.getDownloadHost)(product),
43
- downloadsFolder: (0, BrowserFetcher_1.getDownloadsFolder)(product),
44
- });
45
- const _localRevisions = await (0, BrowserFetcher_1.localRevisions)((0, BrowserFetcher_1.getDownloadsFolder)(product), product, (0, BrowserFetcher_1.getPlatform)(product));
46
- console.log(`${supportedProducts[product]} (${revisionInfo.revision}) downloaded to ${revisionInfo.folderPath}`);
47
- await Promise.all(_localRevisions
48
- .filter((__revision) => {
49
- return __revision !== revisionInfo.revision;
50
- })
51
- .map((__revision) => {
52
- return (0, BrowserFetcher_1.removeBrowser)(__revision, (0, BrowserFetcher_1.getFolderPath)(revision, (0, BrowserFetcher_1.getDownloadsFolder)(product), (0, BrowserFetcher_1.getPlatform)(product)));
53
- }));
54
- }
55
- catch (err) {
56
- throw new Error(`Failed to set up ${supportedProducts[product]} r${revision}! Set "PUPPETEER_SKIP_DOWNLOAD" env variable to skip download.`);
57
- }
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
+ }));
58
53
  }
59
54
  exports.downloadBrowser = downloadBrowser;
60
55
  function toMegabytes(bytes) {
@@ -44,6 +44,65 @@ export interface DevtoolsRemoteObject {
44
44
  * Unique object identifier (for non-primitive values).
45
45
  */
46
46
  objectId?: RemoteObjectId;
47
+ preview?: ObjectPreview;
48
+ }
49
+ export interface ObjectPreview {
50
+ /**
51
+ * Object type. (ObjectPreviewType enum)
52
+ */
53
+ type: 'object' | 'function' | 'undefined' | 'string' | 'number' | 'boolean' | 'symbol' | 'bigint';
54
+ /**
55
+ * Object subtype hint. Specified for `object` type values only. (ObjectPreviewSubtype enum)
56
+ */
57
+ subtype?: 'array' | 'null' | 'node' | 'regexp' | 'date' | 'map' | 'set' | 'weakmap' | 'weakset' | 'iterator' | 'generator' | 'error' | 'proxy' | 'promise' | 'typedarray' | 'arraybuffer' | 'dataview' | 'webassemblymemory' | 'wasmvalue';
58
+ /**
59
+ * String representation of the object.
60
+ */
61
+ description?: string;
62
+ /**
63
+ * True iff some of the properties or entries of the original object did not fit.
64
+ */
65
+ overflow: boolean;
66
+ /**
67
+ * List of the properties.
68
+ */
69
+ properties: PropertyPreview[];
70
+ /**
71
+ * List of the entries. Specified for `map` and `set` subtype values only.
72
+ */
73
+ entries?: EntryPreview[];
74
+ }
75
+ export interface EntryPreview {
76
+ /**
77
+ * Preview of the key. Specified for map-like collection entries.
78
+ */
79
+ key?: ObjectPreview;
80
+ /**
81
+ * Preview of the value.
82
+ */
83
+ value: ObjectPreview;
84
+ }
85
+ export interface PropertyPreview {
86
+ /**
87
+ * Property name.
88
+ */
89
+ name: string;
90
+ /**
91
+ * Object type. Accessor means that the property itself is an accessor property. (PropertyPreviewType enum)
92
+ */
93
+ type: 'object' | 'function' | 'undefined' | 'string' | 'number' | 'boolean' | 'symbol' | 'accessor' | 'bigint';
94
+ /**
95
+ * User-friendly property value string.
96
+ */
97
+ value?: string;
98
+ /**
99
+ * Nested value preview.
100
+ */
101
+ valuePreview?: ObjectPreview;
102
+ /**
103
+ * Object subtype hint. Specified for `object` type values only. (PropertyPreviewSubtype enum)
104
+ */
105
+ subtype?: 'array' | 'null' | 'node' | 'regexp' | 'date' | 'map' | 'set' | 'weakmap' | 'weakset' | 'iterator' | 'generator' | 'error' | 'proxy' | 'promise' | 'typedarray' | 'arraybuffer' | 'dataview' | 'webassemblymemory' | 'wasmvalue';
47
106
  }
48
107
  type TargetID = string;
49
108
  export interface TargetInfo {
@@ -6,10 +6,24 @@ const shouldLogBrowserMessage = (message) => {
6
6
  if (message.startsWith('DevTools listening on')) {
7
7
  return false;
8
8
  }
9
+ // In Ubuntu GitHub Action
10
+ if (message.includes('Falling back to ALSA for audio output')) {
11
+ return false;
12
+ }
13
+ // In Ubuntu GitHub Action
14
+ if (message.includes('Floss manager not present, cannot set Floss enable/disable')) {
15
+ return false;
16
+ }
9
17
  // Noisy but harmless warning
10
18
  if (message.includes('Failed to send GpuControl.CreateCommandBuffer')) {
11
19
  return false;
12
20
  }
21
+ if (message.includes('CreatePlatformSocket() failed: Address family not supported by protocol')) {
22
+ return false;
23
+ }
24
+ if (message.includes('Fontconfig error: No writable cache directories')) {
25
+ return false;
26
+ }
13
27
  return true;
14
28
  };
15
29
  exports.shouldLogBrowserMessage = shouldLogBrowserMessage;
@@ -5,7 +5,7 @@ type Style = {
5
5
  };
6
6
  type Method = (str: string) => string;
7
7
  type Colors = {
8
- enabled: boolean;
8
+ enabled: () => boolean;
9
9
  visible: boolean;
10
10
  styles: Record<string, Style>;
11
11
  keys: Record<string, string[]>;
@@ -26,6 +26,7 @@ type ColorsWithMethods = Colors & {
26
26
  yellow: Method;
27
27
  blue: Method;
28
28
  magenta: Method;
29
+ cyan: Method;
29
30
  white: Method;
30
31
  gray: Method;
31
32
  bgBlack: Method;
@@ -2,15 +2,9 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.chalk = void 0;
4
4
  const is_color_supported_1 = require("./is-color-supported");
5
- const hasColor = () => {
6
- if (typeof process !== 'undefined' && process.env.FORCE_COLOR) {
7
- return true;
8
- }
9
- return is_color_supported_1.isColorSupported;
10
- };
11
5
  exports.chalk = (() => {
12
6
  const colors = {
13
- enabled: hasColor(),
7
+ enabled: () => (0, is_color_supported_1.isColorSupported)(),
14
8
  visible: true,
15
9
  styles: {},
16
10
  keys: {},
@@ -37,7 +31,7 @@ exports.chalk = (() => {
37
31
  const style = (input, stack) => {
38
32
  if (input === '' || input === null || input === undefined)
39
33
  return '';
40
- if (colors.enabled === false)
34
+ if (colors.enabled() === false)
41
35
  return input;
42
36
  if (colors.visible === false)
43
37
  return '';
@@ -81,6 +75,7 @@ exports.chalk = (() => {
81
75
  define('yellow', [33, 39], 'color');
82
76
  define('blue', [34, 39], 'color');
83
77
  define('magenta', [35, 39], 'color');
78
+ define('cyan', [36, 39], 'color');
84
79
  define('white', [37, 39], 'color');
85
80
  define('gray', [90, 39], 'color');
86
81
  define('grey', [90, 39], 'color');
@@ -1 +1 @@
1
- export declare const isColorSupported: boolean;
1
+ export declare const isColorSupported: () => boolean;
@@ -22,16 +22,24 @@ var __importStar = (this && this.__importStar) || function (mod) {
22
22
  __setModuleDefault(result, mod);
23
23
  return result;
24
24
  };
25
- var _a;
26
25
  Object.defineProperty(exports, "__esModule", { value: true });
27
26
  exports.isColorSupported = void 0;
28
27
  const tty = __importStar(require("tty"));
29
- const argv = process.argv || [];
30
- const env = process.env || {};
31
- const isDisabled = 'NO_COLOR' in env || argv.includes('--no-color');
32
- const isForced = 'FORCE_COLOR' in env || argv.includes('--color');
33
- const isWindows = process.platform === 'win32';
34
- const isCompatibleTerminal = ((_a = tty === null || tty === void 0 ? void 0 : tty.isatty) === null || _a === void 0 ? void 0 : _a.call(tty, 1)) && env.TERM && env.TERM !== 'dumb';
35
- const isCI = 'CI' in env &&
36
- ('GITHUB_ACTIONS' in env || 'GITLAB_CI' in env || 'CIRCLECI' in env);
37
- exports.isColorSupported = !isDisabled && (isForced || isWindows || isCompatibleTerminal || isCI);
28
+ const isColorSupported = () => {
29
+ var _a;
30
+ const env = process.env || {};
31
+ const isForceDisabled = 'NO_COLOR' in env;
32
+ if (isForceDisabled) {
33
+ return false;
34
+ }
35
+ const isForced = 'FORCE_COLOR' in env;
36
+ if (isForced) {
37
+ return true;
38
+ }
39
+ const isWindows = process.platform === 'win32';
40
+ const isCompatibleTerminal = ((_a = tty === null || tty === void 0 ? void 0 : tty.isatty) === null || _a === void 0 ? void 0 : _a.call(tty, 1)) && env.TERM && env.TERM !== 'dumb';
41
+ const isCI = 'CI' in env &&
42
+ ('GITHUB_ACTIONS' in env || 'GITLAB_CI' in env || 'CIRCLECI' in env);
43
+ return isWindows || isCompatibleTerminal || isCI;
44
+ };
45
+ exports.isColorSupported = isColorSupported;