@rsdoctor/utils 1.1.2 → 1.1.3
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/README.md
CHANGED
package/dist/cjs/build/server.js
CHANGED
|
@@ -42,7 +42,15 @@ var import_os = __toESM(require("os"));
|
|
|
42
42
|
var import_get_port = __toESM(require("get-port"));
|
|
43
43
|
var import_child_process = require("child_process");
|
|
44
44
|
var import_algorithm = require("../common/algorithm");
|
|
45
|
-
const
|
|
45
|
+
const RESTRICTED_PORTS = [3659, 4045, 6e3, 6665, 6666, 6667, 6668, 6669];
|
|
46
|
+
function getRandomPort(min, max) {
|
|
47
|
+
let port;
|
|
48
|
+
do {
|
|
49
|
+
port = (0, import_algorithm.random)(min, max);
|
|
50
|
+
} while (RESTRICTED_PORTS.includes(port));
|
|
51
|
+
return port;
|
|
52
|
+
}
|
|
53
|
+
const defaultPort = getRandomPort(3e3, 8999);
|
|
46
54
|
async function getPort(expectPort) {
|
|
47
55
|
return (0, import_get_port.default)({ port: expectPort });
|
|
48
56
|
}
|
package/dist/esm/build/server.js
CHANGED
|
@@ -4,7 +4,15 @@ import os from "os";
|
|
|
4
4
|
import gp from "get-port";
|
|
5
5
|
import { execSync } from "child_process";
|
|
6
6
|
import { random } from "../common/algorithm";
|
|
7
|
-
const
|
|
7
|
+
const RESTRICTED_PORTS = [3659, 4045, 6e3, 6665, 6666, 6667, 6668, 6669];
|
|
8
|
+
function getRandomPort(min, max) {
|
|
9
|
+
let port;
|
|
10
|
+
do {
|
|
11
|
+
port = random(min, max);
|
|
12
|
+
} while (RESTRICTED_PORTS.includes(port));
|
|
13
|
+
return port;
|
|
14
|
+
}
|
|
15
|
+
const defaultPort = getRandomPort(3e3, 8999);
|
|
8
16
|
async function getPort(expectPort) {
|
|
9
17
|
return gp({ port: expectPort });
|
|
10
18
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/build/server.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,IAAI,MAAM,MAAM,CAAC;AAIxB,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/build/server.ts"],"names":[],"mappings":"AAAA,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,IAAI,MAAM,MAAM,CAAC;AAIxB,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAc7C,eAAO,MAAM,WAAW,QAA4B,CAAC;AAErD,wBAAsB,OAAO,CAAC,UAAU,EAAE,MAAM,mBAE/C;AAED,eAAO,MAAM,+BAA+B,eAAgB,MAAM,WAiC1D,CAAC;AAET,wBAAgB,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,GAAG,KAAK,CAS9D;AAED,wBAAgB,SAAS,mBAExB;AAED,wBAAsB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IACxD,GAAG,EAAE,UAAU,CAAC,OAAO,CAAC,MAAM,CAAC;IAC/B,MAAM,EAAE,IAAI,CAAC,MAAM,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,GAAG,KAAK,CAAC;CAChC,CAAC,CA8BD"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsdoctor/utils",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "https://github.com/web-infra-dev/rsdoctor",
|
|
@@ -83,7 +83,7 @@
|
|
|
83
83
|
"lines-and-columns": "2.0.4",
|
|
84
84
|
"rslog": "^1.2.3",
|
|
85
85
|
"strip-ansi": "^6.0.1",
|
|
86
|
-
"@rsdoctor/types": "1.1.
|
|
86
|
+
"@rsdoctor/types": "1.1.3"
|
|
87
87
|
},
|
|
88
88
|
"devDependencies": {
|
|
89
89
|
"@types/babel__code-frame": "7.0.6",
|