storybook 10.1.0-alpha.12 → 10.1.0-alpha.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_browser-chunks/{chunk-74YHFU5B.js → chunk-2XZMBGTA.js} +1 -1
- package/dist/_browser-chunks/{chunk-EBHB6RPS.js → chunk-FQ7SLVLR.js} +6 -1
- package/dist/_browser-chunks/{chunk-X3DUQ5RA.js → chunk-GFY5R5EY.js} +1 -1
- package/dist/_browser-chunks/{chunk-WXP2XJ3O.js → chunk-P4F4UVXX.js} +1 -0
- package/dist/_browser-chunks/{chunk-BE2DAXKJ.js → chunk-SS2NHR7W.js} +4 -1
- package/dist/_browser-chunks/{syntaxhighlighter-WKBQ5RC7.js → syntaxhighlighter-IQDEPFLK.js} +1 -1
- package/dist/_node-chunks/{builder-manager-YUOHSIUB.js → builder-manager-FQ5J6V3U.js} +32 -22
- package/dist/_node-chunks/{chunk-B6JWY6PC.js → camelcase-VGUYV77Z.js} +8 -8
- package/dist/_node-chunks/{chunk-FZLRAH4N.js → chunk-2JR3QBT2.js} +7 -7
- package/dist/_node-chunks/chunk-3EBH66BB.js +23 -0
- package/dist/_node-chunks/{chunk-E5FJS66Z.js → chunk-4ZFHN3ZY.js} +6 -6
- package/dist/_node-chunks/{chunk-5HV3B5OP.js → chunk-63PL4NNE.js} +1104 -13
- package/dist/_node-chunks/{chunk-NAOYEL54.js → chunk-A4KENTXT.js} +7 -7
- package/dist/_node-chunks/{chunk-4FT2DHGE.js → chunk-ALIA3J6S.js} +44 -10
- package/dist/_node-chunks/{chunk-WFLWJO24.js → chunk-C2HKH2XQ.js} +5710 -2414
- package/dist/_node-chunks/{chunk-WA6KZQZ2.js → chunk-DQNBAQYT.js} +6 -6
- package/dist/_node-chunks/{chunk-JARUEMEP.js → chunk-F74UHHR6.js} +7 -7
- package/dist/_node-chunks/{chunk-WUXQMQCB.js → chunk-H5XWXVWR.js} +6 -6
- package/dist/_node-chunks/{chunk-OP3INKUD.js → chunk-JMP7YFX2.js} +6 -6
- package/dist/_node-chunks/{chunk-DWXTZT3D.js → chunk-JZR4DHG2.js} +19 -7
- package/dist/_node-chunks/{chunk-QCO2ZM7F.js → chunk-KEA7CVMZ.js} +122 -32
- package/dist/_node-chunks/{chunk-DUXPWBOK.js → chunk-KF3WTAEP.js} +7 -7
- package/dist/_node-chunks/{chunk-2D2IODUU.js → chunk-LPPM7L5D.js} +51 -71
- package/dist/_node-chunks/{chunk-2DMESZFJ.js → chunk-MJUDR7HQ.js} +7 -7
- package/dist/_node-chunks/chunk-NPB4THZQ.js +18 -0
- package/dist/_node-chunks/chunk-NZBK3DSJ.js +29 -0
- package/dist/_node-chunks/{chunk-5KLIDWFN.js → chunk-Q2QUNQK6.js} +7 -7
- package/dist/_node-chunks/{chunk-EZWWR7AR.js → chunk-TMCKISJR.js} +101 -118
- package/dist/_node-chunks/chunk-TWK7AR3U.js +6024 -0
- package/dist/_node-chunks/{chunk-CZ5GHJCC.js → chunk-V7CXWJXC.js} +7 -7
- package/dist/_node-chunks/chunk-W4F3T6CY.js +3781 -0
- package/dist/_node-chunks/{chunk-SEMIAAWG.js → chunk-WACDSFMO.js} +9 -9
- package/dist/_node-chunks/{chunk-A4APXFQ2.js → chunk-WVXZFQQU.js} +14 -8
- package/dist/_node-chunks/chunk-XBPE4PT7.js +78 -0
- package/dist/_node-chunks/chunk-YMM6BYF2.js +61 -0
- package/dist/_node-chunks/{chunk-XXPJ7XR3.js → chunk-ZGZKNZ5S.js} +6 -6
- package/dist/_node-chunks/{dist-DS2B5A3J.js → dist-DR3AP3RJ.js} +9 -9
- package/dist/_node-chunks/{globby-6THB7HVX.js → globby-D4FPSHY2.js} +9 -9
- package/dist/_node-chunks/{lib-5NKX4YGG.js → lib-ZEFOVNTK.js} +7 -7
- package/dist/_node-chunks/{mdx-N42X6CFJ-ZLT3QOFF.js → mdx-N42X6CFJ-PJF3ICCG.js} +8 -8
- package/dist/_node-chunks/{p-limit-PDMWNG7W.js → p-limit-CYQOFYPV.js} +7 -7
- package/dist/babel/index.js +10 -11
- package/dist/bin/core.js +33 -26
- package/dist/bin/dispatcher.js +31 -20
- package/dist/bin/loader.js +10 -13
- package/dist/cli/index.d.ts +1479 -133
- package/dist/cli/index.js +30 -5159
- package/dist/common/index.d.ts +139 -62
- package/dist/common/index.js +66 -51
- package/dist/components/index.d.ts +136 -26
- package/dist/components/index.js +3163 -2859
- package/dist/core-server/index.d.ts +3 -2
- package/dist/core-server/index.js +112 -1486
- package/dist/core-server/presets/common-manager.js +5 -5
- package/dist/core-server/presets/common-override-preset.js +9 -9
- package/dist/core-server/presets/common-preset.js +272 -81
- package/dist/csf/index.js +2 -2
- package/dist/csf-tools/index.js +9 -9
- package/dist/manager/globals-runtime.js +21557 -21133
- package/dist/manager/manager-stores.d.ts +1 -0
- package/dist/manager/manager-stores.js +23 -0
- package/dist/manager/runtime.js +6695 -720
- package/dist/manager-api/index.d.ts +1802 -1
- package/dist/manager-api/index.js +105 -11
- package/dist/manager-errors.d.ts +6 -0
- package/dist/manager-errors.js +2 -2
- package/dist/mocking-utils/index.d.ts +1126 -0
- package/dist/{_node-chunks/chunk-ZXSD6L3S.js → mocking-utils/index.js} +441 -16
- package/dist/node-logger/index.d.ts +192 -24
- package/dist/node-logger/index.js +23 -3148
- package/dist/preview/runtime.js +35 -3
- package/dist/preview-api/index.d.ts +69 -68
- package/dist/preview-api/index.js +2 -2
- package/dist/preview-errors.d.ts +6 -0
- package/dist/preview-errors.js +2 -2
- package/dist/server-errors.d.ts +31 -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/types/index.d.ts +71 -8
- package/dist/types/index.js +25 -1
- package/package.json +11 -9
- package/dist/_node-chunks/camelcase-JREIL7NV.js +0 -18
- package/dist/_node-chunks/chunk-FDXFVHIL.js +0 -1114
- package/dist/_node-chunks/chunk-HZG65SU3.js +0 -34
- package/dist/_node-chunks/chunk-IXVYNBMD.js +0 -18
- package/dist/_node-chunks/chunk-LIH7MTP7.js +0 -3214
- package/dist/_node-chunks/chunk-N5GIRUP5.js +0 -1047
- package/dist/_node-chunks/chunk-O5DA7YLO.js +0 -3171
- package/dist/_node-chunks/chunk-QYQIZBS6.js +0 -26
- package/dist/_node-chunks/chunk-TS2UUH2J.js +0 -301
- package/dist/_node-chunks/chunk-Y4E6IGQF.js +0 -61
- package/dist/_node-chunks/chunk-ZL3AFKRX.js +0 -1029
- package/dist/_node-chunks/plugin-6XMWOGPO.js +0 -123
- package/dist/_node-chunks/plugin-LTOXVT6A.js +0 -109
- package/dist/_node-chunks/webpack-inject-mocker-runtime-plugin-2SFE5LQS.js +0 -46582
- package/dist/_node-chunks/webpack-mock-plugin-CX5J2U56.js +0 -92
- package/dist/core-server/presets/webpack/loaders/storybook-mock-transform-loader.js +0 -32
- package/dist/core-server/presets/webpack/loaders/webpack-automock-loader.js +0 -28
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_yntchggdu3k from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_yntchggdu3k from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_yntchggdu3k from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_yntchggdu3k.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_yntchggdu3k.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_yntchggdu3k.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_yntchggdu3k from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_yntchggdu3k from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_yntchggdu3k from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_yntchggdu3k.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_yntchggdu3k.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_yntchggdu3k.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -12,7 +12,7 @@ var require = CJS_COMPAT_NODE_MODULE_57ru1wfqqjv.createRequire(import.meta.url);
|
|
|
12
12
|
import {
|
|
13
13
|
__commonJS,
|
|
14
14
|
__toESM
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-JMP7YFX2.js";
|
|
16
16
|
|
|
17
17
|
// ../node_modules/balanced-match/index.js
|
|
18
18
|
var require_balanced_match = __commonJS({
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_yntchggdu3k from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_yntchggdu3k from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_yntchggdu3k from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_yntchggdu3k.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_yntchggdu3k.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_yntchggdu3k.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_yntchggdu3k from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_yntchggdu3k from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_yntchggdu3k from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_yntchggdu3k.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_yntchggdu3k.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_yntchggdu3k.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_yntchggdu3k from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_yntchggdu3k from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_yntchggdu3k from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_yntchggdu3k.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_yntchggdu3k.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_yntchggdu3k.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -50,9 +50,21 @@ function any(names, options) {
|
|
|
50
50
|
if (tmp = join2(dir, names[j]), existsSync(tmp)) return tmp;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
// ../node_modules/tiny-invariant/dist/esm/tiny-invariant.js
|
|
54
|
+
var isProduction = process.env.NODE_ENV === "production", prefix = "Invariant failed";
|
|
55
|
+
function invariant(condition, message) {
|
|
56
|
+
if (!condition) {
|
|
57
|
+
if (isProduction)
|
|
58
|
+
throw new Error(prefix);
|
|
59
|
+
var provided = typeof message == "function" ? message() : message, value = provided ? "".concat(prefix, ": ").concat(provided) : prefix;
|
|
60
|
+
throw new Error(value);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
53
64
|
export {
|
|
54
65
|
from,
|
|
55
66
|
up,
|
|
56
67
|
up2,
|
|
57
|
-
any
|
|
68
|
+
any,
|
|
69
|
+
invariant
|
|
58
70
|
};
|
|
@@ -1,40 +1,47 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_yntchggdu3k from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_yntchggdu3k from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_yntchggdu3k from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_yntchggdu3k.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_yntchggdu3k.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_yntchggdu3k.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
11
|
// ------------------------------------------------------------
|
|
12
12
|
import {
|
|
13
13
|
require_build
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-V7CXWJXC.js";
|
|
15
|
+
import {
|
|
16
|
+
StorybookError
|
|
17
|
+
} from "./chunk-XBPE4PT7.js";
|
|
15
18
|
import {
|
|
16
19
|
resolvePackageDir
|
|
17
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-WVXZFQQU.js";
|
|
18
21
|
import {
|
|
19
|
-
|
|
20
|
-
} from "./chunk-
|
|
22
|
+
relative
|
|
23
|
+
} from "./chunk-DQNBAQYT.js";
|
|
21
24
|
import {
|
|
22
25
|
require_dist
|
|
23
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-KF3WTAEP.js";
|
|
24
27
|
import {
|
|
25
28
|
require_picocolors
|
|
26
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-A4KENTXT.js";
|
|
27
30
|
import {
|
|
28
31
|
__toESM
|
|
29
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-JMP7YFX2.js";
|
|
30
33
|
|
|
31
34
|
// src/core-server/utils/server-statics.ts
|
|
32
|
-
var import_picocolors = __toESM(require_picocolors(), 1), import_sirv = __toESM(require_build(), 1), import_ts_dedent = __toESM(require_dist(), 1);
|
|
33
35
|
import { existsSync, statSync } from "node:fs";
|
|
34
36
|
import { readFile, stat } from "node:fs/promises";
|
|
35
37
|
import { basename, isAbsolute, join, posix, resolve, sep, win32 } from "node:path";
|
|
36
|
-
import {
|
|
37
|
-
|
|
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);
|
|
38
45
|
var cacheDir = resolvePathInStorybookCache("", "ignored-sub").split("ignored-sub")[0], files = /* @__PURE__ */ new Map(), readFileOnce = async (path) => {
|
|
39
46
|
if (files.has(path))
|
|
40
47
|
return files.get(path);
|
|
@@ -71,9 +78,13 @@ async function useStatics(app, options) {
|
|
|
71
78
|
}), staticDirs.map((dir) => {
|
|
72
79
|
try {
|
|
73
80
|
let { staticDir, staticPath, targetEndpoint } = mapStaticDir(dir, options.configDir);
|
|
74
|
-
if (!targetEndpoint.startsWith("/sb-") && !staticDir.startsWith(cacheDir)
|
|
75
|
-
|
|
76
|
-
|
|
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()) {
|
|
77
88
|
let staticPathDir = resolve(staticPath, ".."), staticPathFile = basename(staticPath);
|
|
78
89
|
app.use(targetEndpoint, (req, res, next) => {
|
|
79
90
|
req.url = `/${staticPathFile}`, sirvWorkaround(staticPathDir)(req, res, next);
|
|
@@ -107,18 +118,20 @@ var sirvWorkaround = (dir, opts = {}) => (req, res, next) => {
|
|
|
107
118
|
};
|
|
108
119
|
|
|
109
120
|
// src/core-server/withTelemetry.ts
|
|
110
|
-
var import_prompts = __toESM(require_prompts(), 1);
|
|
111
121
|
import { HandledError, cache, isCI, loadAllPresets } from "storybook/internal/common";
|
|
112
|
-
import { logger as logger2 } from "storybook/internal/node-logger";
|
|
113
|
-
import {
|
|
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";
|
|
114
129
|
var promptCrashReports = async () => {
|
|
115
130
|
if (isCI() || !process.stdout.isTTY)
|
|
116
131
|
return;
|
|
117
|
-
let
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
message: "Would you like to help improve Storybook by sending anonymous crash reports?",
|
|
121
|
-
initial: !0
|
|
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
|
|
122
135
|
});
|
|
123
136
|
return await cache.set("enableCrashReports", enableCrashReports), enableCrashReports;
|
|
124
137
|
};
|
|
@@ -130,7 +143,7 @@ async function getErrorLevel({
|
|
|
130
143
|
if (cliOptions.disableTelemetry)
|
|
131
144
|
return "none";
|
|
132
145
|
if (!presetOptions)
|
|
133
|
-
return "
|
|
146
|
+
return "error";
|
|
134
147
|
let core = await (await loadAllPresets(presetOptions)).apply("core");
|
|
135
148
|
if (core?.enableCrashReports !== void 0)
|
|
136
149
|
return core.enableCrashReports ? "full" : "error";
|
|
@@ -144,7 +157,7 @@ async function getErrorLevel({
|
|
|
144
157
|
let valueFromPrompt = await promptCrashReports();
|
|
145
158
|
return valueFromPrompt !== void 0 ? valueFromPrompt ? "full" : "error" : "full";
|
|
146
159
|
}
|
|
147
|
-
async function sendTelemetryError(_error, eventType, options) {
|
|
160
|
+
async function sendTelemetryError(_error, eventType, options, blocking = !0) {
|
|
148
161
|
try {
|
|
149
162
|
let errorLevel = "error";
|
|
150
163
|
try {
|
|
@@ -162,6 +175,7 @@ async function sendTelemetryError(_error, eventType, options) {
|
|
|
162
175
|
name,
|
|
163
176
|
category,
|
|
164
177
|
eventType,
|
|
178
|
+
blocking,
|
|
165
179
|
precedingUpgrade,
|
|
166
180
|
error: errorLevel === "full" ? error : void 0,
|
|
167
181
|
errorHash,
|
|
@@ -178,8 +192,11 @@ async function sendTelemetryError(_error, eventType, options) {
|
|
|
178
192
|
} catch {
|
|
179
193
|
}
|
|
180
194
|
}
|
|
195
|
+
function isTelemetryEnabled(options) {
|
|
196
|
+
return !(options.cliOptions.disableTelemetry || options.cliOptions.test === !0);
|
|
197
|
+
}
|
|
181
198
|
async function withTelemetry(eventType, options, run) {
|
|
182
|
-
let enableTelemetry =
|
|
199
|
+
let enableTelemetry = isTelemetryEnabled(options), canceled = !1;
|
|
183
200
|
async function cancelTelemetry() {
|
|
184
201
|
canceled = !0, enableTelemetry && await telemetry("canceled", { eventType }, { stripMetadata: !0, immediate: !0 }), process.exit(0);
|
|
185
202
|
}
|
|
@@ -189,21 +206,94 @@ async function withTelemetry(eventType, options, run) {
|
|
|
189
206
|
} catch (error) {
|
|
190
207
|
if (canceled)
|
|
191
208
|
return;
|
|
192
|
-
if (!(error instanceof HandledError)) {
|
|
209
|
+
if (!(error instanceof HandledError || error instanceof StorybookError && error.isHandledError)) {
|
|
193
210
|
let { printError = logger2.error } = options;
|
|
194
211
|
printError(error);
|
|
195
212
|
}
|
|
196
213
|
throw enableTelemetry && await sendTelemetryError(error, eventType, options), error;
|
|
197
214
|
} finally {
|
|
198
|
-
|
|
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
|
+
}
|
|
199
221
|
}
|
|
200
222
|
}
|
|
201
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
|
+
|
|
202
289
|
export {
|
|
203
290
|
useStatics,
|
|
204
291
|
parseStaticDir,
|
|
205
292
|
mapStaticDir,
|
|
293
|
+
debounce,
|
|
294
|
+
throttle,
|
|
206
295
|
getErrorLevel,
|
|
207
296
|
sendTelemetryError,
|
|
297
|
+
isTelemetryEnabled,
|
|
208
298
|
withTelemetry
|
|
209
299
|
};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_yntchggdu3k from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_yntchggdu3k from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_yntchggdu3k from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_yntchggdu3k.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_yntchggdu3k.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_yntchggdu3k.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
11
|
// ------------------------------------------------------------
|
|
12
12
|
import {
|
|
13
13
|
__commonJS
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-JMP7YFX2.js";
|
|
15
15
|
|
|
16
16
|
// ../node_modules/ts-dedent/dist/index.js
|
|
17
17
|
var require_dist = __commonJS({
|
|
@@ -1,86 +1,29 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_yntchggdu3k from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_yntchggdu3k from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_yntchggdu3k from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_yntchggdu3k.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_yntchggdu3k.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_yntchggdu3k.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
11
|
// ------------------------------------------------------------
|
|
12
|
+
import {
|
|
13
|
+
StorybookError
|
|
14
|
+
} from "./chunk-XBPE4PT7.js";
|
|
12
15
|
import {
|
|
13
16
|
require_dist
|
|
14
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-KF3WTAEP.js";
|
|
15
18
|
import {
|
|
16
19
|
require_picocolors
|
|
17
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-A4KENTXT.js";
|
|
18
21
|
import {
|
|
19
22
|
__toESM
|
|
20
|
-
} from "./chunk-
|
|
23
|
+
} from "./chunk-JMP7YFX2.js";
|
|
21
24
|
|
|
22
25
|
// src/server-errors.ts
|
|
23
26
|
var import_picocolors = __toESM(require_picocolors(), 1), import_ts_dedent = __toESM(require_dist(), 1);
|
|
24
|
-
|
|
25
|
-
// src/storybook-error.ts
|
|
26
|
-
function parseErrorCode({
|
|
27
|
-
code,
|
|
28
|
-
category
|
|
29
|
-
}) {
|
|
30
|
-
let paddedCode = String(code).padStart(4, "0");
|
|
31
|
-
return `SB_${category}_${paddedCode}`;
|
|
32
|
-
}
|
|
33
|
-
function appendErrorRef(url) {
|
|
34
|
-
if (/^(?!.*storybook\.js\.org)|[?&]ref=error\b/.test(url))
|
|
35
|
-
return url;
|
|
36
|
-
try {
|
|
37
|
-
let urlObj = new URL(url);
|
|
38
|
-
return urlObj.searchParams.set("ref", "error"), urlObj.toString();
|
|
39
|
-
} catch {
|
|
40
|
-
return url;
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
var StorybookError = class _StorybookError extends Error {
|
|
44
|
-
constructor(props) {
|
|
45
|
-
super(_StorybookError.getFullMessage(props));
|
|
46
|
-
/**
|
|
47
|
-
* Data associated with the error. Used to provide additional information in the error message or
|
|
48
|
-
* to be passed to telemetry.
|
|
49
|
-
*/
|
|
50
|
-
this.data = {};
|
|
51
|
-
/** Flag used to easily determine if the error originates from Storybook. */
|
|
52
|
-
this.fromStorybook = !0;
|
|
53
|
-
this.category = props.category, this.documentation = props.documentation ?? !1, this.code = props.code, this.name = props.name;
|
|
54
|
-
}
|
|
55
|
-
get fullErrorCode() {
|
|
56
|
-
return parseErrorCode({ code: this.code, category: this.category });
|
|
57
|
-
}
|
|
58
|
-
/** Overrides the default `Error.name` property in the format: SB_<CATEGORY>_<CODE>. */
|
|
59
|
-
get name() {
|
|
60
|
-
let errorName = this._name || this.constructor.name;
|
|
61
|
-
return `${this.fullErrorCode} (${errorName})`;
|
|
62
|
-
}
|
|
63
|
-
set name(name) {
|
|
64
|
-
this._name = name;
|
|
65
|
-
}
|
|
66
|
-
/** Generates the error message along with additional documentation link (if applicable). */
|
|
67
|
-
static getFullMessage({
|
|
68
|
-
documentation,
|
|
69
|
-
code,
|
|
70
|
-
category,
|
|
71
|
-
message
|
|
72
|
-
}) {
|
|
73
|
-
let page;
|
|
74
|
-
return documentation === !0 ? page = `https://storybook.js.org/error/${parseErrorCode({ code, category })}?ref=error` : typeof documentation == "string" ? page = appendErrorRef(documentation) : Array.isArray(documentation) && (page = `
|
|
75
|
-
${documentation.map((doc) => ` - ${appendErrorRef(doc)}`).join(`
|
|
76
|
-
`)}`), `${message}${page != null ? `
|
|
77
|
-
|
|
78
|
-
More info: ${page}
|
|
79
|
-
` : ""}`;
|
|
80
|
-
}
|
|
81
|
-
};
|
|
82
|
-
|
|
83
|
-
// src/server-errors.ts
|
|
84
27
|
var Category = /* @__PURE__ */ ((Category2) => (Category2.CLI = "CLI", Category2.CLI_INIT = "CLI_INIT", Category2.CLI_AUTOMIGRATE = "CLI_AUTOMIGRATE", Category2.CLI_UPGRADE = "CLI_UPGRADE", Category2.CLI_ADD = "CLI_ADD", Category2.CODEMOD = "CODEMOD", Category2.CORE_SERVER = "CORE-SERVER", Category2.CSF_PLUGIN = "CSF-PLUGIN", Category2.CSF_TOOLS = "CSF-TOOLS", Category2.CORE_COMMON = "CORE-COMMON", Category2.NODE_LOGGER = "NODE-LOGGER", Category2.TELEMETRY = "TELEMETRY", Category2.BUILDER_MANAGER = "BUILDER-MANAGER", Category2.BUILDER_VITE = "BUILDER-VITE", Category2.BUILDER_WEBPACK5 = "BUILDER-WEBPACK5", Category2.SOURCE_LOADER = "SOURCE-LOADER", Category2.POSTINSTALL = "POSTINSTALL", Category2.DOCS_TOOLS = "DOCS-TOOLS", Category2.CORE_WEBPACK = "CORE-WEBPACK", Category2.FRAMEWORK_ANGULAR = "FRAMEWORK_ANGULAR", Category2.FRAMEWORK_EMBER = "FRAMEWORK_EMBER", Category2.FRAMEWORK_HTML_VITE = "FRAMEWORK_HTML-VITE", Category2.FRAMEWORK_HTML_WEBPACK5 = "FRAMEWORK_HTML-WEBPACK5", Category2.FRAMEWORK_NEXTJS = "FRAMEWORK_NEXTJS", Category2.FRAMEWORK_PREACT_VITE = "FRAMEWORK_PREACT-VITE", Category2.FRAMEWORK_PREACT_WEBPACK5 = "FRAMEWORK_PREACT-WEBPACK5", Category2.FRAMEWORK_REACT_VITE = "FRAMEWORK_REACT-VITE", Category2.FRAMEWORK_REACT_WEBPACK5 = "FRAMEWORK_REACT-WEBPACK5", Category2.FRAMEWORK_SERVER_WEBPACK5 = "FRAMEWORK_SERVER-WEBPACK5", Category2.FRAMEWORK_SVELTE_VITE = "FRAMEWORK_SVELTE-VITE", Category2.FRAMEWORK_SVELTEKIT = "FRAMEWORK_SVELTEKIT", Category2.FRAMEWORK_VUE_VITE = "FRAMEWORK_VUE-VITE", Category2.FRAMEWORK_VUE_WEBPACK5 = "FRAMEWORK_VUE-WEBPACK5", Category2.FRAMEWORK_VUE3_VITE = "FRAMEWORK_VUE3-VITE", Category2.FRAMEWORK_VUE3_WEBPACK5 = "FRAMEWORK_VUE3-WEBPACK5", Category2.FRAMEWORK_WEB_COMPONENTS_VITE = "FRAMEWORK_WEB-COMPONENTS-VITE", Category2.FRAMEWORK_WEB_COMPONENTS_WEBPACK5 = "FRAMEWORK_WEB-COMPONENTS-WEBPACK5", Category2))(Category || {}), NxProjectDetectedError = class extends StorybookError {
|
|
85
28
|
constructor() {
|
|
86
29
|
super({
|
|
@@ -410,6 +353,29 @@ var WebpackCompilationError = class extends StorybookError {
|
|
|
410
353
|
});
|
|
411
354
|
this.data = data;
|
|
412
355
|
}
|
|
356
|
+
}, AddonVitestPostinstallPrerequisiteCheckError = class extends StorybookError {
|
|
357
|
+
constructor(data) {
|
|
358
|
+
super({
|
|
359
|
+
name: "AddonVitestPostinstallPrerequisiteCheckError",
|
|
360
|
+
category: "CLI_INIT" /* CLI_INIT */,
|
|
361
|
+
isHandledError: !0,
|
|
362
|
+
code: 4,
|
|
363
|
+
documentation: "",
|
|
364
|
+
message: "The prerequisite check for the Vitest addon failed."
|
|
365
|
+
});
|
|
366
|
+
this.data = data;
|
|
367
|
+
}
|
|
368
|
+
}, AddonVitestPostinstallError = class extends StorybookError {
|
|
369
|
+
constructor(data) {
|
|
370
|
+
super({
|
|
371
|
+
name: "AddonVitestPostinstallError",
|
|
372
|
+
category: "CLI_INIT" /* CLI_INIT */,
|
|
373
|
+
isHandledError: !0,
|
|
374
|
+
code: 5,
|
|
375
|
+
message: "The Vitest addon setup failed."
|
|
376
|
+
});
|
|
377
|
+
this.data = data;
|
|
378
|
+
}
|
|
413
379
|
}, UpgradeStorybookToLowerVersionError = class extends StorybookError {
|
|
414
380
|
constructor(data) {
|
|
415
381
|
super({
|
|
@@ -524,10 +490,21 @@ var WebpackCompilationError = class extends StorybookError {
|
|
|
524
490
|
Please convert your config to use ES modules (import/export syntax).`
|
|
525
491
|
});
|
|
526
492
|
}
|
|
493
|
+
}, AutomigrateError = class extends StorybookError {
|
|
494
|
+
constructor(data) {
|
|
495
|
+
super({
|
|
496
|
+
name: "AutomigrateError",
|
|
497
|
+
category: "CLI_AUTOMIGRATE" /* CLI_AUTOMIGRATE */,
|
|
498
|
+
code: 2,
|
|
499
|
+
message: import_ts_dedent.dedent`
|
|
500
|
+
An error occurred while running the automigrate command.
|
|
501
|
+
`
|
|
502
|
+
});
|
|
503
|
+
this.data = data;
|
|
504
|
+
}
|
|
527
505
|
};
|
|
528
506
|
|
|
529
507
|
export {
|
|
530
|
-
StorybookError,
|
|
531
508
|
Category,
|
|
532
509
|
NxProjectDetectedError,
|
|
533
510
|
MissingFrameworkFieldError,
|
|
@@ -550,11 +527,14 @@ export {
|
|
|
550
527
|
MainFileEvaluationError,
|
|
551
528
|
StatusTypeIdMismatchError,
|
|
552
529
|
GenerateNewProjectOnInitError,
|
|
530
|
+
AddonVitestPostinstallPrerequisiteCheckError,
|
|
531
|
+
AddonVitestPostinstallError,
|
|
553
532
|
UpgradeStorybookToLowerVersionError,
|
|
554
533
|
UpgradeStorybookUnknownCurrentVersionError,
|
|
555
534
|
NoStatsForViteDevError,
|
|
556
535
|
FindPackageVersionsError,
|
|
557
536
|
IncompatiblePostCssConfigError,
|
|
558
537
|
SavingGlobalSettingsFileError,
|
|
559
|
-
CommonJsConfigNotSupportedError
|
|
538
|
+
CommonJsConfigNotSupportedError,
|
|
539
|
+
AutomigrateError
|
|
560
540
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_yntchggdu3k from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_yntchggdu3k from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_yntchggdu3k from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_yntchggdu3k.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_yntchggdu3k.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_yntchggdu3k.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -12,7 +12,7 @@ var require = CJS_COMPAT_NODE_MODULE_57ru1wfqqjv.createRequire(import.meta.url);
|
|
|
12
12
|
import {
|
|
13
13
|
__commonJS,
|
|
14
14
|
__require
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-JMP7YFX2.js";
|
|
16
16
|
|
|
17
17
|
// ../node_modules/picomatch/lib/constants.js
|
|
18
18
|
var require_constants = __commonJS({
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import CJS_COMPAT_NODE_URL_yntchggdu3k from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_yntchggdu3k from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_yntchggdu3k from "node:module";
|
|
4
|
+
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_yntchggdu3k.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_yntchggdu3k.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_yntchggdu3k.createRequire(import.meta.url);
|
|
8
|
+
|
|
9
|
+
// ------------------------------------------------------------
|
|
10
|
+
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
+
// ------------------------------------------------------------
|
|
12
|
+
|
|
13
|
+
// package.json
|
|
14
|
+
var version = "10.1.0-alpha.14";
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
version
|
|
18
|
+
};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import CJS_COMPAT_NODE_URL_yntchggdu3k from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_yntchggdu3k from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_yntchggdu3k from "node:module";
|
|
4
|
+
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_yntchggdu3k.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_yntchggdu3k.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_yntchggdu3k.createRequire(import.meta.url);
|
|
8
|
+
|
|
9
|
+
// ------------------------------------------------------------
|
|
10
|
+
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
+
// ------------------------------------------------------------
|
|
12
|
+
|
|
13
|
+
// src/common/utils/utils.ts
|
|
14
|
+
var groupBy = (items, keySelector) => items.reduce(
|
|
15
|
+
(acc, item, index) => {
|
|
16
|
+
let key = keySelector(item, index);
|
|
17
|
+
return acc[key] ??= [], acc[key].push(item), acc;
|
|
18
|
+
},
|
|
19
|
+
{}
|
|
20
|
+
);
|
|
21
|
+
function invariant(condition, message) {
|
|
22
|
+
if (!condition)
|
|
23
|
+
throw new Error((typeof message == "function" ? message() : message) ?? "Invariant failed");
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export {
|
|
27
|
+
groupBy,
|
|
28
|
+
invariant
|
|
29
|
+
};
|