storybook 9.1.13 → 9.1.15
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/babel/index.cjs +22495 -21246
- package/dist/babel/index.d.ts +672 -336
- package/dist/babel/index.js +22534 -21285
- package/dist/bin/index.cjs +42 -43
- package/dist/bin/index.js +42 -43
- package/dist/cli/bin/index.cjs +1 -1
- package/dist/cli/bin/index.js +1 -1
- package/dist/cli/index.cjs +27120 -25868
- package/dist/cli/index.js +27267 -26015
- package/dist/common/index.cjs +57 -58
- package/dist/common/index.d.ts +0 -1
- package/dist/common/index.js +103 -104
- package/dist/components/index.cjs +4464 -4353
- package/dist/components/index.js +3290 -3181
- package/dist/core-events/index.cjs +105 -103
- package/dist/core-events/index.d.ts +3 -1
- package/dist/core-events/index.js +85 -83
- package/dist/core-server/index.cjs +7389 -7318
- package/dist/core-server/index.js +7598 -7529
- package/dist/core-server/presets/common-preset.cjs +20111 -19862
- package/dist/core-server/presets/common-preset.js +20183 -19934
- package/dist/core-server/presets/webpack/loaders/webpack-automock-loader.cjs +306 -518
- package/dist/core-server/presets/webpack/loaders/webpack-automock-loader.js +302 -525
- package/dist/csf-tools/index.cjs +150 -144
- package/dist/csf-tools/index.js +401 -395
- package/dist/manager/globals-module-info.cjs +2 -0
- package/dist/manager/globals-module-info.js +2 -0
- package/dist/manager/globals-runtime.js +16492 -16380
- package/dist/manager/runtime.js +525 -522
- package/dist/manager-api/index.cjs +1 -1
- package/dist/manager-api/index.js +1 -1
- package/dist/node-logger/index.cjs +71 -71
- package/dist/node-logger/index.js +71 -71
- package/dist/preview/runtime.js +7462 -7458
- package/dist/preview-api/index.cjs +2 -0
- package/dist/preview-api/index.js +233 -230
- package/dist/telemetry/index.cjs +5 -4
- package/dist/telemetry/index.d.ts +1 -1
- package/dist/telemetry/index.js +5 -4
- package/dist/test/index.cjs +267 -267
- package/dist/test/index.js +240 -240
- package/package.json +1 -1
|
@@ -4,301 +4,75 @@ import { dirname as ESM_COMPAT_dirname } from 'node:path';
|
|
|
4
4
|
const __filename = ESM_COMPAT_fileURLToPath(import.meta.url);
|
|
5
5
|
const __dirname = ESM_COMPAT_dirname(__filename);
|
|
6
6
|
const require = ESM_COMPAT_Module.createRequire(import.meta.url);
|
|
7
|
-
var
|
|
8
|
-
var
|
|
9
|
-
var yt = Object.getOwnPropertyDescriptor;
|
|
10
|
-
var bt = Object.getOwnPropertyNames;
|
|
11
|
-
var wt = Object.getPrototypeOf, _t = Object.prototype.hasOwnProperty;
|
|
12
|
-
var d = (c, t) => it(c, "name", { value: t, configurable: !0 });
|
|
13
|
-
var vt = (c, t) => () => (t || c((t = { exports: {} }).exports, t), t.exports);
|
|
14
|
-
var Ct = (c, t, e, i) => {
|
|
15
|
-
if (t && typeof t == "object" || typeof t == "function")
|
|
16
|
-
for (let n of bt(t))
|
|
17
|
-
!_t.call(c, n) && n !== e && it(c, n, { get: () => t[n], enumerable: !(i = yt(t, n)) || i.enumerable });
|
|
18
|
-
return c;
|
|
19
|
-
};
|
|
20
|
-
var St = (c, t, e) => (e = c != null ? mt(wt(c)) : {}, Ct(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
t || !c || !c.__esModule ? it(e, "default", { value: c, enumerable: !0 }) : e,
|
|
26
|
-
c
|
|
27
|
-
));
|
|
7
|
+
var q = Object.defineProperty;
|
|
8
|
+
var u = (l, t) => q(l, "name", { value: t, configurable: !0 });
|
|
28
9
|
|
|
29
|
-
// ../node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.
|
|
30
|
-
var
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
}
|
|
88
|
-
flush() {
|
|
89
|
-
let { buffer: a, out: s, pos: h } = this;
|
|
90
|
-
return h > 0 ? s + R.decode(a.subarray(0, h)) : s;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
class W {
|
|
94
|
-
static {
|
|
95
|
-
d(this, "StringReader");
|
|
96
|
-
}
|
|
97
|
-
constructor(a) {
|
|
98
|
-
this.pos = 0, this.buffer = a;
|
|
99
|
-
}
|
|
100
|
-
next() {
|
|
101
|
-
return this.buffer.charCodeAt(this.pos++);
|
|
102
|
-
}
|
|
103
|
-
peek() {
|
|
104
|
-
return this.buffer.charCodeAt(this.pos);
|
|
105
|
-
}
|
|
106
|
-
indexOf(a) {
|
|
107
|
-
let { buffer: s, pos: h } = this, g = s.indexOf(a, h);
|
|
108
|
-
return g === -1 ? s.length : g;
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
let tt = [];
|
|
112
|
-
function P(f) {
|
|
113
|
-
let { length: a } = f, s = new W(f), h = [], g = [], m = 0;
|
|
114
|
-
for (; s.pos < a; s.pos++) {
|
|
115
|
-
m = r(s, m);
|
|
116
|
-
let _ = r(s, 0);
|
|
117
|
-
if (!u(s, a)) {
|
|
118
|
-
let k = g.pop();
|
|
119
|
-
k[2] = m, k[3] = _;
|
|
120
|
-
continue;
|
|
121
|
-
}
|
|
122
|
-
let b = r(s, 0), w = r(s, 0) & 1 ? [m, _, 0, 0, b, r(s, 0)] : [m, _, 0, 0, b], x = tt;
|
|
123
|
-
if (u(s, a)) {
|
|
124
|
-
x = [];
|
|
125
|
-
do {
|
|
126
|
-
let k = r(s, 0);
|
|
127
|
-
x.push(k);
|
|
128
|
-
} while (u(s, a));
|
|
129
|
-
}
|
|
130
|
-
w.vars = x, h.push(w), g.push(w);
|
|
131
|
-
}
|
|
132
|
-
return h;
|
|
133
|
-
}
|
|
134
|
-
d(P, "decodeOriginalScopes");
|
|
135
|
-
function I(f) {
|
|
136
|
-
let a = new D();
|
|
137
|
-
for (let s = 0; s < f.length; )
|
|
138
|
-
s = L(f, s, a, [0]);
|
|
139
|
-
return a.flush();
|
|
140
|
-
}
|
|
141
|
-
d(I, "encodeOriginalScopes");
|
|
142
|
-
function L(f, a, s, h) {
|
|
143
|
-
let g = f[a], { 0: m, 1: _, 2: b, 3: S, 4: C, vars: w } = g;
|
|
144
|
-
a > 0 && s.write(44), h[0] = l(s, m, h[0]), l(s, _, 0), l(s, C, 0);
|
|
145
|
-
let x = g.length === 6 ? 1 : 0;
|
|
146
|
-
l(s, x, 0), g.length === 6 && l(s, g[5], 0);
|
|
147
|
-
for (let k of w)
|
|
148
|
-
l(s, k, 0);
|
|
149
|
-
for (a++; a < f.length; ) {
|
|
150
|
-
let k = f[a], { 0: y, 1: E } = k;
|
|
151
|
-
if (y > b || y === b && E >= S)
|
|
152
|
-
break;
|
|
153
|
-
a = L(f, a, s, h);
|
|
154
|
-
}
|
|
155
|
-
return s.write(44), h[0] = l(s, b, h[0]), l(s, S, 0), a;
|
|
156
|
-
}
|
|
157
|
-
d(L, "_encodeOriginalScopes");
|
|
158
|
-
function j(f) {
|
|
159
|
-
let { length: a } = f, s = new W(f), h = [], g = [], m = 0, _ = 0, b = 0, S = 0, C = 0, w = 0, x = 0, k = 0;
|
|
160
|
-
do {
|
|
161
|
-
let y = s.indexOf(";"), E = 0;
|
|
162
|
-
for (; s.pos < y; s.pos++) {
|
|
163
|
-
if (E = r(s, E), !u(s, y)) {
|
|
164
|
-
let O = g.pop();
|
|
165
|
-
O[2] = m, O[3] = E;
|
|
166
|
-
continue;
|
|
167
|
-
}
|
|
168
|
-
let A = r(s, 0), Y = A & 1, G = A & 2, K = A & 4, rt = null, et = tt, M;
|
|
169
|
-
if (Y) {
|
|
170
|
-
let O = r(s, _);
|
|
171
|
-
b = r(s, _ === O ? b : 0), _ = O, M = [m, E, 0, 0, O, b];
|
|
172
|
-
} else
|
|
173
|
-
M = [m, E, 0, 0];
|
|
174
|
-
if (M.isScope = !!K, G) {
|
|
175
|
-
let O = S, U = C;
|
|
176
|
-
S = r(s, S);
|
|
177
|
-
let z = O === S;
|
|
178
|
-
C = r(s, z ? C : 0), w = r(s, z && U === C ? w : 0), rt = [S, C, w];
|
|
179
|
-
}
|
|
180
|
-
if (M.callsite = rt, u(s, y)) {
|
|
181
|
-
et = [];
|
|
182
|
-
do {
|
|
183
|
-
x = m, k = E;
|
|
184
|
-
let O = r(s, 0), U;
|
|
185
|
-
if (O < -1) {
|
|
186
|
-
U = [[r(s, 0)]];
|
|
187
|
-
for (let z = -1; z > O; z--) {
|
|
188
|
-
let pt = x;
|
|
189
|
-
x = r(s, x), k = r(s, x === pt ? k : 0);
|
|
190
|
-
let gt = r(s, 0);
|
|
191
|
-
U.push([gt, x, k]);
|
|
192
|
-
}
|
|
193
|
-
} else
|
|
194
|
-
U = [[O]];
|
|
195
|
-
et.push(U);
|
|
196
|
-
} while (u(s, y));
|
|
197
|
-
}
|
|
198
|
-
M.bindings = et, h.push(M), g.push(M);
|
|
199
|
-
}
|
|
200
|
-
m++, s.pos = y + 1;
|
|
201
|
-
} while (s.pos < a);
|
|
202
|
-
return h;
|
|
203
|
-
}
|
|
204
|
-
d(j, "decodeGeneratedRanges");
|
|
205
|
-
function $(f) {
|
|
206
|
-
if (f.length === 0)
|
|
207
|
-
return "";
|
|
208
|
-
let a = new D();
|
|
209
|
-
for (let s = 0; s < f.length; )
|
|
210
|
-
s = T(f, s, a, [0, 0, 0, 0, 0, 0, 0]);
|
|
211
|
-
return a.flush();
|
|
212
|
-
}
|
|
213
|
-
d($, "encodeGeneratedRanges");
|
|
214
|
-
function T(f, a, s, h) {
|
|
215
|
-
let g = f[a], { 0: m, 1: _, 2: b, 3: S, isScope: C, callsite: w, bindings: x } = g;
|
|
216
|
-
h[0] < m ? (v(s, h[0], m), h[0] = m, h[1] = 0) : a > 0 && s.write(44), h[1] = l(s, g[1], h[1]);
|
|
217
|
-
let k = (g.length === 6 ? 1 : 0) | (w ? 2 : 0) | (C ? 4 : 0);
|
|
218
|
-
if (l(s, k, 0), g.length === 6) {
|
|
219
|
-
let { 4: y, 5: E } = g;
|
|
220
|
-
y !== h[2] && (h[3] = 0), h[2] = l(s, y, h[2]), h[3] = l(s, E, h[3]);
|
|
221
|
-
}
|
|
222
|
-
if (w) {
|
|
223
|
-
let { 0: y, 1: E, 2: A } = g.callsite;
|
|
224
|
-
y !== h[4] ? (h[5] = 0, h[6] = 0) : E !== h[5] && (h[6] = 0), h[4] = l(s, y, h[4]), h[5] = l(s, E, h[5]), h[6] = l(s, A, h[6]);
|
|
225
|
-
}
|
|
226
|
-
if (x)
|
|
227
|
-
for (let y of x) {
|
|
228
|
-
y.length > 1 && l(s, -y.length, 0);
|
|
229
|
-
let E = y[0][0];
|
|
230
|
-
l(s, E, 0);
|
|
231
|
-
let A = m, Y = _;
|
|
232
|
-
for (let G = 1; G < y.length; G++) {
|
|
233
|
-
let K = y[G];
|
|
234
|
-
A = l(s, K[1], A), Y = l(s, K[2], Y), l(s, K[0], 0);
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
for (a++; a < f.length; ) {
|
|
238
|
-
let y = f[a], { 0: E, 1: A } = y;
|
|
239
|
-
if (E > b || E === b && A >= S)
|
|
240
|
-
break;
|
|
241
|
-
a = T(f, a, s, h);
|
|
242
|
-
}
|
|
243
|
-
return h[0] < b ? (v(s, h[0], b), h[0] = b, h[1] = 0) : s.write(44), h[1] = l(s, S, h[1]), a;
|
|
244
|
-
}
|
|
245
|
-
d(T, "_encodeGeneratedRanges");
|
|
246
|
-
function v(f, a, s) {
|
|
247
|
-
do
|
|
248
|
-
f.write(59);
|
|
249
|
-
while (++a < s);
|
|
250
|
-
}
|
|
251
|
-
d(v, "catchupLine");
|
|
252
|
-
function N(f) {
|
|
253
|
-
let { length: a } = f, s = new W(f), h = [], g = 0, m = 0, _ = 0, b = 0, S = 0;
|
|
254
|
-
do {
|
|
255
|
-
let C = s.indexOf(";"), w = [], x = !0, k = 0;
|
|
256
|
-
for (g = 0; s.pos < C; ) {
|
|
257
|
-
let y;
|
|
258
|
-
g = r(s, g), g < k && (x = !1), k = g, u(s, C) ? (m = r(s, m), _ = r(s, _), b = r(s, b), u(s, C) ? (S = r(s, S), y = [g, m, _, b, S]) :
|
|
259
|
-
y = [g, m, _, b]) : y = [g], w.push(y), s.pos++;
|
|
260
|
-
}
|
|
261
|
-
x || B(w), h.push(w), s.pos = C + 1;
|
|
262
|
-
} while (s.pos <= a);
|
|
263
|
-
return h;
|
|
264
|
-
}
|
|
265
|
-
d(N, "decode");
|
|
266
|
-
function B(f) {
|
|
267
|
-
f.sort(F);
|
|
268
|
-
}
|
|
269
|
-
d(B, "sort");
|
|
270
|
-
function F(f, a) {
|
|
271
|
-
return f[0] - a[0];
|
|
272
|
-
}
|
|
273
|
-
d(F, "sortComparator");
|
|
274
|
-
function dt(f) {
|
|
275
|
-
let a = new D(), s = 0, h = 0, g = 0, m = 0;
|
|
276
|
-
for (let _ = 0; _ < f.length; _++) {
|
|
277
|
-
let b = f[_];
|
|
278
|
-
if (_ > 0 && a.write(59), b.length === 0)
|
|
279
|
-
continue;
|
|
280
|
-
let S = 0;
|
|
281
|
-
for (let C = 0; C < b.length; C++) {
|
|
282
|
-
let w = b[C];
|
|
283
|
-
C > 0 && a.write(44), S = l(a, w[0], S), w.length !== 1 && (s = l(a, w[1], s), h = l(a, w[2], h), g = l(a, w[3], g), w.length !== 4 &&
|
|
284
|
-
(m = l(a, w[4], m)));
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
return a.flush();
|
|
288
|
-
}
|
|
289
|
-
d(dt, "encode"), c.decode = N, c.decodeGeneratedRanges = j, c.decodeOriginalScopes = P, c.encode = dt, c.encodeGeneratedRanges = $, c.encodeOriginalScopes =
|
|
290
|
-
I, Object.defineProperty(c, "__esModule", { value: !0 });
|
|
291
|
-
});
|
|
292
|
-
});
|
|
10
|
+
// ../node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs
|
|
11
|
+
var W = 44, G = 59, R = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", j = new Uint8Array(64), K = new Uint8Array(128);
|
|
12
|
+
for (let l = 0; l < R.length; l++) {
|
|
13
|
+
let t = R.charCodeAt(l);
|
|
14
|
+
j[l] = t, K[t] = l;
|
|
15
|
+
}
|
|
16
|
+
function w(l, t, e) {
|
|
17
|
+
let i = t - e;
|
|
18
|
+
i = i < 0 ? -i << 1 | 1 : i << 1;
|
|
19
|
+
do {
|
|
20
|
+
let n = i & 31;
|
|
21
|
+
i >>>= 5, i > 0 && (n |= 32), l.write(j[n]);
|
|
22
|
+
} while (i > 0);
|
|
23
|
+
return t;
|
|
24
|
+
}
|
|
25
|
+
u(w, "encodeInteger");
|
|
26
|
+
var A = 1024 * 16, D = typeof TextDecoder < "u" ? /* @__PURE__ */ new TextDecoder() : typeof Buffer < "u" ? {
|
|
27
|
+
decode(l) {
|
|
28
|
+
return Buffer.from(l.buffer, l.byteOffset, l.byteLength).toString();
|
|
29
|
+
}
|
|
30
|
+
} : {
|
|
31
|
+
decode(l) {
|
|
32
|
+
let t = "";
|
|
33
|
+
for (let e = 0; e < l.length; e++)
|
|
34
|
+
t += String.fromCharCode(l[e]);
|
|
35
|
+
return t;
|
|
36
|
+
}
|
|
37
|
+
}, z = class {
|
|
38
|
+
static {
|
|
39
|
+
u(this, "StringWriter");
|
|
40
|
+
}
|
|
41
|
+
constructor() {
|
|
42
|
+
this.pos = 0, this.out = "", this.buffer = new Uint8Array(A);
|
|
43
|
+
}
|
|
44
|
+
write(l) {
|
|
45
|
+
let { buffer: t } = this;
|
|
46
|
+
t[this.pos++] = l, this.pos === A && (this.out += D.decode(t), this.pos = 0);
|
|
47
|
+
}
|
|
48
|
+
flush() {
|
|
49
|
+
let { buffer: l, out: t, pos: e } = this;
|
|
50
|
+
return e > 0 ? t + D.decode(l.subarray(0, e)) : t;
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
function M(l) {
|
|
54
|
+
let t = new z(), e = 0, i = 0, n = 0, r = 0;
|
|
55
|
+
for (let s = 0; s < l.length; s++) {
|
|
56
|
+
let o = l[s];
|
|
57
|
+
if (s > 0 && t.write(G), o.length === 0) continue;
|
|
58
|
+
let a = 0;
|
|
59
|
+
for (let h = 0; h < o.length; h++) {
|
|
60
|
+
let f = o[h];
|
|
61
|
+
h > 0 && t.write(W), a = w(t, f[0], a), f.length !== 1 && (e = w(t, f[1], e), i = w(t, f[2], i), n = w(t, f[3], n), f.length !== 4 && (r =
|
|
62
|
+
w(t, f[4], r)));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return t.flush();
|
|
66
|
+
}
|
|
67
|
+
u(M, "encode");
|
|
293
68
|
|
|
294
69
|
// ../node_modules/magic-string/dist/magic-string.es.mjs
|
|
295
|
-
var
|
|
296
|
-
var Q = class c {
|
|
70
|
+
var E = class l {
|
|
297
71
|
static {
|
|
298
|
-
|
|
72
|
+
u(this, "BitSet");
|
|
299
73
|
}
|
|
300
74
|
constructor(t) {
|
|
301
|
-
this.bits = t instanceof
|
|
75
|
+
this.bits = t instanceof l ? t.bits.slice() : [];
|
|
302
76
|
}
|
|
303
77
|
add(t) {
|
|
304
78
|
this.bits[t >> 5] |= 1 << (t & 31);
|
|
@@ -306,9 +80,9 @@ var Q = class c {
|
|
|
306
80
|
has(t) {
|
|
307
81
|
return !!(this.bits[t >> 5] & 1 << (t & 31));
|
|
308
82
|
}
|
|
309
|
-
},
|
|
83
|
+
}, I = class l {
|
|
310
84
|
static {
|
|
311
|
-
|
|
85
|
+
u(this, "Chunk");
|
|
312
86
|
}
|
|
313
87
|
constructor(t, e, i) {
|
|
314
88
|
this.start = t, this.end = e, this.original = i, this.intro = "", this.outro = "", this.content = i, this.storeName = !1, this.edited = !1,
|
|
@@ -321,7 +95,7 @@ var Q = class c {
|
|
|
321
95
|
this.intro = this.intro + t;
|
|
322
96
|
}
|
|
323
97
|
clone() {
|
|
324
|
-
let t = new
|
|
98
|
+
let t = new l(this.start, this.end, this.original);
|
|
325
99
|
return t.intro = this.intro, t.outro = this.outro, t.content = this.content, t.storeName = this.storeName, t.edited = this.edited, t;
|
|
326
100
|
}
|
|
327
101
|
contains(t) {
|
|
@@ -352,9 +126,9 @@ var Q = class c {
|
|
|
352
126
|
split(t) {
|
|
353
127
|
let e = t - this.start, i = this.original.slice(0, e), n = this.original.slice(e);
|
|
354
128
|
this.original = i;
|
|
355
|
-
let
|
|
356
|
-
return
|
|
357
|
-
this.next,
|
|
129
|
+
let r = new l(t, this.end, n);
|
|
130
|
+
return r.outro = this.outro, this.outro = "", this.end = t, this.edited ? (r.edit("", !1), this.content = "") : this.content = i, r.next =
|
|
131
|
+
this.next, r.next && (r.next.previous = r), r.previous = this, this.next = r, r;
|
|
358
132
|
}
|
|
359
133
|
toString() {
|
|
360
134
|
return this.intro + this.content + this.outro;
|
|
@@ -379,45 +153,45 @@ var Q = class c {
|
|
|
379
153
|
} else if (this.edit("", void 0, !0), this.outro = this.outro.replace(t, ""), this.outro.length) return !0;
|
|
380
154
|
}
|
|
381
155
|
};
|
|
382
|
-
function
|
|
383
|
-
return typeof globalThis < "u" && typeof globalThis.btoa == "function" ? (
|
|
384
|
-
"function" ? (
|
|
156
|
+
function H() {
|
|
157
|
+
return typeof globalThis < "u" && typeof globalThis.btoa == "function" ? (l) => globalThis.btoa(unescape(encodeURIComponent(l))) : typeof Buffer ==
|
|
158
|
+
"function" ? (l) => Buffer.from(l, "utf-8").toString("base64") : () => {
|
|
385
159
|
throw new Error("Unsupported environment: `window.btoa` or `Buffer` should be supported.");
|
|
386
160
|
};
|
|
387
161
|
}
|
|
388
|
-
|
|
389
|
-
var
|
|
162
|
+
u(H, "getBtoa");
|
|
163
|
+
var V = /* @__PURE__ */ H(), P = class {
|
|
390
164
|
static {
|
|
391
|
-
|
|
165
|
+
u(this, "SourceMap");
|
|
392
166
|
}
|
|
393
167
|
constructor(t) {
|
|
394
168
|
this.version = 3, this.file = t.file, this.sources = t.sources, this.sourcesContent = t.sourcesContent, this.names = t.names, this.mappings =
|
|
395
|
-
(
|
|
396
|
-
|
|
169
|
+
M(t.mappings), typeof t.x_google_ignoreList < "u" && (this.x_google_ignoreList = t.x_google_ignoreList), typeof t.debugId < "u" && (this.
|
|
170
|
+
debugId = t.debugId);
|
|
397
171
|
}
|
|
398
172
|
toString() {
|
|
399
173
|
return JSON.stringify(this);
|
|
400
174
|
}
|
|
401
175
|
toUrl() {
|
|
402
|
-
return "data:application/json;charset=utf-8;base64," +
|
|
176
|
+
return "data:application/json;charset=utf-8;base64," + V(this.toString());
|
|
403
177
|
}
|
|
404
178
|
};
|
|
405
|
-
function
|
|
406
|
-
let t =
|
|
407
|
-
`), e = t.filter((
|
|
179
|
+
function Y(l) {
|
|
180
|
+
let t = l.split(`
|
|
181
|
+
`), e = t.filter((r) => /^\t+/.test(r)), i = t.filter((r) => /^ {2,}/.test(r));
|
|
408
182
|
if (e.length === 0 && i.length === 0)
|
|
409
183
|
return null;
|
|
410
184
|
if (e.length >= i.length)
|
|
411
185
|
return " ";
|
|
412
|
-
let n = i.reduce((
|
|
413
|
-
let
|
|
414
|
-
return Math.min(
|
|
186
|
+
let n = i.reduce((r, s) => {
|
|
187
|
+
let o = /^ +/.exec(s)[0].length;
|
|
188
|
+
return Math.min(o, r);
|
|
415
189
|
}, 1 / 0);
|
|
416
190
|
return new Array(n + 1).join(" ");
|
|
417
191
|
}
|
|
418
|
-
|
|
419
|
-
function
|
|
420
|
-
let e =
|
|
192
|
+
u(Y, "guessIndent");
|
|
193
|
+
function J(l, t) {
|
|
194
|
+
let e = l.split(/[/\\]/), i = t.split(/[/\\]/);
|
|
421
195
|
for (e.pop(); e[0] === i[0]; )
|
|
422
196
|
e.shift(), i.shift();
|
|
423
197
|
if (e.length) {
|
|
@@ -426,31 +200,31 @@ function It(c, t) {
|
|
|
426
200
|
}
|
|
427
201
|
return e.concat(i).join("/");
|
|
428
202
|
}
|
|
429
|
-
|
|
430
|
-
var
|
|
431
|
-
function
|
|
432
|
-
return
|
|
203
|
+
u(J, "getRelativePath");
|
|
204
|
+
var Q = Object.prototype.toString;
|
|
205
|
+
function X(l) {
|
|
206
|
+
return Q.call(l) === "[object Object]";
|
|
433
207
|
}
|
|
434
|
-
|
|
435
|
-
function
|
|
436
|
-
let t =
|
|
208
|
+
u(X, "isObject");
|
|
209
|
+
function $(l) {
|
|
210
|
+
let t = l.split(`
|
|
437
211
|
`), e = [];
|
|
438
212
|
for (let i = 0, n = 0; i < t.length; i++)
|
|
439
213
|
e.push(n), n += t[i].length + 1;
|
|
440
|
-
return /* @__PURE__ */
|
|
441
|
-
let
|
|
442
|
-
for (;
|
|
443
|
-
let
|
|
444
|
-
n < e[
|
|
445
|
-
}
|
|
446
|
-
let
|
|
447
|
-
return { line:
|
|
214
|
+
return /* @__PURE__ */ u(function(n) {
|
|
215
|
+
let r = 0, s = e.length;
|
|
216
|
+
for (; r < s; ) {
|
|
217
|
+
let h = r + s >> 1;
|
|
218
|
+
n < e[h] ? s = h : r = h + 1;
|
|
219
|
+
}
|
|
220
|
+
let o = r - 1, a = n - e[o];
|
|
221
|
+
return { line: o, column: a };
|
|
448
222
|
}, "locate");
|
|
449
223
|
}
|
|
450
|
-
|
|
451
|
-
var
|
|
224
|
+
u($, "getLocator");
|
|
225
|
+
var Z = /\w/, O = class {
|
|
452
226
|
static {
|
|
453
|
-
|
|
227
|
+
u(this, "Mappings");
|
|
454
228
|
}
|
|
455
229
|
constructor(t) {
|
|
456
230
|
this.hires = t, this.generatedCodeLine = 0, this.generatedCodeColumn = 0, this.raw = [], this.rawSegments = this.raw[this.generatedCodeLine] =
|
|
@@ -458,35 +232,35 @@ var Nt = /\w/, st = class {
|
|
|
458
232
|
}
|
|
459
233
|
addEdit(t, e, i, n) {
|
|
460
234
|
if (e.length) {
|
|
461
|
-
let
|
|
462
|
-
`, 0),
|
|
463
|
-
for (;
|
|
464
|
-
let
|
|
465
|
-
n >= 0 &&
|
|
466
|
-
this.generatedCodeColumn = 0,
|
|
467
|
-
`,
|
|
235
|
+
let r = e.length - 1, s = e.indexOf(`
|
|
236
|
+
`, 0), o = -1;
|
|
237
|
+
for (; s >= 0 && r > s; ) {
|
|
238
|
+
let h = [this.generatedCodeColumn, t, i.line, i.column];
|
|
239
|
+
n >= 0 && h.push(n), this.rawSegments.push(h), this.generatedCodeLine += 1, this.raw[this.generatedCodeLine] = this.rawSegments = [],
|
|
240
|
+
this.generatedCodeColumn = 0, o = s, s = e.indexOf(`
|
|
241
|
+
`, s + 1);
|
|
468
242
|
}
|
|
469
|
-
let
|
|
470
|
-
n >= 0 &&
|
|
243
|
+
let a = [this.generatedCodeColumn, t, i.line, i.column];
|
|
244
|
+
n >= 0 && a.push(n), this.rawSegments.push(a), this.advance(e.slice(o + 1));
|
|
471
245
|
} else this.pending && (this.rawSegments.push(this.pending), this.advance(e));
|
|
472
246
|
this.pending = null;
|
|
473
247
|
}
|
|
474
|
-
addUneditedChunk(t, e, i, n,
|
|
475
|
-
let
|
|
476
|
-
for (;
|
|
477
|
-
if (i[
|
|
248
|
+
addUneditedChunk(t, e, i, n, r) {
|
|
249
|
+
let s = e.start, o = !0, a = !1;
|
|
250
|
+
for (; s < e.end; ) {
|
|
251
|
+
if (i[s] === `
|
|
478
252
|
`)
|
|
479
253
|
n.line += 1, n.column = 0, this.generatedCodeLine += 1, this.raw[this.generatedCodeLine] = this.rawSegments = [], this.generatedCodeColumn =
|
|
480
|
-
0,
|
|
254
|
+
0, o = !0, a = !1;
|
|
481
255
|
else {
|
|
482
|
-
if (this.hires ||
|
|
483
|
-
let
|
|
484
|
-
this.hires === "boundary" ?
|
|
485
|
-
push(
|
|
256
|
+
if (this.hires || o || r.has(s)) {
|
|
257
|
+
let h = [this.generatedCodeColumn, t, n.line, n.column];
|
|
258
|
+
this.hires === "boundary" ? Z.test(i[s]) ? a || (this.rawSegments.push(h), a = !0) : (this.rawSegments.push(h), a = !1) : this.rawSegments.
|
|
259
|
+
push(h);
|
|
486
260
|
}
|
|
487
|
-
n.column += 1, this.generatedCodeColumn += 1,
|
|
261
|
+
n.column += 1, this.generatedCodeColumn += 1, o = !1;
|
|
488
262
|
}
|
|
489
|
-
|
|
263
|
+
s += 1;
|
|
490
264
|
}
|
|
491
265
|
this.pending = null;
|
|
492
266
|
}
|
|
@@ -501,17 +275,17 @@ var Nt = /\w/, st = class {
|
|
|
501
275
|
}
|
|
502
276
|
this.generatedCodeColumn += e[e.length - 1].length;
|
|
503
277
|
}
|
|
504
|
-
},
|
|
505
|
-
`,
|
|
278
|
+
}, _ = `
|
|
279
|
+
`, b = {
|
|
506
280
|
insertLeft: !1,
|
|
507
281
|
insertRight: !1,
|
|
508
282
|
storeName: !1
|
|
509
|
-
},
|
|
283
|
+
}, L = class l {
|
|
510
284
|
static {
|
|
511
|
-
|
|
285
|
+
u(this, "MagicString");
|
|
512
286
|
}
|
|
513
287
|
constructor(t, e = {}) {
|
|
514
|
-
let i = new
|
|
288
|
+
let i = new I(0, t.length, t);
|
|
515
289
|
Object.defineProperties(this, {
|
|
516
290
|
original: { writable: !0, value: t },
|
|
517
291
|
outro: { writable: !0, value: "" },
|
|
@@ -523,7 +297,7 @@ var Nt = /\w/, st = class {
|
|
|
523
297
|
byEnd: { writable: !0, value: {} },
|
|
524
298
|
filename: { writable: !0, value: e.filename },
|
|
525
299
|
indentExclusionRanges: { writable: !0, value: e.indentExclusionRanges },
|
|
526
|
-
sourcemapLocations: { writable: !0, value: new
|
|
300
|
+
sourcemapLocations: { writable: !0, value: new E() },
|
|
527
301
|
storedNames: { writable: !0, value: {} },
|
|
528
302
|
indentStr: { writable: !0, value: void 0 },
|
|
529
303
|
ignoreList: { writable: !0, value: e.ignoreList },
|
|
@@ -550,31 +324,31 @@ var Nt = /\w/, st = class {
|
|
|
550
324
|
return i ? i.appendRight(e) : this.outro += e, this;
|
|
551
325
|
}
|
|
552
326
|
clone() {
|
|
553
|
-
let t = new
|
|
327
|
+
let t = new l(this.original, { filename: this.filename, offset: this.offset }), e = this.firstChunk, i = t.firstChunk = t.lastSearchedChunk =
|
|
554
328
|
e.clone();
|
|
555
329
|
for (; e; ) {
|
|
556
330
|
t.byStart[i.start] = i, t.byEnd[i.end] = i;
|
|
557
|
-
let n = e.next,
|
|
558
|
-
|
|
331
|
+
let n = e.next, r = n && n.clone();
|
|
332
|
+
r && (i.next = r, r.previous = i, i = r), e = n;
|
|
559
333
|
}
|
|
560
334
|
return t.lastChunk = i, this.indentExclusionRanges && (t.indentExclusionRanges = this.indentExclusionRanges.slice()), t.sourcemapLocations =
|
|
561
|
-
new
|
|
335
|
+
new E(this.sourcemapLocations), t.intro = this.intro, t.outro = this.outro, t;
|
|
562
336
|
}
|
|
563
337
|
generateDecodedMap(t) {
|
|
564
338
|
t = t || {};
|
|
565
|
-
let e = 0, i = Object.keys(this.storedNames), n = new
|
|
566
|
-
return this.intro && n.advance(this.intro), this.firstChunk.eachNext((
|
|
567
|
-
let
|
|
568
|
-
|
|
339
|
+
let e = 0, i = Object.keys(this.storedNames), n = new O(t.hires), r = $(this.original);
|
|
340
|
+
return this.intro && n.advance(this.intro), this.firstChunk.eachNext((s) => {
|
|
341
|
+
let o = r(s.start);
|
|
342
|
+
s.intro.length && n.advance(s.intro), s.edited ? n.addEdit(
|
|
569
343
|
e,
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
) : n.addUneditedChunk(e,
|
|
574
|
-
}), {
|
|
344
|
+
s.content,
|
|
345
|
+
o,
|
|
346
|
+
s.storeName ? i.indexOf(s.original) : -1
|
|
347
|
+
) : n.addUneditedChunk(e, s, this.original, o, this.sourcemapLocations), s.outro.length && n.advance(s.outro);
|
|
348
|
+
}), this.outro && n.advance(this.outro), {
|
|
575
349
|
file: t.file ? t.file.split(/[/\\]/).pop() : void 0,
|
|
576
350
|
sources: [
|
|
577
|
-
t.source ?
|
|
351
|
+
t.source ? J(t.file || "", t.source) : t.file || ""
|
|
578
352
|
],
|
|
579
353
|
sourcesContent: t.includeContent ? [this.original] : void 0,
|
|
580
354
|
names: i,
|
|
@@ -583,10 +357,10 @@ var Nt = /\w/, st = class {
|
|
|
583
357
|
};
|
|
584
358
|
}
|
|
585
359
|
generateMap(t) {
|
|
586
|
-
return new
|
|
360
|
+
return new P(this.generateDecodedMap(t));
|
|
587
361
|
}
|
|
588
362
|
_ensureindentStr() {
|
|
589
|
-
this.indentStr === void 0 && (this.indentStr =
|
|
363
|
+
this.indentStr === void 0 && (this.indentStr = Y(this.original));
|
|
590
364
|
}
|
|
591
365
|
_getRawIndentString() {
|
|
592
366
|
return this._ensureindentStr(), this.indentStr;
|
|
@@ -596,33 +370,33 @@ var Nt = /\w/, st = class {
|
|
|
596
370
|
}
|
|
597
371
|
indent(t, e) {
|
|
598
372
|
let i = /^[^\r\n]/gm;
|
|
599
|
-
if (
|
|
373
|
+
if (X(t) && (e = t, t = void 0), t === void 0 && (this._ensureindentStr(), t = this.indentStr || " "), t === "") return this;
|
|
600
374
|
e = e || {};
|
|
601
375
|
let n = {};
|
|
602
|
-
e.exclude && (typeof e.exclude[0] == "number" ? [e.exclude] : e.exclude).forEach((
|
|
603
|
-
for (let
|
|
604
|
-
n[
|
|
376
|
+
e.exclude && (typeof e.exclude[0] == "number" ? [e.exclude] : e.exclude).forEach((f) => {
|
|
377
|
+
for (let C = f[0]; C < f[1]; C += 1)
|
|
378
|
+
n[C] = !0;
|
|
605
379
|
});
|
|
606
|
-
let
|
|
607
|
-
this.intro = this.intro.replace(i,
|
|
608
|
-
let
|
|
609
|
-
for (;
|
|
610
|
-
let
|
|
611
|
-
if (
|
|
612
|
-
n[
|
|
380
|
+
let r = e.indentStart !== !1, s = /* @__PURE__ */ u((h) => r ? `${t}${h}` : (r = !0, h), "replacer");
|
|
381
|
+
this.intro = this.intro.replace(i, s);
|
|
382
|
+
let o = 0, a = this.firstChunk;
|
|
383
|
+
for (; a; ) {
|
|
384
|
+
let h = a.end;
|
|
385
|
+
if (a.edited)
|
|
386
|
+
n[o] || (a.content = a.content.replace(i, s), a.content.length && (r = a.content[a.content.length - 1] === `
|
|
613
387
|
`));
|
|
614
388
|
else
|
|
615
|
-
for (
|
|
616
|
-
if (!n[
|
|
617
|
-
let
|
|
618
|
-
|
|
619
|
-
` ?
|
|
389
|
+
for (o = a.start; o < h; ) {
|
|
390
|
+
if (!n[o]) {
|
|
391
|
+
let f = this.original[o];
|
|
392
|
+
f === `
|
|
393
|
+
` ? r = !0 : f !== "\r" && r && (r = !1, o === a.start || (this._splitChunk(a, o), a = a.next), a.prependRight(t));
|
|
620
394
|
}
|
|
621
|
-
|
|
395
|
+
o += 1;
|
|
622
396
|
}
|
|
623
|
-
|
|
397
|
+
o = a.end, a = a.next;
|
|
624
398
|
}
|
|
625
|
-
return this.outro = this.outro.replace(i,
|
|
399
|
+
return this.outro = this.outro.replace(i, s), this;
|
|
626
400
|
}
|
|
627
401
|
insert() {
|
|
628
402
|
throw new Error(
|
|
@@ -630,25 +404,25 @@ var Nt = /\w/, st = class {
|
|
|
630
404
|
);
|
|
631
405
|
}
|
|
632
406
|
insertLeft(t, e) {
|
|
633
|
-
return
|
|
407
|
+
return b.insertLeft || (console.warn(
|
|
634
408
|
"magicString.insertLeft(...) is deprecated. Use magicString.appendLeft(...) instead"
|
|
635
|
-
),
|
|
409
|
+
), b.insertLeft = !0), this.appendLeft(t, e);
|
|
636
410
|
}
|
|
637
411
|
insertRight(t, e) {
|
|
638
|
-
return
|
|
412
|
+
return b.insertRight || (console.warn(
|
|
639
413
|
"magicString.insertRight(...) is deprecated. Use magicString.prependRight(...) instead"
|
|
640
|
-
),
|
|
414
|
+
), b.insertRight = !0), this.prependRight(t, e);
|
|
641
415
|
}
|
|
642
416
|
move(t, e, i) {
|
|
643
417
|
if (t = t + this.offset, e = e + this.offset, i = i + this.offset, i >= t && i <= e) throw new Error("Cannot move a selection inside its\
|
|
644
418
|
elf");
|
|
645
419
|
this._split(t), this._split(e), this._split(i);
|
|
646
|
-
let n = this.byStart[t],
|
|
647
|
-
if (!
|
|
648
|
-
let
|
|
649
|
-
return
|
|
650
|
-
(this.lastChunk = n.previous, this.lastChunk.next = null), n.previous =
|
|
651
|
-
|
|
420
|
+
let n = this.byStart[t], r = this.byEnd[e], s = n.previous, o = r.next, a = this.byStart[i];
|
|
421
|
+
if (!a && r === this.lastChunk) return this;
|
|
422
|
+
let h = a ? a.previous : this.lastChunk;
|
|
423
|
+
return s && (s.next = o), o && (o.previous = s), h && (h.next = n), a && (a.previous = r), n.previous || (this.firstChunk = r.next), r.next ||
|
|
424
|
+
(this.lastChunk = n.previous, this.lastChunk.next = null), n.previous = h, r.next = a || null, h || (this.firstChunk = n), a || (this.lastChunk =
|
|
425
|
+
r), this;
|
|
652
426
|
}
|
|
653
427
|
overwrite(t, e, i, n) {
|
|
654
428
|
return n = n || {}, this.update(t, e, i, { ...n, overwrite: !n.contentOnly });
|
|
@@ -664,30 +438,30 @@ elf");
|
|
|
664
438
|
throw new Error(
|
|
665
439
|
"Cannot overwrite a zero-length range \u2013 use appendLeft or prependRight instead"
|
|
666
440
|
);
|
|
667
|
-
this._split(t), this._split(e), n === !0 && (
|
|
441
|
+
this._split(t), this._split(e), n === !0 && (b.storeName || (console.warn(
|
|
668
442
|
"The final argument to magicString.overwrite(...) should be an options object. See https://github.com/rich-harris/magic-string"
|
|
669
|
-
),
|
|
670
|
-
let
|
|
671
|
-
if (
|
|
672
|
-
let
|
|
673
|
-
Object.defineProperty(this.storedNames,
|
|
443
|
+
), b.storeName = !0), n = { storeName: !0 });
|
|
444
|
+
let r = n !== void 0 ? n.storeName : !1, s = n !== void 0 ? n.overwrite : !1;
|
|
445
|
+
if (r) {
|
|
446
|
+
let h = this.original.slice(t, e);
|
|
447
|
+
Object.defineProperty(this.storedNames, h, {
|
|
674
448
|
writable: !0,
|
|
675
449
|
value: !0,
|
|
676
450
|
enumerable: !0
|
|
677
451
|
});
|
|
678
452
|
}
|
|
679
|
-
let
|
|
680
|
-
if (
|
|
681
|
-
let
|
|
682
|
-
for (;
|
|
683
|
-
if (
|
|
453
|
+
let o = this.byStart[t], a = this.byEnd[e];
|
|
454
|
+
if (o) {
|
|
455
|
+
let h = o;
|
|
456
|
+
for (; h !== a; ) {
|
|
457
|
+
if (h.next !== this.byStart[h.end])
|
|
684
458
|
throw new Error("Cannot overwrite across a split point");
|
|
685
|
-
|
|
459
|
+
h = h.next, h.edit("", !1);
|
|
686
460
|
}
|
|
687
|
-
|
|
461
|
+
o.edit(i, r, !s);
|
|
688
462
|
} else {
|
|
689
|
-
let
|
|
690
|
-
|
|
463
|
+
let h = new I(t, e, "").edit(i, r);
|
|
464
|
+
a.next = h, h.previous = a;
|
|
691
465
|
}
|
|
692
466
|
return this;
|
|
693
467
|
}
|
|
@@ -746,24 +520,24 @@ elf");
|
|
|
746
520
|
return this.intro.length ? this.intro[this.intro.length - 1] : "";
|
|
747
521
|
}
|
|
748
522
|
lastLine() {
|
|
749
|
-
let t = this.outro.lastIndexOf(
|
|
523
|
+
let t = this.outro.lastIndexOf(_);
|
|
750
524
|
if (t !== -1) return this.outro.substr(t + 1);
|
|
751
525
|
let e = this.outro, i = this.lastChunk;
|
|
752
526
|
do {
|
|
753
527
|
if (i.outro.length > 0) {
|
|
754
|
-
if (t = i.outro.lastIndexOf(
|
|
528
|
+
if (t = i.outro.lastIndexOf(_), t !== -1) return i.outro.substr(t + 1) + e;
|
|
755
529
|
e = i.outro + e;
|
|
756
530
|
}
|
|
757
531
|
if (i.content.length > 0) {
|
|
758
|
-
if (t = i.content.lastIndexOf(
|
|
532
|
+
if (t = i.content.lastIndexOf(_), t !== -1) return i.content.substr(t + 1) + e;
|
|
759
533
|
e = i.content + e;
|
|
760
534
|
}
|
|
761
535
|
if (i.intro.length > 0) {
|
|
762
|
-
if (t = i.intro.lastIndexOf(
|
|
536
|
+
if (t = i.intro.lastIndexOf(_), t !== -1) return i.intro.substr(t + 1) + e;
|
|
763
537
|
e = i.intro + e;
|
|
764
538
|
}
|
|
765
539
|
} while (i = i.previous);
|
|
766
|
-
return t = this.intro.lastIndexOf(
|
|
540
|
+
return t = this.intro.lastIndexOf(_), t !== -1 ? this.intro.substr(t + 1) + e : this.intro + e;
|
|
767
541
|
}
|
|
768
542
|
slice(t = 0, e = this.original.length - this.offset) {
|
|
769
543
|
if (t = t + this.offset, e = e + this.offset, this.original.length !== 0) {
|
|
@@ -778,14 +552,14 @@ elf");
|
|
|
778
552
|
}
|
|
779
553
|
if (n && n.edited && n.start !== t)
|
|
780
554
|
throw new Error(`Cannot use replaced character ${t} as slice start anchor.`);
|
|
781
|
-
let
|
|
555
|
+
let r = n;
|
|
782
556
|
for (; n; ) {
|
|
783
|
-
n.intro && (
|
|
784
|
-
let
|
|
785
|
-
if (
|
|
557
|
+
n.intro && (r !== n || n.start === t) && (i += n.intro);
|
|
558
|
+
let s = n.start < e && n.end >= e;
|
|
559
|
+
if (s && n.edited && n.end !== e)
|
|
786
560
|
throw new Error(`Cannot use replaced character ${e} as slice end anchor.`);
|
|
787
|
-
let
|
|
788
|
-
if (i += n.content.slice(
|
|
561
|
+
let o = r === n ? t - n.start : 0, a = s ? n.content.length + e - n.end : n.content.length;
|
|
562
|
+
if (i += n.content.slice(o, a), n.outro && (!s || n.end === e) && (i += n.outro), s)
|
|
789
563
|
break;
|
|
790
564
|
n = n.next;
|
|
791
565
|
}
|
|
@@ -798,15 +572,16 @@ elf");
|
|
|
798
572
|
}
|
|
799
573
|
_split(t) {
|
|
800
574
|
if (this.byStart[t] || this.byEnd[t]) return;
|
|
801
|
-
let e = this.lastSearchedChunk, i = t > e.end;
|
|
575
|
+
let e = this.lastSearchedChunk, i = e, n = t > e.end;
|
|
802
576
|
for (; e; ) {
|
|
803
577
|
if (e.contains(t)) return this._splitChunk(e, t);
|
|
804
|
-
e =
|
|
578
|
+
if (e = n ? this.byStart[e.end] : this.byEnd[e.start], e === i) return;
|
|
579
|
+
i = e;
|
|
805
580
|
}
|
|
806
581
|
}
|
|
807
582
|
_splitChunk(t, e) {
|
|
808
583
|
if (t.edited && t.content.length) {
|
|
809
|
-
let n =
|
|
584
|
+
let n = $(this.original)(e);
|
|
810
585
|
throw new Error(
|
|
811
586
|
`Cannot split a chunk that has already been edited (${n.line}:${n.column} \u2013 "${t.original}")`
|
|
812
587
|
);
|
|
@@ -847,9 +622,9 @@ elf");
|
|
|
847
622
|
if (this.outro = this.outro.replace(e, ""), this.outro.length) return !0;
|
|
848
623
|
let i = this.lastChunk;
|
|
849
624
|
do {
|
|
850
|
-
let n = i.end,
|
|
625
|
+
let n = i.end, r = i.trimEnd(e);
|
|
851
626
|
if (i.end !== n && (this.lastChunk === i && (this.lastChunk = i.next), this.byEnd[i.end] = i, this.byStart[i.next.start] = i.next, this.
|
|
852
|
-
byEnd[i.next.end] = i.next),
|
|
627
|
+
byEnd[i.next.end] = i.next), r) return !0;
|
|
853
628
|
i = i.previous;
|
|
854
629
|
} while (i);
|
|
855
630
|
return !1;
|
|
@@ -862,9 +637,9 @@ elf");
|
|
|
862
637
|
if (this.intro = this.intro.replace(e, ""), this.intro.length) return !0;
|
|
863
638
|
let i = this.firstChunk;
|
|
864
639
|
do {
|
|
865
|
-
let n = i.end,
|
|
640
|
+
let n = i.end, r = i.trimStart(e);
|
|
866
641
|
if (i.end !== n && (i === this.lastChunk && (this.lastChunk = i.next), this.byEnd[i.end] = i, this.byStart[i.next.start] = i.next, this.
|
|
867
|
-
byEnd[i.next.end] = i.next),
|
|
642
|
+
byEnd[i.next.end] = i.next), r) return !0;
|
|
868
643
|
i = i.next;
|
|
869
644
|
} while (i);
|
|
870
645
|
return !1;
|
|
@@ -876,44 +651,46 @@ elf");
|
|
|
876
651
|
return this.original !== this.toString();
|
|
877
652
|
}
|
|
878
653
|
_replaceRegexp(t, e) {
|
|
879
|
-
function i(
|
|
880
|
-
return typeof e == "string" ? e.replace(/\$(\$|&|\d+)/g, (
|
|
881
|
-
e(...
|
|
882
|
-
}
|
|
883
|
-
|
|
884
|
-
function n(
|
|
885
|
-
let
|
|
886
|
-
for (;
|
|
887
|
-
|
|
888
|
-
return
|
|
654
|
+
function i(r, s) {
|
|
655
|
+
return typeof e == "string" ? e.replace(/\$(\$|&|\d+)/g, (o, a) => a === "$" ? "$" : a === "&" ? r[0] : +a < r.length ? r[+a] : `$${a}`) :
|
|
656
|
+
e(...r, r.index, s, r.groups);
|
|
657
|
+
}
|
|
658
|
+
u(i, "getReplacement");
|
|
659
|
+
function n(r, s) {
|
|
660
|
+
let o, a = [];
|
|
661
|
+
for (; o = r.exec(s); )
|
|
662
|
+
a.push(o);
|
|
663
|
+
return a;
|
|
889
664
|
}
|
|
890
|
-
if (
|
|
891
|
-
n(t, this.original).forEach((
|
|
892
|
-
if (
|
|
893
|
-
let
|
|
894
|
-
|
|
665
|
+
if (u(n, "matchAll"), t.global)
|
|
666
|
+
n(t, this.original).forEach((s) => {
|
|
667
|
+
if (s.index != null) {
|
|
668
|
+
let o = i(s, this.original);
|
|
669
|
+
o !== s[0] && this.overwrite(s.index, s.index + s[0].length, o);
|
|
895
670
|
}
|
|
896
671
|
});
|
|
897
672
|
else {
|
|
898
|
-
let
|
|
899
|
-
if (
|
|
900
|
-
let
|
|
901
|
-
|
|
673
|
+
let r = this.original.match(t);
|
|
674
|
+
if (r && r.index != null) {
|
|
675
|
+
let s = i(r, this.original);
|
|
676
|
+
s !== r[0] && this.overwrite(r.index, r.index + r[0].length, s);
|
|
902
677
|
}
|
|
903
678
|
}
|
|
904
679
|
return this;
|
|
905
680
|
}
|
|
906
681
|
_replaceString(t, e) {
|
|
907
682
|
let { original: i } = this, n = i.indexOf(t);
|
|
908
|
-
return n !== -1 && this.overwrite(n, n + t.length, e), this;
|
|
683
|
+
return n !== -1 && (typeof e == "function" && (e = e(t, n, i)), t !== e && this.overwrite(n, n + t.length, e)), this;
|
|
909
684
|
}
|
|
910
685
|
replace(t, e) {
|
|
911
686
|
return typeof t == "string" ? this._replaceString(t, e) : this._replaceRegexp(t, e);
|
|
912
687
|
}
|
|
913
688
|
_replaceAllString(t, e) {
|
|
914
689
|
let { original: i } = this, n = t.length;
|
|
915
|
-
for (let
|
|
916
|
-
i.slice(
|
|
690
|
+
for (let r = i.indexOf(t); r !== -1; r = i.indexOf(t, r + n)) {
|
|
691
|
+
let s = i.slice(r, r + n), o = e;
|
|
692
|
+
typeof e == "function" && (o = e(s, r, i)), s !== o && this.overwrite(r, r + n, o);
|
|
693
|
+
}
|
|
917
694
|
return this;
|
|
918
695
|
}
|
|
919
696
|
replaceAll(t, e) {
|
|
@@ -928,106 +705,106 @@ elf");
|
|
|
928
705
|
};
|
|
929
706
|
|
|
930
707
|
// src/core-server/presets/vitePlugins/vite-inject-mocker/constants.ts
|
|
931
|
-
var
|
|
708
|
+
var T = "__vitest_mocker__";
|
|
932
709
|
|
|
933
710
|
// src/core-server/mocking-utils/esmWalker.ts
|
|
934
|
-
function
|
|
935
|
-
return
|
|
711
|
+
function v(l) {
|
|
712
|
+
return l.type === "Identifier" ? l.name : l.raw;
|
|
936
713
|
}
|
|
937
|
-
|
|
714
|
+
u(v, "getArbitraryModuleIdentifier");
|
|
938
715
|
|
|
939
716
|
// src/core-server/mocking-utils/automock.ts
|
|
940
|
-
function
|
|
941
|
-
return
|
|
942
|
-
globalThisAccessor: JSON.stringify(
|
|
717
|
+
function B(l, t, e) {
|
|
718
|
+
return it(l, t ? "autospy" : "automock", e, {
|
|
719
|
+
globalThisAccessor: JSON.stringify(T)
|
|
943
720
|
});
|
|
944
721
|
}
|
|
945
|
-
|
|
946
|
-
function
|
|
947
|
-
let n = i.globalThisAccessor || '"__vitest_mocker__"',
|
|
948
|
-
for (let
|
|
949
|
-
if (
|
|
722
|
+
u(B, "getAutomockCode");
|
|
723
|
+
function it(l, t, e, i = {}) {
|
|
724
|
+
let n = i.globalThisAccessor || '"__vitest_mocker__"', r = e(l), s = new L(l), o = [], a = 0;
|
|
725
|
+
for (let g of r.body) {
|
|
726
|
+
if (g.type === "ExportAllDeclaration")
|
|
950
727
|
throw new Error(
|
|
951
728
|
"automocking files with `export *` is not supported in browser mode because it cannot be statically analysed"
|
|
952
729
|
);
|
|
953
|
-
if (
|
|
954
|
-
let
|
|
955
|
-
if (
|
|
956
|
-
|
|
957
|
-
else if (
|
|
958
|
-
|
|
959
|
-
|
|
730
|
+
if (g.type === "ExportNamedDeclaration") {
|
|
731
|
+
let y = function(c) {
|
|
732
|
+
if (c.type === "Identifier")
|
|
733
|
+
o.push({ name: c.name });
|
|
734
|
+
else if (c.type === "ArrayPattern")
|
|
735
|
+
c.elements.forEach((m) => {
|
|
736
|
+
m && y(m);
|
|
960
737
|
});
|
|
961
|
-
else if (
|
|
962
|
-
|
|
963
|
-
|
|
738
|
+
else if (c.type === "ObjectPattern")
|
|
739
|
+
c.properties.forEach((m) => {
|
|
740
|
+
m.type === "RestElement" ? y(m) : m.type === "Property" && y(m.value);
|
|
964
741
|
});
|
|
965
|
-
else if (
|
|
966
|
-
|
|
742
|
+
else if (c.type === "RestElement")
|
|
743
|
+
y(c.argument);
|
|
967
744
|
else {
|
|
968
|
-
if (
|
|
745
|
+
if (c.type === "AssignmentPattern")
|
|
969
746
|
throw new Error("AssignmentPattern is not supported. Please open a new bug report.");
|
|
970
|
-
if (
|
|
747
|
+
if (c.type === "MemberExpression")
|
|
971
748
|
throw new Error("MemberExpression is not supported. Please open a new bug report.");
|
|
972
749
|
}
|
|
973
750
|
};
|
|
974
|
-
var
|
|
975
|
-
|
|
976
|
-
let
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
}) :
|
|
980
|
-
let
|
|
981
|
-
if (!
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
alias:
|
|
985
|
-
name:
|
|
751
|
+
var st = y;
|
|
752
|
+
u(y, "traversePattern");
|
|
753
|
+
let d = g, p = d.declaration;
|
|
754
|
+
p && (p.type === "FunctionDeclaration" ? o.push({ name: p.id.name }) : p.type === "VariableDeclaration" ? p.declarations.forEach((c) => {
|
|
755
|
+
y(c.id);
|
|
756
|
+
}) : p.type === "ClassDeclaration" && o.push({ name: p.id.name }), s.remove(d.start, p.start));
|
|
757
|
+
let x = d.specifiers || [], N = d.source;
|
|
758
|
+
if (!N && x.length)
|
|
759
|
+
x.forEach((c) => {
|
|
760
|
+
o.push({
|
|
761
|
+
alias: v(c.exported),
|
|
762
|
+
name: v(c.local)
|
|
986
763
|
});
|
|
987
|
-
}),
|
|
988
|
-
else if (
|
|
989
|
-
let
|
|
990
|
-
|
|
991
|
-
let
|
|
992
|
-
|
|
993
|
-
name:
|
|
994
|
-
alias:
|
|
764
|
+
}), s.remove(d.start, d.end);
|
|
765
|
+
else if (N && x.length) {
|
|
766
|
+
let c = [];
|
|
767
|
+
x.forEach((S) => {
|
|
768
|
+
let k = `__vitest_imported_${a++}__`;
|
|
769
|
+
c.push([v(S.local), k]), o.push({
|
|
770
|
+
name: k,
|
|
771
|
+
alias: v(S.exported)
|
|
995
772
|
});
|
|
996
773
|
});
|
|
997
|
-
let
|
|
998
|
-
|
|
774
|
+
let m = `import { ${c.map(([S, k]) => `${S} as ${k}`).join(", ")} } from '${N.value}'`;
|
|
775
|
+
s.overwrite(d.start, d.end, m);
|
|
999
776
|
}
|
|
1000
777
|
}
|
|
1001
|
-
if (
|
|
1002
|
-
let
|
|
1003
|
-
|
|
778
|
+
if (g.type === "ExportDefaultDeclaration") {
|
|
779
|
+
let d = g, p = d.declaration;
|
|
780
|
+
o.push({ name: "__vitest_default", alias: "default" }), s.overwrite(d.start, p.start, "const __vitest_default = ");
|
|
1004
781
|
}
|
|
1005
782
|
}
|
|
1006
|
-
let
|
|
783
|
+
let h = `
|
|
1007
784
|
const __vitest_current_es_module__ = {
|
|
1008
785
|
__esModule: true,
|
|
1009
|
-
${
|
|
786
|
+
${o.map(({ name: g }) => `["${g}"]: ${g},`).join(`
|
|
1010
787
|
`)}
|
|
1011
788
|
}
|
|
1012
789
|
const __vitest_mocked_module__ = globalThis[${n}].mockObject(__vitest_current_es_module__, "${t}")
|
|
1013
|
-
`,
|
|
1014
|
-
`),
|
|
790
|
+
`, f = o.map(({ name: g }, d) => `const __vitest_mocked_${d}__ = __vitest_mocked_module__["${g}"]`).join(`
|
|
791
|
+
`), U = `
|
|
1015
792
|
export {
|
|
1016
|
-
${
|
|
793
|
+
${o.map(({ name: g, alias: d }, p) => ` __vitest_mocked_${p}__ as ${d || g},`).join(`
|
|
1017
794
|
`)}
|
|
1018
795
|
}
|
|
1019
796
|
`;
|
|
1020
|
-
return
|
|
797
|
+
return s.append(h + f + U), s;
|
|
1021
798
|
}
|
|
1022
|
-
|
|
799
|
+
u(it, "automockModule");
|
|
1023
800
|
|
|
1024
801
|
// src/core-server/mocking-utils/extract.ts
|
|
1025
|
-
import { readFileSync as
|
|
1026
|
-
import { generate as
|
|
1027
|
-
import { logger as
|
|
1028
|
-
import { telemetry as
|
|
1029
|
-
import { transformSync as
|
|
1030
|
-
var
|
|
802
|
+
import { readFileSync as $t } from "node:fs";
|
|
803
|
+
import { generate as Bt, parser as nt, types as Ft } from "storybook/internal/babel";
|
|
804
|
+
import { logger as qt } from "storybook/internal/node-logger";
|
|
805
|
+
import { telemetry as Gt } from "storybook/internal/telemetry";
|
|
806
|
+
import { transformSync as zt } from "esbuild";
|
|
807
|
+
var F = /* @__PURE__ */ u((l) => nt.parse(l, {
|
|
1031
808
|
sourceType: "module",
|
|
1032
809
|
// Enable plugins to handle modern JavaScript features, including TSX.
|
|
1033
810
|
plugins: ["typescript", "jsx", "classProperties", "objectRestSpread"],
|
|
@@ -1035,11 +812,11 @@ var ft = /* @__PURE__ */ d((c) => Dt.parse(c, {
|
|
|
1035
812
|
}).program, "babelParser");
|
|
1036
813
|
|
|
1037
814
|
// src/core-server/presets/webpack/loaders/webpack-automock-loader.ts
|
|
1038
|
-
function
|
|
815
|
+
function rt(l) {
|
|
1039
816
|
let e = this.getOptions().spy === "true";
|
|
1040
|
-
return
|
|
817
|
+
return B(l, e, F).toString();
|
|
1041
818
|
}
|
|
1042
|
-
|
|
819
|
+
u(rt, "webpackAutomockLoader");
|
|
1043
820
|
export {
|
|
1044
|
-
|
|
821
|
+
rt as default
|
|
1045
822
|
};
|