jsgar 4.0.1 → 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 +1466 -0
- package/package.json +11 -2
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;
|