mirror of
https://github.com/MercuryWorkshop/bare-mux.git
synced 2025-05-14 06:40:02 -04:00
add readystate values to prototype and start minifying bare-mux builds
This commit is contained in:
parent
88ff83bfaf
commit
c299c00a36
3 changed files with 15 additions and 6 deletions
|
@ -26,6 +26,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@rollup/plugin-terser": "^0.4.4",
|
||||||
"@rollup/plugin-inject": "^5.0.5",
|
"@rollup/plugin-inject": "^5.0.5",
|
||||||
"@rollup/plugin-replace": "^5.0.5",
|
"@rollup/plugin-replace": "^5.0.5",
|
||||||
"rollup": "^4.9.6",
|
"rollup": "^4.9.6",
|
||||||
|
|
|
@ -1,9 +1,11 @@
|
||||||
import inject from '@rollup/plugin-inject';
|
import inject from '@rollup/plugin-inject';
|
||||||
|
import terser from '@rollup/plugin-terser';
|
||||||
import typescript from 'rollup-plugin-typescript2';
|
import typescript from 'rollup-plugin-typescript2';
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
|
|
||||||
const commonPlugins = () => [
|
const commonPlugins = () => [
|
||||||
typescript(),
|
typescript(),
|
||||||
|
terser(),
|
||||||
inject(
|
inject(
|
||||||
Object.fromEntries(
|
Object.fromEntries(
|
||||||
['fetch', 'Request', 'Response', 'WebSocket', 'XMLHttpRequest', 'SharedWorker', 'localStorage', 'serviceWorker'].map(
|
['fetch', 'Request', 'Response', 'WebSocket', 'XMLHttpRequest', 'SharedWorker', 'localStorage', 'serviceWorker'].map(
|
||||||
|
@ -14,6 +16,7 @@ const commonPlugins = () => [
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|
||||||
const configs = [
|
const configs = [
|
||||||
|
|
|
@ -14,10 +14,6 @@ export class BareWebSocket extends EventTarget {
|
||||||
onmessage = null;
|
onmessage = null;
|
||||||
onclose = null;
|
onclose = null;
|
||||||
|
|
||||||
CONNECTING = WebSocketFields.CONNECTING;
|
|
||||||
OPEN = WebSocketFields.OPEN;
|
|
||||||
CLOSING = WebSocketFields.CLOSING;
|
|
||||||
CLOSED = WebSocketFields.CLOSED;
|
|
||||||
channel: MessageChannel;
|
channel: MessageChannel;
|
||||||
constructor(
|
constructor(
|
||||||
remote: string | URL,
|
remote: string | URL,
|
||||||
|
@ -145,3 +141,12 @@ export class BareWebSocket extends EventTarget {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//@ts-expect-error have to do this
|
||||||
|
BareWebSocket.prototype.CONNECTING = WebSocketFields.CONNECTING;
|
||||||
|
//@ts-expect-error have to do this
|
||||||
|
BareWebSocket.prototype.OPEN = WebSocketFields.OPEN;
|
||||||
|
//@ts-expect-error have to do this
|
||||||
|
BareWebSocket.prototype.CLOSING = WebSocketFields.CLOSING;
|
||||||
|
//@ts-expect-error have to do this
|
||||||
|
BareWebSocket.prototype.CLOSED = WebSocketFields.CLOSED;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue