@zimic/interceptor 0.16.0-canary.7 → 0.16.0-canary.9

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/dist/http.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import chalk2 from 'chalk';
1
+ import color2 from 'picocolors';
2
2
  import { HttpHeaders, HttpSearchParams, HttpFormData, HTTP_METHODS, HTTP_METHODS_WITH_RESPONSE_BODY } from '@zimic/http';
3
3
  import { http, passthrough } from 'msw';
4
4
  import * as mswBrowser from 'msw/browser';
@@ -248,7 +248,7 @@ __name(formatValueToLog, "formatValueToLog");
248
248
  function logWithPrefix(messageOrMessages, options = {}) {
249
249
  const { method = "log" } = options;
250
250
  const messages = Array.isArray(messageOrMessages) ? messageOrMessages : [messageOrMessages];
251
- console[method](chalk2.cyan("[@zimic/interceptor]"), ...messages);
251
+ console[method](color2.cyan("[@zimic/interceptor]"), ...messages);
252
252
  }
253
253
  __name(logWithPrefix, "logWithPrefix");
254
254
 
@@ -274,8 +274,8 @@ function createMessageHeader({
274
274
 
275
275
  Requests evaluated by this handler:
276
276
 
277
- ${chalk2.green("- Expected")}
278
- ${chalk2.red("+ Received")}`
277
+ ${color2.green("- Expected")}
278
+ ${color2.red("+ Received")}`
279
279
  ].filter((part) => part !== false).join("");
280
280
  }
281
281
  __name(createMessageHeader, "createMessageHeader");
@@ -290,22 +290,22 @@ function createMessageDiffs({ requestSaving, unmatchedRequestGroups }) {
290
290
  messageParts.push("Computed restriction:");
291
291
  const stringifiedExpected = stringifyValueToLog(diff.computed.expected);
292
292
  const stringifiedReceived = stringifyValueToLog(diff.computed.received);
293
- messageParts.push(` ${chalk2.green(`- return ${stringifiedExpected}`)}`);
294
- messageParts.push(` ${chalk2.red(`+ return ${stringifiedReceived}`)}`);
293
+ messageParts.push(` ${color2.green(`- return ${stringifiedExpected}`)}`);
294
+ messageParts.push(` ${color2.red(`+ return ${stringifiedReceived}`)}`);
295
295
  }
296
296
  if (diff.headers) {
297
297
  messageParts.push("Headers:");
298
298
  const stringifiedExpected = stringifyValueToLog(diff.headers.expected);
299
299
  const stringifiedReceived = stringifyValueToLog(diff.headers.received);
300
- messageParts.push(` ${chalk2.green(`- ${stringifiedExpected}`)}`);
301
- messageParts.push(` ${chalk2.red(`+ ${stringifiedReceived}`)}`);
300
+ messageParts.push(` ${color2.green(`- ${stringifiedExpected}`)}`);
301
+ messageParts.push(` ${color2.red(`+ ${stringifiedReceived}`)}`);
302
302
  }
303
303
  if (diff.searchParams) {
304
304
  messageParts.push("Search params:");
305
305
  const stringifiedExpected = stringifyValueToLog(diff.searchParams.expected);
306
306
  const stringifiedReceived = stringifyValueToLog(diff.searchParams.received);
307
- messageParts.push(` ${chalk2.green(`- ${stringifiedExpected}`)}`);
308
- messageParts.push(` ${chalk2.red(`+ ${stringifiedReceived}`)}`);
307
+ messageParts.push(` ${color2.green(`- ${stringifiedExpected}`)}`);
308
+ messageParts.push(` ${color2.red(`+ ${stringifiedReceived}`)}`);
309
309
  }
310
310
  if (diff.body) {
311
311
  messageParts.push("Body:");
@@ -315,8 +315,8 @@ function createMessageDiffs({ requestSaving, unmatchedRequestGroups }) {
315
315
  const stringifiedReceived = stringifyValueToLog(diff.body.received, {
316
316
  includeClassName: { searchParams: true }
317
317
  });
318
- messageParts.push(` ${chalk2.green(`- ${stringifiedExpected}`)}`);
319
- messageParts.push(` ${chalk2.red(`+ ${stringifiedReceived}`)}`);
318
+ messageParts.push(` ${color2.green(`- ${stringifiedExpected}`)}`);
319
+ messageParts.push(` ${color2.red(`+ ${stringifiedReceived}`)}`);
320
320
  }
321
321
  return messageParts.join("\n ");
322
322
  }).join("\n\n");
@@ -1177,7 +1177,7 @@ var HttpInterceptorWorker = class _HttpInterceptorWorker {
1177
1177
  ]);
1178
1178
  logWithPrefix(
1179
1179
  [
1180
- `${action === "bypass" ? "Warning:" : "Error:"} Request was not handled and was ${action === "bypass" ? chalk2.yellow("bypassed") : chalk2.red("rejected")}.
1180
+ `${action === "bypass" ? "Warning:" : "Error:"} Request was not handled and was ${action === "bypass" ? color2.yellow("bypassed") : color2.red("rejected")}.
1181
1181
 
1182
1182
  `,
1183
1183
  `${request.method} ${request.url}`,