jsgar 4.0.2 → 4.0.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/dist/gar.umd.js +4 -4
- package/gar.js +4 -4
- package/package.json +1 -1
package/dist/gar.umd.js
CHANGED
|
@@ -582,13 +582,13 @@
|
|
|
582
582
|
if (typeof globalThis !== 'undefined' && globalThis.WebSocket) {
|
|
583
583
|
return globalThis.WebSocket;
|
|
584
584
|
}
|
|
585
|
-
// Node.js: resolve 'ws' at runtime
|
|
585
|
+
// Node.js: resolve 'ws' at runtime
|
|
586
586
|
const isNode = typeof process !== 'undefined' && process.versions && process.versions.node;
|
|
587
587
|
if (isNode) {
|
|
588
588
|
try {
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
589
|
+
// createRequire works in both ESM and CJS; resolves from cwd
|
|
590
|
+
const { createRequire } = await import('node:module');
|
|
591
|
+
const req = createRequire(process.cwd() + '/');
|
|
592
592
|
const mod = req('ws');
|
|
593
593
|
const WS = mod.default || mod.WebSocket || mod;
|
|
594
594
|
globalThis.WebSocket = WS;
|
package/gar.js
CHANGED
|
@@ -576,13 +576,13 @@ class GARClient {
|
|
|
576
576
|
if (typeof globalThis !== 'undefined' && globalThis.WebSocket) {
|
|
577
577
|
return globalThis.WebSocket;
|
|
578
578
|
}
|
|
579
|
-
// Node.js: resolve 'ws' at runtime
|
|
579
|
+
// Node.js: resolve 'ws' at runtime
|
|
580
580
|
const isNode = typeof process !== 'undefined' && process.versions && process.versions.node;
|
|
581
581
|
if (isNode) {
|
|
582
582
|
try {
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
583
|
+
// createRequire works in both ESM and CJS; resolves from cwd
|
|
584
|
+
const { createRequire } = await import('node:module');
|
|
585
|
+
const req = createRequire(process.cwd() + '/');
|
|
586
586
|
const mod = req('ws');
|
|
587
587
|
const WS = mod.default || mod.WebSocket || mod;
|
|
588
588
|
globalThis.WebSocket = WS;
|