@pezkuwi/x-ws 14.0.1

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 ADDED
@@ -0,0 +1,12 @@
1
+ # @pezkuwi/x-ws
2
+
3
+ A cross-environment WebSocket.
4
+
5
+ Install it via `yarn add @pezkuwi/x-ws`
6
+
7
+ ```js
8
+ import { WebSocket } from '@pezkuwi/x-ws';
9
+
10
+ ...
11
+ const ws = new WebSocket('wss://example.com');
12
+ ```
package/package.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "author": "Jaco Greeff <jacogr@gmail.com>",
3
+ "bugs": "https://github.com/pezkuwichain/pezkuwi-common/issues",
4
+ "description": "A cross-environment WebSocket replacement",
5
+ "engines": {
6
+ "node": ">=18"
7
+ },
8
+ "homepage": "https://github.com/pezkuwichain/pezkuwi-common/tree/master/packages/x-ws#readme",
9
+ "license": "Apache-2.0",
10
+ "name": "@pezkuwi/x-ws",
11
+ "repository": {
12
+ "directory": "packages/x-ws",
13
+ "type": "git",
14
+ "url": "https://github.com/pezkuwichain/pezkuwi-common.git"
15
+ },
16
+ "sideEffects": false,
17
+ "type": "module",
18
+ "version": "14.0.1",
19
+ "browser": "browser.js",
20
+ "main": "node.js",
21
+ "react-native": "react-native.js",
22
+ "dependencies": {
23
+ "@pezkuwi/x-global": "14.0.1",
24
+ "tslib": "^2.8.0",
25
+ "ws": "^8.18.0"
26
+ },
27
+ "devDependencies": {
28
+ "@types/ws": "^8.5.12"
29
+ }
30
+ }
package/src/browser.ts ADDED
@@ -0,0 +1,8 @@
1
+ // Copyright 2017-2025 @polkadot/x-ws authors & contributors
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import { xglobal } from '@pezkuwi/x-global';
5
+
6
+ export { packageInfo } from './packageInfo.js';
7
+
8
+ export const WebSocket = xglobal.WebSocket;
package/src/mod.ts ADDED
@@ -0,0 +1,4 @@
1
+ // Copyright 2017-2025 @polkadot/x-ws authors & contributors
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ export * from './browser.js';
package/src/node.ts ADDED
@@ -0,0 +1,10 @@
1
+ // Copyright 2017-2025 @polkadot/x-ws authors & contributors
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import ws from 'ws';
5
+
6
+ import { extractGlobal } from '@pezkuwi/x-global';
7
+
8
+ export { packageInfo } from './packageInfo.js';
9
+
10
+ export const WebSocket = /*#__PURE__*/ extractGlobal('WebSocket', ws);
@@ -0,0 +1,6 @@
1
+ // Copyright 2017-2025 @polkadot/x-ws authors & contributors
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ // Do not edit, auto-generated by @polkadot/dev
5
+
6
+ export const packageInfo = { name: '@polkadot/x-ws', path: 'auto', type: 'auto', version: '14.0.1' };
@@ -0,0 +1,4 @@
1
+ // Copyright 2017-2025 @polkadot/x-ws authors & contributors
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ export * from './browser.js';
package/src/shim.ts ADDED
@@ -0,0 +1,7 @@
1
+ // Copyright 2017-2025 @polkadot/x-ws authors & contributors
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import { exposeGlobal } from '@pezkuwi/x-global';
5
+ import { WebSocket } from '@pezkuwi/x-ws';
6
+
7
+ exposeGlobal('WebSocket', WebSocket);
@@ -0,0 +1,14 @@
1
+ {
2
+ "extends": "../../tsconfig.base.json",
3
+ "compilerOptions": {
4
+ "baseUrl": "..",
5
+ "outDir": "./build",
6
+ "rootDir": "./src"
7
+ },
8
+ "exclude": [
9
+ "**/mod.ts"
10
+ ],
11
+ "references": [
12
+ { "path": "../x-global/tsconfig.build.json" }
13
+ ]
14
+ }