Upgrade Storybook to version 9

Signed-off-by: Charles de Dreuille <charles.dedreuille@gmail.com>
This commit is contained in:
Charles de Dreuille
2025-09-14 14:37:55 +01:00
parent f58e7f1d0d
commit ffac5071fe
38 changed files with 506 additions and 729 deletions
+47
View File
@@ -0,0 +1,47 @@
// MSW v2 browser compatibility shim for @vitest/mocker
// This provides MSW v2 exports using MSW v1 APIs to maintain compatibility
// while keeping the rest of the monorepo on MSW v1
try {
// Try to import from MSW v1
const { setupWorker, rest } = require('msw');
// Export in MSW v2 format expected by @vitest/mocker
module.exports = {
setupWorker,
// MSW v2 uses 'http' instead of 'rest', but we provide both for compatibility
http: rest,
rest, // Keep rest for any MSW v1 code
};
} catch (error) {
// Fallback if MSW is not available - provide minimal mock
console.warn(
'MSW not available, providing minimal mock for @vitest/mocker compatibility',
);
module.exports = {
setupWorker: () => ({
start: () => Promise.resolve(),
stop: () => {},
use: () => {},
resetHandlers: () => {},
}),
http: {
get: () => {},
post: () => {},
put: () => {},
delete: () => {},
patch: () => {},
head: () => {},
options: () => {},
},
rest: {
get: () => {},
post: () => {},
put: () => {},
delete: () => {},
patch: () => {},
head: () => {},
options: () => {},
},
};
}