diff --git a/packages/storybook/builder/package.json b/packages/storybook/builder/package.json index bb954d654ed7..96747e02aec6 100644 --- a/packages/storybook/builder/package.json +++ b/packages/storybook/builder/package.json @@ -43,8 +43,7 @@ "@modern-js/core": "workspace:*", "@modern-js/runtime": "workspace:*", "@modern-js/utils": "workspace:*", - "@rspack/dev-client": "0.2.12", - "@storybook/addons": "^6.3.7", + "@rspack/dev-client": "0.3.2", "@storybook/api": "^7.4.0", "@storybook/components": "^7.4.0", "@storybook/core-common": "^7.4.0", @@ -54,13 +53,13 @@ "@storybook/mdx1-csf": "^1.0.0", "@storybook/mdx2-csf": "^1.1.0", "@storybook/preview": "^7.4.0", + "@storybook/preview-api": "^7.4.0", "@storybook/react-docgen-typescript-plugin": "1.0.6--canary.9.0c3f3b7.0", "@storybook/router": "^7.4.0", "@storybook/theming": "^7.4.0", "@types/webpack-hot-middleware": "^2.25.6", "ast-types": "^0.14.2", "babel-plugin-react-docgen": "^4.2.1", - "glob-promise": "^6.0.3", "minimatch": "^3.0.4", "react-docgen": "6.0.0-alpha.3", "remark-external-links": "^9.0.1", diff --git a/packages/storybook/builder/src/addons/components/modern.tsx b/packages/storybook/builder/src/addons/components/modern.tsx index b397b515a842..7c4578136f3f 100644 --- a/packages/storybook/builder/src/addons/components/modern.tsx +++ b/packages/storybook/builder/src/addons/components/modern.tsx @@ -3,13 +3,9 @@ import { createApp } from '@modern-js/runtime'; import type { Plugin, RouterConfig } from '@modern-js/runtime'; import router from '@modern-js/runtime/router'; import state from '@modern-js/runtime/model'; -import type { StoryFn as StoryFunction } from '@storybook/addons'; import type { IConfig } from '../type'; -export const WrapProviders = ( - storyFn: StoryFunction, - config: IConfig, -) => { +export const WrapProviders = (storyFn: any, config: IConfig) => { const App = createApp({ plugins: resolvePlugins(config.modernConfigRuntime), })(storyFn); diff --git a/packages/storybook/builder/src/addons/withPluginRuntime.ts b/packages/storybook/builder/src/addons/withPluginRuntime.ts index 480a11bc3f3a..6223490eaef9 100644 --- a/packages/storybook/builder/src/addons/withPluginRuntime.ts +++ b/packages/storybook/builder/src/addons/withPluginRuntime.ts @@ -1,11 +1,9 @@ -import { type StoryFn as StoryFunction, useParameter } from '@storybook/addons'; +import { useParameter } from '@storybook/preview-api'; +import { DecoratorFunction } from '@storybook/types'; import { WrapProviders } from './components/modern'; import type { IConfig } from './type'; -export const withPluginRuntime = ( - storyFn: StoryFunction, - // context: StoryContext -) => { +export const withPluginRuntime: DecoratorFunction = storyFn => { const modernConfigRuntime = useParameter( 'modernConfigRuntime', ); diff --git a/packages/storybook/builder/src/plugin-storybook.ts b/packages/storybook/builder/src/plugin-storybook.ts index 6004823430e0..9f223f59ee52 100644 --- a/packages/storybook/builder/src/plugin-storybook.ts +++ b/packages/storybook/builder/src/plugin-storybook.ts @@ -1,6 +1,6 @@ /* eslint-disable max-lines */ import { isAbsolute, join, resolve } from 'path'; -import { slash, watch } from '@modern-js/utils'; +import { slash, watch, globby } from '@modern-js/utils'; import { BuilderPlugin, SharedBuilderConfig, @@ -22,7 +22,6 @@ import { loadPreviewOrConfigFile, } from '@storybook/core-common'; import { globals } from '@storybook/preview/globals'; -import { promise as glob } from 'glob-promise'; import type { BuilderPluginAPI as WebpackAPI, @@ -401,7 +400,7 @@ async function createStoriesEntry(cwd: string, storyPatterns: string[]) { const stories = ( await Promise.all( storyPatterns.map(pattern => { - return glob(slash(pattern), { follow: true }); + return globby(slash(pattern), { followSymbolicLinks: true }); }), ) ).reduce((carry, stories) => carry.concat(stories), []); @@ -458,7 +457,7 @@ async function watchStories( const stories = ( await Promise.all( patterns.map(pattern => { - return glob(slash(pattern), { follow: true }); + return globby(slash(pattern), { followSymbolicLinks: true }); }), ) ).reduce((carry, stories) => carry.concat(stories), []);