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.
- package/compiled/@storybook/core-webpack/index.d.ts +39 -32
- package/compiled/@storybook/core-webpack/package.json +1 -1
- package/dist/index.d.ts +152 -102
- package/dist/index.js +1315 -970
- package/dist/loaders/export-order-loader.js +24 -49
- package/dist/loaders/rsbuild-automock-loader.js +6 -19
- package/dist/loaders/storybook-mock-transform-loader.js +12 -27
- package/dist/preset.js +2 -0
- package/dist/preview-preset.js +4 -189
- package/package.json +11 -11
- package/preset.js +2 -0
- package/templates/virtualModuleModernEntry.js +1 -1
- package/dist/_node-chunks/chunk-QCILEEJ4.js +0 -45
|
@@ -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
|
-
|
|
7
|
+
rules?: RulesConfig[];
|
|
7
8
|
};
|
|
8
9
|
type ResolveConfig = {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
10
|
+
extensions?: string[];
|
|
11
|
+
mainFields?: (string | string[])[] | undefined;
|
|
12
|
+
alias?: any;
|
|
12
13
|
};
|
|
13
14
|
interface WebpackConfiguration {
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
|
|
25
|
-
|
|
25
|
+
fsCache?: boolean;
|
|
26
|
+
lazyCompilation?: boolean;
|
|
26
27
|
};
|
|
27
28
|
type StorybookConfig<TWebpackConfiguration = WebpackConfiguration> = StorybookConfig$1 & {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
-
|
|
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[], {
|
|
48
|
-
|
|
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
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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.
|
|
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
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
type
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
/**
|
|
26
|
-
*
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
*
|
|
36
|
-
*/
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
declare function
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
declare const
|
|
97
|
-
|
|
98
|
-
declare
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
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 { }
|