@remotion/bundler 3.0.12 → 3.0.14
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.
- package/dist/get-port.js +25 -22
- package/package.json +3 -3
package/dist/get-port.js
CHANGED
|
@@ -6,15 +6,30 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.getDesiredPort = void 0;
|
|
7
7
|
const net_1 = __importDefault(require("net"));
|
|
8
8
|
const getAvailablePort = (portToTry) => new Promise((resolve, reject) => {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
resolve(port);
|
|
16
|
-
});
|
|
9
|
+
let status = 'unavailable';
|
|
10
|
+
const host = '127.0.0.1';
|
|
11
|
+
const socket = new net_1.default.Socket();
|
|
12
|
+
socket.on('connect', () => {
|
|
13
|
+
status = 'unavailable';
|
|
14
|
+
socket.destroy();
|
|
17
15
|
});
|
|
16
|
+
socket.setTimeout(1000);
|
|
17
|
+
socket.on('timeout', () => {
|
|
18
|
+
status = 'available';
|
|
19
|
+
reject(new Error('Timeout (' +
|
|
20
|
+
1000 +
|
|
21
|
+
'ms) occurred waiting for ' +
|
|
22
|
+
host +
|
|
23
|
+
':' +
|
|
24
|
+
portToTry +
|
|
25
|
+
' to be available'));
|
|
26
|
+
socket.destroy();
|
|
27
|
+
});
|
|
28
|
+
socket.on('error', () => {
|
|
29
|
+
status = 'available';
|
|
30
|
+
});
|
|
31
|
+
socket.on('close', () => resolve(status));
|
|
32
|
+
socket.connect(portToTry, host);
|
|
18
33
|
});
|
|
19
34
|
const portCheckSequence = function* (ports) {
|
|
20
35
|
if (ports) {
|
|
@@ -22,22 +37,10 @@ const portCheckSequence = function* (ports) {
|
|
|
22
37
|
}
|
|
23
38
|
yield 0; // Fall back to 0 if anything else failed
|
|
24
39
|
};
|
|
25
|
-
const isPortAvailable = async (port) => {
|
|
26
|
-
try {
|
|
27
|
-
await getAvailablePort(port);
|
|
28
|
-
return true;
|
|
29
|
-
}
|
|
30
|
-
catch (error) {
|
|
31
|
-
if (!['EADDRINUSE', 'EACCES'].includes(error.code)) {
|
|
32
|
-
throw error;
|
|
33
|
-
}
|
|
34
|
-
return false;
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
40
|
const getPort = async (from, to) => {
|
|
38
41
|
const ports = makeRange(from, to);
|
|
39
42
|
for (const port of portCheckSequence(ports)) {
|
|
40
|
-
if (await
|
|
43
|
+
if ((await getAvailablePort(port)) === 'available') {
|
|
41
44
|
return port;
|
|
42
45
|
}
|
|
43
46
|
}
|
|
@@ -45,7 +48,7 @@ const getPort = async (from, to) => {
|
|
|
45
48
|
};
|
|
46
49
|
const getDesiredPort = async (desiredPort, from, to) => {
|
|
47
50
|
if (typeof desiredPort !== 'undefined' &&
|
|
48
|
-
(await
|
|
51
|
+
(await getAvailablePort(desiredPort)) === 'available') {
|
|
49
52
|
return desiredPort;
|
|
50
53
|
}
|
|
51
54
|
const actualPort = await getPort(from, to);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@remotion/bundler",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.14",
|
|
4
4
|
"description": "Bundler for Remotion",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"memfs": "3.4.3",
|
|
32
32
|
"mime-types": "2.1.34",
|
|
33
33
|
"react-refresh": "0.9.0",
|
|
34
|
-
"remotion": "3.0.
|
|
34
|
+
"remotion": "3.0.14",
|
|
35
35
|
"semver": "7.3.4",
|
|
36
36
|
"source-map": "0.6.1",
|
|
37
37
|
"source-map-loader": "3.0.0",
|
|
@@ -77,5 +77,5 @@
|
|
|
77
77
|
"publishConfig": {
|
|
78
78
|
"access": "public"
|
|
79
79
|
},
|
|
80
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "475caaea420199fcaf3c95c0da908e9208dc0e61"
|
|
81
81
|
}
|