@storybook/builder-webpack5 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.
- package/dist/_node-chunks/{chunk-TMJDR5EF.js → chunk-A3CZ3LUF.js} +14 -19
- package/dist/_node-chunks/chunk-EGL5WHAF.js +60 -0
- package/dist/index.js +610 -912
- package/dist/loaders/export-order-loader.js +15 -22
- package/dist/presets/custom-webpack-preset.js +51 -73
- package/dist/presets/preview-preset.js +51 -71
- package/package.json +4 -4
- package/dist/_node-chunks/chunk-7N6JQ3AR.js +0 -85
package/dist/index.js
CHANGED
|
@@ -1,91 +1,34 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import CJS_COMPAT_NODE_URL_m38t2lu80n from 'node:url';
|
|
2
|
+
import CJS_COMPAT_NODE_PATH_m38t2lu80n from 'node:path';
|
|
3
|
+
import CJS_COMPAT_NODE_MODULE_m38t2lu80n from "node:module";
|
|
4
4
|
|
|
5
|
-
var __filename =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
5
|
+
var __filename = CJS_COMPAT_NODE_URL_m38t2lu80n.fileURLToPath(import.meta.url);
|
|
6
|
+
var __dirname = CJS_COMPAT_NODE_PATH_m38t2lu80n.dirname(__filename);
|
|
7
|
+
var require = CJS_COMPAT_NODE_MODULE_m38t2lu80n.createRequire(import.meta.url);
|
|
8
8
|
|
|
9
9
|
// ------------------------------------------------------------
|
|
10
10
|
// end of CJS compatibility banner, injected by Storybook's esbuild configuration
|
|
11
11
|
// ------------------------------------------------------------
|
|
12
12
|
import {
|
|
13
13
|
getVirtualModules
|
|
14
|
-
} from "./_node-chunks/chunk-
|
|
14
|
+
} from "./_node-chunks/chunk-EGL5WHAF.js";
|
|
15
15
|
import {
|
|
16
16
|
__commonJS,
|
|
17
|
-
__name,
|
|
18
17
|
__require,
|
|
19
18
|
__toESM
|
|
20
|
-
} from "./_node-chunks/chunk-
|
|
19
|
+
} from "./_node-chunks/chunk-A3CZ3LUF.js";
|
|
21
20
|
|
|
22
21
|
// ../../node_modules/pretty-hrtime/index.js
|
|
23
22
|
var require_pretty_hrtime = __commonJS({
|
|
24
23
|
"../../node_modules/pretty-hrtime/index.js"(exports, module) {
|
|
25
24
|
"use strict";
|
|
26
|
-
var minimalDesc = ["h", "min", "s", "ms", "\u03BCs", "ns"];
|
|
27
|
-
var verboseDesc = ["hour", "minute", "second", "millisecond", "microsecond", "nanosecond"];
|
|
28
|
-
var convert = [60 * 60, 60, 1, 1e6, 1e3, 1];
|
|
25
|
+
var minimalDesc = ["h", "min", "s", "ms", "\u03BCs", "ns"], verboseDesc = ["hour", "minute", "second", "millisecond", "microsecond", "nanosecond"], convert = [3600, 60, 1, 1e6, 1e3, 1];
|
|
29
26
|
module.exports = function(source, opts) {
|
|
30
27
|
var verbose, precise, i, spot, sourceAtStep, valAtStep, decimals, strAtStep, results, totalSeconds;
|
|
31
|
-
verbose =
|
|
32
|
-
precise = false;
|
|
33
|
-
if (opts) {
|
|
34
|
-
verbose = opts.verbose || false;
|
|
35
|
-
precise = opts.precise || false;
|
|
36
|
-
}
|
|
37
|
-
if (!Array.isArray(source) || source.length !== 2) {
|
|
38
|
-
return "";
|
|
39
|
-
}
|
|
40
|
-
if (typeof source[0] !== "number" || typeof source[1] !== "number") {
|
|
28
|
+
if (verbose = !1, precise = !1, opts && (verbose = opts.verbose || !1, precise = opts.precise || !1), !Array.isArray(source) || source.length !== 2 || typeof source[0] != "number" || typeof source[1] != "number")
|
|
41
29
|
return "";
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
totalSeconds = source[0] + source[1] / 1e9;
|
|
45
|
-
source[0] = parseInt(totalSeconds);
|
|
46
|
-
source[1] = parseFloat((totalSeconds % 1).toPrecision(9)) * 1e9;
|
|
47
|
-
}
|
|
48
|
-
results = "";
|
|
49
|
-
for (i = 0; i < 6; i++) {
|
|
50
|
-
spot = i < 3 ? 0 : 1;
|
|
51
|
-
sourceAtStep = source[spot];
|
|
52
|
-
if (i !== 3 && i !== 0) {
|
|
53
|
-
sourceAtStep = sourceAtStep % convert[i - 1];
|
|
54
|
-
}
|
|
55
|
-
if (i === 2) {
|
|
56
|
-
sourceAtStep += source[1] / 1e9;
|
|
57
|
-
}
|
|
58
|
-
valAtStep = sourceAtStep / convert[i];
|
|
59
|
-
if (valAtStep >= 1) {
|
|
60
|
-
if (verbose) {
|
|
61
|
-
valAtStep = Math.floor(valAtStep);
|
|
62
|
-
}
|
|
63
|
-
if (!precise) {
|
|
64
|
-
decimals = valAtStep >= 10 ? 0 : 2;
|
|
65
|
-
strAtStep = valAtStep.toFixed(decimals);
|
|
66
|
-
} else {
|
|
67
|
-
strAtStep = valAtStep.toString();
|
|
68
|
-
}
|
|
69
|
-
if (strAtStep.indexOf(".") > -1 && strAtStep[strAtStep.length - 1] === "0") {
|
|
70
|
-
strAtStep = strAtStep.replace(/\.?0+$/, "");
|
|
71
|
-
}
|
|
72
|
-
if (results) {
|
|
73
|
-
results += " ";
|
|
74
|
-
}
|
|
75
|
-
results += strAtStep;
|
|
76
|
-
if (verbose) {
|
|
77
|
-
results += " " + verboseDesc[i];
|
|
78
|
-
if (strAtStep !== "1") {
|
|
79
|
-
results += "s";
|
|
80
|
-
}
|
|
81
|
-
} else {
|
|
82
|
-
results += " " + minimalDesc[i];
|
|
83
|
-
}
|
|
84
|
-
if (!verbose) {
|
|
85
|
-
break;
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
30
|
+
for (source[1] < 0 && (totalSeconds = source[0] + source[1] / 1e9, source[0] = parseInt(totalSeconds), source[1] = parseFloat((totalSeconds % 1).toPrecision(9)) * 1e9), results = "", i = 0; i < 6 && (spot = i < 3 ? 0 : 1, sourceAtStep = source[spot], i !== 3 && i !== 0 && (sourceAtStep = sourceAtStep % convert[i - 1]), i === 2 && (sourceAtStep += source[1] / 1e9), valAtStep = sourceAtStep / convert[i], !(valAtStep >= 1 && (verbose && (valAtStep = Math.floor(valAtStep)), precise ? strAtStep = valAtStep.toString() : (decimals = valAtStep >= 10 ? 0 : 2, strAtStep = valAtStep.toFixed(decimals)), strAtStep.indexOf(".") > -1 && strAtStep[strAtStep.length - 1] === "0" && (strAtStep = strAtStep.replace(/\.?0+$/, "")), results && (results += " "), results += strAtStep, verbose ? (results += " " + verboseDesc[i], strAtStep !== "1" && (results += "s")) : results += " " + minimalDesc[i], !verbose))); i++)
|
|
31
|
+
;
|
|
89
32
|
return results;
|
|
90
33
|
};
|
|
91
34
|
}
|
|
@@ -94,19 +37,13 @@ var require_pretty_hrtime = __commonJS({
|
|
|
94
37
|
// ../../node_modules/totalist/sync/index.js
|
|
95
38
|
var require_sync = __commonJS({
|
|
96
39
|
"../../node_modules/totalist/sync/index.js"(exports) {
|
|
97
|
-
var { join: join2, resolve: resolve2 } = __require("path");
|
|
98
|
-
var { readdirSync, statSync } = __require("fs");
|
|
40
|
+
var { join: join2, resolve: resolve2 } = __require("path"), { readdirSync, statSync } = __require("fs");
|
|
99
41
|
function totalist(dir, callback, pre = "") {
|
|
100
42
|
dir = resolve2(".", dir);
|
|
101
|
-
let arr = readdirSync(dir);
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
abs = join2(dir, arr[i]);
|
|
105
|
-
stats = statSync(abs);
|
|
106
|
-
stats.isDirectory() ? totalist(abs, callback, join2(pre, arr[i])) : callback(join2(pre, arr[i]), abs, stats);
|
|
107
|
-
}
|
|
43
|
+
let arr = readdirSync(dir), i = 0, abs, stats;
|
|
44
|
+
for (; i < arr.length; i++)
|
|
45
|
+
abs = join2(dir, arr[i]), stats = statSync(abs), stats.isDirectory() ? totalist(abs, callback, join2(pre, arr[i])) : callback(join2(pre, arr[i]), abs, stats);
|
|
108
46
|
}
|
|
109
|
-
__name(totalist, "totalist");
|
|
110
47
|
exports.totalist = totalist;
|
|
111
48
|
}
|
|
112
49
|
});
|
|
@@ -123,22 +60,10 @@ var require_build = __commonJS({
|
|
|
123
60
|
let pathname = raw, search = "", query, hash;
|
|
124
61
|
if (raw.length > 1) {
|
|
125
62
|
let idx = raw.indexOf("#", 1);
|
|
126
|
-
|
|
127
|
-
hash = raw.substring(idx);
|
|
128
|
-
pathname = raw.substring(0, idx);
|
|
129
|
-
}
|
|
130
|
-
idx = pathname.indexOf("?", 1);
|
|
131
|
-
if (idx !== -1) {
|
|
132
|
-
search = pathname.substring(idx);
|
|
133
|
-
pathname = pathname.substring(0, idx);
|
|
134
|
-
if (search.length > 1) {
|
|
135
|
-
query = qs.parse(search.substring(1));
|
|
136
|
-
}
|
|
137
|
-
}
|
|
63
|
+
idx !== -1 && (hash = raw.substring(idx), pathname = raw.substring(0, idx)), idx = pathname.indexOf("?", 1), idx !== -1 && (search = pathname.substring(idx), pathname = pathname.substring(0, idx), search.length > 1 && (query = qs.parse(search.substring(1))));
|
|
138
64
|
}
|
|
139
65
|
return req._parsedUrl = { pathname, search, query, hash, raw };
|
|
140
66
|
}
|
|
141
|
-
__name(parse2, "parse");
|
|
142
67
|
exports.parse = parse2;
|
|
143
68
|
}
|
|
144
69
|
});
|
|
@@ -151,447 +76,445 @@ var require_mrmime = __commonJS({
|
|
|
151
76
|
"3gp": "video/3gpp",
|
|
152
77
|
"3gpp": "video/3gpp",
|
|
153
78
|
"3mf": "model/3mf",
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
79
|
+
aac: "audio/aac",
|
|
80
|
+
ac: "application/pkix-attr-cert",
|
|
81
|
+
adp: "audio/adpcm",
|
|
82
|
+
adts: "audio/aac",
|
|
83
|
+
ai: "application/postscript",
|
|
84
|
+
aml: "application/automationml-aml+xml",
|
|
85
|
+
amlx: "application/automationml-amlx+zip",
|
|
86
|
+
amr: "audio/amr",
|
|
87
|
+
apng: "image/apng",
|
|
88
|
+
appcache: "text/cache-manifest",
|
|
89
|
+
appinstaller: "application/appinstaller",
|
|
90
|
+
appx: "application/appx",
|
|
91
|
+
appxbundle: "application/appxbundle",
|
|
92
|
+
asc: "application/pgp-keys",
|
|
93
|
+
atom: "application/atom+xml",
|
|
94
|
+
atomcat: "application/atomcat+xml",
|
|
95
|
+
atomdeleted: "application/atomdeleted+xml",
|
|
96
|
+
atomsvc: "application/atomsvc+xml",
|
|
97
|
+
au: "audio/basic",
|
|
98
|
+
avci: "image/avci",
|
|
99
|
+
avcs: "image/avcs",
|
|
100
|
+
avif: "image/avif",
|
|
101
|
+
aw: "application/applixware",
|
|
102
|
+
bdoc: "application/bdoc",
|
|
103
|
+
bin: "application/octet-stream",
|
|
104
|
+
bmp: "image/bmp",
|
|
105
|
+
bpk: "application/octet-stream",
|
|
106
|
+
btf: "image/prs.btif",
|
|
107
|
+
btif: "image/prs.btif",
|
|
108
|
+
buffer: "application/octet-stream",
|
|
109
|
+
ccxml: "application/ccxml+xml",
|
|
110
|
+
cdfx: "application/cdfx+xml",
|
|
111
|
+
cdmia: "application/cdmi-capability",
|
|
112
|
+
cdmic: "application/cdmi-container",
|
|
113
|
+
cdmid: "application/cdmi-domain",
|
|
114
|
+
cdmio: "application/cdmi-object",
|
|
115
|
+
cdmiq: "application/cdmi-queue",
|
|
116
|
+
cer: "application/pkix-cert",
|
|
117
|
+
cgm: "image/cgm",
|
|
118
|
+
cjs: "application/node",
|
|
119
|
+
class: "application/java-vm",
|
|
120
|
+
coffee: "text/coffeescript",
|
|
121
|
+
conf: "text/plain",
|
|
122
|
+
cpl: "application/cpl+xml",
|
|
123
|
+
cpt: "application/mac-compactpro",
|
|
124
|
+
crl: "application/pkix-crl",
|
|
125
|
+
css: "text/css",
|
|
126
|
+
csv: "text/csv",
|
|
127
|
+
cu: "application/cu-seeme",
|
|
128
|
+
cwl: "application/cwl",
|
|
129
|
+
cww: "application/prs.cww",
|
|
130
|
+
davmount: "application/davmount+xml",
|
|
131
|
+
dbk: "application/docbook+xml",
|
|
132
|
+
deb: "application/octet-stream",
|
|
133
|
+
def: "text/plain",
|
|
134
|
+
deploy: "application/octet-stream",
|
|
135
|
+
dib: "image/bmp",
|
|
211
136
|
"disposition-notification": "message/disposition-notification",
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
137
|
+
dist: "application/octet-stream",
|
|
138
|
+
distz: "application/octet-stream",
|
|
139
|
+
dll: "application/octet-stream",
|
|
140
|
+
dmg: "application/octet-stream",
|
|
141
|
+
dms: "application/octet-stream",
|
|
142
|
+
doc: "application/msword",
|
|
143
|
+
dot: "application/msword",
|
|
144
|
+
dpx: "image/dpx",
|
|
145
|
+
drle: "image/dicom-rle",
|
|
146
|
+
dsc: "text/prs.lines.tag",
|
|
147
|
+
dssc: "application/dssc+der",
|
|
148
|
+
dtd: "application/xml-dtd",
|
|
149
|
+
dump: "application/octet-stream",
|
|
150
|
+
dwd: "application/atsc-dwd+xml",
|
|
151
|
+
ear: "application/java-archive",
|
|
152
|
+
ecma: "application/ecmascript",
|
|
153
|
+
elc: "application/octet-stream",
|
|
154
|
+
emf: "image/emf",
|
|
155
|
+
eml: "message/rfc822",
|
|
156
|
+
emma: "application/emma+xml",
|
|
157
|
+
emotionml: "application/emotionml+xml",
|
|
158
|
+
eps: "application/postscript",
|
|
159
|
+
epub: "application/epub+zip",
|
|
160
|
+
exe: "application/octet-stream",
|
|
161
|
+
exi: "application/exi",
|
|
162
|
+
exp: "application/express",
|
|
163
|
+
exr: "image/aces",
|
|
164
|
+
ez: "application/andrew-inset",
|
|
165
|
+
fdf: "application/fdf",
|
|
166
|
+
fdt: "application/fdt+xml",
|
|
167
|
+
fits: "image/fits",
|
|
168
|
+
g3: "image/g3fax",
|
|
169
|
+
gbr: "application/rpki-ghostbusters",
|
|
170
|
+
geojson: "application/geo+json",
|
|
171
|
+
gif: "image/gif",
|
|
172
|
+
glb: "model/gltf-binary",
|
|
173
|
+
gltf: "model/gltf+json",
|
|
174
|
+
gml: "application/gml+xml",
|
|
175
|
+
gpx: "application/gpx+xml",
|
|
176
|
+
gram: "application/srgs",
|
|
177
|
+
grxml: "application/srgs+xml",
|
|
178
|
+
gxf: "application/gxf",
|
|
179
|
+
gz: "application/gzip",
|
|
180
|
+
h261: "video/h261",
|
|
181
|
+
h263: "video/h263",
|
|
182
|
+
h264: "video/h264",
|
|
183
|
+
heic: "image/heic",
|
|
184
|
+
heics: "image/heic-sequence",
|
|
185
|
+
heif: "image/heif",
|
|
186
|
+
heifs: "image/heif-sequence",
|
|
187
|
+
hej2: "image/hej2k",
|
|
188
|
+
held: "application/atsc-held+xml",
|
|
189
|
+
hjson: "application/hjson",
|
|
190
|
+
hlp: "application/winhlp",
|
|
191
|
+
hqx: "application/mac-binhex40",
|
|
192
|
+
hsj2: "image/hsj2",
|
|
193
|
+
htm: "text/html",
|
|
194
|
+
html: "text/html",
|
|
195
|
+
ics: "text/calendar",
|
|
196
|
+
ief: "image/ief",
|
|
197
|
+
ifb: "text/calendar",
|
|
198
|
+
iges: "model/iges",
|
|
199
|
+
igs: "model/iges",
|
|
200
|
+
img: "application/octet-stream",
|
|
201
|
+
in: "text/plain",
|
|
202
|
+
ini: "text/plain",
|
|
203
|
+
ink: "application/inkml+xml",
|
|
204
|
+
inkml: "application/inkml+xml",
|
|
205
|
+
ipfix: "application/ipfix",
|
|
206
|
+
iso: "application/octet-stream",
|
|
207
|
+
its: "application/its+xml",
|
|
208
|
+
jade: "text/jade",
|
|
209
|
+
jar: "application/java-archive",
|
|
210
|
+
jhc: "image/jphc",
|
|
211
|
+
jls: "image/jls",
|
|
212
|
+
jp2: "image/jp2",
|
|
213
|
+
jpe: "image/jpeg",
|
|
214
|
+
jpeg: "image/jpeg",
|
|
215
|
+
jpf: "image/jpx",
|
|
216
|
+
jpg: "image/jpeg",
|
|
217
|
+
jpg2: "image/jp2",
|
|
218
|
+
jpgm: "image/jpm",
|
|
219
|
+
jpgv: "video/jpeg",
|
|
220
|
+
jph: "image/jph",
|
|
221
|
+
jpm: "image/jpm",
|
|
222
|
+
jpx: "image/jpx",
|
|
223
|
+
js: "text/javascript",
|
|
224
|
+
json: "application/json",
|
|
225
|
+
json5: "application/json5",
|
|
226
|
+
jsonld: "application/ld+json",
|
|
227
|
+
jsonml: "application/jsonml+json",
|
|
228
|
+
jsx: "text/jsx",
|
|
229
|
+
jt: "model/jt",
|
|
230
|
+
jxl: "image/jxl",
|
|
231
|
+
jxr: "image/jxr",
|
|
232
|
+
jxra: "image/jxra",
|
|
233
|
+
jxrs: "image/jxrs",
|
|
234
|
+
jxs: "image/jxs",
|
|
235
|
+
jxsc: "image/jxsc",
|
|
236
|
+
jxsi: "image/jxsi",
|
|
237
|
+
jxss: "image/jxss",
|
|
238
|
+
kar: "audio/midi",
|
|
239
|
+
ktx: "image/ktx",
|
|
240
|
+
ktx2: "image/ktx2",
|
|
241
|
+
less: "text/less",
|
|
242
|
+
lgr: "application/lgr+xml",
|
|
243
|
+
list: "text/plain",
|
|
244
|
+
litcoffee: "text/coffeescript",
|
|
245
|
+
log: "text/plain",
|
|
246
|
+
lostxml: "application/lost+xml",
|
|
247
|
+
lrf: "application/octet-stream",
|
|
248
|
+
m1v: "video/mpeg",
|
|
249
|
+
m21: "application/mp21",
|
|
250
|
+
m2a: "audio/mpeg",
|
|
251
|
+
m2t: "video/mp2t",
|
|
252
|
+
m2ts: "video/mp2t",
|
|
253
|
+
m2v: "video/mpeg",
|
|
254
|
+
m3a: "audio/mpeg",
|
|
255
|
+
m4a: "audio/mp4",
|
|
256
|
+
m4p: "application/mp4",
|
|
257
|
+
m4s: "video/iso.segment",
|
|
258
|
+
ma: "application/mathematica",
|
|
259
|
+
mads: "application/mads+xml",
|
|
260
|
+
maei: "application/mmt-aei+xml",
|
|
261
|
+
man: "text/troff",
|
|
262
|
+
manifest: "text/cache-manifest",
|
|
263
|
+
map: "application/json",
|
|
264
|
+
mar: "application/octet-stream",
|
|
265
|
+
markdown: "text/markdown",
|
|
266
|
+
mathml: "application/mathml+xml",
|
|
267
|
+
mb: "application/mathematica",
|
|
268
|
+
mbox: "application/mbox",
|
|
269
|
+
md: "text/markdown",
|
|
270
|
+
mdx: "text/mdx",
|
|
271
|
+
me: "text/troff",
|
|
272
|
+
mesh: "model/mesh",
|
|
273
|
+
meta4: "application/metalink4+xml",
|
|
274
|
+
metalink: "application/metalink+xml",
|
|
275
|
+
mets: "application/mets+xml",
|
|
276
|
+
mft: "application/rpki-manifest",
|
|
277
|
+
mid: "audio/midi",
|
|
278
|
+
midi: "audio/midi",
|
|
279
|
+
mime: "message/rfc822",
|
|
280
|
+
mj2: "video/mj2",
|
|
281
|
+
mjp2: "video/mj2",
|
|
282
|
+
mjs: "text/javascript",
|
|
283
|
+
mml: "text/mathml",
|
|
284
|
+
mods: "application/mods+xml",
|
|
285
|
+
mov: "video/quicktime",
|
|
286
|
+
mp2: "audio/mpeg",
|
|
287
|
+
mp21: "application/mp21",
|
|
288
|
+
mp2a: "audio/mpeg",
|
|
289
|
+
mp3: "audio/mpeg",
|
|
290
|
+
mp4: "video/mp4",
|
|
291
|
+
mp4a: "audio/mp4",
|
|
292
|
+
mp4s: "application/mp4",
|
|
293
|
+
mp4v: "video/mp4",
|
|
294
|
+
mpd: "application/dash+xml",
|
|
295
|
+
mpe: "video/mpeg",
|
|
296
|
+
mpeg: "video/mpeg",
|
|
297
|
+
mpf: "application/media-policy-dataset+xml",
|
|
298
|
+
mpg: "video/mpeg",
|
|
299
|
+
mpg4: "video/mp4",
|
|
300
|
+
mpga: "audio/mpeg",
|
|
301
|
+
mpp: "application/dash-patch+xml",
|
|
302
|
+
mrc: "application/marc",
|
|
303
|
+
mrcx: "application/marcxml+xml",
|
|
304
|
+
ms: "text/troff",
|
|
305
|
+
mscml: "application/mediaservercontrol+xml",
|
|
306
|
+
msh: "model/mesh",
|
|
307
|
+
msi: "application/octet-stream",
|
|
308
|
+
msix: "application/msix",
|
|
309
|
+
msixbundle: "application/msixbundle",
|
|
310
|
+
msm: "application/octet-stream",
|
|
311
|
+
msp: "application/octet-stream",
|
|
312
|
+
mtl: "model/mtl",
|
|
313
|
+
mts: "video/mp2t",
|
|
314
|
+
musd: "application/mmt-usd+xml",
|
|
315
|
+
mxf: "application/mxf",
|
|
316
|
+
mxmf: "audio/mobile-xmf",
|
|
317
|
+
mxml: "application/xv+xml",
|
|
318
|
+
n3: "text/n3",
|
|
319
|
+
nb: "application/mathematica",
|
|
320
|
+
nq: "application/n-quads",
|
|
321
|
+
nt: "application/n-triples",
|
|
322
|
+
obj: "model/obj",
|
|
323
|
+
oda: "application/oda",
|
|
324
|
+
oga: "audio/ogg",
|
|
325
|
+
ogg: "audio/ogg",
|
|
326
|
+
ogv: "video/ogg",
|
|
327
|
+
ogx: "application/ogg",
|
|
328
|
+
omdoc: "application/omdoc+xml",
|
|
329
|
+
onepkg: "application/onenote",
|
|
330
|
+
onetmp: "application/onenote",
|
|
331
|
+
onetoc: "application/onenote",
|
|
332
|
+
onetoc2: "application/onenote",
|
|
333
|
+
opf: "application/oebps-package+xml",
|
|
334
|
+
opus: "audio/ogg",
|
|
335
|
+
otf: "font/otf",
|
|
336
|
+
owl: "application/rdf+xml",
|
|
337
|
+
oxps: "application/oxps",
|
|
338
|
+
p10: "application/pkcs10",
|
|
339
|
+
p7c: "application/pkcs7-mime",
|
|
340
|
+
p7m: "application/pkcs7-mime",
|
|
341
|
+
p7s: "application/pkcs7-signature",
|
|
342
|
+
p8: "application/pkcs8",
|
|
343
|
+
pdf: "application/pdf",
|
|
344
|
+
pfr: "application/font-tdpfr",
|
|
345
|
+
pgp: "application/pgp-encrypted",
|
|
346
|
+
pkg: "application/octet-stream",
|
|
347
|
+
pki: "application/pkixcmp",
|
|
348
|
+
pkipath: "application/pkix-pkipath",
|
|
349
|
+
pls: "application/pls+xml",
|
|
350
|
+
png: "image/png",
|
|
351
|
+
prc: "model/prc",
|
|
352
|
+
prf: "application/pics-rules",
|
|
353
|
+
provx: "application/provenance+xml",
|
|
354
|
+
ps: "application/postscript",
|
|
355
|
+
pskcxml: "application/pskc+xml",
|
|
356
|
+
pti: "image/prs.pti",
|
|
357
|
+
qt: "video/quicktime",
|
|
358
|
+
raml: "application/raml+yaml",
|
|
359
|
+
rapd: "application/route-apd+xml",
|
|
360
|
+
rdf: "application/rdf+xml",
|
|
361
|
+
relo: "application/p2p-overlay+xml",
|
|
362
|
+
rif: "application/reginfo+xml",
|
|
363
|
+
rl: "application/resource-lists+xml",
|
|
364
|
+
rld: "application/resource-lists-diff+xml",
|
|
365
|
+
rmi: "audio/midi",
|
|
366
|
+
rnc: "application/relax-ng-compact-syntax",
|
|
367
|
+
rng: "application/xml",
|
|
368
|
+
roa: "application/rpki-roa",
|
|
369
|
+
roff: "text/troff",
|
|
370
|
+
rq: "application/sparql-query",
|
|
371
|
+
rs: "application/rls-services+xml",
|
|
372
|
+
rsat: "application/atsc-rsat+xml",
|
|
373
|
+
rsd: "application/rsd+xml",
|
|
374
|
+
rsheet: "application/urc-ressheet+xml",
|
|
375
|
+
rss: "application/rss+xml",
|
|
376
|
+
rtf: "text/rtf",
|
|
377
|
+
rtx: "text/richtext",
|
|
378
|
+
rusd: "application/route-usd+xml",
|
|
379
|
+
s3m: "audio/s3m",
|
|
380
|
+
sbml: "application/sbml+xml",
|
|
381
|
+
scq: "application/scvp-cv-request",
|
|
382
|
+
scs: "application/scvp-cv-response",
|
|
383
|
+
sdp: "application/sdp",
|
|
384
|
+
senmlx: "application/senml+xml",
|
|
385
|
+
sensmlx: "application/sensml+xml",
|
|
386
|
+
ser: "application/java-serialized-object",
|
|
387
|
+
setpay: "application/set-payment-initiation",
|
|
388
|
+
setreg: "application/set-registration-initiation",
|
|
389
|
+
sgi: "image/sgi",
|
|
390
|
+
sgm: "text/sgml",
|
|
391
|
+
sgml: "text/sgml",
|
|
392
|
+
shex: "text/shex",
|
|
393
|
+
shf: "application/shf+xml",
|
|
394
|
+
shtml: "text/html",
|
|
395
|
+
sieve: "application/sieve",
|
|
396
|
+
sig: "application/pgp-signature",
|
|
397
|
+
sil: "audio/silk",
|
|
398
|
+
silo: "model/mesh",
|
|
399
|
+
siv: "application/sieve",
|
|
400
|
+
slim: "text/slim",
|
|
401
|
+
slm: "text/slim",
|
|
402
|
+
sls: "application/route-s-tsid+xml",
|
|
403
|
+
smi: "application/smil+xml",
|
|
404
|
+
smil: "application/smil+xml",
|
|
405
|
+
snd: "audio/basic",
|
|
406
|
+
so: "application/octet-stream",
|
|
407
|
+
spdx: "text/spdx",
|
|
408
|
+
spp: "application/scvp-vp-response",
|
|
409
|
+
spq: "application/scvp-vp-request",
|
|
410
|
+
spx: "audio/ogg",
|
|
411
|
+
sql: "application/sql",
|
|
412
|
+
sru: "application/sru+xml",
|
|
413
|
+
srx: "application/sparql-results+xml",
|
|
414
|
+
ssdl: "application/ssdl+xml",
|
|
415
|
+
ssml: "application/ssml+xml",
|
|
416
|
+
stk: "application/hyperstudio",
|
|
417
|
+
stl: "model/stl",
|
|
418
|
+
stpx: "model/step+xml",
|
|
419
|
+
stpxz: "model/step-xml+zip",
|
|
420
|
+
stpz: "model/step+zip",
|
|
421
|
+
styl: "text/stylus",
|
|
422
|
+
stylus: "text/stylus",
|
|
423
|
+
svg: "image/svg+xml",
|
|
424
|
+
svgz: "image/svg+xml",
|
|
425
|
+
swidtag: "application/swid+xml",
|
|
426
|
+
t: "text/troff",
|
|
427
|
+
t38: "image/t38",
|
|
428
|
+
td: "application/urc-targetdesc+xml",
|
|
429
|
+
tei: "application/tei+xml",
|
|
430
|
+
teicorpus: "application/tei+xml",
|
|
431
|
+
text: "text/plain",
|
|
432
|
+
tfi: "application/thraud+xml",
|
|
433
|
+
tfx: "image/tiff-fx",
|
|
434
|
+
tif: "image/tiff",
|
|
435
|
+
tiff: "image/tiff",
|
|
436
|
+
toml: "application/toml",
|
|
437
|
+
tr: "text/troff",
|
|
438
|
+
trig: "application/trig",
|
|
439
|
+
ts: "video/mp2t",
|
|
440
|
+
tsd: "application/timestamped-data",
|
|
441
|
+
tsv: "text/tab-separated-values",
|
|
442
|
+
ttc: "font/collection",
|
|
443
|
+
ttf: "font/ttf",
|
|
444
|
+
ttl: "text/turtle",
|
|
445
|
+
ttml: "application/ttml+xml",
|
|
446
|
+
txt: "text/plain",
|
|
447
|
+
u3d: "model/u3d",
|
|
448
|
+
u8dsn: "message/global-delivery-status",
|
|
449
|
+
u8hdr: "message/global-headers",
|
|
450
|
+
u8mdn: "message/global-disposition-notification",
|
|
451
|
+
u8msg: "message/global",
|
|
452
|
+
ubj: "application/ubjson",
|
|
453
|
+
uri: "text/uri-list",
|
|
454
|
+
uris: "text/uri-list",
|
|
455
|
+
urls: "text/uri-list",
|
|
456
|
+
vcard: "text/vcard",
|
|
457
|
+
vrml: "model/vrml",
|
|
458
|
+
vtt: "text/vtt",
|
|
459
|
+
vxml: "application/voicexml+xml",
|
|
460
|
+
war: "application/java-archive",
|
|
461
|
+
wasm: "application/wasm",
|
|
462
|
+
wav: "audio/wav",
|
|
463
|
+
weba: "audio/webm",
|
|
464
|
+
webm: "video/webm",
|
|
465
|
+
webmanifest: "application/manifest+json",
|
|
466
|
+
webp: "image/webp",
|
|
467
|
+
wgsl: "text/wgsl",
|
|
468
|
+
wgt: "application/widget",
|
|
469
|
+
wif: "application/watcherinfo+xml",
|
|
470
|
+
wmf: "image/wmf",
|
|
471
|
+
woff: "font/woff",
|
|
472
|
+
woff2: "font/woff2",
|
|
473
|
+
wrl: "model/vrml",
|
|
474
|
+
wsdl: "application/wsdl+xml",
|
|
475
|
+
wspolicy: "application/wspolicy+xml",
|
|
476
|
+
x3d: "model/x3d+xml",
|
|
477
|
+
x3db: "model/x3d+fastinfoset",
|
|
478
|
+
x3dbz: "model/x3d+binary",
|
|
479
|
+
x3dv: "model/x3d-vrml",
|
|
480
|
+
x3dvz: "model/x3d+vrml",
|
|
481
|
+
x3dz: "model/x3d+xml",
|
|
482
|
+
xaml: "application/xaml+xml",
|
|
483
|
+
xav: "application/xcap-att+xml",
|
|
484
|
+
xca: "application/xcap-caps+xml",
|
|
485
|
+
xcs: "application/calendar+xml",
|
|
486
|
+
xdf: "application/xcap-diff+xml",
|
|
487
|
+
xdssc: "application/dssc+xml",
|
|
488
|
+
xel: "application/xcap-el+xml",
|
|
489
|
+
xenc: "application/xenc+xml",
|
|
490
|
+
xer: "application/patch-ops-error+xml",
|
|
491
|
+
xfdf: "application/xfdf",
|
|
492
|
+
xht: "application/xhtml+xml",
|
|
493
|
+
xhtml: "application/xhtml+xml",
|
|
494
|
+
xhvml: "application/xv+xml",
|
|
495
|
+
xlf: "application/xliff+xml",
|
|
496
|
+
xm: "audio/xm",
|
|
497
|
+
xml: "text/xml",
|
|
498
|
+
xns: "application/xcap-ns+xml",
|
|
499
|
+
xop: "application/xop+xml",
|
|
500
|
+
xpl: "application/xproc+xml",
|
|
501
|
+
xsd: "application/xml",
|
|
502
|
+
xsf: "application/prs.xsf+xml",
|
|
503
|
+
xsl: "application/xml",
|
|
504
|
+
xslt: "application/xml",
|
|
505
|
+
xspf: "application/xspf+xml",
|
|
506
|
+
xvm: "application/xv+xml",
|
|
507
|
+
xvml: "application/xv+xml",
|
|
508
|
+
yaml: "text/yaml",
|
|
509
|
+
yang: "application/yang",
|
|
510
|
+
yin: "application/yin+xml",
|
|
511
|
+
yml: "text/yaml",
|
|
512
|
+
zip: "application/zip"
|
|
588
513
|
};
|
|
589
514
|
function lookup(extn) {
|
|
590
|
-
let tmp = ("" + extn).trim().toLowerCase();
|
|
591
|
-
|
|
592
|
-
return mimes[!~idx ? tmp : tmp.substring(++idx)];
|
|
515
|
+
let tmp = ("" + extn).trim().toLowerCase(), idx = tmp.lastIndexOf(".");
|
|
516
|
+
return mimes[~idx ? tmp.substring(++idx) : tmp];
|
|
593
517
|
}
|
|
594
|
-
__name(lookup, "lookup");
|
|
595
518
|
exports.mimes = mimes;
|
|
596
519
|
exports.lookup = lookup;
|
|
597
520
|
}
|
|
@@ -600,169 +523,96 @@ var require_mrmime = __commonJS({
|
|
|
600
523
|
// ../../node_modules/sirv/build.js
|
|
601
524
|
var require_build2 = __commonJS({
|
|
602
525
|
"../../node_modules/sirv/build.js"(exports, module) {
|
|
603
|
-
var fs = __require("fs")
|
|
604
|
-
|
|
605
|
-
var { totalist } = require_sync();
|
|
606
|
-
var { parse: parse2 } = require_build();
|
|
607
|
-
var { lookup } = require_mrmime();
|
|
608
|
-
var noop = /* @__PURE__ */ __name(() => {
|
|
609
|
-
}, "noop");
|
|
526
|
+
var fs = __require("fs"), { join: join2, normalize: normalize2, resolve: resolve2 } = __require("path"), { totalist } = require_sync(), { parse: parse2 } = require_build(), { lookup } = require_mrmime(), noop = () => {
|
|
527
|
+
};
|
|
610
528
|
function isMatch(uri, arr) {
|
|
611
|
-
for (let i = 0; i < arr.length; i++)
|
|
612
|
-
if (arr[i].test(uri)) return
|
|
613
|
-
}
|
|
529
|
+
for (let i = 0; i < arr.length; i++)
|
|
530
|
+
if (arr[i].test(uri)) return !0;
|
|
614
531
|
}
|
|
615
|
-
__name(isMatch, "isMatch");
|
|
616
532
|
function toAssume(uri, extns) {
|
|
617
533
|
let i = 0, x, len = uri.length - 1;
|
|
618
|
-
|
|
619
|
-
uri = uri.substring(0, len);
|
|
620
|
-
}
|
|
534
|
+
uri.charCodeAt(len) === 47 && (uri = uri.substring(0, len));
|
|
621
535
|
let arr = [], tmp = `${uri}/index`;
|
|
622
|
-
for (; i < extns.length; i++)
|
|
623
|
-
x = extns[i] ? `.${extns[i]}` : "";
|
|
624
|
-
if (uri) arr.push(uri + x);
|
|
625
|
-
arr.push(tmp + x);
|
|
626
|
-
}
|
|
536
|
+
for (; i < extns.length; i++)
|
|
537
|
+
x = extns[i] ? `.${extns[i]}` : "", uri && arr.push(uri + x), arr.push(tmp + x);
|
|
627
538
|
return arr;
|
|
628
539
|
}
|
|
629
|
-
__name(toAssume, "toAssume");
|
|
630
540
|
function viaCache(cache, uri, extns) {
|
|
631
541
|
let i = 0, data, arr = toAssume(uri, extns);
|
|
632
|
-
for (; i < arr.length; i++)
|
|
542
|
+
for (; i < arr.length; i++)
|
|
633
543
|
if (data = cache[arr[i]]) return data;
|
|
634
|
-
}
|
|
635
544
|
}
|
|
636
|
-
__name(viaCache, "viaCache");
|
|
637
545
|
function viaLocal(dir, isEtag, uri, extns) {
|
|
638
|
-
let i = 0, arr = toAssume(uri, extns);
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
stats = fs.statSync(abs);
|
|
644
|
-
if (stats.isDirectory()) continue;
|
|
645
|
-
headers = toHeaders(name, stats, isEtag);
|
|
646
|
-
headers["Cache-Control"] = isEtag ? "no-cache" : "no-store";
|
|
647
|
-
return { abs, stats, headers };
|
|
546
|
+
let i = 0, arr = toAssume(uri, extns), abs, stats, name, headers;
|
|
547
|
+
for (; i < arr.length; i++)
|
|
548
|
+
if (abs = normalize2(join2(dir, name = arr[i])), abs.startsWith(dir) && fs.existsSync(abs)) {
|
|
549
|
+
if (stats = fs.statSync(abs), stats.isDirectory()) continue;
|
|
550
|
+
return headers = toHeaders(name, stats, isEtag), headers["Cache-Control"] = isEtag ? "no-cache" : "no-store", { abs, stats, headers };
|
|
648
551
|
}
|
|
649
|
-
}
|
|
650
552
|
}
|
|
651
|
-
__name(viaLocal, "viaLocal");
|
|
652
553
|
function is404(req, res) {
|
|
653
554
|
return res.statusCode = 404, res.end();
|
|
654
555
|
}
|
|
655
|
-
__name(is404, "is404");
|
|
656
556
|
function send(req, res, file, stats, headers) {
|
|
657
557
|
let code = 200, tmp, opts = {};
|
|
658
558
|
headers = { ...headers };
|
|
659
|
-
for (let key in headers)
|
|
660
|
-
tmp = res.getHeader(key);
|
|
661
|
-
|
|
662
|
-
}
|
|
663
|
-
if (tmp = res.getHeader("content-type")) {
|
|
664
|
-
headers["Content-Type"] = tmp;
|
|
665
|
-
}
|
|
666
|
-
if (req.headers.range) {
|
|
559
|
+
for (let key in headers)
|
|
560
|
+
tmp = res.getHeader(key), tmp && (headers[key] = tmp);
|
|
561
|
+
if ((tmp = res.getHeader("content-type")) && (headers["Content-Type"] = tmp), req.headers.range) {
|
|
667
562
|
code = 206;
|
|
668
|
-
let [x, y] = req.headers.range.replace("bytes=", "").split("-");
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
end = stats.size - 1;
|
|
673
|
-
}
|
|
674
|
-
if (start2 >= stats.size) {
|
|
675
|
-
res.setHeader("Content-Range", `bytes */${stats.size}`);
|
|
676
|
-
res.statusCode = 416;
|
|
677
|
-
return res.end();
|
|
678
|
-
}
|
|
679
|
-
headers["Content-Range"] = `bytes ${start2}-${end}/${stats.size}`;
|
|
680
|
-
headers["Content-Length"] = end - start2 + 1;
|
|
681
|
-
headers["Accept-Ranges"] = "bytes";
|
|
563
|
+
let [x, y] = req.headers.range.replace("bytes=", "").split("-"), end = opts.end = parseInt(y, 10) || stats.size - 1, start2 = opts.start = parseInt(x, 10) || 0;
|
|
564
|
+
if (end >= stats.size && (end = stats.size - 1), start2 >= stats.size)
|
|
565
|
+
return res.setHeader("Content-Range", `bytes */${stats.size}`), res.statusCode = 416, res.end();
|
|
566
|
+
headers["Content-Range"] = `bytes ${start2}-${end}/${stats.size}`, headers["Content-Length"] = end - start2 + 1, headers["Accept-Ranges"] = "bytes";
|
|
682
567
|
}
|
|
683
|
-
res.writeHead(code, headers);
|
|
684
|
-
fs.createReadStream(file, opts).pipe(res);
|
|
568
|
+
res.writeHead(code, headers), fs.createReadStream(file, opts).pipe(res);
|
|
685
569
|
}
|
|
686
|
-
__name(send, "send");
|
|
687
570
|
var ENCODING = {
|
|
688
571
|
".br": "br",
|
|
689
572
|
".gz": "gzip"
|
|
690
573
|
};
|
|
691
574
|
function toHeaders(name, stats, isEtag) {
|
|
692
|
-
let enc = ENCODING[name.slice(-3)];
|
|
693
|
-
|
|
694
|
-
if (ctype === "text/html") ctype += ";charset=utf-8";
|
|
575
|
+
let enc = ENCODING[name.slice(-3)], ctype = lookup(name.slice(0, enc && -3)) || "";
|
|
576
|
+
ctype === "text/html" && (ctype += ";charset=utf-8");
|
|
695
577
|
let headers = {
|
|
696
578
|
"Content-Length": stats.size,
|
|
697
579
|
"Content-Type": ctype,
|
|
698
580
|
"Last-Modified": stats.mtime.toUTCString()
|
|
699
581
|
};
|
|
700
|
-
|
|
701
|
-
if (isEtag) headers["ETag"] = `W/"${stats.size}-${stats.mtime.getTime()}"`;
|
|
702
|
-
return headers;
|
|
582
|
+
return enc && (headers["Content-Encoding"] = enc), isEtag && (headers.ETag = `W/"${stats.size}-${stats.mtime.getTime()}"`), headers;
|
|
703
583
|
}
|
|
704
|
-
__name(toHeaders, "toHeaders");
|
|
705
584
|
module.exports = function(dir, opts = {}) {
|
|
706
585
|
dir = resolve2(dir || ".");
|
|
707
|
-
let isNotFound = opts.onNoMatch || is404;
|
|
708
|
-
|
|
709
|
-
let extensions = opts.extensions || ["html", "htm"];
|
|
710
|
-
let gzips = opts.gzip && extensions.map((x) => `${x}.gz`).concat("gz");
|
|
711
|
-
let brots = opts.brotli && extensions.map((x) => `${x}.br`).concat("br");
|
|
712
|
-
const FILES = {};
|
|
713
|
-
let fallback = "/";
|
|
714
|
-
let isEtag = !!opts.etag;
|
|
715
|
-
let isSPA = !!opts.single;
|
|
716
|
-
if (typeof opts.single === "string") {
|
|
586
|
+
let isNotFound = opts.onNoMatch || is404, setHeaders = opts.setHeaders || noop, extensions = opts.extensions || ["html", "htm"], gzips = opts.gzip && extensions.map((x) => `${x}.gz`).concat("gz"), brots = opts.brotli && extensions.map((x) => `${x}.br`).concat("br"), FILES = {}, fallback = "/", isEtag = !!opts.etag, isSPA = !!opts.single;
|
|
587
|
+
if (typeof opts.single == "string") {
|
|
717
588
|
let idx = opts.single.lastIndexOf(".");
|
|
718
|
-
fallback +=
|
|
589
|
+
fallback += ~idx ? opts.single.substring(0, idx) : opts.single;
|
|
719
590
|
}
|
|
720
591
|
let ignores = [];
|
|
721
|
-
|
|
722
|
-
ignores.push(
|
|
723
|
-
|
|
724
|
-
else ignores.push(/\/\.well-known/);
|
|
725
|
-
[].concat(opts.ignores || []).forEach((x) => {
|
|
726
|
-
ignores.push(new RegExp(x, "i"));
|
|
727
|
-
});
|
|
728
|
-
}
|
|
592
|
+
opts.ignores !== !1 && (ignores.push(/[/]([A-Za-z\s\d~$._-]+\.\w+){1,}$/), opts.dotfiles ? ignores.push(/\/\.\w/) : ignores.push(/\/\.well-known/), [].concat(opts.ignores || []).forEach((x) => {
|
|
593
|
+
ignores.push(new RegExp(x, "i"));
|
|
594
|
+
}));
|
|
729
595
|
let cc = opts.maxAge != null && `public,max-age=${opts.maxAge}`;
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
if (cc) headers["Cache-Control"] = cc;
|
|
738
|
-
FILES["/" + name.normalize().replace(/\\+/g, "/")] = { abs, stats, headers };
|
|
739
|
-
});
|
|
740
|
-
}
|
|
596
|
+
cc && opts.immutable ? cc += ",immutable" : cc && opts.maxAge === 0 && (cc += ",must-revalidate"), opts.dev || totalist(dir, (name, abs, stats) => {
|
|
597
|
+
if (!/\.well-known[\\+\/]/.test(name)) {
|
|
598
|
+
if (!opts.dotfiles && /(^\.|[\\+|\/+]\.)/.test(name)) return;
|
|
599
|
+
}
|
|
600
|
+
let headers = toHeaders(name, stats, isEtag);
|
|
601
|
+
cc && (headers["Cache-Control"] = cc), FILES["/" + name.normalize().replace(/\\+/g, "/")] = { abs, stats, headers };
|
|
602
|
+
});
|
|
741
603
|
let lookup2 = opts.dev ? viaLocal.bind(0, dir, isEtag) : viaCache.bind(0, FILES);
|
|
742
604
|
return function(req, res, next) {
|
|
743
|
-
let extns = [""];
|
|
744
|
-
|
|
745
|
-
let val = req.headers["accept-encoding"] || "";
|
|
746
|
-
if (gzips && val.includes("gzip")) extns.unshift(...gzips);
|
|
747
|
-
if (brots && /(br|brotli)/i.test(val)) extns.unshift(...brots);
|
|
748
|
-
extns.push(...extensions);
|
|
749
|
-
if (pathname.indexOf("%") !== -1) {
|
|
605
|
+
let extns = [""], pathname = parse2(req).pathname, val = req.headers["accept-encoding"] || "";
|
|
606
|
+
if (gzips && val.includes("gzip") && extns.unshift(...gzips), brots && /(br|brotli)/i.test(val) && extns.unshift(...brots), extns.push(...extensions), pathname.indexOf("%") !== -1)
|
|
750
607
|
try {
|
|
751
608
|
pathname = decodeURI(pathname);
|
|
752
|
-
} catch
|
|
609
|
+
} catch {
|
|
753
610
|
}
|
|
754
|
-
}
|
|
755
611
|
let data = lookup2(pathname, extns) || isSPA && !isMatch(pathname, ignores) && lookup2(fallback, extns);
|
|
756
612
|
if (!data) return next ? next() : isNotFound(req, res);
|
|
757
|
-
if (isEtag && req.headers["if-none-match"] === data.headers
|
|
758
|
-
res.writeHead(304);
|
|
759
|
-
|
|
760
|
-
}
|
|
761
|
-
if (gzips || brots) {
|
|
762
|
-
res.setHeader("Vary", "Accept-Encoding");
|
|
763
|
-
}
|
|
764
|
-
setHeaders(res, pathname, data.stats);
|
|
765
|
-
send(req, res, data.abs, data.stats, data.headers);
|
|
613
|
+
if (isEtag && req.headers["if-none-match"] === data.headers.ETag)
|
|
614
|
+
return res.writeHead(304), res.end();
|
|
615
|
+
(gzips || brots) && res.setHeader("Vary", "Accept-Encoding"), setHeaders(res, pathname, data.stats), send(req, res, data.abs, data.stats, data.headers);
|
|
766
616
|
};
|
|
767
617
|
};
|
|
768
618
|
}
|
|
@@ -783,147 +633,69 @@ import { checkWebpackVersion } from "@storybook/core-webpack";
|
|
|
783
633
|
// ../../node_modules/pathe/dist/shared/pathe.ff20891b.mjs
|
|
784
634
|
var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
785
635
|
function normalizeWindowsPath(input = "") {
|
|
786
|
-
|
|
787
|
-
return input;
|
|
788
|
-
}
|
|
789
|
-
return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
|
|
636
|
+
return input && input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
|
|
790
637
|
}
|
|
791
|
-
|
|
792
|
-
var
|
|
793
|
-
|
|
794
|
-
var _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
|
|
795
|
-
var normalize = /* @__PURE__ */ __name(function(path2) {
|
|
796
|
-
if (path2.length === 0) {
|
|
638
|
+
var _UNC_REGEX = /^[/\\]{2}/, _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/, _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
|
|
639
|
+
var normalize = function(path2) {
|
|
640
|
+
if (path2.length === 0)
|
|
797
641
|
return ".";
|
|
798
|
-
}
|
|
799
642
|
path2 = normalizeWindowsPath(path2);
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
if (path2.length === 0) {
|
|
805
|
-
if (isPathAbsolute) {
|
|
806
|
-
return "/";
|
|
807
|
-
}
|
|
808
|
-
return trailingSeparator ? "./" : ".";
|
|
809
|
-
}
|
|
810
|
-
if (trailingSeparator) {
|
|
811
|
-
path2 += "/";
|
|
812
|
-
}
|
|
813
|
-
if (_DRIVE_LETTER_RE.test(path2)) {
|
|
814
|
-
path2 += "/";
|
|
815
|
-
}
|
|
816
|
-
if (isUNCPath) {
|
|
817
|
-
if (!isPathAbsolute) {
|
|
818
|
-
return `//./${path2}`;
|
|
819
|
-
}
|
|
820
|
-
return `//${path2}`;
|
|
821
|
-
}
|
|
822
|
-
return isPathAbsolute && !isAbsolute(path2) ? `/${path2}` : path2;
|
|
823
|
-
}, "normalize");
|
|
824
|
-
var join = /* @__PURE__ */ __name(function(...arguments_) {
|
|
825
|
-
if (arguments_.length === 0) {
|
|
643
|
+
let isUNCPath = path2.match(_UNC_REGEX), isPathAbsolute = isAbsolute(path2), trailingSeparator = path2[path2.length - 1] === "/";
|
|
644
|
+
return path2 = normalizeString(path2, !isPathAbsolute), path2.length === 0 ? isPathAbsolute ? "/" : trailingSeparator ? "./" : "." : (trailingSeparator && (path2 += "/"), _DRIVE_LETTER_RE.test(path2) && (path2 += "/"), isUNCPath ? isPathAbsolute ? `//${path2}` : `//./${path2}` : isPathAbsolute && !isAbsolute(path2) ? `/${path2}` : path2);
|
|
645
|
+
}, join = function(...arguments_) {
|
|
646
|
+
if (arguments_.length === 0)
|
|
826
647
|
return ".";
|
|
827
|
-
}
|
|
828
648
|
let joined;
|
|
829
|
-
for (
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
} else {
|
|
834
|
-
joined += `/${argument}`;
|
|
835
|
-
}
|
|
836
|
-
}
|
|
837
|
-
}
|
|
838
|
-
if (joined === void 0) {
|
|
839
|
-
return ".";
|
|
840
|
-
}
|
|
841
|
-
return normalize(joined.replace(/\/\/+/g, "/"));
|
|
842
|
-
}, "join");
|
|
649
|
+
for (let argument of arguments_)
|
|
650
|
+
argument && argument.length > 0 && (joined === void 0 ? joined = argument : joined += `/${argument}`);
|
|
651
|
+
return joined === void 0 ? "." : normalize(joined.replace(/\/\/+/g, "/"));
|
|
652
|
+
};
|
|
843
653
|
function normalizeString(path2, allowAboveRoot) {
|
|
844
|
-
let res = "";
|
|
845
|
-
let lastSegmentLength = 0;
|
|
846
|
-
let lastSlash = -1;
|
|
847
|
-
let dots = 0;
|
|
848
|
-
let char = null;
|
|
654
|
+
let res = "", lastSegmentLength = 0, lastSlash = -1, dots = 0, char = null;
|
|
849
655
|
for (let index = 0; index <= path2.length; ++index) {
|
|
850
|
-
if (index < path2.length)
|
|
656
|
+
if (index < path2.length)
|
|
851
657
|
char = path2[index];
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
658
|
+
else {
|
|
659
|
+
if (char === "/")
|
|
660
|
+
break;
|
|
855
661
|
char = "/";
|
|
856
662
|
}
|
|
857
663
|
if (char === "/") {
|
|
858
|
-
if (lastSlash === index - 1 || dots === 1)
|
|
859
|
-
else if (dots === 2) {
|
|
664
|
+
if (!(lastSlash === index - 1 || dots === 1)) if (dots === 2) {
|
|
860
665
|
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
|
861
666
|
if (res.length > 2) {
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
res = "";
|
|
865
|
-
lastSegmentLength = 0;
|
|
866
|
-
} else {
|
|
867
|
-
res = res.slice(0, lastSlashIndex);
|
|
868
|
-
lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
|
|
869
|
-
}
|
|
870
|
-
lastSlash = index;
|
|
871
|
-
dots = 0;
|
|
667
|
+
let lastSlashIndex = res.lastIndexOf("/");
|
|
668
|
+
lastSlashIndex === -1 ? (res = "", lastSegmentLength = 0) : (res = res.slice(0, lastSlashIndex), lastSegmentLength = res.length - 1 - res.lastIndexOf("/")), lastSlash = index, dots = 0;
|
|
872
669
|
continue;
|
|
873
670
|
} else if (res.length > 0) {
|
|
874
|
-
res = "";
|
|
875
|
-
lastSegmentLength = 0;
|
|
876
|
-
lastSlash = index;
|
|
877
|
-
dots = 0;
|
|
671
|
+
res = "", lastSegmentLength = 0, lastSlash = index, dots = 0;
|
|
878
672
|
continue;
|
|
879
673
|
}
|
|
880
674
|
}
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
if (res.length > 0) {
|
|
887
|
-
res += `/${path2.slice(lastSlash + 1, index)}`;
|
|
888
|
-
} else {
|
|
889
|
-
res = path2.slice(lastSlash + 1, index);
|
|
890
|
-
}
|
|
891
|
-
lastSegmentLength = index - lastSlash - 1;
|
|
892
|
-
}
|
|
893
|
-
lastSlash = index;
|
|
894
|
-
dots = 0;
|
|
895
|
-
} else if (char === "." && dots !== -1) {
|
|
896
|
-
++dots;
|
|
897
|
-
} else {
|
|
898
|
-
dots = -1;
|
|
899
|
-
}
|
|
675
|
+
allowAboveRoot && (res += res.length > 0 ? "/.." : "..", lastSegmentLength = 2);
|
|
676
|
+
} else
|
|
677
|
+
res.length > 0 ? res += `/${path2.slice(lastSlash + 1, index)}` : res = path2.slice(lastSlash + 1, index), lastSegmentLength = index - lastSlash - 1;
|
|
678
|
+
lastSlash = index, dots = 0;
|
|
679
|
+
} else char === "." && dots !== -1 ? ++dots : dots = -1;
|
|
900
680
|
}
|
|
901
681
|
return res;
|
|
902
682
|
}
|
|
903
|
-
|
|
904
|
-
var isAbsolute = /* @__PURE__ */ __name(function(p) {
|
|
683
|
+
var isAbsolute = function(p) {
|
|
905
684
|
return _IS_ABSOLUTE_RE.test(p);
|
|
906
|
-
}
|
|
907
|
-
var _EXTNAME_RE = /.(\.[^./]+)
|
|
908
|
-
|
|
909
|
-
const match = _EXTNAME_RE.exec(normalizeWindowsPath(p));
|
|
685
|
+
};
|
|
686
|
+
var _EXTNAME_RE = /.(\.[^./]+)$/, extname = function(p) {
|
|
687
|
+
let match = _EXTNAME_RE.exec(normalizeWindowsPath(p));
|
|
910
688
|
return match && match[1] || "";
|
|
911
|
-
}
|
|
912
|
-
var dirname =
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
}, "dirname");
|
|
919
|
-
var basename = /* @__PURE__ */ __name(function(p, extension) {
|
|
920
|
-
const lastSegment = normalizeWindowsPath(p).split("/").pop();
|
|
689
|
+
};
|
|
690
|
+
var dirname = function(p) {
|
|
691
|
+
let segments = normalizeWindowsPath(p).replace(/\/$/, "").split("/").slice(0, -1);
|
|
692
|
+
return segments.length === 1 && _DRIVE_LETTER_RE.test(segments[0]) && (segments[0] += "/"), segments.join("/") || (isAbsolute(p) ? "/" : ".");
|
|
693
|
+
};
|
|
694
|
+
var basename = function(p, extension) {
|
|
695
|
+
let lastSegment = normalizeWindowsPath(p).split("/").pop();
|
|
921
696
|
return extension && lastSegment.endsWith(extension) ? lastSegment.slice(0, -extension.length) : lastSegment;
|
|
922
|
-
},
|
|
923
|
-
|
|
924
|
-
const root = normalizeWindowsPath(p).split("/").shift() || "/";
|
|
925
|
-
const base = basename(p);
|
|
926
|
-
const extension = extname(base);
|
|
697
|
+
}, parse = function(p) {
|
|
698
|
+
let root = normalizeWindowsPath(p).split("/").shift() || "/", base = basename(p), extension = extname(base);
|
|
927
699
|
return {
|
|
928
700
|
root,
|
|
929
701
|
dir: dirname(p),
|
|
@@ -931,33 +703,20 @@ var parse = /* @__PURE__ */ __name(function(p) {
|
|
|
931
703
|
ext: extension,
|
|
932
704
|
name: base.slice(0, base.length - extension.length)
|
|
933
705
|
};
|
|
934
|
-
}
|
|
706
|
+
};
|
|
935
707
|
|
|
936
708
|
// src/index.ts
|
|
937
|
-
var import_pretty_hrtime = __toESM(require_pretty_hrtime(), 1);
|
|
938
|
-
var import_sirv = __toESM(require_build2(), 1);
|
|
709
|
+
var import_pretty_hrtime = __toESM(require_pretty_hrtime(), 1), import_sirv = __toESM(require_build2(), 1);
|
|
939
710
|
import webpackModule from "webpack";
|
|
940
711
|
import webpackDevMiddleware from "webpack-dev-middleware";
|
|
941
712
|
import webpackHotMiddleware from "webpack-hot-middleware";
|
|
942
|
-
var { DefinePlugin, IgnorePlugin, ProgressPlugin } = webpackModule
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
var executor = {
|
|
950
|
-
get: /* @__PURE__ */ __name(async (options) => {
|
|
951
|
-
const version = await options.presets.apply("webpackVersion") || "5";
|
|
952
|
-
const webpackInstance = (await options.presets.apply("webpackInstance"))?.default || webpackModule;
|
|
953
|
-
checkWebpackVersion({ version }, "5", "builder-webpack5");
|
|
954
|
-
return webpackInstance;
|
|
955
|
-
}, "get")
|
|
956
|
-
};
|
|
957
|
-
var getConfig = /* @__PURE__ */ __name(async (options) => {
|
|
958
|
-
const { presets } = options;
|
|
959
|
-
const typescriptOptions = await presets.apply("typescript", {}, options);
|
|
960
|
-
const frameworkOptions = await presets.apply("frameworkOptions");
|
|
713
|
+
var { DefinePlugin, IgnorePlugin, ProgressPlugin } = webpackModule, WebpackDefinePlugin = DefinePlugin, WebpackIgnorePlugin = IgnorePlugin, printDuration = (startTime) => (0, import_pretty_hrtime.default)(process.hrtime(startTime)).replace(" ms", " milliseconds").replace(" s", " seconds").replace(" min", " minutes"), corePath = dirname(fileURLToPath(import.meta.resolve("storybook/package.json"))), compilation, reject, executor = {
|
|
714
|
+
get: async (options) => {
|
|
715
|
+
let version = await options.presets.apply("webpackVersion") || "5", webpackInstance = (await options.presets.apply("webpackInstance"))?.default || webpackModule;
|
|
716
|
+
return checkWebpackVersion({ version }, "5", "builder-webpack5"), webpackInstance;
|
|
717
|
+
}
|
|
718
|
+
}, getConfig = async (options) => {
|
|
719
|
+
let { presets } = options, typescriptOptions = await presets.apply("typescript", {}, options), frameworkOptions = await presets.apply("frameworkOptions");
|
|
961
720
|
return presets.apply(
|
|
962
721
|
"webpack",
|
|
963
722
|
{},
|
|
@@ -967,208 +726,147 @@ var getConfig = /* @__PURE__ */ __name(async (options) => {
|
|
|
967
726
|
frameworkOptions
|
|
968
727
|
}
|
|
969
728
|
);
|
|
970
|
-
},
|
|
971
|
-
|
|
972
|
-
var bail = /* @__PURE__ */ __name(async () => {
|
|
973
|
-
if (asyncIterator) {
|
|
729
|
+
}, asyncIterator, bail = async () => {
|
|
730
|
+
if (asyncIterator)
|
|
974
731
|
try {
|
|
975
732
|
await asyncIterator.throw(new Error());
|
|
976
|
-
} catch
|
|
733
|
+
} catch {
|
|
977
734
|
}
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
reject();
|
|
981
|
-
}
|
|
982
|
-
return new Promise((res, rej) => {
|
|
983
|
-
if (process && compilation) {
|
|
735
|
+
return reject && reject(), new Promise((res, rej) => {
|
|
736
|
+
if (process && compilation)
|
|
984
737
|
try {
|
|
985
|
-
compilation.close(() => res());
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
logger.warn("Unable to close preview build!");
|
|
989
|
-
res();
|
|
738
|
+
compilation.close(() => res()), logger.warn("Force closed preview build");
|
|
739
|
+
} catch {
|
|
740
|
+
logger.warn("Unable to close preview build!"), res();
|
|
990
741
|
}
|
|
991
|
-
|
|
742
|
+
else
|
|
992
743
|
res();
|
|
993
|
-
}
|
|
994
744
|
});
|
|
995
|
-
},
|
|
996
|
-
var starter = /* @__PURE__ */ __name(async function* starterGeneratorFn({
|
|
745
|
+
}, starter = async function* ({
|
|
997
746
|
startTime,
|
|
998
747
|
options,
|
|
999
748
|
router,
|
|
1000
749
|
channel
|
|
1001
750
|
}) {
|
|
1002
|
-
|
|
751
|
+
let webpackInstance = await executor.get(options);
|
|
1003
752
|
yield;
|
|
1004
|
-
|
|
1005
|
-
if (config.stats === "none" || config.stats === "summary")
|
|
753
|
+
let config = await getConfig(options);
|
|
754
|
+
if (config.stats === "none" || config.stats === "summary")
|
|
1006
755
|
throw new WebpackMissingStatsError();
|
|
1007
|
-
}
|
|
1008
756
|
yield;
|
|
1009
|
-
|
|
1010
|
-
if (!compiler)
|
|
757
|
+
let compiler = webpackInstance(config);
|
|
758
|
+
if (!compiler)
|
|
1011
759
|
throw new WebpackInvocationError({
|
|
1012
760
|
// eslint-disable-next-line local-rules/no-uncategorized-errors
|
|
1013
|
-
error: new Error(
|
|
761
|
+
error: new Error("Missing Webpack compiler at runtime!")
|
|
1014
762
|
});
|
|
1015
|
-
}
|
|
1016
763
|
yield;
|
|
1017
|
-
|
|
1018
|
-
let totalModules;
|
|
1019
|
-
let value = 0;
|
|
764
|
+
let modulesCount = await options.cache?.get("modulesCount", 1e3), totalModules, value = 0;
|
|
1020
765
|
new ProgressPlugin({
|
|
1021
|
-
handler:
|
|
766
|
+
handler: (newValue, message, arg3) => {
|
|
1022
767
|
value = Math.max(newValue, value);
|
|
1023
|
-
|
|
768
|
+
let progress = { value, message: message.charAt(0).toUpperCase() + message.slice(1) };
|
|
1024
769
|
if (message === "building") {
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
const total = parseInt(counts[2], 10);
|
|
1028
|
-
if (!Number.isNaN(complete) && !Number.isNaN(total)) {
|
|
1029
|
-
progress.modules = { complete, total };
|
|
1030
|
-
totalModules = total;
|
|
1031
|
-
}
|
|
1032
|
-
}
|
|
1033
|
-
if (value === 1) {
|
|
1034
|
-
if (options.cache) {
|
|
1035
|
-
options.cache.set("modulesCount", totalModules);
|
|
1036
|
-
}
|
|
1037
|
-
if (!progress.message) {
|
|
1038
|
-
progress.message = `Completed in ${printDuration(startTime)}.`;
|
|
1039
|
-
}
|
|
770
|
+
let counts = arg3 && arg3.match(/entries (\d+)\/(\d+)/) || [], complete = parseInt(counts[1], 10), total = parseInt(counts[2], 10);
|
|
771
|
+
!Number.isNaN(complete) && !Number.isNaN(total) && (progress.modules = { complete, total }, totalModules = total);
|
|
1040
772
|
}
|
|
1041
|
-
channel.emit(PREVIEW_BUILDER_PROGRESS, progress);
|
|
1042
|
-
},
|
|
773
|
+
value === 1 && (options.cache && options.cache.set("modulesCount", totalModules), progress.message || (progress.message = `Completed in ${printDuration(startTime)}.`)), channel.emit(PREVIEW_BUILDER_PROGRESS, progress);
|
|
774
|
+
},
|
|
1043
775
|
modulesCount
|
|
1044
776
|
}).apply(compiler);
|
|
1045
|
-
|
|
777
|
+
let middlewareOptions = {
|
|
1046
778
|
publicPath: config.output?.publicPath,
|
|
1047
|
-
writeToDisk:
|
|
779
|
+
writeToDisk: !0,
|
|
1048
780
|
stats: "errors-only"
|
|
1049
781
|
};
|
|
1050
782
|
compilation = webpackDevMiddleware(compiler, middlewareOptions);
|
|
1051
|
-
|
|
783
|
+
let previewResolvedDir = join(corePath, "dist/preview");
|
|
1052
784
|
router.use(
|
|
1053
785
|
"/sb-preview",
|
|
1054
786
|
(0, import_sirv.default)(previewResolvedDir, {
|
|
1055
787
|
maxAge: 3e5,
|
|
1056
|
-
dev:
|
|
1057
|
-
immutable:
|
|
788
|
+
dev: !0,
|
|
789
|
+
immutable: !0
|
|
1058
790
|
})
|
|
1059
|
-
);
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
const stats = await new Promise((res, rej) => {
|
|
1063
|
-
compilation?.waitUntilValid(res);
|
|
1064
|
-
reject = rej;
|
|
791
|
+
), router.use(compilation), router.use(webpackHotMiddleware(compiler, { log: !1 }));
|
|
792
|
+
let stats = await new Promise((res, rej) => {
|
|
793
|
+
compilation?.waitUntilValid(res), reject = rej;
|
|
1065
794
|
});
|
|
1066
|
-
yield
|
|
1067
|
-
if (!stats) {
|
|
795
|
+
if (yield, !stats)
|
|
1068
796
|
throw new WebpackMissingStatsError();
|
|
1069
|
-
}
|
|
1070
|
-
|
|
1071
|
-
if (warnings.length > 0) {
|
|
1072
|
-
warnings?.forEach((e) => logger.warn(e.message));
|
|
1073
|
-
}
|
|
1074
|
-
if (errors.length > 0) {
|
|
797
|
+
let { warnings, errors } = getWebpackStats({ config, stats });
|
|
798
|
+
if (warnings.length > 0 && warnings?.forEach((e) => logger.warn(e.message)), errors.length > 0)
|
|
1075
799
|
throw new WebpackCompilationError({ errors });
|
|
1076
|
-
}
|
|
1077
800
|
return {
|
|
1078
801
|
bail,
|
|
1079
802
|
stats,
|
|
1080
803
|
totalTime: process.hrtime(startTime)
|
|
1081
804
|
};
|
|
1082
|
-
}
|
|
805
|
+
};
|
|
1083
806
|
function getWebpackStats({ config, stats }) {
|
|
1084
|
-
|
|
807
|
+
let statsOptions = typeof config.stats == "string" ? config.stats : {
|
|
1085
808
|
...config.stats,
|
|
1086
|
-
warnings:
|
|
1087
|
-
errors:
|
|
1088
|
-
};
|
|
1089
|
-
const { warnings = [], errors = [] } = stats?.toJson(statsOptions) || {};
|
|
809
|
+
warnings: !0,
|
|
810
|
+
errors: !0
|
|
811
|
+
}, { warnings = [], errors = [] } = stats?.toJson(statsOptions) || {};
|
|
1090
812
|
return {
|
|
1091
813
|
warnings,
|
|
1092
814
|
errors
|
|
1093
815
|
};
|
|
1094
816
|
}
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
const webpackInstance = await executor.get(options);
|
|
817
|
+
var builder = async function* ({ startTime, options }) {
|
|
818
|
+
let webpackInstance = await executor.get(options);
|
|
1098
819
|
yield;
|
|
1099
|
-
|
|
1100
|
-
if (config.stats === "none" || config.stats === "summary")
|
|
820
|
+
let config = await getConfig(options);
|
|
821
|
+
if (config.stats === "none" || config.stats === "summary")
|
|
1101
822
|
throw new WebpackMissingStatsError();
|
|
1102
|
-
}
|
|
1103
823
|
yield;
|
|
1104
|
-
|
|
1105
|
-
if (!compiler)
|
|
824
|
+
let compiler = webpackInstance(config);
|
|
825
|
+
if (!compiler)
|
|
1106
826
|
throw new WebpackInvocationError({
|
|
1107
827
|
// eslint-disable-next-line local-rules/no-uncategorized-errors
|
|
1108
|
-
error: new Error(
|
|
828
|
+
error: new Error("Missing Webpack compiler at runtime!")
|
|
1109
829
|
});
|
|
1110
|
-
|
|
1111
|
-
const webpackCompilation = new Promise((succeed, fail) => {
|
|
830
|
+
let webpackCompilation = new Promise((succeed, fail) => {
|
|
1112
831
|
compiler.run((error, stats) => {
|
|
1113
832
|
if (error) {
|
|
1114
833
|
compiler.close(() => fail(new WebpackInvocationError({ error })));
|
|
1115
834
|
return;
|
|
1116
835
|
}
|
|
1117
|
-
if (!stats)
|
|
836
|
+
if (!stats)
|
|
1118
837
|
throw new WebpackMissingStatsError();
|
|
1119
|
-
}
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
warnings?.forEach((e) => logger.warn(e.message));
|
|
1123
|
-
}
|
|
1124
|
-
if (errors.length > 0) {
|
|
1125
|
-
errors.forEach((e) => logger.error(e.message));
|
|
1126
|
-
compiler.close(() => fail(new WebpackCompilationError({ errors })));
|
|
838
|
+
let { warnings, errors } = getWebpackStats({ config, stats });
|
|
839
|
+
if (warnings.length > 0 && warnings?.forEach((e) => logger.warn(e.message)), errors.length > 0) {
|
|
840
|
+
errors.forEach((e) => logger.error(e.message)), compiler.close(() => fail(new WebpackCompilationError({ errors })));
|
|
1127
841
|
return;
|
|
1128
842
|
}
|
|
1129
|
-
compiler.close((closeErr) => {
|
|
1130
|
-
if (closeErr) {
|
|
1131
|
-
return fail(new WebpackInvocationError({ error: closeErr }));
|
|
1132
|
-
}
|
|
1133
|
-
return succeed(stats);
|
|
1134
|
-
});
|
|
843
|
+
compiler.close((closeErr) => closeErr ? fail(new WebpackInvocationError({ error: closeErr })) : succeed(stats));
|
|
1135
844
|
});
|
|
1136
|
-
})
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
return ext === ".js";
|
|
1144
|
-
}
|
|
1145
|
-
return true;
|
|
1146
|
-
}, "filter"),
|
|
1147
|
-
recursive: true
|
|
1148
|
-
});
|
|
1149
|
-
const [webpackCompilationOutput] = await Promise.all([webpackCompilation, previewFiles]);
|
|
845
|
+
}), previewResolvedDir = join(corePath, "dist/preview"), previewDirTarget = join(options.outputDir || "", "sb-preview"), previewFiles = cp(previewResolvedDir, previewDirTarget, {
|
|
846
|
+
filter: (src) => {
|
|
847
|
+
let { ext } = parse(src);
|
|
848
|
+
return ext ? ext === ".js" : !0;
|
|
849
|
+
},
|
|
850
|
+
recursive: !0
|
|
851
|
+
}), [webpackCompilationOutput] = await Promise.all([webpackCompilation, previewFiles]);
|
|
1150
852
|
return webpackCompilationOutput;
|
|
1151
|
-
},
|
|
1152
|
-
var start = /* @__PURE__ */ __name(async (options) => {
|
|
853
|
+
}, start = async (options) => {
|
|
1153
854
|
asyncIterator = starter(options);
|
|
1154
855
|
let result;
|
|
1155
|
-
do
|
|
856
|
+
do
|
|
1156
857
|
result = await asyncIterator.next();
|
|
1157
|
-
|
|
858
|
+
while (!result.done);
|
|
1158
859
|
return result.value;
|
|
1159
|
-
},
|
|
1160
|
-
var build = /* @__PURE__ */ __name(async (options) => {
|
|
860
|
+
}, build = async (options) => {
|
|
1161
861
|
asyncIterator = builder(options);
|
|
1162
862
|
let result;
|
|
1163
|
-
do
|
|
863
|
+
do
|
|
1164
864
|
result = await asyncIterator.next();
|
|
1165
|
-
|
|
865
|
+
while (!result.done);
|
|
1166
866
|
return result.value;
|
|
1167
|
-
},
|
|
1168
|
-
var corePresets = [
|
|
867
|
+
}, corePresets = [
|
|
1169
868
|
import.meta.resolve("@storybook/builder-webpack5/presets/preview-preset")
|
|
1170
|
-
]
|
|
1171
|
-
var overridePresets = [
|
|
869
|
+
], overridePresets = [
|
|
1172
870
|
import.meta.resolve("@storybook/builder-webpack5/presets/custom-webpack-preset")
|
|
1173
871
|
];
|
|
1174
872
|
export {
|