diff --git a/CHANGELOG.md b/CHANGELOG.md index c78e29fa62ae..2de9a1f7882f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +## 8.0.5 + +- Addon-docs: Fix `react-dom/server` imports breaking stories and docs - [#26557](https://github.com/storybookjs/storybook/pull/26557), thanks @JReinhold! +- Automigrations: Fix missing support for mts vite config - [#26441](https://github.com/storybookjs/storybook/pull/26441), thanks @drik98! +- CLI: Improve Yarn berry error parsing - [#26616](https://github.com/storybookjs/storybook/pull/26616), thanks @yannbf! +- React-Docgen: Make sure to be able to handle empty unions - [#26639](https://github.com/storybookjs/storybook/pull/26639), thanks @kasperpeulen! +- Viewport: Fix missing style - [#26530](https://github.com/storybookjs/storybook/pull/26530), thanks @jpzwarte! + ## 8.0.4 - Addon Docs: Support Stencil based display names in source snippets - [#26592](https://github.com/storybookjs/storybook/pull/26592), thanks @yannbf! diff --git a/CHANGELOG.prerelease.md b/CHANGELOG.prerelease.md index a956bce6d243..ada76261b3cb 100644 --- a/CHANGELOG.prerelease.md +++ b/CHANGELOG.prerelease.md @@ -1,3 +1,13 @@ +## 8.1.0-alpha.6 + +- CLI: Add --config-dir flag to migrate command - [#26721](https://github.com/storybookjs/storybook/pull/26721), thanks @yannbf! +- Core: Add `duration` and `onClick` support to Notification API and improve Notification UI - [#26696](https://github.com/storybookjs/storybook/pull/26696), thanks @ghengeveld! +- Dependency: Bump es-module-lexer - [#26737](https://github.com/storybookjs/storybook/pull/26737), thanks @valentinpalkovic! +- Dependency: Update globby dependency - [#26733](https://github.com/storybookjs/storybook/pull/26733), thanks @valentinpalkovic! +- Dependency: Update postcss-loader in Next.js framework - [#26707](https://github.com/storybookjs/storybook/pull/26707), thanks @valentinpalkovic! +- Next.js: Fix next/font usage on Windows machines - [#26700](https://github.com/storybookjs/storybook/pull/26700), thanks @valentinpalkovic! +- Webpack: Fix sourcemap generation in webpack react-docgen-loader - [#26676](https://github.com/storybookjs/storybook/pull/26676), thanks @valentinpalkovic! + ## 8.1.0-alpha.5 - Addon-docs: Fix `react-dom/server` imports breaking stories and docs - [#26557](https://github.com/storybookjs/storybook/pull/26557), thanks @JReinhold! diff --git a/code/builders/builder-vite/package.json b/code/builders/builder-vite/package.json index 33a9b5ce1edb..f8967dca56fb 100644 --- a/code/builders/builder-vite/package.json +++ b/code/builders/builder-vite/package.json @@ -54,7 +54,7 @@ "@storybook/types": "workspace:*", "@types/find-cache-dir": "^3.2.1", "browser-assert": "^1.2.1", - "es-module-lexer": "^0.9.3", + "es-module-lexer": "^1.5.0", "express": "^4.17.3", "find-cache-dir": "^3.0.0", "fs-extra": "^11.1.0", diff --git a/code/builders/builder-vite/src/plugins/inject-export-order-plugin.ts b/code/builders/builder-vite/src/plugins/inject-export-order-plugin.ts index 621dae80e647..9587b23fdaf7 100644 --- a/code/builders/builder-vite/src/plugins/inject-export-order-plugin.ts +++ b/code/builders/builder-vite/src/plugins/inject-export-order-plugin.ts @@ -19,12 +19,14 @@ export async function injectExportOrderPlugin() { // instead of calling `await parse()` every time. const [, exports] = await parse(code); - if (exports.includes('__namedExportsOrder')) { + const exportNames = exports.map((e) => code.substring(e.s, e.e)); + + if (exportNames.includes('__namedExportsOrder')) { // user has defined named exports already return undefined; } const s = new MagicString(code); - const orderedExports = exports.filter((e) => e !== 'default'); + const orderedExports = exportNames.filter((e) => e !== 'default'); s.append(`;export const __namedExportsOrder = ${JSON.stringify(orderedExports)};`); return { code: s.toString(), diff --git a/code/builders/builder-webpack5/package.json b/code/builders/builder-webpack5/package.json index 86a394065112..ffd1e7dff39a 100644 --- a/code/builders/builder-webpack5/package.json +++ b/code/builders/builder-webpack5/package.json @@ -78,7 +78,7 @@ "cjs-module-lexer": "^1.2.3", "constants-browserify": "^1.0.0", "css-loader": "^6.7.1", - "es-module-lexer": "^1.4.1", + "es-module-lexer": "^1.5.0", "express": "^4.17.3", "fork-ts-checker-webpack-plugin": "^8.0.0", "fs-extra": "^11.1.0", diff --git a/code/frameworks/nextjs/package.json b/code/frameworks/nextjs/package.json index a24a7896181f..a4fdc13f0c88 100644 --- a/code/frameworks/nextjs/package.json +++ b/code/frameworks/nextjs/package.json @@ -108,8 +108,8 @@ "loader-utils": "^3.2.1", "node-polyfill-webpack-plugin": "^2.0.1", "pnp-webpack-plugin": "^1.7.0", - "postcss": "^8.4.21", - "postcss-loader": "^7.0.2", + "postcss": "^8.4.38", + "postcss-loader": "^8.1.1", "react-refresh": "^0.14.0", "resolve-url-loader": "^5.0.0", "sass-loader": "^12.4.0", diff --git a/code/frameworks/nextjs/src/css/webpack.ts b/code/frameworks/nextjs/src/css/webpack.ts index 75718527e7dd..f6c7d7838f0a 100644 --- a/code/frameworks/nextjs/src/css/webpack.ts +++ b/code/frameworks/nextjs/src/css/webpack.ts @@ -36,7 +36,7 @@ export const configureCss = (baseConfig: WebpackConfig, nextConfig: NextConfig): ], // We transform the "target.css" files from next.js into Javascript // for Next.js to support fonts, so it should be ignored by the css-loader. - exclude: /next\/.*\/target.css$/, + exclude: /next(\\|\/|\\\\).*(\\|\/|\\\\)target\.css$/, }; } }); diff --git a/code/frameworks/nextjs/src/font/webpack/configureNextFont.ts b/code/frameworks/nextjs/src/font/webpack/configureNextFont.ts index b1e3851611d6..bd3f1640ff36 100644 --- a/code/frameworks/nextjs/src/font/webpack/configureNextFont.ts +++ b/code/frameworks/nextjs/src/font/webpack/configureNextFont.ts @@ -7,7 +7,7 @@ export function configureNextFont(baseConfig: Configuration, isSWC?: boolean) { if (isSWC) { baseConfig.module?.rules?.push({ - test: /next\/.*\/target.css$/, + test: /next(\\|\/|\\\\).*(\\|\/|\\\\)target\.css$/, loader: fontLoaderPath, }); } else { diff --git a/code/frameworks/nextjs/src/font/webpack/loader/local/get-font-face-declarations.ts b/code/frameworks/nextjs/src/font/webpack/loader/local/get-font-face-declarations.ts index f3f35c2fc065..e980d15b0e3d 100644 --- a/code/frameworks/nextjs/src/font/webpack/loader/local/get-font-face-declarations.ts +++ b/code/frameworks/nextjs/src/font/webpack/loader/local/get-font-face-declarations.ts @@ -39,13 +39,9 @@ export async function getFontFaceDeclarations( .map(({ prop, value }: { prop: string; value: string }) => `${prop}: ${value};`) .join('\n'); - const arePathsWin32Format = /^[a-z]:\\/iu.test(options.filename); - const cleanWin32Path = (pathString: string): string => - arePathsWin32Format ? pathString.replace(/\\/gu, '/') : pathString; - const getFontFaceCSS = () => { if (typeof localFontSrc === 'string') { - const localFontPath = cleanWin32Path(path.join(parentFolder, localFontSrc)); + const localFontPath = path.join(parentFolder, localFontSrc).replaceAll('\\', '/'); return `@font-face { font-family: ${id}; @@ -55,7 +51,7 @@ export async function getFontFaceDeclarations( } return localFontSrc .map((font) => { - const localFontPath = cleanWin32Path(path.join(parentFolder, font.path)); + const localFontPath = path.join(parentFolder, font.path).replaceAll('\\', '/'); return `@font-face { font-family: ${id}; diff --git a/code/frameworks/nextjs/src/font/webpack/loader/storybook-nextjs-font-loader.ts b/code/frameworks/nextjs/src/font/webpack/loader/storybook-nextjs-font-loader.ts index 2110701aae61..055d934f57a4 100644 --- a/code/frameworks/nextjs/src/font/webpack/loader/storybook-nextjs-font-loader.ts +++ b/code/frameworks/nextjs/src/font/webpack/loader/storybook-nextjs-font-loader.ts @@ -3,6 +3,7 @@ import { getFontFaceDeclarations as getLocalFontFaceDeclarations } from './local import type { LoaderOptions } from './types'; import { getCSSMeta } from './utils/get-css-meta'; import { setFontDeclarationsInHead } from './utils/set-font-declarations-in-head'; +import path from 'path'; type FontFaceDeclaration = { id: string; @@ -39,11 +40,19 @@ export default async function storybookNextjsFontLoader(this: any) { let fontFaceDeclaration: FontFaceDeclaration | undefined; - if (options.source.endsWith('next/font/google') || options.source.endsWith('@next/font/google')) { + const pathSep = path.sep; + + if ( + options.source.endsWith(`next${pathSep}font${pathSep}google`) || + options.source.endsWith(`@next${pathSep}font${pathSep}google`) + ) { fontFaceDeclaration = await getGoogleFontFaceDeclarations(options); } - if (options.source.endsWith('next/font/local') || options.source.endsWith('@next/font/local')) { + if ( + options.source.endsWith(`next${pathSep}font${pathSep}local`) || + options.source.endsWith(`@next${pathSep}font${pathSep}local`) + ) { fontFaceDeclaration = await getLocalFontFaceDeclarations(options, rootCtx, swcMode); } diff --git a/code/lib/cli/package.json b/code/lib/cli/package.json index 3c0c985c8963..b54f29308a15 100644 --- a/code/lib/cli/package.json +++ b/code/lib/cli/package.json @@ -80,7 +80,7 @@ "fs-extra": "^11.1.0", "get-npm-tarball-url": "^2.0.3", "giget": "^1.0.0", - "globby": "^11.0.2", + "globby": "^14.0.1", "jscodeshift": "^0.15.1", "leven": "^3.1.0", "ora": "^5.4.1", diff --git a/code/lib/cli/src/automigrate/fixes/mdx-1-to-3.ts b/code/lib/cli/src/automigrate/fixes/mdx-1-to-3.ts index 3d81d0934447..8b556033a6ac 100644 --- a/code/lib/cli/src/automigrate/fixes/mdx-1-to-3.ts +++ b/code/lib/cli/src/automigrate/fixes/mdx-1-to-3.ts @@ -2,7 +2,6 @@ import chalk from 'chalk'; import { dedent } from 'ts-dedent'; import { basename } from 'path'; import fse from 'fs-extra'; -import globby from 'globby'; import type { Fix } from '../types'; const MDX1_STYLE_START = /