@blaxel/core 0.2.16-dev.98 → 0.2.16-dev.99
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/common/node.js +11 -1
- package/package.json +1 -1
package/dist/common/node.js
CHANGED
|
@@ -15,6 +15,7 @@ let dotenv = null;
|
|
|
15
15
|
exports.dotenv = dotenv;
|
|
16
16
|
let ws = null;
|
|
17
17
|
exports.ws = ws;
|
|
18
|
+
const isBrowser = typeof globalThis !== "undefined" && globalThis && globalThis.window !== undefined;
|
|
18
19
|
if (isNode) {
|
|
19
20
|
try {
|
|
20
21
|
exports.fs = fs = eval("require")("fs");
|
|
@@ -24,6 +25,15 @@ if (isNode) {
|
|
|
24
25
|
exports.ws = ws = eval("require")("ws");
|
|
25
26
|
}
|
|
26
27
|
catch (e) {
|
|
27
|
-
console.warn("fs
|
|
28
|
+
console.warn("fs, os, path, dotenv, ws are not available in this environment");
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
// cloudflare
|
|
32
|
+
else if (!isBrowser) {
|
|
33
|
+
try {
|
|
34
|
+
exports.ws = ws = eval("require")("ws");
|
|
35
|
+
}
|
|
36
|
+
catch (e) {
|
|
37
|
+
console.warn("ws is not available in this environment");
|
|
28
38
|
}
|
|
29
39
|
}
|