@remotion/renderer 4.0.418 → 4.0.420
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.
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
16
|
import type { DownloadBrowserProgressFn } from '../options/on-browser-download';
|
|
17
|
-
|
|
17
|
+
import { TESTED_VERSION } from './get-chrome-download-url';
|
|
18
|
+
export { TESTED_VERSION };
|
|
18
19
|
interface BrowserFetcherRevisionInfo {
|
|
19
20
|
folderPath: string;
|
|
20
21
|
executablePath: string;
|
|
@@ -30,4 +31,3 @@ export declare const downloadBrowser: ({ logLevel, indent, onProgress, version,
|
|
|
30
31
|
chromeMode: "chrome-for-testing" | "headless-shell";
|
|
31
32
|
}) => Promise<BrowserFetcherRevisionInfo | undefined>;
|
|
32
33
|
export declare const getRevisionInfo: (chromeMode: "chrome-for-testing" | "headless-shell") => BrowserFetcherRevisionInfo;
|
|
33
|
-
export {};
|
|
@@ -59,29 +59,9 @@ const extract_zip_1 = __importDefault(require("extract-zip"));
|
|
|
59
59
|
const node_util_1 = require("node:util");
|
|
60
60
|
const download_file_1 = require("../assets/download-file");
|
|
61
61
|
const make_file_executable_1 = require("../compositor/make-file-executable");
|
|
62
|
+
const get_chrome_download_url_1 = require("./get-chrome-download-url");
|
|
63
|
+
Object.defineProperty(exports, "TESTED_VERSION", { enumerable: true, get: function () { return get_chrome_download_url_1.TESTED_VERSION; } });
|
|
62
64
|
const get_download_destination_1 = require("./get-download-destination");
|
|
63
|
-
exports.TESTED_VERSION = '144.0.7559.20';
|
|
64
|
-
// https://github.com/microsoft/playwright/blame/e76ca6cba40c26bf22c19cf37398d2b9da9ed465/packages/playwright-core/browsers.json
|
|
65
|
-
// packages/playwright-core/browsers.json
|
|
66
|
-
const PLAYWRIGHT_VERSION = '1207'; // 144.0.7559.20
|
|
67
|
-
function getChromeDownloadUrl({ platform, version, chromeMode, }) {
|
|
68
|
-
if (platform === 'linux-arm64') {
|
|
69
|
-
if (chromeMode === 'chrome-for-testing') {
|
|
70
|
-
return `https://playwright.azureedge.net/builds/chromium/${version !== null && version !== void 0 ? version : PLAYWRIGHT_VERSION}/chromium-linux-arm64.zip`;
|
|
71
|
-
}
|
|
72
|
-
if (version) {
|
|
73
|
-
return `https://playwright.azureedge.net/builds/chromium/${version !== null && version !== void 0 ? version : PLAYWRIGHT_VERSION}/chromium-headless-shell-linux-arm64.zip`;
|
|
74
|
-
}
|
|
75
|
-
return `https://remotion.media/chromium-headless-shell-linux-arm64-${exports.TESTED_VERSION}.zip?clearcache`;
|
|
76
|
-
}
|
|
77
|
-
if (chromeMode === 'headless-shell') {
|
|
78
|
-
if (platform === 'linux64' && version === null) {
|
|
79
|
-
return `https://remotion.media/chromium-headless-shell-linux-x64-${exports.TESTED_VERSION}.zip?clearcache`;
|
|
80
|
-
}
|
|
81
|
-
return `https://storage.googleapis.com/chrome-for-testing-public/${version !== null && version !== void 0 ? version : exports.TESTED_VERSION}/${platform}/chrome-headless-shell-${platform}.zip`;
|
|
82
|
-
}
|
|
83
|
-
return `https://storage.googleapis.com/chrome-for-testing-public/${version !== null && version !== void 0 ? version : exports.TESTED_VERSION}/${platform}/chrome-${platform}.zip`;
|
|
84
|
-
}
|
|
85
65
|
const mkdirAsync = fs.promises.mkdir;
|
|
86
66
|
const unlinkAsync = (0, node_util_1.promisify)(fs.unlink.bind(fs));
|
|
87
67
|
function existsAsync(filePath) {
|
|
@@ -118,7 +98,7 @@ const getExpectedVersion = (version, _chromeMode) => {
|
|
|
118
98
|
if (version) {
|
|
119
99
|
return version;
|
|
120
100
|
}
|
|
121
|
-
return
|
|
101
|
+
return get_chrome_download_url_1.TESTED_VERSION;
|
|
122
102
|
};
|
|
123
103
|
const readVersionFile = (chromeMode) => {
|
|
124
104
|
const versionFilePath = getVersionFilePath(chromeMode);
|
|
@@ -136,7 +116,7 @@ const writeVersionFile = (chromeMode, version) => {
|
|
|
136
116
|
};
|
|
137
117
|
const downloadBrowser = async ({ logLevel, indent, onProgress, version, chromeMode, }) => {
|
|
138
118
|
const platform = getPlatform();
|
|
139
|
-
const downloadURL = getChromeDownloadUrl({ platform, version, chromeMode });
|
|
119
|
+
const downloadURL = (0, get_chrome_download_url_1.getChromeDownloadUrl)({ platform, version, chromeMode });
|
|
140
120
|
const fileName = downloadURL.split('/').pop();
|
|
141
121
|
if (!fileName) {
|
|
142
122
|
throw new Error(`A malformed download URL was found: ${downloadURL}.`);
|
|
@@ -165,6 +145,7 @@ const downloadBrowser = async ({ logLevel, indent, onProgress, version, chromeMo
|
|
|
165
145
|
'Chrome Headless Shell is not available for Windows for arm64 architecture.',
|
|
166
146
|
].join('\n'));
|
|
167
147
|
}
|
|
148
|
+
(0, get_chrome_download_url_1.logDownloadUrl)({ url: downloadURL, logLevel, indent });
|
|
168
149
|
try {
|
|
169
150
|
await (0, download_file_1.downloadFile)({
|
|
170
151
|
url: downloadURL,
|
|
@@ -185,14 +166,25 @@ const downloadBrowser = async ({ logLevel, indent, onProgress, version, chromeMo
|
|
|
185
166
|
abortSignal: new AbortController().signal,
|
|
186
167
|
});
|
|
187
168
|
await (0, extract_zip_1.default)(archivePath, { dir: outputPath });
|
|
188
|
-
const
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
169
|
+
const possibleSubdirs = [
|
|
170
|
+
'chrome-linux',
|
|
171
|
+
'chrome-headless-shell-linux64',
|
|
172
|
+
'chromium-headless-shell-amazon-linux2023-arm64',
|
|
173
|
+
'chromium-headless-shell-amazon-linux2023-x64',
|
|
174
|
+
];
|
|
175
|
+
for (const subdir of possibleSubdirs) {
|
|
176
|
+
const chromeLinuxFolder = path.join(outputPath, subdir);
|
|
177
|
+
const chromePath = path.join(chromeLinuxFolder, 'chrome');
|
|
178
|
+
if (fs.existsSync(chromePath)) {
|
|
179
|
+
const chromeHeadlessShellPath = path.join(chromeLinuxFolder, 'chrome-headless-shell');
|
|
180
|
+
fs.renameSync(chromePath, chromeHeadlessShellPath);
|
|
181
|
+
}
|
|
182
|
+
if (fs.existsSync(chromeLinuxFolder)) {
|
|
183
|
+
const targetFolder = path.join(outputPath, 'chrome-headless-shell-' + platform);
|
|
184
|
+
if (chromeLinuxFolder !== targetFolder) {
|
|
185
|
+
fs.renameSync(chromeLinuxFolder, targetFolder);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
196
188
|
}
|
|
197
189
|
}
|
|
198
190
|
catch (err) {
|
|
@@ -231,7 +223,7 @@ const getExecutablePath = (chromeMode) => {
|
|
|
231
223
|
if (chromeMode === 'headless-shell') {
|
|
232
224
|
return path.join(folderPath, `chrome-headless-shell-${platform}`, platform === 'win64'
|
|
233
225
|
? 'chrome-headless-shell.exe'
|
|
234
|
-
: platform === 'linux-arm64'
|
|
226
|
+
: platform === 'linux-arm64' || (0, get_chrome_download_url_1.isAmazonLinux2023)()
|
|
235
227
|
? 'headless_shell'
|
|
236
228
|
: 'chrome-headless-shell');
|
|
237
229
|
}
|
|
@@ -242,7 +234,7 @@ const getRevisionInfo = (chromeMode) => {
|
|
|
242
234
|
const downloadsFolder = getDownloadsFolder(chromeMode);
|
|
243
235
|
const platform = getPlatform();
|
|
244
236
|
const folderPath = getFolderPath(downloadsFolder, platform);
|
|
245
|
-
const url = getChromeDownloadUrl({ platform, version: null, chromeMode });
|
|
237
|
+
const url = (0, get_chrome_download_url_1.getChromeDownloadUrl)({ platform, version: null, chromeMode });
|
|
246
238
|
const local = fs.existsSync(folderPath);
|
|
247
239
|
return {
|
|
248
240
|
executablePath,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { ChromeMode } from '../options/chrome-mode';
|
|
2
|
+
export declare const TESTED_VERSION = "144.0.7559.20";
|
|
3
|
+
export type Platform = 'linux64' | 'linux-arm64' | 'mac-x64' | 'mac-arm64' | 'win64';
|
|
4
|
+
export declare const isAmazonLinux2023: () => boolean;
|
|
5
|
+
export declare const canUseRemotionMediaBinaries: () => boolean;
|
|
6
|
+
export declare function getChromeDownloadUrl({ platform, version, chromeMode }: {
|
|
7
|
+
platform: Platform;
|
|
8
|
+
version: string | null;
|
|
9
|
+
chromeMode: ChromeMode;
|
|
10
|
+
}): string;
|
|
11
|
+
export declare const logDownloadUrl: ({ url, logLevel, indent, }: {
|
|
12
|
+
url: string;
|
|
13
|
+
logLevel: "error" | "info" | "trace" | "verbose" | "warn";
|
|
14
|
+
indent: boolean;
|
|
15
|
+
}) => void;
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.logDownloadUrl = exports.canUseRemotionMediaBinaries = exports.isAmazonLinux2023 = exports.TESTED_VERSION = void 0;
|
|
37
|
+
exports.getChromeDownloadUrl = getChromeDownloadUrl;
|
|
38
|
+
const fs = __importStar(require("node:fs"));
|
|
39
|
+
const os = __importStar(require("node:os"));
|
|
40
|
+
const logger_1 = require("../logger");
|
|
41
|
+
exports.TESTED_VERSION = '144.0.7559.20';
|
|
42
|
+
// https://github.com/microsoft/playwright/blame/e76ca6cba40c26bf22c19cf37398d2b9da9ed465/packages/playwright-core/browsers.json
|
|
43
|
+
// packages/playwright-core/browsers.json
|
|
44
|
+
const PLAYWRIGHT_VERSION = '1207'; // 144.0.7559.20
|
|
45
|
+
const isAmazonLinux2023 = () => {
|
|
46
|
+
if (os.platform() !== 'linux') {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
try {
|
|
50
|
+
const osRelease = fs.readFileSync('/etc/os-release', 'utf-8');
|
|
51
|
+
return (osRelease.includes('Amazon Linux') && osRelease.includes('VERSION="2023"'));
|
|
52
|
+
}
|
|
53
|
+
catch (_a) {
|
|
54
|
+
return false;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
exports.isAmazonLinux2023 = isAmazonLinux2023;
|
|
58
|
+
// remotion.media binaries are built on Ubuntu 24.04 which requires glibc 2.35+
|
|
59
|
+
const MINIMUM_GLIBC_FOR_REMOTION_MEDIA = [2, 35];
|
|
60
|
+
const getGlibcVersion = () => {
|
|
61
|
+
if (process.platform !== 'linux') {
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
64
|
+
const { report } = process;
|
|
65
|
+
if (!report) {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
const rep = report.getReport();
|
|
69
|
+
if (typeof rep === 'string') {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
// @ts-expect-error no types
|
|
73
|
+
const { glibcVersionRuntime } = rep.header;
|
|
74
|
+
if (!glibcVersionRuntime) {
|
|
75
|
+
return null;
|
|
76
|
+
}
|
|
77
|
+
const split = glibcVersionRuntime.split('.');
|
|
78
|
+
if (split.length !== 2) {
|
|
79
|
+
return null;
|
|
80
|
+
}
|
|
81
|
+
return [Number(split[0]), Number(split[1])];
|
|
82
|
+
};
|
|
83
|
+
const isGlibcVersionAtLeast = (required) => {
|
|
84
|
+
const version = getGlibcVersion();
|
|
85
|
+
if (version === null) {
|
|
86
|
+
// If we can't detect, assume it's not compatible to be safe
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
const [major, minor] = version;
|
|
90
|
+
const [reqMajor, reqMinor] = required;
|
|
91
|
+
if (major > reqMajor) {
|
|
92
|
+
return true;
|
|
93
|
+
}
|
|
94
|
+
if (major === reqMajor && minor >= reqMinor) {
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
97
|
+
return false;
|
|
98
|
+
};
|
|
99
|
+
const canUseRemotionMediaBinaries = () => {
|
|
100
|
+
if (process.platform !== 'linux') {
|
|
101
|
+
// remotion.media binaries are only for Linux
|
|
102
|
+
return false;
|
|
103
|
+
}
|
|
104
|
+
return isGlibcVersionAtLeast(MINIMUM_GLIBC_FOR_REMOTION_MEDIA);
|
|
105
|
+
};
|
|
106
|
+
exports.canUseRemotionMediaBinaries = canUseRemotionMediaBinaries;
|
|
107
|
+
function getChromeDownloadUrl({ platform, version, chromeMode, }) {
|
|
108
|
+
if (platform === 'linux-arm64') {
|
|
109
|
+
// Amazon Linux 2023 on arm64 needs a special build.
|
|
110
|
+
// This binary is compatible with older glibc (no 2.35 requirement).
|
|
111
|
+
if ((0, exports.isAmazonLinux2023)() && chromeMode === 'headless-shell' && !version) {
|
|
112
|
+
return 'https://remotion.media/chromium-headless-shell-amazon-linux-arm64-144.0.7559.20.zip';
|
|
113
|
+
}
|
|
114
|
+
if (chromeMode === 'chrome-for-testing') {
|
|
115
|
+
return `https://playwright.azureedge.net/builds/chromium/${version !== null && version !== void 0 ? version : PLAYWRIGHT_VERSION}/chromium-linux-arm64.zip`;
|
|
116
|
+
}
|
|
117
|
+
if (version) {
|
|
118
|
+
return `https://playwright.azureedge.net/builds/chromium/${version}/chromium-headless-shell-linux-arm64.zip`;
|
|
119
|
+
}
|
|
120
|
+
// Regular arm64 binary requires glibc 2.35+
|
|
121
|
+
if ((0, exports.canUseRemotionMediaBinaries)()) {
|
|
122
|
+
return `https://remotion.media/chromium-headless-shell-linux-arm64-${exports.TESTED_VERSION}.zip?clearcache`;
|
|
123
|
+
}
|
|
124
|
+
// Fall back to Playwright for older glibc (non-Amazon Linux systems)
|
|
125
|
+
return `https://playwright.azureedge.net/builds/chromium/${PLAYWRIGHT_VERSION}/chromium-headless-shell-linux-arm64.zip`;
|
|
126
|
+
}
|
|
127
|
+
if (chromeMode === 'headless-shell') {
|
|
128
|
+
// Amazon Linux 2023 needs a special build.
|
|
129
|
+
// This binary is compatible with older glibc (no 2.35 requirement).
|
|
130
|
+
if ((0, exports.isAmazonLinux2023)() && platform === 'linux64' && !version) {
|
|
131
|
+
return `https://remotion.media/chromium-headless-shell-amazon-linux-x64-144.0.7559.20.zip`;
|
|
132
|
+
}
|
|
133
|
+
if (platform === 'linux64' && version === null) {
|
|
134
|
+
if ((0, exports.canUseRemotionMediaBinaries)()) {
|
|
135
|
+
return `https://remotion.media/chromium-headless-shell-linux-x64-${exports.TESTED_VERSION}.zip?clearcache`;
|
|
136
|
+
}
|
|
137
|
+
// Fall back to Google's CDN for older glibc
|
|
138
|
+
return `https://storage.googleapis.com/chrome-for-testing-public/${exports.TESTED_VERSION}/${platform}/chrome-headless-shell-${platform}.zip`;
|
|
139
|
+
}
|
|
140
|
+
return `https://storage.googleapis.com/chrome-for-testing-public/${version !== null && version !== void 0 ? version : exports.TESTED_VERSION}/${platform}/chrome-headless-shell-${platform}.zip`;
|
|
141
|
+
}
|
|
142
|
+
return `https://storage.googleapis.com/chrome-for-testing-public/${version !== null && version !== void 0 ? version : exports.TESTED_VERSION}/${platform}/chrome-${platform}.zip`;
|
|
143
|
+
}
|
|
144
|
+
const logDownloadUrl = ({ url, logLevel, indent, }) => {
|
|
145
|
+
logger_1.Log.info({ indent, logLevel }, `Downloading from: ${url}`);
|
|
146
|
+
};
|
|
147
|
+
exports.logDownloadUrl = logDownloadUrl;
|
package/dist/esm/index.mjs
CHANGED
|
@@ -4711,8 +4711,8 @@ var defaultOnLog = ({ logLevel, tag, previewString }) => {
|
|
|
4711
4711
|
};
|
|
4712
4712
|
|
|
4713
4713
|
// src/open-browser.ts
|
|
4714
|
-
import
|
|
4715
|
-
import
|
|
4714
|
+
import fs10 from "node:fs";
|
|
4715
|
+
import os4 from "node:os";
|
|
4716
4716
|
import path9 from "node:path";
|
|
4717
4717
|
|
|
4718
4718
|
// src/browser/Launcher.ts
|
|
@@ -4746,24 +4746,126 @@ var launchChrome = async ({
|
|
|
4746
4746
|
};
|
|
4747
4747
|
|
|
4748
4748
|
// src/ensure-browser.ts
|
|
4749
|
-
import
|
|
4749
|
+
import fs8 from "fs";
|
|
4750
4750
|
|
|
4751
4751
|
// src/browser/BrowserFetcher.ts
|
|
4752
|
-
import * as
|
|
4753
|
-
import * as
|
|
4752
|
+
import * as fs7 from "node:fs";
|
|
4753
|
+
import * as os3 from "node:os";
|
|
4754
4754
|
import * as path8 from "node:path";
|
|
4755
4755
|
import extractZip from "extract-zip";
|
|
4756
4756
|
import { promisify } from "node:util";
|
|
4757
4757
|
|
|
4758
|
+
// src/browser/get-chrome-download-url.ts
|
|
4759
|
+
import * as fs5 from "node:fs";
|
|
4760
|
+
import * as os2 from "node:os";
|
|
4761
|
+
var TESTED_VERSION = "144.0.7559.20";
|
|
4762
|
+
var PLAYWRIGHT_VERSION = "1207";
|
|
4763
|
+
var isAmazonLinux2023 = () => {
|
|
4764
|
+
if (os2.platform() !== "linux") {
|
|
4765
|
+
return false;
|
|
4766
|
+
}
|
|
4767
|
+
try {
|
|
4768
|
+
const osRelease = fs5.readFileSync("/etc/os-release", "utf-8");
|
|
4769
|
+
return osRelease.includes("Amazon Linux") && osRelease.includes('VERSION="2023"');
|
|
4770
|
+
} catch {
|
|
4771
|
+
return false;
|
|
4772
|
+
}
|
|
4773
|
+
};
|
|
4774
|
+
var MINIMUM_GLIBC_FOR_REMOTION_MEDIA = [2, 35];
|
|
4775
|
+
var getGlibcVersion = () => {
|
|
4776
|
+
if (process.platform !== "linux") {
|
|
4777
|
+
return null;
|
|
4778
|
+
}
|
|
4779
|
+
const { report } = process;
|
|
4780
|
+
if (!report) {
|
|
4781
|
+
return null;
|
|
4782
|
+
}
|
|
4783
|
+
const rep = report.getReport();
|
|
4784
|
+
if (typeof rep === "string") {
|
|
4785
|
+
return null;
|
|
4786
|
+
}
|
|
4787
|
+
const { glibcVersionRuntime } = rep.header;
|
|
4788
|
+
if (!glibcVersionRuntime) {
|
|
4789
|
+
return null;
|
|
4790
|
+
}
|
|
4791
|
+
const split = glibcVersionRuntime.split(".");
|
|
4792
|
+
if (split.length !== 2) {
|
|
4793
|
+
return null;
|
|
4794
|
+
}
|
|
4795
|
+
return [Number(split[0]), Number(split[1])];
|
|
4796
|
+
};
|
|
4797
|
+
var isGlibcVersionAtLeast = (required2) => {
|
|
4798
|
+
const version = getGlibcVersion();
|
|
4799
|
+
if (version === null) {
|
|
4800
|
+
return false;
|
|
4801
|
+
}
|
|
4802
|
+
const [major, minor] = version;
|
|
4803
|
+
const [reqMajor, reqMinor] = required2;
|
|
4804
|
+
if (major > reqMajor) {
|
|
4805
|
+
return true;
|
|
4806
|
+
}
|
|
4807
|
+
if (major === reqMajor && minor >= reqMinor) {
|
|
4808
|
+
return true;
|
|
4809
|
+
}
|
|
4810
|
+
return false;
|
|
4811
|
+
};
|
|
4812
|
+
var canUseRemotionMediaBinaries = () => {
|
|
4813
|
+
if (process.platform !== "linux") {
|
|
4814
|
+
return false;
|
|
4815
|
+
}
|
|
4816
|
+
return isGlibcVersionAtLeast(MINIMUM_GLIBC_FOR_REMOTION_MEDIA);
|
|
4817
|
+
};
|
|
4818
|
+
function getChromeDownloadUrl({
|
|
4819
|
+
platform: platform2,
|
|
4820
|
+
version,
|
|
4821
|
+
chromeMode
|
|
4822
|
+
}) {
|
|
4823
|
+
if (platform2 === "linux-arm64") {
|
|
4824
|
+
if (isAmazonLinux2023() && chromeMode === "headless-shell" && !version) {
|
|
4825
|
+
return "https://remotion.media/chromium-headless-shell-amazon-linux-arm64-144.0.7559.20.zip";
|
|
4826
|
+
}
|
|
4827
|
+
if (chromeMode === "chrome-for-testing") {
|
|
4828
|
+
return `https://playwright.azureedge.net/builds/chromium/${version ?? PLAYWRIGHT_VERSION}/chromium-linux-arm64.zip`;
|
|
4829
|
+
}
|
|
4830
|
+
if (version) {
|
|
4831
|
+
return `https://playwright.azureedge.net/builds/chromium/${version}/chromium-headless-shell-linux-arm64.zip`;
|
|
4832
|
+
}
|
|
4833
|
+
if (canUseRemotionMediaBinaries()) {
|
|
4834
|
+
return `https://remotion.media/chromium-headless-shell-linux-arm64-${TESTED_VERSION}.zip?clearcache`;
|
|
4835
|
+
}
|
|
4836
|
+
return `https://playwright.azureedge.net/builds/chromium/${PLAYWRIGHT_VERSION}/chromium-headless-shell-linux-arm64.zip`;
|
|
4837
|
+
}
|
|
4838
|
+
if (chromeMode === "headless-shell") {
|
|
4839
|
+
if (isAmazonLinux2023() && platform2 === "linux64" && !version) {
|
|
4840
|
+
return `https://remotion.media/chromium-headless-shell-amazon-linux-x64-144.0.7559.20.zip`;
|
|
4841
|
+
}
|
|
4842
|
+
if (platform2 === "linux64" && version === null) {
|
|
4843
|
+
if (canUseRemotionMediaBinaries()) {
|
|
4844
|
+
return `https://remotion.media/chromium-headless-shell-linux-x64-${TESTED_VERSION}.zip?clearcache`;
|
|
4845
|
+
}
|
|
4846
|
+
return `https://storage.googleapis.com/chrome-for-testing-public/${TESTED_VERSION}/${platform2}/chrome-headless-shell-${platform2}.zip`;
|
|
4847
|
+
}
|
|
4848
|
+
return `https://storage.googleapis.com/chrome-for-testing-public/${version ?? TESTED_VERSION}/${platform2}/chrome-headless-shell-${platform2}.zip`;
|
|
4849
|
+
}
|
|
4850
|
+
return `https://storage.googleapis.com/chrome-for-testing-public/${version ?? TESTED_VERSION}/${platform2}/chrome-${platform2}.zip`;
|
|
4851
|
+
}
|
|
4852
|
+
var logDownloadUrl = ({
|
|
4853
|
+
url,
|
|
4854
|
+
logLevel,
|
|
4855
|
+
indent
|
|
4856
|
+
}) => {
|
|
4857
|
+
Log.info({ indent, logLevel }, `Downloading from: ${url}`);
|
|
4858
|
+
};
|
|
4859
|
+
|
|
4758
4860
|
// src/browser/get-download-destination.ts
|
|
4759
|
-
import
|
|
4861
|
+
import fs6 from "node:fs";
|
|
4760
4862
|
import path7 from "node:path";
|
|
4761
4863
|
var getDownloadsCacheDir = () => {
|
|
4762
4864
|
const cwd = process.cwd();
|
|
4763
4865
|
let dir = cwd;
|
|
4764
4866
|
for (;; ) {
|
|
4765
4867
|
try {
|
|
4766
|
-
if (
|
|
4868
|
+
if (fs6.statSync(path7.join(dir, "package.json")).isFile()) {
|
|
4767
4869
|
break;
|
|
4768
4870
|
}
|
|
4769
4871
|
} catch (e) {}
|
|
@@ -4787,50 +4889,26 @@ var getDownloadsCacheDir = () => {
|
|
|
4787
4889
|
};
|
|
4788
4890
|
|
|
4789
4891
|
// src/browser/BrowserFetcher.ts
|
|
4790
|
-
var
|
|
4791
|
-
var
|
|
4792
|
-
function getChromeDownloadUrl({
|
|
4793
|
-
platform: platform2,
|
|
4794
|
-
version,
|
|
4795
|
-
chromeMode
|
|
4796
|
-
}) {
|
|
4797
|
-
if (platform2 === "linux-arm64") {
|
|
4798
|
-
if (chromeMode === "chrome-for-testing") {
|
|
4799
|
-
return `https://playwright.azureedge.net/builds/chromium/${version ?? PLAYWRIGHT_VERSION}/chromium-linux-arm64.zip`;
|
|
4800
|
-
}
|
|
4801
|
-
if (version) {
|
|
4802
|
-
return `https://playwright.azureedge.net/builds/chromium/${version ?? PLAYWRIGHT_VERSION}/chromium-headless-shell-linux-arm64.zip`;
|
|
4803
|
-
}
|
|
4804
|
-
return `https://remotion.media/chromium-headless-shell-linux-arm64-${TESTED_VERSION}.zip?clearcache`;
|
|
4805
|
-
}
|
|
4806
|
-
if (chromeMode === "headless-shell") {
|
|
4807
|
-
if (platform2 === "linux64" && version === null) {
|
|
4808
|
-
return `https://remotion.media/chromium-headless-shell-linux-x64-${TESTED_VERSION}.zip?clearcache`;
|
|
4809
|
-
}
|
|
4810
|
-
return `https://storage.googleapis.com/chrome-for-testing-public/${version ?? TESTED_VERSION}/${platform2}/chrome-headless-shell-${platform2}.zip`;
|
|
4811
|
-
}
|
|
4812
|
-
return `https://storage.googleapis.com/chrome-for-testing-public/${version ?? TESTED_VERSION}/${platform2}/chrome-${platform2}.zip`;
|
|
4813
|
-
}
|
|
4814
|
-
var mkdirAsync = fs6.promises.mkdir;
|
|
4815
|
-
var unlinkAsync = promisify(fs6.unlink.bind(fs6));
|
|
4892
|
+
var mkdirAsync = fs7.promises.mkdir;
|
|
4893
|
+
var unlinkAsync = promisify(fs7.unlink.bind(fs7));
|
|
4816
4894
|
function existsAsync(filePath) {
|
|
4817
4895
|
return new Promise((resolve2) => {
|
|
4818
|
-
|
|
4896
|
+
fs7.access(filePath, (err) => {
|
|
4819
4897
|
return resolve2(!err);
|
|
4820
4898
|
});
|
|
4821
4899
|
});
|
|
4822
4900
|
}
|
|
4823
4901
|
var getPlatform = () => {
|
|
4824
|
-
const
|
|
4825
|
-
switch (
|
|
4902
|
+
const platform3 = os3.platform();
|
|
4903
|
+
switch (platform3) {
|
|
4826
4904
|
case "darwin":
|
|
4827
|
-
return
|
|
4905
|
+
return os3.arch() === "arm64" ? "mac-arm64" : "mac-x64";
|
|
4828
4906
|
case "linux":
|
|
4829
|
-
return
|
|
4907
|
+
return os3.arch() === "arm64" ? "linux-arm64" : "linux64";
|
|
4830
4908
|
case "win32":
|
|
4831
4909
|
return "win64";
|
|
4832
4910
|
default:
|
|
4833
|
-
throw new Error("Unsupported platform: " +
|
|
4911
|
+
throw new Error("Unsupported platform: " + platform3);
|
|
4834
4912
|
}
|
|
4835
4913
|
};
|
|
4836
4914
|
var getDownloadsFolder = (chromeMode) => {
|
|
@@ -4850,14 +4928,14 @@ var getExpectedVersion = (version, _chromeMode) => {
|
|
|
4850
4928
|
var readVersionFile = (chromeMode) => {
|
|
4851
4929
|
const versionFilePath = getVersionFilePath(chromeMode);
|
|
4852
4930
|
try {
|
|
4853
|
-
return
|
|
4931
|
+
return fs7.readFileSync(versionFilePath, "utf-8").trim();
|
|
4854
4932
|
} catch {
|
|
4855
4933
|
return null;
|
|
4856
4934
|
}
|
|
4857
4935
|
};
|
|
4858
4936
|
var writeVersionFile = (chromeMode, version) => {
|
|
4859
4937
|
const versionFilePath = getVersionFilePath(chromeMode);
|
|
4860
|
-
|
|
4938
|
+
fs7.writeFileSync(versionFilePath, version);
|
|
4861
4939
|
};
|
|
4862
4940
|
var downloadBrowser = async ({
|
|
4863
4941
|
logLevel,
|
|
@@ -4866,34 +4944,35 @@ var downloadBrowser = async ({
|
|
|
4866
4944
|
version,
|
|
4867
4945
|
chromeMode
|
|
4868
4946
|
}) => {
|
|
4869
|
-
const
|
|
4870
|
-
const downloadURL = getChromeDownloadUrl({ platform:
|
|
4947
|
+
const platform3 = getPlatform();
|
|
4948
|
+
const downloadURL = getChromeDownloadUrl({ platform: platform3, version, chromeMode });
|
|
4871
4949
|
const fileName = downloadURL.split("/").pop();
|
|
4872
4950
|
if (!fileName) {
|
|
4873
4951
|
throw new Error(`A malformed download URL was found: ${downloadURL}.`);
|
|
4874
4952
|
}
|
|
4875
4953
|
const downloadsFolder = getDownloadsFolder(chromeMode);
|
|
4876
4954
|
const archivePath = path8.join(downloadsFolder, fileName);
|
|
4877
|
-
const outputPath = getFolderPath(downloadsFolder,
|
|
4955
|
+
const outputPath = getFolderPath(downloadsFolder, platform3);
|
|
4878
4956
|
const expectedVersion = getExpectedVersion(version, chromeMode);
|
|
4879
4957
|
if (await existsAsync(outputPath)) {
|
|
4880
4958
|
const installedVersion = readVersionFile(chromeMode);
|
|
4881
4959
|
if (installedVersion === expectedVersion) {
|
|
4882
4960
|
return getRevisionInfo(chromeMode);
|
|
4883
4961
|
}
|
|
4884
|
-
|
|
4962
|
+
fs7.rmSync(outputPath, { recursive: true, force: true });
|
|
4885
4963
|
}
|
|
4886
4964
|
if (!await existsAsync(downloadsFolder)) {
|
|
4887
4965
|
await mkdirAsync(downloadsFolder, {
|
|
4888
4966
|
recursive: true
|
|
4889
4967
|
});
|
|
4890
4968
|
}
|
|
4891
|
-
if (
|
|
4969
|
+
if (os3.platform() !== "darwin" && os3.platform() !== "linux" && os3.arch() === "arm64") {
|
|
4892
4970
|
throw new Error([
|
|
4893
4971
|
"Chrome Headless Shell is not available for Windows for arm64 architecture."
|
|
4894
4972
|
].join(`
|
|
4895
4973
|
`));
|
|
4896
4974
|
}
|
|
4975
|
+
logDownloadUrl({ url: downloadURL, logLevel, indent });
|
|
4897
4976
|
try {
|
|
4898
4977
|
await downloadFile({
|
|
4899
4978
|
url: downloadURL,
|
|
@@ -4914,14 +4993,25 @@ var downloadBrowser = async ({
|
|
|
4914
4993
|
abortSignal: new AbortController().signal
|
|
4915
4994
|
});
|
|
4916
4995
|
await extractZip(archivePath, { dir: outputPath });
|
|
4917
|
-
const
|
|
4918
|
-
|
|
4919
|
-
|
|
4920
|
-
|
|
4921
|
-
|
|
4922
|
-
|
|
4923
|
-
|
|
4924
|
-
|
|
4996
|
+
const possibleSubdirs = [
|
|
4997
|
+
"chrome-linux",
|
|
4998
|
+
"chrome-headless-shell-linux64",
|
|
4999
|
+
"chromium-headless-shell-amazon-linux2023-arm64",
|
|
5000
|
+
"chromium-headless-shell-amazon-linux2023-x64"
|
|
5001
|
+
];
|
|
5002
|
+
for (const subdir of possibleSubdirs) {
|
|
5003
|
+
const chromeLinuxFolder = path8.join(outputPath, subdir);
|
|
5004
|
+
const chromePath = path8.join(chromeLinuxFolder, "chrome");
|
|
5005
|
+
if (fs7.existsSync(chromePath)) {
|
|
5006
|
+
const chromeHeadlessShellPath = path8.join(chromeLinuxFolder, "chrome-headless-shell");
|
|
5007
|
+
fs7.renameSync(chromePath, chromeHeadlessShellPath);
|
|
5008
|
+
}
|
|
5009
|
+
if (fs7.existsSync(chromeLinuxFolder)) {
|
|
5010
|
+
const targetFolder = path8.join(outputPath, "chrome-headless-shell-" + platform3);
|
|
5011
|
+
if (chromeLinuxFolder !== targetFolder) {
|
|
5012
|
+
fs7.renameSync(chromeLinuxFolder, targetFolder);
|
|
5013
|
+
}
|
|
5014
|
+
}
|
|
4925
5015
|
}
|
|
4926
5016
|
} catch (err) {
|
|
4927
5017
|
return Promise.reject(err);
|
|
@@ -4935,37 +5025,37 @@ var downloadBrowser = async ({
|
|
|
4935
5025
|
makeFileExecutableIfItIsNot(revisionInfo.executablePath);
|
|
4936
5026
|
return revisionInfo;
|
|
4937
5027
|
};
|
|
4938
|
-
var getFolderPath = (downloadsFolder,
|
|
4939
|
-
return path8.resolve(downloadsFolder,
|
|
5028
|
+
var getFolderPath = (downloadsFolder, platform3) => {
|
|
5029
|
+
return path8.resolve(downloadsFolder, platform3);
|
|
4940
5030
|
};
|
|
4941
5031
|
var getExecutablePath2 = (chromeMode) => {
|
|
4942
5032
|
const downloadsFolder = getDownloadsFolder(chromeMode);
|
|
4943
|
-
const
|
|
4944
|
-
const folderPath = getFolderPath(downloadsFolder,
|
|
5033
|
+
const platform3 = getPlatform();
|
|
5034
|
+
const folderPath = getFolderPath(downloadsFolder, platform3);
|
|
4945
5035
|
if (chromeMode === "chrome-for-testing") {
|
|
4946
|
-
if (
|
|
4947
|
-
return path8.join(folderPath, `chrome-${
|
|
5036
|
+
if (platform3 === "mac-arm64" || platform3 === "mac-x64") {
|
|
5037
|
+
return path8.join(folderPath, `chrome-${platform3}`, "Google Chrome for Testing.app/Contents/MacOS/Google Chrome for Testing");
|
|
4948
5038
|
}
|
|
4949
|
-
if (
|
|
5039
|
+
if (platform3 === "win64") {
|
|
4950
5040
|
return path8.join(folderPath, "chrome-win64", "chrome.exe");
|
|
4951
5041
|
}
|
|
4952
|
-
if (
|
|
5042
|
+
if (platform3 === "linux64" || platform3 === "linux-arm64") {
|
|
4953
5043
|
return path8.join(folderPath, "chrome-linux64", "chrome");
|
|
4954
5044
|
}
|
|
4955
|
-
throw new Error("unsupported platform" +
|
|
5045
|
+
throw new Error("unsupported platform" + platform3);
|
|
4956
5046
|
}
|
|
4957
5047
|
if (chromeMode === "headless-shell") {
|
|
4958
|
-
return path8.join(folderPath, `chrome-headless-shell-${
|
|
5048
|
+
return path8.join(folderPath, `chrome-headless-shell-${platform3}`, platform3 === "win64" ? "chrome-headless-shell.exe" : platform3 === "linux-arm64" || isAmazonLinux2023() ? "headless_shell" : "chrome-headless-shell");
|
|
4959
5049
|
}
|
|
4960
5050
|
throw new Error("unsupported chrome mode" + chromeMode);
|
|
4961
5051
|
};
|
|
4962
5052
|
var getRevisionInfo = (chromeMode) => {
|
|
4963
5053
|
const executablePath = getExecutablePath2(chromeMode);
|
|
4964
5054
|
const downloadsFolder = getDownloadsFolder(chromeMode);
|
|
4965
|
-
const
|
|
4966
|
-
const folderPath = getFolderPath(downloadsFolder,
|
|
4967
|
-
const url = getChromeDownloadUrl({ platform:
|
|
4968
|
-
const local =
|
|
5055
|
+
const platform3 = getPlatform();
|
|
5056
|
+
const folderPath = getFolderPath(downloadsFolder, platform3);
|
|
5057
|
+
const url = getChromeDownloadUrl({ platform: platform3, version: null, chromeMode });
|
|
5058
|
+
const local = fs7.existsSync(folderPath);
|
|
4969
5059
|
return {
|
|
4970
5060
|
executablePath,
|
|
4971
5061
|
folderPath,
|
|
@@ -5004,13 +5094,13 @@ var getBrowserStatus = ({
|
|
|
5004
5094
|
chromeMode
|
|
5005
5095
|
}) => {
|
|
5006
5096
|
if (browserExecutable) {
|
|
5007
|
-
if (!
|
|
5097
|
+
if (!fs8.existsSync(browserExecutable)) {
|
|
5008
5098
|
throw new Error(`"browserExecutable" was specified as '${browserExecutable}' but the path doesn't exist. Pass "null" for "browserExecutable" to download a browser automatically.`);
|
|
5009
5099
|
}
|
|
5010
5100
|
return { path: browserExecutable, type: "user-defined-path" };
|
|
5011
5101
|
}
|
|
5012
5102
|
const revision = getRevisionInfo(chromeMode);
|
|
5013
|
-
if (revision.local &&
|
|
5103
|
+
if (revision.local && fs8.existsSync(revision.executablePath)) {
|
|
5014
5104
|
const actualVersion = readVersionFile(chromeMode);
|
|
5015
5105
|
if (actualVersion === TESTED_VERSION) {
|
|
5016
5106
|
return { path: revision.executablePath, type: "local-puppeteer-browser" };
|
|
@@ -5036,7 +5126,7 @@ var ensureBrowser = (options) => {
|
|
|
5036
5126
|
};
|
|
5037
5127
|
|
|
5038
5128
|
// src/get-local-browser-executable.ts
|
|
5039
|
-
import
|
|
5129
|
+
import fs9 from "node:fs";
|
|
5040
5130
|
var getBrowserStatus2 = ({
|
|
5041
5131
|
browserExecutablePath,
|
|
5042
5132
|
indent,
|
|
@@ -5044,13 +5134,13 @@ var getBrowserStatus2 = ({
|
|
|
5044
5134
|
chromeMode
|
|
5045
5135
|
}) => {
|
|
5046
5136
|
if (browserExecutablePath) {
|
|
5047
|
-
if (!
|
|
5137
|
+
if (!fs9.existsSync(browserExecutablePath)) {
|
|
5048
5138
|
Log.warn({ indent, logLevel }, `Browser executable was specified as '${browserExecutablePath}' but the path doesn't exist.`);
|
|
5049
5139
|
}
|
|
5050
5140
|
return { path: browserExecutablePath, type: "user-defined-path" };
|
|
5051
5141
|
}
|
|
5052
5142
|
const revision = getRevisionInfo(chromeMode);
|
|
5053
|
-
if (revision.local &&
|
|
5143
|
+
if (revision.local && fs9.existsSync(revision.executablePath)) {
|
|
5054
5144
|
return { path: revision.executablePath, type: "local-puppeteer-browser" };
|
|
5055
5145
|
}
|
|
5056
5146
|
return { type: "no-browser" };
|
|
@@ -5102,10 +5192,10 @@ var getCpuCount = () => {
|
|
|
5102
5192
|
import { freemem } from "node:os";
|
|
5103
5193
|
|
|
5104
5194
|
// src/memory/from-docker-cgroup.ts
|
|
5105
|
-
import { readFileSync as
|
|
5195
|
+
import { readFileSync as readFileSync4 } from "node:fs";
|
|
5106
5196
|
var getMaxMemoryFromCgroupV2 = () => {
|
|
5107
5197
|
try {
|
|
5108
|
-
const data =
|
|
5198
|
+
const data = readFileSync4("/sys/fs/cgroup/memory.max", "utf-8");
|
|
5109
5199
|
if (data.trim() === "max") {
|
|
5110
5200
|
return Infinity;
|
|
5111
5201
|
}
|
|
@@ -5116,7 +5206,7 @@ var getMaxMemoryFromCgroupV2 = () => {
|
|
|
5116
5206
|
};
|
|
5117
5207
|
var getAvailableMemoryFromCgroupV2 = () => {
|
|
5118
5208
|
try {
|
|
5119
|
-
const data =
|
|
5209
|
+
const data = readFileSync4("/sys/fs/cgroup/memory.current", "utf-8");
|
|
5120
5210
|
return parseInt(data, 10);
|
|
5121
5211
|
} catch {
|
|
5122
5212
|
return null;
|
|
@@ -5124,7 +5214,7 @@ var getAvailableMemoryFromCgroupV2 = () => {
|
|
|
5124
5214
|
};
|
|
5125
5215
|
var getMaxMemoryFromCgroupV1 = () => {
|
|
5126
5216
|
try {
|
|
5127
|
-
const data =
|
|
5217
|
+
const data = readFileSync4("/sys/fs/cgroup/memory/memory.limit_in_bytes", "utf-8");
|
|
5128
5218
|
if (data.trim() === "max") {
|
|
5129
5219
|
return Infinity;
|
|
5130
5220
|
}
|
|
@@ -5135,7 +5225,7 @@ var getMaxMemoryFromCgroupV1 = () => {
|
|
|
5135
5225
|
};
|
|
5136
5226
|
var getAvailableMemoryFromCgroupV1 = () => {
|
|
5137
5227
|
try {
|
|
5138
|
-
const data =
|
|
5228
|
+
const data = readFileSync4("/sys/fs/cgroup/memory/memory.usage_in_bytes", "utf-8");
|
|
5139
5229
|
return parseInt(data, 10);
|
|
5140
5230
|
} catch {
|
|
5141
5231
|
return null;
|
|
@@ -5168,13 +5258,13 @@ var getMaxLambdaMemory = () => {
|
|
|
5168
5258
|
};
|
|
5169
5259
|
|
|
5170
5260
|
// src/memory/from-proc-meminfo.ts
|
|
5171
|
-
import { existsSync as existsSync3, readFileSync as
|
|
5261
|
+
import { existsSync as existsSync3, readFileSync as readFileSync5 } from "node:fs";
|
|
5172
5262
|
var getFreeMemoryFromProcMeminfo = (logLevel) => {
|
|
5173
5263
|
if (!existsSync3("/proc/meminfo")) {
|
|
5174
5264
|
return null;
|
|
5175
5265
|
}
|
|
5176
5266
|
try {
|
|
5177
|
-
const data =
|
|
5267
|
+
const data = readFileSync5("/proc/meminfo", "utf-8");
|
|
5178
5268
|
const lines = data.split(`
|
|
5179
5269
|
`);
|
|
5180
5270
|
const memAvailableLine = lines.find((line) => line.startsWith("MemAvailable"));
|
|
@@ -5338,7 +5428,7 @@ var internalOpenBrowser = async ({
|
|
|
5338
5428
|
if (chromiumOptions.userAgent) {
|
|
5339
5429
|
Log.verbose({ indent, logLevel, tag: "openBrowser()" }, `Using custom user agent: ${chromiumOptions.userAgent}`);
|
|
5340
5430
|
}
|
|
5341
|
-
const userDataDir = await
|
|
5431
|
+
const userDataDir = await fs10.promises.mkdtemp(path9.join(os4.tmpdir(), "puppeteer_dev_chrome_profile-"));
|
|
5342
5432
|
const browserInstance = await launchChrome({
|
|
5343
5433
|
executablePath,
|
|
5344
5434
|
logLevel,
|
|
@@ -5515,7 +5605,7 @@ import path19 from "node:path";
|
|
|
5515
5605
|
import { NoReactInternals as NoReactInternals7 } from "remotion/no-react";
|
|
5516
5606
|
|
|
5517
5607
|
// src/assets/download-and-map-assets-to-file.ts
|
|
5518
|
-
import
|
|
5608
|
+
import fs11 from "node:fs";
|
|
5519
5609
|
import path11, { extname as extname2 } from "node:path";
|
|
5520
5610
|
import { random } from "remotion/no-react";
|
|
5521
5611
|
|
|
@@ -14551,7 +14641,7 @@ var downloadAsset = async ({
|
|
|
14551
14641
|
const { downloadDir } = downloadMap;
|
|
14552
14642
|
if (downloadMap.hasBeenDownloadedMap[src]?.[downloadDir]) {
|
|
14553
14643
|
const claimedDownloadLocation = downloadMap.hasBeenDownloadedMap[src]?.[downloadDir];
|
|
14554
|
-
if (
|
|
14644
|
+
if (fs11.existsSync(claimedDownloadLocation)) {
|
|
14555
14645
|
return claimedDownloadLocation;
|
|
14556
14646
|
}
|
|
14557
14647
|
downloadMap.hasBeenDownloadedMap[src][downloadDir] = null;
|
|
@@ -14590,7 +14680,7 @@ var downloadAsset = async ({
|
|
|
14590
14680
|
});
|
|
14591
14681
|
ensureOutputDirectory(output);
|
|
14592
14682
|
const buff = Buffer.from(assetData, encoding);
|
|
14593
|
-
await
|
|
14683
|
+
await fs11.promises.writeFile(output, buff);
|
|
14594
14684
|
notifyAssetIsDownloaded({ src, downloadMap, downloadDir, to: output });
|
|
14595
14685
|
return output;
|
|
14596
14686
|
}
|
|
@@ -15171,8 +15261,8 @@ class OffthreadVideoServerEmitter {
|
|
|
15171
15261
|
}
|
|
15172
15262
|
|
|
15173
15263
|
// src/tmp-dir.ts
|
|
15174
|
-
import
|
|
15175
|
-
import
|
|
15264
|
+
import fs12, { mkdirSync } from "node:fs";
|
|
15265
|
+
import os5 from "node:os";
|
|
15176
15266
|
import path13 from "node:path";
|
|
15177
15267
|
var alphabet = "abcdefghijklmnopqrstuvwxyz0123456789";
|
|
15178
15268
|
var randomHash = () => {
|
|
@@ -15181,9 +15271,9 @@ var randomHash = () => {
|
|
|
15181
15271
|
}).join("");
|
|
15182
15272
|
};
|
|
15183
15273
|
var tmpDir = (str) => {
|
|
15184
|
-
const newDir = path13.join(
|
|
15185
|
-
if (
|
|
15186
|
-
|
|
15274
|
+
const newDir = path13.join(os5.tmpdir(), str + randomHash());
|
|
15275
|
+
if (fs12.existsSync(newDir)) {
|
|
15276
|
+
fs12.rmSync(newDir, {
|
|
15187
15277
|
recursive: true,
|
|
15188
15278
|
force: true
|
|
15189
15279
|
});
|
|
@@ -15193,7 +15283,7 @@ var tmpDir = (str) => {
|
|
|
15193
15283
|
};
|
|
15194
15284
|
|
|
15195
15285
|
// src/assets/inline-audio-mixing.ts
|
|
15196
|
-
import
|
|
15286
|
+
import fs13, { writeSync } from "node:fs";
|
|
15197
15287
|
import path14 from "node:path";
|
|
15198
15288
|
|
|
15199
15289
|
// src/sample-rate.ts
|
|
@@ -15259,7 +15349,7 @@ var makeInlineAudioMixing = (dir) => {
|
|
|
15259
15349
|
const cleanup = () => {
|
|
15260
15350
|
for (const fd of Object.values(openFiles)) {
|
|
15261
15351
|
try {
|
|
15262
|
-
|
|
15352
|
+
fs13.closeSync(fd);
|
|
15263
15353
|
} catch {}
|
|
15264
15354
|
}
|
|
15265
15355
|
deleteDirectory(folderToAdd);
|
|
@@ -15279,7 +15369,7 @@ var makeInlineAudioMixing = (dir) => {
|
|
|
15279
15369
|
}) => {
|
|
15280
15370
|
const filePath = getFilePath(asset);
|
|
15281
15371
|
if (!openFiles[filePath]) {
|
|
15282
|
-
openFiles[filePath] =
|
|
15372
|
+
openFiles[filePath] = fs13.openSync(filePath, "w");
|
|
15283
15373
|
}
|
|
15284
15374
|
if (writtenHeaders[filePath]) {
|
|
15285
15375
|
return;
|
|
@@ -15321,7 +15411,7 @@ var makeInlineAudioMixing = (dir) => {
|
|
|
15321
15411
|
binariesDirectory,
|
|
15322
15412
|
cancelSignal
|
|
15323
15413
|
});
|
|
15324
|
-
|
|
15414
|
+
fs13.renameSync(tmpFile, fd);
|
|
15325
15415
|
}
|
|
15326
15416
|
}
|
|
15327
15417
|
};
|
|
@@ -15598,13 +15688,13 @@ var makeRange = (from, to) => {
|
|
|
15598
15688
|
};
|
|
15599
15689
|
|
|
15600
15690
|
// src/port-config.ts
|
|
15601
|
-
import
|
|
15691
|
+
import os6 from "os";
|
|
15602
15692
|
var cached = null;
|
|
15603
15693
|
var getPortConfig = (preferIpv4) => {
|
|
15604
15694
|
if (cached) {
|
|
15605
15695
|
return cached;
|
|
15606
15696
|
}
|
|
15607
|
-
const networkInterfaces =
|
|
15697
|
+
const networkInterfaces = os6.networkInterfaces();
|
|
15608
15698
|
const flattened = flattenNetworkInterfaces(networkInterfaces);
|
|
15609
15699
|
const host = getHostToBind(flattened, preferIpv4);
|
|
15610
15700
|
const hostsToTry = getHostsToTry(flattened);
|
|
@@ -17384,7 +17474,7 @@ var validateSelectedPixelFormatAndCodecCombination = (pixelFormat, codec) => {
|
|
|
17384
17474
|
};
|
|
17385
17475
|
|
|
17386
17476
|
// src/render-frames.ts
|
|
17387
|
-
import
|
|
17477
|
+
import fs15 from "node:fs";
|
|
17388
17478
|
import path21 from "node:path";
|
|
17389
17479
|
import { NoReactInternals as NoReactInternals12 } from "remotion/no-react";
|
|
17390
17480
|
|
|
@@ -18301,7 +18391,7 @@ var onlyInlineAudio = (assets) => {
|
|
|
18301
18391
|
import * as assert2 from "node:assert";
|
|
18302
18392
|
|
|
18303
18393
|
// src/screenshot-task.ts
|
|
18304
|
-
import
|
|
18394
|
+
import fs14 from "node:fs";
|
|
18305
18395
|
var screenshotTask = async ({
|
|
18306
18396
|
format: format2,
|
|
18307
18397
|
height,
|
|
@@ -18362,7 +18452,7 @@ var screenshotTask = async ({
|
|
|
18362
18452
|
}
|
|
18363
18453
|
const buffer = Buffer.from(result.data, "base64");
|
|
18364
18454
|
if (path20) {
|
|
18365
|
-
await
|
|
18455
|
+
await fs14.promises.writeFile(path20, buffer);
|
|
18366
18456
|
}
|
|
18367
18457
|
return buffer;
|
|
18368
18458
|
} catch (err) {
|
|
@@ -19000,8 +19090,8 @@ var innerRenderFrames = async ({
|
|
|
19000
19090
|
darkMode
|
|
19001
19091
|
}) => {
|
|
19002
19092
|
if (outputDir) {
|
|
19003
|
-
if (!
|
|
19004
|
-
|
|
19093
|
+
if (!fs15.existsSync(outputDir)) {
|
|
19094
|
+
fs15.mkdirSync(outputDir, {
|
|
19005
19095
|
recursive: true
|
|
19006
19096
|
});
|
|
19007
19097
|
}
|
|
@@ -19432,8 +19522,8 @@ var renderFrames = (options) => {
|
|
|
19432
19522
|
|
|
19433
19523
|
// src/render-media.ts
|
|
19434
19524
|
import { LicensingInternals } from "@remotion/licensing";
|
|
19435
|
-
import
|
|
19436
|
-
import
|
|
19525
|
+
import fs17 from "node:fs";
|
|
19526
|
+
import os7 from "node:os";
|
|
19437
19527
|
import path26 from "node:path";
|
|
19438
19528
|
import { NoReactInternals as NoReactInternals15 } from "remotion/no-react";
|
|
19439
19529
|
|
|
@@ -20302,7 +20392,7 @@ var createFfmpegMergeFilter = ({
|
|
|
20302
20392
|
};
|
|
20303
20393
|
|
|
20304
20394
|
// src/ffmpeg-filter-file.ts
|
|
20305
|
-
import
|
|
20395
|
+
import fs16, { existsSync as existsSync5 } from "node:fs";
|
|
20306
20396
|
import path22 from "node:path";
|
|
20307
20397
|
var makeFfmpegFilterFile = (complexFilter, downloadMap) => {
|
|
20308
20398
|
if (complexFilter.filter === null) {
|
|
@@ -20319,13 +20409,13 @@ var makeFfmpegFilterFileStr = async (complexFilter, downloadMap) => {
|
|
|
20319
20409
|
const random2 = Math.random().toString().replace(".", "");
|
|
20320
20410
|
const filterFile = path22.join(downloadMap.complexFilter, "complex-filter-" + random2 + ".txt");
|
|
20321
20411
|
if (!existsSync5(downloadMap.complexFilter)) {
|
|
20322
|
-
|
|
20412
|
+
fs16.mkdirSync(downloadMap.complexFilter, { recursive: true });
|
|
20323
20413
|
}
|
|
20324
|
-
await
|
|
20414
|
+
await fs16.promises.writeFile(filterFile, complexFilter);
|
|
20325
20415
|
return {
|
|
20326
20416
|
file: filterFile,
|
|
20327
20417
|
cleanup: () => {
|
|
20328
|
-
|
|
20418
|
+
fs16.unlinkSync(filterFile);
|
|
20329
20419
|
}
|
|
20330
20420
|
};
|
|
20331
20421
|
};
|
|
@@ -21655,7 +21745,7 @@ var internalRenderMediaRaw = ({
|
|
|
21655
21745
|
}
|
|
21656
21746
|
const imageFormat = isAudioCodec(codec) ? "none" : provisionalImageFormat ?? compositionWithPossibleUnevenDimensions.defaultVideoImageFormat ?? DEFAULT_VIDEO_IMAGE_FORMAT;
|
|
21657
21747
|
validateSelectedPixelFormatAndImageFormatCombination(pixelFormat, imageFormat);
|
|
21658
|
-
const workingDir =
|
|
21748
|
+
const workingDir = fs17.mkdtempSync(path26.join(os7.tmpdir(), "react-motion-render"));
|
|
21659
21749
|
const preEncodedFileLocation = parallelEncoding ? path26.join(workingDir, "pre-encode." + getFileExtensionFromCodec(codec, audioCodec)) : null;
|
|
21660
21750
|
if (onCtrlCExit && workingDir) {
|
|
21661
21751
|
onCtrlCExit(`Delete ${workingDir}`, () => deleteDirectory(workingDir));
|
|
@@ -21980,10 +22070,10 @@ var internalRenderMediaRaw = ({
|
|
|
21980
22070
|
}
|
|
21981
22071
|
reject(err);
|
|
21982
22072
|
}).finally(() => {
|
|
21983
|
-
if (preEncodedFileLocation !== null &&
|
|
22073
|
+
if (preEncodedFileLocation !== null && fs17.existsSync(preEncodedFileLocation)) {
|
|
21984
22074
|
deleteDirectory(path26.dirname(preEncodedFileLocation));
|
|
21985
22075
|
}
|
|
21986
|
-
if (workingDir &&
|
|
22076
|
+
if (workingDir && fs17.existsSync(workingDir)) {
|
|
21987
22077
|
deleteDirectory(workingDir);
|
|
21988
22078
|
}
|
|
21989
22079
|
cleanupServerFn?.(false).catch((err) => {
|
|
@@ -22151,7 +22241,7 @@ var renderMedia = ({
|
|
|
22151
22241
|
|
|
22152
22242
|
// src/render-still.ts
|
|
22153
22243
|
import { LicensingInternals as LicensingInternals2 } from "@remotion/licensing";
|
|
22154
|
-
import
|
|
22244
|
+
import fs18, { statSync as statSync2 } from "node:fs";
|
|
22155
22245
|
import path27 from "node:path";
|
|
22156
22246
|
import { NoReactInternals as NoReactInternals16 } from "remotion/no-react";
|
|
22157
22247
|
var innerRenderStill = async ({
|
|
@@ -22205,7 +22295,7 @@ var innerRenderStill = async ({
|
|
|
22205
22295
|
output = typeof output === "string" ? path27.resolve(process.cwd(), output) : null;
|
|
22206
22296
|
validateJpegQuality(jpegQuality);
|
|
22207
22297
|
if (output) {
|
|
22208
|
-
if (
|
|
22298
|
+
if (fs18.existsSync(output)) {
|
|
22209
22299
|
if (!overwrite) {
|
|
22210
22300
|
throw new Error(`Cannot render still - "overwrite" option was set to false, but the output destination ${output} already exists.`);
|
|
22211
22301
|
}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"url": "https://github.com/remotion-dev/remotion/tree/main/packages/renderer"
|
|
4
4
|
},
|
|
5
5
|
"name": "@remotion/renderer",
|
|
6
|
-
"version": "4.0.
|
|
6
|
+
"version": "4.0.420",
|
|
7
7
|
"description": "Render Remotion videos using Node.js or Bun",
|
|
8
8
|
"main": "dist/index.js",
|
|
9
9
|
"types": "dist/index.d.ts",
|
|
@@ -23,11 +23,11 @@
|
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"execa": "5.1.1",
|
|
25
25
|
"extract-zip": "2.0.1",
|
|
26
|
-
"remotion": "4.0.
|
|
27
|
-
"@remotion/streaming": "4.0.
|
|
26
|
+
"remotion": "4.0.420",
|
|
27
|
+
"@remotion/streaming": "4.0.420",
|
|
28
28
|
"source-map": "^0.8.0-beta.0",
|
|
29
29
|
"ws": "8.17.1",
|
|
30
|
-
"@remotion/licensing": "4.0.
|
|
30
|
+
"@remotion/licensing": "4.0.420"
|
|
31
31
|
},
|
|
32
32
|
"peerDependencies": {
|
|
33
33
|
"react": ">=16.8.0",
|
|
@@ -41,19 +41,19 @@
|
|
|
41
41
|
"react-dom": "19.2.3",
|
|
42
42
|
"@typescript/native-preview": "7.0.0-dev.20260105.1",
|
|
43
43
|
"@types/ws": "8.5.10",
|
|
44
|
-
"@remotion/example-videos": "4.0.
|
|
45
|
-
"@remotion/eslint-config-internal": "4.0.
|
|
44
|
+
"@remotion/example-videos": "4.0.420",
|
|
45
|
+
"@remotion/eslint-config-internal": "4.0.420",
|
|
46
46
|
"eslint": "9.19.0",
|
|
47
47
|
"@types/node": "20.12.14"
|
|
48
48
|
},
|
|
49
49
|
"optionalDependencies": {
|
|
50
|
-
"@remotion/compositor-darwin-arm64": "4.0.
|
|
51
|
-
"@remotion/compositor-darwin-x64": "4.0.
|
|
52
|
-
"@remotion/compositor-linux-arm64-gnu": "4.0.
|
|
53
|
-
"@remotion/compositor-linux-arm64-musl": "4.0.
|
|
54
|
-
"@remotion/compositor-linux-x64-gnu": "4.0.
|
|
55
|
-
"@remotion/compositor-linux-x64-musl": "4.0.
|
|
56
|
-
"@remotion/compositor-win32-x64-msvc": "4.0.
|
|
50
|
+
"@remotion/compositor-darwin-arm64": "4.0.420",
|
|
51
|
+
"@remotion/compositor-darwin-x64": "4.0.420",
|
|
52
|
+
"@remotion/compositor-linux-arm64-gnu": "4.0.420",
|
|
53
|
+
"@remotion/compositor-linux-arm64-musl": "4.0.420",
|
|
54
|
+
"@remotion/compositor-linux-x64-gnu": "4.0.420",
|
|
55
|
+
"@remotion/compositor-linux-x64-musl": "4.0.420",
|
|
56
|
+
"@remotion/compositor-win32-x64-msvc": "4.0.420"
|
|
57
57
|
},
|
|
58
58
|
"keywords": [
|
|
59
59
|
"remotion",
|