storybook 10.1.0-alpha.8 → 10.1.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_browser-chunks/Color-FTG7SQDA.js +1097 -0
- package/dist/_browser-chunks/WithTooltip-LMROHDUP.js +1651 -0
- package/dist/_browser-chunks/chunk-2FRVAXCZ.js +7 -0
- package/dist/_browser-chunks/{chunk-FDWKXLBI.js → chunk-2XZMBGTA.js} +44 -109
- package/dist/_browser-chunks/chunk-3IAH5M2U.js +171 -0
- package/dist/_browser-chunks/chunk-3OXGAGBE.js +779 -0
- package/dist/_browser-chunks/{chunk-TMDZCWME.js → chunk-3PJE6VLG.js} +1 -3
- package/dist/_browser-chunks/{chunk-VAMFPZY3.js → chunk-45UGUKRX.js} +2 -7
- package/dist/_browser-chunks/chunk-6XWLIJQL.js +11 -0
- package/dist/_browser-chunks/{chunk-MM7DTO55.js → chunk-A242L54C.js} +10 -16
- package/dist/_browser-chunks/chunk-AIOS4NGK.js +252 -0
- package/dist/_browser-chunks/chunk-AS2HQEYC.js +14 -0
- package/dist/_browser-chunks/chunk-AXG2BOBL.js +836 -0
- package/dist/_browser-chunks/{chunk-MH6AXFXB.js → chunk-CHUV5WSW.js} +0 -5
- package/dist/_browser-chunks/chunk-EUVGDK4H.js +93 -0
- package/dist/_browser-chunks/chunk-EZSQOHRI.js +18 -0
- package/dist/_browser-chunks/{chunk-CADGRH3P.js → chunk-FNXWN6IK.js} +3 -8
- package/dist/_browser-chunks/chunk-FQ7SLVLR.js +66 -0
- package/dist/_browser-chunks/chunk-GFLS4VP3.js +64 -0
- package/dist/_browser-chunks/chunk-GFY5R5EY.js +47 -0
- package/dist/_browser-chunks/{chunk-L2D73C6Z.js → chunk-H6XK3RSC.js} +13 -21
- package/dist/_browser-chunks/chunk-IPA5A322.js +71 -0
- package/dist/_browser-chunks/chunk-JP7NCOJX.js +37 -0
- package/dist/_browser-chunks/chunk-KJHJLCBK.js +11 -0
- package/dist/_browser-chunks/{chunk-OWPZQM2D.js → chunk-L4RMQ7D7.js} +60 -110
- package/dist/_browser-chunks/chunk-P4F4UVXX.js +951 -0
- package/dist/_browser-chunks/{chunk-AB7OOPUX.js → chunk-QKODTO7K.js} +0 -5
- package/dist/_browser-chunks/chunk-RP5RXKFU.js +2491 -0
- package/dist/_browser-chunks/chunk-SL75JR6Y.js +9 -0
- package/dist/_browser-chunks/chunk-SS2NHR7W.js +2969 -0
- package/dist/_browser-chunks/chunk-UD6FQLAF.js +1481 -0
- package/dist/_browser-chunks/chunk-VYJQ7RU5.js +2853 -0
- package/dist/_browser-chunks/chunk-WJYERY3R.js +136 -0
- package/dist/_browser-chunks/chunk-XJNX76GA.js +85 -0
- package/dist/_browser-chunks/{chunk-F4Q6SGTB.js → chunk-YKE5S47A.js} +177 -399
- package/dist/_browser-chunks/{chunk-SN4J4IQ3.js → chunk-ZUWEVLDX.js} +1 -7
- package/dist/_browser-chunks/{formatter-OMEEQ6HG.js → formatter-QJ4M4OGQ.js} +4 -9
- package/dist/_browser-chunks/{syntaxhighlighter-CAVLW7PM.js → syntaxhighlighter-IQDEPFLK.js} +704 -1848
- package/dist/_node-chunks/{builder-manager-57OYTFQ5.js → builder-manager-BDAQHXFI.js} +510 -1019
- package/dist/_node-chunks/camelcase-3C7DZZPX.js +37 -0
- package/dist/_node-chunks/chunk-2IIQTGNE.js +6024 -0
- package/dist/_node-chunks/chunk-56U5LEMP.js +3043 -0
- package/dist/_node-chunks/chunk-7LIRCAQE.js +20 -0
- package/dist/_node-chunks/chunk-7RN6TXKP.js +603 -0
- package/dist/_node-chunks/chunk-7SJ7PZNL.js +4523 -0
- package/dist/_node-chunks/{chunk-2GK7NW46.js → chunk-BG4RDXG7.js} +8 -10
- package/dist/_node-chunks/chunk-CBQKMXLQ.js +18 -0
- package/dist/_node-chunks/chunk-CN2IW2KQ.js +1564 -0
- package/dist/_node-chunks/chunk-CQMAU6UQ.js +943 -0
- package/dist/_node-chunks/{chunk-RG4Z25PY.js → chunk-D6ND3TVY.js} +116 -276
- package/dist/_node-chunks/chunk-DC355CYB.js +61 -0
- package/dist/_node-chunks/{chunk-EBYCXVVR.js → chunk-EVK2SBW5.js} +292 -688
- package/dist/_node-chunks/chunk-IXWEUXJ2.js +119 -0
- package/dist/_node-chunks/{chunk-6F6CCOXH.js → chunk-KVRF22SH.js} +469 -983
- package/dist/_node-chunks/chunk-LEDP4QQW.js +919 -0
- package/dist/_node-chunks/{chunk-C4KEDJ6O.js → chunk-MMVV6DGG.js} +8133 -8887
- package/dist/_node-chunks/chunk-O5CGEVRI.js +29 -0
- package/dist/_node-chunks/chunk-OZZO56XN.js +299 -0
- package/dist/_node-chunks/chunk-POT2EVGD.js +78 -0
- package/dist/_node-chunks/chunk-R5YGFSTV.js +3781 -0
- package/dist/_node-chunks/chunk-SQCTM2OS.js +23 -0
- package/dist/_node-chunks/chunk-UFOFO5H7.js +54 -0
- package/dist/_node-chunks/chunk-VBF7ALJF.js +72 -0
- package/dist/_node-chunks/chunk-W6MAMTUF.js +70 -0
- package/dist/_node-chunks/chunk-WURL4XOT.js +46662 -0
- package/dist/_node-chunks/chunk-XGK6MVKR.js +61 -0
- package/dist/_node-chunks/chunk-YV3GDSDT.js +765 -0
- package/dist/_node-chunks/{chunk-RSHLCHYY.js → chunk-YWV55YW3.js} +15 -24
- package/dist/_node-chunks/dist-KEP4IFRN.js +121 -0
- package/dist/_node-chunks/globby-4WUBTDCN.js +3452 -0
- package/dist/_node-chunks/lib-JVOEKTYM.js +366 -0
- package/dist/_node-chunks/mdx-N42X6CFJ-C5WFYYXR.js +14329 -0
- package/dist/_node-chunks/p-limit-LDY632RS.js +116 -0
- package/dist/actions/decorator.js +21 -42
- package/dist/actions/index.js +3 -3
- package/dist/babel/index.d.ts +671 -335
- package/dist/babel/index.js +10 -11
- package/dist/bin/core.js +601 -1548
- package/dist/bin/dispatcher.js +36 -36
- package/dist/bin/loader.js +24 -38
- package/dist/channels/index.js +98 -234
- package/dist/cli/index.d.ts +1479 -133
- package/dist/cli/index.js +30 -8540
- package/dist/client-logger/index.js +31 -61
- package/dist/common/index.d.ts +139 -62
- package/dist/common/index.js +66 -51
- package/dist/components/index.d.ts +575 -273
- package/dist/components/index.js +14863 -4313
- package/dist/core-events/index.js +2 -66
- package/dist/core-server/index.d.ts +3 -2
- package/dist/core-server/index.js +2910 -8519
- package/dist/core-server/presets/common-manager.css +2 -2
- package/dist/core-server/presets/common-manager.js +2521 -5233
- package/dist/core-server/presets/common-override-preset.js +31 -60
- package/dist/core-server/presets/common-preset.js +663 -962
- package/dist/csf/index.js +534 -1179
- package/dist/csf-tools/index.js +9 -9
- package/dist/docs-tools/index.js +6 -6
- package/dist/highlight/index.js +2 -2
- package/dist/instrumenter/index.js +199 -415
- package/dist/manager/globals-runtime.js +59044 -67141
- package/dist/manager/globals.js +2 -3
- package/dist/manager/manager-stores.d.ts +1 -0
- package/dist/manager/manager-stores.js +23 -0
- package/dist/manager/runtime.js +11511 -10953
- package/dist/manager-api/index.d.ts +1811 -2
- package/dist/manager-api/index.js +1348 -2401
- package/dist/manager-errors.d.ts +9 -0
- package/dist/manager-errors.js +3 -3
- package/dist/mocking-utils/index.d.ts +1126 -0
- package/dist/mocking-utils/index.js +1181 -0
- package/dist/node-logger/index.d.ts +192 -24
- package/dist/node-logger/index.js +23 -4471
- package/dist/preview/globals.js +2 -3
- package/dist/preview/runtime.js +10799 -22393
- package/dist/preview-api/index.d.ts +1 -1
- package/dist/preview-api/index.js +13 -13
- package/dist/preview-errors.d.ts +9 -0
- package/dist/preview-errors.js +4 -4
- package/dist/router/index.js +347 -899
- package/dist/server-errors.d.ts +34 -1
- package/dist/server-errors.js +17 -10
- package/dist/telemetry/index.d.ts +24 -3
- package/dist/telemetry/index.js +25 -24
- package/dist/test/index.js +6131 -11916
- package/dist/theming/create.d.ts +1 -0
- package/dist/theming/create.js +4 -4
- package/dist/theming/index.d.ts +3366 -2599
- package/dist/theming/index.js +501 -1091
- package/dist/types/index.d.ts +72 -8
- package/dist/types/index.js +27 -12
- package/dist/viewport/index.js +3 -3
- package/package.json +26 -17
- package/dist/_browser-chunks/Color-7ZNS6F6B.js +0 -1676
- package/dist/_browser-chunks/WithTooltip-SK46ZJ2J.js +0 -13
- package/dist/_browser-chunks/chunk-6A7OIVEL.js +0 -66
- package/dist/_browser-chunks/chunk-B4A3ADP3.js +0 -3816
- package/dist/_browser-chunks/chunk-BOOOPFZF.js +0 -2335
- package/dist/_browser-chunks/chunk-FSBVR7H5.js +0 -106
- package/dist/_browser-chunks/chunk-FUOHXXZT.js +0 -23
- package/dist/_browser-chunks/chunk-GTKOCWCT.js +0 -17
- package/dist/_browser-chunks/chunk-HHW4FUMO.js +0 -12
- package/dist/_browser-chunks/chunk-JVSKG4YS.js +0 -4052
- package/dist/_browser-chunks/chunk-LASUB7TL.js +0 -76
- package/dist/_browser-chunks/chunk-LYCSRYYR.js +0 -101
- package/dist/_browser-chunks/chunk-NVV6MIOE.js +0 -243
- package/dist/_browser-chunks/chunk-OBXWFEPB.js +0 -852
- package/dist/_browser-chunks/chunk-OPCDBBL3.js +0 -48
- package/dist/_browser-chunks/chunk-PB6FZ3WE.js +0 -130
- package/dist/_browser-chunks/chunk-RNE2IUTB.js +0 -1300
- package/dist/_browser-chunks/chunk-RW5PKMWM.js +0 -4182
- package/dist/_browser-chunks/chunk-SYS437NN.js +0 -122
- package/dist/_browser-chunks/chunk-U46RQHA4.js +0 -12
- package/dist/_browser-chunks/chunk-UTNZYD2N.js +0 -311
- package/dist/_browser-chunks/chunk-VUAFL5XK.js +0 -20
- package/dist/_browser-chunks/chunk-XDGMHOV7.js +0 -2197
- package/dist/_browser-chunks/chunk-XW6KSYKF.js +0 -16
- package/dist/_browser-chunks/chunk-Y3M7TW6K.js +0 -1041
- package/dist/_browser-chunks/chunk-ZNRFDIVA.js +0 -233
- package/dist/_node-chunks/camelcase-2KEDZHZ2.js +0 -18
- package/dist/_node-chunks/chunk-34NNXTBR.js +0 -28
- package/dist/_node-chunks/chunk-3N2A3KZX.js +0 -420
- package/dist/_node-chunks/chunk-5P7P5KDN.js +0 -90
- package/dist/_node-chunks/chunk-5WBRBDXI.js +0 -79
- package/dist/_node-chunks/chunk-7PWTU7T2.js +0 -697
- package/dist/_node-chunks/chunk-CHRHQ7AZ.js +0 -4272
- package/dist/_node-chunks/chunk-D4EGQLJI.js +0 -64656
- package/dist/_node-chunks/chunk-EKCURTKU.js +0 -1544
- package/dist/_node-chunks/chunk-GBVPPW4H.js +0 -1657
- package/dist/_node-chunks/chunk-J6VOKT2F.js +0 -220
- package/dist/_node-chunks/chunk-JLBYSGXS.js +0 -69
- package/dist/_node-chunks/chunk-LLCELSUL.js +0 -1198
- package/dist/_node-chunks/chunk-NS4OCQ4F.js +0 -61
- package/dist/_node-chunks/chunk-NXVLFYDR.js +0 -1518
- package/dist/_node-chunks/chunk-NZPWAJOZ.js +0 -304
- package/dist/_node-chunks/chunk-OYFSIV3I.js +0 -6712
- package/dist/_node-chunks/chunk-OZ43LMDF.js +0 -5029
- package/dist/_node-chunks/chunk-Q5HJHFF2.js +0 -61
- package/dist/_node-chunks/chunk-QHER4CEN.js +0 -34
- package/dist/_node-chunks/chunk-RF2PJM54.js +0 -1531
- package/dist/_node-chunks/chunk-S3OHGEE3.js +0 -101
- package/dist/_node-chunks/chunk-S5XOMVSV.js +0 -2256
- package/dist/_node-chunks/chunk-SGXQZ47H.js +0 -1586
- package/dist/_node-chunks/chunk-TDU6OVUH.js +0 -111
- package/dist/_node-chunks/chunk-TYQQFNQX.js +0 -1250
- package/dist/_node-chunks/chunk-WNGLARN2.js +0 -4741
- package/dist/_node-chunks/chunk-YUOVDCXL.js +0 -18
- package/dist/_node-chunks/dist-O5FB7YUW.js +0 -175
- package/dist/_node-chunks/globby-3NMV7WHX.js +0 -5222
- package/dist/_node-chunks/lib-VZD7BRSA.js +0 -518
- package/dist/_node-chunks/mdx-N42X6CFJ-3RP7RKKU.js +0 -22017
- package/dist/_node-chunks/p-limit-LIKBTXEJ.js +0 -168
- package/dist/_node-chunks/plugin-2NYZBK4A.js +0 -129
- package/dist/_node-chunks/plugin-6QGMO7J7.js +0 -159
- package/dist/_node-chunks/webpack-inject-mocker-runtime-plugin-Z2JI6J2H.js +0 -69102
- package/dist/_node-chunks/webpack-mock-plugin-D4BE2SSI.js +0 -124
- package/dist/core-server/presets/webpack/loaders/storybook-mock-transform-loader.js +0 -36
- package/dist/core-server/presets/webpack/loaders/webpack-automock-loader.js +0 -33
|
@@ -1,168 +0,0 @@
|
|
|
1
|
-
import CJS_COMPAT_NODE_URL_rqth4iav4b from 'node:url';
|
|
2
|
-
import CJS_COMPAT_NODE_PATH_rqth4iav4b from 'node:path';
|
|
3
|
-
import CJS_COMPAT_NODE_MODULE_rqth4iav4b from "node:module";
|
|
4
|
-
|
|
5
|
-
var __filename = CJS_COMPAT_NODE_URL_rqth4iav4b.fileURLToPath(import.meta.url);
|
|
6
|
-
var __dirname = CJS_COMPAT_NODE_PATH_rqth4iav4b.dirname(__filename);
|
|
7
|
-
var require = CJS_COMPAT_NODE_MODULE_rqth4iav4b.createRequire(import.meta.url);
|
|
8
|
-
|
|
9
|
-
// ------------------------------------------------------------
|
|
10
|
-
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
-
// ------------------------------------------------------------
|
|
12
|
-
import {
|
|
13
|
-
__name
|
|
14
|
-
} from "./chunk-Q5HJHFF2.js";
|
|
15
|
-
|
|
16
|
-
// ../node_modules/yocto-queue/index.js
|
|
17
|
-
var Node = class {
|
|
18
|
-
static {
|
|
19
|
-
__name(this, "Node");
|
|
20
|
-
}
|
|
21
|
-
value;
|
|
22
|
-
next;
|
|
23
|
-
constructor(value) {
|
|
24
|
-
this.value = value;
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
var Queue = class {
|
|
28
|
-
static {
|
|
29
|
-
__name(this, "Queue");
|
|
30
|
-
}
|
|
31
|
-
#head;
|
|
32
|
-
#tail;
|
|
33
|
-
#size;
|
|
34
|
-
constructor() {
|
|
35
|
-
this.clear();
|
|
36
|
-
}
|
|
37
|
-
enqueue(value) {
|
|
38
|
-
const node = new Node(value);
|
|
39
|
-
if (this.#head) {
|
|
40
|
-
this.#tail.next = node;
|
|
41
|
-
this.#tail = node;
|
|
42
|
-
} else {
|
|
43
|
-
this.#head = node;
|
|
44
|
-
this.#tail = node;
|
|
45
|
-
}
|
|
46
|
-
this.#size++;
|
|
47
|
-
}
|
|
48
|
-
dequeue() {
|
|
49
|
-
const current = this.#head;
|
|
50
|
-
if (!current) {
|
|
51
|
-
return;
|
|
52
|
-
}
|
|
53
|
-
this.#head = this.#head.next;
|
|
54
|
-
this.#size--;
|
|
55
|
-
return current.value;
|
|
56
|
-
}
|
|
57
|
-
peek() {
|
|
58
|
-
if (!this.#head) {
|
|
59
|
-
return;
|
|
60
|
-
}
|
|
61
|
-
return this.#head.value;
|
|
62
|
-
}
|
|
63
|
-
clear() {
|
|
64
|
-
this.#head = void 0;
|
|
65
|
-
this.#tail = void 0;
|
|
66
|
-
this.#size = 0;
|
|
67
|
-
}
|
|
68
|
-
get size() {
|
|
69
|
-
return this.#size;
|
|
70
|
-
}
|
|
71
|
-
*[Symbol.iterator]() {
|
|
72
|
-
let current = this.#head;
|
|
73
|
-
while (current) {
|
|
74
|
-
yield current.value;
|
|
75
|
-
current = current.next;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
*drain() {
|
|
79
|
-
while (this.#head) {
|
|
80
|
-
yield this.dequeue();
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
// ../node_modules/p-limit/index.js
|
|
86
|
-
function pLimit(concurrency) {
|
|
87
|
-
validateConcurrency(concurrency);
|
|
88
|
-
const queue = new Queue();
|
|
89
|
-
let activeCount = 0;
|
|
90
|
-
const resumeNext = /* @__PURE__ */ __name(() => {
|
|
91
|
-
if (activeCount < concurrency && queue.size > 0) {
|
|
92
|
-
queue.dequeue()();
|
|
93
|
-
activeCount++;
|
|
94
|
-
}
|
|
95
|
-
}, "resumeNext");
|
|
96
|
-
const next = /* @__PURE__ */ __name(() => {
|
|
97
|
-
activeCount--;
|
|
98
|
-
resumeNext();
|
|
99
|
-
}, "next");
|
|
100
|
-
const run = /* @__PURE__ */ __name(async (function_, resolve, arguments_) => {
|
|
101
|
-
const result = (async () => function_(...arguments_))();
|
|
102
|
-
resolve(result);
|
|
103
|
-
try {
|
|
104
|
-
await result;
|
|
105
|
-
} catch {
|
|
106
|
-
}
|
|
107
|
-
next();
|
|
108
|
-
}, "run");
|
|
109
|
-
const enqueue = /* @__PURE__ */ __name((function_, resolve, arguments_) => {
|
|
110
|
-
new Promise((internalResolve) => {
|
|
111
|
-
queue.enqueue(internalResolve);
|
|
112
|
-
}).then(
|
|
113
|
-
run.bind(void 0, function_, resolve, arguments_)
|
|
114
|
-
);
|
|
115
|
-
(async () => {
|
|
116
|
-
await Promise.resolve();
|
|
117
|
-
if (activeCount < concurrency) {
|
|
118
|
-
resumeNext();
|
|
119
|
-
}
|
|
120
|
-
})();
|
|
121
|
-
}, "enqueue");
|
|
122
|
-
const generator = /* @__PURE__ */ __name((function_, ...arguments_) => new Promise((resolve) => {
|
|
123
|
-
enqueue(function_, resolve, arguments_);
|
|
124
|
-
}), "generator");
|
|
125
|
-
Object.defineProperties(generator, {
|
|
126
|
-
activeCount: {
|
|
127
|
-
get: /* @__PURE__ */ __name(() => activeCount, "get")
|
|
128
|
-
},
|
|
129
|
-
pendingCount: {
|
|
130
|
-
get: /* @__PURE__ */ __name(() => queue.size, "get")
|
|
131
|
-
},
|
|
132
|
-
clearQueue: {
|
|
133
|
-
value() {
|
|
134
|
-
queue.clear();
|
|
135
|
-
}
|
|
136
|
-
},
|
|
137
|
-
concurrency: {
|
|
138
|
-
get: /* @__PURE__ */ __name(() => concurrency, "get"),
|
|
139
|
-
set(newConcurrency) {
|
|
140
|
-
validateConcurrency(newConcurrency);
|
|
141
|
-
concurrency = newConcurrency;
|
|
142
|
-
queueMicrotask(() => {
|
|
143
|
-
while (activeCount < concurrency && queue.size > 0) {
|
|
144
|
-
resumeNext();
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
});
|
|
150
|
-
return generator;
|
|
151
|
-
}
|
|
152
|
-
__name(pLimit, "pLimit");
|
|
153
|
-
function limitFunction(function_, option) {
|
|
154
|
-
const { concurrency } = option;
|
|
155
|
-
const limit = pLimit(concurrency);
|
|
156
|
-
return (...arguments_) => limit(() => function_(...arguments_));
|
|
157
|
-
}
|
|
158
|
-
__name(limitFunction, "limitFunction");
|
|
159
|
-
function validateConcurrency(concurrency) {
|
|
160
|
-
if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {
|
|
161
|
-
throw new TypeError("Expected `concurrency` to be a number from 1 and up");
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
__name(validateConcurrency, "validateConcurrency");
|
|
165
|
-
export {
|
|
166
|
-
pLimit as default,
|
|
167
|
-
limitFunction
|
|
168
|
-
};
|
|
@@ -1,129 +0,0 @@
|
|
|
1
|
-
import CJS_COMPAT_NODE_URL_rqth4iav4b from 'node:url';
|
|
2
|
-
import CJS_COMPAT_NODE_PATH_rqth4iav4b from 'node:path';
|
|
3
|
-
import CJS_COMPAT_NODE_MODULE_rqth4iav4b from "node:module";
|
|
4
|
-
|
|
5
|
-
var __filename = CJS_COMPAT_NODE_URL_rqth4iav4b.fileURLToPath(import.meta.url);
|
|
6
|
-
var __dirname = CJS_COMPAT_NODE_PATH_rqth4iav4b.dirname(__filename);
|
|
7
|
-
var require = CJS_COMPAT_NODE_MODULE_rqth4iav4b.createRequire(import.meta.url);
|
|
8
|
-
|
|
9
|
-
// ------------------------------------------------------------
|
|
10
|
-
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
-
// ------------------------------------------------------------
|
|
12
|
-
import {
|
|
13
|
-
resolvePackageDir
|
|
14
|
-
} from "./chunk-EKCURTKU.js";
|
|
15
|
-
import "./chunk-J6VOKT2F.js";
|
|
16
|
-
import {
|
|
17
|
-
require_dist
|
|
18
|
-
} from "./chunk-JLBYSGXS.js";
|
|
19
|
-
import {
|
|
20
|
-
__name,
|
|
21
|
-
__toESM
|
|
22
|
-
} from "./chunk-Q5HJHFF2.js";
|
|
23
|
-
|
|
24
|
-
// src/core-server/presets/vitePlugins/vite-inject-mocker/plugin.ts
|
|
25
|
-
import { readFileSync } from "node:fs";
|
|
26
|
-
import { join } from "node:path";
|
|
27
|
-
import { fileURLToPath } from "node:url";
|
|
28
|
-
|
|
29
|
-
// ../node_modules/@rolldown/pluginutils/dist/index.js
|
|
30
|
-
function exactRegex(str, flags) {
|
|
31
|
-
return new RegExp(`^${escapeRegex(str)}$`, flags);
|
|
32
|
-
}
|
|
33
|
-
__name(exactRegex, "exactRegex");
|
|
34
|
-
var escapeRegexRE = /[-/\\^$*+?.()|[\]{}]/g;
|
|
35
|
-
function escapeRegex(str) {
|
|
36
|
-
return str.replace(escapeRegexRE, "\\$&");
|
|
37
|
-
}
|
|
38
|
-
__name(escapeRegex, "escapeRegex");
|
|
39
|
-
|
|
40
|
-
// src/core-server/presets/vitePlugins/vite-inject-mocker/plugin.ts
|
|
41
|
-
var import_ts_dedent = __toESM(require_dist(), 1);
|
|
42
|
-
var entryPath = "/vite-inject-mocker-entry.js";
|
|
43
|
-
var entryCode = import_ts_dedent.dedent`
|
|
44
|
-
<script type="module" src=".${entryPath}"></script>
|
|
45
|
-
`;
|
|
46
|
-
var server;
|
|
47
|
-
var viteInjectMockerRuntime = /* @__PURE__ */ __name((options) => {
|
|
48
|
-
let viteConfig;
|
|
49
|
-
return {
|
|
50
|
-
name: "vite:storybook-inject-mocker-runtime",
|
|
51
|
-
buildStart() {
|
|
52
|
-
if (viteConfig.command === "build") {
|
|
53
|
-
this.emitFile({
|
|
54
|
-
type: "chunk",
|
|
55
|
-
id: join(
|
|
56
|
-
resolvePackageDir("storybook"),
|
|
57
|
-
"assets",
|
|
58
|
-
"server",
|
|
59
|
-
"mocker-runtime.template.js"
|
|
60
|
-
),
|
|
61
|
-
fileName: entryPath.slice(1)
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
config() {
|
|
66
|
-
return {
|
|
67
|
-
optimizeDeps: {
|
|
68
|
-
include: ["@vitest/mocker", "@vitest/mocker/browser"]
|
|
69
|
-
},
|
|
70
|
-
resolve: {
|
|
71
|
-
// Aliasing necessary for package managers like pnpm, since resolving modules from a virtual module
|
|
72
|
-
// leads to errors, if the imported module is not a dependency of the project.
|
|
73
|
-
// By resolving the module to the real path, we can avoid this issue.
|
|
74
|
-
alias: {
|
|
75
|
-
"@vitest/mocker/browser": fileURLToPath(import.meta.resolve("@vitest/mocker/browser")),
|
|
76
|
-
"@vitest/mocker": fileURLToPath(import.meta.resolve("@vitest/mocker"))
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
};
|
|
80
|
-
},
|
|
81
|
-
configResolved(config) {
|
|
82
|
-
viteConfig = config;
|
|
83
|
-
},
|
|
84
|
-
configureServer(server_) {
|
|
85
|
-
server = server_;
|
|
86
|
-
if (options.previewConfigPath) {
|
|
87
|
-
server.watcher.on("change", (file) => {
|
|
88
|
-
if (file === options.previewConfigPath) {
|
|
89
|
-
server.ws.send({
|
|
90
|
-
type: "custom",
|
|
91
|
-
event: "invalidate-mocker"
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
resolveId: {
|
|
98
|
-
filter: {
|
|
99
|
-
id: [exactRegex(entryPath)]
|
|
100
|
-
},
|
|
101
|
-
handler(id) {
|
|
102
|
-
if (exactRegex(id).test(entryPath)) {
|
|
103
|
-
return id;
|
|
104
|
-
}
|
|
105
|
-
return null;
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
async load(id) {
|
|
109
|
-
if (exactRegex(id).test(entryPath)) {
|
|
110
|
-
return readFileSync(
|
|
111
|
-
join(resolvePackageDir("storybook"), "assets", "server", "mocker-runtime.template.js"),
|
|
112
|
-
"utf-8"
|
|
113
|
-
);
|
|
114
|
-
}
|
|
115
|
-
return null;
|
|
116
|
-
},
|
|
117
|
-
transformIndexHtml(html) {
|
|
118
|
-
const headTag = html.match(/<head[^>]*>/);
|
|
119
|
-
if (headTag) {
|
|
120
|
-
const headTagIndex = html.indexOf(headTag[0]);
|
|
121
|
-
const newHtml = html.slice(0, headTagIndex + headTag[0].length) + entryCode + html.slice(headTagIndex + headTag[0].length);
|
|
122
|
-
return newHtml;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
};
|
|
126
|
-
}, "viteInjectMockerRuntime");
|
|
127
|
-
export {
|
|
128
|
-
viteInjectMockerRuntime
|
|
129
|
-
};
|
|
@@ -1,159 +0,0 @@
|
|
|
1
|
-
import CJS_COMPAT_NODE_URL_rqth4iav4b from 'node:url';
|
|
2
|
-
import CJS_COMPAT_NODE_PATH_rqth4iav4b from 'node:path';
|
|
3
|
-
import CJS_COMPAT_NODE_MODULE_rqth4iav4b from "node:module";
|
|
4
|
-
|
|
5
|
-
var __filename = CJS_COMPAT_NODE_URL_rqth4iav4b.fileURLToPath(import.meta.url);
|
|
6
|
-
var __dirname = CJS_COMPAT_NODE_PATH_rqth4iav4b.dirname(__filename);
|
|
7
|
-
var require = CJS_COMPAT_NODE_MODULE_rqth4iav4b.createRequire(import.meta.url);
|
|
8
|
-
|
|
9
|
-
// ------------------------------------------------------------
|
|
10
|
-
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
|
-
// ------------------------------------------------------------
|
|
12
|
-
import {
|
|
13
|
-
getAutomockCode
|
|
14
|
-
} from "./chunk-TYQQFNQX.js";
|
|
15
|
-
import {
|
|
16
|
-
babelParser,
|
|
17
|
-
extractMockCalls,
|
|
18
|
-
getRealPath,
|
|
19
|
-
rewriteSbMockImportCalls
|
|
20
|
-
} from "./chunk-3N2A3KZX.js";
|
|
21
|
-
import {
|
|
22
|
-
normalize
|
|
23
|
-
} from "./chunk-J6VOKT2F.js";
|
|
24
|
-
import {
|
|
25
|
-
__name
|
|
26
|
-
} from "./chunk-Q5HJHFF2.js";
|
|
27
|
-
|
|
28
|
-
// src/core-server/presets/vitePlugins/vite-mock/plugin.ts
|
|
29
|
-
import { readFileSync } from "node:fs";
|
|
30
|
-
import { logger } from "storybook/internal/node-logger";
|
|
31
|
-
|
|
32
|
-
// src/core-server/presets/vitePlugins/vite-mock/utils.ts
|
|
33
|
-
function getCleanId(id) {
|
|
34
|
-
return id.replace(/^.*\/deps\//, "").replace(/\.js.*$/, "").replace(/_/g, "/");
|
|
35
|
-
}
|
|
36
|
-
__name(getCleanId, "getCleanId");
|
|
37
|
-
function invalidateAllRelatedModules(server, absPath, pkgName) {
|
|
38
|
-
for (const mod of server.moduleGraph.idToModuleMap.values()) {
|
|
39
|
-
if (mod.id === absPath || mod.id && getCleanId(mod.id) === pkgName) {
|
|
40
|
-
server.moduleGraph.invalidateModule(mod);
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
__name(invalidateAllRelatedModules, "invalidateAllRelatedModules");
|
|
45
|
-
|
|
46
|
-
// src/core-server/presets/vitePlugins/vite-mock/plugin.ts
|
|
47
|
-
function viteMockPlugin(options) {
|
|
48
|
-
let viteConfig;
|
|
49
|
-
let mockCalls = [];
|
|
50
|
-
const normalizedPreviewConfigPath = normalize(options.previewConfigPath);
|
|
51
|
-
return [
|
|
52
|
-
{
|
|
53
|
-
name: "storybook:mock-loader",
|
|
54
|
-
configResolved(config) {
|
|
55
|
-
viteConfig = config;
|
|
56
|
-
},
|
|
57
|
-
buildStart() {
|
|
58
|
-
mockCalls = extractMockCalls(options, babelParser, viteConfig.root);
|
|
59
|
-
},
|
|
60
|
-
configureServer(server) {
|
|
61
|
-
async function invalidateAffectedFiles(file) {
|
|
62
|
-
if (file === options.previewConfigPath || file.includes("__mocks__")) {
|
|
63
|
-
const oldMockCalls = mockCalls;
|
|
64
|
-
mockCalls = extractMockCalls(options, babelParser, viteConfig.root);
|
|
65
|
-
const previewMod = server.moduleGraph.getModuleById(options.previewConfigPath);
|
|
66
|
-
if (previewMod) {
|
|
67
|
-
server.moduleGraph.invalidateModule(previewMod);
|
|
68
|
-
}
|
|
69
|
-
for (const call of mockCalls) {
|
|
70
|
-
invalidateAllRelatedModules(server, call.absolutePath, call.path);
|
|
71
|
-
}
|
|
72
|
-
const newAbsPaths = new Set(mockCalls.map((c) => c.absolutePath));
|
|
73
|
-
for (const oldCall of oldMockCalls) {
|
|
74
|
-
if (!newAbsPaths.has(oldCall.absolutePath)) {
|
|
75
|
-
invalidateAllRelatedModules(server, oldCall.absolutePath, oldCall.path);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
server.ws.send({ type: "full-reload" });
|
|
79
|
-
return [];
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
__name(invalidateAffectedFiles, "invalidateAffectedFiles");
|
|
83
|
-
server.watcher.on("change", invalidateAffectedFiles);
|
|
84
|
-
server.watcher.on("add", invalidateAffectedFiles);
|
|
85
|
-
server.watcher.on("unlink", invalidateAffectedFiles);
|
|
86
|
-
},
|
|
87
|
-
load: {
|
|
88
|
-
order: "pre",
|
|
89
|
-
handler(id) {
|
|
90
|
-
const preserveSymlinks = viteConfig.resolve.preserveSymlinks;
|
|
91
|
-
const idNorm = getRealPath(id, preserveSymlinks);
|
|
92
|
-
const cleanId = getCleanId(idNorm);
|
|
93
|
-
for (const call of mockCalls) {
|
|
94
|
-
const callNorm = getRealPath(call.absolutePath, preserveSymlinks);
|
|
95
|
-
if (callNorm !== idNorm && call.path !== cleanId) {
|
|
96
|
-
continue;
|
|
97
|
-
}
|
|
98
|
-
if (call.redirectPath) {
|
|
99
|
-
this.addWatchFile(call.redirectPath);
|
|
100
|
-
return readFileSync(call.redirectPath, "utf-8");
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
return null;
|
|
104
|
-
}
|
|
105
|
-
},
|
|
106
|
-
transform: {
|
|
107
|
-
order: "pre",
|
|
108
|
-
handler(code, id) {
|
|
109
|
-
for (const call of mockCalls) {
|
|
110
|
-
const preserveSymlinks = viteConfig.resolve.preserveSymlinks;
|
|
111
|
-
const idNorm = getRealPath(id, preserveSymlinks);
|
|
112
|
-
const callNorm = getRealPath(call.absolutePath, preserveSymlinks);
|
|
113
|
-
if (viteConfig.command !== "serve") {
|
|
114
|
-
if (callNorm !== idNorm) {
|
|
115
|
-
continue;
|
|
116
|
-
}
|
|
117
|
-
} else {
|
|
118
|
-
const cleanId = getCleanId(idNorm);
|
|
119
|
-
if (call.path !== cleanId && callNorm !== idNorm) {
|
|
120
|
-
continue;
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
try {
|
|
124
|
-
if (!call.redirectPath) {
|
|
125
|
-
const automockedCode = getAutomockCode(code, call.spy, babelParser);
|
|
126
|
-
return {
|
|
127
|
-
code: automockedCode.toString(),
|
|
128
|
-
map: automockedCode.generateMap()
|
|
129
|
-
};
|
|
130
|
-
}
|
|
131
|
-
} catch (e) {
|
|
132
|
-
logger.error(`Error automocking ${id}: ${e}`);
|
|
133
|
-
return null;
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
return null;
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
name: "storybook:mock-loader-preview",
|
|
142
|
-
transform(code, id) {
|
|
143
|
-
if (id === normalizedPreviewConfigPath) {
|
|
144
|
-
try {
|
|
145
|
-
return rewriteSbMockImportCalls(code);
|
|
146
|
-
} catch (e) {
|
|
147
|
-
logger.debug(`Could not transform sb.mock(import(...)) calls in ${id}: ${e}`);
|
|
148
|
-
return null;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
return null;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
];
|
|
155
|
-
}
|
|
156
|
-
__name(viteMockPlugin, "viteMockPlugin");
|
|
157
|
-
export {
|
|
158
|
-
viteMockPlugin
|
|
159
|
-
};
|