@storybook/react 11.0.0-rc.1 → 11.0.0-rc.3
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-XQNZ5YRO.js → chunk-GBFPEOJZ.js} +1 -36
- package/dist/_browser-chunks/chunk-KI7YBTX7.js +42 -0
- package/dist/_browser-chunks/{chunk-RHGZ5MD3.js → chunk-LI5LRSL3.js} +1 -1
- package/dist/_node-chunks/{chunk-LZBEMUVF.js → chunk-4UV6B7T7.js} +4 -2
- package/dist/_node-chunks/{chunk-CJ2XYAXX.js → chunk-M3SEC5XW.js} +321 -27
- package/dist/_node-chunks/chunk-PQZIOGBY.js +1 -1
- package/dist/_node-chunks/{chunk-N7TOZR54.js → chunk-RIMY5QBX.js} +10 -6
- package/dist/_node-chunks/{chunk-ITCF7APG.js → chunk-RNO52GGS.js} +1 -1
- package/dist/_node-chunks/{chunk-2I5WCK5H.js → chunk-XMHC3CJ5.js} +64 -334
- package/dist/_node-chunks/{extractArgTypesFromComponentFile-BBV3XDO4.js → extractArgTypesFromComponentFile-UJJRVMGW.js} +4 -4
- package/dist/_node-chunks/{extractReactDocgenInfo-L44YP4OM.js → extractReactDocgenInfo-Z5DJORGO.js} +2 -2
- package/dist/_node-chunks/{reactDocgen-WMOVFLAX.js → reactDocgen-CS462JSF.js} +2 -2
- package/dist/docgen/docgen-worker.js +8 -4
- package/dist/docs/register-print-hole.js +2 -0
- package/dist/entry-preview-docs.js +2 -1
- package/dist/index.js +3 -2
- package/dist/preset.js +27 -22
- package/dist/preview.js +3 -2
- package/package.json +4 -3
- package/template/cli/js/Button.jsx +0 -2
- package/template/cli/js/Header.jsx +0 -2
- package/template/cli/ts/Button.tsx +0 -2
- package/template/cli/ts/Header.tsx +0 -2
|
@@ -11,8 +11,10 @@ import {
|
|
|
11
11
|
getImportTag,
|
|
12
12
|
groupByToMap,
|
|
13
13
|
invariant,
|
|
14
|
-
matchPath
|
|
15
|
-
|
|
14
|
+
matchPath,
|
|
15
|
+
posix,
|
|
16
|
+
relative
|
|
17
|
+
} from "./chunk-M3SEC5XW.js";
|
|
16
18
|
import {
|
|
17
19
|
__commonJS,
|
|
18
20
|
__toESM
|
|
@@ -1563,7 +1565,7 @@ var require_proxyLanguageService = __commonJS({
|
|
|
1563
1565
|
};
|
|
1564
1566
|
}
|
|
1565
1567
|
function getEncodedSemanticClassifications(language, getEncodedSemanticClassifications2) {
|
|
1566
|
-
return (filePath, span,
|
|
1568
|
+
return (filePath, span, format) => {
|
|
1567
1569
|
let fileName = filePath.replace(windowsPathReg, "/"), [serviceScript, targetScript, sourceScript] = (0, utils_1.getServiceScript)(language, fileName);
|
|
1568
1570
|
if (targetScript?.associatedOnly)
|
|
1569
1571
|
return {
|
|
@@ -1577,7 +1579,7 @@ var require_proxyLanguageService = __commonJS({
|
|
|
1577
1579
|
spans: [],
|
|
1578
1580
|
endOfLineState: 0
|
|
1579
1581
|
};
|
|
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 },
|
|
1582
|
+
let mappingOffset = (0, transform_1.getMappingOffset)(language, serviceScript), start = mapped.start + mappingOffset, end = mapped.end + mappingOffset, result = getEncodedSemanticClassifications2(targetScript.id, { start, length: end - start }, format), spans = [];
|
|
1581
1583
|
for (let i = 0; i < result.spans.length; i += 3)
|
|
1582
1584
|
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)) {
|
|
1583
1585
|
spans.push(sourceStart, sourceEnd - sourceStart, result.spans[i + 2]);
|
|
@@ -1585,7 +1587,7 @@ var require_proxyLanguageService = __commonJS({
|
|
|
1585
1587
|
}
|
|
1586
1588
|
return result.spans = spans, result;
|
|
1587
1589
|
} else
|
|
1588
|
-
return getEncodedSemanticClassifications2(fileName, span,
|
|
1590
|
+
return getEncodedSemanticClassifications2(fileName, span, format);
|
|
1589
1591
|
};
|
|
1590
1592
|
}
|
|
1591
1593
|
function getSyntacticDiagnostics(language, languageService, getSyntacticDiagnostics2) {
|
|
@@ -1833,23 +1835,23 @@ var require_path_browserify = __commonJS({
|
|
|
1833
1835
|
}
|
|
1834
1836
|
return res;
|
|
1835
1837
|
}
|
|
1836
|
-
function _format(
|
|
1838
|
+
function _format(sep, pathObject) {
|
|
1837
1839
|
var dir = pathObject.dir || pathObject.root, base = pathObject.base || (pathObject.name || "") + (pathObject.ext || "");
|
|
1838
|
-
return dir ? dir === pathObject.root ? dir + base : dir +
|
|
1840
|
+
return dir ? dir === pathObject.root ? dir + base : dir + sep + base : base;
|
|
1839
1841
|
}
|
|
1840
1842
|
var posix2 = {
|
|
1841
1843
|
// path.resolve([from ...], to)
|
|
1842
1844
|
resolve: function() {
|
|
1843
|
-
for (var resolvedPath = "", resolvedAbsolute = !1,
|
|
1845
|
+
for (var resolvedPath = "", resolvedAbsolute = !1, cwd, i = arguments.length - 1; i >= -1 && !resolvedAbsolute; i--) {
|
|
1844
1846
|
var path2;
|
|
1845
|
-
i >= 0 ? path2 = arguments[i] : (
|
|
1847
|
+
i >= 0 ? path2 = arguments[i] : (cwd === void 0 && (cwd = process.cwd()), path2 = cwd), assertPath(path2), path2.length !== 0 && (resolvedPath = path2 + "/" + resolvedPath, resolvedAbsolute = path2.charCodeAt(0) === 47);
|
|
1846
1848
|
}
|
|
1847
1849
|
return resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute), resolvedAbsolute ? resolvedPath.length > 0 ? "/" + resolvedPath : "/" : resolvedPath.length > 0 ? resolvedPath : ".";
|
|
1848
1850
|
},
|
|
1849
1851
|
normalize: function(path2) {
|
|
1850
1852
|
if (assertPath(path2), path2.length === 0) return ".";
|
|
1851
|
-
var
|
|
1852
|
-
return path2 = normalizeStringPosix(path2, !
|
|
1853
|
+
var isAbsolute2 = path2.charCodeAt(0) === 47, trailingSeparator = path2.charCodeAt(path2.length - 1) === 47;
|
|
1854
|
+
return path2 = normalizeStringPosix(path2, !isAbsolute2), path2.length === 0 && !isAbsolute2 && (path2 = "."), path2.length > 0 && trailingSeparator && (path2 += "/"), isAbsolute2 ? "/" + path2 : path2;
|
|
1853
1855
|
},
|
|
1854
1856
|
isAbsolute: function(path2) {
|
|
1855
1857
|
return assertPath(path2), path2.length > 0 && path2.charCodeAt(0) === 47;
|
|
@@ -1959,8 +1961,8 @@ var require_path_browserify = __commonJS({
|
|
|
1959
1961
|
assertPath(path2);
|
|
1960
1962
|
var ret = { root: "", dir: "", base: "", ext: "", name: "" };
|
|
1961
1963
|
if (path2.length === 0) return ret;
|
|
1962
|
-
var code = path2.charCodeAt(0),
|
|
1963
|
-
|
|
1964
|
+
var code = path2.charCodeAt(0), isAbsolute2 = code === 47, start;
|
|
1965
|
+
isAbsolute2 ? (ret.root = "/", start = 1) : start = 0;
|
|
1964
1966
|
for (var startDot = -1, startPart = 0, end = -1, matchedSlash = !0, i = path2.length - 1, preDotState = 0; i >= start; --i) {
|
|
1965
1967
|
if (code = path2.charCodeAt(i), code === 47) {
|
|
1966
1968
|
if (!matchedSlash) {
|
|
@@ -1973,7 +1975,7 @@ var require_path_browserify = __commonJS({
|
|
|
1973
1975
|
}
|
|
1974
1976
|
return startDot === -1 || end === -1 || // We saw a non-dot character immediately before the dot
|
|
1975
1977
|
preDotState === 0 || // The (right-most) trimmed path component is exactly '..'
|
|
1976
|
-
preDotState === 1 && startDot === end - 1 && startDot === startPart + 1 ? end !== -1 && (startPart === 0 &&
|
|
1978
|
+
preDotState === 1 && startDot === end - 1 && startDot === startPart + 1 ? end !== -1 && (startPart === 0 && isAbsolute2 ? ret.base = ret.name = path2.slice(1, end) : ret.base = ret.name = path2.slice(startPart, end)) : (startPart === 0 && isAbsolute2 ? (ret.name = path2.slice(1, startDot), ret.base = path2.slice(1, end)) : (ret.name = path2.slice(startPart, startDot), ret.base = path2.slice(startPart, end)), ret.ext = path2.slice(startDot, end)), startPart > 0 ? ret.dir = path2.slice(0, startPart - 1) : isAbsolute2 && (ret.dir = "/"), ret;
|
|
1977
1979
|
},
|
|
1978
1980
|
sep: "/",
|
|
1979
1981
|
delimiter: ":",
|
|
@@ -5083,9 +5085,16 @@ var ComponentMetaProject = class extends ProgramBackedProject {
|
|
|
5083
5085
|
(s) => s,
|
|
5084
5086
|
// asScriptId - identity for React (no URI mapping needed)
|
|
5085
5087
|
projectHost
|
|
5086
|
-
);
|
|
5088
|
+
), getHostScriptVersion = languageServiceHost.getScriptVersion;
|
|
5087
5089
|
this.service = typescript.createLanguageService(
|
|
5088
|
-
Object.assign(languageServiceHost, {
|
|
5090
|
+
Object.assign(languageServiceHost, {
|
|
5091
|
+
// Like tsserver, read a referenced project's sources instead of its .d.ts output, so its
|
|
5092
|
+
// components stay in the program. The flag is internal on LanguageServiceHost's typings.
|
|
5093
|
+
useSourceOfProjectReferenceRedirect: () => !0,
|
|
5094
|
+
// The registry hands a file parsed by one project to another project that asks for the same
|
|
5095
|
+
// version. The host counts versions from 0 for each project, so the mtime tells them apart.
|
|
5096
|
+
getScriptVersion: (fileName) => `${getHostScriptVersion(fileName)}:${this.files.getScriptVersion(fileName)}`
|
|
5097
|
+
}),
|
|
5089
5098
|
this.documentRegistry
|
|
5090
5099
|
);
|
|
5091
5100
|
}
|
|
@@ -5219,6 +5228,7 @@ function createCompilerApiBackend(typescript, fsFileSnapshots) {
|
|
|
5219
5228
|
void 0,
|
|
5220
5229
|
documentRegistry
|
|
5221
5230
|
),
|
|
5231
|
+
sharesParsedFiles: !0,
|
|
5222
5232
|
dispose: () => fsFileSnapshots.clear()
|
|
5223
5233
|
} };
|
|
5224
5234
|
}
|
|
@@ -5227,8 +5237,13 @@ var ComponentMetaManager = class extends BaseComponentMetaManager {
|
|
|
5227
5237
|
* `recycleHeapPressureRatio` is the fraction of the V8 heap limit at which the shared program(s)
|
|
5228
5238
|
* are recycled; the memory regression gate passes `Infinity` to disable recycling and assert the
|
|
5229
5239
|
* OOM still happens without the fix.
|
|
5240
|
+
*
|
|
5241
|
+
* `keepParsedFilesOnRecycle` is for a manager that serves one request after another, like the
|
|
5242
|
+
* docgen worker. A recycle then keeps the parsed files of the projects the batch used, so the next
|
|
5243
|
+
* request does not parse them again. Without it a recycle frees them, which suits a caller that
|
|
5244
|
+
* extracts everything in one batch and needs the heap for other work afterwards.
|
|
5230
5245
|
*/
|
|
5231
|
-
constructor(typescript, recycleHeapPressureRatio) {
|
|
5246
|
+
constructor(typescript, recycleHeapPressureRatio, { keepParsedFilesOnRecycle = !1 } = {}) {
|
|
5232
5247
|
let fsFileSnapshots = /* @__PURE__ */ new Map(), { fileSystem, factory } = createComponentMetaBackend(typescript, {
|
|
5233
5248
|
compiler: (compilerApi) => createCompilerApiBackend(compilerApi, fsFileSnapshots),
|
|
5234
5249
|
native: (modules) => createNativeBackend(modules, NativeComponentMetaProject, {
|
|
@@ -5239,7 +5254,7 @@ var ComponentMetaManager = class extends BaseComponentMetaManager {
|
|
|
5239
5254
|
jsx: modules.sync.JsxEmit.ReactJSX
|
|
5240
5255
|
})
|
|
5241
5256
|
});
|
|
5242
|
-
super(fileSystem, factory, recycleHeapPressureRatio), this.fsFileSnapshots = fsFileSnapshots;
|
|
5257
|
+
super(fileSystem, factory, recycleHeapPressureRatio), this.fsFileSnapshots = fsFileSnapshots, this.keepParsedFilesOnRecycle = keepParsedFilesOnRecycle;
|
|
5243
5258
|
}
|
|
5244
5259
|
/**
|
|
5245
5260
|
* Batch-extract component props across all entries, grouping by tsconfig project so each project
|
|
@@ -5258,7 +5273,7 @@ var ComponentMetaManager = class extends BaseComponentMetaManager {
|
|
|
5258
5273
|
logger3.debug(`[reactComponentMeta] Batch extraction failed: ${err}`);
|
|
5259
5274
|
}
|
|
5260
5275
|
}
|
|
5261
|
-
this.recycleProjectsIfHeapPressured() && batchFiles?.clear();
|
|
5276
|
+
this.recycleProjectsIfHeapPressured(this.keepParsedFilesOnRecycle ? byProject.keys() : []) && batchFiles?.clear();
|
|
5262
5277
|
}
|
|
5263
5278
|
addBatchFiles(project, batchFiles) {
|
|
5264
5279
|
let files = batchFiles?.get(project) ?? [];
|
|
@@ -5271,296 +5286,6 @@ var ComponentMetaManager = class extends BaseComponentMetaManager {
|
|
|
5271
5286
|
}
|
|
5272
5287
|
}, isExtractable = (storyRef) => !!storyRef.component?.path && !!storyRef.component.importName;
|
|
5273
5288
|
|
|
5274
|
-
// ../../../node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
|
|
5275
|
-
var _lazyMatch = () => {
|
|
5276
|
-
var __lib__ = (() => {
|
|
5277
|
-
var m = Object.defineProperty, V = Object.getOwnPropertyDescriptor, G = Object.getOwnPropertyNames, T = Object.prototype.hasOwnProperty, q = (r, e) => {
|
|
5278
|
-
for (var n in e) m(r, n, { get: e[n], enumerable: !0 });
|
|
5279
|
-
}, H = (r, e, n, a) => {
|
|
5280
|
-
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 });
|
|
5281
|
-
return r;
|
|
5282
|
-
}, J = (r) => H(m({}, "__esModule", { value: !0 }), r), w = {};
|
|
5283
|
-
q(w, { default: () => re });
|
|
5284
|
-
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) => {
|
|
5285
|
-
let e = /* @__PURE__ */ new Map();
|
|
5286
|
-
return (n) => {
|
|
5287
|
-
let a = e.get(n);
|
|
5288
|
-
if (a) return a;
|
|
5289
|
-
let t = r(n);
|
|
5290
|
-
return e.set(n, t), t;
|
|
5291
|
-
};
|
|
5292
|
-
}, rr = (r, e, n = {}) => {
|
|
5293
|
-
let a = { cache: {}, input: r, index: 0, indexMax: 0, options: n, output: [] };
|
|
5294
|
-
if (v(e)(a) && a.index === r.length) return a.output;
|
|
5295
|
-
throw new Error(`Failed to parse at index ${a.indexMax}`);
|
|
5296
|
-
}, i = (r, e) => A(r) ? er(r, e) : b(r) ? ar(r, e) : nr(r, e), er = (r, e) => {
|
|
5297
|
-
let n = {};
|
|
5298
|
-
for (let a of r) {
|
|
5299
|
-
if (a.length !== 1) throw new Error(`Invalid character: "${a}"`);
|
|
5300
|
-
let t = a.charCodeAt(0);
|
|
5301
|
-
n[t] = !0;
|
|
5302
|
-
}
|
|
5303
|
-
return (a) => {
|
|
5304
|
-
let t = a.index, o = a.input;
|
|
5305
|
-
for (; a.index < o.length && o.charCodeAt(a.index) in n; ) a.index += 1;
|
|
5306
|
-
let u = a.index;
|
|
5307
|
-
if (u > t) {
|
|
5308
|
-
if (!h(e) && !a.options.silent) {
|
|
5309
|
-
let s = a.input.slice(t, u), c = d(e) ? e(s, o, String(t)) : e;
|
|
5310
|
-
h(c) || a.output.push(c);
|
|
5311
|
-
}
|
|
5312
|
-
a.indexMax = Math.max(a.indexMax, a.index);
|
|
5313
|
-
}
|
|
5314
|
-
return !0;
|
|
5315
|
-
};
|
|
5316
|
-
}, nr = (r, e) => {
|
|
5317
|
-
let n = r.source, a = r.flags.replace(/y|$/, "y"), t = new RegExp(n, a);
|
|
5318
|
-
return g((o) => {
|
|
5319
|
-
t.lastIndex = o.index;
|
|
5320
|
-
let u = t.exec(o.input);
|
|
5321
|
-
if (u) {
|
|
5322
|
-
if (!h(e) && !o.options.silent) {
|
|
5323
|
-
let s = d(e) ? e(...u, o.input, String(o.index)) : e;
|
|
5324
|
-
h(s) || o.output.push(s);
|
|
5325
|
-
}
|
|
5326
|
-
return o.index += u[0].length, o.indexMax = Math.max(o.indexMax, o.index), !0;
|
|
5327
|
-
} else return !1;
|
|
5328
|
-
});
|
|
5329
|
-
}, ar = (r, e) => (n) => {
|
|
5330
|
-
if (n.input.startsWith(r, n.index)) {
|
|
5331
|
-
if (!h(e) && !n.options.silent) {
|
|
5332
|
-
let t = d(e) ? e(r, n.input, String(n.index)) : e;
|
|
5333
|
-
h(t) || n.output.push(t);
|
|
5334
|
-
}
|
|
5335
|
-
return n.index += r.length, n.indexMax = Math.max(n.indexMax, n.index), !0;
|
|
5336
|
-
} else return !1;
|
|
5337
|
-
}, C = (r, e, n, a) => {
|
|
5338
|
-
let t = v(r);
|
|
5339
|
-
return g(_(M((o) => {
|
|
5340
|
-
let u = 0;
|
|
5341
|
-
for (; u < n; ) {
|
|
5342
|
-
let s = o.index;
|
|
5343
|
-
if (!t(o) || (u += 1, o.index === s)) break;
|
|
5344
|
-
}
|
|
5345
|
-
return u >= e;
|
|
5346
|
-
})));
|
|
5347
|
-
}, tr = (r, e) => C(r, 0, 1), f = (r, e) => C(r, 0, 1 / 0), x = (r, e) => {
|
|
5348
|
-
let n = r.map(v);
|
|
5349
|
-
return g(_(M((a) => {
|
|
5350
|
-
for (let t = 0, o = n.length; t < o; t++) if (!n[t](a)) return !1;
|
|
5351
|
-
return !0;
|
|
5352
|
-
})));
|
|
5353
|
-
}, l = (r, e) => {
|
|
5354
|
-
let n = r.map(v);
|
|
5355
|
-
return g(_((a) => {
|
|
5356
|
-
for (let t = 0, o = n.length; t < o; t++) if (n[t](a)) return !0;
|
|
5357
|
-
return !1;
|
|
5358
|
-
}));
|
|
5359
|
-
}, M = (r, e = !1) => {
|
|
5360
|
-
let n = v(r);
|
|
5361
|
-
return (a) => {
|
|
5362
|
-
let t = a.index, o = a.output.length, u = n(a);
|
|
5363
|
-
return (!u || e) && (a.index = t, a.output.length !== o && (a.output.length = o)), u;
|
|
5364
|
-
};
|
|
5365
|
-
}, _ = (r, e) => v(r), g = /* @__PURE__ */ (() => {
|
|
5366
|
-
let r = 0;
|
|
5367
|
-
return (e) => {
|
|
5368
|
-
let n = v(e), a = r += 1;
|
|
5369
|
-
return (t) => {
|
|
5370
|
-
var o;
|
|
5371
|
-
if (t.options.memoization === !1) return n(t);
|
|
5372
|
-
let u = t.index, s = (o = t.cache)[a] || (o[a] = /* @__PURE__ */ new Map()), c = s.get(u);
|
|
5373
|
-
if (c === !1) return !1;
|
|
5374
|
-
if (W(c)) return t.index = c, !0;
|
|
5375
|
-
if (c) return t.index = c.index, c.output?.length && t.output.push(...c.output), !0;
|
|
5376
|
-
{
|
|
5377
|
-
let Z = t.output.length;
|
|
5378
|
-
if (n(t)) {
|
|
5379
|
-
let D = t.index, U = t.output.length;
|
|
5380
|
-
if (U > Z) {
|
|
5381
|
-
let ee = t.output.slice(Z, U);
|
|
5382
|
-
s.set(u, { index: D, output: ee });
|
|
5383
|
-
} else s.set(u, D);
|
|
5384
|
-
return !0;
|
|
5385
|
-
} else return s.set(u, !1), !1;
|
|
5386
|
-
}
|
|
5387
|
-
};
|
|
5388
|
-
};
|
|
5389
|
-
})(), E = (r) => {
|
|
5390
|
-
let e;
|
|
5391
|
-
return (n) => (e || (e = v(r())), e(n));
|
|
5392
|
-
}, v = Y((r) => {
|
|
5393
|
-
if (d(r)) return Q(r) ? E(r) : r;
|
|
5394
|
-
if (b(r) || X(r)) return i(r);
|
|
5395
|
-
if (A(r)) return x(r);
|
|
5396
|
-
if (K(r)) return l(Object.values(r));
|
|
5397
|
-
throw new Error("Invalid rule");
|
|
5398
|
-
}), P = "abcdefghijklmnopqrstuvwxyz", ir = (r) => {
|
|
5399
|
-
let e = "";
|
|
5400
|
-
for (; r > 0; ) {
|
|
5401
|
-
let n = (r - 1) % 26;
|
|
5402
|
-
e = P[n] + e, r = Math.floor((r - 1) / 26);
|
|
5403
|
-
}
|
|
5404
|
-
return e;
|
|
5405
|
-
}, O = (r) => {
|
|
5406
|
-
let e = 0;
|
|
5407
|
-
for (let n = 0, a = r.length; n < a; n++) e = e * 26 + P.indexOf(r[n]) + 1;
|
|
5408
|
-
return e;
|
|
5409
|
-
}, S = (r, e) => {
|
|
5410
|
-
if (e < r) return S(e, r);
|
|
5411
|
-
let n = [];
|
|
5412
|
-
for (; r <= e; ) n.push(r++);
|
|
5413
|
-
return n;
|
|
5414
|
-
}, 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) => {
|
|
5415
|
-
let e = {};
|
|
5416
|
-
return (n) => e[n] ?? (e[n] = r(n));
|
|
5417
|
-
}, 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) => {
|
|
5418
|
-
let n = Array.isArray(r) ? r : [r];
|
|
5419
|
-
if (!n.length) return !1;
|
|
5420
|
-
let a = n.map($.compile), t = n.every((s) => /(\/(?:\*\*)?|\[\/\])$/.test(s)), o = e.replace(/[\\\/]+/g, "/").replace(/\/$/, t ? "/" : "");
|
|
5421
|
-
return a.some((s) => s.test(o));
|
|
5422
|
-
};
|
|
5423
|
-
$.compile = (r) => new RegExp(`^${L(Yr(r))}$`, "s");
|
|
5424
|
-
var re = $;
|
|
5425
|
-
return J(w);
|
|
5426
|
-
})();
|
|
5427
|
-
return __lib__.default || __lib__;
|
|
5428
|
-
}, _match, zeptomatch = (path2, pattern) => (_match || (_match = _lazyMatch(), _lazyMatch = null), _match(path2, pattern)), _DRIVE_LETTER_START_RE2 = /^[A-Za-z]:\//;
|
|
5429
|
-
function normalizeWindowsPath2(input = "") {
|
|
5430
|
-
return input && input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE2, (r) => r.toUpperCase());
|
|
5431
|
-
}
|
|
5432
|
-
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) {
|
|
5433
|
-
if (path2.length === 0)
|
|
5434
|
-
return ".";
|
|
5435
|
-
path2 = normalizeWindowsPath2(path2);
|
|
5436
|
-
let isUNCPath = path2.match(_UNC_REGEX2), isPathAbsolute = isAbsolute2(path2), trailingSeparator = path2[path2.length - 1] === "/";
|
|
5437
|
-
return path2 = normalizeString2(path2, !isPathAbsolute), path2.length === 0 ? isPathAbsolute ? "/" : trailingSeparator ? "./" : "." : (trailingSeparator && (path2 += "/"), _DRIVE_LETTER_RE2.test(path2) && (path2 += "/"), isUNCPath ? isPathAbsolute ? `//${path2}` : `//./${path2}` : isPathAbsolute && !isAbsolute2(path2) ? `/${path2}` : path2);
|
|
5438
|
-
}, join2 = function(...segments) {
|
|
5439
|
-
let path2 = "";
|
|
5440
|
-
for (let seg of segments)
|
|
5441
|
-
if (seg)
|
|
5442
|
-
if (path2.length > 0) {
|
|
5443
|
-
let pathTrailing = path2[path2.length - 1] === "/", segLeading = seg[0] === "/";
|
|
5444
|
-
pathTrailing && segLeading ? path2 += seg.slice(1) : path2 += pathTrailing || segLeading ? seg : `/${seg}`;
|
|
5445
|
-
} else
|
|
5446
|
-
path2 += seg;
|
|
5447
|
-
return normalize2(path2);
|
|
5448
|
-
};
|
|
5449
|
-
function cwd() {
|
|
5450
|
-
return typeof process < "u" && typeof process.cwd == "function" ? process.cwd().replace(/\\/g, "/") : "/";
|
|
5451
|
-
}
|
|
5452
|
-
var resolve = function(...arguments_) {
|
|
5453
|
-
arguments_ = arguments_.map((argument) => normalizeWindowsPath2(argument));
|
|
5454
|
-
let resolvedPath = "", resolvedAbsolute = !1;
|
|
5455
|
-
for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
|
|
5456
|
-
let path2 = index >= 0 ? arguments_[index] : cwd();
|
|
5457
|
-
!path2 || path2.length === 0 || (resolvedPath = `${path2}/${resolvedPath}`, resolvedAbsolute = isAbsolute2(path2));
|
|
5458
|
-
}
|
|
5459
|
-
return resolvedPath = normalizeString2(resolvedPath, !resolvedAbsolute), resolvedAbsolute && !isAbsolute2(resolvedPath) ? `/${resolvedPath}` : resolvedPath.length > 0 ? resolvedPath : ".";
|
|
5460
|
-
};
|
|
5461
|
-
function normalizeString2(path2, allowAboveRoot) {
|
|
5462
|
-
let res = "", lastSegmentLength = 0, lastSlash = -1, dots = 0, char = null;
|
|
5463
|
-
for (let index = 0; index <= path2.length; ++index) {
|
|
5464
|
-
if (index < path2.length)
|
|
5465
|
-
char = path2[index];
|
|
5466
|
-
else {
|
|
5467
|
-
if (char === "/")
|
|
5468
|
-
break;
|
|
5469
|
-
char = "/";
|
|
5470
|
-
}
|
|
5471
|
-
if (char === "/") {
|
|
5472
|
-
if (!(lastSlash === index - 1 || dots === 1)) if (dots === 2) {
|
|
5473
|
-
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
|
5474
|
-
if (res.length > 2) {
|
|
5475
|
-
let lastSlashIndex = res.lastIndexOf("/");
|
|
5476
|
-
lastSlashIndex === -1 ? (res = "", lastSegmentLength = 0) : (res = res.slice(0, lastSlashIndex), lastSegmentLength = res.length - 1 - res.lastIndexOf("/")), lastSlash = index, dots = 0;
|
|
5477
|
-
continue;
|
|
5478
|
-
} else if (res.length > 0) {
|
|
5479
|
-
res = "", lastSegmentLength = 0, lastSlash = index, dots = 0;
|
|
5480
|
-
continue;
|
|
5481
|
-
}
|
|
5482
|
-
}
|
|
5483
|
-
allowAboveRoot && (res += res.length > 0 ? "/.." : "..", lastSegmentLength = 2);
|
|
5484
|
-
} else
|
|
5485
|
-
res.length > 0 ? res += `/${path2.slice(lastSlash + 1, index)}` : res = path2.slice(lastSlash + 1, index), lastSegmentLength = index - lastSlash - 1;
|
|
5486
|
-
lastSlash = index, dots = 0;
|
|
5487
|
-
} else char === "." && dots !== -1 ? ++dots : dots = -1;
|
|
5488
|
-
}
|
|
5489
|
-
return res;
|
|
5490
|
-
}
|
|
5491
|
-
var isAbsolute2 = function(p) {
|
|
5492
|
-
return _IS_ABSOLUTE_RE2.test(p);
|
|
5493
|
-
}, toNamespacedPath = function(p) {
|
|
5494
|
-
return normalizeWindowsPath2(p);
|
|
5495
|
-
}, extname = function(p) {
|
|
5496
|
-
if (p === "..") return "";
|
|
5497
|
-
let match = _EXTNAME_RE.exec(normalizeWindowsPath2(p));
|
|
5498
|
-
return match && match[1] || "";
|
|
5499
|
-
}, relative = function(from, to) {
|
|
5500
|
-
let _from = resolve(from).replace(_ROOT_FOLDER_RE, "$1").split("/"), _to = resolve(to).replace(_ROOT_FOLDER_RE, "$1").split("/");
|
|
5501
|
-
if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0])
|
|
5502
|
-
return _to.join("/");
|
|
5503
|
-
let _fromCopy = [..._from];
|
|
5504
|
-
for (let segment of _fromCopy) {
|
|
5505
|
-
if (_to[0] !== segment)
|
|
5506
|
-
break;
|
|
5507
|
-
_from.shift(), _to.shift();
|
|
5508
|
-
}
|
|
5509
|
-
return [..._from.map(() => ".."), ..._to].join("/");
|
|
5510
|
-
}, dirname3 = function(p) {
|
|
5511
|
-
let segments = normalizeWindowsPath2(p).replace(/\/$/, "").split("/").slice(0, -1);
|
|
5512
|
-
return segments.length === 1 && _DRIVE_LETTER_RE2.test(segments[0]) && (segments[0] += "/"), segments.join("/") || (isAbsolute2(p) ? "/" : ".");
|
|
5513
|
-
}, format = function(p) {
|
|
5514
|
-
let ext = p.ext ? p.ext.startsWith(".") ? p.ext : `.${p.ext}` : "", segments = [p.root, p.dir, p.base ?? (p.name ?? "") + ext].filter(
|
|
5515
|
-
Boolean
|
|
5516
|
-
);
|
|
5517
|
-
return normalizeWindowsPath2(
|
|
5518
|
-
p.root ? resolve(...segments) : segments.join("/")
|
|
5519
|
-
);
|
|
5520
|
-
}, basename = function(p, extension) {
|
|
5521
|
-
let segments = normalizeWindowsPath2(p).split("/"), lastSegment = "";
|
|
5522
|
-
for (let i = segments.length - 1; i >= 0; i--) {
|
|
5523
|
-
let val = segments[i];
|
|
5524
|
-
if (val) {
|
|
5525
|
-
lastSegment = val;
|
|
5526
|
-
break;
|
|
5527
|
-
}
|
|
5528
|
-
}
|
|
5529
|
-
return extension && lastSegment.endsWith(extension) ? lastSegment.slice(0, -extension.length) : lastSegment;
|
|
5530
|
-
}, parse = function(p) {
|
|
5531
|
-
let root = _PATH_ROOT_RE.exec(p)?.[0]?.replace(/\\/g, "/") || "", base = basename(p), extension = extname(base);
|
|
5532
|
-
return {
|
|
5533
|
-
root,
|
|
5534
|
-
dir: dirname3(p),
|
|
5535
|
-
base,
|
|
5536
|
-
ext: extension,
|
|
5537
|
-
name: base.slice(0, base.length - extension.length)
|
|
5538
|
-
};
|
|
5539
|
-
}, matchesGlob = (path2, pattern) => zeptomatch(pattern, normalize2(path2)), _path = {
|
|
5540
|
-
__proto__: null,
|
|
5541
|
-
basename,
|
|
5542
|
-
dirname: dirname3,
|
|
5543
|
-
extname,
|
|
5544
|
-
format,
|
|
5545
|
-
isAbsolute: isAbsolute2,
|
|
5546
|
-
join: join2,
|
|
5547
|
-
matchesGlob,
|
|
5548
|
-
normalize: normalize2,
|
|
5549
|
-
normalizeString: normalizeString2,
|
|
5550
|
-
parse,
|
|
5551
|
-
relative,
|
|
5552
|
-
resolve,
|
|
5553
|
-
sep,
|
|
5554
|
-
toNamespacedPath
|
|
5555
|
-
};
|
|
5556
|
-
|
|
5557
|
-
// ../../../node_modules/pathe/dist/index.mjs
|
|
5558
|
-
var delimiter = globalThis.process?.platform === "win32" ? ";" : ":", _platforms = { posix: void 0, win32: void 0 }, mix = (del = delimiter) => new Proxy(_path, {
|
|
5559
|
-
get(_, prop) {
|
|
5560
|
-
return prop === "delimiter" ? del : prop === "posix" ? posix : prop === "win32" ? win32 : _platforms[prop] || _path[prop];
|
|
5561
|
-
}
|
|
5562
|
-
}), posix = /* @__PURE__ */ mix(":"), win32 = /* @__PURE__ */ mix(";");
|
|
5563
|
-
|
|
5564
5289
|
// src/componentManifest/generateCodeSnippet.ts
|
|
5565
5290
|
import {
|
|
5566
5291
|
textOf,
|
|
@@ -5774,7 +5499,7 @@ function rewriteJsx(code, node, merged, edits, mark) {
|
|
|
5774
5499
|
}
|
|
5775
5500
|
|
|
5776
5501
|
// src/componentManifest/reactDocgenTypescript.ts
|
|
5777
|
-
import { dirname as
|
|
5502
|
+
import { dirname as dirname3, join as join2, resolve } from "node:path";
|
|
5778
5503
|
import {
|
|
5779
5504
|
extractComponentJsDocInfo as extractComponentJsDocInfo2,
|
|
5780
5505
|
resolveExportedSymbol
|
|
@@ -5888,17 +5613,18 @@ function getReactDocgenTypescriptError(path2, {
|
|
|
5888
5613
|
localImportName,
|
|
5889
5614
|
componentName
|
|
5890
5615
|
}, docs) {
|
|
5616
|
+
let file = `File: ${relative(process.cwd(), path2)}`;
|
|
5891
5617
|
return docs.length === 0 ? {
|
|
5892
5618
|
name: "react-docgen-typescript found no component docs",
|
|
5893
5619
|
message: [
|
|
5894
|
-
|
|
5620
|
+
file,
|
|
5895
5621
|
"react-docgen-typescript did not return any component docs for this file."
|
|
5896
5622
|
].join(`
|
|
5897
5623
|
`)
|
|
5898
5624
|
} : {
|
|
5899
5625
|
name: "react-docgen-typescript could not match component docs",
|
|
5900
5626
|
message: [
|
|
5901
|
-
|
|
5627
|
+
file,
|
|
5902
5628
|
"react-docgen-typescript returned component docs for this file, but none matched the story's component import.",
|
|
5903
5629
|
`Looked for: componentName=${componentName}, localImportName=${localImportName ?? "<none>"}, importName=${importName ?? "<none>"}.`
|
|
5904
5630
|
].join(`
|
|
@@ -5926,15 +5652,15 @@ var parseWithReactDocgenTypescript = asyncCache(
|
|
|
5926
5652
|
},
|
|
5927
5653
|
{ name: "parseWithReactDocgenTypescript" }
|
|
5928
5654
|
), findOwningTsconfigPath = cached(
|
|
5929
|
-
(typescript,
|
|
5930
|
-
let configPath = findTsconfigPath(
|
|
5655
|
+
(typescript, cwd, filePath) => {
|
|
5656
|
+
let configPath = findTsconfigPath(cwd);
|
|
5931
5657
|
if (configPath)
|
|
5932
5658
|
return findTsconfigPathIncludingFile(typescript, configPath, filePath, /* @__PURE__ */ new Set()) ?? configPath;
|
|
5933
5659
|
},
|
|
5934
5660
|
{
|
|
5935
|
-
key: (typescript,
|
|
5661
|
+
key: (typescript, cwd, filePath) => `${normalizeFileName(typescript, resolve(cwd))}::${normalizeFileName(
|
|
5936
5662
|
typescript,
|
|
5937
|
-
|
|
5663
|
+
resolve(filePath)
|
|
5938
5664
|
)}`,
|
|
5939
5665
|
name: "findOwningTsconfigPath"
|
|
5940
5666
|
}
|
|
@@ -5959,8 +5685,8 @@ function findTsconfigPathIncludingFile(typescript, configPath, filePath, seenCon
|
|
|
5959
5685
|
}
|
|
5960
5686
|
}
|
|
5961
5687
|
function getReferencedTsconfigPaths(typescript, configPath, config) {
|
|
5962
|
-
return (Array.isArray(config?.references) ? config.references : []).map((reference) => reference.path).filter((referencePath) => typeof referencePath == "string").map((referencePath) =>
|
|
5963
|
-
(referencePath) => referencePath.endsWith(".json") ? referencePath :
|
|
5688
|
+
return (Array.isArray(config?.references) ? config.references : []).map((reference) => reference.path).filter((referencePath) => typeof referencePath == "string").map((referencePath) => resolve(dirname3(configPath), referencePath)).map(
|
|
5689
|
+
(referencePath) => referencePath.endsWith(".json") ? referencePath : join2(referencePath, "tsconfig.json")
|
|
5964
5690
|
).filter((referencePath) => typescript.sys.fileExists(referencePath));
|
|
5965
5691
|
}
|
|
5966
5692
|
function parseTsconfig(typescript, configPath) {
|
|
@@ -5972,7 +5698,7 @@ function readTsconfig(typescript, configPath) {
|
|
|
5972
5698
|
return cachedTsconfig;
|
|
5973
5699
|
let { config } = typescript.readConfigFile(configPath, typescript.sys.readFile), state = {
|
|
5974
5700
|
config,
|
|
5975
|
-
parsed: typescript.parseJsonConfigFileContent(config, typescript.sys,
|
|
5701
|
+
parsed: typescript.parseJsonConfigFileContent(config, typescript.sys, dirname3(configPath))
|
|
5976
5702
|
};
|
|
5977
5703
|
return tsconfigCache.set(cacheKey, state), state;
|
|
5978
5704
|
}
|
|
@@ -5980,7 +5706,7 @@ function isSameFileName(typescript, left, right) {
|
|
|
5980
5706
|
return normalizeFileName(typescript, left) === normalizeFileName(typescript, right);
|
|
5981
5707
|
}
|
|
5982
5708
|
function normalizeFileName(typescript, fileName) {
|
|
5983
|
-
let normalized =
|
|
5709
|
+
let normalized = resolve(fileName).replace(/\\/g, "/");
|
|
5984
5710
|
return typescript.sys.useCaseSensitiveFileNames ? normalized : normalized.toLowerCase();
|
|
5985
5711
|
}
|
|
5986
5712
|
|
|
@@ -6001,7 +5727,7 @@ import {
|
|
|
6001
5727
|
} from "storybook/internal/csf-tools";
|
|
6002
5728
|
|
|
6003
5729
|
// src/componentManifest/getComponentImports.ts
|
|
6004
|
-
import { dirname as
|
|
5730
|
+
import { dirname as dirname4 } from "node:path";
|
|
6005
5731
|
import {
|
|
6006
5732
|
buildImportStatements,
|
|
6007
5733
|
collectImportBindings as collectImportBindings2,
|
|
@@ -6016,7 +5742,7 @@ import { getTypeScriptForDocgenError, isModuleNotFoundError as isModuleNotFoundE
|
|
|
6016
5742
|
import { logger as logger5 } from "storybook/internal/node-logger";
|
|
6017
5743
|
var reactDocgenPromise;
|
|
6018
5744
|
function loadReactDocgen() {
|
|
6019
|
-
return reactDocgenPromise ??= import("./reactDocgen-
|
|
5745
|
+
return reactDocgenPromise ??= import("./reactDocgen-CS462JSF.js").catch((error) => {
|
|
6020
5746
|
if (isModuleNotFoundError2(error)) {
|
|
6021
5747
|
logger5.debug(`Skipping react-docgen, which is not installed: ${error}`);
|
|
6022
5748
|
return;
|
|
@@ -6086,14 +5812,14 @@ var isReactDocgenTypescriptResolvable = () => {
|
|
|
6086
5812
|
jsxDepth: componentDepth.get(c)
|
|
6087
5813
|
}, path2, isPackage = !1;
|
|
6088
5814
|
try {
|
|
6089
|
-
component.importId && storyFilePath && (path2 = cachedResolveImport(matchPath(component.importId,
|
|
6090
|
-
basedir:
|
|
5815
|
+
component.importId && storyFilePath && (path2 = cachedResolveImport(matchPath(component.importId, dirname4(storyFilePath)), {
|
|
5816
|
+
basedir: dirname4(storyFilePath)
|
|
6091
5817
|
}));
|
|
6092
5818
|
} catch (e) {
|
|
6093
5819
|
logger6.debug(e);
|
|
6094
5820
|
}
|
|
6095
5821
|
try {
|
|
6096
|
-
component.importId && !component.importId.startsWith(".") && storyFilePath && (cachedResolveImport(component.importId, { basedir:
|
|
5822
|
+
component.importId && !component.importId.startsWith(".") && storyFilePath && (cachedResolveImport(component.importId, { basedir: dirname4(storyFilePath) }), isPackage = !0);
|
|
6097
5823
|
} catch {
|
|
6098
5824
|
}
|
|
6099
5825
|
let componentWithPackage = { ...component, isPackage }, target = docgenTargets?.get(c);
|
|
@@ -6125,7 +5851,7 @@ var isReactDocgenTypescriptResolvable = () => {
|
|
|
6125
5851
|
let message = e instanceof Error ? e.message : String(e);
|
|
6126
5852
|
logger6.debug(`react-docgen-typescript failed for ${docgenPath}: ${message}`), reactDocgenTypescriptError = isModuleNotFoundError3(e) && !isReactDocgenTypescriptResolvable() ? getDocgenPackageMissingError("react-docgen-typescript") : {
|
|
6127
5853
|
name: "react-docgen-typescript parse error",
|
|
6128
|
-
message: `File: ${docgenPath}
|
|
5854
|
+
message: `File: ${relative(process.cwd(), docgenPath)}
|
|
6129
5855
|
${message}`
|
|
6130
5856
|
};
|
|
6131
5857
|
}
|
|
@@ -6263,7 +5989,7 @@ function extractStorySnippets(csf, componentName, filterStoryIds, references, wi
|
|
|
6263
5989
|
}
|
|
6264
5990
|
|
|
6265
5991
|
// src/componentManifest/buildReactComponentDocgen.ts
|
|
6266
|
-
import { getComponentIdFromEntry } from "storybook/internal/common";
|
|
5992
|
+
import { componentPathFromStory, getComponentIdFromEntry } from "storybook/internal/common";
|
|
6267
5993
|
import {
|
|
6268
5994
|
buildImportStatements as buildImportStatements2,
|
|
6269
5995
|
createStoryReferenceResolver,
|
|
@@ -6303,8 +6029,9 @@ function getFallbackImport(packageName, componentName) {
|
|
|
6303
6029
|
}).join(`
|
|
6304
6030
|
`) : "";
|
|
6305
6031
|
}
|
|
6032
|
+
var relativize = (fileName) => posix.relative(process.cwd(), fileName);
|
|
6306
6033
|
function relativizeComponentMetaPaths(doc) {
|
|
6307
|
-
let
|
|
6034
|
+
let relativizeProp = (prop) => ({
|
|
6308
6035
|
...prop,
|
|
6309
6036
|
parent: prop.parent ? { ...prop.parent, fileName: relativize(prop.parent.fileName) } : prop.parent,
|
|
6310
6037
|
declarations: prop.declarations?.map((declaration) => ({
|
|
@@ -6314,6 +6041,7 @@ function relativizeComponentMetaPaths(doc) {
|
|
|
6314
6041
|
});
|
|
6315
6042
|
return {
|
|
6316
6043
|
...doc,
|
|
6044
|
+
filePath: relativize(doc.filePath),
|
|
6317
6045
|
props: Object.fromEntries(
|
|
6318
6046
|
Object.entries(doc.props).map(([name, prop]) => [name, relativizeProp(prop)])
|
|
6319
6047
|
)
|
|
@@ -6323,8 +6051,11 @@ function getComponentDocgenData(component, docgenEngine) {
|
|
|
6323
6051
|
let reactDocgen, reactDocgenTypescript, reactComponentMeta, docgenDescription, docgenJsDocTags, docgenError;
|
|
6324
6052
|
if (docgenEngine === "react-docgen") {
|
|
6325
6053
|
let result = component?.reactDocgen;
|
|
6326
|
-
reactDocgen = result?.type === "success" ? result.data : void 0, docgenDescription = reactDocgen?.description, docgenError = result?.type === "error" ? result.error : void 0;
|
|
6327
|
-
} else docgenEngine === "react-docgen-typescript" ? (reactDocgenTypescript = component?.reactDocgenTypescript
|
|
6054
|
+
reactDocgen = result?.type === "success" ? { ...result.data, definedInFile: relativize(result.data.definedInFile) } : void 0, docgenDescription = reactDocgen?.description, docgenError = result?.type === "error" ? result.error : void 0;
|
|
6055
|
+
} else docgenEngine === "react-docgen-typescript" ? (reactDocgenTypescript = component?.reactDocgenTypescript && {
|
|
6056
|
+
...component.reactDocgenTypescript,
|
|
6057
|
+
filePath: relativize(component.reactDocgenTypescript.filePath)
|
|
6058
|
+
}, docgenDescription = reactDocgenTypescript?.description, docgenJsDocTags = component?.componentJsDocTags, docgenError = component?.reactDocgenTypescriptError) : (reactComponentMeta = component?.reactComponentMeta ? relativizeComponentMetaPaths(component.reactComponentMeta) : void 0, docgenDescription = reactComponentMeta?.description, docgenJsDocTags = component?.componentJsDocTags);
|
|
6328
6059
|
return {
|
|
6329
6060
|
docgenDescription,
|
|
6330
6061
|
docgenError,
|
|
@@ -6339,6 +6070,7 @@ function createSubcomponentDocgen({
|
|
|
6339
6070
|
declaredName,
|
|
6340
6071
|
docgenEngine,
|
|
6341
6072
|
packageName,
|
|
6073
|
+
storyPath,
|
|
6342
6074
|
storyFilePath
|
|
6343
6075
|
}) {
|
|
6344
6076
|
let imports = buildImportStatements2({ refs: component ? [component] : [], packageName }).join(`
|
|
@@ -6356,7 +6088,7 @@ function createSubcomponentDocgen({
|
|
|
6356
6088
|
);
|
|
6357
6089
|
return {
|
|
6358
6090
|
name: declaredName,
|
|
6359
|
-
path: component?.path
|
|
6091
|
+
path: component?.path ? componentPathFromStory(storyFilePath, storyPath, component.path) : storyFilePath,
|
|
6360
6092
|
description,
|
|
6361
6093
|
summary,
|
|
6362
6094
|
import: imports || void 0,
|
|
@@ -6456,6 +6188,7 @@ ${storyFile}`
|
|
|
6456
6188
|
declaredName: subcomponent.name,
|
|
6457
6189
|
docgenEngine,
|
|
6458
6190
|
packageName,
|
|
6191
|
+
storyPath,
|
|
6459
6192
|
storyFilePath
|
|
6460
6193
|
})
|
|
6461
6194
|
])
|
|
@@ -6514,9 +6247,6 @@ function buildReactComponentDocgenFromResolved({
|
|
|
6514
6247
|
}
|
|
6515
6248
|
|
|
6516
6249
|
export {
|
|
6517
|
-
join2 as join,
|
|
6518
|
-
isAbsolute2 as isAbsolute,
|
|
6519
|
-
posix,
|
|
6520
6250
|
getCodeSnippet,
|
|
6521
6251
|
invalidateParser,
|
|
6522
6252
|
resolveStoryFileComponents,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getSharedComponentMetaManager
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-RNO52GGS.js";
|
|
4
4
|
import {
|
|
5
5
|
extractArgTypesFromComponentMeta
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-4UV6B7T7.js";
|
|
7
|
+
import "./chunk-XMHC3CJ5.js";
|
|
8
8
|
import "./chunk-MYBSMCSW.js";
|
|
9
|
-
import "./chunk-
|
|
9
|
+
import "./chunk-M3SEC5XW.js";
|
|
10
10
|
import "./chunk-SC3QXTHH.js";
|
|
11
11
|
import "./chunk-QKPKKS4R.js";
|
|
12
12
|
import "./chunk-PQZIOGBY.js";
|