Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release: Prerelease 8.5.0-beta.8 #30156

Merged
merged 48 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
fcd2b24
Docs fixes found during 8.5 QA
kylegach Dec 18, 2024
8cbd0ca
Correct `viteFinal` guidance
kylegach Dec 19, 2024
eaaa59b
Add MSW version requirement
kylegach Dec 23, 2024
6814085
UI: Fix overlapping shadow of testing module on scrollbar
valentinpalkovic Dec 24, 2024
50a61c5
Add webpack-to-vite migration guidance
kylegach Dec 27, 2024
0f5424c
Docs: A11y minor fixes
jonniebigodes Dec 28, 2024
ac11562
Removes the outdated addon screenshot
jonniebigodes Dec 28, 2024
c321ce9
Merge pull request #30153 from storybookjs/docs_fix_broken_a11y_links
valentinpalkovic Dec 30, 2024
2cb8bdb
Merge pull request #30103 from storybookjs/8-5-docs-fixes
valentinpalkovic Dec 30, 2024
494cdc3
Merge pull request #30132 from storybookjs/valentin/fix-overlapping-s…
valentinpalkovic Dec 30, 2024
f2560a6
move @types/node to devDeps consistently
ndelangen Jan 2, 2025
2eb8766
Merge branch 'next' into norbert/node-types-devdep-only
ndelangen Jan 2, 2025
e9a7adb
fix incorrect move of dep to peerDep
ndelangen Jan 2, 2025
0556bd2
Fix mistakes in #30103
kylegach Jan 2, 2025
fbf01bd
Merge pull request #30176 from storybookjs/8-5-docs-fixes-2
kylegach Jan 2, 2025
acb6a30
add ts-ignore
ndelangen Jan 3, 2025
b9f251a
Merge branch 'next' of https://github.com/storybookjs/storybook into …
ndelangen Jan 3, 2025
3827d83
Merge branch 'next' into norbert/node-types-devdep-only
ndelangen Jan 3, 2025
2183c2d
bump `vue-tsc` to v2, see https://github.com/vuejs/language-tools/iss…
ndelangen Jan 3, 2025
de65bec
Merge pull request #30163 from storybookjs/norbert/node-types-devdep-…
ndelangen Jan 3, 2025
60c06af
fix: add extra babel plugin to handle node modules
dannyhw Jan 4, 2025
9149ae8
fix: comment
dannyhw Jan 4, 2025
7f181a0
fix: add dependency
dannyhw Jan 4, 2025
30ddce6
fix: lock
dannyhw Jan 4, 2025
1fd1509
fix: remove expo preset and reduce to just the important plugins
dannyhw Jan 5, 2025
cb64e89
fix: comments
dannyhw Jan 5, 2025
d28b7be
fix: remove uneeded expo os env
dannyhw Jan 5, 2025
f3fdb8a
fix: remove require thing for now
dannyhw Jan 5, 2025
90ef869
better comments
dannyhw Jan 5, 2025
7794b8e
split up config for the babel plugin
dannyhw Jan 5, 2025
2db1781
fix: preset react options and make them an object
dannyhw Jan 5, 2025
30f7368
fix: oops types
dannyhw Jan 5, 2025
b0aac2a
fix: dont run vite config migraiton for rnw
dannyhw Jan 5, 2025
45e96d3
test: test for react-native-web-vite exception
dannyhw Jan 5, 2025
2adf23d
Manager: Optimize getPanels function with memoization
valentinpalkovic Jan 6, 2025
cc60f03
React: Force act running always in sequence
valentinpalkovic Jan 6, 2025
103267b
Rename `a11ytest` tag to `a11y-test`
kylegach Jan 6, 2025
4162860
Merge pull request #30190 from storybookjs/danny/rnw-doesnt-require-v…
shilman Jan 6, 2025
89d1d0e
Merge pull request #30192 from storybookjs/valentin/add-memoization-f…
valentinpalkovic Jan 7, 2025
5f976fc
refactor: streamline promise handling in renderToCanvas function
valentinpalkovic Jan 7, 2025
3139720
Fix tests
valentinpalkovic Jan 7, 2025
b066e56
refactor: change return type of renderToCanvas cleanup function to async
valentinpalkovic Jan 7, 2025
c4542a2
always use process.cwd() for paths in importFn()
JReinhold Jan 7, 2025
732f0c3
Merge pull request #30198 from storybookjs/docs-a11y-test-tag
valentinpalkovic Jan 7, 2025
b59cfc1
Merge pull request #30206 from storybookjs/jeppe/fix-projectroot
JReinhold Jan 7, 2025
f6a6867
Merge pull request #30191 from storybookjs/valentin/fix-act-running-s…
valentinpalkovic Jan 7, 2025
77c0a57
Merge pull request #30188 from storybookjs/danny/fix-rnw-transpile-no…
shilman Jan 7, 2025
ca42774
Write changelog for 8.5.0-beta.8 [skip ci]
storybook-bot Jan 7, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.prerelease.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
## 8.5.0-beta.8

- Automigrations: Skip vite config file migration for react native web - [#30190](https://github.com/storybookjs/storybook/pull/30190), thanks @dannyhw!
- Maintenance: Move `@types/node` to `devDeps` consistently - [#30163](https://github.com/storybookjs/storybook/pull/30163), thanks @ndelangen!
- Manager: Optimize getPanels function with memoization - [#30192](https://github.com/storybookjs/storybook/pull/30192), thanks @valentinpalkovic!
- RNW-Vite: Fix reanimated support with babel plugin for node_modules - [#30188](https://github.com/storybookjs/storybook/pull/30188), thanks @dannyhw!
- React: Force act running always in sequence - [#30191](https://github.com/storybookjs/storybook/pull/30191), thanks @valentinpalkovic!
- UI: Fix overlapping shadow of testing module on scrollbar - [#30132](https://github.com/storybookjs/storybook/pull/30132), thanks @valentinpalkovic!
- Vite: Fix wrong import paths when configDir is not in project root - [#30206](https://github.com/storybookjs/storybook/pull/30206), thanks @JReinhold!

## 8.5.0-beta.7

- Addon Test: Context menu updates - [#30107](https://github.com/storybookjs/storybook/pull/30107), thanks @ghengeveld!
Expand Down
Binary file removed code/addons/a11y/docs/screenshot.png
Binary file not shown.
3 changes: 2 additions & 1 deletion code/addons/test/src/components/TestProviderRender.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,8 @@ export const TestProviderRender: FC<
icon={
state.crashed ? (
<TestStatusIcon status="critical" aria-label="status: crashed" />
) : status === 'unknown' ? (
) : // @ts-expect-error: TODO: Fix types
status === 'unknown' ? (
<TestStatusIcon status="unknown" aria-label="status: unknown" />
) : (
<TestStatusIcon status={statusMap[status]} aria-label={`status: ${status}`} />
Expand Down
13 changes: 7 additions & 6 deletions code/builders/builder-vite/src/codegen-importfn-script.test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { beforeEach, describe, expect, it, vi } from 'vitest';
import { describe, expect, it, vi } from 'vitest';

import { toImportFn } from './codegen-importfn-script';

describe('toImportFn', () => {
it('should correctly map story paths to import functions for absolute paths on Linux', async () => {
const root = '/absolute/path';
vi.spyOn(process, 'cwd').mockReturnValue('/absolute/path');

const stories = ['/absolute/path/to/story1.js', '/absolute/path/to/story2.js'];

const result = await toImportFn(root, stories);
const result = await toImportFn(stories);

expect(result).toMatchInlineSnapshot(`
"const importers = {
Expand All @@ -22,10 +23,10 @@ describe('toImportFn', () => {
});

it('should correctly map story paths to import functions for absolute paths on Windows', async () => {
const root = 'C:\\absolute\\path';
vi.spyOn(process, 'cwd').mockReturnValue('C:\\absolute\\path');
const stories = ['C:\\absolute\\path\\to\\story1.js', 'C:\\absolute\\path\\to\\story2.js'];

const result = await toImportFn(root, stories);
const result = await toImportFn(stories);

expect(result).toMatchInlineSnapshot(`
"const importers = {
Expand All @@ -43,7 +44,7 @@ describe('toImportFn', () => {
const root = '/absolute/path';
const stories: string[] = [];

const result = await toImportFn(root, stories);
const result = await toImportFn(stories);

expect(result).toMatchInlineSnapshot(`
"const importers = {};
Expand Down
6 changes: 3 additions & 3 deletions code/builders/builder-vite/src/codegen-importfn-script.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ function toImportPath(relativePath: string) {
*
* @param stories An array of absolute story paths.
*/
export async function toImportFn(root: string, stories: string[]) {
export async function toImportFn(stories: string[]) {
const objectEntries = stories.map((file) => {
const relativePath = relative(root, file);
const relativePath = relative(process.cwd(), file);

return [toImportPath(relativePath), genDynamicImport(normalize(file))] as [string, string];
});
Expand All @@ -51,5 +51,5 @@ export async function generateImportFnScriptCode(options: Options): Promise<stri

// We can then call toImportFn to create a function that can be used to load each story dynamically.
// eslint-disable-next-line @typescript-eslint/return-await
return await toImportFn(options.projectRoot || process.cwd(), stories);
return await toImportFn(stories);
}
6 changes: 3 additions & 3 deletions code/builders/builder-vite/src/vite-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,18 +53,18 @@ export async function commonConfig(

const { viteConfigPath } = await getBuilderOptions<BuilderOptions>(options);

options.projectRoot = options.projectRoot || resolve(options.configDir, '..');
const projectRoot = resolve(options.configDir, '..');

// I destructure away the `build` property from the user's config object
// I do this because I can contain config that breaks storybook, such as we had in a lit project.
// If the user needs to configure the `build` they need to do so in the viteFinal function in main.js.
const { config: { build: buildProperty = undefined, ...userConfig } = {} } =
(await loadConfigFromFile(configEnv, viteConfigPath, options.projectRoot)) ?? {};
(await loadConfigFromFile(configEnv, viteConfigPath, projectRoot)) ?? {};

const sbConfig: InlineConfig = {
configFile: false,
cacheDir: resolvePathInStorybookCache('sb-vite', options.cacheKey),
root: options.projectRoot,
root: projectRoot,
// Allow storybook deployed as subfolder. See https://github.com/storybookjs/builder-vite/issues/238
base: './',
plugins: await pluginConfig(options),
Expand Down
2 changes: 1 addition & 1 deletion code/builders/builder-webpack5/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@
},
"dependencies": {
"@storybook/core-webpack": "workspace:*",
"@types/node": "^22.0.0",
"@types/semver": "^7.3.4",
"browser-assert": "^1.2.1",
"case-sensitive-paths-webpack-plugin": "^2.4.0",
Expand All @@ -90,6 +89,7 @@
"webpack-virtual-modules": "^0.6.0"
},
"devDependencies": {
"@types/node": "^22.0.0",
"@types/pretty-hrtime": "^1.0.0",
"@types/terser-webpack-plugin": "^5.2.0",
"@types/webpack-hot-middleware": "^2.25.6",
Expand Down
4 changes: 3 additions & 1 deletion code/core/src/manager/components/sidebar/SidebarBottom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,14 @@ const Content = styled.div(({ theme }) => ({
bottom: 0,
left: 0,
right: 0,
padding: 12,
padding: '12px 0',
margin: '0 12px',
display: 'flex',
flexDirection: 'column',
gap: 12,
color: theme.color.defaultText,
fontSize: theme.typography.size.s1,
overflow: 'hidden',

'&:empty': {
display: 'none',
Expand Down
4 changes: 2 additions & 2 deletions code/core/src/manager/container/Panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const createPanelActions = memoize(1)((api) => ({
togglePosition: () => api.togglePanelPosition(),
}));

const getPanels = (api: API) => {
const getPanels = memoize(1)((api: API) => {
const allPanels = api.getElements(Addon_TypesEnum.PANEL);
const story = api.getCurrentStoryData();

Expand All @@ -42,7 +42,7 @@ const getPanels = (api: API) => {
});

return filteredPanels;
};
});

const mapper = ({ state, api }: Combo) => ({
panels: getPanels(api),
Expand Down
1 change: 0 additions & 1 deletion code/core/src/types/modules/core-common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,6 @@ export interface BuilderOptions {
ignorePreview?: boolean;
cache?: FileSystemCache;
configDir: string;
projectRoot?: string;
docsMode?: boolean;
features?: StorybookConfigRaw['features'];
versionCheck?: VersionCheck;
Expand Down
2 changes: 1 addition & 1 deletion code/frameworks/angular/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
"@storybook/manager-api": "workspace:*",
"@storybook/preview-api": "workspace:*",
"@storybook/theming": "workspace:*",
"@types/node": "^22.0.0",
"@types/react": "^18.0.37",
"@types/react-dom": "^18.0.11",
"@types/semver": "^7.3.4",
Expand Down Expand Up @@ -73,6 +72,7 @@
"@angular/platform-browser": "^17.3.0",
"@angular/platform-browser-dynamic": "^17.3.0",
"@types/cross-spawn": "^6.0.2",
"@types/node": "^22.0.0",
"@types/tmp": "^0.2.3",
"cross-spawn": "^7.0.3",
"tmp": "^0.2.1",
Expand Down
2 changes: 1 addition & 1 deletion code/frameworks/experimental-nextjs-vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@
"vite-plugin-storybook-nextjs": "^1.1.0"
},
"devDependencies": {
"@types/node": "^18.0.0",
"@types/node": "^22.0.0",
"next": "^15.0.3",
"typescript": "^5.3.2"
},
Expand Down
4 changes: 2 additions & 2 deletions code/frameworks/html-webpack5/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,10 @@
"@storybook/builder-webpack5": "workspace:*",
"@storybook/global": "^5.0.0",
"@storybook/html": "workspace:*",
"@storybook/preset-html-webpack": "workspace:*",
"@types/node": "^22.0.0"
"@storybook/preset-html-webpack": "workspace:*"
},
"devDependencies": {
"@types/node": "^22.0.0",
"typescript": "^5.3.2"
},
"peerDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion code/frameworks/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@
"@storybook/preset-react-webpack": "workspace:*",
"@storybook/react": "workspace:*",
"@storybook/test": "workspace:*",
"@types/node": "^22.0.0",
"@types/semver": "^7.3.4",
"babel-loader": "^9.1.3",
"css-loader": "^6.7.3",
Expand All @@ -175,6 +174,7 @@
"@types/babel__plugin-transform-runtime": "^7",
"@types/babel__preset-env": "^7",
"@types/loader-utils": "^2.0.5",
"@types/node": "^22.0.0",
"@types/react-refresh": "^0",
"next": "^15.0.3",
"typescript": "^5.3.2",
Expand Down
4 changes: 2 additions & 2 deletions code/frameworks/preact-webpack5/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@
"dependencies": {
"@storybook/builder-webpack5": "workspace:*",
"@storybook/preact": "workspace:*",
"@storybook/preset-preact-webpack": "workspace:*",
"@types/node": "^22.0.0"
"@storybook/preset-preact-webpack": "workspace:*"
},
"devDependencies": {
"@types/node": "^22.0.0",
"preact": "^10.5.13",
"typescript": "^5.3.2"
},
Expand Down
3 changes: 3 additions & 0 deletions code/frameworks/react-native-web-vite/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,15 @@
"prep": "jiti ../../../scripts/prepare/bundle.ts"
},
"dependencies": {
"@babel/plugin-transform-modules-commonjs": "^7.26.3",
"@babel/preset-react": "^7.26.3",
"@bunchtogether/vite-plugin-flow": "^1.0.2",
"@joshwooding/vite-plugin-react-docgen-typescript": "0.4.2",
"@storybook/builder-vite": "workspace:*",
"@storybook/react": "workspace:*",
"@storybook/react-vite": "workspace:*",
"@vitejs/plugin-react": "^4.3.2",
"vite-plugin-babel": "^1.3.0",
"vite-tsconfig-paths": "^5.1.4"
},
"devDependencies": {
Expand Down
51 changes: 48 additions & 3 deletions code/frameworks/react-native-web-vite/src/preset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { viteFinal as reactViteFinal } from '@storybook/react-vite/preset';
import { esbuildFlowPlugin, flowPlugin } from '@bunchtogether/vite-plugin-flow';
import react from '@vitejs/plugin-react';
import type { InlineConfig, PluginOption } from 'vite';
import babel from 'vite-plugin-babel';
import tsconfigPaths from 'vite-tsconfig-paths';

import type { FrameworkOptions, StorybookConfig } from './types';
Expand Down Expand Up @@ -64,25 +65,68 @@ export function reactNativeWeb(): PluginOption {
export const viteFinal: StorybookConfig['viteFinal'] = async (config, options) => {
const { mergeConfig } = await import('vite');

const { pluginReactOptions = {} } =
const { pluginReactOptions = {}, pluginBabelOptions = {} } =
await options.presets.apply<FrameworkOptions>('frameworkOptions');

const isDevelopment = options.configType !== 'PRODUCTION';

const reactConfig = await reactViteFinal(config, options);

const { plugins = [] } = reactConfig;

plugins.unshift(
tsconfigPaths(),

// fix for react native packages shipping with flow types untranspiled
flowPlugin({
exclude: [/node_modules\/(?!react-native|@react-native)/],
}),
react({
...pluginReactOptions,
jsxRuntime: pluginReactOptions.jsxRuntime || 'automatic',
babel: {
babelrc: false,
configFile: false,
...pluginReactOptions.babel,
},
}),

// we need to add this extra babel config because the react plugin doesn't allow
// for transpiling node_modules. We need this because many react native packages are un-transpiled.
// see this pr for more context: https://github.com/vitejs/vite-plugin-react/pull/306
// However we keep the react plugin to get the fast refresh and the other stuff its doing
babel({
...pluginBabelOptions,
include: pluginBabelOptions.include || [/node_modules\/(react-native|@react-native)/],
exclude: pluginBabelOptions.exclude,
babelConfig: {
...pluginBabelOptions.babelConfig,
babelrc: false,
configFile: false,
presets: [
[
'@babel/preset-react',
{
development: isDevelopment,
runtime: 'automatic',
...(pluginBabelOptions.presetReact || {}),
},
],
...(pluginBabelOptions.babelConfig?.presets || []),
],
plugins: [
[
// this is a fix for reanimated not working in production
'@babel/plugin-transform-modules-commonjs',
{
strict: false,
strictMode: false, // prevent "use strict" injections
allowTopLevelThis: true, // dont rewrite global `this` -> `undefined`
},
],
...(pluginBabelOptions.babelConfig?.plugins || []),
],
},
jsxRuntime: 'automatic',
...pluginReactOptions,
})
);

Expand All @@ -91,6 +135,7 @@ export const viteFinal: StorybookConfig['viteFinal'] = async (config, options) =
return mergeConfig(reactConfig, {
optimizeDeps: {
esbuildOptions: {
// fix for react native packages shipping with flow types untranspiled
plugins: [esbuildFlowPlugin(new RegExp(/\.(flow|jsx?)$/), (_path: string) => 'jsx')],
},
},
Expand Down
8 changes: 8 additions & 0 deletions code/frameworks/react-native-web-vite/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,17 @@ import type {
} from '@storybook/react-vite';

import type { BabelOptions, Options as ReactOptions } from '@vitejs/plugin-react';
import type { BabelPluginOptions } from 'vite-plugin-babel';

export type FrameworkOptions = FrameworkOptionsBase & {
pluginReactOptions?: Omit<ReactOptions, 'babel'> & { babel?: BabelOptions };
pluginBabelOptions?: BabelPluginOptions & {
presetReact?: {
[key: string]: any;
runtime?: 'automatic' | 'classic';
importSource?: string;
};
};
};

type FrameworkName = CompatibleString<'@storybook/react-native-web-vite'>;
Expand Down
4 changes: 3 additions & 1 deletion code/frameworks/react-webpack5/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@
"dependencies": {
"@storybook/builder-webpack5": "workspace:*",
"@storybook/preset-react-webpack": "workspace:*",
"@storybook/react": "workspace:*",
"@storybook/react": "workspace:*"
},
"devDependencies": {
"@types/node": "^22.0.0"
},
"peerDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions code/frameworks/server-webpack5/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@
"dependencies": {
"@storybook/builder-webpack5": "workspace:*",
"@storybook/preset-server-webpack": "workspace:*",
"@storybook/server": "workspace:*",
"@types/node": "^22.0.0"
"@storybook/server": "workspace:*"
},
"devDependencies": {
"@types/node": "^22.0.0",
"typescript": "^5.3.2"
},
"peerDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions code/frameworks/vue3-webpack5/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,10 @@
"dependencies": {
"@storybook/builder-webpack5": "workspace:*",
"@storybook/preset-vue3-webpack": "workspace:*",
"@storybook/vue3": "workspace:*",
"@types/node": "^22.0.0"
"@storybook/vue3": "workspace:*"
},
"devDependencies": {
"@types/node": "^22.0.0",
"@vue/compiler-sfc": "3.0.0",
"typescript": "^5.3.2",
"vue": "3.0.0"
Expand Down
Loading
Loading