storybook 10.1.0-alpha.1 → 10.1.0-alpha.11

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.
Files changed (202) hide show
  1. package/dist/_browser-chunks/Color-FTG7SQDA.js +1097 -0
  2. package/dist/_browser-chunks/WithTooltip-LMROHDUP.js +1651 -0
  3. package/dist/_browser-chunks/chunk-2FRVAXCZ.js +7 -0
  4. package/dist/_browser-chunks/chunk-3IAH5M2U.js +171 -0
  5. package/dist/_browser-chunks/chunk-3OXGAGBE.js +779 -0
  6. package/dist/_browser-chunks/{chunk-TMDZCWME.js → chunk-3PJE6VLG.js} +1 -3
  7. package/dist/_browser-chunks/{chunk-VAMFPZY3.js → chunk-45UGUKRX.js} +2 -7
  8. package/dist/_browser-chunks/chunk-6XWLIJQL.js +11 -0
  9. package/dist/_browser-chunks/{chunk-FDWKXLBI.js → chunk-74YHFU5B.js} +44 -109
  10. package/dist/_browser-chunks/{chunk-MM7DTO55.js → chunk-A242L54C.js} +10 -16
  11. package/dist/_browser-chunks/chunk-AIOS4NGK.js +252 -0
  12. package/dist/_browser-chunks/chunk-AS2HQEYC.js +14 -0
  13. package/dist/_browser-chunks/chunk-AXG2BOBL.js +836 -0
  14. package/dist/_browser-chunks/chunk-BE2DAXKJ.js +2966 -0
  15. package/dist/_browser-chunks/{chunk-MH6AXFXB.js → chunk-CHUV5WSW.js} +0 -5
  16. package/dist/_browser-chunks/chunk-EBHB6RPS.js +61 -0
  17. package/dist/_browser-chunks/chunk-EUVGDK4H.js +93 -0
  18. package/dist/_browser-chunks/chunk-EZSQOHRI.js +18 -0
  19. package/dist/_browser-chunks/{chunk-CADGRH3P.js → chunk-FNXWN6IK.js} +3 -8
  20. package/dist/_browser-chunks/chunk-GFLS4VP3.js +64 -0
  21. package/dist/_browser-chunks/{chunk-L2D73C6Z.js → chunk-H6XK3RSC.js} +13 -21
  22. package/dist/_browser-chunks/chunk-IPA5A322.js +71 -0
  23. package/dist/_browser-chunks/chunk-JP7NCOJX.js +37 -0
  24. package/dist/_browser-chunks/chunk-KJHJLCBK.js +11 -0
  25. package/dist/_browser-chunks/chunk-L4RMQ7D7.js +223 -0
  26. package/dist/_browser-chunks/{chunk-AB7OOPUX.js → chunk-QKODTO7K.js} +0 -5
  27. package/dist/_browser-chunks/chunk-RP5RXKFU.js +2491 -0
  28. package/dist/_browser-chunks/chunk-SL75JR6Y.js +9 -0
  29. package/dist/_browser-chunks/chunk-UD6FQLAF.js +1481 -0
  30. package/dist/_browser-chunks/chunk-VYJQ7RU5.js +2853 -0
  31. package/dist/_browser-chunks/chunk-WJYERY3R.js +136 -0
  32. package/dist/_browser-chunks/chunk-WXP2XJ3O.js +950 -0
  33. package/dist/_browser-chunks/chunk-X3DUQ5RA.js +47 -0
  34. package/dist/_browser-chunks/chunk-XJNX76GA.js +85 -0
  35. package/dist/_browser-chunks/{chunk-F4Q6SGTB.js → chunk-YKE5S47A.js} +177 -399
  36. package/dist/_browser-chunks/{chunk-SN4J4IQ3.js → chunk-ZUWEVLDX.js} +1 -7
  37. package/dist/_browser-chunks/{formatter-OMEEQ6HG.js → formatter-QJ4M4OGQ.js} +4 -9
  38. package/dist/_browser-chunks/{syntaxhighlighter-DK2ODWXH.js → syntaxhighlighter-WKBQ5RC7.js} +707 -1851
  39. package/dist/_node-chunks/{builder-manager-6UBDPV7P.js → builder-manager-PMPHOSM2.js} +495 -1013
  40. package/dist/_node-chunks/camelcase-K3IOOFQW.js +18 -0
  41. package/dist/_node-chunks/{chunk-QNUGJO6L.js → chunk-32NE3UE3.js} +15 -24
  42. package/dist/_node-chunks/chunk-4GZCFQFG.js +58 -0
  43. package/dist/_node-chunks/chunk-5QK5MSOI.js +943 -0
  44. package/dist/_node-chunks/{chunk-3FPF5Y2F.js → chunk-6ZOLETQK.js} +8 -10
  45. package/dist/_node-chunks/chunk-7I22Y76Z.js +1047 -0
  46. package/dist/_node-chunks/chunk-AKTRSR3O.js +72 -0
  47. package/dist/_node-chunks/chunk-BBOP3XCK.js +119 -0
  48. package/dist/_node-chunks/chunk-C2GQVDWI.js +34 -0
  49. package/dist/_node-chunks/{chunk-SCTKVDWR.js → chunk-GG2WQZSG.js} +4619 -7350
  50. package/dist/_node-chunks/chunk-GQJOWVVR.js +3214 -0
  51. package/dist/_node-chunks/chunk-JCRM2YVK.js +3009 -0
  52. package/dist/_node-chunks/chunk-KK4AT5F3.js +1029 -0
  53. package/dist/_node-chunks/chunk-L7MYXJUM.js +1114 -0
  54. package/dist/_node-chunks/{chunk-LAU7VVPC.js → chunk-LCZO45L7.js} +469 -983
  55. package/dist/_node-chunks/chunk-LR3QITDI.js +209 -0
  56. package/dist/_node-chunks/chunk-LXG4DK35.js +3171 -0
  57. package/dist/_node-chunks/chunk-MJ3WOS6F.js +37 -0
  58. package/dist/_node-chunks/chunk-PHOZWZZO.js +61 -0
  59. package/dist/_node-chunks/chunk-QECOQWRJ.js +936 -0
  60. package/dist/_node-chunks/chunk-QH4V5YDB.js +20 -0
  61. package/dist/_node-chunks/chunk-R6HWGZWD.js +26 -0
  62. package/dist/_node-chunks/chunk-SPQXMU2Q.js +759 -0
  63. package/dist/_node-chunks/chunk-TXZY6V6O.js +1564 -0
  64. package/dist/_node-chunks/chunk-UGDPX5LE.js +756 -0
  65. package/dist/_node-chunks/chunk-UY26MQLT.js +603 -0
  66. package/dist/_node-chunks/chunk-WK3EMYK6.js +61 -0
  67. package/dist/_node-chunks/{chunk-CJHAP7SE.js → chunk-WLHMN7AP.js} +292 -688
  68. package/dist/_node-chunks/chunk-XGVLB4UJ.js +54 -0
  69. package/dist/_node-chunks/{chunk-J7N7PD5Q.js → chunk-YHRFI6BE.js} +87 -227
  70. package/dist/_node-chunks/chunk-YK4KVMFW.js +18 -0
  71. package/dist/_node-chunks/chunk-ZZALGOA6.js +4523 -0
  72. package/dist/_node-chunks/chunk-ZZPBSYA5.js +301 -0
  73. package/dist/_node-chunks/chunk-ZZSRFAC6.js +45571 -0
  74. package/dist/_node-chunks/dist-4DWOCZUD.js +121 -0
  75. package/dist/_node-chunks/globby-AAARUKEU.js +3452 -0
  76. package/dist/_node-chunks/lib-HEUKGL62.js +366 -0
  77. package/dist/_node-chunks/mdx-N42X6CFJ-DCVRPS6N.js +14329 -0
  78. package/dist/_node-chunks/p-limit-F5ZKJ6WZ.js +116 -0
  79. package/dist/_node-chunks/plugin-7YY7JXCH.js +123 -0
  80. package/dist/_node-chunks/{plugin-HJLCLGNT.js → plugin-SZP3CW6W.js} +36 -56
  81. package/dist/_node-chunks/webpack-inject-mocker-runtime-plugin-TGKNDPO6.js +46623 -0
  82. package/dist/_node-chunks/webpack-mock-plugin-LNTZZFBE.js +92 -0
  83. package/dist/actions/decorator.js +21 -42
  84. package/dist/actions/index.js +3 -3
  85. package/dist/babel/index.d.ts +671 -335
  86. package/dist/babel/index.js +11 -11
  87. package/dist/bin/core.js +592 -1546
  88. package/dist/bin/dispatcher.js +26 -37
  89. package/dist/bin/loader.js +23 -34
  90. package/dist/channels/index.js +98 -234
  91. package/dist/cli/index.js +1966 -5347
  92. package/dist/client-logger/index.js +31 -61
  93. package/dist/common/index.d.ts +210 -3
  94. package/dist/common/index.js +28 -20
  95. package/dist/components/index.d.ts +472 -280
  96. package/dist/components/index.js +15992 -75
  97. package/dist/core-events/index.js +2 -66
  98. package/dist/core-server/index.js +3837 -7191
  99. package/dist/core-server/presets/common-manager.css +2 -2
  100. package/dist/core-server/presets/common-manager.js +2511 -5219
  101. package/dist/core-server/presets/common-override-preset.js +31 -60
  102. package/dist/core-server/presets/common-preset.js +434 -924
  103. package/dist/core-server/presets/webpack/loaders/storybook-mock-transform-loader.js +15 -19
  104. package/dist/core-server/presets/webpack/loaders/webpack-automock-loader.js +12 -17
  105. package/dist/csf/index.js +534 -1172
  106. package/dist/csf-tools/index.d.ts +15 -4
  107. package/dist/csf-tools/index.js +9 -9
  108. package/dist/docs-tools/index.js +6 -6
  109. package/dist/highlight/index.js +2 -2
  110. package/dist/instrumenter/index.js +199 -415
  111. package/dist/manager/globals-runtime.js +47968 -56484
  112. package/dist/manager/globals.js +2 -3
  113. package/dist/manager/runtime.js +4901 -10318
  114. package/dist/manager-api/index.d.ts +11 -3
  115. package/dist/manager-api/index.js +1250 -2397
  116. package/dist/manager-errors.d.ts +3 -0
  117. package/dist/manager-errors.js +3 -3
  118. package/dist/node-logger/index.d.ts +1 -1
  119. package/dist/node-logger/index.js +1270 -2593
  120. package/dist/preview/globals.js +2 -3
  121. package/dist/preview/runtime.js +10767 -22386
  122. package/dist/preview-api/index.d.ts +67 -68
  123. package/dist/preview-api/index.js +15 -15
  124. package/dist/preview-errors.d.ts +3 -0
  125. package/dist/preview-errors.js +4 -4
  126. package/dist/router/index.js +347 -899
  127. package/dist/server-errors.d.ts +3 -0
  128. package/dist/server-errors.js +10 -10
  129. package/dist/telemetry/index.js +24 -24
  130. package/dist/test/index.js +6129 -11914
  131. package/dist/theming/create.d.ts +4 -2
  132. package/dist/theming/create.js +4 -4
  133. package/dist/theming/index.d.ts +3397 -2628
  134. package/dist/theming/index.js +502 -1091
  135. package/dist/types/index.d.ts +50 -5
  136. package/dist/types/index.js +2 -11
  137. package/dist/viewport/index.js +3 -3
  138. package/package.json +17 -9
  139. package/dist/_browser-chunks/Color-7ZNS6F6B.js +0 -1676
  140. package/dist/_browser-chunks/WithTooltip-SK46ZJ2J.js +0 -13
  141. package/dist/_browser-chunks/chunk-6A7OIVEL.js +0 -66
  142. package/dist/_browser-chunks/chunk-B4A3ADP3.js +0 -3816
  143. package/dist/_browser-chunks/chunk-BOOOPFZF.js +0 -2335
  144. package/dist/_browser-chunks/chunk-C4XOKMDU.js +0 -270
  145. package/dist/_browser-chunks/chunk-FSBVR7H5.js +0 -106
  146. package/dist/_browser-chunks/chunk-FUOHXXZT.js +0 -23
  147. package/dist/_browser-chunks/chunk-GTKOCWCT.js +0 -17
  148. package/dist/_browser-chunks/chunk-HHW4FUMO.js +0 -12
  149. package/dist/_browser-chunks/chunk-I74EUU5O.js +0 -5809
  150. package/dist/_browser-chunks/chunk-JVSKG4YS.js +0 -4052
  151. package/dist/_browser-chunks/chunk-LASUB7TL.js +0 -76
  152. package/dist/_browser-chunks/chunk-LYCSRYYR.js +0 -101
  153. package/dist/_browser-chunks/chunk-NVV6MIOE.js +0 -243
  154. package/dist/_browser-chunks/chunk-OBXWFEPB.js +0 -852
  155. package/dist/_browser-chunks/chunk-OPCDBBL3.js +0 -48
  156. package/dist/_browser-chunks/chunk-PB6FZ3WE.js +0 -130
  157. package/dist/_browser-chunks/chunk-RNE2IUTB.js +0 -1300
  158. package/dist/_browser-chunks/chunk-SYS437NN.js +0 -122
  159. package/dist/_browser-chunks/chunk-U46RQHA4.js +0 -12
  160. package/dist/_browser-chunks/chunk-UTNZYD2N.js +0 -311
  161. package/dist/_browser-chunks/chunk-VUAFL5XK.js +0 -20
  162. package/dist/_browser-chunks/chunk-W4QKLQSC.js +0 -4182
  163. package/dist/_browser-chunks/chunk-XDGMHOV7.js +0 -2197
  164. package/dist/_browser-chunks/chunk-XW6KSYKF.js +0 -16
  165. package/dist/_browser-chunks/chunk-Y3M7TW6K.js +0 -1041
  166. package/dist/_browser-chunks/chunk-ZNRFDIVA.js +0 -233
  167. package/dist/_node-chunks/camelcase-WKJOVNPM.js +0 -18
  168. package/dist/_node-chunks/chunk-2RIKHYCS.js +0 -304
  169. package/dist/_node-chunks/chunk-3JCSHYSU.js +0 -1657
  170. package/dist/_node-chunks/chunk-4GE6Q4MX.js +0 -1531
  171. package/dist/_node-chunks/chunk-5SEHHENC.js +0 -64656
  172. package/dist/_node-chunks/chunk-6GD23U64.js +0 -420
  173. package/dist/_node-chunks/chunk-6OAXYS5T.js +0 -1544
  174. package/dist/_node-chunks/chunk-7TNUMFKR.js +0 -4741
  175. package/dist/_node-chunks/chunk-BCDHUXAJ.js +0 -4272
  176. package/dist/_node-chunks/chunk-BYVQZ2HU.js +0 -220
  177. package/dist/_node-chunks/chunk-DAMVKHAC.js +0 -101
  178. package/dist/_node-chunks/chunk-FEOC7OX2.js +0 -1586
  179. package/dist/_node-chunks/chunk-FY7XZPLY.js +0 -2248
  180. package/dist/_node-chunks/chunk-GD2FXWDF.js +0 -697
  181. package/dist/_node-chunks/chunk-HM6B7FE5.js +0 -18
  182. package/dist/_node-chunks/chunk-HORWITP7.js +0 -90
  183. package/dist/_node-chunks/chunk-II4AFH3V.js +0 -28
  184. package/dist/_node-chunks/chunk-MF2PUEWG.js +0 -5029
  185. package/dist/_node-chunks/chunk-RVE4UTVQ.js +0 -1518
  186. package/dist/_node-chunks/chunk-TUFWZUTO.js +0 -69
  187. package/dist/_node-chunks/chunk-TXHNWNH4.js +0 -79
  188. package/dist/_node-chunks/chunk-ULWNTI6M.js +0 -1198
  189. package/dist/_node-chunks/chunk-VYRFXLRO.js +0 -6712
  190. package/dist/_node-chunks/chunk-WNOSTIYP.js +0 -34
  191. package/dist/_node-chunks/chunk-X67VGZN4.js +0 -1250
  192. package/dist/_node-chunks/chunk-XCEBYOA4.js +0 -61
  193. package/dist/_node-chunks/chunk-XW7YMR7I.js +0 -111
  194. package/dist/_node-chunks/chunk-ZRFYQ46H.js +0 -61
  195. package/dist/_node-chunks/dist-APCKHSY3.js +0 -175
  196. package/dist/_node-chunks/globby-TSGXGDA2.js +0 -5222
  197. package/dist/_node-chunks/lib-DZ5TVIU5.js +0 -518
  198. package/dist/_node-chunks/mdx-N42X6CFJ-Z6BYQCPN.js +0 -22017
  199. package/dist/_node-chunks/p-limit-MLJNGG2K.js +0 -168
  200. package/dist/_node-chunks/plugin-J3JI3ZKJ.js +0 -159
  201. package/dist/_node-chunks/webpack-inject-mocker-runtime-plugin-3QHNTM5B.js +0 -69102
  202. package/dist/_node-chunks/webpack-mock-plugin-4Y3MWPJ6.js +0 -124
@@ -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_in4hyfgp7kn from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_in4hyfgp7kn from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_in4hyfgp7kn from "node:module";
4
-
5
- var __filename = CJS_COMPAT_NODE_URL_in4hyfgp7kn.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_in4hyfgp7kn.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_in4hyfgp7kn.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-DAMVKHAC.js";
15
- import "./chunk-XCEBYOA4.js";
16
- export {
17
- camelCase as default
18
- };
@@ -1,304 +0,0 @@
1
- import CJS_COMPAT_NODE_URL_in4hyfgp7kn from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_in4hyfgp7kn from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_in4hyfgp7kn from "node:module";
4
-
5
- var __filename = CJS_COMPAT_NODE_URL_in4hyfgp7kn.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_in4hyfgp7kn.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_in4hyfgp7kn.createRequire(import.meta.url);
8
-
9
- // ------------------------------------------------------------
10
- // end of CJS compatibility banner, injected by Storybook's esbuild configuration
11
- // ------------------------------------------------------------
12
- import {
13
- require_build
14
- } from "./chunk-GD2FXWDF.js";
15
- import {
16
- resolvePackageDir
17
- } from "./chunk-6OAXYS5T.js";
18
- import {
19
- require_prompts
20
- } from "./chunk-MF2PUEWG.js";
21
- import {
22
- require_dist
23
- } from "./chunk-TUFWZUTO.js";
24
- import {
25
- require_picocolors
26
- } from "./chunk-QNUGJO6L.js";
27
- import {
28
- __name,
29
- __toESM
30
- } from "./chunk-XCEBYOA4.js";
31
-
32
- // src/core-server/utils/server-statics.ts
33
- var import_picocolors = __toESM(require_picocolors(), 1);
34
- var import_sirv = __toESM(require_build(), 1);
35
- var import_ts_dedent = __toESM(require_dist(), 1);
36
- import { existsSync, statSync } from "node:fs";
37
- import { readFile, stat } from "node:fs/promises";
38
- import { basename, isAbsolute, join, posix, resolve, sep, win32 } from "node:path";
39
- import { getDirectoryFromWorkingDir, resolvePathInStorybookCache } from "storybook/internal/common";
40
- import { logger, once } from "storybook/internal/node-logger";
41
- var cacheDir = resolvePathInStorybookCache("", "ignored-sub").split("ignored-sub")[0];
42
- var files = /* @__PURE__ */ new Map();
43
- var readFileOnce = /* @__PURE__ */ __name(async (path) => {
44
- if (files.has(path)) {
45
- return files.get(path);
46
- } else {
47
- const [data, stats] = await Promise.all([readFile(path, "utf-8"), stat(path)]);
48
- const result = { data, mtime: stats.mtimeMs };
49
- files.set(path, result);
50
- return result;
51
- }
52
- }, "readFileOnce");
53
- var faviconWrapperPath = join(
54
- resolvePackageDir("storybook"),
55
- "/assets/browser/favicon-wrapper.svg"
56
- );
57
- var prepareNestedSvg = /* @__PURE__ */ __name((svg) => {
58
- const [, openingTag, contents, closingTag] = svg?.match(/(<svg[^>]*>)(.*?)(<\/svg>)/s) ?? [];
59
- if (!openingTag || !contents || !closingTag) {
60
- return svg;
61
- }
62
- let width;
63
- let height;
64
- let modifiedTag = openingTag.replace(/width=["']([^"']*)["']/g, (_, value) => {
65
- width = parseFloat(value);
66
- return 'width="32px"';
67
- }).replace(/height=["']([^"']*)["']/g, (_, value) => {
68
- height = parseFloat(value);
69
- return 'height="32px"';
70
- });
71
- const hasViewBox = /viewBox=["'][^"']*["']/.test(modifiedTag);
72
- if (!hasViewBox && width && height) {
73
- modifiedTag = modifiedTag.replace(/>$/, ` viewBox="0 0 ${width} ${height}">`);
74
- }
75
- modifiedTag = modifiedTag.replace(/preserveAspectRatio=["'][^"']*["']/g, "").replace(/>$/, ' preserveAspectRatio="xMidYMid meet">');
76
- return modifiedTag + contents + closingTag;
77
- }, "prepareNestedSvg");
78
- async function useStatics(app, options) {
79
- const staticDirs = await options.presets.apply("staticDirs") ?? [];
80
- const faviconPath = await options.presets.apply("favicon");
81
- const faviconDir = resolve(faviconPath, "..");
82
- const faviconFile = basename(faviconPath);
83
- app.use(`/${faviconFile}`, async (req, res, next) => {
84
- const status = req.query.status;
85
- if (status && faviconFile.endsWith(".svg") && ["active", "critical", "negative", "positive", "warning"].includes(status)) {
86
- const [faviconInfo, faviconWrapperInfo] = await Promise.all([
87
- readFileOnce(join(faviconDir, faviconFile)),
88
- readFileOnce(faviconWrapperPath)
89
- ]).catch((e) => {
90
- if (e instanceof Error) {
91
- once.warn(`Failed to read favicon: ${e.message}`);
92
- }
93
- return [null, null];
94
- });
95
- if (faviconInfo && faviconWrapperInfo) {
96
- const svg = faviconWrapperInfo.data.replace('<g id="mask"', `<g mask="url(#${status}-mask)"`).replace('<use id="status"', `<use href="#${status}"`).replace('<use id="icon" />', prepareNestedSvg(faviconInfo.data));
97
- res.setHeader("Content-Type", "image/svg+xml");
98
- res.setHeader("ETag", `"${faviconWrapperInfo.mtime}-${faviconInfo.mtime}"`);
99
- res.end(svg);
100
- return;
101
- }
102
- }
103
- req.url = `/${faviconFile}`;
104
- return sirvWorkaround(faviconDir)(req, res, next);
105
- });
106
- staticDirs.map((dir) => {
107
- try {
108
- const { staticDir, staticPath, targetEndpoint } = mapStaticDir(dir, options.configDir);
109
- if (!targetEndpoint.startsWith("/sb-") && !staticDir.startsWith(cacheDir)) {
110
- logger.info(
111
- `=> Serving static files from ${import_picocolors.default.cyan(staticDir)} at ${import_picocolors.default.cyan(targetEndpoint)}`
112
- );
113
- }
114
- if (existsSync(staticPath) && statSync(staticPath).isFile()) {
115
- const staticPathDir = resolve(staticPath, "..");
116
- const staticPathFile = basename(staticPath);
117
- app.use(targetEndpoint, (req, res, next) => {
118
- req.url = `/${staticPathFile}`;
119
- sirvWorkaround(staticPathDir)(req, res, next);
120
- });
121
- } else {
122
- app.use(targetEndpoint, sirvWorkaround(staticPath));
123
- }
124
- } catch (e) {
125
- if (e instanceof Error) {
126
- logger.warn(e.message);
127
- }
128
- }
129
- });
130
- }
131
- __name(useStatics, "useStatics");
132
- var sirvWorkaround = /* @__PURE__ */ __name((dir, opts = {}) => (req, res, next) => {
133
- const originalParsedUrl = req._parsedUrl;
134
- const maybeNext = next ? () => {
135
- req._parsedUrl = originalParsedUrl;
136
- next();
137
- } : void 0;
138
- (0, import_sirv.default)(dir, { dev: true, etag: true, extensions: [], ...opts })(req, res, maybeNext);
139
- }, "sirvWorkaround");
140
- var parseStaticDir = /* @__PURE__ */ __name((arg) => {
141
- const lastColonIndex = arg.lastIndexOf(":");
142
- const isWindowsAbsolute = win32.isAbsolute(arg);
143
- const isWindowsRawDirOnly = isWindowsAbsolute && lastColonIndex === 1;
144
- const splitIndex = lastColonIndex !== -1 && !isWindowsRawDirOnly ? lastColonIndex : arg.length;
145
- const [from, to] = [arg.slice(0, splitIndex), arg.slice(splitIndex + 1)];
146
- const staticDir = isAbsolute(from) ? from : `./${from}`;
147
- const staticPath = resolve(staticDir);
148
- if (!existsSync(staticPath)) {
149
- throw new Error(
150
- import_ts_dedent.dedent`
151
- Failed to load static files, no such directory: ${import_picocolors.default.cyan(staticPath)}
152
- Make sure this directory exists.
153
- `
154
- );
155
- }
156
- const targetRaw = to || (statSync(staticPath).isFile() ? basename(staticPath) : "/");
157
- const target = targetRaw.split(sep).join(posix.sep);
158
- const targetDir = target.replace(/^\/?/, "./");
159
- const targetEndpoint = targetDir.substring(1);
160
- return { staticDir, staticPath, targetDir, targetEndpoint };
161
- }, "parseStaticDir");
162
- var mapStaticDir = /* @__PURE__ */ __name((staticDir, configDir) => {
163
- const specifier = typeof staticDir === "string" ? staticDir : `${staticDir.from}:${staticDir.to}`;
164
- const normalizedDir = isAbsolute(specifier) ? specifier : getDirectoryFromWorkingDir({ configDir, workingDir: process.cwd(), directory: specifier });
165
- return parseStaticDir(normalizedDir);
166
- }, "mapStaticDir");
167
-
168
- // src/core-server/withTelemetry.ts
169
- var import_prompts = __toESM(require_prompts(), 1);
170
- import { HandledError, cache, isCI, loadAllPresets } from "storybook/internal/common";
171
- import { logger as logger2 } from "storybook/internal/node-logger";
172
- import { getPrecedingUpgrade, oneWayHash, telemetry } from "storybook/internal/telemetry";
173
- var promptCrashReports = /* @__PURE__ */ __name(async () => {
174
- if (isCI() || !process.stdout.isTTY) {
175
- return void 0;
176
- }
177
- const { enableCrashReports } = await (0, import_prompts.default)({
178
- type: "confirm",
179
- name: "enableCrashReports",
180
- message: `Would you like to help improve Storybook by sending anonymous crash reports?`,
181
- initial: true
182
- });
183
- await cache.set("enableCrashReports", enableCrashReports);
184
- return enableCrashReports;
185
- }, "promptCrashReports");
186
- async function getErrorLevel({
187
- cliOptions,
188
- presetOptions,
189
- skipPrompt
190
- }) {
191
- if (cliOptions.disableTelemetry) {
192
- return "none";
193
- }
194
- if (!presetOptions) {
195
- return "full";
196
- }
197
- const presets = await loadAllPresets(presetOptions);
198
- const core = await presets.apply("core");
199
- if (core?.enableCrashReports !== void 0) {
200
- return core.enableCrashReports ? "full" : "error";
201
- }
202
- if (core?.disableTelemetry) {
203
- return "none";
204
- }
205
- const valueFromCache = await cache.get("enableCrashReports") ?? await cache.get("enableCrashreports");
206
- if (valueFromCache !== void 0) {
207
- return valueFromCache ? "full" : "error";
208
- }
209
- if (skipPrompt) {
210
- return "error";
211
- }
212
- const valueFromPrompt = await promptCrashReports();
213
- if (valueFromPrompt !== void 0) {
214
- return valueFromPrompt ? "full" : "error";
215
- }
216
- return "full";
217
- }
218
- __name(getErrorLevel, "getErrorLevel");
219
- async function sendTelemetryError(_error, eventType, options) {
220
- try {
221
- let errorLevel = "error";
222
- try {
223
- errorLevel = await getErrorLevel(options);
224
- } catch (err) {
225
- }
226
- if (errorLevel !== "none") {
227
- const precedingUpgrade = await getPrecedingUpgrade();
228
- const error = _error;
229
- let errorHash;
230
- if ("message" in error) {
231
- errorHash = error.message ? oneWayHash(error.message) : "EMPTY_MESSAGE";
232
- } else {
233
- errorHash = "NO_MESSAGE";
234
- }
235
- const { code, name, category } = error;
236
- await telemetry(
237
- "error",
238
- {
239
- code,
240
- name,
241
- category,
242
- eventType,
243
- precedingUpgrade,
244
- error: errorLevel === "full" ? error : void 0,
245
- errorHash,
246
- // if we ever end up sending a non-error instance, we'd like to know
247
- isErrorInstance: error instanceof Error
248
- },
249
- {
250
- immediate: true,
251
- configDir: options.cliOptions.configDir || options.presetOptions?.configDir,
252
- enableCrashReports: errorLevel === "full"
253
- }
254
- );
255
- }
256
- } catch (err) {
257
- }
258
- }
259
- __name(sendTelemetryError, "sendTelemetryError");
260
- async function withTelemetry(eventType, options, run) {
261
- const enableTelemetry = !(options.cliOptions.disableTelemetry || options.cliOptions.test === true);
262
- let canceled = false;
263
- async function cancelTelemetry() {
264
- canceled = true;
265
- if (enableTelemetry) {
266
- await telemetry("canceled", { eventType }, { stripMetadata: true, immediate: true });
267
- }
268
- process.exit(0);
269
- }
270
- __name(cancelTelemetry, "cancelTelemetry");
271
- if (eventType === "init") {
272
- process.on("SIGINT", cancelTelemetry);
273
- }
274
- if (enableTelemetry) {
275
- telemetry("boot", { eventType }, { stripMetadata: true });
276
- }
277
- try {
278
- return await run();
279
- } catch (error) {
280
- if (canceled) {
281
- return void 0;
282
- }
283
- if (!(error instanceof HandledError)) {
284
- const { printError = logger2.error } = options;
285
- printError(error);
286
- }
287
- if (enableTelemetry) {
288
- await sendTelemetryError(error, eventType, options);
289
- }
290
- throw error;
291
- } finally {
292
- process.off("SIGINT", cancelTelemetry);
293
- }
294
- }
295
- __name(withTelemetry, "withTelemetry");
296
-
297
- export {
298
- useStatics,
299
- parseStaticDir,
300
- mapStaticDir,
301
- getErrorLevel,
302
- sendTelemetryError,
303
- withTelemetry
304
- };