@storybook/react 11.0.0-beta.3 → 11.0.0-beta.4

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.
@@ -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-IHFW4SZ5.js";
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-YAHZ47OQ.js";
15
+ } from "./chunk-CJ2XYAXX.js";
27
16
  import {
28
17
  __commonJS,
29
18
  __toESM
30
- } from "./chunk-MA6UOA7T.js";
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, format3) => {
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 }, format3), spans = [];
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, format3);
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(sep3, pathObject) {
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 + sep3 + base : base;
1838
+ return dir ? dir === pathObject.root ? dir + base : dir + sep2 + base : base;
1850
1839
  }
1851
- var posix3 = {
1840
+ var posix2 = {
1852
1841
  // path.resolve([from ...], to)
1853
1842
  resolve: function() {
1854
- for (var resolvedPath = "", resolvedAbsolute = !1, cwd3, i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
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] : (cwd3 === void 0 && (cwd3 = process.cwd()), path2 = cwd3), assertPath(path2), path2.length !== 0 && (resolvedPath = path2 + "/" + resolvedPath, resolvedAbsolute = path2.charCodeAt(0) === 47);
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 ? "." : posix3.normalize(joined);
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 = posix3.resolve(from), to = posix3.resolve(to), from === to)) return "";
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
- posix3.posix = posix3;
1995
- module.exports = posix3;
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-IDD6AHYE.js
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 __filename = CJS_COMPAT_NODE_URL_r3c3rhnvdz.fileURLToPath(import.meta.url), __dirname = CJS_COMPAT_NODE_PATH_r3c3rhnvdz.dirname(__filename), require2 = CJS_COMPAT_NODE_MODULE_r3c3rhnvdz.createRequire(import.meta.url), _lazyMatch = () => {
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]:$/, _ROOT_FOLDER_RE = /^\/([A-Za-z]:)?$/, _EXTNAME_RE = /.(\.[^./]+|\.)$/, _PATH_ROOT_RE = /^[/\\]|^[a-zA-Z]:[/\\]/, sep = "/", normalize = function(path2) {
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
- }, format = function(p) {
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 __filename2 = CJS_COMPAT_NODE_URL_r3c3rhnvdz2.fileURLToPath(import.meta.url), __dirname2 = CJS_COMPAT_NODE_PATH_r3c3rhnvdz2.dirname(__filename2), require3 = CJS_COMPAT_NODE_MODULE_r3c3rhnvdz2.createRequire(import.meta.url), DOCGEN_NODE_GUARDS = [
3434
+ var DOCGEN_NODE_GUARDS = [
3680
3435
  "isArrayLiteralExpression",
3681
3436
  "isArrayTypeNode",
3682
3437
  "isArrowFunction",
@@ -5264,7 +5019,10 @@ var ComponentMetaProject = class extends ProgramBackedProject {
5264
5019
  // asScriptId - identity for React (no URI mapping needed)
5265
5020
  projectHost
5266
5021
  );
5267
- this.service = typescript.createLanguageService(languageServiceHost, this.documentRegistry);
5022
+ this.service = typescript.createLanguageService(
5023
+ Object.assign(languageServiceHost, { useSourceOfProjectReferenceRedirect: () => !0 }),
5024
+ this.documentRegistry
5025
+ );
5268
5026
  }
5269
5027
  getCommandLine() {
5270
5028
  return this.commandLine;
@@ -5440,7 +5198,7 @@ var ComponentMetaManager = class extends BaseComponentMetaManager {
5440
5198
  };
5441
5199
 
5442
5200
  // ../../../node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
5443
- var _lazyMatch2 = () => {
5201
+ var _lazyMatch = () => {
5444
5202
  var __lib__ = (() => {
5445
5203
  var m = Object.defineProperty, V = Object.getOwnPropertyDescriptor, G = Object.getOwnPropertyNames, T = Object.prototype.hasOwnProperty, q = (r, e) => {
5446
5204
  for (var n in e) m(r, n, { get: e[n], enumerable: !0 });
@@ -5593,11 +5351,11 @@ var _lazyMatch2 = () => {
5593
5351
  return J(w);
5594
5352
  })();
5595
5353
  return __lib__.default || __lib__;
5596
- }, _match2, zeptomatch2 = (path2, pattern) => (_match2 || (_match2 = _lazyMatch2(), _lazyMatch2 = null), _match2(path2, pattern)), _DRIVE_LETTER_START_RE2 = /^[A-Za-z]:\//;
5354
+ }, _match, zeptomatch = (path2, pattern) => (_match || (_match = _lazyMatch(), _lazyMatch = null), _match(path2, pattern)), _DRIVE_LETTER_START_RE2 = /^[A-Za-z]:\//;
5597
5355
  function normalizeWindowsPath2(input = "") {
5598
5356
  return input && input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE2, (r) => r.toUpperCase());
5599
5357
  }
5600
- var _UNC_REGEX2 = /^[/\\]{2}/, _IS_ABSOLUTE_RE2 = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/, _DRIVE_LETTER_RE2 = /^[A-Za-z]:$/, _ROOT_FOLDER_RE2 = /^\/([A-Za-z]:)?$/, _EXTNAME_RE2 = /.(\.[^./]+|\.)$/, _PATH_ROOT_RE2 = /^[/\\]|^[a-zA-Z]:[/\\]/, sep2 = "/", normalize2 = function(path2) {
5358
+ 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
5359
  if (path2.length === 0)
5602
5360
  return ".";
5603
5361
  path2 = normalizeWindowsPath2(path2);
@@ -5614,14 +5372,14 @@ var _UNC_REGEX2 = /^[/\\]{2}/, _IS_ABSOLUTE_RE2 = /^[/\\](?![/\\])|^[/\\]{2}(?!\
5614
5372
  path2 += seg;
5615
5373
  return normalize2(path2);
5616
5374
  };
5617
- function cwd2() {
5375
+ function cwd() {
5618
5376
  return typeof process < "u" && typeof process.cwd == "function" ? process.cwd().replace(/\\/g, "/") : "/";
5619
5377
  }
5620
- var resolve2 = function(...arguments_) {
5378
+ var resolve = function(...arguments_) {
5621
5379
  arguments_ = arguments_.map((argument) => normalizeWindowsPath2(argument));
5622
5380
  let resolvedPath = "", resolvedAbsolute = !1;
5623
5381
  for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
5624
- let path2 = index >= 0 ? arguments_[index] : cwd2();
5382
+ let path2 = index >= 0 ? arguments_[index] : cwd();
5625
5383
  !path2 || path2.length === 0 || (resolvedPath = `${path2}/${resolvedPath}`, resolvedAbsolute = isAbsolute2(path2));
5626
5384
  }
5627
5385
  return resolvedPath = normalizeString2(resolvedPath, !resolvedAbsolute), resolvedAbsolute && !isAbsolute2(resolvedPath) ? `/${resolvedPath}` : resolvedPath.length > 0 ? resolvedPath : ".";
@@ -5658,14 +5416,14 @@ function normalizeString2(path2, allowAboveRoot) {
5658
5416
  }
5659
5417
  var isAbsolute2 = function(p) {
5660
5418
  return _IS_ABSOLUTE_RE2.test(p);
5661
- }, toNamespacedPath2 = function(p) {
5419
+ }, toNamespacedPath = function(p) {
5662
5420
  return normalizeWindowsPath2(p);
5663
- }, extname2 = function(p) {
5421
+ }, extname = function(p) {
5664
5422
  if (p === "..") return "";
5665
- let match = _EXTNAME_RE2.exec(normalizeWindowsPath2(p));
5423
+ let match = _EXTNAME_RE.exec(normalizeWindowsPath2(p));
5666
5424
  return match && match[1] || "";
5667
- }, relative2 = function(from, to) {
5668
- let _from = resolve2(from).replace(_ROOT_FOLDER_RE2, "$1").split("/"), _to = resolve2(to).replace(_ROOT_FOLDER_RE2, "$1").split("/");
5425
+ }, relative = function(from, to) {
5426
+ let _from = resolve(from).replace(_ROOT_FOLDER_RE, "$1").split("/"), _to = resolve(to).replace(_ROOT_FOLDER_RE, "$1").split("/");
5669
5427
  if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0])
5670
5428
  return _to.join("/");
5671
5429
  let _fromCopy = [..._from];
@@ -5678,14 +5436,14 @@ var isAbsolute2 = function(p) {
5678
5436
  }, dirname3 = function(p) {
5679
5437
  let segments = normalizeWindowsPath2(p).replace(/\/$/, "").split("/").slice(0, -1);
5680
5438
  return segments.length === 1 && _DRIVE_LETTER_RE2.test(segments[0]) && (segments[0] += "/"), segments.join("/") || (isAbsolute2(p) ? "/" : ".");
5681
- }, format2 = function(p) {
5439
+ }, format = function(p) {
5682
5440
  let ext = p.ext ? p.ext.startsWith(".") ? p.ext : `.${p.ext}` : "", segments = [p.root, p.dir, p.base ?? (p.name ?? "") + ext].filter(
5683
5441
  Boolean
5684
5442
  );
5685
5443
  return normalizeWindowsPath2(
5686
- p.root ? resolve2(...segments) : segments.join("/")
5444
+ p.root ? resolve(...segments) : segments.join("/")
5687
5445
  );
5688
- }, basename2 = function(p, extension) {
5446
+ }, basename = function(p, extension) {
5689
5447
  let segments = normalizeWindowsPath2(p).split("/"), lastSegment = "";
5690
5448
  for (let i = segments.length - 1; i >= 0; i--) {
5691
5449
  let val = segments[i];
@@ -5695,8 +5453,8 @@ var isAbsolute2 = function(p) {
5695
5453
  }
5696
5454
  }
5697
5455
  return extension && lastSegment.endsWith(extension) ? lastSegment.slice(0, -extension.length) : lastSegment;
5698
- }, parse2 = function(p) {
5699
- let root = _PATH_ROOT_RE2.exec(p)?.[0]?.replace(/\\/g, "/") || "", base = basename2(p), extension = extname2(base);
5456
+ }, parse = function(p) {
5457
+ let root = _PATH_ROOT_RE.exec(p)?.[0]?.replace(/\\/g, "/") || "", base = basename(p), extension = extname(base);
5700
5458
  return {
5701
5459
  root,
5702
5460
  dir: dirname3(p),
@@ -5704,30 +5462,30 @@ var isAbsolute2 = function(p) {
5704
5462
  ext: extension,
5705
5463
  name: base.slice(0, base.length - extension.length)
5706
5464
  };
5707
- }, matchesGlob2 = (path2, pattern) => zeptomatch2(pattern, normalize2(path2)), _path2 = {
5465
+ }, matchesGlob = (path2, pattern) => zeptomatch(pattern, normalize2(path2)), _path = {
5708
5466
  __proto__: null,
5709
- basename: basename2,
5467
+ basename,
5710
5468
  dirname: dirname3,
5711
- extname: extname2,
5712
- format: format2,
5469
+ extname,
5470
+ format,
5713
5471
  isAbsolute: isAbsolute2,
5714
5472
  join: join2,
5715
- matchesGlob: matchesGlob2,
5473
+ matchesGlob,
5716
5474
  normalize: normalize2,
5717
5475
  normalizeString: normalizeString2,
5718
- parse: parse2,
5719
- relative: relative2,
5720
- resolve: resolve2,
5721
- sep: sep2,
5722
- toNamespacedPath: toNamespacedPath2
5476
+ parse,
5477
+ relative,
5478
+ resolve,
5479
+ sep,
5480
+ toNamespacedPath
5723
5481
  };
5724
5482
 
5725
5483
  // ../../../node_modules/pathe/dist/index.mjs
5726
- var delimiter2 = globalThis.process?.platform === "win32" ? ";" : ":", _platforms2 = { posix: void 0, win32: void 0 }, mix2 = (del = delimiter2) => new Proxy(_path2, {
5484
+ var delimiter = globalThis.process?.platform === "win32" ? ";" : ":", _platforms = { posix: void 0, win32: void 0 }, mix = (del = delimiter) => new Proxy(_path, {
5727
5485
  get(_, prop) {
5728
- return prop === "delimiter" ? del : prop === "posix" ? posix2 : prop === "win32" ? win322 : _platforms2[prop] || _path2[prop];
5486
+ return prop === "delimiter" ? del : prop === "posix" ? posix : prop === "win32" ? win32 : _platforms[prop] || _path[prop];
5729
5487
  }
5730
- }), posix2 = mix2(":"), win322 = mix2(";");
5488
+ }), posix = /* @__PURE__ */ mix(":"), win32 = /* @__PURE__ */ mix(";");
5731
5489
 
5732
5490
  // src/componentManifest/generateCodeSnippet.ts
5733
5491
  import {
@@ -5942,7 +5700,7 @@ function rewriteJsx(code, node, merged, edits, mark) {
5942
5700
  }
5943
5701
 
5944
5702
  // src/componentManifest/reactDocgenTypescript.ts
5945
- import { dirname as dirname4, join as join3, resolve as resolve3 } from "node:path";
5703
+ import { dirname as dirname4, join as join3, resolve as resolve2 } from "node:path";
5946
5704
  import {
5947
5705
  extractComponentJsDocInfo as extractComponentJsDocInfo2,
5948
5706
  resolveExportedSymbol
@@ -6094,15 +5852,15 @@ var parseWithReactDocgenTypescript = asyncCache(
6094
5852
  },
6095
5853
  { name: "parseWithReactDocgenTypescript" }
6096
5854
  ), findOwningTsconfigPath = cached(
6097
- (typescript, cwd3, filePath) => {
6098
- let configPath = findTsconfigPath(cwd3);
5855
+ (typescript, cwd2, filePath) => {
5856
+ let configPath = findTsconfigPath(cwd2);
6099
5857
  if (configPath)
6100
5858
  return findTsconfigPathIncludingFile(typescript, configPath, filePath, /* @__PURE__ */ new Set()) ?? configPath;
6101
5859
  },
6102
5860
  {
6103
- key: (typescript, cwd3, filePath) => `${normalizeFileName(typescript, resolve3(cwd3))}::${normalizeFileName(
5861
+ key: (typescript, cwd2, filePath) => `${normalizeFileName(typescript, resolve2(cwd2))}::${normalizeFileName(
6104
5862
  typescript,
6105
- resolve3(filePath)
5863
+ resolve2(filePath)
6106
5864
  )}`,
6107
5865
  name: "findOwningTsconfigPath"
6108
5866
  }
@@ -6127,7 +5885,7 @@ function findTsconfigPathIncludingFile(typescript, configPath, filePath, seenCon
6127
5885
  }
6128
5886
  }
6129
5887
  function getReferencedTsconfigPaths(typescript, configPath, config) {
6130
- return (Array.isArray(config?.references) ? config.references : []).map((reference) => reference.path).filter((referencePath) => typeof referencePath == "string").map((referencePath) => resolve3(dirname4(configPath), referencePath)).map(
5888
+ return (Array.isArray(config?.references) ? config.references : []).map((reference) => reference.path).filter((referencePath) => typeof referencePath == "string").map((referencePath) => resolve2(dirname4(configPath), referencePath)).map(
6131
5889
  (referencePath) => referencePath.endsWith(".json") ? referencePath : join3(referencePath, "tsconfig.json")
6132
5890
  ).filter((referencePath) => typescript.sys.fileExists(referencePath));
6133
5891
  }
@@ -6148,14 +5906,20 @@ function isSameFileName(typescript, left, right) {
6148
5906
  return normalizeFileName(typescript, left) === normalizeFileName(typescript, right);
6149
5907
  }
6150
5908
  function normalizeFileName(typescript, fileName) {
6151
- let normalized = resolve3(fileName).replace(/\\/g, "/");
5909
+ let normalized = resolve2(fileName).replace(/\\/g, "/");
6152
5910
  return typescript.sys.useCaseSensitiveFileNames ? normalized : normalized.toLowerCase();
6153
5911
  }
6154
5912
 
6155
5913
  // src/componentManifest/resolveComponents.ts
6156
- import { extractDeclaredSubcomponents } from "storybook/internal/common";
5914
+ import {
5915
+ createMetaComponentResolver,
5916
+ createModuleResolver,
5917
+ extractDeclaredSubcomponents,
5918
+ supportedExtensions
5919
+ } from "storybook/internal/common";
6157
5920
  import { storyNameFromExport } from "storybook/internal/csf/csf-utils";
6158
5921
  import {
5922
+ collectImportBindings as collectImportBindings3,
6159
5923
  createStoryArgsResolver as createStoryArgsResolver2,
6160
5924
  extractStoryJSDocInfo,
6161
5925
  loadCsf,
@@ -6178,7 +5942,7 @@ import { getTypeScriptForDocgenError, isModuleNotFoundError as isModuleNotFoundE
6178
5942
  import { logger as logger5 } from "storybook/internal/node-logger";
6179
5943
  var reactDocgenPromise;
6180
5944
  function loadReactDocgen() {
6181
- return reactDocgenPromise ??= import("./reactDocgen-US7O3JSK.js").catch((error) => {
5945
+ return reactDocgenPromise ??= import("./reactDocgen-WMOVFLAX.js").catch((error) => {
6182
5946
  if (isModuleNotFoundError2(error)) {
6183
5947
  logger5.debug(`Skipping react-docgen, which is not installed: ${error}`);
6184
5948
  return;
@@ -6211,7 +5975,8 @@ var isReactDocgenTypescriptResolvable = () => {
6211
5975
  storyFilePath,
6212
5976
  typescriptOptions = {},
6213
5977
  docgenEngine,
6214
- additionalComponentNames = []
5978
+ additionalComponentNames = [],
5979
+ docgenTargets
6215
5980
  }) => {
6216
5981
  let { reactDocgenTypescriptOptions } = typescriptOptions, componentSet = /* @__PURE__ */ new Set(), componentDepth = /* @__PURE__ */ new Map(), localToImport = collectImportBindings2(csf.program), jsxDepth = /* @__PURE__ */ new Map();
6217
5982
  walk2(csf.program, (node, parent) => {
@@ -6257,18 +6022,36 @@ var isReactDocgenTypescriptResolvable = () => {
6257
6022
  component.importId && !component.importId.startsWith(".") && storyFilePath && (cachedResolveImport(component.importId, { basedir: dirname5(storyFilePath) }), isPackage = !0);
6258
6023
  } catch {
6259
6024
  }
6260
- let componentWithPackage = { ...component, isPackage };
6261
- if (path2) {
6025
+ let componentWithPackage = { ...component, isPackage }, target = docgenTargets?.get(c);
6026
+ if (target && "missing" in target) {
6027
+ let error = { name: "Component export not found", message: target.missing };
6028
+ return docgenEngine === "react-docgen" ? { ...componentWithPackage, path: path2, reactDocgen: { type: "error", error } } : { ...componentWithPackage, path: path2, reactDocgenTypescriptError: error };
6029
+ }
6030
+ let docgenRef = target ? {
6031
+ ...componentWithPackage,
6032
+ importName: target.exportName,
6033
+ localImportName: target.exportName,
6034
+ member: void 0,
6035
+ namespace: void 0
6036
+ } : componentWithPackage, docgenPath = target?.path ?? path2;
6037
+ if (path2 ??= docgenPath, path2 && docgenPath) {
6262
6038
  if (docgenEngine === "react-docgen-typescript") {
6263
6039
  let reactDocgenTypescript, reactDocgenTypescriptError;
6264
6040
  try {
6265
- let docs = await parseWithReactDocgenTypescript(path2, reactDocgenTypescriptOptions);
6266
- reactDocgenTypescript = matchComponentDoc(docs, component), reactDocgenTypescript || (reactDocgenTypescriptError = getReactDocgenTypescriptError(path2, component, docs));
6041
+ let docs = await parseWithReactDocgenTypescript(
6042
+ docgenPath,
6043
+ reactDocgenTypescriptOptions
6044
+ );
6045
+ reactDocgenTypescript = matchComponentDoc(docs, docgenRef), reactDocgenTypescript || (reactDocgenTypescriptError = getReactDocgenTypescriptError(
6046
+ docgenPath,
6047
+ docgenRef,
6048
+ docs
6049
+ ));
6267
6050
  } catch (e) {
6268
6051
  let message = e instanceof Error ? e.message : String(e);
6269
- logger6.debug(`react-docgen-typescript failed for ${path2}: ${message}`), reactDocgenTypescriptError = isModuleNotFoundError3(e) && !isReactDocgenTypescriptResolvable() ? getDocgenPackageMissingError("react-docgen-typescript") : {
6052
+ logger6.debug(`react-docgen-typescript failed for ${docgenPath}: ${message}`), reactDocgenTypescriptError = isModuleNotFoundError3(e) && !isReactDocgenTypescriptResolvable() ? getDocgenPackageMissingError("react-docgen-typescript") : {
6270
6053
  name: "react-docgen-typescript parse error",
6271
- message: `File: ${path2}
6054
+ message: `File: ${docgenPath}
6272
6055
  ${message}`
6273
6056
  };
6274
6057
  }
@@ -6287,7 +6070,7 @@ ${message}`
6287
6070
  };
6288
6071
  }
6289
6072
  if (docgenEngine === "react-docgen") {
6290
- let reactDocgenEngine = await loadReactDocgen(), reactDocgen = reactDocgenEngine ? reactDocgenEngine.getReactDocgen(path2, componentWithPackage) : { type: "error", error: getDocgenPackageMissingError("react-docgen") };
6073
+ let reactDocgenEngine = await loadReactDocgen(), reactDocgen = reactDocgenEngine ? reactDocgenEngine.getReactDocgen(docgenPath, docgenRef) : { type: "error", error: getDocgenPackageMissingError("react-docgen") };
6291
6074
  return {
6292
6075
  ...componentWithPackage,
6293
6076
  path: path2,
@@ -6313,6 +6096,21 @@ function findExactComponentMatch(components, componentName) {
6313
6096
  }
6314
6097
 
6315
6098
  // src/componentManifest/resolveComponents.ts
6099
+ var resolveMetaComponent = createMetaComponentResolver({
6100
+ reader: {
6101
+ resolver: createModuleResolver({
6102
+ extensions: [...supportedExtensions],
6103
+ extensionAlias: {
6104
+ ".js": [".js", ".ts", ".tsx"],
6105
+ ".jsx": [".jsx", ".tsx"],
6106
+ ".mjs": [".mjs", ".mts"],
6107
+ ".cjs": [".cjs", ".cts"]
6108
+ },
6109
+ mainFields: ["module", "main"],
6110
+ tsconfig: "auto"
6111
+ })
6112
+ }
6113
+ });
6316
6114
  function findMatchingComponent(components, componentName, title) {
6317
6115
  let exactMatch = findExactComponentMatch(components, componentName);
6318
6116
  if (exactMatch)
@@ -6331,17 +6129,30 @@ function findMatchingComponent(components, componentName, title) {
6331
6129
  return best;
6332
6130
  }
6333
6131
  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), allComponents = await getComponents({
6335
- additionalComponentNames: declaredSubcomponents.map(
6336
- (subcomponent) => subcomponent.componentName
6337
- ),
6132
+ 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) => {
6133
+ let resolved = resolveMetaComponent(csf, storyPath, node);
6134
+ if ("reason" in resolved)
6135
+ return resolved.reason === "missing-export" && docgenTargets.set(name, {
6136
+ missing: `"${resolved.importId}" has no export "${resolved.exportName}", which ${resolved.expression} reads.`
6137
+ }), name;
6138
+ let { localName, importId, importer, path: path2, exportName } = resolved.component, ownName = importer === storyPath && storyImports.get(localName)?.importId === importId && !storyImports.has(name.split(".")[0]) ? localName : name;
6139
+ return importId && path2 && docgenTargets.set(ownName, { path: path2, exportName }), ownName;
6140
+ }, metaComponentName = componentName && resolveName(componentName), declared = declaredSubcomponents.map((subcomponent) => ({
6141
+ name: subcomponent.name,
6142
+ componentName: resolveName(subcomponent.componentName, subcomponent.node)
6143
+ })), allComponents = await getComponents({
6144
+ additionalComponentNames: [
6145
+ ...metaComponentName ? [metaComponentName] : [],
6146
+ ...declared.map((subcomponent) => subcomponent.componentName)
6147
+ ],
6338
6148
  csf,
6339
6149
  storyFilePath: storyPath,
6340
6150
  typescriptOptions,
6341
- docgenEngine
6342
- }), component = findMatchingComponent(allComponents, componentName, title), subcomponents = declaredSubcomponents.map((declared) => ({
6343
- name: declared.name,
6344
- component: findExactComponentMatch(allComponents, declared.componentName)
6151
+ docgenEngine,
6152
+ docgenTargets: docgenEngine === "react-component-meta" ? void 0 : docgenTargets
6153
+ }), component = findMatchingComponent(allComponents, metaComponentName, title), subcomponents = declared.map((subcomponent) => ({
6154
+ name: subcomponent.name,
6155
+ component: findExactComponentMatch(allComponents, subcomponent.componentName)
6345
6156
  }));
6346
6157
  return { storyPath, storyFile, csf, componentName, allComponents, component, subcomponents };
6347
6158
  }
@@ -6400,7 +6211,7 @@ function hasRootEntry(pkg) {
6400
6211
  }
6401
6212
  function getImportablePackageName(componentPath, fallbackPath) {
6402
6213
  let nearestPkg = cachedFindUp("package.json", {
6403
- cwd: posix2.dirname(componentPath ?? fallbackPath)
6214
+ cwd: posix.dirname(componentPath ?? fallbackPath)
6404
6215
  });
6405
6216
  try {
6406
6217
  if (!nearestPkg)
@@ -6419,7 +6230,7 @@ function getFallbackImport(packageName, componentName) {
6419
6230
  `) : "";
6420
6231
  }
6421
6232
  function relativizeComponentMetaPaths(doc) {
6422
- let relativize = (fileName) => posix2.relative(process.cwd(), fileName), relativizeProp = (prop) => ({
6233
+ let relativize = (fileName) => posix.relative(process.cwd(), fileName), relativizeProp = (prop) => ({
6423
6234
  ...prop,
6424
6235
  parent: prop.parent ? { ...prop.parent, fileName: relativize(prop.parent.fileName) } : prop.parent,
6425
6236
  declarations: prop.declarations?.map((declaration) => ({
@@ -6631,7 +6442,7 @@ function buildReactComponentDocgenFromResolved({
6631
6442
  export {
6632
6443
  join2 as join,
6633
6444
  isAbsolute2 as isAbsolute,
6634
- posix2 as posix,
6445
+ posix,
6635
6446
  getCodeSnippet,
6636
6447
  invalidateParser,
6637
6448
  resolveStoryFileComponents,