msw 0.0.0-fetch.rc-17 → 0.0.0-fetch.rc-19
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 +2 -12
- package/lib/browser/index.mjs +2 -12
- package/lib/core/index.d.ts +0 -1
- package/lib/core/index.js +0 -2
- package/lib/core/index.mjs +0 -2
- package/lib/iife/index.js +645 -2324
- package/lib/mockServiceWorker.js +2 -20
- package/package.json +5 -5
- package/lib/core/NetworkError.d.ts +0 -16
- package/lib/core/NetworkError.js +0 -29
- package/lib/core/NetworkError.mjs +0 -9
package/lib/mockServiceWorker.js
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
/* tslint:disable */
|
|
3
3
|
|
|
4
4
|
/**
|
|
5
|
-
* Mock Service Worker (0.0.0-fetch.rc-
|
|
5
|
+
* Mock Service Worker (0.0.0-fetch.rc-19).
|
|
6
6
|
* @see https://github.com/mswjs/msw
|
|
7
7
|
* - Please do NOT modify this file.
|
|
8
8
|
* - Please do NOT serve this file on production.
|
|
9
9
|
*/
|
|
10
10
|
|
|
11
|
-
const INTEGRITY_CHECKSUM = '
|
|
11
|
+
const INTEGRITY_CHECKSUM = 'e2d8525b2d1bdadf89a15ae5a2619512'
|
|
12
12
|
const IS_MOCKED_RESPONSE = Symbol('isMockedResponse')
|
|
13
13
|
const activeClientIds = new Set()
|
|
14
14
|
|
|
@@ -112,15 +112,6 @@ self.addEventListener('fetch', function (event) {
|
|
|
112
112
|
|
|
113
113
|
event.respondWith(
|
|
114
114
|
handleRequest(event, requestId).catch((error) => {
|
|
115
|
-
if (error.name === 'NetworkError') {
|
|
116
|
-
console.warn(
|
|
117
|
-
'[MSW] Successfully emulated a network error for the "%s %s" request.',
|
|
118
|
-
request.method,
|
|
119
|
-
request.url,
|
|
120
|
-
)
|
|
121
|
-
return
|
|
122
|
-
}
|
|
123
|
-
|
|
124
115
|
// At this point, any exception indicates an issue with the original request/response.
|
|
125
116
|
console.error(
|
|
126
117
|
`\
|
|
@@ -270,15 +261,6 @@ async function getResponse(event, client, requestId) {
|
|
|
270
261
|
case 'MOCK_NOT_FOUND': {
|
|
271
262
|
return passthrough()
|
|
272
263
|
}
|
|
273
|
-
|
|
274
|
-
case 'NETWORK_ERROR': {
|
|
275
|
-
const { name, message } = clientMessage.data
|
|
276
|
-
const networkError = new Error(message)
|
|
277
|
-
networkError.name = name
|
|
278
|
-
|
|
279
|
-
// Rejecting a "respondWith" promise emulates a network error.
|
|
280
|
-
throw networkError
|
|
281
|
-
}
|
|
282
264
|
}
|
|
283
265
|
|
|
284
266
|
return passthrough()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "msw",
|
|
3
|
-
"version": "0.0.0-fetch.rc-
|
|
3
|
+
"version": "0.0.0-fetch.rc-19",
|
|
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",
|
|
@@ -114,7 +114,7 @@
|
|
|
114
114
|
"@bundled-es-modules/js-levenshtein": "^2.0.1",
|
|
115
115
|
"@bundled-es-modules/statuses": "^1.0.1",
|
|
116
116
|
"@mswjs/cookies": "^1.0.0",
|
|
117
|
-
"@mswjs/interceptors": "^0.
|
|
117
|
+
"@mswjs/interceptors": "^0.25.1",
|
|
118
118
|
"@open-draft/until": "^2.1.0",
|
|
119
119
|
"@types/cookie": "^0.4.1",
|
|
120
120
|
"@types/js-levenshtein": "^1.1.1",
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
"chokidar": "^3.4.2",
|
|
124
124
|
"formdata-node": "4.4.1",
|
|
125
125
|
"graphql": "^15.0.0 || ^16.7.0",
|
|
126
|
-
"headers-polyfill": "^3.
|
|
126
|
+
"headers-polyfill": "^3.2.3",
|
|
127
127
|
"inquirer": "^8.2.0",
|
|
128
128
|
"is-node-process": "^1.2.0",
|
|
129
129
|
"js-levenshtein": "^1.1.6",
|
|
@@ -140,7 +140,7 @@
|
|
|
140
140
|
"@commitlint/cli": "^16.1.0",
|
|
141
141
|
"@commitlint/config-conventional": "^16.0.0",
|
|
142
142
|
"@open-draft/test-server": "^0.4.2",
|
|
143
|
-
"@ossjs/release": "^0.
|
|
143
|
+
"@ossjs/release": "^0.7.2",
|
|
144
144
|
"@playwright/test": "^1.30.0",
|
|
145
145
|
"@swc/core": "^1.3.35",
|
|
146
146
|
"@swc/jest": "^0.2.24",
|
|
@@ -189,7 +189,7 @@
|
|
|
189
189
|
"webpack-http-server": "^0.5.0"
|
|
190
190
|
},
|
|
191
191
|
"peerDependencies": {
|
|
192
|
-
"typescript": ">= 4.4.x <= 5.
|
|
192
|
+
"typescript": ">= 4.4.x <= 5.2.x"
|
|
193
193
|
},
|
|
194
194
|
"peerDependenciesMeta": {
|
|
195
195
|
"typescript": {
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* An error indicating network issues while
|
|
3
|
-
* processing a request.
|
|
4
|
-
*
|
|
5
|
-
* @example
|
|
6
|
-
* import { http, NetworkError } from 'msw'
|
|
7
|
-
*
|
|
8
|
-
* http.get('/user', () => {
|
|
9
|
-
* throw new NetworkError('Failed to fetch')
|
|
10
|
-
* })
|
|
11
|
-
*/
|
|
12
|
-
declare class NetworkError extends Error {
|
|
13
|
-
constructor(message: string);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export { NetworkError };
|
package/lib/core/NetworkError.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
-
var __export = (target, all) => {
|
|
7
|
-
for (var name in all)
|
|
8
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
-
};
|
|
10
|
-
var __copyProps = (to, from, except, desc) => {
|
|
11
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
-
for (let key of __getOwnPropNames(from))
|
|
13
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
-
}
|
|
16
|
-
return to;
|
|
17
|
-
};
|
|
18
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
-
var NetworkError_exports = {};
|
|
20
|
-
__export(NetworkError_exports, {
|
|
21
|
-
NetworkError: () => NetworkError
|
|
22
|
-
});
|
|
23
|
-
module.exports = __toCommonJS(NetworkError_exports);
|
|
24
|
-
class NetworkError extends Error {
|
|
25
|
-
constructor(message) {
|
|
26
|
-
super(message);
|
|
27
|
-
this.name = "NetworkError";
|
|
28
|
-
}
|
|
29
|
-
}
|