storybook 10.1.0-alpha.12 → 10.1.0-alpha.13
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/_node-chunks/{builder-manager-YUOHSIUB.js → builder-manager-DWDUVXZM.js} +27 -22
- package/dist/_node-chunks/{chunk-B6JWY6PC.js → camelcase-EETCRTJX.js} +8 -8
- package/dist/_node-chunks/{chunk-CZ5GHJCC.js → chunk-2W4GZCLE.js} +7 -7
- package/dist/_node-chunks/{chunk-E5FJS66Z.js → chunk-447655DM.js} +6 -6
- package/dist/_node-chunks/{chunk-WFLWJO24.js → chunk-4EJUC2SD.js} +4998 -1685
- package/dist/_node-chunks/chunk-4ZJOH2UN.js +61 -0
- package/dist/_node-chunks/chunk-654SJIMS.js +23 -0
- package/dist/_node-chunks/{chunk-2DMESZFJ.js → chunk-7IAVT2FU.js} +7 -7
- package/dist/_node-chunks/{chunk-5KLIDWFN.js → chunk-7KFHRNOT.js} +7 -7
- package/dist/_node-chunks/{chunk-XXPJ7XR3.js → chunk-AZIPBEBK.js} +6 -6
- package/dist/_node-chunks/{chunk-WUXQMQCB.js → chunk-B76FDKVB.js} +6 -6
- package/dist/_node-chunks/chunk-B7PGKETD.js +3781 -0
- package/dist/_node-chunks/{chunk-EZWWR7AR.js → chunk-CLUBH2LP.js} +55 -36
- package/dist/_node-chunks/{chunk-DUXPWBOK.js → chunk-CMYD2JNN.js} +7 -7
- package/dist/_node-chunks/{chunk-QCO2ZM7F.js → chunk-DIPKXLEP.js} +55 -32
- package/dist/_node-chunks/{chunk-DWXTZT3D.js → chunk-DPFYWXEA.js} +6 -6
- package/dist/_node-chunks/{chunk-FZLRAH4N.js → chunk-FCVNHU2F.js} +7 -7
- package/dist/_node-chunks/{chunk-QYQIZBS6.js → chunk-JQ7RQS5Q.js} +6 -6
- package/dist/_node-chunks/chunk-LEL5OSY3.js +18 -0
- package/dist/_node-chunks/{chunk-WA6KZQZ2.js → chunk-LPKSBF62.js} +6 -6
- package/dist/_node-chunks/chunk-LYEZOJ43.js +78 -0
- package/dist/_node-chunks/{chunk-JARUEMEP.js → chunk-MIA5324I.js} +7 -7
- package/dist/_node-chunks/{chunk-A4APXFQ2.js → chunk-MJM4TEMP.js} +14 -8
- package/dist/_node-chunks/{chunk-NAOYEL54.js → chunk-OVVZIUHS.js} +7 -7
- package/dist/_node-chunks/{chunk-5HV3B5OP.js → chunk-RUUNVQ6W.js} +1104 -13
- package/dist/_node-chunks/{chunk-2D2IODUU.js → chunk-URLNGLC2.js} +51 -71
- package/dist/_node-chunks/{chunk-OP3INKUD.js → chunk-WC2YEQHJ.js} +6 -6
- package/dist/_node-chunks/{chunk-4FT2DHGE.js → chunk-XKRVQL2G.js} +8 -8
- package/dist/_node-chunks/{chunk-SEMIAAWG.js → chunk-Z2OWEMX3.js} +8 -8
- package/dist/_node-chunks/{dist-DS2B5A3J.js → dist-22CLJ4BC.js} +9 -9
- package/dist/_node-chunks/{globby-6THB7HVX.js → globby-GR24TGSK.js} +9 -9
- package/dist/_node-chunks/{lib-5NKX4YGG.js → lib-G2LGVRPC.js} +7 -7
- package/dist/_node-chunks/{mdx-N42X6CFJ-ZLT3QOFF.js → mdx-N42X6CFJ-W6P6IDDW.js} +8 -8
- package/dist/_node-chunks/{p-limit-PDMWNG7W.js → p-limit-K4FZHG2F.js} +7 -7
- package/dist/babel/index.js +10 -11
- package/dist/bin/core.js +32 -26
- package/dist/bin/dispatcher.js +31 -20
- package/dist/bin/loader.js +10 -13
- package/dist/cli/index.d.ts +692 -133
- package/dist/cli/index.js +1005 -177
- package/dist/common/index.d.ts +139 -62
- package/dist/common/index.js +63 -49
- package/dist/core-server/index.d.ts +3 -2
- package/dist/core-server/index.js +96 -1413
- package/dist/core-server/presets/common-override-preset.js +9 -9
- package/dist/core-server/presets/common-preset.js +25 -65
- package/dist/csf-tools/index.js +9 -9
- package/dist/manager/globals-runtime.js +32 -3
- package/dist/manager/runtime.js +1 -1
- package/dist/manager-api/index.d.ts +1 -1
- package/dist/manager-api/index.js +4 -4
- 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 +31 -2
- package/dist/preview-api/index.d.ts +69 -68
- 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 +23 -2
- 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 +7 -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-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,47 +1,46 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_h0pwn2pcb57 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_h0pwn2pcb57 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_h0pwn2pcb57 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_h0pwn2pcb57.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_h0pwn2pcb57.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_h0pwn2pcb57.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
|
version
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-LEL5OSY3.js";
|
|
15
15
|
import {
|
|
16
16
|
createFileSystemCache,
|
|
17
|
+
execa,
|
|
18
|
+
execaCommand,
|
|
19
|
+
getProjectRoot,
|
|
17
20
|
resolvePathInStorybookCache,
|
|
18
21
|
up
|
|
19
|
-
} from "./chunk-
|
|
22
|
+
} from "./chunk-4EJUC2SD.js";
|
|
20
23
|
import {
|
|
21
24
|
globalSettings
|
|
22
|
-
} from "./chunk-
|
|
23
|
-
import {
|
|
24
|
-
execaCommand,
|
|
25
|
-
getProjectRoot
|
|
26
|
-
} from "./chunk-O5DA7YLO.js";
|
|
25
|
+
} from "./chunk-XKRVQL2G.js";
|
|
27
26
|
import {
|
|
28
27
|
getSessionId,
|
|
29
28
|
nanoid,
|
|
30
29
|
set
|
|
31
|
-
} from "./chunk-
|
|
30
|
+
} from "./chunk-B76FDKVB.js";
|
|
32
31
|
import {
|
|
33
32
|
resolvePackageDir
|
|
34
|
-
} from "./chunk-
|
|
33
|
+
} from "./chunk-MJM4TEMP.js";
|
|
35
34
|
import {
|
|
36
35
|
slash
|
|
37
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-447655DM.js";
|
|
38
37
|
import {
|
|
39
|
-
|
|
40
|
-
} from "./chunk-
|
|
38
|
+
require_dist
|
|
39
|
+
} from "./chunk-CMYD2JNN.js";
|
|
41
40
|
import {
|
|
42
41
|
__commonJS,
|
|
43
42
|
__toESM
|
|
44
|
-
} from "./chunk-
|
|
43
|
+
} from "./chunk-WC2YEQHJ.js";
|
|
45
44
|
|
|
46
45
|
// ../node_modules/fetch-retry/index.js
|
|
47
46
|
var require_fetch_retry = __commonJS({
|
|
@@ -133,15 +132,16 @@ var require_fetch_retry = __commonJS({
|
|
|
133
132
|
import { logger as logger2 } from "storybook/internal/node-logger";
|
|
134
133
|
|
|
135
134
|
// src/telemetry/notify.ts
|
|
136
|
-
var
|
|
135
|
+
var import_ts_dedent = __toESM(require_dist(), 1);
|
|
137
136
|
import { cache } from "storybook/internal/common";
|
|
138
|
-
import {
|
|
137
|
+
import { logger } from "storybook/internal/node-logger";
|
|
139
138
|
var TELEMETRY_KEY_NOTIFY_DATE = "telemetry-notification-date", notify = async () => {
|
|
140
|
-
await cache.get(TELEMETRY_KEY_NOTIFY_DATE, null) || (cache.set(TELEMETRY_KEY_NOTIFY_DATE, Date.now()), logger.
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
139
|
+
await cache.get(TELEMETRY_KEY_NOTIFY_DATE, null) || (cache.set(TELEMETRY_KEY_NOTIFY_DATE, Date.now()), logger.info(
|
|
140
|
+
import_ts_dedent.dedent`
|
|
141
|
+
Attention: Storybook now collects completely anonymous telemetry regarding usage. This information is used to shape Storybook's roadmap and prioritize features. You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
|
|
142
|
+
https://storybook.js.org/telemetry
|
|
143
|
+
`
|
|
144
|
+
));
|
|
145
145
|
};
|
|
146
146
|
|
|
147
147
|
// src/telemetry/sanitize.ts
|
|
@@ -197,8 +197,8 @@ import { sep } from "node:path";
|
|
|
197
197
|
|
|
198
198
|
// src/telemetry/exec-command-count-lines.ts
|
|
199
199
|
import { createInterface } from "node:readline";
|
|
200
|
-
async function execCommandCountLines(command, options) {
|
|
201
|
-
let process3 =
|
|
200
|
+
async function execCommandCountLines(command, args, options) {
|
|
201
|
+
let process3 = execa(command, args, { buffer: !1, ...options });
|
|
202
202
|
if (!process3.stdout)
|
|
203
203
|
throw new Error("Unexpected missing stdout");
|
|
204
204
|
let lineCount = 0, rl = createInterface(process3.stdout);
|
|
@@ -224,11 +224,10 @@ var nameMatches = ["page", "screen"], extensions = ["js", "jsx", "ts", "tsx"], g
|
|
|
224
224
|
match,
|
|
225
225
|
[match[0].toUpperCase(), ...match.slice(1)].join("")
|
|
226
226
|
]).flatMap(
|
|
227
|
-
(match) => extensions.map((extension) =>
|
|
227
|
+
(match) => extensions.map((extension) => `${basePath}${sep}*${match}*.${extension}`)
|
|
228
228
|
);
|
|
229
229
|
try {
|
|
230
|
-
|
|
231
|
-
return await execCommandCountLines(command);
|
|
230
|
+
return await execCommandCountLines("git", ["ls-files", "--", ...globs]);
|
|
232
231
|
} catch {
|
|
233
232
|
return;
|
|
234
233
|
}
|
|
@@ -643,8 +642,12 @@ var getPackageManagerInfo = async () => {
|
|
|
643
642
|
// src/telemetry/get-portable-stories-usage.ts
|
|
644
643
|
var getPortableStoriesFileCountUncached = async (path3) => {
|
|
645
644
|
try {
|
|
646
|
-
|
|
647
|
-
|
|
645
|
+
return await execCommandCountLines("git", [
|
|
646
|
+
"grep",
|
|
647
|
+
"-l",
|
|
648
|
+
"composeStor",
|
|
649
|
+
...path3 ? ["--", path3] : []
|
|
650
|
+
]);
|
|
648
651
|
} catch (err) {
|
|
649
652
|
return err.exitCode === 1 ? 0 : void 0;
|
|
650
653
|
}
|
|
@@ -776,7 +779,7 @@ var metaFrameworks = {
|
|
|
776
779
|
portableStoriesFileCount,
|
|
777
780
|
applicationFileCount,
|
|
778
781
|
storybookVersion: version,
|
|
779
|
-
storybookVersionSpecifier: storybookInfo.version,
|
|
782
|
+
storybookVersionSpecifier: storybookInfo.version ?? "",
|
|
780
783
|
language,
|
|
781
784
|
storybookPackages,
|
|
782
785
|
addons,
|
|
@@ -903,6 +906,22 @@ async function sendTelemetry(data, options = { retryDelay: 1e3, immediate: !1 })
|
|
|
903
906
|
}
|
|
904
907
|
}
|
|
905
908
|
|
|
909
|
+
// src/telemetry/error-collector.ts
|
|
910
|
+
var ErrorCollector = class _ErrorCollector {
|
|
911
|
+
constructor() {
|
|
912
|
+
this.errors = [];
|
|
913
|
+
}
|
|
914
|
+
static getInstance() {
|
|
915
|
+
return _ErrorCollector.instance || (_ErrorCollector.instance = new _ErrorCollector()), _ErrorCollector.instance;
|
|
916
|
+
}
|
|
917
|
+
static addError(error) {
|
|
918
|
+
this.getInstance().errors.push(error);
|
|
919
|
+
}
|
|
920
|
+
static getErrors() {
|
|
921
|
+
return this.getInstance().errors;
|
|
922
|
+
}
|
|
923
|
+
};
|
|
924
|
+
|
|
906
925
|
// src/telemetry/index.ts
|
|
907
926
|
var isExampleStoryId = (storyId) => storyId.startsWith("example-button--") || storyId.startsWith("example-header--") || storyId.startsWith("example-page--"), telemetry = async (eventType, payload = {}, options = {}) => {
|
|
908
927
|
eventType !== "boot" && options.notify !== !1 && await notify();
|
|
@@ -916,8 +935,7 @@ var isExampleStoryId = (storyId) => storyId.startsWith("example-button--") || st
|
|
|
916
935
|
payload.metadataErrorMessage = sanitizeError(error).message, options?.enableCrashReports && (payload.metadataError = sanitizeError(error));
|
|
917
936
|
} finally {
|
|
918
937
|
let { error } = payload;
|
|
919
|
-
error && (payload.error = sanitizeError(error)), (!payload.error || options?.enableCrashReports) && (process.env?.STORYBOOK_TELEMETRY_DEBUG && (logger2.info(
|
|
920
|
-
[telemetry]`), logger2.info(JSON.stringify(telemetryData, null, 2))), await sendTelemetry(telemetryData, options));
|
|
938
|
+
error && (payload.error = sanitizeError(error)), (!payload.error || options?.enableCrashReports) && (process.env?.STORYBOOK_TELEMETRY_DEBUG && (logger2.info("[telemetry]"), logger2.info(JSON.stringify(telemetryData, null, 2))), await sendTelemetry(telemetryData, options));
|
|
921
939
|
}
|
|
922
940
|
};
|
|
923
941
|
|
|
@@ -931,6 +949,7 @@ export {
|
|
|
931
949
|
getStorybookMetadata,
|
|
932
950
|
oneWayHash,
|
|
933
951
|
addToGlobalContext,
|
|
952
|
+
ErrorCollector,
|
|
934
953
|
isExampleStoryId,
|
|
935
954
|
telemetry
|
|
936
955
|
};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_h0pwn2pcb57 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_h0pwn2pcb57 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_h0pwn2pcb57 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_h0pwn2pcb57.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_h0pwn2pcb57.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_h0pwn2pcb57.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-WC2YEQHJ.js";
|
|
15
15
|
|
|
16
16
|
// ../node_modules/ts-dedent/dist/index.js
|
|
17
17
|
var require_dist = __commonJS({
|
|
@@ -1,40 +1,47 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_h0pwn2pcb57 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_h0pwn2pcb57 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_h0pwn2pcb57 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_h0pwn2pcb57.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_h0pwn2pcb57.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_h0pwn2pcb57.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-2W4GZCLE.js";
|
|
15
|
+
import {
|
|
16
|
+
StorybookError
|
|
17
|
+
} from "./chunk-LYEZOJ43.js";
|
|
15
18
|
import {
|
|
16
19
|
resolvePackageDir
|
|
17
|
-
} from "./chunk-
|
|
20
|
+
} from "./chunk-MJM4TEMP.js";
|
|
18
21
|
import {
|
|
19
|
-
|
|
20
|
-
} from "./chunk-
|
|
22
|
+
relative
|
|
23
|
+
} from "./chunk-LPKSBF62.js";
|
|
21
24
|
import {
|
|
22
25
|
require_dist
|
|
23
|
-
} from "./chunk-
|
|
26
|
+
} from "./chunk-CMYD2JNN.js";
|
|
24
27
|
import {
|
|
25
28
|
require_picocolors
|
|
26
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-OVVZIUHS.js";
|
|
27
30
|
import {
|
|
28
31
|
__toESM
|
|
29
|
-
} from "./chunk-
|
|
32
|
+
} from "./chunk-WC2YEQHJ.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,13 +206,18 @@ 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
|
|
|
@@ -205,5 +227,6 @@ export {
|
|
|
205
227
|
mapStaticDir,
|
|
206
228
|
getErrorLevel,
|
|
207
229
|
sendTelemetryError,
|
|
230
|
+
isTelemetryEnabled,
|
|
208
231
|
withTelemetry
|
|
209
232
|
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_h0pwn2pcb57 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_h0pwn2pcb57 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_h0pwn2pcb57 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_h0pwn2pcb57.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_h0pwn2pcb57.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_h0pwn2pcb57.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_h0pwn2pcb57 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_h0pwn2pcb57 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_h0pwn2pcb57 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_h0pwn2pcb57.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_h0pwn2pcb57.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_h0pwn2pcb57.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-WC2YEQHJ.js";
|
|
16
16
|
|
|
17
17
|
// ../node_modules/ms/index.js
|
|
18
18
|
var require_ms = __commonJS({
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_h0pwn2pcb57 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_h0pwn2pcb57 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_h0pwn2pcb57 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_h0pwn2pcb57.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_h0pwn2pcb57.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_h0pwn2pcb57.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import CJS_COMPAT_NODE_URL_h0pwn2pcb57 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_h0pwn2pcb57 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_h0pwn2pcb57 from "node:module";
|
|
4
|
+
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_h0pwn2pcb57.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_h0pwn2pcb57.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_h0pwn2pcb57.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.13";
|
|
15
|
+
|
|
16
|
+
export {
|
|
17
|
+
version
|
|
18
|
+
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_h0pwn2pcb57 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_h0pwn2pcb57 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_h0pwn2pcb57 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_h0pwn2pcb57.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_h0pwn2pcb57.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_h0pwn2pcb57.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import CJS_COMPAT_NODE_URL_h0pwn2pcb57 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_h0pwn2pcb57 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_h0pwn2pcb57 from "node:module";
|
|
4
|
+
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_h0pwn2pcb57.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_h0pwn2pcb57.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_h0pwn2pcb57.createRequire(import.meta.url);
|
|
8
|
+
|
|
9
|
+
// ------------------------------------------------------------
|
|
10
|
+
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
+
// ------------------------------------------------------------
|
|
12
|
+
|
|
13
|
+
// src/storybook-error.ts
|
|
14
|
+
function parseErrorCode({
|
|
15
|
+
code,
|
|
16
|
+
category
|
|
17
|
+
}) {
|
|
18
|
+
let paddedCode = String(code).padStart(4, "0");
|
|
19
|
+
return `SB_${category}_${paddedCode}`;
|
|
20
|
+
}
|
|
21
|
+
function appendErrorRef(url) {
|
|
22
|
+
if (/^(?!.*storybook\.js\.org)|[?&]ref=error\b/.test(url))
|
|
23
|
+
return url;
|
|
24
|
+
try {
|
|
25
|
+
let urlObj = new URL(url);
|
|
26
|
+
return urlObj.searchParams.set("ref", "error"), urlObj.toString();
|
|
27
|
+
} catch {
|
|
28
|
+
return url;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
var StorybookError = class _StorybookError extends Error {
|
|
32
|
+
constructor(props) {
|
|
33
|
+
super(_StorybookError.getFullMessage(props));
|
|
34
|
+
/**
|
|
35
|
+
* Data associated with the error. Used to provide additional information in the error message or
|
|
36
|
+
* to be passed to telemetry.
|
|
37
|
+
*/
|
|
38
|
+
this.data = {};
|
|
39
|
+
/** Flag used to easily determine if the error originates from Storybook. */
|
|
40
|
+
this.fromStorybook = !0;
|
|
41
|
+
/**
|
|
42
|
+
* Flag used to determine if the error is handled by us and should therefore not be shown to the
|
|
43
|
+
* user.
|
|
44
|
+
*/
|
|
45
|
+
this.isHandledError = !1;
|
|
46
|
+
this.category = props.category, this.documentation = props.documentation ?? !1, this.code = props.code, this.isHandledError = props.isHandledError ?? !1, this.name = props.name;
|
|
47
|
+
}
|
|
48
|
+
get fullErrorCode() {
|
|
49
|
+
return parseErrorCode({ code: this.code, category: this.category });
|
|
50
|
+
}
|
|
51
|
+
/** Overrides the default `Error.name` property in the format: SB_<CATEGORY>_<CODE>. */
|
|
52
|
+
get name() {
|
|
53
|
+
let errorName = this._name || this.constructor.name;
|
|
54
|
+
return `${this.fullErrorCode} (${errorName})`;
|
|
55
|
+
}
|
|
56
|
+
set name(name) {
|
|
57
|
+
this._name = name;
|
|
58
|
+
}
|
|
59
|
+
/** Generates the error message along with additional documentation link (if applicable). */
|
|
60
|
+
static getFullMessage({
|
|
61
|
+
documentation,
|
|
62
|
+
code,
|
|
63
|
+
category,
|
|
64
|
+
message
|
|
65
|
+
}) {
|
|
66
|
+
let page;
|
|
67
|
+
return documentation === !0 ? page = `https://storybook.js.org/error/${parseErrorCode({ code, category })}?ref=error` : typeof documentation == "string" ? page = appendErrorRef(documentation) : Array.isArray(documentation) && (page = `
|
|
68
|
+
${documentation.map((doc) => ` - ${appendErrorRef(doc)}`).join(`
|
|
69
|
+
`)}`), `${message}${page != null ? `
|
|
70
|
+
|
|
71
|
+
More info: ${page}
|
|
72
|
+
` : ""}`;
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
export {
|
|
77
|
+
StorybookError
|
|
78
|
+
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_h0pwn2pcb57 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_h0pwn2pcb57 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_h0pwn2pcb57 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_h0pwn2pcb57.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_h0pwn2pcb57.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_h0pwn2pcb57.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-WC2YEQHJ.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_h0pwn2pcb57 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_h0pwn2pcb57 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_h0pwn2pcb57 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_h0pwn2pcb57.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_h0pwn2pcb57.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_h0pwn2pcb57.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
|
dirname,
|
|
14
14
|
join
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-LPKSBF62.js";
|
|
16
16
|
|
|
17
17
|
// ../node_modules/exsolve/dist/index.mjs
|
|
18
18
|
import fs, { lstatSync, realpathSync, statSync } from "node:fs";
|
|
@@ -714,7 +714,13 @@ import { win32 } from "node:path/win32";
|
|
|
714
714
|
import { fileURLToPath as fileURLToPath2, pathToFileURL as pathToFileURL2 } from "node:url";
|
|
715
715
|
var importMetaResolve = (...args) => typeof import.meta.resolve != "function" && process.env.VITEST === "true" ? (console.warn(
|
|
716
716
|
"importMetaResolve from within Storybook is being used in a Vitest test, but it shouldn't be. Please report this at https://github.com/storybookjs/storybook/issues/new?template=bug_report.yml"
|
|
717
|
-
), pathToFileURL2(args[0]).href) : import.meta.resolve(...args), resolvePackageDir = (pkg, parent) =>
|
|
717
|
+
), pathToFileURL2(args[0]).href) : import.meta.resolve(...args), resolvePackageDir = (pkg, parent) => {
|
|
718
|
+
try {
|
|
719
|
+
return dirname(fileURLToPath2(importMetaResolve(join(pkg, "package.json"), parent)));
|
|
720
|
+
} catch {
|
|
721
|
+
return dirname(fileURLToPath2(importMetaResolve(join(pkg, "package.json"))));
|
|
722
|
+
}
|
|
723
|
+
}, isTypescriptLoaderRegistered = !1;
|
|
718
724
|
async function importModule(path2, { skipCache = !1 } = {}) {
|
|
719
725
|
if (!isTypescriptLoaderRegistered) {
|
|
720
726
|
let typescriptLoaderUrl = importMetaResolve("storybook/internal/bin/loader");
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_h0pwn2pcb57 from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_h0pwn2pcb57 from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_h0pwn2pcb57 from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_h0pwn2pcb57.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_h0pwn2pcb57.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_h0pwn2pcb57.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-WC2YEQHJ.js";
|
|
15
15
|
|
|
16
16
|
// ../node_modules/picocolors/picocolors.js
|
|
17
17
|
var require_picocolors = __commonJS({
|