@remotion/renderer 4.0.0-alpha5 → 4.0.0-alpha7

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 (121) hide show
  1. package/dist/assets/download-and-map-assets-to-file.js +6 -6
  2. package/dist/assets/download-file.d.ts +3 -2
  3. package/dist/assets/download-file.js +18 -3
  4. package/dist/assets/download-map.js +7 -7
  5. package/dist/assets/read-file.d.ts +1 -1
  6. package/dist/assets/read-file.js +2 -2
  7. package/dist/assets/sanitize-filepath.js +2 -2
  8. package/dist/browser/BrowserFetcher.js +13 -13
  9. package/dist/browser/BrowserRunner.d.ts +1 -1
  10. package/dist/browser/BrowserRunner.js +9 -22
  11. package/dist/browser/LaunchOptions.d.ts +1 -2
  12. package/dist/browser/Launcher.js +7 -15
  13. package/dist/browser/NodeWebSocketTransport.js +4 -4
  14. package/dist/browser/get-download-destination.js +8 -8
  15. package/dist/call-ffmpeg.js +8 -3
  16. package/dist/chalk/index.d.ts +54 -0
  17. package/dist/chalk/index.js +135 -0
  18. package/dist/chalk/is-color-supported.d.ts +1 -0
  19. package/dist/chalk/is-color-supported.js +37 -0
  20. package/dist/client.d.ts +41 -41
  21. package/dist/combine-videos.js +6 -6
  22. package/dist/compositor/compose.js +12 -7
  23. package/dist/compositor/compositor.d.ts +2 -2
  24. package/dist/compositor/compositor.js +13 -8
  25. package/dist/compositor/get-executable-path.js +1 -10
  26. package/dist/create-ffmpeg-complex-filter.d.ts +1 -4
  27. package/dist/delete-directory.js +3 -3
  28. package/dist/does-have-m2-bug.js +2 -2
  29. package/dist/ensure-output-directory.js +5 -5
  30. package/dist/ffmpeg-filter-file.js +7 -7
  31. package/dist/find-closest-package-json.js +6 -6
  32. package/dist/get-compositions.d.ts +4 -0
  33. package/dist/get-compositions.js +2 -1
  34. package/dist/get-concurrency.js +3 -3
  35. package/dist/get-extension-from-codec.d.ts +2 -2
  36. package/dist/get-extension-of-filename.js +2 -2
  37. package/dist/get-local-browser-executable.js +4 -4
  38. package/dist/get-video-threads-flag.js +3 -3
  39. package/dist/index.d.ts +111 -36
  40. package/dist/index.js +9 -0
  41. package/dist/logger.d.ts +22 -0
  42. package/dist/logger.js +61 -0
  43. package/dist/merge-audio-track.js +2 -2
  44. package/dist/mime-types.js +2 -2
  45. package/dist/offthread-video-server.d.ts +3 -2
  46. package/dist/offthread-video-server.js +4 -4
  47. package/dist/open-browser.d.ts +1 -1
  48. package/dist/open-browser.js +1 -1
  49. package/dist/options/jpeg-quality.js +1 -1
  50. package/dist/prepare-server.d.ts +2 -1
  51. package/dist/prepare-server.js +7 -5
  52. package/dist/prespawn-ffmpeg.d.ts +1 -0
  53. package/dist/prespawn-ffmpeg.js +37 -14
  54. package/dist/prestitcher-memory-usage.js +2 -2
  55. package/dist/provide-screenshot.d.ts +1 -0
  56. package/dist/puppeteer-screenshot.d.ts +1 -0
  57. package/dist/puppeteer-screenshot.js +1 -1
  58. package/dist/render-frames.d.ts +4 -0
  59. package/dist/render-frames.js +9 -7
  60. package/dist/render-media.d.ts +4 -1
  61. package/dist/render-media.js +47 -26
  62. package/dist/render-still.d.ts +6 -0
  63. package/dist/render-still.js +20 -7
  64. package/dist/resolve-asset-src.js +2 -2
  65. package/dist/screenshot-dom-element.d.ts +1 -0
  66. package/dist/screenshot-task.d.ts +1 -0
  67. package/dist/screenshot-task.js +2 -2
  68. package/dist/serve-handler/index.d.ts +1 -1
  69. package/dist/serve-handler/index.js +15 -15
  70. package/dist/serve-handler/is-path-inside.js +3 -3
  71. package/dist/serve-static.d.ts +1 -0
  72. package/dist/serve-static.js +3 -2
  73. package/dist/stitch-frames-to-video.d.ts +2 -0
  74. package/dist/stitch-frames-to-video.js +62 -39
  75. package/dist/take-frame-and-compose.d.ts +1 -0
  76. package/dist/take-frame-and-compose.js +6 -6
  77. package/dist/tmp-dir.js +7 -7
  78. package/dist/validate-output-filename.d.ts +1 -1
  79. package/install-toolchain.mjs +2 -2
  80. package/package.json +9 -9
  81. package/types/ws/index.d.ts +5 -5
  82. package/dist/assets/get-video-stream-duration.d.ts +0 -9
  83. package/dist/assets/get-video-stream-duration.js +0 -71
  84. package/dist/calculate-sar-dar-pixels.d.ts +0 -9
  85. package/dist/calculate-sar-dar-pixels.js +0 -19
  86. package/dist/determine-resize-params.d.ts +0 -1
  87. package/dist/determine-resize-params.js +0 -10
  88. package/dist/determine-vcodec-ffmpeg-flags.d.ts +0 -2
  89. package/dist/determine-vcodec-ffmpeg-flags.js +0 -13
  90. package/dist/ensure-ffmpeg.d.ts +0 -18
  91. package/dist/ensure-ffmpeg.js +0 -58
  92. package/dist/ensure-presentation-timestamp.d.ts +0 -15
  93. package/dist/ensure-presentation-timestamp.js +0 -88
  94. package/dist/extract-frame-from-video.d.ts +0 -17
  95. package/dist/extract-frame-from-video.js +0 -191
  96. package/dist/ffmpeg-executable.d.ts +0 -1
  97. package/dist/ffmpeg-executable.js +0 -2
  98. package/dist/ffmpeg-flags.d.ts +0 -31
  99. package/dist/ffmpeg-flags.js +0 -245
  100. package/dist/frame-to-ffmpeg-timestamp.d.ts +0 -1
  101. package/dist/frame-to-ffmpeg-timestamp.js +0 -8
  102. package/dist/get-can-extract-frames-fast.d.ts +0 -14
  103. package/dist/get-can-extract-frames-fast.js +0 -71
  104. package/dist/get-frame-of-video-slow.d.ts +0 -15
  105. package/dist/get-frame-of-video-slow.js +0 -72
  106. package/dist/get-video-info.d.ts +0 -8
  107. package/dist/get-video-info.js +0 -59
  108. package/dist/is-beyond-last-frame.d.ts +0 -3
  109. package/dist/is-beyond-last-frame.js +0 -12
  110. package/dist/last-frame-from-video-cache.d.ts +0 -18
  111. package/dist/last-frame-from-video-cache.js +0 -55
  112. package/dist/legacy-webpack-config.d.ts +0 -9
  113. package/dist/legacy-webpack-config.js +0 -13
  114. package/dist/quality.d.ts +0 -1
  115. package/dist/quality.js +0 -21
  116. package/dist/try-to-extract-frame-of-video-fast.d.ts +0 -13
  117. package/dist/try-to-extract-frame-of-video-fast.js +0 -55
  118. package/dist/validate-ffmpeg.d.ts +0 -7
  119. package/dist/validate-ffmpeg.js +0 -77
  120. package/dist/warn-about-ffmpeg-version.d.ts +0 -5
  121. package/dist/warn-about-ffmpeg-version.js +0 -37
@@ -27,8 +27,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.downloadAndMapAssetsToFileUrl = exports.getSanitizedFilenameForAssetUrl = exports.markAllAssetsAsDownloaded = exports.downloadAsset = void 0;
30
- const fs_1 = __importDefault(require("fs"));
31
- const path_1 = __importStar(require("path"));
30
+ const node_fs_1 = __importDefault(require("node:fs"));
31
+ const node_path_1 = __importStar(require("node:path"));
32
32
  const remotion_1 = require("remotion");
33
33
  const compress_assets_1 = require("../compress-assets");
34
34
  const ensure_output_directory_1 = require("../ensure-output-directory");
@@ -124,7 +124,7 @@ const downloadAsset = async ({ src, onDownload, downloadMap, }) => {
124
124
  if ((_a = downloadMap.hasBeenDownloadedMap[src]) === null || _a === void 0 ? void 0 : _a[downloadDir]) {
125
125
  const claimedDownloadLocation = (_b = downloadMap.hasBeenDownloadedMap[src]) === null || _b === void 0 ? void 0 : _b[downloadDir];
126
126
  // The OS might have deleted the file since even though we marked it as downloaded. In that case we reset the state and download it again
127
- if (fs_1.default.existsSync(claimedDownloadLocation)) {
127
+ if (node_fs_1.default.existsSync(claimedDownloadLocation)) {
128
128
  return claimedDownloadLocation;
129
129
  }
130
130
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
@@ -168,7 +168,7 @@ const downloadAsset = async ({ src, onDownload, downloadMap, }) => {
168
168
  });
169
169
  (0, ensure_output_directory_1.ensureOutputDirectory)(output);
170
170
  const buff = Buffer.from(assetData, encoding);
171
- await fs_1.default.promises.writeFile(output, buff);
171
+ await node_fs_1.default.promises.writeFile(output, buff);
172
172
  notifyAssetIsDownloaded({ src, downloadMap, downloadDir, to: output });
173
173
  return output;
174
174
  }
@@ -212,7 +212,7 @@ const getFilename = ({ contentDisposition, src, contentType, }) => {
212
212
  };
213
213
  }
214
214
  const { pathname, search } = new URL(src);
215
- const ext = (0, path_1.extname)(pathname);
215
+ const ext = (0, node_path_1.extname)(pathname);
216
216
  // Has no file extension, check if we can derive it from contentType
217
217
  if (!ext && contentType) {
218
218
  const matchedExt = (0, mime_types_1.getExt)(contentType);
@@ -238,7 +238,7 @@ const getSanitizedFilenameForAssetUrl = ({ src, downloadDir, contentDisposition,
238
238
  : '';
239
239
  const hashedFileName = String((0, remotion_1.random)(`${pathname}${search}`)).replace('0.', '');
240
240
  const filename = hashedFileName + fileExtension;
241
- return path_1.default.join(downloadDir, (0, sanitize_filepath_1.sanitizeFilePath)(filename));
241
+ return node_path_1.default.join(downloadDir, (0, sanitize_filepath_1.sanitizeFilePath)(filename));
242
242
  };
243
243
  exports.getSanitizedFilenameForAssetUrl = getSanitizedFilenameForAssetUrl;
244
244
  const downloadAndMapAssetsToFileUrl = async ({ asset, onDownload, downloadMap, }) => {
@@ -2,7 +2,7 @@ declare type Response = {
2
2
  sizeInBytes: number;
3
3
  to: string;
4
4
  };
5
- export declare const downloadFile: ({ onProgress, url, to: toFn, }: {
5
+ declare type Options = {
6
6
  url: string;
7
7
  to: (contentDisposition: string | null, contentType: string | null) => string;
8
8
  onProgress: ((progress: {
@@ -10,5 +10,6 @@ export declare const downloadFile: ({ onProgress, url, to: toFn, }: {
10
10
  downloaded: number;
11
11
  totalSize: number | null;
12
12
  }) => void) | undefined;
13
- }) => Promise<Response>;
13
+ };
14
+ export declare const downloadFile: (options: Options, retries?: number) => Promise<Response>;
14
15
  export {};
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.downloadFile = void 0;
4
- const fs_1 = require("fs");
4
+ const node_fs_1 = require("node:fs");
5
5
  const ensure_output_directory_1 = require("../ensure-output-directory");
6
6
  const read_file_1 = require("./read-file");
7
- const downloadFile = ({ onProgress, url, to: toFn, }) => {
7
+ const downloadFileWithoutRetries = ({ onProgress, url, to: toFn }) => {
8
8
  return new Promise((resolve, reject) => {
9
9
  let rejected = false;
10
10
  let resolved = false;
@@ -44,7 +44,7 @@ const downloadFile = ({ onProgress, url, to: toFn, }) => {
44
44
  (0, ensure_output_directory_1.ensureOutputDirectory)(to);
45
45
  const sizeHeader = res.headers['content-length'];
46
46
  const totalSize = typeof sizeHeader === 'undefined' ? null : Number(sizeHeader);
47
- const writeStream = (0, fs_1.createWriteStream)(to);
47
+ const writeStream = (0, node_fs_1.createWriteStream)(to);
48
48
  let downloaded = 0;
49
49
  // Listen to 'close' event instead of more
50
50
  // concise method to avoid this problem
@@ -86,4 +86,19 @@ const downloadFile = ({ onProgress, url, to: toFn, }) => {
86
86
  });
87
87
  });
88
88
  };
89
+ const downloadFile = async (options, retries = 2) => {
90
+ try {
91
+ const res = await downloadFileWithoutRetries(options);
92
+ return res;
93
+ }
94
+ catch (err) {
95
+ if (err.message === 'aborted') {
96
+ if (retries === 0) {
97
+ throw err;
98
+ }
99
+ return (0, exports.downloadFile)(options, retries - 1);
100
+ }
101
+ throw err;
102
+ }
103
+ };
89
104
  exports.downloadFile = downloadFile;
@@ -27,18 +27,18 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.cleanDownloadMap = exports.makeDownloadMap = void 0;
30
- const fs_1 = __importStar(require("fs"));
31
- const path_1 = __importDefault(require("path"));
30
+ const node_fs_1 = __importStar(require("node:fs"));
31
+ const node_path_1 = __importDefault(require("node:path"));
32
32
  const delete_directory_1 = require("../delete-directory");
33
33
  const tmp_dir_1 = require("../tmp-dir");
34
34
  const makeAndReturn = (dir, name) => {
35
- const p = path_1.default.join(dir, name);
36
- (0, fs_1.mkdirSync)(p);
35
+ const p = node_path_1.default.join(dir, name);
36
+ (0, node_fs_1.mkdirSync)(p);
37
37
  return p;
38
38
  };
39
- const packageJsonPath = path_1.default.join(__dirname, '..', '..', 'package.json');
40
- const packageJson = fs_1.default.existsSync(packageJsonPath)
41
- ? JSON.parse(fs_1.default.readFileSync(packageJsonPath, 'utf-8'))
39
+ const packageJsonPath = node_path_1.default.join(__dirname, '..', '..', 'package.json');
40
+ const packageJson = node_fs_1.default.existsSync(packageJsonPath)
41
+ ? JSON.parse(node_fs_1.default.readFileSync(packageJsonPath, 'utf-8'))
42
42
  : null;
43
43
  const makeDownloadMap = () => {
44
44
  const dir = (0, tmp_dir_1.tmpDir)(packageJson
@@ -1,2 +1,2 @@
1
- import http from 'http';
1
+ import http from 'node:http';
2
2
  export declare const readFile: (url: string, redirectsSoFar?: number) => Promise<http.IncomingMessage>;
@@ -4,15 +4,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.readFile = void 0;
7
- const http_1 = __importDefault(require("http"));
8
7
  const https_1 = __importDefault(require("https"));
8
+ const node_http_1 = __importDefault(require("node:http"));
9
9
  const redirect_status_codes_1 = require("../redirect-status-codes");
10
10
  const getClient = (url) => {
11
11
  if (url.startsWith('https://')) {
12
12
  return https_1.default.get;
13
13
  }
14
14
  if (url.startsWith('http://')) {
15
- return http_1.default.get;
15
+ return node_http_1.default.get;
16
16
  }
17
17
  throw new Error('Can only download URLs starting with http:// or https://');
18
18
  };
@@ -4,13 +4,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.sanitizeFilePath = void 0;
7
- const path_1 = __importDefault(require("path"));
7
+ const node_path_1 = __importDefault(require("node:path"));
8
8
  const sanitize_filename_1 = require("./sanitize-filename");
9
9
  const pathSeparators = /[/\\]/;
10
10
  const sanitizeFilePath = (pathToSanitize) => {
11
11
  return pathToSanitize
12
12
  .split(pathSeparators)
13
13
  .map((s) => (0, sanitize_filename_1.sanitizeFilename)(s))
14
- .join(path_1.default.sep);
14
+ .join(node_path_1.default.sep);
15
15
  };
16
16
  exports.sanitizeFilePath = sanitizeFilePath;
@@ -42,16 +42,16 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
42
42
  };
43
43
  Object.defineProperty(exports, "__esModule", { value: true });
44
44
  exports.getRevisionInfo = exports.getFolderPath = exports.removeBrowser = exports.localRevisions = exports.download = exports.getDownloadHost = exports.getDownloadsFolder = exports.getPlatform = void 0;
45
- const childProcess = __importStar(require("child_process"));
46
- const fs = __importStar(require("fs"));
47
- const http = __importStar(require("http"));
48
45
  const https = __importStar(require("https"));
49
- const os = __importStar(require("os"));
50
- const path = __importStar(require("path"));
51
- const util_1 = __importDefault(require("util"));
46
+ const childProcess = __importStar(require("node:child_process"));
47
+ const fs = __importStar(require("node:fs"));
48
+ const http = __importStar(require("node:http"));
49
+ const os = __importStar(require("node:os"));
50
+ const path = __importStar(require("node:path"));
51
+ const node_util_1 = __importDefault(require("node:util"));
52
52
  const extract_zip_1 = __importDefault(require("extract-zip"));
53
- const URL = __importStar(require("url"));
54
- const util_2 = require("util");
53
+ const URL = __importStar(require("node:url"));
54
+ const node_util_2 = require("node:util");
55
55
  const assert_1 = require("./assert");
56
56
  const delete_directory_1 = require("../delete-directory");
57
57
  const get_download_destination_1 = require("./get-download-destination");
@@ -109,7 +109,7 @@ function _downloadURL(product, platform, host, revision) {
109
109
  if (platform === 'win64' || platform === 'win32') {
110
110
  return 'https://remotionchromium-binaries.s3.eu-central-1.amazonaws.com/thorium-107.zip';
111
111
  }
112
- return util_1.default.format(downloadURLs[product][platform], host, revision, archiveName(product, platform, revision));
112
+ return node_util_1.default.format(downloadURLs[product][platform], host, revision, archiveName(product, platform, revision));
113
113
  }
114
114
  function handleArm64() {
115
115
  let exists = fs.existsSync('/usr/bin/chromium-browser');
@@ -126,10 +126,10 @@ function handleArm64() {
126
126
  '\n\n sudo apt install chromium-browser\n');
127
127
  throw new Error();
128
128
  }
129
- const readdirAsync = (0, util_2.promisify)(fs.readdir.bind(fs));
130
- const mkdirAsync = (0, util_2.promisify)(fs.mkdir.bind(fs));
131
- const unlinkAsync = (0, util_2.promisify)(fs.unlink.bind(fs));
132
- const chmodAsync = (0, util_2.promisify)(fs.chmod.bind(fs));
129
+ const readdirAsync = (0, node_util_2.promisify)(fs.readdir.bind(fs));
130
+ const mkdirAsync = (0, node_util_2.promisify)(fs.mkdir.bind(fs));
131
+ const unlinkAsync = (0, node_util_2.promisify)(fs.unlink.bind(fs));
132
+ const chmodAsync = (0, node_util_2.promisify)(fs.chmod.bind(fs));
133
133
  function existsAsync(filePath) {
134
134
  return new Promise((resolve) => {
135
135
  fs.access(filePath, (err) => {
@@ -14,7 +14,7 @@
14
14
  * limitations under the License.
15
15
  */
16
16
  /// <reference types="node" />
17
- import * as childProcess from 'child_process';
17
+ import * as childProcess from 'node:child_process';
18
18
  import { Connection } from './Connection';
19
19
  import type { LaunchOptions } from './LaunchOptions';
20
20
  export declare class BrowserRunner {
@@ -51,10 +51,11 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
51
51
  var _BrowserRunner_executablePath, _BrowserRunner_processArguments, _BrowserRunner_userDataDir, _BrowserRunner_closed, _BrowserRunner_listeners, _BrowserRunner_processClosing;
52
52
  Object.defineProperty(exports, "__esModule", { value: true });
53
53
  exports.BrowserRunner = void 0;
54
- const childProcess = __importStar(require("child_process"));
55
- const fs = __importStar(require("fs"));
54
+ const childProcess = __importStar(require("node:child_process"));
55
+ const fs = __importStar(require("node:fs"));
56
56
  const readline = __importStar(require("readline"));
57
57
  const delete_directory_1 = require("../delete-directory");
58
+ const logger_1 = require("../logger");
58
59
  const assert_1 = require("./assert");
59
60
  const Connection_1 = require("./Connection");
60
61
  const Errors_1 = require("./Errors");
@@ -78,22 +79,10 @@ class BrowserRunner {
78
79
  }
79
80
  start(options) {
80
81
  var _a, _b;
81
- const { dumpio, env, pipe } = options;
82
- let stdio;
83
- if (pipe) {
84
- if (dumpio) {
85
- stdio = ['ignore', 'pipe', 'pipe', 'pipe', 'pipe'];
86
- }
87
- else {
88
- stdio = ['ignore', 'ignore', 'ignore', 'pipe', 'pipe'];
89
- }
90
- }
91
- else if (dumpio) {
92
- stdio = ['pipe', 'pipe', 'pipe'];
93
- }
94
- else {
95
- stdio = ['pipe', 'ignore', 'pipe'];
96
- }
82
+ const { dumpio, env } = options;
83
+ const stdio = dumpio
84
+ ? ['ignore', 'pipe', 'pipe']
85
+ : ['pipe', 'ignore', 'pipe'];
97
86
  (0, assert_1.assert)(!this.proc, 'This process has previously been started.');
98
87
  this.proc = childProcess.spawn(__classPrivateFieldGet(this, _BrowserRunner_executablePath, "f"), __classPrivateFieldGet(this, _BrowserRunner_processArguments, "f"), {
99
88
  // On non-windows platforms, `detached: true` makes child process a
@@ -106,12 +95,10 @@ class BrowserRunner {
106
95
  });
107
96
  if (dumpio) {
108
97
  (_a = this.proc.stdout) === null || _a === void 0 ? void 0 : _a.on('data', (d) => {
109
- process.stdout.write(options.indentationString);
110
- process.stdout.write(d.toString().trimStart());
98
+ logger_1.Log.verboseAdvanced({ indent: options.indent, logLevel: (0, logger_1.getLogLevel)(), tag: 'chrome' }, d.toString().trim());
111
99
  });
112
100
  (_b = this.proc.stderr) === null || _b === void 0 ? void 0 : _b.on('data', (d) => {
113
- process.stderr.write(options.indentationString);
114
- process.stderr.write(d.toString().trimStart());
101
+ logger_1.Log.verboseAdvanced({ indent: options.indent, logLevel: (0, logger_1.getLogLevel)(), tag: 'chrome' }, d.toString().trim());
115
102
  });
116
103
  }
117
104
  __classPrivateFieldSet(this, _BrowserRunner_closed, false, "f");
@@ -27,8 +27,7 @@ export interface LaunchOptions {
27
27
  timeout?: number;
28
28
  dumpio?: boolean;
29
29
  env?: Record<string, string | undefined>;
30
- pipe?: boolean;
31
30
  product?: Product;
32
- indentationString: string;
31
+ indent: boolean;
33
32
  }
34
33
  export declare type PuppeteerNodeLaunchOptions = BrowserLaunchArgumentOptions & LaunchOptions & BrowserConnectOptions;
@@ -42,10 +42,9 @@ exports.ChromeLauncher = void 0;
42
42
  * See the License for the specific language governing permissions and
43
43
  * limitations under the License.
44
44
  */
45
- const fs_1 = __importDefault(require("fs"));
46
- const os = __importStar(require("os"));
47
- const path = __importStar(require("path"));
48
- const assert_1 = require("./assert");
45
+ const node_fs_1 = __importDefault(require("node:fs"));
46
+ const os = __importStar(require("node:os"));
47
+ const path = __importStar(require("node:path"));
49
48
  const Browser_1 = require("./Browser");
50
49
  const BrowserRunner_1 = require("./BrowserRunner");
51
50
  const BrowserFetcher_1 = require("./BrowserFetcher");
@@ -57,22 +56,16 @@ class ChromeLauncher {
57
56
  this._preferredRevision = preferredRevision;
58
57
  }
59
58
  async launch(options) {
60
- const { args = [], dumpio = false, executablePath, pipe = false, env = process.env, defaultViewport, timeout = 60000, debuggingPort, indentationString, } = options;
59
+ const { args = [], dumpio = false, executablePath, env = process.env, defaultViewport, timeout = 60000, debuggingPort, indent, } = options;
61
60
  const chromeArguments = args;
62
61
  if (!chromeArguments.some((argument) => {
63
62
  return argument.startsWith('--remote-debugging-');
64
63
  })) {
65
- if (pipe) {
66
- (0, assert_1.assert)(!debuggingPort, 'Browser should be launched with either pipe or debugging port - not both.');
67
- chromeArguments.push('--remote-debugging-pipe');
68
- }
69
- else {
70
- chromeArguments.push(`--remote-debugging-port=${debuggingPort || 0}`);
71
- }
64
+ chromeArguments.push(`--remote-debugging-port=${debuggingPort || 0}`);
72
65
  }
73
66
  // Check for the user data dir argument, which will always be set even
74
67
  // with a custom directory specified via the userDataDir option.
75
- const userDataDir = await fs_1.default.promises.mkdtemp(path.join(tmpDir(), 'puppeteer_dev_chrome_profile-'));
68
+ const userDataDir = await node_fs_1.default.promises.mkdtemp(path.join(tmpDir(), 'puppeteer_dev_chrome_profile-'));
76
69
  chromeArguments.push(`--user-data-dir=${userDataDir}`);
77
70
  let chromeExecutable = executablePath;
78
71
  if (!chromeExecutable) {
@@ -90,8 +83,7 @@ class ChromeLauncher {
90
83
  runner.start({
91
84
  dumpio,
92
85
  env,
93
- pipe: false,
94
- indentationString,
86
+ indent,
95
87
  });
96
88
  let browser;
97
89
  try {
@@ -28,8 +28,8 @@ exports.NodeWebSocketTransport = void 0;
28
28
  * See the License for the specific language governing permissions and
29
29
  * limitations under the License.
30
30
  */
31
- const dns_1 = require("dns");
32
- const url_1 = require("url");
31
+ const node_dns_1 = require("node:dns");
32
+ const node_url_1 = require("node:url");
33
33
  const ws_types_1 = require("../ws/ws-types");
34
34
  class NodeWebSocketTransport {
35
35
  constructor(ws) {
@@ -56,9 +56,9 @@ class NodeWebSocketTransport {
56
56
  // manually with the previous behavior according to:
57
57
  // - https://nodejs.org/api/dns.html#dnslookuphostname-options-callback
58
58
  // because of https://bugzilla.mozilla.org/show_bug.cgi?id=1769994.
59
- const url = new url_1.URL(urlString);
59
+ const url = new node_url_1.URL(urlString);
60
60
  if (url.hostname === 'localhost') {
61
- const { address } = await dns_1.promises.lookup(url.hostname, { verbatim: false });
61
+ const { address } = await node_dns_1.promises.lookup(url.hostname, { verbatim: false });
62
62
  url.hostname = address;
63
63
  }
64
64
  return new Promise((resolve, reject) => {
@@ -4,20 +4,20 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getDownloadsCacheDir = void 0;
7
- const fs_1 = __importDefault(require("fs"));
8
- const path_1 = __importDefault(require("path"));
7
+ const node_fs_1 = __importDefault(require("node:fs"));
8
+ const node_path_1 = __importDefault(require("node:path"));
9
9
  const getDownloadsCacheDir = () => {
10
10
  const cwd = process.cwd();
11
11
  let dir = cwd;
12
12
  for (;;) {
13
13
  try {
14
- if (fs_1.default.statSync(path_1.default.join(dir, 'package.json')).isFile()) {
14
+ if (node_fs_1.default.statSync(node_path_1.default.join(dir, 'package.json')).isFile()) {
15
15
  break;
16
16
  }
17
17
  // eslint-disable-next-line no-empty
18
18
  }
19
19
  catch (e) { }
20
- const parent = path_1.default.dirname(dir);
20
+ const parent = node_path_1.default.dirname(dir);
21
21
  if (dir === parent) {
22
22
  dir = undefined;
23
23
  break;
@@ -25,14 +25,14 @@ const getDownloadsCacheDir = () => {
25
25
  dir = parent;
26
26
  }
27
27
  if (!dir) {
28
- return path_1.default.resolve(cwd, '.remotion');
28
+ return node_path_1.default.resolve(cwd, '.remotion');
29
29
  }
30
30
  if (process.versions.pnp === '1') {
31
- return path_1.default.resolve(dir, '.pnp/.remotion');
31
+ return node_path_1.default.resolve(dir, '.pnp/.remotion');
32
32
  }
33
33
  if (process.versions.pnp === '3') {
34
- return path_1.default.resolve(dir, '.yarn/.remotion');
34
+ return node_path_1.default.resolve(dir, '.yarn/.remotion');
35
35
  }
36
- return path_1.default.resolve(dir, 'node_modules/.remotion');
36
+ return node_path_1.default.resolve(dir, 'node_modules/.remotion');
37
37
  };
38
38
  exports.getDownloadsCacheDir = getDownloadsCacheDir;
@@ -5,11 +5,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.callFf = exports.dynamicLibraryPathOptions = void 0;
7
7
  const execa_1 = __importDefault(require("execa"));
8
- const path_1 = __importDefault(require("path"));
8
+ const node_fs_1 = require("node:fs");
9
+ const node_path_1 = __importDefault(require("node:path"));
9
10
  const get_executable_path_1 = require("./compositor/get-executable-path");
10
11
  const truthy_1 = require("./truthy");
11
12
  const dynamicLibraryPathOptions = () => {
12
- const lib = path_1.default.join((0, get_executable_path_1.getExecutablePath)('ffmpeg-cwd'), 'remotion', 'lib');
13
+ const lib = node_path_1.default.join((0, get_executable_path_1.getExecutablePath)('ffmpeg-cwd'), 'remotion', 'lib');
13
14
  return {
14
15
  env: {
15
16
  RUST_BACKTRACE: 'full',
@@ -29,7 +30,11 @@ const dynamicLibraryPathOptions = () => {
29
30
  };
30
31
  exports.dynamicLibraryPathOptions = dynamicLibraryPathOptions;
31
32
  const callFf = (bin, args, options) => {
32
- return (0, execa_1.default)((0, get_executable_path_1.getExecutablePath)(bin), args.filter(truthy_1.truthy), {
33
+ const executablePath = (0, get_executable_path_1.getExecutablePath)(bin);
34
+ if (!process.env.READ_ONLY_FS) {
35
+ (0, node_fs_1.chmodSync)(executablePath, 0o755);
36
+ }
37
+ return (0, execa_1.default)(executablePath, args.filter(truthy_1.truthy), {
33
38
  ...(0, exports.dynamicLibraryPathOptions)(),
34
39
  ...options,
35
40
  });
@@ -0,0 +1,54 @@
1
+ declare type Style = {
2
+ codes: [number, number];
3
+ name: string;
4
+ wrap?: (input: string, newline: boolean) => string;
5
+ };
6
+ declare type Method = (str: string) => string;
7
+ declare type Colors = {
8
+ enabled: boolean;
9
+ visible: boolean;
10
+ styles: Record<string, Style>;
11
+ keys: Record<string, string[]>;
12
+ alias?: (name: string, col: string) => void;
13
+ };
14
+ declare type ColorsWithMethods = Colors & {
15
+ reset: Method;
16
+ bold: Method;
17
+ dim: Method;
18
+ italic: Method;
19
+ underline: Method;
20
+ inverse: Method;
21
+ hidden: Method;
22
+ strikethrough: Method;
23
+ black: Method;
24
+ red: Method;
25
+ green: Method;
26
+ yellow: Method;
27
+ blue: Method;
28
+ magenta: Method;
29
+ white: Method;
30
+ gray: Method;
31
+ bgBlack: Method;
32
+ bgRed: Method;
33
+ bgGreen: Method;
34
+ bgYellow: Method;
35
+ bgBlue: Method;
36
+ bgMagenta: Method;
37
+ bgWhite: Method;
38
+ blackBright: Method;
39
+ redBright: Method;
40
+ greenBright: Method;
41
+ yellowBright: Method;
42
+ blueBright: Method;
43
+ magentaBright: Method;
44
+ whiteBright: Method;
45
+ bgBlackBright: Method;
46
+ bgRedBright: Method;
47
+ bgGreenBright: Method;
48
+ bgYellowBright: Method;
49
+ bgBlueBright: Method;
50
+ bgMagentaBright: Method;
51
+ bgWhiteBright: Method;
52
+ };
53
+ export declare const chalk: ColorsWithMethods;
54
+ export {};
@@ -0,0 +1,135 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.chalk = void 0;
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
+ exports.chalk = (() => {
12
+ const colors = {
13
+ enabled: hasColor(),
14
+ visible: true,
15
+ styles: {},
16
+ keys: {},
17
+ };
18
+ const ansi = (st) => {
19
+ const open = `\u001b[${st.codes[0]}m`;
20
+ const close = `\u001b[${st.codes[1]}m`;
21
+ const regex = new RegExp(`\\u001b\\[${st.codes[1]}m`, 'g');
22
+ st.wrap = (input, newline) => {
23
+ if (input.includes(close))
24
+ input = input.replace(regex, close + open);
25
+ const output = open + input + close;
26
+ // see https://github.com/chalk/chalk/pull/92, thanks to the
27
+ // chalk contributors for this fix. However, we've confirmed that
28
+ // this issue is also present in Windows terminals
29
+ return newline ? output.replace(/\r*\n/g, `${close}$&${open}`) : output;
30
+ };
31
+ return st;
32
+ };
33
+ const wrap = (sty, input, newline) => {
34
+ var _a;
35
+ return (_a = sty.wrap) === null || _a === void 0 ? void 0 : _a.call(sty, input, newline);
36
+ };
37
+ const style = (input, stack) => {
38
+ if (input === '' || input === null || input === undefined)
39
+ return '';
40
+ if (colors.enabled === false)
41
+ return input;
42
+ if (colors.visible === false)
43
+ return '';
44
+ let str = String(input);
45
+ const nl = str.includes('\n');
46
+ let n = stack.length;
47
+ while (n-- > 0)
48
+ str = wrap(colors.styles[stack[n]], str, nl);
49
+ return str;
50
+ };
51
+ const define = (name, codes, type) => {
52
+ colors.styles[name] = ansi({ name, codes });
53
+ const keys = colors.keys[type] || (colors.keys[type] = []);
54
+ keys.push(name);
55
+ Reflect.defineProperty(colors, name, {
56
+ configurable: true,
57
+ enumerable: true,
58
+ set(value) {
59
+ var _a;
60
+ (_a = colors.alias) === null || _a === void 0 ? void 0 : _a.call(colors, name, value);
61
+ },
62
+ get() {
63
+ const color = (input) => style(input, color.stack);
64
+ Reflect.setPrototypeOf(color, colors);
65
+ color.stack = this.stack ? this.stack.concat(name) : [name];
66
+ return color;
67
+ },
68
+ });
69
+ };
70
+ define('reset', [0, 0], 'modifier');
71
+ define('bold', [1, 22], 'modifier');
72
+ define('dim', [2, 22], 'modifier');
73
+ define('italic', [3, 23], 'modifier');
74
+ define('underline', [4, 24], 'modifier');
75
+ define('inverse', [7, 27], 'modifier');
76
+ define('hidden', [8, 28], 'modifier');
77
+ define('strikethrough', [9, 29], 'modifier');
78
+ define('black', [30, 39], 'color');
79
+ define('red', [31, 39], 'color');
80
+ define('green', [32, 39], 'color');
81
+ define('yellow', [33, 39], 'color');
82
+ define('blue', [34, 39], 'color');
83
+ define('magenta', [35, 39], 'color');
84
+ define('white', [37, 39], 'color');
85
+ define('gray', [90, 39], 'color');
86
+ define('grey', [90, 39], 'color');
87
+ define('bgBlack', [40, 49], 'bg');
88
+ define('bgRed', [41, 49], 'bg');
89
+ define('bgGreen', [42, 49], 'bg');
90
+ define('bgYellow', [43, 49], 'bg');
91
+ define('bgBlue', [44, 49], 'bg');
92
+ define('bgMagenta', [45, 49], 'bg');
93
+ define('bgWhite', [47, 49], 'bg');
94
+ define('blackBright', [90, 39], 'bright');
95
+ define('redBright', [91, 39], 'bright');
96
+ define('greenBright', [92, 39], 'bright');
97
+ define('yellowBright', [93, 39], 'bright');
98
+ define('blueBright', [94, 39], 'bright');
99
+ define('magentaBright', [95, 39], 'bright');
100
+ define('whiteBright', [97, 39], 'bright');
101
+ define('bgBlackBright', [100, 49], 'bgBright');
102
+ define('bgRedBright', [101, 49], 'bgBright');
103
+ define('bgGreenBright', [102, 49], 'bgBright');
104
+ define('bgYellowBright', [103, 49], 'bgBright');
105
+ define('bgBlueBright', [104, 49], 'bgBright');
106
+ define('bgMagentaBright', [105, 49], 'bgBright');
107
+ define('bgWhiteBright', [107, 49], 'bgBright');
108
+ colors.alias = (name, color) => {
109
+ // @ts-expect-error
110
+ const fn = colors[color];
111
+ if (typeof fn !== 'function') {
112
+ throw new TypeError('Expected alias to be the name of an existing color (string) or a function');
113
+ }
114
+ if (!fn.stack) {
115
+ Reflect.defineProperty(fn, 'name', { value: name });
116
+ colors.styles[name] = fn;
117
+ fn.stack = [name];
118
+ }
119
+ Reflect.defineProperty(colors, name, {
120
+ configurable: true,
121
+ enumerable: true,
122
+ set(value) {
123
+ var _a;
124
+ (_a = colors.alias) === null || _a === void 0 ? void 0 : _a.call(colors, name, value);
125
+ },
126
+ get() {
127
+ const col = (input) => style(input, col.stack);
128
+ Reflect.setPrototypeOf(col, colors);
129
+ col.stack = this.stack ? this.stack.concat(fn.stack) : fn.stack;
130
+ return col;
131
+ },
132
+ });
133
+ };
134
+ return colors;
135
+ })();
@@ -0,0 +1 @@
1
+ export declare const isColorSupported: boolean;