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,233 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
noop
|
|
3
|
-
} from "./chunk-AB7OOPUX.js";
|
|
4
|
-
import {
|
|
5
|
-
argumentsTag,
|
|
6
|
-
arrayBufferTag,
|
|
7
|
-
arrayTag,
|
|
8
|
-
bigInt64ArrayTag,
|
|
9
|
-
bigUint64ArrayTag,
|
|
10
|
-
booleanTag,
|
|
11
|
-
dataViewTag,
|
|
12
|
-
dateTag,
|
|
13
|
-
errorTag,
|
|
14
|
-
float32ArrayTag,
|
|
15
|
-
float64ArrayTag,
|
|
16
|
-
functionTag,
|
|
17
|
-
getSymbols,
|
|
18
|
-
getTag,
|
|
19
|
-
int16ArrayTag,
|
|
20
|
-
int32ArrayTag,
|
|
21
|
-
int8ArrayTag,
|
|
22
|
-
isPlainObject,
|
|
23
|
-
mapTag,
|
|
24
|
-
numberTag,
|
|
25
|
-
objectTag,
|
|
26
|
-
regexpTag,
|
|
27
|
-
setTag,
|
|
28
|
-
stringTag,
|
|
29
|
-
symbolTag,
|
|
30
|
-
uint16ArrayTag,
|
|
31
|
-
uint32ArrayTag,
|
|
32
|
-
uint8ArrayTag,
|
|
33
|
-
uint8ClampedArrayTag
|
|
34
|
-
} from "./chunk-FSBVR7H5.js";
|
|
35
|
-
import {
|
|
36
|
-
__name
|
|
37
|
-
} from "./chunk-MM7DTO55.js";
|
|
38
|
-
|
|
39
|
-
// ../node_modules/es-toolkit/dist/compat/util/eq.mjs
|
|
40
|
-
function eq(value, other) {
|
|
41
|
-
return value === other || Number.isNaN(value) && Number.isNaN(other);
|
|
42
|
-
}
|
|
43
|
-
__name(eq, "eq");
|
|
44
|
-
|
|
45
|
-
// ../node_modules/es-toolkit/dist/predicate/isEqualWith.mjs
|
|
46
|
-
function isEqualWith(a, b, areValuesEqual) {
|
|
47
|
-
return isEqualWithImpl(a, b, void 0, void 0, void 0, void 0, areValuesEqual);
|
|
48
|
-
}
|
|
49
|
-
__name(isEqualWith, "isEqualWith");
|
|
50
|
-
function isEqualWithImpl(a, b, property, aParent, bParent, stack, areValuesEqual) {
|
|
51
|
-
const result = areValuesEqual(a, b, property, aParent, bParent, stack);
|
|
52
|
-
if (result !== void 0) {
|
|
53
|
-
return result;
|
|
54
|
-
}
|
|
55
|
-
if (typeof a === typeof b) {
|
|
56
|
-
switch (typeof a) {
|
|
57
|
-
case "bigint":
|
|
58
|
-
case "string":
|
|
59
|
-
case "boolean":
|
|
60
|
-
case "symbol":
|
|
61
|
-
case "undefined": {
|
|
62
|
-
return a === b;
|
|
63
|
-
}
|
|
64
|
-
case "number": {
|
|
65
|
-
return a === b || Object.is(a, b);
|
|
66
|
-
}
|
|
67
|
-
case "function": {
|
|
68
|
-
return a === b;
|
|
69
|
-
}
|
|
70
|
-
case "object": {
|
|
71
|
-
return areObjectsEqual(a, b, stack, areValuesEqual);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
return areObjectsEqual(a, b, stack, areValuesEqual);
|
|
76
|
-
}
|
|
77
|
-
__name(isEqualWithImpl, "isEqualWithImpl");
|
|
78
|
-
function areObjectsEqual(a, b, stack, areValuesEqual) {
|
|
79
|
-
if (Object.is(a, b)) {
|
|
80
|
-
return true;
|
|
81
|
-
}
|
|
82
|
-
let aTag = getTag(a);
|
|
83
|
-
let bTag = getTag(b);
|
|
84
|
-
if (aTag === argumentsTag) {
|
|
85
|
-
aTag = objectTag;
|
|
86
|
-
}
|
|
87
|
-
if (bTag === argumentsTag) {
|
|
88
|
-
bTag = objectTag;
|
|
89
|
-
}
|
|
90
|
-
if (aTag !== bTag) {
|
|
91
|
-
return false;
|
|
92
|
-
}
|
|
93
|
-
switch (aTag) {
|
|
94
|
-
case stringTag:
|
|
95
|
-
return a.toString() === b.toString();
|
|
96
|
-
case numberTag: {
|
|
97
|
-
const x = a.valueOf();
|
|
98
|
-
const y = b.valueOf();
|
|
99
|
-
return eq(x, y);
|
|
100
|
-
}
|
|
101
|
-
case booleanTag:
|
|
102
|
-
case dateTag:
|
|
103
|
-
case symbolTag:
|
|
104
|
-
return Object.is(a.valueOf(), b.valueOf());
|
|
105
|
-
case regexpTag: {
|
|
106
|
-
return a.source === b.source && a.flags === b.flags;
|
|
107
|
-
}
|
|
108
|
-
case functionTag: {
|
|
109
|
-
return a === b;
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
stack = stack ?? /* @__PURE__ */ new Map();
|
|
113
|
-
const aStack = stack.get(a);
|
|
114
|
-
const bStack = stack.get(b);
|
|
115
|
-
if (aStack != null && bStack != null) {
|
|
116
|
-
return aStack === b;
|
|
117
|
-
}
|
|
118
|
-
stack.set(a, b);
|
|
119
|
-
stack.set(b, a);
|
|
120
|
-
try {
|
|
121
|
-
switch (aTag) {
|
|
122
|
-
case mapTag: {
|
|
123
|
-
if (a.size !== b.size) {
|
|
124
|
-
return false;
|
|
125
|
-
}
|
|
126
|
-
for (const [key, value] of a.entries()) {
|
|
127
|
-
if (!b.has(key) || !isEqualWithImpl(value, b.get(key), key, a, b, stack, areValuesEqual)) {
|
|
128
|
-
return false;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
return true;
|
|
132
|
-
}
|
|
133
|
-
case setTag: {
|
|
134
|
-
if (a.size !== b.size) {
|
|
135
|
-
return false;
|
|
136
|
-
}
|
|
137
|
-
const aValues = Array.from(a.values());
|
|
138
|
-
const bValues = Array.from(b.values());
|
|
139
|
-
for (let i = 0; i < aValues.length; i++) {
|
|
140
|
-
const aValue = aValues[i];
|
|
141
|
-
const index = bValues.findIndex((bValue) => {
|
|
142
|
-
return isEqualWithImpl(aValue, bValue, void 0, a, b, stack, areValuesEqual);
|
|
143
|
-
});
|
|
144
|
-
if (index === -1) {
|
|
145
|
-
return false;
|
|
146
|
-
}
|
|
147
|
-
bValues.splice(index, 1);
|
|
148
|
-
}
|
|
149
|
-
return true;
|
|
150
|
-
}
|
|
151
|
-
case arrayTag:
|
|
152
|
-
case uint8ArrayTag:
|
|
153
|
-
case uint8ClampedArrayTag:
|
|
154
|
-
case uint16ArrayTag:
|
|
155
|
-
case uint32ArrayTag:
|
|
156
|
-
case bigUint64ArrayTag:
|
|
157
|
-
case int8ArrayTag:
|
|
158
|
-
case int16ArrayTag:
|
|
159
|
-
case int32ArrayTag:
|
|
160
|
-
case bigInt64ArrayTag:
|
|
161
|
-
case float32ArrayTag:
|
|
162
|
-
case float64ArrayTag: {
|
|
163
|
-
if (typeof Buffer !== "undefined" && Buffer.isBuffer(a) !== Buffer.isBuffer(b)) {
|
|
164
|
-
return false;
|
|
165
|
-
}
|
|
166
|
-
if (a.length !== b.length) {
|
|
167
|
-
return false;
|
|
168
|
-
}
|
|
169
|
-
for (let i = 0; i < a.length; i++) {
|
|
170
|
-
if (!isEqualWithImpl(a[i], b[i], i, a, b, stack, areValuesEqual)) {
|
|
171
|
-
return false;
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
return true;
|
|
175
|
-
}
|
|
176
|
-
case arrayBufferTag: {
|
|
177
|
-
if (a.byteLength !== b.byteLength) {
|
|
178
|
-
return false;
|
|
179
|
-
}
|
|
180
|
-
return areObjectsEqual(new Uint8Array(a), new Uint8Array(b), stack, areValuesEqual);
|
|
181
|
-
}
|
|
182
|
-
case dataViewTag: {
|
|
183
|
-
if (a.byteLength !== b.byteLength || a.byteOffset !== b.byteOffset) {
|
|
184
|
-
return false;
|
|
185
|
-
}
|
|
186
|
-
return areObjectsEqual(new Uint8Array(a), new Uint8Array(b), stack, areValuesEqual);
|
|
187
|
-
}
|
|
188
|
-
case errorTag: {
|
|
189
|
-
return a.name === b.name && a.message === b.message;
|
|
190
|
-
}
|
|
191
|
-
case objectTag: {
|
|
192
|
-
const areEqualInstances = areObjectsEqual(a.constructor, b.constructor, stack, areValuesEqual) || isPlainObject(a) && isPlainObject(b);
|
|
193
|
-
if (!areEqualInstances) {
|
|
194
|
-
return false;
|
|
195
|
-
}
|
|
196
|
-
const aKeys = [...Object.keys(a), ...getSymbols(a)];
|
|
197
|
-
const bKeys = [...Object.keys(b), ...getSymbols(b)];
|
|
198
|
-
if (aKeys.length !== bKeys.length) {
|
|
199
|
-
return false;
|
|
200
|
-
}
|
|
201
|
-
for (let i = 0; i < aKeys.length; i++) {
|
|
202
|
-
const propKey = aKeys[i];
|
|
203
|
-
const aProp = a[propKey];
|
|
204
|
-
if (!Object.hasOwn(b, propKey)) {
|
|
205
|
-
return false;
|
|
206
|
-
}
|
|
207
|
-
const bProp = b[propKey];
|
|
208
|
-
if (!isEqualWithImpl(aProp, bProp, propKey, a, b, stack, areValuesEqual)) {
|
|
209
|
-
return false;
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
return true;
|
|
213
|
-
}
|
|
214
|
-
default: {
|
|
215
|
-
return false;
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
} finally {
|
|
219
|
-
stack.delete(a);
|
|
220
|
-
stack.delete(b);
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
__name(areObjectsEqual, "areObjectsEqual");
|
|
224
|
-
|
|
225
|
-
// ../node_modules/es-toolkit/dist/predicate/isEqual.mjs
|
|
226
|
-
function isEqual(a, b) {
|
|
227
|
-
return isEqualWith(a, b, noop);
|
|
228
|
-
}
|
|
229
|
-
__name(isEqual, "isEqual");
|
|
230
|
-
|
|
231
|
-
export {
|
|
232
|
-
isEqual
|
|
233
|
-
};
|
|
@@ -1,18 +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
|
-
camelCase
|
|
14
|
-
} from "./chunk-S3OHGEE3.js";
|
|
15
|
-
import "./chunk-Q5HJHFF2.js";
|
|
16
|
-
export {
|
|
17
|
-
camelCase as default
|
|
18
|
-
};
|
|
@@ -1,28 +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/slash/index.js
|
|
17
|
-
function slash(path) {
|
|
18
|
-
const isExtendedLengthPath = path.startsWith("\\\\?\\");
|
|
19
|
-
if (isExtendedLengthPath) {
|
|
20
|
-
return path;
|
|
21
|
-
}
|
|
22
|
-
return path.replace(/\\/g, "/");
|
|
23
|
-
}
|
|
24
|
-
__name(slash, "slash");
|
|
25
|
-
|
|
26
|
-
export {
|
|
27
|
-
slash
|
|
28
|
-
};
|
|
@@ -1,420 +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
|
-
basename,
|
|
14
|
-
dirname,
|
|
15
|
-
isAbsolute,
|
|
16
|
-
join,
|
|
17
|
-
normalize,
|
|
18
|
-
resolve
|
|
19
|
-
} from "./chunk-J6VOKT2F.js";
|
|
20
|
-
import {
|
|
21
|
-
__name
|
|
22
|
-
} from "./chunk-Q5HJHFF2.js";
|
|
23
|
-
|
|
24
|
-
// src/core-server/mocking-utils/resolve.ts
|
|
25
|
-
import { readFileSync as readFileSync2, realpathSync } from "node:fs";
|
|
26
|
-
import { createRequire } from "node:module";
|
|
27
|
-
import { findMockRedirect } from "@vitest/mocker/redirect";
|
|
28
|
-
|
|
29
|
-
// ../node_modules/resolve.exports/dist/index.mjs
|
|
30
|
-
function e(e2, n2, r2) {
|
|
31
|
-
throw new Error(r2 ? `No known conditions for "${n2}" specifier in "${e2}" package` : `Missing "${n2}" specifier in "${e2}" package`);
|
|
32
|
-
}
|
|
33
|
-
__name(e, "e");
|
|
34
|
-
function n(n2, i, o2, f) {
|
|
35
|
-
let s, u, l = r(n2, o2), c = function(e2) {
|
|
36
|
-
let n3 = /* @__PURE__ */ new Set(["default", ...e2.conditions || []]);
|
|
37
|
-
return e2.unsafe || n3.add(e2.require ? "require" : "import"), e2.unsafe || n3.add(e2.browser ? "browser" : "node"), n3;
|
|
38
|
-
}(f || {}), a = i[l];
|
|
39
|
-
if (void 0 === a) {
|
|
40
|
-
let e2, n3, r2, t3;
|
|
41
|
-
for (t3 in i) n3 && t3.length < n3.length || ("/" === t3[t3.length - 1] && l.startsWith(t3) ? (u = l.substring(t3.length), n3 = t3) : t3.length > 1 && (r2 = t3.indexOf("*", 1), ~r2 && (e2 = RegExp("^" + t3.substring(0, r2) + "(.*)" + t3.substring(1 + r2) + "$").exec(l), e2 && e2[1] && (u = e2[1], n3 = t3))));
|
|
42
|
-
a = i[n3];
|
|
43
|
-
}
|
|
44
|
-
return a || e(n2, l), s = t(a, c), s || e(n2, l, 1), u && function(e2, n3) {
|
|
45
|
-
let r2, t3 = 0, i2 = e2.length, o3 = /[*]/g, f2 = /[/]$/;
|
|
46
|
-
for (; t3 < i2; t3++) e2[t3] = o3.test(r2 = e2[t3]) ? r2.replace(o3, n3) : f2.test(r2) ? r2 + n3 : r2;
|
|
47
|
-
}(s, u), s;
|
|
48
|
-
}
|
|
49
|
-
__name(n, "n");
|
|
50
|
-
function r(e2, n2, r2) {
|
|
51
|
-
if (e2 === n2 || "." === n2) return ".";
|
|
52
|
-
let t3 = e2 + "/", i = t3.length, o2 = n2.slice(0, i) === t3, f = o2 ? n2.slice(i) : n2;
|
|
53
|
-
return "#" === f[0] ? f : o2 || !r2 ? "./" === f.slice(0, 2) ? f : "./" + f : f;
|
|
54
|
-
}
|
|
55
|
-
__name(r, "r");
|
|
56
|
-
function t(e2, n2, r2) {
|
|
57
|
-
if (e2) {
|
|
58
|
-
if ("string" == typeof e2) return r2 && r2.add(e2), [e2];
|
|
59
|
-
let i, o2;
|
|
60
|
-
if (Array.isArray(e2)) {
|
|
61
|
-
for (o2 = r2 || /* @__PURE__ */ new Set(), i = 0; i < e2.length; i++) t(e2[i], n2, o2);
|
|
62
|
-
if (!r2 && o2.size) return [...o2];
|
|
63
|
-
} else for (i in e2) if (n2.has(i)) return t(e2[i], n2, r2);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
__name(t, "t");
|
|
67
|
-
function o(e2, r2, t3) {
|
|
68
|
-
let i, o2 = e2.exports;
|
|
69
|
-
if (o2) {
|
|
70
|
-
if ("string" == typeof o2) o2 = { ".": o2 };
|
|
71
|
-
else for (i in o2) {
|
|
72
|
-
"." !== i[0] && (o2 = { ".": o2 });
|
|
73
|
-
break;
|
|
74
|
-
}
|
|
75
|
-
return n(e2.name, o2, r2 || ".", t3);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
__name(o, "o");
|
|
79
|
-
|
|
80
|
-
// src/core-server/mocking-utils/extract.ts
|
|
81
|
-
import { readFileSync } from "node:fs";
|
|
82
|
-
import { generate, parser, types as t2 } from "storybook/internal/babel";
|
|
83
|
-
import { logger } from "storybook/internal/node-logger";
|
|
84
|
-
import { telemetry } from "storybook/internal/telemetry";
|
|
85
|
-
import { transformSync } from "esbuild";
|
|
86
|
-
|
|
87
|
-
// ../node_modules/estree-walker/src/walker.js
|
|
88
|
-
var WalkerBase = class {
|
|
89
|
-
static {
|
|
90
|
-
__name(this, "WalkerBase");
|
|
91
|
-
}
|
|
92
|
-
constructor() {
|
|
93
|
-
this.should_skip = false;
|
|
94
|
-
this.should_remove = false;
|
|
95
|
-
this.replacement = null;
|
|
96
|
-
this.context = {
|
|
97
|
-
skip: /* @__PURE__ */ __name(() => this.should_skip = true, "skip"),
|
|
98
|
-
remove: /* @__PURE__ */ __name(() => this.should_remove = true, "remove"),
|
|
99
|
-
replace: /* @__PURE__ */ __name((node) => this.replacement = node, "replace")
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* @template {Node} Parent
|
|
104
|
-
* @param {Parent | null | undefined} parent
|
|
105
|
-
* @param {keyof Parent | null | undefined} prop
|
|
106
|
-
* @param {number | null | undefined} index
|
|
107
|
-
* @param {Node} node
|
|
108
|
-
*/
|
|
109
|
-
replace(parent, prop, index, node) {
|
|
110
|
-
if (parent && prop) {
|
|
111
|
-
if (index != null) {
|
|
112
|
-
parent[prop][index] = node;
|
|
113
|
-
} else {
|
|
114
|
-
parent[prop] = node;
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* @template {Node} Parent
|
|
120
|
-
* @param {Parent | null | undefined} parent
|
|
121
|
-
* @param {keyof Parent | null | undefined} prop
|
|
122
|
-
* @param {number | null | undefined} index
|
|
123
|
-
*/
|
|
124
|
-
remove(parent, prop, index) {
|
|
125
|
-
if (parent && prop) {
|
|
126
|
-
if (index !== null && index !== void 0) {
|
|
127
|
-
parent[prop].splice(index, 1);
|
|
128
|
-
} else {
|
|
129
|
-
delete parent[prop];
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
};
|
|
134
|
-
|
|
135
|
-
// ../node_modules/estree-walker/src/sync.js
|
|
136
|
-
var SyncWalker = class extends WalkerBase {
|
|
137
|
-
static {
|
|
138
|
-
__name(this, "SyncWalker");
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
*
|
|
142
|
-
* @param {SyncHandler} [enter]
|
|
143
|
-
* @param {SyncHandler} [leave]
|
|
144
|
-
*/
|
|
145
|
-
constructor(enter, leave) {
|
|
146
|
-
super();
|
|
147
|
-
this.should_skip = false;
|
|
148
|
-
this.should_remove = false;
|
|
149
|
-
this.replacement = null;
|
|
150
|
-
this.context = {
|
|
151
|
-
skip: /* @__PURE__ */ __name(() => this.should_skip = true, "skip"),
|
|
152
|
-
remove: /* @__PURE__ */ __name(() => this.should_remove = true, "remove"),
|
|
153
|
-
replace: /* @__PURE__ */ __name((node) => this.replacement = node, "replace")
|
|
154
|
-
};
|
|
155
|
-
this.enter = enter;
|
|
156
|
-
this.leave = leave;
|
|
157
|
-
}
|
|
158
|
-
/**
|
|
159
|
-
* @template {Node} Parent
|
|
160
|
-
* @param {Node} node
|
|
161
|
-
* @param {Parent | null} parent
|
|
162
|
-
* @param {keyof Parent} [prop]
|
|
163
|
-
* @param {number | null} [index]
|
|
164
|
-
* @returns {Node | null}
|
|
165
|
-
*/
|
|
166
|
-
visit(node, parent, prop, index) {
|
|
167
|
-
if (node) {
|
|
168
|
-
if (this.enter) {
|
|
169
|
-
const _should_skip = this.should_skip;
|
|
170
|
-
const _should_remove = this.should_remove;
|
|
171
|
-
const _replacement = this.replacement;
|
|
172
|
-
this.should_skip = false;
|
|
173
|
-
this.should_remove = false;
|
|
174
|
-
this.replacement = null;
|
|
175
|
-
this.enter.call(this.context, node, parent, prop, index);
|
|
176
|
-
if (this.replacement) {
|
|
177
|
-
node = this.replacement;
|
|
178
|
-
this.replace(parent, prop, index, node);
|
|
179
|
-
}
|
|
180
|
-
if (this.should_remove) {
|
|
181
|
-
this.remove(parent, prop, index);
|
|
182
|
-
}
|
|
183
|
-
const skipped = this.should_skip;
|
|
184
|
-
const removed = this.should_remove;
|
|
185
|
-
this.should_skip = _should_skip;
|
|
186
|
-
this.should_remove = _should_remove;
|
|
187
|
-
this.replacement = _replacement;
|
|
188
|
-
if (skipped) return node;
|
|
189
|
-
if (removed) return null;
|
|
190
|
-
}
|
|
191
|
-
let key;
|
|
192
|
-
for (key in node) {
|
|
193
|
-
const value = node[key];
|
|
194
|
-
if (value && typeof value === "object") {
|
|
195
|
-
if (Array.isArray(value)) {
|
|
196
|
-
const nodes = (
|
|
197
|
-
/** @type {Array<unknown>} */
|
|
198
|
-
value
|
|
199
|
-
);
|
|
200
|
-
for (let i = 0; i < nodes.length; i += 1) {
|
|
201
|
-
const item = nodes[i];
|
|
202
|
-
if (isNode(item)) {
|
|
203
|
-
if (!this.visit(item, node, key, i)) {
|
|
204
|
-
i--;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
} else if (isNode(value)) {
|
|
209
|
-
this.visit(value, node, key, null);
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
if (this.leave) {
|
|
214
|
-
const _replacement = this.replacement;
|
|
215
|
-
const _should_remove = this.should_remove;
|
|
216
|
-
this.replacement = null;
|
|
217
|
-
this.should_remove = false;
|
|
218
|
-
this.leave.call(this.context, node, parent, prop, index);
|
|
219
|
-
if (this.replacement) {
|
|
220
|
-
node = this.replacement;
|
|
221
|
-
this.replace(parent, prop, index, node);
|
|
222
|
-
}
|
|
223
|
-
if (this.should_remove) {
|
|
224
|
-
this.remove(parent, prop, index);
|
|
225
|
-
}
|
|
226
|
-
const removed = this.should_remove;
|
|
227
|
-
this.replacement = _replacement;
|
|
228
|
-
this.should_remove = _should_remove;
|
|
229
|
-
if (removed) return null;
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
return node;
|
|
233
|
-
}
|
|
234
|
-
};
|
|
235
|
-
function isNode(value) {
|
|
236
|
-
return value !== null && typeof value === "object" && "type" in value && typeof value.type === "string";
|
|
237
|
-
}
|
|
238
|
-
__name(isNode, "isNode");
|
|
239
|
-
|
|
240
|
-
// ../node_modules/estree-walker/src/index.js
|
|
241
|
-
function walk(ast, { enter, leave }) {
|
|
242
|
-
const instance = new SyncWalker(enter, leave);
|
|
243
|
-
return instance.visit(ast, null);
|
|
244
|
-
}
|
|
245
|
-
__name(walk, "walk");
|
|
246
|
-
|
|
247
|
-
// src/core-server/mocking-utils/extract.ts
|
|
248
|
-
var DEFAULT_MODULE_DIRECTORIES = ["/node_modules/"];
|
|
249
|
-
function isModuleDirectory(path) {
|
|
250
|
-
const normalizedPath = normalize(path);
|
|
251
|
-
return DEFAULT_MODULE_DIRECTORIES.some((dir) => normalizedPath.includes(dir));
|
|
252
|
-
}
|
|
253
|
-
__name(isModuleDirectory, "isModuleDirectory");
|
|
254
|
-
var babelParser = /* @__PURE__ */ __name((code) => {
|
|
255
|
-
return parser.parse(code, {
|
|
256
|
-
sourceType: "module",
|
|
257
|
-
// Enable plugins to handle modern JavaScript features, including TSX.
|
|
258
|
-
plugins: ["typescript", "jsx", "classProperties", "objectRestSpread"],
|
|
259
|
-
errorRecovery: true
|
|
260
|
-
}).program;
|
|
261
|
-
}, "babelParser");
|
|
262
|
-
function rewriteSbMockImportCalls(code) {
|
|
263
|
-
const ast = babelParser(code);
|
|
264
|
-
walk(ast, {
|
|
265
|
-
enter(node) {
|
|
266
|
-
if (node.type === "CallExpression" && node.callee.type === "MemberExpression" && node.callee.object.type === "Identifier" && node.callee.object.name === "sb" && node.callee.property.type === "Identifier" && node.callee.property.name === "mock" && node.arguments.length > 0 && node.arguments[0].type === "CallExpression" && node.arguments[0].callee.type === "Import" && node.arguments[0].arguments.length === 1 && node.arguments[0].arguments[0].type === "StringLiteral") {
|
|
267
|
-
node.arguments[0] = t2.stringLiteral(node.arguments[0].arguments[0].value);
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
});
|
|
271
|
-
return generate(ast, {}, code);
|
|
272
|
-
}
|
|
273
|
-
__name(rewriteSbMockImportCalls, "rewriteSbMockImportCalls");
|
|
274
|
-
function extractMockCalls(options, parse, root) {
|
|
275
|
-
try {
|
|
276
|
-
let hasSpyTrue2 = function(objectExpression) {
|
|
277
|
-
if (!objectExpression || !objectExpression.properties) {
|
|
278
|
-
return false;
|
|
279
|
-
}
|
|
280
|
-
for (const prop of objectExpression.properties) {
|
|
281
|
-
if (prop.type === "ObjectProperty" && (prop.key.type === "Identifier" && prop.key.name === "spy" || prop.key.type === "StringLiteral" && prop.key.value === "spy") && prop.value.type === "BooleanLiteral" && prop.value.value === true) {
|
|
282
|
-
return true;
|
|
283
|
-
}
|
|
284
|
-
}
|
|
285
|
-
return false;
|
|
286
|
-
};
|
|
287
|
-
var hasSpyTrue = hasSpyTrue2;
|
|
288
|
-
__name(hasSpyTrue2, "hasSpyTrue");
|
|
289
|
-
const previewConfigCode = readFileSync(options.previewConfigPath, "utf-8");
|
|
290
|
-
const { code: jsCode } = transformSync(previewConfigCode, { loader: "tsx", format: "esm" });
|
|
291
|
-
const ast = parse(jsCode);
|
|
292
|
-
const mocks = [];
|
|
293
|
-
walk(ast, {
|
|
294
|
-
// @ts-expect-error - Node comes from babel
|
|
295
|
-
async enter(node) {
|
|
296
|
-
if (node.type !== "CallExpression" || node.callee.type !== "MemberExpression" || node.callee.object.type !== "Identifier" || node.callee.object.name !== "sb" || node.callee.property.type !== "Identifier" || node.callee.property.name !== "mock") {
|
|
297
|
-
return;
|
|
298
|
-
}
|
|
299
|
-
if (node.arguments.length === 0) {
|
|
300
|
-
return;
|
|
301
|
-
}
|
|
302
|
-
let path;
|
|
303
|
-
if (node.arguments[0].type === "StringLiteral") {
|
|
304
|
-
path = node.arguments[0].value;
|
|
305
|
-
} else if (node.arguments[0].type === "CallExpression" && node.arguments[0].callee.type === "Import" && node.arguments[0].arguments[0].type === "StringLiteral") {
|
|
306
|
-
path = node.arguments[0].arguments[0].value;
|
|
307
|
-
} else {
|
|
308
|
-
return;
|
|
309
|
-
}
|
|
310
|
-
const spy = node.arguments.length > 1 && node.arguments[1].type === "ObjectExpression" && hasSpyTrue2(node.arguments[1]);
|
|
311
|
-
const { absolutePath, redirectPath } = resolveMock(path, root, options.previewConfigPath);
|
|
312
|
-
const pathWithoutExtension = path.replace(/\.[^/.]+$/, "");
|
|
313
|
-
const basenameAbsolutePath = basename(absolutePath);
|
|
314
|
-
const basenamePath = basename(path);
|
|
315
|
-
const pathWithoutExtensionAndBasename = basenameAbsolutePath === basenamePath ? pathWithoutExtension : path;
|
|
316
|
-
mocks.push({
|
|
317
|
-
path: pathWithoutExtensionAndBasename,
|
|
318
|
-
absolutePath,
|
|
319
|
-
redirectPath,
|
|
320
|
-
spy
|
|
321
|
-
});
|
|
322
|
-
}
|
|
323
|
-
});
|
|
324
|
-
if (!options.coreOptions?.disableTelemetry) {
|
|
325
|
-
telemetry(
|
|
326
|
-
"mocking",
|
|
327
|
-
{
|
|
328
|
-
modulesMocked: mocks.length,
|
|
329
|
-
modulesSpied: mocks.map((mock) => mock.spy).filter(Boolean).length,
|
|
330
|
-
modulesManuallyMocked: mocks.map((mock) => !!mock.redirectPath).filter(Boolean).length
|
|
331
|
-
},
|
|
332
|
-
{ configDir: options.configDir }
|
|
333
|
-
);
|
|
334
|
-
}
|
|
335
|
-
return mocks;
|
|
336
|
-
} catch (error) {
|
|
337
|
-
logger.debug("Error extracting mock calls", error);
|
|
338
|
-
return [];
|
|
339
|
-
}
|
|
340
|
-
}
|
|
341
|
-
__name(extractMockCalls, "extractMockCalls");
|
|
342
|
-
|
|
343
|
-
// src/core-server/mocking-utils/resolve.ts
|
|
344
|
-
var require2 = createRequire(import.meta.url);
|
|
345
|
-
function findPackageJson(specifier, basedir) {
|
|
346
|
-
const packageJsonPath = require2.resolve(`${specifier}/package.json`, { paths: [basedir] });
|
|
347
|
-
return {
|
|
348
|
-
path: packageJsonPath,
|
|
349
|
-
data: JSON.parse(readFileSync2(packageJsonPath, "utf-8"))
|
|
350
|
-
};
|
|
351
|
-
}
|
|
352
|
-
__name(findPackageJson, "findPackageJson");
|
|
353
|
-
function resolveExternalModule(path, root) {
|
|
354
|
-
const parts = path.split("/");
|
|
355
|
-
const packageName = path.startsWith("@") ? `${parts[0]}/${parts[1]}` : parts[0];
|
|
356
|
-
const entry = `.${path.slice(packageName.length)}`;
|
|
357
|
-
const { path: packageJsonPath, data: pkg } = findPackageJson(packageName, root);
|
|
358
|
-
const packageDir = dirname(packageJsonPath);
|
|
359
|
-
if (pkg.exports) {
|
|
360
|
-
const result = o(pkg, entry, {
|
|
361
|
-
browser: true
|
|
362
|
-
});
|
|
363
|
-
if (result) {
|
|
364
|
-
return join(packageDir, result[0]);
|
|
365
|
-
}
|
|
366
|
-
}
|
|
367
|
-
return require2.resolve(path, { paths: [root] });
|
|
368
|
-
}
|
|
369
|
-
__name(resolveExternalModule, "resolveExternalModule");
|
|
370
|
-
function getIsExternal(path, importer) {
|
|
371
|
-
try {
|
|
372
|
-
return !isAbsolute(path) && isModuleDirectory(require2.resolve(path, { paths: [importer] }));
|
|
373
|
-
} catch (e2) {
|
|
374
|
-
return false;
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
__name(getIsExternal, "getIsExternal");
|
|
378
|
-
function resolveMock(path, root, importer) {
|
|
379
|
-
const isExternal = getIsExternal(path, root);
|
|
380
|
-
const externalPath = isExternal ? path : null;
|
|
381
|
-
const absolutePath = isExternal ? resolveExternalModule(path, root) : require2.resolve(path, { paths: [dirname(importer)] });
|
|
382
|
-
const normalizedAbsolutePath = resolve(absolutePath);
|
|
383
|
-
const redirectPath = findMockRedirect(root, normalizedAbsolutePath, externalPath);
|
|
384
|
-
return {
|
|
385
|
-
absolutePath: normalizedAbsolutePath,
|
|
386
|
-
redirectPath
|
|
387
|
-
// will be null if no __mocks__ file is found
|
|
388
|
-
};
|
|
389
|
-
}
|
|
390
|
-
__name(resolveMock, "resolveMock");
|
|
391
|
-
function getRealPath(path, preserveSymlinks) {
|
|
392
|
-
try {
|
|
393
|
-
return preserveSymlinks ? realpathSync(path) : path;
|
|
394
|
-
} catch {
|
|
395
|
-
return path;
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
__name(getRealPath, "getRealPath");
|
|
399
|
-
function resolveWithExtensions(path, from) {
|
|
400
|
-
const extensions = [".js", ".ts", ".tsx", ".mjs", ".cjs", ".svelte", ".vue"];
|
|
401
|
-
for (const extension of extensions) {
|
|
402
|
-
try {
|
|
403
|
-
return require2.resolve(path + extension, { paths: [from] });
|
|
404
|
-
} catch (e2) {
|
|
405
|
-
continue;
|
|
406
|
-
}
|
|
407
|
-
}
|
|
408
|
-
return require2.resolve(path, { paths: [from] });
|
|
409
|
-
}
|
|
410
|
-
__name(resolveWithExtensions, "resolveWithExtensions");
|
|
411
|
-
|
|
412
|
-
export {
|
|
413
|
-
resolveExternalModule,
|
|
414
|
-
getIsExternal,
|
|
415
|
-
getRealPath,
|
|
416
|
-
resolveWithExtensions,
|
|
417
|
-
babelParser,
|
|
418
|
-
rewriteSbMockImportCalls,
|
|
419
|
-
extractMockCalls
|
|
420
|
-
};
|