Update checked-in dependencies
This commit is contained in:
parent
c9f0d30a86
commit
95d52b7807
647 changed files with 498055 additions and 3880 deletions
1
node_modules/@mswjs/interceptors/lib/browser/chunk-3NVFHQ5L.mjs.map
generated
vendored
1
node_modules/@mswjs/interceptors/lib/browser/chunk-3NVFHQ5L.mjs.map
generated
vendored
File diff suppressed because one or more lines are too long
|
|
@ -6,11 +6,12 @@ import {
|
|||
import {
|
||||
RequestController,
|
||||
handleRequest
|
||||
} from "./chunk-H5O73WD2.mjs";
|
||||
} from "./chunk-L37TY7LC.mjs";
|
||||
import {
|
||||
FetchResponse,
|
||||
IS_PATCHED_MODULE
|
||||
} from "./chunk-FK37CTPH.mjs";
|
||||
IS_PATCHED_MODULE,
|
||||
setRawRequest
|
||||
} from "./chunk-CNX33NZA.mjs";
|
||||
import {
|
||||
hasConfigurableGlobal
|
||||
} from "./chunk-TX5GBTFY.mjs";
|
||||
|
|
@ -693,6 +694,7 @@ var XMLHttpRequestController = class {
|
|||
}
|
||||
});
|
||||
define(fetchRequest, "headers", proxyHeaders);
|
||||
setRawRequest(fetchRequest, this.request);
|
||||
this.logger.info("converted request to a Fetch API Request!", fetchRequest);
|
||||
return fetchRequest;
|
||||
}
|
||||
|
|
@ -841,4 +843,4 @@ XMLHttpRequestInterceptor.interceptorSymbol = Symbol("xhr");
|
|||
export {
|
||||
XMLHttpRequestInterceptor
|
||||
};
|
||||
//# sourceMappingURL=chunk-E2WFHJX6.mjs.map
|
||||
//# sourceMappingURL=chunk-7RPAMWJ6.mjs.map
|
||||
1
node_modules/@mswjs/interceptors/lib/browser/chunk-7RPAMWJ6.mjs.map
generated
vendored
Normal file
1
node_modules/@mswjs/interceptors/lib/browser/chunk-7RPAMWJ6.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -97,9 +97,20 @@ var FetchResponse = _FetchResponse;
|
|||
FetchResponse.STATUS_CODES_WITHOUT_BODY = [101, 103, 204, 205, 304];
|
||||
FetchResponse.STATUS_CODES_WITH_REDIRECT = [301, 302, 303, 307, 308];
|
||||
|
||||
// src/getRawRequest.ts
|
||||
var kRawRequest = Symbol("kRawRequest");
|
||||
function getRawRequest(request) {
|
||||
return Reflect.get(request, kRawRequest);
|
||||
}
|
||||
function setRawRequest(request, rawRequest) {
|
||||
Reflect.set(request, kRawRequest, rawRequest);
|
||||
}
|
||||
|
||||
export {
|
||||
IS_PATCHED_MODULE,
|
||||
canParseUrl,
|
||||
FetchResponse
|
||||
FetchResponse,
|
||||
getRawRequest,
|
||||
setRawRequest
|
||||
};
|
||||
//# sourceMappingURL=chunk-FK37CTPH.mjs.map
|
||||
//# sourceMappingURL=chunk-CNX33NZA.mjs.map
|
||||
1
node_modules/@mswjs/interceptors/lib/browser/chunk-CNX33NZA.mjs.map
generated
vendored
Normal file
1
node_modules/@mswjs/interceptors/lib/browser/chunk-CNX33NZA.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/@mswjs/interceptors/lib/browser/chunk-E2WFHJX6.mjs.map
generated
vendored
1
node_modules/@mswjs/interceptors/lib/browser/chunk-E2WFHJX6.mjs.map
generated
vendored
File diff suppressed because one or more lines are too long
1
node_modules/@mswjs/interceptors/lib/browser/chunk-F7RG3QQH.js.map
generated
vendored
1
node_modules/@mswjs/interceptors/lib/browser/chunk-F7RG3QQH.js.map
generated
vendored
File diff suppressed because one or more lines are too long
1
node_modules/@mswjs/interceptors/lib/browser/chunk-FGSEOIC4.js.map
generated
vendored
1
node_modules/@mswjs/interceptors/lib/browser/chunk-FGSEOIC4.js.map
generated
vendored
File diff suppressed because one or more lines are too long
1
node_modules/@mswjs/interceptors/lib/browser/chunk-FK37CTPH.mjs.map
generated
vendored
1
node_modules/@mswjs/interceptors/lib/browser/chunk-FK37CTPH.mjs.map
generated
vendored
File diff suppressed because one or more lines are too long
|
|
@ -39,12 +39,14 @@ var RequestController = class {
|
|||
this[kResponsePromise].resolve(response);
|
||||
}
|
||||
/**
|
||||
* Error this request with the given error.
|
||||
* Error this request with the given reason.
|
||||
*
|
||||
* @example
|
||||
* controller.errorWith()
|
||||
* controller.errorWith(new Error('Oops!'))
|
||||
* controller.errorWith({ message: 'Oops!'})
|
||||
*/
|
||||
errorWith(error) {
|
||||
errorWith(reason) {
|
||||
_outvariant.invariant.as(
|
||||
InterceptorError,
|
||||
!this[kRequestHandled],
|
||||
|
|
@ -53,7 +55,7 @@ var RequestController = class {
|
|||
this.request.url
|
||||
);
|
||||
this[kRequestHandled] = true;
|
||||
this[kResponsePromise].resolve(error);
|
||||
this[kResponsePromise].resolve(reason);
|
||||
}
|
||||
};
|
||||
kResponsePromise, kRequestHandled;
|
||||
|
|
@ -73,6 +75,11 @@ async function emitAsync(emitter, eventName, ...data) {
|
|||
|
||||
var _until = require('@open-draft/until');
|
||||
|
||||
// src/utils/isObject.ts
|
||||
function isObject(value, loose = false) {
|
||||
return loose ? Object.prototype.toString.call(value).startsWith("[object ") : Object.prototype.toString.call(value) === "[object Object]";
|
||||
}
|
||||
|
||||
// src/utils/isPropertyAccessible.ts
|
||||
function isPropertyAccessible(obj, key) {
|
||||
try {
|
||||
|
|
@ -103,7 +110,10 @@ function createServerErrorResponse(body) {
|
|||
);
|
||||
}
|
||||
function isResponseError(response) {
|
||||
return isPropertyAccessible(response, "type") && response.type === "error";
|
||||
return response != null && response instanceof Response && isPropertyAccessible(response, "type") && response.type === "error";
|
||||
}
|
||||
function isResponseLike(value) {
|
||||
return isObject(value, true) && isPropertyAccessible(value, "status") && isPropertyAccessible(value, "statusText") && isPropertyAccessible(value, "bodyUsed");
|
||||
}
|
||||
|
||||
// src/utils/isNodeLikeError.ts
|
||||
|
|
@ -122,12 +132,21 @@ async function handleRequest(options) {
|
|||
const handleResponse = async (response) => {
|
||||
if (response instanceof Error) {
|
||||
options.onError(response);
|
||||
} else if (isResponseError(response)) {
|
||||
options.onRequestError(response);
|
||||
} else {
|
||||
await options.onResponse(response);
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
if (isResponseError(response)) {
|
||||
options.onRequestError(response);
|
||||
return true;
|
||||
}
|
||||
if (isResponseLike(response)) {
|
||||
await options.onResponse(response);
|
||||
return true;
|
||||
}
|
||||
if (isObject(response)) {
|
||||
options.onError(response);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
const handleResponseError = async (error) => {
|
||||
if (error instanceof InterceptorError) {
|
||||
|
|
@ -165,7 +184,7 @@ async function handleRequest(options) {
|
|||
}
|
||||
}
|
||||
const result = await _until.until.call(void 0, async () => {
|
||||
const requestListtenersPromise = emitAsync(options.emitter, "request", {
|
||||
const requestListenersPromise = emitAsync(options.emitter, "request", {
|
||||
requestId: options.requestId,
|
||||
request: options.request,
|
||||
controller: options.controller
|
||||
|
|
@ -173,11 +192,10 @@ async function handleRequest(options) {
|
|||
await Promise.race([
|
||||
// Short-circuit the request handling promise if the request gets aborted.
|
||||
requestAbortPromise,
|
||||
requestListtenersPromise,
|
||||
requestListenersPromise,
|
||||
options.controller[kResponsePromise]
|
||||
]);
|
||||
const mockedResponse = await options.controller[kResponsePromise];
|
||||
return mockedResponse;
|
||||
return await options.controller[kResponsePromise];
|
||||
});
|
||||
if (requestAbortPromise.state === "rejected") {
|
||||
options.onError(requestAbortPromise.rejectionReason);
|
||||
|
|
@ -225,4 +243,4 @@ async function handleRequest(options) {
|
|||
|
||||
|
||||
exports.RequestController = RequestController; exports.emitAsync = emitAsync; exports.handleRequest = handleRequest;
|
||||
//# sourceMappingURL=chunk-FGSEOIC4.js.map
|
||||
//# sourceMappingURL=chunk-GTJ35JP4.js.map
|
||||
1
node_modules/@mswjs/interceptors/lib/browser/chunk-GTJ35JP4.js.map
generated
vendored
Normal file
1
node_modules/@mswjs/interceptors/lib/browser/chunk-GTJ35JP4.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
1
node_modules/@mswjs/interceptors/lib/browser/chunk-H4LFCCBA.js.map
generated
vendored
1
node_modules/@mswjs/interceptors/lib/browser/chunk-H4LFCCBA.js.map
generated
vendored
File diff suppressed because one or more lines are too long
1
node_modules/@mswjs/interceptors/lib/browser/chunk-H5O73WD2.mjs.map
generated
vendored
1
node_modules/@mswjs/interceptors/lib/browser/chunk-H5O73WD2.mjs.map
generated
vendored
File diff suppressed because one or more lines are too long
1
node_modules/@mswjs/interceptors/lib/browser/chunk-J2HDR5D7.js.map
generated
vendored
1
node_modules/@mswjs/interceptors/lib/browser/chunk-J2HDR5D7.js.map
generated
vendored
File diff suppressed because one or more lines are too long
|
|
@ -39,12 +39,14 @@ var RequestController = class {
|
|||
this[kResponsePromise].resolve(response);
|
||||
}
|
||||
/**
|
||||
* Error this request with the given error.
|
||||
* Error this request with the given reason.
|
||||
*
|
||||
* @example
|
||||
* controller.errorWith()
|
||||
* controller.errorWith(new Error('Oops!'))
|
||||
* controller.errorWith({ message: 'Oops!'})
|
||||
*/
|
||||
errorWith(error) {
|
||||
errorWith(reason) {
|
||||
invariant.as(
|
||||
InterceptorError,
|
||||
!this[kRequestHandled],
|
||||
|
|
@ -53,7 +55,7 @@ var RequestController = class {
|
|||
this.request.url
|
||||
);
|
||||
this[kRequestHandled] = true;
|
||||
this[kResponsePromise].resolve(error);
|
||||
this[kResponsePromise].resolve(reason);
|
||||
}
|
||||
};
|
||||
kResponsePromise, kRequestHandled;
|
||||
|
|
@ -73,6 +75,11 @@ async function emitAsync(emitter, eventName, ...data) {
|
|||
import { DeferredPromise as DeferredPromise2 } from "@open-draft/deferred-promise";
|
||||
import { until } from "@open-draft/until";
|
||||
|
||||
// src/utils/isObject.ts
|
||||
function isObject(value, loose = false) {
|
||||
return loose ? Object.prototype.toString.call(value).startsWith("[object ") : Object.prototype.toString.call(value) === "[object Object]";
|
||||
}
|
||||
|
||||
// src/utils/isPropertyAccessible.ts
|
||||
function isPropertyAccessible(obj, key) {
|
||||
try {
|
||||
|
|
@ -103,7 +110,10 @@ function createServerErrorResponse(body) {
|
|||
);
|
||||
}
|
||||
function isResponseError(response) {
|
||||
return isPropertyAccessible(response, "type") && response.type === "error";
|
||||
return response != null && response instanceof Response && isPropertyAccessible(response, "type") && response.type === "error";
|
||||
}
|
||||
function isResponseLike(value) {
|
||||
return isObject(value, true) && isPropertyAccessible(value, "status") && isPropertyAccessible(value, "statusText") && isPropertyAccessible(value, "bodyUsed");
|
||||
}
|
||||
|
||||
// src/utils/isNodeLikeError.ts
|
||||
|
|
@ -122,12 +132,21 @@ async function handleRequest(options) {
|
|||
const handleResponse = async (response) => {
|
||||
if (response instanceof Error) {
|
||||
options.onError(response);
|
||||
} else if (isResponseError(response)) {
|
||||
options.onRequestError(response);
|
||||
} else {
|
||||
await options.onResponse(response);
|
||||
return true;
|
||||
}
|
||||
return true;
|
||||
if (isResponseError(response)) {
|
||||
options.onRequestError(response);
|
||||
return true;
|
||||
}
|
||||
if (isResponseLike(response)) {
|
||||
await options.onResponse(response);
|
||||
return true;
|
||||
}
|
||||
if (isObject(response)) {
|
||||
options.onError(response);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
const handleResponseError = async (error) => {
|
||||
if (error instanceof InterceptorError) {
|
||||
|
|
@ -165,7 +184,7 @@ async function handleRequest(options) {
|
|||
}
|
||||
}
|
||||
const result = await until(async () => {
|
||||
const requestListtenersPromise = emitAsync(options.emitter, "request", {
|
||||
const requestListenersPromise = emitAsync(options.emitter, "request", {
|
||||
requestId: options.requestId,
|
||||
request: options.request,
|
||||
controller: options.controller
|
||||
|
|
@ -173,11 +192,10 @@ async function handleRequest(options) {
|
|||
await Promise.race([
|
||||
// Short-circuit the request handling promise if the request gets aborted.
|
||||
requestAbortPromise,
|
||||
requestListtenersPromise,
|
||||
requestListenersPromise,
|
||||
options.controller[kResponsePromise]
|
||||
]);
|
||||
const mockedResponse = await options.controller[kResponsePromise];
|
||||
return mockedResponse;
|
||||
return await options.controller[kResponsePromise];
|
||||
});
|
||||
if (requestAbortPromise.state === "rejected") {
|
||||
options.onError(requestAbortPromise.rejectionReason);
|
||||
|
|
@ -225,4 +243,4 @@ export {
|
|||
emitAsync,
|
||||
handleRequest
|
||||
};
|
||||
//# sourceMappingURL=chunk-H5O73WD2.mjs.map
|
||||
//# sourceMappingURL=chunk-L37TY7LC.mjs.map
|
||||
1
node_modules/@mswjs/interceptors/lib/browser/chunk-L37TY7LC.mjs.map
generated
vendored
Normal file
1
node_modules/@mswjs/interceptors/lib/browser/chunk-L37TY7LC.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -97,9 +97,20 @@ var FetchResponse = _FetchResponse;
|
|||
FetchResponse.STATUS_CODES_WITHOUT_BODY = [101, 103, 204, 205, 304];
|
||||
FetchResponse.STATUS_CODES_WITH_REDIRECT = [301, 302, 303, 307, 308];
|
||||
|
||||
// src/getRawRequest.ts
|
||||
var kRawRequest = Symbol("kRawRequest");
|
||||
function getRawRequest(request) {
|
||||
return Reflect.get(request, kRawRequest);
|
||||
}
|
||||
function setRawRequest(request, rawRequest) {
|
||||
Reflect.set(request, kRawRequest, rawRequest);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
exports.IS_PATCHED_MODULE = IS_PATCHED_MODULE; exports.canParseUrl = canParseUrl; exports.FetchResponse = FetchResponse;
|
||||
//# sourceMappingURL=chunk-F7RG3QQH.js.map
|
||||
|
||||
|
||||
|
||||
exports.IS_PATCHED_MODULE = IS_PATCHED_MODULE; exports.canParseUrl = canParseUrl; exports.FetchResponse = FetchResponse; exports.getRawRequest = getRawRequest; exports.setRawRequest = setRawRequest;
|
||||
//# sourceMappingURL=chunk-MSUVVHIG.js.map
|
||||
1
node_modules/@mswjs/interceptors/lib/browser/chunk-MSUVVHIG.js.map
generated
vendored
Normal file
1
node_modules/@mswjs/interceptors/lib/browser/chunk-MSUVVHIG.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -6,11 +6,12 @@ var _chunkLK6DILFKjs = require('./chunk-LK6DILFK.js');
|
|||
|
||||
|
||||
|
||||
var _chunkFGSEOIC4js = require('./chunk-FGSEOIC4.js');
|
||||
var _chunkGTJ35JP4js = require('./chunk-GTJ35JP4.js');
|
||||
|
||||
|
||||
|
||||
var _chunkF7RG3QQHjs = require('./chunk-F7RG3QQH.js');
|
||||
|
||||
var _chunkMSUVVHIGjs = require('./chunk-MSUVVHIG.js');
|
||||
|
||||
|
||||
var _chunkPFGO5BSMjs = require('./chunk-PFGO5BSM.js');
|
||||
|
|
@ -206,8 +207,8 @@ function parseJson(data) {
|
|||
|
||||
// src/interceptors/XMLHttpRequest/utils/createResponse.ts
|
||||
function createResponse(request, body) {
|
||||
const responseBodyOrNull = _chunkF7RG3QQHjs.FetchResponse.isResponseWithBody(request.status) ? body : null;
|
||||
return new (0, _chunkF7RG3QQHjs.FetchResponse)(responseBodyOrNull, {
|
||||
const responseBodyOrNull = _chunkMSUVVHIGjs.FetchResponse.isResponseWithBody(request.status) ? body : null;
|
||||
return new (0, _chunkMSUVVHIGjs.FetchResponse)(responseBodyOrNull, {
|
||||
url: request.responseURL,
|
||||
status: request.status,
|
||||
statusText: request.statusText,
|
||||
|
|
@ -693,6 +694,7 @@ var XMLHttpRequestController = class {
|
|||
}
|
||||
});
|
||||
define(fetchRequest, "headers", proxyHeaders);
|
||||
_chunkMSUVVHIGjs.setRawRequest.call(void 0, fetchRequest, this.request);
|
||||
this.logger.info("converted request to a Fetch API Request!", fetchRequest);
|
||||
return fetchRequest;
|
||||
}
|
||||
|
|
@ -741,13 +743,13 @@ function createXMLHttpRequestProxy({
|
|||
logger
|
||||
);
|
||||
xhrRequestController.onRequest = async function({ request, requestId }) {
|
||||
const controller = new (0, _chunkFGSEOIC4js.RequestController)(request);
|
||||
const controller = new (0, _chunkGTJ35JP4js.RequestController)(request);
|
||||
this.logger.info("awaiting mocked response...");
|
||||
this.logger.info(
|
||||
'emitting the "request" event for %s listener(s)...',
|
||||
emitter.listenerCount("request")
|
||||
);
|
||||
const isRequestHandled = await _chunkFGSEOIC4js.handleRequest.call(void 0, {
|
||||
const isRequestHandled = await _chunkGTJ35JP4js.handleRequest.call(void 0, {
|
||||
request,
|
||||
requestId,
|
||||
controller,
|
||||
|
|
@ -807,7 +809,7 @@ var _XMLHttpRequestInterceptor = class extends _chunkTIPR373Rjs.Interceptor {
|
|||
logger.info('patching "XMLHttpRequest" module...');
|
||||
const PureXMLHttpRequest = globalThis.XMLHttpRequest;
|
||||
_outvariant.invariant.call(void 0,
|
||||
!PureXMLHttpRequest[_chunkF7RG3QQHjs.IS_PATCHED_MODULE],
|
||||
!PureXMLHttpRequest[_chunkMSUVVHIGjs.IS_PATCHED_MODULE],
|
||||
'Failed to patch the "XMLHttpRequest" module: already patched.'
|
||||
);
|
||||
globalThis.XMLHttpRequest = createXMLHttpRequestProxy({
|
||||
|
|
@ -818,13 +820,13 @@ var _XMLHttpRequestInterceptor = class extends _chunkTIPR373Rjs.Interceptor {
|
|||
'native "XMLHttpRequest" module patched!',
|
||||
globalThis.XMLHttpRequest.name
|
||||
);
|
||||
Object.defineProperty(globalThis.XMLHttpRequest, _chunkF7RG3QQHjs.IS_PATCHED_MODULE, {
|
||||
Object.defineProperty(globalThis.XMLHttpRequest, _chunkMSUVVHIGjs.IS_PATCHED_MODULE, {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
value: true
|
||||
});
|
||||
this.subscriptions.push(() => {
|
||||
Object.defineProperty(globalThis.XMLHttpRequest, _chunkF7RG3QQHjs.IS_PATCHED_MODULE, {
|
||||
Object.defineProperty(globalThis.XMLHttpRequest, _chunkMSUVVHIGjs.IS_PATCHED_MODULE, {
|
||||
value: void 0
|
||||
});
|
||||
globalThis.XMLHttpRequest = PureXMLHttpRequest;
|
||||
|
|
@ -841,4 +843,4 @@ XMLHttpRequestInterceptor.interceptorSymbol = Symbol("xhr");
|
|||
|
||||
|
||||
exports.XMLHttpRequestInterceptor = XMLHttpRequestInterceptor;
|
||||
//# sourceMappingURL=chunk-J2HDR5D7.js.map
|
||||
//# sourceMappingURL=chunk-O2RCNIMR.js.map
|
||||
1
node_modules/@mswjs/interceptors/lib/browser/chunk-O2RCNIMR.js.map
generated
vendored
Normal file
1
node_modules/@mswjs/interceptors/lib/browser/chunk-O2RCNIMR.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -2,12 +2,13 @@ import {
|
|||
RequestController,
|
||||
emitAsync,
|
||||
handleRequest
|
||||
} from "./chunk-H5O73WD2.mjs";
|
||||
} from "./chunk-L37TY7LC.mjs";
|
||||
import {
|
||||
FetchResponse,
|
||||
IS_PATCHED_MODULE,
|
||||
canParseUrl
|
||||
} from "./chunk-FK37CTPH.mjs";
|
||||
canParseUrl,
|
||||
setRawRequest
|
||||
} from "./chunk-CNX33NZA.mjs";
|
||||
import {
|
||||
hasConfigurableGlobal
|
||||
} from "./chunk-TX5GBTFY.mjs";
|
||||
|
|
@ -176,8 +177,11 @@ var _FetchInterceptor = class extends Interceptor {
|
|||
);
|
||||
globalThis.fetch = async (input, init) => {
|
||||
const requestId = createRequestId();
|
||||
const resolvedInput = typeof input === "string" && typeof location !== "undefined" && !canParseUrl(input) ? new URL(input, location.origin) : input;
|
||||
const resolvedInput = typeof input === "string" && typeof location !== "undefined" && !canParseUrl(input) ? new URL(input, location.href) : input;
|
||||
const request = new Request(resolvedInput, init);
|
||||
if (input instanceof Request) {
|
||||
setRawRequest(request, input);
|
||||
}
|
||||
const responsePromise = new DeferredPromise();
|
||||
const controller = new RequestController(request);
|
||||
this.logger.info("[%s] %s", request.method, request.url);
|
||||
|
|
@ -284,4 +288,4 @@ FetchInterceptor.symbol = Symbol("fetch");
|
|||
export {
|
||||
FetchInterceptor
|
||||
};
|
||||
//# sourceMappingURL=chunk-3NVFHQ5L.mjs.map
|
||||
//# sourceMappingURL=chunk-SKG3GP7X.mjs.map
|
||||
1
node_modules/@mswjs/interceptors/lib/browser/chunk-SKG3GP7X.mjs.map
generated
vendored
Normal file
1
node_modules/@mswjs/interceptors/lib/browser/chunk-SKG3GP7X.mjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -2,12 +2,13 @@
|
|||
|
||||
|
||||
|
||||
var _chunkFGSEOIC4js = require('./chunk-FGSEOIC4.js');
|
||||
var _chunkGTJ35JP4js = require('./chunk-GTJ35JP4.js');
|
||||
|
||||
|
||||
|
||||
|
||||
var _chunkF7RG3QQHjs = require('./chunk-F7RG3QQH.js');
|
||||
|
||||
var _chunkMSUVVHIGjs = require('./chunk-MSUVVHIG.js');
|
||||
|
||||
|
||||
var _chunkPFGO5BSMjs = require('./chunk-PFGO5BSM.js');
|
||||
|
|
@ -171,22 +172,25 @@ var _FetchInterceptor = class extends _chunkTIPR373Rjs.Interceptor {
|
|||
async setup() {
|
||||
const pureFetch = globalThis.fetch;
|
||||
_outvariant.invariant.call(void 0,
|
||||
!pureFetch[_chunkF7RG3QQHjs.IS_PATCHED_MODULE],
|
||||
!pureFetch[_chunkMSUVVHIGjs.IS_PATCHED_MODULE],
|
||||
'Failed to patch the "fetch" module: already patched.'
|
||||
);
|
||||
globalThis.fetch = async (input, init) => {
|
||||
const requestId = _chunkTIPR373Rjs.createRequestId.call(void 0, );
|
||||
const resolvedInput = typeof input === "string" && typeof location !== "undefined" && !_chunkF7RG3QQHjs.canParseUrl.call(void 0, input) ? new URL(input, location.origin) : input;
|
||||
const resolvedInput = typeof input === "string" && typeof location !== "undefined" && !_chunkMSUVVHIGjs.canParseUrl.call(void 0, input) ? new URL(input, location.href) : input;
|
||||
const request = new Request(resolvedInput, init);
|
||||
if (input instanceof Request) {
|
||||
_chunkMSUVVHIGjs.setRawRequest.call(void 0, request, input);
|
||||
}
|
||||
const responsePromise = new (0, _deferredpromise.DeferredPromise)();
|
||||
const controller = new (0, _chunkFGSEOIC4js.RequestController)(request);
|
||||
const controller = new (0, _chunkGTJ35JP4js.RequestController)(request);
|
||||
this.logger.info("[%s] %s", request.method, request.url);
|
||||
this.logger.info("awaiting for the mocked response...");
|
||||
this.logger.info(
|
||||
'emitting the "request" event for %s listener(s)...',
|
||||
this.emitter.listenerCount("request")
|
||||
);
|
||||
const isRequestHandled = await _chunkFGSEOIC4js.handleRequest.call(void 0, {
|
||||
const isRequestHandled = await _chunkGTJ35JP4js.handleRequest.call(void 0, {
|
||||
request,
|
||||
requestId,
|
||||
emitter: this.emitter,
|
||||
|
|
@ -196,9 +200,9 @@ var _FetchInterceptor = class extends _chunkTIPR373Rjs.Interceptor {
|
|||
rawResponse
|
||||
});
|
||||
const decompressedStream = decompressResponse(rawResponse);
|
||||
const response = decompressedStream === null ? rawResponse : new (0, _chunkF7RG3QQHjs.FetchResponse)(decompressedStream, rawResponse);
|
||||
_chunkF7RG3QQHjs.FetchResponse.setUrl(request.url, response);
|
||||
if (_chunkF7RG3QQHjs.FetchResponse.isRedirectResponse(response.status)) {
|
||||
const response = decompressedStream === null ? rawResponse : new (0, _chunkMSUVVHIGjs.FetchResponse)(decompressedStream, rawResponse);
|
||||
_chunkMSUVVHIGjs.FetchResponse.setUrl(request.url, response);
|
||||
if (_chunkMSUVVHIGjs.FetchResponse.isRedirectResponse(response.status)) {
|
||||
if (request.redirect === "error") {
|
||||
responsePromise.reject(createNetworkError("unexpected redirect"));
|
||||
return;
|
||||
|
|
@ -217,7 +221,7 @@ var _FetchInterceptor = class extends _chunkTIPR373Rjs.Interceptor {
|
|||
}
|
||||
if (this.emitter.listenerCount("response") > 0) {
|
||||
this.logger.info('emitting the "response" event...');
|
||||
await _chunkFGSEOIC4js.emitAsync.call(void 0, this.emitter, "response", {
|
||||
await _chunkGTJ35JP4js.emitAsync.call(void 0, this.emitter, "response", {
|
||||
// Clone the mocked response for the "response" event listener.
|
||||
// This way, the listener can read the response and not lock its body
|
||||
// for the actual fetch consumer.
|
||||
|
|
@ -251,7 +255,7 @@ var _FetchInterceptor = class extends _chunkTIPR373Rjs.Interceptor {
|
|||
if (this.emitter.listenerCount("response") > 0) {
|
||||
this.logger.info('emitting the "response" event...');
|
||||
const responseClone = response.clone();
|
||||
await _chunkFGSEOIC4js.emitAsync.call(void 0, this.emitter, "response", {
|
||||
await _chunkGTJ35JP4js.emitAsync.call(void 0, this.emitter, "response", {
|
||||
response: responseClone,
|
||||
isMockedResponse: false,
|
||||
request: requestCloneForResponseEvent,
|
||||
|
|
@ -261,13 +265,13 @@ var _FetchInterceptor = class extends _chunkTIPR373Rjs.Interceptor {
|
|||
return response;
|
||||
});
|
||||
};
|
||||
Object.defineProperty(globalThis.fetch, _chunkF7RG3QQHjs.IS_PATCHED_MODULE, {
|
||||
Object.defineProperty(globalThis.fetch, _chunkMSUVVHIGjs.IS_PATCHED_MODULE, {
|
||||
enumerable: true,
|
||||
configurable: true,
|
||||
value: true
|
||||
});
|
||||
this.subscriptions.push(() => {
|
||||
Object.defineProperty(globalThis.fetch, _chunkF7RG3QQHjs.IS_PATCHED_MODULE, {
|
||||
Object.defineProperty(globalThis.fetch, _chunkMSUVVHIGjs.IS_PATCHED_MODULE, {
|
||||
value: void 0
|
||||
});
|
||||
globalThis.fetch = pureFetch;
|
||||
|
|
@ -284,4 +288,4 @@ FetchInterceptor.symbol = Symbol("fetch");
|
|||
|
||||
|
||||
exports.FetchInterceptor = FetchInterceptor;
|
||||
//# sourceMappingURL=chunk-H4LFCCBA.js.map
|
||||
//# sourceMappingURL=chunk-UY4VLZVB.js.map
|
||||
1
node_modules/@mswjs/interceptors/lib/browser/chunk-UY4VLZVB.js.map
generated
vendored
Normal file
1
node_modules/@mswjs/interceptors/lib/browser/chunk-UY4VLZVB.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
|
|
@ -11,7 +11,7 @@ declare class RequestController {
|
|||
* @note This promise cannot be rejected. It's either infinitely
|
||||
* pending or resolved with whichever Response was passed to `respondWith()`.
|
||||
*/
|
||||
[kResponsePromise]: DeferredPromise<Response | Error | undefined>;
|
||||
[kResponsePromise]: DeferredPromise<Response | Record<string, any> | undefined>;
|
||||
/**
|
||||
* Internal flag indicating if this request has been handled.
|
||||
* @note The response promise becomes "fulfilled" on the next tick.
|
||||
|
|
@ -27,12 +27,14 @@ declare class RequestController {
|
|||
*/
|
||||
respondWith(response: Response): void;
|
||||
/**
|
||||
* Error this request with the given error.
|
||||
* Error this request with the given reason.
|
||||
*
|
||||
* @example
|
||||
* controller.errorWith()
|
||||
* controller.errorWith(new Error('Oops!'))
|
||||
* controller.errorWith({ message: 'Oops!'})
|
||||
*/
|
||||
errorWith(error?: Error): void;
|
||||
errorWith(reason?: Error | Record<string, any>): void;
|
||||
}
|
||||
|
||||
declare const IS_PATCHED_MODULE: unique symbol;
|
||||
18
node_modules/@mswjs/interceptors/lib/browser/index.d.ts
generated
vendored
18
node_modules/@mswjs/interceptors/lib/browser/index.d.ts
generated
vendored
|
|
@ -1,4 +1,4 @@
|
|||
export { H as HttpRequestEventMap, I as IS_PATCHED_MODULE, R as RequestController, a as RequestCredentials } from './glossary-6564c252.js';
|
||||
export { H as HttpRequestEventMap, I as IS_PATCHED_MODULE, R as RequestController, a as RequestCredentials } from './glossary-7152281e.js';
|
||||
import { I as Interceptor, E as ExtractEventNames } from './Interceptor-af98b768.js';
|
||||
export { c as INTERNAL_REQUEST_ID_HEADER_NAME, a as InterceptorEventMap, e as InterceptorReadyState, b as InterceptorSubscription, d as deleteGlobalSymbol, g as getGlobalSymbol } from './Interceptor-af98b768.js';
|
||||
import { EventMap, Listener } from 'strict-event-emitter';
|
||||
|
|
@ -66,4 +66,18 @@ declare class FetchResponse extends Response {
|
|||
constructor(body?: BodyInit | null, init?: FetchResponseInit);
|
||||
}
|
||||
|
||||
export { BatchInterceptor, BatchInterceptorOptions, ExtractEventMapType, ExtractEventNames, FetchResponse, Interceptor, createRequestId, decodeBuffer, encodeBuffer, getCleanUrl };
|
||||
/**
|
||||
* Returns a raw request instance associated with this request.
|
||||
*
|
||||
* @example
|
||||
* interceptor.on('request', ({ request }) => {
|
||||
* const rawRequest = getRawRequest(request)
|
||||
*
|
||||
* if (rawRequest instanceof http.ClientRequest) {
|
||||
* console.log(rawRequest.rawHeaders)
|
||||
* }
|
||||
* })
|
||||
*/
|
||||
declare function getRawRequest(request: Request): unknown | undefined;
|
||||
|
||||
export { BatchInterceptor, BatchInterceptorOptions, ExtractEventMapType, ExtractEventNames, FetchResponse, Interceptor, createRequestId, decodeBuffer, encodeBuffer, getCleanUrl, getRawRequest };
|
||||
|
|
|
|||
6
node_modules/@mswjs/interceptors/lib/browser/index.js
generated
vendored
6
node_modules/@mswjs/interceptors/lib/browser/index.js
generated
vendored
|
|
@ -5,7 +5,8 @@ var _chunkLK6DILFKjs = require('./chunk-LK6DILFK.js');
|
|||
|
||||
|
||||
|
||||
var _chunkF7RG3QQHjs = require('./chunk-F7RG3QQH.js');
|
||||
|
||||
var _chunkMSUVVHIGjs = require('./chunk-MSUVVHIG.js');
|
||||
|
||||
|
||||
|
||||
|
|
@ -75,5 +76,6 @@ function getCleanUrl(url, isAbsolute = true) {
|
|||
|
||||
|
||||
|
||||
exports.BatchInterceptor = BatchInterceptor; exports.FetchResponse = _chunkF7RG3QQHjs.FetchResponse; exports.INTERNAL_REQUEST_ID_HEADER_NAME = _chunkTIPR373Rjs.INTERNAL_REQUEST_ID_HEADER_NAME; exports.IS_PATCHED_MODULE = _chunkF7RG3QQHjs.IS_PATCHED_MODULE; exports.Interceptor = _chunkTIPR373Rjs.Interceptor; exports.InterceptorReadyState = _chunkTIPR373Rjs.InterceptorReadyState; exports.createRequestId = _chunkTIPR373Rjs.createRequestId; exports.decodeBuffer = _chunkLK6DILFKjs.decodeBuffer; exports.deleteGlobalSymbol = _chunkTIPR373Rjs.deleteGlobalSymbol; exports.encodeBuffer = _chunkLK6DILFKjs.encodeBuffer; exports.getCleanUrl = getCleanUrl; exports.getGlobalSymbol = _chunkTIPR373Rjs.getGlobalSymbol;
|
||||
|
||||
exports.BatchInterceptor = BatchInterceptor; exports.FetchResponse = _chunkMSUVVHIGjs.FetchResponse; exports.INTERNAL_REQUEST_ID_HEADER_NAME = _chunkTIPR373Rjs.INTERNAL_REQUEST_ID_HEADER_NAME; exports.IS_PATCHED_MODULE = _chunkMSUVVHIGjs.IS_PATCHED_MODULE; exports.Interceptor = _chunkTIPR373Rjs.Interceptor; exports.InterceptorReadyState = _chunkTIPR373Rjs.InterceptorReadyState; exports.createRequestId = _chunkTIPR373Rjs.createRequestId; exports.decodeBuffer = _chunkLK6DILFKjs.decodeBuffer; exports.deleteGlobalSymbol = _chunkTIPR373Rjs.deleteGlobalSymbol; exports.encodeBuffer = _chunkLK6DILFKjs.encodeBuffer; exports.getCleanUrl = getCleanUrl; exports.getGlobalSymbol = _chunkTIPR373Rjs.getGlobalSymbol; exports.getRawRequest = _chunkMSUVVHIGjs.getRawRequest;
|
||||
//# sourceMappingURL=index.js.map
|
||||
2
node_modules/@mswjs/interceptors/lib/browser/index.js.map
generated
vendored
2
node_modules/@mswjs/interceptors/lib/browser/index.js.map
generated
vendored
|
|
@ -1 +1 @@
|
|||
{"version":3,"sources":["../../src/BatchInterceptor.ts","../../src/utils/getCleanUrl.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAsBO,IAAM,mBAAN,cAGG,YAAoB;AAAA,EAK5B,YAAY,SAAmD;AAC7D,qBAAiB,SAAS,OAAO,QAAQ,IAAI;AAC7C,UAAM,iBAAiB,MAAM;AAC7B,SAAK,eAAe,QAAQ;AAAA,EAC9B;AAAA,EAEU,QAAQ;AAChB,UAAM,SAAS,KAAK,OAAO,OAAO,OAAO;AAEzC,WAAO,KAAK,mCAAmC,KAAK,aAAa,MAAM;AAEvE,eAAW,eAAe,KAAK,cAAc;AAC3C,aAAO,KAAK,gCAAgC,YAAY,YAAY,IAAI;AACxE,kBAAY,MAAM;AAElB,aAAO,KAAK,yCAAyC;AACrD,WAAK,cAAc,KAAK,MAAM,YAAY,QAAQ,CAAC;AAAA,IACrD;AAAA,EACF;AAAA,EAEO,GACL,OACA,UACM;AAGN,eAAW,eAAe,KAAK,cAAc;AAC3C,kBAAY,GAAG,OAAO,QAAQ;AAAA,IAChC;AAEA,WAAO;AAAA,EACT;AAAA,EAEO,KACL,OACA,UACM;AACN,eAAW,eAAe,KAAK,cAAc;AAC3C,kBAAY,KAAK,OAAO,QAAQ;AAAA,IAClC;AAEA,WAAO;AAAA,EACT;AAAA,EAEO,IACL,OACA,UACM;AACN,eAAW,eAAe,KAAK,cAAc;AAC3C,kBAAY,IAAI,OAAO,QAAQ;AAAA,IACjC;AAEA,WAAO;AAAA,EACT;AAAA,EAEO,mBACL,OACM;AACN,eAAW,gBAAgB,KAAK,cAAc;AAC5C,mBAAa,mBAAmB,KAAK;AAAA,IACvC;AAEA,WAAO;AAAA,EACT;AACF;;;AC3FO,SAAS,YAAY,KAAU,aAAsB,MAAc;AACxE,SAAO,CAAC,cAAc,IAAI,QAAQ,IAAI,QAAQ,EAAE,OAAO,OAAO,EAAE,KAAK,EAAE;AACzE","sourcesContent":["import { EventMap, Listener } from 'strict-event-emitter'\nimport { Interceptor, ExtractEventNames } from './Interceptor'\n\nexport interface BatchInterceptorOptions<\n InterceptorList extends ReadonlyArray<Interceptor<any>>\n> {\n name: string\n interceptors: InterceptorList\n}\n\nexport type ExtractEventMapType<\n InterceptorList extends ReadonlyArray<Interceptor<any>>\n> = InterceptorList extends ReadonlyArray<infer InterceptorType>\n ? InterceptorType extends Interceptor<infer EventMap>\n ? EventMap\n : never\n : never\n\n/**\n * A batch interceptor that exposes a single interface\n * to apply and operate with multiple interceptors at once.\n */\nexport class BatchInterceptor<\n InterceptorList extends ReadonlyArray<Interceptor<any>>,\n Events extends EventMap = ExtractEventMapType<InterceptorList>\n> extends Interceptor<Events> {\n static symbol: symbol\n\n private interceptors: InterceptorList\n\n constructor(options: BatchInterceptorOptions<InterceptorList>) {\n BatchInterceptor.symbol = Symbol(options.name)\n super(BatchInterceptor.symbol)\n this.interceptors = options.interceptors\n }\n\n protected setup() {\n const logger = this.logger.extend('setup')\n\n logger.info('applying all %d interceptors...', this.interceptors.length)\n\n for (const interceptor of this.interceptors) {\n logger.info('applying \"%s\" interceptor...', interceptor.constructor.name)\n interceptor.apply()\n\n logger.info('adding interceptor dispose subscription')\n this.subscriptions.push(() => interceptor.dispose())\n }\n }\n\n public on<EventName extends ExtractEventNames<Events>>(\n event: EventName,\n listener: Listener<Events[EventName]>\n ): this {\n // Instead of adding a listener to the batch interceptor,\n // propagate the listener to each of the individual interceptors.\n for (const interceptor of this.interceptors) {\n interceptor.on(event, listener)\n }\n\n return this\n }\n\n public once<EventName extends ExtractEventNames<Events>>(\n event: EventName,\n listener: Listener<Events[EventName]>\n ): this {\n for (const interceptor of this.interceptors) {\n interceptor.once(event, listener)\n }\n\n return this\n }\n\n public off<EventName extends ExtractEventNames<Events>>(\n event: EventName,\n listener: Listener<Events[EventName]>\n ): this {\n for (const interceptor of this.interceptors) {\n interceptor.off(event, listener)\n }\n\n return this\n }\n\n public removeAllListeners<EventName extends ExtractEventNames<Events>>(\n event?: EventName | undefined\n ): this {\n for (const interceptors of this.interceptors) {\n interceptors.removeAllListeners(event)\n }\n\n return this\n }\n}\n","/**\n * Removes query parameters and hashes from a given URL.\n */\nexport function getCleanUrl(url: URL, isAbsolute: boolean = true): string {\n return [isAbsolute && url.origin, url.pathname].filter(Boolean).join('')\n}\n"]}
|
||||
{"version":3,"sources":["../../src/BatchInterceptor.ts","../../src/utils/getCleanUrl.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAsBO,IAAM,mBAAN,cAGG,YAAoB;AAAA,EAK5B,YAAY,SAAmD;AAC7D,qBAAiB,SAAS,OAAO,QAAQ,IAAI;AAC7C,UAAM,iBAAiB,MAAM;AAC7B,SAAK,eAAe,QAAQ;AAAA,EAC9B;AAAA,EAEU,QAAQ;AAChB,UAAM,SAAS,KAAK,OAAO,OAAO,OAAO;AAEzC,WAAO,KAAK,mCAAmC,KAAK,aAAa,MAAM;AAEvE,eAAW,eAAe,KAAK,cAAc;AAC3C,aAAO,KAAK,gCAAgC,YAAY,YAAY,IAAI;AACxE,kBAAY,MAAM;AAElB,aAAO,KAAK,yCAAyC;AACrD,WAAK,cAAc,KAAK,MAAM,YAAY,QAAQ,CAAC;AAAA,IACrD;AAAA,EACF;AAAA,EAEO,GACL,OACA,UACM;AAGN,eAAW,eAAe,KAAK,cAAc;AAC3C,kBAAY,GAAG,OAAO,QAAQ;AAAA,IAChC;AAEA,WAAO;AAAA,EACT;AAAA,EAEO,KACL,OACA,UACM;AACN,eAAW,eAAe,KAAK,cAAc;AAC3C,kBAAY,KAAK,OAAO,QAAQ;AAAA,IAClC;AAEA,WAAO;AAAA,EACT;AAAA,EAEO,IACL,OACA,UACM;AACN,eAAW,eAAe,KAAK,cAAc;AAC3C,kBAAY,IAAI,OAAO,QAAQ;AAAA,IACjC;AAEA,WAAO;AAAA,EACT;AAAA,EAEO,mBACL,OACM;AACN,eAAW,gBAAgB,KAAK,cAAc;AAC5C,mBAAa,mBAAmB,KAAK;AAAA,IACvC;AAEA,WAAO;AAAA,EACT;AACF;;;AC3FO,SAAS,YAAY,KAAU,aAAsB,MAAc;AACxE,SAAO,CAAC,cAAc,IAAI,QAAQ,IAAI,QAAQ,EAAE,OAAO,OAAO,EAAE,KAAK,EAAE;AACzE","sourcesContent":["import { EventMap, Listener } from 'strict-event-emitter'\nimport { Interceptor, ExtractEventNames } from './Interceptor'\n\nexport interface BatchInterceptorOptions<\n InterceptorList extends ReadonlyArray<Interceptor<any>>\n> {\n name: string\n interceptors: InterceptorList\n}\n\nexport type ExtractEventMapType<\n InterceptorList extends ReadonlyArray<Interceptor<any>>\n> = InterceptorList extends ReadonlyArray<infer InterceptorType>\n ? InterceptorType extends Interceptor<infer EventMap>\n ? EventMap\n : never\n : never\n\n/**\n * A batch interceptor that exposes a single interface\n * to apply and operate with multiple interceptors at once.\n */\nexport class BatchInterceptor<\n InterceptorList extends ReadonlyArray<Interceptor<any>>,\n Events extends EventMap = ExtractEventMapType<InterceptorList>\n> extends Interceptor<Events> {\n static symbol: symbol\n\n private interceptors: InterceptorList\n\n constructor(options: BatchInterceptorOptions<InterceptorList>) {\n BatchInterceptor.symbol = Symbol(options.name)\n super(BatchInterceptor.symbol)\n this.interceptors = options.interceptors\n }\n\n protected setup() {\n const logger = this.logger.extend('setup')\n\n logger.info('applying all %d interceptors...', this.interceptors.length)\n\n for (const interceptor of this.interceptors) {\n logger.info('applying \"%s\" interceptor...', interceptor.constructor.name)\n interceptor.apply()\n\n logger.info('adding interceptor dispose subscription')\n this.subscriptions.push(() => interceptor.dispose())\n }\n }\n\n public on<EventName extends ExtractEventNames<Events>>(\n event: EventName,\n listener: Listener<Events[EventName]>\n ): this {\n // Instead of adding a listener to the batch interceptor,\n // propagate the listener to each of the individual interceptors.\n for (const interceptor of this.interceptors) {\n interceptor.on(event, listener)\n }\n\n return this\n }\n\n public once<EventName extends ExtractEventNames<Events>>(\n event: EventName,\n listener: Listener<Events[EventName]>\n ): this {\n for (const interceptor of this.interceptors) {\n interceptor.once(event, listener)\n }\n\n return this\n }\n\n public off<EventName extends ExtractEventNames<Events>>(\n event: EventName,\n listener: Listener<Events[EventName]>\n ): this {\n for (const interceptor of this.interceptors) {\n interceptor.off(event, listener)\n }\n\n return this\n }\n\n public removeAllListeners<EventName extends ExtractEventNames<Events>>(\n event?: EventName | undefined\n ): this {\n for (const interceptors of this.interceptors) {\n interceptors.removeAllListeners(event)\n }\n\n return this\n }\n}\n","/**\n * Removes query parameters and hashes from a given URL.\n */\nexport function getCleanUrl(url: URL, isAbsolute: boolean = true): string {\n return [isAbsolute && url.origin, url.pathname].filter(Boolean).join('')\n}\n"]}
|
||||
8
node_modules/@mswjs/interceptors/lib/browser/index.mjs
generated
vendored
8
node_modules/@mswjs/interceptors/lib/browser/index.mjs
generated
vendored
|
|
@ -4,8 +4,9 @@ import {
|
|||
} from "./chunk-6HYIRFX2.mjs";
|
||||
import {
|
||||
FetchResponse,
|
||||
IS_PATCHED_MODULE
|
||||
} from "./chunk-FK37CTPH.mjs";
|
||||
IS_PATCHED_MODULE,
|
||||
getRawRequest
|
||||
} from "./chunk-CNX33NZA.mjs";
|
||||
import {
|
||||
INTERNAL_REQUEST_ID_HEADER_NAME,
|
||||
Interceptor,
|
||||
|
|
@ -74,6 +75,7 @@ export {
|
|||
deleteGlobalSymbol,
|
||||
encodeBuffer,
|
||||
getCleanUrl,
|
||||
getGlobalSymbol
|
||||
getGlobalSymbol,
|
||||
getRawRequest
|
||||
};
|
||||
//# sourceMappingURL=index.mjs.map
|
||||
2
node_modules/@mswjs/interceptors/lib/browser/index.mjs.map
generated
vendored
2
node_modules/@mswjs/interceptors/lib/browser/index.mjs.map
generated
vendored
|
|
@ -1 +1 @@
|
|||
{"version":3,"sources":["../../src/BatchInterceptor.ts","../../src/utils/getCleanUrl.ts"],"sourcesContent":["import { EventMap, Listener } from 'strict-event-emitter'\nimport { Interceptor, ExtractEventNames } from './Interceptor'\n\nexport interface BatchInterceptorOptions<\n InterceptorList extends ReadonlyArray<Interceptor<any>>\n> {\n name: string\n interceptors: InterceptorList\n}\n\nexport type ExtractEventMapType<\n InterceptorList extends ReadonlyArray<Interceptor<any>>\n> = InterceptorList extends ReadonlyArray<infer InterceptorType>\n ? InterceptorType extends Interceptor<infer EventMap>\n ? EventMap\n : never\n : never\n\n/**\n * A batch interceptor that exposes a single interface\n * to apply and operate with multiple interceptors at once.\n */\nexport class BatchInterceptor<\n InterceptorList extends ReadonlyArray<Interceptor<any>>,\n Events extends EventMap = ExtractEventMapType<InterceptorList>\n> extends Interceptor<Events> {\n static symbol: symbol\n\n private interceptors: InterceptorList\n\n constructor(options: BatchInterceptorOptions<InterceptorList>) {\n BatchInterceptor.symbol = Symbol(options.name)\n super(BatchInterceptor.symbol)\n this.interceptors = options.interceptors\n }\n\n protected setup() {\n const logger = this.logger.extend('setup')\n\n logger.info('applying all %d interceptors...', this.interceptors.length)\n\n for (const interceptor of this.interceptors) {\n logger.info('applying \"%s\" interceptor...', interceptor.constructor.name)\n interceptor.apply()\n\n logger.info('adding interceptor dispose subscription')\n this.subscriptions.push(() => interceptor.dispose())\n }\n }\n\n public on<EventName extends ExtractEventNames<Events>>(\n event: EventName,\n listener: Listener<Events[EventName]>\n ): this {\n // Instead of adding a listener to the batch interceptor,\n // propagate the listener to each of the individual interceptors.\n for (const interceptor of this.interceptors) {\n interceptor.on(event, listener)\n }\n\n return this\n }\n\n public once<EventName extends ExtractEventNames<Events>>(\n event: EventName,\n listener: Listener<Events[EventName]>\n ): this {\n for (const interceptor of this.interceptors) {\n interceptor.once(event, listener)\n }\n\n return this\n }\n\n public off<EventName extends ExtractEventNames<Events>>(\n event: EventName,\n listener: Listener<Events[EventName]>\n ): this {\n for (const interceptor of this.interceptors) {\n interceptor.off(event, listener)\n }\n\n return this\n }\n\n public removeAllListeners<EventName extends ExtractEventNames<Events>>(\n event?: EventName | undefined\n ): this {\n for (const interceptors of this.interceptors) {\n interceptors.removeAllListeners(event)\n }\n\n return this\n }\n}\n","/**\n * Removes query parameters and hashes from a given URL.\n */\nexport function getCleanUrl(url: URL, isAbsolute: boolean = true): string {\n return [isAbsolute && url.origin, url.pathname].filter(Boolean).join('')\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAsBO,IAAM,mBAAN,cAGG,YAAoB;AAAA,EAK5B,YAAY,SAAmD;AAC7D,qBAAiB,SAAS,OAAO,QAAQ,IAAI;AAC7C,UAAM,iBAAiB,MAAM;AAC7B,SAAK,eAAe,QAAQ;AAAA,EAC9B;AAAA,EAEU,QAAQ;AAChB,UAAM,SAAS,KAAK,OAAO,OAAO,OAAO;AAEzC,WAAO,KAAK,mCAAmC,KAAK,aAAa,MAAM;AAEvE,eAAW,eAAe,KAAK,cAAc;AAC3C,aAAO,KAAK,gCAAgC,YAAY,YAAY,IAAI;AACxE,kBAAY,MAAM;AAElB,aAAO,KAAK,yCAAyC;AACrD,WAAK,cAAc,KAAK,MAAM,YAAY,QAAQ,CAAC;AAAA,IACrD;AAAA,EACF;AAAA,EAEO,GACL,OACA,UACM;AAGN,eAAW,eAAe,KAAK,cAAc;AAC3C,kBAAY,GAAG,OAAO,QAAQ;AAAA,IAChC;AAEA,WAAO;AAAA,EACT;AAAA,EAEO,KACL,OACA,UACM;AACN,eAAW,eAAe,KAAK,cAAc;AAC3C,kBAAY,KAAK,OAAO,QAAQ;AAAA,IAClC;AAEA,WAAO;AAAA,EACT;AAAA,EAEO,IACL,OACA,UACM;AACN,eAAW,eAAe,KAAK,cAAc;AAC3C,kBAAY,IAAI,OAAO,QAAQ;AAAA,IACjC;AAEA,WAAO;AAAA,EACT;AAAA,EAEO,mBACL,OACM;AACN,eAAW,gBAAgB,KAAK,cAAc;AAC5C,mBAAa,mBAAmB,KAAK;AAAA,IACvC;AAEA,WAAO;AAAA,EACT;AACF;;;AC3FO,SAAS,YAAY,KAAU,aAAsB,MAAc;AACxE,SAAO,CAAC,cAAc,IAAI,QAAQ,IAAI,QAAQ,EAAE,OAAO,OAAO,EAAE,KAAK,EAAE;AACzE;","names":[]}
|
||||
{"version":3,"sources":["../../src/BatchInterceptor.ts","../../src/utils/getCleanUrl.ts"],"sourcesContent":["import { EventMap, Listener } from 'strict-event-emitter'\nimport { Interceptor, ExtractEventNames } from './Interceptor'\n\nexport interface BatchInterceptorOptions<\n InterceptorList extends ReadonlyArray<Interceptor<any>>\n> {\n name: string\n interceptors: InterceptorList\n}\n\nexport type ExtractEventMapType<\n InterceptorList extends ReadonlyArray<Interceptor<any>>\n> = InterceptorList extends ReadonlyArray<infer InterceptorType>\n ? InterceptorType extends Interceptor<infer EventMap>\n ? EventMap\n : never\n : never\n\n/**\n * A batch interceptor that exposes a single interface\n * to apply and operate with multiple interceptors at once.\n */\nexport class BatchInterceptor<\n InterceptorList extends ReadonlyArray<Interceptor<any>>,\n Events extends EventMap = ExtractEventMapType<InterceptorList>\n> extends Interceptor<Events> {\n static symbol: symbol\n\n private interceptors: InterceptorList\n\n constructor(options: BatchInterceptorOptions<InterceptorList>) {\n BatchInterceptor.symbol = Symbol(options.name)\n super(BatchInterceptor.symbol)\n this.interceptors = options.interceptors\n }\n\n protected setup() {\n const logger = this.logger.extend('setup')\n\n logger.info('applying all %d interceptors...', this.interceptors.length)\n\n for (const interceptor of this.interceptors) {\n logger.info('applying \"%s\" interceptor...', interceptor.constructor.name)\n interceptor.apply()\n\n logger.info('adding interceptor dispose subscription')\n this.subscriptions.push(() => interceptor.dispose())\n }\n }\n\n public on<EventName extends ExtractEventNames<Events>>(\n event: EventName,\n listener: Listener<Events[EventName]>\n ): this {\n // Instead of adding a listener to the batch interceptor,\n // propagate the listener to each of the individual interceptors.\n for (const interceptor of this.interceptors) {\n interceptor.on(event, listener)\n }\n\n return this\n }\n\n public once<EventName extends ExtractEventNames<Events>>(\n event: EventName,\n listener: Listener<Events[EventName]>\n ): this {\n for (const interceptor of this.interceptors) {\n interceptor.once(event, listener)\n }\n\n return this\n }\n\n public off<EventName extends ExtractEventNames<Events>>(\n event: EventName,\n listener: Listener<Events[EventName]>\n ): this {\n for (const interceptor of this.interceptors) {\n interceptor.off(event, listener)\n }\n\n return this\n }\n\n public removeAllListeners<EventName extends ExtractEventNames<Events>>(\n event?: EventName | undefined\n ): this {\n for (const interceptors of this.interceptors) {\n interceptors.removeAllListeners(event)\n }\n\n return this\n }\n}\n","/**\n * Removes query parameters and hashes from a given URL.\n */\nexport function getCleanUrl(url: URL, isAbsolute: boolean = true): string {\n return [isAbsolute && url.origin, url.pathname].filter(Boolean).join('')\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAsBO,IAAM,mBAAN,cAGG,YAAoB;AAAA,EAK5B,YAAY,SAAmD;AAC7D,qBAAiB,SAAS,OAAO,QAAQ,IAAI;AAC7C,UAAM,iBAAiB,MAAM;AAC7B,SAAK,eAAe,QAAQ;AAAA,EAC9B;AAAA,EAEU,QAAQ;AAChB,UAAM,SAAS,KAAK,OAAO,OAAO,OAAO;AAEzC,WAAO,KAAK,mCAAmC,KAAK,aAAa,MAAM;AAEvE,eAAW,eAAe,KAAK,cAAc;AAC3C,aAAO,KAAK,gCAAgC,YAAY,YAAY,IAAI;AACxE,kBAAY,MAAM;AAElB,aAAO,KAAK,yCAAyC;AACrD,WAAK,cAAc,KAAK,MAAM,YAAY,QAAQ,CAAC;AAAA,IACrD;AAAA,EACF;AAAA,EAEO,GACL,OACA,UACM;AAGN,eAAW,eAAe,KAAK,cAAc;AAC3C,kBAAY,GAAG,OAAO,QAAQ;AAAA,IAChC;AAEA,WAAO;AAAA,EACT;AAAA,EAEO,KACL,OACA,UACM;AACN,eAAW,eAAe,KAAK,cAAc;AAC3C,kBAAY,KAAK,OAAO,QAAQ;AAAA,IAClC;AAEA,WAAO;AAAA,EACT;AAAA,EAEO,IACL,OACA,UACM;AACN,eAAW,eAAe,KAAK,cAAc;AAC3C,kBAAY,IAAI,OAAO,QAAQ;AAAA,IACjC;AAEA,WAAO;AAAA,EACT;AAAA,EAEO,mBACL,OACM;AACN,eAAW,gBAAgB,KAAK,cAAc;AAC5C,mBAAa,mBAAmB,KAAK;AAAA,IACvC;AAEA,WAAO;AAAA,EACT;AACF;;;AC3FO,SAAS,YAAY,KAAU,aAAsB,MAAc;AACxE,SAAO,CAAC,cAAc,IAAI,QAAQ,IAAI,QAAQ,EAAE,OAAO,OAAO,EAAE,KAAK,EAAE;AACzE;","names":[]}
|
||||
2
node_modules/@mswjs/interceptors/lib/browser/interceptors/XMLHttpRequest/index.d.ts
generated
vendored
2
node_modules/@mswjs/interceptors/lib/browser/interceptors/XMLHttpRequest/index.d.ts
generated
vendored
|
|
@ -1,5 +1,5 @@
|
|||
import { Emitter } from 'strict-event-emitter';
|
||||
import { H as HttpRequestEventMap } from '../../glossary-6564c252.js';
|
||||
import { H as HttpRequestEventMap } from '../../glossary-7152281e.js';
|
||||
import { I as Interceptor } from '../../Interceptor-af98b768.js';
|
||||
import '@open-draft/deferred-promise';
|
||||
import '@open-draft/logger';
|
||||
|
|
|
|||
8
node_modules/@mswjs/interceptors/lib/browser/interceptors/XMLHttpRequest/index.js
generated
vendored
8
node_modules/@mswjs/interceptors/lib/browser/interceptors/XMLHttpRequest/index.js
generated
vendored
|
|
@ -1,12 +1,12 @@
|
|||
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
||||
|
||||
var _chunkJ2HDR5D7js = require('../../chunk-J2HDR5D7.js');
|
||||
var _chunkO2RCNIMRjs = require('../../chunk-O2RCNIMR.js');
|
||||
require('../../chunk-LK6DILFK.js');
|
||||
require('../../chunk-FGSEOIC4.js');
|
||||
require('../../chunk-F7RG3QQH.js');
|
||||
require('../../chunk-GTJ35JP4.js');
|
||||
require('../../chunk-MSUVVHIG.js');
|
||||
require('../../chunk-PFGO5BSM.js');
|
||||
require('../../chunk-TIPR373R.js');
|
||||
|
||||
|
||||
exports.XMLHttpRequestInterceptor = _chunkJ2HDR5D7js.XMLHttpRequestInterceptor;
|
||||
exports.XMLHttpRequestInterceptor = _chunkO2RCNIMRjs.XMLHttpRequestInterceptor;
|
||||
//# sourceMappingURL=index.js.map
|
||||
6
node_modules/@mswjs/interceptors/lib/browser/interceptors/XMLHttpRequest/index.mjs
generated
vendored
6
node_modules/@mswjs/interceptors/lib/browser/interceptors/XMLHttpRequest/index.mjs
generated
vendored
|
|
@ -1,9 +1,9 @@
|
|||
import {
|
||||
XMLHttpRequestInterceptor
|
||||
} from "../../chunk-E2WFHJX6.mjs";
|
||||
} from "../../chunk-7RPAMWJ6.mjs";
|
||||
import "../../chunk-6HYIRFX2.mjs";
|
||||
import "../../chunk-H5O73WD2.mjs";
|
||||
import "../../chunk-FK37CTPH.mjs";
|
||||
import "../../chunk-L37TY7LC.mjs";
|
||||
import "../../chunk-CNX33NZA.mjs";
|
||||
import "../../chunk-TX5GBTFY.mjs";
|
||||
import "../../chunk-QED3Q6Z2.mjs";
|
||||
export {
|
||||
|
|
|
|||
2
node_modules/@mswjs/interceptors/lib/browser/interceptors/fetch/index.d.ts
generated
vendored
2
node_modules/@mswjs/interceptors/lib/browser/interceptors/fetch/index.d.ts
generated
vendored
|
|
@ -1,4 +1,4 @@
|
|||
import { H as HttpRequestEventMap } from '../../glossary-6564c252.js';
|
||||
import { H as HttpRequestEventMap } from '../../glossary-7152281e.js';
|
||||
import { I as Interceptor } from '../../Interceptor-af98b768.js';
|
||||
import '@open-draft/deferred-promise';
|
||||
import '@open-draft/logger';
|
||||
|
|
|
|||
8
node_modules/@mswjs/interceptors/lib/browser/interceptors/fetch/index.js
generated
vendored
8
node_modules/@mswjs/interceptors/lib/browser/interceptors/fetch/index.js
generated
vendored
|
|
@ -1,11 +1,11 @@
|
|||
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
||||
|
||||
var _chunkH4LFCCBAjs = require('../../chunk-H4LFCCBA.js');
|
||||
require('../../chunk-FGSEOIC4.js');
|
||||
require('../../chunk-F7RG3QQH.js');
|
||||
var _chunkUY4VLZVBjs = require('../../chunk-UY4VLZVB.js');
|
||||
require('../../chunk-GTJ35JP4.js');
|
||||
require('../../chunk-MSUVVHIG.js');
|
||||
require('../../chunk-PFGO5BSM.js');
|
||||
require('../../chunk-TIPR373R.js');
|
||||
|
||||
|
||||
exports.FetchInterceptor = _chunkH4LFCCBAjs.FetchInterceptor;
|
||||
exports.FetchInterceptor = _chunkUY4VLZVBjs.FetchInterceptor;
|
||||
//# sourceMappingURL=index.js.map
|
||||
6
node_modules/@mswjs/interceptors/lib/browser/interceptors/fetch/index.mjs
generated
vendored
6
node_modules/@mswjs/interceptors/lib/browser/interceptors/fetch/index.mjs
generated
vendored
|
|
@ -1,8 +1,8 @@
|
|||
import {
|
||||
FetchInterceptor
|
||||
} from "../../chunk-3NVFHQ5L.mjs";
|
||||
import "../../chunk-H5O73WD2.mjs";
|
||||
import "../../chunk-FK37CTPH.mjs";
|
||||
} from "../../chunk-SKG3GP7X.mjs";
|
||||
import "../../chunk-L37TY7LC.mjs";
|
||||
import "../../chunk-CNX33NZA.mjs";
|
||||
import "../../chunk-TX5GBTFY.mjs";
|
||||
import "../../chunk-QED3Q6Z2.mjs";
|
||||
export {
|
||||
|
|
|
|||
2
node_modules/@mswjs/interceptors/lib/browser/presets/browser.d.ts
generated
vendored
2
node_modules/@mswjs/interceptors/lib/browser/presets/browser.d.ts
generated
vendored
|
|
@ -1,6 +1,6 @@
|
|||
import { FetchInterceptor } from '../interceptors/fetch/index.js';
|
||||
import { XMLHttpRequestInterceptor } from '../interceptors/XMLHttpRequest/index.js';
|
||||
import '../glossary-6564c252.js';
|
||||
import '../glossary-7152281e.js';
|
||||
import '@open-draft/deferred-promise';
|
||||
import '../Interceptor-af98b768.js';
|
||||
import '@open-draft/logger';
|
||||
|
|
|
|||
12
node_modules/@mswjs/interceptors/lib/browser/presets/browser.js
generated
vendored
12
node_modules/@mswjs/interceptors/lib/browser/presets/browser.js
generated
vendored
|
|
@ -1,19 +1,19 @@
|
|||
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
||||
|
||||
var _chunkJ2HDR5D7js = require('../chunk-J2HDR5D7.js');
|
||||
var _chunkO2RCNIMRjs = require('../chunk-O2RCNIMR.js');
|
||||
require('../chunk-LK6DILFK.js');
|
||||
|
||||
|
||||
var _chunkH4LFCCBAjs = require('../chunk-H4LFCCBA.js');
|
||||
require('../chunk-FGSEOIC4.js');
|
||||
require('../chunk-F7RG3QQH.js');
|
||||
var _chunkUY4VLZVBjs = require('../chunk-UY4VLZVB.js');
|
||||
require('../chunk-GTJ35JP4.js');
|
||||
require('../chunk-MSUVVHIG.js');
|
||||
require('../chunk-PFGO5BSM.js');
|
||||
require('../chunk-TIPR373R.js');
|
||||
|
||||
// src/presets/browser.ts
|
||||
var browser_default = [
|
||||
new (0, _chunkH4LFCCBAjs.FetchInterceptor)(),
|
||||
new (0, _chunkJ2HDR5D7js.XMLHttpRequestInterceptor)()
|
||||
new (0, _chunkUY4VLZVBjs.FetchInterceptor)(),
|
||||
new (0, _chunkO2RCNIMRjs.XMLHttpRequestInterceptor)()
|
||||
];
|
||||
|
||||
|
||||
|
|
|
|||
8
node_modules/@mswjs/interceptors/lib/browser/presets/browser.mjs
generated
vendored
8
node_modules/@mswjs/interceptors/lib/browser/presets/browser.mjs
generated
vendored
|
|
@ -1,12 +1,12 @@
|
|||
import {
|
||||
XMLHttpRequestInterceptor
|
||||
} from "../chunk-E2WFHJX6.mjs";
|
||||
} from "../chunk-7RPAMWJ6.mjs";
|
||||
import "../chunk-6HYIRFX2.mjs";
|
||||
import {
|
||||
FetchInterceptor
|
||||
} from "../chunk-3NVFHQ5L.mjs";
|
||||
import "../chunk-H5O73WD2.mjs";
|
||||
import "../chunk-FK37CTPH.mjs";
|
||||
} from "../chunk-SKG3GP7X.mjs";
|
||||
import "../chunk-L37TY7LC.mjs";
|
||||
import "../chunk-CNX33NZA.mjs";
|
||||
import "../chunk-TX5GBTFY.mjs";
|
||||
import "../chunk-QED3Q6Z2.mjs";
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue