msw 0.45.0 → 0.47.0

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.
@@ -138,6 +138,9 @@ var devUtils = {
138
138
  // src/utils/request/onUnhandledRequest.ts
139
139
  import getStringMatchScore from "js-levenshtein";
140
140
 
141
+ // src/utils/internal/parseGraphQLRequest.ts
142
+ import { parse } from "graphql";
143
+
141
144
  // src/utils/request/getPublicUrlFromRequest.ts
142
145
  var getPublicUrlFromRequest = (request) => {
143
146
  return request.referrer.startsWith(request.url.origin) ? request.url.pathname : new URL(request.url.pathname, `${request.url.protocol}//${request.url.host}`).href;
@@ -165,8 +168,7 @@ function parseDocumentNode(node) {
165
168
  }
166
169
  function parseQuery(query) {
167
170
  try {
168
- const { parse: parse3 } = __require("graphql");
169
- const ast = parse3(query);
171
+ const ast = parse(query);
170
172
  return parseDocumentNode(ast);
171
173
  } catch (error2) {
172
174
  return error2;
@@ -1225,6 +1227,13 @@ function pipeEvents(source, destination) {
1225
1227
  source.emit._isPiped = true;
1226
1228
  }
1227
1229
 
1230
+ // src/utils/internal/toReadonlyArray.ts
1231
+ function toReadonlyArray(source) {
1232
+ const clone = [...source];
1233
+ Object.freeze(clone);
1234
+ return clone;
1235
+ }
1236
+
1228
1237
  // src/node/createSetupServer.ts
1229
1238
  var DEFAULT_LISTEN_OPTIONS = {
1230
1239
  onUnhandledRequest: "warn"
@@ -1296,8 +1305,12 @@ function createSetupServer(...interceptors) {
1296
1305
  resetHandlers(...nextHandlers) {
1297
1306
  currentHandlers = resetHandlers(requestHandlers, ...nextHandlers);
1298
1307
  },
1308
+ listHandlers() {
1309
+ return toReadonlyArray(currentHandlers);
1310
+ },
1299
1311
  printHandlers() {
1300
- currentHandlers.forEach((handler) => {
1312
+ const handlers = this.listHandlers();
1313
+ handlers.forEach((handler) => {
1301
1314
  const { header, callFrame } = handler.info;
1302
1315
  const pragma = handler.info.hasOwnProperty("operationType") ? "[graphql]" : "[rest]";
1303
1316
  console.log(`${bold(`${pragma} ${header}`)}