react-websocket 2.1.0 → 3.0.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/package.json CHANGED
@@ -1,49 +1,134 @@
1
1
  {
2
2
  "name": "react-websocket",
3
- "version": "2.1.0",
4
- "description": "ReactJS Websocket Listener Component",
5
- "main": "build/index.js",
6
- "publishConfig": { "registry": "https://registry.npmjs.org" },
3
+ "version": "3.0.0",
4
+ "description": "Hooks-first WebSocket client for React: shared connections, auto-reconnect, typed messages, Suspense-ready",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "import": {
12
+ "types": "./dist/index.d.ts",
13
+ "default": "./dist/index.js"
14
+ },
15
+ "require": {
16
+ "types": "./dist/index.d.cts",
17
+ "default": "./dist/index.cjs"
18
+ }
19
+ },
20
+ "./core": {
21
+ "import": {
22
+ "types": "./dist/core.d.ts",
23
+ "default": "./dist/core.js"
24
+ },
25
+ "require": {
26
+ "types": "./dist/core.d.cts",
27
+ "default": "./dist/core.cjs"
28
+ }
29
+ },
30
+ "./package.json": "./package.json"
31
+ },
32
+ "files": [
33
+ "dist"
34
+ ],
35
+ "sideEffects": false,
36
+ "publishConfig": {
37
+ "access": "public"
38
+ },
7
39
  "scripts": {
8
- "start": "cross-env NODE_ENV=development node server.js",
9
- "compile-example": "webpack",
10
- "test": "echo \"Error: no test specified\" && exit 1",
11
- "prerelease": "cross-env NODE_ENV=production webpack --config webpack.prod.config.js"
40
+ "build": "rm -rf dist && tsup",
41
+ "dev": "tsup --watch",
42
+ "test": "vitest run",
43
+ "test:watch": "vitest",
44
+ "test:coverage": "vitest run --coverage",
45
+ "typecheck": "tsc --noEmit",
46
+ "lint": "eslint .",
47
+ "format": "prettier --write .",
48
+ "format:check": "prettier --check .",
49
+ "check:package": "npm run build && publint --strict && attw --pack . --profile node16",
50
+ "size": "npm run build && size-limit",
51
+ "docs:dev": "vitepress dev docs",
52
+ "docs:build": "vitepress build docs",
53
+ "docs:preview": "vitepress preview docs",
54
+ "example": "vite example",
55
+ "example:server": "python3 example/server.py",
56
+ "prepublishOnly": "npm run lint && npm run typecheck && npm test && npm run check:package"
12
57
  },
13
58
  "repository": {
14
59
  "type": "git",
15
- "url": "git@github.com:mehmetkose/react-websocket.git"
60
+ "url": "git+https://github.com/mehmetkose/react-websocket.git"
16
61
  },
17
62
  "keywords": [
18
- "reactjs",
19
- "websocket",
20
63
  "react",
21
- "connection"
64
+ "websocket",
65
+ "hooks",
66
+ "realtime",
67
+ "reconnect",
68
+ "suspense"
22
69
  ],
70
+ "author": "Mehmet Kose <mehmet@sourcream.uk> (https://sourcream.uk/)",
23
71
  "maintainers": [
24
- "Mehmet Kose <mehmet@linux.com> (https://mehmetkose.github.io/)"
72
+ "Mehmet Kose <mehmet@sourcream.uk> (https://sourcream.uk/)"
25
73
  ],
26
74
  "license": "MIT",
27
75
  "bugs": {
28
76
  "url": "https://github.com/mehmetkose/react-websocket/issues"
29
77
  },
30
78
  "homepage": "https://github.com/mehmetkose/react-websocket",
31
- "example": {
32
- "script": "example/component.jsx"
79
+ "peerDependencies": {
80
+ "react": "^18.0.0 || ^19.0.0"
33
81
  },
34
82
  "devDependencies": {
35
- "babel": "^5.8.23",
36
- "babel-loader": "^5.3.1",
37
- "cross-env": "^3.1.4",
38
- "prop-types": "^15.5.8",
39
- "react": "^15.5.4",
40
- "react-dom": "^15.5.4",
41
- "react-hot-loader": "^1.3.0",
42
- "webpack": "^1.10.1",
43
- "webpack-dev-server": ">=3.1.11"
83
+ "@arethetypeswrong/cli": "^0.18.5",
84
+ "@eslint/js": "^10.0.1",
85
+ "@size-limit/preset-small-lib": "^14.2.0",
86
+ "@testing-library/react": "^16.3.3",
87
+ "@types/react": "^19.3.0",
88
+ "@types/react-dom": "^19.3.0",
89
+ "@vitejs/plugin-react": "^6.1.2",
90
+ "@vitest/coverage-v8": "^5.0.3",
91
+ "eslint": "^10.12.0",
92
+ "eslint-plugin-react-hooks": "^7.1.1",
93
+ "globals": "^17.13.0",
94
+ "jsdom": "^30.1.2",
95
+ "prettier": "^3.9.9",
96
+ "publint": "^0.3.25",
97
+ "react": "^19.3.0",
98
+ "react-dom": "^19.3.0",
99
+ "size-limit": "^14.2.0",
100
+ "tsup": "^8.5.1",
101
+ "typescript": "^6.0.3",
102
+ "typescript-eslint": "^8.71.1",
103
+ "vite": "^8.3.4",
104
+ "vitepress": "^1.6.4",
105
+ "vitest": "^5.0.3"
44
106
  },
45
- "peerDependencies": {
46
- "react": ">0.14.5",
47
- "react-dom": ">0.14.5"
107
+ "size-limit": [
108
+ {
109
+ "name": "react-websocket (useWebSocket)",
110
+ "path": "dist/index.js",
111
+ "import": "{ useWebSocket }",
112
+ "ignore": [
113
+ "react"
114
+ ],
115
+ "limit": "3 kB"
116
+ },
117
+ {
118
+ "name": "react-websocket/core (createWebSocket)",
119
+ "path": "dist/core.js",
120
+ "import": "{ createWebSocket }",
121
+ "ignore": [
122
+ "react"
123
+ ],
124
+ "limit": "2.6 kB"
125
+ }
126
+ ],
127
+ "overrides": {
128
+ "@docsearch/react": {
129
+ "react": "$react",
130
+ "react-dom": "$react-dom",
131
+ "@types/react": "$@types/react"
132
+ }
48
133
  }
49
134
  }