@storybook/react 11.0.0-beta.3 → 11.0.0-beta.5
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/_browser-chunks/{chunk-U7XUEUFQ.js → chunk-LK5PKCYS.js} +1 -1
- package/dist/_browser-chunks/{chunk-EA5DV32Q.js → chunk-XQNZ5YRO.js} +3 -2
- package/dist/_node-chunks/{chunk-YSSTGZG6.js → chunk-2DC27WWN.js} +202 -335
- package/dist/_node-chunks/{chunk-23AJ2HMB.js → chunk-2NYPPHY3.js} +1 -12
- package/dist/_node-chunks/{chunk-YAHZ47OQ.js → chunk-CJ2XYAXX.js} +1 -12
- package/dist/_node-chunks/{chunk-ZQMXVWN3.js → chunk-HRHJMJC7.js} +1 -12
- package/dist/_node-chunks/chunk-MYBSMCSW.js +6 -0
- package/dist/_node-chunks/{chunk-J7MJPACM.js → chunk-N7TOZR54.js} +3 -14
- package/dist/_node-chunks/{chunk-MA6UOA7T.js → chunk-PQZIOGBY.js} +1 -11
- package/dist/_node-chunks/{chunk-OICUDNLP.js → chunk-QKPKKS4R.js} +1 -12
- package/dist/_node-chunks/{chunk-WCSAV7ZK.js → chunk-SC3QXTHH.js} +12 -23
- package/dist/_node-chunks/chunk-WSXDRG6X.js +120 -0
- package/dist/_node-chunks/extractArgTypesFromComponentFile-E3P24DW4.js +33 -0
- package/dist/_node-chunks/{extractReactDocgenInfo-XQKB6M4O.js → extractReactDocgenInfo-L44YP4OM.js} +5 -16
- package/dist/_node-chunks/{extractReactTypescriptDocgenInfo-X3XIYU7H.js → extractReactTypescriptDocgenInfo-XLLLW3MT.js} +3 -14
- package/dist/_node-chunks/reactDocgen-WMOVFLAX.js +15 -0
- package/dist/builder-docgen.js +3 -14
- package/dist/docgen/docgen-worker.js +9 -20
- package/dist/entry-preview-docs.js +1 -1
- package/dist/index.js +2 -2
- package/dist/preset.js +11 -146
- package/dist/preview.js +2 -2
- package/package.json +3 -3
- package/dist/_node-chunks/chunk-DYAQFVW4.js +0 -93
- package/dist/_node-chunks/chunk-IHFW4SZ5.js +0 -18
- package/dist/_node-chunks/extractArgTypesFromComponentFile-U3IU4PU3.js +0 -44
- package/dist/_node-chunks/reactDocgen-US7O3JSK.js +0 -26
- /package/template/cli/ts/{Button.stories.ts → Button.stories.tsx} +0 -0
- /package/template/cli/ts/{Header.stories.ts → Header.stories.tsx} +0 -0
- /package/template/cli/ts/{Page.stories.ts → Page.stories.tsx} +0 -0
|
@@ -1,18 +1,7 @@
|
|
|
1
|
-
import CJS_COMPAT_NODE_URL_f25fxbi8k7f from 'node:url';
|
|
2
|
-
import CJS_COMPAT_NODE_PATH_f25fxbi8k7f from 'node:path';
|
|
3
|
-
import CJS_COMPAT_NODE_MODULE_f25fxbi8k7f from "node:module";
|
|
4
|
-
|
|
5
|
-
var __filename = CJS_COMPAT_NODE_URL_f25fxbi8k7f.fileURLToPath(import.meta.url);
|
|
6
|
-
var __dirname = CJS_COMPAT_NODE_PATH_f25fxbi8k7f.dirname(__filename);
|
|
7
|
-
var require = CJS_COMPAT_NODE_MODULE_f25fxbi8k7f.createRequire(import.meta.url);
|
|
8
|
-
|
|
9
|
-
// ------------------------------------------------------------
|
|
10
|
-
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
-
// ------------------------------------------------------------
|
|
12
1
|
import {
|
|
13
2
|
ComponentMetaManager,
|
|
14
3
|
loadDocgenTypeScript
|
|
15
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-2DC27WWN.js";
|
|
16
5
|
|
|
17
6
|
// src/componentManifest/componentMetaManagerSingleton.ts
|
|
18
7
|
import { logger } from "storybook/internal/node-logger";
|
|
@@ -1,19 +1,8 @@
|
|
|
1
|
-
import CJS_COMPAT_NODE_URL_f25fxbi8k7f from 'node:url';
|
|
2
|
-
import CJS_COMPAT_NODE_PATH_f25fxbi8k7f from 'node:path';
|
|
3
|
-
import CJS_COMPAT_NODE_MODULE_f25fxbi8k7f from "node:module";
|
|
4
|
-
|
|
5
|
-
var __filename = CJS_COMPAT_NODE_URL_f25fxbi8k7f.fileURLToPath(import.meta.url);
|
|
6
|
-
var __dirname = CJS_COMPAT_NODE_PATH_f25fxbi8k7f.dirname(__filename);
|
|
7
|
-
var require = CJS_COMPAT_NODE_MODULE_f25fxbi8k7f.createRequire(import.meta.url);
|
|
8
|
-
|
|
9
|
-
// ------------------------------------------------------------
|
|
10
|
-
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
-
// ------------------------------------------------------------
|
|
12
1
|
import {
|
|
13
2
|
__commonJS,
|
|
14
3
|
__require,
|
|
15
4
|
__toESM
|
|
16
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-PQZIOGBY.js";
|
|
17
6
|
|
|
18
7
|
// ../../../node_modules/tsconfig-paths/lib/filesystem.js
|
|
19
8
|
var require_filesystem = __commonJS({
|
|
@@ -1,17 +1,6 @@
|
|
|
1
|
-
import CJS_COMPAT_NODE_URL_f25fxbi8k7f from 'node:url';
|
|
2
|
-
import CJS_COMPAT_NODE_PATH_f25fxbi8k7f from 'node:path';
|
|
3
|
-
import CJS_COMPAT_NODE_MODULE_f25fxbi8k7f from "node:module";
|
|
4
|
-
|
|
5
|
-
var __filename = CJS_COMPAT_NODE_URL_f25fxbi8k7f.fileURLToPath(import.meta.url);
|
|
6
|
-
var __dirname = CJS_COMPAT_NODE_PATH_f25fxbi8k7f.dirname(__filename);
|
|
7
|
-
var require = CJS_COMPAT_NODE_MODULE_f25fxbi8k7f.createRequire(import.meta.url);
|
|
8
|
-
|
|
9
|
-
// ------------------------------------------------------------
|
|
10
|
-
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
-
// ------------------------------------------------------------
|
|
12
1
|
import {
|
|
13
2
|
REACT_DOCGEN_TYPESCRIPT_APIS
|
|
14
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-MYBSMCSW.js";
|
|
15
4
|
|
|
16
5
|
// src/builder-docgen.ts
|
|
17
6
|
import {
|
|
@@ -1,28 +1,17 @@
|
|
|
1
|
-
import CJS_COMPAT_NODE_URL_f25fxbi8k7f from 'node:url';
|
|
2
|
-
import CJS_COMPAT_NODE_PATH_f25fxbi8k7f from 'node:path';
|
|
3
|
-
import CJS_COMPAT_NODE_MODULE_f25fxbi8k7f from "node:module";
|
|
4
|
-
|
|
5
|
-
var __filename = CJS_COMPAT_NODE_URL_f25fxbi8k7f.fileURLToPath(import.meta.url);
|
|
6
|
-
var __dirname = CJS_COMPAT_NODE_PATH_f25fxbi8k7f.dirname(__filename);
|
|
7
|
-
var require = CJS_COMPAT_NODE_MODULE_f25fxbi8k7f.createRequire(import.meta.url);
|
|
8
|
-
|
|
9
|
-
// ------------------------------------------------------------
|
|
10
|
-
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
-
// ------------------------------------------------------------
|
|
12
1
|
import {
|
|
13
2
|
cached,
|
|
14
3
|
cachedReadFileSync,
|
|
15
4
|
cachedResolveImport,
|
|
16
5
|
matchPath
|
|
17
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-CJ2XYAXX.js";
|
|
18
7
|
import {
|
|
19
8
|
require_dist
|
|
20
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-QKPKKS4R.js";
|
|
21
10
|
import {
|
|
22
11
|
__commonJS,
|
|
23
12
|
__require,
|
|
24
13
|
__toESM
|
|
25
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-PQZIOGBY.js";
|
|
26
15
|
|
|
27
16
|
// ../../../node_modules/resolve/lib/homedir.js
|
|
28
17
|
var require_homedir = __commonJS({
|
|
@@ -1,14 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
import CJS_COMPAT_NODE_PATH_f25fxbi8k7f from 'node:path';
|
|
3
|
-
import CJS_COMPAT_NODE_MODULE_f25fxbi8k7f from "node:module";
|
|
4
|
-
|
|
5
|
-
var __filename = CJS_COMPAT_NODE_URL_f25fxbi8k7f.fileURLToPath(import.meta.url);
|
|
6
|
-
var __dirname = CJS_COMPAT_NODE_PATH_f25fxbi8k7f.dirname(__filename);
|
|
7
|
-
var require = CJS_COMPAT_NODE_MODULE_f25fxbi8k7f.createRequire(import.meta.url);
|
|
8
|
-
|
|
9
|
-
// ------------------------------------------------------------
|
|
10
|
-
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
-
// ------------------------------------------------------------
|
|
1
|
+
import { createRequire as CJS_COMPAT_CREATE_REQUIRE_h7kvzawybx6 } from "node:module";var require = CJS_COMPAT_CREATE_REQUIRE_h7kvzawybx6(import.meta.url);
|
|
12
2
|
var __create = Object.create;
|
|
13
3
|
var __defProp = Object.defineProperty;
|
|
14
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -1,17 +1,6 @@
|
|
|
1
|
-
import CJS_COMPAT_NODE_URL_f25fxbi8k7f from 'node:url';
|
|
2
|
-
import CJS_COMPAT_NODE_PATH_f25fxbi8k7f from 'node:path';
|
|
3
|
-
import CJS_COMPAT_NODE_MODULE_f25fxbi8k7f from "node:module";
|
|
4
|
-
|
|
5
|
-
var __filename = CJS_COMPAT_NODE_URL_f25fxbi8k7f.fileURLToPath(import.meta.url);
|
|
6
|
-
var __dirname = CJS_COMPAT_NODE_PATH_f25fxbi8k7f.dirname(__filename);
|
|
7
|
-
var require = CJS_COMPAT_NODE_MODULE_f25fxbi8k7f.createRequire(import.meta.url);
|
|
8
|
-
|
|
9
|
-
// ------------------------------------------------------------
|
|
10
|
-
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
-
// ------------------------------------------------------------
|
|
12
1
|
import {
|
|
13
2
|
__commonJS
|
|
14
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-PQZIOGBY.js";
|
|
15
4
|
|
|
16
5
|
// ../../../node_modules/ts-dedent/dist/index.js
|
|
17
6
|
var require_dist = __commonJS({
|
|
@@ -1,24 +1,13 @@
|
|
|
1
|
-
import CJS_COMPAT_NODE_URL_f25fxbi8k7f from 'node:url';
|
|
2
|
-
import CJS_COMPAT_NODE_PATH_f25fxbi8k7f from 'node:path';
|
|
3
|
-
import CJS_COMPAT_NODE_MODULE_f25fxbi8k7f from "node:module";
|
|
4
|
-
|
|
5
|
-
var __filename = CJS_COMPAT_NODE_URL_f25fxbi8k7f.fileURLToPath(import.meta.url);
|
|
6
|
-
var __dirname = CJS_COMPAT_NODE_PATH_f25fxbi8k7f.dirname(__filename);
|
|
7
|
-
var require = CJS_COMPAT_NODE_MODULE_f25fxbi8k7f.createRequire(import.meta.url);
|
|
8
|
-
|
|
9
|
-
// ------------------------------------------------------------
|
|
10
|
-
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
-
// ------------------------------------------------------------
|
|
12
1
|
import {
|
|
13
2
|
require_dist
|
|
14
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-QKPKKS4R.js";
|
|
15
4
|
import {
|
|
16
5
|
__commonJS,
|
|
17
6
|
__esm,
|
|
18
7
|
__export,
|
|
19
8
|
__toCommonJS,
|
|
20
9
|
__toESM
|
|
21
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-PQZIOGBY.js";
|
|
22
11
|
|
|
23
12
|
// ../../../node_modules/estraverse/estraverse.js
|
|
24
13
|
var require_estraverse = __commonJS({
|
|
@@ -254,7 +243,7 @@ var require_estraverse = __commonJS({
|
|
|
254
243
|
}, Controller.prototype.__initialize = function(root, visitor) {
|
|
255
244
|
this.visitor = visitor, this.root = root, this.__worklist = [], this.__leavelist = [], this.__current = null, this.__state = null, this.__fallback = null, visitor.fallback === "iteration" ? this.__fallback = Object.keys : typeof visitor.fallback == "function" && (this.__fallback = visitor.fallback), this.__keys = VisitorKeys, visitor.keys && (this.__keys = Object.assign(Object.create(this.__keys), visitor.keys));
|
|
256
245
|
};
|
|
257
|
-
function
|
|
246
|
+
function isNode(node) {
|
|
258
247
|
return node == null ? !1 : typeof node == "object" && typeof node.type == "string";
|
|
259
248
|
}
|
|
260
249
|
function isProperty(nodeType, key) {
|
|
@@ -291,13 +280,13 @@ var require_estraverse = __commonJS({
|
|
|
291
280
|
if (candidate[current22] && !candidateExistsInLeaveList(leavelist, candidate[current22])) {
|
|
292
281
|
if (isProperty(nodeType, candidates[current2]))
|
|
293
282
|
element = new Element(candidate[current22], [key, current22], "Property", null);
|
|
294
|
-
else if (
|
|
283
|
+
else if (isNode(candidate[current22]))
|
|
295
284
|
element = new Element(candidate[current22], [key, current22], null, null);
|
|
296
285
|
else
|
|
297
286
|
continue;
|
|
298
287
|
worklist.push(element);
|
|
299
288
|
}
|
|
300
|
-
} else if (
|
|
289
|
+
} else if (isNode(candidate)) {
|
|
301
290
|
if (candidateExistsInLeaveList(leavelist, candidate))
|
|
302
291
|
continue;
|
|
303
292
|
worklist.push(new Element(candidate, key, null, null));
|
|
@@ -341,13 +330,13 @@ var require_estraverse = __commonJS({
|
|
|
341
330
|
if (candidate[current22]) {
|
|
342
331
|
if (isProperty(nodeType, candidates[current2]))
|
|
343
332
|
element = new Element(candidate[current22], [key, current22], "Property", new Reference(candidate, current22));
|
|
344
|
-
else if (
|
|
333
|
+
else if (isNode(candidate[current22]))
|
|
345
334
|
element = new Element(candidate[current22], [key, current22], null, new Reference(candidate, current22));
|
|
346
335
|
else
|
|
347
336
|
continue;
|
|
348
337
|
worklist.push(element);
|
|
349
338
|
}
|
|
350
|
-
} else
|
|
339
|
+
} else isNode(candidate) && worklist.push(new Element(candidate, key, null, new Reference(node, key)));
|
|
351
340
|
}
|
|
352
341
|
}
|
|
353
342
|
return outer.root;
|
|
@@ -6938,7 +6927,7 @@ var require_dist2 = __commonJS({
|
|
|
6938
6927
|
return "{}";
|
|
6939
6928
|
seen.push(input);
|
|
6940
6929
|
var ret = "{" + tokens.newLine + objKeys_1.map(function(el, i2) {
|
|
6941
|
-
var eol = objKeys_1.length - 1 === i2 ? tokens.newLine : "," + tokens.newLineOrSpace,
|
|
6930
|
+
var eol = objKeys_1.length - 1 === i2 ? tokens.newLine : "," + tokens.newLineOrSpace, isSymbol = typeof el == "symbol", isClassic = !isSymbol && /^[a-z$_][a-z$_0-9]*$/i.test(el.toString()), key = isSymbol || isClassic ? el : prettyPrint2(el, combinedOptions), value = prettyPrint2(input[el], combinedOptions, pad + combinedOptions.indent);
|
|
6942
6931
|
return combinedOptions.transform && (value = combinedOptions.transform(input, el, value)), tokens.indent + String(key) + ": " + value + eol;
|
|
6943
6932
|
}).join("") + tokens.pad + "}";
|
|
6944
6933
|
return seen.pop(), expandWhiteSpace(ret);
|
|
@@ -7584,7 +7573,7 @@ function _unsupportedIterableToArray(r, a) {
|
|
|
7584
7573
|
function safeSortObject(value, seen) {
|
|
7585
7574
|
if (value === null || _typeof(value) !== "object" || value instanceof Date || value instanceof RegExp)
|
|
7586
7575
|
return value;
|
|
7587
|
-
if (React.isValidElement(value)) {
|
|
7576
|
+
if (/* @__PURE__ */ React.isValidElement(value)) {
|
|
7588
7577
|
var copyObj = _objectSpread2({}, value);
|
|
7589
7578
|
return delete copyObj._owner, copyObj;
|
|
7590
7579
|
}
|
|
@@ -7675,7 +7664,7 @@ var createStringTreeNode = function(value) {
|
|
|
7675
7664
|
return createStringTreeNode(element);
|
|
7676
7665
|
if (typeof element == "number")
|
|
7677
7666
|
return createNumberTreeNode(element);
|
|
7678
|
-
if (
|
|
7667
|
+
if (!/* @__PURE__ */ React__default.isValidElement(element))
|
|
7679
7668
|
throw new Error("react-element-to-jsx-string: Expected a React.Element, got `".concat(_typeof(element), "`"));
|
|
7680
7669
|
var displayName = displayNameFn(element), props = filterProps(element.props, noChildren);
|
|
7681
7670
|
element.ref !== null && (props.ref = element.ref);
|
|
@@ -7701,7 +7690,7 @@ var defaultFunctionValue = inlineFunction, formatFunction = (function(fn, option
|
|
|
7701
7690
|
var normalizedValue = sortObject(value), stringifiedValue = (0, import_pretty_print_object.prettyPrint)(normalizedValue, {
|
|
7702
7691
|
transform: function(currentObj, prop, originalResult) {
|
|
7703
7692
|
var currentValue = currentObj[prop];
|
|
7704
|
-
return currentValue && isValidElement2(currentValue) ? formatTreeNode(_parseReactElement(currentValue, options), !0, lvl, options) : typeof currentValue == "function" ? formatFunction(currentValue, options) : originalResult;
|
|
7693
|
+
return currentValue && /* @__PURE__ */ isValidElement2(currentValue) ? formatTreeNode(_parseReactElement(currentValue, options), !0, lvl, options) : typeof currentValue == "function" ? formatFunction(currentValue, options) : originalResult;
|
|
7705
7694
|
}
|
|
7706
7695
|
});
|
|
7707
7696
|
return inline ? stringifiedValue.replace(/\s+/g, " ").replace(/{ /g, "{").replace(/ }/g, "}").replace(/\[ /g, "[").replace(/ ]/g, "]") : stringifiedValue.replace(/\t/g, spacer(1, options.tabStop)).replace(/\n([^$])/g, `
|
|
@@ -7717,7 +7706,7 @@ var defaultFunctionValue = inlineFunction, formatFunction = (function(fn, option
|
|
|
7717
7706
|
var symbolDescription = propValue.valueOf().toString().replace(/Symbol\((.*)\)/, "$1");
|
|
7718
7707
|
return symbolDescription ? "{Symbol('".concat(symbolDescription, "')}") : "{Symbol()}";
|
|
7719
7708
|
}
|
|
7720
|
-
return typeof propValue == "function" ? "{".concat(formatFunction(propValue, options), "}") : isValidElement2(propValue) ? "{".concat(formatTreeNode(_parseReactElement(propValue, options), !0, lvl, options), "}") : propValue instanceof Date ? isNaN(propValue.valueOf()) ? "{new Date(NaN)}" : '{new Date("'.concat(propValue.toISOString(), '")}') : isPlainObject2(propValue) || Array.isArray(propValue) ? "{".concat(formatComplexDataStructure(propValue, inline, lvl, options), "}") : "{".concat(String(propValue), "}");
|
|
7709
|
+
return typeof propValue == "function" ? "{".concat(formatFunction(propValue, options), "}") : /* @__PURE__ */ isValidElement2(propValue) ? "{".concat(formatTreeNode(_parseReactElement(propValue, options), !0, lvl, options), "}") : propValue instanceof Date ? isNaN(propValue.valueOf()) ? "{new Date(NaN)}" : '{new Date("'.concat(propValue.toISOString(), '")}') : isPlainObject2(propValue) || Array.isArray(propValue) ? "{".concat(formatComplexDataStructure(propValue, inline, lvl, options), "}") : "{".concat(String(propValue), "}");
|
|
7721
7710
|
}, formatProp = (function(name, hasValue, value, hasDefaultValue, defaultValue, inline, lvl, options) {
|
|
7722
7711
|
if (!hasValue && !hasDefaultValue)
|
|
7723
7712
|
throw new Error('The prop "'.concat(name, '" has no value and no default: could not be formatted'));
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import {
|
|
2
|
+
buildComponentDocgenFromResolved,
|
|
3
|
+
isExtractable,
|
|
4
|
+
posix,
|
|
5
|
+
resolveStoryFileComponents
|
|
6
|
+
} from "./chunk-2DC27WWN.js";
|
|
7
|
+
import {
|
|
8
|
+
extractArgTypes
|
|
9
|
+
} from "./chunk-SC3QXTHH.js";
|
|
10
|
+
|
|
11
|
+
// src/docgen/buildDocgen.ts
|
|
12
|
+
import { getStoryImportPathFromEntry } from "storybook/internal/common";
|
|
13
|
+
import { logger } from "storybook/internal/node-logger";
|
|
14
|
+
var REACT_ATTRIBUTE_INTERFACES = /* @__PURE__ */ new Set(["Attributes", "RefAttributes", "ClassAttributes"]);
|
|
15
|
+
function isReactAttribute(prop) {
|
|
16
|
+
return !!prop.parent && REACT_ATTRIBUTE_INTERFACES.has(prop.parent.name) && /(^|[\\/])node_modules[\\/]/.test(prop.parent.fileName);
|
|
17
|
+
}
|
|
18
|
+
function extractArgTypesFromComponentMeta(componentMeta) {
|
|
19
|
+
if (!componentMeta)
|
|
20
|
+
return;
|
|
21
|
+
let props = Object.fromEntries(
|
|
22
|
+
Object.entries(componentMeta.props).filter(([, prop]) => !isReactAttribute(prop)).map(([name, prop]) => [
|
|
23
|
+
name,
|
|
24
|
+
prop.defaultValue ? { ...prop, defaultValue: { ...prop.defaultValue, computed: !1 } } : prop
|
|
25
|
+
])
|
|
26
|
+
);
|
|
27
|
+
return extractArgTypes({ __docgenInfo: { ...componentMeta, props } }) ?? void 0;
|
|
28
|
+
}
|
|
29
|
+
function addArgTypesFromComponentMeta(payload) {
|
|
30
|
+
let argTypes = extractArgTypesFromComponentMeta(payload.reactComponentMeta), subcomponents = payload.subcomponents ? Object.fromEntries(
|
|
31
|
+
Object.entries(payload.subcomponents).map(([name, subcomponent]) => [
|
|
32
|
+
name,
|
|
33
|
+
{
|
|
34
|
+
...subcomponent,
|
|
35
|
+
argTypes: extractArgTypesFromComponentMeta(subcomponent.reactComponentMeta)
|
|
36
|
+
}
|
|
37
|
+
])
|
|
38
|
+
) : void 0;
|
|
39
|
+
return {
|
|
40
|
+
...payload,
|
|
41
|
+
...argTypes ? { argTypes } : {},
|
|
42
|
+
...subcomponents ? { subcomponents } : {}
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function toStoryRefs(storyPath, { component, subcomponents }) {
|
|
46
|
+
return [component, ...subcomponents.map((sub) => sub.component)].filter((ref) => ref !== void 0).map((ref) => ({ storyPath, component: ref }));
|
|
47
|
+
}
|
|
48
|
+
async function resolveStory({ entry }, context) {
|
|
49
|
+
let storyFilePath = getStoryImportPathFromEntry(entry);
|
|
50
|
+
if (!storyFilePath)
|
|
51
|
+
return;
|
|
52
|
+
let storyPath = resolveStoryPath(storyFilePath, context);
|
|
53
|
+
try {
|
|
54
|
+
let resolved = await resolveStoryFileComponents({
|
|
55
|
+
storyPath,
|
|
56
|
+
title: entry.title,
|
|
57
|
+
typescriptOptions: context.typescriptOptions,
|
|
58
|
+
docgenEngine: "react-component-meta"
|
|
59
|
+
});
|
|
60
|
+
return { storyFilePath, storyPath, resolved };
|
|
61
|
+
} catch {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
var resolveStoryPath = (storyFilePath, { resolvePath }) => resolvePath ? resolvePath(storyFilePath) : posix.join(process.cwd(), storyFilePath);
|
|
66
|
+
async function extractEach(inputs, extractOne) {
|
|
67
|
+
let results = [];
|
|
68
|
+
for (let input of inputs)
|
|
69
|
+
try {
|
|
70
|
+
results.push({ status: "fulfilled", value: await extractOne(input) });
|
|
71
|
+
} catch (reason) {
|
|
72
|
+
results.push({ status: "rejected", reason });
|
|
73
|
+
}
|
|
74
|
+
return results;
|
|
75
|
+
}
|
|
76
|
+
async function buildDocgenPayloads(inputs, context) {
|
|
77
|
+
if (inputs.length === 1)
|
|
78
|
+
return extractEach(inputs, (input) => buildDocgenPayload(input, context));
|
|
79
|
+
let refs = (await Promise.all(
|
|
80
|
+
inputs.map(async (input) => {
|
|
81
|
+
let story = await resolveStory(input, context);
|
|
82
|
+
return story ? toStoryRefs(story.storyPath, story.resolved) : [];
|
|
83
|
+
})
|
|
84
|
+
)).flat(), batchFiles;
|
|
85
|
+
try {
|
|
86
|
+
batchFiles = context.componentMetaManager.groupFilesByProject(
|
|
87
|
+
refs.filter(isExtractable).map(({ storyPath, component }) => ({
|
|
88
|
+
projectFile: storyPath,
|
|
89
|
+
files: [storyPath, component.path]
|
|
90
|
+
}))
|
|
91
|
+
);
|
|
92
|
+
} catch (err) {
|
|
93
|
+
logger.debug(`[reactComponentMeta] Grouping the batch files failed: ${err}`);
|
|
94
|
+
}
|
|
95
|
+
return extractEach(inputs, (input) => buildDocgenPayload(input, { ...context, batchFiles }));
|
|
96
|
+
}
|
|
97
|
+
async function buildDocgenPayload(input, context) {
|
|
98
|
+
let story = await resolveStory(input, context);
|
|
99
|
+
if (!story)
|
|
100
|
+
return;
|
|
101
|
+
let { storyFilePath, storyPath, resolved } = story, { csf, componentName, component, subcomponents, storyFile } = resolved, storyRefs = toStoryRefs(storyPath, resolved);
|
|
102
|
+
storyRefs.length > 0 && context.componentMetaManager.batchExtract(storyRefs, context.batchFiles);
|
|
103
|
+
let componentDocgen = buildComponentDocgenFromResolved({
|
|
104
|
+
entry: input.entry,
|
|
105
|
+
storyPath,
|
|
106
|
+
storyFilePath,
|
|
107
|
+
storyFile,
|
|
108
|
+
csf,
|
|
109
|
+
componentName,
|
|
110
|
+
component,
|
|
111
|
+
subcomponents,
|
|
112
|
+
docgenEngine: "react-component-meta"
|
|
113
|
+
});
|
|
114
|
+
return addArgTypesFromComponentMeta(componentDocgen);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export {
|
|
118
|
+
extractArgTypesFromComponentMeta,
|
|
119
|
+
buildDocgenPayloads
|
|
120
|
+
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getSharedComponentMetaManager
|
|
3
|
+
} from "./chunk-2NYPPHY3.js";
|
|
4
|
+
import {
|
|
5
|
+
extractArgTypesFromComponentMeta
|
|
6
|
+
} from "./chunk-WSXDRG6X.js";
|
|
7
|
+
import "./chunk-2DC27WWN.js";
|
|
8
|
+
import "./chunk-MYBSMCSW.js";
|
|
9
|
+
import "./chunk-CJ2XYAXX.js";
|
|
10
|
+
import "./chunk-SC3QXTHH.js";
|
|
11
|
+
import "./chunk-QKPKKS4R.js";
|
|
12
|
+
import "./chunk-PQZIOGBY.js";
|
|
13
|
+
|
|
14
|
+
// src/docgen/extractArgTypesFromComponentFile.ts
|
|
15
|
+
async function extractArgTypesFromComponentFile({
|
|
16
|
+
componentFilePath,
|
|
17
|
+
componentExportName = "default",
|
|
18
|
+
typeScriptSpecifier
|
|
19
|
+
}) {
|
|
20
|
+
let manager = await getSharedComponentMetaManager(typeScriptSpecifier);
|
|
21
|
+
if (!manager)
|
|
22
|
+
return null;
|
|
23
|
+
let component = {
|
|
24
|
+
componentName: componentExportName,
|
|
25
|
+
importName: componentExportName,
|
|
26
|
+
path: componentFilePath,
|
|
27
|
+
isPackage: !1
|
|
28
|
+
};
|
|
29
|
+
return manager.batchExtract([{ storyPath: componentFilePath, component }]), extractArgTypesFromComponentMeta(component.reactComponentMeta) ?? null;
|
|
30
|
+
}
|
|
31
|
+
export {
|
|
32
|
+
extractArgTypesFromComponentFile
|
|
33
|
+
};
|
package/dist/_node-chunks/{extractReactDocgenInfo-XQKB6M4O.js → extractReactDocgenInfo-L44YP4OM.js}
RENAMED
|
@@ -1,25 +1,14 @@
|
|
|
1
|
-
import CJS_COMPAT_NODE_URL_f25fxbi8k7f from 'node:url';
|
|
2
|
-
import CJS_COMPAT_NODE_PATH_f25fxbi8k7f from 'node:path';
|
|
3
|
-
import CJS_COMPAT_NODE_MODULE_f25fxbi8k7f from "node:module";
|
|
4
|
-
|
|
5
|
-
var __filename = CJS_COMPAT_NODE_URL_f25fxbi8k7f.fileURLToPath(import.meta.url);
|
|
6
|
-
var __dirname = CJS_COMPAT_NODE_PATH_f25fxbi8k7f.dirname(__filename);
|
|
7
|
-
var require = CJS_COMPAT_NODE_MODULE_f25fxbi8k7f.createRequire(import.meta.url);
|
|
8
|
-
|
|
9
|
-
// ------------------------------------------------------------
|
|
10
|
-
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
-
// ------------------------------------------------------------
|
|
12
1
|
import {
|
|
13
2
|
parseWithReactDocgen
|
|
14
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-N7TOZR54.js";
|
|
15
4
|
import {
|
|
16
5
|
cachedReadFileSync
|
|
17
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-CJ2XYAXX.js";
|
|
18
7
|
import {
|
|
19
8
|
extractArgTypes
|
|
20
|
-
} from "./chunk-
|
|
21
|
-
import "./chunk-
|
|
22
|
-
import "./chunk-
|
|
9
|
+
} from "./chunk-SC3QXTHH.js";
|
|
10
|
+
import "./chunk-QKPKKS4R.js";
|
|
11
|
+
import "./chunk-PQZIOGBY.js";
|
|
23
12
|
|
|
24
13
|
// src/componentManifest/reactDocgen/extractReactDocgenInfo.ts
|
|
25
14
|
import { logger } from "storybook/internal/node-logger";
|
|
@@ -1,19 +1,8 @@
|
|
|
1
|
-
import CJS_COMPAT_NODE_URL_f25fxbi8k7f from 'node:url';
|
|
2
|
-
import CJS_COMPAT_NODE_PATH_f25fxbi8k7f from 'node:path';
|
|
3
|
-
import CJS_COMPAT_NODE_MODULE_f25fxbi8k7f from "node:module";
|
|
4
|
-
|
|
5
|
-
var __filename = CJS_COMPAT_NODE_URL_f25fxbi8k7f.fileURLToPath(import.meta.url);
|
|
6
|
-
var __dirname = CJS_COMPAT_NODE_PATH_f25fxbi8k7f.dirname(__filename);
|
|
7
|
-
var require = CJS_COMPAT_NODE_MODULE_f25fxbi8k7f.createRequire(import.meta.url);
|
|
8
|
-
|
|
9
|
-
// ------------------------------------------------------------
|
|
10
|
-
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
-
// ------------------------------------------------------------
|
|
12
1
|
import {
|
|
13
2
|
extractArgTypes
|
|
14
|
-
} from "./chunk-
|
|
15
|
-
import "./chunk-
|
|
16
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-SC3QXTHH.js";
|
|
4
|
+
import "./chunk-QKPKKS4R.js";
|
|
5
|
+
import "./chunk-PQZIOGBY.js";
|
|
17
6
|
|
|
18
7
|
// src/componentManifest/reactDocgen/extractReactTypescriptDocgenInfo.ts
|
|
19
8
|
import { logger } from "storybook/internal/node-logger";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getMatchingDocgen,
|
|
3
|
+
getReactDocgen,
|
|
4
|
+
getReactDocgenImporter,
|
|
5
|
+
parseWithReactDocgen
|
|
6
|
+
} from "./chunk-N7TOZR54.js";
|
|
7
|
+
import "./chunk-CJ2XYAXX.js";
|
|
8
|
+
import "./chunk-QKPKKS4R.js";
|
|
9
|
+
import "./chunk-PQZIOGBY.js";
|
|
10
|
+
export {
|
|
11
|
+
getMatchingDocgen,
|
|
12
|
+
getReactDocgen,
|
|
13
|
+
getReactDocgenImporter,
|
|
14
|
+
parseWithReactDocgen
|
|
15
|
+
};
|
package/dist/builder-docgen.js
CHANGED
|
@@ -1,22 +1,11 @@
|
|
|
1
|
-
import CJS_COMPAT_NODE_URL_f25fxbi8k7f from 'node:url';
|
|
2
|
-
import CJS_COMPAT_NODE_PATH_f25fxbi8k7f from 'node:path';
|
|
3
|
-
import CJS_COMPAT_NODE_MODULE_f25fxbi8k7f from "node:module";
|
|
4
|
-
|
|
5
|
-
var __filename = CJS_COMPAT_NODE_URL_f25fxbi8k7f.fileURLToPath(import.meta.url);
|
|
6
|
-
var __dirname = CJS_COMPAT_NODE_PATH_f25fxbi8k7f.dirname(__filename);
|
|
7
|
-
var require = CJS_COMPAT_NODE_MODULE_f25fxbi8k7f.createRequire(import.meta.url);
|
|
8
|
-
|
|
9
|
-
// ------------------------------------------------------------
|
|
10
|
-
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
-
// ------------------------------------------------------------
|
|
12
1
|
import {
|
|
13
2
|
REACT_BUILDER_DOCGEN_PACKAGES,
|
|
14
3
|
getReactBuilderDocgenPackages,
|
|
15
4
|
isReactBuilderDocgenPackageInstalled,
|
|
16
5
|
prepareReactBuilderDocgen
|
|
17
|
-
} from "./_node-chunks/chunk-
|
|
18
|
-
import "./_node-chunks/chunk-
|
|
19
|
-
import "./_node-chunks/chunk-
|
|
6
|
+
} from "./_node-chunks/chunk-HRHJMJC7.js";
|
|
7
|
+
import "./_node-chunks/chunk-MYBSMCSW.js";
|
|
8
|
+
import "./_node-chunks/chunk-PQZIOGBY.js";
|
|
20
9
|
export {
|
|
21
10
|
REACT_BUILDER_DOCGEN_PACKAGES,
|
|
22
11
|
getReactBuilderDocgenPackages,
|
|
@@ -1,26 +1,15 @@
|
|
|
1
|
-
import CJS_COMPAT_NODE_URL_f25fxbi8k7f from 'node:url';
|
|
2
|
-
import CJS_COMPAT_NODE_PATH_f25fxbi8k7f from 'node:path';
|
|
3
|
-
import CJS_COMPAT_NODE_MODULE_f25fxbi8k7f from "node:module";
|
|
4
|
-
|
|
5
|
-
var __filename = CJS_COMPAT_NODE_URL_f25fxbi8k7f.fileURLToPath(import.meta.url);
|
|
6
|
-
var __dirname = CJS_COMPAT_NODE_PATH_f25fxbi8k7f.dirname(__filename);
|
|
7
|
-
var require = CJS_COMPAT_NODE_MODULE_f25fxbi8k7f.createRequire(import.meta.url);
|
|
8
|
-
|
|
9
|
-
// ------------------------------------------------------------
|
|
10
|
-
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
-
// ------------------------------------------------------------
|
|
12
1
|
import {
|
|
13
|
-
|
|
14
|
-
} from "../_node-chunks/chunk-
|
|
2
|
+
buildDocgenPayloads
|
|
3
|
+
} from "../_node-chunks/chunk-WSXDRG6X.js";
|
|
15
4
|
import {
|
|
16
5
|
ComponentMetaManager,
|
|
17
6
|
loadDocgenTypeScript
|
|
18
|
-
} from "../_node-chunks/chunk-
|
|
19
|
-
import "../_node-chunks/chunk-
|
|
20
|
-
import "../_node-chunks/chunk-
|
|
21
|
-
import "../_node-chunks/chunk-
|
|
22
|
-
import "../_node-chunks/chunk-
|
|
23
|
-
import "../_node-chunks/chunk-
|
|
7
|
+
} from "../_node-chunks/chunk-2DC27WWN.js";
|
|
8
|
+
import "../_node-chunks/chunk-MYBSMCSW.js";
|
|
9
|
+
import "../_node-chunks/chunk-CJ2XYAXX.js";
|
|
10
|
+
import "../_node-chunks/chunk-SC3QXTHH.js";
|
|
11
|
+
import "../_node-chunks/chunk-QKPKKS4R.js";
|
|
12
|
+
import "../_node-chunks/chunk-PQZIOGBY.js";
|
|
24
13
|
|
|
25
14
|
// src/docgen/docgen-worker.ts
|
|
26
15
|
import {
|
|
@@ -38,7 +27,7 @@ var createDocgenProvider = ({
|
|
|
38
27
|
return;
|
|
39
28
|
}
|
|
40
29
|
},
|
|
41
|
-
|
|
30
|
+
extractBatch: (componentMetaManager, inputs) => buildDocgenPayloads(inputs, { componentMetaManager })
|
|
42
31
|
});
|
|
43
32
|
export {
|
|
44
33
|
createDocgenProvider
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
applyDecorators,
|
|
3
3
|
decorators,
|
|
4
4
|
parameters
|
|
5
|
-
} from "./_browser-chunks/chunk-
|
|
5
|
+
} from "./_browser-chunks/chunk-XQNZ5YRO.js";
|
|
6
6
|
import "./_browser-chunks/chunk-DDIRQRCA.js";
|
|
7
7
|
import "./_browser-chunks/chunk-B3FR4PBN.js";
|
|
8
8
|
import "./_browser-chunks/chunk-UAWMPV5J.js";
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__definePreview
|
|
3
|
-
} from "./_browser-chunks/chunk-
|
|
3
|
+
} from "./_browser-chunks/chunk-LK5PKCYS.js";
|
|
4
4
|
import {
|
|
5
5
|
entry_preview_exports,
|
|
6
6
|
renderToCanvas
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
import {
|
|
9
9
|
entry_preview_argtypes_exports
|
|
10
10
|
} from "./_browser-chunks/chunk-WWHCZJWM.js";
|
|
11
|
-
import "./_browser-chunks/chunk-
|
|
11
|
+
import "./_browser-chunks/chunk-XQNZ5YRO.js";
|
|
12
12
|
import "./_browser-chunks/chunk-DDIRQRCA.js";
|
|
13
13
|
import "./_browser-chunks/chunk-B3FR4PBN.js";
|
|
14
14
|
import "./_browser-chunks/chunk-UAWMPV5J.js";
|