storybook 10.1.0-alpha.9 → 10.1.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_browser-chunks/Color-FTG7SQDA.js +1097 -0
- package/dist/_browser-chunks/WithTooltip-LMROHDUP.js +1651 -0
- package/dist/_browser-chunks/chunk-2FRVAXCZ.js +7 -0
- package/dist/_browser-chunks/{chunk-FDWKXLBI.js → chunk-2XZMBGTA.js} +44 -109
- package/dist/_browser-chunks/chunk-3IAH5M2U.js +171 -0
- package/dist/_browser-chunks/chunk-3OXGAGBE.js +779 -0
- package/dist/_browser-chunks/{chunk-TMDZCWME.js → chunk-3PJE6VLG.js} +1 -3
- package/dist/_browser-chunks/{chunk-VAMFPZY3.js → chunk-45UGUKRX.js} +2 -7
- package/dist/_browser-chunks/chunk-6XWLIJQL.js +11 -0
- package/dist/_browser-chunks/{chunk-MM7DTO55.js → chunk-A242L54C.js} +10 -16
- package/dist/_browser-chunks/chunk-AIOS4NGK.js +252 -0
- package/dist/_browser-chunks/chunk-AS2HQEYC.js +14 -0
- package/dist/_browser-chunks/chunk-AXG2BOBL.js +836 -0
- package/dist/_browser-chunks/{chunk-MH6AXFXB.js → chunk-CHUV5WSW.js} +0 -5
- package/dist/_browser-chunks/chunk-EUVGDK4H.js +93 -0
- package/dist/_browser-chunks/chunk-EZSQOHRI.js +18 -0
- package/dist/_browser-chunks/{chunk-CADGRH3P.js → chunk-FNXWN6IK.js} +3 -8
- package/dist/_browser-chunks/chunk-FQ7SLVLR.js +66 -0
- package/dist/_browser-chunks/chunk-GFLS4VP3.js +64 -0
- package/dist/_browser-chunks/chunk-GFY5R5EY.js +47 -0
- package/dist/_browser-chunks/{chunk-L2D73C6Z.js → chunk-H6XK3RSC.js} +13 -21
- package/dist/_browser-chunks/chunk-IPA5A322.js +71 -0
- package/dist/_browser-chunks/chunk-JP7NCOJX.js +37 -0
- package/dist/_browser-chunks/chunk-KJHJLCBK.js +11 -0
- package/dist/_browser-chunks/{chunk-OWPZQM2D.js → chunk-L4RMQ7D7.js} +60 -110
- package/dist/_browser-chunks/chunk-P4F4UVXX.js +951 -0
- package/dist/_browser-chunks/{chunk-AB7OOPUX.js → chunk-QKODTO7K.js} +0 -5
- package/dist/_browser-chunks/chunk-RP5RXKFU.js +2491 -0
- package/dist/_browser-chunks/chunk-SL75JR6Y.js +9 -0
- package/dist/_browser-chunks/chunk-SS2NHR7W.js +2969 -0
- package/dist/_browser-chunks/chunk-UD6FQLAF.js +1481 -0
- package/dist/_browser-chunks/chunk-VYJQ7RU5.js +2853 -0
- package/dist/_browser-chunks/chunk-WJYERY3R.js +136 -0
- package/dist/_browser-chunks/chunk-XJNX76GA.js +85 -0
- package/dist/_browser-chunks/{chunk-F4Q6SGTB.js → chunk-YKE5S47A.js} +177 -399
- package/dist/_browser-chunks/{chunk-SN4J4IQ3.js → chunk-ZUWEVLDX.js} +1 -7
- package/dist/_browser-chunks/{formatter-OMEEQ6HG.js → formatter-QJ4M4OGQ.js} +4 -9
- package/dist/_browser-chunks/{syntaxhighlighter-CAVLW7PM.js → syntaxhighlighter-IQDEPFLK.js} +704 -1848
- package/dist/_node-chunks/{builder-manager-SM3UWERX.js → builder-manager-FTVC2JL7.js} +510 -1019
- package/dist/_node-chunks/camelcase-3SMT5WKC.js +37 -0
- package/dist/_node-chunks/chunk-2OVULPK3.js +54 -0
- package/dist/_node-chunks/chunk-3JJPSDXI.js +3043 -0
- package/dist/_node-chunks/chunk-54NMJ4II.js +1564 -0
- package/dist/_node-chunks/chunk-5V4A6MSI.js +943 -0
- package/dist/_node-chunks/chunk-6DEMT5VX.js +299 -0
- package/dist/_node-chunks/{chunk-HHSTA6QS.js → chunk-6L7FFBOW.js} +8 -10
- package/dist/_node-chunks/chunk-6ULDIDXV.js +46662 -0
- package/dist/_node-chunks/chunk-AREL5IXS.js +603 -0
- package/dist/_node-chunks/chunk-DWA53E73.js +23 -0
- package/dist/_node-chunks/chunk-FNYKBULZ.js +765 -0
- package/dist/_node-chunks/chunk-IUYZQKSX.js +70 -0
- package/dist/_node-chunks/{chunk-F6EFOEC7.js → chunk-K673CX4Q.js} +469 -983
- package/dist/_node-chunks/chunk-KJAFCNZ3.js +61 -0
- package/dist/_node-chunks/chunk-N3BJOOY5.js +78 -0
- package/dist/_node-chunks/{chunk-EBUEXRH5.js → chunk-O5FMCQHP.js} +116 -276
- package/dist/_node-chunks/chunk-RIKQZHV3.js +29 -0
- package/dist/_node-chunks/chunk-RURZIE3W.js +3780 -0
- package/dist/_node-chunks/chunk-RVII4SK6.js +919 -0
- package/dist/_node-chunks/chunk-S3PBHOVC.js +6024 -0
- package/dist/_node-chunks/chunk-SQSFX47N.js +61 -0
- package/dist/_node-chunks/{chunk-SGM3ZCCT.js → chunk-TURUTKVH.js} +292 -688
- package/dist/_node-chunks/chunk-VRICJPXY.js +72 -0
- package/dist/_node-chunks/chunk-WIWWMCEU.js +119 -0
- package/dist/_node-chunks/{chunk-ATDHMMIZ.js → chunk-XGNRK7QB.js} +15 -24
- package/dist/_node-chunks/chunk-Y2FOTPAE.js +4523 -0
- package/dist/_node-chunks/{chunk-GHIBZRKD.js → chunk-Y4UYN72K.js} +8133 -8887
- package/dist/_node-chunks/chunk-Z4BMBA5L.js +18 -0
- package/dist/_node-chunks/chunk-ZMCJS2GU.js +20 -0
- package/dist/_node-chunks/dist-TZLZ3T6L.js +121 -0
- package/dist/_node-chunks/globby-22GFCZQD.js +3452 -0
- package/dist/_node-chunks/lib-37NQ4ZIJ.js +366 -0
- package/dist/_node-chunks/mdx-N42X6CFJ-2TRB7OEH.js +14329 -0
- package/dist/_node-chunks/p-limit-UD7TYFDW.js +116 -0
- package/dist/actions/decorator.js +21 -42
- package/dist/actions/index.js +3 -3
- package/dist/babel/index.d.ts +671 -335
- package/dist/babel/index.js +10 -11
- package/dist/bin/core.js +602 -1549
- package/dist/bin/dispatcher.js +36 -36
- package/dist/bin/loader.js +24 -38
- package/dist/channels/index.js +98 -234
- package/dist/cli/index.d.ts +1479 -133
- package/dist/cli/index.js +30 -8540
- package/dist/client-logger/index.js +31 -61
- package/dist/common/index.d.ts +139 -62
- package/dist/common/index.js +66 -51
- package/dist/components/index.d.ts +575 -273
- package/dist/components/index.js +14863 -4313
- package/dist/core-events/index.js +2 -66
- package/dist/core-server/index.d.ts +3 -2
- package/dist/core-server/index.js +2911 -8519
- package/dist/core-server/presets/common-manager.css +2 -2
- package/dist/core-server/presets/common-manager.js +2521 -5233
- package/dist/core-server/presets/common-override-preset.js +31 -60
- package/dist/core-server/presets/common-preset.js +663 -962
- package/dist/csf/index.js +534 -1179
- package/dist/csf-tools/index.js +9 -9
- package/dist/docs-tools/index.js +6 -6
- package/dist/highlight/index.js +2 -2
- package/dist/instrumenter/index.js +199 -415
- package/dist/manager/globals-runtime.js +59044 -67141
- package/dist/manager/globals.js +2 -3
- package/dist/manager/manager-stores.d.ts +1 -0
- package/dist/manager/manager-stores.js +23 -0
- package/dist/manager/runtime.js +11569 -10953
- package/dist/manager-api/index.d.ts +1813 -2
- package/dist/manager-api/index.js +1348 -2401
- package/dist/manager-errors.d.ts +9 -0
- package/dist/manager-errors.js +3 -3
- package/dist/mocking-utils/index.d.ts +1126 -0
- package/dist/mocking-utils/index.js +1181 -0
- package/dist/node-logger/index.d.ts +192 -24
- package/dist/node-logger/index.js +23 -4471
- package/dist/preview/globals.js +2 -3
- package/dist/preview/runtime.js +10799 -22393
- package/dist/preview-api/index.d.ts +1 -1
- package/dist/preview-api/index.js +13 -13
- package/dist/preview-errors.d.ts +9 -0
- package/dist/preview-errors.js +4 -4
- package/dist/router/index.js +347 -899
- package/dist/server-errors.d.ts +34 -1
- package/dist/server-errors.js +17 -10
- package/dist/telemetry/index.d.ts +24 -3
- package/dist/telemetry/index.js +25 -24
- package/dist/test/index.js +6131 -11916
- package/dist/theming/create.d.ts +1 -0
- package/dist/theming/create.js +4 -4
- package/dist/theming/index.d.ts +3366 -2599
- package/dist/theming/index.js +501 -1091
- package/dist/types/index.d.ts +72 -8
- package/dist/types/index.js +27 -12
- package/dist/viewport/index.js +3 -3
- package/package.json +26 -17
- package/dist/_browser-chunks/Color-7ZNS6F6B.js +0 -1676
- package/dist/_browser-chunks/WithTooltip-SK46ZJ2J.js +0 -13
- package/dist/_browser-chunks/chunk-6A7OIVEL.js +0 -66
- package/dist/_browser-chunks/chunk-B4A3ADP3.js +0 -3816
- package/dist/_browser-chunks/chunk-BOOOPFZF.js +0 -2335
- package/dist/_browser-chunks/chunk-FSBVR7H5.js +0 -106
- package/dist/_browser-chunks/chunk-FUOHXXZT.js +0 -23
- package/dist/_browser-chunks/chunk-GTKOCWCT.js +0 -17
- package/dist/_browser-chunks/chunk-HHW4FUMO.js +0 -12
- package/dist/_browser-chunks/chunk-JVSKG4YS.js +0 -4052
- package/dist/_browser-chunks/chunk-LASUB7TL.js +0 -76
- package/dist/_browser-chunks/chunk-LYCSRYYR.js +0 -101
- package/dist/_browser-chunks/chunk-NVV6MIOE.js +0 -243
- package/dist/_browser-chunks/chunk-OBXWFEPB.js +0 -852
- package/dist/_browser-chunks/chunk-OPCDBBL3.js +0 -48
- package/dist/_browser-chunks/chunk-PB6FZ3WE.js +0 -130
- package/dist/_browser-chunks/chunk-RNE2IUTB.js +0 -1300
- package/dist/_browser-chunks/chunk-RW5PKMWM.js +0 -4182
- package/dist/_browser-chunks/chunk-SYS437NN.js +0 -122
- package/dist/_browser-chunks/chunk-U46RQHA4.js +0 -12
- package/dist/_browser-chunks/chunk-UTNZYD2N.js +0 -311
- package/dist/_browser-chunks/chunk-VUAFL5XK.js +0 -20
- package/dist/_browser-chunks/chunk-XDGMHOV7.js +0 -2197
- package/dist/_browser-chunks/chunk-XW6KSYKF.js +0 -16
- package/dist/_browser-chunks/chunk-Y3M7TW6K.js +0 -1041
- package/dist/_browser-chunks/chunk-ZNRFDIVA.js +0 -233
- package/dist/_node-chunks/camelcase-H5QSGQLK.js +0 -18
- package/dist/_node-chunks/chunk-3THWHQOC.js +0 -61
- package/dist/_node-chunks/chunk-45YUOLTU.js +0 -69
- package/dist/_node-chunks/chunk-4QSNCPAU.js +0 -64656
- package/dist/_node-chunks/chunk-744PQSOU.js +0 -79
- package/dist/_node-chunks/chunk-74Z2U7QG.js +0 -1544
- package/dist/_node-chunks/chunk-7MB7TFPO.js +0 -1198
- package/dist/_node-chunks/chunk-A7GS4RFT.js +0 -697
- package/dist/_node-chunks/chunk-BIA3A5UM.js +0 -61
- package/dist/_node-chunks/chunk-C5G7CLWX.js +0 -1657
- package/dist/_node-chunks/chunk-DLFUKMYJ.js +0 -1531
- package/dist/_node-chunks/chunk-EMRGRXKT.js +0 -111
- package/dist/_node-chunks/chunk-EX46EHHY.js +0 -420
- package/dist/_node-chunks/chunk-F76QKNOJ.js +0 -304
- package/dist/_node-chunks/chunk-HDCRUTEF.js +0 -220
- package/dist/_node-chunks/chunk-HUYAOIPH.js +0 -90
- package/dist/_node-chunks/chunk-IBJZQZJC.js +0 -101
- package/dist/_node-chunks/chunk-KZN2RDDT.js +0 -6712
- package/dist/_node-chunks/chunk-LYUNFU3F.js +0 -4741
- package/dist/_node-chunks/chunk-N44SIS6K.js +0 -28
- package/dist/_node-chunks/chunk-NILZM6KR.js +0 -18
- package/dist/_node-chunks/chunk-PC4ZRP6W.js +0 -34
- package/dist/_node-chunks/chunk-TJNGOQUH.js +0 -4272
- package/dist/_node-chunks/chunk-UBSYLHIL.js +0 -1250
- package/dist/_node-chunks/chunk-UTCLXPOC.js +0 -1518
- package/dist/_node-chunks/chunk-WOXXODXP.js +0 -5029
- package/dist/_node-chunks/chunk-XC4MEUA6.js +0 -1586
- package/dist/_node-chunks/chunk-YRXXMKRR.js +0 -2256
- package/dist/_node-chunks/dist-SL73W244.js +0 -175
- package/dist/_node-chunks/globby-ZSHAUQZ5.js +0 -5222
- package/dist/_node-chunks/lib-U2VIPUTI.js +0 -518
- package/dist/_node-chunks/mdx-N42X6CFJ-ZLHD33JK.js +0 -22017
- package/dist/_node-chunks/p-limit-K5BS5MSV.js +0 -168
- package/dist/_node-chunks/plugin-5PD4YIUH.js +0 -129
- package/dist/_node-chunks/plugin-MONDT2WL.js +0 -159
- package/dist/_node-chunks/webpack-inject-mocker-runtime-plugin-EUZJRG3W.js +0 -69102
- package/dist/_node-chunks/webpack-mock-plugin-T4LDXEHE.js +0 -124
- package/dist/core-server/presets/webpack/loaders/storybook-mock-transform-loader.js +0 -36
- package/dist/core-server/presets/webpack/loaders/webpack-automock-loader.js +0 -33
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
import CJS_COMPAT_NODE_URL_jdojl2z4eei from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_jdojl2z4eei from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_jdojl2z4eei from "node:module";
|
|
4
|
+
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_jdojl2z4eei.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_jdojl2z4eei.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_jdojl2z4eei.createRequire(import.meta.url);
|
|
8
|
+
|
|
9
|
+
// ------------------------------------------------------------
|
|
10
|
+
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
+
// ------------------------------------------------------------
|
|
12
|
+
import {
|
|
13
|
+
require_build
|
|
14
|
+
} from "./chunk-AREL5IXS.js";
|
|
15
|
+
import {
|
|
16
|
+
StorybookError
|
|
17
|
+
} from "./chunk-N3BJOOY5.js";
|
|
18
|
+
import {
|
|
19
|
+
resolvePackageDir
|
|
20
|
+
} from "./chunk-FNYKBULZ.js";
|
|
21
|
+
import {
|
|
22
|
+
relative
|
|
23
|
+
} from "./chunk-WIWWMCEU.js";
|
|
24
|
+
import {
|
|
25
|
+
require_dist
|
|
26
|
+
} from "./chunk-SQSFX47N.js";
|
|
27
|
+
import {
|
|
28
|
+
require_picocolors
|
|
29
|
+
} from "./chunk-XGNRK7QB.js";
|
|
30
|
+
import {
|
|
31
|
+
__toESM
|
|
32
|
+
} from "./chunk-2OVULPK3.js";
|
|
33
|
+
|
|
34
|
+
// src/core-server/utils/server-statics.ts
|
|
35
|
+
import { existsSync, statSync } from "node:fs";
|
|
36
|
+
import { readFile, stat } from "node:fs/promises";
|
|
37
|
+
import { basename, isAbsolute, join, posix, resolve, sep, win32 } from "node:path";
|
|
38
|
+
import {
|
|
39
|
+
getDirectoryFromWorkingDir,
|
|
40
|
+
getProjectRoot,
|
|
41
|
+
resolvePathInStorybookCache
|
|
42
|
+
} from "storybook/internal/common";
|
|
43
|
+
import { CLI_COLORS, logger, once } from "storybook/internal/node-logger";
|
|
44
|
+
var import_picocolors = __toESM(require_picocolors(), 1), import_sirv = __toESM(require_build(), 1), import_ts_dedent = __toESM(require_dist(), 1);
|
|
45
|
+
var cacheDir = resolvePathInStorybookCache("", "ignored-sub").split("ignored-sub")[0], files = /* @__PURE__ */ new Map(), readFileOnce = async (path) => {
|
|
46
|
+
if (files.has(path))
|
|
47
|
+
return files.get(path);
|
|
48
|
+
{
|
|
49
|
+
let [data, stats] = await Promise.all([readFile(path, "utf-8"), stat(path)]), result = { data, mtime: stats.mtimeMs };
|
|
50
|
+
return files.set(path, result), result;
|
|
51
|
+
}
|
|
52
|
+
}, faviconWrapperPath = join(
|
|
53
|
+
resolvePackageDir("storybook"),
|
|
54
|
+
"/assets/browser/favicon-wrapper.svg"
|
|
55
|
+
), prepareNestedSvg = (svg) => {
|
|
56
|
+
let [, openingTag, contents, closingTag] = svg?.match(/(<svg[^>]*>)(.*?)(<\/svg>)/s) ?? [];
|
|
57
|
+
if (!openingTag || !contents || !closingTag)
|
|
58
|
+
return svg;
|
|
59
|
+
let width, height, modifiedTag = openingTag.replace(/width=["']([^"']*)["']/g, (_, value) => (width = parseFloat(value), 'width="32px"')).replace(/height=["']([^"']*)["']/g, (_, value) => (height = parseFloat(value), 'height="32px"'));
|
|
60
|
+
return !/viewBox=["'][^"']*["']/.test(modifiedTag) && width && height && (modifiedTag = modifiedTag.replace(/>$/, ` viewBox="0 0 ${width} ${height}">`)), modifiedTag = modifiedTag.replace(/preserveAspectRatio=["'][^"']*["']/g, "").replace(/>$/, ' preserveAspectRatio="xMidYMid meet">'), modifiedTag + contents + closingTag;
|
|
61
|
+
};
|
|
62
|
+
async function useStatics(app, options) {
|
|
63
|
+
let staticDirs = await options.presets.apply("staticDirs") ?? [], faviconPath = await options.presets.apply("favicon"), faviconDir = resolve(faviconPath, ".."), faviconFile = basename(faviconPath);
|
|
64
|
+
app.use(`/${faviconFile}`, async (req, res, next) => {
|
|
65
|
+
let status = req.query.status;
|
|
66
|
+
if (status && faviconFile.endsWith(".svg") && ["active", "critical", "negative", "positive", "warning"].includes(status)) {
|
|
67
|
+
let [faviconInfo, faviconWrapperInfo] = await Promise.all([
|
|
68
|
+
readFileOnce(join(faviconDir, faviconFile)),
|
|
69
|
+
readFileOnce(faviconWrapperPath)
|
|
70
|
+
]).catch((e) => (e instanceof Error && once.warn(`Failed to read favicon: ${e.message}`), [null, null]));
|
|
71
|
+
if (faviconInfo && faviconWrapperInfo) {
|
|
72
|
+
let svg = faviconWrapperInfo.data.replace('<g id="mask"', `<g mask="url(#${status}-mask)"`).replace('<use id="status"', `<use href="#${status}"`).replace('<use id="icon" />', prepareNestedSvg(faviconInfo.data));
|
|
73
|
+
res.setHeader("Content-Type", "image/svg+xml"), res.setHeader("ETag", `"${faviconWrapperInfo.mtime}-${faviconInfo.mtime}"`), res.end(svg);
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return req.url = `/${faviconFile}`, sirvWorkaround(faviconDir)(req, res, next);
|
|
78
|
+
}), staticDirs.map((dir) => {
|
|
79
|
+
try {
|
|
80
|
+
let { staticDir, staticPath, targetEndpoint } = mapStaticDir(dir, options.configDir);
|
|
81
|
+
if (!targetEndpoint.startsWith("/sb-") && !staticDir.startsWith(cacheDir)) {
|
|
82
|
+
let relativeStaticDir = relative(getProjectRoot(), staticDir);
|
|
83
|
+
logger.debug(
|
|
84
|
+
`Serving static files from ${CLI_COLORS.info(relativeStaticDir)} at ${CLI_COLORS.info(targetEndpoint)}`
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
if (existsSync(staticPath) && statSync(staticPath).isFile()) {
|
|
88
|
+
let staticPathDir = resolve(staticPath, ".."), staticPathFile = basename(staticPath);
|
|
89
|
+
app.use(targetEndpoint, (req, res, next) => {
|
|
90
|
+
req.url = `/${staticPathFile}`, sirvWorkaround(staticPathDir)(req, res, next);
|
|
91
|
+
});
|
|
92
|
+
} else
|
|
93
|
+
app.use(targetEndpoint, sirvWorkaround(staticPath));
|
|
94
|
+
} catch (e) {
|
|
95
|
+
e instanceof Error && logger.warn(e.message);
|
|
96
|
+
}
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
var sirvWorkaround = (dir, opts = {}) => (req, res, next) => {
|
|
100
|
+
let originalParsedUrl = req._parsedUrl, maybeNext = next ? () => {
|
|
101
|
+
req._parsedUrl = originalParsedUrl, next();
|
|
102
|
+
} : void 0;
|
|
103
|
+
(0, import_sirv.default)(dir, { dev: !0, etag: !0, extensions: [], ...opts })(req, res, maybeNext);
|
|
104
|
+
}, parseStaticDir = (arg) => {
|
|
105
|
+
let lastColonIndex = arg.lastIndexOf(":"), isWindowsRawDirOnly = win32.isAbsolute(arg) && lastColonIndex === 1, splitIndex = lastColonIndex !== -1 && !isWindowsRawDirOnly ? lastColonIndex : arg.length, [from, to] = [arg.slice(0, splitIndex), arg.slice(splitIndex + 1)], staticDir = isAbsolute(from) ? from : `./${from}`, staticPath = resolve(staticDir);
|
|
106
|
+
if (!existsSync(staticPath))
|
|
107
|
+
throw new Error(
|
|
108
|
+
import_ts_dedent.dedent`
|
|
109
|
+
Failed to load static files, no such directory: ${import_picocolors.default.cyan(staticPath)}
|
|
110
|
+
Make sure this directory exists.
|
|
111
|
+
`
|
|
112
|
+
);
|
|
113
|
+
let targetDir = (to || (statSync(staticPath).isFile() ? basename(staticPath) : "/")).split(sep).join(posix.sep).replace(/^\/?/, "./"), targetEndpoint = targetDir.substring(1);
|
|
114
|
+
return { staticDir, staticPath, targetDir, targetEndpoint };
|
|
115
|
+
}, mapStaticDir = (staticDir, configDir) => {
|
|
116
|
+
let specifier = typeof staticDir == "string" ? staticDir : `${staticDir.from}:${staticDir.to}`, normalizedDir = isAbsolute(specifier) ? specifier : getDirectoryFromWorkingDir({ configDir, workingDir: process.cwd(), directory: specifier });
|
|
117
|
+
return parseStaticDir(normalizedDir);
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
// src/core-server/withTelemetry.ts
|
|
121
|
+
import { HandledError, cache, isCI, loadAllPresets } from "storybook/internal/common";
|
|
122
|
+
import { logger as logger2, prompt } from "storybook/internal/node-logger";
|
|
123
|
+
import {
|
|
124
|
+
ErrorCollector,
|
|
125
|
+
getPrecedingUpgrade,
|
|
126
|
+
oneWayHash,
|
|
127
|
+
telemetry
|
|
128
|
+
} from "storybook/internal/telemetry";
|
|
129
|
+
var promptCrashReports = async () => {
|
|
130
|
+
if (isCI() || !process.stdout.isTTY)
|
|
131
|
+
return;
|
|
132
|
+
let enableCrashReports = await prompt.confirm({
|
|
133
|
+
message: "Would you like to send anonymous crash reports to improve Storybook and fix bugs faster?",
|
|
134
|
+
initialValue: !0
|
|
135
|
+
});
|
|
136
|
+
return await cache.set("enableCrashReports", enableCrashReports), enableCrashReports;
|
|
137
|
+
};
|
|
138
|
+
async function getErrorLevel({
|
|
139
|
+
cliOptions,
|
|
140
|
+
presetOptions,
|
|
141
|
+
skipPrompt
|
|
142
|
+
}) {
|
|
143
|
+
if (cliOptions.disableTelemetry)
|
|
144
|
+
return "none";
|
|
145
|
+
if (!presetOptions)
|
|
146
|
+
return "error";
|
|
147
|
+
let core = await (await loadAllPresets(presetOptions)).apply("core");
|
|
148
|
+
if (core?.enableCrashReports !== void 0)
|
|
149
|
+
return core.enableCrashReports ? "full" : "error";
|
|
150
|
+
if (core?.disableTelemetry)
|
|
151
|
+
return "none";
|
|
152
|
+
let valueFromCache = await cache.get("enableCrashReports") ?? await cache.get("enableCrashreports");
|
|
153
|
+
if (valueFromCache !== void 0)
|
|
154
|
+
return valueFromCache ? "full" : "error";
|
|
155
|
+
if (skipPrompt)
|
|
156
|
+
return "error";
|
|
157
|
+
let valueFromPrompt = await promptCrashReports();
|
|
158
|
+
return valueFromPrompt !== void 0 ? valueFromPrompt ? "full" : "error" : "full";
|
|
159
|
+
}
|
|
160
|
+
async function sendTelemetryError(_error, eventType, options, blocking = !0) {
|
|
161
|
+
try {
|
|
162
|
+
let errorLevel = "error";
|
|
163
|
+
try {
|
|
164
|
+
errorLevel = await getErrorLevel(options);
|
|
165
|
+
} catch {
|
|
166
|
+
}
|
|
167
|
+
if (errorLevel !== "none") {
|
|
168
|
+
let precedingUpgrade = await getPrecedingUpgrade(), error = _error, errorHash;
|
|
169
|
+
"message" in error ? errorHash = error.message ? oneWayHash(error.message) : "EMPTY_MESSAGE" : errorHash = "NO_MESSAGE";
|
|
170
|
+
let { code, name, category } = error;
|
|
171
|
+
await telemetry(
|
|
172
|
+
"error",
|
|
173
|
+
{
|
|
174
|
+
code,
|
|
175
|
+
name,
|
|
176
|
+
category,
|
|
177
|
+
eventType,
|
|
178
|
+
blocking,
|
|
179
|
+
precedingUpgrade,
|
|
180
|
+
error: errorLevel === "full" ? error : void 0,
|
|
181
|
+
errorHash,
|
|
182
|
+
// if we ever end up sending a non-error instance, we'd like to know
|
|
183
|
+
isErrorInstance: error instanceof Error
|
|
184
|
+
},
|
|
185
|
+
{
|
|
186
|
+
immediate: !0,
|
|
187
|
+
configDir: options.cliOptions.configDir || options.presetOptions?.configDir,
|
|
188
|
+
enableCrashReports: errorLevel === "full"
|
|
189
|
+
}
|
|
190
|
+
);
|
|
191
|
+
}
|
|
192
|
+
} catch {
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
function isTelemetryEnabled(options) {
|
|
196
|
+
return !(options.cliOptions.disableTelemetry || options.cliOptions.test === !0);
|
|
197
|
+
}
|
|
198
|
+
async function withTelemetry(eventType, options, run) {
|
|
199
|
+
let enableTelemetry = isTelemetryEnabled(options), canceled = !1;
|
|
200
|
+
async function cancelTelemetry() {
|
|
201
|
+
canceled = !0, enableTelemetry && await telemetry("canceled", { eventType }, { stripMetadata: !0, immediate: !0 }), process.exit(0);
|
|
202
|
+
}
|
|
203
|
+
eventType === "init" && process.on("SIGINT", cancelTelemetry), enableTelemetry && telemetry("boot", { eventType }, { stripMetadata: !0 });
|
|
204
|
+
try {
|
|
205
|
+
return await run();
|
|
206
|
+
} catch (error) {
|
|
207
|
+
if (canceled)
|
|
208
|
+
return;
|
|
209
|
+
if (!(error instanceof HandledError || error instanceof StorybookError && error.isHandledError)) {
|
|
210
|
+
let { printError = logger2.error } = options;
|
|
211
|
+
printError(error);
|
|
212
|
+
}
|
|
213
|
+
throw enableTelemetry && await sendTelemetryError(error, eventType, options), error;
|
|
214
|
+
} finally {
|
|
215
|
+
if (enableTelemetry) {
|
|
216
|
+
let errors = ErrorCollector.getErrors();
|
|
217
|
+
for (let error of errors)
|
|
218
|
+
await sendTelemetryError(error, eventType, options, !1);
|
|
219
|
+
process.off("SIGINT", cancelTelemetry);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
}
|
|
223
|
+
|
|
224
|
+
// ../node_modules/es-toolkit/dist/function/debounce.mjs
|
|
225
|
+
function debounce(func, debounceMs, { signal, edges } = {}) {
|
|
226
|
+
let pendingThis, pendingArgs = null, leading = edges != null && edges.includes("leading"), trailing = edges == null || edges.includes("trailing"), invoke = () => {
|
|
227
|
+
pendingArgs !== null && (func.apply(pendingThis, pendingArgs), pendingThis = void 0, pendingArgs = null);
|
|
228
|
+
}, onTimerEnd = () => {
|
|
229
|
+
trailing && invoke(), cancel();
|
|
230
|
+
}, timeoutId = null, schedule = () => {
|
|
231
|
+
timeoutId != null && clearTimeout(timeoutId), timeoutId = setTimeout(() => {
|
|
232
|
+
timeoutId = null, onTimerEnd();
|
|
233
|
+
}, debounceMs);
|
|
234
|
+
}, cancelTimer = () => {
|
|
235
|
+
timeoutId !== null && (clearTimeout(timeoutId), timeoutId = null);
|
|
236
|
+
}, cancel = () => {
|
|
237
|
+
cancelTimer(), pendingThis = void 0, pendingArgs = null;
|
|
238
|
+
}, flush = () => {
|
|
239
|
+
invoke();
|
|
240
|
+
}, debounced = function(...args) {
|
|
241
|
+
if (signal?.aborted)
|
|
242
|
+
return;
|
|
243
|
+
pendingThis = this, pendingArgs = args;
|
|
244
|
+
let isFirstCall = timeoutId == null;
|
|
245
|
+
schedule(), leading && isFirstCall && invoke();
|
|
246
|
+
};
|
|
247
|
+
return debounced.schedule = schedule, debounced.cancel = cancel, debounced.flush = flush, signal?.addEventListener("abort", cancel, { once: !0 }), debounced;
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// ../node_modules/es-toolkit/dist/function/throttle.mjs
|
|
251
|
+
function throttle(func, throttleMs, { signal, edges = ["leading", "trailing"] } = {}) {
|
|
252
|
+
let pendingAt = null, debounced = debounce(func, throttleMs, { signal, edges }), throttled = function(...args) {
|
|
253
|
+
pendingAt == null ? pendingAt = Date.now() : Date.now() - pendingAt >= throttleMs && (pendingAt = Date.now(), debounced.cancel()), debounced.apply(this, args);
|
|
254
|
+
};
|
|
255
|
+
return throttled.cancel = debounced.cancel, throttled.flush = debounced.flush, throttled;
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
// ../node_modules/es-toolkit/dist/function/partial.mjs
|
|
259
|
+
function partial(func, ...partialArgs) {
|
|
260
|
+
return partialImpl(func, placeholderSymbol, ...partialArgs);
|
|
261
|
+
}
|
|
262
|
+
function partialImpl(func, placeholder, ...partialArgs) {
|
|
263
|
+
let partialed = function(...providedArgs) {
|
|
264
|
+
let providedArgsIndex = 0, substitutedArgs = partialArgs.slice().map((arg) => arg === placeholder ? providedArgs[providedArgsIndex++] : arg), remainingArgs = providedArgs.slice(providedArgsIndex);
|
|
265
|
+
return func.apply(this, substitutedArgs.concat(remainingArgs));
|
|
266
|
+
};
|
|
267
|
+
return func.prototype && (partialed.prototype = Object.create(func.prototype)), partialed;
|
|
268
|
+
}
|
|
269
|
+
var placeholderSymbol = Symbol("partial.placeholder");
|
|
270
|
+
partial.placeholder = placeholderSymbol;
|
|
271
|
+
|
|
272
|
+
// ../node_modules/es-toolkit/dist/function/partialRight.mjs
|
|
273
|
+
function partialRight(func, ...partialArgs) {
|
|
274
|
+
return partialRightImpl(func, placeholderSymbol2, ...partialArgs);
|
|
275
|
+
}
|
|
276
|
+
function partialRightImpl(func, placeholder, ...partialArgs) {
|
|
277
|
+
let partialedRight = function(...providedArgs) {
|
|
278
|
+
let placeholderLength = partialArgs.filter((arg) => arg === placeholder).length, rangeLength = Math.max(providedArgs.length - placeholderLength, 0), remainingArgs = providedArgs.slice(0, rangeLength), providedArgsIndex = rangeLength, substitutedArgs = partialArgs.slice().map((arg) => arg === placeholder ? providedArgs[providedArgsIndex++] : arg);
|
|
279
|
+
return func.apply(this, remainingArgs.concat(substitutedArgs));
|
|
280
|
+
};
|
|
281
|
+
return func.prototype && (partialedRight.prototype = Object.create(func.prototype)), partialedRight;
|
|
282
|
+
}
|
|
283
|
+
var placeholderSymbol2 = Symbol("partialRight.placeholder");
|
|
284
|
+
partialRight.placeholder = placeholderSymbol2;
|
|
285
|
+
|
|
286
|
+
// ../node_modules/es-toolkit/dist/function/retry.mjs
|
|
287
|
+
var DEFAULT_RETRIES = Number.POSITIVE_INFINITY;
|
|
288
|
+
|
|
289
|
+
export {
|
|
290
|
+
useStatics,
|
|
291
|
+
parseStaticDir,
|
|
292
|
+
mapStaticDir,
|
|
293
|
+
debounce,
|
|
294
|
+
throttle,
|
|
295
|
+
getErrorLevel,
|
|
296
|
+
sendTelemetryError,
|
|
297
|
+
isTelemetryEnabled,
|
|
298
|
+
withTelemetry
|
|
299
|
+
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_jdojl2z4eei from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_jdojl2z4eei from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_jdojl2z4eei from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_jdojl2z4eei.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_jdojl2z4eei.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_jdojl2z4eei.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -18,11 +18,9 @@ var BROWSER_TARGETS = [
|
|
|
18
18
|
"safari18.3",
|
|
19
19
|
"ios18.3",
|
|
20
20
|
"opera117"
|
|
21
|
-
]
|
|
22
|
-
var NODE_TARGET = "node20.19";
|
|
23
|
-
var SUPPORTED_FEATURES = {
|
|
21
|
+
], NODE_TARGET = "node20.19", SUPPORTED_FEATURES = {
|
|
24
22
|
// React Native does not support class static blocks without a specific babel plugin
|
|
25
|
-
"class-static-blocks":
|
|
23
|
+
"class-static-blocks": !1
|
|
26
24
|
};
|
|
27
25
|
|
|
28
26
|
export {
|