@mswjs/interceptors 0.22.13 → 0.22.14
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/{chunk-NHFEA72Q.js → chunk-3Z75UBS4.js} +9 -9
- package/lib/browser/{chunk-ECRLBCQN.js → chunk-7VJMJSIJ.js} +3 -9
- package/lib/browser/{chunk-4W72RMFC.mjs → chunk-K3UETV3P.mjs} +1 -1
- package/lib/browser/{chunk-UYUNRMLU.mjs → chunk-MQA5WAD4.mjs} +1 -1
- package/lib/browser/{chunk-O7B67YBY.mjs → chunk-MW6NCDWE.mjs} +3 -9
- package/lib/browser/{chunk-KCAWLR7J.js → chunk-QAZ3SPQZ.js} +25 -25
- package/lib/browser/{chunk-EGQUVEJ3.js → chunk-SA7FXMQM.js} +5 -5
- package/lib/browser/{chunk-MJZRQFUP.mjs → chunk-V4G6RNUT.mjs} +2 -2
- package/lib/browser/index.js +4 -4
- package/lib/browser/index.mjs +2 -2
- package/lib/browser/interceptors/XMLHttpRequest/index.js +4 -4
- package/lib/browser/interceptors/XMLHttpRequest/index.mjs +3 -3
- package/lib/browser/interceptors/fetch/index.js +3 -3
- package/lib/browser/interceptors/fetch/index.mjs +2 -2
- package/lib/browser/presets/browser.js +6 -6
- package/lib/browser/presets/browser.mjs +4 -4
- package/lib/node/RemoteHttpInterceptor.js +9 -9
- package/lib/node/RemoteHttpInterceptor.mjs +5 -5
- package/lib/node/{chunk-RL5IV5PL.mjs → chunk-6HZ2ESGZ.mjs} +2 -2
- package/lib/node/{chunk-2OJRZCGS.js → chunk-BAJASIQJ.js} +6 -6
- package/lib/node/{chunk-PKB2CXQV.js → chunk-IHW3ERPT.js} +3 -3
- package/lib/node/{chunk-S5A4P4BZ.mjs → chunk-LTX5IGCQ.mjs} +1 -1
- package/lib/node/{chunk-6KJ5M2VR.js → chunk-MPFSBY4S.js} +3 -9
- package/lib/node/{chunk-SBAVVQIW.mjs → chunk-NUSH7ACE.mjs} +1 -1
- package/lib/node/{chunk-BGW7OOI4.js → chunk-QRCYLMPE.js} +2 -2
- package/lib/node/{chunk-JRKMZWAD.mjs → chunk-R6MTHW6S.mjs} +1 -1
- package/lib/node/{chunk-RJMXHEGJ.js → chunk-VJDB3MIV.js} +2 -2
- package/lib/node/{chunk-3V5OWTY7.mjs → chunk-Y5QA6OEZ.mjs} +3 -9
- package/lib/node/index.js +4 -4
- package/lib/node/index.mjs +3 -3
- package/lib/node/interceptors/ClientRequest/index.js +3 -3
- package/lib/node/interceptors/ClientRequest/index.mjs +2 -2
- package/lib/node/interceptors/XMLHttpRequest/index.js +4 -4
- package/lib/node/interceptors/XMLHttpRequest/index.mjs +3 -3
- package/lib/node/interceptors/fetch/index.js +2 -2
- package/lib/node/interceptors/fetch/index.mjs +1 -1
- package/lib/node/presets/node.js +6 -6
- package/lib/node/presets/node.mjs +4 -4
- package/package.json +1 -1
- package/src/Interceptor.test.ts +6 -14
- package/src/Interceptor.ts +3 -10
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkQAZ3SPQZjs = require('./chunk-QAZ3SPQZ.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
@@ -10,7 +10,7 @@ var _chunkPCFJD76Xjs = require('./chunk-PCFJD76X.js');
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _chunk7VJMJSIJjs = require('./chunk-7VJMJSIJ.js');
|
|
14
14
|
|
|
15
15
|
// src/interceptors/XMLHttpRequest/index.ts
|
|
16
16
|
var _outvariant = require('outvariant');
|
|
@@ -252,7 +252,7 @@ var XMLHttpRequestController = class {
|
|
|
252
252
|
case "send": {
|
|
253
253
|
const [body] = args;
|
|
254
254
|
if (body != null) {
|
|
255
|
-
this.requestBody = typeof body === "string" ?
|
|
255
|
+
this.requestBody = typeof body === "string" ? _chunkQAZ3SPQZjs.encodeBuffer.call(void 0, body) : body;
|
|
256
256
|
}
|
|
257
257
|
this.request.addEventListener("load", () => {
|
|
258
258
|
if (typeof this.onResponse !== "undefined") {
|
|
@@ -398,7 +398,7 @@ var XMLHttpRequestController = class {
|
|
|
398
398
|
}
|
|
399
399
|
}
|
|
400
400
|
responseBufferToText() {
|
|
401
|
-
return
|
|
401
|
+
return _chunkQAZ3SPQZjs.decodeBuffer.call(void 0, this.responseBuffer);
|
|
402
402
|
}
|
|
403
403
|
get response() {
|
|
404
404
|
this.logger.info(
|
|
@@ -415,7 +415,7 @@ var XMLHttpRequestController = class {
|
|
|
415
415
|
return responseJson;
|
|
416
416
|
}
|
|
417
417
|
case "arraybuffer": {
|
|
418
|
-
const arrayBuffer =
|
|
418
|
+
const arrayBuffer = _chunkQAZ3SPQZjs.toArrayBuffer.call(void 0, this.responseBuffer);
|
|
419
419
|
this.logger.info("resolved response ArrayBuffer", arrayBuffer);
|
|
420
420
|
return arrayBuffer;
|
|
421
421
|
}
|
|
@@ -641,7 +641,7 @@ function createXMLHttpRequestProxy({
|
|
|
641
641
|
}
|
|
642
642
|
|
|
643
643
|
// src/interceptors/XMLHttpRequest/index.ts
|
|
644
|
-
var _XMLHttpRequestInterceptor = class extends
|
|
644
|
+
var _XMLHttpRequestInterceptor = class extends _chunk7VJMJSIJjs.Interceptor {
|
|
645
645
|
constructor() {
|
|
646
646
|
super(_XMLHttpRequestInterceptor.interceptorSymbol);
|
|
647
647
|
}
|
|
@@ -653,7 +653,7 @@ var _XMLHttpRequestInterceptor = class extends _chunkECRLBCQNjs.Interceptor {
|
|
|
653
653
|
logger.info('patching "XMLHttpRequest" module...');
|
|
654
654
|
const PureXMLHttpRequest = globalThis.XMLHttpRequest;
|
|
655
655
|
_outvariant.invariant.call(void 0,
|
|
656
|
-
!PureXMLHttpRequest[
|
|
656
|
+
!PureXMLHttpRequest[_chunk7VJMJSIJjs.IS_PATCHED_MODULE],
|
|
657
657
|
'Failed to patch the "XMLHttpRequest" module: already patched.'
|
|
658
658
|
);
|
|
659
659
|
globalThis.XMLHttpRequest = createXMLHttpRequestProxy({
|
|
@@ -664,13 +664,13 @@ var _XMLHttpRequestInterceptor = class extends _chunkECRLBCQNjs.Interceptor {
|
|
|
664
664
|
'native "XMLHttpRequest" module patched!',
|
|
665
665
|
globalThis.XMLHttpRequest.name
|
|
666
666
|
);
|
|
667
|
-
Object.defineProperty(globalThis.XMLHttpRequest,
|
|
667
|
+
Object.defineProperty(globalThis.XMLHttpRequest, _chunk7VJMJSIJjs.IS_PATCHED_MODULE, {
|
|
668
668
|
enumerable: true,
|
|
669
669
|
configurable: true,
|
|
670
670
|
value: true
|
|
671
671
|
});
|
|
672
672
|
this.subscriptions.push(() => {
|
|
673
|
-
Object.defineProperty(globalThis.XMLHttpRequest,
|
|
673
|
+
Object.defineProperty(globalThis.XMLHttpRequest, _chunk7VJMJSIJjs.IS_PATCHED_MODULE, {
|
|
674
674
|
value: void 0
|
|
675
675
|
});
|
|
676
676
|
globalThis.XMLHttpRequest = PureXMLHttpRequest;
|
|
@@ -181,17 +181,13 @@ var Interceptor = class {
|
|
|
181
181
|
logger.info('removed proxied "%s" listener!', event);
|
|
182
182
|
});
|
|
183
183
|
};
|
|
184
|
-
|
|
185
|
-
this.readyState = "APPLIED" /* APPLIED */;
|
|
186
|
-
});
|
|
184
|
+
this.readyState = "APPLIED" /* APPLIED */;
|
|
187
185
|
return;
|
|
188
186
|
}
|
|
189
187
|
logger.info("no running instance found, setting up a new instance...");
|
|
190
188
|
this.setup();
|
|
191
189
|
this.setInstance();
|
|
192
|
-
|
|
193
|
-
this.readyState = "APPLIED" /* APPLIED */;
|
|
194
|
-
});
|
|
190
|
+
this.readyState = "APPLIED" /* APPLIED */;
|
|
195
191
|
}
|
|
196
192
|
setup() {
|
|
197
193
|
}
|
|
@@ -228,9 +224,7 @@ var Interceptor = class {
|
|
|
228
224
|
}
|
|
229
225
|
this.emitter.deactivate();
|
|
230
226
|
logger.info("destroyed the listener!");
|
|
231
|
-
|
|
232
|
-
this.readyState = "DISPOSED" /* DISPOSED */;
|
|
233
|
-
});
|
|
227
|
+
this.readyState = "DISPOSED" /* DISPOSED */;
|
|
234
228
|
}
|
|
235
229
|
getInstance() {
|
|
236
230
|
var _a;
|
|
@@ -181,17 +181,13 @@ var Interceptor = class {
|
|
|
181
181
|
logger.info('removed proxied "%s" listener!', event);
|
|
182
182
|
});
|
|
183
183
|
};
|
|
184
|
-
|
|
185
|
-
this.readyState = "APPLIED" /* APPLIED */;
|
|
186
|
-
});
|
|
184
|
+
this.readyState = "APPLIED" /* APPLIED */;
|
|
187
185
|
return;
|
|
188
186
|
}
|
|
189
187
|
logger.info("no running instance found, setting up a new instance...");
|
|
190
188
|
this.setup();
|
|
191
189
|
this.setInstance();
|
|
192
|
-
|
|
193
|
-
this.readyState = "APPLIED" /* APPLIED */;
|
|
194
|
-
});
|
|
190
|
+
this.readyState = "APPLIED" /* APPLIED */;
|
|
195
191
|
}
|
|
196
192
|
setup() {
|
|
197
193
|
}
|
|
@@ -228,9 +224,7 @@ var Interceptor = class {
|
|
|
228
224
|
}
|
|
229
225
|
this.emitter.deactivate();
|
|
230
226
|
logger.info("destroyed the listener!");
|
|
231
|
-
|
|
232
|
-
this.readyState = "DISPOSED" /* DISPOSED */;
|
|
233
|
-
});
|
|
227
|
+
this.readyState = "DISPOSED" /* DISPOSED */;
|
|
234
228
|
}
|
|
235
229
|
getInstance() {
|
|
236
230
|
var _a;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk7VJMJSIJjs = require('./chunk-7VJMJSIJ.js');
|
|
4
4
|
|
|
5
5
|
// node_modules/has-symbols/shams.js
|
|
6
|
-
var require_shams =
|
|
6
|
+
var require_shams = _chunk7VJMJSIJjs.__commonJS.call(void 0, {
|
|
7
7
|
"node_modules/has-symbols/shams.js"(exports, module) {
|
|
8
8
|
"use strict";
|
|
9
9
|
module.exports = function hasSymbols() {
|
|
@@ -55,7 +55,7 @@ var require_shams = _chunkECRLBCQNjs.__commonJS.call(void 0, {
|
|
|
55
55
|
});
|
|
56
56
|
|
|
57
57
|
// node_modules/has-tostringtag/shams.js
|
|
58
|
-
var require_shams2 =
|
|
58
|
+
var require_shams2 = _chunk7VJMJSIJjs.__commonJS.call(void 0, {
|
|
59
59
|
"node_modules/has-tostringtag/shams.js"(exports, module) {
|
|
60
60
|
"use strict";
|
|
61
61
|
var hasSymbols = require_shams();
|
|
@@ -66,7 +66,7 @@ var require_shams2 = _chunkECRLBCQNjs.__commonJS.call(void 0, {
|
|
|
66
66
|
});
|
|
67
67
|
|
|
68
68
|
// node_modules/call-bind/node_modules/has-symbols/shams.js
|
|
69
|
-
var require_shams3 =
|
|
69
|
+
var require_shams3 = _chunk7VJMJSIJjs.__commonJS.call(void 0, {
|
|
70
70
|
"node_modules/call-bind/node_modules/has-symbols/shams.js"(exports, module) {
|
|
71
71
|
"use strict";
|
|
72
72
|
module.exports = function hasSymbols() {
|
|
@@ -118,7 +118,7 @@ var require_shams3 = _chunkECRLBCQNjs.__commonJS.call(void 0, {
|
|
|
118
118
|
});
|
|
119
119
|
|
|
120
120
|
// node_modules/call-bind/node_modules/has-symbols/index.js
|
|
121
|
-
var require_has_symbols =
|
|
121
|
+
var require_has_symbols = _chunk7VJMJSIJjs.__commonJS.call(void 0, {
|
|
122
122
|
"node_modules/call-bind/node_modules/has-symbols/index.js"(exports, module) {
|
|
123
123
|
"use strict";
|
|
124
124
|
var origSymbol = typeof Symbol !== "undefined" && Symbol;
|
|
@@ -142,7 +142,7 @@ var require_has_symbols = _chunkECRLBCQNjs.__commonJS.call(void 0, {
|
|
|
142
142
|
});
|
|
143
143
|
|
|
144
144
|
// node_modules/function-bind/implementation.js
|
|
145
|
-
var require_implementation =
|
|
145
|
+
var require_implementation = _chunk7VJMJSIJjs.__commonJS.call(void 0, {
|
|
146
146
|
"node_modules/function-bind/implementation.js"(exports, module) {
|
|
147
147
|
"use strict";
|
|
148
148
|
var ERROR_MESSAGE = "Function.prototype.bind called on incompatible ";
|
|
@@ -192,7 +192,7 @@ var require_implementation = _chunkECRLBCQNjs.__commonJS.call(void 0, {
|
|
|
192
192
|
});
|
|
193
193
|
|
|
194
194
|
// node_modules/function-bind/index.js
|
|
195
|
-
var require_function_bind =
|
|
195
|
+
var require_function_bind = _chunk7VJMJSIJjs.__commonJS.call(void 0, {
|
|
196
196
|
"node_modules/function-bind/index.js"(exports, module) {
|
|
197
197
|
"use strict";
|
|
198
198
|
var implementation = require_implementation();
|
|
@@ -201,7 +201,7 @@ var require_function_bind = _chunkECRLBCQNjs.__commonJS.call(void 0, {
|
|
|
201
201
|
});
|
|
202
202
|
|
|
203
203
|
// node_modules/has/src/index.js
|
|
204
|
-
var require_src =
|
|
204
|
+
var require_src = _chunk7VJMJSIJjs.__commonJS.call(void 0, {
|
|
205
205
|
"node_modules/has/src/index.js"(exports, module) {
|
|
206
206
|
"use strict";
|
|
207
207
|
var bind = require_function_bind();
|
|
@@ -210,7 +210,7 @@ var require_src = _chunkECRLBCQNjs.__commonJS.call(void 0, {
|
|
|
210
210
|
});
|
|
211
211
|
|
|
212
212
|
// node_modules/call-bind/node_modules/get-intrinsic/index.js
|
|
213
|
-
var require_get_intrinsic =
|
|
213
|
+
var require_get_intrinsic = _chunk7VJMJSIJjs.__commonJS.call(void 0, {
|
|
214
214
|
"node_modules/call-bind/node_modules/get-intrinsic/index.js"(exports, module) {
|
|
215
215
|
"use strict";
|
|
216
216
|
var undefined2;
|
|
@@ -500,7 +500,7 @@ var require_get_intrinsic = _chunkECRLBCQNjs.__commonJS.call(void 0, {
|
|
|
500
500
|
});
|
|
501
501
|
|
|
502
502
|
// node_modules/call-bind/index.js
|
|
503
|
-
var require_call_bind =
|
|
503
|
+
var require_call_bind = _chunk7VJMJSIJjs.__commonJS.call(void 0, {
|
|
504
504
|
"node_modules/call-bind/index.js"(exports, module) {
|
|
505
505
|
"use strict";
|
|
506
506
|
var bind = require_function_bind();
|
|
@@ -544,7 +544,7 @@ var require_call_bind = _chunkECRLBCQNjs.__commonJS.call(void 0, {
|
|
|
544
544
|
});
|
|
545
545
|
|
|
546
546
|
// node_modules/call-bind/callBound.js
|
|
547
|
-
var require_callBound =
|
|
547
|
+
var require_callBound = _chunk7VJMJSIJjs.__commonJS.call(void 0, {
|
|
548
548
|
"node_modules/call-bind/callBound.js"(exports, module) {
|
|
549
549
|
"use strict";
|
|
550
550
|
var GetIntrinsic = require_get_intrinsic();
|
|
@@ -561,7 +561,7 @@ var require_callBound = _chunkECRLBCQNjs.__commonJS.call(void 0, {
|
|
|
561
561
|
});
|
|
562
562
|
|
|
563
563
|
// node_modules/is-arguments/index.js
|
|
564
|
-
var require_is_arguments =
|
|
564
|
+
var require_is_arguments = _chunk7VJMJSIJjs.__commonJS.call(void 0, {
|
|
565
565
|
"node_modules/is-arguments/index.js"(exports, module) {
|
|
566
566
|
"use strict";
|
|
567
567
|
var hasToStringTag = require_shams2()();
|
|
@@ -588,7 +588,7 @@ var require_is_arguments = _chunkECRLBCQNjs.__commonJS.call(void 0, {
|
|
|
588
588
|
});
|
|
589
589
|
|
|
590
590
|
// node_modules/is-generator-function/index.js
|
|
591
|
-
var require_is_generator_function =
|
|
591
|
+
var require_is_generator_function = _chunk7VJMJSIJjs.__commonJS.call(void 0, {
|
|
592
592
|
"node_modules/is-generator-function/index.js"(exports, module) {
|
|
593
593
|
"use strict";
|
|
594
594
|
var toStr = Object.prototype.toString;
|
|
@@ -630,7 +630,7 @@ var require_is_generator_function = _chunkECRLBCQNjs.__commonJS.call(void 0, {
|
|
|
630
630
|
});
|
|
631
631
|
|
|
632
632
|
// node_modules/is-callable/index.js
|
|
633
|
-
var require_is_callable =
|
|
633
|
+
var require_is_callable = _chunk7VJMJSIJjs.__commonJS.call(void 0, {
|
|
634
634
|
"node_modules/is-callable/index.js"(exports, module) {
|
|
635
635
|
"use strict";
|
|
636
636
|
var fnToStr = Function.prototype.toString;
|
|
@@ -728,7 +728,7 @@ var require_is_callable = _chunkECRLBCQNjs.__commonJS.call(void 0, {
|
|
|
728
728
|
});
|
|
729
729
|
|
|
730
730
|
// node_modules/for-each/index.js
|
|
731
|
-
var require_for_each =
|
|
731
|
+
var require_for_each = _chunk7VJMJSIJjs.__commonJS.call(void 0, {
|
|
732
732
|
"node_modules/for-each/index.js"(exports, module) {
|
|
733
733
|
"use strict";
|
|
734
734
|
var isCallable = require_is_callable();
|
|
@@ -786,7 +786,7 @@ var require_for_each = _chunkECRLBCQNjs.__commonJS.call(void 0, {
|
|
|
786
786
|
});
|
|
787
787
|
|
|
788
788
|
// node_modules/available-typed-arrays/index.js
|
|
789
|
-
var require_available_typed_arrays =
|
|
789
|
+
var require_available_typed_arrays = _chunk7VJMJSIJjs.__commonJS.call(void 0, {
|
|
790
790
|
"node_modules/available-typed-arrays/index.js"(exports, module) {
|
|
791
791
|
"use strict";
|
|
792
792
|
var possibleNames = [
|
|
@@ -816,7 +816,7 @@ var require_available_typed_arrays = _chunkECRLBCQNjs.__commonJS.call(void 0, {
|
|
|
816
816
|
});
|
|
817
817
|
|
|
818
818
|
// node_modules/has-symbols/index.js
|
|
819
|
-
var require_has_symbols2 =
|
|
819
|
+
var require_has_symbols2 = _chunk7VJMJSIJjs.__commonJS.call(void 0, {
|
|
820
820
|
"node_modules/has-symbols/index.js"(exports, module) {
|
|
821
821
|
"use strict";
|
|
822
822
|
var origSymbol = typeof Symbol !== "undefined" && Symbol;
|
|
@@ -840,7 +840,7 @@ var require_has_symbols2 = _chunkECRLBCQNjs.__commonJS.call(void 0, {
|
|
|
840
840
|
});
|
|
841
841
|
|
|
842
842
|
// node_modules/get-intrinsic/index.js
|
|
843
|
-
var require_get_intrinsic2 =
|
|
843
|
+
var require_get_intrinsic2 = _chunk7VJMJSIJjs.__commonJS.call(void 0, {
|
|
844
844
|
"node_modules/get-intrinsic/index.js"(exports, module) {
|
|
845
845
|
"use strict";
|
|
846
846
|
var undefined2;
|
|
@@ -1134,7 +1134,7 @@ var require_get_intrinsic2 = _chunkECRLBCQNjs.__commonJS.call(void 0, {
|
|
|
1134
1134
|
});
|
|
1135
1135
|
|
|
1136
1136
|
// node_modules/es-abstract/helpers/getOwnPropertyDescriptor.js
|
|
1137
|
-
var require_getOwnPropertyDescriptor =
|
|
1137
|
+
var require_getOwnPropertyDescriptor = _chunk7VJMJSIJjs.__commonJS.call(void 0, {
|
|
1138
1138
|
"node_modules/es-abstract/helpers/getOwnPropertyDescriptor.js"(exports, module) {
|
|
1139
1139
|
"use strict";
|
|
1140
1140
|
var GetIntrinsic = require_get_intrinsic2();
|
|
@@ -1151,7 +1151,7 @@ var require_getOwnPropertyDescriptor = _chunkECRLBCQNjs.__commonJS.call(void 0,
|
|
|
1151
1151
|
});
|
|
1152
1152
|
|
|
1153
1153
|
// node_modules/is-typed-array/index.js
|
|
1154
|
-
var require_is_typed_array =
|
|
1154
|
+
var require_is_typed_array = _chunk7VJMJSIJjs.__commonJS.call(void 0, {
|
|
1155
1155
|
"node_modules/is-typed-array/index.js"(exports, module) {
|
|
1156
1156
|
"use strict";
|
|
1157
1157
|
var forEach = require_for_each();
|
|
@@ -1216,7 +1216,7 @@ var require_is_typed_array = _chunkECRLBCQNjs.__commonJS.call(void 0, {
|
|
|
1216
1216
|
});
|
|
1217
1217
|
|
|
1218
1218
|
// node_modules/which-typed-array/index.js
|
|
1219
|
-
var require_which_typed_array =
|
|
1219
|
+
var require_which_typed_array = _chunk7VJMJSIJjs.__commonJS.call(void 0, {
|
|
1220
1220
|
"node_modules/which-typed-array/index.js"(exports, module) {
|
|
1221
1221
|
"use strict";
|
|
1222
1222
|
var forEach = require_for_each();
|
|
@@ -1275,7 +1275,7 @@ var require_which_typed_array = _chunkECRLBCQNjs.__commonJS.call(void 0, {
|
|
|
1275
1275
|
});
|
|
1276
1276
|
|
|
1277
1277
|
// node_modules/util/support/types.js
|
|
1278
|
-
var require_types =
|
|
1278
|
+
var require_types = _chunk7VJMJSIJjs.__commonJS.call(void 0, {
|
|
1279
1279
|
"node_modules/util/support/types.js"(exports) {
|
|
1280
1280
|
"use strict";
|
|
1281
1281
|
var isArgumentsObject = require_is_arguments();
|
|
@@ -1505,7 +1505,7 @@ var require_types = _chunkECRLBCQNjs.__commonJS.call(void 0, {
|
|
|
1505
1505
|
});
|
|
1506
1506
|
|
|
1507
1507
|
// node_modules/util/support/isBufferBrowser.js
|
|
1508
|
-
var require_isBufferBrowser =
|
|
1508
|
+
var require_isBufferBrowser = _chunk7VJMJSIJjs.__commonJS.call(void 0, {
|
|
1509
1509
|
"node_modules/util/support/isBufferBrowser.js"(exports, module) {
|
|
1510
1510
|
module.exports = function isBuffer(arg) {
|
|
1511
1511
|
return arg && typeof arg === "object" && typeof arg.copy === "function" && typeof arg.fill === "function" && typeof arg.readUInt8 === "function";
|
|
@@ -1514,7 +1514,7 @@ var require_isBufferBrowser = _chunkECRLBCQNjs.__commonJS.call(void 0, {
|
|
|
1514
1514
|
});
|
|
1515
1515
|
|
|
1516
1516
|
// node_modules/inherits/inherits_browser.js
|
|
1517
|
-
var require_inherits_browser =
|
|
1517
|
+
var require_inherits_browser = _chunk7VJMJSIJjs.__commonJS.call(void 0, {
|
|
1518
1518
|
"node_modules/inherits/inherits_browser.js"(exports, module) {
|
|
1519
1519
|
if (typeof Object.create === "function") {
|
|
1520
1520
|
module.exports = function inherits(ctor, superCtor) {
|
|
@@ -1546,7 +1546,7 @@ var require_inherits_browser = _chunkECRLBCQNjs.__commonJS.call(void 0, {
|
|
|
1546
1546
|
});
|
|
1547
1547
|
|
|
1548
1548
|
// node_modules/util/util.js
|
|
1549
|
-
var require_util =
|
|
1549
|
+
var require_util = _chunk7VJMJSIJjs.__commonJS.call(void 0, {
|
|
1550
1550
|
"node_modules/util/util.js"(exports) {
|
|
1551
1551
|
var getOwnPropertyDescriptors = Object.getOwnPropertyDescriptors || function getOwnPropertyDescriptors2(obj) {
|
|
1552
1552
|
var keys = Object.keys(obj);
|
|
@@ -5,12 +5,12 @@ var _chunkPCFJD76Xjs = require('./chunk-PCFJD76X.js');
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunk7VJMJSIJjs = require('./chunk-7VJMJSIJ.js');
|
|
9
9
|
|
|
10
10
|
// src/interceptors/fetch/index.ts
|
|
11
11
|
var _outvariant = require('outvariant');
|
|
12
12
|
var _until = require('@open-draft/until');
|
|
13
|
-
var _FetchInterceptor = class extends
|
|
13
|
+
var _FetchInterceptor = class extends _chunk7VJMJSIJjs.Interceptor {
|
|
14
14
|
constructor() {
|
|
15
15
|
super(_FetchInterceptor.symbol);
|
|
16
16
|
}
|
|
@@ -20,7 +20,7 @@ var _FetchInterceptor = class extends _chunkECRLBCQNjs.Interceptor {
|
|
|
20
20
|
setup() {
|
|
21
21
|
const pureFetch = globalThis.fetch;
|
|
22
22
|
_outvariant.invariant.call(void 0,
|
|
23
|
-
!pureFetch[
|
|
23
|
+
!pureFetch[_chunk7VJMJSIJjs.IS_PATCHED_MODULE],
|
|
24
24
|
'Failed to patch the "fetch" module: already patched.'
|
|
25
25
|
);
|
|
26
26
|
globalThis.fetch = async (input, init) => {
|
|
@@ -86,13 +86,13 @@ var _FetchInterceptor = class extends _chunkECRLBCQNjs.Interceptor {
|
|
|
86
86
|
return response;
|
|
87
87
|
});
|
|
88
88
|
};
|
|
89
|
-
Object.defineProperty(globalThis.fetch,
|
|
89
|
+
Object.defineProperty(globalThis.fetch, _chunk7VJMJSIJjs.IS_PATCHED_MODULE, {
|
|
90
90
|
enumerable: true,
|
|
91
91
|
configurable: true,
|
|
92
92
|
value: true
|
|
93
93
|
});
|
|
94
94
|
this.subscriptions.push(() => {
|
|
95
|
-
Object.defineProperty(globalThis.fetch,
|
|
95
|
+
Object.defineProperty(globalThis.fetch, _chunk7VJMJSIJjs.IS_PATCHED_MODULE, {
|
|
96
96
|
value: void 0
|
|
97
97
|
});
|
|
98
98
|
globalThis.fetch = pureFetch;
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
decodeBuffer,
|
|
3
3
|
encodeBuffer,
|
|
4
4
|
toArrayBuffer
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-MQA5WAD4.mjs";
|
|
6
6
|
import {
|
|
7
7
|
toInteractiveRequest,
|
|
8
8
|
uuidv4
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
import {
|
|
11
11
|
IS_PATCHED_MODULE,
|
|
12
12
|
Interceptor
|
|
13
|
-
} from "./chunk-
|
|
13
|
+
} from "./chunk-MW6NCDWE.mjs";
|
|
14
14
|
|
|
15
15
|
// src/interceptors/XMLHttpRequest/index.ts
|
|
16
16
|
import { invariant as invariant2 } from "outvariant";
|
package/lib/browser/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkQAZ3SPQZjs = require('./chunk-QAZ3SPQZ.js');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunk7VJMJSIJjs = require('./chunk-7VJMJSIJ.js');
|
|
12
12
|
|
|
13
13
|
// src/BatchInterceptor.ts
|
|
14
|
-
var BatchInterceptor = class extends
|
|
14
|
+
var BatchInterceptor = class extends _chunk7VJMJSIJjs.Interceptor {
|
|
15
15
|
constructor(options) {
|
|
16
16
|
BatchInterceptor.symbol = Symbol(options.name);
|
|
17
17
|
super(BatchInterceptor.symbol);
|
|
@@ -48,4 +48,4 @@ function getCleanUrl(url, isAbsolute = true) {
|
|
|
48
48
|
|
|
49
49
|
|
|
50
50
|
|
|
51
|
-
exports.BatchInterceptor = BatchInterceptor; exports.IS_PATCHED_MODULE =
|
|
51
|
+
exports.BatchInterceptor = BatchInterceptor; exports.IS_PATCHED_MODULE = _chunk7VJMJSIJjs.IS_PATCHED_MODULE; exports.Interceptor = _chunk7VJMJSIJjs.Interceptor; exports.InterceptorReadyState = _chunk7VJMJSIJjs.InterceptorReadyState; exports.decodeBuffer = _chunkQAZ3SPQZjs.decodeBuffer; exports.deleteGlobalSymbol = _chunk7VJMJSIJjs.deleteGlobalSymbol; exports.encodeBuffer = _chunkQAZ3SPQZjs.encodeBuffer; exports.getCleanUrl = getCleanUrl; exports.getGlobalSymbol = _chunk7VJMJSIJjs.getGlobalSymbol;
|
package/lib/browser/index.mjs
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
decodeBuffer,
|
|
3
3
|
encodeBuffer
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-MQA5WAD4.mjs";
|
|
5
5
|
import {
|
|
6
6
|
IS_PATCHED_MODULE,
|
|
7
7
|
Interceptor,
|
|
8
8
|
InterceptorReadyState,
|
|
9
9
|
deleteGlobalSymbol,
|
|
10
10
|
getGlobalSymbol
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-MW6NCDWE.mjs";
|
|
12
12
|
|
|
13
13
|
// src/BatchInterceptor.ts
|
|
14
14
|
var BatchInterceptor = class extends Interceptor {
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../../chunk-
|
|
3
|
+
var _chunk3Z75UBS4js = require('../../chunk-3Z75UBS4.js');
|
|
4
|
+
require('../../chunk-QAZ3SPQZ.js');
|
|
5
5
|
require('../../chunk-PCFJD76X.js');
|
|
6
|
-
require('../../chunk-
|
|
6
|
+
require('../../chunk-7VJMJSIJ.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
exports.XMLHttpRequestInterceptor =
|
|
9
|
+
exports.XMLHttpRequestInterceptor = _chunk3Z75UBS4js.XMLHttpRequestInterceptor;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
XMLHttpRequestInterceptor
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-V4G6RNUT.mjs";
|
|
4
|
+
import "../../chunk-MQA5WAD4.mjs";
|
|
5
5
|
import "../../chunk-RT3ATOJH.mjs";
|
|
6
|
-
import "../../chunk-
|
|
6
|
+
import "../../chunk-MW6NCDWE.mjs";
|
|
7
7
|
export {
|
|
8
8
|
XMLHttpRequestInterceptor
|
|
9
9
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkSA7FXMQMjs = require('../../chunk-SA7FXMQM.js');
|
|
4
4
|
require('../../chunk-PCFJD76X.js');
|
|
5
|
-
require('../../chunk-
|
|
5
|
+
require('../../chunk-7VJMJSIJ.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
exports.FetchInterceptor =
|
|
8
|
+
exports.FetchInterceptor = _chunkSA7FXMQMjs.FetchInterceptor;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
3
|
+
var _chunk3Z75UBS4js = require('../chunk-3Z75UBS4.js');
|
|
4
|
+
require('../chunk-QAZ3SPQZ.js');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkSA7FXMQMjs = require('../chunk-SA7FXMQM.js');
|
|
8
8
|
require('../chunk-PCFJD76X.js');
|
|
9
|
-
require('../chunk-
|
|
9
|
+
require('../chunk-7VJMJSIJ.js');
|
|
10
10
|
|
|
11
11
|
// src/presets/browser.ts
|
|
12
12
|
var browser_default = [
|
|
13
|
-
new (0,
|
|
14
|
-
new (0,
|
|
13
|
+
new (0, _chunkSA7FXMQMjs.FetchInterceptor)(),
|
|
14
|
+
new (0, _chunk3Z75UBS4js.XMLHttpRequestInterceptor)()
|
|
15
15
|
];
|
|
16
16
|
|
|
17
17
|
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
XMLHttpRequestInterceptor
|
|
3
|
-
} from "../chunk-
|
|
4
|
-
import "../chunk-
|
|
3
|
+
} from "../chunk-V4G6RNUT.mjs";
|
|
4
|
+
import "../chunk-MQA5WAD4.mjs";
|
|
5
5
|
import {
|
|
6
6
|
FetchInterceptor
|
|
7
|
-
} from "../chunk-
|
|
7
|
+
} from "../chunk-K3UETV3P.mjs";
|
|
8
8
|
import "../chunk-RT3ATOJH.mjs";
|
|
9
|
-
import "../chunk-
|
|
9
|
+
import "../chunk-MW6NCDWE.mjs";
|
|
10
10
|
|
|
11
11
|
// src/presets/browser.ts
|
|
12
12
|
var browser_default = [
|
|
@@ -1,30 +1,30 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkVJDB3MIVjs = require('./chunk-VJDB3MIV.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkQRCYLMPEjs = require('./chunk-QRCYLMPE.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
10
|
-
require('./chunk-
|
|
9
|
+
var _chunkBAJASIQJjs = require('./chunk-BAJASIQJ.js');
|
|
10
|
+
require('./chunk-IHW3ERPT.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
|
|
17
|
+
var _chunkMPFSBY4Sjs = require('./chunk-MPFSBY4S.js');
|
|
18
18
|
|
|
19
19
|
// src/RemoteHttpInterceptor.ts
|
|
20
20
|
var _headerspolyfill = require('headers-polyfill');
|
|
21
|
-
var RemoteHttpInterceptor = class extends
|
|
21
|
+
var RemoteHttpInterceptor = class extends _chunkVJDB3MIVjs.BatchInterceptor {
|
|
22
22
|
constructor() {
|
|
23
23
|
super({
|
|
24
24
|
name: "remote-interceptor",
|
|
25
25
|
interceptors: [
|
|
26
|
-
new (0,
|
|
27
|
-
new (0,
|
|
26
|
+
new (0, _chunkQRCYLMPEjs.ClientRequestInterceptor)(),
|
|
27
|
+
new (0, _chunkBAJASIQJjs.XMLHttpRequestInterceptor)()
|
|
28
28
|
]
|
|
29
29
|
});
|
|
30
30
|
}
|
|
@@ -91,7 +91,7 @@ function requestReviver(key, value) {
|
|
|
91
91
|
return value;
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
|
-
var _RemoteHttpResolver = class extends
|
|
94
|
+
var _RemoteHttpResolver = class extends _chunkMPFSBY4Sjs.Interceptor {
|
|
95
95
|
constructor(options) {
|
|
96
96
|
super(_RemoteHttpResolver.symbol);
|
|
97
97
|
this.process = options.process;
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BatchInterceptor
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-NUSH7ACE.mjs";
|
|
4
4
|
import {
|
|
5
5
|
ClientRequestInterceptor
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-R6MTHW6S.mjs";
|
|
7
7
|
import {
|
|
8
8
|
XMLHttpRequestInterceptor
|
|
9
|
-
} from "./chunk-
|
|
10
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-6HZ2ESGZ.mjs";
|
|
10
|
+
import "./chunk-LTX5IGCQ.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-
|
|
17
|
+
} from "./chunk-Y5QA6OEZ.mjs";
|
|
18
18
|
|
|
19
19
|
// src/RemoteHttpInterceptor.ts
|
|
20
20
|
import { Headers, headersToObject } from "headers-polyfill";
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
decodeBuffer,
|
|
3
3
|
encodeBuffer,
|
|
4
4
|
toArrayBuffer
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-LTX5IGCQ.mjs";
|
|
6
6
|
import {
|
|
7
7
|
IS_PATCHED_MODULE
|
|
8
8
|
} from "./chunk-GFH37L5D.mjs";
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
} from "./chunk-STA6QBYM.mjs";
|
|
13
13
|
import {
|
|
14
14
|
Interceptor
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-Y5QA6OEZ.mjs";
|
|
16
16
|
|
|
17
17
|
// src/interceptors/XMLHttpRequest/index.ts
|
|
18
18
|
import { invariant as invariant2 } from "outvariant";
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkIHW3ERPTjs = require('./chunk-IHW3ERPT.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
var _chunkVQ4DZOBBjs = require('./chunk-VQ4DZOBB.js');
|
|
@@ -12,7 +12,7 @@ var _chunkVQ4DZOBBjs = require('./chunk-VQ4DZOBB.js');
|
|
|
12
12
|
var _chunkZJOF5MEZjs = require('./chunk-ZJOF5MEZ.js');
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _chunkMPFSBY4Sjs = require('./chunk-MPFSBY4S.js');
|
|
16
16
|
|
|
17
17
|
// src/interceptors/XMLHttpRequest/index.ts
|
|
18
18
|
var _outvariant = require('outvariant');
|
|
@@ -254,7 +254,7 @@ var XMLHttpRequestController = class {
|
|
|
254
254
|
case "send": {
|
|
255
255
|
const [body] = args;
|
|
256
256
|
if (body != null) {
|
|
257
|
-
this.requestBody = typeof body === "string" ?
|
|
257
|
+
this.requestBody = typeof body === "string" ? _chunkIHW3ERPTjs.encodeBuffer.call(void 0, body) : body;
|
|
258
258
|
}
|
|
259
259
|
this.request.addEventListener("load", () => {
|
|
260
260
|
if (typeof this.onResponse !== "undefined") {
|
|
@@ -400,7 +400,7 @@ var XMLHttpRequestController = class {
|
|
|
400
400
|
}
|
|
401
401
|
}
|
|
402
402
|
responseBufferToText() {
|
|
403
|
-
return
|
|
403
|
+
return _chunkIHW3ERPTjs.decodeBuffer.call(void 0, this.responseBuffer);
|
|
404
404
|
}
|
|
405
405
|
get response() {
|
|
406
406
|
this.logger.info(
|
|
@@ -417,7 +417,7 @@ var XMLHttpRequestController = class {
|
|
|
417
417
|
return responseJson;
|
|
418
418
|
}
|
|
419
419
|
case "arraybuffer": {
|
|
420
|
-
const arrayBuffer =
|
|
420
|
+
const arrayBuffer = _chunkIHW3ERPTjs.toArrayBuffer.call(void 0, this.responseBuffer);
|
|
421
421
|
this.logger.info("resolved response ArrayBuffer", arrayBuffer);
|
|
422
422
|
return arrayBuffer;
|
|
423
423
|
}
|
|
@@ -643,7 +643,7 @@ function createXMLHttpRequestProxy({
|
|
|
643
643
|
}
|
|
644
644
|
|
|
645
645
|
// src/interceptors/XMLHttpRequest/index.ts
|
|
646
|
-
var _XMLHttpRequestInterceptor = class extends
|
|
646
|
+
var _XMLHttpRequestInterceptor = class extends _chunkMPFSBY4Sjs.Interceptor {
|
|
647
647
|
constructor() {
|
|
648
648
|
super(_XMLHttpRequestInterceptor.interceptorSymbol);
|
|
649
649
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkMPFSBY4Sjs = require('./chunk-MPFSBY4S.js');
|
|
4
4
|
|
|
5
5
|
// src/shims/webEncoding.ts
|
|
6
|
-
var TextEncoder = typeof globalThis.TextEncoder === "undefined" ?
|
|
7
|
-
var TextDecoder = typeof globalThis.TextDecoder === "undefined" ?
|
|
6
|
+
var TextEncoder = typeof globalThis.TextEncoder === "undefined" ? _chunkMPFSBY4Sjs.__require.call(void 0, "util").TextEncoder : globalThis.TextEncoder;
|
|
7
|
+
var TextDecoder = typeof globalThis.TextDecoder === "undefined" ? _chunkMPFSBY4Sjs.__require.call(void 0, "util").TextDecoder : globalThis.TextDecoder;
|
|
8
8
|
|
|
9
9
|
// src/utils/bufferUtils.ts
|
|
10
10
|
var encoder = new TextEncoder();
|
|
@@ -181,17 +181,13 @@ var Interceptor = class {
|
|
|
181
181
|
logger.info('removed proxied "%s" listener!', event);
|
|
182
182
|
});
|
|
183
183
|
};
|
|
184
|
-
|
|
185
|
-
this.readyState = "APPLIED" /* APPLIED */;
|
|
186
|
-
});
|
|
184
|
+
this.readyState = "APPLIED" /* APPLIED */;
|
|
187
185
|
return;
|
|
188
186
|
}
|
|
189
187
|
logger.info("no running instance found, setting up a new instance...");
|
|
190
188
|
this.setup();
|
|
191
189
|
this.setInstance();
|
|
192
|
-
|
|
193
|
-
this.readyState = "APPLIED" /* APPLIED */;
|
|
194
|
-
});
|
|
190
|
+
this.readyState = "APPLIED" /* APPLIED */;
|
|
195
191
|
}
|
|
196
192
|
setup() {
|
|
197
193
|
}
|
|
@@ -228,9 +224,7 @@ var Interceptor = class {
|
|
|
228
224
|
}
|
|
229
225
|
this.emitter.deactivate();
|
|
230
226
|
logger.info("destroyed the listener!");
|
|
231
|
-
|
|
232
|
-
this.readyState = "DISPOSED" /* DISPOSED */;
|
|
233
|
-
});
|
|
227
|
+
this.readyState = "DISPOSED" /* DISPOSED */;
|
|
234
228
|
}
|
|
235
229
|
getInstance() {
|
|
236
230
|
var _a;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
var _chunkZJOF5MEZjs = require('./chunk-ZJOF5MEZ.js');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkMPFSBY4Sjs = require('./chunk-MPFSBY4S.js');
|
|
8
8
|
|
|
9
9
|
// src/interceptors/ClientRequest/index.ts
|
|
10
10
|
var _http = require('http'); var _http2 = _interopRequireDefault(_http);
|
|
@@ -675,7 +675,7 @@ function request(protocol, options) {
|
|
|
675
675
|
}
|
|
676
676
|
|
|
677
677
|
// src/interceptors/ClientRequest/index.ts
|
|
678
|
-
var _ClientRequestInterceptor = class extends
|
|
678
|
+
var _ClientRequestInterceptor = class extends _chunkMPFSBY4Sjs.Interceptor {
|
|
679
679
|
constructor() {
|
|
680
680
|
super(_ClientRequestInterceptor.interceptorSymbol);
|
|
681
681
|
this.modules = /* @__PURE__ */ new Map();
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkMPFSBY4Sjs = require('./chunk-MPFSBY4S.js');
|
|
4
4
|
|
|
5
5
|
// src/BatchInterceptor.ts
|
|
6
|
-
var BatchInterceptor = class extends
|
|
6
|
+
var BatchInterceptor = class extends _chunkMPFSBY4Sjs.Interceptor {
|
|
7
7
|
constructor(options) {
|
|
8
8
|
BatchInterceptor.symbol = Symbol(options.name);
|
|
9
9
|
super(BatchInterceptor.symbol);
|
|
@@ -181,17 +181,13 @@ var Interceptor = class {
|
|
|
181
181
|
logger.info('removed proxied "%s" listener!', event);
|
|
182
182
|
});
|
|
183
183
|
};
|
|
184
|
-
|
|
185
|
-
this.readyState = "APPLIED" /* APPLIED */;
|
|
186
|
-
});
|
|
184
|
+
this.readyState = "APPLIED" /* APPLIED */;
|
|
187
185
|
return;
|
|
188
186
|
}
|
|
189
187
|
logger.info("no running instance found, setting up a new instance...");
|
|
190
188
|
this.setup();
|
|
191
189
|
this.setInstance();
|
|
192
|
-
|
|
193
|
-
this.readyState = "APPLIED" /* APPLIED */;
|
|
194
|
-
});
|
|
190
|
+
this.readyState = "APPLIED" /* APPLIED */;
|
|
195
191
|
}
|
|
196
192
|
setup() {
|
|
197
193
|
}
|
|
@@ -228,9 +224,7 @@ var Interceptor = class {
|
|
|
228
224
|
}
|
|
229
225
|
this.emitter.deactivate();
|
|
230
226
|
logger.info("destroyed the listener!");
|
|
231
|
-
|
|
232
|
-
this.readyState = "DISPOSED" /* DISPOSED */;
|
|
233
|
-
});
|
|
227
|
+
this.readyState = "DISPOSED" /* DISPOSED */;
|
|
234
228
|
}
|
|
235
229
|
getInstance() {
|
|
236
230
|
var _a;
|
package/lib/node/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkVJDB3MIVjs = require('./chunk-VJDB3MIV.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkIHW3ERPTjs = require('./chunk-IHW3ERPT.js');
|
|
8
8
|
|
|
9
9
|
|
|
10
10
|
var _chunkVQ4DZOBBjs = require('./chunk-VQ4DZOBB.js');
|
|
@@ -13,7 +13,7 @@ var _chunkVQ4DZOBBjs = require('./chunk-VQ4DZOBB.js');
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
var
|
|
16
|
+
var _chunkMPFSBY4Sjs = require('./chunk-MPFSBY4S.js');
|
|
17
17
|
|
|
18
18
|
// src/utils/getCleanUrl.ts
|
|
19
19
|
function getCleanUrl(url, isAbsolute = true) {
|
|
@@ -29,4 +29,4 @@ function getCleanUrl(url, isAbsolute = true) {
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
exports.BatchInterceptor =
|
|
32
|
+
exports.BatchInterceptor = _chunkVJDB3MIVjs.BatchInterceptor; exports.IS_PATCHED_MODULE = _chunkVQ4DZOBBjs.IS_PATCHED_MODULE; exports.Interceptor = _chunkMPFSBY4Sjs.Interceptor; exports.InterceptorReadyState = _chunkMPFSBY4Sjs.InterceptorReadyState; exports.decodeBuffer = _chunkIHW3ERPTjs.decodeBuffer; exports.deleteGlobalSymbol = _chunkMPFSBY4Sjs.deleteGlobalSymbol; exports.encodeBuffer = _chunkIHW3ERPTjs.encodeBuffer; exports.getCleanUrl = getCleanUrl; exports.getGlobalSymbol = _chunkMPFSBY4Sjs.getGlobalSymbol;
|
package/lib/node/index.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BatchInterceptor
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-NUSH7ACE.mjs";
|
|
4
4
|
import {
|
|
5
5
|
decodeBuffer,
|
|
6
6
|
encodeBuffer
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-LTX5IGCQ.mjs";
|
|
8
8
|
import {
|
|
9
9
|
IS_PATCHED_MODULE
|
|
10
10
|
} from "./chunk-GFH37L5D.mjs";
|
|
@@ -13,7 +13,7 @@ import {
|
|
|
13
13
|
InterceptorReadyState,
|
|
14
14
|
deleteGlobalSymbol,
|
|
15
15
|
getGlobalSymbol
|
|
16
|
-
} from "./chunk-
|
|
16
|
+
} from "./chunk-Y5QA6OEZ.mjs";
|
|
17
17
|
|
|
18
18
|
// src/utils/getCleanUrl.ts
|
|
19
19
|
function getCleanUrl(url, isAbsolute = true) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkQRCYLMPEjs = require('../../chunk-QRCYLMPE.js');
|
|
4
4
|
require('../../chunk-ZJOF5MEZ.js');
|
|
5
|
-
require('../../chunk-
|
|
5
|
+
require('../../chunk-MPFSBY4S.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
exports.ClientRequestInterceptor =
|
|
8
|
+
exports.ClientRequestInterceptor = _chunkQRCYLMPEjs.ClientRequestInterceptor;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ClientRequestInterceptor
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-R6MTHW6S.mjs";
|
|
4
4
|
import "../../chunk-STA6QBYM.mjs";
|
|
5
|
-
import "../../chunk-
|
|
5
|
+
import "../../chunk-Y5QA6OEZ.mjs";
|
|
6
6
|
export {
|
|
7
7
|
ClientRequestInterceptor
|
|
8
8
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../../chunk-
|
|
3
|
+
var _chunkBAJASIQJjs = require('../../chunk-BAJASIQJ.js');
|
|
4
|
+
require('../../chunk-IHW3ERPT.js');
|
|
5
5
|
require('../../chunk-VQ4DZOBB.js');
|
|
6
6
|
require('../../chunk-ZJOF5MEZ.js');
|
|
7
|
-
require('../../chunk-
|
|
7
|
+
require('../../chunk-MPFSBY4S.js');
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
exports.XMLHttpRequestInterceptor =
|
|
10
|
+
exports.XMLHttpRequestInterceptor = _chunkBAJASIQJjs.XMLHttpRequestInterceptor;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
XMLHttpRequestInterceptor
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-6HZ2ESGZ.mjs";
|
|
4
|
+
import "../../chunk-LTX5IGCQ.mjs";
|
|
5
5
|
import "../../chunk-GFH37L5D.mjs";
|
|
6
6
|
import "../../chunk-STA6QBYM.mjs";
|
|
7
|
-
import "../../chunk-
|
|
7
|
+
import "../../chunk-Y5QA6OEZ.mjs";
|
|
8
8
|
export {
|
|
9
9
|
XMLHttpRequestInterceptor
|
|
10
10
|
};
|
|
@@ -7,12 +7,12 @@ var _chunkVQ4DZOBBjs = require('../../chunk-VQ4DZOBB.js');
|
|
|
7
7
|
var _chunkZJOF5MEZjs = require('../../chunk-ZJOF5MEZ.js');
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkMPFSBY4Sjs = require('../../chunk-MPFSBY4S.js');
|
|
11
11
|
|
|
12
12
|
// src/interceptors/fetch/index.ts
|
|
13
13
|
var _outvariant = require('outvariant');
|
|
14
14
|
var _until = require('@open-draft/until');
|
|
15
|
-
var _FetchInterceptor = class extends
|
|
15
|
+
var _FetchInterceptor = class extends _chunkMPFSBY4Sjs.Interceptor {
|
|
16
16
|
constructor() {
|
|
17
17
|
super(_FetchInterceptor.symbol);
|
|
18
18
|
}
|
package/lib/node/presets/node.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkQRCYLMPEjs = require('../chunk-QRCYLMPE.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
7
|
-
require('../chunk-
|
|
6
|
+
var _chunkBAJASIQJjs = require('../chunk-BAJASIQJ.js');
|
|
7
|
+
require('../chunk-IHW3ERPT.js');
|
|
8
8
|
require('../chunk-VQ4DZOBB.js');
|
|
9
9
|
require('../chunk-ZJOF5MEZ.js');
|
|
10
|
-
require('../chunk-
|
|
10
|
+
require('../chunk-MPFSBY4S.js');
|
|
11
11
|
|
|
12
12
|
// src/presets/node.ts
|
|
13
13
|
var node_default = [
|
|
14
|
-
new (0,
|
|
15
|
-
new (0,
|
|
14
|
+
new (0, _chunkQRCYLMPEjs.ClientRequestInterceptor)(),
|
|
15
|
+
new (0, _chunkBAJASIQJjs.XMLHttpRequestInterceptor)()
|
|
16
16
|
];
|
|
17
17
|
|
|
18
18
|
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ClientRequestInterceptor
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-R6MTHW6S.mjs";
|
|
4
4
|
import {
|
|
5
5
|
XMLHttpRequestInterceptor
|
|
6
|
-
} from "../chunk-
|
|
7
|
-
import "../chunk-
|
|
6
|
+
} from "../chunk-6HZ2ESGZ.mjs";
|
|
7
|
+
import "../chunk-LTX5IGCQ.mjs";
|
|
8
8
|
import "../chunk-GFH37L5D.mjs";
|
|
9
9
|
import "../chunk-STA6QBYM.mjs";
|
|
10
|
-
import "../chunk-
|
|
10
|
+
import "../chunk-Y5QA6OEZ.mjs";
|
|
11
11
|
|
|
12
12
|
// src/presets/node.ts
|
|
13
13
|
var node_default = [
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mswjs/interceptors",
|
|
3
3
|
"description": "Low-level HTTP/HTTPS/XHR/fetch request interception library.",
|
|
4
|
-
"version": "0.22.
|
|
4
|
+
"version": "0.22.14",
|
|
5
5
|
"main": "./lib/node/index.js",
|
|
6
6
|
"module": "./lib/node/index.mjs",
|
|
7
7
|
"types": "./lib/node/index.d.ts",
|
package/src/Interceptor.test.ts
CHANGED
|
@@ -52,21 +52,15 @@ describe('readyState', () => {
|
|
|
52
52
|
interceptor.apply()
|
|
53
53
|
|
|
54
54
|
expect(interceptor.readyState).toBe(InterceptorReadyState.INACTIVE)
|
|
55
|
-
|
|
56
|
-
await nextTickAsync(() => {
|
|
57
|
-
expect(interceptor.readyState).toBe(InterceptorReadyState.INACTIVE)
|
|
58
|
-
})
|
|
59
55
|
})
|
|
60
56
|
|
|
61
57
|
it('perfroms state transition when the interceptor is applying', async () => {
|
|
62
58
|
const interceptor = new Interceptor(symbol)
|
|
63
59
|
interceptor.apply()
|
|
64
60
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
expect(interceptor.readyState).toBe(InterceptorReadyState.APPLIED)
|
|
69
|
-
})
|
|
61
|
+
// The interceptor's state transitions to APPLIED immediately.
|
|
62
|
+
// The only exception is if something throws during the setup.
|
|
63
|
+
expect(interceptor.readyState).toBe(InterceptorReadyState.APPLIED)
|
|
70
64
|
})
|
|
71
65
|
|
|
72
66
|
it('perfroms state transition when disposing of the interceptor', async () => {
|
|
@@ -74,11 +68,9 @@ describe('readyState', () => {
|
|
|
74
68
|
interceptor.apply()
|
|
75
69
|
interceptor.dispose()
|
|
76
70
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
expect(interceptor.readyState).toBe(InterceptorReadyState.DISPOSED)
|
|
81
|
-
})
|
|
71
|
+
// The interceptor's state transitions to DISPOSED immediately.
|
|
72
|
+
// The only exception is if something throws during the teardown.
|
|
73
|
+
expect(interceptor.readyState).toBe(InterceptorReadyState.DISPOSED)
|
|
82
74
|
})
|
|
83
75
|
})
|
|
84
76
|
|
package/src/Interceptor.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { Logger } from '@open-draft/logger'
|
|
2
2
|
import { Listener } from 'strict-event-emitter'
|
|
3
3
|
import { AsyncEventEmitter } from './utils/AsyncEventEmitter'
|
|
4
|
-
import { nextTick } from './utils/nextTick'
|
|
5
4
|
|
|
6
5
|
export type InterceptorEventMap = Record<string, any>
|
|
7
6
|
export type InterceptorSubscription = () => void
|
|
@@ -115,9 +114,7 @@ export class Interceptor<Events extends InterceptorEventMap> {
|
|
|
115
114
|
})
|
|
116
115
|
}
|
|
117
116
|
|
|
118
|
-
|
|
119
|
-
this.readyState = InterceptorReadyState.APPLIED
|
|
120
|
-
})
|
|
117
|
+
this.readyState = InterceptorReadyState.APPLIED
|
|
121
118
|
|
|
122
119
|
return
|
|
123
120
|
}
|
|
@@ -130,9 +127,7 @@ export class Interceptor<Events extends InterceptorEventMap> {
|
|
|
130
127
|
// Store the newly applied interceptor instance globally.
|
|
131
128
|
this.setInstance()
|
|
132
129
|
|
|
133
|
-
|
|
134
|
-
this.readyState = InterceptorReadyState.APPLIED
|
|
135
|
-
})
|
|
130
|
+
this.readyState = InterceptorReadyState.APPLIED
|
|
136
131
|
}
|
|
137
132
|
|
|
138
133
|
/**
|
|
@@ -204,9 +199,7 @@ export class Interceptor<Events extends InterceptorEventMap> {
|
|
|
204
199
|
this.emitter.deactivate()
|
|
205
200
|
logger.info('destroyed the listener!')
|
|
206
201
|
|
|
207
|
-
|
|
208
|
-
this.readyState = InterceptorReadyState.DISPOSED
|
|
209
|
-
})
|
|
202
|
+
this.readyState = InterceptorReadyState.DISPOSED
|
|
210
203
|
}
|
|
211
204
|
|
|
212
205
|
private getInstance(): this | undefined {
|