@remotion/renderer 3.3.86 → 3.3.88

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.
@@ -15,11 +15,6 @@
15
15
  */
16
16
  import type { Product } from './Product';
17
17
  declare type Platform = 'linux' | 'mac' | 'mac_arm' | 'win32' | 'win64';
18
- export interface BrowserFetcherOptions {
19
- platform: Platform | null;
20
- product: Product;
21
- path: string | null;
22
- }
23
18
  interface BrowserFetcherRevisionInfo {
24
19
  folderPath: string;
25
20
  executablePath: string;
@@ -28,63 +23,20 @@ interface BrowserFetcherRevisionInfo {
28
23
  revision: string;
29
24
  product: string;
30
25
  }
31
- export declare class BrowserFetcher {
32
- #private;
33
- constructor(options: BrowserFetcherOptions);
34
- /**
35
- * @returns Returns the current `Platform`, which is one of `mac`, `linux`,
36
- * `win32` or `win64`.
37
- */
38
- platform(): Platform;
39
- /**
40
- * @returns Returns the current `Product`, which is one of `chrome` or
41
- * `firefox`.
42
- */
43
- product(): Product;
44
- /**
45
- * @returns The download host being used.
46
- */
47
- host(): string;
48
- /**
49
- * Initiates a HEAD request to check if the revision is available.
50
- * @remarks
51
- * This method is affected by the current `product`.
52
- * @param revision - The revision to check availability for.
53
- * @returns A promise that resolves to `true` if the revision could be downloaded
54
- * from the host.
55
- */
56
- canDownload(revision: string): Promise<boolean>;
57
- /**
58
- * Initiates a GET request to download the revision from the host.
59
- * @remarks
60
- * This method is affected by the current `product`.
61
- * @param revision - The revision to download.
62
- * @param progressCallback - A function that will be called with two arguments:
63
- * How many bytes have been downloaded and the total number of bytes of the download.
64
- * @returns A promise with revision information when the revision is downloaded
65
- * and extracted.
66
- */
67
- download(revision: string, progressCallback?: (x: number, y: number) => void): Promise<BrowserFetcherRevisionInfo | undefined>;
68
- /**
69
- * @remarks
70
- * This method is affected by the current `product`.
71
- * @returns A promise with a list of all revision strings (for the current `product`)
72
- * available locally on disk.
73
- */
74
- localRevisions(): Promise<string[]>;
75
- /**
76
- * @remarks
77
- * This method is affected by the current `product`.
78
- * @param revision - A revision to remove for the current `product`.
79
- * @returns A promise that resolves when the revision has been removes or
80
- * throws if the revision has not been downloaded.
81
- */
82
- remove(revision: string): Promise<void>;
83
- /**
84
- * @param revision - The revision to get info for.
85
- * @returns The revision info for the given revision.
86
- */
87
- revisionInfo(revision: string): BrowserFetcherRevisionInfo;
88
- }
26
+ export declare const getPlatform: (product: Product) => Platform;
27
+ export declare const getDownloadsFolder: (product: Product) => string;
28
+ export declare const getDownloadHost: (product: Product) => "https://storage.googleapis.com" | "https://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central";
29
+ export declare const download: ({ revision, progressCallback, product, platform, downloadHost, downloadsFolder, }: {
30
+ revision: string;
31
+ progressCallback: (x: number, y: number) => void;
32
+ product: Product;
33
+ platform: Platform;
34
+ downloadHost: string;
35
+ downloadsFolder: string;
36
+ }) => Promise<BrowserFetcherRevisionInfo | undefined>;
37
+ export declare const localRevisions: (downloadsFolder: string, product: Product, platform: Platform) => Promise<string[]>;
38
+ export declare const removeBrowser: (revision: string, folderPath: string) => Promise<void>;
39
+ export declare const getFolderPath: (revision: string, downloadsFolder: string, platform: Platform) => string;
40
+ export declare const getRevisionInfo: (revision: string, product: Product) => BrowserFetcherRevisionInfo;
89
41
  export declare function _downloadFile(url: string, destinationPath: string, progressCallback: (x: number, y: number) => void): Promise<number>;
90
42
  export {};
@@ -37,23 +37,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
37
37
  __setModuleDefault(result, mod);
38
38
  return result;
39
39
  };
40
- var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
41
- if (kind === "m") throw new TypeError("Private method is not writable");
42
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
43
- 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");
44
- return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
45
- };
46
- var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
47
- if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
48
- 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");
49
- return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
50
- };
51
40
  var __importDefault = (this && this.__importDefault) || function (mod) {
52
41
  return (mod && mod.__esModule) ? mod : { "default": mod };
53
42
  };
54
- var _BrowserFetcher_instances, _BrowserFetcher_product, _BrowserFetcher_downloadsFolder, _BrowserFetcher_downloadHost, _BrowserFetcher_platform, _BrowserFetcher_getFolderPath;
55
43
  Object.defineProperty(exports, "__esModule", { value: true });
56
- exports._downloadFile = exports.BrowserFetcher = void 0;
44
+ exports._downloadFile = exports.getRevisionInfo = exports.getFolderPath = exports.removeBrowser = exports.localRevisions = exports.download = exports.getDownloadHost = exports.getDownloadsFolder = exports.getPlatform = void 0;
57
45
  const childProcess = __importStar(require("child_process"));
58
46
  const fs = __importStar(require("fs"));
59
47
  const http = __importStar(require("http"));
@@ -149,223 +137,147 @@ function existsAsync(filePath) {
149
137
  });
150
138
  });
151
139
  }
152
- class BrowserFetcher {
153
- constructor(options) {
154
- _BrowserFetcher_instances.add(this);
155
- _BrowserFetcher_product.set(this, void 0);
156
- _BrowserFetcher_downloadsFolder.set(this, void 0);
157
- _BrowserFetcher_downloadHost.set(this, void 0);
158
- _BrowserFetcher_platform.set(this, void 0);
159
- __classPrivateFieldSet(this, _BrowserFetcher_product, options.product.toLowerCase(), "f");
160
- (0, assert_1.assert)(__classPrivateFieldGet(this, _BrowserFetcher_product, "f") === 'chrome' || __classPrivateFieldGet(this, _BrowserFetcher_product, "f") === 'firefox', `Unknown product: "${options.product}"`);
161
- __classPrivateFieldSet(this, _BrowserFetcher_downloadsFolder, options.path ||
162
- path.join((0, get_download_destination_1.getDownloadsCacheDir)(), browserConfig[__classPrivateFieldGet(this, _BrowserFetcher_product, "f")].destination), "f");
163
- __classPrivateFieldSet(this, _BrowserFetcher_downloadHost, browserConfig[__classPrivateFieldGet(this, _BrowserFetcher_product, "f")].host, "f");
164
- if (options.platform) {
165
- __classPrivateFieldSet(this, _BrowserFetcher_platform, options.platform, "f");
166
- }
167
- else {
168
- const platform = os.platform();
169
- switch (platform) {
170
- case 'darwin':
171
- switch (__classPrivateFieldGet(this, _BrowserFetcher_product, "f")) {
172
- case 'chrome':
173
- __classPrivateFieldSet(this, _BrowserFetcher_platform, os.arch() === 'arm64' && PUPPETEER_EXPERIMENTAL_CHROMIUM_MAC_ARM
174
- ? 'mac_arm'
175
- : 'mac', "f");
176
- break;
177
- case 'firefox':
178
- __classPrivateFieldSet(this, _BrowserFetcher_platform, 'mac', "f");
179
- break;
180
- default:
181
- throw new Error('unknown browser');
182
- }
183
- break;
184
- case 'linux':
185
- __classPrivateFieldSet(this, _BrowserFetcher_platform, 'linux', "f");
186
- break;
187
- case 'win32':
188
- __classPrivateFieldSet(this, _BrowserFetcher_platform, os.arch() === 'x64' ? 'win64' : 'win32', "f");
189
- return;
140
+ const getPlatform = (product) => {
141
+ const platform = os.platform();
142
+ switch (platform) {
143
+ case 'darwin':
144
+ switch (product) {
145
+ case 'chrome':
146
+ return os.arch() === 'arm64' &&
147
+ PUPPETEER_EXPERIMENTAL_CHROMIUM_MAC_ARM
148
+ ? 'mac_arm'
149
+ : 'mac';
150
+ case 'firefox':
151
+ return 'mac';
190
152
  default:
191
- (0, assert_1.assert)(false, 'Unsupported platform: ' + platform);
153
+ throw new Error('unknown browser');
192
154
  }
193
- }
194
- (0, assert_1.assert)(downloadURLs[__classPrivateFieldGet(this, _BrowserFetcher_product, "f")][__classPrivateFieldGet(this, _BrowserFetcher_platform, "f")], 'Unsupported platform: ' + __classPrivateFieldGet(this, _BrowserFetcher_platform, "f"));
155
+ case 'linux':
156
+ return 'linux';
157
+ case 'win32':
158
+ return os.arch() === 'x64' ? 'win64' : 'win32';
159
+ default:
160
+ (0, assert_1.assert)(false, 'Unsupported platform: ' + platform);
195
161
  }
196
- /**
197
- * @returns Returns the current `Platform`, which is one of `mac`, `linux`,
198
- * `win32` or `win64`.
199
- */
200
- platform() {
201
- return __classPrivateFieldGet(this, _BrowserFetcher_platform, "f");
162
+ };
163
+ exports.getPlatform = getPlatform;
164
+ const getDownloadsFolder = (product) => {
165
+ return path.join((0, get_download_destination_1.getDownloadsCacheDir)(), browserConfig[product].destination);
166
+ };
167
+ exports.getDownloadsFolder = getDownloadsFolder;
168
+ const getDownloadHost = (product) => {
169
+ return browserConfig[product].host;
170
+ };
171
+ exports.getDownloadHost = getDownloadHost;
172
+ const download = async ({ revision, progressCallback, product, platform, downloadHost, downloadsFolder, }) => {
173
+ const url = _downloadURL(product, platform, downloadHost, revision);
174
+ const fileName = url.split('/').pop();
175
+ (0, assert_1.assert)(fileName, `A malformed download URL was found: ${url}.`);
176
+ const archivePath = path.join(downloadsFolder, fileName);
177
+ const outputPath = (0, exports.getFolderPath)(revision, downloadsFolder, platform);
178
+ if (await existsAsync(outputPath)) {
179
+ return (0, exports.getRevisionInfo)(revision, product);
202
180
  }
203
- /**
204
- * @returns Returns the current `Product`, which is one of `chrome` or
205
- * `firefox`.
206
- */
207
- product() {
208
- return __classPrivateFieldGet(this, _BrowserFetcher_product, "f");
181
+ if (!(await existsAsync(downloadsFolder))) {
182
+ await mkdirAsync(downloadsFolder, {
183
+ recursive: true,
184
+ });
209
185
  }
210
- /**
211
- * @returns The download host being used.
212
- */
213
- host() {
214
- return __classPrivateFieldGet(this, _BrowserFetcher_downloadHost, "f");
186
+ // Use system Chromium builds on Linux ARM devices
187
+ if (os.platform() !== 'darwin' && os.arch() === 'arm64') {
188
+ handleArm64();
189
+ return;
215
190
  }
216
- /**
217
- * Initiates a HEAD request to check if the revision is available.
218
- * @remarks
219
- * This method is affected by the current `product`.
220
- * @param revision - The revision to check availability for.
221
- * @returns A promise that resolves to `true` if the revision could be downloaded
222
- * from the host.
223
- */
224
- canDownload(revision) {
225
- const url = _downloadURL(__classPrivateFieldGet(this, _BrowserFetcher_product, "f"), __classPrivateFieldGet(this, _BrowserFetcher_platform, "f"), __classPrivateFieldGet(this, _BrowserFetcher_downloadHost, "f"), revision);
226
- return new Promise((resolve) => {
227
- const request = httpRequest(url, 'HEAD', (response) => {
228
- resolve(response.statusCode === 200);
229
- }, false);
230
- request.on('error', (error) => {
231
- console.error(error);
232
- resolve(false);
233
- });
234
- });
191
+ try {
192
+ await _downloadFile(url, archivePath, progressCallback);
193
+ await install(archivePath, outputPath);
235
194
  }
236
- /**
237
- * Initiates a GET request to download the revision from the host.
238
- * @remarks
239
- * This method is affected by the current `product`.
240
- * @param revision - The revision to download.
241
- * @param progressCallback - A function that will be called with two arguments:
242
- * How many bytes have been downloaded and the total number of bytes of the download.
243
- * @returns A promise with revision information when the revision is downloaded
244
- * and extracted.
245
- */
246
- async download(revision, progressCallback = () => undefined) {
247
- const url = _downloadURL(__classPrivateFieldGet(this, _BrowserFetcher_product, "f"), __classPrivateFieldGet(this, _BrowserFetcher_platform, "f"), __classPrivateFieldGet(this, _BrowserFetcher_downloadHost, "f"), revision);
248
- const fileName = url.split('/').pop();
249
- (0, assert_1.assert)(fileName, `A malformed download URL was found: ${url}.`);
250
- const archivePath = path.join(__classPrivateFieldGet(this, _BrowserFetcher_downloadsFolder, "f"), fileName);
251
- const outputPath = __classPrivateFieldGet(this, _BrowserFetcher_instances, "m", _BrowserFetcher_getFolderPath).call(this, revision);
252
- if (await existsAsync(outputPath)) {
253
- return this.revisionInfo(revision);
254
- }
255
- if (!(await existsAsync(__classPrivateFieldGet(this, _BrowserFetcher_downloadsFolder, "f")))) {
256
- await mkdirAsync(__classPrivateFieldGet(this, _BrowserFetcher_downloadsFolder, "f"), {
257
- recursive: true,
258
- });
195
+ finally {
196
+ if (await existsAsync(archivePath)) {
197
+ await unlinkAsync(archivePath);
259
198
  }
260
- // Use system Chromium builds on Linux ARM devices
261
- if (os.platform() !== 'darwin' && os.arch() === 'arm64') {
262
- handleArm64();
263
- return;
264
- }
265
- try {
266
- await _downloadFile(url, archivePath, progressCallback);
267
- await install(archivePath, outputPath);
268
- }
269
- finally {
270
- if (await existsAsync(archivePath)) {
271
- await unlinkAsync(archivePath);
272
- }
199
+ }
200
+ const revisionInfo = (0, exports.getRevisionInfo)(revision, product);
201
+ if (revisionInfo) {
202
+ await chmodAsync(revisionInfo.executablePath, 0o755);
203
+ }
204
+ return revisionInfo;
205
+ };
206
+ exports.download = download;
207
+ const localRevisions = async (downloadsFolder, product, platform) => {
208
+ if (!(await existsAsync(downloadsFolder))) {
209
+ return [];
210
+ }
211
+ const fileNames = await readdirAsync(downloadsFolder);
212
+ return fileNames
213
+ .map((fileName) => {
214
+ return parseFolderPath(product, fileName);
215
+ })
216
+ .filter((entry) => {
217
+ var _a;
218
+ return (_a = (entry && entry.platform === platform)) !== null && _a !== void 0 ? _a : false;
219
+ })
220
+ .map((entry) => {
221
+ return entry.revision;
222
+ });
223
+ };
224
+ exports.localRevisions = localRevisions;
225
+ const removeBrowser = async (revision, folderPath) => {
226
+ (0, assert_1.assert)(await existsAsync(folderPath), `Failed to remove: revision ${revision} is not downloaded`);
227
+ (0, delete_directory_1.deleteDirectory)(folderPath);
228
+ };
229
+ exports.removeBrowser = removeBrowser;
230
+ const getFolderPath = (revision, downloadsFolder, platform) => {
231
+ return path.resolve(downloadsFolder, `${platform}-${revision}`);
232
+ };
233
+ exports.getFolderPath = getFolderPath;
234
+ const getExecutablePath = (product, revision) => {
235
+ const downloadsFolder = (0, exports.getDownloadsFolder)(product);
236
+ const platform = (0, exports.getPlatform)(product);
237
+ const folderPath = (0, exports.getFolderPath)(revision, downloadsFolder, platform);
238
+ if (product === 'chrome') {
239
+ if (platform === 'mac' || platform === 'mac_arm') {
240
+ return path.join(folderPath, archiveName(product, platform, revision), 'Chromium.app', 'Contents', 'MacOS', 'Chromium');
273
241
  }
274
- const revisionInfo = this.revisionInfo(revision);
275
- if (revisionInfo) {
276
- await chmodAsync(revisionInfo.executablePath, 0o755);
242
+ if (platform === 'linux') {
243
+ return path.join(folderPath, archiveName(product, platform, revision), 'chrome');
277
244
  }
278
- return revisionInfo;
279
- }
280
- /**
281
- * @remarks
282
- * This method is affected by the current `product`.
283
- * @returns A promise with a list of all revision strings (for the current `product`)
284
- * available locally on disk.
285
- */
286
- async localRevisions() {
287
- if (!(await existsAsync(__classPrivateFieldGet(this, _BrowserFetcher_downloadsFolder, "f")))) {
288
- return [];
245
+ if (platform === 'win32' || platform === 'win64') {
246
+ return path.join(folderPath, archiveName(product, platform, revision), 'thorium.exe');
289
247
  }
290
- const fileNames = await readdirAsync(__classPrivateFieldGet(this, _BrowserFetcher_downloadsFolder, "f"));
291
- return fileNames
292
- .map((fileName) => {
293
- return parseFolderPath(__classPrivateFieldGet(this, _BrowserFetcher_product, "f"), fileName);
294
- })
295
- .filter((entry) => {
296
- var _a;
297
- return (_a = (entry && entry.platform === __classPrivateFieldGet(this, _BrowserFetcher_platform, "f"))) !== null && _a !== void 0 ? _a : false;
298
- })
299
- .map((entry) => {
300
- return entry.revision;
301
- });
302
- }
303
- /**
304
- * @remarks
305
- * This method is affected by the current `product`.
306
- * @param revision - A revision to remove for the current `product`.
307
- * @returns A promise that resolves when the revision has been removes or
308
- * throws if the revision has not been downloaded.
309
- */
310
- async remove(revision) {
311
- const folderPath = __classPrivateFieldGet(this, _BrowserFetcher_instances, "m", _BrowserFetcher_getFolderPath).call(this, revision);
312
- (0, assert_1.assert)(await existsAsync(folderPath), `Failed to remove: revision ${revision} is not downloaded`);
313
- (0, delete_directory_1.deleteDirectory)(folderPath);
248
+ throw new Error('Unsupported platform: ' + platform);
314
249
  }
315
- /**
316
- * @param revision - The revision to get info for.
317
- * @returns The revision info for the given revision.
318
- */
319
- revisionInfo(revision) {
320
- const folderPath = __classPrivateFieldGet(this, _BrowserFetcher_instances, "m", _BrowserFetcher_getFolderPath).call(this, revision);
321
- let executablePath = '';
322
- if (__classPrivateFieldGet(this, _BrowserFetcher_product, "f") === 'chrome') {
323
- if (__classPrivateFieldGet(this, _BrowserFetcher_platform, "f") === 'mac' || __classPrivateFieldGet(this, _BrowserFetcher_platform, "f") === 'mac_arm') {
324
- executablePath = path.join(folderPath, archiveName(__classPrivateFieldGet(this, _BrowserFetcher_product, "f"), __classPrivateFieldGet(this, _BrowserFetcher_platform, "f"), revision), 'Chromium.app', 'Contents', 'MacOS', 'Chromium');
325
- }
326
- else if (__classPrivateFieldGet(this, _BrowserFetcher_platform, "f") === 'linux') {
327
- executablePath = path.join(folderPath, archiveName(__classPrivateFieldGet(this, _BrowserFetcher_product, "f"), __classPrivateFieldGet(this, _BrowserFetcher_platform, "f"), revision), 'chrome');
328
- }
329
- else if (__classPrivateFieldGet(this, _BrowserFetcher_platform, "f") === 'win32' || __classPrivateFieldGet(this, _BrowserFetcher_platform, "f") === 'win64') {
330
- executablePath = path.join(folderPath, archiveName(__classPrivateFieldGet(this, _BrowserFetcher_product, "f"), __classPrivateFieldGet(this, _BrowserFetcher_platform, "f"), revision), 'thorium.exe');
331
- }
332
- else {
333
- throw new Error('Unsupported platform: ' + __classPrivateFieldGet(this, _BrowserFetcher_platform, "f"));
334
- }
250
+ if (product === 'firefox') {
251
+ if (platform === 'mac' || platform === 'mac_arm') {
252
+ return path.join(folderPath, 'Firefox Nightly.app', 'Contents', 'MacOS', 'firefox');
335
253
  }
336
- else if (__classPrivateFieldGet(this, _BrowserFetcher_product, "f") === 'firefox') {
337
- if (__classPrivateFieldGet(this, _BrowserFetcher_platform, "f") === 'mac' || __classPrivateFieldGet(this, _BrowserFetcher_platform, "f") === 'mac_arm') {
338
- executablePath = path.join(folderPath, 'Firefox Nightly.app', 'Contents', 'MacOS', 'firefox');
339
- }
340
- else if (__classPrivateFieldGet(this, _BrowserFetcher_platform, "f") === 'linux') {
341
- executablePath = path.join(folderPath, 'firefox', 'firefox');
342
- }
343
- else if (__classPrivateFieldGet(this, _BrowserFetcher_platform, "f") === 'win32' || __classPrivateFieldGet(this, _BrowserFetcher_platform, "f") === 'win64') {
344
- executablePath = path.join(folderPath, 'firefox', 'firefox.exe');
345
- }
346
- else {
347
- throw new Error('Unsupported platform: ' + __classPrivateFieldGet(this, _BrowserFetcher_platform, "f"));
348
- }
254
+ if (platform === 'linux') {
255
+ return path.join(folderPath, 'firefox', 'firefox');
349
256
  }
350
- else {
351
- throw new Error('Unsupported product: ' + __classPrivateFieldGet(this, _BrowserFetcher_product, "f"));
257
+ if (platform === 'win32' || platform === 'win64') {
258
+ return path.join(folderPath, 'firefox', 'firefox.exe');
352
259
  }
353
- const url = _downloadURL(__classPrivateFieldGet(this, _BrowserFetcher_product, "f"), __classPrivateFieldGet(this, _BrowserFetcher_platform, "f"), __classPrivateFieldGet(this, _BrowserFetcher_downloadHost, "f"), revision);
354
- const local = fs.existsSync(folderPath);
355
- return {
356
- revision,
357
- executablePath,
358
- folderPath,
359
- local,
360
- url,
361
- product: __classPrivateFieldGet(this, _BrowserFetcher_product, "f"),
362
- };
260
+ throw new Error('Unsupported platform: ' + platform);
363
261
  }
364
- }
365
- exports.BrowserFetcher = BrowserFetcher;
366
- _BrowserFetcher_product = new WeakMap(), _BrowserFetcher_downloadsFolder = new WeakMap(), _BrowserFetcher_downloadHost = new WeakMap(), _BrowserFetcher_platform = new WeakMap(), _BrowserFetcher_instances = new WeakSet(), _BrowserFetcher_getFolderPath = function _BrowserFetcher_getFolderPath(revision) {
367
- return path.resolve(__classPrivateFieldGet(this, _BrowserFetcher_downloadsFolder, "f"), `${__classPrivateFieldGet(this, _BrowserFetcher_platform, "f")}-${revision}`);
262
+ throw new Error('Unsupported product: ' + product);
263
+ };
264
+ const getRevisionInfo = (revision, product) => {
265
+ const executablePath = getExecutablePath(product, revision);
266
+ const downloadsFolder = (0, exports.getDownloadsFolder)(product);
267
+ const platform = (0, exports.getPlatform)(product);
268
+ const folderPath = (0, exports.getFolderPath)(revision, downloadsFolder, platform);
269
+ const url = _downloadURL(product, platform, (0, exports.getDownloadHost)(product), revision);
270
+ const local = fs.existsSync(folderPath);
271
+ return {
272
+ revision,
273
+ executablePath,
274
+ folderPath,
275
+ local,
276
+ url,
277
+ product,
278
+ };
368
279
  };
280
+ exports.getRevisionInfo = getRevisionInfo;
369
281
  function parseFolderPath(product, folderPath) {
370
282
  const name = path.basename(folderPath);
371
283
  const splits = name.split('-');
@@ -47,8 +47,8 @@ const os = __importStar(require("os"));
47
47
  const path = __importStar(require("path"));
48
48
  const assert_1 = require("./assert");
49
49
  const Browser_1 = require("./Browser");
50
- const BrowserFetcher_1 = require("./BrowserFetcher");
51
50
  const BrowserRunner_1 = require("./BrowserRunner");
51
+ const BrowserFetcher_1 = require("./BrowserFetcher");
52
52
  const tmpDir = () => {
53
53
  return process.env.PUPPETEER_TMP_DIR || os.tmpdir();
54
54
  };
@@ -131,12 +131,7 @@ class ChromeLauncher {
131
131
  exports.ChromeLauncher = ChromeLauncher;
132
132
  function resolveExecutablePath(launcher) {
133
133
  const { product, _preferredRevision } = launcher;
134
- const browserFetcher = new BrowserFetcher_1.BrowserFetcher({
135
- product,
136
- path: null,
137
- platform: null,
138
- });
139
- const revisionInfo = browserFetcher.revisionInfo(_preferredRevision);
134
+ const revisionInfo = (0, BrowserFetcher_1.getRevisionInfo)(_preferredRevision, 'chrome');
140
135
  const firefoxHelp = `Run \`PUPPETEER_PRODUCT=firefox npm install\` to download a supported Firefox browser binary.`;
141
136
  const chromeHelp = `Run \`npm install\` to download the correct Chromium revision (${launcher._preferredRevision}).`;
142
137
  const missingText = revisionInfo.local
@@ -15,8 +15,6 @@
15
15
  */
16
16
  import type { Browser } from './Browser';
17
17
  import type { BrowserConnectOptions } from './BrowserConnector';
18
- import type { BrowserFetcherOptions } from './BrowserFetcher';
19
- import { BrowserFetcher } from './BrowserFetcher';
20
18
  import type { ProductLauncher } from './Launcher';
21
19
  import type { BrowserLaunchArgumentOptions, LaunchOptions } from './LaunchOptions';
22
20
  import type { Product } from './Product';
@@ -35,6 +33,5 @@ export declare class PuppeteerNode {
35
33
  executablePath(channel?: string): string;
36
34
  get _launcher(): ProductLauncher;
37
35
  get product(): string;
38
- createBrowserFetcher(options: BrowserFetcherOptions): BrowserFetcher;
39
36
  }
40
37
  export {};
@@ -28,7 +28,6 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
28
28
  var _PuppeteerNode_lazyLauncher, _PuppeteerNode_productName;
29
29
  Object.defineProperty(exports, "__esModule", { value: true });
30
30
  exports.PuppeteerNode = void 0;
31
- const BrowserFetcher_1 = require("./BrowserFetcher");
32
31
  const Launcher_1 = require("./Launcher");
33
32
  const revisions_1 = require("./revisions");
34
33
  class PuppeteerNode {
@@ -40,7 +39,6 @@ class PuppeteerNode {
40
39
  this._preferredRevision = preferredRevision;
41
40
  this.launch = this.launch.bind(this);
42
41
  this.executablePath = this.executablePath.bind(this);
43
- this.createBrowserFetcher = this.createBrowserFetcher.bind(this);
44
42
  }
45
43
  launch(options) {
46
44
  if (options.product) {
@@ -66,9 +64,6 @@ class PuppeteerNode {
66
64
  get product() {
67
65
  return this._launcher.product;
68
66
  }
69
- createBrowserFetcher(options) {
70
- return new BrowserFetcher_1.BrowserFetcher(options);
71
- }
72
67
  }
73
68
  exports.PuppeteerNode = PuppeteerNode;
74
69
  _PuppeteerNode_lazyLauncher = new WeakMap(), _PuppeteerNode_productName = new WeakMap();
@@ -16,62 +16,48 @@
16
16
  */
17
17
  Object.defineProperty(exports, "__esModule", { value: true });
18
18
  exports.downloadBrowser = void 0;
19
- const node_1 = require("./node");
19
+ const BrowserFetcher_1 = require("./BrowserFetcher");
20
20
  const revisions_1 = require("./revisions");
21
21
  const supportedProducts = {
22
22
  chrome: 'Chromium',
23
23
  firefox: 'Firefox Nightly',
24
24
  };
25
- async function downloadBrowser(product) {
26
- const browserFetcher = node_1.puppeteer.createBrowserFetcher({
27
- product,
28
- path: null,
29
- platform: null,
30
- });
31
- const revision = await getRevision();
32
- await fetchBinary(revision);
33
- function getRevision() {
34
- if (product === 'chrome') {
35
- return revisions_1.PUPPETEER_REVISIONS.chromium;
36
- }
37
- throw new Error(`Unsupported product ${product}`);
25
+ function getRevision(product) {
26
+ if (product === 'chrome') {
27
+ return revisions_1.PUPPETEER_REVISIONS.chromium;
38
28
  }
39
- function fetchBinary(_revision) {
40
- const revisionInfo = browserFetcher.revisionInfo(_revision);
41
- // Do nothing if the revision is already downloaded.
42
- if (revisionInfo.local) {
43
- console.log(`${supportedProducts[product]} is already in ${revisionInfo.folderPath}; skipping download.`);
44
- return;
45
- }
46
- function onSuccess(localRevisions) {
47
- console.log(`${supportedProducts[product]} (${revisionInfo.revision}) downloaded to ${revisionInfo.folderPath}`);
48
- localRevisions = localRevisions.filter((__revision) => {
49
- return __revision !== revisionInfo.revision;
50
- });
51
- const cleanupOldVersions = localRevisions.map((__revision) => {
52
- return browserFetcher.remove(__revision);
53
- });
54
- Promise.all([...cleanupOldVersions]);
55
- }
56
- function onError(error) {
57
- console.error(`ERROR: Failed to set up ${supportedProducts[product]} r${_revision}! Set "PUPPETEER_SKIP_DOWNLOAD" env variable to skip download.`);
58
- console.error(error);
59
- process.exit(1);
60
- }
61
- function onProgress(downloadedBytes, totalBytes) {
62
- console.log('Downloading', supportedProducts[product], toMegabytes(downloadedBytes) + '/' + toMegabytes(totalBytes));
63
- }
64
- return browserFetcher
65
- .download(revisionInfo.revision, onProgress)
66
- .then(() => {
67
- return browserFetcher.localRevisions();
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
+ 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;
68
50
  })
69
- .then(onSuccess)
70
- .catch(onError);
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
+ }));
71
54
  }
72
- function toMegabytes(bytes) {
73
- const mb = bytes / 1024 / 1024;
74
- return `${Math.round(mb * 10) / 10} Mb`;
55
+ catch (err) {
56
+ throw new Error(`Failed to set up ${supportedProducts[product]} r${revision}! Set "PUPPETEER_SKIP_DOWNLOAD" env variable to skip download.`);
75
57
  }
76
58
  }
77
59
  exports.downloadBrowser = downloadBrowser;
60
+ function toMegabytes(bytes) {
61
+ const mb = bytes / 1024 / 1024;
62
+ return `${Math.round(mb * 10) / 10} Mb`;
63
+ }
@@ -5,8 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getLocalBrowserExecutable = exports.ensureLocalBrowser = void 0;
7
7
  const fs_1 = __importDefault(require("fs"));
8
+ const BrowserFetcher_1 = require("./browser/BrowserFetcher");
8
9
  const create_browser_fetcher_1 = require("./browser/create-browser-fetcher");
9
- const node_1 = require("./browser/node");
10
10
  const revisions_1 = require("./browser/revisions");
11
11
  const getSearchPathsForProduct = (product) => {
12
12
  var _a;
@@ -44,15 +44,6 @@ const getLocalBrowser = (product) => {
44
44
  }
45
45
  return null;
46
46
  };
47
- const getBrowserRevision = (product) => {
48
- const browserFetcher = node_1.puppeteer.createBrowserFetcher({
49
- product,
50
- path: null,
51
- platform: null,
52
- });
53
- const revisionInfo = browserFetcher.revisionInfo(revisions_1.PUPPETEER_REVISIONS.chromium);
54
- return revisionInfo;
55
- };
56
47
  const getBrowserStatus = (product, browserExecutablePath) => {
57
48
  if (browserExecutablePath) {
58
49
  if (!fs_1.default.existsSync(browserExecutablePath)) {
@@ -64,8 +55,8 @@ const getBrowserStatus = (product, browserExecutablePath) => {
64
55
  if (localBrowser !== null) {
65
56
  return { path: localBrowser, type: 'local-browser' };
66
57
  }
67
- const revision = getBrowserRevision(product);
68
- if (revision.local !== null && fs_1.default.existsSync(revision.executablePath)) {
58
+ const revision = (0, BrowserFetcher_1.getRevisionInfo)(revisions_1.PUPPETEER_REVISIONS.chromium, product);
59
+ if (revision.local && fs_1.default.existsSync(revision.executablePath)) {
69
60
  return { path: revision.executablePath, type: 'local-puppeteer-browser' };
70
61
  }
71
62
  return { type: 'no-browser' };
package/dist/index.d.ts CHANGED
@@ -119,8 +119,8 @@ export declare const RenderInternals: {
119
119
  validPixelFormats: readonly ["yuv420p", "yuva420p", "yuv422p", "yuv444p", "yuv420p10le", "yuv422p10le", "yuv444p10le", "yuva444p10le"];
120
120
  DEFAULT_BROWSER: import("./browser").Browser;
121
121
  validateFrameRange: (frameRange: import("./frame-range").FrameRange | null) => void;
122
- DEFAULT_OPENGL_RENDERER: "angle" | "swangle" | "egl" | "swiftshader" | null;
123
- validateOpenGlRenderer: (option: "angle" | "swangle" | "egl" | "swiftshader" | null) => "angle" | "swangle" | "egl" | "swiftshader" | null;
122
+ DEFAULT_OPENGL_RENDERER: "swangle" | "angle" | "egl" | "swiftshader" | null;
123
+ validateOpenGlRenderer: (option: "swangle" | "angle" | "egl" | "swiftshader" | null) => "swangle" | "angle" | "egl" | "swiftshader" | null;
124
124
  validImageFormats: readonly ["png", "jpeg", "none"];
125
125
  validCodecs: readonly ["h264", "h265", "vp8", "vp9", "mp3", "aac", "wav", "prores", "h264-mkv", "gif"];
126
126
  DEFAULT_PIXEL_FORMAT: "yuv420p" | "yuva420p" | "yuv422p" | "yuv444p" | "yuv420p10le" | "yuv422p10le" | "yuv444p10le" | "yuva444p10le";
@@ -129,7 +129,7 @@ export declare const RenderInternals: {
129
129
  DEFAULT_CODEC: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif";
130
130
  isAudioCodec: (codec: "h264" | "h265" | "vp8" | "vp9" | "mp3" | "aac" | "wav" | "prores" | "h264-mkv" | "gif" | undefined) => boolean;
131
131
  logLevels: readonly ["verbose", "info", "warn", "error"];
132
- isEqualOrBelowLogLevel: (currentLevel: "error" | "verbose" | "info" | "warn", level: "error" | "verbose" | "info" | "warn") => boolean;
132
+ isEqualOrBelowLogLevel: (currentLevel: "verbose" | "error" | "info" | "warn", level: "verbose" | "error" | "info" | "warn") => boolean;
133
133
  isValidLogLevel: (level: string) => boolean;
134
134
  perf: typeof perf;
135
135
  makeDownloadMap: () => import("./assets/download-map").DownloadMap;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/renderer",
3
- "version": "3.3.86",
3
+ "version": "3.3.88",
4
4
  "description": "Renderer for Remotion",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -16,7 +16,7 @@
16
16
  "dependencies": {
17
17
  "execa": "5.1.1",
18
18
  "extract-zip": "2.0.1",
19
- "remotion": "3.3.86",
19
+ "remotion": "3.3.88",
20
20
  "source-map": "^0.8.0-beta.0",
21
21
  "ws": "8.7.0"
22
22
  },
@@ -41,13 +41,13 @@
41
41
  "vitest": "0.24.3"
42
42
  },
43
43
  "optionalDependencies": {
44
- "@remotion/compositor-darwin-arm64": "3.3.86",
45
- "@remotion/compositor-darwin-x64": "3.3.86",
46
- "@remotion/compositor-linux-arm64-gnu": "3.3.86",
47
- "@remotion/compositor-linux-arm64-musl": "3.3.86",
48
- "@remotion/compositor-linux-x64-gnu": "3.3.86",
49
- "@remotion/compositor-linux-x64-musl": "3.3.86",
50
- "@remotion/compositor-win32-x64-msvc": "3.3.86"
44
+ "@remotion/compositor-darwin-arm64": "3.3.88",
45
+ "@remotion/compositor-darwin-x64": "3.3.88",
46
+ "@remotion/compositor-linux-arm64-gnu": "3.3.88",
47
+ "@remotion/compositor-linux-arm64-musl": "3.3.88",
48
+ "@remotion/compositor-linux-x64-gnu": "3.3.88",
49
+ "@remotion/compositor-linux-x64-musl": "3.3.88",
50
+ "@remotion/compositor-win32-x64-msvc": "3.3.88"
51
51
  },
52
52
  "keywords": [
53
53
  "remotion",