@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,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
|
import {
|
|
16
5
|
asyncCache,
|
|
17
6
|
cached,
|
|
@@ -23,11 +12,11 @@ import {
|
|
|
23
12
|
groupByToMap,
|
|
24
13
|
invariant,
|
|
25
14
|
matchPath
|
|
26
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-CJ2XYAXX.js";
|
|
27
16
|
import {
|
|
28
17
|
__commonJS,
|
|
29
18
|
__toESM
|
|
30
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-PQZIOGBY.js";
|
|
31
20
|
|
|
32
21
|
// ../../../node_modules/@volar/source-map/lib/binarySearch.js
|
|
33
22
|
var require_binarySearch = __commonJS({
|
|
@@ -1574,7 +1563,7 @@ var require_proxyLanguageService = __commonJS({
|
|
|
1574
1563
|
};
|
|
1575
1564
|
}
|
|
1576
1565
|
function getEncodedSemanticClassifications(language, getEncodedSemanticClassifications2) {
|
|
1577
|
-
return (filePath, span,
|
|
1566
|
+
return (filePath, span, format2) => {
|
|
1578
1567
|
let fileName = filePath.replace(windowsPathReg, "/"), [serviceScript, targetScript, sourceScript] = (0, utils_1.getServiceScript)(language, fileName);
|
|
1579
1568
|
if (targetScript?.associatedOnly)
|
|
1580
1569
|
return {
|
|
@@ -1588,7 +1577,7 @@ var require_proxyLanguageService = __commonJS({
|
|
|
1588
1577
|
spans: [],
|
|
1589
1578
|
endOfLineState: 0
|
|
1590
1579
|
};
|
|
1591
|
-
let mappingOffset = (0, transform_1.getMappingOffset)(language, serviceScript), start = mapped.start + mappingOffset, end = mapped.end + mappingOffset, result = getEncodedSemanticClassifications2(targetScript.id, { start, length: end - start },
|
|
1580
|
+
let mappingOffset = (0, transform_1.getMappingOffset)(language, serviceScript), start = mapped.start + mappingOffset, end = mapped.end + mappingOffset, result = getEncodedSemanticClassifications2(targetScript.id, { start, length: end - start }, format2), spans = [];
|
|
1592
1581
|
for (let i = 0; i < result.spans.length; i += 3)
|
|
1593
1582
|
for (let [_, sourceStart, sourceEnd] of (0, transform_1.toSourceRanges)(sourceScript, language, serviceScript, result.spans[i], result.spans[i] + result.spans[i + 1], !1, language_core_1.isSemanticTokensEnabled)) {
|
|
1594
1583
|
spans.push(sourceStart, sourceEnd - sourceStart, result.spans[i + 2]);
|
|
@@ -1596,7 +1585,7 @@ var require_proxyLanguageService = __commonJS({
|
|
|
1596
1585
|
}
|
|
1597
1586
|
return result.spans = spans, result;
|
|
1598
1587
|
} else
|
|
1599
|
-
return getEncodedSemanticClassifications2(fileName, span,
|
|
1588
|
+
return getEncodedSemanticClassifications2(fileName, span, format2);
|
|
1600
1589
|
};
|
|
1601
1590
|
}
|
|
1602
1591
|
function getSyntacticDiagnostics(language, languageService, getSyntacticDiagnostics2) {
|
|
@@ -1844,16 +1833,16 @@ var require_path_browserify = __commonJS({
|
|
|
1844
1833
|
}
|
|
1845
1834
|
return res;
|
|
1846
1835
|
}
|
|
1847
|
-
function _format(
|
|
1836
|
+
function _format(sep2, pathObject) {
|
|
1848
1837
|
var dir = pathObject.dir || pathObject.root, base = pathObject.base || (pathObject.name || "") + (pathObject.ext || "");
|
|
1849
|
-
return dir ? dir === pathObject.root ? dir + base : dir +
|
|
1838
|
+
return dir ? dir === pathObject.root ? dir + base : dir + sep2 + base : base;
|
|
1850
1839
|
}
|
|
1851
|
-
var
|
|
1840
|
+
var posix2 = {
|
|
1852
1841
|
// path.resolve([from ...], to)
|
|
1853
1842
|
resolve: function() {
|
|
1854
|
-
for (var resolvedPath = "", resolvedAbsolute = !1,
|
|
1843
|
+
for (var resolvedPath = "", resolvedAbsolute = !1, cwd2, i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
|
|
1855
1844
|
var path2;
|
|
1856
|
-
i >= 0 ? path2 = arguments[i] : (
|
|
1845
|
+
i >= 0 ? path2 = arguments[i] : (cwd2 === void 0 && (cwd2 = process.cwd()), path2 = cwd2), assertPath(path2), path2.length !== 0 && (resolvedPath = path2 + "/" + resolvedPath, resolvedAbsolute = path2.charCodeAt(0) === 47);
|
|
1857
1846
|
}
|
|
1858
1847
|
return resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute), resolvedAbsolute ? resolvedPath.length > 0 ? "/" + resolvedPath : "/" : resolvedPath.length > 0 ? resolvedPath : ".";
|
|
1859
1848
|
},
|
|
@@ -1872,10 +1861,10 @@ var require_path_browserify = __commonJS({
|
|
|
1872
1861
|
var arg = arguments[i];
|
|
1873
1862
|
assertPath(arg), arg.length > 0 && (joined === void 0 ? joined = arg : joined += "/" + arg);
|
|
1874
1863
|
}
|
|
1875
|
-
return joined === void 0 ? "." :
|
|
1864
|
+
return joined === void 0 ? "." : posix2.normalize(joined);
|
|
1876
1865
|
},
|
|
1877
1866
|
relative: function(from, to) {
|
|
1878
|
-
if (assertPath(from), assertPath(to), from === to || (from =
|
|
1867
|
+
if (assertPath(from), assertPath(to), from === to || (from = posix2.resolve(from), to = posix2.resolve(to), from === to)) return "";
|
|
1879
1868
|
for (var fromStart = 1; fromStart < from.length && from.charCodeAt(fromStart) === 47; ++fromStart)
|
|
1880
1869
|
;
|
|
1881
1870
|
for (var fromEnd = from.length, fromLen = fromEnd - fromStart, toStart = 1; toStart < to.length && to.charCodeAt(toStart) === 47; ++toStart)
|
|
@@ -1991,8 +1980,8 @@ var require_path_browserify = __commonJS({
|
|
|
1991
1980
|
win32: null,
|
|
1992
1981
|
posix: null
|
|
1993
1982
|
};
|
|
1994
|
-
|
|
1995
|
-
module.exports =
|
|
1983
|
+
posix2.posix = posix2;
|
|
1984
|
+
module.exports = posix2;
|
|
1996
1985
|
}
|
|
1997
1986
|
});
|
|
1998
1987
|
|
|
@@ -3328,10 +3317,7 @@ var require_typescript = __commonJS({
|
|
|
3328
3317
|
}
|
|
3329
3318
|
});
|
|
3330
3319
|
|
|
3331
|
-
// ../../lib/component-meta-typescript/dist/_node-chunks/chunk-
|
|
3332
|
-
import CJS_COMPAT_NODE_URL_r3c3rhnvdz from "node:url";
|
|
3333
|
-
import CJS_COMPAT_NODE_PATH_r3c3rhnvdz from "node:path";
|
|
3334
|
-
import CJS_COMPAT_NODE_MODULE_r3c3rhnvdz from "node:module";
|
|
3320
|
+
// ../../lib/component-meta-typescript/dist/_node-chunks/chunk-LDXLIZQK.js
|
|
3335
3321
|
import { pathToFileURL } from "node:url";
|
|
3336
3322
|
import {
|
|
3337
3323
|
getTypeScriptDocgenApi,
|
|
@@ -3343,164 +3329,11 @@ import {
|
|
|
3343
3329
|
TypeScriptMissingForDocgenError,
|
|
3344
3330
|
TypeScriptWithoutCompilerApiError
|
|
3345
3331
|
} from "storybook/internal/server-errors";
|
|
3346
|
-
var
|
|
3347
|
-
var __lib__ = (() => {
|
|
3348
|
-
var m = Object.defineProperty, V = Object.getOwnPropertyDescriptor, G = Object.getOwnPropertyNames, T = Object.prototype.hasOwnProperty, q = (r, e) => {
|
|
3349
|
-
for (var n in e) m(r, n, { get: e[n], enumerable: !0 });
|
|
3350
|
-
}, H = (r, e, n, a) => {
|
|
3351
|
-
if (e && typeof e == "object" || typeof e == "function") for (let t of G(e)) !T.call(r, t) && t !== n && m(r, t, { get: () => e[t], enumerable: !(a = V(e, t)) || a.enumerable });
|
|
3352
|
-
return r;
|
|
3353
|
-
}, J = (r) => H(m({}, "__esModule", { value: !0 }), r), w = {};
|
|
3354
|
-
q(w, { default: () => re });
|
|
3355
|
-
var A = (r) => Array.isArray(r), d = (r) => typeof r == "function", Q = (r) => r.length === 0, W = (r) => typeof r == "number", K = (r) => typeof r == "object" && r !== null, X = (r) => r instanceof RegExp, b = (r) => typeof r == "string", h = (r) => r === void 0, Y = (r) => {
|
|
3356
|
-
let e = /* @__PURE__ */ new Map();
|
|
3357
|
-
return (n) => {
|
|
3358
|
-
let a = e.get(n);
|
|
3359
|
-
if (a) return a;
|
|
3360
|
-
let t = r(n);
|
|
3361
|
-
return e.set(n, t), t;
|
|
3362
|
-
};
|
|
3363
|
-
}, rr = (r, e, n = {}) => {
|
|
3364
|
-
let a = { cache: {}, input: r, index: 0, indexMax: 0, options: n, output: [] };
|
|
3365
|
-
if (v(e)(a) && a.index === r.length) return a.output;
|
|
3366
|
-
throw new Error(`Failed to parse at index ${a.indexMax}`);
|
|
3367
|
-
}, i = (r, e) => A(r) ? er(r, e) : b(r) ? ar(r, e) : nr(r, e), er = (r, e) => {
|
|
3368
|
-
let n = {};
|
|
3369
|
-
for (let a of r) {
|
|
3370
|
-
if (a.length !== 1) throw new Error(`Invalid character: "${a}"`);
|
|
3371
|
-
let t = a.charCodeAt(0);
|
|
3372
|
-
n[t] = !0;
|
|
3373
|
-
}
|
|
3374
|
-
return (a) => {
|
|
3375
|
-
let t = a.index, o = a.input;
|
|
3376
|
-
for (; a.index < o.length && o.charCodeAt(a.index) in n; ) a.index += 1;
|
|
3377
|
-
let u = a.index;
|
|
3378
|
-
if (u > t) {
|
|
3379
|
-
if (!h(e) && !a.options.silent) {
|
|
3380
|
-
let s = a.input.slice(t, u), c = d(e) ? e(s, o, String(t)) : e;
|
|
3381
|
-
h(c) || a.output.push(c);
|
|
3382
|
-
}
|
|
3383
|
-
a.indexMax = Math.max(a.indexMax, a.index);
|
|
3384
|
-
}
|
|
3385
|
-
return !0;
|
|
3386
|
-
};
|
|
3387
|
-
}, nr = (r, e) => {
|
|
3388
|
-
let n = r.source, a = r.flags.replace(/y|$/, "y"), t = new RegExp(n, a);
|
|
3389
|
-
return g((o) => {
|
|
3390
|
-
t.lastIndex = o.index;
|
|
3391
|
-
let u = t.exec(o.input);
|
|
3392
|
-
if (u) {
|
|
3393
|
-
if (!h(e) && !o.options.silent) {
|
|
3394
|
-
let s = d(e) ? e(...u, o.input, String(o.index)) : e;
|
|
3395
|
-
h(s) || o.output.push(s);
|
|
3396
|
-
}
|
|
3397
|
-
return o.index += u[0].length, o.indexMax = Math.max(o.indexMax, o.index), !0;
|
|
3398
|
-
} else return !1;
|
|
3399
|
-
});
|
|
3400
|
-
}, ar = (r, e) => (n) => {
|
|
3401
|
-
if (n.input.startsWith(r, n.index)) {
|
|
3402
|
-
if (!h(e) && !n.options.silent) {
|
|
3403
|
-
let t = d(e) ? e(r, n.input, String(n.index)) : e;
|
|
3404
|
-
h(t) || n.output.push(t);
|
|
3405
|
-
}
|
|
3406
|
-
return n.index += r.length, n.indexMax = Math.max(n.indexMax, n.index), !0;
|
|
3407
|
-
} else return !1;
|
|
3408
|
-
}, C = (r, e, n, a) => {
|
|
3409
|
-
let t = v(r);
|
|
3410
|
-
return g(_(M((o) => {
|
|
3411
|
-
let u = 0;
|
|
3412
|
-
for (; u < n; ) {
|
|
3413
|
-
let s = o.index;
|
|
3414
|
-
if (!t(o) || (u += 1, o.index === s)) break;
|
|
3415
|
-
}
|
|
3416
|
-
return u >= e;
|
|
3417
|
-
})));
|
|
3418
|
-
}, tr = (r, e) => C(r, 0, 1), f = (r, e) => C(r, 0, 1 / 0), x = (r, e) => {
|
|
3419
|
-
let n = r.map(v);
|
|
3420
|
-
return g(_(M((a) => {
|
|
3421
|
-
for (let t = 0, o = n.length; t < o; t++) if (!n[t](a)) return !1;
|
|
3422
|
-
return !0;
|
|
3423
|
-
})));
|
|
3424
|
-
}, l = (r, e) => {
|
|
3425
|
-
let n = r.map(v);
|
|
3426
|
-
return g(_((a) => {
|
|
3427
|
-
for (let t = 0, o = n.length; t < o; t++) if (n[t](a)) return !0;
|
|
3428
|
-
return !1;
|
|
3429
|
-
}));
|
|
3430
|
-
}, M = (r, e = !1) => {
|
|
3431
|
-
let n = v(r);
|
|
3432
|
-
return (a) => {
|
|
3433
|
-
let t = a.index, o = a.output.length, u = n(a);
|
|
3434
|
-
return (!u || e) && (a.index = t, a.output.length !== o && (a.output.length = o)), u;
|
|
3435
|
-
};
|
|
3436
|
-
}, _ = (r, e) => v(r), g = /* @__PURE__ */ (() => {
|
|
3437
|
-
let r = 0;
|
|
3438
|
-
return (e) => {
|
|
3439
|
-
let n = v(e), a = r += 1;
|
|
3440
|
-
return (t) => {
|
|
3441
|
-
var o;
|
|
3442
|
-
if (t.options.memoization === !1) return n(t);
|
|
3443
|
-
let u = t.index, s = (o = t.cache)[a] || (o[a] = /* @__PURE__ */ new Map()), c = s.get(u);
|
|
3444
|
-
if (c === !1) return !1;
|
|
3445
|
-
if (W(c)) return t.index = c, !0;
|
|
3446
|
-
if (c) return t.index = c.index, c.output?.length && t.output.push(...c.output), !0;
|
|
3447
|
-
{
|
|
3448
|
-
let Z = t.output.length;
|
|
3449
|
-
if (n(t)) {
|
|
3450
|
-
let D = t.index, U = t.output.length;
|
|
3451
|
-
if (U > Z) {
|
|
3452
|
-
let ee = t.output.slice(Z, U);
|
|
3453
|
-
s.set(u, { index: D, output: ee });
|
|
3454
|
-
} else s.set(u, D);
|
|
3455
|
-
return !0;
|
|
3456
|
-
} else return s.set(u, !1), !1;
|
|
3457
|
-
}
|
|
3458
|
-
};
|
|
3459
|
-
};
|
|
3460
|
-
})(), E = (r) => {
|
|
3461
|
-
let e;
|
|
3462
|
-
return (n) => (e || (e = v(r())), e(n));
|
|
3463
|
-
}, v = Y((r) => {
|
|
3464
|
-
if (d(r)) return Q(r) ? E(r) : r;
|
|
3465
|
-
if (b(r) || X(r)) return i(r);
|
|
3466
|
-
if (A(r)) return x(r);
|
|
3467
|
-
if (K(r)) return l(Object.values(r));
|
|
3468
|
-
throw new Error("Invalid rule");
|
|
3469
|
-
}), P = "abcdefghijklmnopqrstuvwxyz", ir = (r) => {
|
|
3470
|
-
let e = "";
|
|
3471
|
-
for (; r > 0; ) {
|
|
3472
|
-
let n = (r - 1) % 26;
|
|
3473
|
-
e = P[n] + e, r = Math.floor((r - 1) / 26);
|
|
3474
|
-
}
|
|
3475
|
-
return e;
|
|
3476
|
-
}, O = (r) => {
|
|
3477
|
-
let e = 0;
|
|
3478
|
-
for (let n = 0, a = r.length; n < a; n++) e = e * 26 + P.indexOf(r[n]) + 1;
|
|
3479
|
-
return e;
|
|
3480
|
-
}, S = (r, e) => {
|
|
3481
|
-
if (e < r) return S(e, r);
|
|
3482
|
-
let n = [];
|
|
3483
|
-
for (; r <= e; ) n.push(r++);
|
|
3484
|
-
return n;
|
|
3485
|
-
}, or = (r, e, n) => S(r, e).map((a) => String(a).padStart(n, "0")), R = (r, e) => S(O(r), O(e)).map(ir), p = (r) => r, z = (r) => ur((e) => rr(e, r, { memoization: !1 }).join("")), ur = (r) => {
|
|
3486
|
-
let e = {};
|
|
3487
|
-
return (n) => e[n] ?? (e[n] = r(n));
|
|
3488
|
-
}, sr = i(/^\*\*\/\*$/, ".*"), cr = i(/^\*\*\/(\*)?([ a-zA-Z0-9._-]+)$/, (r, e, n) => `.*${e ? "" : "(?:^|/)"}${n.replaceAll(".", "\\.")}`), lr = i(/^\*\*\/(\*)?([ a-zA-Z0-9._-]*)\{([ a-zA-Z0-9._-]+(?:,[ a-zA-Z0-9._-]+)*)\}$/, (r, e, n, a) => `.*${e ? "" : "(?:^|/)"}${n.replaceAll(".", "\\.")}(?:${a.replaceAll(",", "|").replaceAll(".", "\\.")})`), y = i(/\\./, p), pr = i(/[$.*+?^(){}[\]\|]/, (r) => `\\${r}`), vr = i(/./, p), hr = i(/^(?:!!)*!(.*)$/, (r, e) => `(?!^${L(e)}$).*?`), dr = i(/^(!!)+/, ""), fr = l([hr, dr]), xr = i(/\/(\*\*\/)+/, "(?:/.+/|/)"), gr = i(/^(\*\*\/)+/, "(?:^|.*/)"), mr = i(/\/(\*\*)$/, "(?:/.*|$)"), _r = i(/\*\*/, ".*"), j = l([xr, gr, mr, _r]), Sr = i(/\*\/(?!\*\*\/)/, "[^/]*/"), yr = i(/\*/, "[^/]*"), N = l([Sr, yr]), k = i("?", "[^/]"), $r = i("[", p), wr = i("]", p), Ar = i(/[!^]/, "^/"), br = i(/[a-z]-[a-z]|[0-9]-[0-9]/i, p), Cr = i(/[$.*+?^(){}[\|]/, (r) => `\\${r}`), Mr = i(/[^\]]/, p), Er = l([y, Cr, br, Mr]), B = x([$r, tr(Ar), f(Er), wr]), Pr = i("{", "(?:"), Or = i("}", ")"), Rr = i(/(\d+)\.\.(\d+)/, (r, e, n) => or(+e, +n, Math.min(e.length, n.length)).join("|")), zr = i(/([a-z]+)\.\.([a-z]+)/, (r, e, n) => R(e, n).join("|")), jr = i(/([A-Z]+)\.\.([A-Z]+)/, (r, e, n) => R(e.toLowerCase(), n.toLowerCase()).join("|").toUpperCase()), Nr = l([Rr, zr, jr]), I = x([Pr, Nr, Or]), kr = i("{", "(?:"), Br = i("}", ")"), Ir = i(",", "|"), Fr = i(/[$.*+?^(){[\]\|]/, (r) => `\\${r}`), Lr = i(/[^}]/, p), Zr = E(() => F), Dr = l([j, N, k, B, I, Zr, y, Fr, Ir, Lr]), F = x([kr, f(Dr), Br]), Ur = f(l([sr, cr, lr, fr, j, N, k, B, I, F, y, pr, vr])), Vr = Ur, Gr = z(Vr), L = Gr, Tr = i(/\\./, p), qr = i(/./, p), Hr = i(/\*\*\*+/, "*"), Jr = i(/([^/{[(!])\*\*/, (r, e) => `${e}*`), Qr = i(/(^|.)\*\*(?=[^*/)\]}])/, (r, e) => `${e}*`), Wr = f(l([Tr, Hr, Jr, Qr, qr])), Kr = Wr, Xr = z(Kr), Yr = Xr, $ = (r, e) => {
|
|
3489
|
-
let n = Array.isArray(r) ? r : [r];
|
|
3490
|
-
if (!n.length) return !1;
|
|
3491
|
-
let a = n.map($.compile), t = n.every((s) => /(\/(?:\*\*)?|\[\/\])$/.test(s)), o = e.replace(/[\\\/]+/g, "/").replace(/\/$/, t ? "/" : "");
|
|
3492
|
-
return a.some((s) => s.test(o));
|
|
3493
|
-
};
|
|
3494
|
-
$.compile = (r) => new RegExp(`^${L(Yr(r))}$`, "s");
|
|
3495
|
-
var re = $;
|
|
3496
|
-
return J(w);
|
|
3497
|
-
})();
|
|
3498
|
-
return __lib__.default || __lib__;
|
|
3499
|
-
}, _match, zeptomatch = (path2, pattern) => (_match || (_match = _lazyMatch(), _lazyMatch = null), _match(path2, pattern)), _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
3332
|
+
var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
3500
3333
|
function normalizeWindowsPath(input = "") {
|
|
3501
3334
|
return input && input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
|
|
3502
3335
|
}
|
|
3503
|
-
var _UNC_REGEX = /^[/\\]{2}/, _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/, _DRIVE_LETTER_RE = /^[A-Za-z]:$/,
|
|
3336
|
+
var _UNC_REGEX = /^[/\\]{2}/, _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/, _DRIVE_LETTER_RE = /^[A-Za-z]:$/, normalize = function(path2) {
|
|
3504
3337
|
if (path2.length === 0)
|
|
3505
3338
|
return ".";
|
|
3506
3339
|
path2 = normalizeWindowsPath(path2);
|
|
@@ -3517,18 +3350,6 @@ var _UNC_REGEX = /^[/\\]{2}/, _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)
|
|
|
3517
3350
|
path2 += seg;
|
|
3518
3351
|
return normalize(path2);
|
|
3519
3352
|
};
|
|
3520
|
-
function cwd() {
|
|
3521
|
-
return typeof process < "u" && typeof process.cwd == "function" ? process.cwd().replace(/\\/g, "/") : "/";
|
|
3522
|
-
}
|
|
3523
|
-
var resolve = function(...arguments_) {
|
|
3524
|
-
arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
|
|
3525
|
-
let resolvedPath = "", resolvedAbsolute = !1;
|
|
3526
|
-
for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
|
|
3527
|
-
let path2 = index >= 0 ? arguments_[index] : cwd();
|
|
3528
|
-
!path2 || path2.length === 0 || (resolvedPath = `${path2}/${resolvedPath}`, resolvedAbsolute = isAbsolute(path2));
|
|
3529
|
-
}
|
|
3530
|
-
return resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute), resolvedAbsolute && !isAbsolute(resolvedPath) ? `/${resolvedPath}` : resolvedPath.length > 0 ? resolvedPath : ".";
|
|
3531
|
-
};
|
|
3532
3353
|
function normalizeString(path2, allowAboveRoot) {
|
|
3533
3354
|
let res = "", lastSegmentLength = 0, lastSlash = -1, dots = 0, char = null;
|
|
3534
3355
|
for (let index = 0; index <= path2.length; ++index) {
|
|
@@ -3561,73 +3382,10 @@ function normalizeString(path2, allowAboveRoot) {
|
|
|
3561
3382
|
}
|
|
3562
3383
|
var isAbsolute = function(p) {
|
|
3563
3384
|
return _IS_ABSOLUTE_RE.test(p);
|
|
3564
|
-
}, toNamespacedPath = function(p) {
|
|
3565
|
-
return normalizeWindowsPath(p);
|
|
3566
|
-
}, extname = function(p) {
|
|
3567
|
-
if (p === "..") return "";
|
|
3568
|
-
let match = _EXTNAME_RE.exec(normalizeWindowsPath(p));
|
|
3569
|
-
return match && match[1] || "";
|
|
3570
|
-
}, relative = function(from, to) {
|
|
3571
|
-
let _from = resolve(from).replace(_ROOT_FOLDER_RE, "$1").split("/"), _to = resolve(to).replace(_ROOT_FOLDER_RE, "$1").split("/");
|
|
3572
|
-
if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0])
|
|
3573
|
-
return _to.join("/");
|
|
3574
|
-
let _fromCopy = [..._from];
|
|
3575
|
-
for (let segment of _fromCopy) {
|
|
3576
|
-
if (_to[0] !== segment)
|
|
3577
|
-
break;
|
|
3578
|
-
_from.shift(), _to.shift();
|
|
3579
|
-
}
|
|
3580
|
-
return [..._from.map(() => ".."), ..._to].join("/");
|
|
3581
3385
|
}, dirname = function(p) {
|
|
3582
3386
|
let segments = normalizeWindowsPath(p).replace(/\/$/, "").split("/").slice(0, -1);
|
|
3583
3387
|
return segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0]) && (segments[0] += "/"), segments.join("/") || (isAbsolute(p) ? "/" : ".");
|
|
3584
|
-
},
|
|
3585
|
-
let ext = p.ext ? p.ext.startsWith(".") ? p.ext : `.${p.ext}` : "", segments = [p.root, p.dir, p.base ?? (p.name ?? "") + ext].filter(
|
|
3586
|
-
Boolean
|
|
3587
|
-
);
|
|
3588
|
-
return normalizeWindowsPath(
|
|
3589
|
-
p.root ? resolve(...segments) : segments.join("/")
|
|
3590
|
-
);
|
|
3591
|
-
}, basename = function(p, extension) {
|
|
3592
|
-
let segments = normalizeWindowsPath(p).split("/"), lastSegment = "";
|
|
3593
|
-
for (let i = segments.length - 1; i >= 0; i--) {
|
|
3594
|
-
let val = segments[i];
|
|
3595
|
-
if (val) {
|
|
3596
|
-
lastSegment = val;
|
|
3597
|
-
break;
|
|
3598
|
-
}
|
|
3599
|
-
}
|
|
3600
|
-
return extension && lastSegment.endsWith(extension) ? lastSegment.slice(0, -extension.length) : lastSegment;
|
|
3601
|
-
}, parse = function(p) {
|
|
3602
|
-
let root = _PATH_ROOT_RE.exec(p)?.[0]?.replace(/\\/g, "/") || "", base = basename(p), extension = extname(base);
|
|
3603
|
-
return {
|
|
3604
|
-
root,
|
|
3605
|
-
dir: dirname(p),
|
|
3606
|
-
base,
|
|
3607
|
-
ext: extension,
|
|
3608
|
-
name: base.slice(0, base.length - extension.length)
|
|
3609
|
-
};
|
|
3610
|
-
}, matchesGlob = (path2, pattern) => zeptomatch(pattern, normalize(path2)), _path = {
|
|
3611
|
-
__proto__: null,
|
|
3612
|
-
basename,
|
|
3613
|
-
dirname,
|
|
3614
|
-
extname,
|
|
3615
|
-
format,
|
|
3616
|
-
isAbsolute,
|
|
3617
|
-
join,
|
|
3618
|
-
matchesGlob,
|
|
3619
|
-
normalize,
|
|
3620
|
-
normalizeString,
|
|
3621
|
-
parse,
|
|
3622
|
-
relative,
|
|
3623
|
-
resolve,
|
|
3624
|
-
sep,
|
|
3625
|
-
toNamespacedPath
|
|
3626
|
-
}, delimiter = globalThis.process?.platform === "win32" ? ";" : ":", _platforms = { posix: void 0, win32: void 0 }, mix = (del = delimiter) => new Proxy(_path, {
|
|
3627
|
-
get(_, prop) {
|
|
3628
|
-
return prop === "delimiter" ? del : prop === "posix" ? posix : prop === "win32" ? win32 : _platforms[prop] || _path[prop];
|
|
3629
|
-
}
|
|
3630
|
-
}), posix = mix(":"), win32 = mix(";"), DOCGEN_APIS = ["compiler", "native"], NATIVE_ENTRY_POINTS = { sync: "./sync", ast: "./ast", factory: "./ast/factory" };
|
|
3388
|
+
}, DOCGEN_APIS = ["compiler", "native"], NATIVE_ENTRY_POINTS = { sync: "./sync", ast: "./ast", factory: "./ast/factory" };
|
|
3631
3389
|
async function loadNativeTypeScriptModules(importEntry) {
|
|
3632
3390
|
let [sync, ast, factory] = await Promise.all(
|
|
3633
3391
|
Object.values(NATIVE_ENTRY_POINTS).map((subpath) => importEntry(subpath))
|
|
@@ -3667,16 +3425,13 @@ function loadDocgenTypeScript(typeScriptSpecifier) {
|
|
|
3667
3425
|
}
|
|
3668
3426
|
|
|
3669
3427
|
// ../../lib/component-meta-typescript/dist/index.js
|
|
3670
|
-
import CJS_COMPAT_NODE_URL_r3c3rhnvdz2 from "node:url";
|
|
3671
|
-
import CJS_COMPAT_NODE_PATH_r3c3rhnvdz2 from "node:path";
|
|
3672
|
-
import CJS_COMPAT_NODE_MODULE_r3c3rhnvdz2 from "node:module";
|
|
3673
3428
|
import { existsSync, readFileSync, statSync } from "node:fs";
|
|
3674
3429
|
import {
|
|
3675
3430
|
filterSourceFilePaths
|
|
3676
3431
|
} from "storybook/internal/component-meta";
|
|
3677
3432
|
import { statSync as statSync2 } from "node:fs";
|
|
3678
3433
|
import { logger } from "storybook/internal/node-logger";
|
|
3679
|
-
var
|
|
3434
|
+
var DOCGEN_NODE_GUARDS = [
|
|
3680
3435
|
"isArrayLiteralExpression",
|
|
3681
3436
|
"isArrayTypeNode",
|
|
3682
3437
|
"isArrowFunction",
|
|
@@ -4710,7 +4465,42 @@ function getAllDeclarationParents(typescript, prop) {
|
|
|
4710
4465
|
}
|
|
4711
4466
|
return parents.length > 0 ? parents : void 0;
|
|
4712
4467
|
}
|
|
4713
|
-
function
|
|
4468
|
+
function getDeclaredLiterals(typescript, checker, node, depth = 0) {
|
|
4469
|
+
if (!node || depth > MAX_SERIALIZATION_DEPTH)
|
|
4470
|
+
return [];
|
|
4471
|
+
if (typescript.isParenthesizedTypeNode(node))
|
|
4472
|
+
return getDeclaredLiterals(typescript, checker, node.type, depth);
|
|
4473
|
+
if (typescript.isUnionTypeNode(node))
|
|
4474
|
+
return node.types.flatMap((member) => getDeclaredLiterals(typescript, checker, member, depth));
|
|
4475
|
+
if (typescript.isLiteralTypeNode(node)) {
|
|
4476
|
+
let { literal } = node;
|
|
4477
|
+
return typescript.isStringLiteralLike(literal) ? [literal.text] : typescript.isNumericLiteral(literal) ? [Number(literal.text)] : typescript.isPrefixUnaryExpression(literal) && literal.operator === typescript.SyntaxKind.MinusToken && typescript.isNumericLiteral(literal.operand) ? [-Number(literal.operand.text)] : [];
|
|
4478
|
+
}
|
|
4479
|
+
if (typescript.isTypeReferenceNode(node)) {
|
|
4480
|
+
let symbol = checker.getSymbolAtLocation(node.typeName);
|
|
4481
|
+
return ((symbol ? resolveAliasedSymbol(typescript, checker, symbol).declarations : void 0) ?? []).flatMap(
|
|
4482
|
+
(declaration) => typescript.isTypeAliasDeclaration(declaration) ? getDeclaredLiterals(typescript, checker, declaration.type, depth + 1) : []
|
|
4483
|
+
);
|
|
4484
|
+
}
|
|
4485
|
+
return [];
|
|
4486
|
+
}
|
|
4487
|
+
function compareNumericOrByCodeUnit(a, b) {
|
|
4488
|
+
if (typeof a == "number" && typeof b == "number")
|
|
4489
|
+
return a - b;
|
|
4490
|
+
let [textA, textB] = [String(a), String(b)];
|
|
4491
|
+
return textA < textB ? -1 : textA > textB ? 1 : 0;
|
|
4492
|
+
}
|
|
4493
|
+
function compareEnumMembers(typescript, a, b) {
|
|
4494
|
+
let [memberA, memberB] = [a, b].map((type) => {
|
|
4495
|
+
let declaration = type.symbol?.declarations?.[0];
|
|
4496
|
+
return declaration && typescript.isEnumMember(declaration) ? declaration : void 0;
|
|
4497
|
+
});
|
|
4498
|
+
if (!memberA || !memberB)
|
|
4499
|
+
return +!memberA - +!memberB;
|
|
4500
|
+
let [enumA, enumB] = [memberA.parent, memberB.parent];
|
|
4501
|
+
return compareNumericOrByCodeUnit(enumA.getSourceFile().fileName, enumB.getSourceFile().fileName) || enumA.pos - enumB.pos || memberA.pos - memberB.pos;
|
|
4502
|
+
}
|
|
4503
|
+
function serializeType(typescript, checker, type, isRequired, depth = 0, declaredTypeNode) {
|
|
4714
4504
|
if (depth > MAX_SERIALIZATION_DEPTH)
|
|
4715
4505
|
return { name: checker.typeToString(type) };
|
|
4716
4506
|
if (type.isUnion()) {
|
|
@@ -4721,7 +4511,12 @@ function serializeType(typescript, checker, type, isRequired, depth = 0) {
|
|
|
4721
4511
|
);
|
|
4722
4512
|
if (booleanLiterals.length === 2 && booleanLiterals.length === nonUndefinedTypes.length)
|
|
4723
4513
|
return { name: "boolean" };
|
|
4724
|
-
let
|
|
4514
|
+
let declaredLiterals = getDeclaredLiterals(typescript, checker, declaredTypeNode), declaredPosition = (member) => {
|
|
4515
|
+
let index = declaredLiterals.indexOf(member.value);
|
|
4516
|
+
return index === -1 ? declaredLiterals.length : index;
|
|
4517
|
+
}, literalMembers = nonUndefinedTypes.filter(isLiteralType).toSorted(
|
|
4518
|
+
(a, b) => declaredPosition(a) - declaredPosition(b) || compareEnumMembers(typescript, a, b) || compareNumericOrByCodeUnit(a.value, b.value)
|
|
4519
|
+
);
|
|
4725
4520
|
if (literalMembers.length > 0 && literalMembers.length === nonUndefinedTypes.length)
|
|
4726
4521
|
return {
|
|
4727
4522
|
name: "enum",
|
|
@@ -4921,7 +4716,7 @@ function getJSDocDefault(typescript, prop, checker) {
|
|
|
4921
4716
|
return typescript.displayPartsToString(tag.text) || void 0;
|
|
4922
4717
|
}
|
|
4923
4718
|
function extractPropItem(typescript, checker, prop, contextNode, defaultsMap, typeOverride) {
|
|
4924
|
-
let isRequired = !!!(prop.flags & typescript.SymbolFlags.Optional), propType = typeOverride ?? checker.getTypeOfSymbolAtLocation(prop, contextNode), type = serializeType(typescript, checker, propType, isRequired), description = typescript.displayPartsToString(
|
|
4719
|
+
let isRequired = !!!(prop.flags & typescript.SymbolFlags.Optional), propType = typeOverride ?? checker.getTypeOfSymbolAtLocation(prop, contextNode), declaration = prop.declarations?.[0], declaredTypeNode = declaration && (typescript.isPropertySignature(declaration) || typescript.isPropertyDeclaration(declaration)) ? declaration.type : void 0, type = serializeType(typescript, checker, propType, isRequired, 0, declaredTypeNode), description = typescript.displayPartsToString(
|
|
4925
4720
|
prop.getDocumentationComment(checker)
|
|
4926
4721
|
), parent = getParentType(typescript, prop), declarations = getAllDeclarationParents(typescript, prop), propName = prop.getName(), destructuringDefault = defaultsMap?.get(propName), jsDocDefault = getJSDocDefault(typescript, prop, checker), defaultStr = destructuringDefault ?? jsDocDefault;
|
|
4927
4722
|
return {
|
|
@@ -4934,6 +4729,11 @@ function extractPropItem(typescript, checker, prop, contextNode, defaultsMap, ty
|
|
|
4934
4729
|
declarations
|
|
4935
4730
|
};
|
|
4936
4731
|
}
|
|
4732
|
+
function orderByDeclaration(properties) {
|
|
4733
|
+
return [...groupByToMap(properties, (prop) => prop.declarations?.[0]?.parent ?? prop).values()].flatMap(
|
|
4734
|
+
(group) => group.toSorted((a, b) => (a.declarations?.[0]?.pos ?? 0) - (b.declarations?.[0]?.pos ?? 0))
|
|
4735
|
+
);
|
|
4736
|
+
}
|
|
4937
4737
|
function getBulkSourceExclusions(typescript, properties) {
|
|
4938
4738
|
let bulkCandidates = properties.flatMap((prop) => {
|
|
4939
4739
|
let source = getPropSourceFile(prop);
|
|
@@ -4994,6 +4794,7 @@ function serializeComponentDoc(typescript, checker, {
|
|
|
4994
4794
|
allProperties = Array.from(seen.values()), unionForceOptional = forceOptional;
|
|
4995
4795
|
} else
|
|
4996
4796
|
allProperties = propsType.getApparentProperties();
|
|
4797
|
+
allProperties = orderByDeclaration(allProperties);
|
|
4997
4798
|
let excluded = getBulkSourceExclusions(typescript, allProperties), implementation = followVariableReferences(typescript, checker, resolved), defaultsMap = extractDestructuringDefaults(typescript, implementation, checker);
|
|
4998
4799
|
if (defaultsMap.size === 0 && defaultsSourcePath) {
|
|
4999
4800
|
let fallbackDefaults = extractDefaultsFromSourceFile(typescript, defaultsSourcePath, {
|
|
@@ -5264,7 +5065,10 @@ var ComponentMetaProject = class extends ProgramBackedProject {
|
|
|
5264
5065
|
// asScriptId - identity for React (no URI mapping needed)
|
|
5265
5066
|
projectHost
|
|
5266
5067
|
);
|
|
5267
|
-
this.service = typescript.createLanguageService(
|
|
5068
|
+
this.service = typescript.createLanguageService(
|
|
5069
|
+
Object.assign(languageServiceHost, { useSourceOfProjectReferenceRedirect: () => !0 }),
|
|
5070
|
+
this.documentRegistry
|
|
5071
|
+
);
|
|
5268
5072
|
}
|
|
5269
5073
|
getCommandLine() {
|
|
5270
5074
|
return this.commandLine;
|
|
@@ -5422,25 +5226,34 @@ var ComponentMetaManager = class extends BaseComponentMetaManager {
|
|
|
5422
5226
|
* Batch-extract component props across all entries, grouping by tsconfig project so each project
|
|
5423
5227
|
* builds its TS program only once.
|
|
5424
5228
|
*/
|
|
5425
|
-
batchExtract(entries) {
|
|
5426
|
-
let
|
|
5427
|
-
(
|
|
5428
|
-
), byProject = groupByToMap(
|
|
5429
|
-
extractableEntries,
|
|
5229
|
+
batchExtract(entries, batchFiles) {
|
|
5230
|
+
let byProject = groupByToMap(
|
|
5231
|
+
entries.filter(isExtractable),
|
|
5430
5232
|
(storyRef) => this.getProjectForFile(storyRef.storyPath)
|
|
5431
5233
|
);
|
|
5432
|
-
for (let [project, projectEntries] of byProject)
|
|
5234
|
+
for (let [project, projectEntries] of byProject) {
|
|
5235
|
+
this.addBatchFiles(project, batchFiles);
|
|
5433
5236
|
try {
|
|
5434
5237
|
project.extractPropsFromStories(projectEntries);
|
|
5435
5238
|
} catch (err) {
|
|
5436
5239
|
logger3.debug(`[reactComponentMeta] Batch extraction failed: ${err}`);
|
|
5437
5240
|
}
|
|
5438
|
-
|
|
5241
|
+
}
|
|
5242
|
+
this.recycleProjectsIfHeapPressured() && batchFiles?.clear();
|
|
5439
5243
|
}
|
|
5440
|
-
|
|
5244
|
+
addBatchFiles(project, batchFiles) {
|
|
5245
|
+
let files = batchFiles?.get(project) ?? [];
|
|
5246
|
+
batchFiles?.delete(project);
|
|
5247
|
+
try {
|
|
5248
|
+
project.ensureFiles(files);
|
|
5249
|
+
} catch (err) {
|
|
5250
|
+
logger3.debug(`[reactComponentMeta] Adding the batch files failed: ${err}`);
|
|
5251
|
+
}
|
|
5252
|
+
}
|
|
5253
|
+
}, isExtractable = (storyRef) => !!storyRef.component?.path && !!storyRef.component.importName;
|
|
5441
5254
|
|
|
5442
5255
|
// ../../../node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
|
|
5443
|
-
var
|
|
5256
|
+
var _lazyMatch = () => {
|
|
5444
5257
|
var __lib__ = (() => {
|
|
5445
5258
|
var m = Object.defineProperty, V = Object.getOwnPropertyDescriptor, G = Object.getOwnPropertyNames, T = Object.prototype.hasOwnProperty, q = (r, e) => {
|
|
5446
5259
|
for (var n in e) m(r, n, { get: e[n], enumerable: !0 });
|
|
@@ -5593,11 +5406,11 @@ var _lazyMatch2 = () => {
|
|
|
5593
5406
|
return J(w);
|
|
5594
5407
|
})();
|
|
5595
5408
|
return __lib__.default || __lib__;
|
|
5596
|
-
},
|
|
5409
|
+
}, _match, zeptomatch = (path2, pattern) => (_match || (_match = _lazyMatch(), _lazyMatch = null), _match(path2, pattern)), _DRIVE_LETTER_START_RE2 = /^[A-Za-z]:\//;
|
|
5597
5410
|
function normalizeWindowsPath2(input = "") {
|
|
5598
5411
|
return input && input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE2, (r) => r.toUpperCase());
|
|
5599
5412
|
}
|
|
5600
|
-
var _UNC_REGEX2 = /^[/\\]{2}/, _IS_ABSOLUTE_RE2 = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/, _DRIVE_LETTER_RE2 = /^[A-Za-z]:$/,
|
|
5413
|
+
var _UNC_REGEX2 = /^[/\\]{2}/, _IS_ABSOLUTE_RE2 = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/, _DRIVE_LETTER_RE2 = /^[A-Za-z]:$/, _ROOT_FOLDER_RE = /^\/([A-Za-z]:)?$/, _EXTNAME_RE = /.(\.[^./]+|\.)$/, _PATH_ROOT_RE = /^[/\\]|^[a-zA-Z]:[/\\]/, sep = "/", normalize2 = function(path2) {
|
|
5601
5414
|
if (path2.length === 0)
|
|
5602
5415
|
return ".";
|
|
5603
5416
|
path2 = normalizeWindowsPath2(path2);
|
|
@@ -5614,14 +5427,14 @@ var _UNC_REGEX2 = /^[/\\]{2}/, _IS_ABSOLUTE_RE2 = /^[/\\](?![/\\])|^[/\\]{2}(?!\
|
|
|
5614
5427
|
path2 += seg;
|
|
5615
5428
|
return normalize2(path2);
|
|
5616
5429
|
};
|
|
5617
|
-
function
|
|
5430
|
+
function cwd() {
|
|
5618
5431
|
return typeof process < "u" && typeof process.cwd == "function" ? process.cwd().replace(/\\/g, "/") : "/";
|
|
5619
5432
|
}
|
|
5620
|
-
var
|
|
5433
|
+
var resolve = function(...arguments_) {
|
|
5621
5434
|
arguments_ = arguments_.map((argument) => normalizeWindowsPath2(argument));
|
|
5622
5435
|
let resolvedPath = "", resolvedAbsolute = !1;
|
|
5623
5436
|
for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
|
|
5624
|
-
let path2 = index >= 0 ? arguments_[index] :
|
|
5437
|
+
let path2 = index >= 0 ? arguments_[index] : cwd();
|
|
5625
5438
|
!path2 || path2.length === 0 || (resolvedPath = `${path2}/${resolvedPath}`, resolvedAbsolute = isAbsolute2(path2));
|
|
5626
5439
|
}
|
|
5627
5440
|
return resolvedPath = normalizeString2(resolvedPath, !resolvedAbsolute), resolvedAbsolute && !isAbsolute2(resolvedPath) ? `/${resolvedPath}` : resolvedPath.length > 0 ? resolvedPath : ".";
|
|
@@ -5658,14 +5471,14 @@ function normalizeString2(path2, allowAboveRoot) {
|
|
|
5658
5471
|
}
|
|
5659
5472
|
var isAbsolute2 = function(p) {
|
|
5660
5473
|
return _IS_ABSOLUTE_RE2.test(p);
|
|
5661
|
-
},
|
|
5474
|
+
}, toNamespacedPath = function(p) {
|
|
5662
5475
|
return normalizeWindowsPath2(p);
|
|
5663
|
-
},
|
|
5476
|
+
}, extname = function(p) {
|
|
5664
5477
|
if (p === "..") return "";
|
|
5665
|
-
let match =
|
|
5478
|
+
let match = _EXTNAME_RE.exec(normalizeWindowsPath2(p));
|
|
5666
5479
|
return match && match[1] || "";
|
|
5667
|
-
},
|
|
5668
|
-
let _from =
|
|
5480
|
+
}, relative = function(from, to) {
|
|
5481
|
+
let _from = resolve(from).replace(_ROOT_FOLDER_RE, "$1").split("/"), _to = resolve(to).replace(_ROOT_FOLDER_RE, "$1").split("/");
|
|
5669
5482
|
if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0])
|
|
5670
5483
|
return _to.join("/");
|
|
5671
5484
|
let _fromCopy = [..._from];
|
|
@@ -5678,14 +5491,14 @@ var isAbsolute2 = function(p) {
|
|
|
5678
5491
|
}, dirname3 = function(p) {
|
|
5679
5492
|
let segments = normalizeWindowsPath2(p).replace(/\/$/, "").split("/").slice(0, -1);
|
|
5680
5493
|
return segments.length === 1 && _DRIVE_LETTER_RE2.test(segments[0]) && (segments[0] += "/"), segments.join("/") || (isAbsolute2(p) ? "/" : ".");
|
|
5681
|
-
},
|
|
5494
|
+
}, format = function(p) {
|
|
5682
5495
|
let ext = p.ext ? p.ext.startsWith(".") ? p.ext : `.${p.ext}` : "", segments = [p.root, p.dir, p.base ?? (p.name ?? "") + ext].filter(
|
|
5683
5496
|
Boolean
|
|
5684
5497
|
);
|
|
5685
5498
|
return normalizeWindowsPath2(
|
|
5686
|
-
p.root ?
|
|
5499
|
+
p.root ? resolve(...segments) : segments.join("/")
|
|
5687
5500
|
);
|
|
5688
|
-
},
|
|
5501
|
+
}, basename = function(p, extension) {
|
|
5689
5502
|
let segments = normalizeWindowsPath2(p).split("/"), lastSegment = "";
|
|
5690
5503
|
for (let i = segments.length - 1; i >= 0; i--) {
|
|
5691
5504
|
let val = segments[i];
|
|
@@ -5695,8 +5508,8 @@ var isAbsolute2 = function(p) {
|
|
|
5695
5508
|
}
|
|
5696
5509
|
}
|
|
5697
5510
|
return extension && lastSegment.endsWith(extension) ? lastSegment.slice(0, -extension.length) : lastSegment;
|
|
5698
|
-
},
|
|
5699
|
-
let root =
|
|
5511
|
+
}, parse = function(p) {
|
|
5512
|
+
let root = _PATH_ROOT_RE.exec(p)?.[0]?.replace(/\\/g, "/") || "", base = basename(p), extension = extname(base);
|
|
5700
5513
|
return {
|
|
5701
5514
|
root,
|
|
5702
5515
|
dir: dirname3(p),
|
|
@@ -5704,30 +5517,30 @@ var isAbsolute2 = function(p) {
|
|
|
5704
5517
|
ext: extension,
|
|
5705
5518
|
name: base.slice(0, base.length - extension.length)
|
|
5706
5519
|
};
|
|
5707
|
-
},
|
|
5520
|
+
}, matchesGlob = (path2, pattern) => zeptomatch(pattern, normalize2(path2)), _path = {
|
|
5708
5521
|
__proto__: null,
|
|
5709
|
-
basename
|
|
5522
|
+
basename,
|
|
5710
5523
|
dirname: dirname3,
|
|
5711
|
-
extname
|
|
5712
|
-
format
|
|
5524
|
+
extname,
|
|
5525
|
+
format,
|
|
5713
5526
|
isAbsolute: isAbsolute2,
|
|
5714
5527
|
join: join2,
|
|
5715
|
-
matchesGlob
|
|
5528
|
+
matchesGlob,
|
|
5716
5529
|
normalize: normalize2,
|
|
5717
5530
|
normalizeString: normalizeString2,
|
|
5718
|
-
parse
|
|
5719
|
-
relative
|
|
5720
|
-
resolve
|
|
5721
|
-
sep
|
|
5722
|
-
toNamespacedPath
|
|
5531
|
+
parse,
|
|
5532
|
+
relative,
|
|
5533
|
+
resolve,
|
|
5534
|
+
sep,
|
|
5535
|
+
toNamespacedPath
|
|
5723
5536
|
};
|
|
5724
5537
|
|
|
5725
5538
|
// ../../../node_modules/pathe/dist/index.mjs
|
|
5726
|
-
var
|
|
5539
|
+
var delimiter = globalThis.process?.platform === "win32" ? ";" : ":", _platforms = { posix: void 0, win32: void 0 }, mix = (del = delimiter) => new Proxy(_path, {
|
|
5727
5540
|
get(_, prop) {
|
|
5728
|
-
return prop === "delimiter" ? del : prop === "posix" ?
|
|
5541
|
+
return prop === "delimiter" ? del : prop === "posix" ? posix : prop === "win32" ? win32 : _platforms[prop] || _path[prop];
|
|
5729
5542
|
}
|
|
5730
|
-
}),
|
|
5543
|
+
}), posix = /* @__PURE__ */ mix(":"), win32 = /* @__PURE__ */ mix(";");
|
|
5731
5544
|
|
|
5732
5545
|
// src/componentManifest/generateCodeSnippet.ts
|
|
5733
5546
|
import {
|
|
@@ -5942,7 +5755,7 @@ function rewriteJsx(code, node, merged, edits, mark) {
|
|
|
5942
5755
|
}
|
|
5943
5756
|
|
|
5944
5757
|
// src/componentManifest/reactDocgenTypescript.ts
|
|
5945
|
-
import { dirname as dirname4, join as join3, resolve as
|
|
5758
|
+
import { dirname as dirname4, join as join3, resolve as resolve2 } from "node:path";
|
|
5946
5759
|
import {
|
|
5947
5760
|
extractComponentJsDocInfo as extractComponentJsDocInfo2,
|
|
5948
5761
|
resolveExportedSymbol
|
|
@@ -6094,15 +5907,15 @@ var parseWithReactDocgenTypescript = asyncCache(
|
|
|
6094
5907
|
},
|
|
6095
5908
|
{ name: "parseWithReactDocgenTypescript" }
|
|
6096
5909
|
), findOwningTsconfigPath = cached(
|
|
6097
|
-
(typescript,
|
|
6098
|
-
let configPath = findTsconfigPath(
|
|
5910
|
+
(typescript, cwd2, filePath) => {
|
|
5911
|
+
let configPath = findTsconfigPath(cwd2);
|
|
6099
5912
|
if (configPath)
|
|
6100
5913
|
return findTsconfigPathIncludingFile(typescript, configPath, filePath, /* @__PURE__ */ new Set()) ?? configPath;
|
|
6101
5914
|
},
|
|
6102
5915
|
{
|
|
6103
|
-
key: (typescript,
|
|
5916
|
+
key: (typescript, cwd2, filePath) => `${normalizeFileName(typescript, resolve2(cwd2))}::${normalizeFileName(
|
|
6104
5917
|
typescript,
|
|
6105
|
-
|
|
5918
|
+
resolve2(filePath)
|
|
6106
5919
|
)}`,
|
|
6107
5920
|
name: "findOwningTsconfigPath"
|
|
6108
5921
|
}
|
|
@@ -6127,7 +5940,7 @@ function findTsconfigPathIncludingFile(typescript, configPath, filePath, seenCon
|
|
|
6127
5940
|
}
|
|
6128
5941
|
}
|
|
6129
5942
|
function getReferencedTsconfigPaths(typescript, configPath, config) {
|
|
6130
|
-
return (Array.isArray(config?.references) ? config.references : []).map((reference) => reference.path).filter((referencePath) => typeof referencePath == "string").map((referencePath) =>
|
|
5943
|
+
return (Array.isArray(config?.references) ? config.references : []).map((reference) => reference.path).filter((referencePath) => typeof referencePath == "string").map((referencePath) => resolve2(dirname4(configPath), referencePath)).map(
|
|
6131
5944
|
(referencePath) => referencePath.endsWith(".json") ? referencePath : join3(referencePath, "tsconfig.json")
|
|
6132
5945
|
).filter((referencePath) => typescript.sys.fileExists(referencePath));
|
|
6133
5946
|
}
|
|
@@ -6148,14 +5961,20 @@ function isSameFileName(typescript, left, right) {
|
|
|
6148
5961
|
return normalizeFileName(typescript, left) === normalizeFileName(typescript, right);
|
|
6149
5962
|
}
|
|
6150
5963
|
function normalizeFileName(typescript, fileName) {
|
|
6151
|
-
let normalized =
|
|
5964
|
+
let normalized = resolve2(fileName).replace(/\\/g, "/");
|
|
6152
5965
|
return typescript.sys.useCaseSensitiveFileNames ? normalized : normalized.toLowerCase();
|
|
6153
5966
|
}
|
|
6154
5967
|
|
|
6155
5968
|
// src/componentManifest/resolveComponents.ts
|
|
6156
|
-
import {
|
|
5969
|
+
import {
|
|
5970
|
+
createMetaComponentResolver,
|
|
5971
|
+
createModuleResolver,
|
|
5972
|
+
extractDeclaredSubcomponents,
|
|
5973
|
+
supportedExtensions
|
|
5974
|
+
} from "storybook/internal/common";
|
|
6157
5975
|
import { storyNameFromExport } from "storybook/internal/csf/csf-utils";
|
|
6158
5976
|
import {
|
|
5977
|
+
collectImportBindings as collectImportBindings3,
|
|
6159
5978
|
createStoryArgsResolver as createStoryArgsResolver2,
|
|
6160
5979
|
extractStoryJSDocInfo,
|
|
6161
5980
|
loadCsf,
|
|
@@ -6178,7 +5997,7 @@ import { getTypeScriptForDocgenError, isModuleNotFoundError as isModuleNotFoundE
|
|
|
6178
5997
|
import { logger as logger5 } from "storybook/internal/node-logger";
|
|
6179
5998
|
var reactDocgenPromise;
|
|
6180
5999
|
function loadReactDocgen() {
|
|
6181
|
-
return reactDocgenPromise ??= import("./reactDocgen-
|
|
6000
|
+
return reactDocgenPromise ??= import("./reactDocgen-WMOVFLAX.js").catch((error) => {
|
|
6182
6001
|
if (isModuleNotFoundError2(error)) {
|
|
6183
6002
|
logger5.debug(`Skipping react-docgen, which is not installed: ${error}`);
|
|
6184
6003
|
return;
|
|
@@ -6211,7 +6030,8 @@ var isReactDocgenTypescriptResolvable = () => {
|
|
|
6211
6030
|
storyFilePath,
|
|
6212
6031
|
typescriptOptions = {},
|
|
6213
6032
|
docgenEngine,
|
|
6214
|
-
additionalComponentNames = []
|
|
6033
|
+
additionalComponentNames = [],
|
|
6034
|
+
docgenTargets
|
|
6215
6035
|
}) => {
|
|
6216
6036
|
let { reactDocgenTypescriptOptions } = typescriptOptions, componentSet = /* @__PURE__ */ new Set(), componentDepth = /* @__PURE__ */ new Map(), localToImport = collectImportBindings2(csf.program), jsxDepth = /* @__PURE__ */ new Map();
|
|
6217
6037
|
walk2(csf.program, (node, parent) => {
|
|
@@ -6257,18 +6077,36 @@ var isReactDocgenTypescriptResolvable = () => {
|
|
|
6257
6077
|
component.importId && !component.importId.startsWith(".") && storyFilePath && (cachedResolveImport(component.importId, { basedir: dirname5(storyFilePath) }), isPackage = !0);
|
|
6258
6078
|
} catch {
|
|
6259
6079
|
}
|
|
6260
|
-
let componentWithPackage = { ...component, isPackage };
|
|
6261
|
-
if (
|
|
6080
|
+
let componentWithPackage = { ...component, isPackage }, target = docgenTargets?.get(c);
|
|
6081
|
+
if (target && "missing" in target) {
|
|
6082
|
+
let error = { name: "Component export not found", message: target.missing };
|
|
6083
|
+
return docgenEngine === "react-docgen" ? { ...componentWithPackage, path: path2, reactDocgen: { type: "error", error } } : { ...componentWithPackage, path: path2, reactDocgenTypescriptError: error };
|
|
6084
|
+
}
|
|
6085
|
+
let docgenRef = target ? {
|
|
6086
|
+
...componentWithPackage,
|
|
6087
|
+
importName: target.exportName,
|
|
6088
|
+
localImportName: target.exportName,
|
|
6089
|
+
member: void 0,
|
|
6090
|
+
namespace: void 0
|
|
6091
|
+
} : componentWithPackage, docgenPath = target?.path ?? path2;
|
|
6092
|
+
if (path2 ??= docgenPath, path2 && docgenPath) {
|
|
6262
6093
|
if (docgenEngine === "react-docgen-typescript") {
|
|
6263
6094
|
let reactDocgenTypescript, reactDocgenTypescriptError;
|
|
6264
6095
|
try {
|
|
6265
|
-
let docs = await parseWithReactDocgenTypescript(
|
|
6266
|
-
|
|
6096
|
+
let docs = await parseWithReactDocgenTypescript(
|
|
6097
|
+
docgenPath,
|
|
6098
|
+
reactDocgenTypescriptOptions
|
|
6099
|
+
);
|
|
6100
|
+
reactDocgenTypescript = matchComponentDoc(docs, docgenRef), reactDocgenTypescript || (reactDocgenTypescriptError = getReactDocgenTypescriptError(
|
|
6101
|
+
docgenPath,
|
|
6102
|
+
docgenRef,
|
|
6103
|
+
docs
|
|
6104
|
+
));
|
|
6267
6105
|
} catch (e) {
|
|
6268
6106
|
let message = e instanceof Error ? e.message : String(e);
|
|
6269
|
-
logger6.debug(`react-docgen-typescript failed for ${
|
|
6107
|
+
logger6.debug(`react-docgen-typescript failed for ${docgenPath}: ${message}`), reactDocgenTypescriptError = isModuleNotFoundError3(e) && !isReactDocgenTypescriptResolvable() ? getDocgenPackageMissingError("react-docgen-typescript") : {
|
|
6270
6108
|
name: "react-docgen-typescript parse error",
|
|
6271
|
-
message: `File: ${
|
|
6109
|
+
message: `File: ${docgenPath}
|
|
6272
6110
|
${message}`
|
|
6273
6111
|
};
|
|
6274
6112
|
}
|
|
@@ -6287,7 +6125,7 @@ ${message}`
|
|
|
6287
6125
|
};
|
|
6288
6126
|
}
|
|
6289
6127
|
if (docgenEngine === "react-docgen") {
|
|
6290
|
-
let reactDocgenEngine = await loadReactDocgen(), reactDocgen = reactDocgenEngine ? reactDocgenEngine.getReactDocgen(
|
|
6128
|
+
let reactDocgenEngine = await loadReactDocgen(), reactDocgen = reactDocgenEngine ? reactDocgenEngine.getReactDocgen(docgenPath, docgenRef) : { type: "error", error: getDocgenPackageMissingError("react-docgen") };
|
|
6291
6129
|
return {
|
|
6292
6130
|
...componentWithPackage,
|
|
6293
6131
|
path: path2,
|
|
@@ -6313,6 +6151,21 @@ function findExactComponentMatch(components, componentName) {
|
|
|
6313
6151
|
}
|
|
6314
6152
|
|
|
6315
6153
|
// src/componentManifest/resolveComponents.ts
|
|
6154
|
+
var resolveMetaComponent = createMetaComponentResolver({
|
|
6155
|
+
reader: {
|
|
6156
|
+
resolver: createModuleResolver({
|
|
6157
|
+
extensions: [...supportedExtensions],
|
|
6158
|
+
extensionAlias: {
|
|
6159
|
+
".js": [".js", ".ts", ".tsx"],
|
|
6160
|
+
".jsx": [".jsx", ".tsx"],
|
|
6161
|
+
".mjs": [".mjs", ".mts"],
|
|
6162
|
+
".cjs": [".cjs", ".cts"]
|
|
6163
|
+
},
|
|
6164
|
+
mainFields: ["module", "main"],
|
|
6165
|
+
tsconfig: "auto"
|
|
6166
|
+
})
|
|
6167
|
+
}
|
|
6168
|
+
});
|
|
6316
6169
|
function findMatchingComponent(components, componentName, title) {
|
|
6317
6170
|
let exactMatch = findExactComponentMatch(components, componentName);
|
|
6318
6171
|
if (exactMatch)
|
|
@@ -6331,17 +6184,30 @@ function findMatchingComponent(components, componentName, title) {
|
|
|
6331
6184
|
return best;
|
|
6332
6185
|
}
|
|
6333
6186
|
async function resolveStoryFileComponents(options) {
|
|
6334
|
-
let { storyPath, title, typescriptOptions, docgenEngine } = options, storyFile = cachedReadTextFileSync(storyPath), csf = loadCsf(storyFile, { makeTitle: () => title, fileName: storyPath }).parse(), componentName = csf._meta?.component, declaredSubcomponents = extractDeclaredSubcomponents(csf),
|
|
6335
|
-
|
|
6336
|
-
|
|
6337
|
-
|
|
6187
|
+
let { storyPath, title, typescriptOptions, docgenEngine } = options, storyFile = cachedReadTextFileSync(storyPath), csf = loadCsf(storyFile, { makeTitle: () => title, fileName: storyPath }).parse(), componentName = csf._meta?.component, declaredSubcomponents = extractDeclaredSubcomponents(csf), docgenTargets = /* @__PURE__ */ new Map(), storyImports = collectImportBindings3(csf.editor.program), resolveName = (name, node) => {
|
|
6188
|
+
let resolved = resolveMetaComponent(csf, storyPath, node);
|
|
6189
|
+
if ("reason" in resolved)
|
|
6190
|
+
return resolved.reason === "missing-export" && docgenTargets.set(name, {
|
|
6191
|
+
missing: `"${resolved.importId}" has no export "${resolved.exportName}", which ${resolved.expression} reads.`
|
|
6192
|
+
}), name;
|
|
6193
|
+
let { localName, importId, importer, path: path2, exportName } = resolved.component, ownName = importer === storyPath && storyImports.get(localName)?.importId === importId && !storyImports.has(name.split(".")[0]) ? localName : name;
|
|
6194
|
+
return importId && path2 && docgenTargets.set(ownName, { path: path2, exportName }), ownName;
|
|
6195
|
+
}, metaComponentName = componentName && resolveName(componentName), declared = declaredSubcomponents.map((subcomponent) => ({
|
|
6196
|
+
name: subcomponent.name,
|
|
6197
|
+
componentName: resolveName(subcomponent.componentName, subcomponent.node)
|
|
6198
|
+
})), allComponents = await getComponents({
|
|
6199
|
+
additionalComponentNames: [
|
|
6200
|
+
...metaComponentName ? [metaComponentName] : [],
|
|
6201
|
+
...declared.map((subcomponent) => subcomponent.componentName)
|
|
6202
|
+
],
|
|
6338
6203
|
csf,
|
|
6339
6204
|
storyFilePath: storyPath,
|
|
6340
6205
|
typescriptOptions,
|
|
6341
|
-
docgenEngine
|
|
6342
|
-
|
|
6343
|
-
|
|
6344
|
-
|
|
6206
|
+
docgenEngine,
|
|
6207
|
+
docgenTargets: docgenEngine === "react-component-meta" ? void 0 : docgenTargets
|
|
6208
|
+
}), component = findMatchingComponent(allComponents, metaComponentName, title), subcomponents = declared.map((subcomponent) => ({
|
|
6209
|
+
name: subcomponent.name,
|
|
6210
|
+
component: findExactComponentMatch(allComponents, subcomponent.componentName)
|
|
6345
6211
|
}));
|
|
6346
6212
|
return { storyPath, storyFile, csf, componentName, allComponents, component, subcomponents };
|
|
6347
6213
|
}
|
|
@@ -6400,7 +6266,7 @@ function hasRootEntry(pkg) {
|
|
|
6400
6266
|
}
|
|
6401
6267
|
function getImportablePackageName(componentPath, fallbackPath) {
|
|
6402
6268
|
let nearestPkg = cachedFindUp("package.json", {
|
|
6403
|
-
cwd:
|
|
6269
|
+
cwd: posix.dirname(componentPath ?? fallbackPath)
|
|
6404
6270
|
});
|
|
6405
6271
|
try {
|
|
6406
6272
|
if (!nearestPkg)
|
|
@@ -6419,7 +6285,7 @@ function getFallbackImport(packageName, componentName) {
|
|
|
6419
6285
|
`) : "";
|
|
6420
6286
|
}
|
|
6421
6287
|
function relativizeComponentMetaPaths(doc) {
|
|
6422
|
-
let relativize = (fileName) =>
|
|
6288
|
+
let relativize = (fileName) => posix.relative(process.cwd(), fileName), relativizeProp = (prop) => ({
|
|
6423
6289
|
...prop,
|
|
6424
6290
|
parent: prop.parent ? { ...prop.parent, fileName: relativize(prop.parent.fileName) } : prop.parent,
|
|
6425
6291
|
declarations: prop.declarations?.map((declaration) => ({
|
|
@@ -6631,7 +6497,7 @@ function buildReactComponentDocgenFromResolved({
|
|
|
6631
6497
|
export {
|
|
6632
6498
|
join2 as join,
|
|
6633
6499
|
isAbsolute2 as isAbsolute,
|
|
6634
|
-
|
|
6500
|
+
posix,
|
|
6635
6501
|
getCodeSnippet,
|
|
6636
6502
|
invalidateParser,
|
|
6637
6503
|
resolveStoryFileComponents,
|
|
@@ -6639,5 +6505,6 @@ export {
|
|
|
6639
6505
|
buildComponentDocgenFromResolved,
|
|
6640
6506
|
buildReactComponentDocgenFromResolved,
|
|
6641
6507
|
loadDocgenTypeScript,
|
|
6642
|
-
ComponentMetaManager
|
|
6508
|
+
ComponentMetaManager,
|
|
6509
|
+
isExtractable
|
|
6643
6510
|
};
|