feat: isomorphic sockets and use eventemitter3 (#2514)

Reduces filesize by 3kb minified and gzipped or 2.8% and reduces bundler
config steps.

- Move `WSWrapper` to `@xrpl/isomorphic` to remove the need to add
mapping of `ws` to `WSWrapper` file in bundler configs
- Switch to `eventemitter3` which is smaller than `events` by almost
1kb and will not require a mapping to node's `events` in `vite`
bundling. `webpack` always automatically maps it.
    - max listeners is not a thing for `eventemitter3` so we do not
need to set it to `Infinity`. `ws` uses the native event emitter which
does still need that to be set.
- Remove `eventemitter2` which was only used in tests and was replaced
with `eventemitter3`

BREAKING CHANGE: Config for frontend bundlers has changed for `ws`.
This commit is contained in:
Caleb Kniffen
2023-10-17 21:00:29 -05:00
parent 3c8a990e6a
commit 294509cf79
16 changed files with 188 additions and 116 deletions

View File

@@ -44,7 +44,6 @@
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-tsdoc": "^0.2.16",
"eventemitter2": "^6.0.0",
"expect": "^29.3.1",
"jest": "^29.3.1",
"jest-mock": "^29.3.1",