msw 2.14.6 → 2.14.7
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/README.md +5 -5
- package/lib/browser/index.js +232 -92
- package/lib/browser/index.js.map +1 -1
- package/lib/browser/index.mjs +232 -92
- package/lib/browser/index.mjs.map +1 -1
- package/lib/core/{HttpResponse-CQwYpuKo.d.mts → HttpResponse-BTyqrRB6.d.mts} +1 -1
- package/lib/core/{HttpResponse-BFS34nkx.d.ts → HttpResponse-BXyXQFMJ.d.ts} +1 -1
- package/lib/core/HttpResponse.d.mts +1 -1
- package/lib/core/HttpResponse.d.ts +1 -1
- package/lib/core/HttpResponse.js +2 -2
- package/lib/core/HttpResponse.js.map +1 -1
- package/lib/core/HttpResponse.mjs +2 -2
- package/lib/core/HttpResponse.mjs.map +1 -1
- package/lib/core/experimental/compat.d.mts +2 -2
- package/lib/core/experimental/compat.d.ts +2 -2
- package/lib/core/experimental/define-network.d.mts +2 -2
- package/lib/core/experimental/define-network.d.ts +2 -2
- package/lib/core/experimental/frames/http-frame.d.mts +2 -2
- package/lib/core/experimental/frames/http-frame.d.ts +2 -2
- package/lib/core/experimental/frames/network-frame.d.mts +2 -2
- package/lib/core/experimental/frames/network-frame.d.ts +2 -2
- package/lib/core/experimental/frames/network-frame.js +2 -0
- package/lib/core/experimental/frames/network-frame.js.map +1 -1
- package/lib/core/experimental/frames/network-frame.mjs +2 -0
- package/lib/core/experimental/frames/network-frame.mjs.map +1 -1
- package/lib/core/experimental/frames/websocket-frame.d.mts +2 -2
- package/lib/core/experimental/frames/websocket-frame.d.ts +2 -2
- package/lib/core/experimental/handlers-controller.d.mts +1 -1
- package/lib/core/experimental/handlers-controller.d.ts +1 -1
- package/lib/core/experimental/index.d.mts +2 -2
- package/lib/core/experimental/index.d.ts +2 -2
- package/lib/core/experimental/on-unhandled-frame.d.mts +2 -2
- package/lib/core/experimental/on-unhandled-frame.d.ts +2 -2
- package/lib/core/experimental/setup-api.d.mts +1 -1
- package/lib/core/experimental/setup-api.d.ts +1 -1
- package/lib/core/experimental/sources/interceptor-source.d.mts +2 -2
- package/lib/core/experimental/sources/interceptor-source.d.ts +2 -2
- package/lib/core/experimental/sources/network-source.d.mts +2 -2
- package/lib/core/experimental/sources/network-source.d.ts +2 -2
- package/lib/core/getResponse.d.mts +1 -1
- package/lib/core/getResponse.d.ts +1 -1
- package/lib/core/graphql.d.mts +1 -1
- package/lib/core/graphql.d.ts +1 -1
- package/lib/core/handlers/GraphQLHandler.d.mts +1 -1
- package/lib/core/handlers/GraphQLHandler.d.ts +1 -1
- package/lib/core/handlers/HttpHandler.d.mts +1 -1
- package/lib/core/handlers/HttpHandler.d.ts +1 -1
- package/lib/core/handlers/RequestHandler.d.mts +1 -1
- package/lib/core/handlers/RequestHandler.d.ts +1 -1
- package/lib/core/handlers/WebSocketHandler.js +7 -6
- package/lib/core/handlers/WebSocketHandler.js.map +1 -1
- package/lib/core/handlers/WebSocketHandler.mjs +7 -6
- package/lib/core/handlers/WebSocketHandler.mjs.map +1 -1
- package/lib/core/http.d.mts +1 -1
- package/lib/core/http.d.ts +1 -1
- package/lib/core/index.d.mts +1 -1
- package/lib/core/index.d.ts +1 -1
- package/lib/core/{on-unhandled-frame-BBR-P3kV.d.ts → on-unhandled-frame-0KmwUmeV.d.ts} +1 -1
- package/lib/core/{on-unhandled-frame-Cr1KOZ0I.d.mts → on-unhandled-frame-gkokW4Rr.d.mts} +1 -1
- package/lib/core/passthrough.d.mts +1 -1
- package/lib/core/passthrough.d.ts +1 -1
- package/lib/core/sse.d.mts +1 -1
- package/lib/core/sse.d.ts +1 -1
- package/lib/core/sse.js +18 -13
- package/lib/core/sse.js.map +1 -1
- package/lib/core/sse.mjs +18 -13
- package/lib/core/sse.mjs.map +1 -1
- package/lib/core/utils/HttpResponse/decorators.d.mts +1 -1
- package/lib/core/utils/HttpResponse/decorators.d.ts +1 -1
- package/lib/core/utils/HttpResponse/decorators.js +1 -1
- package/lib/core/utils/HttpResponse/decorators.js.map +1 -1
- package/lib/core/utils/HttpResponse/decorators.mjs +1 -1
- package/lib/core/utils/HttpResponse/decorators.mjs.map +1 -1
- package/lib/core/utils/executeHandlers.d.mts +1 -1
- package/lib/core/utils/executeHandlers.d.ts +1 -1
- package/lib/core/utils/handleRequest.d.mts +1 -1
- package/lib/core/utils/handleRequest.d.ts +1 -1
- package/lib/core/utils/internal/attachSiblingHandlers.d.mts +1 -1
- package/lib/core/utils/internal/attachSiblingHandlers.d.ts +1 -1
- package/lib/core/utils/internal/attachSiblingHandlers.js +1 -1
- package/lib/core/utils/internal/attachSiblingHandlers.js.map +1 -1
- package/lib/core/utils/internal/attachSiblingHandlers.mjs +1 -1
- package/lib/core/utils/internal/attachSiblingHandlers.mjs.map +1 -1
- package/lib/core/utils/internal/isHandlerKind.d.mts +1 -1
- package/lib/core/utils/internal/isHandlerKind.d.ts +1 -1
- package/lib/core/utils/internal/parseGraphQLRequest.d.mts +1 -1
- package/lib/core/utils/internal/parseGraphQLRequest.d.ts +1 -1
- package/lib/core/utils/internal/parseMultipartData.d.mts +1 -1
- package/lib/core/utils/internal/parseMultipartData.d.ts +1 -1
- package/lib/core/ws/WebSocketClientManager.js +4 -0
- package/lib/core/ws/WebSocketClientManager.js.map +1 -1
- package/lib/core/ws/WebSocketClientManager.mjs +4 -0
- package/lib/core/ws/WebSocketClientManager.mjs.map +1 -1
- package/lib/core/ws/handleWebSocketEvent.d.mts +1 -1
- package/lib/core/ws/handleWebSocketEvent.d.ts +1 -1
- package/lib/iife/index.js +4402 -972
- package/lib/iife/index.js.map +1 -1
- package/lib/mockServiceWorker.js +1 -1
- package/package.json +4 -5
- package/src/core/sse.ts +15 -4
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.7'
|
|
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.7",
|
|
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",
|
|
@@ -248,7 +248,7 @@
|
|
|
248
248
|
"@fastify/websocket": "^11.2.0",
|
|
249
249
|
"@graphql-typed-document-node/core": "^3.2.0",
|
|
250
250
|
"@open-draft/test-server": "^0.4.2",
|
|
251
|
-
"@ossjs/release": "^0.
|
|
251
|
+
"@ossjs/release": "^0.11.1",
|
|
252
252
|
"@playwright/test": "^1.59.1",
|
|
253
253
|
"@types/express": "^5.0.6",
|
|
254
254
|
"@types/json-bigint": "^1.0.4",
|
|
@@ -280,13 +280,12 @@
|
|
|
280
280
|
"simple-git-hooks": "^2.13.1",
|
|
281
281
|
"tsup": "^8.5.1",
|
|
282
282
|
"typescript": "^5.9.3",
|
|
283
|
-
"undici": "^
|
|
283
|
+
"undici": "^7.28.0",
|
|
284
284
|
"url-loader": "^4.1.1",
|
|
285
285
|
"vitest": "^4.1.4",
|
|
286
|
-
"vitest-environment-miniflare": "^2.14.4",
|
|
287
286
|
"webpack": "^5.106.2",
|
|
288
287
|
"webpack-http-server": "^0.5.0",
|
|
289
|
-
"msw": "^2.14.
|
|
288
|
+
"msw": "^2.14.7"
|
|
290
289
|
},
|
|
291
290
|
"peerDependencies": {
|
|
292
291
|
"typescript": ">= 4.8.x"
|
package/src/core/sse.ts
CHANGED
|
@@ -80,7 +80,7 @@ const SSE_RESPONSE_INIT: ResponseInit = {
|
|
|
80
80
|
class ServerSentEventHandler<
|
|
81
81
|
EventMap extends EventMapConstraint,
|
|
82
82
|
> extends HttpHandler {
|
|
83
|
-
#
|
|
83
|
+
#loggableRequests: WeakSet<Request>
|
|
84
84
|
|
|
85
85
|
constructor(path: Path, resolver: ServerSentEventResolver<EventMap, any>) {
|
|
86
86
|
invariant(
|
|
@@ -94,7 +94,16 @@ class ServerSentEventHandler<
|
|
|
94
94
|
info.request,
|
|
95
95
|
)
|
|
96
96
|
|
|
97
|
-
|
|
97
|
+
/**
|
|
98
|
+
* @note Scope the emitter to this connection so its logging
|
|
99
|
+
* listeners don't accumulate on the handler across connections.
|
|
100
|
+
*/
|
|
101
|
+
const emitter = new Emitter<ServerSentEventClientEventMap>()
|
|
102
|
+
client[kClientEmitter] = emitter
|
|
103
|
+
|
|
104
|
+
if (this.#loggableRequests.has(info.request)) {
|
|
105
|
+
this.#attachClientLogger(info.request, emitter)
|
|
106
|
+
}
|
|
98
107
|
|
|
99
108
|
await resolver({
|
|
100
109
|
...info,
|
|
@@ -105,7 +114,7 @@ class ServerSentEventHandler<
|
|
|
105
114
|
return response
|
|
106
115
|
})
|
|
107
116
|
|
|
108
|
-
this.#
|
|
117
|
+
this.#loggableRequests = new WeakSet()
|
|
109
118
|
}
|
|
110
119
|
|
|
111
120
|
async predicate(args: {
|
|
@@ -134,7 +143,9 @@ class ServerSentEventHandler<
|
|
|
134
143
|
response: new Response('[streaming]', SSE_RESPONSE_INIT),
|
|
135
144
|
})
|
|
136
145
|
|
|
137
|
-
|
|
146
|
+
// Defer attaching the client logger until the resolver runs
|
|
147
|
+
// and creates a connection-scoped emitter for this request.
|
|
148
|
+
this.#loggableRequests.add(args.request)
|
|
138
149
|
}
|
|
139
150
|
|
|
140
151
|
return matches
|