@depup/msw 2.12.13-depup.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +21 -0
- package/README.md +40 -0
- package/browser/package.json +31 -0
- package/changes.json +46 -0
- package/cli/index.js +35 -0
- package/cli/init.js +226 -0
- package/cli/invariant.js +9 -0
- package/cli/package.json +3 -0
- package/config/constants.js +13 -0
- package/config/package.json +3 -0
- package/config/scripts/postinstall.js +36 -0
- package/lib/browser/index.d.mts +102 -0
- package/lib/browser/index.d.ts +102 -0
- package/lib/browser/index.js +2911 -0
- package/lib/browser/index.js.map +1 -0
- package/lib/browser/index.mjs +2888 -0
- package/lib/browser/index.mjs.map +1 -0
- package/lib/core/HttpResponse-Be4eT3x6.d.mts +338 -0
- package/lib/core/HttpResponse-Dj6ibgFJ.d.ts +338 -0
- package/lib/core/HttpResponse.d.mts +6 -0
- package/lib/core/HttpResponse.d.ts +6 -0
- package/lib/core/HttpResponse.js +176 -0
- package/lib/core/HttpResponse.js.map +1 -0
- package/lib/core/HttpResponse.mjs +159 -0
- package/lib/core/HttpResponse.mjs.map +1 -0
- package/lib/core/SetupApi.d.mts +44 -0
- package/lib/core/SetupApi.d.ts +44 -0
- package/lib/core/SetupApi.js +112 -0
- package/lib/core/SetupApi.js.map +1 -0
- package/lib/core/SetupApi.mjs +92 -0
- package/lib/core/SetupApi.mjs.map +1 -0
- package/lib/core/bypass.d.mts +16 -0
- package/lib/core/bypass.d.ts +16 -0
- package/lib/core/bypass.js +42 -0
- package/lib/core/bypass.js.map +1 -0
- package/lib/core/bypass.mjs +22 -0
- package/lib/core/bypass.mjs.map +1 -0
- package/lib/core/delay.d.mts +18 -0
- package/lib/core/delay.d.ts +18 -0
- package/lib/core/delay.js +77 -0
- package/lib/core/delay.js.map +1 -0
- package/lib/core/delay.mjs +57 -0
- package/lib/core/delay.mjs.map +1 -0
- package/lib/core/getResponse.d.mts +18 -0
- package/lib/core/getResponse.d.ts +18 -0
- package/lib/core/getResponse.js +35 -0
- package/lib/core/getResponse.js.map +1 -0
- package/lib/core/getResponse.mjs +17 -0
- package/lib/core/getResponse.mjs.map +1 -0
- package/lib/core/graphql.d.mts +76 -0
- package/lib/core/graphql.d.ts +76 -0
- package/lib/core/graphql.js +90 -0
- package/lib/core/graphql.js.map +1 -0
- package/lib/core/graphql.mjs +72 -0
- package/lib/core/graphql.mjs.map +1 -0
- package/lib/core/handlers/GraphQLHandler.d.mts +6 -0
- package/lib/core/handlers/GraphQLHandler.d.ts +6 -0
- package/lib/core/handlers/GraphQLHandler.js +231 -0
- package/lib/core/handlers/GraphQLHandler.js.map +1 -0
- package/lib/core/handlers/GraphQLHandler.mjs +218 -0
- package/lib/core/handlers/GraphQLHandler.mjs.map +1 -0
- package/lib/core/handlers/HttpHandler.d.mts +75 -0
- package/lib/core/handlers/HttpHandler.d.ts +75 -0
- package/lib/core/handlers/HttpHandler.js +128 -0
- package/lib/core/handlers/HttpHandler.js.map +1 -0
- package/lib/core/handlers/HttpHandler.mjs +112 -0
- package/lib/core/handlers/HttpHandler.mjs.map +1 -0
- package/lib/core/handlers/RequestHandler.d.mts +6 -0
- package/lib/core/handlers/RequestHandler.d.ts +6 -0
- package/lib/core/handlers/RequestHandler.js +173 -0
- package/lib/core/handlers/RequestHandler.js.map +1 -0
- package/lib/core/handlers/RequestHandler.mjs +155 -0
- package/lib/core/handlers/RequestHandler.mjs.map +1 -0
- package/lib/core/handlers/WebSocketHandler.d.mts +42 -0
- package/lib/core/handlers/WebSocketHandler.d.ts +42 -0
- package/lib/core/handlers/WebSocketHandler.js +147 -0
- package/lib/core/handlers/WebSocketHandler.js.map +1 -0
- package/lib/core/handlers/WebSocketHandler.mjs +129 -0
- package/lib/core/handlers/WebSocketHandler.mjs.map +1 -0
- package/lib/core/handlers/common.d.mts +3 -0
- package/lib/core/handlers/common.d.ts +3 -0
- package/lib/core/handlers/common.js +17 -0
- package/lib/core/handlers/common.js.map +1 -0
- package/lib/core/handlers/common.mjs +1 -0
- package/lib/core/handlers/common.mjs.map +1 -0
- package/lib/core/http.d.mts +31 -0
- package/lib/core/http.d.ts +31 -0
- package/lib/core/http.js +40 -0
- package/lib/core/http.js.map +1 -0
- package/lib/core/http.mjs +23 -0
- package/lib/core/http.mjs.map +1 -0
- package/lib/core/index.d.mts +32 -0
- package/lib/core/index.d.ts +32 -0
- package/lib/core/index.js +64 -0
- package/lib/core/index.js.map +1 -0
- package/lib/core/index.mjs +52 -0
- package/lib/core/index.mjs.map +1 -0
- package/lib/core/isCommonAssetRequest.d.mts +20 -0
- package/lib/core/isCommonAssetRequest.d.ts +20 -0
- package/lib/core/isCommonAssetRequest.js +42 -0
- package/lib/core/isCommonAssetRequest.js.map +1 -0
- package/lib/core/isCommonAssetRequest.mjs +22 -0
- package/lib/core/isCommonAssetRequest.mjs.map +1 -0
- package/lib/core/passthrough.d.mts +24 -0
- package/lib/core/passthrough.d.ts +24 -0
- package/lib/core/passthrough.js +33 -0
- package/lib/core/passthrough.js.map +1 -0
- package/lib/core/passthrough.mjs +13 -0
- package/lib/core/passthrough.mjs.map +1 -0
- package/lib/core/sharedOptions.d.mts +64 -0
- package/lib/core/sharedOptions.d.ts +64 -0
- package/lib/core/sharedOptions.js +17 -0
- package/lib/core/sharedOptions.js.map +1 -0
- package/lib/core/sharedOptions.mjs +1 -0
- package/lib/core/sharedOptions.mjs.map +1 -0
- package/lib/core/sse.d.mts +116 -0
- package/lib/core/sse.d.ts +116 -0
- package/lib/core/sse.js +607 -0
- package/lib/core/sse.js.map +1 -0
- package/lib/core/sse.mjs +589 -0
- package/lib/core/sse.mjs.map +1 -0
- package/lib/core/typeUtils.d.mts +12 -0
- package/lib/core/typeUtils.d.ts +12 -0
- package/lib/core/typeUtils.js +17 -0
- package/lib/core/typeUtils.js.map +1 -0
- package/lib/core/typeUtils.mjs +1 -0
- package/lib/core/typeUtils.mjs.map +1 -0
- package/lib/core/utils/HttpResponse/decorators.d.mts +17 -0
- package/lib/core/utils/HttpResponse/decorators.d.ts +17 -0
- package/lib/core/utils/HttpResponse/decorators.js +77 -0
- package/lib/core/utils/HttpResponse/decorators.js.map +1 -0
- package/lib/core/utils/HttpResponse/decorators.mjs +47 -0
- package/lib/core/utils/HttpResponse/decorators.mjs.map +1 -0
- package/lib/core/utils/cookieStore.d.mts +13 -0
- package/lib/core/utils/cookieStore.d.ts +13 -0
- package/lib/core/utils/cookieStore.js +90 -0
- package/lib/core/utils/cookieStore.js.map +1 -0
- package/lib/core/utils/cookieStore.mjs +74 -0
- package/lib/core/utils/cookieStore.mjs.map +1 -0
- package/lib/core/utils/executeHandlers.d.mts +6 -0
- package/lib/core/utils/executeHandlers.d.ts +6 -0
- package/lib/core/utils/executeHandlers.js +50 -0
- package/lib/core/utils/executeHandlers.js.map +1 -0
- package/lib/core/utils/executeHandlers.mjs +30 -0
- package/lib/core/utils/executeHandlers.mjs.map +1 -0
- package/lib/core/utils/handleRequest.d.mts +29 -0
- package/lib/core/utils/handleRequest.d.ts +29 -0
- package/lib/core/utils/handleRequest.js +76 -0
- package/lib/core/utils/handleRequest.js.map +1 -0
- package/lib/core/utils/handleRequest.mjs +58 -0
- package/lib/core/utils/handleRequest.mjs.map +1 -0
- package/lib/core/utils/internal/Disposable.d.mts +7 -0
- package/lib/core/utils/internal/Disposable.d.ts +7 -0
- package/lib/core/utils/internal/Disposable.js +33 -0
- package/lib/core/utils/internal/Disposable.js.map +1 -0
- package/lib/core/utils/internal/Disposable.mjs +13 -0
- package/lib/core/utils/internal/Disposable.mjs.map +1 -0
- package/lib/core/utils/internal/checkGlobals.d.mts +3 -0
- package/lib/core/utils/internal/checkGlobals.d.ts +3 -0
- package/lib/core/utils/internal/checkGlobals.js +34 -0
- package/lib/core/utils/internal/checkGlobals.js.map +1 -0
- package/lib/core/utils/internal/checkGlobals.mjs +14 -0
- package/lib/core/utils/internal/checkGlobals.mjs.map +1 -0
- package/lib/core/utils/internal/devUtils.d.mts +28 -0
- package/lib/core/utils/internal/devUtils.d.ts +28 -0
- package/lib/core/utils/internal/devUtils.js +48 -0
- package/lib/core/utils/internal/devUtils.js.map +1 -0
- package/lib/core/utils/internal/devUtils.mjs +28 -0
- package/lib/core/utils/internal/devUtils.mjs.map +1 -0
- package/lib/core/utils/internal/getCallFrame.d.mts +6 -0
- package/lib/core/utils/internal/getCallFrame.d.ts +6 -0
- package/lib/core/utils/internal/getCallFrame.js +41 -0
- package/lib/core/utils/internal/getCallFrame.js.map +1 -0
- package/lib/core/utils/internal/getCallFrame.mjs +21 -0
- package/lib/core/utils/internal/getCallFrame.mjs.map +1 -0
- package/lib/core/utils/internal/hasRefCounted.d.mts +3 -0
- package/lib/core/utils/internal/hasRefCounted.d.ts +3 -0
- package/lib/core/utils/internal/hasRefCounted.js +27 -0
- package/lib/core/utils/internal/hasRefCounted.js.map +1 -0
- package/lib/core/utils/internal/hasRefCounted.mjs +7 -0
- package/lib/core/utils/internal/hasRefCounted.mjs.map +1 -0
- package/lib/core/utils/internal/isHandlerKind.d.mts +19 -0
- package/lib/core/utils/internal/isHandlerKind.d.ts +19 -0
- package/lib/core/utils/internal/isHandlerKind.js +29 -0
- package/lib/core/utils/internal/isHandlerKind.js.map +1 -0
- package/lib/core/utils/internal/isHandlerKind.mjs +9 -0
- package/lib/core/utils/internal/isHandlerKind.mjs.map +1 -0
- package/lib/core/utils/internal/isIterable.d.mts +20 -0
- package/lib/core/utils/internal/isIterable.d.ts +20 -0
- package/lib/core/utils/internal/isIterable.js +30 -0
- package/lib/core/utils/internal/isIterable.js.map +1 -0
- package/lib/core/utils/internal/isIterable.mjs +10 -0
- package/lib/core/utils/internal/isIterable.mjs.map +1 -0
- package/lib/core/utils/internal/isObject.d.mts +6 -0
- package/lib/core/utils/internal/isObject.d.ts +6 -0
- package/lib/core/utils/internal/isObject.js +27 -0
- package/lib/core/utils/internal/isObject.js.map +1 -0
- package/lib/core/utils/internal/isObject.mjs +7 -0
- package/lib/core/utils/internal/isObject.mjs.map +1 -0
- package/lib/core/utils/internal/isStringEqual.d.mts +6 -0
- package/lib/core/utils/internal/isStringEqual.d.ts +6 -0
- package/lib/core/utils/internal/isStringEqual.js +27 -0
- package/lib/core/utils/internal/isStringEqual.js.map +1 -0
- package/lib/core/utils/internal/isStringEqual.mjs +7 -0
- package/lib/core/utils/internal/isStringEqual.mjs.map +1 -0
- package/lib/core/utils/internal/jsonParse.d.mts +7 -0
- package/lib/core/utils/internal/jsonParse.d.ts +7 -0
- package/lib/core/utils/internal/jsonParse.js +31 -0
- package/lib/core/utils/internal/jsonParse.js.map +1 -0
- package/lib/core/utils/internal/jsonParse.mjs +11 -0
- package/lib/core/utils/internal/jsonParse.mjs.map +1 -0
- package/lib/core/utils/internal/mergeRight.d.mts +7 -0
- package/lib/core/utils/internal/mergeRight.d.ts +7 -0
- package/lib/core/utils/internal/mergeRight.js +43 -0
- package/lib/core/utils/internal/mergeRight.js.map +1 -0
- package/lib/core/utils/internal/mergeRight.mjs +23 -0
- package/lib/core/utils/internal/mergeRight.mjs.map +1 -0
- package/lib/core/utils/internal/parseGraphQLRequest.d.mts +6 -0
- package/lib/core/utils/internal/parseGraphQLRequest.d.ts +6 -0
- package/lib/core/utils/internal/parseGraphQLRequest.js +146 -0
- package/lib/core/utils/internal/parseGraphQLRequest.js.map +1 -0
- package/lib/core/utils/internal/parseGraphQLRequest.mjs +129 -0
- package/lib/core/utils/internal/parseGraphQLRequest.mjs.map +1 -0
- package/lib/core/utils/internal/parseMultipartData.d.mts +14 -0
- package/lib/core/utils/internal/parseMultipartData.d.ts +14 -0
- package/lib/core/utils/internal/parseMultipartData.js +83 -0
- package/lib/core/utils/internal/parseMultipartData.js.map +1 -0
- package/lib/core/utils/internal/parseMultipartData.mjs +63 -0
- package/lib/core/utils/internal/parseMultipartData.mjs.map +1 -0
- package/lib/core/utils/internal/pipeEvents.d.mts +8 -0
- package/lib/core/utils/internal/pipeEvents.d.ts +8 -0
- package/lib/core/utils/internal/pipeEvents.js +36 -0
- package/lib/core/utils/internal/pipeEvents.js.map +1 -0
- package/lib/core/utils/internal/pipeEvents.mjs +16 -0
- package/lib/core/utils/internal/pipeEvents.mjs.map +1 -0
- package/lib/core/utils/internal/requestHandlerUtils.d.mts +12 -0
- package/lib/core/utils/internal/requestHandlerUtils.d.ts +12 -0
- package/lib/core/utils/internal/requestHandlerUtils.js +37 -0
- package/lib/core/utils/internal/requestHandlerUtils.js.map +1 -0
- package/lib/core/utils/internal/requestHandlerUtils.mjs +17 -0
- package/lib/core/utils/internal/requestHandlerUtils.mjs.map +1 -0
- package/lib/core/utils/internal/toReadonlyArray.d.mts +6 -0
- package/lib/core/utils/internal/toReadonlyArray.d.ts +6 -0
- package/lib/core/utils/internal/toReadonlyArray.js +29 -0
- package/lib/core/utils/internal/toReadonlyArray.js.map +1 -0
- package/lib/core/utils/internal/toReadonlyArray.mjs +9 -0
- package/lib/core/utils/internal/toReadonlyArray.mjs.map +1 -0
- package/lib/core/utils/internal/tryCatch.d.mts +3 -0
- package/lib/core/utils/internal/tryCatch.d.ts +3 -0
- package/lib/core/utils/internal/tryCatch.js +32 -0
- package/lib/core/utils/internal/tryCatch.js.map +1 -0
- package/lib/core/utils/internal/tryCatch.mjs +12 -0
- package/lib/core/utils/internal/tryCatch.mjs.map +1 -0
- package/lib/core/utils/logging/getStatusCodeColor.d.mts +11 -0
- package/lib/core/utils/logging/getStatusCodeColor.d.ts +11 -0
- package/lib/core/utils/logging/getStatusCodeColor.js +40 -0
- package/lib/core/utils/logging/getStatusCodeColor.js.map +1 -0
- package/lib/core/utils/logging/getStatusCodeColor.mjs +20 -0
- package/lib/core/utils/logging/getStatusCodeColor.mjs.map +1 -0
- package/lib/core/utils/logging/getTimestamp.d.mts +9 -0
- package/lib/core/utils/logging/getTimestamp.d.ts +9 -0
- package/lib/core/utils/logging/getTimestamp.js +32 -0
- package/lib/core/utils/logging/getTimestamp.js.map +1 -0
- package/lib/core/utils/logging/getTimestamp.mjs +12 -0
- package/lib/core/utils/logging/getTimestamp.mjs.map +1 -0
- package/lib/core/utils/logging/serializeRequest.d.mts +12 -0
- package/lib/core/utils/logging/serializeRequest.d.ts +12 -0
- package/lib/core/utils/logging/serializeRequest.js +34 -0
- package/lib/core/utils/logging/serializeRequest.js.map +1 -0
- package/lib/core/utils/logging/serializeRequest.mjs +14 -0
- package/lib/core/utils/logging/serializeRequest.mjs.map +1 -0
- package/lib/core/utils/logging/serializeResponse.d.mts +9 -0
- package/lib/core/utils/logging/serializeResponse.d.ts +9 -0
- package/lib/core/utils/logging/serializeResponse.js +48 -0
- package/lib/core/utils/logging/serializeResponse.js.map +1 -0
- package/lib/core/utils/logging/serializeResponse.mjs +18 -0
- package/lib/core/utils/logging/serializeResponse.mjs.map +1 -0
- package/lib/core/utils/matching/matchRequestUrl.d.mts +20 -0
- package/lib/core/utils/matching/matchRequestUrl.d.ts +20 -0
- package/lib/core/utils/matching/matchRequestUrl.js +55 -0
- package/lib/core/utils/matching/matchRequestUrl.js.map +1 -0
- package/lib/core/utils/matching/matchRequestUrl.mjs +35 -0
- package/lib/core/utils/matching/matchRequestUrl.mjs.map +1 -0
- package/lib/core/utils/matching/normalizePath.d.mts +13 -0
- package/lib/core/utils/matching/normalizePath.d.ts +13 -0
- package/lib/core/utils/matching/normalizePath.js +33 -0
- package/lib/core/utils/matching/normalizePath.js.map +1 -0
- package/lib/core/utils/matching/normalizePath.mjs +13 -0
- package/lib/core/utils/matching/normalizePath.mjs.map +1 -0
- package/lib/core/utils/request/getAllAcceptedMimeTypes.d.mts +14 -0
- package/lib/core/utils/request/getAllAcceptedMimeTypes.d.ts +14 -0
- package/lib/core/utils/request/getAllAcceptedMimeTypes.js +61 -0
- package/lib/core/utils/request/getAllAcceptedMimeTypes.js.map +1 -0
- package/lib/core/utils/request/getAllAcceptedMimeTypes.mjs +41 -0
- package/lib/core/utils/request/getAllAcceptedMimeTypes.mjs.map +1 -0
- package/lib/core/utils/request/getRequestCookies.d.mts +3 -0
- package/lib/core/utils/request/getRequestCookies.d.ts +3 -0
- package/lib/core/utils/request/getRequestCookies.js +79 -0
- package/lib/core/utils/request/getRequestCookies.js.map +1 -0
- package/lib/core/utils/request/getRequestCookies.mjs +62 -0
- package/lib/core/utils/request/getRequestCookies.mjs.map +1 -0
- package/lib/core/utils/request/onUnhandledRequest.d.mts +9 -0
- package/lib/core/utils/request/onUnhandledRequest.d.ts +9 -0
- package/lib/core/utils/request/onUnhandledRequest.js +76 -0
- package/lib/core/utils/request/onUnhandledRequest.js.map +1 -0
- package/lib/core/utils/request/onUnhandledRequest.mjs +56 -0
- package/lib/core/utils/request/onUnhandledRequest.mjs.map +1 -0
- package/lib/core/utils/request/storeResponseCookies.d.mts +3 -0
- package/lib/core/utils/request/storeResponseCookies.d.ts +3 -0
- package/lib/core/utils/request/storeResponseCookies.js +32 -0
- package/lib/core/utils/request/storeResponseCookies.js.map +1 -0
- package/lib/core/utils/request/storeResponseCookies.mjs +12 -0
- package/lib/core/utils/request/storeResponseCookies.mjs.map +1 -0
- package/lib/core/utils/request/toPublicUrl.d.mts +7 -0
- package/lib/core/utils/request/toPublicUrl.d.ts +7 -0
- package/lib/core/utils/request/toPublicUrl.js +31 -0
- package/lib/core/utils/request/toPublicUrl.js.map +1 -0
- package/lib/core/utils/request/toPublicUrl.mjs +11 -0
- package/lib/core/utils/request/toPublicUrl.mjs.map +1 -0
- package/lib/core/utils/toResponseInit.d.mts +3 -0
- package/lib/core/utils/toResponseInit.d.ts +3 -0
- package/lib/core/utils/toResponseInit.js +31 -0
- package/lib/core/utils/toResponseInit.js.map +1 -0
- package/lib/core/utils/toResponseInit.mjs +11 -0
- package/lib/core/utils/toResponseInit.mjs.map +1 -0
- package/lib/core/utils/url/cleanUrl.d.mts +7 -0
- package/lib/core/utils/url/cleanUrl.d.ts +7 -0
- package/lib/core/utils/url/cleanUrl.js +31 -0
- package/lib/core/utils/url/cleanUrl.js.map +1 -0
- package/lib/core/utils/url/cleanUrl.mjs +11 -0
- package/lib/core/utils/url/cleanUrl.mjs.map +1 -0
- package/lib/core/utils/url/getAbsoluteUrl.d.mts +6 -0
- package/lib/core/utils/url/getAbsoluteUrl.d.ts +6 -0
- package/lib/core/utils/url/getAbsoluteUrl.js +38 -0
- package/lib/core/utils/url/getAbsoluteUrl.js.map +1 -0
- package/lib/core/utils/url/getAbsoluteUrl.mjs +18 -0
- package/lib/core/utils/url/getAbsoluteUrl.mjs.map +1 -0
- package/lib/core/utils/url/isAbsoluteUrl.d.mts +6 -0
- package/lib/core/utils/url/isAbsoluteUrl.d.ts +6 -0
- package/lib/core/utils/url/isAbsoluteUrl.js +27 -0
- package/lib/core/utils/url/isAbsoluteUrl.js.map +1 -0
- package/lib/core/utils/url/isAbsoluteUrl.mjs +7 -0
- package/lib/core/utils/url/isAbsoluteUrl.mjs.map +1 -0
- package/lib/core/ws/WebSocketClientManager.d.mts +65 -0
- package/lib/core/ws/WebSocketClientManager.d.ts +65 -0
- package/lib/core/ws/WebSocketClientManager.js +159 -0
- package/lib/core/ws/WebSocketClientManager.js.map +1 -0
- package/lib/core/ws/WebSocketClientManager.mjs +139 -0
- package/lib/core/ws/WebSocketClientManager.mjs.map +1 -0
- package/lib/core/ws/WebSocketClientStore.d.mts +13 -0
- package/lib/core/ws/WebSocketClientStore.d.ts +13 -0
- package/lib/core/ws/WebSocketClientStore.js +26 -0
- package/lib/core/ws/WebSocketClientStore.js.map +1 -0
- package/lib/core/ws/WebSocketClientStore.mjs +6 -0
- package/lib/core/ws/WebSocketClientStore.mjs.map +1 -0
- package/lib/core/ws/WebSocketIndexedDBClientStore.d.mts +14 -0
- package/lib/core/ws/WebSocketIndexedDBClientStore.d.ts +14 -0
- package/lib/core/ws/WebSocketIndexedDBClientStore.js +130 -0
- package/lib/core/ws/WebSocketIndexedDBClientStore.js.map +1 -0
- package/lib/core/ws/WebSocketIndexedDBClientStore.mjs +110 -0
- package/lib/core/ws/WebSocketIndexedDBClientStore.mjs.map +1 -0
- package/lib/core/ws/WebSocketMemoryClientStore.d.mts +12 -0
- package/lib/core/ws/WebSocketMemoryClientStore.d.ts +12 -0
- package/lib/core/ws/WebSocketMemoryClientStore.js +41 -0
- package/lib/core/ws/WebSocketMemoryClientStore.js.map +1 -0
- package/lib/core/ws/WebSocketMemoryClientStore.mjs +21 -0
- package/lib/core/ws/WebSocketMemoryClientStore.mjs.map +1 -0
- package/lib/core/ws/handleWebSocketEvent.d.mts +20 -0
- package/lib/core/ws/handleWebSocketEvent.d.ts +20 -0
- package/lib/core/ws/handleWebSocketEvent.js +61 -0
- package/lib/core/ws/handleWebSocketEvent.js.map +1 -0
- package/lib/core/ws/handleWebSocketEvent.mjs +43 -0
- package/lib/core/ws/handleWebSocketEvent.mjs.map +1 -0
- package/lib/core/ws/utils/attachWebSocketLogger.d.mts +18 -0
- package/lib/core/ws/utils/attachWebSocketLogger.d.ts +18 -0
- package/lib/core/ws/utils/attachWebSocketLogger.js +199 -0
- package/lib/core/ws/utils/attachWebSocketLogger.js.map +1 -0
- package/lib/core/ws/utils/attachWebSocketLogger.mjs +179 -0
- package/lib/core/ws/utils/attachWebSocketLogger.mjs.map +1 -0
- package/lib/core/ws/utils/getMessageLength.d.mts +11 -0
- package/lib/core/ws/utils/getMessageLength.d.ts +11 -0
- package/lib/core/ws/utils/getMessageLength.js +34 -0
- package/lib/core/ws/utils/getMessageLength.js.map +1 -0
- package/lib/core/ws/utils/getMessageLength.mjs +14 -0
- package/lib/core/ws/utils/getMessageLength.mjs.map +1 -0
- package/lib/core/ws/utils/getPublicData.d.mts +5 -0
- package/lib/core/ws/utils/getPublicData.d.ts +5 -0
- package/lib/core/ws/utils/getPublicData.js +37 -0
- package/lib/core/ws/utils/getPublicData.js.map +1 -0
- package/lib/core/ws/utils/getPublicData.mjs +17 -0
- package/lib/core/ws/utils/getPublicData.mjs.map +1 -0
- package/lib/core/ws/utils/truncateMessage.d.mts +3 -0
- package/lib/core/ws/utils/truncateMessage.d.ts +3 -0
- package/lib/core/ws/utils/truncateMessage.js +31 -0
- package/lib/core/ws/utils/truncateMessage.js.map +1 -0
- package/lib/core/ws/utils/truncateMessage.mjs +11 -0
- package/lib/core/ws/utils/truncateMessage.mjs.map +1 -0
- package/lib/core/ws/webSocketInterceptor.d.mts +5 -0
- package/lib/core/ws/webSocketInterceptor.d.ts +5 -0
- package/lib/core/ws/webSocketInterceptor.js +26 -0
- package/lib/core/ws/webSocketInterceptor.js.map +1 -0
- package/lib/core/ws/webSocketInterceptor.mjs +6 -0
- package/lib/core/ws/webSocketInterceptor.mjs.map +1 -0
- package/lib/core/ws.d.mts +75 -0
- package/lib/core/ws.d.ts +75 -0
- package/lib/core/ws.js +69 -0
- package/lib/core/ws.js.map +1 -0
- package/lib/core/ws.mjs +52 -0
- package/lib/core/ws.mjs.map +1 -0
- package/lib/iife/index.js +23752 -0
- package/lib/iife/index.js.map +1 -0
- package/lib/mockServiceWorker.js +349 -0
- package/lib/native/index.d.mts +74 -0
- package/lib/native/index.d.ts +74 -0
- package/lib/native/index.js +156 -0
- package/lib/native/index.js.map +1 -0
- package/lib/native/index.mjs +134 -0
- package/lib/native/index.mjs.map +1 -0
- package/lib/node/index.d.mts +91 -0
- package/lib/node/index.d.ts +91 -0
- package/lib/node/index.js +209 -0
- package/lib/node/index.js.map +1 -0
- package/lib/node/index.mjs +184 -0
- package/lib/node/index.mjs.map +1 -0
- package/lib/shims/cookie.d.mts +7 -0
- package/lib/shims/cookie.d.ts +7 -0
- package/lib/shims/cookie.js +204 -0
- package/lib/shims/cookie.mjs +196 -0
- package/lib/shims/statuses.d.mts +6 -0
- package/lib/shims/statuses.d.ts +6 -0
- package/lib/shims/statuses.js +195 -0
- package/lib/shims/statuses.mjs +187 -0
- package/native/package.json +30 -0
- package/node/package.json +33 -0
- package/package.json +381 -0
- package/src/browser/global.browser.d.ts +1 -0
- package/src/browser/index.ts +3 -0
- package/src/browser/setupWorker/glossary.ts +138 -0
- package/src/browser/setupWorker/setupWorker.node.test.ts +10 -0
- package/src/browser/setupWorker/setupWorker.ts +184 -0
- package/src/browser/setupWorker/start/createFallbackRequestListener.ts +71 -0
- package/src/browser/setupWorker/start/createRequestListener.ts +138 -0
- package/src/browser/setupWorker/start/createResponseListener.ts +57 -0
- package/src/browser/setupWorker/start/createStartHandler.ts +137 -0
- package/src/browser/setupWorker/start/utils/enableMocking.ts +30 -0
- package/src/browser/setupWorker/start/utils/getWorkerByRegistration.ts +25 -0
- package/src/browser/setupWorker/start/utils/getWorkerInstance.ts +97 -0
- package/src/browser/setupWorker/start/utils/prepareStartHandler.test.ts +59 -0
- package/src/browser/setupWorker/start/utils/prepareStartHandler.ts +44 -0
- package/src/browser/setupWorker/start/utils/printStartMessage.test.ts +84 -0
- package/src/browser/setupWorker/start/utils/printStartMessage.ts +51 -0
- package/src/browser/setupWorker/start/utils/validateWorkerScope.ts +18 -0
- package/src/browser/setupWorker/stop/utils/printStopMessage.test.ts +26 -0
- package/src/browser/setupWorker/stop/utils/printStopMessage.ts +13 -0
- package/src/browser/tsconfig.browser.build.json +6 -0
- package/src/browser/tsconfig.browser.json +9 -0
- package/src/browser/utils/checkWorkerIntegrity.ts +42 -0
- package/src/browser/utils/deserializeRequest.ts +15 -0
- package/src/browser/utils/getAbsoluteWorkerUrl.test.ts +29 -0
- package/src/browser/utils/getAbsoluteWorkerUrl.ts +7 -0
- package/src/browser/utils/pruneGetRequestBody.test.ts +53 -0
- package/src/browser/utils/pruneGetRequestBody.ts +21 -0
- package/src/browser/utils/supports.ts +30 -0
- package/src/browser/utils/workerChannel.ts +159 -0
- package/src/core/HttpResponse.test.ts +378 -0
- package/src/core/HttpResponse.ts +248 -0
- package/src/core/SetupApi.ts +127 -0
- package/src/core/bypass.test.ts +80 -0
- package/src/core/bypass.ts +46 -0
- package/src/core/delay.ts +82 -0
- package/src/core/getResponse.test.ts +74 -0
- package/src/core/getResponse.ts +29 -0
- package/src/core/graphql.test.ts +11 -0
- package/src/core/graphql.ts +136 -0
- package/src/core/handlers/GraphQLHandler.test.ts +873 -0
- package/src/core/handlers/GraphQLHandler.ts +437 -0
- package/src/core/handlers/HttpHandler.test.ts +253 -0
- package/src/core/handlers/HttpHandler.ts +214 -0
- package/src/core/handlers/RequestHandler.ts +391 -0
- package/src/core/handlers/WebSocketHandler.test.ts +127 -0
- package/src/core/handlers/WebSocketHandler.ts +209 -0
- package/src/core/handlers/common.ts +1 -0
- package/src/core/http.test.ts +15 -0
- package/src/core/http.ts +64 -0
- package/src/core/index.ts +110 -0
- package/src/core/isCommonAssetRequest.ts +45 -0
- package/src/core/passthrough.test.ts +11 -0
- package/src/core/passthrough.ts +25 -0
- package/src/core/sharedOptions.ts +66 -0
- package/src/core/sse.ts +916 -0
- package/src/core/typeUtils.ts +26 -0
- package/src/core/utils/HttpResponse/decorators.ts +76 -0
- package/src/core/utils/cookieStore.ts +94 -0
- package/src/core/utils/executeHandlers.ts +69 -0
- package/src/core/utils/handleRequest.test.ts +573 -0
- package/src/core/utils/handleRequest.ts +117 -0
- package/src/core/utils/internal/Disposable.ts +12 -0
- package/src/core/utils/internal/checkGlobals.ts +17 -0
- package/src/core/utils/internal/devUtils.test.ts +21 -0
- package/src/core/utils/internal/devUtils.ts +44 -0
- package/src/core/utils/internal/getCallFrame.test.ts +154 -0
- package/src/core/utils/internal/getCallFrame.ts +35 -0
- package/src/core/utils/internal/hasRefCounted.test.ts +16 -0
- package/src/core/utils/internal/hasRefCounted.ts +8 -0
- package/src/core/utils/internal/isHandlerKind.test.ts +64 -0
- package/src/core/utils/internal/isHandlerKind.ts +21 -0
- package/src/core/utils/internal/isIterable.test.ts +23 -0
- package/src/core/utils/internal/isIterable.ts +32 -0
- package/src/core/utils/internal/isObject.test.ts +20 -0
- package/src/core/utils/internal/isObject.ts +6 -0
- package/src/core/utils/internal/isStringEqual.test.ts +45 -0
- package/src/core/utils/internal/isStringEqual.ts +6 -0
- package/src/core/utils/internal/jsonParse.test.ts +13 -0
- package/src/core/utils/internal/jsonParse.ts +13 -0
- package/src/core/utils/internal/mergeRight.test.ts +43 -0
- package/src/core/utils/internal/mergeRight.ts +30 -0
- package/src/core/utils/internal/parseGraphQLRequest.test.ts +99 -0
- package/src/core/utils/internal/parseGraphQLRequest.ts +214 -0
- package/src/core/utils/internal/parseMultipartData.test.ts +76 -0
- package/src/core/utils/internal/parseMultipartData.ts +106 -0
- package/src/core/utils/internal/pipeEvents.test.ts +14 -0
- package/src/core/utils/internal/pipeEvents.ts +25 -0
- package/src/core/utils/internal/requestHandlerUtils.ts +21 -0
- package/src/core/utils/internal/toReadonlyArray.test.ts +30 -0
- package/src/core/utils/internal/toReadonlyArray.ts +8 -0
- package/src/core/utils/internal/tryCatch.test.ts +29 -0
- package/src/core/utils/internal/tryCatch.ts +11 -0
- package/src/core/utils/logging/getStatusCodeColor.test.ts +22 -0
- package/src/core/utils/logging/getStatusCodeColor.ts +20 -0
- package/src/core/utils/logging/getTimestamp.test.ts +32 -0
- package/src/core/utils/logging/getTimestamp.ts +17 -0
- package/src/core/utils/logging/serializeRequest.test.ts +23 -0
- package/src/core/utils/logging/serializeRequest.ts +23 -0
- package/src/core/utils/logging/serializeResponse.test.ts +77 -0
- package/src/core/utils/logging/serializeResponse.ts +31 -0
- package/src/core/utils/matching/matchRequestUrl.test.ts +183 -0
- package/src/core/utils/matching/matchRequestUrl.ts +77 -0
- package/src/core/utils/matching/normalizePath.node.test.ts +44 -0
- package/src/core/utils/matching/normalizePath.test.ts +56 -0
- package/src/core/utils/matching/normalizePath.ts +22 -0
- package/src/core/utils/request/getAllAcceptedMimeTypes.test.ts +86 -0
- package/src/core/utils/request/getAllAcceptedMimeTypes.ts +70 -0
- package/src/core/utils/request/getRequestCookies.ts +88 -0
- package/src/core/utils/request/onUnhandledRequest.node.test.ts +62 -0
- package/src/core/utils/request/onUnhandledRequest.test.ts +228 -0
- package/src/core/utils/request/onUnhandledRequest.ts +81 -0
- package/src/core/utils/request/storeResponseCookies.ts +17 -0
- package/src/core/utils/request/toPublicUrl.node.test.ts +17 -0
- package/src/core/utils/request/toPublicUrl.test.ts +16 -0
- package/src/core/utils/request/toPublicUrl.ts +16 -0
- package/src/core/utils/toResponseInit.ts +7 -0
- package/src/core/utils/url/cleanUrl.test.ts +22 -0
- package/src/core/utils/url/cleanUrl.ts +16 -0
- package/src/core/utils/url/getAbsoluteUrl.node.test.ts +19 -0
- package/src/core/utils/url/getAbsoluteUrl.test.ts +47 -0
- package/src/core/utils/url/getAbsoluteUrl.ts +25 -0
- package/src/core/utils/url/isAbsoluteUrl.test.ts +32 -0
- package/src/core/utils/url/isAbsoluteUrl.ts +6 -0
- package/src/core/ws/WebSocketClientManager.test.ts +164 -0
- package/src/core/ws/WebSocketClientManager.ts +241 -0
- package/src/core/ws/WebSocketClientStore.ts +14 -0
- package/src/core/ws/WebSocketIndexedDBClientStore.ts +140 -0
- package/src/core/ws/WebSocketMemoryClientStore.ts +27 -0
- package/src/core/ws/handleWebSocketEvent.ts +64 -0
- package/src/core/ws/utils/attachWebSocketLogger.ts +245 -0
- package/src/core/ws/utils/getMessageLength.test.ts +16 -0
- package/src/core/ws/utils/getMessageLength.ts +20 -0
- package/src/core/ws/utils/getPublicData.test.ts +38 -0
- package/src/core/ws/utils/getPublicData.ts +18 -0
- package/src/core/ws/utils/truncateMessage.test.ts +12 -0
- package/src/core/ws/utils/truncateMessage.ts +9 -0
- package/src/core/ws/webSocketInterceptor.ts +3 -0
- package/src/core/ws.test.ts +23 -0
- package/src/core/ws.ts +161 -0
- package/src/iife/index.ts +2 -0
- package/src/mockServiceWorker.js +349 -0
- package/src/native/index.ts +21 -0
- package/src/node/SetupServerApi.ts +87 -0
- package/src/node/SetupServerCommonApi.ts +169 -0
- package/src/node/glossary.ts +74 -0
- package/src/node/index.ts +3 -0
- package/src/node/setupServer.ts +15 -0
- package/src/package.json +3 -0
- package/src/shims/cookie.ts +7 -0
- package/src/shims/statuses.ts +6 -0
- package/src/tsconfig.core.build.json +6 -0
- package/src/tsconfig.node.build.json +6 -0
- package/src/tsconfig.node.json +8 -0
- package/src/tsconfig.src.json +10 -0
- package/src/tsconfig.worker.json +13 -0
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
// src/node/SetupServerApi.ts
|
|
2
|
+
import { AsyncLocalStorage } from "async_hooks";
|
|
3
|
+
import { ClientRequestInterceptor } from "@mswjs/interceptors/ClientRequest";
|
|
4
|
+
import { XMLHttpRequestInterceptor } from "@mswjs/interceptors/XMLHttpRequest";
|
|
5
|
+
import { FetchInterceptor } from "@mswjs/interceptors/fetch";
|
|
6
|
+
|
|
7
|
+
// src/node/SetupServerCommonApi.ts
|
|
8
|
+
import { invariant } from "outvariant";
|
|
9
|
+
import {
|
|
10
|
+
BatchInterceptor,
|
|
11
|
+
InterceptorReadyState
|
|
12
|
+
} from "@mswjs/interceptors";
|
|
13
|
+
import { SetupApi } from '../core/SetupApi.mjs';
|
|
14
|
+
import { handleRequest } from '../core/utils/handleRequest.mjs';
|
|
15
|
+
import { mergeRight } from '../core/utils/internal/mergeRight.mjs';
|
|
16
|
+
import { InternalError, devUtils } from '../core/utils/internal/devUtils.mjs';
|
|
17
|
+
import { handleWebSocketEvent } from '../core/ws/handleWebSocketEvent.mjs';
|
|
18
|
+
import { webSocketInterceptor } from '../core/ws/webSocketInterceptor.mjs';
|
|
19
|
+
import { isHandlerKind } from '../core/utils/internal/isHandlerKind.mjs';
|
|
20
|
+
var DEFAULT_LISTEN_OPTIONS = {
|
|
21
|
+
onUnhandledRequest: "warn"
|
|
22
|
+
};
|
|
23
|
+
var SetupServerCommonApi = class extends SetupApi {
|
|
24
|
+
interceptor;
|
|
25
|
+
resolvedOptions;
|
|
26
|
+
constructor(interceptors, handlers) {
|
|
27
|
+
super(...handlers);
|
|
28
|
+
this.interceptor = new BatchInterceptor({
|
|
29
|
+
name: "setup-server",
|
|
30
|
+
interceptors
|
|
31
|
+
});
|
|
32
|
+
this.resolvedOptions = {};
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Subscribe to all requests that are using the interceptor object
|
|
36
|
+
*/
|
|
37
|
+
init() {
|
|
38
|
+
this.interceptor.on(
|
|
39
|
+
"request",
|
|
40
|
+
async ({ request, requestId, controller }) => {
|
|
41
|
+
const response = await handleRequest(
|
|
42
|
+
request,
|
|
43
|
+
requestId,
|
|
44
|
+
this.handlersController.currentHandlers().filter(isHandlerKind("RequestHandler")),
|
|
45
|
+
this.resolvedOptions,
|
|
46
|
+
this.emitter,
|
|
47
|
+
{
|
|
48
|
+
onPassthroughResponse(request2) {
|
|
49
|
+
const acceptHeader = request2.headers.get("accept");
|
|
50
|
+
if (acceptHeader) {
|
|
51
|
+
const nextAcceptHeader = acceptHeader.replace(
|
|
52
|
+
/(,\s+)?msw\/passthrough/,
|
|
53
|
+
""
|
|
54
|
+
);
|
|
55
|
+
if (nextAcceptHeader) {
|
|
56
|
+
request2.headers.set("accept", nextAcceptHeader);
|
|
57
|
+
} else {
|
|
58
|
+
request2.headers.delete("accept");
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
if (response) {
|
|
65
|
+
controller.respondWith(response);
|
|
66
|
+
}
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
this.interceptor.on("unhandledException", ({ error }) => {
|
|
71
|
+
if (error instanceof InternalError) {
|
|
72
|
+
throw error;
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
this.interceptor.on(
|
|
76
|
+
"response",
|
|
77
|
+
({ response, isMockedResponse, request, requestId }) => {
|
|
78
|
+
this.emitter.emit(
|
|
79
|
+
isMockedResponse ? "response:mocked" : "response:bypass",
|
|
80
|
+
{
|
|
81
|
+
response,
|
|
82
|
+
request,
|
|
83
|
+
requestId
|
|
84
|
+
}
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
);
|
|
88
|
+
handleWebSocketEvent({
|
|
89
|
+
getUnhandledRequestStrategy: () => {
|
|
90
|
+
return this.resolvedOptions.onUnhandledRequest;
|
|
91
|
+
},
|
|
92
|
+
getHandlers: () => {
|
|
93
|
+
return this.handlersController.currentHandlers();
|
|
94
|
+
},
|
|
95
|
+
onMockedConnection: () => {
|
|
96
|
+
},
|
|
97
|
+
onPassthroughConnection: () => {
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
listen(options = {}) {
|
|
102
|
+
this.resolvedOptions = mergeRight(
|
|
103
|
+
DEFAULT_LISTEN_OPTIONS,
|
|
104
|
+
options
|
|
105
|
+
);
|
|
106
|
+
this.interceptor.apply();
|
|
107
|
+
this.init();
|
|
108
|
+
this.subscriptions.push(() => this.interceptor.dispose());
|
|
109
|
+
webSocketInterceptor.apply();
|
|
110
|
+
this.subscriptions.push(() => webSocketInterceptor.dispose());
|
|
111
|
+
invariant(
|
|
112
|
+
[InterceptorReadyState.APPLYING, InterceptorReadyState.APPLIED].includes(
|
|
113
|
+
this.interceptor.readyState
|
|
114
|
+
),
|
|
115
|
+
devUtils.formatMessage(
|
|
116
|
+
'Failed to start "setupServer": the interceptor failed to apply. This is likely an issue with the library and you should report it at "%s".'
|
|
117
|
+
),
|
|
118
|
+
"https://github.com/mswjs/msw/issues/new/choose"
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
close() {
|
|
122
|
+
this.dispose();
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
// src/node/SetupServerApi.ts
|
|
127
|
+
var store = new AsyncLocalStorage();
|
|
128
|
+
var AsyncHandlersController = class {
|
|
129
|
+
rootContext;
|
|
130
|
+
constructor(initialHandlers) {
|
|
131
|
+
this.rootContext = { initialHandlers, handlers: [] };
|
|
132
|
+
}
|
|
133
|
+
get context() {
|
|
134
|
+
return store.getStore() || this.rootContext;
|
|
135
|
+
}
|
|
136
|
+
prepend(runtimeHandlers) {
|
|
137
|
+
this.context.handlers.unshift(...runtimeHandlers);
|
|
138
|
+
}
|
|
139
|
+
reset(nextHandlers) {
|
|
140
|
+
const context = this.context;
|
|
141
|
+
context.handlers = [];
|
|
142
|
+
context.initialHandlers = nextHandlers.length > 0 ? nextHandlers : context.initialHandlers;
|
|
143
|
+
}
|
|
144
|
+
currentHandlers() {
|
|
145
|
+
const { initialHandlers, handlers } = this.context;
|
|
146
|
+
return handlers.concat(initialHandlers);
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
var SetupServerApi = class extends SetupServerCommonApi {
|
|
150
|
+
constructor(handlers, interceptors = [
|
|
151
|
+
new ClientRequestInterceptor(),
|
|
152
|
+
new XMLHttpRequestInterceptor(),
|
|
153
|
+
new FetchInterceptor()
|
|
154
|
+
]) {
|
|
155
|
+
super(interceptors, handlers);
|
|
156
|
+
this.handlersController = new AsyncHandlersController(handlers);
|
|
157
|
+
}
|
|
158
|
+
boundary(callback) {
|
|
159
|
+
return (...args) => {
|
|
160
|
+
return store.run(
|
|
161
|
+
{
|
|
162
|
+
initialHandlers: this.handlersController.currentHandlers(),
|
|
163
|
+
handlers: []
|
|
164
|
+
},
|
|
165
|
+
callback,
|
|
166
|
+
...args
|
|
167
|
+
);
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
close() {
|
|
171
|
+
super.close();
|
|
172
|
+
store.disable();
|
|
173
|
+
}
|
|
174
|
+
};
|
|
175
|
+
|
|
176
|
+
// src/node/setupServer.ts
|
|
177
|
+
var setupServer = (...handlers) => {
|
|
178
|
+
return new SetupServerApi(handlers);
|
|
179
|
+
};
|
|
180
|
+
export {
|
|
181
|
+
SetupServerApi,
|
|
182
|
+
setupServer
|
|
183
|
+
};
|
|
184
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/node/SetupServerApi.ts","../../src/node/SetupServerCommonApi.ts","../../src/node/setupServer.ts"],"sourcesContent":["import { AsyncLocalStorage } from 'node:async_hooks'\nimport type { HttpRequestEventMap, Interceptor } from '@mswjs/interceptors'\nimport { ClientRequestInterceptor } from '@mswjs/interceptors/ClientRequest'\nimport { XMLHttpRequestInterceptor } from '@mswjs/interceptors/XMLHttpRequest'\nimport { FetchInterceptor } from '@mswjs/interceptors/fetch'\nimport { HandlersController } from '~/core/SetupApi'\nimport type { RequestHandler } from '~/core/handlers/RequestHandler'\nimport type { WebSocketHandler } from '~/core/handlers/WebSocketHandler'\nimport type { SetupServer } from './glossary'\nimport { SetupServerCommonApi } from './SetupServerCommonApi'\n\nconst store = new AsyncLocalStorage<RequestHandlersContext>()\n\ntype RequestHandlersContext = {\n initialHandlers: Array<RequestHandler | WebSocketHandler>\n handlers: Array<RequestHandler | WebSocketHandler>\n}\n\n/**\n * A handlers controller that utilizes `AsyncLocalStorage` in Node.js\n * to prevent the request handlers list from being a shared state\n * across multiple tests.\n */\nclass AsyncHandlersController implements HandlersController {\n private rootContext: RequestHandlersContext\n\n constructor(initialHandlers: Array<RequestHandler | WebSocketHandler>) {\n this.rootContext = { initialHandlers, handlers: [] }\n }\n\n get context(): RequestHandlersContext {\n return store.getStore() || this.rootContext\n }\n\n public prepend(runtimeHandlers: Array<RequestHandler | WebSocketHandler>) {\n this.context.handlers.unshift(...runtimeHandlers)\n }\n\n public reset(nextHandlers: Array<RequestHandler | WebSocketHandler>) {\n const context = this.context\n context.handlers = []\n context.initialHandlers =\n nextHandlers.length > 0 ? nextHandlers : context.initialHandlers\n }\n\n public currentHandlers(): Array<RequestHandler | WebSocketHandler> {\n const { initialHandlers, handlers } = this.context\n return handlers.concat(initialHandlers)\n }\n}\nexport class SetupServerApi\n extends SetupServerCommonApi\n implements SetupServer\n{\n constructor(\n handlers: Array<RequestHandler | WebSocketHandler>,\n interceptors: Array<Interceptor<HttpRequestEventMap>> = [\n new ClientRequestInterceptor(),\n new XMLHttpRequestInterceptor(),\n new FetchInterceptor(),\n ],\n ) {\n super(interceptors, handlers)\n\n this.handlersController = new AsyncHandlersController(handlers)\n }\n\n public boundary<Args extends Array<any>, R>(\n callback: (...args: Args) => R,\n ): (...args: Args) => R {\n return (...args: Args): R => {\n return store.run<any, any>(\n {\n initialHandlers: this.handlersController.currentHandlers(),\n handlers: [],\n },\n callback,\n ...args,\n )\n }\n }\n\n public close(): void {\n super.close()\n store.disable()\n }\n}\n","/**\n * @note This API is extended by both \"msw/node\" and \"msw/native\"\n * so be minding about the things you import!\n */\nimport type { RequiredDeep } from 'type-fest'\nimport { invariant } from 'outvariant'\nimport {\n BatchInterceptor,\n InterceptorReadyState,\n type HttpRequestEventMap,\n type Interceptor,\n} from '@mswjs/interceptors'\nimport type { LifeCycleEventsMap, SharedOptions } from '~/core/sharedOptions'\nimport { SetupApi } from '~/core/SetupApi'\nimport { handleRequest } from '~/core/utils/handleRequest'\nimport type { RequestHandler } from '~/core/handlers/RequestHandler'\nimport type { WebSocketHandler } from '~/core/handlers/WebSocketHandler'\nimport { mergeRight } from '~/core/utils/internal/mergeRight'\nimport { InternalError, devUtils } from '~/core/utils/internal/devUtils'\nimport type { SetupServerCommon } from './glossary'\nimport { handleWebSocketEvent } from '~/core/ws/handleWebSocketEvent'\nimport { webSocketInterceptor } from '~/core/ws/webSocketInterceptor'\nimport { isHandlerKind } from '~/core/utils/internal/isHandlerKind'\n\nconst DEFAULT_LISTEN_OPTIONS: RequiredDeep<SharedOptions> = {\n onUnhandledRequest: 'warn',\n}\n\nexport class SetupServerCommonApi\n extends SetupApi<LifeCycleEventsMap>\n implements SetupServerCommon\n{\n protected readonly interceptor: BatchInterceptor<\n Array<Interceptor<HttpRequestEventMap>>,\n HttpRequestEventMap\n >\n private resolvedOptions: RequiredDeep<SharedOptions>\n\n constructor(\n interceptors: Array<Interceptor<HttpRequestEventMap>>,\n handlers: Array<RequestHandler | WebSocketHandler>,\n ) {\n super(...handlers)\n\n this.interceptor = new BatchInterceptor({\n name: 'setup-server',\n interceptors,\n })\n\n this.resolvedOptions = {} as RequiredDeep<SharedOptions>\n }\n\n /**\n * Subscribe to all requests that are using the interceptor object\n */\n private init(): void {\n this.interceptor.on(\n 'request',\n async ({ request, requestId, controller }) => {\n const response = await handleRequest(\n request,\n requestId,\n this.handlersController\n .currentHandlers()\n .filter(isHandlerKind('RequestHandler')),\n this.resolvedOptions,\n this.emitter,\n {\n onPassthroughResponse(request) {\n const acceptHeader = request.headers.get('accept')\n\n /**\n * @note Remove the internal bypass request header.\n * In the browser, this is done by the worker script.\n * In Node.js, it has to be done here.\n */\n if (acceptHeader) {\n const nextAcceptHeader = acceptHeader.replace(\n /(,\\s+)?msw\\/passthrough/,\n '',\n )\n\n if (nextAcceptHeader) {\n request.headers.set('accept', nextAcceptHeader)\n } else {\n request.headers.delete('accept')\n }\n }\n },\n },\n )\n\n if (response) {\n controller.respondWith(response)\n }\n\n return\n },\n )\n\n this.interceptor.on('unhandledException', ({ error }) => {\n if (error instanceof InternalError) {\n throw error\n }\n })\n\n this.interceptor.on(\n 'response',\n ({ response, isMockedResponse, request, requestId }) => {\n this.emitter.emit(\n isMockedResponse ? 'response:mocked' : 'response:bypass',\n {\n response,\n request,\n requestId,\n },\n )\n },\n )\n\n // Preconfigure the WebSocket interception but don't enable it just yet.\n // It will be enabled when the server starts.\n handleWebSocketEvent({\n getUnhandledRequestStrategy: () => {\n return this.resolvedOptions.onUnhandledRequest\n },\n getHandlers: () => {\n return this.handlersController.currentHandlers()\n },\n onMockedConnection: () => {},\n onPassthroughConnection: () => {},\n })\n }\n\n public listen(options: Partial<SharedOptions> = {}): void {\n this.resolvedOptions = mergeRight(\n DEFAULT_LISTEN_OPTIONS,\n options,\n ) as RequiredDeep<SharedOptions>\n\n // Apply the interceptor when starting the server.\n // Attach the event listeners to the interceptor here\n // so they get re-attached whenever `.listen()` is called.\n this.interceptor.apply()\n this.init()\n this.subscriptions.push(() => this.interceptor.dispose())\n\n // Apply the WebSocket interception.\n webSocketInterceptor.apply()\n this.subscriptions.push(() => webSocketInterceptor.dispose())\n\n // Assert that the interceptor has been applied successfully.\n // Also guards us from forgetting to call \"interceptor.apply()\"\n // as a part of the \"listen\" method.\n invariant(\n [InterceptorReadyState.APPLYING, InterceptorReadyState.APPLIED].includes(\n this.interceptor.readyState,\n ),\n devUtils.formatMessage(\n 'Failed to start \"setupServer\": the interceptor failed to apply. This is likely an issue with the library and you should report it at \"%s\".',\n ),\n 'https://github.com/mswjs/msw/issues/new/choose',\n )\n }\n\n public close(): void {\n this.dispose()\n }\n}\n","import type { RequestHandler } from '~/core/handlers/RequestHandler'\nimport type { WebSocketHandler } from '~/core/handlers/WebSocketHandler'\nimport { SetupServerApi } from './SetupServerApi'\n\n/**\n * Sets up a requests interception in Node.js with the given request handlers.\n * @param {RequestHandler[]} handlers List of request handlers.\n *\n * @see {@link https://mswjs.io/docs/api/setup-server `setupServer()` API reference}\n */\nexport const setupServer = (\n ...handlers: Array<RequestHandler | WebSocketHandler>\n): SetupServerApi => {\n return new SetupServerApi(handlers)\n}\n"],"mappings":"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","names":["request"]}
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
+
};
|
|
11
|
+
var __export = (target, all) => {
|
|
12
|
+
for (var name in all)
|
|
13
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
14
|
+
};
|
|
15
|
+
var __copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from))
|
|
18
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
19
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
22
|
+
};
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
24
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
25
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
26
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
27
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
28
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
29
|
+
mod
|
|
30
|
+
));
|
|
31
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
|
+
|
|
33
|
+
// node_modules/.pnpm/cookie@1.0.2/node_modules/cookie/dist/index.js
|
|
34
|
+
var require_dist = __commonJS({
|
|
35
|
+
"node_modules/.pnpm/cookie@1.0.2/node_modules/cookie/dist/index.js"(exports) {
|
|
36
|
+
"use strict";
|
|
37
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
38
|
+
exports.parse = parse2;
|
|
39
|
+
exports.serialize = serialize2;
|
|
40
|
+
var cookieNameRegExp = /^[\u0021-\u003A\u003C\u003E-\u007E]+$/;
|
|
41
|
+
var cookieValueRegExp = /^[\u0021-\u003A\u003C-\u007E]*$/;
|
|
42
|
+
var domainValueRegExp = /^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i;
|
|
43
|
+
var pathValueRegExp = /^[\u0020-\u003A\u003D-\u007E]*$/;
|
|
44
|
+
var __toString = Object.prototype.toString;
|
|
45
|
+
var NullObject = /* @__PURE__ */ (() => {
|
|
46
|
+
const C = function() {
|
|
47
|
+
};
|
|
48
|
+
C.prototype = /* @__PURE__ */ Object.create(null);
|
|
49
|
+
return C;
|
|
50
|
+
})();
|
|
51
|
+
function parse2(str, options) {
|
|
52
|
+
const obj = new NullObject();
|
|
53
|
+
const len = str.length;
|
|
54
|
+
if (len < 2)
|
|
55
|
+
return obj;
|
|
56
|
+
const dec = options?.decode || decode;
|
|
57
|
+
let index = 0;
|
|
58
|
+
do {
|
|
59
|
+
const eqIdx = str.indexOf("=", index);
|
|
60
|
+
if (eqIdx === -1)
|
|
61
|
+
break;
|
|
62
|
+
const colonIdx = str.indexOf(";", index);
|
|
63
|
+
const endIdx = colonIdx === -1 ? len : colonIdx;
|
|
64
|
+
if (eqIdx > endIdx) {
|
|
65
|
+
index = str.lastIndexOf(";", eqIdx - 1) + 1;
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
const keyStartIdx = startIndex(str, index, eqIdx);
|
|
69
|
+
const keyEndIdx = endIndex(str, eqIdx, keyStartIdx);
|
|
70
|
+
const key = str.slice(keyStartIdx, keyEndIdx);
|
|
71
|
+
if (obj[key] === void 0) {
|
|
72
|
+
let valStartIdx = startIndex(str, eqIdx + 1, endIdx);
|
|
73
|
+
let valEndIdx = endIndex(str, endIdx, valStartIdx);
|
|
74
|
+
const value = dec(str.slice(valStartIdx, valEndIdx));
|
|
75
|
+
obj[key] = value;
|
|
76
|
+
}
|
|
77
|
+
index = endIdx + 1;
|
|
78
|
+
} while (index < len);
|
|
79
|
+
return obj;
|
|
80
|
+
}
|
|
81
|
+
function startIndex(str, index, max) {
|
|
82
|
+
do {
|
|
83
|
+
const code = str.charCodeAt(index);
|
|
84
|
+
if (code !== 32 && code !== 9)
|
|
85
|
+
return index;
|
|
86
|
+
} while (++index < max);
|
|
87
|
+
return max;
|
|
88
|
+
}
|
|
89
|
+
function endIndex(str, index, min) {
|
|
90
|
+
while (index > min) {
|
|
91
|
+
const code = str.charCodeAt(--index);
|
|
92
|
+
if (code !== 32 && code !== 9)
|
|
93
|
+
return index + 1;
|
|
94
|
+
}
|
|
95
|
+
return min;
|
|
96
|
+
}
|
|
97
|
+
function serialize2(name, val, options) {
|
|
98
|
+
const enc = options?.encode || encodeURIComponent;
|
|
99
|
+
if (!cookieNameRegExp.test(name)) {
|
|
100
|
+
throw new TypeError(`argument name is invalid: ${name}`);
|
|
101
|
+
}
|
|
102
|
+
const value = enc(val);
|
|
103
|
+
if (!cookieValueRegExp.test(value)) {
|
|
104
|
+
throw new TypeError(`argument val is invalid: ${val}`);
|
|
105
|
+
}
|
|
106
|
+
let str = name + "=" + value;
|
|
107
|
+
if (!options)
|
|
108
|
+
return str;
|
|
109
|
+
if (options.maxAge !== void 0) {
|
|
110
|
+
if (!Number.isInteger(options.maxAge)) {
|
|
111
|
+
throw new TypeError(`option maxAge is invalid: ${options.maxAge}`);
|
|
112
|
+
}
|
|
113
|
+
str += "; Max-Age=" + options.maxAge;
|
|
114
|
+
}
|
|
115
|
+
if (options.domain) {
|
|
116
|
+
if (!domainValueRegExp.test(options.domain)) {
|
|
117
|
+
throw new TypeError(`option domain is invalid: ${options.domain}`);
|
|
118
|
+
}
|
|
119
|
+
str += "; Domain=" + options.domain;
|
|
120
|
+
}
|
|
121
|
+
if (options.path) {
|
|
122
|
+
if (!pathValueRegExp.test(options.path)) {
|
|
123
|
+
throw new TypeError(`option path is invalid: ${options.path}`);
|
|
124
|
+
}
|
|
125
|
+
str += "; Path=" + options.path;
|
|
126
|
+
}
|
|
127
|
+
if (options.expires) {
|
|
128
|
+
if (!isDate(options.expires) || !Number.isFinite(options.expires.valueOf())) {
|
|
129
|
+
throw new TypeError(`option expires is invalid: ${options.expires}`);
|
|
130
|
+
}
|
|
131
|
+
str += "; Expires=" + options.expires.toUTCString();
|
|
132
|
+
}
|
|
133
|
+
if (options.httpOnly) {
|
|
134
|
+
str += "; HttpOnly";
|
|
135
|
+
}
|
|
136
|
+
if (options.secure) {
|
|
137
|
+
str += "; Secure";
|
|
138
|
+
}
|
|
139
|
+
if (options.partitioned) {
|
|
140
|
+
str += "; Partitioned";
|
|
141
|
+
}
|
|
142
|
+
if (options.priority) {
|
|
143
|
+
const priority = typeof options.priority === "string" ? options.priority.toLowerCase() : void 0;
|
|
144
|
+
switch (priority) {
|
|
145
|
+
case "low":
|
|
146
|
+
str += "; Priority=Low";
|
|
147
|
+
break;
|
|
148
|
+
case "medium":
|
|
149
|
+
str += "; Priority=Medium";
|
|
150
|
+
break;
|
|
151
|
+
case "high":
|
|
152
|
+
str += "; Priority=High";
|
|
153
|
+
break;
|
|
154
|
+
default:
|
|
155
|
+
throw new TypeError(`option priority is invalid: ${options.priority}`);
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
if (options.sameSite) {
|
|
159
|
+
const sameSite = typeof options.sameSite === "string" ? options.sameSite.toLowerCase() : options.sameSite;
|
|
160
|
+
switch (sameSite) {
|
|
161
|
+
case true:
|
|
162
|
+
case "strict":
|
|
163
|
+
str += "; SameSite=Strict";
|
|
164
|
+
break;
|
|
165
|
+
case "lax":
|
|
166
|
+
str += "; SameSite=Lax";
|
|
167
|
+
break;
|
|
168
|
+
case "none":
|
|
169
|
+
str += "; SameSite=None";
|
|
170
|
+
break;
|
|
171
|
+
default:
|
|
172
|
+
throw new TypeError(`option sameSite is invalid: ${options.sameSite}`);
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return str;
|
|
176
|
+
}
|
|
177
|
+
function decode(str) {
|
|
178
|
+
if (str.indexOf("%") === -1)
|
|
179
|
+
return str;
|
|
180
|
+
try {
|
|
181
|
+
return decodeURIComponent(str);
|
|
182
|
+
} catch (e) {
|
|
183
|
+
return str;
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
function isDate(val) {
|
|
187
|
+
return __toString.call(val) === "[object Date]";
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
// src/shims/cookie.ts
|
|
193
|
+
var cookie_exports = {};
|
|
194
|
+
__export(cookie_exports, {
|
|
195
|
+
default: () => cookie_default,
|
|
196
|
+
parse: () => parse,
|
|
197
|
+
serialize: () => serialize
|
|
198
|
+
});
|
|
199
|
+
module.exports = __toCommonJS(cookie_exports);
|
|
200
|
+
var allCookie = __toESM(require_dist(), 1);
|
|
201
|
+
var cookie = allCookie.default || allCookie;
|
|
202
|
+
var parse = cookie.parse;
|
|
203
|
+
var serialize = cookie.serialize;
|
|
204
|
+
var cookie_default = cookie;
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
8
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
19
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
20
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
21
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
22
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
23
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
24
|
+
mod
|
|
25
|
+
));
|
|
26
|
+
|
|
27
|
+
// node_modules/.pnpm/cookie@1.0.2/node_modules/cookie/dist/index.js
|
|
28
|
+
var require_dist = __commonJS({
|
|
29
|
+
"node_modules/.pnpm/cookie@1.0.2/node_modules/cookie/dist/index.js"(exports) {
|
|
30
|
+
"use strict";
|
|
31
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
+
exports.parse = parse2;
|
|
33
|
+
exports.serialize = serialize2;
|
|
34
|
+
var cookieNameRegExp = /^[\u0021-\u003A\u003C\u003E-\u007E]+$/;
|
|
35
|
+
var cookieValueRegExp = /^[\u0021-\u003A\u003C-\u007E]*$/;
|
|
36
|
+
var domainValueRegExp = /^([.]?[a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)([.][a-z0-9]([a-z0-9-]{0,61}[a-z0-9])?)*$/i;
|
|
37
|
+
var pathValueRegExp = /^[\u0020-\u003A\u003D-\u007E]*$/;
|
|
38
|
+
var __toString = Object.prototype.toString;
|
|
39
|
+
var NullObject = /* @__PURE__ */ (() => {
|
|
40
|
+
const C = function() {
|
|
41
|
+
};
|
|
42
|
+
C.prototype = /* @__PURE__ */ Object.create(null);
|
|
43
|
+
return C;
|
|
44
|
+
})();
|
|
45
|
+
function parse2(str, options) {
|
|
46
|
+
const obj = new NullObject();
|
|
47
|
+
const len = str.length;
|
|
48
|
+
if (len < 2)
|
|
49
|
+
return obj;
|
|
50
|
+
const dec = options?.decode || decode;
|
|
51
|
+
let index = 0;
|
|
52
|
+
do {
|
|
53
|
+
const eqIdx = str.indexOf("=", index);
|
|
54
|
+
if (eqIdx === -1)
|
|
55
|
+
break;
|
|
56
|
+
const colonIdx = str.indexOf(";", index);
|
|
57
|
+
const endIdx = colonIdx === -1 ? len : colonIdx;
|
|
58
|
+
if (eqIdx > endIdx) {
|
|
59
|
+
index = str.lastIndexOf(";", eqIdx - 1) + 1;
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
const keyStartIdx = startIndex(str, index, eqIdx);
|
|
63
|
+
const keyEndIdx = endIndex(str, eqIdx, keyStartIdx);
|
|
64
|
+
const key = str.slice(keyStartIdx, keyEndIdx);
|
|
65
|
+
if (obj[key] === void 0) {
|
|
66
|
+
let valStartIdx = startIndex(str, eqIdx + 1, endIdx);
|
|
67
|
+
let valEndIdx = endIndex(str, endIdx, valStartIdx);
|
|
68
|
+
const value = dec(str.slice(valStartIdx, valEndIdx));
|
|
69
|
+
obj[key] = value;
|
|
70
|
+
}
|
|
71
|
+
index = endIdx + 1;
|
|
72
|
+
} while (index < len);
|
|
73
|
+
return obj;
|
|
74
|
+
}
|
|
75
|
+
function startIndex(str, index, max) {
|
|
76
|
+
do {
|
|
77
|
+
const code = str.charCodeAt(index);
|
|
78
|
+
if (code !== 32 && code !== 9)
|
|
79
|
+
return index;
|
|
80
|
+
} while (++index < max);
|
|
81
|
+
return max;
|
|
82
|
+
}
|
|
83
|
+
function endIndex(str, index, min) {
|
|
84
|
+
while (index > min) {
|
|
85
|
+
const code = str.charCodeAt(--index);
|
|
86
|
+
if (code !== 32 && code !== 9)
|
|
87
|
+
return index + 1;
|
|
88
|
+
}
|
|
89
|
+
return min;
|
|
90
|
+
}
|
|
91
|
+
function serialize2(name, val, options) {
|
|
92
|
+
const enc = options?.encode || encodeURIComponent;
|
|
93
|
+
if (!cookieNameRegExp.test(name)) {
|
|
94
|
+
throw new TypeError(`argument name is invalid: ${name}`);
|
|
95
|
+
}
|
|
96
|
+
const value = enc(val);
|
|
97
|
+
if (!cookieValueRegExp.test(value)) {
|
|
98
|
+
throw new TypeError(`argument val is invalid: ${val}`);
|
|
99
|
+
}
|
|
100
|
+
let str = name + "=" + value;
|
|
101
|
+
if (!options)
|
|
102
|
+
return str;
|
|
103
|
+
if (options.maxAge !== void 0) {
|
|
104
|
+
if (!Number.isInteger(options.maxAge)) {
|
|
105
|
+
throw new TypeError(`option maxAge is invalid: ${options.maxAge}`);
|
|
106
|
+
}
|
|
107
|
+
str += "; Max-Age=" + options.maxAge;
|
|
108
|
+
}
|
|
109
|
+
if (options.domain) {
|
|
110
|
+
if (!domainValueRegExp.test(options.domain)) {
|
|
111
|
+
throw new TypeError(`option domain is invalid: ${options.domain}`);
|
|
112
|
+
}
|
|
113
|
+
str += "; Domain=" + options.domain;
|
|
114
|
+
}
|
|
115
|
+
if (options.path) {
|
|
116
|
+
if (!pathValueRegExp.test(options.path)) {
|
|
117
|
+
throw new TypeError(`option path is invalid: ${options.path}`);
|
|
118
|
+
}
|
|
119
|
+
str += "; Path=" + options.path;
|
|
120
|
+
}
|
|
121
|
+
if (options.expires) {
|
|
122
|
+
if (!isDate(options.expires) || !Number.isFinite(options.expires.valueOf())) {
|
|
123
|
+
throw new TypeError(`option expires is invalid: ${options.expires}`);
|
|
124
|
+
}
|
|
125
|
+
str += "; Expires=" + options.expires.toUTCString();
|
|
126
|
+
}
|
|
127
|
+
if (options.httpOnly) {
|
|
128
|
+
str += "; HttpOnly";
|
|
129
|
+
}
|
|
130
|
+
if (options.secure) {
|
|
131
|
+
str += "; Secure";
|
|
132
|
+
}
|
|
133
|
+
if (options.partitioned) {
|
|
134
|
+
str += "; Partitioned";
|
|
135
|
+
}
|
|
136
|
+
if (options.priority) {
|
|
137
|
+
const priority = typeof options.priority === "string" ? options.priority.toLowerCase() : void 0;
|
|
138
|
+
switch (priority) {
|
|
139
|
+
case "low":
|
|
140
|
+
str += "; Priority=Low";
|
|
141
|
+
break;
|
|
142
|
+
case "medium":
|
|
143
|
+
str += "; Priority=Medium";
|
|
144
|
+
break;
|
|
145
|
+
case "high":
|
|
146
|
+
str += "; Priority=High";
|
|
147
|
+
break;
|
|
148
|
+
default:
|
|
149
|
+
throw new TypeError(`option priority is invalid: ${options.priority}`);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
if (options.sameSite) {
|
|
153
|
+
const sameSite = typeof options.sameSite === "string" ? options.sameSite.toLowerCase() : options.sameSite;
|
|
154
|
+
switch (sameSite) {
|
|
155
|
+
case true:
|
|
156
|
+
case "strict":
|
|
157
|
+
str += "; SameSite=Strict";
|
|
158
|
+
break;
|
|
159
|
+
case "lax":
|
|
160
|
+
str += "; SameSite=Lax";
|
|
161
|
+
break;
|
|
162
|
+
case "none":
|
|
163
|
+
str += "; SameSite=None";
|
|
164
|
+
break;
|
|
165
|
+
default:
|
|
166
|
+
throw new TypeError(`option sameSite is invalid: ${options.sameSite}`);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
return str;
|
|
170
|
+
}
|
|
171
|
+
function decode(str) {
|
|
172
|
+
if (str.indexOf("%") === -1)
|
|
173
|
+
return str;
|
|
174
|
+
try {
|
|
175
|
+
return decodeURIComponent(str);
|
|
176
|
+
} catch (e) {
|
|
177
|
+
return str;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
function isDate(val) {
|
|
181
|
+
return __toString.call(val) === "[object Date]";
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
// src/shims/cookie.ts
|
|
187
|
+
var allCookie = __toESM(require_dist(), 1);
|
|
188
|
+
var cookie = allCookie.default || allCookie;
|
|
189
|
+
var parse = cookie.parse;
|
|
190
|
+
var serialize = cookie.serialize;
|
|
191
|
+
var cookie_default = cookie;
|
|
192
|
+
export {
|
|
193
|
+
cookie_default as default,
|
|
194
|
+
parse,
|
|
195
|
+
serialize
|
|
196
|
+
};
|