Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 2 additions & 2 deletions .agents/skills/storybook-check/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
"local": "packages/builder-rsbuild/src/plugins/rsbuild-plugin-storybook-mock.ts",
"note": "Mocking is an Rsbuild plugin appended in builder code after presets.apply('rsbuildFinal'); this mirrors builder-vite's viteMockPlugin shape while keeping the after-user ordering of builder-webpack5's override slot. The rest of custom-webpack-preset (user webpack config loading, SWC/babel handling) has its semantic parallels reviewed in iframe-rsbuild.config.ts / preview-preset.ts.",
"intentionalDivergences": [
"core.disableWebpackDefaults is not ported and is a present-day user-facing no-op for this builder: the public main.ts option type-checks in Storybook 10.5.10, but webpack's default-skip has no Rsbuild equivalent and rsbuildFinal runs after intrinsic defaults so cannot emulate it; CRA was the original motivating use case (upstream PR #15062), and supporting the option would require a real pre-default opt-out"
"core.disableWebpackDefaults is not ported and is a present-day user-facing no-op for this builder: the public main.ts option type-checks in Storybook 11, but webpack's default-skip has no Rsbuild equivalent and rsbuildFinal runs after intrinsic defaults so cannot emulate it; CRA was the original motivating use case (upstream PR #15062), and supporting the option would require a real pre-default opt-out"
]
},
{
Expand Down Expand Up @@ -134,7 +134,7 @@
"upstream": "code/presets/react-webpack/src/loaders/react-docgen-loader.ts",
"local": "packages/framework-react/src/loaders/react-docgen-loader.ts",
"intentionalDivergences": [
"LoaderContext type imported from webpack via @ts-expect-error because @rsbuild/core does not reexport it"
"LoaderContext type imported as Rspack.LoaderContext from @rsbuild/core instead of webpack"
]
},
{
Expand Down
3 changes: 0 additions & 3 deletions packages/addon-modernjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,6 @@
"peerDependenciesMeta": {
"@modern-js/plugin": {
"optional": true
},
"typescript": {
"optional": true
}
},
"engines": {
Expand Down
7 changes: 1 addition & 6 deletions packages/addon-rslib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
"devDependencies": {
"@microsoft/api-extractor": "^7.59.4",
"@rsbuild/core": "^2.2.13",
"@rslib/core": "~1.0.3",
"@rslib/core": "^1.0.3",
"@types/node": "^22.12.0",
"storybook": "11.0.0-rc.1",
"storybook-builder-rsbuild": "workspace:*",
Expand All @@ -54,11 +54,6 @@
"@rslib/core": ">= 0.22.0",
"storybook-builder-rsbuild": "workspace:^"
},
"peerDependenciesMeta": {
"typescript": {
"optional": true
}
},
"engines": {
"node": ">=22.12.0"
},
Expand Down
4 changes: 0 additions & 4 deletions packages/builder-rsbuild/build-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ const config: BuildEntries = {
'./templates/virtualModuleModernEntry.js':
'./templates/virtualModuleModernEntry.js',
'./templates/preview.ejs': './templates/preview.ejs',
'./templates/virtualModuleEntry.template.js':
'./templates/virtualModuleEntry.template.js',
'./templates/virtualModuleStory.template.js':
'./templates/virtualModuleStory.template.js',
},
}

Expand Down
9 changes: 1 addition & 8 deletions packages/builder-rsbuild/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@
"./preset": "./dist/preset.js",
"./presets/preview-preset": "./dist/preview-preset.js",
"./templates/preview.ejs": "./templates/preview.ejs",
"./templates/virtualModuleEntry.template.js": "./templates/virtualModuleEntry.template.js",
"./templates/virtualModuleModernEntry.js": "./templates/virtualModuleModernEntry.js",
"./templates/virtualModuleStory.template.js": "./templates/virtualModuleStory.template.js"
"./templates/virtualModuleModernEntry.js": "./templates/virtualModuleModernEntry.js"
},
"files": [
"dist/**/*",
Expand Down Expand Up @@ -85,11 +83,6 @@
"@rsbuild/core": "^2.0.0",
"storybook": "^11.0.0-rc.1"
},
"peerDependenciesMeta": {
"typescript": {
"optional": true
}
},
"engines": {
"node": ">=22.12.0"
},
Expand Down
17 changes: 1 addition & 16 deletions packages/builder-rsbuild/src/preview/iframe-rsbuild.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -133,19 +133,12 @@ const loadWebpackAddonPresets = async (options: RsbuildBuilderOptions) => {
export default async (
options: RsbuildBuilderOptions,
): Promise<RsbuildConfig> => {
const { rsbuildConfigPath, addonDocs } =
await getBuilderOptions<BuilderOptions>(options)
const { rsbuildConfigPath } = await getBuilderOptions<BuilderOptions>(options)
const [webpackConfigFromPresets, webpackAddonPresets] = await Promise.all([
options.presets.apply<Rspack.Configuration>('webpack', {}, options),
loadWebpackAddonPresets(options),
])

if (addonDocs) {
console.warn(
'`addonDocs` option is deprecated and will be removed in future versions. Please use `@storybook/addon-docs` option instead.',
)
}

const {
outputDir = join('.', 'public'),
quiet,
Expand Down Expand Up @@ -439,14 +432,6 @@ export default async (
: isProd
config.optimization.moduleIds = 'named'

// If using react-dom-shim with React 16/17, `useId` won't be exported in dependency,
// which will cause an HarmonyLinkingError. Set `exportsPresence` to `false` to allow
// doing this runtime detection.
config.module ??= {}
config.module.parser ??= {}
config.module.parser.javascript ??= {}
config.module.parser.javascript.exportsPresence = false

config.plugins ??= []
config.plugins.push(
...[
Expand Down
4 changes: 0 additions & 4 deletions packages/builder-rsbuild/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,6 @@ export type BuilderOptions = {
* Which environment to use from the Rsbuild config.
*/
environment?: string
/**
* @storybook/addon-docs options
*/
addonDocs?: any
}

export interface BuilderResult extends BuilderResultBase {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ const createOptions = (
) => {
const builderCoreOptions: Record<string, unknown> = {
rsbuildConfigPath: fixtureRsbuildConfig,
addonDocs: {},
fsCache: false,
...(lazyCompilation === 'unset' ? {} : { lazyCompilation }),
...builderOptionOverrides,
Expand Down
5 changes: 2 additions & 3 deletions packages/framework-react/src/loaders/react-docgen-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* Code taken from https://github.com/storybookjs/storybook/tree/next/code/presets/react-webpack/src/loaders
*/

import type { Rspack } from '@rsbuild/core'
import MagicString from 'magic-string'
import { existsSync } from 'node:fs'
import { dirname, sep } from 'node:path'
Expand All @@ -25,8 +26,6 @@ import {
} from 'storybook/internal/common'
import { logger } from 'storybook/internal/node-logger'
import * as TsconfigPaths from 'tsconfig-paths'
// @ts-expect-error can not reexport `LoaderContext` from @rsbuild/core
import type { LoaderContext } from 'webpack'

import {
defaultLookupModule,
Expand Down Expand Up @@ -88,7 +87,7 @@ const defaultResolver = new docgenResolver.FindExportedDefinitionsResolver()
const handlers = [...defaultHandlers, actualNameHandler]

export default async function reactDocgenLoader(
this: LoaderContext<{ debug: boolean }>,
this: Rspack.LoaderContext<{ debug?: boolean }>,
source: string,
map: any,
) {
Expand Down
43 changes: 0 additions & 43 deletions packages/framework-react/src/react-docs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ export const rsbuildFinalDocs: NonNullable<
//#region react-docgen-typescript
const reactDocGenTsPlugin = await import('./plugins/react-docgen-typescript')

// TODO: Rspack doesn't support the hooks `react-docgen-typescript`' required.
// Currently, using `transform` hook to implement the same behavior.
return mergeRsbuildConfig(config, {
tools: {
rspack: {
Expand All @@ -101,45 +99,4 @@ export const rsbuildFinalDocs: NonNullable<
],
})
//#endregion

//#region webpack flavor react-docgen-typescript implementation, lacking support for hooks.
// it's now superseded by the `transform` hook implementation of Vite flavor.

// Reference only: `@storybook/react-docgen-typescript-plugin` is not a dependency of this package.
// const { ReactDocgenTypeScriptPlugin } = await import(
// '@storybook/react-docgen-typescript-plugin'
// )

// const { reactDocgenTypescriptOptions } = typescriptOptions || {}

// return mergeRsbuildConfig(config, {
// tools: {
// rspack: {
// module: {
// rules: [
// {
// test: /\.(cjs|mjs|jsx?)$/,
// enforce: 'pre',
// loader: requirer(
// require.resolve,
// 'storybook-react-rsbuild/loaders/react-docgen-loader',
// ),
// options: {
// debug,
// },
// exclude: /(\.(stories|story)\.(js|jsx|ts|tsx))|(node_modules)/,
// },
// ],
// },
// plugins: [
// new ReactDocgenTypeScriptPlugin({
// ...reactDocgenTypescriptOptions,
// // We *need* this set so that RDT returns default values in the same format as react-docgen
// savePropValueAsString: true,
// }),
// ],
// },
// },
// })
//#endregion
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
* Code taken from https://github.com/storybookjs/storybook/tree/next/code/presets/react-webpack/src/loaders
*/

import type { Rspack } from '@rsbuild/core'
import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs'
import { dirname, join } from 'node:path'
import { afterEach, describe, expect, it, rs } from 'rstack/test'
Expand Down Expand Up @@ -165,7 +166,7 @@ async function runLoader(resourcePath: string) {
async: () => rs.fn(),
getOptions: () => ({}),
resourcePath,
},
} as unknown as Rspack.LoaderContext<{ debug?: boolean }>,
'export const Button = () => null',
undefined,
)
Expand Down
4 changes: 2 additions & 2 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 0 additions & 4 deletions rstest-setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ expect.addSnapshotSerializer(
)

const ignoreList = [
(error: any) =>
error.message.includes(
'`addonDocs` option is deprecated and will be removed in future versions. Please use `@storybook/addon-docs` option instead.',
),
(error: any) => error.message.includes('":nth-child" is potentially unsafe'),
(error: any) =>
error.message.includes('":first-child" is potentially unsafe'),
Expand Down
2 changes: 0 additions & 2 deletions scripts/check-dependency-version.mts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ if (dep) {
// === devDependencies ===
const cdvcDevDep = new CDVC(root, {
depType: ['devDependencies'],
// addon-rslib keeps a Rslib 1 dev copy for type-check/tests of its peer dependency; sandboxes track Rslib 0.x.
ignoreDep: ['@rslib/core'],
ignorePackage: ['website'],
})

Expand Down
2 changes: 1 addition & 1 deletion website/docs/en/guide/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ See the **[Frameworks](/guide/framework/react)** section for detailed migration

:::info Peer dependency requirements

**`@rsbuild/core`** <PeerRange name="@rsbuild/core" /> — Storybook Rsbuild requires the stable Rsbuild runtime. See the [1.0 release announcement](https://rsbuild.rs/community/releases/v1-0) for background.
**`@rsbuild/core`** <PeerRange name="@rsbuild/core" /> — Storybook Rsbuild requires the stable Rsbuild runtime. See the [2.0 release announcement](https://rsbuild.rs/blog/v2-0) for background.

**`storybook`** <PeerRange name="storybook" /> — The range is pinned to the `storybook` peer of the bundled `@storybook/*` packages and is bumped alongside Storybook releases. The minor version of Storybook Rsbuild tracks the Storybook minor it is built against: 4.0.x targets Storybook 11.0, 4.1.x will target Storybook 11.1, and so on. Upgrade guidance is available in the [Storybook migration guide](https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#from-version-10x-to-1100).

Expand Down
2 changes: 1 addition & 1 deletion website/docs/zh/guide/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ Storybook 会检测到 Rsbuild 并自动为你配置 `storybook-builder-rsbuild`

:::info Peer dependency 要求

**`@rsbuild/core`** <PeerRange name="@rsbuild/core" /> — Storybook Rsbuild 依赖稳定版 Rsbuild 运行时。背景信息请参阅 [1.0 发布公告](https://rsbuild.rs/community/releases/v1-0)。
**`@rsbuild/core`** <PeerRange name="@rsbuild/core" /> — Storybook Rsbuild 依赖稳定版 Rsbuild 运行时。背景信息请参阅 [2.0 发布公告](https://rsbuild.rs/blog/v2-0)。

**`storybook`** <PeerRange name="storybook" /> — 该范围与内置 `@storybook/*` 包的 `storybook` peer 保持一致,并随 Storybook 发版同步更新。Storybook Rsbuild 的 minor 版本号与其对应的 Storybook minor 版本号保持一致:4.0.x 对应 Storybook 11.0,4.1.x 将对应 Storybook 11.1,以此类推。升级指引可参阅 [Storybook 迁移指南](https://github.com/storybookjs/storybook/blob/next/MIGRATION.md#from-version-10x-to-1100)。

Expand Down
Loading