UNPKG

830 BJavaScriptView Raw
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.getFreePortAsync = getFreePortAsync;
7function _freeportAsync() {
8 const data = _interopRequireDefault(require("freeport-async"));
9 _freeportAsync = function () {
10 return data;
11 };
12 return data;
13}
14function _internal() {
15 const data = require("../internal");
16 _internal = function () {
17 return data;
18 };
19 return data;
20}
21function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
22async function getFreePortAsync(rangeStart) {
23 const port = await (0, _freeportAsync().default)(rangeStart, {
24 hostnames: [null, 'localhost']
25 });
26 if (!port) {
27 throw new (_internal().XDLError)('NO_PORT_FOUND', 'No available port found');
28 }
29 return port;
30}
31//# sourceMappingURL=getFreePortAsync.js.map
\No newline at end of file