Skip to content

Commit

Permalink
upgrade to Storybook 8.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
yannbf committed Feb 25, 2025
1 parent 25a392e commit 44596a7
Show file tree
Hide file tree
Showing 4 changed files with 643 additions and 525 deletions.
22 changes: 11 additions & 11 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,19 @@
"@babel/core": "^7.14.6",
"@chromatic-com/storybook": "^3.2.1",
"@ladle/react": "^4.1.2",
"@storybook/addon-a11y": "^8.5.0",
"@storybook/addon-a11y": "^8.6.0",
"@storybook/addon-coverage": "^1.0.4",
"@storybook/addon-designs": "^8.0.3",
"@storybook/addon-essentials": "^8.5.0",
"@storybook/addon-themes": "^8.5.0",
"@storybook/blocks": "^8.5.0",
"@storybook/experimental-addon-test": "^8.5.0",
"@storybook/manager-api": "^8.5.0",
"@storybook/react": "^8.5.0",
"@storybook/react-vite": "^8.5.0",
"@storybook/test": "^8.5.0",
"@storybook/addon-essentials": "^8.6.0",
"@storybook/addon-themes": "^8.6.0",
"@storybook/blocks": "^8.6.0",
"@storybook/experimental-addon-test": "^8.6.0",
"@storybook/manager-api": "^8.6.0",
"@storybook/react": "^8.6.0",
"@storybook/react-vite": "^8.6.0",
"@storybook/test": "^8.6.0",
"@storybook/test-runner": "^0.19.1",
"@storybook/theming": "^8.5.0",
"@storybook/theming": "^8.6.0",
"@testing-library/jest-dom": "^6.4.6",
"@testing-library/react": "^16.0.0",
"@testing-library/react-hooks": "^8.0.1",
Expand Down Expand Up @@ -112,7 +112,7 @@
"prettier": "^3.2.5",
"react-is": "^18.3.1",
"react-test-renderer": "^18.3.1",
"storybook": "^8.5.0",
"storybook": "^8.6.0",
"vite": "^4.0.0",
"vite-plugin-svgr": "^4.2.0",
"vitest": "2.1.2",
Expand Down
39 changes: 31 additions & 8 deletions public/mockServiceWorker.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
* - Please do NOT serve this file on production.
*/

const PACKAGE_VERSION = '2.4.9'
const INTEGRITY_CHECKSUM = '26357c79639bfa20d64c0efca2a87423'
const PACKAGE_VERSION = '2.7.3'
const INTEGRITY_CHECKSUM = '00729d72e3b82faf54ca8b9621dbb96f'
const IS_MOCKED_RESPONSE = Symbol('isMockedResponse')
const activeClientIds = new Set()

Expand Down Expand Up @@ -62,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
}
Expand Down Expand Up @@ -155,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
}
Expand Down Expand Up @@ -183,12 +192,26 @@ 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 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.
const acceptHeader = headers.get('accept')
if (acceptHeader) {
const values = acceptHeader.split(',').map((value) => value.trim())
const filteredValues = values.filter(
(value) => value !== 'msw/passthrough',
)

// 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']
if (filteredValues.length > 0) {
headers.set('accept', filteredValues.join(', '))
} else {
headers.delete('accept')
}
}

return fetch(requestClone, { headers })
}
Expand Down
2 changes: 0 additions & 2 deletions vitest.workspace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ export default defineWorkspace([
name: 'chromium',
provider: 'playwright',
},
// Make sure to adjust this pattern to match your stories files.
include: ['**/*.stories.?(m)[jt]s?(x)'],
setupFiles: ['.storybook/vitest.setup.ts'],
},
},
Expand Down
Loading

0 comments on commit 44596a7

Please sign in to comment.