From 1c3e6f1e18347a2b93e5b274afb82d7599b81441 Mon Sep 17 00:00:00 2001 From: Jeppe Reinhold Date: Fri, 10 May 2024 00:09:08 +0200 Subject: [PATCH 1/2] change nextjs compatibility map to have more precise versions --- .../nextjs/src/compatibility/compatibility-map.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/code/frameworks/nextjs/src/compatibility/compatibility-map.ts b/code/frameworks/nextjs/src/compatibility/compatibility-map.ts index 96c8459e0fee..ee7b43f5be40 100644 --- a/code/frameworks/nextjs/src/compatibility/compatibility-map.ts +++ b/code/frameworks/nextjs/src/compatibility/compatibility-map.ts @@ -3,8 +3,12 @@ import semver from 'semver'; import { getNextjsVersion, addScopedAlias } from '../utils'; const mapping: Record> = { - '<14.0.0': { + '<14.1.0': { + // https://github.com/vercel/next.js/blob/v14.1.0/packages/next/src/shared/lib/segment.ts 'next/dist/shared/lib/segment': '@storybook/nextjs/dist/compatibility/segment.compat', + }, + '<14.0.4': { + // https://github.com/vercel/next.js/blob/v14.0.4/packages/next/src/client/components/redirect-status-code.ts 'next/dist/client/components/redirect-status-code': '@storybook/nextjs/dist/compatibility/redirect-status-code.compat', }, From 64c5b49dae447016c0ac163e120885b827be36fb Mon Sep 17 00:00:00 2001 From: Jeppe Reinhold Date: Fri, 10 May 2024 00:09:56 +0200 Subject: [PATCH 2/2] improve readability of nextjs compatibility mapping --- code/frameworks/nextjs/src/compatibility/compatibility-map.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/code/frameworks/nextjs/src/compatibility/compatibility-map.ts b/code/frameworks/nextjs/src/compatibility/compatibility-map.ts index ee7b43f5be40..f423ee1db0fc 100644 --- a/code/frameworks/nextjs/src/compatibility/compatibility-map.ts +++ b/code/frameworks/nextjs/src/compatibility/compatibility-map.ts @@ -18,7 +18,7 @@ export const getCompatibilityAliases = () => { const version = getNextjsVersion(); const result: Record = {}; - Object.keys(mapping).filter((key) => { + Object.keys(mapping).forEach((key) => { if (semver.intersects(version, key)) { Object.assign(result, mapping[key]); }