@storybook/react 11.0.0-alpha.7 → 11.0.0-alpha.9
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/_node-chunks/{chunk-EH6QRX5B.js → chunk-AV7GEKV7.js} +682 -751
- package/dist/docgen/docgen-worker.js +12 -11
- package/dist/index.d.ts +3 -3
- package/dist/preset.js +134 -119
- package/package.json +2 -5
- package/template/cli/js/Button.jsx +11 -23
- package/template/cli/js/Header.jsx +8 -12
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_ynn8fkacxge from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_ynn8fkacxge from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_ynn8fkacxge from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_ynn8fkacxge.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_ynn8fkacxge.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_ynn8fkacxge.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -2203,22 +2203,22 @@ var require_createProject = __commonJS({
|
|
|
2203
2203
|
// ../../../node_modules/vscode-uri/lib/umd/index.js
|
|
2204
2204
|
var require_umd = __commonJS({
|
|
2205
2205
|
"../../../node_modules/vscode-uri/lib/umd/index.js"(exports, module) {
|
|
2206
|
-
(function(
|
|
2206
|
+
(function(t, e) {
|
|
2207
2207
|
if (typeof exports == "object" && typeof module == "object") module.exports = e();
|
|
2208
2208
|
else if (typeof define == "function" && define.amd) define([], e);
|
|
2209
2209
|
else {
|
|
2210
2210
|
var r = e();
|
|
2211
|
-
for (var n in r) (typeof exports == "object" ? exports :
|
|
2211
|
+
for (var n in r) (typeof exports == "object" ? exports : t)[n] = r[n];
|
|
2212
2212
|
}
|
|
2213
2213
|
})(exports, (() => (() => {
|
|
2214
2214
|
"use strict";
|
|
2215
|
-
var
|
|
2216
|
-
function e2(
|
|
2217
|
-
if (typeof
|
|
2215
|
+
var t = { 975: (t2) => {
|
|
2216
|
+
function e2(t3) {
|
|
2217
|
+
if (typeof t3 != "string") throw new TypeError("Path must be a string. Received " + JSON.stringify(t3));
|
|
2218
2218
|
}
|
|
2219
|
-
function r2(
|
|
2220
|
-
for (var r3, n3 = "", i2 = 0, o = -1, s = 0, a = 0; a <=
|
|
2221
|
-
if (a <
|
|
2219
|
+
function r2(t3, e3) {
|
|
2220
|
+
for (var r3, n3 = "", i2 = 0, o = -1, s = 0, a = 0; a <= t3.length; ++a) {
|
|
2221
|
+
if (a < t3.length) r3 = t3.charCodeAt(a);
|
|
2222
2222
|
else {
|
|
2223
2223
|
if (r3 === 47) break;
|
|
2224
2224
|
r3 = 47;
|
|
@@ -2238,70 +2238,70 @@ var require_umd = __commonJS({
|
|
|
2238
2238
|
}
|
|
2239
2239
|
}
|
|
2240
2240
|
e3 && (n3.length > 0 ? n3 += "/.." : n3 = "..", i2 = 2);
|
|
2241
|
-
} else n3.length > 0 ? n3 += "/" +
|
|
2241
|
+
} else n3.length > 0 ? n3 += "/" + t3.slice(o + 1, a) : n3 = t3.slice(o + 1, a), i2 = a - o - 1;
|
|
2242
2242
|
o = a, s = 0;
|
|
2243
2243
|
} else r3 === 46 && s !== -1 ? ++s : s = -1;
|
|
2244
2244
|
}
|
|
2245
2245
|
return n3;
|
|
2246
2246
|
}
|
|
2247
2247
|
var n2 = { resolve: function() {
|
|
2248
|
-
for (var
|
|
2248
|
+
for (var t3, n3 = "", i2 = !1, o = arguments.length - 1; o >= -1 && !i2; o--) {
|
|
2249
2249
|
var s;
|
|
2250
|
-
o >= 0 ? s = arguments[o] : (
|
|
2250
|
+
o >= 0 ? s = arguments[o] : (t3 === void 0 && (t3 = process.cwd()), s = t3), e2(s), s.length !== 0 && (n3 = s + "/" + n3, i2 = s.charCodeAt(0) === 47);
|
|
2251
2251
|
}
|
|
2252
2252
|
return n3 = r2(n3, !i2), i2 ? n3.length > 0 ? "/" + n3 : "/" : n3.length > 0 ? n3 : ".";
|
|
2253
|
-
}, normalize: function(
|
|
2254
|
-
if (e2(
|
|
2255
|
-
var n3 =
|
|
2256
|
-
return (
|
|
2257
|
-
}, isAbsolute: function(
|
|
2258
|
-
return e2(
|
|
2253
|
+
}, normalize: function(t3) {
|
|
2254
|
+
if (e2(t3), t3.length === 0) return ".";
|
|
2255
|
+
var n3 = t3.charCodeAt(0) === 47, i2 = t3.charCodeAt(t3.length - 1) === 47;
|
|
2256
|
+
return (t3 = r2(t3, !n3)).length !== 0 || n3 || (t3 = "."), t3.length > 0 && i2 && (t3 += "/"), n3 ? "/" + t3 : t3;
|
|
2257
|
+
}, isAbsolute: function(t3) {
|
|
2258
|
+
return e2(t3), t3.length > 0 && t3.charCodeAt(0) === 47;
|
|
2259
2259
|
}, join: function() {
|
|
2260
2260
|
if (arguments.length === 0) return ".";
|
|
2261
|
-
for (var
|
|
2261
|
+
for (var t3, r3 = 0; r3 < arguments.length; ++r3) {
|
|
2262
2262
|
var i2 = arguments[r3];
|
|
2263
|
-
e2(i2), i2.length > 0 && (
|
|
2263
|
+
e2(i2), i2.length > 0 && (t3 === void 0 ? t3 = i2 : t3 += "/" + i2);
|
|
2264
2264
|
}
|
|
2265
|
-
return
|
|
2266
|
-
}, relative: function(
|
|
2267
|
-
if (e2(
|
|
2268
|
-
for (var i2 = 1; i2 <
|
|
2269
|
-
for (var o =
|
|
2265
|
+
return t3 === void 0 ? "." : n2.normalize(t3);
|
|
2266
|
+
}, relative: function(t3, r3) {
|
|
2267
|
+
if (e2(t3), e2(r3), t3 === r3 || (t3 = n2.resolve(t3)) === (r3 = n2.resolve(r3))) return "";
|
|
2268
|
+
for (var i2 = 1; i2 < t3.length && t3.charCodeAt(i2) === 47; ++i2) ;
|
|
2269
|
+
for (var o = t3.length, s = o - i2, a = 1; a < r3.length && r3.charCodeAt(a) === 47; ++a) ;
|
|
2270
2270
|
for (var h = r3.length - a, c = s < h ? s : h, f = -1, u = 0; u <= c; ++u) {
|
|
2271
2271
|
if (u === c) {
|
|
2272
2272
|
if (h > c) {
|
|
2273
2273
|
if (r3.charCodeAt(a + u) === 47) return r3.slice(a + u + 1);
|
|
2274
2274
|
if (u === 0) return r3.slice(a + u);
|
|
2275
|
-
} else s > c && (
|
|
2275
|
+
} else s > c && (t3.charCodeAt(i2 + u) === 47 ? f = u : u === 0 && (f = 0));
|
|
2276
2276
|
break;
|
|
2277
2277
|
}
|
|
2278
|
-
var l =
|
|
2278
|
+
var l = t3.charCodeAt(i2 + u);
|
|
2279
2279
|
if (l !== r3.charCodeAt(a + u)) break;
|
|
2280
2280
|
l === 47 && (f = u);
|
|
2281
2281
|
}
|
|
2282
2282
|
var d = "";
|
|
2283
|
-
for (u = i2 + f + 1; u <= o; ++u) u !== o &&
|
|
2283
|
+
for (u = i2 + f + 1; u <= o; ++u) u !== o && t3.charCodeAt(u) !== 47 || (d.length === 0 ? d += ".." : d += "/..");
|
|
2284
2284
|
return d.length > 0 ? d + r3.slice(a + f) : (a += f, r3.charCodeAt(a) === 47 && ++a, r3.slice(a));
|
|
2285
|
-
}, _makeLong: function(
|
|
2286
|
-
return
|
|
2287
|
-
}, dirname: function(
|
|
2288
|
-
if (e2(
|
|
2289
|
-
for (var r3 =
|
|
2285
|
+
}, _makeLong: function(t3) {
|
|
2286
|
+
return t3;
|
|
2287
|
+
}, dirname: function(t3) {
|
|
2288
|
+
if (e2(t3), t3.length === 0) return ".";
|
|
2289
|
+
for (var r3 = t3.charCodeAt(0), n3 = r3 === 47, i2 = -1, o = !0, s = t3.length - 1; s >= 1; --s) if ((r3 = t3.charCodeAt(s)) === 47) {
|
|
2290
2290
|
if (!o) {
|
|
2291
2291
|
i2 = s;
|
|
2292
2292
|
break;
|
|
2293
2293
|
}
|
|
2294
2294
|
} else o = !1;
|
|
2295
|
-
return i2 === -1 ? n3 ? "/" : "." : n3 && i2 === 1 ? "//" :
|
|
2296
|
-
}, basename: function(
|
|
2295
|
+
return i2 === -1 ? n3 ? "/" : "." : n3 && i2 === 1 ? "//" : t3.slice(0, i2);
|
|
2296
|
+
}, basename: function(t3, r3) {
|
|
2297
2297
|
if (r3 !== void 0 && typeof r3 != "string") throw new TypeError('"ext" argument must be a string');
|
|
2298
|
-
e2(
|
|
2298
|
+
e2(t3);
|
|
2299
2299
|
var n3, i2 = 0, o = -1, s = !0;
|
|
2300
|
-
if (r3 !== void 0 && r3.length > 0 && r3.length <=
|
|
2301
|
-
if (r3.length ===
|
|
2300
|
+
if (r3 !== void 0 && r3.length > 0 && r3.length <= t3.length) {
|
|
2301
|
+
if (r3.length === t3.length && r3 === t3) return "";
|
|
2302
2302
|
var a = r3.length - 1, h = -1;
|
|
2303
|
-
for (n3 =
|
|
2304
|
-
var c =
|
|
2303
|
+
for (n3 = t3.length - 1; n3 >= 0; --n3) {
|
|
2304
|
+
var c = t3.charCodeAt(n3);
|
|
2305
2305
|
if (c === 47) {
|
|
2306
2306
|
if (!s) {
|
|
2307
2307
|
i2 = n3 + 1;
|
|
@@ -2309,79 +2309,79 @@ var require_umd = __commonJS({
|
|
|
2309
2309
|
}
|
|
2310
2310
|
} else h === -1 && (s = !1, h = n3 + 1), a >= 0 && (c === r3.charCodeAt(a) ? --a == -1 && (o = n3) : (a = -1, o = h));
|
|
2311
2311
|
}
|
|
2312
|
-
return i2 === o ? o = h : o === -1 && (o =
|
|
2312
|
+
return i2 === o ? o = h : o === -1 && (o = t3.length), t3.slice(i2, o);
|
|
2313
2313
|
}
|
|
2314
|
-
for (n3 =
|
|
2314
|
+
for (n3 = t3.length - 1; n3 >= 0; --n3) if (t3.charCodeAt(n3) === 47) {
|
|
2315
2315
|
if (!s) {
|
|
2316
2316
|
i2 = n3 + 1;
|
|
2317
2317
|
break;
|
|
2318
2318
|
}
|
|
2319
2319
|
} else o === -1 && (s = !1, o = n3 + 1);
|
|
2320
|
-
return o === -1 ? "" :
|
|
2321
|
-
}, extname: function(
|
|
2322
|
-
e2(
|
|
2323
|
-
for (var r3 = -1, n3 = 0, i2 = -1, o = !0, s = 0, a =
|
|
2324
|
-
var h =
|
|
2320
|
+
return o === -1 ? "" : t3.slice(i2, o);
|
|
2321
|
+
}, extname: function(t3) {
|
|
2322
|
+
e2(t3);
|
|
2323
|
+
for (var r3 = -1, n3 = 0, i2 = -1, o = !0, s = 0, a = t3.length - 1; a >= 0; --a) {
|
|
2324
|
+
var h = t3.charCodeAt(a);
|
|
2325
2325
|
if (h !== 47) i2 === -1 && (o = !1, i2 = a + 1), h === 46 ? r3 === -1 ? r3 = a : s !== 1 && (s = 1) : r3 !== -1 && (s = -1);
|
|
2326
2326
|
else if (!o) {
|
|
2327
2327
|
n3 = a + 1;
|
|
2328
2328
|
break;
|
|
2329
2329
|
}
|
|
2330
2330
|
}
|
|
2331
|
-
return r3 === -1 || i2 === -1 || s === 0 || s === 1 && r3 === i2 - 1 && r3 === n3 + 1 ? "" :
|
|
2332
|
-
}, format: function(
|
|
2333
|
-
if (
|
|
2334
|
-
return (function(
|
|
2331
|
+
return r3 === -1 || i2 === -1 || s === 0 || s === 1 && r3 === i2 - 1 && r3 === n3 + 1 ? "" : t3.slice(r3, i2);
|
|
2332
|
+
}, format: function(t3) {
|
|
2333
|
+
if (t3 === null || typeof t3 != "object") throw new TypeError('The "pathObject" argument must be of type Object. Received type ' + typeof t3);
|
|
2334
|
+
return (function(t4, e3) {
|
|
2335
2335
|
var r3 = e3.dir || e3.root, n3 = e3.base || (e3.name || "") + (e3.ext || "");
|
|
2336
2336
|
return r3 ? r3 === e3.root ? r3 + n3 : r3 + "/" + n3 : n3;
|
|
2337
|
-
})(0,
|
|
2338
|
-
}, parse: function(
|
|
2339
|
-
e2(
|
|
2337
|
+
})(0, t3);
|
|
2338
|
+
}, parse: function(t3) {
|
|
2339
|
+
e2(t3);
|
|
2340
2340
|
var r3 = { root: "", dir: "", base: "", ext: "", name: "" };
|
|
2341
|
-
if (
|
|
2342
|
-
var n3, i2 =
|
|
2341
|
+
if (t3.length === 0) return r3;
|
|
2342
|
+
var n3, i2 = t3.charCodeAt(0), o = i2 === 47;
|
|
2343
2343
|
o ? (r3.root = "/", n3 = 1) : n3 = 0;
|
|
2344
|
-
for (var s = -1, a = 0, h = -1, c = !0, f =
|
|
2344
|
+
for (var s = -1, a = 0, h = -1, c = !0, f = t3.length - 1, u = 0; f >= n3; --f) if ((i2 = t3.charCodeAt(f)) !== 47) h === -1 && (c = !1, h = f + 1), i2 === 46 ? s === -1 ? s = f : u !== 1 && (u = 1) : s !== -1 && (u = -1);
|
|
2345
2345
|
else if (!c) {
|
|
2346
2346
|
a = f + 1;
|
|
2347
2347
|
break;
|
|
2348
2348
|
}
|
|
2349
|
-
return s === -1 || h === -1 || u === 0 || u === 1 && s === h - 1 && s === a + 1 ? h !== -1 && (r3.base = r3.name = a === 0 && o ?
|
|
2349
|
+
return s === -1 || h === -1 || u === 0 || u === 1 && s === h - 1 && s === a + 1 ? h !== -1 && (r3.base = r3.name = a === 0 && o ? t3.slice(1, h) : t3.slice(a, h)) : (a === 0 && o ? (r3.name = t3.slice(1, s), r3.base = t3.slice(1, h)) : (r3.name = t3.slice(a, s), r3.base = t3.slice(a, h)), r3.ext = t3.slice(s, h)), a > 0 ? r3.dir = t3.slice(0, a - 1) : o && (r3.dir = "/"), r3;
|
|
2350
2350
|
}, sep: "/", delimiter: ":", win32: null, posix: null };
|
|
2351
|
-
n2.posix = n2,
|
|
2352
|
-
}, 70: (
|
|
2351
|
+
n2.posix = n2, t2.exports = n2;
|
|
2352
|
+
}, 70: (t2, e2) => {
|
|
2353
2353
|
if (Object.defineProperty(e2, "__esModule", { value: !0 }), e2.isWindows = void 0, typeof process == "object") e2.isWindows = process.platform === "win32";
|
|
2354
2354
|
else if (typeof navigator == "object") {
|
|
2355
|
-
let
|
|
2356
|
-
e2.isWindows =
|
|
2355
|
+
let t3 = navigator.userAgent;
|
|
2356
|
+
e2.isWindows = t3.indexOf("Windows") >= 0;
|
|
2357
2357
|
}
|
|
2358
|
-
}, 231: (
|
|
2358
|
+
}, 231: (t2, e2, r2) => {
|
|
2359
2359
|
Object.defineProperty(e2, "__esModule", { value: !0 }), e2.uriToFsPath = e2.URI = void 0;
|
|
2360
2360
|
let n2 = r2(70), i2 = /^\w[\w\d+.-]*$/, o = /^\//, s = /^\/\//;
|
|
2361
|
-
function a(
|
|
2362
|
-
if (!
|
|
2363
|
-
if (
|
|
2364
|
-
if (
|
|
2365
|
-
if (
|
|
2366
|
-
if (!o.test(
|
|
2367
|
-
} else if (s.test(
|
|
2361
|
+
function a(t3, e3) {
|
|
2362
|
+
if (!t3.scheme && e3) throw new Error(`[UriError]: Scheme is missing: {scheme: "", authority: "${t3.authority}", path: "${t3.path}", query: "${t3.query}", fragment: "${t3.fragment}"}`);
|
|
2363
|
+
if (t3.scheme && !i2.test(t3.scheme)) throw new Error("[UriError]: Scheme contains illegal characters.");
|
|
2364
|
+
if (t3.path) {
|
|
2365
|
+
if (t3.authority) {
|
|
2366
|
+
if (!o.test(t3.path)) throw new Error('[UriError]: If a URI contains an authority component, then the path component must either be empty or begin with a slash ("/") character');
|
|
2367
|
+
} else if (s.test(t3.path)) throw new Error('[UriError]: If a URI does not contain an authority component, then the path cannot begin with two slash characters ("//")');
|
|
2368
2368
|
}
|
|
2369
2369
|
}
|
|
2370
2370
|
let h = "", c = "/", f = /^(([^:/?#]+?):)?(\/\/([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?/;
|
|
2371
2371
|
class u {
|
|
2372
|
-
static isUri(
|
|
2373
|
-
return
|
|
2372
|
+
static isUri(t3) {
|
|
2373
|
+
return t3 instanceof u || !!t3 && typeof t3.authority == "string" && typeof t3.fragment == "string" && typeof t3.path == "string" && typeof t3.query == "string" && typeof t3.scheme == "string" && typeof t3.fsPath == "string" && typeof t3.with == "function" && typeof t3.toString == "function";
|
|
2374
2374
|
}
|
|
2375
2375
|
scheme;
|
|
2376
2376
|
authority;
|
|
2377
2377
|
path;
|
|
2378
2378
|
query;
|
|
2379
2379
|
fragment;
|
|
2380
|
-
constructor(
|
|
2381
|
-
typeof
|
|
2382
|
-
return
|
|
2383
|
-
})(
|
|
2384
|
-
switch (
|
|
2380
|
+
constructor(t3, e3, r3, n3, i3, o2 = !1) {
|
|
2381
|
+
typeof t3 == "object" ? (this.scheme = t3.scheme || h, this.authority = t3.authority || h, this.path = t3.path || h, this.query = t3.query || h, this.fragment = t3.fragment || h) : (this.scheme = /* @__PURE__ */ (function(t4, e4) {
|
|
2382
|
+
return t4 || e4 ? t4 : "file";
|
|
2383
|
+
})(t3, o2), this.authority = e3 || h, this.path = (function(t4, e4) {
|
|
2384
|
+
switch (t4) {
|
|
2385
2385
|
case "https":
|
|
2386
2386
|
case "http":
|
|
2387
2387
|
case "file":
|
|
@@ -2393,42 +2393,42 @@ var require_umd = __commonJS({
|
|
|
2393
2393
|
get fsPath() {
|
|
2394
2394
|
return v(this, !1);
|
|
2395
2395
|
}
|
|
2396
|
-
with(
|
|
2397
|
-
if (!
|
|
2398
|
-
let { scheme: e3, authority: r3, path: n3, query: i3, fragment: o2 } =
|
|
2396
|
+
with(t3) {
|
|
2397
|
+
if (!t3) return this;
|
|
2398
|
+
let { scheme: e3, authority: r3, path: n3, query: i3, fragment: o2 } = t3;
|
|
2399
2399
|
return e3 === void 0 ? e3 = this.scheme : e3 === null && (e3 = h), r3 === void 0 ? r3 = this.authority : r3 === null && (r3 = h), n3 === void 0 ? n3 = this.path : n3 === null && (n3 = h), i3 === void 0 ? i3 = this.query : i3 === null && (i3 = h), o2 === void 0 ? o2 = this.fragment : o2 === null && (o2 = h), e3 === this.scheme && r3 === this.authority && n3 === this.path && i3 === this.query && o2 === this.fragment ? this : new d(e3, r3, n3, i3, o2);
|
|
2400
2400
|
}
|
|
2401
|
-
static parse(
|
|
2402
|
-
let r3 = f.exec(
|
|
2401
|
+
static parse(t3, e3 = !1) {
|
|
2402
|
+
let r3 = f.exec(t3);
|
|
2403
2403
|
return r3 ? new d(r3[2] || h, w(r3[4] || h), w(r3[5] || h), w(r3[7] || h), w(r3[9] || h), e3) : new d(h, h, h, h, h);
|
|
2404
2404
|
}
|
|
2405
|
-
static file(
|
|
2405
|
+
static file(t3) {
|
|
2406
2406
|
let e3 = h;
|
|
2407
|
-
if (n2.isWindows && (
|
|
2408
|
-
let r3 =
|
|
2409
|
-
r3 === -1 ? (e3 =
|
|
2407
|
+
if (n2.isWindows && (t3 = t3.replace(/\\/g, c)), t3[0] === c && t3[1] === c) {
|
|
2408
|
+
let r3 = t3.indexOf(c, 2);
|
|
2409
|
+
r3 === -1 ? (e3 = t3.substring(2), t3 = c) : (e3 = t3.substring(2, r3), t3 = t3.substring(r3) || c);
|
|
2410
2410
|
}
|
|
2411
|
-
return new d("file", e3,
|
|
2411
|
+
return new d("file", e3, t3, h, h);
|
|
2412
2412
|
}
|
|
2413
|
-
static from(
|
|
2414
|
-
let e3 = new d(
|
|
2413
|
+
static from(t3) {
|
|
2414
|
+
let e3 = new d(t3.scheme, t3.authority, t3.path, t3.query, t3.fragment);
|
|
2415
2415
|
return a(e3, !0), e3;
|
|
2416
2416
|
}
|
|
2417
|
-
toString(
|
|
2418
|
-
return y(this,
|
|
2417
|
+
toString(t3 = !1) {
|
|
2418
|
+
return y(this, t3);
|
|
2419
2419
|
}
|
|
2420
2420
|
toJSON() {
|
|
2421
2421
|
return this;
|
|
2422
2422
|
}
|
|
2423
|
-
static revive(
|
|
2424
|
-
if (
|
|
2425
|
-
if (
|
|
2423
|
+
static revive(t3) {
|
|
2424
|
+
if (t3) {
|
|
2425
|
+
if (t3 instanceof u) return t3;
|
|
2426
2426
|
{
|
|
2427
|
-
let e3 = new d(
|
|
2428
|
-
return e3._formatted =
|
|
2427
|
+
let e3 = new d(t3);
|
|
2428
|
+
return e3._formatted = t3.external, e3._fsPath = t3._sep === l ? t3.fsPath : null, e3;
|
|
2429
2429
|
}
|
|
2430
2430
|
}
|
|
2431
|
-
return
|
|
2431
|
+
return t3;
|
|
2432
2432
|
}
|
|
2433
2433
|
}
|
|
2434
2434
|
e2.URI = u;
|
|
@@ -2439,112 +2439,112 @@ var require_umd = __commonJS({
|
|
|
2439
2439
|
get fsPath() {
|
|
2440
2440
|
return this._fsPath || (this._fsPath = v(this, !1)), this._fsPath;
|
|
2441
2441
|
}
|
|
2442
|
-
toString(
|
|
2443
|
-
return
|
|
2442
|
+
toString(t3 = !1) {
|
|
2443
|
+
return t3 ? y(this, !0) : (this._formatted || (this._formatted = y(this, !1)), this._formatted);
|
|
2444
2444
|
}
|
|
2445
2445
|
toJSON() {
|
|
2446
|
-
let
|
|
2447
|
-
return this._fsPath && (
|
|
2446
|
+
let t3 = { $mid: 1 };
|
|
2447
|
+
return this._fsPath && (t3.fsPath = this._fsPath, t3._sep = l), this._formatted && (t3.external = this._formatted), this.path && (t3.path = this.path), this.scheme && (t3.scheme = this.scheme), this.authority && (t3.authority = this.authority), this.query && (t3.query = this.query), this.fragment && (t3.fragment = this.fragment), t3;
|
|
2448
2448
|
}
|
|
2449
2449
|
}
|
|
2450
2450
|
let p = { 58: "%3A", 47: "%2F", 63: "%3F", 35: "%23", 91: "%5B", 93: "%5D", 64: "%40", 33: "%21", 36: "%24", 38: "%26", 39: "%27", 40: "%28", 41: "%29", 42: "%2A", 43: "%2B", 44: "%2C", 59: "%3B", 61: "%3D", 32: "%20" };
|
|
2451
|
-
function g(
|
|
2451
|
+
function g(t3, e3, r3) {
|
|
2452
2452
|
let n3, i3 = -1;
|
|
2453
|
-
for (let o2 = 0; o2 <
|
|
2454
|
-
let s2 =
|
|
2455
|
-
if (s2 >= 97 && s2 <= 122 || s2 >= 65 && s2 <= 90 || s2 >= 48 && s2 <= 57 || s2 === 45 || s2 === 46 || s2 === 95 || s2 === 126 || e3 && s2 === 47 || r3 && s2 === 91 || r3 && s2 === 93 || r3 && s2 === 58) i3 !== -1 && (n3 += encodeURIComponent(
|
|
2453
|
+
for (let o2 = 0; o2 < t3.length; o2++) {
|
|
2454
|
+
let s2 = t3.charCodeAt(o2);
|
|
2455
|
+
if (s2 >= 97 && s2 <= 122 || s2 >= 65 && s2 <= 90 || s2 >= 48 && s2 <= 57 || s2 === 45 || s2 === 46 || s2 === 95 || s2 === 126 || e3 && s2 === 47 || r3 && s2 === 91 || r3 && s2 === 93 || r3 && s2 === 58) i3 !== -1 && (n3 += encodeURIComponent(t3.substring(i3, o2)), i3 = -1), n3 !== void 0 && (n3 += t3.charAt(o2));
|
|
2456
2456
|
else {
|
|
2457
|
-
n3 === void 0 && (n3 =
|
|
2457
|
+
n3 === void 0 && (n3 = t3.substr(0, o2));
|
|
2458
2458
|
let e4 = p[s2];
|
|
2459
|
-
e4 !== void 0 ? (i3 !== -1 && (n3 += encodeURIComponent(
|
|
2459
|
+
e4 !== void 0 ? (i3 !== -1 && (n3 += encodeURIComponent(t3.substring(i3, o2)), i3 = -1), n3 += e4) : i3 === -1 && (i3 = o2);
|
|
2460
2460
|
}
|
|
2461
2461
|
}
|
|
2462
|
-
return i3 !== -1 && (n3 += encodeURIComponent(
|
|
2462
|
+
return i3 !== -1 && (n3 += encodeURIComponent(t3.substring(i3))), n3 !== void 0 ? n3 : t3;
|
|
2463
2463
|
}
|
|
2464
|
-
function m(
|
|
2464
|
+
function m(t3) {
|
|
2465
2465
|
let e3;
|
|
2466
|
-
for (let r3 = 0; r3 <
|
|
2467
|
-
let n3 =
|
|
2468
|
-
n3 === 35 || n3 === 63 ? (e3 === void 0 && (e3 =
|
|
2466
|
+
for (let r3 = 0; r3 < t3.length; r3++) {
|
|
2467
|
+
let n3 = t3.charCodeAt(r3);
|
|
2468
|
+
n3 === 35 || n3 === 63 ? (e3 === void 0 && (e3 = t3.substr(0, r3)), e3 += p[n3]) : e3 !== void 0 && (e3 += t3[r3]);
|
|
2469
2469
|
}
|
|
2470
|
-
return e3 !== void 0 ? e3 :
|
|
2470
|
+
return e3 !== void 0 ? e3 : t3;
|
|
2471
2471
|
}
|
|
2472
|
-
function v(
|
|
2472
|
+
function v(t3, e3) {
|
|
2473
2473
|
let r3;
|
|
2474
|
-
return r3 =
|
|
2474
|
+
return r3 = t3.authority && t3.path.length > 1 && t3.scheme === "file" ? `//${t3.authority}${t3.path}` : t3.path.charCodeAt(0) === 47 && (t3.path.charCodeAt(1) >= 65 && t3.path.charCodeAt(1) <= 90 || t3.path.charCodeAt(1) >= 97 && t3.path.charCodeAt(1) <= 122) && t3.path.charCodeAt(2) === 58 ? e3 ? t3.path.substr(1) : t3.path[1].toLowerCase() + t3.path.substr(2) : t3.path, n2.isWindows && (r3 = r3.replace(/\//g, "\\")), r3;
|
|
2475
2475
|
}
|
|
2476
|
-
function y(
|
|
2477
|
-
let r3 = e3 ? m : g, n3 = "", { scheme: i3, authority: o2, path: s2, query: a2, fragment: h2 } =
|
|
2476
|
+
function y(t3, e3) {
|
|
2477
|
+
let r3 = e3 ? m : g, n3 = "", { scheme: i3, authority: o2, path: s2, query: a2, fragment: h2 } = t3;
|
|
2478
2478
|
if (i3 && (n3 += i3, n3 += ":"), (o2 || i3 === "file") && (n3 += c, n3 += c), o2) {
|
|
2479
|
-
let
|
|
2480
|
-
if (
|
|
2481
|
-
let e4 = o2.substr(0,
|
|
2482
|
-
o2 = o2.substr(
|
|
2479
|
+
let t4 = o2.indexOf("@");
|
|
2480
|
+
if (t4 !== -1) {
|
|
2481
|
+
let e4 = o2.substr(0, t4);
|
|
2482
|
+
o2 = o2.substr(t4 + 1), t4 = e4.lastIndexOf(":"), t4 === -1 ? n3 += r3(e4, !1, !1) : (n3 += r3(e4.substr(0, t4), !1, !1), n3 += ":", n3 += r3(e4.substr(t4 + 1), !1, !0)), n3 += "@";
|
|
2483
2483
|
}
|
|
2484
|
-
o2 = o2.toLowerCase(),
|
|
2484
|
+
o2 = o2.toLowerCase(), t4 = o2.lastIndexOf(":"), t4 === -1 ? n3 += r3(o2, !1, !0) : (n3 += r3(o2.substr(0, t4), !1, !0), n3 += o2.substr(t4));
|
|
2485
2485
|
}
|
|
2486
2486
|
if (s2) {
|
|
2487
2487
|
if (s2.length >= 3 && s2.charCodeAt(0) === 47 && s2.charCodeAt(2) === 58) {
|
|
2488
|
-
let
|
|
2489
|
-
|
|
2488
|
+
let t4 = s2.charCodeAt(1);
|
|
2489
|
+
t4 >= 65 && t4 <= 90 && (s2 = `/${String.fromCharCode(t4 + 32)}:${s2.substr(3)}`);
|
|
2490
2490
|
} else if (s2.length >= 2 && s2.charCodeAt(1) === 58) {
|
|
2491
|
-
let
|
|
2492
|
-
|
|
2491
|
+
let t4 = s2.charCodeAt(0);
|
|
2492
|
+
t4 >= 65 && t4 <= 90 && (s2 = `${String.fromCharCode(t4 + 32)}:${s2.substr(2)}`);
|
|
2493
2493
|
}
|
|
2494
2494
|
n3 += r3(s2, !0, !1);
|
|
2495
2495
|
}
|
|
2496
2496
|
return a2 && (n3 += "?", n3 += r3(a2, !1, !1)), h2 && (n3 += "#", n3 += e3 ? h2 : g(h2, !1, !1)), n3;
|
|
2497
2497
|
}
|
|
2498
|
-
function b(
|
|
2498
|
+
function b(t3) {
|
|
2499
2499
|
try {
|
|
2500
|
-
return decodeURIComponent(
|
|
2500
|
+
return decodeURIComponent(t3);
|
|
2501
2501
|
} catch {
|
|
2502
|
-
return
|
|
2502
|
+
return t3.length > 3 ? t3.substr(0, 3) + b(t3.substr(3)) : t3;
|
|
2503
2503
|
}
|
|
2504
2504
|
}
|
|
2505
2505
|
e2.uriToFsPath = v;
|
|
2506
2506
|
let C = /(%[0-9A-Za-z][0-9A-Za-z])+/g;
|
|
2507
|
-
function w(
|
|
2508
|
-
return
|
|
2507
|
+
function w(t3) {
|
|
2508
|
+
return t3.match(C) ? t3.replace(C, ((t4) => b(t4))) : t3;
|
|
2509
2509
|
}
|
|
2510
|
-
}, 552: function(
|
|
2511
|
-
var n2 = this && this.__createBinding || (Object.create ? function(
|
|
2510
|
+
}, 552: function(t2, e2, r2) {
|
|
2511
|
+
var n2 = this && this.__createBinding || (Object.create ? function(t3, e3, r3, n3) {
|
|
2512
2512
|
n3 === void 0 && (n3 = r3);
|
|
2513
2513
|
var i3 = Object.getOwnPropertyDescriptor(e3, r3);
|
|
2514
2514
|
i3 && !("get" in i3 ? !e3.__esModule : i3.writable || i3.configurable) || (i3 = { enumerable: !0, get: function() {
|
|
2515
2515
|
return e3[r3];
|
|
2516
|
-
} }), Object.defineProperty(
|
|
2517
|
-
} : function(
|
|
2518
|
-
n3 === void 0 && (n3 = r3),
|
|
2519
|
-
}), i2 = this && this.__setModuleDefault || (Object.create ? function(
|
|
2520
|
-
Object.defineProperty(
|
|
2521
|
-
} : function(
|
|
2522
|
-
|
|
2523
|
-
}), o = this && this.__importStar || function(
|
|
2524
|
-
if (
|
|
2516
|
+
} }), Object.defineProperty(t3, n3, i3);
|
|
2517
|
+
} : function(t3, e3, r3, n3) {
|
|
2518
|
+
n3 === void 0 && (n3 = r3), t3[n3] = e3[r3];
|
|
2519
|
+
}), i2 = this && this.__setModuleDefault || (Object.create ? function(t3, e3) {
|
|
2520
|
+
Object.defineProperty(t3, "default", { enumerable: !0, value: e3 });
|
|
2521
|
+
} : function(t3, e3) {
|
|
2522
|
+
t3.default = e3;
|
|
2523
|
+
}), o = this && this.__importStar || function(t3) {
|
|
2524
|
+
if (t3 && t3.__esModule) return t3;
|
|
2525
2525
|
var e3 = {};
|
|
2526
|
-
if (
|
|
2527
|
-
return i2(e3,
|
|
2526
|
+
if (t3 != null) for (var r3 in t3) r3 !== "default" && Object.prototype.hasOwnProperty.call(t3, r3) && n2(e3, t3, r3);
|
|
2527
|
+
return i2(e3, t3), e3;
|
|
2528
2528
|
};
|
|
2529
2529
|
Object.defineProperty(e2, "__esModule", { value: !0 }), e2.Utils = void 0;
|
|
2530
2530
|
let s = o(r2(975)), a = s.posix || s, h = "/";
|
|
2531
2531
|
var c;
|
|
2532
|
-
(function(
|
|
2533
|
-
|
|
2534
|
-
return
|
|
2535
|
-
},
|
|
2536
|
-
let r3 =
|
|
2532
|
+
(function(t3) {
|
|
2533
|
+
t3.joinPath = function(t4, ...e3) {
|
|
2534
|
+
return t4.with({ path: a.join(t4.path, ...e3) });
|
|
2535
|
+
}, t3.resolvePath = function(t4, ...e3) {
|
|
2536
|
+
let r3 = t4.path, n3 = !1;
|
|
2537
2537
|
r3[0] !== h && (r3 = h + r3, n3 = !0);
|
|
2538
2538
|
let i3 = a.resolve(r3, ...e3);
|
|
2539
|
-
return n3 && i3[0] === h && !
|
|
2540
|
-
},
|
|
2541
|
-
if (
|
|
2542
|
-
let e3 = a.dirname(
|
|
2543
|
-
return e3.length === 1 && e3.charCodeAt(0) === 46 && (e3 = ""),
|
|
2544
|
-
},
|
|
2545
|
-
return a.basename(
|
|
2546
|
-
},
|
|
2547
|
-
return a.extname(
|
|
2539
|
+
return n3 && i3[0] === h && !t4.authority && (i3 = i3.substring(1)), t4.with({ path: i3 });
|
|
2540
|
+
}, t3.dirname = function(t4) {
|
|
2541
|
+
if (t4.path.length === 0 || t4.path === h) return t4;
|
|
2542
|
+
let e3 = a.dirname(t4.path);
|
|
2543
|
+
return e3.length === 1 && e3.charCodeAt(0) === 46 && (e3 = ""), t4.with({ path: e3 });
|
|
2544
|
+
}, t3.basename = function(t4) {
|
|
2545
|
+
return a.basename(t4.path);
|
|
2546
|
+
}, t3.extname = function(t4) {
|
|
2547
|
+
return a.extname(t4.path);
|
|
2548
2548
|
};
|
|
2549
2549
|
})(c || (e2.Utils = c = {}));
|
|
2550
2550
|
} }, e = {};
|
|
@@ -2552,18 +2552,18 @@ var require_umd = __commonJS({
|
|
|
2552
2552
|
var i2 = e[n2];
|
|
2553
2553
|
if (i2 !== void 0) return i2.exports;
|
|
2554
2554
|
var o = e[n2] = { exports: {} };
|
|
2555
|
-
return
|
|
2555
|
+
return t[n2].call(o.exports, o, o.exports, r), o.exports;
|
|
2556
2556
|
}
|
|
2557
2557
|
var n = {};
|
|
2558
2558
|
return (() => {
|
|
2559
|
-
var
|
|
2560
|
-
Object.defineProperty(
|
|
2559
|
+
var t2 = n;
|
|
2560
|
+
Object.defineProperty(t2, "__esModule", { value: !0 }), t2.Utils = t2.URI = void 0;
|
|
2561
2561
|
let e2 = r(231);
|
|
2562
|
-
Object.defineProperty(
|
|
2562
|
+
Object.defineProperty(t2, "URI", { enumerable: !0, get: function() {
|
|
2563
2563
|
return e2.URI;
|
|
2564
2564
|
} });
|
|
2565
2565
|
let i2 = r(552);
|
|
2566
|
-
Object.defineProperty(
|
|
2566
|
+
Object.defineProperty(t2, "Utils", { enumerable: !0, get: function() {
|
|
2567
2567
|
return i2.Utils;
|
|
2568
2568
|
} });
|
|
2569
2569
|
})(), n;
|
|
@@ -6167,7 +6167,7 @@ __export(acorn_exports, {
|
|
|
6167
6167
|
lineBreak: () => lineBreak,
|
|
6168
6168
|
lineBreakG: () => lineBreakG,
|
|
6169
6169
|
nonASCIIwhitespace: () => nonASCIIwhitespace,
|
|
6170
|
-
parse: () =>
|
|
6170
|
+
parse: () => parse4,
|
|
6171
6171
|
parseExpressionAt: () => parseExpressionAt2,
|
|
6172
6172
|
tokContexts: () => types,
|
|
6173
6173
|
tokTypes: () => types$1,
|
|
@@ -6335,7 +6335,7 @@ function stringToNumber(str, isLegacyOctalNumericLiteral) {
|
|
|
6335
6335
|
function stringToBigInt(str) {
|
|
6336
6336
|
return typeof BigInt != "function" ? null : BigInt(str.replace(/_/g, ""));
|
|
6337
6337
|
}
|
|
6338
|
-
function
|
|
6338
|
+
function parse4(input, options) {
|
|
6339
6339
|
return Parser.parse(input, options);
|
|
6340
6340
|
}
|
|
6341
6341
|
function parseExpressionAt2(input, pos, options) {
|
|
@@ -7825,7 +7825,7 @@ var astralIdentifierCodes, astralIdentifierStartCodes, nonASCIIidentifierChars,
|
|
|
7825
7825
|
var oldYieldPos = this.yieldPos, oldAwaitPos = this.awaitPos, oldAwaitIdentPos = this.awaitIdentPos;
|
|
7826
7826
|
return this.enterScope(functionFlags(isAsync, !1) | SCOPE_ARROW), this.initFunction(node), this.options.ecmaVersion >= 8 && (node.async = !!isAsync), this.yieldPos = 0, this.awaitPos = 0, this.awaitIdentPos = 0, node.params = this.toAssignableList(params, !0), this.parseFunctionBody(node, !0, !1, forInit), this.yieldPos = oldYieldPos, this.awaitPos = oldAwaitPos, this.awaitIdentPos = oldAwaitIdentPos, this.finishNode(node, "ArrowFunctionExpression");
|
|
7827
7827
|
};
|
|
7828
|
-
pp$5.parseFunctionBody = function(node, isArrowFunction,
|
|
7828
|
+
pp$5.parseFunctionBody = function(node, isArrowFunction, isMethod2, forInit) {
|
|
7829
7829
|
var isExpression = isArrowFunction && this.type !== types$1.braceL, oldStrict = this.strict, useStrict = !1;
|
|
7830
7830
|
if (isExpression)
|
|
7831
7831
|
node.body = this.parseMaybeAssign(forInit), node.expression = !0, this.checkParams(node, !1);
|
|
@@ -7833,7 +7833,7 @@ var astralIdentifierCodes, astralIdentifierStartCodes, nonASCIIidentifierChars,
|
|
|
7833
7833
|
var nonSimple = this.options.ecmaVersion >= 7 && !this.isSimpleParamList(node.params);
|
|
7834
7834
|
(!oldStrict || nonSimple) && (useStrict = this.strictDirective(this.end), useStrict && nonSimple && this.raiseRecoverable(node.start, "Illegal 'use strict' directive in function with non-simple parameter list"));
|
|
7835
7835
|
var oldLabels = this.labels;
|
|
7836
|
-
this.labels = [], useStrict && (this.strict = !0), this.checkParams(node, !oldStrict && !useStrict && !isArrowFunction && !
|
|
7836
|
+
this.labels = [], useStrict && (this.strict = !0), this.checkParams(node, !oldStrict && !useStrict && !isArrowFunction && !isMethod2 && this.isSimpleParamList(node.params)), this.strict && node.id && this.checkLValSimple(node.id, BIND_OUTSIDE), node.body = this.parseBlock(!1, void 0, useStrict && !oldStrict), node.expression = !1, this.adaptDirectivePrologue(node.body.body), this.labels = oldLabels;
|
|
7837
7837
|
}
|
|
7838
7838
|
this.exitScope();
|
|
7839
7839
|
};
|
|
@@ -10235,12 +10235,12 @@ var require_dist2 = __commonJS({
|
|
|
10235
10235
|
"../../../node_modules/@base2/pretty-print-object/dist/index.js"(exports) {
|
|
10236
10236
|
"use strict";
|
|
10237
10237
|
var __assign = exports && exports.__assign || function() {
|
|
10238
|
-
return __assign = Object.assign || function(
|
|
10238
|
+
return __assign = Object.assign || function(t) {
|
|
10239
10239
|
for (var s, i2 = 1, n = arguments.length; i2 < n; i2++) {
|
|
10240
10240
|
s = arguments[i2];
|
|
10241
|
-
for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && (
|
|
10241
|
+
for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && (t[p] = s[p]);
|
|
10242
10242
|
}
|
|
10243
|
-
return
|
|
10243
|
+
return t;
|
|
10244
10244
|
}, __assign.apply(this, arguments);
|
|
10245
10245
|
}, __spreadArrays = exports && exports.__spreadArrays || function() {
|
|
10246
10246
|
for (var s = 0, i2 = 0, il = arguments.length; i2 < il; i2++) s += arguments[i2].length;
|
|
@@ -10331,7 +10331,7 @@ var require_dist2 = __commonJS({
|
|
|
10331
10331
|
var require_react_is_production_min = __commonJS({
|
|
10332
10332
|
"../../../node_modules/react-element-to-jsx-string/node_modules/react-is/cjs/react-is.production.min.js"(exports) {
|
|
10333
10333
|
"use strict";
|
|
10334
|
-
var b = /* @__PURE__ */ Symbol.for("react.element"), c = /* @__PURE__ */ Symbol.for("react.portal"), d = /* @__PURE__ */ Symbol.for("react.fragment"), e = /* @__PURE__ */ Symbol.for("react.strict_mode"), f = /* @__PURE__ */ Symbol.for("react.profiler"), g = /* @__PURE__ */ Symbol.for("react.provider"), h = /* @__PURE__ */ Symbol.for("react.context"), k = /* @__PURE__ */ Symbol.for("react.server_context"), l = /* @__PURE__ */ Symbol.for("react.forward_ref"), m = /* @__PURE__ */ Symbol.for("react.suspense"), n = /* @__PURE__ */ Symbol.for("react.suspense_list"), p = /* @__PURE__ */ Symbol.for("react.memo"), q = /* @__PURE__ */ Symbol.for("react.lazy"),
|
|
10334
|
+
var b = /* @__PURE__ */ Symbol.for("react.element"), c = /* @__PURE__ */ Symbol.for("react.portal"), d = /* @__PURE__ */ Symbol.for("react.fragment"), e = /* @__PURE__ */ Symbol.for("react.strict_mode"), f = /* @__PURE__ */ Symbol.for("react.profiler"), g = /* @__PURE__ */ Symbol.for("react.provider"), h = /* @__PURE__ */ Symbol.for("react.context"), k = /* @__PURE__ */ Symbol.for("react.server_context"), l = /* @__PURE__ */ Symbol.for("react.forward_ref"), m = /* @__PURE__ */ Symbol.for("react.suspense"), n = /* @__PURE__ */ Symbol.for("react.suspense_list"), p = /* @__PURE__ */ Symbol.for("react.memo"), q = /* @__PURE__ */ Symbol.for("react.lazy"), t = /* @__PURE__ */ Symbol.for("react.offscreen"), u;
|
|
10335
10335
|
u = /* @__PURE__ */ Symbol.for("react.module.reference");
|
|
10336
10336
|
function v(a) {
|
|
10337
10337
|
if (typeof a == "object" && a !== null) {
|
|
@@ -10418,7 +10418,7 @@ var require_react_is_production_min = __commonJS({
|
|
|
10418
10418
|
return v(a) === n;
|
|
10419
10419
|
};
|
|
10420
10420
|
exports.isValidElementType = function(a) {
|
|
10421
|
-
return typeof a == "string" || typeof a == "function" || a === d || a === f || a === e || a === m || a === n || a ===
|
|
10421
|
+
return typeof a == "string" || typeof a == "function" || a === d || a === f || a === e || a === m || a === n || a === t || typeof a == "object" && a !== null && (a.$$typeof === q || a.$$typeof === p || a.$$typeof === g || a.$$typeof === h || a.$$typeof === l || a.$$typeof === u || a.getModuleId !== void 0);
|
|
10422
10422
|
};
|
|
10423
10423
|
exports.typeOf = v;
|
|
10424
10424
|
}
|
|
@@ -11655,12 +11655,12 @@ var require_tsconfig_loader = __commonJS({
|
|
|
11655
11655
|
"../../../node_modules/tsconfig-paths/lib/tsconfig-loader.js"(exports) {
|
|
11656
11656
|
"use strict";
|
|
11657
11657
|
var __assign = exports && exports.__assign || function() {
|
|
11658
|
-
return __assign = Object.assign || function(
|
|
11658
|
+
return __assign = Object.assign || function(t) {
|
|
11659
11659
|
for (var s, i2 = 1, n = arguments.length; i2 < n; i2++) {
|
|
11660
11660
|
s = arguments[i2];
|
|
11661
|
-
for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && (
|
|
11661
|
+
for (var p in s) Object.prototype.hasOwnProperty.call(s, p) && (t[p] = s[p]);
|
|
11662
11662
|
}
|
|
11663
|
-
return
|
|
11663
|
+
return t;
|
|
11664
11664
|
}, __assign.apply(this, arguments);
|
|
11665
11665
|
};
|
|
11666
11666
|
Object.defineProperty(exports, "__esModule", { value: !0 });
|
|
@@ -13444,9 +13444,9 @@ function serializeType(typescript, checker, type, isRequired, depth = 0) {
|
|
|
13444
13444
|
return { name: checker.typeToString(type) };
|
|
13445
13445
|
if (type.isUnion()) {
|
|
13446
13446
|
let nonUndefinedTypes = type.types.filter(
|
|
13447
|
-
(
|
|
13447
|
+
(t) => !(t.getFlags() & typescript.TypeFlags.Undefined)
|
|
13448
13448
|
), booleanLiterals = nonUndefinedTypes.filter(
|
|
13449
|
-
(
|
|
13449
|
+
(t) => t.getFlags() & typescript.TypeFlags.BooleanLiteral
|
|
13450
13450
|
);
|
|
13451
13451
|
if (booleanLiterals.length === 2 && booleanLiterals.length === nonUndefinedTypes.length)
|
|
13452
13452
|
return { name: "boolean" };
|
|
@@ -14097,12 +14097,6 @@ function createReactProjectFactory(typescript) {
|
|
|
14097
14097
|
}
|
|
14098
14098
|
};
|
|
14099
14099
|
}
|
|
14100
|
-
function assertTypeScriptCompilerApi(typescript) {
|
|
14101
|
-
if (typeof typescript?.sys?.fileExists != "function")
|
|
14102
|
-
throw new Error(
|
|
14103
|
-
"The resolved `typescript` package does not expose the compiler API (`ts.sys` is undefined). This happens when `typescript` resolves to a build without the full API, such as the TypeScript 7 native-preview package. Component metadata extraction requires a standard TypeScript installation."
|
|
14104
|
-
);
|
|
14105
|
-
}
|
|
14106
14100
|
var ComponentMetaManager = class extends BaseComponentMetaManager {
|
|
14107
14101
|
/**
|
|
14108
14102
|
* @param recycleHeapPressureRatio Fraction of the V8 heap limit at which the shared program(s)
|
|
@@ -14110,7 +14104,6 @@ var ComponentMetaManager = class extends BaseComponentMetaManager {
|
|
|
14110
14104
|
* to disable recycling and assert the OOM still happens without the fix.
|
|
14111
14105
|
*/
|
|
14112
14106
|
constructor(typescript, recycleHeapPressureRatio) {
|
|
14113
|
-
assertTypeScriptCompilerApi(typescript);
|
|
14114
14107
|
let { factory, fsFileSnapshots } = createReactProjectFactory(typescript);
|
|
14115
14108
|
super(typescript, factory, recycleHeapPressureRatio), this.fsFileSnapshots = fsFileSnapshots;
|
|
14116
14109
|
}
|
|
@@ -14135,6 +14128,296 @@ var ComponentMetaManager = class extends BaseComponentMetaManager {
|
|
|
14135
14128
|
}
|
|
14136
14129
|
};
|
|
14137
14130
|
|
|
14131
|
+
// ../../../node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
|
|
14132
|
+
var _lazyMatch = () => {
|
|
14133
|
+
var __lib__ = (() => {
|
|
14134
|
+
var m = Object.defineProperty, V = Object.getOwnPropertyDescriptor, G = Object.getOwnPropertyNames, T = Object.prototype.hasOwnProperty, q = (r, e) => {
|
|
14135
|
+
for (var n in e) m(r, n, { get: e[n], enumerable: !0 });
|
|
14136
|
+
}, H = (r, e, n, a) => {
|
|
14137
|
+
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 });
|
|
14138
|
+
return r;
|
|
14139
|
+
}, J = (r) => H(m({}, "__esModule", { value: !0 }), r), w = {};
|
|
14140
|
+
q(w, { default: () => re });
|
|
14141
|
+
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) => {
|
|
14142
|
+
let e = /* @__PURE__ */ new Map();
|
|
14143
|
+
return (n) => {
|
|
14144
|
+
let a = e.get(n);
|
|
14145
|
+
if (a) return a;
|
|
14146
|
+
let t = r(n);
|
|
14147
|
+
return e.set(n, t), t;
|
|
14148
|
+
};
|
|
14149
|
+
}, rr = (r, e, n = {}) => {
|
|
14150
|
+
let a = { cache: {}, input: r, index: 0, indexMax: 0, options: n, output: [] };
|
|
14151
|
+
if (v(e)(a) && a.index === r.length) return a.output;
|
|
14152
|
+
throw new Error(`Failed to parse at index ${a.indexMax}`);
|
|
14153
|
+
}, i2 = (r, e) => A(r) ? er(r, e) : b(r) ? ar(r, e) : nr(r, e), er = (r, e) => {
|
|
14154
|
+
let n = {};
|
|
14155
|
+
for (let a of r) {
|
|
14156
|
+
if (a.length !== 1) throw new Error(`Invalid character: "${a}"`);
|
|
14157
|
+
let t = a.charCodeAt(0);
|
|
14158
|
+
n[t] = !0;
|
|
14159
|
+
}
|
|
14160
|
+
return (a) => {
|
|
14161
|
+
let t = a.index, o = a.input;
|
|
14162
|
+
for (; a.index < o.length && o.charCodeAt(a.index) in n; ) a.index += 1;
|
|
14163
|
+
let u = a.index;
|
|
14164
|
+
if (u > t) {
|
|
14165
|
+
if (!h(e) && !a.options.silent) {
|
|
14166
|
+
let s = a.input.slice(t, u), c = d(e) ? e(s, o, String(t)) : e;
|
|
14167
|
+
h(c) || a.output.push(c);
|
|
14168
|
+
}
|
|
14169
|
+
a.indexMax = Math.max(a.indexMax, a.index);
|
|
14170
|
+
}
|
|
14171
|
+
return !0;
|
|
14172
|
+
};
|
|
14173
|
+
}, nr = (r, e) => {
|
|
14174
|
+
let n = r.source, a = r.flags.replace(/y|$/, "y"), t = new RegExp(n, a);
|
|
14175
|
+
return g((o) => {
|
|
14176
|
+
t.lastIndex = o.index;
|
|
14177
|
+
let u = t.exec(o.input);
|
|
14178
|
+
if (u) {
|
|
14179
|
+
if (!h(e) && !o.options.silent) {
|
|
14180
|
+
let s = d(e) ? e(...u, o.input, String(o.index)) : e;
|
|
14181
|
+
h(s) || o.output.push(s);
|
|
14182
|
+
}
|
|
14183
|
+
return o.index += u[0].length, o.indexMax = Math.max(o.indexMax, o.index), !0;
|
|
14184
|
+
} else return !1;
|
|
14185
|
+
});
|
|
14186
|
+
}, ar = (r, e) => (n) => {
|
|
14187
|
+
if (n.input.startsWith(r, n.index)) {
|
|
14188
|
+
if (!h(e) && !n.options.silent) {
|
|
14189
|
+
let t = d(e) ? e(r, n.input, String(n.index)) : e;
|
|
14190
|
+
h(t) || n.output.push(t);
|
|
14191
|
+
}
|
|
14192
|
+
return n.index += r.length, n.indexMax = Math.max(n.indexMax, n.index), !0;
|
|
14193
|
+
} else return !1;
|
|
14194
|
+
}, C = (r, e, n, a) => {
|
|
14195
|
+
let t = v(r);
|
|
14196
|
+
return g(_(M((o) => {
|
|
14197
|
+
let u = 0;
|
|
14198
|
+
for (; u < n; ) {
|
|
14199
|
+
let s = o.index;
|
|
14200
|
+
if (!t(o) || (u += 1, o.index === s)) break;
|
|
14201
|
+
}
|
|
14202
|
+
return u >= e;
|
|
14203
|
+
})));
|
|
14204
|
+
}, tr = (r, e) => C(r, 0, 1), f = (r, e) => C(r, 0, 1 / 0), x = (r, e) => {
|
|
14205
|
+
let n = r.map(v);
|
|
14206
|
+
return g(_(M((a) => {
|
|
14207
|
+
for (let t = 0, o = n.length; t < o; t++) if (!n[t](a)) return !1;
|
|
14208
|
+
return !0;
|
|
14209
|
+
})));
|
|
14210
|
+
}, l = (r, e) => {
|
|
14211
|
+
let n = r.map(v);
|
|
14212
|
+
return g(_((a) => {
|
|
14213
|
+
for (let t = 0, o = n.length; t < o; t++) if (n[t](a)) return !0;
|
|
14214
|
+
return !1;
|
|
14215
|
+
}));
|
|
14216
|
+
}, M = (r, e = !1) => {
|
|
14217
|
+
let n = v(r);
|
|
14218
|
+
return (a) => {
|
|
14219
|
+
let t = a.index, o = a.output.length, u = n(a);
|
|
14220
|
+
return (!u || e) && (a.index = t, a.output.length !== o && (a.output.length = o)), u;
|
|
14221
|
+
};
|
|
14222
|
+
}, _ = (r, e) => v(r), g = /* @__PURE__ */ (() => {
|
|
14223
|
+
let r = 0;
|
|
14224
|
+
return (e) => {
|
|
14225
|
+
let n = v(e), a = r += 1;
|
|
14226
|
+
return (t) => {
|
|
14227
|
+
var o;
|
|
14228
|
+
if (t.options.memoization === !1) return n(t);
|
|
14229
|
+
let u = t.index, s = (o = t.cache)[a] || (o[a] = /* @__PURE__ */ new Map()), c = s.get(u);
|
|
14230
|
+
if (c === !1) return !1;
|
|
14231
|
+
if (W(c)) return t.index = c, !0;
|
|
14232
|
+
if (c) return t.index = c.index, c.output?.length && t.output.push(...c.output), !0;
|
|
14233
|
+
{
|
|
14234
|
+
let Z = t.output.length;
|
|
14235
|
+
if (n(t)) {
|
|
14236
|
+
let D = t.index, U = t.output.length;
|
|
14237
|
+
if (U > Z) {
|
|
14238
|
+
let ee = t.output.slice(Z, U);
|
|
14239
|
+
s.set(u, { index: D, output: ee });
|
|
14240
|
+
} else s.set(u, D);
|
|
14241
|
+
return !0;
|
|
14242
|
+
} else return s.set(u, !1), !1;
|
|
14243
|
+
}
|
|
14244
|
+
};
|
|
14245
|
+
};
|
|
14246
|
+
})(), E = (r) => {
|
|
14247
|
+
let e;
|
|
14248
|
+
return (n) => (e || (e = v(r())), e(n));
|
|
14249
|
+
}, v = Y((r) => {
|
|
14250
|
+
if (d(r)) return Q(r) ? E(r) : r;
|
|
14251
|
+
if (b(r) || X(r)) return i2(r);
|
|
14252
|
+
if (A(r)) return x(r);
|
|
14253
|
+
if (K(r)) return l(Object.values(r));
|
|
14254
|
+
throw new Error("Invalid rule");
|
|
14255
|
+
}), P = "abcdefghijklmnopqrstuvwxyz", ir = (r) => {
|
|
14256
|
+
let e = "";
|
|
14257
|
+
for (; r > 0; ) {
|
|
14258
|
+
let n = (r - 1) % 26;
|
|
14259
|
+
e = P[n] + e, r = Math.floor((r - 1) / 26);
|
|
14260
|
+
}
|
|
14261
|
+
return e;
|
|
14262
|
+
}, O = (r) => {
|
|
14263
|
+
let e = 0;
|
|
14264
|
+
for (let n = 0, a = r.length; n < a; n++) e = e * 26 + P.indexOf(r[n]) + 1;
|
|
14265
|
+
return e;
|
|
14266
|
+
}, S = (r, e) => {
|
|
14267
|
+
if (e < r) return S(e, r);
|
|
14268
|
+
let n = [];
|
|
14269
|
+
for (; r <= e; ) n.push(r++);
|
|
14270
|
+
return n;
|
|
14271
|
+
}, 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) => {
|
|
14272
|
+
let e = {};
|
|
14273
|
+
return (n) => e[n] ?? (e[n] = r(n));
|
|
14274
|
+
}, sr = i2(/^\*\*\/\*$/, ".*"), cr = i2(/^\*\*\/(\*)?([ a-zA-Z0-9._-]+)$/, (r, e, n) => `.*${e ? "" : "(?:^|/)"}${n.replaceAll(".", "\\.")}`), lr = i2(/^\*\*\/(\*)?([ a-zA-Z0-9._-]*)\{([ a-zA-Z0-9._-]+(?:,[ a-zA-Z0-9._-]+)*)\}$/, (r, e, n, a) => `.*${e ? "" : "(?:^|/)"}${n.replaceAll(".", "\\.")}(?:${a.replaceAll(",", "|").replaceAll(".", "\\.")})`), y = i2(/\\./, p), pr = i2(/[$.*+?^(){}[\]\|]/, (r) => `\\${r}`), vr = i2(/./, p), hr = i2(/^(?:!!)*!(.*)$/, (r, e) => `(?!^${L(e)}$).*?`), dr = i2(/^(!!)+/, ""), fr = l([hr, dr]), xr = i2(/\/(\*\*\/)+/, "(?:/.+/|/)"), gr = i2(/^(\*\*\/)+/, "(?:^|.*/)"), mr = i2(/\/(\*\*)$/, "(?:/.*|$)"), _r = i2(/\*\*/, ".*"), j = l([xr, gr, mr, _r]), Sr = i2(/\*\/(?!\*\*\/)/, "[^/]*/"), yr = i2(/\*/, "[^/]*"), N = l([Sr, yr]), k = i2("?", "[^/]"), $r = i2("[", p), wr = i2("]", p), Ar = i2(/[!^]/, "^/"), br = i2(/[a-z]-[a-z]|[0-9]-[0-9]/i, p), Cr = i2(/[$.*+?^(){}[\|]/, (r) => `\\${r}`), Mr = i2(/[^\]]/, p), Er = l([y, Cr, br, Mr]), B = x([$r, tr(Ar), f(Er), wr]), Pr = i2("{", "(?:"), Or = i2("}", ")"), Rr = i2(/(\d+)\.\.(\d+)/, (r, e, n) => or(+e, +n, Math.min(e.length, n.length)).join("|")), zr = i2(/([a-z]+)\.\.([a-z]+)/, (r, e, n) => R(e, n).join("|")), jr = i2(/([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 = i2("{", "(?:"), Br = i2("}", ")"), Ir = i2(",", "|"), Fr = i2(/[$.*+?^(){[\]\|]/, (r) => `\\${r}`), Lr = i2(/[^}]/, 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 = i2(/\\./, p), qr = i2(/./, p), Hr = i2(/\*\*\*+/, "*"), Jr = i2(/([^/{[(!])\*\*/, (r, e) => `${e}*`), Qr = i2(/(^|.)\*\*(?=[^*/)\]}])/, (r, e) => `${e}*`), Wr = f(l([Tr, Hr, Jr, Qr, qr])), Kr = Wr, Xr = z(Kr), Yr = Xr, $ = (r, e) => {
|
|
14275
|
+
let n = Array.isArray(r) ? r : [r];
|
|
14276
|
+
if (!n.length) return !1;
|
|
14277
|
+
let a = n.map($.compile), t = n.every((s) => /(\/(?:\*\*)?|\[\/\])$/.test(s)), o = e.replace(/[\\\/]+/g, "/").replace(/\/$/, t ? "/" : "");
|
|
14278
|
+
return a.some((s) => s.test(o));
|
|
14279
|
+
};
|
|
14280
|
+
$.compile = (r) => new RegExp(`^${L(Yr(r))}$`, "s");
|
|
14281
|
+
var re = $;
|
|
14282
|
+
return J(w);
|
|
14283
|
+
})();
|
|
14284
|
+
return __lib__.default || __lib__;
|
|
14285
|
+
}, _match, zeptomatch = (path2, pattern) => (_match || (_match = _lazyMatch(), _lazyMatch = null), _match(path2, pattern)), _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
14286
|
+
function normalizeWindowsPath(input = "") {
|
|
14287
|
+
return input && input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
|
|
14288
|
+
}
|
|
14289
|
+
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) {
|
|
14290
|
+
if (path2.length === 0)
|
|
14291
|
+
return ".";
|
|
14292
|
+
path2 = normalizeWindowsPath(path2);
|
|
14293
|
+
let isUNCPath = path2.match(_UNC_REGEX), isPathAbsolute = isAbsolute2(path2), trailingSeparator = path2[path2.length - 1] === "/";
|
|
14294
|
+
return path2 = normalizeString(path2, !isPathAbsolute), path2.length === 0 ? isPathAbsolute ? "/" : trailingSeparator ? "./" : "." : (trailingSeparator && (path2 += "/"), _DRIVE_LETTER_RE.test(path2) && (path2 += "/"), isUNCPath ? isPathAbsolute ? `//${path2}` : `//./${path2}` : isPathAbsolute && !isAbsolute2(path2) ? `/${path2}` : path2);
|
|
14295
|
+
}, join3 = function(...segments) {
|
|
14296
|
+
let path2 = "";
|
|
14297
|
+
for (let seg of segments)
|
|
14298
|
+
if (seg)
|
|
14299
|
+
if (path2.length > 0) {
|
|
14300
|
+
let pathTrailing = path2[path2.length - 1] === "/", segLeading = seg[0] === "/";
|
|
14301
|
+
pathTrailing && segLeading ? path2 += seg.slice(1) : path2 += pathTrailing || segLeading ? seg : `/${seg}`;
|
|
14302
|
+
} else
|
|
14303
|
+
path2 += seg;
|
|
14304
|
+
return normalize(path2);
|
|
14305
|
+
};
|
|
14306
|
+
function cwd() {
|
|
14307
|
+
return typeof process < "u" && typeof process.cwd == "function" ? process.cwd().replace(/\\/g, "/") : "/";
|
|
14308
|
+
}
|
|
14309
|
+
var resolve2 = function(...arguments_) {
|
|
14310
|
+
arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
|
|
14311
|
+
let resolvedPath = "", resolvedAbsolute = !1;
|
|
14312
|
+
for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
|
|
14313
|
+
let path2 = index >= 0 ? arguments_[index] : cwd();
|
|
14314
|
+
!path2 || path2.length === 0 || (resolvedPath = `${path2}/${resolvedPath}`, resolvedAbsolute = isAbsolute2(path2));
|
|
14315
|
+
}
|
|
14316
|
+
return resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute), resolvedAbsolute && !isAbsolute2(resolvedPath) ? `/${resolvedPath}` : resolvedPath.length > 0 ? resolvedPath : ".";
|
|
14317
|
+
};
|
|
14318
|
+
function normalizeString(path2, allowAboveRoot) {
|
|
14319
|
+
let res = "", lastSegmentLength = 0, lastSlash = -1, dots = 0, char = null;
|
|
14320
|
+
for (let index = 0; index <= path2.length; ++index) {
|
|
14321
|
+
if (index < path2.length)
|
|
14322
|
+
char = path2[index];
|
|
14323
|
+
else {
|
|
14324
|
+
if (char === "/")
|
|
14325
|
+
break;
|
|
14326
|
+
char = "/";
|
|
14327
|
+
}
|
|
14328
|
+
if (char === "/") {
|
|
14329
|
+
if (!(lastSlash === index - 1 || dots === 1)) if (dots === 2) {
|
|
14330
|
+
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
|
14331
|
+
if (res.length > 2) {
|
|
14332
|
+
let lastSlashIndex = res.lastIndexOf("/");
|
|
14333
|
+
lastSlashIndex === -1 ? (res = "", lastSegmentLength = 0) : (res = res.slice(0, lastSlashIndex), lastSegmentLength = res.length - 1 - res.lastIndexOf("/")), lastSlash = index, dots = 0;
|
|
14334
|
+
continue;
|
|
14335
|
+
} else if (res.length > 0) {
|
|
14336
|
+
res = "", lastSegmentLength = 0, lastSlash = index, dots = 0;
|
|
14337
|
+
continue;
|
|
14338
|
+
}
|
|
14339
|
+
}
|
|
14340
|
+
allowAboveRoot && (res += res.length > 0 ? "/.." : "..", lastSegmentLength = 2);
|
|
14341
|
+
} else
|
|
14342
|
+
res.length > 0 ? res += `/${path2.slice(lastSlash + 1, index)}` : res = path2.slice(lastSlash + 1, index), lastSegmentLength = index - lastSlash - 1;
|
|
14343
|
+
lastSlash = index, dots = 0;
|
|
14344
|
+
} else char === "." && dots !== -1 ? ++dots : dots = -1;
|
|
14345
|
+
}
|
|
14346
|
+
return res;
|
|
14347
|
+
}
|
|
14348
|
+
var isAbsolute2 = function(p) {
|
|
14349
|
+
return _IS_ABSOLUTE_RE.test(p);
|
|
14350
|
+
}, toNamespacedPath = function(p) {
|
|
14351
|
+
return normalizeWindowsPath(p);
|
|
14352
|
+
}, extname = function(p) {
|
|
14353
|
+
if (p === "..") return "";
|
|
14354
|
+
let match = _EXTNAME_RE.exec(normalizeWindowsPath(p));
|
|
14355
|
+
return match && match[1] || "";
|
|
14356
|
+
}, relative = function(from, to) {
|
|
14357
|
+
let _from = resolve2(from).replace(_ROOT_FOLDER_RE, "$1").split("/"), _to = resolve2(to).replace(_ROOT_FOLDER_RE, "$1").split("/");
|
|
14358
|
+
if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0])
|
|
14359
|
+
return _to.join("/");
|
|
14360
|
+
let _fromCopy = [..._from];
|
|
14361
|
+
for (let segment of _fromCopy) {
|
|
14362
|
+
if (_to[0] !== segment)
|
|
14363
|
+
break;
|
|
14364
|
+
_from.shift(), _to.shift();
|
|
14365
|
+
}
|
|
14366
|
+
return [..._from.map(() => ".."), ..._to].join("/");
|
|
14367
|
+
}, dirname3 = function(p) {
|
|
14368
|
+
let segments = normalizeWindowsPath(p).replace(/\/$/, "").split("/").slice(0, -1);
|
|
14369
|
+
return segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0]) && (segments[0] += "/"), segments.join("/") || (isAbsolute2(p) ? "/" : ".");
|
|
14370
|
+
}, format = function(p) {
|
|
14371
|
+
let ext = p.ext ? p.ext.startsWith(".") ? p.ext : `.${p.ext}` : "", segments = [p.root, p.dir, p.base ?? (p.name ?? "") + ext].filter(
|
|
14372
|
+
Boolean
|
|
14373
|
+
);
|
|
14374
|
+
return normalizeWindowsPath(
|
|
14375
|
+
p.root ? resolve2(...segments) : segments.join("/")
|
|
14376
|
+
);
|
|
14377
|
+
}, basename = function(p, extension) {
|
|
14378
|
+
let segments = normalizeWindowsPath(p).split("/"), lastSegment = "";
|
|
14379
|
+
for (let i2 = segments.length - 1; i2 >= 0; i2--) {
|
|
14380
|
+
let val = segments[i2];
|
|
14381
|
+
if (val) {
|
|
14382
|
+
lastSegment = val;
|
|
14383
|
+
break;
|
|
14384
|
+
}
|
|
14385
|
+
}
|
|
14386
|
+
return extension && lastSegment.endsWith(extension) ? lastSegment.slice(0, -extension.length) : lastSegment;
|
|
14387
|
+
}, parse = function(p) {
|
|
14388
|
+
let root = _PATH_ROOT_RE.exec(p)?.[0]?.replace(/\\/g, "/") || "", base2 = basename(p), extension = extname(base2);
|
|
14389
|
+
return {
|
|
14390
|
+
root,
|
|
14391
|
+
dir: dirname3(p),
|
|
14392
|
+
base: base2,
|
|
14393
|
+
ext: extension,
|
|
14394
|
+
name: base2.slice(0, base2.length - extension.length)
|
|
14395
|
+
};
|
|
14396
|
+
}, matchesGlob = (path2, pattern) => zeptomatch(pattern, normalize(path2)), _path = {
|
|
14397
|
+
__proto__: null,
|
|
14398
|
+
basename,
|
|
14399
|
+
dirname: dirname3,
|
|
14400
|
+
extname,
|
|
14401
|
+
format,
|
|
14402
|
+
isAbsolute: isAbsolute2,
|
|
14403
|
+
join: join3,
|
|
14404
|
+
matchesGlob,
|
|
14405
|
+
normalize,
|
|
14406
|
+
normalizeString,
|
|
14407
|
+
parse,
|
|
14408
|
+
relative,
|
|
14409
|
+
resolve: resolve2,
|
|
14410
|
+
sep,
|
|
14411
|
+
toNamespacedPath
|
|
14412
|
+
};
|
|
14413
|
+
|
|
14414
|
+
// ../../../node_modules/pathe/dist/index.mjs
|
|
14415
|
+
var delimiter = globalThis.process?.platform === "win32" ? ";" : ":", _platforms = { posix: void 0, win32: void 0 }, mix = (del = delimiter) => new Proxy(_path, {
|
|
14416
|
+
get(_, prop) {
|
|
14417
|
+
return prop === "delimiter" ? del : prop === "posix" ? posix : prop === "win32" ? win32 : _platforms[prop] || _path[prop];
|
|
14418
|
+
}
|
|
14419
|
+
}), posix = mix(":"), win32 = mix(";");
|
|
14420
|
+
|
|
14138
14421
|
// src/extractProps.ts
|
|
14139
14422
|
import {
|
|
14140
14423
|
TypeSystem,
|
|
@@ -14327,7 +14610,7 @@ function parseExpression(expression) {
|
|
|
14327
14610
|
return null;
|
|
14328
14611
|
}
|
|
14329
14612
|
}
|
|
14330
|
-
function
|
|
14613
|
+
function parse5(value) {
|
|
14331
14614
|
let ast = acornParser.parse(`(${value})`, { ecmaVersion: 2020 }), parsingResult = {
|
|
14332
14615
|
inferredType: { type: "Unknown" /* UNKNOWN */ },
|
|
14333
14616
|
ast
|
|
@@ -14345,7 +14628,7 @@ function parse4(value) {
|
|
|
14345
14628
|
// src/docs/lib/inspection/inspectValue.ts
|
|
14346
14629
|
function inspectValue(value) {
|
|
14347
14630
|
try {
|
|
14348
|
-
return { ...
|
|
14631
|
+
return { ...parse5(value) };
|
|
14349
14632
|
} catch {
|
|
14350
14633
|
}
|
|
14351
14634
|
return { inferredType: { type: "Unknown" /* UNKNOWN */ } };
|
|
@@ -14495,13 +14778,13 @@ function _arrayLikeToArray(r, a) {
|
|
|
14495
14778
|
function _arrayWithoutHoles(r) {
|
|
14496
14779
|
if (Array.isArray(r)) return _arrayLikeToArray(r);
|
|
14497
14780
|
}
|
|
14498
|
-
function _defineProperty(e, r,
|
|
14781
|
+
function _defineProperty(e, r, t) {
|
|
14499
14782
|
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
14500
|
-
value:
|
|
14783
|
+
value: t,
|
|
14501
14784
|
enumerable: !0,
|
|
14502
14785
|
configurable: !0,
|
|
14503
14786
|
writable: !0
|
|
14504
|
-
}) : e[r] =
|
|
14787
|
+
}) : e[r] = t, e;
|
|
14505
14788
|
}
|
|
14506
14789
|
function _iterableToArray(r) {
|
|
14507
14790
|
if (typeof Symbol < "u" && r[Symbol.iterator] != null || r["@@iterator"] != null) return Array.from(r);
|
|
@@ -14511,22 +14794,22 @@ function _nonIterableSpread() {
|
|
|
14511
14794
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`);
|
|
14512
14795
|
}
|
|
14513
14796
|
function ownKeys(e, r) {
|
|
14514
|
-
var
|
|
14797
|
+
var t = Object.keys(e);
|
|
14515
14798
|
if (Object.getOwnPropertySymbols) {
|
|
14516
14799
|
var o = Object.getOwnPropertySymbols(e);
|
|
14517
14800
|
r && (o = o.filter(function(r2) {
|
|
14518
14801
|
return Object.getOwnPropertyDescriptor(e, r2).enumerable;
|
|
14519
|
-
})),
|
|
14802
|
+
})), t.push.apply(t, o);
|
|
14520
14803
|
}
|
|
14521
|
-
return
|
|
14804
|
+
return t;
|
|
14522
14805
|
}
|
|
14523
14806
|
function _objectSpread2(e) {
|
|
14524
14807
|
for (var r = 1; r < arguments.length; r++) {
|
|
14525
|
-
var
|
|
14526
|
-
r % 2 ? ownKeys(Object(
|
|
14527
|
-
_defineProperty(e, r2,
|
|
14528
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(
|
|
14529
|
-
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(
|
|
14808
|
+
var t = arguments[r] != null ? arguments[r] : {};
|
|
14809
|
+
r % 2 ? ownKeys(Object(t), !0).forEach(function(r2) {
|
|
14810
|
+
_defineProperty(e, r2, t[r2]);
|
|
14811
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function(r2) {
|
|
14812
|
+
Object.defineProperty(e, r2, Object.getOwnPropertyDescriptor(t, r2));
|
|
14530
14813
|
});
|
|
14531
14814
|
}
|
|
14532
14815
|
return e;
|
|
@@ -14534,18 +14817,18 @@ function _objectSpread2(e) {
|
|
|
14534
14817
|
function _toConsumableArray(r) {
|
|
14535
14818
|
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
|
|
14536
14819
|
}
|
|
14537
|
-
function _toPrimitive(
|
|
14538
|
-
if (typeof
|
|
14539
|
-
var e =
|
|
14820
|
+
function _toPrimitive(t, r) {
|
|
14821
|
+
if (typeof t != "object" || !t) return t;
|
|
14822
|
+
var e = t[Symbol.toPrimitive];
|
|
14540
14823
|
if (e !== void 0) {
|
|
14541
|
-
var i2 = e.call(
|
|
14824
|
+
var i2 = e.call(t, r || "default");
|
|
14542
14825
|
if (typeof i2 != "object") return i2;
|
|
14543
14826
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
14544
14827
|
}
|
|
14545
|
-
return (r === "string" ? String : Number)(
|
|
14828
|
+
return (r === "string" ? String : Number)(t);
|
|
14546
14829
|
}
|
|
14547
|
-
function _toPropertyKey(
|
|
14548
|
-
var i2 = _toPrimitive(
|
|
14830
|
+
function _toPropertyKey(t) {
|
|
14831
|
+
var i2 = _toPrimitive(t, "string");
|
|
14549
14832
|
return typeof i2 == "symbol" ? i2 : i2 + "";
|
|
14550
14833
|
}
|
|
14551
14834
|
function _typeof(o) {
|
|
@@ -14559,8 +14842,8 @@ function _typeof(o) {
|
|
|
14559
14842
|
function _unsupportedIterableToArray(r, a) {
|
|
14560
14843
|
if (r) {
|
|
14561
14844
|
if (typeof r == "string") return _arrayLikeToArray(r, a);
|
|
14562
|
-
var
|
|
14563
|
-
return
|
|
14845
|
+
var t = {}.toString.call(r).slice(8, -1);
|
|
14846
|
+
return t === "Object" && r.constructor && (t = r.constructor.name), t === "Map" || t === "Set" ? Array.from(r) : t === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
14564
14847
|
}
|
|
14565
14848
|
}
|
|
14566
14849
|
function safeSortObject(value, seen) {
|
|
@@ -15325,20 +15608,19 @@ var extractArgTypes = (component) => {
|
|
|
15325
15608
|
// src/componentManifest/reactDocgen.ts
|
|
15326
15609
|
var import_ts_dedent2 = __toESM(require_dist(), 1), TsconfigPaths = __toESM(require_lib2(), 1);
|
|
15327
15610
|
import { existsSync as existsSync2 } from "node:fs";
|
|
15328
|
-
import { dirname as
|
|
15329
|
-
import { babelParse, types as t } from "storybook/internal/babel";
|
|
15611
|
+
import { dirname as dirname4, sep as sep2 } from "node:path";
|
|
15330
15612
|
import {
|
|
15331
15613
|
findTsconfigPathForPath,
|
|
15332
15614
|
getTsconfigPathsBaseDir,
|
|
15333
15615
|
supportedExtensions as supportedExtensions2
|
|
15334
15616
|
} from "storybook/internal/common";
|
|
15335
|
-
import { extractJSDocInfo } from "storybook/internal/csf-tools";
|
|
15617
|
+
import { extractJSDocInfo, parseModule } from "storybook/internal/csf-tools";
|
|
15336
15618
|
import { logger as logger3 } from "storybook/internal/node-logger";
|
|
15337
15619
|
import {
|
|
15338
15620
|
builtinHandlers as docgenHandlers,
|
|
15339
15621
|
builtinResolvers as docgenResolver,
|
|
15340
15622
|
makeFsImporter,
|
|
15341
|
-
parse as
|
|
15623
|
+
parse as parse6
|
|
15342
15624
|
} from "react-docgen";
|
|
15343
15625
|
|
|
15344
15626
|
// src/componentManifest/reactDocgen/actualNameHandler.ts
|
|
@@ -15530,7 +15812,7 @@ var getTsConfig = cached(
|
|
|
15530
15812
|
},
|
|
15531
15813
|
{ name: "getTsConfig" }
|
|
15532
15814
|
), parseWithReactDocgen = cached(
|
|
15533
|
-
(code, path2) =>
|
|
15815
|
+
(code, path2) => parse6(code, {
|
|
15534
15816
|
resolver: defaultResolver2,
|
|
15535
15817
|
handlers,
|
|
15536
15818
|
importer: getReactDocgenImporter(),
|
|
@@ -15539,15 +15821,15 @@ var getTsConfig = cached(
|
|
|
15539
15821
|
{ key: (code, path2) => path2, name: "parseWithReactDocgen" }
|
|
15540
15822
|
), getExportPaths = cached(
|
|
15541
15823
|
(code, filePath) => {
|
|
15542
|
-
let
|
|
15824
|
+
let program;
|
|
15543
15825
|
try {
|
|
15544
|
-
|
|
15826
|
+
program = parseModule(code, filePath).program;
|
|
15545
15827
|
} catch {
|
|
15546
15828
|
return [];
|
|
15547
15829
|
}
|
|
15548
|
-
let basedir =
|
|
15549
|
-
return
|
|
15550
|
-
(statement) =>
|
|
15830
|
+
let basedir = dirname4(filePath);
|
|
15831
|
+
return program.body.flatMap(
|
|
15832
|
+
(statement) => statement.type === "ExportAllDeclaration" ? [statement.source.value] : statement.type === "ExportNamedDeclaration" && statement.source && !statement.declaration ? [statement.source.value] : []
|
|
15551
15833
|
).map((id) => matchPath(id, filePath)).flatMap((id) => {
|
|
15552
15834
|
try {
|
|
15553
15835
|
return [cachedResolveImport(id, { basedir })];
|
|
@@ -15673,10 +15955,10 @@ Prefer relative imports if possible.`
|
|
|
15673
15955
|
function getReactDocgenImporter() {
|
|
15674
15956
|
return makeFsImporter((filename, basedir) => {
|
|
15675
15957
|
let mappedFilenameByPaths = matchPath(filename, basedir), result = cachedResolveImport(mappedFilenameByPaths, { basedir });
|
|
15676
|
-
if (result.includes(`${
|
|
15958
|
+
if (result.includes(`${sep2}react-native${sep2}index.js`)) {
|
|
15677
15959
|
let replaced = result.replace(
|
|
15678
|
-
`${
|
|
15679
|
-
`${
|
|
15960
|
+
`${sep2}react-native${sep2}index.js`,
|
|
15961
|
+
`${sep2}react-native-web${sep2}dist${sep2}index.js`
|
|
15680
15962
|
);
|
|
15681
15963
|
if (existsSync2(replaced) && supportedExtensions2.find((ext) => result.endsWith(ext)))
|
|
15682
15964
|
return replaced;
|
|
@@ -15691,533 +15973,180 @@ function getImportTag(docgen) {
|
|
|
15691
15973
|
return (jsdocComment ? extractJSDocInfo(jsdocComment).tags : void 0)?.import?.[0];
|
|
15692
15974
|
}
|
|
15693
15975
|
|
|
15694
|
-
// ../../../node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
|
|
15695
|
-
var _lazyMatch = () => {
|
|
15696
|
-
var __lib__ = (() => {
|
|
15697
|
-
var m = Object.defineProperty, V = Object.getOwnPropertyDescriptor, G = Object.getOwnPropertyNames, T = Object.prototype.hasOwnProperty, q = (r, e) => {
|
|
15698
|
-
for (var n in e) m(r, n, { get: e[n], enumerable: !0 });
|
|
15699
|
-
}, H = (r, e, n, a) => {
|
|
15700
|
-
if (e && typeof e == "object" || typeof e == "function") for (let t4 of G(e)) !T.call(r, t4) && t4 !== n && m(r, t4, { get: () => e[t4], enumerable: !(a = V(e, t4)) || a.enumerable });
|
|
15701
|
-
return r;
|
|
15702
|
-
}, J = (r) => H(m({}, "__esModule", { value: !0 }), r), w = {};
|
|
15703
|
-
q(w, { default: () => re });
|
|
15704
|
-
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) => {
|
|
15705
|
-
let e = /* @__PURE__ */ new Map();
|
|
15706
|
-
return (n) => {
|
|
15707
|
-
let a = e.get(n);
|
|
15708
|
-
if (a) return a;
|
|
15709
|
-
let t4 = r(n);
|
|
15710
|
-
return e.set(n, t4), t4;
|
|
15711
|
-
};
|
|
15712
|
-
}, rr = (r, e, n = {}) => {
|
|
15713
|
-
let a = { cache: {}, input: r, index: 0, indexMax: 0, options: n, output: [] };
|
|
15714
|
-
if (v(e)(a) && a.index === r.length) return a.output;
|
|
15715
|
-
throw new Error(`Failed to parse at index ${a.indexMax}`);
|
|
15716
|
-
}, i2 = (r, e) => A(r) ? er(r, e) : b(r) ? ar(r, e) : nr(r, e), er = (r, e) => {
|
|
15717
|
-
let n = {};
|
|
15718
|
-
for (let a of r) {
|
|
15719
|
-
if (a.length !== 1) throw new Error(`Invalid character: "${a}"`);
|
|
15720
|
-
let t4 = a.charCodeAt(0);
|
|
15721
|
-
n[t4] = !0;
|
|
15722
|
-
}
|
|
15723
|
-
return (a) => {
|
|
15724
|
-
let t4 = a.index, o = a.input;
|
|
15725
|
-
for (; a.index < o.length && o.charCodeAt(a.index) in n; ) a.index += 1;
|
|
15726
|
-
let u = a.index;
|
|
15727
|
-
if (u > t4) {
|
|
15728
|
-
if (!h(e) && !a.options.silent) {
|
|
15729
|
-
let s = a.input.slice(t4, u), c = d(e) ? e(s, o, String(t4)) : e;
|
|
15730
|
-
h(c) || a.output.push(c);
|
|
15731
|
-
}
|
|
15732
|
-
a.indexMax = Math.max(a.indexMax, a.index);
|
|
15733
|
-
}
|
|
15734
|
-
return !0;
|
|
15735
|
-
};
|
|
15736
|
-
}, nr = (r, e) => {
|
|
15737
|
-
let n = r.source, a = r.flags.replace(/y|$/, "y"), t4 = new RegExp(n, a);
|
|
15738
|
-
return g((o) => {
|
|
15739
|
-
t4.lastIndex = o.index;
|
|
15740
|
-
let u = t4.exec(o.input);
|
|
15741
|
-
if (u) {
|
|
15742
|
-
if (!h(e) && !o.options.silent) {
|
|
15743
|
-
let s = d(e) ? e(...u, o.input, String(o.index)) : e;
|
|
15744
|
-
h(s) || o.output.push(s);
|
|
15745
|
-
}
|
|
15746
|
-
return o.index += u[0].length, o.indexMax = Math.max(o.indexMax, o.index), !0;
|
|
15747
|
-
} else return !1;
|
|
15748
|
-
});
|
|
15749
|
-
}, ar = (r, e) => (n) => {
|
|
15750
|
-
if (n.input.startsWith(r, n.index)) {
|
|
15751
|
-
if (!h(e) && !n.options.silent) {
|
|
15752
|
-
let t4 = d(e) ? e(r, n.input, String(n.index)) : e;
|
|
15753
|
-
h(t4) || n.output.push(t4);
|
|
15754
|
-
}
|
|
15755
|
-
return n.index += r.length, n.indexMax = Math.max(n.indexMax, n.index), !0;
|
|
15756
|
-
} else return !1;
|
|
15757
|
-
}, C = (r, e, n, a) => {
|
|
15758
|
-
let t4 = v(r);
|
|
15759
|
-
return g(_(M((o) => {
|
|
15760
|
-
let u = 0;
|
|
15761
|
-
for (; u < n; ) {
|
|
15762
|
-
let s = o.index;
|
|
15763
|
-
if (!t4(o) || (u += 1, o.index === s)) break;
|
|
15764
|
-
}
|
|
15765
|
-
return u >= e;
|
|
15766
|
-
})));
|
|
15767
|
-
}, tr = (r, e) => C(r, 0, 1), f = (r, e) => C(r, 0, 1 / 0), x = (r, e) => {
|
|
15768
|
-
let n = r.map(v);
|
|
15769
|
-
return g(_(M((a) => {
|
|
15770
|
-
for (let t4 = 0, o = n.length; t4 < o; t4++) if (!n[t4](a)) return !1;
|
|
15771
|
-
return !0;
|
|
15772
|
-
})));
|
|
15773
|
-
}, l = (r, e) => {
|
|
15774
|
-
let n = r.map(v);
|
|
15775
|
-
return g(_((a) => {
|
|
15776
|
-
for (let t4 = 0, o = n.length; t4 < o; t4++) if (n[t4](a)) return !0;
|
|
15777
|
-
return !1;
|
|
15778
|
-
}));
|
|
15779
|
-
}, M = (r, e = !1) => {
|
|
15780
|
-
let n = v(r);
|
|
15781
|
-
return (a) => {
|
|
15782
|
-
let t4 = a.index, o = a.output.length, u = n(a);
|
|
15783
|
-
return (!u || e) && (a.index = t4, a.output.length !== o && (a.output.length = o)), u;
|
|
15784
|
-
};
|
|
15785
|
-
}, _ = (r, e) => v(r), g = /* @__PURE__ */ (() => {
|
|
15786
|
-
let r = 0;
|
|
15787
|
-
return (e) => {
|
|
15788
|
-
let n = v(e), a = r += 1;
|
|
15789
|
-
return (t4) => {
|
|
15790
|
-
var o;
|
|
15791
|
-
if (t4.options.memoization === !1) return n(t4);
|
|
15792
|
-
let u = t4.index, s = (o = t4.cache)[a] || (o[a] = /* @__PURE__ */ new Map()), c = s.get(u);
|
|
15793
|
-
if (c === !1) return !1;
|
|
15794
|
-
if (W(c)) return t4.index = c, !0;
|
|
15795
|
-
if (c) return t4.index = c.index, c.output?.length && t4.output.push(...c.output), !0;
|
|
15796
|
-
{
|
|
15797
|
-
let Z = t4.output.length;
|
|
15798
|
-
if (n(t4)) {
|
|
15799
|
-
let D = t4.index, U = t4.output.length;
|
|
15800
|
-
if (U > Z) {
|
|
15801
|
-
let ee = t4.output.slice(Z, U);
|
|
15802
|
-
s.set(u, { index: D, output: ee });
|
|
15803
|
-
} else s.set(u, D);
|
|
15804
|
-
return !0;
|
|
15805
|
-
} else return s.set(u, !1), !1;
|
|
15806
|
-
}
|
|
15807
|
-
};
|
|
15808
|
-
};
|
|
15809
|
-
})(), E = (r) => {
|
|
15810
|
-
let e;
|
|
15811
|
-
return (n) => (e || (e = v(r())), e(n));
|
|
15812
|
-
}, v = Y((r) => {
|
|
15813
|
-
if (d(r)) return Q(r) ? E(r) : r;
|
|
15814
|
-
if (b(r) || X(r)) return i2(r);
|
|
15815
|
-
if (A(r)) return x(r);
|
|
15816
|
-
if (K(r)) return l(Object.values(r));
|
|
15817
|
-
throw new Error("Invalid rule");
|
|
15818
|
-
}), P = "abcdefghijklmnopqrstuvwxyz", ir = (r) => {
|
|
15819
|
-
let e = "";
|
|
15820
|
-
for (; r > 0; ) {
|
|
15821
|
-
let n = (r - 1) % 26;
|
|
15822
|
-
e = P[n] + e, r = Math.floor((r - 1) / 26);
|
|
15823
|
-
}
|
|
15824
|
-
return e;
|
|
15825
|
-
}, O = (r) => {
|
|
15826
|
-
let e = 0;
|
|
15827
|
-
for (let n = 0, a = r.length; n < a; n++) e = e * 26 + P.indexOf(r[n]) + 1;
|
|
15828
|
-
return e;
|
|
15829
|
-
}, S = (r, e) => {
|
|
15830
|
-
if (e < r) return S(e, r);
|
|
15831
|
-
let n = [];
|
|
15832
|
-
for (; r <= e; ) n.push(r++);
|
|
15833
|
-
return n;
|
|
15834
|
-
}, 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) => {
|
|
15835
|
-
let e = {};
|
|
15836
|
-
return (n) => e[n] ?? (e[n] = r(n));
|
|
15837
|
-
}, sr = i2(/^\*\*\/\*$/, ".*"), cr = i2(/^\*\*\/(\*)?([ a-zA-Z0-9._-]+)$/, (r, e, n) => `.*${e ? "" : "(?:^|/)"}${n.replaceAll(".", "\\.")}`), lr = i2(/^\*\*\/(\*)?([ a-zA-Z0-9._-]*)\{([ a-zA-Z0-9._-]+(?:,[ a-zA-Z0-9._-]+)*)\}$/, (r, e, n, a) => `.*${e ? "" : "(?:^|/)"}${n.replaceAll(".", "\\.")}(?:${a.replaceAll(",", "|").replaceAll(".", "\\.")})`), y = i2(/\\./, p), pr = i2(/[$.*+?^(){}[\]\|]/, (r) => `\\${r}`), vr = i2(/./, p), hr = i2(/^(?:!!)*!(.*)$/, (r, e) => `(?!^${L(e)}$).*?`), dr = i2(/^(!!)+/, ""), fr = l([hr, dr]), xr = i2(/\/(\*\*\/)+/, "(?:/.+/|/)"), gr = i2(/^(\*\*\/)+/, "(?:^|.*/)"), mr = i2(/\/(\*\*)$/, "(?:/.*|$)"), _r = i2(/\*\*/, ".*"), j = l([xr, gr, mr, _r]), Sr = i2(/\*\/(?!\*\*\/)/, "[^/]*/"), yr = i2(/\*/, "[^/]*"), N = l([Sr, yr]), k = i2("?", "[^/]"), $r = i2("[", p), wr = i2("]", p), Ar = i2(/[!^]/, "^/"), br = i2(/[a-z]-[a-z]|[0-9]-[0-9]/i, p), Cr = i2(/[$.*+?^(){}[\|]/, (r) => `\\${r}`), Mr = i2(/[^\]]/, p), Er = l([y, Cr, br, Mr]), B = x([$r, tr(Ar), f(Er), wr]), Pr = i2("{", "(?:"), Or = i2("}", ")"), Rr = i2(/(\d+)\.\.(\d+)/, (r, e, n) => or(+e, +n, Math.min(e.length, n.length)).join("|")), zr = i2(/([a-z]+)\.\.([a-z]+)/, (r, e, n) => R(e, n).join("|")), jr = i2(/([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 = i2("{", "(?:"), Br = i2("}", ")"), Ir = i2(",", "|"), Fr = i2(/[$.*+?^(){[\]\|]/, (r) => `\\${r}`), Lr = i2(/[^}]/, 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 = i2(/\\./, p), qr = i2(/./, p), Hr = i2(/\*\*\*+/, "*"), Jr = i2(/([^/{[(!])\*\*/, (r, e) => `${e}*`), Qr = i2(/(^|.)\*\*(?=[^*/)\]}])/, (r, e) => `${e}*`), Wr = f(l([Tr, Hr, Jr, Qr, qr])), Kr = Wr, Xr = z(Kr), Yr = Xr, $ = (r, e) => {
|
|
15838
|
-
let n = Array.isArray(r) ? r : [r];
|
|
15839
|
-
if (!n.length) return !1;
|
|
15840
|
-
let a = n.map($.compile), t4 = n.every((s) => /(\/(?:\*\*)?|\[\/\])$/.test(s)), o = e.replace(/[\\\/]+/g, "/").replace(/\/$/, t4 ? "/" : "");
|
|
15841
|
-
return a.some((s) => s.test(o));
|
|
15842
|
-
};
|
|
15843
|
-
$.compile = (r) => new RegExp(`^${L(Yr(r))}$`, "s");
|
|
15844
|
-
var re = $;
|
|
15845
|
-
return J(w);
|
|
15846
|
-
})();
|
|
15847
|
-
return __lib__.default || __lib__;
|
|
15848
|
-
}, _match, zeptomatch = (path2, pattern) => (_match || (_match = _lazyMatch(), _lazyMatch = null), _match(path2, pattern)), _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
15849
|
-
function normalizeWindowsPath(input = "") {
|
|
15850
|
-
return input && input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
|
|
15851
|
-
}
|
|
15852
|
-
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]:[/\\]/, sep2 = "/", normalize = function(path2) {
|
|
15853
|
-
if (path2.length === 0)
|
|
15854
|
-
return ".";
|
|
15855
|
-
path2 = normalizeWindowsPath(path2);
|
|
15856
|
-
let isUNCPath = path2.match(_UNC_REGEX), isPathAbsolute = isAbsolute2(path2), trailingSeparator = path2[path2.length - 1] === "/";
|
|
15857
|
-
return path2 = normalizeString(path2, !isPathAbsolute), path2.length === 0 ? isPathAbsolute ? "/" : trailingSeparator ? "./" : "." : (trailingSeparator && (path2 += "/"), _DRIVE_LETTER_RE.test(path2) && (path2 += "/"), isUNCPath ? isPathAbsolute ? `//${path2}` : `//./${path2}` : isPathAbsolute && !isAbsolute2(path2) ? `/${path2}` : path2);
|
|
15858
|
-
}, join3 = function(...segments) {
|
|
15859
|
-
let path2 = "";
|
|
15860
|
-
for (let seg of segments)
|
|
15861
|
-
if (seg)
|
|
15862
|
-
if (path2.length > 0) {
|
|
15863
|
-
let pathTrailing = path2[path2.length - 1] === "/", segLeading = seg[0] === "/";
|
|
15864
|
-
pathTrailing && segLeading ? path2 += seg.slice(1) : path2 += pathTrailing || segLeading ? seg : `/${seg}`;
|
|
15865
|
-
} else
|
|
15866
|
-
path2 += seg;
|
|
15867
|
-
return normalize(path2);
|
|
15868
|
-
};
|
|
15869
|
-
function cwd() {
|
|
15870
|
-
return typeof process < "u" && typeof process.cwd == "function" ? process.cwd().replace(/\\/g, "/") : "/";
|
|
15871
|
-
}
|
|
15872
|
-
var resolve3 = function(...arguments_) {
|
|
15873
|
-
arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
|
|
15874
|
-
let resolvedPath = "", resolvedAbsolute = !1;
|
|
15875
|
-
for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
|
|
15876
|
-
let path2 = index >= 0 ? arguments_[index] : cwd();
|
|
15877
|
-
!path2 || path2.length === 0 || (resolvedPath = `${path2}/${resolvedPath}`, resolvedAbsolute = isAbsolute2(path2));
|
|
15878
|
-
}
|
|
15879
|
-
return resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute), resolvedAbsolute && !isAbsolute2(resolvedPath) ? `/${resolvedPath}` : resolvedPath.length > 0 ? resolvedPath : ".";
|
|
15880
|
-
};
|
|
15881
|
-
function normalizeString(path2, allowAboveRoot) {
|
|
15882
|
-
let res = "", lastSegmentLength = 0, lastSlash = -1, dots = 0, char = null;
|
|
15883
|
-
for (let index = 0; index <= path2.length; ++index) {
|
|
15884
|
-
if (index < path2.length)
|
|
15885
|
-
char = path2[index];
|
|
15886
|
-
else {
|
|
15887
|
-
if (char === "/")
|
|
15888
|
-
break;
|
|
15889
|
-
char = "/";
|
|
15890
|
-
}
|
|
15891
|
-
if (char === "/") {
|
|
15892
|
-
if (!(lastSlash === index - 1 || dots === 1)) if (dots === 2) {
|
|
15893
|
-
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
|
15894
|
-
if (res.length > 2) {
|
|
15895
|
-
let lastSlashIndex = res.lastIndexOf("/");
|
|
15896
|
-
lastSlashIndex === -1 ? (res = "", lastSegmentLength = 0) : (res = res.slice(0, lastSlashIndex), lastSegmentLength = res.length - 1 - res.lastIndexOf("/")), lastSlash = index, dots = 0;
|
|
15897
|
-
continue;
|
|
15898
|
-
} else if (res.length > 0) {
|
|
15899
|
-
res = "", lastSegmentLength = 0, lastSlash = index, dots = 0;
|
|
15900
|
-
continue;
|
|
15901
|
-
}
|
|
15902
|
-
}
|
|
15903
|
-
allowAboveRoot && (res += res.length > 0 ? "/.." : "..", lastSegmentLength = 2);
|
|
15904
|
-
} else
|
|
15905
|
-
res.length > 0 ? res += `/${path2.slice(lastSlash + 1, index)}` : res = path2.slice(lastSlash + 1, index), lastSegmentLength = index - lastSlash - 1;
|
|
15906
|
-
lastSlash = index, dots = 0;
|
|
15907
|
-
} else char === "." && dots !== -1 ? ++dots : dots = -1;
|
|
15908
|
-
}
|
|
15909
|
-
return res;
|
|
15910
|
-
}
|
|
15911
|
-
var isAbsolute2 = function(p) {
|
|
15912
|
-
return _IS_ABSOLUTE_RE.test(p);
|
|
15913
|
-
}, toNamespacedPath = function(p) {
|
|
15914
|
-
return normalizeWindowsPath(p);
|
|
15915
|
-
}, extname = function(p) {
|
|
15916
|
-
if (p === "..") return "";
|
|
15917
|
-
let match = _EXTNAME_RE.exec(normalizeWindowsPath(p));
|
|
15918
|
-
return match && match[1] || "";
|
|
15919
|
-
}, relative = function(from, to) {
|
|
15920
|
-
let _from = resolve3(from).replace(_ROOT_FOLDER_RE, "$1").split("/"), _to = resolve3(to).replace(_ROOT_FOLDER_RE, "$1").split("/");
|
|
15921
|
-
if (_to[0][1] === ":" && _from[0][1] === ":" && _from[0] !== _to[0])
|
|
15922
|
-
return _to.join("/");
|
|
15923
|
-
let _fromCopy = [..._from];
|
|
15924
|
-
for (let segment of _fromCopy) {
|
|
15925
|
-
if (_to[0] !== segment)
|
|
15926
|
-
break;
|
|
15927
|
-
_from.shift(), _to.shift();
|
|
15928
|
-
}
|
|
15929
|
-
return [..._from.map(() => ".."), ..._to].join("/");
|
|
15930
|
-
}, dirname4 = function(p) {
|
|
15931
|
-
let segments = normalizeWindowsPath(p).replace(/\/$/, "").split("/").slice(0, -1);
|
|
15932
|
-
return segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0]) && (segments[0] += "/"), segments.join("/") || (isAbsolute2(p) ? "/" : ".");
|
|
15933
|
-
}, format = function(p) {
|
|
15934
|
-
let ext = p.ext ? p.ext.startsWith(".") ? p.ext : `.${p.ext}` : "", segments = [p.root, p.dir, p.base ?? (p.name ?? "") + ext].filter(
|
|
15935
|
-
Boolean
|
|
15936
|
-
);
|
|
15937
|
-
return normalizeWindowsPath(
|
|
15938
|
-
p.root ? resolve3(...segments) : segments.join("/")
|
|
15939
|
-
);
|
|
15940
|
-
}, basename = function(p, extension) {
|
|
15941
|
-
let segments = normalizeWindowsPath(p).split("/"), lastSegment = "";
|
|
15942
|
-
for (let i2 = segments.length - 1; i2 >= 0; i2--) {
|
|
15943
|
-
let val = segments[i2];
|
|
15944
|
-
if (val) {
|
|
15945
|
-
lastSegment = val;
|
|
15946
|
-
break;
|
|
15947
|
-
}
|
|
15948
|
-
}
|
|
15949
|
-
return extension && lastSegment.endsWith(extension) ? lastSegment.slice(0, -extension.length) : lastSegment;
|
|
15950
|
-
}, parse6 = function(p) {
|
|
15951
|
-
let root = _PATH_ROOT_RE.exec(p)?.[0]?.replace(/\\/g, "/") || "", base2 = basename(p), extension = extname(base2);
|
|
15952
|
-
return {
|
|
15953
|
-
root,
|
|
15954
|
-
dir: dirname4(p),
|
|
15955
|
-
base: base2,
|
|
15956
|
-
ext: extension,
|
|
15957
|
-
name: base2.slice(0, base2.length - extension.length)
|
|
15958
|
-
};
|
|
15959
|
-
}, matchesGlob = (path2, pattern) => zeptomatch(pattern, normalize(path2)), _path = {
|
|
15960
|
-
__proto__: null,
|
|
15961
|
-
basename,
|
|
15962
|
-
dirname: dirname4,
|
|
15963
|
-
extname,
|
|
15964
|
-
format,
|
|
15965
|
-
isAbsolute: isAbsolute2,
|
|
15966
|
-
join: join3,
|
|
15967
|
-
matchesGlob,
|
|
15968
|
-
normalize,
|
|
15969
|
-
normalizeString,
|
|
15970
|
-
parse: parse6,
|
|
15971
|
-
relative,
|
|
15972
|
-
resolve: resolve3,
|
|
15973
|
-
sep: sep2,
|
|
15974
|
-
toNamespacedPath
|
|
15975
|
-
};
|
|
15976
|
-
|
|
15977
|
-
// ../../../node_modules/pathe/dist/index.mjs
|
|
15978
|
-
var delimiter = globalThis.process?.platform === "win32" ? ";" : ":", _platforms = { posix: void 0, win32: void 0 }, mix = (del = delimiter) => new Proxy(_path, {
|
|
15979
|
-
get(_, prop) {
|
|
15980
|
-
return prop === "delimiter" ? del : prop === "posix" ? posix : prop === "win32" ? win32 : _platforms[prop] || _path[prop];
|
|
15981
|
-
}
|
|
15982
|
-
}), posix = mix(":"), win32 = mix(";");
|
|
15983
|
-
|
|
15984
15976
|
// src/componentManifest/generateCodeSnippet.ts
|
|
15985
|
-
import { types as t2 } from "storybook/internal/babel";
|
|
15986
15977
|
import {
|
|
15978
|
+
textOf,
|
|
15987
15979
|
collectImportBindings,
|
|
15988
15980
|
createStoryArgsResolver,
|
|
15981
|
+
detachedTextOf,
|
|
15989
15982
|
isCanonicalCsf2BindCall,
|
|
15990
|
-
|
|
15983
|
+
isStringLiteral,
|
|
15984
|
+
lineIndent,
|
|
15985
|
+
metaObject,
|
|
15991
15986
|
normalizeStoryDeclaration,
|
|
15992
|
-
|
|
15987
|
+
parseModule as parseModule2,
|
|
15988
|
+
reindent,
|
|
15989
|
+
resolveRenderFunction,
|
|
15990
|
+
storyShapeError,
|
|
15991
|
+
walk
|
|
15993
15992
|
} from "storybook/internal/csf-tools";
|
|
15994
15993
|
function renderFunctionOf(resolution) {
|
|
15995
|
-
return resolution.kind === "resolved" ? resolution.
|
|
15994
|
+
return resolution.kind === "resolved" ? resolution.node : resolution.kind === "unresolved" ? resolution.shadowedRender : void 0;
|
|
15996
15995
|
}
|
|
15997
15996
|
function getCodeSnippet(csf, storyName, componentName, resolver = createStoryArgsResolver(csf)) {
|
|
15998
15997
|
let { args, imports, unresolved } = resolver.resolve(storyName), importedBind = importedBoundStory(csf, storyName, args);
|
|
15999
15998
|
return importedBind ? {
|
|
16000
|
-
|
|
15999
|
+
code: importedBind.code,
|
|
16001
16000
|
imports: [...imports, importedBind.importRef],
|
|
16002
16001
|
unresolved
|
|
16003
16002
|
} : {
|
|
16004
|
-
|
|
16003
|
+
code: buildSnippet(csf, storyName, componentName, args, resolver),
|
|
16005
16004
|
imports,
|
|
16006
16005
|
unresolved
|
|
16007
16006
|
};
|
|
16008
16007
|
}
|
|
16009
16008
|
function importedBoundStory(csf, storyName, args) {
|
|
16010
|
-
let declaration = csf.
|
|
16011
|
-
if (
|
|
16009
|
+
let declaration = csf._storyExports[storyName];
|
|
16010
|
+
if (declaration?.type !== "VariableDeclarator" || !isCanonicalCsf2BindCall(declaration.init))
|
|
16012
16011
|
return;
|
|
16013
|
-
let
|
|
16014
|
-
if (!init.isCallExpression() || !isCanonicalCsf2BindCall(init.node))
|
|
16015
|
-
return;
|
|
16016
|
-
let callee = init.get("callee");
|
|
16017
|
-
if (!callee.isMemberExpression())
|
|
16018
|
-
return;
|
|
16019
|
-
let object = callee.get("object");
|
|
16020
|
-
if (!object.isIdentifier())
|
|
16021
|
-
return;
|
|
16022
|
-
let binding = collectImportBindings(csf._file.path).get(object.node.name);
|
|
16012
|
+
let local = declaration.init.callee.object.name, binding = collectImportBindings(csf.program).get(local);
|
|
16023
16013
|
if (!binding)
|
|
16024
16014
|
return;
|
|
16025
|
-
let
|
|
16015
|
+
let print = valuePrinter(" "), values = Object.entries(args).map(
|
|
16016
|
+
([key, value]) => ` ${JSON.stringify(key)}: ${print(value)}`
|
|
16017
|
+
), argsObject = values.length ? `{
|
|
16018
|
+
${values.join(`,
|
|
16019
|
+
`)}
|
|
16020
|
+
}` : "{}";
|
|
16026
16021
|
return {
|
|
16027
|
-
|
|
16028
|
-
t2.variableDeclarator(t2.identifier(storyName), t2.arrowFunctionExpression([], boundCall))
|
|
16029
|
-
]),
|
|
16022
|
+
code: `const ${storyName} = () => ${textOf(declaration.init)}(${argsObject});`,
|
|
16030
16023
|
importRef: {
|
|
16031
|
-
localImportName:
|
|
16024
|
+
localImportName: local,
|
|
16032
16025
|
importId: binding.importId,
|
|
16033
16026
|
importName: binding.importName,
|
|
16034
|
-
...binding.importName === "*" ? { namespace:
|
|
16027
|
+
...binding.importName === "*" ? { namespace: local } : {}
|
|
16035
16028
|
}
|
|
16036
16029
|
};
|
|
16037
16030
|
}
|
|
16038
|
-
function
|
|
16039
|
-
let storyDeclaration = csf.
|
|
16031
|
+
function buildSnippet(csf, storyName, componentName, merged, resolver) {
|
|
16032
|
+
let editor = csf.editor, storyDeclaration = csf._storyExports[storyName];
|
|
16040
16033
|
if (!storyDeclaration) {
|
|
16041
|
-
let message = "Expected story to be a function or variable declaration"
|
|
16042
|
-
|
|
16043
|
-
|
|
16044
|
-
let normalizedStory = normalizeStoryDeclaration(storyDeclaration), storyFn;
|
|
16045
|
-
normalizedStory.type === "fn" && (storyFn = normalizedStory.path);
|
|
16046
|
-
let storyConfigPath = normalizedStory.type === "config" ? normalizedStory.path : void 0, metaRender = resolveRenderFunction(metaObjectPath(csf), storyDeclaration, ctx), storyRender = resolveRenderFunction(storyConfigPath, storyDeclaration, ctx);
|
|
16047
|
-
storyFn || (storyFn = renderFunctionOf(storyRender) ?? (storyRender.kind === "missing" ? renderFunctionOf(metaRender) : void 0));
|
|
16048
|
-
let entries = Object.entries(merged).filter(([k]) => k !== "children"), validEntries = entries.filter(([k, v]) => isValidJsxAttrName(k) && v != null), invalidEntries = entries.filter(([k, v]) => !isValidJsxAttrName(k) && v != null), injectedAttrs = validEntries.map(([k, v]) => toAttr(k, v)).filter((a) => a != null);
|
|
16049
|
-
if (storyFn) {
|
|
16050
|
-
let fn = storyFn.node;
|
|
16051
|
-
if (t2.isArrowFunctionExpression(fn) && (t2.isJSXElement(fn.body) || t2.isJSXFragment(fn.body))) {
|
|
16052
|
-
let spreadRes = transformArgsSpreadsInJsx(fn.body, merged), inlineRes = inlineArgsInJsx(spreadRes.node, merged);
|
|
16053
|
-
if (spreadRes.changed || inlineRes.changed) {
|
|
16054
|
-
let newFn = t2.arrowFunctionExpression(
|
|
16055
|
-
remainingParams(fn, inlineRes.node),
|
|
16056
|
-
inlineRes.node,
|
|
16057
|
-
fn.async
|
|
16058
|
-
);
|
|
16059
|
-
return t2.variableDeclaration("const", [
|
|
16060
|
-
t2.variableDeclarator(t2.identifier(storyName), newFn)
|
|
16061
|
-
]);
|
|
16062
|
-
}
|
|
16063
|
-
}
|
|
16064
|
-
let stmts = t2.isFunctionDeclaration(fn) || t2.isObjectMethod(fn) || t2.isArrowFunctionExpression(fn) && t2.isBlockStatement(fn.body) || t2.isFunctionExpression(fn) && t2.isBlockStatement(fn.body) ? fn.body.body : void 0;
|
|
16065
|
-
if (stmts) {
|
|
16066
|
-
let changed = !1, newBody = stmts.map((stmt) => {
|
|
16067
|
-
if (t2.isReturnStatement(stmt) && stmt.argument && (t2.isJSXElement(stmt.argument) || t2.isJSXFragment(stmt.argument))) {
|
|
16068
|
-
let spreadRes = transformArgsSpreadsInJsx(stmt.argument, merged), inlineRes = inlineArgsInJsx(spreadRes.node, merged);
|
|
16069
|
-
if (spreadRes.changed || inlineRes.changed)
|
|
16070
|
-
return changed = !0, t2.returnStatement(inlineRes.node);
|
|
16071
|
-
}
|
|
16072
|
-
return stmt;
|
|
16073
|
-
});
|
|
16074
|
-
if (changed) {
|
|
16075
|
-
let body = t2.blockStatement(newBody), params = remainingParams(fn, body);
|
|
16076
|
-
return t2.isFunctionDeclaration(fn) ? t2.functionDeclaration(t2.identifier(storyName), params, body, fn.generator, fn.async) : t2.variableDeclaration("const", [
|
|
16077
|
-
t2.variableDeclarator(
|
|
16078
|
-
t2.identifier(storyName),
|
|
16079
|
-
t2.arrowFunctionExpression(params, body, fn.async)
|
|
16080
|
-
)
|
|
16081
|
-
]);
|
|
16082
|
-
}
|
|
16083
|
-
}
|
|
16084
|
-
return t2.isFunctionDeclaration(fn) ? t2.functionDeclaration(t2.identifier(storyName), fn.params, fn.body, fn.generator, fn.async) : t2.variableDeclaration("const", [
|
|
16085
|
-
t2.variableDeclarator(
|
|
16086
|
-
t2.identifier(storyName),
|
|
16087
|
-
t2.isObjectMethod(fn) ? t2.arrowFunctionExpression(fn.params, fn.body, fn.async) : fn
|
|
16034
|
+
let message = "Expected story to be a function or variable declaration", statement = csf.program.body.find(
|
|
16035
|
+
(node) => node.type === "ExportNamedDeclaration" && node.specifiers.some(
|
|
16036
|
+
(specifier) => (specifier.exported.type === "Identifier" ? specifier.exported.name : specifier.exported.value) === storyName
|
|
16088
16037
|
)
|
|
16089
|
-
|
|
16038
|
+
);
|
|
16039
|
+
throw statement ? storyShapeError(message, statement, editor) : message;
|
|
16090
16040
|
}
|
|
16041
|
+
let normalizedStory = normalizeStoryDeclaration(storyDeclaration, editor), storyFn = normalizedStory.type === "fn" ? normalizedStory.node : void 0, storyConfig = normalizedStory.type === "config" ? normalizedStory.node : void 0, metaRender = resolveRenderFunction(metaObject(csf), editor, resolver.ctx), storyRender = resolveRenderFunction(storyConfig, editor, resolver.ctx);
|
|
16042
|
+
if (storyFn || (storyFn = renderFunctionOf(storyRender) ?? (storyRender.kind === "missing" ? renderFunctionOf(metaRender) : void 0)), storyFn)
|
|
16043
|
+
return functionSnippet(
|
|
16044
|
+
editor.code,
|
|
16045
|
+
storyName,
|
|
16046
|
+
storyFn,
|
|
16047
|
+
isMethod(editor.parentOf(storyFn)),
|
|
16048
|
+
merged
|
|
16049
|
+
);
|
|
16091
16050
|
invariant(componentName, "Could not generate snippet without component name.");
|
|
16092
|
-
let
|
|
16093
|
-
|
|
16094
|
-
t2.jsxElement(
|
|
16095
|
-
t2.jsxOpeningElement(name, openingElAttrs, selfClosing),
|
|
16096
|
-
selfClosing ? null : t2.jsxClosingElement(name),
|
|
16097
|
-
children,
|
|
16098
|
-
selfClosing
|
|
16099
|
-
)
|
|
16100
|
-
);
|
|
16101
|
-
return t2.variableDeclaration("const", [t2.variableDeclarator(t2.identifier(storyName), arrow)]);
|
|
16051
|
+
let print = valuePrinter(""), attrs = injectedAttributes(merged, /* @__PURE__ */ new Set(), print), children = toJsxChildren(merged.children, print), opening = [componentName, ...attrs].join(" "), element = children ? `<${opening}>${children}</${componentName}>` : `<${opening} />`;
|
|
16052
|
+
return `const ${storyName} = () => ${element};`;
|
|
16102
16053
|
}
|
|
16103
|
-
|
|
16104
|
-
|
|
16054
|
+
var isMethod = (parent) => parent?.type === "Property" && (parent.method || parent.kind !== "init");
|
|
16055
|
+
function functionSnippet(code, storyName, fn, method, merged) {
|
|
16056
|
+
let asyncPrefix = fn.async ? "async " : "", params = fn.params.length ? code.slice(fn.params[0].start, fn.params[fn.params.length - 1].end) : "", edits = [];
|
|
16057
|
+
if (fn.type === "ArrowFunctionExpression" && isJsx(fn.body)) {
|
|
16058
|
+
if (rewriteJsx(code, fn.body, merged, edits)) {
|
|
16059
|
+
let body = printRange(code, fn.body, edits), kept = readsArgs(`${asyncPrefix}() => (${body});`) ? params : "";
|
|
16060
|
+
return `const ${storyName} = ${asyncPrefix}(${kept}) => ${body};`;
|
|
16061
|
+
}
|
|
16062
|
+
} else if (fn.body?.type === "BlockStatement") {
|
|
16063
|
+
let changed = !1;
|
|
16064
|
+
for (let statement of fn.body.body)
|
|
16065
|
+
statement.type === "ReturnStatement" && isJsx(statement.argument) && (changed = rewriteJsx(code, statement.argument, merged, edits) || changed);
|
|
16066
|
+
if (changed) {
|
|
16067
|
+
let body = printRange(code, fn.body, edits), head = `${asyncPrefix}function${fn.generator ? "*" : ""}`, kept = readsArgs(`${head} f() ${body}`) ? params : "";
|
|
16068
|
+
return fn.type === "FunctionDeclaration" ? `${asyncPrefix}function${fn.generator ? "*" : ""} ${storyName}(${kept}) ${body}` : `const ${storyName} = ${asyncPrefix}(${kept}) => ${body};`;
|
|
16069
|
+
}
|
|
16070
|
+
}
|
|
16071
|
+
return fn.type === "FunctionDeclaration" && fn.body ? `${asyncPrefix}function${fn.generator ? "*" : ""} ${storyName}(${params}) ${printRange(code, fn.body, [])}` : method && fn.body ? `const ${storyName} = ${asyncPrefix}(${params}) => ${printRange(code, fn.body, [])};` : `const ${storyName} = ${printRange(code, fn, [])};`;
|
|
16105
16072
|
}
|
|
16106
|
-
|
|
16073
|
+
var isJsx = (node) => node?.type === "JSXElement" || node?.type === "JSXFragment";
|
|
16074
|
+
function printRange(code, range, edits) {
|
|
16075
|
+
let text = "", cursor = range.start;
|
|
16076
|
+
for (let edit of [...edits].sort((a, b) => a.start - b.start || a.end - b.end))
|
|
16077
|
+
text += code.slice(cursor, edit.start) + edit.text, cursor = edit.end;
|
|
16078
|
+
return text += code.slice(cursor, range.end), reindent(text, lineIndent(code, range.start), "");
|
|
16079
|
+
}
|
|
16080
|
+
function readsArgs(source) {
|
|
16107
16081
|
let named = /* @__PURE__ */ new Set(), reads = !1;
|
|
16108
|
-
return
|
|
16109
|
-
|
|
16082
|
+
return walk(parseModule2(source).program, (current2) => {
|
|
16083
|
+
current2.type === "MemberExpression" && !current2.computed && named.add(current2.property), current2.type === "Property" && !current2.computed && !current2.shorthand && named.add(current2.key), current2.type === "Identifier" && current2.name === "args" && !named.has(current2) && (reads = !0);
|
|
16110
16084
|
}), reads;
|
|
16111
16085
|
}
|
|
16112
|
-
|
|
16113
|
-
|
|
16114
|
-
|
|
16115
|
-
|
|
16116
|
-
|
|
16117
|
-
)
|
|
16118
|
-
|
|
16119
|
-
}
|
|
16120
|
-
var isValidJsxAttrName = (n) => /^[A-Za-z_][A-Za-z0-9_:-]*$/.test(n), toAttr = (key, value) => t2.isBooleanLiteral(value) ? value.value ? t2.jsxAttribute(t2.jsxIdentifier(key), null) : t2.jsxAttribute(t2.jsxIdentifier(key), t2.jsxExpressionContainer(value)) : t2.isStringLiteral(value) ? t2.jsxAttribute(t2.jsxIdentifier(key), t2.stringLiteral(value.value)) : t2.isExpression(value) ? t2.jsxAttribute(t2.jsxIdentifier(key), t2.jsxExpressionContainer(value)) : null, toJsxChildren = (node) => node ? t2.isStringLiteral(node) ? [t2.jsxText(node.value)] : t2.isJSXElement(node) || t2.isJSXFragment(node) ? [node] : t2.isExpression(node) ? [t2.jsxExpressionContainer(node)] : [] : [];
|
|
16121
|
-
function getArgsMemberKey(expr) {
|
|
16122
|
-
if (t2.isMemberExpression(expr) && t2.isIdentifier(expr.object) && expr.object.name === "args") {
|
|
16123
|
-
if (t2.isIdentifier(expr.property) && !expr.computed)
|
|
16124
|
-
return expr.property.name;
|
|
16125
|
-
if (t2.isStringLiteral(expr.property) && expr.computed)
|
|
16126
|
-
return expr.property.value;
|
|
16127
|
-
}
|
|
16128
|
-
if (t2.isOptionalMemberExpression?.(expr) && t2.isIdentifier(expr.object) && expr.object.name === "args") {
|
|
16129
|
-
let prop = expr.property;
|
|
16130
|
-
if (t2.isIdentifier(prop) && !expr.computed)
|
|
16131
|
-
return prop.name;
|
|
16132
|
-
if (t2.isStringLiteral(prop) && expr.computed)
|
|
16133
|
-
return prop.value;
|
|
16086
|
+
var valuePrinter = (indent) => (node) => reindent(detachedTextOf(node), "", indent), isValidJsxAttrName = (n) => /^[A-Za-z_][A-Za-z0-9_:-]*$/.test(n), toAttr = (key, value, print) => value.type === "Literal" && typeof value.value == "boolean" ? value.value ? key : `${key}={false}` : isStringLiteral(value) && !/["&\r\n]/.test(value.value) ? `${key}="${value.value}"` : `${key}={${print(value)}}`;
|
|
16087
|
+
function injectedAttributes(merged, existing, print) {
|
|
16088
|
+
let entries = Object.entries(merged).filter(
|
|
16089
|
+
([k, v]) => v != null && k !== "children" && !existing.has(k)
|
|
16090
|
+
), attrs = entries.filter(([k]) => isValidJsxAttrName(k)).map(([k, v]) => toAttr(k, v, print)), invalid = entries.filter(([k]) => !isValidJsxAttrName(k));
|
|
16091
|
+
if (invalid.length > 0) {
|
|
16092
|
+
let members = invalid.map(([k, v]) => `${JSON.stringify(k)}: ${print(v)}`);
|
|
16093
|
+
attrs.push(`{...{ ${members.join(", ")} }}`);
|
|
16134
16094
|
}
|
|
16135
|
-
return
|
|
16095
|
+
return attrs;
|
|
16136
16096
|
}
|
|
16137
|
-
|
|
16138
|
-
|
|
16139
|
-
|
|
16140
|
-
|
|
16141
|
-
if (!t2.isJSXAttribute(a))
|
|
16142
|
-
return [a];
|
|
16143
|
-
let name = t2.isJSXIdentifier(a.name) ? a.name.name : null;
|
|
16144
|
-
if (!(name && a.value && t2.isJSXExpressionContainer(a.value)))
|
|
16145
|
-
return [a];
|
|
16146
|
-
let key = getArgsMemberKey(a.value.expression);
|
|
16147
|
-
if (!(key && key in merged))
|
|
16148
|
-
return [a];
|
|
16149
|
-
let repl = toAttr(name, merged[key]);
|
|
16150
|
-
return changed = !0, repl ? [repl] : [];
|
|
16151
|
-
}), newChildren = node.children.flatMap((c) => {
|
|
16152
|
-
if (t2.isJSXElement(c) || t2.isJSXFragment(c)) {
|
|
16153
|
-
let res = inlineArgsInJsx(c, merged);
|
|
16154
|
-
return changed ||= res.changed, [res.node];
|
|
16155
|
-
}
|
|
16156
|
-
return t2.isJSXExpressionContainer(c) && getArgsMemberKey(c.expression) === "children" && merged.children ? (changed = !0, toJsxChildren(merged.children)) : [c];
|
|
16157
|
-
}), selfClosing = opening.selfClosing && newChildren.length === 0;
|
|
16158
|
-
return {
|
|
16159
|
-
node: t2.jsxElement(
|
|
16160
|
-
t2.jsxOpeningElement(opening.name, newAttrs, selfClosing),
|
|
16161
|
-
selfClosing ? null : node.closingElement ?? t2.jsxClosingElement(opening.name),
|
|
16162
|
-
newChildren,
|
|
16163
|
-
selfClosing
|
|
16164
|
-
),
|
|
16165
|
-
changed
|
|
16166
|
-
};
|
|
16167
|
-
}
|
|
16168
|
-
let fragChildren = node.children.flatMap((c) => {
|
|
16169
|
-
if (t2.isJSXElement(c) || t2.isJSXFragment(c)) {
|
|
16170
|
-
let res = inlineArgsInJsx(c, merged);
|
|
16171
|
-
return changed ||= res.changed, [res.node];
|
|
16172
|
-
}
|
|
16173
|
-
return t2.isJSXExpressionContainer(c) && getArgsMemberKey(c.expression) === "children" && "children" in merged ? (changed = !0, toJsxChildren(merged.children)) : [c];
|
|
16174
|
-
});
|
|
16175
|
-
return { node: t2.jsxFragment(node.openingFragment, node.closingFragment, fragChildren), changed };
|
|
16097
|
+
var toJsxChildren = (node, print) => node ? isStringLiteral(node) && !/[{}<>&\r\n]/.test(node.value) ? node.value : isJsx(node) ? print(node) : `{${print(node)}}` : "";
|
|
16098
|
+
function getArgsMemberKey(expr) {
|
|
16099
|
+
let member = expr.type === "ChainExpression" ? expr.expression : expr;
|
|
16100
|
+
return member.type !== "MemberExpression" || member.object.type !== "Identifier" || member.object.name !== "args" ? null : member.property.type === "Identifier" && !member.computed ? member.property.name : isStringLiteral(member.property) && member.computed ? member.property.value : null;
|
|
16176
16101
|
}
|
|
16177
|
-
function
|
|
16178
|
-
let changed = !1,
|
|
16179
|
-
|
|
16180
|
-
|
|
16181
|
-
|
|
16182
|
-
|
|
16183
|
-
let opening = node.openingElement, attrs = opening.attributes, isArgsSpread = (a) => t2.isJSXSpreadAttribute(a) && t2.isIdentifier(a.argument) && a.argument.name === "args", sawArgsSpread = attrs.some(isArgsSpread), firstIdx = attrs.findIndex(isArgsSpread), nonArgsAttrs = attrs.filter((a) => !isArgsSpread(a)), insertionIndex = sawArgsSpread ? attrs.slice(0, firstIdx).filter((a) => !isArgsSpread(a)).length : 0, newAttrs = sawArgsSpread ? (() => {
|
|
16102
|
+
function rewriteJsx(code, node, merged, edits) {
|
|
16103
|
+
let changed = !1, printAt = (offset2) => valuePrinter(lineIndent(code, offset2));
|
|
16104
|
+
if (node.type === "JSXElement") {
|
|
16105
|
+
let opening = node.openingElement, attrs = opening.attributes, isArgsSpread = (a) => a.type === "JSXSpreadAttribute" && a.argument.type === "Identifier" && a.argument.name === "args", firstSpread = attrs.findIndex(isArgsSpread), tagEnd = (opening.typeArguments ?? opening.name).end;
|
|
16106
|
+
if (firstSpread !== -1) {
|
|
16107
|
+
changed = !0;
|
|
16184
16108
|
let existing = new Set(
|
|
16185
|
-
|
|
16186
|
-
|
|
16187
|
-
|
|
16188
|
-
|
|
16189
|
-
|
|
16190
|
-
|
|
16191
|
-
|
|
16192
|
-
|
|
16193
|
-
|
|
16194
|
-
|
|
16195
|
-
|
|
16109
|
+
attrs.flatMap(
|
|
16110
|
+
(a) => a.type === "JSXAttribute" && a.name.type === "JSXIdentifier" ? [a.name.name] : []
|
|
16111
|
+
)
|
|
16112
|
+
), print = printAt(attrs[firstSpread].start), pieces = injectedAttributes(merged, existing, print).join(" ");
|
|
16113
|
+
if (attrs.forEach((a, index) => {
|
|
16114
|
+
isArgsSpread(a) && (index === firstSpread && pieces ? edits.push({ start: a.start, end: a.end, text: pieces }) : edits.push({ start: index > 0 ? attrs[index - 1].end : tagEnd, end: a.end, text: "" }));
|
|
16115
|
+
}), node.children.length === 0 && merged.children) {
|
|
16116
|
+
let children = toJsxChildren(merged.children, printAt(opening.start));
|
|
16117
|
+
if (opening.selfClosing) {
|
|
16118
|
+
let name = code.slice(opening.name.start, opening.name.end), lastEnd = attrs.length > 0 ? attrs[attrs.length - 1].end : tagEnd;
|
|
16119
|
+
edits.push({ start: lastEnd, end: opening.end, text: `>${children}</${name}>` });
|
|
16120
|
+
} else
|
|
16121
|
+
edits.push({ start: opening.end, end: opening.end, text: children });
|
|
16196
16122
|
}
|
|
16197
|
-
return [c];
|
|
16198
|
-
}), children = sawArgsSpread && newChildren.length === 0 && merged.children ? (changed = !0, toJsxChildren(merged.children)) : newChildren, selfClosing = children.length === 0;
|
|
16199
|
-
return {
|
|
16200
|
-
node: t2.jsxElement(
|
|
16201
|
-
t2.jsxOpeningElement(opening.name, newAttrs, selfClosing),
|
|
16202
|
-
selfClosing ? null : node.closingElement ?? t2.jsxClosingElement(opening.name),
|
|
16203
|
-
children,
|
|
16204
|
-
selfClosing
|
|
16205
|
-
),
|
|
16206
|
-
changed
|
|
16207
|
-
};
|
|
16208
|
-
}
|
|
16209
|
-
let fragChildren = node.children.flatMap((c) => {
|
|
16210
|
-
if (t2.isJSXElement(c) || t2.isJSXFragment(c)) {
|
|
16211
|
-
let res = transformArgsSpreadsInJsx(c, merged);
|
|
16212
|
-
return changed ||= res.changed, [res.node];
|
|
16213
16123
|
}
|
|
16214
|
-
|
|
16215
|
-
|
|
16216
|
-
|
|
16124
|
+
for (let a of attrs) {
|
|
16125
|
+
if (a.type !== "JSXAttribute" || a.name.type !== "JSXIdentifier" || a.value?.type !== "JSXExpressionContainer")
|
|
16126
|
+
continue;
|
|
16127
|
+
let key = getArgsMemberKey(a.value.expression);
|
|
16128
|
+
key !== null && Object.hasOwn(merged, key) && (edits.push({
|
|
16129
|
+
start: a.start,
|
|
16130
|
+
end: a.end,
|
|
16131
|
+
text: toAttr(a.name.name, merged[key], printAt(a.start))
|
|
16132
|
+
}), changed = !0);
|
|
16133
|
+
}
|
|
16134
|
+
}
|
|
16135
|
+
for (let child of node.children)
|
|
16136
|
+
isJsx(child) ? changed = rewriteJsx(code, child, merged, edits) || changed : child.type === "JSXExpressionContainer" && getArgsMemberKey(child.expression) === "children" && merged.children && (edits.push({
|
|
16137
|
+
start: child.start,
|
|
16138
|
+
end: child.end,
|
|
16139
|
+
text: toJsxChildren(merged.children, printAt(child.start))
|
|
16140
|
+
}), changed = !0);
|
|
16141
|
+
return changed;
|
|
16217
16142
|
}
|
|
16218
16143
|
|
|
16219
16144
|
// src/componentManifest/reactDocgenTypescript.ts
|
|
16220
16145
|
import { dirname as dirname5, join as join4, resolve as resolve4 } from "node:path";
|
|
16146
|
+
import {
|
|
16147
|
+
extractComponentJsDocInfo as extractComponentJsDocInfo2,
|
|
16148
|
+
resolveExportedSymbol
|
|
16149
|
+
} from "storybook/internal/component-meta";
|
|
16221
16150
|
import { logger as logger4 } from "storybook/internal/node-logger";
|
|
16222
16151
|
var typeScriptPromise, reactDocgenTypescriptPromise, loadTypeScript = () => typeScriptPromise ??= import("typescript").then((ts) => ts.default ?? ts), loadReactDocgenTypescript = () => reactDocgenTypescriptPromise ??= import("react-docgen-typescript"), LARGE_NON_USER_SOURCE_THRESHOLD = 30, getPropSource = (prop) => prop.parent?.fileName ?? prop.declarations?.[0]?.fileName, getLargeNonUserPropSources = (props) => {
|
|
16223
16152
|
let countBySource = /* @__PURE__ */ new Map();
|
|
@@ -16263,9 +16192,9 @@ function getExportNameMap(typescript, checker, sourceFile) {
|
|
|
16263
16192
|
}
|
|
16264
16193
|
return result;
|
|
16265
16194
|
}
|
|
16266
|
-
var previousProgramsByConfigKey = /* @__PURE__ */ new Map(), parserCache = /* @__PURE__ */ new Map(), parserBuilds = /* @__PURE__ */ new Map();
|
|
16195
|
+
var previousProgramsByConfigKey = /* @__PURE__ */ new Map(), parserCache = /* @__PURE__ */ new Map(), parserBuilds = /* @__PURE__ */ new Map(), tsconfigCache = /* @__PURE__ */ new Map();
|
|
16267
16196
|
function invalidateParser() {
|
|
16268
|
-
parserCache = /* @__PURE__ */ new Map(), parserBuilds = /* @__PURE__ */ new Map(), previousProgramsByConfigKey.clear();
|
|
16197
|
+
parserCache = /* @__PURE__ */ new Map(), parserBuilds = /* @__PURE__ */ new Map(), tsconfigCache = /* @__PURE__ */ new Map(), previousProgramsByConfigKey.clear();
|
|
16269
16198
|
}
|
|
16270
16199
|
async function getParser(filePath, userOptions) {
|
|
16271
16200
|
let [typescript, reactDocgenTypescript] = await Promise.all([
|
|
@@ -16348,12 +16277,11 @@ var parseWithReactDocgenTypescript = asyncCache(
|
|
|
16348
16277
|
async (filePath, userOptions) => {
|
|
16349
16278
|
let { program, fileParser, typescript } = await getParser(filePath, userOptions), checker = program.getTypeChecker(), sourceFile = program.getSourceFile(filePath), docs = fileParser.parseWithProgramProvider(filePath, () => program), exportNameMap = sourceFile ? getExportNameMap(typescript, checker, sourceFile) : /* @__PURE__ */ new Map();
|
|
16350
16279
|
return docs.map((doc) => {
|
|
16351
|
-
let largeNonUserSources = getLargeNonUserPropSources(doc.props);
|
|
16280
|
+
let largeNonUserSources = getLargeNonUserPropSources(doc.props), exportName = exportNameMap.get(doc.displayName) ?? doc.displayName, symbol = sourceFile ? resolveExportedSymbol(typescript, checker, sourceFile, exportName) : void 0, componentJsDocTags = symbol ? extractComponentJsDocInfo2(typescript, checker, symbol).jsDocTags : void 0;
|
|
16352
16281
|
return {
|
|
16353
16282
|
...doc,
|
|
16354
|
-
|
|
16355
|
-
|
|
16356
|
-
exportName: exportNameMap.get(doc.displayName) ?? doc.displayName,
|
|
16283
|
+
exportName,
|
|
16284
|
+
componentJsDocTags,
|
|
16357
16285
|
// Filter out bulk props from non-user sources (React built-ins, DOM, CSS-in-JS system props)
|
|
16358
16286
|
props: Object.fromEntries(
|
|
16359
16287
|
Object.entries(doc.props).filter(([, prop]) => {
|
|
@@ -16407,11 +16335,14 @@ function parseTsconfig(typescript, configPath) {
|
|
|
16407
16335
|
return readTsconfig(typescript, configPath).parsed;
|
|
16408
16336
|
}
|
|
16409
16337
|
function readTsconfig(typescript, configPath) {
|
|
16410
|
-
let
|
|
16411
|
-
|
|
16338
|
+
let cacheKey = normalizeFileName(typescript, configPath), cachedTsconfig = tsconfigCache.get(cacheKey);
|
|
16339
|
+
if (cachedTsconfig)
|
|
16340
|
+
return cachedTsconfig;
|
|
16341
|
+
let { config } = typescript.readConfigFile(configPath, typescript.sys.readFile), state = {
|
|
16412
16342
|
config,
|
|
16413
16343
|
parsed: typescript.parseJsonConfigFileContent(config, typescript.sys, dirname5(configPath))
|
|
16414
16344
|
};
|
|
16345
|
+
return tsconfigCache.set(cacheKey, state), state;
|
|
16415
16346
|
}
|
|
16416
16347
|
function isSameFileName(typescript, left, right) {
|
|
16417
16348
|
return normalizeFileName(typescript, left) === normalizeFileName(typescript, right);
|
|
@@ -16422,7 +16353,6 @@ function normalizeFileName(typescript, fileName) {
|
|
|
16422
16353
|
}
|
|
16423
16354
|
|
|
16424
16355
|
// src/componentManifest/resolveComponents.ts
|
|
16425
|
-
import { recast } from "storybook/internal/babel";
|
|
16426
16356
|
import { extractDeclaredSubcomponents } from "storybook/internal/common";
|
|
16427
16357
|
import { storyNameFromExport } from "storybook/internal/csf/csf-utils";
|
|
16428
16358
|
import {
|
|
@@ -16434,11 +16364,11 @@ import {
|
|
|
16434
16364
|
|
|
16435
16365
|
// src/componentManifest/getComponentImports.ts
|
|
16436
16366
|
import { dirname as dirname6 } from "node:path";
|
|
16437
|
-
import { types as t3 } from "storybook/internal/babel";
|
|
16438
16367
|
import {
|
|
16439
16368
|
buildImportStatements,
|
|
16440
16369
|
collectImportBindings as collectImportBindings2,
|
|
16441
|
-
resolveComponentImport
|
|
16370
|
+
resolveComponentImport,
|
|
16371
|
+
walk as walk2
|
|
16442
16372
|
} from "storybook/internal/csf-tools";
|
|
16443
16373
|
import { logger as logger5 } from "storybook/internal/node-logger";
|
|
16444
16374
|
var baseIdentifier = (component) => component.split(".")[0] ?? component, getComponents = async ({
|
|
@@ -16448,28 +16378,21 @@ var baseIdentifier = (component) => component.split(".")[0] ?? component, getCom
|
|
|
16448
16378
|
docgenEngine,
|
|
16449
16379
|
additionalComponentNames = []
|
|
16450
16380
|
}) => {
|
|
16451
|
-
let { reactDocgenTypescriptOptions } = typescriptOptions,
|
|
16452
|
-
program
|
|
16453
|
-
JSXElement:
|
|
16454
|
-
|
|
16455
|
-
|
|
16456
|
-
|
|
16457
|
-
|
|
16458
|
-
|
|
16459
|
-
|
|
16460
|
-
|
|
16461
|
-
|
|
16462
|
-
|
|
16463
|
-
|
|
16464
|
-
|
|
16465
|
-
|
|
16466
|
-
let jsxNameToString = (nm) => t3.isJSXIdentifier(nm) ? nm.name : `${jsxNameToString(nm.object)}.${jsxNameToString(nm.property)}`;
|
|
16467
|
-
name = jsxNameToString(n), componentSet.add(name);
|
|
16468
|
-
}
|
|
16469
|
-
if (name) {
|
|
16470
|
-
let depth = jsxDepth - 1, existing = componentDepth.get(name);
|
|
16471
|
-
(existing === void 0 || depth < existing) && componentDepth.set(name, depth);
|
|
16472
|
-
}
|
|
16381
|
+
let { reactDocgenTypescriptOptions } = typescriptOptions, componentSet = /* @__PURE__ */ new Set(), componentDepth = /* @__PURE__ */ new Map(), localToImport = collectImportBindings2(csf.program), jsxDepth = /* @__PURE__ */ new Map();
|
|
16382
|
+
walk2(csf.program, (node, parent) => {
|
|
16383
|
+
let depth = (parent ? jsxDepth.get(parent) ?? 0 : 0) + (node.type === "JSXElement" ? 1 : 0);
|
|
16384
|
+
if (jsxDepth.set(node, depth), node.type !== "JSXOpeningElement")
|
|
16385
|
+
return;
|
|
16386
|
+
let n = node.name, name;
|
|
16387
|
+
if (n.type === "JSXIdentifier")
|
|
16388
|
+
name = n.name, name && /[A-Z]/.test(name.charAt(0)) && componentSet.add(name);
|
|
16389
|
+
else if (n.type === "JSXMemberExpression") {
|
|
16390
|
+
let jsxNameToString = (nm) => nm.type === "JSXIdentifier" ? nm.name : `${jsxNameToString(nm.object)}.${jsxNameToString(nm.property)}`;
|
|
16391
|
+
name = jsxNameToString(n), componentSet.add(name);
|
|
16392
|
+
}
|
|
16393
|
+
if (name) {
|
|
16394
|
+
let wrappingDepth = depth - 1, existing = componentDepth.get(name);
|
|
16395
|
+
(existing === void 0 || wrappingDepth < existing) && componentDepth.set(name, wrappingDepth);
|
|
16473
16396
|
}
|
|
16474
16397
|
});
|
|
16475
16398
|
let metaComp = csf._meta?.component;
|
|
@@ -16477,8 +16400,8 @@ var baseIdentifier = (component) => component.split(".")[0] ?? component, getCom
|
|
|
16477
16400
|
for (let componentName of additionalComponentNames)
|
|
16478
16401
|
componentSet.add(componentName);
|
|
16479
16402
|
let components = Array.from(componentSet).sort((a, b) => a.localeCompare(b)), isLocallyDefinedWithoutImport = (base2) => {
|
|
16480
|
-
let binding = program.
|
|
16481
|
-
return binding ?
|
|
16403
|
+
let binding = csf.editor.scopes.program.bindings.get(base2);
|
|
16404
|
+
return binding ? binding.kind !== "import" : !1;
|
|
16482
16405
|
}, filteredComponents = components.filter(
|
|
16483
16406
|
(c) => !isLocallyDefinedWithoutImport(baseIdentifier(c))
|
|
16484
16407
|
);
|
|
@@ -16514,13 +16437,18 @@ var baseIdentifier = (component) => component.split(".")[0] ?? component, getCom
|
|
|
16514
16437
|
${message}`
|
|
16515
16438
|
};
|
|
16516
16439
|
}
|
|
16517
|
-
let
|
|
16440
|
+
let reactDocgenTypescriptDoc, componentJsDocTags = reactDocgenTypescript?.componentJsDocTags;
|
|
16441
|
+
if (reactDocgenTypescript) {
|
|
16442
|
+
let { componentJsDocTags: _tags, ...doc } = reactDocgenTypescript;
|
|
16443
|
+
reactDocgenTypescriptDoc = doc, componentJsDocTags = _tags;
|
|
16444
|
+
}
|
|
16518
16445
|
return {
|
|
16519
16446
|
...componentWithPackage,
|
|
16520
16447
|
path: path2,
|
|
16521
|
-
...
|
|
16448
|
+
...reactDocgenTypescriptDoc ? { reactDocgenTypescript: reactDocgenTypescriptDoc } : {},
|
|
16522
16449
|
...reactDocgenTypescriptError ? { reactDocgenTypescriptError } : {},
|
|
16523
|
-
|
|
16450
|
+
...componentJsDocTags ? { componentJsDocTags } : {},
|
|
16451
|
+
importOverride: componentJsDocTags?.import?.[0]?.trim()
|
|
16524
16452
|
};
|
|
16525
16453
|
}
|
|
16526
16454
|
if (docgenEngine === "react-docgen") {
|
|
@@ -16568,7 +16496,7 @@ function findMatchingComponent(components, componentName, title) {
|
|
|
16568
16496
|
return best;
|
|
16569
16497
|
}
|
|
16570
16498
|
async function resolveStoryFileComponents(options) {
|
|
16571
|
-
let { storyPath, title, typescriptOptions, docgenEngine } = options, storyFile = cachedReadTextFileSync(storyPath), csf = loadCsf(storyFile, { makeTitle: () => title }).parse(), componentName = csf._meta?.component, declaredSubcomponents = extractDeclaredSubcomponents(csf), allComponents = await getComponents({
|
|
16499
|
+
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({
|
|
16572
16500
|
additionalComponentNames: declaredSubcomponents.map(
|
|
16573
16501
|
(subcomponent) => subcomponent.componentName
|
|
16574
16502
|
),
|
|
@@ -16587,15 +16515,16 @@ function extractStorySnippets(csf, componentName, filterStoryIds, references) {
|
|
|
16587
16515
|
return { stories: Object.entries(csf._stories).filter(([, story]) => !filterStoryIds || filterStoryIds.has(story.id)).map(([storyExport, story]) => {
|
|
16588
16516
|
let name = story.name ?? storyNameFromExport(storyExport);
|
|
16589
16517
|
try {
|
|
16590
|
-
let { description, summary } = extractStoryJSDocInfo(
|
|
16518
|
+
let { description, summary } = extractStoryJSDocInfo(
|
|
16519
|
+
csf._storyStatements[storyExport],
|
|
16520
|
+
csf.editor
|
|
16521
|
+
), snippet = getCodeSnippet(csf, storyExport, componentName, resolver);
|
|
16591
16522
|
imports.push(...snippet.imports);
|
|
16592
16523
|
let warning = unresolvedWarning(snippet.unresolved);
|
|
16593
16524
|
return {
|
|
16594
16525
|
id: story.id,
|
|
16595
16526
|
name,
|
|
16596
|
-
|
|
16597
|
-
snippet: recast.print(snippet.node, { lineTerminator: `
|
|
16598
|
-
` }).code,
|
|
16527
|
+
snippet: snippet.code,
|
|
16599
16528
|
description,
|
|
16600
16529
|
summary,
|
|
16601
16530
|
...warning ? { warning } : {}
|
|
@@ -16613,7 +16542,8 @@ import {
|
|
|
16613
16542
|
buildImportStatements as buildImportStatements2,
|
|
16614
16543
|
createStoryReferenceResolver,
|
|
16615
16544
|
extractComponentDescription,
|
|
16616
|
-
extractDescription
|
|
16545
|
+
extractDescription,
|
|
16546
|
+
storyShapeError as storyShapeError2
|
|
16617
16547
|
} from "storybook/internal/csf-tools";
|
|
16618
16548
|
var openStoryReferences = createStoryReferenceResolver(), ROOT_ENTRY_FIELDS = ["main", "module", "types", "typings", "browser"];
|
|
16619
16549
|
function hasRootEntry(pkg) {
|
|
@@ -16668,7 +16598,7 @@ function getComponentDocgenData(component, docgenEngine) {
|
|
|
16668
16598
|
if (docgenEngine === "react-docgen") {
|
|
16669
16599
|
let result = component?.reactDocgen;
|
|
16670
16600
|
reactDocgen = result?.type === "success" ? result.data : void 0, docgenDescription = reactDocgen?.description, docgenError = result?.type === "error" ? result.error : void 0;
|
|
16671
|
-
} else docgenEngine === "react-docgen-typescript" ? (reactDocgenTypescript = component?.reactDocgenTypescript, docgenDescription = reactDocgenTypescript?.description, docgenError = component?.reactDocgenTypescriptError) : (reactComponentMeta = component?.reactComponentMeta ? relativizeComponentMetaPaths(component.reactComponentMeta) : void 0, docgenDescription = reactComponentMeta?.description, docgenJsDocTags = component?.componentJsDocTags);
|
|
16601
|
+
} else docgenEngine === "react-docgen-typescript" ? (reactDocgenTypescript = component?.reactDocgenTypescript, docgenDescription = reactDocgenTypescript?.description, docgenJsDocTags = component?.componentJsDocTags, docgenError = component?.reactDocgenTypescriptError) : (reactComponentMeta = component?.reactComponentMeta ? relativizeComponentMetaPaths(component.reactComponentMeta) : void 0, docgenDescription = reactComponentMeta?.description, docgenJsDocTags = component?.componentJsDocTags);
|
|
16672
16602
|
return {
|
|
16673
16603
|
docgenDescription,
|
|
16674
16604
|
docgenError,
|
|
@@ -16779,14 +16709,14 @@ function buildComponentDocgenFromResolved({
|
|
|
16779
16709
|
jsDocTags: base2.jsDocTags ?? {},
|
|
16780
16710
|
error: docgenError ?? {
|
|
16781
16711
|
name: error.name,
|
|
16782
|
-
message: (csf.
|
|
16712
|
+
message: (csf._metaStatement ? storyShapeError2(error.message, csf._metaStatement, csf.editor).message : error.message) + `
|
|
16783
16713
|
|
|
16784
16714
|
${entry.importPath}:
|
|
16785
16715
|
${storyFile}`
|
|
16786
16716
|
}
|
|
16787
16717
|
};
|
|
16788
16718
|
}
|
|
16789
|
-
let metaJsDoc = extractDescription(csf._metaStatement) || void 0, { description, summary, jsDocTags } = extractComponentDescription(
|
|
16719
|
+
let metaJsDoc = extractDescription(csf._metaStatement, csf.editor) || void 0, { description, summary, jsDocTags } = extractComponentDescription(
|
|
16790
16720
|
metaJsDoc,
|
|
16791
16721
|
docgenDescription,
|
|
16792
16722
|
docgenJsDocTags
|
|
@@ -16858,12 +16788,13 @@ function buildReactComponentDocgenFromResolved({
|
|
|
16858
16788
|
export {
|
|
16859
16789
|
__commonJS,
|
|
16860
16790
|
__toESM,
|
|
16791
|
+
join3 as join,
|
|
16792
|
+
isAbsolute2 as isAbsolute,
|
|
16793
|
+
posix,
|
|
16861
16794
|
extractArgTypes,
|
|
16862
16795
|
invalidateCache,
|
|
16863
16796
|
cachedReadFileSync,
|
|
16864
16797
|
parseWithReactDocgen,
|
|
16865
|
-
join3 as join,
|
|
16866
|
-
posix,
|
|
16867
16798
|
getCodeSnippet,
|
|
16868
16799
|
invalidateParser,
|
|
16869
16800
|
resolveStoryFileComponents,
|