@rsdoctor/components 1.0.0-alpha.4 → 1.0.0-beta.0
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/utils/socket.js +2 -1
- package/package.json +5 -5
package/dist/utils/socket.js
CHANGED
|
@@ -2,6 +2,7 @@ import { io } from "socket.io-client";
|
|
|
2
2
|
const map = /* @__PURE__ */ new Map();
|
|
3
3
|
const socketProtocol = location.protocol.includes("https") ? "wss" : "ws";
|
|
4
4
|
const defaultSocketUrl = process.env.NODE_ENV === "development" ? `${socketProtocol}://${location.hostname}:${process.env.LOCAL_CLI_PORT}` : `${socketProtocol}://${location.host}`;
|
|
5
|
+
const ipv4Pattern = /^(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)$/;
|
|
5
6
|
function ensureSocket(socketUrl = defaultSocketUrl) {
|
|
6
7
|
if (!map.has(socketUrl)) {
|
|
7
8
|
const socket = io(socketUrl, {});
|
|
@@ -31,7 +32,7 @@ function formatURL({
|
|
|
31
32
|
url.port = String(port);
|
|
32
33
|
url.hostname = hostname;
|
|
33
34
|
url.protocol = location.protocol.includes("https") ? "wss" : "ws";
|
|
34
|
-
return url.toString()
|
|
35
|
+
return ipv4Pattern.test(hostname) || hostname.includes("localhost") ? url.toString() : `${protocol}//${hostname}`;
|
|
35
36
|
}
|
|
36
37
|
const colon = protocol.indexOf(":") === -1 ? ":" : "";
|
|
37
38
|
return `${protocol}${colon}//${hostname}:${port}`;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rsdoctor/components",
|
|
3
|
-
"version": "1.0.0-
|
|
3
|
+
"version": "1.0.0-beta.0",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"rc-dialog": "9.1.0",
|
|
63
63
|
"rc-tree": "5.7.2",
|
|
64
64
|
"react": "18.3.1",
|
|
65
|
-
"react-highlight-words": "^0.
|
|
65
|
+
"react-highlight-words": "^0.21.0",
|
|
66
66
|
"react-hyper-tree": "0.3.12",
|
|
67
67
|
"react-i18next": "12.0.0",
|
|
68
68
|
"react-json-view": "1.21.3",
|
|
@@ -71,9 +71,9 @@
|
|
|
71
71
|
"socket.io-client": "4.6.1",
|
|
72
72
|
"typescript": "^5.2.2",
|
|
73
73
|
"url-parse": "1.5.10",
|
|
74
|
-
"@rsdoctor/
|
|
75
|
-
"@rsdoctor/types": "1.0.0-
|
|
76
|
-
"@rsdoctor/
|
|
74
|
+
"@rsdoctor/graph": "1.0.0-beta.0",
|
|
75
|
+
"@rsdoctor/types": "1.0.0-beta.0",
|
|
76
|
+
"@rsdoctor/utils": "1.0.0-beta.0"
|
|
77
77
|
},
|
|
78
78
|
"publishConfig": {
|
|
79
79
|
"access": "public",
|