@remotion/renderer 3.3.44 → 3.3.45

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.
@@ -9,8 +9,6 @@ const get_port_1 = require("./get-port");
9
9
  const offthread_video_server_1 = require("./offthread-video-server");
10
10
  const serve_handler_1 = require("./serve-handler");
11
11
  const serveStatic = async (path, options) => {
12
- var _a;
13
- const { port, didUsePort } = await (0, get_port_1.getDesiredPort)((_a = options === null || options === void 0 ? void 0 : options.port) !== null && _a !== void 0 ? _a : undefined, 3000, 3100);
14
12
  const offthreadRequest = (0, offthread_video_server_1.startOffthreadVideoServer)({
15
13
  ffmpegExecutable: options.ffmpegExecutable,
16
14
  ffprobeExecutable: options.ffprobeExecutable,
@@ -19,65 +17,86 @@ const serveStatic = async (path, options) => {
19
17
  downloadMap: options.downloadMap,
20
18
  remotionRoot: options.remotionRoot,
21
19
  });
22
- try {
23
- const connections = {};
24
- const server = http_1.default
25
- .createServer((request, response) => {
26
- var _a;
27
- if ((_a = request.url) === null || _a === void 0 ? void 0 : _a.startsWith('/proxy')) {
28
- return offthreadRequest(request, response);
29
- }
30
- if (path === null) {
31
- response.writeHead(404);
32
- response.end('Server only supports /proxy');
33
- return;
34
- }
35
- (0, serve_handler_1.serveHandler)(request, response, {
36
- public: path,
37
- }).catch(() => {
38
- response.statusCode = 500;
39
- response.end('Error serving file');
40
- });
41
- })
42
- .listen(port);
43
- server.on('connection', (conn) => {
44
- const key = conn.remoteAddress + ':' + conn.remotePort;
45
- connections[key] = conn;
46
- conn.on('close', () => {
47
- delete connections[key];
48
- });
20
+ const connections = {};
21
+ const server = http_1.default.createServer((request, response) => {
22
+ var _a;
23
+ if ((_a = request.url) === null || _a === void 0 ? void 0 : _a.startsWith('/proxy')) {
24
+ return offthreadRequest(request, response);
25
+ }
26
+ if (path === null) {
27
+ response.writeHead(404);
28
+ response.end('Server only supports /proxy');
29
+ return;
30
+ }
31
+ (0, serve_handler_1.serveHandler)(request, response, {
32
+ public: path,
33
+ }).catch(() => {
34
+ response.statusCode = 500;
35
+ response.end('Error serving file');
49
36
  });
50
- server.on('listening', () => {
51
- didUsePort();
37
+ });
38
+ server.on('connection', (conn) => {
39
+ const key = conn.remoteAddress + ':' + conn.remotePort;
40
+ connections[key] = conn;
41
+ conn.on('close', () => {
42
+ delete connections[key];
52
43
  });
53
- const destroyConnections = function () {
54
- for (const key in connections)
55
- connections[key].destroy();
56
- };
57
- const close = () => {
58
- return new Promise((resolve, reject) => {
59
- destroyConnections();
60
- server.close((err) => {
61
- if (err) {
62
- if (err.code === 'ERR_SERVER_NOT_RUNNING') {
63
- return resolve();
64
- }
44
+ });
45
+ let selectedPort = null;
46
+ const maxTries = 5;
47
+ for (let i = 0; i < maxTries; i++) {
48
+ try {
49
+ selectedPort = await new Promise((resolve, reject) => {
50
+ var _a;
51
+ (0, get_port_1.getDesiredPort)((_a = options === null || options === void 0 ? void 0 : options.port) !== null && _a !== void 0 ? _a : undefined, 3000, 3100)
52
+ .then(({ port, didUsePort }) => {
53
+ server.listen(port);
54
+ server.on('listening', () => {
55
+ resolve(port);
56
+ return didUsePort();
57
+ });
58
+ server.on('error', (err) => {
65
59
  reject(err);
66
- }
67
- else {
68
- resolve();
69
- }
70
- });
60
+ });
61
+ })
62
+ .catch((err) => reject(err));
71
63
  });
72
- };
73
- return { port, close };
74
- }
75
- catch (err) {
76
- console.log({ err, msg: err.message });
77
- if (err.message.includes('EADDRINUSE')) {
78
- return (0, exports.serveStatic)(path, options);
64
+ const destroyConnections = function () {
65
+ for (const key in connections)
66
+ connections[key].destroy();
67
+ };
68
+ const close = () => {
69
+ return new Promise((resolve, reject) => {
70
+ destroyConnections();
71
+ server.close((err) => {
72
+ if (err) {
73
+ if (err.code ===
74
+ 'ERR_SERVER_NOT_RUNNING') {
75
+ return resolve();
76
+ }
77
+ reject(err);
78
+ }
79
+ else {
80
+ resolve();
81
+ }
82
+ });
83
+ });
84
+ };
85
+ return { port: selectedPort, close };
86
+ }
87
+ catch (err) {
88
+ if (!(err instanceof Error)) {
89
+ throw err;
90
+ }
91
+ const codedError = err;
92
+ if (codedError.code === 'EADDRINUSE') {
93
+ // Already in use, try another port
94
+ }
95
+ else {
96
+ throw err;
97
+ }
79
98
  }
80
- throw err;
81
99
  }
100
+ throw new Error(`Tried ${maxTries} times to find a free port. Giving up.`);
82
101
  };
83
102
  exports.serveStatic = serveStatic;
@@ -16,6 +16,9 @@ const setPropsAndEnv = async ({ inputProps, envVariables, page, serveUrl, initia
16
16
  await page.evaluateOnNewDocument((timeout) => {
17
17
  window.remotion_puppeteerTimeout = timeout;
18
18
  }, actualTimeout);
19
+ if (typeof inputProps === 'string') {
20
+ throw new Error('Input props should be an object, not a string.');
21
+ }
19
22
  if (inputProps) {
20
23
  await page.evaluateOnNewDocument((input) => {
21
24
  window.remotion_inputProps = input;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@remotion/renderer",
3
- "version": "3.3.44",
3
+ "version": "3.3.45",
4
4
  "description": "Renderer for Remotion",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -24,7 +24,7 @@
24
24
  "dependencies": {
25
25
  "execa": "5.1.1",
26
26
  "extract-zip": "2.0.1",
27
- "remotion": "3.3.44",
27
+ "remotion": "3.3.45",
28
28
  "source-map": "^0.8.0-beta.0",
29
29
  "ws": "8.7.0"
30
30
  },
@@ -49,13 +49,13 @@
49
49
  "vitest": "0.24.3"
50
50
  },
51
51
  "optionalDependencies": {
52
- "@remotion/compositor-darwin-arm64": "3.3.44",
53
- "@remotion/compositor-darwin-x64": "3.3.44",
54
- "@remotion/compositor-linux-arm64-gnu": "3.3.44",
55
- "@remotion/compositor-linux-arm64-musl": "3.3.44",
56
- "@remotion/compositor-linux-x64-gnu": "3.3.44",
57
- "@remotion/compositor-linux-x64-musl": "3.3.44",
58
- "@remotion/compositor-win32-x64-msvc": "3.3.44"
52
+ "@remotion/compositor-darwin-arm64": "3.3.45",
53
+ "@remotion/compositor-darwin-x64": "3.3.45",
54
+ "@remotion/compositor-linux-arm64-gnu": "3.3.45",
55
+ "@remotion/compositor-linux-arm64-musl": "3.3.45",
56
+ "@remotion/compositor-linux-x64-gnu": "3.3.45",
57
+ "@remotion/compositor-linux-x64-musl": "3.3.45",
58
+ "@remotion/compositor-win32-x64-msvc": "3.3.45"
59
59
  },
60
60
  "keywords": [
61
61
  "remotion",
@@ -67,5 +67,5 @@
67
67
  "publishConfig": {
68
68
  "access": "public"
69
69
  },
70
- "gitHead": "7ba7bbdacbda1499ecdb92f1d9581d5db458edf8"
70
+ "gitHead": "75c028236b43ff2fd0f3f3772f9f79cfde069e36"
71
71
  }