msw 2.4.9 → 2.4.11
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/browser/index.js +23 -106
- package/lib/browser/index.js.map +1 -1
- package/lib/browser/index.mjs +23 -106
- package/lib/browser/index.mjs.map +1 -1
- package/lib/core/{GraphQLHandler-5pZBHLn9.d.mts → GraphQLHandler-ClMB0BOy.d.mts} +1 -1
- package/lib/core/{GraphQLHandler-Cu4Xvg4S.d.ts → GraphQLHandler-D6mLMXGZ.d.ts} +1 -1
- package/lib/core/{HttpResponse-DE19n76Q.d.ts → HttpResponse-DaYkf3ml.d.ts} +1 -1
- package/lib/core/{HttpResponse-Gtw1lt3H.d.mts → HttpResponse-vn-Pb4Bi.d.mts} +1 -1
- package/lib/core/HttpResponse.d.mts +1 -1
- package/lib/core/HttpResponse.d.ts +1 -1
- package/lib/core/SetupApi.d.mts +1 -1
- package/lib/core/SetupApi.d.ts +1 -1
- package/lib/core/getResponse.d.mts +1 -1
- package/lib/core/getResponse.d.ts +1 -1
- package/lib/core/graphql.d.mts +2 -2
- package/lib/core/graphql.d.ts +2 -2
- package/lib/core/handlers/GraphQLHandler.d.mts +2 -2
- package/lib/core/handlers/GraphQLHandler.d.ts +2 -2
- 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/http.d.mts +1 -1
- package/lib/core/http.d.ts +1 -1
- package/lib/core/index.d.mts +2 -2
- package/lib/core/index.d.ts +2 -2
- package/lib/core/passthrough.d.mts +1 -1
- package/lib/core/passthrough.d.ts +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/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/parseGraphQLRequest.d.mts +2 -2
- package/lib/core/utils/internal/parseGraphQLRequest.d.ts +2 -2
- package/lib/core/utils/internal/parseMultipartData.d.mts +1 -1
- package/lib/core/utils/internal/parseMultipartData.d.ts +1 -1
- package/lib/core/utils/internal/requestHandlerUtils.d.mts +1 -1
- package/lib/core/utils/internal/requestHandlerUtils.d.ts +1 -1
- package/lib/iife/index.js +117 -190
- package/lib/iife/index.js.map +1 -1
- package/lib/mockServiceWorker.js +1 -1
- package/package.json +21 -22
- package/src/browser/setupWorker/start/utils/getWorkerInstance.ts +12 -10
package/lib/mockServiceWorker.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* - Please do NOT serve this file on production.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
const PACKAGE_VERSION = '2.4.
|
|
11
|
+
const PACKAGE_VERSION = '2.4.11'
|
|
12
12
|
const INTEGRITY_CHECKSUM = '26357c79639bfa20d64c0efca2a87423'
|
|
13
13
|
const IS_MOCKED_RESPONSE = Symbol('isMockedResponse')
|
|
14
14
|
const activeClientIds = new Set()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "msw",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.11",
|
|
4
4
|
"description": "Seamless REST/GraphQL API mocking library for browser and Node.js.",
|
|
5
5
|
"main": "./lib/core/index.js",
|
|
6
6
|
"module": "./lib/core/index.mjs",
|
|
@@ -125,10 +125,10 @@
|
|
|
125
125
|
"graphql": "^16.8.1",
|
|
126
126
|
"headers-polyfill": "^4.0.2",
|
|
127
127
|
"is-node-process": "^1.2.0",
|
|
128
|
-
"outvariant": "^1.4.
|
|
128
|
+
"outvariant": "^1.4.3",
|
|
129
129
|
"path-to-regexp": "^6.3.0",
|
|
130
130
|
"strict-event-emitter": "^0.5.1",
|
|
131
|
-
"type-fest": "^4.
|
|
131
|
+
"type-fest": "^4.26.1",
|
|
132
132
|
"yargs": "^17.7.2"
|
|
133
133
|
},
|
|
134
134
|
"devDependencies": {
|
|
@@ -136,47 +136,46 @@
|
|
|
136
136
|
"@commitlint/config-conventional": "^18.4.4",
|
|
137
137
|
"@open-draft/test-server": "^0.4.2",
|
|
138
138
|
"@ossjs/release": "^0.8.1",
|
|
139
|
-
"@playwright/test": "^1.
|
|
140
|
-
"@swc/core": "^1.3.102",
|
|
139
|
+
"@playwright/test": "^1.48.0",
|
|
141
140
|
"@types/express": "^4.17.21",
|
|
142
141
|
"@types/fs-extra": "^11.0.4",
|
|
143
142
|
"@types/glob": "^8.1.0",
|
|
144
143
|
"@types/json-bigint": "^1.0.4",
|
|
145
144
|
"@types/node": "18.x",
|
|
146
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
147
|
-
"@typescript-eslint/parser": "^8.
|
|
148
|
-
"@web/dev-server": "^0.
|
|
149
|
-
"axios": "^1.
|
|
145
|
+
"@typescript-eslint/eslint-plugin": "^8.8.1",
|
|
146
|
+
"@typescript-eslint/parser": "^8.8.1",
|
|
147
|
+
"@web/dev-server": "^0.4.6",
|
|
148
|
+
"axios": "^1.7.7",
|
|
150
149
|
"babel-minify": "^0.5.1",
|
|
151
|
-
"commitizen": "^4.
|
|
150
|
+
"commitizen": "^4.3.1",
|
|
152
151
|
"cross-env": "^7.0.3",
|
|
153
152
|
"cross-fetch": "^4.0.0",
|
|
154
153
|
"cz-conventional-changelog": "3.3.0",
|
|
155
|
-
"esbuild": "^0.
|
|
156
|
-
"esbuild-loader": "^4.
|
|
154
|
+
"esbuild": "^0.24.0",
|
|
155
|
+
"esbuild-loader": "^4.2.2",
|
|
157
156
|
"eslint": "^8.57.0",
|
|
158
157
|
"eslint-config-prettier": "^9.1.0",
|
|
159
|
-
"eslint-plugin-prettier": "^5.1
|
|
158
|
+
"eslint-plugin-prettier": "^5.2.1",
|
|
160
159
|
"express": "^5.0.0",
|
|
161
160
|
"fs-extra": "^11.2.0",
|
|
162
161
|
"fs-teardown": "^0.3.0",
|
|
163
|
-
"glob": "^
|
|
164
|
-
"jsdom": "^
|
|
162
|
+
"glob": "^11.0.0",
|
|
163
|
+
"jsdom": "^25.0.1",
|
|
165
164
|
"json-bigint": "^1.0.0",
|
|
166
|
-
"lint-staged": "^15.2.
|
|
165
|
+
"lint-staged": "^15.2.10",
|
|
167
166
|
"page-with": "^0.6.1",
|
|
168
|
-
"prettier": "^3.
|
|
167
|
+
"prettier": "^3.3.3",
|
|
169
168
|
"regenerator-runtime": "^0.14.1",
|
|
170
|
-
"rimraf": "^
|
|
169
|
+
"rimraf": "^6.0.1",
|
|
171
170
|
"simple-git-hooks": "^2.9.0",
|
|
172
171
|
"ts-node": "^10.9.2",
|
|
173
|
-
"tsup": "^8.0
|
|
172
|
+
"tsup": "^8.3.0",
|
|
174
173
|
"typescript": "^5.5.2",
|
|
175
|
-
"undici": "^
|
|
174
|
+
"undici": "^6.20.0",
|
|
176
175
|
"url-loader": "^4.1.1",
|
|
177
176
|
"vitest": "^1.2.2",
|
|
178
|
-
"vitest-environment-miniflare": "^2.14.
|
|
179
|
-
"webpack": "^5.
|
|
177
|
+
"vitest-environment-miniflare": "^2.14.4",
|
|
178
|
+
"webpack": "^5.95.0",
|
|
180
179
|
"webpack-http-server": "^0.5.0"
|
|
181
180
|
},
|
|
182
181
|
"peerDependencies": {
|
|
@@ -36,17 +36,19 @@ export const getWorkerInstance = async (
|
|
|
36
36
|
const [existingRegistration] = mockRegistrations
|
|
37
37
|
|
|
38
38
|
if (existingRegistration) {
|
|
39
|
-
//
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
),
|
|
39
|
+
// Schedule the worker update in the background.
|
|
40
|
+
// Update ensures the existing worker is up-to-date.
|
|
41
|
+
existingRegistration.update()
|
|
42
|
+
|
|
43
|
+
// Return the worker reference immediately.
|
|
44
|
+
return [
|
|
45
|
+
getWorkerByRegistration(
|
|
47
46
|
existingRegistration,
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
absoluteWorkerUrl,
|
|
48
|
+
findWorker,
|
|
49
|
+
),
|
|
50
|
+
existingRegistration,
|
|
51
|
+
]
|
|
50
52
|
}
|
|
51
53
|
|
|
52
54
|
// When the Service Worker wasn't found, register it anew and return the reference.
|