From 7ac65438c0ee7718158cbc0e1b5cd00d6162ae8b Mon Sep 17 00:00:00 2001 From: Artem Zakharchenko Date: Wed, 13 Nov 2024 11:07:20 +0100 Subject: [PATCH] update msw to 2.6.4 --- examples/with-angular/package.json | 2 +- .../with-angular/src/mockServiceWorker.js | 42 +-- examples/with-jest/package.json | 2 +- examples/with-karma/package.json | 2 +- examples/with-karma/test/mockServiceWorker.js | 42 +-- .../with-playwright/app/mockServiceWorker.js | 42 +-- examples/with-playwright/package.json | 2 +- examples/with-remix/package.json | 2 +- .../with-remix/public/mockServiceWorker.js | 42 +-- examples/with-svelte/package.json | 2 +- .../with-svelte/static/mockServiceWorker.js | 197 ++++++------- examples/with-vitest-cjs/package.json | 2 +- examples/with-vitest/package.json | 2 +- examples/with-vue/package.json | 2 +- examples/with-vue/public/mockServiceWorker.js | 42 +-- pnpm-lock.yaml | 259 +++++++----------- 16 files changed, 336 insertions(+), 348 deletions(-) diff --git a/examples/with-angular/package.json b/examples/with-angular/package.json index d546130..663860f 100644 --- a/examples/with-angular/package.json +++ b/examples/with-angular/package.json @@ -37,7 +37,7 @@ "jest": "^29.5.0", "jest-environment-jsdom": "^29.5.0", "jest-preset-angular": "13.0.1", - "msw": "2.2.2", + "msw": "2.6.4", "start-server-and-test": "^2.0.0", "tslib": "2.3.0", "typescript": "~4.9" diff --git a/examples/with-angular/src/mockServiceWorker.js b/examples/with-angular/src/mockServiceWorker.js index 0acd8ff..8241ef8 100644 --- a/examples/with-angular/src/mockServiceWorker.js +++ b/examples/with-angular/src/mockServiceWorker.js @@ -2,13 +2,14 @@ /* tslint:disable */ /** - * Mock Service Worker (2.2.2). + * Mock Service Worker. * @see https://github.com/mswjs/msw * - Please do NOT modify this file. * - Please do NOT serve this file on production. */ -const INTEGRITY_CHECKSUM = '223d191a56023cd36aa88c802961b911' +const PACKAGE_VERSION = '2.6.4' +const INTEGRITY_CHECKSUM = 'ca7800994cc8bfb5eb961e037c877074' const IS_MOCKED_RESPONSE = Symbol('isMockedResponse') const activeClientIds = new Set() @@ -48,7 +49,10 @@ self.addEventListener('message', async function (event) { case 'INTEGRITY_CHECK_REQUEST': { sendToClient(client, { type: 'INTEGRITY_CHECK_RESPONSE', - payload: INTEGRITY_CHECKSUM, + payload: { + packageVersion: PACKAGE_VERSION, + checksum: INTEGRITY_CHECKSUM, + }, }) break } @@ -58,7 +62,12 @@ self.addEventListener('message', async function (event) { sendToClient(client, { type: 'MOCKING_ENABLED', - payload: true, + payload: { + client: { + id: client.id, + frameType: client.frameType, + }, + }, }) break } @@ -151,6 +160,10 @@ async function handleRequest(event, requestId) { async function resolveMainClient(event) { const client = await self.clients.get(event.clientId) + if (activeClientIds.has(event.clientId)) { + return client + } + if (client?.frameType === 'top-level') { return client } @@ -179,12 +192,14 @@ async function getResponse(event, client, requestId) { const requestClone = request.clone() function passthrough() { - const headers = Object.fromEntries(requestClone.headers.entries()) + // Cast the request headers to a new Headers instance + // so the headers can be manipulated with. + const headers = new Headers(requestClone.headers) - // Remove internal MSW request header so the passthrough request - // complies with any potential CORS preflight checks on the server. - // Some servers forbid unknown request headers. - delete headers['x-msw-intention'] + // Remove the "accept" header value that marked this request as passthrough. + // This prevents request alteration and also keeps it compliant with the + // user-defined CORS policies. + headers.delete('accept', 'msw/passthrough') return fetch(requestClone, { headers }) } @@ -202,13 +217,6 @@ async function getResponse(event, client, requestId) { return passthrough() } - // Bypass requests with the explicit bypass header. - // Such requests can be issued by "ctx.fetch()". - const mswIntention = request.headers.get('x-msw-intention') - if (['bypass', 'passthrough'].includes(mswIntention)) { - return passthrough() - } - // Notify the client that a request has been intercepted. const requestBuffer = await request.arrayBuffer() const clientMessage = await sendToClient( @@ -240,7 +248,7 @@ async function getResponse(event, client, requestId) { return respondWithMock(clientMessage.data) } - case 'MOCK_NOT_FOUND': { + case 'PASSTHROUGH': { return passthrough() } } diff --git a/examples/with-jest/package.json b/examples/with-jest/package.json index 53894a4..5f68bdb 100644 --- a/examples/with-jest/package.json +++ b/examples/with-jest/package.json @@ -9,7 +9,7 @@ "@types/jest": "^29.5.1", "@types/node": "^18", "jest": "^29.5.0", - "msw": "2.2.2", + "msw": "2.6.4", "ts-node": "^10.9.2", "typescript": "^5.0.4", "with-angular": "workspace:*", diff --git a/examples/with-karma/package.json b/examples/with-karma/package.json index 01f2593..29fbfce 100644 --- a/examples/with-karma/package.json +++ b/examples/with-karma/package.json @@ -12,7 +12,7 @@ "karma-mocha-reporter": "^2.2.5", "karma-webpack": "^5.0.0", "mocha": "^10.2.0", - "msw": "2.2.2", + "msw": "2.6.4", "webpack": "^5.81.0" }, "msw": { diff --git a/examples/with-karma/test/mockServiceWorker.js b/examples/with-karma/test/mockServiceWorker.js index 0acd8ff..8241ef8 100644 --- a/examples/with-karma/test/mockServiceWorker.js +++ b/examples/with-karma/test/mockServiceWorker.js @@ -2,13 +2,14 @@ /* tslint:disable */ /** - * Mock Service Worker (2.2.2). + * Mock Service Worker. * @see https://github.com/mswjs/msw * - Please do NOT modify this file. * - Please do NOT serve this file on production. */ -const INTEGRITY_CHECKSUM = '223d191a56023cd36aa88c802961b911' +const PACKAGE_VERSION = '2.6.4' +const INTEGRITY_CHECKSUM = 'ca7800994cc8bfb5eb961e037c877074' const IS_MOCKED_RESPONSE = Symbol('isMockedResponse') const activeClientIds = new Set() @@ -48,7 +49,10 @@ self.addEventListener('message', async function (event) { case 'INTEGRITY_CHECK_REQUEST': { sendToClient(client, { type: 'INTEGRITY_CHECK_RESPONSE', - payload: INTEGRITY_CHECKSUM, + payload: { + packageVersion: PACKAGE_VERSION, + checksum: INTEGRITY_CHECKSUM, + }, }) break } @@ -58,7 +62,12 @@ self.addEventListener('message', async function (event) { sendToClient(client, { type: 'MOCKING_ENABLED', - payload: true, + payload: { + client: { + id: client.id, + frameType: client.frameType, + }, + }, }) break } @@ -151,6 +160,10 @@ async function handleRequest(event, requestId) { async function resolveMainClient(event) { const client = await self.clients.get(event.clientId) + if (activeClientIds.has(event.clientId)) { + return client + } + if (client?.frameType === 'top-level') { return client } @@ -179,12 +192,14 @@ async function getResponse(event, client, requestId) { const requestClone = request.clone() function passthrough() { - const headers = Object.fromEntries(requestClone.headers.entries()) + // Cast the request headers to a new Headers instance + // so the headers can be manipulated with. + const headers = new Headers(requestClone.headers) - // Remove internal MSW request header so the passthrough request - // complies with any potential CORS preflight checks on the server. - // Some servers forbid unknown request headers. - delete headers['x-msw-intention'] + // Remove the "accept" header value that marked this request as passthrough. + // This prevents request alteration and also keeps it compliant with the + // user-defined CORS policies. + headers.delete('accept', 'msw/passthrough') return fetch(requestClone, { headers }) } @@ -202,13 +217,6 @@ async function getResponse(event, client, requestId) { return passthrough() } - // Bypass requests with the explicit bypass header. - // Such requests can be issued by "ctx.fetch()". - const mswIntention = request.headers.get('x-msw-intention') - if (['bypass', 'passthrough'].includes(mswIntention)) { - return passthrough() - } - // Notify the client that a request has been intercepted. const requestBuffer = await request.arrayBuffer() const clientMessage = await sendToClient( @@ -240,7 +248,7 @@ async function getResponse(event, client, requestId) { return respondWithMock(clientMessage.data) } - case 'MOCK_NOT_FOUND': { + case 'PASSTHROUGH': { return passthrough() } } diff --git a/examples/with-playwright/app/mockServiceWorker.js b/examples/with-playwright/app/mockServiceWorker.js index 0acd8ff..8241ef8 100644 --- a/examples/with-playwright/app/mockServiceWorker.js +++ b/examples/with-playwright/app/mockServiceWorker.js @@ -2,13 +2,14 @@ /* tslint:disable */ /** - * Mock Service Worker (2.2.2). + * Mock Service Worker. * @see https://github.com/mswjs/msw * - Please do NOT modify this file. * - Please do NOT serve this file on production. */ -const INTEGRITY_CHECKSUM = '223d191a56023cd36aa88c802961b911' +const PACKAGE_VERSION = '2.6.4' +const INTEGRITY_CHECKSUM = 'ca7800994cc8bfb5eb961e037c877074' const IS_MOCKED_RESPONSE = Symbol('isMockedResponse') const activeClientIds = new Set() @@ -48,7 +49,10 @@ self.addEventListener('message', async function (event) { case 'INTEGRITY_CHECK_REQUEST': { sendToClient(client, { type: 'INTEGRITY_CHECK_RESPONSE', - payload: INTEGRITY_CHECKSUM, + payload: { + packageVersion: PACKAGE_VERSION, + checksum: INTEGRITY_CHECKSUM, + }, }) break } @@ -58,7 +62,12 @@ self.addEventListener('message', async function (event) { sendToClient(client, { type: 'MOCKING_ENABLED', - payload: true, + payload: { + client: { + id: client.id, + frameType: client.frameType, + }, + }, }) break } @@ -151,6 +160,10 @@ async function handleRequest(event, requestId) { async function resolveMainClient(event) { const client = await self.clients.get(event.clientId) + if (activeClientIds.has(event.clientId)) { + return client + } + if (client?.frameType === 'top-level') { return client } @@ -179,12 +192,14 @@ async function getResponse(event, client, requestId) { const requestClone = request.clone() function passthrough() { - const headers = Object.fromEntries(requestClone.headers.entries()) + // Cast the request headers to a new Headers instance + // so the headers can be manipulated with. + const headers = new Headers(requestClone.headers) - // Remove internal MSW request header so the passthrough request - // complies with any potential CORS preflight checks on the server. - // Some servers forbid unknown request headers. - delete headers['x-msw-intention'] + // Remove the "accept" header value that marked this request as passthrough. + // This prevents request alteration and also keeps it compliant with the + // user-defined CORS policies. + headers.delete('accept', 'msw/passthrough') return fetch(requestClone, { headers }) } @@ -202,13 +217,6 @@ async function getResponse(event, client, requestId) { return passthrough() } - // Bypass requests with the explicit bypass header. - // Such requests can be issued by "ctx.fetch()". - const mswIntention = request.headers.get('x-msw-intention') - if (['bypass', 'passthrough'].includes(mswIntention)) { - return passthrough() - } - // Notify the client that a request has been intercepted. const requestBuffer = await request.arrayBuffer() const clientMessage = await sendToClient( @@ -240,7 +248,7 @@ async function getResponse(event, client, requestId) { return respondWithMock(clientMessage.data) } - case 'MOCK_NOT_FOUND': { + case 'PASSTHROUGH': { return passthrough() } } diff --git a/examples/with-playwright/package.json b/examples/with-playwright/package.json index 253a8b0..864bc13 100644 --- a/examples/with-playwright/package.json +++ b/examples/with-playwright/package.json @@ -8,7 +8,7 @@ "devDependencies": { "@playwright/test": "^1.40.1", "@web/dev-server": "^0.2.1", - "msw": "2.2.2", + "msw": "2.6.4", "playwright": "^1.33.0", "typescript": "^5.0.4" }, diff --git a/examples/with-remix/package.json b/examples/with-remix/package.json index eda1eed..a1d93e2 100644 --- a/examples/with-remix/package.json +++ b/examples/with-remix/package.json @@ -26,7 +26,7 @@ "@types/react": "^18.0.35", "@types/react-dom": "^18.0.11", "eslint": "^8.38.0", - "msw": "2.2.2", + "msw": "2.6.4", "playwright": "^1.33.0", "typescript": "^4.9.5" }, diff --git a/examples/with-remix/public/mockServiceWorker.js b/examples/with-remix/public/mockServiceWorker.js index 0acd8ff..8241ef8 100644 --- a/examples/with-remix/public/mockServiceWorker.js +++ b/examples/with-remix/public/mockServiceWorker.js @@ -2,13 +2,14 @@ /* tslint:disable */ /** - * Mock Service Worker (2.2.2). + * Mock Service Worker. * @see https://github.com/mswjs/msw * - Please do NOT modify this file. * - Please do NOT serve this file on production. */ -const INTEGRITY_CHECKSUM = '223d191a56023cd36aa88c802961b911' +const PACKAGE_VERSION = '2.6.4' +const INTEGRITY_CHECKSUM = 'ca7800994cc8bfb5eb961e037c877074' const IS_MOCKED_RESPONSE = Symbol('isMockedResponse') const activeClientIds = new Set() @@ -48,7 +49,10 @@ self.addEventListener('message', async function (event) { case 'INTEGRITY_CHECK_REQUEST': { sendToClient(client, { type: 'INTEGRITY_CHECK_RESPONSE', - payload: INTEGRITY_CHECKSUM, + payload: { + packageVersion: PACKAGE_VERSION, + checksum: INTEGRITY_CHECKSUM, + }, }) break } @@ -58,7 +62,12 @@ self.addEventListener('message', async function (event) { sendToClient(client, { type: 'MOCKING_ENABLED', - payload: true, + payload: { + client: { + id: client.id, + frameType: client.frameType, + }, + }, }) break } @@ -151,6 +160,10 @@ async function handleRequest(event, requestId) { async function resolveMainClient(event) { const client = await self.clients.get(event.clientId) + if (activeClientIds.has(event.clientId)) { + return client + } + if (client?.frameType === 'top-level') { return client } @@ -179,12 +192,14 @@ async function getResponse(event, client, requestId) { const requestClone = request.clone() function passthrough() { - const headers = Object.fromEntries(requestClone.headers.entries()) + // Cast the request headers to a new Headers instance + // so the headers can be manipulated with. + const headers = new Headers(requestClone.headers) - // Remove internal MSW request header so the passthrough request - // complies with any potential CORS preflight checks on the server. - // Some servers forbid unknown request headers. - delete headers['x-msw-intention'] + // Remove the "accept" header value that marked this request as passthrough. + // This prevents request alteration and also keeps it compliant with the + // user-defined CORS policies. + headers.delete('accept', 'msw/passthrough') return fetch(requestClone, { headers }) } @@ -202,13 +217,6 @@ async function getResponse(event, client, requestId) { return passthrough() } - // Bypass requests with the explicit bypass header. - // Such requests can be issued by "ctx.fetch()". - const mswIntention = request.headers.get('x-msw-intention') - if (['bypass', 'passthrough'].includes(mswIntention)) { - return passthrough() - } - // Notify the client that a request has been intercepted. const requestBuffer = await request.arrayBuffer() const clientMessage = await sendToClient( @@ -240,7 +248,7 @@ async function getResponse(event, client, requestId) { return respondWithMock(clientMessage.data) } - case 'MOCK_NOT_FOUND': { + case 'PASSTHROUGH': { return passthrough() } } diff --git a/examples/with-svelte/package.json b/examples/with-svelte/package.json index b4db327..a2076ef 100644 --- a/examples/with-svelte/package.json +++ b/examples/with-svelte/package.json @@ -23,7 +23,7 @@ "eslint": "^8.40.0", "eslint-config-prettier": "^8.8.0", "eslint-plugin-svelte": "^2.27.4", - "msw": "2.2.2", + "msw": "2.6.4", "playwright": "^1.33.0", "prettier": "^2.8.8", "prettier-plugin-svelte": "^2.10.0", diff --git a/examples/with-svelte/static/mockServiceWorker.js b/examples/with-svelte/static/mockServiceWorker.js index 1ed37d0..8241ef8 100644 --- a/examples/with-svelte/static/mockServiceWorker.js +++ b/examples/with-svelte/static/mockServiceWorker.js @@ -2,125 +2,134 @@ /* tslint:disable */ /** - * Mock Service Worker (2.2.2). + * Mock Service Worker. * @see https://github.com/mswjs/msw * - Please do NOT modify this file. * - Please do NOT serve this file on production. */ -const INTEGRITY_CHECKSUM = '223d191a56023cd36aa88c802961b911'; -const IS_MOCKED_RESPONSE = Symbol('isMockedResponse'); -const activeClientIds = new Set(); +const PACKAGE_VERSION = '2.6.4' +const INTEGRITY_CHECKSUM = 'ca7800994cc8bfb5eb961e037c877074' +const IS_MOCKED_RESPONSE = Symbol('isMockedResponse') +const activeClientIds = new Set() self.addEventListener('install', function () { - self.skipWaiting(); -}); + self.skipWaiting() +}) self.addEventListener('activate', function (event) { - event.waitUntil(self.clients.claim()); -}); + event.waitUntil(self.clients.claim()) +}) self.addEventListener('message', async function (event) { - const clientId = event.source.id; + const clientId = event.source.id if (!clientId || !self.clients) { - return; + return } - const client = await self.clients.get(clientId); + const client = await self.clients.get(clientId) if (!client) { - return; + return } const allClients = await self.clients.matchAll({ - type: 'window' - }); + type: 'window', + }) switch (event.data) { case 'KEEPALIVE_REQUEST': { sendToClient(client, { - type: 'KEEPALIVE_RESPONSE' - }); - break; + type: 'KEEPALIVE_RESPONSE', + }) + break } case 'INTEGRITY_CHECK_REQUEST': { sendToClient(client, { type: 'INTEGRITY_CHECK_RESPONSE', - payload: INTEGRITY_CHECKSUM - }); - break; + payload: { + packageVersion: PACKAGE_VERSION, + checksum: INTEGRITY_CHECKSUM, + }, + }) + break } case 'MOCK_ACTIVATE': { - activeClientIds.add(clientId); + activeClientIds.add(clientId) sendToClient(client, { type: 'MOCKING_ENABLED', - payload: true - }); - break; + payload: { + client: { + id: client.id, + frameType: client.frameType, + }, + }, + }) + break } case 'MOCK_DEACTIVATE': { - activeClientIds.delete(clientId); - break; + activeClientIds.delete(clientId) + break } case 'CLIENT_CLOSED': { - activeClientIds.delete(clientId); + activeClientIds.delete(clientId) const remainingClients = allClients.filter((client) => { - return client.id !== clientId; - }); + return client.id !== clientId + }) // Unregister itself when there are no more clients if (remainingClients.length === 0) { - self.registration.unregister(); + self.registration.unregister() } - break; + break } } -}); +}) self.addEventListener('fetch', function (event) { - const { request } = event; + const { request } = event // Bypass navigation requests. if (request.mode === 'navigate') { - return; + return } // Opening the DevTools triggers the "only-if-cached" request // that cannot be handled by the worker. Bypass such requests. if (request.cache === 'only-if-cached' && request.mode !== 'same-origin') { - return; + return } // Bypass all requests when there are no active clients. // Prevents the self-unregistered worked from handling requests // after it's been deleted (still remains active until the next reload). if (activeClientIds.size === 0) { - return; + return } // Generate unique request ID. - const requestId = crypto.randomUUID(); - event.respondWith(handleRequest(event, requestId)); -}); + const requestId = crypto.randomUUID() + event.respondWith(handleRequest(event, requestId)) +}) async function handleRequest(event, requestId) { - const client = await resolveMainClient(event); - const response = await getResponse(event, client, requestId); + const client = await resolveMainClient(event) + const response = await getResponse(event, client, requestId) // Send back the response clone for the "response:*" life-cycle events. // Ensure MSW is active and ready to handle the message, otherwise // this message will pend indefinitely. if (client && activeClientIds.has(client.id)) { - (async function () { - const responseClone = response.clone(); + ;(async function () { + const responseClone = response.clone() sendToClient( client, @@ -133,15 +142,15 @@ async function handleRequest(event, requestId) { status: responseClone.status, statusText: responseClone.statusText, body: responseClone.body, - headers: Object.fromEntries(responseClone.headers.entries()) - } + headers: Object.fromEntries(responseClone.headers.entries()), + }, }, - [responseClone.body] - ); - })(); + [responseClone.body], + ) + })() } - return response; + return response } // Resolve the main client for the given event. @@ -149,49 +158,55 @@ async function handleRequest(event, requestId) { // that registered the worker. It's with the latter the worker should // communicate with during the response resolving phase. async function resolveMainClient(event) { - const client = await self.clients.get(event.clientId); + const client = await self.clients.get(event.clientId) + + if (activeClientIds.has(event.clientId)) { + return client + } if (client?.frameType === 'top-level') { - return client; + return client } const allClients = await self.clients.matchAll({ - type: 'window' - }); + type: 'window', + }) return allClients .filter((client) => { // Get only those clients that are currently visible. - return client.visibilityState === 'visible'; + return client.visibilityState === 'visible' }) .find((client) => { // Find the client ID that's recorded in the // set of clients that have registered the worker. - return activeClientIds.has(client.id); - }); + return activeClientIds.has(client.id) + }) } async function getResponse(event, client, requestId) { - const { request } = event; + const { request } = event // Clone the request because it might've been already used // (i.e. its body has been read and sent to the client). - const requestClone = request.clone(); + const requestClone = request.clone() function passthrough() { - const headers = Object.fromEntries(requestClone.headers.entries()); + // Cast the request headers to a new Headers instance + // so the headers can be manipulated with. + const headers = new Headers(requestClone.headers) - // Remove internal MSW request header so the passthrough request - // complies with any potential CORS preflight checks on the server. - // Some servers forbid unknown request headers. - delete headers['x-msw-intention']; + // Remove the "accept" header value that marked this request as passthrough. + // This prevents request alteration and also keeps it compliant with the + // user-defined CORS policies. + headers.delete('accept', 'msw/passthrough') - return fetch(requestClone, { headers }); + return fetch(requestClone, { headers }) } // Bypass mocking when the client is not active. if (!client) { - return passthrough(); + return passthrough() } // Bypass initial page load requests (i.e. static assets). @@ -199,18 +214,11 @@ async function getResponse(event, client, requestId) { // means that MSW hasn't dispatched the "MOCK_ACTIVATE" event yet // and is not ready to handle requests. if (!activeClientIds.has(client.id)) { - return passthrough(); - } - - // Bypass requests with the explicit bypass header. - // Such requests can be issued by "ctx.fetch()". - const mswIntention = request.headers.get('x-msw-intention'); - if (['bypass', 'passthrough'].includes(mswIntention)) { - return passthrough(); + return passthrough() } // Notify the client that a request has been intercepted. - const requestBuffer = await request.arrayBuffer(); + const requestBuffer = await request.arrayBuffer() const clientMessage = await sendToClient( client, { @@ -229,39 +237,42 @@ async function getResponse(event, client, requestId) { referrer: request.referrer, referrerPolicy: request.referrerPolicy, body: requestBuffer, - keepalive: request.keepalive - } + keepalive: request.keepalive, + }, }, - [requestBuffer] - ); + [requestBuffer], + ) switch (clientMessage.type) { case 'MOCK_RESPONSE': { - return respondWithMock(clientMessage.data); + return respondWithMock(clientMessage.data) } - case 'MOCK_NOT_FOUND': { - return passthrough(); + case 'PASSTHROUGH': { + return passthrough() } } - return passthrough(); + return passthrough() } function sendToClient(client, message, transferrables = []) { return new Promise((resolve, reject) => { - const channel = new MessageChannel(); + const channel = new MessageChannel() channel.port1.onmessage = (event) => { if (event.data && event.data.error) { - return reject(event.data.error); + return reject(event.data.error) } - resolve(event.data); - }; + resolve(event.data) + } - client.postMessage(message, [channel.port2].concat(transferrables.filter(Boolean))); - }); + client.postMessage( + message, + [channel.port2].concat(transferrables.filter(Boolean)), + ) + }) } async function respondWithMock(response) { @@ -270,15 +281,15 @@ async function respondWithMock(response) { // instance will have status code set to 0. Since it's not possible to create // a Response instance with status code 0, handle that use-case separately. if (response.status === 0) { - return Response.error(); + return Response.error() } - const mockedResponse = new Response(response.body, response); + const mockedResponse = new Response(response.body, response) Reflect.defineProperty(mockedResponse, IS_MOCKED_RESPONSE, { value: true, - enumerable: true - }); + enumerable: true, + }) - return mockedResponse; + return mockedResponse } diff --git a/examples/with-vitest-cjs/package.json b/examples/with-vitest-cjs/package.json index a43f0b5..e208deb 100644 --- a/examples/with-vitest-cjs/package.json +++ b/examples/with-vitest-cjs/package.json @@ -5,7 +5,7 @@ }, "devDependencies": { "jsdom": "^21.1.1", - "msw": "2.2.2", + "msw": "2.6.4", "typescript": "^5.0.4", "vitest": "^0.30.1" } diff --git a/examples/with-vitest/package.json b/examples/with-vitest/package.json index 2fcd623..4d5882c 100644 --- a/examples/with-vitest/package.json +++ b/examples/with-vitest/package.json @@ -6,7 +6,7 @@ }, "devDependencies": { "jsdom": "^21.1.1", - "msw": "2.2.2", + "msw": "2.6.4", "typescript": "^5.0.4", "vitest": "^0.30.1" } diff --git a/examples/with-vue/package.json b/examples/with-vue/package.json index 3355e3a..6e20c6b 100644 --- a/examples/with-vue/package.json +++ b/examples/with-vue/package.json @@ -23,7 +23,7 @@ "@vue/tsconfig": "^0.1.3", "cypress": "^12.7.0", "jsdom": "^21.1.0", - "msw": "2.2.2", + "msw": "2.6.4", "npm-run-all": "^4.1.5", "start-server-and-test": "^2.0.0", "typescript": "~4.8.4", diff --git a/examples/with-vue/public/mockServiceWorker.js b/examples/with-vue/public/mockServiceWorker.js index 0acd8ff..8241ef8 100644 --- a/examples/with-vue/public/mockServiceWorker.js +++ b/examples/with-vue/public/mockServiceWorker.js @@ -2,13 +2,14 @@ /* tslint:disable */ /** - * Mock Service Worker (2.2.2). + * Mock Service Worker. * @see https://github.com/mswjs/msw * - Please do NOT modify this file. * - Please do NOT serve this file on production. */ -const INTEGRITY_CHECKSUM = '223d191a56023cd36aa88c802961b911' +const PACKAGE_VERSION = '2.6.4' +const INTEGRITY_CHECKSUM = 'ca7800994cc8bfb5eb961e037c877074' const IS_MOCKED_RESPONSE = Symbol('isMockedResponse') const activeClientIds = new Set() @@ -48,7 +49,10 @@ self.addEventListener('message', async function (event) { case 'INTEGRITY_CHECK_REQUEST': { sendToClient(client, { type: 'INTEGRITY_CHECK_RESPONSE', - payload: INTEGRITY_CHECKSUM, + payload: { + packageVersion: PACKAGE_VERSION, + checksum: INTEGRITY_CHECKSUM, + }, }) break } @@ -58,7 +62,12 @@ self.addEventListener('message', async function (event) { sendToClient(client, { type: 'MOCKING_ENABLED', - payload: true, + payload: { + client: { + id: client.id, + frameType: client.frameType, + }, + }, }) break } @@ -151,6 +160,10 @@ async function handleRequest(event, requestId) { async function resolveMainClient(event) { const client = await self.clients.get(event.clientId) + if (activeClientIds.has(event.clientId)) { + return client + } + if (client?.frameType === 'top-level') { return client } @@ -179,12 +192,14 @@ async function getResponse(event, client, requestId) { const requestClone = request.clone() function passthrough() { - const headers = Object.fromEntries(requestClone.headers.entries()) + // Cast the request headers to a new Headers instance + // so the headers can be manipulated with. + const headers = new Headers(requestClone.headers) - // Remove internal MSW request header so the passthrough request - // complies with any potential CORS preflight checks on the server. - // Some servers forbid unknown request headers. - delete headers['x-msw-intention'] + // Remove the "accept" header value that marked this request as passthrough. + // This prevents request alteration and also keeps it compliant with the + // user-defined CORS policies. + headers.delete('accept', 'msw/passthrough') return fetch(requestClone, { headers }) } @@ -202,13 +217,6 @@ async function getResponse(event, client, requestId) { return passthrough() } - // Bypass requests with the explicit bypass header. - // Such requests can be issued by "ctx.fetch()". - const mswIntention = request.headers.get('x-msw-intention') - if (['bypass', 'passthrough'].includes(mswIntention)) { - return passthrough() - } - // Notify the client that a request has been intercepted. const requestBuffer = await request.arrayBuffer() const clientMessage = await sendToClient( @@ -240,7 +248,7 @@ async function getResponse(event, client, requestId) { return respondWithMock(clientMessage.data) } - case 'MOCK_NOT_FOUND': { + case 'PASSTHROUGH': { return passthrough() } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6552c66..67e73f2 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -85,8 +85,8 @@ importers: specifier: 13.0.1 version: 13.0.1(@angular-devkit/build-angular@15.2.10)(@angular/compiler-cli@15.2.10)(@angular/core@15.2.10)(@angular/platform-browser-dynamic@15.2.10)(@babel/core@7.23.7)(jest@29.7.0)(typescript@4.9.5) msw: - specifier: 2.2.2 - version: 2.2.2(typescript@4.9.5) + specifier: 2.6.4 + version: 2.6.4(@types/node@18.19.7)(typescript@4.9.5) start-server-and-test: specifier: ^2.0.0 version: 2.0.3 @@ -115,8 +115,8 @@ importers: specifier: ^29.5.0 version: 29.7.0(@types/node@18.19.7)(ts-node@10.9.2) msw: - specifier: 2.2.2 - version: 2.2.2(typescript@5.3.3) + specifier: 2.6.4 + version: 2.6.4(@types/node@18.19.7)(typescript@5.3.3) ts-node: specifier: ^10.9.2 version: 10.9.2(@swc/core@1.3.103)(@types/node@18.19.7)(typescript@5.3.3) @@ -205,8 +205,8 @@ importers: specifier: ^10.2.0 version: 10.2.0 msw: - specifier: 2.2.2 - version: 2.2.2(typescript@5.3.3) + specifier: 2.6.4 + version: 2.6.4(@types/node@18.19.7)(typescript@5.3.3) webpack: specifier: ^5.81.0 version: 5.89.0 @@ -287,8 +287,8 @@ importers: specifier: ^0.2.1 version: 0.2.5 msw: - specifier: 2.2.2 - version: 2.2.2(typescript@5.3.3) + specifier: 2.6.4 + version: 2.6.4(@types/node@18.19.7)(typescript@5.3.3) playwright: specifier: ^1.33.0 version: 1.40.1 @@ -322,7 +322,7 @@ importers: version: 1.40.1 '@remix-run/dev': specifier: ^1.15.0 - version: 1.19.3(@remix-run/serve@1.19.3) + version: 1.19.3(@remix-run/serve@1.19.3)(@types/node@18.19.7) '@remix-run/eslint-config': specifier: ^1.15.0 version: 1.19.3(eslint@8.56.0)(react@18.2.0)(typescript@4.9.5) @@ -336,8 +336,8 @@ importers: specifier: ^8.38.0 version: 8.56.0 msw: - specifier: 2.2.2 - version: 2.2.2(typescript@4.9.5) + specifier: 2.6.4 + version: 2.6.4(@types/node@18.19.7)(typescript@4.9.5) playwright: specifier: ^1.33.0 version: 1.40.1 @@ -372,8 +372,8 @@ importers: specifier: ^2.27.4 version: 2.35.1(eslint@8.56.0)(svelte@3.59.2) msw: - specifier: 2.2.2 - version: 2.2.2(typescript@5.3.3) + specifier: 2.6.4 + version: 2.6.4(@types/node@18.19.7)(typescript@5.3.3) playwright: specifier: ^1.33.0 version: 1.40.1 @@ -408,8 +408,8 @@ importers: specifier: ^21.1.1 version: 21.1.2 msw: - specifier: 2.2.2 - version: 2.2.2(typescript@5.3.3) + specifier: 2.6.4 + version: 2.6.4(@types/node@18.19.7)(typescript@5.3.3) typescript: specifier: ^5.0.4 version: 5.3.3 @@ -423,8 +423,8 @@ importers: specifier: ^21.1.1 version: 21.1.2 msw: - specifier: 2.2.2 - version: 2.2.2(typescript@5.3.3) + specifier: 2.6.4 + version: 2.6.4(@types/node@18.19.7)(typescript@5.3.3) typescript: specifier: ^5.0.4 version: 5.3.3 @@ -460,8 +460,8 @@ importers: specifier: ^21.1.0 version: 21.1.2 msw: - specifier: 2.2.2 - version: 2.2.2(typescript@4.8.4) + specifier: 2.6.4 + version: 2.6.4(@types/node@18.19.7)(typescript@4.8.4) npm-run-all: specifier: ^4.1.5 version: 4.1.5 @@ -3145,12 +3145,6 @@ packages: resolution: {integrity: sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==} dev: true - /@bundled-es-modules/cookie@2.0.0: - resolution: {integrity: sha512-Or6YHg/kamKHpxULAdSqhGqnWFneIXu1NKvvfBBzKGwpVsYuFIQ5aBPHDnnoR3ghW1nvSkALd+EF9iMtY7Vjxw==} - dependencies: - cookie: 0.5.0 - dev: true - /@bundled-es-modules/cookie@2.0.1: resolution: {integrity: sha512-8o+5fRPLNbjbdGRRmJj3h6Hh1AQJf2dk3qQ/5ZFb+PXkRNiSoMGGUKlsgLfrxneb72axVJyIYji64E2+nNfYyw==} dependencies: @@ -4150,14 +4144,6 @@ packages: resolution: {integrity: sha512-6EwiSjwWYP7pTckG6I5eyFANjPhmPjUX9JRLUSfNPC7FX7zK9gyZAfUEaECL6ALTpGX5AjnBq3C9XmVWPitNpw==} dev: true - /@inquirer/confirm@3.0.0: - resolution: {integrity: sha512-LHeuYP1D8NmQra1eR4UqvZMXwxEdDXyElJmmZfU44xdNLL6+GcQBS0uE16vyfZVjH8c22p9e+DStROfE/hyHrg==} - engines: {node: '>=18'} - dependencies: - '@inquirer/core': 7.0.0 - '@inquirer/type': 1.2.0 - dev: true - /@inquirer/confirm@5.0.2(@types/node@18.19.7): resolution: {integrity: sha512-KJLUHOaKnNCYzwVbryj3TNBxyZIrr56fR5N45v6K9IPrbT6B7DcudBMfylkV1A8PUdJE15mybkEQyp2/ZUpxUA==} engines: {node: '>=18'} @@ -4186,36 +4172,11 @@ packages: - '@types/node' dev: true - /@inquirer/core@7.0.0: - resolution: {integrity: sha512-g13W5yEt9r1sEVVriffJqQ8GWy94OnfxLCreNSOTw0HPVcszmc/If1KIf7YBmlwtX4klmvwpZHnQpl3N7VX2xA==} - engines: {node: '>=18'} - dependencies: - '@inquirer/type': 1.2.0 - '@types/mute-stream': 0.0.4 - '@types/node': 20.11.24 - '@types/wrap-ansi': 3.0.0 - ansi-escapes: 4.3.2 - chalk: 4.1.2 - cli-spinners: 2.9.2 - cli-width: 4.1.0 - figures: 3.2.0 - mute-stream: 1.0.0 - run-async: 3.0.0 - signal-exit: 4.1.0 - strip-ansi: 6.0.1 - wrap-ansi: 6.2.0 - dev: true - /@inquirer/figures@1.0.8: resolution: {integrity: sha512-tKd+jsmhq21AP1LhexC0pPwsCxEhGgAkg28byjJAd+xhmIs8LUX8JbUc3vBf3PhLxWiB5EvyBE5X7JSPAqMAqg==} engines: {node: '>=18'} dev: true - /@inquirer/type@1.2.0: - resolution: {integrity: sha512-/vvkUkYhrjbm+RolU7V1aUFDydZVKNKqKHR5TsE+j5DXgXFwrsOPcoGUJ02K0O7q7O53CU2DOTMYCHeGZ25WHA==} - engines: {node: '>=18'} - dev: true - /@inquirer/type@3.0.1(@types/node@18.19.7): resolution: {integrity: sha512-+ksJMIy92sOAiAccGpcKZUc3bYO07cADnscIxHBknEm3uNts3movSmBofc1908BNy5edKscxYeAdaX1NXkHS6A==} engines: {node: '>=18'} @@ -4568,23 +4529,6 @@ packages: - supports-color dev: true - /@mswjs/cookies@1.1.0: - resolution: {integrity: sha512-0ZcCVQxifZmhwNBoQIrystCb+2sWBY2Zw8lpfJBPCHGCA/HWqehITeCRVIv4VMy8MPlaHo2w2pTHFV2pFfqKPw==} - engines: {node: '>=18'} - dev: true - - /@mswjs/interceptors@0.25.16: - resolution: {integrity: sha512-8QC8JyKztvoGAdPgyZy49c9vSHHAZjHagwl4RY9E8carULk8ym3iTaiawrT1YoLF/qb449h48f71XDPgkUSOUg==} - engines: {node: '>=18'} - dependencies: - '@open-draft/deferred-promise': 2.2.0 - '@open-draft/logger': 0.3.0 - '@open-draft/until': 2.1.0 - is-node-process: 1.2.0 - outvariant: 1.4.2 - strict-event-emitter: 0.5.1 - dev: true - /@mswjs/interceptors@0.36.10: resolution: {integrity: sha512-GXrJgakgJW3DWKueebkvtYgGKkxA7s0u5B0P5syJM5rvQUnrpLPigvci8Hukl7yEM+sU06l+er2Fgvx/gmiRgg==} engines: {node: '>=18'} @@ -4793,7 +4737,7 @@ packages: engines: {node: '>=18.0.0'} dev: false - /@remix-run/dev@1.19.3(@remix-run/serve@1.19.3): + /@remix-run/dev@1.19.3(@remix-run/serve@1.19.3)(@types/node@18.19.7): resolution: {integrity: sha512-Yh733OI0AxR7QbPaJbocujxSF1S5CToDmfZnmv5SlTTIXEw5KfnbCceHy9qhUp0nrkz2YT7pd1zbTEVYIi/Vug==} engines: {node: '>=14.0.0'} hasBin: true @@ -4815,7 +4759,7 @@ packages: '@npmcli/package-json': 2.0.0 '@remix-run/serve': 1.19.3 '@remix-run/server-runtime': 1.19.3 - '@vanilla-extract/integration': 6.2.4 + '@vanilla-extract/integration': 6.2.4(@types/node@18.19.7) arg: 5.0.2 cacache: 15.3.0 chalk: 4.1.2 @@ -5961,12 +5905,6 @@ packages: resolution: {integrity: sha512-nG96G3Wp6acyAgJqGasjODb+acrI7KltPiRxzHPXnP3NgI28bpQDRv53olbqGXbfcgF5aiiHmO3xpwEpS5Ld9g==} dev: true - /@types/mute-stream@0.0.4: - resolution: {integrity: sha512-CPM9nzrCPPJHQNA9keH9CVkVI+WR5kMa+7XEs5jcGQ0VoAGnLv242w8lIVgwAEfmE4oufJRaTc9PNLQl0ioAow==} - dependencies: - '@types/node': 20.11.24 - dev: true - /@types/node-forge@1.3.11: resolution: {integrity: sha512-FQx220y22OKNTqaByeBGqHWYz4cl94tpcxeFdvBo3wjG6XPBuZ0BNgNZRV5J5TFmmcsJ4IzsLkmGRiQbnYsBEQ==} dependencies: @@ -6106,10 +6044,6 @@ packages: resolution: {integrity: sha512-IfYcSBWE3hLpBg8+X2SEa8LVkJdJEkT2Ese2aaLs3ptGdVtABxndrMaxuFlQ1qdFf9Q5rDvDpxI3WwgvKFAsQA==} dev: true - /@types/wrap-ansi@3.0.0: - resolution: {integrity: sha512-ltIpx+kM7g/MLRZfkbL7EsCEjfzCcScLpkg37eXEtx5kmrAKBkTJwd1GIAjDSL8wTpM6Hzn5YO4pSb91BEwu1g==} - dev: true - /@types/ws@7.4.7: resolution: {integrity: sha512-JQbbmxZTZehdc2iszGKs5oC3NFnjeay7mtAWrdt7qNtAVK0g19muApzAy4bm9byz79xa2ZnO/BOBC2R8RC5Lww==} dependencies: @@ -6572,6 +6506,33 @@ packages: - terser dev: true + /@vanilla-extract/integration@6.2.4(@types/node@18.19.7): + resolution: {integrity: sha512-+AfymNMVq9sEUe0OJpdCokmPZg4Zi6CqKaW/PnUOfDwEn53ighHOMOBl5hAgxYR8Kiz9NG43Bn00mkjWlFi+ng==} + dependencies: + '@babel/core': 7.23.7 + '@babel/plugin-syntax-typescript': 7.23.3(@babel/core@7.23.7) + '@vanilla-extract/babel-plugin-debug-ids': 1.0.3 + '@vanilla-extract/css': 1.14.0 + esbuild: 0.17.6 + eval: 0.1.8 + find-up: 5.0.0 + javascript-stringify: 2.1.0 + lodash: 4.17.21 + mlly: 1.5.0 + outdent: 0.8.0 + vite: 4.5.1(@types/node@18.19.7) + vite-node: 0.28.5(@types/node@18.19.7) + transitivePeerDependencies: + - '@types/node' + - less + - lightningcss + - sass + - stylus + - sugarss + - supports-color + - terser + dev: true + /@vanilla-extract/private@1.0.3: resolution: {integrity: sha512-17kVyLq3ePTKOkveHxXuIJZtGYs+cSoev7BlP+Lf4916qfDhk/HBjvlYDe8egrea7LNPHKwSZJK/bzZC+Q6AwQ==} dev: true @@ -14157,22 +14118,23 @@ packages: /ms@2.1.3: resolution: {integrity: sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==} - /msw@2.2.2(typescript@4.8.4): - resolution: {integrity: sha512-Vn3RGCmp14Oy1Lo9yGJMk4+qV/WdK8opNyHt0jdBnvzQ8OEhFvQ2AeM9EXOgQtGLvzUWzqrrwlfwmsCkFViUlg==} + /msw@2.6.4(@types/node@18.19.7)(typescript@4.8.4): + resolution: {integrity: sha512-Pm4LmWQeytDsNCR+A7gt39XAdtH6zQb6jnIKRig0FlvYOn8eksn3s1nXxUfz5KYUjbckof7Z4p2ewzgffPoCbg==} engines: {node: '>=18'} hasBin: true requiresBuild: true peerDependencies: - typescript: '>= 4.7.x <= 5.3.x' + typescript: '>= 4.8.x' peerDependenciesMeta: typescript: optional: true dependencies: - '@bundled-es-modules/cookie': 2.0.0 + '@bundled-es-modules/cookie': 2.0.1 '@bundled-es-modules/statuses': 1.0.1 - '@inquirer/confirm': 3.0.0 - '@mswjs/cookies': 1.1.0 - '@mswjs/interceptors': 0.25.16 + '@bundled-es-modules/tough-cookie': 0.1.6 + '@inquirer/confirm': 5.0.2(@types/node@18.19.7) + '@mswjs/interceptors': 0.36.10 + '@open-draft/deferred-promise': 2.2.0 '@open-draft/until': 2.1.0 '@types/cookie': 0.6.0 '@types/statuses': 2.0.4 @@ -14180,30 +14142,33 @@ packages: graphql: 16.8.1 headers-polyfill: 4.0.2 is-node-process: 1.2.0 - outvariant: 1.4.2 - path-to-regexp: 6.2.1 + outvariant: 1.4.3 + path-to-regexp: 6.3.0 strict-event-emitter: 0.5.1 - type-fest: 4.10.3 + type-fest: 4.26.1 typescript: 4.8.4 yargs: 17.7.2 + transitivePeerDependencies: + - '@types/node' dev: true - /msw@2.2.2(typescript@4.9.5): - resolution: {integrity: sha512-Vn3RGCmp14Oy1Lo9yGJMk4+qV/WdK8opNyHt0jdBnvzQ8OEhFvQ2AeM9EXOgQtGLvzUWzqrrwlfwmsCkFViUlg==} + /msw@2.6.4(@types/node@18.19.7)(typescript@4.9.5): + resolution: {integrity: sha512-Pm4LmWQeytDsNCR+A7gt39XAdtH6zQb6jnIKRig0FlvYOn8eksn3s1nXxUfz5KYUjbckof7Z4p2ewzgffPoCbg==} engines: {node: '>=18'} hasBin: true requiresBuild: true peerDependencies: - typescript: '>= 4.7.x <= 5.3.x' + typescript: '>= 4.8.x' peerDependenciesMeta: typescript: optional: true dependencies: - '@bundled-es-modules/cookie': 2.0.0 + '@bundled-es-modules/cookie': 2.0.1 '@bundled-es-modules/statuses': 1.0.1 - '@inquirer/confirm': 3.0.0 - '@mswjs/cookies': 1.1.0 - '@mswjs/interceptors': 0.25.16 + '@bundled-es-modules/tough-cookie': 0.1.6 + '@inquirer/confirm': 5.0.2(@types/node@18.19.7) + '@mswjs/interceptors': 0.36.10 + '@open-draft/deferred-promise': 2.2.0 '@open-draft/until': 2.1.0 '@types/cookie': 0.6.0 '@types/statuses': 2.0.4 @@ -14211,43 +14176,14 @@ packages: graphql: 16.8.1 headers-polyfill: 4.0.2 is-node-process: 1.2.0 - outvariant: 1.4.2 - path-to-regexp: 6.2.1 + outvariant: 1.4.3 + path-to-regexp: 6.3.0 strict-event-emitter: 0.5.1 - type-fest: 4.10.3 + type-fest: 4.26.1 typescript: 4.9.5 yargs: 17.7.2 - dev: true - - /msw@2.2.2(typescript@5.3.3): - resolution: {integrity: sha512-Vn3RGCmp14Oy1Lo9yGJMk4+qV/WdK8opNyHt0jdBnvzQ8OEhFvQ2AeM9EXOgQtGLvzUWzqrrwlfwmsCkFViUlg==} - engines: {node: '>=18'} - hasBin: true - requiresBuild: true - peerDependencies: - typescript: '>= 4.7.x <= 5.3.x' - peerDependenciesMeta: - typescript: - optional: true - dependencies: - '@bundled-es-modules/cookie': 2.0.0 - '@bundled-es-modules/statuses': 1.0.1 - '@inquirer/confirm': 3.0.0 - '@mswjs/cookies': 1.1.0 - '@mswjs/interceptors': 0.25.16 - '@open-draft/until': 2.1.0 - '@types/cookie': 0.6.0 - '@types/statuses': 2.0.4 - chalk: 4.1.2 - graphql: 16.8.1 - headers-polyfill: 4.0.2 - is-node-process: 1.2.0 - outvariant: 1.4.2 - path-to-regexp: 6.2.1 - strict-event-emitter: 0.5.1 - type-fest: 4.10.3 - typescript: 5.3.3 - yargs: 17.7.2 + transitivePeerDependencies: + - '@types/node' dev: true /msw@2.6.4(@types/node@18.19.7)(typescript@5.3.3): @@ -14305,11 +14241,6 @@ packages: resolution: {integrity: sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==} dev: true - /mute-stream@1.0.0: - resolution: {integrity: sha512-avsJQhyd+680gKXyG/sQc0nXaC6rBkPOfyHYcFb9+hdkqQkR9bdnkJ0AMZhke0oesPqIO+mFFJ+IdBc7mst4IA==} - engines: {node: ^14.17.0 || ^16.13.0 || >=18.0.0} - dev: true - /mute-stream@2.0.0: resolution: {integrity: sha512-WWdIxpyjEn+FhQJQQv9aQAYlHoNVdzIzUySNV1gHUPDSdZJ3yZn7pAAbQcV7B56Mvu881q9FZV+0Vx2xC44VWA==} engines: {node: ^18.17.0 || >=20.5.0} @@ -14777,10 +14708,6 @@ packages: resolution: {integrity: sha512-KiOAIsdpUTcAXuykya5fnVVT+/5uS0Q1mrkRHcF89tpieSmY33O/tmc54CqwA+bfhbtEfZUNLHaPUiB9X3jt1A==} dev: true - /outvariant@1.4.2: - resolution: {integrity: sha512-Ou3dJ6bA/UJ5GVHxah4LnqDwZRwAmWxrG3wtrHrbGnP4RnLCtA64A4F+ae7Y8ww660JaddSoArUR5HjipWSHAQ==} - dev: true - /outvariant@1.4.3: resolution: {integrity: sha512-+Sl2UErvtsoajRDKCE5/dBz4DIvHXQQnAxtQTF04OJxY0+DyZXSo5P5Bb7XYWOh81syohlYL24hbDwxedPUJCA==} dev: true @@ -15063,10 +14990,6 @@ packages: /path-to-regexp@0.1.7: resolution: {integrity: sha512-5DFkuoqlv1uYQKxy8omFBeJPQcdoE07Kv2sferDCrAq1ohOU+MSDswDIbnx3YAM60qIOnYa53wBhXW0EbMonrQ==} - /path-to-regexp@6.2.1: - resolution: {integrity: sha512-JLyh7xT1kizaEvcaXOQwOc2/Yhw6KZOvPf1S8401UyLk86CU79LN3vl7ztXGm/pZ+YjoyAJ4rxmHwbkBXJX+yw==} - dev: true - /path-to-regexp@6.3.0: resolution: {integrity: sha512-Yhpw4T9C6hPpgPeA28us07OJeqZ5EzQTkbfwuhsUg0c237RomFoETJgmp2sa3F/41gfLE6G5cqcYwznmeEeOlQ==} dev: true @@ -16079,11 +16002,6 @@ packages: engines: {node: '>=0.12.0'} dev: true - /run-async@3.0.0: - resolution: {integrity: sha512-540WwVDOMxA6dN6We19EcT9sc3hkXPw5mzRNGM3FkdN/vtE9NFvj5lFAPNwUDmJjXidm3v7TC1cTE7t17Ulm1Q==} - engines: {node: '>=0.12.0'} - dev: true - /run-parallel@1.2.0: resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==} dependencies: @@ -17566,11 +17484,6 @@ packages: engines: {node: '>=10'} dev: true - /type-fest@4.10.3: - resolution: {integrity: sha512-JLXyjizi072smKGGcZiAJDCNweT8J+AuRxmPZ1aG7TERg4ijx9REl8CNhbr36RV4qXqL1gO1FF9HL8OkVmmrsA==} - engines: {node: '>=16'} - dev: true - /type-fest@4.26.1: resolution: {integrity: sha512-yOGpmOAL7CkKe/91I5O3gPICmJNLJ1G4zFYVAsRHg7M64biSnPtRj0WNQt++bRkjYOqjWXrhnUw1utzmVErAdg==} engines: {node: '>=16'} @@ -17989,6 +17902,30 @@ packages: - terser dev: true + /vite-node@0.28.5(@types/node@18.19.7): + resolution: {integrity: sha512-LmXb9saMGlrMZbXTvOveJKwMTBTNUH66c8rJnQ0ZPNX+myPEol64+szRzXtV5ORb0Hb/91yq+/D3oERoyAt6LA==} + engines: {node: '>=v14.16.0'} + hasBin: true + dependencies: + cac: 6.7.14 + debug: 4.3.4(supports-color@8.1.1) + mlly: 1.5.0 + pathe: 1.1.2 + picocolors: 1.0.0 + source-map: 0.6.1 + source-map-support: 0.5.21 + vite: 4.5.1(@types/node@18.19.7) + transitivePeerDependencies: + - '@types/node' + - less + - lightningcss + - sass + - stylus + - sugarss + - supports-color + - terser + dev: true + /vite-node@0.29.8(@types/node@18.19.7): resolution: {integrity: sha512-b6OtCXfk65L6SElVM20q5G546yu10/kNrhg08afEoWlFRJXFq9/6glsvSVY+aI6YeC1tu2TtAqI2jHEQmOmsFw==} engines: {node: '>=v14.16.0'}