storybook-react-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/dist/chunks/generate-1782ed11.js +86 -0
- package/dist/chunks/options-7e849a08.js +9 -0
- package/dist/chunks/react-docgen-typescript-9f56b1df.js +99 -0
- package/dist/chunks/typescript-69cd7fa9.js +13 -0
- package/dist/index.d.ts +75 -54
- package/dist/index.js +1 -5
- package/dist/loaders/react-docgen-loader.d.ts +12 -10
- package/dist/loaders/react-docgen-loader.js +154 -180
- package/dist/node/index.d.ts +71 -55
- package/dist/node/index.js +3 -18
- package/dist/preset.d.ts +74 -55
- package/dist/preset.js +84 -90
- package/package.json +10 -11
- package/dist/_node-chunks/chunk-TPE2Q567.js +0 -21
- package/dist/_node-chunks/generate-4YW4NBRQ.js +0 -168
- package/dist/_node-chunks/options-YEVZIRR2.js +0 -24
- package/dist/_node-chunks/react-docgen-typescript-R6NQ22Y3.js +0 -114
- package/dist/_node-chunks/typescript-VNYISKUD.js +0 -33
|
@@ -1,196 +1,170 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var require = CJS_COMPAT_NODE_MODULE_a0ef041aa6a9c434.createRequire(import.meta.url);
|
|
8
|
-
|
|
9
|
-
// ------------------------------------------------------------
|
|
10
|
-
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
-
// ------------------------------------------------------------
|
|
12
|
-
import "../_node-chunks/chunk-TPE2Q567.js";
|
|
13
|
-
|
|
14
|
-
// src/loaders/react-docgen-loader.ts
|
|
15
|
-
import findUp from "find-up";
|
|
16
|
-
import MagicString from "magic-string";
|
|
17
|
-
import {
|
|
18
|
-
builtinHandlers as docgenHandlers,
|
|
19
|
-
builtinResolvers as docgenResolver,
|
|
20
|
-
ERROR_CODES,
|
|
21
|
-
makeFsImporter,
|
|
22
|
-
parse,
|
|
23
|
-
utils
|
|
24
|
-
} from "react-docgen";
|
|
1
|
+
import "node:module";
|
|
2
|
+
import magic_string from "magic-string";
|
|
3
|
+
import { existsSync } from "node:fs";
|
|
4
|
+
import { dirname, extname, sep } from "node:path";
|
|
5
|
+
import { ERROR_CODES, builtinHandlers, builtinResolvers, makeFsImporter, parse, utils } from "react-docgen";
|
|
6
|
+
import { findTsconfigPathForFile, getTsconfigPathsBaseDir } from "storybook/internal/common";
|
|
25
7
|
import { logger } from "storybook/internal/node-logger";
|
|
26
|
-
import * as TsconfigPaths from "tsconfig-paths";
|
|
27
|
-
|
|
28
|
-
// src/loaders/docgen-resolver.ts
|
|
29
|
-
import { extname } from "node:path";
|
|
30
8
|
import resolve from "resolve";
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
".mts",
|
|
52
|
-
".cts",
|
|
53
|
-
".jsx"
|
|
9
|
+
import * as __rspack_external_tsconfig_paths_8d3c5087 from "tsconfig-paths";
|
|
10
|
+
class ReactDocgenResolveError extends Error {
|
|
11
|
+
code = 'MODULE_NOT_FOUND';
|
|
12
|
+
constructor(filename){
|
|
13
|
+
super(`'${filename}' was ignored by react-docgen.`);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
const RESOLVE_EXTENSIONS = [
|
|
17
|
+
'.js',
|
|
18
|
+
'.cts',
|
|
19
|
+
'.mts',
|
|
20
|
+
'.ctsx',
|
|
21
|
+
'.mtsx',
|
|
22
|
+
'.ts',
|
|
23
|
+
'.tsx',
|
|
24
|
+
'.mjs',
|
|
25
|
+
'.cjs',
|
|
26
|
+
'.mts',
|
|
27
|
+
'.cts',
|
|
28
|
+
'.jsx'
|
|
54
29
|
];
|
|
55
30
|
function defaultLookupModule(filename, basedir) {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
31
|
+
const resolveOptions = {
|
|
32
|
+
basedir,
|
|
33
|
+
extensions: RESOLVE_EXTENSIONS,
|
|
34
|
+
includeCoreModules: false
|
|
35
|
+
};
|
|
36
|
+
try {
|
|
37
|
+
return resolve.sync(filename, resolveOptions);
|
|
38
|
+
} catch (error) {
|
|
39
|
+
const ext = extname(filename);
|
|
40
|
+
let newFilename;
|
|
41
|
+
switch(ext){
|
|
42
|
+
case '.js':
|
|
43
|
+
case '.mjs':
|
|
44
|
+
case '.cjs':
|
|
45
|
+
{
|
|
46
|
+
const tsFilename = `${filename.slice(0, -2)}ts`;
|
|
47
|
+
try {
|
|
48
|
+
return resolve.sync(tsFilename, {
|
|
49
|
+
...resolveOptions,
|
|
50
|
+
extensions: []
|
|
51
|
+
});
|
|
52
|
+
} catch {
|
|
53
|
+
newFilename = `${filename.slice(0, -2)}tsx`;
|
|
54
|
+
}
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
case '.jsx':
|
|
58
|
+
newFilename = `${filename.slice(0, -3)}tsx`;
|
|
59
|
+
break;
|
|
60
|
+
default:
|
|
61
|
+
throw error;
|
|
62
|
+
}
|
|
63
|
+
return resolve.sync(newFilename, {
|
|
73
64
|
...resolveOptions,
|
|
74
65
|
extensions: []
|
|
75
|
-
|
|
76
|
-
} catch {
|
|
77
|
-
newFilename = `${filename.slice(0, -2)}tsx`;
|
|
78
|
-
}
|
|
79
|
-
break;
|
|
80
|
-
}
|
|
81
|
-
case ".jsx":
|
|
82
|
-
newFilename = `${filename.slice(0, -3)}tsx`;
|
|
83
|
-
break;
|
|
84
|
-
default:
|
|
85
|
-
throw error;
|
|
66
|
+
});
|
|
86
67
|
}
|
|
87
|
-
return resolve.sync(newFilename, {
|
|
88
|
-
...resolveOptions,
|
|
89
|
-
// we already know that there is an extension at this point, so no need to check other extensions
|
|
90
|
-
extensions: []
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
68
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
"actualName",
|
|
108
|
-
getNameOrValue(currentPath.parentPath.get("id"))
|
|
109
|
-
);
|
|
110
|
-
return;
|
|
111
|
-
}
|
|
112
|
-
if (currentPath.parentPath.isAssignmentExpression()) {
|
|
113
|
-
let leftPath = currentPath.parentPath.get("left");
|
|
114
|
-
if (leftPath.isIdentifier() || leftPath.isLiteral()) {
|
|
115
|
-
documentation.set("actualName", getNameOrValue(leftPath));
|
|
116
|
-
return;
|
|
69
|
+
const { getNameOrValue: getNameOrValue, isReactForwardRefCall: isReactForwardRefCall } = utils;
|
|
70
|
+
const react_docgen_loader_actualNameHandler = function(documentation, componentDefinition) {
|
|
71
|
+
documentation.set('definedInFile', componentDefinition.hub.file.opts.filename);
|
|
72
|
+
if ((componentDefinition.isClassDeclaration() || componentDefinition.isFunctionDeclaration()) && componentDefinition.has('id')) documentation.set('actualName', getNameOrValue(componentDefinition.get('id')));
|
|
73
|
+
else if (componentDefinition.isArrowFunctionExpression() || componentDefinition.isFunctionExpression() || isReactForwardRefCall(componentDefinition)) {
|
|
74
|
+
let currentPath = componentDefinition;
|
|
75
|
+
while(currentPath.parentPath){
|
|
76
|
+
if (currentPath.parentPath.isVariableDeclarator()) return void documentation.set('actualName', getNameOrValue(currentPath.parentPath.get('id')));
|
|
77
|
+
if (currentPath.parentPath.isAssignmentExpression()) {
|
|
78
|
+
const leftPath = currentPath.parentPath.get('left');
|
|
79
|
+
if (leftPath.isIdentifier() || leftPath.isLiteral()) return void documentation.set('actualName', getNameOrValue(leftPath));
|
|
80
|
+
}
|
|
81
|
+
currentPath = currentPath.parentPath;
|
|
117
82
|
}
|
|
118
|
-
|
|
119
|
-
currentPath = currentPath.parentPath;
|
|
83
|
+
documentation.set('actualName', '');
|
|
120
84
|
}
|
|
121
|
-
documentation.set("actualName", "");
|
|
122
|
-
}
|
|
123
|
-
}, defaultHandlers = Object.values(docgenHandlers).map((handler) => handler), defaultResolver = new docgenResolver.FindExportedDefinitionsResolver(), handlers = [...defaultHandlers, actualNameHandler], tsconfigPathsInitializeStatus = "uninitialized", resolveTsconfigPathsInitialingPromise, tsconfigPathsInitialingPromise = new Promise((resolve2) => {
|
|
124
|
-
resolveTsconfigPathsInitialingPromise = resolve2;
|
|
125
|
-
}), finishInitialization = () => {
|
|
126
|
-
resolveTsconfigPathsInitialingPromise(), tsconfigPathsInitializeStatus = "initialized";
|
|
127
|
-
}, matchPath, TSCONFIG_CANDIDATES = [
|
|
128
|
-
"tsconfig.json",
|
|
129
|
-
"tsconfig.base.json",
|
|
130
|
-
"tsconfig.app.json"
|
|
131
|
-
], findTsconfigPath = async (cwd) => {
|
|
132
|
-
for (let candidate of TSCONFIG_CANDIDATES) {
|
|
133
|
-
let found = await findUp(candidate, { cwd });
|
|
134
|
-
if (found)
|
|
135
|
-
return found;
|
|
136
|
-
}
|
|
137
85
|
};
|
|
86
|
+
const defaultHandlers = Object.values(builtinHandlers).map((handler)=>handler);
|
|
87
|
+
const defaultResolver = new builtinResolvers.FindExportedDefinitionsResolver();
|
|
88
|
+
const handlers = [
|
|
89
|
+
...defaultHandlers,
|
|
90
|
+
react_docgen_loader_actualNameHandler
|
|
91
|
+
];
|
|
138
92
|
async function reactDocgenLoader(source, map) {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
93
|
+
const callback = this.async();
|
|
94
|
+
const options = this.getOptions() || {};
|
|
95
|
+
const { debug = false } = options;
|
|
96
|
+
try {
|
|
97
|
+
const matchPath = createTsconfigMatchPath(this.resourcePath);
|
|
98
|
+
const docgenResults = parse(source, {
|
|
99
|
+
filename: this.resourcePath,
|
|
100
|
+
resolver: defaultResolver,
|
|
101
|
+
handlers: handlers,
|
|
102
|
+
importer: getReactDocgenImporter(matchPath),
|
|
103
|
+
babelOptions: {
|
|
104
|
+
babelrc: false,
|
|
105
|
+
configFile: false
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
const magicString = new magic_string(source);
|
|
109
|
+
for (const info of docgenResults){
|
|
110
|
+
const { actualName, definedInFile, ...docgenInfo } = info;
|
|
111
|
+
if (actualName && definedInFile === this.resourcePath) {
|
|
112
|
+
const docNode = JSON.stringify(docgenInfo);
|
|
113
|
+
magicString.append(`;${actualName}.__docgenInfo=${docNode}`);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
callback(null, magicString.toString(), map ?? magicString.generateMap({
|
|
117
|
+
hires: true,
|
|
118
|
+
source: this.resourcePath,
|
|
119
|
+
includeContent: true
|
|
120
|
+
}));
|
|
121
|
+
} catch (error) {
|
|
122
|
+
if (error.code === ERROR_CODES.MISSING_DEFINITION) callback(null, source);
|
|
123
|
+
else {
|
|
124
|
+
if (debug) {
|
|
125
|
+
logger.warn(`Failed to parse ${this.resourcePath} with react-docgen. Please use the below error message and the content of the file which causes the error to report the issue to the maintainers of react-docgen. https://github.com/reactjs/react-docgen`);
|
|
126
|
+
logger.error(error);
|
|
127
|
+
} else logger.warn(`Failed to parse ${this.resourcePath} with react-docgen. Rerun Storybook with --loglevel=debug to get more info.`);
|
|
128
|
+
callback(null, source);
|
|
129
|
+
}
|
|
167
130
|
}
|
|
168
|
-
callback(
|
|
169
|
-
null,
|
|
170
|
-
magicString.toString(),
|
|
171
|
-
map ?? magicString.generateMap({
|
|
172
|
-
hires: !0,
|
|
173
|
-
source: this.resourcePath,
|
|
174
|
-
includeContent: !0
|
|
175
|
-
})
|
|
176
|
-
);
|
|
177
|
-
} catch (error) {
|
|
178
|
-
error.code === ERROR_CODES.MISSING_DEFINITION || (debug ? (logger.warn(
|
|
179
|
-
`Failed to parse ${this.resourcePath} with react-docgen. Please use the below error message and the content of the file which causes the error to report the issue to the maintainers of react-docgen. https://github.com/reactjs/react-docgen`
|
|
180
|
-
), logger.error(error)) : logger.warn(
|
|
181
|
-
`Failed to parse ${this.resourcePath} with react-docgen. Rerun Storybook with --loglevel=debug to get more info.`
|
|
182
|
-
)), callback(null, source);
|
|
183
|
-
}
|
|
184
131
|
}
|
|
185
132
|
function getReactDocgenImporter(matchingPath) {
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
133
|
+
return makeFsImporter((filename, basedir)=>{
|
|
134
|
+
const mappedFilenameByPaths = (()=>{
|
|
135
|
+
if (matchingPath) {
|
|
136
|
+
const match = matchingPath(filename);
|
|
137
|
+
return match || filename;
|
|
138
|
+
}
|
|
139
|
+
return filename;
|
|
140
|
+
})();
|
|
141
|
+
const result = defaultLookupModule(mappedFilenameByPaths, basedir);
|
|
142
|
+
if (result.includes(`${sep}react-native${sep}index.js`)) {
|
|
143
|
+
const replaced = result.replace(`${sep}react-native${sep}index.js`, `${sep}react-native-web${sep}dist${sep}index.js`);
|
|
144
|
+
if (existsSync(replaced)) {
|
|
145
|
+
if (RESOLVE_EXTENSIONS.find((ext)=>result.endsWith(ext))) return replaced;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
if (RESOLVE_EXTENSIONS.find((ext)=>result.endsWith(ext))) return result;
|
|
149
|
+
throw new ReactDocgenResolveError(filename);
|
|
150
|
+
});
|
|
192
151
|
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
152
|
+
const matchPathByTsconfigPath = new Map();
|
|
153
|
+
function createTsconfigMatchPath(filePath) {
|
|
154
|
+
const tsconfigPath = findTsconfigPathForFile(dirname(filePath), filePath);
|
|
155
|
+
if (!tsconfigPath) return;
|
|
156
|
+
const cached = matchPathByTsconfigPath.get(tsconfigPath);
|
|
157
|
+
if (cached) return cached;
|
|
158
|
+
const tsconfig = __rspack_external_tsconfig_paths_8d3c5087.loadConfig(tsconfigPath);
|
|
159
|
+
if ('success' !== tsconfig.resultType) return;
|
|
160
|
+
logger.debug('Using tsconfig paths for react-docgen');
|
|
161
|
+
const matchPath = __rspack_external_tsconfig_paths_8d3c5087.createMatchPath(getTsconfigPathsBaseDir(tsconfig.configFileAbsolutePath), tsconfig.paths, [
|
|
162
|
+
'browser',
|
|
163
|
+
'module',
|
|
164
|
+
'main'
|
|
165
|
+
]);
|
|
166
|
+
matchPathByTsconfigPath.set(tsconfigPath, matchPath);
|
|
167
|
+
return matchPath;
|
|
168
|
+
}
|
|
169
|
+
export default reactDocgenLoader;
|
|
170
|
+
export { getReactDocgenImporter };
|
package/dist/node/index.d.ts
CHANGED
|
@@ -1,55 +1,71 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
type
|
|
6
|
-
type
|
|
7
|
-
type
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* @default
|
|
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
|
-
|
|
1
|
+
import type { BuilderOptions } from 'storybook-builder-rsbuild';
|
|
2
|
+
import type { CompatibleString } from 'storybook/internal/types';
|
|
3
|
+
import type { PluginOptions } from '@storybook/react-docgen-typescript-plugin';
|
|
4
|
+
import type { StorybookConfig as StorybookConfig_2 } from 'storybook/internal/types';
|
|
5
|
+
import type { StorybookConfigRsbuild } from 'storybook-builder-rsbuild';
|
|
6
|
+
import type { TypescriptOptions } from 'storybook/internal/types';
|
|
7
|
+
import type { TypescriptOptions as TypescriptOptions_2 } from 'storybook-builder-rsbuild';
|
|
8
|
+
|
|
9
|
+
declare type BuilderName = CompatibleString<'storybook-builder-rsbuild'>;
|
|
10
|
+
|
|
11
|
+
export declare function defineMain(config: StorybookConfig): StorybookConfig;
|
|
12
|
+
|
|
13
|
+
declare type FrameworkName = CompatibleString<'storybook-react-rsbuild'>;
|
|
14
|
+
|
|
15
|
+
declare type FrameworkOptions = {
|
|
16
|
+
builder?: BuilderOptions;
|
|
17
|
+
strictMode?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Use React's legacy root API to mount components
|
|
20
|
+
* @description
|
|
21
|
+
* React has introduced a new root API with React 18.x to enable a whole set of new features (e.g. concurrent features)
|
|
22
|
+
* If this flag is true, the legacy Root API is used to mount components to make it easier to migrate step by step to React 18.
|
|
23
|
+
* @default false
|
|
24
|
+
*/
|
|
25
|
+
legacyRootApi?: boolean;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The interface for Storybook configuration in `main.ts` files.
|
|
30
|
+
*/
|
|
31
|
+
export declare type StorybookConfig = Omit<StorybookConfig_2, keyof StorybookConfigRsbuild | keyof StorybookConfigFramework> & StorybookConfigRsbuild & StorybookConfigFramework;
|
|
32
|
+
|
|
33
|
+
declare type StorybookConfigFramework = {
|
|
34
|
+
framework: FrameworkName | {
|
|
35
|
+
name: FrameworkName;
|
|
36
|
+
options: FrameworkOptions;
|
|
37
|
+
};
|
|
38
|
+
core?: StorybookConfig_2['core'] & {
|
|
39
|
+
builder?: BuilderName | {
|
|
40
|
+
name: BuilderName;
|
|
41
|
+
options: BuilderOptions;
|
|
42
|
+
};
|
|
43
|
+
};
|
|
44
|
+
features?: StorybookConfig_2['features'] & {
|
|
45
|
+
/**
|
|
46
|
+
* Enable the experimental `.test` function in CSF Next
|
|
47
|
+
*
|
|
48
|
+
* @see https://storybook.js.org/docs/api/main-config/main-config-features#experimentaltestsyntax
|
|
49
|
+
*/
|
|
50
|
+
experimentalTestSyntax?: boolean;
|
|
51
|
+
};
|
|
52
|
+
typescript?: Partial<TypescriptOptions & TypescriptOptions_2 & TypescriptOptionsReact>;
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
declare type TypescriptOptionsReact = {
|
|
56
|
+
/**
|
|
57
|
+
* Sets the type of Docgen when working with React and TypeScript
|
|
58
|
+
*
|
|
59
|
+
* @default `'react-docgen'`
|
|
60
|
+
*/
|
|
61
|
+
reactDocgen: 'react-docgen-typescript' | 'react-docgen' | false;
|
|
62
|
+
/**
|
|
63
|
+
* Configures `react-docgen-typescript-plugin`
|
|
64
|
+
*
|
|
65
|
+
* @default
|
|
66
|
+
* @see https://github.com/storybookjs/storybook/blob/next/code/builders/builder-webpack5/src/config/defaults.js#L4-L6
|
|
67
|
+
*/
|
|
68
|
+
reactDocgenTypescriptOptions: PluginOptions;
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export { }
|
package/dist/node/index.js
CHANGED
|
@@ -1,20 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
import CJS_COMPAT_NODE_PATH_a0ef041aa6a9c434 from 'node:path';
|
|
3
|
-
import CJS_COMPAT_NODE_MODULE_a0ef041aa6a9c434 from "node:module";
|
|
4
|
-
|
|
5
|
-
var __filename = CJS_COMPAT_NODE_URL_a0ef041aa6a9c434.fileURLToPath(import.meta.url);
|
|
6
|
-
var __dirname = CJS_COMPAT_NODE_PATH_a0ef041aa6a9c434.dirname(__filename);
|
|
7
|
-
var require = CJS_COMPAT_NODE_MODULE_a0ef041aa6a9c434.createRequire(import.meta.url);
|
|
8
|
-
|
|
9
|
-
// ------------------------------------------------------------
|
|
10
|
-
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
-
// ------------------------------------------------------------
|
|
12
|
-
import "../_node-chunks/chunk-TPE2Q567.js";
|
|
13
|
-
|
|
14
|
-
// src/node/index.ts
|
|
1
|
+
import "node:module";
|
|
15
2
|
function defineMain(config) {
|
|
16
|
-
|
|
3
|
+
return config;
|
|
17
4
|
}
|
|
18
|
-
export {
|
|
19
|
-
defineMain
|
|
20
|
-
};
|
|
5
|
+
export { defineMain };
|
package/dist/preset.d.ts
CHANGED
|
@@ -1,55 +1,74 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
type
|
|
6
|
-
type
|
|
7
|
-
type
|
|
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
|
-
type
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
1
|
+
import type { BuilderOptions } from 'storybook-builder-rsbuild';
|
|
2
|
+
import type { CompatibleString } from 'storybook/internal/types';
|
|
3
|
+
import type { PluginOptions } from '@storybook/react-docgen-typescript-plugin';
|
|
4
|
+
import type { PresetProperty } from 'storybook/internal/types';
|
|
5
|
+
import type { StorybookConfig as StorybookConfig_2 } from 'storybook/internal/types';
|
|
6
|
+
import type { StorybookConfigRsbuild } from 'storybook-builder-rsbuild';
|
|
7
|
+
import type { TypescriptOptions } from 'storybook/internal/types';
|
|
8
|
+
import type { TypescriptOptions as TypescriptOptions_2 } from 'storybook-builder-rsbuild';
|
|
9
|
+
|
|
10
|
+
declare type BuilderName = CompatibleString<'storybook-builder-rsbuild'>;
|
|
11
|
+
|
|
12
|
+
export declare const core: PresetProperty<'core'>;
|
|
13
|
+
|
|
14
|
+
declare type FrameworkName = CompatibleString<'storybook-react-rsbuild'>;
|
|
15
|
+
|
|
16
|
+
declare type FrameworkOptions = {
|
|
17
|
+
builder?: BuilderOptions;
|
|
18
|
+
strictMode?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Use React's legacy root API to mount components
|
|
21
|
+
* @description
|
|
22
|
+
* React has introduced a new root API with React 18.x to enable a whole set of new features (e.g. concurrent features)
|
|
23
|
+
* If this flag is true, the legacy Root API is used to mount components to make it easier to migrate step by step to React 18.
|
|
24
|
+
* @default false
|
|
25
|
+
*/
|
|
26
|
+
legacyRootApi?: boolean;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export declare const rsbuildFinal: NonNullable<StorybookConfig['rsbuildFinal']>;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The interface for Storybook configuration in `main.ts` files.
|
|
33
|
+
*/
|
|
34
|
+
declare type StorybookConfig = Omit<StorybookConfig_2, keyof StorybookConfigRsbuild | keyof StorybookConfigFramework> & StorybookConfigRsbuild & StorybookConfigFramework;
|
|
35
|
+
|
|
36
|
+
declare type StorybookConfigFramework = {
|
|
37
|
+
framework: FrameworkName | {
|
|
38
|
+
name: FrameworkName;
|
|
39
|
+
options: FrameworkOptions;
|
|
40
|
+
};
|
|
41
|
+
core?: StorybookConfig_2['core'] & {
|
|
42
|
+
builder?: BuilderName | {
|
|
43
|
+
name: BuilderName;
|
|
44
|
+
options: BuilderOptions;
|
|
45
|
+
};
|
|
46
|
+
};
|
|
47
|
+
features?: StorybookConfig_2['features'] & {
|
|
48
|
+
/**
|
|
49
|
+
* Enable the experimental `.test` function in CSF Next
|
|
50
|
+
*
|
|
51
|
+
* @see https://storybook.js.org/docs/api/main-config/main-config-features#experimentaltestsyntax
|
|
52
|
+
*/
|
|
53
|
+
experimentalTestSyntax?: boolean;
|
|
54
|
+
};
|
|
55
|
+
typescript?: Partial<TypescriptOptions & TypescriptOptions_2 & TypescriptOptionsReact>;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
declare type TypescriptOptionsReact = {
|
|
59
|
+
/**
|
|
60
|
+
* Sets the type of Docgen when working with React and TypeScript
|
|
61
|
+
*
|
|
62
|
+
* @default `'react-docgen'`
|
|
63
|
+
*/
|
|
64
|
+
reactDocgen: 'react-docgen-typescript' | 'react-docgen' | false;
|
|
65
|
+
/**
|
|
66
|
+
* Configures `react-docgen-typescript-plugin`
|
|
67
|
+
*
|
|
68
|
+
* @default
|
|
69
|
+
* @see https://github.com/storybookjs/storybook/blob/next/code/builders/builder-webpack5/src/config/defaults.js#L4-L6
|
|
70
|
+
*/
|
|
71
|
+
reactDocgenTypescriptOptions: PluginOptions;
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export { }
|