storybook-builder-rsbuild 3.4.2 → 3.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,57 +1,64 @@
1
1
  import { StorybookConfig as StorybookConfig$1, Options, NormalizedStoriesSpecifier } from 'storybook/internal/types';
2
2
  export { BuilderResult, Options, Preset, TypescriptOptions } from 'storybook/internal/types';
3
3
 
4
+ //#region code/lib/core-webpack/.dts-emit/code/lib/core-webpack/src/types.d.ts
4
5
  type RulesConfig = any;
5
6
  type ModuleConfig = {
6
- rules?: RulesConfig[];
7
+ rules?: RulesConfig[];
7
8
  };
8
9
  type ResolveConfig = {
9
- extensions?: string[];
10
- mainFields?: (string | string[])[] | undefined;
11
- alias?: any;
10
+ extensions?: string[];
11
+ mainFields?: (string | string[])[] | undefined;
12
+ alias?: any;
12
13
  };
13
14
  interface WebpackConfiguration {
14
- plugins?: any[];
15
- module?: ModuleConfig;
16
- resolve?: ResolveConfig;
17
- optimization?: any;
18
- devtool?: false | string | {
19
- type: 'all' | 'javascript' | 'css';
20
- use: any;
21
- }[];
15
+ plugins?: any[];
16
+ module?: ModuleConfig;
17
+ resolve?: ResolveConfig;
18
+ optimization?: any;
19
+ devtool?: false | string | {
20
+ type: 'all' | 'javascript' | 'css';
21
+ use: any;
22
+ }[];
22
23
  }
23
24
  type BuilderOptions = {
24
- fsCache?: boolean;
25
- lazyCompilation?: boolean;
25
+ fsCache?: boolean;
26
+ lazyCompilation?: boolean;
26
27
  };
27
28
  type StorybookConfig<TWebpackConfiguration = WebpackConfiguration> = StorybookConfig$1 & {
28
- /**
29
- * Modify or return a custom Webpack config after the Storybook's default configuration has run
30
- * (mostly used by addons).
31
- */
32
- webpack?: (config: TWebpackConfiguration, options: Options) => TWebpackConfiguration | Promise<TWebpackConfiguration>;
33
- /** Modify or return a custom Webpack config after every addon has run. */
34
- webpackFinal?: (config: TWebpackConfiguration, options: Options) => TWebpackConfiguration | Promise<TWebpackConfiguration>;
29
+ /**
30
+ * Modify or return a custom Webpack config after the Storybook's default configuration has run
31
+ * (mostly used by addons).
32
+ */
33
+ webpack?: (config: TWebpackConfiguration, options: Options) => TWebpackConfiguration | Promise<TWebpackConfiguration>; /** Modify or return a custom Webpack config after every addon has run. */
34
+ webpackFinal?: (config: TWebpackConfiguration, options: Options) => TWebpackConfiguration | Promise<TWebpackConfiguration>;
35
35
  };
36
-
36
+ //#endregion
37
+ //#region code/lib/core-webpack/.dts-emit/code/lib/core-webpack/src/load-custom-webpack-config.d.ts
37
38
  declare const loadCustomWebpackConfig: (configDir: string) => Promise<any>;
38
-
39
+ //#endregion
40
+ //#region code/lib/core-webpack/.dts-emit/code/lib/core-webpack/src/check-webpack-version.d.ts
39
41
  declare const checkWebpackVersion: (webpack: {
40
- version?: string;
42
+ version?: string;
41
43
  }, specifier: string, caption: string) => void;
42
-
44
+ //#endregion
45
+ //#region code/lib/core-webpack/.dts-emit/code/lib/core-webpack/src/merge-webpack-config.d.ts
43
46
  declare function mergeConfigs(config: WebpackConfiguration, customConfig: WebpackConfiguration): WebpackConfiguration;
44
-
47
+ //#endregion
48
+ //#region code/lib/core-webpack/.dts-emit/code/lib/core-webpack/src/to-importFn.d.ts
45
49
  declare function webpackIncludeRegexp(specifier: NormalizedStoriesSpecifier): RegExp;
46
50
  declare function toImportFnPart(specifier: NormalizedStoriesSpecifier): string;
47
- declare function toImportFn(stories: NormalizedStoriesSpecifier[], { needPipelinedImport }?: {
48
- needPipelinedImport?: boolean;
51
+ declare function toImportFn(stories: NormalizedStoriesSpecifier[], {
52
+ needPipelinedImport
53
+ }?: {
54
+ needPipelinedImport?: boolean;
49
55
  }): string;
50
-
56
+ //#endregion
57
+ //#region code/lib/core-webpack/.dts-emit/code/lib/core-webpack/src/to-require-context.d.ts
51
58
  declare const toRequireContext: (specifier: NormalizedStoriesSpecifier) => {
52
- path: string;
53
- recursive: boolean;
54
- match: RegExp;
59
+ path: string;
60
+ recursive: boolean;
61
+ match: RegExp;
55
62
  };
56
63
  declare const toRequireContextString: (specifier: NormalizedStoriesSpecifier) => string;
57
64
 
@@ -1 +1 @@
1
- {"name":"@storybook/core-webpack","version":"10.5.5","funding":{"type":"opencollective","url":"https://opencollective.com/storybook"},"license":"MIT","types":"index.d.ts","type":"module"}
1
+ {"name":"@storybook/core-webpack","version":"10.6.0","funding":{"type":"opencollective","url":"https://opencollective.com/storybook"},"license":"MIT","types":"index.d.ts","type":"module"}
package/dist/index.d.ts CHANGED
@@ -1,102 +1,152 @@
1
- import * as rsbuildReal from '@rsbuild/core';
2
- import { DevConfig, RsbuildConfig } from '@rsbuild/core';
3
- import { BuilderResult as BuilderResult$1, Builder, Options, StorybookConfigRaw, TypescriptOptions as TypescriptOptions$1, NormalizedStoriesSpecifier } from 'storybook/internal/types';
4
- import { PluginTypeCheckerOptions } from '@rsbuild/plugin-type-check';
5
-
6
- type RsbuildStats = {
7
- toJson: (...args: any[]) => any;
8
- };
9
- /**
10
- * Options for TypeScript usage within Storybook.
11
- */
12
- interface TypescriptOptions extends TypescriptOptions$1 {
13
- /**
14
- * Configures `@rsbuild/plugin-type-check`, using `fork-ts-checker-webpack-plugin` under the hood.
15
- */
16
- checkOptions?: PluginTypeCheckerOptions;
17
- }
18
- type RsbuildBuilder = Builder<RsbuildConfig, RsbuildStats>;
19
- type RsbuildFinal = (config: RsbuildConfig, options: Options) => RsbuildConfig | Promise<RsbuildConfig>;
20
- type StorybookConfigRsbuild = {
21
- rsbuildFinal?: RsbuildFinal;
22
- webpackAddons?: StorybookConfigRaw['addons'];
23
- };
24
- type BuilderOptions = {
25
- /**
26
- * Path to rsbuild.config file, relative to CWD.
27
- */
28
- rsbuildConfigPath?: string;
29
- /**
30
- * Pass-through Rsbuild `dev.lazyCompilation` options.
31
- */
32
- lazyCompilation?: DevConfig['lazyCompilation'];
33
- /**
34
- * Enable Rspack's [persistent cache(experimental)](https://rspack.dev/config/experiments#experimentscache).
35
- * We continue to use the name `fsCache` here to maintain better compatibility with the webpack builder.
36
- */
37
- fsCache?: boolean;
38
- /**
39
- * Which environment to use from the Rsbuild config.
40
- */
41
- environment?: string;
42
- /**
43
- * @storybook/addon-docs options
44
- */
45
- addonDocs?: any;
46
- };
47
- interface BuilderResult extends BuilderResult$1 {
48
- stats?: Stats;
49
- }
50
-
51
- /**
52
- * Strips fields that are unsafe to inherit into the Storybook preview build.
53
- *
54
- * @internal For use by official Storybook Rsbuild packages only. This API is subject to change at
55
- * any time and should not be used in user configuration.
56
- */
57
- declare const stripInheritedConfig: (config: RsbuildConfig, source: string) => string[];
58
-
59
- /**
60
- * Re-assert Storybook core's intent to keep `node_modules` out of the stories
61
- * context. Core's `(?!.*node_modules)` guard relies on webpack's context
62
- * dropping `node_modules`; Rspack's `ContextModule` enumerates it, so a
63
- * dependency shipping `.stories.*` gets swept in. We append a separator-anchored
64
- * `webpackExclude` to every generated `webpackInclude`, except specifiers that
65
- * intentionally glob into `node_modules` (real segment or alternation branch) —
66
- * matching the webpack builder, which surfaces those.
67
- *
68
- * TODO: remove once the upstream Rspack fix ships in a released `@rspack/core`
69
- * — https://github.com/web-infra-dev/rspack/pull/14576.
70
- */
71
- declare const excludeNodeModulesFromStoryContext: (importFnSource: string, stories: NormalizedStoriesSpecifier[]) => string;
72
- declare const getVirtualModules: (options: Options, isLazyCompilationActive: boolean) => Promise<{
73
- virtualModules: Record<string, string>;
74
- entries: string[];
75
- }>;
76
-
77
- type StatsOrMultiStats = Parameters<rsbuildReal.OnAfterBuildFn>[0]['stats'];
78
- type Stats = NonNullable<Exclude<StatsOrMultiStats, {
79
- stats: unknown[];
80
- }>>;
81
- declare const printDuration: (startTime: [number, number]) => string;
82
- type BuilderStartOptions = Parameters<RsbuildBuilder['start']>['0'];
83
- declare const executor: {
84
- get: (options: Options) => Promise<typeof rsbuildReal>;
85
- };
86
- declare const getConfig: RsbuildBuilder['getConfig'];
87
- declare function bail(): Promise<void>;
88
- /**
89
- * Returns a {@link ChangeDetectionAdapter} bound to the Rspack compiler created by `start()`.
90
- *
91
- * Storybook core only invokes this after `start()` has resolved, so `activeCompiler` is populated
92
- * in practice. The guard is defensive: it fails loudly on an unexpected call-before-start rather
93
- * than silently binding to an undefined compiler.
94
- */
95
- declare const changeDetectionAdapter: NonNullable<RsbuildBuilder['changeDetectionAdapter']>;
96
- declare const start: RsbuildBuilder['start'];
97
- declare const build: ({ options }: BuilderStartOptions) => Promise<Stats>;
98
- declare const corePresets: string[];
99
- declare const previewMainTemplate: () => string;
100
-
101
- export { bail, build, changeDetectionAdapter, corePresets, excludeNodeModulesFromStoryContext, executor, getConfig, getVirtualModules, previewMainTemplate, printDuration, start, stripInheritedConfig };
102
- export type { BuilderOptions, BuilderResult, RsbuildBuilder, RsbuildFinal, Stats, StorybookConfigRsbuild, TypescriptOptions };
1
+ import type { Builder } from 'storybook/internal/types';
2
+ import type { BuilderResult as BuilderResult_2 } from 'storybook/internal/types';
3
+ import type { DevConfig } from '@rsbuild/core';
4
+ import type { NormalizedStoriesSpecifier } from 'storybook/internal/types';
5
+ import type { Options } from 'storybook/internal/types';
6
+ import type { PluginTypeCheckerOptions } from '@rsbuild/plugin-type-check';
7
+ import { RsbuildConfig } from '@rsbuild/core';
8
+ import * as rsbuildReal from '@rsbuild/core';
9
+ import type { StorybookConfigRaw } from 'storybook/internal/types';
10
+ import type { TypescriptOptions as TypescriptOptions_2 } from 'storybook/internal/types';
11
+
12
+ export declare function bail(): Promise<void>;
13
+
14
+ export declare const build: ({ options, }: BuilderStartOptions) => Promise<Stats>;
15
+
16
+ export declare type BuilderOptions = {
17
+ /**
18
+ * Path to rsbuild.config file, relative to CWD.
19
+ */
20
+ rsbuildConfigPath?: string;
21
+ /**
22
+ * Pass-through Rsbuild `dev.lazyCompilation` options.
23
+ */
24
+ lazyCompilation?: DevConfig['lazyCompilation'];
25
+ /**
26
+ * Enable Rspack's [persistent cache(experimental)](https://rspack.dev/config/experiments#experimentscache).
27
+ * We continue to use the name `fsCache` here to maintain better compatibility with the webpack builder.
28
+ */
29
+ fsCache?: boolean;
30
+ /**
31
+ * Which environment to use from the Rsbuild config.
32
+ */
33
+ environment?: string;
34
+ /**
35
+ * @storybook/addon-docs options
36
+ */
37
+ addonDocs?: any;
38
+ };
39
+
40
+ export declare interface BuilderResult extends BuilderResult_2 {
41
+ stats?: Stats;
42
+ }
43
+
44
+ declare type BuilderStartOptions = Parameters<RsbuildBuilder['start']>['0'];
45
+
46
+ /**
47
+ * Returns a {@link ChangeDetectionAdapter} bound to the Rspack compiler created by `start()`, or a
48
+ * headless adapter when `options` are passed without a dev server (the `storybook tools` CLI).
49
+ * Throws if called without options before `start()` has created the compiler.
50
+ */
51
+ export declare const changeDetectionAdapter: NonNullable<RsbuildBuilder['changeDetectionAdapter']>;
52
+
53
+ export declare const corePresets: string[];
54
+
55
+ /**
56
+ * Re-assert Storybook core's intent to keep `node_modules` out of the stories
57
+ * context. Core's `(?!.*node_modules)` guard relies on webpack's context
58
+ * dropping `node_modules`; Rspack's `ContextModule` enumerates it, so a
59
+ * dependency shipping `.stories.*` gets swept in. We append a separator-anchored
60
+ * `webpackExclude` to every generated `webpackInclude`, except specifiers that
61
+ * intentionally glob into `node_modules` (real segment or alternation branch) —
62
+ * matching the webpack builder, which surfaces those.
63
+ *
64
+ * TODO: remove once the upstream Rspack fix ships in a released `@rspack/core`
65
+ * — https://github.com/web-infra-dev/rspack/pull/14576.
66
+ */
67
+ export declare const excludeNodeModulesFromStoryContext: (importFnSource: string, stories: NormalizedStoriesSpecifier[]) => string;
68
+
69
+ export declare const executor: {
70
+ get: (options: Options) => Promise<typeof rsbuildReal>;
71
+ };
72
+
73
+ export declare const getConfig: RsbuildBuilder['getConfig'];
74
+
75
+ export declare const getVirtualModules: (options: Options, isLazyCompilationActive: boolean) => Promise<{
76
+ virtualModules: Record<string, string>;
77
+ entries: string[];
78
+ }>;
79
+
80
+ /**
81
+ * Merges the selected environment over the top-level config and drops `environments`.
82
+ * Stripping is the caller's job; see `stripInheritedConfig`.
83
+ *
84
+ * @internal For use by official Storybook Rsbuild packages only. This API is subject to change at
85
+ * any time and should not be used in user configuration.
86
+ */
87
+ export declare function pickRsbuildEnvironment(config: {
88
+ [K in keyof RsbuildConfig]?: unknown;
89
+ }, { environment, source }: {
90
+ environment?: string;
91
+ source: string;
92
+ }): RsbuildConfig;
93
+
94
+ export declare const previewMainTemplate: () => string;
95
+
96
+ export declare const printDuration: (startTime: [number, number]) => string;
97
+
98
+ export declare type RsbuildBuilder = Builder<RsbuildConfig, RsbuildStats>;
99
+
100
+ export declare type RsbuildFinal = (config: RsbuildConfig, options: Options) => RsbuildConfig | Promise<RsbuildConfig>;
101
+
102
+ declare type RsbuildStats = {
103
+ toJson: (...args: any[]) => any;
104
+ };
105
+
106
+ export declare const start: RsbuildBuilder['start'];
107
+
108
+ export declare type Stats = Exclude<StatsOrMultiStats, {
109
+ stats: unknown[];
110
+ }>;
111
+
112
+ declare type StatsOrMultiStats = Parameters<rsbuildReal.OnAfterDevCompileFn>[0]['stats'];
113
+
114
+ export declare type StorybookConfigRsbuild = {
115
+ rsbuildFinal?: RsbuildFinal;
116
+ webpackAddons?: StorybookConfigRaw['addons'];
117
+ features?: StorybookConfigRaw['features'] & {
118
+ /**
119
+ * Enable the experimental `.test` function in CSF Next
120
+ *
121
+ * @see https://storybook.js.org/docs/api/main-config/main-config-features#experimentaltestsyntax
122
+ */
123
+ experimentalTestSyntax?: boolean;
124
+ /**
125
+ * Remove the `bugfixes` option from `@babel/preset-env`. This is required when using Babel 8 and when
126
+ * Storybook fails to detect your Babel version.
127
+ *
128
+ * @default false
129
+ */
130
+ babelRemoveBugfixes?: boolean;
131
+ };
132
+ };
133
+
134
+ /**
135
+ * Strips fields that are unsafe to inherit into the Storybook preview build.
136
+ *
137
+ * @internal For use by official Storybook Rsbuild packages only. This API is subject to change at
138
+ * any time and should not be used in user configuration.
139
+ */
140
+ export declare const stripInheritedConfig: (config: RsbuildConfig, source: string) => string[];
141
+
142
+ /**
143
+ * Options for TypeScript usage within Storybook.
144
+ */
145
+ export declare interface TypescriptOptions extends TypescriptOptions_2 {
146
+ /**
147
+ * Configures `@rsbuild/plugin-type-check`, using `fork-ts-checker-webpack-plugin` under the hood.
148
+ */
149
+ checkOptions?: PluginTypeCheckerOptions;
150
+ }
151
+
152
+ export { }