msw 0.0.0-fetch.rc-15 → 0.0.0-fetch.rc-17
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 +13 -8
- package/lib/browser/index.d.ts +0 -6
- package/lib/browser/index.js +14 -32
- package/lib/browser/index.mjs +14 -32
- package/lib/core/NetworkError.d.ts +2 -2
- package/lib/core/SetupApi.d.ts +0 -1
- package/lib/core/handlers/GraphQLHandler.js +1 -1
- package/lib/core/handlers/GraphQLHandler.mjs +1 -1
- package/lib/core/handlers/{RestHandler.d.ts → HttpHandler.d.ts} +12 -12
- package/lib/core/handlers/{RestHandler.js → HttpHandler.js} +16 -16
- package/lib/core/handlers/{RestHandler.mjs → HttpHandler.mjs} +13 -13
- package/lib/core/{rest.d.ts → http.d.ts} +11 -11
- package/lib/core/{rest.js → http.js} +16 -16
- package/lib/core/http.mjs +22 -0
- package/lib/core/{rest.spec.js → http.spec.js} +3 -3
- package/lib/core/{rest.spec.mjs → http.spec.mjs} +3 -3
- package/lib/core/index.d.ts +2 -2
- package/lib/core/index.js +6 -6
- package/lib/core/index.mjs +6 -6
- package/lib/core/passthrough.d.ts +5 -2
- package/lib/core/sharedOptions.d.ts +45 -7
- package/lib/core/utils/handleRequest.js +13 -9
- package/lib/core/utils/handleRequest.mjs +13 -9
- package/lib/core/utils/internal/parseGraphQLRequest.js +4 -3
- package/lib/core/utils/internal/parseGraphQLRequest.mjs +4 -3
- package/lib/core/utils/request/onUnhandledRequest.js +14 -8
- package/lib/core/utils/request/onUnhandledRequest.mjs +15 -9
- package/lib/iife/index.js +97 -104
- package/lib/mockServiceWorker.js +1 -1
- package/lib/native/index.d.ts +0 -6
- package/lib/native/index.js +5 -13
- package/lib/native/index.mjs +5 -13
- package/lib/node/index.d.ts +0 -6
- package/lib/node/index.js +5 -13
- package/lib/node/index.mjs +5 -13
- package/package.json +2 -1
- package/lib/core/rest.mjs +0 -22
- /package/lib/core/{rest.spec.d.ts → http.spec.d.ts} +0 -0
package/lib/node/index.mjs
CHANGED
|
@@ -64,9 +64,11 @@ var SetupServerApi = class extends SetupApi {
|
|
|
64
64
|
({ response, isMockedResponse, request, requestId }) => {
|
|
65
65
|
this.emitter.emit(
|
|
66
66
|
isMockedResponse ? "response:mocked" : "response:bypass",
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
{
|
|
68
|
+
response,
|
|
69
|
+
request,
|
|
70
|
+
requestId
|
|
71
|
+
}
|
|
70
72
|
);
|
|
71
73
|
}
|
|
72
74
|
);
|
|
@@ -90,16 +92,6 @@ var SetupServerApi = class extends SetupApi {
|
|
|
90
92
|
"https://github.com/mswjs/msw/issues/new/choose"
|
|
91
93
|
);
|
|
92
94
|
}
|
|
93
|
-
printHandlers() {
|
|
94
|
-
const handlers = this.listHandlers();
|
|
95
|
-
handlers.forEach((handler) => {
|
|
96
|
-
const { header, callFrame } = handler.info;
|
|
97
|
-
const pragma = handler.info.hasOwnProperty("operationType") ? "[graphql]" : "[rest]";
|
|
98
|
-
console.log(`${`${pragma} ${header}`}
|
|
99
|
-
Declaration: ${callFrame}
|
|
100
|
-
`);
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
95
|
close() {
|
|
104
96
|
this.dispose();
|
|
105
97
|
}
|
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "msw",
|
|
3
|
-
"version": "0.0.0-fetch.rc-
|
|
3
|
+
"version": "0.0.0-fetch.rc-17",
|
|
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",
|
|
7
7
|
"types": "./lib/core/index.d.ts",
|
|
8
|
+
"packageManager": "pnpm@7.12.2",
|
|
8
9
|
"exports": {
|
|
9
10
|
".": {
|
|
10
11
|
"types": "./lib/core/index.d.ts",
|
package/lib/core/rest.mjs
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
RESTMethods,
|
|
3
|
-
RestHandler
|
|
4
|
-
} from './handlers/RestHandler.mjs';
|
|
5
|
-
function createRestHandler(method) {
|
|
6
|
-
return (path, resolver, options = {}) => {
|
|
7
|
-
return new RestHandler(method, path, resolver, options);
|
|
8
|
-
};
|
|
9
|
-
}
|
|
10
|
-
const rest = {
|
|
11
|
-
all: createRestHandler(/.+/),
|
|
12
|
-
head: createRestHandler(RESTMethods.HEAD),
|
|
13
|
-
get: createRestHandler(RESTMethods.GET),
|
|
14
|
-
post: createRestHandler(RESTMethods.POST),
|
|
15
|
-
put: createRestHandler(RESTMethods.PUT),
|
|
16
|
-
delete: createRestHandler(RESTMethods.DELETE),
|
|
17
|
-
patch: createRestHandler(RESTMethods.PATCH),
|
|
18
|
-
options: createRestHandler(RESTMethods.OPTIONS)
|
|
19
|
-
};
|
|
20
|
-
export {
|
|
21
|
-
rest
|
|
22
|
-
};
|
|
File without changes
|