msw 2.14.4 → 2.14.5
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/lib/core/experimental/sources/interceptor-source.js +9 -0
- package/lib/core/experimental/sources/interceptor-source.js.map +1 -1
- package/lib/core/experimental/sources/interceptor-source.mjs +9 -0
- package/lib/core/experimental/sources/interceptor-source.mjs.map +1 -1
- package/lib/iife/index.js +9 -0
- package/lib/iife/index.js.map +1 -1
- package/lib/mockServiceWorker.js +1 -1
- package/package.json +2 -2
- package/src/core/experimental/sources/interceptor-source.ts +14 -0
package/lib/mockServiceWorker.js
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* - Please do NOT modify this file.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
const PACKAGE_VERSION = '2.14.
|
|
10
|
+
const PACKAGE_VERSION = '2.14.5'
|
|
11
11
|
const INTEGRITY_CHECKSUM = '4db4a41e972cec1b64cc569c66952d82'
|
|
12
12
|
const IS_MOCKED_RESPONSE = Symbol('isMockedResponse')
|
|
13
13
|
const activeClientIds = new Set()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "msw",
|
|
3
|
-
"version": "2.14.
|
|
3
|
+
"version": "2.14.5",
|
|
4
4
|
"description": "Seamless REST/GraphQL API mocking library for browser and Node.js.",
|
|
5
5
|
"type": "commonjs",
|
|
6
6
|
"main": "./lib/core/index.js",
|
|
@@ -286,7 +286,7 @@
|
|
|
286
286
|
"vitest-environment-miniflare": "^2.14.4",
|
|
287
287
|
"webpack": "^5.106.2",
|
|
288
288
|
"webpack-http-server": "^0.5.0",
|
|
289
|
-
"msw": "^2.14.
|
|
289
|
+
"msw": "^2.14.5"
|
|
290
290
|
},
|
|
291
291
|
"peerDependencies": {
|
|
292
292
|
"typescript": ">= 4.8.x"
|
|
@@ -163,6 +163,20 @@ class InterceptorHttpNetworkFrame extends HttpNetworkFrame {
|
|
|
163
163
|
class InterceptorWebSocketNetworkFrame extends WebSocketNetworkFrame {
|
|
164
164
|
constructor(args: { connection: WebSocketConnectionData }) {
|
|
165
165
|
super({ connection: args.connection })
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* @note Provide a similar frame listener cleanup as for HTTP.
|
|
169
|
+
* When the client connection closes, the handler can no longer be used.
|
|
170
|
+
*/
|
|
171
|
+
args.connection.client.addEventListener(
|
|
172
|
+
'close',
|
|
173
|
+
() => {
|
|
174
|
+
this.events.removeAllListeners()
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
once: true,
|
|
178
|
+
},
|
|
179
|
+
)
|
|
166
180
|
}
|
|
167
181
|
|
|
168
182
|
public errorWith(reason?: unknown): void {
|