@mswjs/interceptors 0.22.10 → 0.22.12

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.
Files changed (72) hide show
  1. package/lib/browser/{Interceptor-c794917d.d.ts → Interceptor-c8fc448a.d.ts} +3 -3
  2. package/lib/browser/{chunk-KX4GZMPY.mjs → chunk-4W72RMFC.mjs} +15 -11
  3. package/lib/browser/{chunk-OK5YCL7L.js → chunk-ECRLBCQN.js} +55 -55
  4. package/lib/browser/{chunk-KQGVZIDK.js → chunk-EGQUVEJ3.js} +19 -15
  5. package/lib/browser/{chunk-2EIH6L6D.js → chunk-KCAWLR7J.js} +25 -25
  6. package/lib/browser/{chunk-CKVJ2NZB.mjs → chunk-MJZRQFUP.mjs} +67 -54
  7. package/lib/browser/{chunk-H4SFMU2L.js → chunk-NHFEA72Q.js} +74 -61
  8. package/lib/browser/{chunk-2GVXYEMC.mjs → chunk-O7B67YBY.mjs} +54 -54
  9. package/lib/browser/{chunk-65HGG3CV.mjs → chunk-UYUNRMLU.mjs} +1 -1
  10. package/lib/browser/index.d.ts +3 -3
  11. package/lib/browser/index.js +8 -8
  12. package/lib/browser/index.mjs +6 -6
  13. package/lib/browser/interceptors/XMLHttpRequest/index.d.ts +2 -2
  14. package/lib/browser/interceptors/XMLHttpRequest/index.js +4 -4
  15. package/lib/browser/interceptors/XMLHttpRequest/index.mjs +3 -3
  16. package/lib/browser/interceptors/fetch/index.d.ts +2 -2
  17. package/lib/browser/interceptors/fetch/index.js +3 -3
  18. package/lib/browser/interceptors/fetch/index.mjs +2 -2
  19. package/lib/browser/presets/browser.d.ts +2 -2
  20. package/lib/browser/presets/browser.js +6 -6
  21. package/lib/browser/presets/browser.mjs +4 -4
  22. package/lib/node/{BatchInterceptor-5c1e5de3.d.ts → BatchInterceptor-fe69020d.d.ts} +1 -1
  23. package/lib/node/{Interceptor-b3a4098c.d.ts → Interceptor-f9dfe016.d.ts} +3 -3
  24. package/lib/node/RemoteHttpInterceptor.d.ts +3 -3
  25. package/lib/node/RemoteHttpInterceptor.js +25 -19
  26. package/lib/node/RemoteHttpInterceptor.mjs +21 -15
  27. package/lib/node/{chunk-VTP5KY7W.js → chunk-2OJRZCGS.js} +71 -58
  28. package/lib/node/{chunk-6CRMKMDL.mjs → chunk-3V5OWTY7.mjs} +54 -55
  29. package/lib/node/{chunk-62KFIM4W.js → chunk-6KJ5M2VR.js} +56 -57
  30. package/lib/node/{chunk-A3X67VOL.js → chunk-7XU7Q63W.js} +111 -94
  31. package/lib/node/{chunk-MUUQLKVJ.js → chunk-PKB2CXQV.js} +3 -3
  32. package/lib/node/{chunk-SFLY7F52.js → chunk-RJMXHEGJ.js} +6 -6
  33. package/lib/node/{chunk-EHQJSMSD.mjs → chunk-RL5IV5PL.mjs} +67 -54
  34. package/lib/node/{chunk-RFVEKRYP.mjs → chunk-S5A4P4BZ.mjs} +1 -1
  35. package/lib/node/{chunk-IC6Y7RGW.mjs → chunk-SBAVVQIW.mjs} +5 -5
  36. package/lib/node/{chunk-W27FTX2A.mjs → chunk-XVHIXGXD.mjs} +111 -94
  37. package/lib/node/index.d.ts +3 -3
  38. package/lib/node/index.js +4 -4
  39. package/lib/node/index.mjs +3 -3
  40. package/lib/node/interceptors/ClientRequest/index.d.ts +2 -2
  41. package/lib/node/interceptors/ClientRequest/index.js +3 -3
  42. package/lib/node/interceptors/ClientRequest/index.mjs +2 -2
  43. package/lib/node/interceptors/XMLHttpRequest/index.d.ts +2 -2
  44. package/lib/node/interceptors/XMLHttpRequest/index.js +4 -4
  45. package/lib/node/interceptors/XMLHttpRequest/index.mjs +3 -3
  46. package/lib/node/interceptors/fetch/index.d.ts +2 -2
  47. package/lib/node/interceptors/fetch/index.js +16 -12
  48. package/lib/node/interceptors/fetch/index.mjs +15 -11
  49. package/lib/node/presets/node.d.ts +2 -2
  50. package/lib/node/presets/node.js +6 -6
  51. package/lib/node/presets/node.mjs +4 -4
  52. package/package.json +2 -3
  53. package/src/BatchInterceptor.ts +4 -4
  54. package/src/Interceptor.ts +27 -27
  55. package/src/RemoteHttpInterceptor.ts +16 -10
  56. package/src/interceptors/ClientRequest/NodeClientRequest.test.ts +11 -11
  57. package/src/interceptors/ClientRequest/NodeClientRequest.ts +47 -38
  58. package/src/interceptors/ClientRequest/http.request.ts +3 -3
  59. package/src/interceptors/ClientRequest/index.ts +4 -4
  60. package/src/interceptors/ClientRequest/utils/createRequest.test.ts +5 -5
  61. package/src/interceptors/ClientRequest/utils/getIncomingMessageBody.ts +7 -7
  62. package/src/interceptors/ClientRequest/utils/normalizeClientRequestArgs.ts +27 -27
  63. package/src/interceptors/ClientRequest/utils/normalizeClientRequestEndArgs.ts +4 -4
  64. package/src/interceptors/ClientRequest/utils/normalizeClientRequestWriteArgs.ts +7 -4
  65. package/src/interceptors/XMLHttpRequest/XMLHttpRequestController.ts +47 -36
  66. package/src/interceptors/XMLHttpRequest/XMLHttpRequestProxy.ts +15 -13
  67. package/src/interceptors/XMLHttpRequest/index.ts +5 -5
  68. package/src/interceptors/fetch/index.ts +14 -11
  69. package/src/utils/AsyncEventEmitter.ts +27 -27
  70. package/src/utils/cloneObject.ts +7 -7
  71. package/src/utils/getUrlByRequestOptions.ts +13 -13
  72. package/src/utils/debug.ts +0 -4
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  __commonJS
3
- } from "./chunk-2GVXYEMC.mjs";
3
+ } from "./chunk-O7B67YBY.mjs";
4
4
 
5
5
  // node_modules/has-symbols/shams.js
6
6
  var require_shams = __commonJS({
@@ -1,7 +1,7 @@
1
- import { I as Interceptor, E as ExtractEventNames } from './Interceptor-c794917d.js';
2
- export { E as ExtractEventNames, H as HttpRequestEventMap, a as IS_PATCHED_MODULE, I as Interceptor, b as InterceptorEventMap, e as InterceptorReadyState, c as InterceptorSubscription, R as RequestCredentials, d as deleteGlobalSymbol, g as getGlobalSymbol } from './Interceptor-c794917d.js';
1
+ import { I as Interceptor, E as ExtractEventNames } from './Interceptor-c8fc448a.js';
2
+ export { E as ExtractEventNames, H as HttpRequestEventMap, a as IS_PATCHED_MODULE, I as Interceptor, b as InterceptorEventMap, e as InterceptorReadyState, c as InterceptorSubscription, R as RequestCredentials, d as deleteGlobalSymbol, g as getGlobalSymbol } from './Interceptor-c8fc448a.js';
3
3
  import { EventMap, Listener } from 'strict-event-emitter';
4
- import 'debug';
4
+ import '@open-draft/logger';
5
5
 
6
6
  interface BatchInterceptorOptions<InterceptorList extends ReadonlyArray<Interceptor<any>>> {
7
7
  name: string;
@@ -1,29 +1,29 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
3
 
4
- var _chunk2EIH6L6Djs = require('./chunk-2EIH6L6D.js');
4
+ var _chunkKCAWLR7Jjs = require('./chunk-KCAWLR7J.js');
5
5
 
6
6
 
7
7
 
8
8
 
9
9
 
10
10
 
11
- var _chunkOK5YCL7Ljs = require('./chunk-OK5YCL7L.js');
11
+ var _chunkECRLBCQNjs = require('./chunk-ECRLBCQN.js');
12
12
 
13
13
  // src/BatchInterceptor.ts
14
- var BatchInterceptor = class extends _chunkOK5YCL7Ljs.Interceptor {
14
+ var BatchInterceptor = class extends _chunkECRLBCQNjs.Interceptor {
15
15
  constructor(options) {
16
16
  BatchInterceptor.symbol = Symbol(options.name);
17
17
  super(BatchInterceptor.symbol);
18
18
  this.interceptors = options.interceptors;
19
19
  }
20
20
  setup() {
21
- const log = this.log.extend("setup");
22
- log("applying all %d interceptors...", this.interceptors.length);
21
+ const logger = this.logger.extend("setup");
22
+ logger.info("applying all %d interceptors...", this.interceptors.length);
23
23
  for (const interceptor of this.interceptors) {
24
- log('applying "%s" interceptor...', interceptor.constructor.name);
24
+ logger.info('applying "%s" interceptor...', interceptor.constructor.name);
25
25
  interceptor.apply();
26
- log("adding interceptor dispose subscription");
26
+ logger.info("adding interceptor dispose subscription");
27
27
  this.subscriptions.push(() => interceptor.dispose());
28
28
  }
29
29
  }
@@ -48,4 +48,4 @@ function getCleanUrl(url, isAbsolute = true) {
48
48
 
49
49
 
50
50
 
51
- exports.BatchInterceptor = BatchInterceptor; exports.IS_PATCHED_MODULE = _chunkOK5YCL7Ljs.IS_PATCHED_MODULE; exports.Interceptor = _chunkOK5YCL7Ljs.Interceptor; exports.InterceptorReadyState = _chunkOK5YCL7Ljs.InterceptorReadyState; exports.decodeBuffer = _chunk2EIH6L6Djs.decodeBuffer; exports.deleteGlobalSymbol = _chunkOK5YCL7Ljs.deleteGlobalSymbol; exports.encodeBuffer = _chunk2EIH6L6Djs.encodeBuffer; exports.getCleanUrl = getCleanUrl; exports.getGlobalSymbol = _chunkOK5YCL7Ljs.getGlobalSymbol;
51
+ exports.BatchInterceptor = BatchInterceptor; exports.IS_PATCHED_MODULE = _chunkECRLBCQNjs.IS_PATCHED_MODULE; exports.Interceptor = _chunkECRLBCQNjs.Interceptor; exports.InterceptorReadyState = _chunkECRLBCQNjs.InterceptorReadyState; exports.decodeBuffer = _chunkKCAWLR7Jjs.decodeBuffer; exports.deleteGlobalSymbol = _chunkECRLBCQNjs.deleteGlobalSymbol; exports.encodeBuffer = _chunkKCAWLR7Jjs.encodeBuffer; exports.getCleanUrl = getCleanUrl; exports.getGlobalSymbol = _chunkECRLBCQNjs.getGlobalSymbol;
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  decodeBuffer,
3
3
  encodeBuffer
4
- } from "./chunk-65HGG3CV.mjs";
4
+ } from "./chunk-UYUNRMLU.mjs";
5
5
  import {
6
6
  IS_PATCHED_MODULE,
7
7
  Interceptor,
8
8
  InterceptorReadyState,
9
9
  deleteGlobalSymbol,
10
10
  getGlobalSymbol
11
- } from "./chunk-2GVXYEMC.mjs";
11
+ } from "./chunk-O7B67YBY.mjs";
12
12
 
13
13
  // src/BatchInterceptor.ts
14
14
  var BatchInterceptor = class extends Interceptor {
@@ -18,12 +18,12 @@ var BatchInterceptor = class extends Interceptor {
18
18
  this.interceptors = options.interceptors;
19
19
  }
20
20
  setup() {
21
- const log = this.log.extend("setup");
22
- log("applying all %d interceptors...", this.interceptors.length);
21
+ const logger = this.logger.extend("setup");
22
+ logger.info("applying all %d interceptors...", this.interceptors.length);
23
23
  for (const interceptor of this.interceptors) {
24
- log('applying "%s" interceptor...', interceptor.constructor.name);
24
+ logger.info('applying "%s" interceptor...', interceptor.constructor.name);
25
25
  interceptor.apply();
26
- log("adding interceptor dispose subscription");
26
+ logger.info("adding interceptor dispose subscription");
27
27
  this.subscriptions.push(() => interceptor.dispose());
28
28
  }
29
29
  }
@@ -1,6 +1,6 @@
1
- import { f as InteractiveRequest, A as AsyncEventEmitter, H as HttpRequestEventMap, I as Interceptor } from '../../Interceptor-c794917d.js';
1
+ import { f as InteractiveRequest, A as AsyncEventEmitter, H as HttpRequestEventMap, I as Interceptor } from '../../Interceptor-c8fc448a.js';
2
+ import '@open-draft/logger';
2
3
  import 'strict-event-emitter';
3
- import 'debug';
4
4
 
5
5
  type XMLHttpRequestEventListener = (request: InteractiveRequest, requestId: string) => Promise<void> | void;
6
6
  type XMLHttpRequestEmitter = AsyncEventEmitter<HttpRequestEventMap>;
@@ -1,9 +1,9 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkH4SFMU2Ljs = require('../../chunk-H4SFMU2L.js');
4
- require('../../chunk-2EIH6L6D.js');
3
+ var _chunkNHFEA72Qjs = require('../../chunk-NHFEA72Q.js');
4
+ require('../../chunk-KCAWLR7J.js');
5
5
  require('../../chunk-PCFJD76X.js');
6
- require('../../chunk-OK5YCL7L.js');
6
+ require('../../chunk-ECRLBCQN.js');
7
7
 
8
8
 
9
- exports.XMLHttpRequestInterceptor = _chunkH4SFMU2Ljs.XMLHttpRequestInterceptor;
9
+ exports.XMLHttpRequestInterceptor = _chunkNHFEA72Qjs.XMLHttpRequestInterceptor;
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  XMLHttpRequestInterceptor
3
- } from "../../chunk-CKVJ2NZB.mjs";
4
- import "../../chunk-65HGG3CV.mjs";
3
+ } from "../../chunk-MJZRQFUP.mjs";
4
+ import "../../chunk-UYUNRMLU.mjs";
5
5
  import "../../chunk-RT3ATOJH.mjs";
6
- import "../../chunk-2GVXYEMC.mjs";
6
+ import "../../chunk-O7B67YBY.mjs";
7
7
  export {
8
8
  XMLHttpRequestInterceptor
9
9
  };
@@ -1,6 +1,6 @@
1
- import { I as Interceptor, H as HttpRequestEventMap } from '../../Interceptor-c794917d.js';
1
+ import { I as Interceptor, H as HttpRequestEventMap } from '../../Interceptor-c8fc448a.js';
2
+ import '@open-draft/logger';
2
3
  import 'strict-event-emitter';
3
- import 'debug';
4
4
 
5
5
  declare class FetchInterceptor extends Interceptor<HttpRequestEventMap> {
6
6
  static symbol: symbol;
@@ -1,8 +1,8 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkKQGVZIDKjs = require('../../chunk-KQGVZIDK.js');
3
+ var _chunkEGQUVEJ3js = require('../../chunk-EGQUVEJ3.js');
4
4
  require('../../chunk-PCFJD76X.js');
5
- require('../../chunk-OK5YCL7L.js');
5
+ require('../../chunk-ECRLBCQN.js');
6
6
 
7
7
 
8
- exports.FetchInterceptor = _chunkKQGVZIDKjs.FetchInterceptor;
8
+ exports.FetchInterceptor = _chunkEGQUVEJ3js.FetchInterceptor;
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  FetchInterceptor
3
- } from "../../chunk-KX4GZMPY.mjs";
3
+ } from "../../chunk-4W72RMFC.mjs";
4
4
  import "../../chunk-RT3ATOJH.mjs";
5
- import "../../chunk-2GVXYEMC.mjs";
5
+ import "../../chunk-O7B67YBY.mjs";
6
6
  export {
7
7
  FetchInterceptor
8
8
  };
@@ -1,8 +1,8 @@
1
1
  import { FetchInterceptor } from '../interceptors/fetch/index.js';
2
2
  import { XMLHttpRequestInterceptor } from '../interceptors/XMLHttpRequest/index.js';
3
- import '../Interceptor-c794917d.js';
3
+ import '../Interceptor-c8fc448a.js';
4
+ import '@open-draft/logger';
4
5
  import 'strict-event-emitter';
5
- import 'debug';
6
6
 
7
7
  /**
8
8
  * The default preset provisions the interception of requests
@@ -1,17 +1,17 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkH4SFMU2Ljs = require('../chunk-H4SFMU2L.js');
4
- require('../chunk-2EIH6L6D.js');
3
+ var _chunkNHFEA72Qjs = require('../chunk-NHFEA72Q.js');
4
+ require('../chunk-KCAWLR7J.js');
5
5
 
6
6
 
7
- var _chunkKQGVZIDKjs = require('../chunk-KQGVZIDK.js');
7
+ var _chunkEGQUVEJ3js = require('../chunk-EGQUVEJ3.js');
8
8
  require('../chunk-PCFJD76X.js');
9
- require('../chunk-OK5YCL7L.js');
9
+ require('../chunk-ECRLBCQN.js');
10
10
 
11
11
  // src/presets/browser.ts
12
12
  var browser_default = [
13
- new (0, _chunkKQGVZIDKjs.FetchInterceptor)(),
14
- new (0, _chunkH4SFMU2Ljs.XMLHttpRequestInterceptor)()
13
+ new (0, _chunkEGQUVEJ3js.FetchInterceptor)(),
14
+ new (0, _chunkNHFEA72Qjs.XMLHttpRequestInterceptor)()
15
15
  ];
16
16
 
17
17
 
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  XMLHttpRequestInterceptor
3
- } from "../chunk-CKVJ2NZB.mjs";
4
- import "../chunk-65HGG3CV.mjs";
3
+ } from "../chunk-MJZRQFUP.mjs";
4
+ import "../chunk-UYUNRMLU.mjs";
5
5
  import {
6
6
  FetchInterceptor
7
- } from "../chunk-KX4GZMPY.mjs";
7
+ } from "../chunk-4W72RMFC.mjs";
8
8
  import "../chunk-RT3ATOJH.mjs";
9
- import "../chunk-2GVXYEMC.mjs";
9
+ import "../chunk-O7B67YBY.mjs";
10
10
 
11
11
  // src/presets/browser.ts
12
12
  var browser_default = [
@@ -1,5 +1,5 @@
1
1
  import { EventMap, Listener } from 'strict-event-emitter';
2
- import { e as Interceptor, E as ExtractEventNames } from './Interceptor-b3a4098c.js';
2
+ import { e as Interceptor, E as ExtractEventNames } from './Interceptor-f9dfe016.js';
3
3
 
4
4
  interface BatchInterceptorOptions<InterceptorList extends ReadonlyArray<Interceptor<any>>> {
5
5
  name: string;
@@ -1,5 +1,5 @@
1
+ import { Logger } from '@open-draft/logger';
1
2
  import { EventMap, Emitter, Listener } from 'strict-event-emitter';
2
- import { Debugger } from 'debug';
3
3
 
4
4
  type AnyFunction = (...args: any[]) => any;
5
5
  type LazyCallbackReturnType<FnType extends AnyFunction> = Parameters<FnType> | [];
@@ -30,7 +30,7 @@ declare enum AsyncEventEmitterReadyState {
30
30
  }
31
31
  declare class AsyncEventEmitter<Events extends EventMap> extends Emitter<Events> {
32
32
  readyState: AsyncEventEmitterReadyState;
33
- private log;
33
+ private logger;
34
34
  protected queue: Map<keyof Events, Array<QueueItem<Events[any]>>>;
35
35
  constructor();
36
36
  on<EventName extends keyof Events>(eventName: EventName, listener: Listener<any>): this;
@@ -69,7 +69,7 @@ declare class Interceptor<Events extends InterceptorEventMap> {
69
69
  private readonly symbol;
70
70
  protected emitter: AsyncEventEmitter<Events>;
71
71
  protected subscriptions: Array<InterceptorSubscription>;
72
- protected log: Debugger;
72
+ protected logger: Logger;
73
73
  readyState: InterceptorReadyState;
74
74
  constructor(symbol: symbol);
75
75
  /**
@@ -1,11 +1,11 @@
1
1
  import { ChildProcess } from 'child_process';
2
2
  import { HeadersObject } from 'headers-polyfill';
3
- import { e as Interceptor, H as HttpRequestEventMap } from './Interceptor-b3a4098c.js';
4
- import { a as BatchInterceptor } from './BatchInterceptor-5c1e5de3.js';
3
+ import { e as Interceptor, H as HttpRequestEventMap } from './Interceptor-f9dfe016.js';
4
+ import { a as BatchInterceptor } from './BatchInterceptor-fe69020d.js';
5
5
  import { ClientRequestInterceptor } from './interceptors/ClientRequest/index.js';
6
6
  import { XMLHttpRequestInterceptor } from './interceptors/XMLHttpRequest/index.js';
7
+ import '@open-draft/logger';
7
8
  import 'strict-event-emitter';
8
- import 'debug';
9
9
  import 'http';
10
10
  import 'https';
11
11
 
@@ -1,30 +1,30 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkSFLY7F52js = require('./chunk-SFLY7F52.js');
3
+ var _chunkRJMXHEGJjs = require('./chunk-RJMXHEGJ.js');
4
4
 
5
5
 
6
- var _chunkA3X67VOLjs = require('./chunk-A3X67VOL.js');
6
+ var _chunk7XU7Q63Wjs = require('./chunk-7XU7Q63W.js');
7
7
 
8
8
 
9
- var _chunkVTP5KY7Wjs = require('./chunk-VTP5KY7W.js');
10
- require('./chunk-MUUQLKVJ.js');
9
+ var _chunk2OJRZCGSjs = require('./chunk-2OJRZCGS.js');
10
+ require('./chunk-PKB2CXQV.js');
11
11
  require('./chunk-VQ4DZOBB.js');
12
12
 
13
13
 
14
14
  var _chunkZJOF5MEZjs = require('./chunk-ZJOF5MEZ.js');
15
15
 
16
16
 
17
- var _chunk62KFIM4Wjs = require('./chunk-62KFIM4W.js');
17
+ var _chunk6KJ5M2VRjs = require('./chunk-6KJ5M2VR.js');
18
18
 
19
19
  // src/RemoteHttpInterceptor.ts
20
20
  var _headerspolyfill = require('headers-polyfill');
21
- var RemoteHttpInterceptor = class extends _chunkSFLY7F52js.BatchInterceptor {
21
+ var RemoteHttpInterceptor = class extends _chunkRJMXHEGJjs.BatchInterceptor {
22
22
  constructor() {
23
23
  super({
24
24
  name: "remote-interceptor",
25
25
  interceptors: [
26
- new (0, _chunkA3X67VOLjs.ClientRequestInterceptor)(),
27
- new (0, _chunkVTP5KY7Wjs.XMLHttpRequestInterceptor)()
26
+ new (0, _chunk7XU7Q63Wjs.ClientRequestInterceptor)(),
27
+ new (0, _chunk2OJRZCGSjs.XMLHttpRequestInterceptor)()
28
28
  ]
29
29
  });
30
30
  }
@@ -41,7 +41,10 @@ var RemoteHttpInterceptor = class extends _chunkSFLY7F52js.BatchInterceptor {
41
41
  credentials: request.credentials,
42
42
  body: ["GET", "HEAD"].includes(request.method) ? null : await request.text()
43
43
  });
44
- this.log("sent serialized request to the child:", serializedRequest);
44
+ this.logger.info(
45
+ "sent serialized request to the child:",
46
+ serializedRequest
47
+ );
45
48
  (_a = process.send) == null ? void 0 : _a.call(process, `request:${serializedRequest}`);
46
49
  const responsePromise = new Promise((resolve) => {
47
50
  handleParentMessage = (message) => {
@@ -66,7 +69,7 @@ var RemoteHttpInterceptor = class extends _chunkSFLY7F52js.BatchInterceptor {
66
69
  }
67
70
  };
68
71
  });
69
- this.log(
72
+ this.logger.info(
70
73
  'add "message" listener to the parent process',
71
74
  handleParentMessage
72
75
  );
@@ -88,17 +91,17 @@ function requestReviver(key, value) {
88
91
  return value;
89
92
  }
90
93
  }
91
- var _RemoteHttpResolver = class extends _chunk62KFIM4Wjs.Interceptor {
94
+ var _RemoteHttpResolver = class extends _chunk6KJ5M2VRjs.Interceptor {
92
95
  constructor(options) {
93
96
  super(_RemoteHttpResolver.symbol);
94
97
  this.process = options.process;
95
98
  }
96
99
  setup() {
97
- const log = this.log.extend("setup");
100
+ const logger = this.logger.extend("setup");
98
101
  const handleChildMessage = async (message) => {
99
- log("received message from child!", message);
102
+ logger.info("received message from child!", message);
100
103
  if (typeof message !== "string" || !message.startsWith("request:")) {
101
- log("unknown message, ignoring...");
104
+ logger.info("unknown message, ignoring...");
102
105
  return;
103
106
  }
104
107
  const [, serializedRequest] = message.match(/^request:(.+)$/) || [];
@@ -109,7 +112,7 @@ var _RemoteHttpResolver = class extends _chunk62KFIM4Wjs.Interceptor {
109
112
  serializedRequest,
110
113
  requestReviver
111
114
  );
112
- log("parsed intercepted request", requestJson);
115
+ logger.info("parsed intercepted request", requestJson);
113
116
  const capturedRequest = new Request(requestJson.url, {
114
117
  method: requestJson.method,
115
118
  headers: new (0, _headerspolyfill.Headers)(requestJson.headers),
@@ -128,7 +131,7 @@ var _RemoteHttpResolver = class extends _chunk62KFIM4Wjs.Interceptor {
128
131
  if (!mockedResponse) {
129
132
  return;
130
133
  }
131
- log("event.respondWith called with:", mockedResponse);
134
+ logger.info("event.respondWith called with:", mockedResponse);
132
135
  const responseClone = mockedResponse.clone();
133
136
  const responseText = await mockedResponse.text();
134
137
  const serializedResponse = JSON.stringify({
@@ -151,13 +154,16 @@ var _RemoteHttpResolver = class extends _chunk62KFIM4Wjs.Interceptor {
151
154
  );
152
155
  }
153
156
  );
154
- log("sent serialized mocked response to the parent:", serializedResponse);
157
+ logger.info(
158
+ "sent serialized mocked response to the parent:",
159
+ serializedResponse
160
+ );
155
161
  };
156
162
  this.subscriptions.push(() => {
157
163
  this.process.removeListener("message", handleChildMessage);
158
- log('removed the "message" listener from the child process!');
164
+ logger.info('removed the "message" listener from the child process!');
159
165
  });
160
- log('adding a "message" listener to the child process');
166
+ logger.info('adding a "message" listener to the child process');
161
167
  this.process.addListener("message", handleChildMessage);
162
168
  this.process.once("error", () => this.dispose());
163
169
  this.process.once("exit", () => this.dispose());
@@ -1,20 +1,20 @@
1
1
  import {
2
2
  BatchInterceptor
3
- } from "./chunk-IC6Y7RGW.mjs";
3
+ } from "./chunk-SBAVVQIW.mjs";
4
4
  import {
5
5
  ClientRequestInterceptor
6
- } from "./chunk-W27FTX2A.mjs";
6
+ } from "./chunk-XVHIXGXD.mjs";
7
7
  import {
8
8
  XMLHttpRequestInterceptor
9
- } from "./chunk-EHQJSMSD.mjs";
10
- import "./chunk-RFVEKRYP.mjs";
9
+ } from "./chunk-RL5IV5PL.mjs";
10
+ import "./chunk-S5A4P4BZ.mjs";
11
11
  import "./chunk-GFH37L5D.mjs";
12
12
  import {
13
13
  toInteractiveRequest
14
14
  } from "./chunk-STA6QBYM.mjs";
15
15
  import {
16
16
  Interceptor
17
- } from "./chunk-6CRMKMDL.mjs";
17
+ } from "./chunk-3V5OWTY7.mjs";
18
18
 
19
19
  // src/RemoteHttpInterceptor.ts
20
20
  import { Headers, headersToObject } from "headers-polyfill";
@@ -41,7 +41,10 @@ var RemoteHttpInterceptor = class extends BatchInterceptor {
41
41
  credentials: request.credentials,
42
42
  body: ["GET", "HEAD"].includes(request.method) ? null : await request.text()
43
43
  });
44
- this.log("sent serialized request to the child:", serializedRequest);
44
+ this.logger.info(
45
+ "sent serialized request to the child:",
46
+ serializedRequest
47
+ );
45
48
  (_a = process.send) == null ? void 0 : _a.call(process, `request:${serializedRequest}`);
46
49
  const responsePromise = new Promise((resolve) => {
47
50
  handleParentMessage = (message) => {
@@ -66,7 +69,7 @@ var RemoteHttpInterceptor = class extends BatchInterceptor {
66
69
  }
67
70
  };
68
71
  });
69
- this.log(
72
+ this.logger.info(
70
73
  'add "message" listener to the parent process',
71
74
  handleParentMessage
72
75
  );
@@ -94,11 +97,11 @@ var _RemoteHttpResolver = class extends Interceptor {
94
97
  this.process = options.process;
95
98
  }
96
99
  setup() {
97
- const log = this.log.extend("setup");
100
+ const logger = this.logger.extend("setup");
98
101
  const handleChildMessage = async (message) => {
99
- log("received message from child!", message);
102
+ logger.info("received message from child!", message);
100
103
  if (typeof message !== "string" || !message.startsWith("request:")) {
101
- log("unknown message, ignoring...");
104
+ logger.info("unknown message, ignoring...");
102
105
  return;
103
106
  }
104
107
  const [, serializedRequest] = message.match(/^request:(.+)$/) || [];
@@ -109,7 +112,7 @@ var _RemoteHttpResolver = class extends Interceptor {
109
112
  serializedRequest,
110
113
  requestReviver
111
114
  );
112
- log("parsed intercepted request", requestJson);
115
+ logger.info("parsed intercepted request", requestJson);
113
116
  const capturedRequest = new Request(requestJson.url, {
114
117
  method: requestJson.method,
115
118
  headers: new Headers(requestJson.headers),
@@ -128,7 +131,7 @@ var _RemoteHttpResolver = class extends Interceptor {
128
131
  if (!mockedResponse) {
129
132
  return;
130
133
  }
131
- log("event.respondWith called with:", mockedResponse);
134
+ logger.info("event.respondWith called with:", mockedResponse);
132
135
  const responseClone = mockedResponse.clone();
133
136
  const responseText = await mockedResponse.text();
134
137
  const serializedResponse = JSON.stringify({
@@ -151,13 +154,16 @@ var _RemoteHttpResolver = class extends Interceptor {
151
154
  );
152
155
  }
153
156
  );
154
- log("sent serialized mocked response to the parent:", serializedResponse);
157
+ logger.info(
158
+ "sent serialized mocked response to the parent:",
159
+ serializedResponse
160
+ );
155
161
  };
156
162
  this.subscriptions.push(() => {
157
163
  this.process.removeListener("message", handleChildMessage);
158
- log('removed the "message" listener from the child process!');
164
+ logger.info('removed the "message" listener from the child process!');
159
165
  });
160
- log('adding a "message" listener to the child process');
166
+ logger.info('adding a "message" listener to the child process');
161
167
  this.process.addListener("message", handleChildMessage);
162
168
  this.process.once("error", () => this.dispose());
163
169
  this.process.once("exit", () => this.dispose());