Skip to content

Commit 7245b80

Browse files
chore: migrate to TypeScript
This change introduces an ESM build which will allow tree shaking. A CJS build is also provided for backward compatibility.
1 parent c7e27b0 commit 7245b80

34 files changed

+603
-1042
lines changed

.eslintrc.json

Lines changed: 0 additions & 8 deletions
This file was deleted.

lib/globalThis.browser.js renamed to lib/globalThis.browser.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports = (() => {
1+
export default (() => {
22
if (typeof self !== "undefined") {
33
return self;
44
} else if (typeof window !== "undefined") {

lib/globalThis.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

lib/globalThis.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export default global;

lib/index.js

Lines changed: 0 additions & 14 deletions
This file was deleted.

lib/index.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
import { Socket } from "./socket.js";
2+
3+
export default (uri, opts) => new Socket(uri, opts);
4+
5+
/**
6+
* Expose deps for legacy compatibility
7+
* and standalone browser access.
8+
*/
9+
export { Socket };
10+
export { SocketOptions } from "./socket.js";
11+
export const protocol = Socket.protocol;
12+
export { Transport } from "./transport.js";
13+
export { transports } from "./transports/index.js";
14+
export { installTimerFunctions } from "./util.js";

0 commit comments

Comments
 (0)