@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
package/dist/preset.js
CHANGED
|
@@ -1,20 +1,9 @@
|
|
|
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
|
-
} from "./_node-chunks/chunk-
|
|
3
|
+
} from "./_node-chunks/chunk-HRHJMJC7.js";
|
|
15
4
|
import {
|
|
16
5
|
getSharedComponentMetaManager
|
|
17
|
-
} from "./_node-chunks/chunk-
|
|
6
|
+
} from "./_node-chunks/chunk-2NYPPHY3.js";
|
|
18
7
|
import {
|
|
19
8
|
buildReactComponentDocgenFromResolved,
|
|
20
9
|
buildStoryDocsFromResolved,
|
|
@@ -24,14 +13,14 @@ import {
|
|
|
24
13
|
join,
|
|
25
14
|
posix,
|
|
26
15
|
resolveStoryFileComponents
|
|
27
|
-
} from "./_node-chunks/chunk-
|
|
16
|
+
} from "./_node-chunks/chunk-2DC27WWN.js";
|
|
28
17
|
import {
|
|
29
18
|
REACT_DOCGEN_TYPESCRIPT_APIS
|
|
30
|
-
} from "./_node-chunks/chunk-
|
|
19
|
+
} from "./_node-chunks/chunk-MYBSMCSW.js";
|
|
31
20
|
import {
|
|
32
21
|
invalidateCache
|
|
33
|
-
} from "./_node-chunks/chunk-
|
|
34
|
-
import "./_node-chunks/chunk-
|
|
22
|
+
} from "./_node-chunks/chunk-CJ2XYAXX.js";
|
|
23
|
+
import "./_node-chunks/chunk-PQZIOGBY.js";
|
|
35
24
|
|
|
36
25
|
// src/preset.ts
|
|
37
26
|
import path2, { join as join3 } from "node:path";
|
|
@@ -48,130 +37,6 @@ import { logger } from "storybook/internal/node-logger";
|
|
|
48
37
|
import nodeModule, { createRequire } from "node:module";
|
|
49
38
|
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
50
39
|
|
|
51
|
-
// ../../../node_modules/exsolve/dist/index.mjs
|
|
52
|
-
import assert from "node:assert";
|
|
53
|
-
import v8 from "node:v8";
|
|
54
|
-
import { format, inspect } from "node:util";
|
|
55
|
-
var own$1 = {}.hasOwnProperty, classRegExp = /^([A-Z][a-z\d]*)+$/, kTypes = /* @__PURE__ */ new Set([
|
|
56
|
-
"string",
|
|
57
|
-
"function",
|
|
58
|
-
"number",
|
|
59
|
-
"object",
|
|
60
|
-
"Function",
|
|
61
|
-
"Object",
|
|
62
|
-
"boolean",
|
|
63
|
-
"bigint",
|
|
64
|
-
"symbol"
|
|
65
|
-
]), messages = /* @__PURE__ */ new Map(), nodeInternalPrefix = "__node_internal_", userStackTraceLimit;
|
|
66
|
-
function formatList(array, type = "and") {
|
|
67
|
-
return array.length < 3 ? array.join(` ${type} `) : `${array.slice(0, -1).join(", ")}, ${type} ${array.at(-1)}`;
|
|
68
|
-
}
|
|
69
|
-
function createError(sym, value, constructor) {
|
|
70
|
-
return messages.set(sym, value), makeNodeErrorWithCode(constructor, sym);
|
|
71
|
-
}
|
|
72
|
-
function makeNodeErrorWithCode(Base, key) {
|
|
73
|
-
return function(...parameters) {
|
|
74
|
-
let limit = Error.stackTraceLimit;
|
|
75
|
-
isErrorStackTraceLimitWritable() && (Error.stackTraceLimit = 0);
|
|
76
|
-
let error = new Base();
|
|
77
|
-
isErrorStackTraceLimitWritable() && (Error.stackTraceLimit = limit);
|
|
78
|
-
let message = getMessage(key, parameters, error);
|
|
79
|
-
return Object.defineProperties(error, {
|
|
80
|
-
message: {
|
|
81
|
-
value: message,
|
|
82
|
-
enumerable: !1,
|
|
83
|
-
writable: !0,
|
|
84
|
-
configurable: !0
|
|
85
|
-
},
|
|
86
|
-
toString: {
|
|
87
|
-
value() {
|
|
88
|
-
return `${this.name} [${key}]: ${this.message}`;
|
|
89
|
-
},
|
|
90
|
-
enumerable: !1,
|
|
91
|
-
writable: !0,
|
|
92
|
-
configurable: !0
|
|
93
|
-
}
|
|
94
|
-
}), captureLargerStackTrace(error), error.code = key, error;
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
function isErrorStackTraceLimitWritable() {
|
|
98
|
-
try {
|
|
99
|
-
if (v8.startupSnapshot.isBuildingSnapshot()) return !1;
|
|
100
|
-
} catch {
|
|
101
|
-
}
|
|
102
|
-
let desc = Object.getOwnPropertyDescriptor(Error, "stackTraceLimit");
|
|
103
|
-
return desc === void 0 ? Object.isExtensible(Error) : own$1.call(desc, "writable") && desc.writable !== void 0 ? desc.writable : desc.set !== void 0;
|
|
104
|
-
}
|
|
105
|
-
function hideStackFrames(wrappedFunction) {
|
|
106
|
-
let hidden = nodeInternalPrefix + wrappedFunction.name;
|
|
107
|
-
return Object.defineProperty(wrappedFunction, "name", { value: hidden }), wrappedFunction;
|
|
108
|
-
}
|
|
109
|
-
var captureLargerStackTrace = hideStackFrames(function(error) {
|
|
110
|
-
let stackTraceLimitIsWritable = isErrorStackTraceLimitWritable();
|
|
111
|
-
return stackTraceLimitIsWritable && (userStackTraceLimit = Error.stackTraceLimit, Error.stackTraceLimit = Number.POSITIVE_INFINITY), Error.captureStackTrace(error), stackTraceLimitIsWritable && (Error.stackTraceLimit = userStackTraceLimit), error;
|
|
112
|
-
});
|
|
113
|
-
function getMessage(key, parameters, self) {
|
|
114
|
-
let message = messages.get(key);
|
|
115
|
-
if (assert.ok(message !== void 0, "expected `message` to be found"), typeof message == "function")
|
|
116
|
-
return assert.ok(message.length <= parameters.length, `Code: ${key}; The provided arguments length (${parameters.length}) does not match the required ones (${message.length}).`), Reflect.apply(message, self, parameters);
|
|
117
|
-
let regex = /%[dfijoOs]/g, expectedLength = 0;
|
|
118
|
-
for (; regex.exec(message) !== null; ) expectedLength++;
|
|
119
|
-
return assert.ok(expectedLength === parameters.length, `Code: ${key}; The provided arguments length (${parameters.length}) does not match the required ones (${expectedLength}).`), parameters.length === 0 ? message : (parameters.unshift(message), Reflect.apply(format, null, parameters));
|
|
120
|
-
}
|
|
121
|
-
function determineSpecificType(value) {
|
|
122
|
-
if (value == null) return String(value);
|
|
123
|
-
if (typeof value == "function" && value.name) return `function ${value.name}`;
|
|
124
|
-
if (typeof value == "object")
|
|
125
|
-
return value.constructor && value.constructor.name ? `an instance of ${value.constructor.name}` : `${inspect(value, { depth: -1 })}`;
|
|
126
|
-
let inspected = inspect(value, { colors: !1 });
|
|
127
|
-
return inspected.length > 28 && (inspected = `${inspected.slice(0, 25)}...`), `type ${typeof value} (${inspected})`;
|
|
128
|
-
}
|
|
129
|
-
var ERR_INVALID_ARG_TYPE = createError("ERR_INVALID_ARG_TYPE", (name, expected, actual) => {
|
|
130
|
-
assert.ok(typeof name == "string", "'name' must be a string"), Array.isArray(expected) || (expected = [expected]);
|
|
131
|
-
let message = "The ";
|
|
132
|
-
if (name.endsWith(" argument")) message += `${name} `;
|
|
133
|
-
else {
|
|
134
|
-
let type = name.includes(".") ? "property" : "argument";
|
|
135
|
-
message += `"${name}" ${type} `;
|
|
136
|
-
}
|
|
137
|
-
message += "must be ";
|
|
138
|
-
let types = [], instances = [], other = [];
|
|
139
|
-
for (let value of expected)
|
|
140
|
-
assert.ok(typeof value == "string", "All expected entries have to be of type string"), kTypes.has(value) ? types.push(value.toLowerCase()) : classRegExp.exec(value) === null ? (assert.ok(value !== "object", 'The value "object" should be written as "Object"'), other.push(value)) : instances.push(value);
|
|
141
|
-
if (instances.length > 0) {
|
|
142
|
-
let pos = types.indexOf("object");
|
|
143
|
-
pos !== -1 && (types.slice(pos, 1), instances.push("Object"));
|
|
144
|
-
}
|
|
145
|
-
return types.length > 0 && (message += `${types.length > 1 ? "one of type" : "of type"} ${formatList(types, "or")}`, (instances.length > 0 || other.length > 0) && (message += " or ")), instances.length > 0 && (message += `an instance of ${formatList(instances, "or")}`, other.length > 0 && (message += " or ")), other.length > 0 && (other.length > 1 ? message += `one of ${formatList(other, "or")}` : (other[0]?.toLowerCase() !== other[0] && (message += "an "), message += `${other[0]}`)), message += `. Received ${determineSpecificType(actual)}`, message;
|
|
146
|
-
}, TypeError), ERR_INVALID_MODULE_SPECIFIER = createError(
|
|
147
|
-
"ERR_INVALID_MODULE_SPECIFIER",
|
|
148
|
-
/**
|
|
149
|
-
* @param {string} request
|
|
150
|
-
* @param {string} reason
|
|
151
|
-
* @param {string} [base]
|
|
152
|
-
*/
|
|
153
|
-
(request, reason, base) => `Invalid module "${request}" ${reason}${base ? ` imported from ${base}` : ""}`,
|
|
154
|
-
TypeError
|
|
155
|
-
), ERR_INVALID_PACKAGE_CONFIG = createError("ERR_INVALID_PACKAGE_CONFIG", (path$1, base, message) => `Invalid package config ${path$1}${base ? ` while importing ${base}` : ""}${message ? `. ${message}` : ""}`, Error), ERR_INVALID_PACKAGE_TARGET = createError("ERR_INVALID_PACKAGE_TARGET", (packagePath, key, target, isImport = !1, base) => {
|
|
156
|
-
let relatedError = typeof target == "string" && !isImport && target.length > 0 && !target.startsWith("./");
|
|
157
|
-
return key === "." ? (assert.ok(isImport === !1), `Invalid "exports" main target ${JSON.stringify(target)} defined in the package config ${packagePath}package.json${base ? ` imported from ${base}` : ""}${relatedError ? '; targets must start with "./"' : ""}`) : `Invalid "${isImport ? "imports" : "exports"}" target ${JSON.stringify(target)} defined for '${key}' in the package config ${packagePath}package.json${base ? ` imported from ${base}` : ""}${relatedError ? '; targets must start with "./"' : ""}`;
|
|
158
|
-
}, Error), ERR_MODULE_NOT_FOUND = createError("ERR_MODULE_NOT_FOUND", (path$1, base, exactUrl = !1) => `Cannot find ${exactUrl ? "module" : "package"} '${path$1}' imported from ${base}`, Error), ERR_NETWORK_IMPORT_DISALLOWED = createError("ERR_NETWORK_IMPORT_DISALLOWED", "import of '%s' by %s is not supported: %s", Error), ERR_PACKAGE_IMPORT_NOT_DEFINED = createError("ERR_PACKAGE_IMPORT_NOT_DEFINED", (specifier, packagePath, base) => `Package import specifier "${specifier}" is not defined${packagePath ? ` in package ${packagePath || ""}package.json` : ""} imported from ${base}`, TypeError), ERR_PACKAGE_PATH_NOT_EXPORTED = createError(
|
|
159
|
-
"ERR_PACKAGE_PATH_NOT_EXPORTED",
|
|
160
|
-
/**
|
|
161
|
-
* @param {string} packagePath
|
|
162
|
-
* @param {string} subpath
|
|
163
|
-
* @param {string} [base]
|
|
164
|
-
*/
|
|
165
|
-
(packagePath, subpath, base) => subpath === "." ? `No "exports" main defined in ${packagePath}package.json${base ? ` imported from ${base}` : ""}` : `Package subpath '${subpath}' is not defined by "exports" in ${packagePath}package.json${base ? ` imported from ${base}` : ""}`,
|
|
166
|
-
Error
|
|
167
|
-
), ERR_UNSUPPORTED_DIR_IMPORT = createError("ERR_UNSUPPORTED_DIR_IMPORT", "Directory import '%s' is not supported resolving ES modules imported from %s", Error), ERR_UNSUPPORTED_RESOLVE_REQUEST = createError("ERR_UNSUPPORTED_RESOLVE_REQUEST", 'Failed to resolve module specifier "%s" from "%s": Invalid relative URL or base scheme is not hierarchical.', TypeError), ERR_UNKNOWN_FILE_EXTENSION = createError("ERR_UNKNOWN_FILE_EXTENSION", (extension, path$1) => `Unknown file extension "${extension}" for ${path$1}`, TypeError), ERR_INVALID_ARG_VALUE = createError("ERR_INVALID_ARG_VALUE", (name, value, reason = "is invalid") => {
|
|
168
|
-
let inspected = inspect(value);
|
|
169
|
-
return inspected.length > 128 && (inspected = `${inspected.slice(0, 128)}...`), `The ${name.includes(".") ? "property" : "argument"} '${name}' ${reason}. Received ${inspected}`;
|
|
170
|
-
}, TypeError), hasOwnProperty$1 = {}.hasOwnProperty;
|
|
171
|
-
var hasOwnProperty = {}.hasOwnProperty;
|
|
172
|
-
var RegExpPrototypeSymbolReplace = RegExp.prototype[Symbol.replace], own = {}.hasOwnProperty;
|
|
173
|
-
var isWindows = process.platform === "win32", globalCache = globalThis.__EXSOLVE_CACHE__ ||= /* @__PURE__ */ new Map();
|
|
174
|
-
|
|
175
40
|
// ../../core/node_modules/pathe/dist/shared/pathe.ff20891b.mjs
|
|
176
41
|
var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
177
42
|
function normalizeWindowsPath(input = "") {
|
|
@@ -375,7 +240,7 @@ var enrichCsf = async (input, options) => {
|
|
|
375
240
|
let promises = Object.keys(csf._stories).map(async (key) => {
|
|
376
241
|
if (!csfSource._meta?.component)
|
|
377
242
|
return;
|
|
378
|
-
let { format:
|
|
243
|
+
let { format: format2 } = await getPrettier(), code, snippet;
|
|
379
244
|
try {
|
|
380
245
|
code = getCodeSnippet(csfSource, key, csfSource._meta?.component).snippet;
|
|
381
246
|
} catch (e) {
|
|
@@ -384,7 +249,7 @@ var enrichCsf = async (input, options) => {
|
|
|
384
249
|
snippet = e.message;
|
|
385
250
|
}
|
|
386
251
|
try {
|
|
387
|
-
!snippet && code && (snippet = await
|
|
252
|
+
!snippet && code && (snippet = await format2(code, {
|
|
388
253
|
filepath: join(process.cwd(), "component.tsx")
|
|
389
254
|
}));
|
|
390
255
|
} catch (e) {
|
|
@@ -514,7 +379,7 @@ async function internal_getArgTypesData(_input, options) {
|
|
|
514
379
|
return null;
|
|
515
380
|
let absoluteComponentFilePath = path2.isAbsolute(componentFilePath) ? componentFilePath : join3(getProjectRoot(), componentFilePath);
|
|
516
381
|
if ((await presets?.apply("features", {}))?.docgenServer) {
|
|
517
|
-
let { extractArgTypesFromComponentFile } = await import("./_node-chunks/extractArgTypesFromComponentFile-
|
|
382
|
+
let { extractArgTypesFromComponentFile } = await import("./_node-chunks/extractArgTypesFromComponentFile-E3P24DW4.js");
|
|
518
383
|
return extractArgTypesFromComponentFile({
|
|
519
384
|
componentFilePath: absoluteComponentFilePath,
|
|
520
385
|
componentExportName,
|
|
@@ -533,14 +398,14 @@ async function internal_getArgTypesData(_input, options) {
|
|
|
533
398
|
let argTypesData;
|
|
534
399
|
try {
|
|
535
400
|
if (reactDocgen === "react-docgen-typescript") {
|
|
536
|
-
let { extractArgTypesFromDocgenTypescript } = await import("./_node-chunks/extractReactTypescriptDocgenInfo-
|
|
401
|
+
let { extractArgTypesFromDocgenTypescript } = await import("./_node-chunks/extractReactTypescriptDocgenInfo-XLLLW3MT.js");
|
|
537
402
|
argTypesData = await extractArgTypesFromDocgenTypescript({
|
|
538
403
|
componentFilePath: absoluteComponentFilePath,
|
|
539
404
|
componentExportName,
|
|
540
405
|
reactDocgenTypescriptOptions
|
|
541
406
|
});
|
|
542
407
|
} else {
|
|
543
|
-
let { extractArgTypesFromDocgen } = await import("./_node-chunks/extractReactDocgenInfo-
|
|
408
|
+
let { extractArgTypesFromDocgen } = await import("./_node-chunks/extractReactDocgenInfo-L44YP4OM.js");
|
|
544
409
|
argTypesData = extractArgTypesFromDocgen({
|
|
545
410
|
componentFilePath: absoluteComponentFilePath,
|
|
546
411
|
componentExportName
|
package/dist/preview.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__definePreview
|
|
3
|
-
} from "./_browser-chunks/chunk-
|
|
3
|
+
} from "./_browser-chunks/chunk-LK5PKCYS.js";
|
|
4
4
|
import "./_browser-chunks/chunk-I62VTYU3.js";
|
|
5
5
|
import "./_browser-chunks/chunk-WWHCZJWM.js";
|
|
6
|
-
import "./_browser-chunks/chunk-
|
|
6
|
+
import "./_browser-chunks/chunk-XQNZ5YRO.js";
|
|
7
7
|
import "./_browser-chunks/chunk-DDIRQRCA.js";
|
|
8
8
|
import "./_browser-chunks/chunk-B3FR4PBN.js";
|
|
9
9
|
import "./_browser-chunks/chunk-UAWMPV5J.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/react",
|
|
3
|
-
"version": "11.0.0-beta.
|
|
3
|
+
"version": "11.0.0-beta.5",
|
|
4
4
|
"description": "Storybook React renderer",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook"
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"@storybook/global": "^5.0.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
-
"@storybook/component-meta-typescript": "11.0.0-beta.
|
|
59
|
+
"@storybook/component-meta-typescript": "11.0.0-beta.5",
|
|
60
60
|
"@types/babel-plugin-react-docgen": "^4.2.3",
|
|
61
61
|
"@types/escodegen": "^0.0.6",
|
|
62
62
|
"@types/estree": "^1.0.6",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
"react-docgen": "^8.0.2",
|
|
91
91
|
"react-docgen-typescript": "^2.2.2",
|
|
92
92
|
"react-dom": "^18.0.0 || ^19.0.0",
|
|
93
|
-
"storybook": "^11.0.0-beta.
|
|
93
|
+
"storybook": "^11.0.0-beta.5",
|
|
94
94
|
"typescript": "^5.9.0 || ^6.0.0 || ^7.0.0"
|
|
95
95
|
},
|
|
96
96
|
"peerDependenciesMeta": {
|
|
@@ -1,93 +0,0 @@
|
|
|
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
|
-
import {
|
|
13
|
-
buildComponentDocgenFromResolved,
|
|
14
|
-
posix,
|
|
15
|
-
resolveStoryFileComponents
|
|
16
|
-
} from "./chunk-YSSTGZG6.js";
|
|
17
|
-
import {
|
|
18
|
-
extractArgTypes
|
|
19
|
-
} from "./chunk-WCSAV7ZK.js";
|
|
20
|
-
|
|
21
|
-
// src/docgen/buildDocgen.ts
|
|
22
|
-
import { getStoryImportPathFromEntry } from "storybook/internal/common";
|
|
23
|
-
var REACT_ATTRIBUTE_INTERFACES = /* @__PURE__ */ new Set(["Attributes", "RefAttributes", "ClassAttributes"]);
|
|
24
|
-
function isReactAttribute(prop) {
|
|
25
|
-
return !!prop.parent && REACT_ATTRIBUTE_INTERFACES.has(prop.parent.name) && /(^|[\\/])node_modules[\\/]/.test(prop.parent.fileName);
|
|
26
|
-
}
|
|
27
|
-
function extractArgTypesFromComponentMeta(componentMeta) {
|
|
28
|
-
if (!componentMeta)
|
|
29
|
-
return;
|
|
30
|
-
let props = Object.fromEntries(
|
|
31
|
-
Object.entries(componentMeta.props).filter(([, prop]) => !isReactAttribute(prop)).map(([name, prop]) => [
|
|
32
|
-
name,
|
|
33
|
-
prop.defaultValue ? { ...prop, defaultValue: { ...prop.defaultValue, computed: !1 } } : prop
|
|
34
|
-
])
|
|
35
|
-
);
|
|
36
|
-
return extractArgTypes({ __docgenInfo: { ...componentMeta, props } }) ?? void 0;
|
|
37
|
-
}
|
|
38
|
-
function addArgTypesFromComponentMeta(payload) {
|
|
39
|
-
let argTypes = extractArgTypesFromComponentMeta(payload.reactComponentMeta), subcomponents = payload.subcomponents ? Object.fromEntries(
|
|
40
|
-
Object.entries(payload.subcomponents).map(([name, subcomponent]) => [
|
|
41
|
-
name,
|
|
42
|
-
{
|
|
43
|
-
...subcomponent,
|
|
44
|
-
argTypes: extractArgTypesFromComponentMeta(subcomponent.reactComponentMeta)
|
|
45
|
-
}
|
|
46
|
-
])
|
|
47
|
-
) : void 0;
|
|
48
|
-
return {
|
|
49
|
-
...payload,
|
|
50
|
-
...argTypes ? { argTypes } : {},
|
|
51
|
-
...subcomponents ? { subcomponents } : {}
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
async function buildDocgenPayload(input, context) {
|
|
55
|
-
let storyFilePath = getStoryImportPathFromEntry(input.entry);
|
|
56
|
-
if (!storyFilePath)
|
|
57
|
-
return;
|
|
58
|
-
let storyPath = (context.resolvePath ?? ((importPath) => posix.join(process.cwd(), importPath)))(storyFilePath), resolved;
|
|
59
|
-
try {
|
|
60
|
-
resolved = await resolveStoryFileComponents({
|
|
61
|
-
storyPath,
|
|
62
|
-
title: input.entry.title,
|
|
63
|
-
typescriptOptions: context.typescriptOptions,
|
|
64
|
-
docgenEngine: "react-component-meta"
|
|
65
|
-
});
|
|
66
|
-
} catch {
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
let { csf, componentName, component, subcomponents, storyFile } = resolved, usableSubcomponents = subcomponents.filter(
|
|
70
|
-
(sub) => sub.component !== void 0
|
|
71
|
-
), storyRefs = [
|
|
72
|
-
...component ? [{ storyPath, component }] : [],
|
|
73
|
-
...usableSubcomponents.map((sub) => ({ storyPath, component: sub.component }))
|
|
74
|
-
];
|
|
75
|
-
storyRefs.length > 0 && context.componentMetaManager.batchExtract(storyRefs);
|
|
76
|
-
let componentDocgen = buildComponentDocgenFromResolved({
|
|
77
|
-
entry: input.entry,
|
|
78
|
-
storyPath,
|
|
79
|
-
storyFilePath,
|
|
80
|
-
storyFile,
|
|
81
|
-
csf,
|
|
82
|
-
componentName,
|
|
83
|
-
component,
|
|
84
|
-
subcomponents,
|
|
85
|
-
docgenEngine: "react-component-meta"
|
|
86
|
-
});
|
|
87
|
-
return addArgTypesFromComponentMeta(componentDocgen);
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
export {
|
|
91
|
-
extractArgTypesFromComponentMeta,
|
|
92
|
-
buildDocgenPayload
|
|
93
|
-
};
|
|
@@ -1,18 +0,0 @@
|
|
|
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
|
-
|
|
13
|
-
// src/docgen-typescript-apis.ts
|
|
14
|
-
var REACT_DOCGEN_TYPESCRIPT_APIS = ["compiler", "native"];
|
|
15
|
-
|
|
16
|
-
export {
|
|
17
|
-
REACT_DOCGEN_TYPESCRIPT_APIS
|
|
18
|
-
};
|
|
@@ -1,44 +0,0 @@
|
|
|
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
|
-
import {
|
|
13
|
-
getSharedComponentMetaManager
|
|
14
|
-
} from "./chunk-23AJ2HMB.js";
|
|
15
|
-
import {
|
|
16
|
-
extractArgTypesFromComponentMeta
|
|
17
|
-
} from "./chunk-DYAQFVW4.js";
|
|
18
|
-
import "./chunk-YSSTGZG6.js";
|
|
19
|
-
import "./chunk-IHFW4SZ5.js";
|
|
20
|
-
import "./chunk-YAHZ47OQ.js";
|
|
21
|
-
import "./chunk-WCSAV7ZK.js";
|
|
22
|
-
import "./chunk-OICUDNLP.js";
|
|
23
|
-
import "./chunk-MA6UOA7T.js";
|
|
24
|
-
|
|
25
|
-
// src/docgen/extractArgTypesFromComponentFile.ts
|
|
26
|
-
async function extractArgTypesFromComponentFile({
|
|
27
|
-
componentFilePath,
|
|
28
|
-
componentExportName = "default",
|
|
29
|
-
typeScriptSpecifier
|
|
30
|
-
}) {
|
|
31
|
-
let manager = await getSharedComponentMetaManager(typeScriptSpecifier);
|
|
32
|
-
if (!manager)
|
|
33
|
-
return null;
|
|
34
|
-
let component = {
|
|
35
|
-
componentName: componentExportName,
|
|
36
|
-
importName: componentExportName,
|
|
37
|
-
path: componentFilePath,
|
|
38
|
-
isPackage: !1
|
|
39
|
-
};
|
|
40
|
-
return manager.batchExtract([{ storyPath: componentFilePath, component }]), extractArgTypesFromComponentMeta(component.reactComponentMeta) ?? null;
|
|
41
|
-
}
|
|
42
|
-
export {
|
|
43
|
-
extractArgTypesFromComponentFile
|
|
44
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
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
|
-
import {
|
|
13
|
-
getMatchingDocgen,
|
|
14
|
-
getReactDocgen,
|
|
15
|
-
getReactDocgenImporter,
|
|
16
|
-
parseWithReactDocgen
|
|
17
|
-
} from "./chunk-J7MJPACM.js";
|
|
18
|
-
import "./chunk-YAHZ47OQ.js";
|
|
19
|
-
import "./chunk-OICUDNLP.js";
|
|
20
|
-
import "./chunk-MA6UOA7T.js";
|
|
21
|
-
export {
|
|
22
|
-
getMatchingDocgen,
|
|
23
|
-
getReactDocgen,
|
|
24
|
-
getReactDocgenImporter,
|
|
25
|
-
parseWithReactDocgen
|
|
26
|
-
};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|