@slidev/cli 0.27.18 → 0.27.20

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.
@@ -0,0 +1,747 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2
+
3
+
4
+ var _chunk3ND6GSCFjs = require('./chunk-3ND6GSCF.js');
5
+
6
+
7
+
8
+
9
+
10
+
11
+ var _chunkRUL3XRPSjs = require('./chunk-RUL3XRPS.js');
12
+
13
+ // ../../node_modules/.pnpm/totalist@1.1.0/node_modules/totalist/sync/index.js
14
+ var require_sync = _chunkRUL3XRPSjs.__commonJS.call(void 0, {
15
+ "../../node_modules/.pnpm/totalist@1.1.0/node_modules/totalist/sync/index.js"(exports, module) {
16
+ _chunkRUL3XRPSjs.init_cjs_shims.call(void 0, );
17
+ var { join: join3, resolve: resolve3 } = _chunkRUL3XRPSjs.__require.call(void 0, "path");
18
+ var { readdirSync, statSync: statSync2 } = _chunkRUL3XRPSjs.__require.call(void 0, "fs");
19
+ module.exports = function list2(dir, callback, pre = "") {
20
+ dir = resolve3(".", dir);
21
+ let arr = readdirSync(dir);
22
+ let i = 0, abs, stats;
23
+ for (; i < arr.length; i++) {
24
+ abs = join3(dir, arr[i]);
25
+ stats = statSync2(abs);
26
+ stats.isDirectory() ? list2(abs, callback, join3(pre, arr[i])) : callback(join3(pre, arr[i]), abs, stats);
27
+ }
28
+ };
29
+ }
30
+ });
31
+
32
+ // node/build.ts
33
+ _chunkRUL3XRPSjs.init_cjs_shims.call(void 0, );
34
+ var _path = require('path');
35
+ var _http = require('http'); var _http2 = _interopRequireDefault(_http);
36
+ var _fsextra = require('fs-extra'); var _fsextra2 = _interopRequireDefault(_fsextra);
37
+ var _vite = require('vite');
38
+ var _connect = require('connect'); var _connect2 = _interopRequireDefault(_connect);
39
+
40
+ // ../../node_modules/.pnpm/sirv@1.0.19/node_modules/sirv/build.mjs
41
+ _chunkRUL3XRPSjs.init_cjs_shims.call(void 0, );
42
+ var _fs = require('fs'); var fs = _interopRequireWildcard(_fs);
43
+
44
+
45
+ // ../../node_modules/.pnpm/@polka+url@1.0.0-next.20/node_modules/@polka/url/build.mjs
46
+ _chunkRUL3XRPSjs.init_cjs_shims.call(void 0, );
47
+ var _querystring = require('querystring'); var qs = _interopRequireWildcard(_querystring);
48
+ function parse2(req) {
49
+ let raw = req.url;
50
+ if (raw == null)
51
+ return;
52
+ let prev = req._parsedUrl;
53
+ if (prev && prev.raw === raw)
54
+ return prev;
55
+ let pathname = raw, search = "", query;
56
+ if (raw.length > 1) {
57
+ let idx = raw.indexOf("?", 1);
58
+ if (idx !== -1) {
59
+ search = raw.substring(idx);
60
+ pathname = raw.substring(0, idx);
61
+ if (search.length > 1) {
62
+ query = qs.parse(search.substring(1));
63
+ }
64
+ }
65
+ }
66
+ return req._parsedUrl = { pathname, search, query, raw };
67
+ }
68
+
69
+ // ../../node_modules/.pnpm/sirv@1.0.19/node_modules/sirv/build.mjs
70
+ var import_sync = _chunkRUL3XRPSjs.__toModule.call(void 0, require_sync());
71
+
72
+ // ../../node_modules/.pnpm/mrmime@1.0.0/node_modules/mrmime/index.mjs
73
+ _chunkRUL3XRPSjs.init_cjs_shims.call(void 0, );
74
+ var mimes = {
75
+ "ez": "application/andrew-inset",
76
+ "aw": "application/applixware",
77
+ "atom": "application/atom+xml",
78
+ "atomcat": "application/atomcat+xml",
79
+ "atomdeleted": "application/atomdeleted+xml",
80
+ "atomsvc": "application/atomsvc+xml",
81
+ "dwd": "application/atsc-dwd+xml",
82
+ "held": "application/atsc-held+xml",
83
+ "rsat": "application/atsc-rsat+xml",
84
+ "bdoc": "application/bdoc",
85
+ "xcs": "application/calendar+xml",
86
+ "ccxml": "application/ccxml+xml",
87
+ "cdfx": "application/cdfx+xml",
88
+ "cdmia": "application/cdmi-capability",
89
+ "cdmic": "application/cdmi-container",
90
+ "cdmid": "application/cdmi-domain",
91
+ "cdmio": "application/cdmi-object",
92
+ "cdmiq": "application/cdmi-queue",
93
+ "cu": "application/cu-seeme",
94
+ "mpd": "application/dash+xml",
95
+ "davmount": "application/davmount+xml",
96
+ "dbk": "application/docbook+xml",
97
+ "dssc": "application/dssc+der",
98
+ "xdssc": "application/dssc+xml",
99
+ "es": "application/ecmascript",
100
+ "ecma": "application/ecmascript",
101
+ "emma": "application/emma+xml",
102
+ "emotionml": "application/emotionml+xml",
103
+ "epub": "application/epub+zip",
104
+ "exi": "application/exi",
105
+ "fdt": "application/fdt+xml",
106
+ "pfr": "application/font-tdpfr",
107
+ "geojson": "application/geo+json",
108
+ "gml": "application/gml+xml",
109
+ "gpx": "application/gpx+xml",
110
+ "gxf": "application/gxf",
111
+ "gz": "application/gzip",
112
+ "hjson": "application/hjson",
113
+ "stk": "application/hyperstudio",
114
+ "ink": "application/inkml+xml",
115
+ "inkml": "application/inkml+xml",
116
+ "ipfix": "application/ipfix",
117
+ "its": "application/its+xml",
118
+ "jar": "application/java-archive",
119
+ "war": "application/java-archive",
120
+ "ear": "application/java-archive",
121
+ "ser": "application/java-serialized-object",
122
+ "class": "application/java-vm",
123
+ "js": "application/javascript",
124
+ "mjs": "application/javascript",
125
+ "json": "application/json",
126
+ "map": "application/json",
127
+ "json5": "application/json5",
128
+ "jsonml": "application/jsonml+json",
129
+ "jsonld": "application/ld+json",
130
+ "lgr": "application/lgr+xml",
131
+ "lostxml": "application/lost+xml",
132
+ "hqx": "application/mac-binhex40",
133
+ "cpt": "application/mac-compactpro",
134
+ "mads": "application/mads+xml",
135
+ "webmanifest": "application/manifest+json",
136
+ "mrc": "application/marc",
137
+ "mrcx": "application/marcxml+xml",
138
+ "ma": "application/mathematica",
139
+ "nb": "application/mathematica",
140
+ "mb": "application/mathematica",
141
+ "mathml": "application/mathml+xml",
142
+ "mbox": "application/mbox",
143
+ "mscml": "application/mediaservercontrol+xml",
144
+ "metalink": "application/metalink+xml",
145
+ "meta4": "application/metalink4+xml",
146
+ "mets": "application/mets+xml",
147
+ "maei": "application/mmt-aei+xml",
148
+ "musd": "application/mmt-usd+xml",
149
+ "mods": "application/mods+xml",
150
+ "m21": "application/mp21",
151
+ "mp21": "application/mp21",
152
+ "mp4s": "application/mp4",
153
+ "m4p": "application/mp4",
154
+ "doc": "application/msword",
155
+ "dot": "application/msword",
156
+ "mxf": "application/mxf",
157
+ "nq": "application/n-quads",
158
+ "nt": "application/n-triples",
159
+ "cjs": "application/node",
160
+ "bin": "application/octet-stream",
161
+ "dms": "application/octet-stream",
162
+ "lrf": "application/octet-stream",
163
+ "mar": "application/octet-stream",
164
+ "so": "application/octet-stream",
165
+ "dist": "application/octet-stream",
166
+ "distz": "application/octet-stream",
167
+ "pkg": "application/octet-stream",
168
+ "bpk": "application/octet-stream",
169
+ "dump": "application/octet-stream",
170
+ "elc": "application/octet-stream",
171
+ "deploy": "application/octet-stream",
172
+ "exe": "application/octet-stream",
173
+ "dll": "application/octet-stream",
174
+ "deb": "application/octet-stream",
175
+ "dmg": "application/octet-stream",
176
+ "iso": "application/octet-stream",
177
+ "img": "application/octet-stream",
178
+ "msi": "application/octet-stream",
179
+ "msp": "application/octet-stream",
180
+ "msm": "application/octet-stream",
181
+ "buffer": "application/octet-stream",
182
+ "oda": "application/oda",
183
+ "opf": "application/oebps-package+xml",
184
+ "ogx": "application/ogg",
185
+ "omdoc": "application/omdoc+xml",
186
+ "onetoc": "application/onenote",
187
+ "onetoc2": "application/onenote",
188
+ "onetmp": "application/onenote",
189
+ "onepkg": "application/onenote",
190
+ "oxps": "application/oxps",
191
+ "relo": "application/p2p-overlay+xml",
192
+ "xer": "application/patch-ops-error+xml",
193
+ "pdf": "application/pdf",
194
+ "pgp": "application/pgp-encrypted",
195
+ "asc": "application/pgp-signature",
196
+ "sig": "application/pgp-signature",
197
+ "prf": "application/pics-rules",
198
+ "p10": "application/pkcs10",
199
+ "p7m": "application/pkcs7-mime",
200
+ "p7c": "application/pkcs7-mime",
201
+ "p7s": "application/pkcs7-signature",
202
+ "p8": "application/pkcs8",
203
+ "ac": "application/pkix-attr-cert",
204
+ "cer": "application/pkix-cert",
205
+ "crl": "application/pkix-crl",
206
+ "pkipath": "application/pkix-pkipath",
207
+ "pki": "application/pkixcmp",
208
+ "pls": "application/pls+xml",
209
+ "ai": "application/postscript",
210
+ "eps": "application/postscript",
211
+ "ps": "application/postscript",
212
+ "provx": "application/provenance+xml",
213
+ "cww": "application/prs.cww",
214
+ "pskcxml": "application/pskc+xml",
215
+ "raml": "application/raml+yaml",
216
+ "rdf": "application/rdf+xml",
217
+ "owl": "application/rdf+xml",
218
+ "rif": "application/reginfo+xml",
219
+ "rnc": "application/relax-ng-compact-syntax",
220
+ "rl": "application/resource-lists+xml",
221
+ "rld": "application/resource-lists-diff+xml",
222
+ "rs": "application/rls-services+xml",
223
+ "rapd": "application/route-apd+xml",
224
+ "sls": "application/route-s-tsid+xml",
225
+ "rusd": "application/route-usd+xml",
226
+ "gbr": "application/rpki-ghostbusters",
227
+ "mft": "application/rpki-manifest",
228
+ "roa": "application/rpki-roa",
229
+ "rsd": "application/rsd+xml",
230
+ "rss": "application/rss+xml",
231
+ "rtf": "application/rtf",
232
+ "sbml": "application/sbml+xml",
233
+ "scq": "application/scvp-cv-request",
234
+ "scs": "application/scvp-cv-response",
235
+ "spq": "application/scvp-vp-request",
236
+ "spp": "application/scvp-vp-response",
237
+ "sdp": "application/sdp",
238
+ "senmlx": "application/senml+xml",
239
+ "sensmlx": "application/sensml+xml",
240
+ "setpay": "application/set-payment-initiation",
241
+ "setreg": "application/set-registration-initiation",
242
+ "shf": "application/shf+xml",
243
+ "siv": "application/sieve",
244
+ "sieve": "application/sieve",
245
+ "smi": "application/smil+xml",
246
+ "smil": "application/smil+xml",
247
+ "rq": "application/sparql-query",
248
+ "srx": "application/sparql-results+xml",
249
+ "gram": "application/srgs",
250
+ "grxml": "application/srgs+xml",
251
+ "sru": "application/sru+xml",
252
+ "ssdl": "application/ssdl+xml",
253
+ "ssml": "application/ssml+xml",
254
+ "swidtag": "application/swid+xml",
255
+ "tei": "application/tei+xml",
256
+ "teicorpus": "application/tei+xml",
257
+ "tfi": "application/thraud+xml",
258
+ "tsd": "application/timestamped-data",
259
+ "toml": "application/toml",
260
+ "trig": "application/trig",
261
+ "ttml": "application/ttml+xml",
262
+ "ubj": "application/ubjson",
263
+ "rsheet": "application/urc-ressheet+xml",
264
+ "td": "application/urc-targetdesc+xml",
265
+ "vxml": "application/voicexml+xml",
266
+ "wasm": "application/wasm",
267
+ "wgt": "application/widget",
268
+ "hlp": "application/winhlp",
269
+ "wsdl": "application/wsdl+xml",
270
+ "wspolicy": "application/wspolicy+xml",
271
+ "xaml": "application/xaml+xml",
272
+ "xav": "application/xcap-att+xml",
273
+ "xca": "application/xcap-caps+xml",
274
+ "xdf": "application/xcap-diff+xml",
275
+ "xel": "application/xcap-el+xml",
276
+ "xns": "application/xcap-ns+xml",
277
+ "xenc": "application/xenc+xml",
278
+ "xhtml": "application/xhtml+xml",
279
+ "xht": "application/xhtml+xml",
280
+ "xlf": "application/xliff+xml",
281
+ "xml": "application/xml",
282
+ "xsl": "application/xml",
283
+ "xsd": "application/xml",
284
+ "rng": "application/xml",
285
+ "dtd": "application/xml-dtd",
286
+ "xop": "application/xop+xml",
287
+ "xpl": "application/xproc+xml",
288
+ "xslt": "application/xml",
289
+ "xspf": "application/xspf+xml",
290
+ "mxml": "application/xv+xml",
291
+ "xhvml": "application/xv+xml",
292
+ "xvml": "application/xv+xml",
293
+ "xvm": "application/xv+xml",
294
+ "yang": "application/yang",
295
+ "yin": "application/yin+xml",
296
+ "zip": "application/zip",
297
+ "3gpp": "video/3gpp",
298
+ "adp": "audio/adpcm",
299
+ "amr": "audio/amr",
300
+ "au": "audio/basic",
301
+ "snd": "audio/basic",
302
+ "mid": "audio/midi",
303
+ "midi": "audio/midi",
304
+ "kar": "audio/midi",
305
+ "rmi": "audio/midi",
306
+ "mxmf": "audio/mobile-xmf",
307
+ "mp3": "audio/mpeg",
308
+ "m4a": "audio/mp4",
309
+ "mp4a": "audio/mp4",
310
+ "mpga": "audio/mpeg",
311
+ "mp2": "audio/mpeg",
312
+ "mp2a": "audio/mpeg",
313
+ "m2a": "audio/mpeg",
314
+ "m3a": "audio/mpeg",
315
+ "oga": "audio/ogg",
316
+ "ogg": "audio/ogg",
317
+ "spx": "audio/ogg",
318
+ "opus": "audio/ogg",
319
+ "s3m": "audio/s3m",
320
+ "sil": "audio/silk",
321
+ "wav": "audio/wav",
322
+ "weba": "audio/webm",
323
+ "xm": "audio/xm",
324
+ "ttc": "font/collection",
325
+ "otf": "font/otf",
326
+ "ttf": "font/ttf",
327
+ "woff": "font/woff",
328
+ "woff2": "font/woff2",
329
+ "exr": "image/aces",
330
+ "apng": "image/apng",
331
+ "avif": "image/avif",
332
+ "bmp": "image/bmp",
333
+ "cgm": "image/cgm",
334
+ "drle": "image/dicom-rle",
335
+ "emf": "image/emf",
336
+ "fits": "image/fits",
337
+ "g3": "image/g3fax",
338
+ "gif": "image/gif",
339
+ "heic": "image/heic",
340
+ "heics": "image/heic-sequence",
341
+ "heif": "image/heif",
342
+ "heifs": "image/heif-sequence",
343
+ "hej2": "image/hej2k",
344
+ "hsj2": "image/hsj2",
345
+ "ief": "image/ief",
346
+ "jls": "image/jls",
347
+ "jp2": "image/jp2",
348
+ "jpg2": "image/jp2",
349
+ "jpeg": "image/jpeg",
350
+ "jpg": "image/jpeg",
351
+ "jpe": "image/jpeg",
352
+ "jph": "image/jph",
353
+ "jhc": "image/jphc",
354
+ "jpm": "image/jpm",
355
+ "jpx": "image/jpx",
356
+ "jpf": "image/jpx",
357
+ "jxr": "image/jxr",
358
+ "jxra": "image/jxra",
359
+ "jxrs": "image/jxrs",
360
+ "jxs": "image/jxs",
361
+ "jxsc": "image/jxsc",
362
+ "jxsi": "image/jxsi",
363
+ "jxss": "image/jxss",
364
+ "ktx": "image/ktx",
365
+ "ktx2": "image/ktx2",
366
+ "png": "image/png",
367
+ "btif": "image/prs.btif",
368
+ "pti": "image/prs.pti",
369
+ "sgi": "image/sgi",
370
+ "svg": "image/svg+xml",
371
+ "svgz": "image/svg+xml",
372
+ "t38": "image/t38",
373
+ "tif": "image/tiff",
374
+ "tiff": "image/tiff",
375
+ "tfx": "image/tiff-fx",
376
+ "webp": "image/webp",
377
+ "wmf": "image/wmf",
378
+ "disposition-notification": "message/disposition-notification",
379
+ "u8msg": "message/global",
380
+ "u8dsn": "message/global-delivery-status",
381
+ "u8mdn": "message/global-disposition-notification",
382
+ "u8hdr": "message/global-headers",
383
+ "eml": "message/rfc822",
384
+ "mime": "message/rfc822",
385
+ "3mf": "model/3mf",
386
+ "gltf": "model/gltf+json",
387
+ "glb": "model/gltf-binary",
388
+ "igs": "model/iges",
389
+ "iges": "model/iges",
390
+ "msh": "model/mesh",
391
+ "mesh": "model/mesh",
392
+ "silo": "model/mesh",
393
+ "mtl": "model/mtl",
394
+ "obj": "model/obj",
395
+ "stpz": "model/step+zip",
396
+ "stpxz": "model/step-xml+zip",
397
+ "stl": "model/stl",
398
+ "wrl": "model/vrml",
399
+ "vrml": "model/vrml",
400
+ "x3db": "model/x3d+fastinfoset",
401
+ "x3dbz": "model/x3d+binary",
402
+ "x3dv": "model/x3d-vrml",
403
+ "x3dvz": "model/x3d+vrml",
404
+ "x3d": "model/x3d+xml",
405
+ "x3dz": "model/x3d+xml",
406
+ "appcache": "text/cache-manifest",
407
+ "manifest": "text/cache-manifest",
408
+ "ics": "text/calendar",
409
+ "ifb": "text/calendar",
410
+ "coffee": "text/coffeescript",
411
+ "litcoffee": "text/coffeescript",
412
+ "css": "text/css",
413
+ "csv": "text/csv",
414
+ "html": "text/html",
415
+ "htm": "text/html",
416
+ "shtml": "text/html",
417
+ "jade": "text/jade",
418
+ "jsx": "text/jsx",
419
+ "less": "text/less",
420
+ "markdown": "text/markdown",
421
+ "md": "text/markdown",
422
+ "mml": "text/mathml",
423
+ "mdx": "text/mdx",
424
+ "n3": "text/n3",
425
+ "txt": "text/plain",
426
+ "text": "text/plain",
427
+ "conf": "text/plain",
428
+ "def": "text/plain",
429
+ "list": "text/plain",
430
+ "log": "text/plain",
431
+ "in": "text/plain",
432
+ "ini": "text/plain",
433
+ "dsc": "text/prs.lines.tag",
434
+ "rtx": "text/richtext",
435
+ "sgml": "text/sgml",
436
+ "sgm": "text/sgml",
437
+ "shex": "text/shex",
438
+ "slim": "text/slim",
439
+ "slm": "text/slim",
440
+ "spdx": "text/spdx",
441
+ "stylus": "text/stylus",
442
+ "styl": "text/stylus",
443
+ "tsv": "text/tab-separated-values",
444
+ "t": "text/troff",
445
+ "tr": "text/troff",
446
+ "roff": "text/troff",
447
+ "man": "text/troff",
448
+ "me": "text/troff",
449
+ "ms": "text/troff",
450
+ "ttl": "text/turtle",
451
+ "uri": "text/uri-list",
452
+ "uris": "text/uri-list",
453
+ "urls": "text/uri-list",
454
+ "vcard": "text/vcard",
455
+ "vtt": "text/vtt",
456
+ "yaml": "text/yaml",
457
+ "yml": "text/yaml",
458
+ "3gp": "video/3gpp",
459
+ "3g2": "video/3gpp2",
460
+ "h261": "video/h261",
461
+ "h263": "video/h263",
462
+ "h264": "video/h264",
463
+ "m4s": "video/iso.segment",
464
+ "jpgv": "video/jpeg",
465
+ "jpgm": "image/jpm",
466
+ "mj2": "video/mj2",
467
+ "mjp2": "video/mj2",
468
+ "ts": "video/mp2t",
469
+ "mp4": "video/mp4",
470
+ "mp4v": "video/mp4",
471
+ "mpg4": "video/mp4",
472
+ "mpeg": "video/mpeg",
473
+ "mpg": "video/mpeg",
474
+ "mpe": "video/mpeg",
475
+ "m1v": "video/mpeg",
476
+ "m2v": "video/mpeg",
477
+ "ogv": "video/ogg",
478
+ "qt": "video/quicktime",
479
+ "mov": "video/quicktime",
480
+ "webm": "video/webm"
481
+ };
482
+ function lookup(extn) {
483
+ let tmp = ("" + extn).trim().toLowerCase();
484
+ let idx = tmp.lastIndexOf(".");
485
+ return mimes[!~idx ? tmp : tmp.substring(++idx)];
486
+ }
487
+
488
+ // ../../node_modules/.pnpm/sirv@1.0.19/node_modules/sirv/build.mjs
489
+ var noop = () => {
490
+ };
491
+ function isMatch(uri, arr) {
492
+ for (let i = 0; i < arr.length; i++) {
493
+ if (arr[i].test(uri))
494
+ return true;
495
+ }
496
+ }
497
+ function toAssume(uri, extns) {
498
+ let i = 0, x, len = uri.length - 1;
499
+ if (uri.charCodeAt(len) === 47) {
500
+ uri = uri.substring(0, len);
501
+ }
502
+ let arr = [], tmp = `${uri}/index`;
503
+ for (; i < extns.length; i++) {
504
+ x = extns[i] ? `.${extns[i]}` : "";
505
+ if (uri)
506
+ arr.push(uri + x);
507
+ arr.push(tmp + x);
508
+ }
509
+ return arr;
510
+ }
511
+ function viaCache(cache, uri, extns) {
512
+ let i = 0, data, arr = toAssume(uri, extns);
513
+ for (; i < arr.length; i++) {
514
+ if (data = cache[arr[i]])
515
+ return data;
516
+ }
517
+ }
518
+ function viaLocal(dir, isEtag, uri, extns) {
519
+ let i = 0, arr = toAssume(uri, extns);
520
+ let abs, stats, name, headers;
521
+ for (; i < arr.length; i++) {
522
+ abs = _path.normalize.call(void 0, _path.join.call(void 0, dir, name = arr[i]));
523
+ if (abs.startsWith(dir) && fs.existsSync(abs)) {
524
+ stats = fs.statSync(abs);
525
+ if (stats.isDirectory())
526
+ continue;
527
+ headers = toHeaders(name, stats, isEtag);
528
+ headers["Cache-Control"] = isEtag ? "no-cache" : "no-store";
529
+ return { abs, stats, headers };
530
+ }
531
+ }
532
+ }
533
+ function is404(req, res) {
534
+ return res.statusCode = 404, res.end();
535
+ }
536
+ function send(req, res, file, stats, headers) {
537
+ let code = 200, tmp, opts = {};
538
+ headers = _chunkRUL3XRPSjs.__spreadValues.call(void 0, {}, headers);
539
+ for (let key in headers) {
540
+ tmp = res.getHeader(key);
541
+ if (tmp)
542
+ headers[key] = tmp;
543
+ }
544
+ if (tmp = res.getHeader("content-type")) {
545
+ headers["Content-Type"] = tmp;
546
+ }
547
+ if (req.headers.range) {
548
+ code = 206;
549
+ let [x, y] = req.headers.range.replace("bytes=", "").split("-");
550
+ let end = opts.end = parseInt(y, 10) || stats.size - 1;
551
+ let start = opts.start = parseInt(x, 10) || 0;
552
+ if (start >= stats.size || end >= stats.size) {
553
+ res.setHeader("Content-Range", `bytes */${stats.size}`);
554
+ res.statusCode = 416;
555
+ return res.end();
556
+ }
557
+ headers["Content-Range"] = `bytes ${start}-${end}/${stats.size}`;
558
+ headers["Content-Length"] = end - start + 1;
559
+ headers["Accept-Ranges"] = "bytes";
560
+ }
561
+ res.writeHead(code, headers);
562
+ fs.createReadStream(file, opts).pipe(res);
563
+ }
564
+ var ENCODING = {
565
+ ".br": "br",
566
+ ".gz": "gzip"
567
+ };
568
+ function toHeaders(name, stats, isEtag) {
569
+ let enc = ENCODING[name.slice(-3)];
570
+ let ctype = lookup(name.slice(0, enc && -3)) || "";
571
+ if (ctype === "text/html")
572
+ ctype += ";charset=utf-8";
573
+ let headers = {
574
+ "Content-Length": stats.size,
575
+ "Content-Type": ctype,
576
+ "Last-Modified": stats.mtime.toUTCString()
577
+ };
578
+ if (enc)
579
+ headers["Content-Encoding"] = enc;
580
+ if (isEtag)
581
+ headers["ETag"] = `W/"${stats.size}-${stats.mtime.getTime()}"`;
582
+ return headers;
583
+ }
584
+ function build_default(dir, opts = {}) {
585
+ dir = _path.resolve.call(void 0, dir || ".");
586
+ let isNotFound = opts.onNoMatch || is404;
587
+ let setHeaders = opts.setHeaders || noop;
588
+ let extensions = opts.extensions || ["html", "htm"];
589
+ let gzips = opts.gzip && extensions.map((x) => `${x}.gz`).concat("gz");
590
+ let brots = opts.brotli && extensions.map((x) => `${x}.br`).concat("br");
591
+ const FILES = {};
592
+ let fallback = "/";
593
+ let isEtag = !!opts.etag;
594
+ let isSPA = !!opts.single;
595
+ if (typeof opts.single === "string") {
596
+ let idx = opts.single.lastIndexOf(".");
597
+ fallback += !!~idx ? opts.single.substring(0, idx) : opts.single;
598
+ }
599
+ let ignores = [];
600
+ if (opts.ignores !== false) {
601
+ ignores.push(/[/]([A-Za-z\s\d~$._-]+\.\w+){1,}$/);
602
+ if (opts.dotfiles)
603
+ ignores.push(/\/\.\w/);
604
+ else
605
+ ignores.push(/\/\.well-known/);
606
+ [].concat(opts.ignores || []).forEach((x) => {
607
+ ignores.push(new RegExp(x, "i"));
608
+ });
609
+ }
610
+ let cc = opts.maxAge != null && `public,max-age=${opts.maxAge}`;
611
+ if (cc && opts.immutable)
612
+ cc += ",immutable";
613
+ else if (cc && opts.maxAge === 0)
614
+ cc += ",must-revalidate";
615
+ if (!opts.dev) {
616
+ (0, import_sync.default)(dir, (name, abs, stats) => {
617
+ if (/\.well-known[\\+\/]/.test(name)) {
618
+ } else if (!opts.dotfiles && /(^\.|[\\+|\/+]\.)/.test(name))
619
+ return;
620
+ let headers = toHeaders(name, stats, isEtag);
621
+ if (cc)
622
+ headers["Cache-Control"] = cc;
623
+ FILES["/" + name.normalize().replace(/\\+/g, "/")] = { abs, stats, headers };
624
+ });
625
+ }
626
+ let lookup2 = opts.dev ? viaLocal.bind(0, dir, isEtag) : viaCache.bind(0, FILES);
627
+ return function(req, res, next) {
628
+ let extns = [""];
629
+ let pathname = parse2(req).pathname;
630
+ let val = req.headers["accept-encoding"] || "";
631
+ if (gzips && val.includes("gzip"))
632
+ extns.unshift(...gzips);
633
+ if (brots && /(br|brotli)/i.test(val))
634
+ extns.unshift(...brots);
635
+ extns.push(...extensions);
636
+ if (pathname.indexOf("%") !== -1) {
637
+ try {
638
+ pathname = decodeURIComponent(pathname);
639
+ } catch (err) {
640
+ }
641
+ }
642
+ let data = lookup2(pathname, extns) || isSPA && !isMatch(pathname, ignores) && lookup2(fallback, extns);
643
+ if (!data)
644
+ return next ? next() : isNotFound(req, res);
645
+ if (isEtag && req.headers["if-none-match"] === data.headers["ETag"]) {
646
+ res.writeHead(304);
647
+ return res.end();
648
+ }
649
+ if (gzips || brots) {
650
+ res.setHeader("Vary", "Accept-Encoding");
651
+ }
652
+ setHeaders(res, pathname, data.stats);
653
+ send(req, res, data.abs, data.stats, data.headers);
654
+ };
655
+ }
656
+
657
+ // node/build.ts
658
+ var _kolorist = require('kolorist');
659
+ async function build(options, viteConfig = {}) {
660
+ const indexPath = _path.resolve.call(void 0, options.userRoot, "index.html");
661
+ const rawConfig = await _vite.resolveConfig.call(void 0, {}, "build");
662
+ const pluginOptions = rawConfig.slidev || {};
663
+ let originalIndexHTML;
664
+ if (_fsextra2.default.existsSync(indexPath))
665
+ originalIndexHTML = await _fsextra2.default.readFile(indexPath, "utf-8");
666
+ await _fsextra2.default.writeFile(indexPath, await _chunk3ND6GSCFjs.getIndexHtml.call(void 0, options), "utf-8");
667
+ let config = void 0;
668
+ try {
669
+ const inlineConfig = _vite.mergeConfig.call(void 0, viteConfig, {
670
+ plugins: [
671
+ await _chunk3ND6GSCFjs.ViteSlidevPlugin.call(void 0, options, pluginOptions),
672
+ {
673
+ name: "resolve-config",
674
+ configResolved(_config) {
675
+ config = _config;
676
+ }
677
+ }
678
+ ],
679
+ build: {
680
+ chunkSizeWarningLimit: 2e3
681
+ }
682
+ });
683
+ await _vite.build.call(void 0, inlineConfig);
684
+ if (options.data.features.monaco) {
685
+ if (options.data.config.monaco === "dev") {
686
+ console.log(_kolorist.yellow.call(void 0, " Monaco is disabled in the build, to enabled it, set `monaco: true` in the frontmatter"));
687
+ } else {
688
+ console.log(_kolorist.blue.call(void 0, " building for Monaco...\n"));
689
+ await _vite.build.call(void 0, _vite.mergeConfig.call(void 0, inlineConfig, {
690
+ root: _path.join.call(void 0, options.clientRoot, "iframes/monaco"),
691
+ base: `${config.base}iframes/monaco/`,
692
+ build: {
693
+ outDir: _path.resolve.call(void 0, config.build.outDir, "iframes/monaco"),
694
+ rollupOptions: {
695
+ output: {
696
+ manualChunks: {
697
+ jsonWorker: ["monaco-editor/esm/vs/language/json/json.worker"],
698
+ cssWorker: ["monaco-editor/esm/vs/language/css/css.worker"],
699
+ htmlWorker: ["monaco-editor/esm/vs/language/html/html.worker"],
700
+ tsWorker: ["monaco-editor/esm/vs/language/typescript/ts.worker"],
701
+ editorWorker: ["monaco-editor/esm/vs/editor/editor.worker"]
702
+ }
703
+ }
704
+ }
705
+ }
706
+ }));
707
+ }
708
+ }
709
+ } finally {
710
+ if (originalIndexHTML != null)
711
+ await _fsextra2.default.writeFile(indexPath, originalIndexHTML, "utf-8");
712
+ else
713
+ await _fsextra2.default.unlink(indexPath);
714
+ }
715
+ await _fsextra2.default.copyFile(_path.resolve.call(void 0, config.build.outDir, "index.html"), _path.resolve.call(void 0, config.build.outDir, "404.html"));
716
+ const redirectsPath = _path.resolve.call(void 0, config.build.outDir, "_redirects");
717
+ if (!_fsextra2.default.existsSync(redirectsPath))
718
+ await _fsextra2.default.writeFile(redirectsPath, `${config.base}* ${config.base}index.html 200
719
+ `, "utf-8");
720
+ if ([true, "true", "auto"].includes(options.data.config.download)) {
721
+ const { exportSlides } = await Promise.resolve().then(() => _chunkRUL3XRPSjs.__toModule.call(void 0, _chunkRUL3XRPSjs.__require.call(void 0, "./export-FUMCNU5W.js")));
722
+ const port = 12445;
723
+ const app = _connect2.default.call(void 0, );
724
+ const server = _http2.default.createServer(app);
725
+ app.use(config.base, build_default(config.build.outDir, {
726
+ etag: true,
727
+ single: true,
728
+ dev: true
729
+ }));
730
+ server.listen(port);
731
+ await exportSlides({
732
+ port,
733
+ total: options.data.slides.length,
734
+ format: "pdf",
735
+ output: _path.join.call(void 0, config.build.outDir, "slidev-exported.pdf"),
736
+ base: config.base,
737
+ dark: options.data.config.colorSchema === "dark",
738
+ width: 1920,
739
+ height: Math.round(1920 / options.data.config.aspectRatio),
740
+ routerMode: options.data.config.routerMode
741
+ });
742
+ server.close();
743
+ }
744
+ }
745
+
746
+
747
+ exports.build = build;