From aa7574f88471aa30ae472a5cddf1000a8baa70fd Mon Sep 17 00:00:00 2001 From: Damien Arrachequesne Date: Tue, 27 Oct 2020 23:17:12 +0100 Subject: [PATCH] feat: serve msgpack bundle See https://github.com/socketio/socket.io-client/commit/71d60480af9ea06d22792540dafb18a76e9362e7 --- lib/index.ts | 4 +++- package.json | 1 + test/socket.io.ts | 10 ++++++++++ 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/lib/index.ts b/lib/index.ts index 19825dd96e..97f702717a 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -272,7 +272,9 @@ export class Server extends EventEmitter { const escapedPath = this._path.replace(/[-\/\\^$*+?.()|[\]{}]/g, "\\$&"); this.clientPathRegex = new RegExp( - "^" + escapedPath + "/socket\\.io(\\.min)?\\.js(\\.map)?$" + "^" + + escapedPath + + "/socket\\.io(\\.min|\\.msgpack\\.min)?\\.js(\\.map)?$" ); return this; } diff --git a/package.json b/package.json index 4cc5b296a4..5d8170659b 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ ], "files": [ "dist/", + "client-dist/", "wrapper.mjs" ], "type": "commonjs", diff --git a/test/socket.io.ts b/test/socket.io.ts index 397bd46c5b..bc7377bce9 100644 --- a/test/socket.io.ts +++ b/test/socket.io.ts @@ -92,6 +92,16 @@ describe("socket.io", () => { }); }); + it( + "should serve bundle with msgpack parser", + testSource("socket.io.msgpack.min.js") + ); + + it( + "should serve source map for bundle with msgpack parser", + testSourceMap("socket.io.msgpack.min.js.map") + ); + it("should handle 304", done => { const srv = createServer(); new Server(srv);