storybook 10.1.0-alpha.2 → 10.1.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_node-chunks/{builder-manager-XRIDLU42.js → builder-manager-GBWCUYRR.js} +12 -12
- package/dist/_node-chunks/camelcase-2N6MD2HZ.js +18 -0
- package/dist/_node-chunks/{chunk-2L3QAN3W.js → chunk-2JHIUWIN.js} +7 -7
- package/dist/_node-chunks/{chunk-3AR5SJTX.js → chunk-5KDXQR2J.js} +7 -7
- package/dist/_node-chunks/{chunk-D43KJFPO.js → chunk-5X7FGASE.js} +7 -7
- package/dist/_node-chunks/{chunk-LJPS53G5.js → chunk-6U2QTN2E.js} +7 -7
- package/dist/_node-chunks/{chunk-WHOPLOGE.js → chunk-APKZWRTX.js} +7 -7
- package/dist/_node-chunks/{chunk-QFET4WIW.js → chunk-AX2PCJZ2.js} +6 -6
- package/dist/_node-chunks/{chunk-S6RYOO4I.js → chunk-B63HGQAB.js} +9 -9
- package/dist/_node-chunks/{chunk-BAE27Z3H.js → chunk-BNO5FB6B.js} +8 -8
- package/dist/_node-chunks/{chunk-FWBIPR34.js → chunk-C4UVY6FF.js} +7 -7
- package/dist/_node-chunks/{chunk-HFHQNHRU.js → chunk-CKXP5RYA.js} +9 -9
- package/dist/_node-chunks/chunk-D3NGJQDZ.js +18 -0
- package/dist/_node-chunks/{chunk-6WXUZSNC.js → chunk-FJWQKOXX.js} +10 -10
- package/dist/_node-chunks/{chunk-ZN2EDLIJ.js → chunk-GMO24NTJ.js} +7 -7
- package/dist/_node-chunks/{chunk-L5J4RBU5.js → chunk-HH57J4TX.js} +8 -8
- package/dist/_node-chunks/{chunk-Q5JSLT56.js → chunk-JKWP2FKQ.js} +7 -7
- package/dist/_node-chunks/chunk-LPNJ7PJY.js +61 -0
- package/dist/_node-chunks/{chunk-FI6CLUVL.js → chunk-MDXYV4OF.js} +15 -15
- package/dist/_node-chunks/{chunk-EKPHXLN6.js → chunk-MPUDYIDW.js} +7 -7
- package/dist/_node-chunks/{chunk-RQKELEE4.js → chunk-N7XYNLCJ.js} +7 -7
- package/dist/_node-chunks/{chunk-GWSFLQQQ.js → chunk-NCHBSJG3.js} +1466 -148
- package/dist/_node-chunks/{chunk-6TX2TV3E.js → chunk-NTH76OZA.js} +12 -12
- package/dist/_node-chunks/{chunk-5RN3IJGF.js → chunk-NTX43F34.js} +7 -7
- package/dist/_node-chunks/{chunk-BB3ZKTWJ.js → chunk-NYXHMPY4.js} +7 -7
- package/dist/_node-chunks/{chunk-BYQZFXRF.js → chunk-RLMJDF6S.js} +8 -8
- package/dist/_node-chunks/{chunk-IK3K67LJ.js → chunk-S32G4TCP.js} +7 -7
- package/dist/_node-chunks/{chunk-OM4TBMP7.js → chunk-SQAKXWVV.js} +7 -7
- package/dist/_node-chunks/{chunk-RUJOX3JR.js → chunk-T7KB265F.js} +6 -6
- package/dist/_node-chunks/{chunk-QS5MMNF7.js → chunk-TDLKTACT.js} +7 -7
- package/dist/_node-chunks/{chunk-ZI3WVJBS.js → chunk-TSKLBMF3.js} +8 -8
- package/dist/_node-chunks/{chunk-XVXUF5GE.js → chunk-TZ7GUTJ4.js} +7 -7
- package/dist/_node-chunks/{chunk-RIPSSVT6.js → chunk-YFBIEJ33.js} +7 -7
- package/dist/_node-chunks/{chunk-VEZ6C62C.js → chunk-YJJWZPL7.js} +8 -8
- package/dist/_node-chunks/{chunk-ZTHTAFLY.js → chunk-ZQY3BNST.js} +12 -12
- package/dist/_node-chunks/{dist-Q25SOSXX.js → dist-SQENNWFY.js} +9 -9
- package/dist/_node-chunks/{globby-I54LIY47.js → globby-CVPDLQ5Z.js} +9 -9
- package/dist/_node-chunks/{lib-KQD2WJWJ.js → lib-4BTTMYE2.js} +7 -7
- package/dist/_node-chunks/{mdx-N42X6CFJ-CT3A7SBK.js → mdx-N42X6CFJ-ENVHI6CC.js} +8 -8
- package/dist/_node-chunks/{p-limit-2NBKFARM.js → p-limit-I2XW6GST.js} +7 -7
- package/dist/_node-chunks/{plugin-2CCCBGGB.js → plugin-4NIE24IO.js} +10 -10
- package/dist/_node-chunks/{plugin-RF5FICSG.js → plugin-O5PHZ367.js} +10 -10
- package/dist/_node-chunks/{webpack-inject-mocker-runtime-plugin-RY56E77L.js → webpack-inject-mocker-runtime-plugin-SVBN7WFH.js} +10 -10
- package/dist/_node-chunks/{webpack-mock-plugin-6VDFRSC4.js → webpack-mock-plugin-XBV3VXVD.js} +9 -9
- package/dist/babel/index.js +11 -11
- package/dist/bin/core.js +11 -11
- package/dist/bin/dispatcher.js +11 -11
- package/dist/bin/loader.js +9 -9
- package/dist/cli/index.js +21 -21
- package/dist/common/index.d.ts +190 -2
- package/dist/common/index.js +26 -20
- package/dist/core-server/index.js +712 -46
- package/dist/core-server/presets/common-override-preset.js +9 -9
- package/dist/core-server/presets/common-preset.js +23 -23
- package/dist/core-server/presets/webpack/loaders/storybook-mock-transform-loader.js +9 -9
- package/dist/core-server/presets/webpack/loaders/webpack-automock-loader.js +10 -10
- package/dist/csf-tools/index.js +9 -9
- package/dist/manager/globals-runtime.js +1 -1
- package/dist/manager-api/index.d.ts +1 -1
- package/dist/manager-api/index.js +1 -1
- package/dist/node-logger/index.js +14 -14
- package/dist/server-errors.js +10 -10
- package/dist/telemetry/index.js +24 -24
- package/dist/types/index.d.ts +2 -0
- package/package.json +2 -1
- package/dist/_node-chunks/camelcase-3IIGGJ6N.js +0 -18
- package/dist/_node-chunks/chunk-N3ZE2FCS.js +0 -61
- package/dist/_node-chunks/chunk-U6VJQXTG.js +0 -18
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_bqgqh4d46dd from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_bqgqh4d46dd from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_bqgqh4d46dd from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_bqgqh4d46dd.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_bqgqh4d46dd.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_bqgqh4d46dd.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
|
detectPnp
|
|
14
|
-
} from "../_node-chunks/chunk-
|
|
14
|
+
} from "../_node-chunks/chunk-NTH76OZA.js";
|
|
15
15
|
import {
|
|
16
16
|
require_pretty_hrtime
|
|
17
|
-
} from "../_node-chunks/chunk-
|
|
17
|
+
} from "../_node-chunks/chunk-GMO24NTJ.js";
|
|
18
18
|
import {
|
|
19
19
|
boxen,
|
|
20
20
|
require_string_width
|
|
21
|
-
} from "../_node-chunks/chunk-
|
|
22
|
-
import "../_node-chunks/chunk-
|
|
21
|
+
} from "../_node-chunks/chunk-RLMJDF6S.js";
|
|
22
|
+
import "../_node-chunks/chunk-NTX43F34.js";
|
|
23
23
|
import {
|
|
24
24
|
StatusTypeIdMismatchError,
|
|
25
25
|
StorybookError
|
|
26
|
-
} from "../_node-chunks/chunk-
|
|
26
|
+
} from "../_node-chunks/chunk-CKXP5RYA.js";
|
|
27
27
|
import {
|
|
28
28
|
getErrorLevel,
|
|
29
29
|
mapStaticDir,
|
|
@@ -31,61 +31,63 @@ import {
|
|
|
31
31
|
sendTelemetryError,
|
|
32
32
|
useStatics,
|
|
33
33
|
withTelemetry
|
|
34
|
-
} from "../_node-chunks/chunk-
|
|
35
|
-
import "../_node-chunks/chunk-
|
|
34
|
+
} from "../_node-chunks/chunk-ZQY3BNST.js";
|
|
35
|
+
import "../_node-chunks/chunk-N7XYNLCJ.js";
|
|
36
36
|
import {
|
|
37
37
|
telemetry
|
|
38
|
-
} from "../_node-chunks/chunk-
|
|
39
|
-
import "../_node-chunks/chunk-
|
|
38
|
+
} from "../_node-chunks/chunk-MDXYV4OF.js";
|
|
39
|
+
import "../_node-chunks/chunk-D3NGJQDZ.js";
|
|
40
40
|
import {
|
|
41
|
+
resolveImport,
|
|
42
|
+
supportedExtensions,
|
|
41
43
|
userOrAutoTitleFromSpecifier
|
|
42
|
-
} from "../_node-chunks/chunk-
|
|
43
|
-
import "../_node-chunks/chunk-
|
|
44
|
-
import "../_node-chunks/chunk-
|
|
45
|
-
import "../_node-chunks/chunk-
|
|
44
|
+
} from "../_node-chunks/chunk-NCHBSJG3.js";
|
|
45
|
+
import "../_node-chunks/chunk-TZ7GUTJ4.js";
|
|
46
|
+
import "../_node-chunks/chunk-LPNJ7PJY.js";
|
|
47
|
+
import "../_node-chunks/chunk-HH57J4TX.js";
|
|
46
48
|
import {
|
|
47
49
|
optionalEnvToBoolean,
|
|
48
50
|
require_cross_spawn
|
|
49
|
-
} from "../_node-chunks/chunk-
|
|
51
|
+
} from "../_node-chunks/chunk-B63HGQAB.js";
|
|
50
52
|
import {
|
|
51
53
|
up2 as up
|
|
52
|
-
} from "../_node-chunks/chunk-
|
|
53
|
-
import "../_node-chunks/chunk-
|
|
54
|
+
} from "../_node-chunks/chunk-5KDXQR2J.js";
|
|
55
|
+
import "../_node-chunks/chunk-SQAKXWVV.js";
|
|
54
56
|
import {
|
|
55
57
|
invariant
|
|
56
|
-
} from "../_node-chunks/chunk-
|
|
58
|
+
} from "../_node-chunks/chunk-5X7FGASE.js";
|
|
57
59
|
import {
|
|
58
60
|
importModule,
|
|
59
61
|
resolvePackageDir
|
|
60
|
-
} from "../_node-chunks/chunk-
|
|
62
|
+
} from "../_node-chunks/chunk-TSKLBMF3.js";
|
|
61
63
|
import {
|
|
62
64
|
join,
|
|
63
65
|
relative,
|
|
64
66
|
resolve
|
|
65
|
-
} from "../_node-chunks/chunk-
|
|
67
|
+
} from "../_node-chunks/chunk-6U2QTN2E.js";
|
|
66
68
|
import {
|
|
67
69
|
require_prompts
|
|
68
|
-
} from "../_node-chunks/chunk-
|
|
69
|
-
import "../_node-chunks/chunk-
|
|
70
|
+
} from "../_node-chunks/chunk-NYXHMPY4.js";
|
|
71
|
+
import "../_node-chunks/chunk-JKWP2FKQ.js";
|
|
70
72
|
import {
|
|
71
73
|
slash
|
|
72
|
-
} from "../_node-chunks/chunk-
|
|
74
|
+
} from "../_node-chunks/chunk-MPUDYIDW.js";
|
|
73
75
|
import {
|
|
74
76
|
require_dist
|
|
75
|
-
} from "../_node-chunks/chunk-
|
|
77
|
+
} from "../_node-chunks/chunk-S32G4TCP.js";
|
|
76
78
|
import {
|
|
77
79
|
require_lib,
|
|
78
80
|
require_src
|
|
79
|
-
} from "../_node-chunks/chunk-
|
|
81
|
+
} from "../_node-chunks/chunk-TDLKTACT.js";
|
|
80
82
|
import {
|
|
81
83
|
require_picocolors
|
|
82
|
-
} from "../_node-chunks/chunk-
|
|
84
|
+
} from "../_node-chunks/chunk-2JHIUWIN.js";
|
|
83
85
|
import {
|
|
84
86
|
__commonJS,
|
|
85
87
|
__name,
|
|
86
88
|
__require,
|
|
87
89
|
__toESM
|
|
88
|
-
} from "../_node-chunks/chunk-
|
|
90
|
+
} from "../_node-chunks/chunk-T7KB265F.js";
|
|
89
91
|
|
|
90
92
|
// ../node_modules/tsconfig-paths/lib/filesystem.js
|
|
91
93
|
var require_filesystem = __commonJS({
|
|
@@ -8487,6 +8489,645 @@ import { getPrecedingUpgrade, telemetry as telemetry2 } from "storybook/internal
|
|
|
8487
8489
|
import { global as global2 } from "@storybook/global";
|
|
8488
8490
|
var import_picocolors4 = __toESM(require_picocolors(), 1);
|
|
8489
8491
|
|
|
8492
|
+
// src/core-server/manifest.ts
|
|
8493
|
+
import { groupBy } from "storybook/internal/common";
|
|
8494
|
+
function renderManifestComponentsPage(manifest) {
|
|
8495
|
+
const entries = Object.entries(manifest?.components ?? {}).sort(
|
|
8496
|
+
(a, b) => (a[1].name || a[0]).localeCompare(b[1].name || b[0])
|
|
8497
|
+
);
|
|
8498
|
+
const analyses = entries.map(([, c]) => analyzeComponent(c));
|
|
8499
|
+
const totals = {
|
|
8500
|
+
components: entries.length,
|
|
8501
|
+
componentsWithError: analyses.filter((a) => a.hasComponentError).length,
|
|
8502
|
+
componentsWithWarnings: analyses.filter((a) => a.hasWarns).length,
|
|
8503
|
+
examples: analyses.reduce((sum, a) => sum + a.totalExamples, 0),
|
|
8504
|
+
exampleErrors: analyses.reduce((sum, a) => sum + a.exampleErrors, 0)
|
|
8505
|
+
};
|
|
8506
|
+
const allPill = `<a class="filter-pill all" data-k="all" href="#filter-all">All</a>`;
|
|
8507
|
+
const compErrorsPill = totals.componentsWithError > 0 ? `<a class="filter-pill err" data-k="errors" href="#filter-errors">${totals.componentsWithError}/${totals.components} component ${plural(totals.componentsWithError, "error")}</a>` : `<span class="filter-pill ok" aria-disabled="true">${totals.components} components ok</span>`;
|
|
8508
|
+
const compWarningsPill = totals.componentsWithWarnings > 0 ? `<a class="filter-pill warn" data-k="warnings" href="#filter-warnings">${totals.componentsWithWarnings}/${totals.components} component ${plural(totals.componentsWithWarnings, "warning")}</a>` : "";
|
|
8509
|
+
const examplesPill = totals.exampleErrors > 0 ? `<a class="filter-pill err" data-k="example-errors" href="#filter-example-errors">${totals.exampleErrors}/${totals.examples} example errors</a>` : `<span class="filter-pill ok" aria-disabled="true">${totals.examples} examples ok</span>`;
|
|
8510
|
+
const grid = entries.map(([key, c], idx) => renderComponentCard(key, c, `${idx}`)).join("");
|
|
8511
|
+
const errorGroups = Object.entries(
|
|
8512
|
+
groupBy(
|
|
8513
|
+
entries.map(([, it]) => it).filter((it) => it.error),
|
|
8514
|
+
(manifest2) => manifest2.error?.name ?? "Error"
|
|
8515
|
+
)
|
|
8516
|
+
);
|
|
8517
|
+
const errorGroupsHTML = errorGroups.map(([error, grouped]) => {
|
|
8518
|
+
const id = error.toLowerCase().replace(/[^a-z0-9]+/g, "-");
|
|
8519
|
+
const headerText = `${esc(error)}`;
|
|
8520
|
+
const cards = grouped.map((manifest2, id2) => renderComponentCard(manifest2.id, manifest2, `error-${id2}`)).join("");
|
|
8521
|
+
return `
|
|
8522
|
+
<section class="group">
|
|
8523
|
+
<input id="${id}-toggle" class="group-tg" type="checkbox" hidden />
|
|
8524
|
+
<label for="${id}-toggle" class="group-header">
|
|
8525
|
+
<span class="caret">\u25B8</span>
|
|
8526
|
+
<span class="group-title">${headerText}</span>
|
|
8527
|
+
<span class="group-count">${grouped.length}</span>
|
|
8528
|
+
</label>
|
|
8529
|
+
<div class="group-cards">${cards}</div>
|
|
8530
|
+
</section>
|
|
8531
|
+
`;
|
|
8532
|
+
}).join("");
|
|
8533
|
+
return `<!doctype html>
|
|
8534
|
+
<html lang="en">
|
|
8535
|
+
<head>
|
|
8536
|
+
<meta charset="utf-8" />
|
|
8537
|
+
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
8538
|
+
<title>Components Manifest</title>
|
|
8539
|
+
<style>
|
|
8540
|
+
:root {
|
|
8541
|
+
--bg: #0b0c10;
|
|
8542
|
+
--panel: #121318;
|
|
8543
|
+
--muted: #9aa0a6;
|
|
8544
|
+
--fg: #e8eaed;
|
|
8545
|
+
--ok: #22c55e;
|
|
8546
|
+
--warn: #b08900;
|
|
8547
|
+
--err: #c62828;
|
|
8548
|
+
--ok-bg: #0c1a13;
|
|
8549
|
+
--warn-bg: #1a1608;
|
|
8550
|
+
--err-bg: #1a0e0e;
|
|
8551
|
+
--chip: #1f2330;
|
|
8552
|
+
--border: #2b2f3a;
|
|
8553
|
+
--link: #8ab4f8;
|
|
8554
|
+
--active-ring: 1px; /* 1px active ring for pills and toggles */
|
|
8555
|
+
}
|
|
8556
|
+
|
|
8557
|
+
* {
|
|
8558
|
+
box-sizing: border-box;
|
|
8559
|
+
}
|
|
8560
|
+
|
|
8561
|
+
html,
|
|
8562
|
+
body {
|
|
8563
|
+
margin: 0;
|
|
8564
|
+
background: var(--bg);
|
|
8565
|
+
color: var(--fg);
|
|
8566
|
+
font: 14px/1.5 system-ui,
|
|
8567
|
+
-apple-system,
|
|
8568
|
+
Segoe UI,
|
|
8569
|
+
Roboto,
|
|
8570
|
+
Ubuntu,
|
|
8571
|
+
Cantarell,
|
|
8572
|
+
'Helvetica Neue',
|
|
8573
|
+
Arial,
|
|
8574
|
+
'Noto Sans';
|
|
8575
|
+
}
|
|
8576
|
+
|
|
8577
|
+
.wrap {
|
|
8578
|
+
max-width: 1100px;
|
|
8579
|
+
margin: 0 auto;
|
|
8580
|
+
padding: 16px 20px;
|
|
8581
|
+
}
|
|
8582
|
+
|
|
8583
|
+
header {
|
|
8584
|
+
position: sticky;
|
|
8585
|
+
top: 0;
|
|
8586
|
+
backdrop-filter: blur(6px);
|
|
8587
|
+
background: color-mix(in srgb, var(--bg) 84%, transparent);
|
|
8588
|
+
border-bottom: 1px solid var(--border);
|
|
8589
|
+
z-index: 10;
|
|
8590
|
+
}
|
|
8591
|
+
|
|
8592
|
+
h1 {
|
|
8593
|
+
font-size: 20px;
|
|
8594
|
+
margin: 0 0 6px;
|
|
8595
|
+
}
|
|
8596
|
+
|
|
8597
|
+
.summary {
|
|
8598
|
+
display: flex;
|
|
8599
|
+
gap: 12px;
|
|
8600
|
+
flex-wrap: wrap;
|
|
8601
|
+
align-items: center;
|
|
8602
|
+
}
|
|
8603
|
+
|
|
8604
|
+
/* Top filter pills */
|
|
8605
|
+
.filter-pill {
|
|
8606
|
+
display: inline-flex;
|
|
8607
|
+
align-items: center;
|
|
8608
|
+
gap: 6px;
|
|
8609
|
+
padding: 6px 12px;
|
|
8610
|
+
border: 1px solid var(--border);
|
|
8611
|
+
border-radius: 999px;
|
|
8612
|
+
background: var(--panel);
|
|
8613
|
+
text-decoration: none;
|
|
8614
|
+
cursor: pointer;
|
|
8615
|
+
user-select: none;
|
|
8616
|
+
color: var(--fg);
|
|
8617
|
+
}
|
|
8618
|
+
|
|
8619
|
+
.filter-pill.ok {
|
|
8620
|
+
color: #b9f6ca;
|
|
8621
|
+
border-color: color-mix(in srgb, var(--ok) 55%, var(--border));
|
|
8622
|
+
background: color-mix(in srgb, var(--ok) 18%, #000);
|
|
8623
|
+
}
|
|
8624
|
+
|
|
8625
|
+
.filter-pill.warn {
|
|
8626
|
+
color: #ffd666;
|
|
8627
|
+
border-color: color-mix(in srgb, var(--warn) 55%, var(--border));
|
|
8628
|
+
background: var(--warn-bg);
|
|
8629
|
+
}
|
|
8630
|
+
|
|
8631
|
+
.filter-pill.err {
|
|
8632
|
+
color: #ff9aa0;
|
|
8633
|
+
border-color: color-mix(in srgb, var(--err) 55%, var(--border));
|
|
8634
|
+
background: var(--err-bg);
|
|
8635
|
+
}
|
|
8636
|
+
|
|
8637
|
+
.filter-pill.all {
|
|
8638
|
+
color: #d7dbe0;
|
|
8639
|
+
border-color: var(--border);
|
|
8640
|
+
background: var(--panel);
|
|
8641
|
+
}
|
|
8642
|
+
|
|
8643
|
+
.filter-pill[aria-disabled='true'] {
|
|
8644
|
+
cursor: default;
|
|
8645
|
+
text-decoration: none;
|
|
8646
|
+
}
|
|
8647
|
+
|
|
8648
|
+
.filter-pill:focus,
|
|
8649
|
+
.filter-pill:active {
|
|
8650
|
+
outline: none;
|
|
8651
|
+
box-shadow: none;
|
|
8652
|
+
}
|
|
8653
|
+
|
|
8654
|
+
/* Selected top pill ring via :target */
|
|
8655
|
+
#filter-all:target ~ header .filter-pill[data-k='all'],
|
|
8656
|
+
#filter-errors:target ~ header .filter-pill[data-k='errors'],
|
|
8657
|
+
#filter-warnings:target ~ header .filter-pill[data-k='warnings'],
|
|
8658
|
+
#filter-example-errors:target ~ header .filter-pill[data-k='example-errors'] {
|
|
8659
|
+
box-shadow: 0 0 0 var(--active-ring) currentColor;
|
|
8660
|
+
border-color: currentColor;
|
|
8661
|
+
}
|
|
8662
|
+
|
|
8663
|
+
/* Hidden targets for filtering */
|
|
8664
|
+
#filter-all,
|
|
8665
|
+
#filter-errors,
|
|
8666
|
+
#filter-warnings,
|
|
8667
|
+
#filter-example-errors {
|
|
8668
|
+
display: none;
|
|
8669
|
+
}
|
|
8670
|
+
|
|
8671
|
+
main {
|
|
8672
|
+
padding: 24px 0 40px;
|
|
8673
|
+
}
|
|
8674
|
+
|
|
8675
|
+
.grid {
|
|
8676
|
+
display: grid;
|
|
8677
|
+
grid-template-columns: 1fr;
|
|
8678
|
+
gap: 14px;
|
|
8679
|
+
}
|
|
8680
|
+
|
|
8681
|
+
/* one card per row */
|
|
8682
|
+
|
|
8683
|
+
.card {
|
|
8684
|
+
border: 1px solid var(--border);
|
|
8685
|
+
background: var(--panel);
|
|
8686
|
+
border-radius: 14px;
|
|
8687
|
+
padding: 14px;
|
|
8688
|
+
display: flex;
|
|
8689
|
+
flex-direction: column;
|
|
8690
|
+
gap: 10px;
|
|
8691
|
+
}
|
|
8692
|
+
|
|
8693
|
+
.head {
|
|
8694
|
+
display: flex;
|
|
8695
|
+
flex-direction: column;
|
|
8696
|
+
gap: 8px;
|
|
8697
|
+
}
|
|
8698
|
+
|
|
8699
|
+
.title {
|
|
8700
|
+
display: flex;
|
|
8701
|
+
align-items: center;
|
|
8702
|
+
justify-content: space-between;
|
|
8703
|
+
gap: 10px;
|
|
8704
|
+
}
|
|
8705
|
+
|
|
8706
|
+
.title h2 {
|
|
8707
|
+
font-size: 16px;
|
|
8708
|
+
margin: 0;
|
|
8709
|
+
overflow: hidden;
|
|
8710
|
+
text-overflow: ellipsis;
|
|
8711
|
+
white-space: nowrap;
|
|
8712
|
+
}
|
|
8713
|
+
|
|
8714
|
+
.meta {
|
|
8715
|
+
font-size: 12px;
|
|
8716
|
+
color: var(--muted);
|
|
8717
|
+
overflow: hidden;
|
|
8718
|
+
text-overflow: ellipsis;
|
|
8719
|
+
white-space: nowrap;
|
|
8720
|
+
}
|
|
8721
|
+
|
|
8722
|
+
.kv {
|
|
8723
|
+
display: flex;
|
|
8724
|
+
flex-wrap: wrap;
|
|
8725
|
+
gap: 6px;
|
|
8726
|
+
}
|
|
8727
|
+
|
|
8728
|
+
.chip {
|
|
8729
|
+
font-size: 12px;
|
|
8730
|
+
padding: 4px 8px;
|
|
8731
|
+
border-radius: 999px;
|
|
8732
|
+
background: var(--chip);
|
|
8733
|
+
border: 1px solid var(--border);
|
|
8734
|
+
}
|
|
8735
|
+
|
|
8736
|
+
.hint {
|
|
8737
|
+
color: var(--muted);
|
|
8738
|
+
font-size: 12px;
|
|
8739
|
+
}
|
|
8740
|
+
|
|
8741
|
+
.badges {
|
|
8742
|
+
display: flex;
|
|
8743
|
+
gap: 8px;
|
|
8744
|
+
flex-wrap: wrap;
|
|
8745
|
+
}
|
|
8746
|
+
|
|
8747
|
+
/* Per-card badges: labels become toggles when clickable */
|
|
8748
|
+
.badge {
|
|
8749
|
+
font-size: 12px;
|
|
8750
|
+
padding: 3px 8px;
|
|
8751
|
+
border-radius: 999px;
|
|
8752
|
+
border: 1px solid var(--border);
|
|
8753
|
+
background: var(--chip);
|
|
8754
|
+
color: #d7dbe0;
|
|
8755
|
+
}
|
|
8756
|
+
|
|
8757
|
+
.badge.ok {
|
|
8758
|
+
color: #b9f6ca;
|
|
8759
|
+
border-color: color-mix(in srgb, var(--ok) 55%, var(--border));
|
|
8760
|
+
}
|
|
8761
|
+
|
|
8762
|
+
.badge.warn {
|
|
8763
|
+
color: #ffd666;
|
|
8764
|
+
border-color: color-mix(in srgb, var(--warn) 55%, var(--border));
|
|
8765
|
+
}
|
|
8766
|
+
|
|
8767
|
+
.badge.err {
|
|
8768
|
+
color: #ff9aa0;
|
|
8769
|
+
border-color: color-mix(in srgb, var(--err) 55%, var(--border));
|
|
8770
|
+
}
|
|
8771
|
+
|
|
8772
|
+
.as-toggle {
|
|
8773
|
+
cursor: pointer;
|
|
8774
|
+
}
|
|
8775
|
+
|
|
8776
|
+
/* 1px ring on active toggle */
|
|
8777
|
+
.tg-err:checked + label.as-toggle,
|
|
8778
|
+
.tg-warn:checked + label.as-toggle,
|
|
8779
|
+
.tg-ex:checked + label.as-toggle {
|
|
8780
|
+
box-shadow: 0 0 0 var(--active-ring) currentColor;
|
|
8781
|
+
border-color: currentColor;
|
|
8782
|
+
}
|
|
8783
|
+
|
|
8784
|
+
/* Panels: hidden by default, shown when respective toggle checked */
|
|
8785
|
+
.panels {
|
|
8786
|
+
display: grid;
|
|
8787
|
+
gap: 10px;
|
|
8788
|
+
}
|
|
8789
|
+
|
|
8790
|
+
.panel {
|
|
8791
|
+
display: none;
|
|
8792
|
+
}
|
|
8793
|
+
|
|
8794
|
+
.tg-err:checked ~ .panels .panel-err {
|
|
8795
|
+
display: grid;
|
|
8796
|
+
}
|
|
8797
|
+
|
|
8798
|
+
.tg-warn:checked ~ .panels .panel-warn {
|
|
8799
|
+
display: grid;
|
|
8800
|
+
gap: 8px;
|
|
8801
|
+
}
|
|
8802
|
+
|
|
8803
|
+
.tg-ex:checked ~ .panels .panel-ex {
|
|
8804
|
+
display: grid;
|
|
8805
|
+
}
|
|
8806
|
+
|
|
8807
|
+
/* Colored notes for component error + warnings */
|
|
8808
|
+
.note {
|
|
8809
|
+
padding: 12px;
|
|
8810
|
+
border: 1px solid var(--border);
|
|
8811
|
+
border-radius: 10px;
|
|
8812
|
+
}
|
|
8813
|
+
|
|
8814
|
+
.note.err {
|
|
8815
|
+
border-color: color-mix(in srgb, var(--err) 55%, var(--border));
|
|
8816
|
+
background: var(--err-bg);
|
|
8817
|
+
color: #ffd1d4;
|
|
8818
|
+
}
|
|
8819
|
+
|
|
8820
|
+
.note.warn {
|
|
8821
|
+
border-color: color-mix(in srgb, var(--warn) 55%, var(--border));
|
|
8822
|
+
background: var(--warn-bg);
|
|
8823
|
+
color: #ffe9a6;
|
|
8824
|
+
}
|
|
8825
|
+
|
|
8826
|
+
.note-title {
|
|
8827
|
+
font-weight: 600;
|
|
8828
|
+
margin-bottom: 6px;
|
|
8829
|
+
}
|
|
8830
|
+
|
|
8831
|
+
.note-body {
|
|
8832
|
+
white-space: normal;
|
|
8833
|
+
}
|
|
8834
|
+
|
|
8835
|
+
/* Example error cards */
|
|
8836
|
+
.ex {
|
|
8837
|
+
padding: 10px;
|
|
8838
|
+
border: 1px solid var(--border);
|
|
8839
|
+
border-radius: 10px;
|
|
8840
|
+
background: #0f131b;
|
|
8841
|
+
}
|
|
8842
|
+
|
|
8843
|
+
.ex.err {
|
|
8844
|
+
border-color: color-mix(in srgb, var(--err) 55%, var(--border));
|
|
8845
|
+
}
|
|
8846
|
+
|
|
8847
|
+
.row {
|
|
8848
|
+
display: flex;
|
|
8849
|
+
align-items: center;
|
|
8850
|
+
gap: 8px;
|
|
8851
|
+
flex-wrap: wrap;
|
|
8852
|
+
}
|
|
8853
|
+
|
|
8854
|
+
.status-dot {
|
|
8855
|
+
width: 8px;
|
|
8856
|
+
height: 8px;
|
|
8857
|
+
border-radius: 50%;
|
|
8858
|
+
display: inline-block;
|
|
8859
|
+
}
|
|
8860
|
+
|
|
8861
|
+
.dot-ok {
|
|
8862
|
+
background: var(--ok);
|
|
8863
|
+
}
|
|
8864
|
+
|
|
8865
|
+
.dot-err {
|
|
8866
|
+
background: var(--err);
|
|
8867
|
+
}
|
|
8868
|
+
|
|
8869
|
+
.ex-name {
|
|
8870
|
+
font-weight: 600;
|
|
8871
|
+
}
|
|
8872
|
+
|
|
8873
|
+
/* Error groups (visible in errors filter) */
|
|
8874
|
+
.error-groups {
|
|
8875
|
+
display: none;
|
|
8876
|
+
margin-bottom: 16px;
|
|
8877
|
+
}
|
|
8878
|
+
|
|
8879
|
+
.group {
|
|
8880
|
+
border: 1px solid var(--border);
|
|
8881
|
+
background: var(--panel);
|
|
8882
|
+
border-radius: 14px;
|
|
8883
|
+
overflow: hidden;
|
|
8884
|
+
}
|
|
8885
|
+
|
|
8886
|
+
.group + .group {
|
|
8887
|
+
margin-top: 12px;
|
|
8888
|
+
}
|
|
8889
|
+
|
|
8890
|
+
.group-header {
|
|
8891
|
+
display: flex;
|
|
8892
|
+
align-items: center;
|
|
8893
|
+
gap: 10px;
|
|
8894
|
+
padding: 12px 14px;
|
|
8895
|
+
cursor: pointer;
|
|
8896
|
+
border-bottom: 1px solid var(--border);
|
|
8897
|
+
}
|
|
8898
|
+
|
|
8899
|
+
.group-header:hover {
|
|
8900
|
+
background: #141722;
|
|
8901
|
+
}
|
|
8902
|
+
|
|
8903
|
+
.group-title {
|
|
8904
|
+
font-weight: 600;
|
|
8905
|
+
flex: 1;
|
|
8906
|
+
}
|
|
8907
|
+
|
|
8908
|
+
.group-count {
|
|
8909
|
+
font-size: 12px;
|
|
8910
|
+
color: var(--muted);
|
|
8911
|
+
}
|
|
8912
|
+
|
|
8913
|
+
.group-cards {
|
|
8914
|
+
display: none;
|
|
8915
|
+
padding: 12px;
|
|
8916
|
+
}
|
|
8917
|
+
|
|
8918
|
+
.group .card {
|
|
8919
|
+
margin: 12px 0;
|
|
8920
|
+
}
|
|
8921
|
+
|
|
8922
|
+
.group .card:first-child {
|
|
8923
|
+
margin-top: 0;
|
|
8924
|
+
}
|
|
8925
|
+
|
|
8926
|
+
.group .card:last-child {
|
|
8927
|
+
margin-bottom: 0;
|
|
8928
|
+
}
|
|
8929
|
+
|
|
8930
|
+
/* caret rotation */
|
|
8931
|
+
.group-tg:checked + label .caret {
|
|
8932
|
+
transform: rotate(90deg);
|
|
8933
|
+
}
|
|
8934
|
+
|
|
8935
|
+
.caret {
|
|
8936
|
+
transition: transform 0.15s ease;
|
|
8937
|
+
}
|
|
8938
|
+
|
|
8939
|
+
/* toggle body */
|
|
8940
|
+
.group-tg:checked ~ .group-cards {
|
|
8941
|
+
display: block;
|
|
8942
|
+
}
|
|
8943
|
+
|
|
8944
|
+
/* CSS-only filtering of cards via top pills */
|
|
8945
|
+
#filter-errors:target ~ main .card:not(.has-error):not(.has-example-error) {
|
|
8946
|
+
display: none;
|
|
8947
|
+
}
|
|
8948
|
+
|
|
8949
|
+
#filter-warnings:target ~ main .card:not(.has-warn) {
|
|
8950
|
+
display: none;
|
|
8951
|
+
}
|
|
8952
|
+
|
|
8953
|
+
#filter-example-errors:target ~ main .card:not(.has-example-error) {
|
|
8954
|
+
display: none;
|
|
8955
|
+
}
|
|
8956
|
+
|
|
8957
|
+
#filter-all:target ~ main .card {
|
|
8958
|
+
display: block;
|
|
8959
|
+
}
|
|
8960
|
+
|
|
8961
|
+
/* In errors view, hide standalone component-error cards in the regular grid (they will appear in groups) */
|
|
8962
|
+
#filter-errors:target ~ main .grid .card.has-error {
|
|
8963
|
+
display: none;
|
|
8964
|
+
}
|
|
8965
|
+
|
|
8966
|
+
/* Show grouped section only in errors view */
|
|
8967
|
+
#filter-errors:target ~ main .error-groups {
|
|
8968
|
+
display: block;
|
|
8969
|
+
}
|
|
8970
|
+
|
|
8971
|
+
/* When a toggle is checked, show the corresponding panel */
|
|
8972
|
+
.card > .tg-err:checked ~ .panels .panel-err {
|
|
8973
|
+
display: grid;
|
|
8974
|
+
}
|
|
8975
|
+
|
|
8976
|
+
.card > .tg-warn:checked ~ .panels .panel-warn {
|
|
8977
|
+
display: grid;
|
|
8978
|
+
}
|
|
8979
|
+
|
|
8980
|
+
.card > .tg-ex:checked ~ .panels .panel-ex {
|
|
8981
|
+
display: grid;
|
|
8982
|
+
}
|
|
8983
|
+
|
|
8984
|
+
/* Optional: a subtle 1px ring on the active badge, using :has() if available */
|
|
8985
|
+
@supports selector(.card:has(.tg-err:checked)) {
|
|
8986
|
+
.card:has(.tg-err:checked) label[for$='-err'],
|
|
8987
|
+
.card:has(.tg-warn:checked) label[for$='-warn'],
|
|
8988
|
+
.card:has(.tg-ex:checked) label[for$='-ex'] {
|
|
8989
|
+
box-shadow: 0 0 0 1px currentColor;
|
|
8990
|
+
border-color: currentColor;
|
|
8991
|
+
}
|
|
8992
|
+
}
|
|
8993
|
+
</style>
|
|
8994
|
+
</head>
|
|
8995
|
+
<body>
|
|
8996
|
+
<!-- Hidden targets for the top-level filters -->
|
|
8997
|
+
<span id="filter-all"></span>
|
|
8998
|
+
<span id="filter-errors"></span>
|
|
8999
|
+
<span id="filter-warnings"></span>
|
|
9000
|
+
<span id="filter-example-errors"></span>
|
|
9001
|
+
<header>
|
|
9002
|
+
<div class="wrap">
|
|
9003
|
+
<h1>Components Manifest</h1>
|
|
9004
|
+
<div class="summary">${allPill}${compErrorsPill}${compWarningsPill}${examplesPill}</div>
|
|
9005
|
+
</div>
|
|
9006
|
+
</header>
|
|
9007
|
+
<main>
|
|
9008
|
+
<div class="wrap">
|
|
9009
|
+
<div class="grid" role="list">
|
|
9010
|
+
${grid || `<div class="card"><div class="head"><div class="hint">No components.</div></div></div>`}
|
|
9011
|
+
</div>
|
|
9012
|
+
${errorGroups.length ? `<div class="error-groups" role="region" aria-label="Error groups">${errorGroupsHTML}</div>` : ""}
|
|
9013
|
+
</div>
|
|
9014
|
+
</main>
|
|
9015
|
+
</body>
|
|
9016
|
+
</html> `;
|
|
9017
|
+
}
|
|
9018
|
+
__name(renderManifestComponentsPage, "renderManifestComponentsPage");
|
|
9019
|
+
var esc = /* @__PURE__ */ __name((s) => String(s ?? "").replace(
|
|
9020
|
+
/[&<>"']/g,
|
|
9021
|
+
(c) => ({ "&": "&", "<": "<", ">": ">", '"': """, "'": "'" })[c]
|
|
9022
|
+
), "esc");
|
|
9023
|
+
var plural = /* @__PURE__ */ __name((n, one, many = `${one}s`) => n === 1 ? one : many, "plural");
|
|
9024
|
+
function analyzeComponent(c) {
|
|
9025
|
+
const hasComponentError = !!c.error;
|
|
9026
|
+
const warns = [];
|
|
9027
|
+
if (!c.description?.trim()) {
|
|
9028
|
+
warns.push(
|
|
9029
|
+
"No description found. Write a jsdoc comment such as /** Component description */ on your component or on your stories meta."
|
|
9030
|
+
);
|
|
9031
|
+
}
|
|
9032
|
+
if (!c.import?.trim()) {
|
|
9033
|
+
warns.push(
|
|
9034
|
+
`Specify an @import jsdoc tag on your component or your stories meta such as @import import { ${c.name} } from 'my-design-system';`
|
|
9035
|
+
);
|
|
9036
|
+
}
|
|
9037
|
+
const totalExamples = c.examples?.length ?? 0;
|
|
9038
|
+
const exampleErrors = (c.examples ?? []).filter((e) => !!e?.error).length;
|
|
9039
|
+
const exampleOk = totalExamples - exampleErrors;
|
|
9040
|
+
const hasAnyError = hasComponentError || exampleErrors > 0;
|
|
9041
|
+
return {
|
|
9042
|
+
hasComponentError,
|
|
9043
|
+
hasAnyError,
|
|
9044
|
+
hasWarns: warns.length > 0,
|
|
9045
|
+
warns,
|
|
9046
|
+
totalExamples,
|
|
9047
|
+
exampleErrors,
|
|
9048
|
+
exampleOk
|
|
9049
|
+
};
|
|
9050
|
+
}
|
|
9051
|
+
__name(analyzeComponent, "analyzeComponent");
|
|
9052
|
+
function note(title, bodyHTML, kind) {
|
|
9053
|
+
return `
|
|
9054
|
+
<div class="note ${kind}">
|
|
9055
|
+
<div class="note-title">${esc(title)}</div>
|
|
9056
|
+
<div class="note-body">${bodyHTML}</div>
|
|
9057
|
+
</div>`;
|
|
9058
|
+
}
|
|
9059
|
+
__name(note, "note");
|
|
9060
|
+
function renderComponentCard(key, c, id) {
|
|
9061
|
+
const a = analyzeComponent(c);
|
|
9062
|
+
const statusDot = a.hasAnyError ? "dot-err" : "dot-ok";
|
|
9063
|
+
const errorExamples = (c.examples ?? []).filter((ex) => !!ex?.error);
|
|
9064
|
+
const slug = `c-${id}-${(c.id || key).toLowerCase().replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "")}`;
|
|
9065
|
+
const componentErrorBadge = a.hasComponentError ? `<label for="${slug}-err" class="badge err as-toggle">component error</label>` : "";
|
|
9066
|
+
const warningsBadge = a.hasWarns ? `<label for="${slug}-warn" class="badge warn as-toggle">${a.warns.length} ${plural(a.warns.length, "warning")}</label>` : "";
|
|
9067
|
+
const examplesBadge = a.exampleErrors > 0 ? `<label for="${slug}-ex" class="badge err as-toggle">${a.exampleErrors}/${a.totalExamples} example errors</label>` : `<span class="badge ok">${a.totalExamples} examples ok</span>`;
|
|
9068
|
+
const tags = c.jsDocTags && typeof c.jsDocTags === "object" ? Object.entries(c.jsDocTags).flatMap(
|
|
9069
|
+
([k, v]) => (Array.isArray(v) ? v : [v]).map(
|
|
9070
|
+
(val) => `<span class="chip">${esc(k)}: ${esc(val)}</span>`
|
|
9071
|
+
)
|
|
9072
|
+
).join("") : "";
|
|
9073
|
+
esc(c.error?.message || "Unknown error");
|
|
9074
|
+
return `
|
|
9075
|
+
<article
|
|
9076
|
+
class="card
|
|
9077
|
+
${a.hasComponentError ? "has-error" : "no-error"}
|
|
9078
|
+
${a.hasWarns ? "has-warn" : "no-warn"}
|
|
9079
|
+
${a.exampleErrors ? "has-example-error" : "no-example-error"}"
|
|
9080
|
+
role="listitem"
|
|
9081
|
+
aria-label="${esc(c.name || key)}">
|
|
9082
|
+
<div class="head">
|
|
9083
|
+
<div class="title">
|
|
9084
|
+
<h2><span class="status-dot ${statusDot}"></span> ${esc(c.name || key)}</h2>
|
|
9085
|
+
<div class="badges">
|
|
9086
|
+
${componentErrorBadge}
|
|
9087
|
+
${warningsBadge}
|
|
9088
|
+
${examplesBadge}
|
|
9089
|
+
</div>
|
|
9090
|
+
</div>
|
|
9091
|
+
<div class="meta" title="${esc(c.path)}">${esc(c.id)} \xB7 ${esc(c.path)}</div>
|
|
9092
|
+
${c.summary ? `<div>${esc(c.summary)}</div>` : ""}
|
|
9093
|
+
${c.description ? `<div class="hint">${esc(c.description)}</div>` : ""}
|
|
9094
|
+
${tags ? `<div class="kv">${tags}</div>` : ""}
|
|
9095
|
+
</div>
|
|
9096
|
+
|
|
9097
|
+
<!-- \u2B07\uFE0F Hidden toggles must be siblings BEFORE .panels -->
|
|
9098
|
+
${a.hasComponentError ? `<input id="${slug}-err" class="tg tg-err" type="checkbox" hidden />` : ""}
|
|
9099
|
+
${a.hasWarns ? `<input id="${slug}-warn" class="tg tg-warn" type="checkbox" hidden />` : ""}
|
|
9100
|
+
${a.exampleErrors > 0 ? `<input id="${slug}-ex" class="tg tg-ex" type="checkbox" hidden />` : ""}
|
|
9101
|
+
|
|
9102
|
+
<div class="panels">
|
|
9103
|
+
${a.hasComponentError ? `
|
|
9104
|
+
<div class="panel panel-err">
|
|
9105
|
+
${note("Component error", `<pre><code>${esc(c.error?.message || "Unknown error")}</code></pre>`, "err")}
|
|
9106
|
+
</div>` : ""}
|
|
9107
|
+
${a.hasWarns ? `
|
|
9108
|
+
<div class="panel panel-warn">
|
|
9109
|
+
${a.warns.map((w) => note("Warning", esc(w), "warn")).join("")}
|
|
9110
|
+
</div>` : ""}
|
|
9111
|
+
${a.exampleErrors > 0 ? `
|
|
9112
|
+
<div class="panel panel-ex">
|
|
9113
|
+
${errorExamples.map(
|
|
9114
|
+
(ex, j) => `
|
|
9115
|
+
<div class="ex err">
|
|
9116
|
+
<div class="row">
|
|
9117
|
+
<span class="status-dot dot-err"></span>
|
|
9118
|
+
<span class="ex-name">${esc(ex?.name ?? `Example ${j + 1}`)}</span>
|
|
9119
|
+
<span class="badge err">example error</span>
|
|
9120
|
+
</div>
|
|
9121
|
+
${ex?.snippet ? `<pre><code>${esc(ex.snippet)}</code></pre>` : ""}
|
|
9122
|
+
${ex?.error?.message ? `<pre><code>${esc(ex.error.message)}</code></pre>` : ""}
|
|
9123
|
+
</div>`
|
|
9124
|
+
).join("")}
|
|
9125
|
+
</div>` : ""}
|
|
9126
|
+
</div>
|
|
9127
|
+
</article>`;
|
|
9128
|
+
}
|
|
9129
|
+
__name(renderComponentCard, "renderComponentCard");
|
|
9130
|
+
|
|
8490
9131
|
// src/core-server/utils/StoryIndexGenerator.ts
|
|
8491
9132
|
import { existsSync } from "node:fs";
|
|
8492
9133
|
import { readFile } from "node:fs/promises";
|
|
@@ -8719,7 +9360,7 @@ var StoryIndexGenerator = class _StoryIndexGenerator {
|
|
|
8719
9360
|
}
|
|
8720
9361
|
const pathToSubIndex = {};
|
|
8721
9362
|
const fullGlob = slash(join2(specifier.directory, specifier.files));
|
|
8722
|
-
const { globby } = await import("../_node-chunks/globby-
|
|
9363
|
+
const { globby } = await import("../_node-chunks/globby-CVPDLQ5Z.js");
|
|
8723
9364
|
const files = await globby(fullGlob, {
|
|
8724
9365
|
absolute: true,
|
|
8725
9366
|
cwd: workingDir,
|
|
@@ -8868,17 +9509,15 @@ var StoryIndexGenerator = class _StoryIndexGenerator {
|
|
|
8868
9509
|
* If no such file exists, assume that the import is from a package and return the raw
|
|
8869
9510
|
*/
|
|
8870
9511
|
resolveComponentPath(rawComponentPath, absolutePath, matchPath) {
|
|
8871
|
-
|
|
8872
|
-
|
|
8873
|
-
|
|
8874
|
-
|
|
8875
|
-
|
|
8876
|
-
|
|
8877
|
-
if (existing) {
|
|
8878
|
-
const relativePath = relative2(this.options.workingDir, existing);
|
|
8879
|
-
return slash(normalizeStoryPath(relativePath));
|
|
9512
|
+
const matchedPath = matchPath?.(rawComponentPath, void 0, void 0, supportedExtensions) ?? rawComponentPath;
|
|
9513
|
+
let resolved;
|
|
9514
|
+
try {
|
|
9515
|
+
resolved = resolveImport(matchedPath, { basedir: dirname(absolutePath) });
|
|
9516
|
+
} catch (_) {
|
|
9517
|
+
return matchedPath;
|
|
8880
9518
|
}
|
|
8881
|
-
|
|
9519
|
+
const relativePath = relative2(this.options.workingDir, resolved);
|
|
9520
|
+
return slash(normalizeStoryPath(relativePath));
|
|
8882
9521
|
}
|
|
8883
9522
|
async extractStories(specifier, absolutePath, projectTags = []) {
|
|
8884
9523
|
const relativePath = relative2(this.options.workingDir, absolutePath);
|
|
@@ -8977,7 +9616,7 @@ var StoryIndexGenerator = class _StoryIndexGenerator {
|
|
|
8977
9616
|
const normalizedPath = normalizeStoryPath(relativePath);
|
|
8978
9617
|
const importPath = slash(normalizedPath);
|
|
8979
9618
|
const content = await readFile(absolutePath, { encoding: "utf8" });
|
|
8980
|
-
const { analyze } = await import("../_node-chunks/dist-
|
|
9619
|
+
const { analyze } = await import("../_node-chunks/dist-SQENNWFY.js");
|
|
8981
9620
|
const result = await analyze(content);
|
|
8982
9621
|
if (result.isTemplate) {
|
|
8983
9622
|
return false;
|
|
@@ -9320,7 +9959,7 @@ __name(print, "print");
|
|
|
9320
9959
|
// src/core-server/utils/get-builders.ts
|
|
9321
9960
|
import { MissingBuilderError } from "storybook/internal/server-errors";
|
|
9322
9961
|
async function getManagerBuilder() {
|
|
9323
|
-
return await import("../_node-chunks/builder-manager-
|
|
9962
|
+
return await import("../_node-chunks/builder-manager-GBWCUYRR.js");
|
|
9324
9963
|
}
|
|
9325
9964
|
__name(getManagerBuilder, "getManagerBuilder");
|
|
9326
9965
|
async function getPreviewBuilder(resolvedPreviewBuilder) {
|
|
@@ -9559,7 +10198,7 @@ function watchStorySpecifiers(specifiers, options, onInvalidate) {
|
|
|
9559
10198
|
// because the directory could already be within the files part (e.g. './x/foo/bar')
|
|
9560
10199
|
basename2(specifier.files)
|
|
9561
10200
|
);
|
|
9562
|
-
const { globby } = await import("../_node-chunks/globby-
|
|
10201
|
+
const { globby } = await import("../_node-chunks/globby-CVPDLQ5Z.js");
|
|
9563
10202
|
const addedFiles = await globby(slash(dirGlob), commonGlobOptions2(dirGlob));
|
|
9564
10203
|
addedFiles.forEach((filePath) => {
|
|
9565
10204
|
const fileImportPath = toImportPath(filePath);
|
|
@@ -9881,6 +10520,10 @@ async function buildStaticStandalone(options) {
|
|
|
9881
10520
|
join(options.outputDir, "manifests", "components.json"),
|
|
9882
10521
|
JSON.stringify(manifests)
|
|
9883
10522
|
);
|
|
10523
|
+
await writeFile3(
|
|
10524
|
+
join(options.outputDir, "manifests", "components.html"),
|
|
10525
|
+
renderManifestComponentsPage(manifests)
|
|
10526
|
+
);
|
|
9884
10527
|
} catch (e) {
|
|
9885
10528
|
logger4.error("Failed to generate manifests/components.json");
|
|
9886
10529
|
logger4.error(e instanceof Error ? e : String(e));
|
|
@@ -11781,6 +12424,29 @@ async function storybookDevServer(options) {
|
|
|
11781
12424
|
return;
|
|
11782
12425
|
}
|
|
11783
12426
|
});
|
|
12427
|
+
app.get("/manifests/components.html", async (req, res) => {
|
|
12428
|
+
try {
|
|
12429
|
+
const componentManifestGenerator = await options.presets.apply(
|
|
12430
|
+
"experimental_componentManifestGenerator"
|
|
12431
|
+
);
|
|
12432
|
+
const indexGenerator = await initializedStoryIndexGenerator;
|
|
12433
|
+
if (!componentManifestGenerator || !indexGenerator) {
|
|
12434
|
+
res.statusCode = 400;
|
|
12435
|
+
res.setHeader("Content-Type", "text/html; charset=utf-8");
|
|
12436
|
+
res.end(`<pre>No component manifest generator configured.</pre>`);
|
|
12437
|
+
return;
|
|
12438
|
+
}
|
|
12439
|
+
const manifest = await componentManifestGenerator(
|
|
12440
|
+
indexGenerator
|
|
12441
|
+
);
|
|
12442
|
+
res.setHeader("Content-Type", "text/html; charset=utf-8");
|
|
12443
|
+
res.end(renderManifestComponentsPage(manifest));
|
|
12444
|
+
} catch (e) {
|
|
12445
|
+
res.statusCode = 500;
|
|
12446
|
+
res.setHeader("Content-Type", "text/html; charset=utf-8");
|
|
12447
|
+
res.end(`<pre>${e instanceof Error ? e.toString() : String(e)}</pre>`);
|
|
12448
|
+
}
|
|
12449
|
+
});
|
|
11784
12450
|
}
|
|
11785
12451
|
doTelemetry(app, core2, initializedStoryIndexGenerator, options);
|
|
11786
12452
|
async function cancelTelemetry() {
|