@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.
@@ -1,408 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2
-
3
-
4
- var _chunkDVHCB7TLjs = require('./chunk-DVHCB7TL.js');
5
-
6
-
7
-
8
-
9
-
10
-
11
- var _chunk7EYE5BOQjs = require('./chunk-7EYE5BOQ.js');
12
-
13
- // ../../node_modules/.pnpm/@polka+url@1.0.0-next.20/node_modules/@polka/url/build.js
14
- var require_build = _chunk7EYE5BOQjs.__commonJS.call(void 0, {
15
- "../../node_modules/.pnpm/@polka+url@1.0.0-next.20/node_modules/@polka/url/build.js"(exports) {
16
- _chunk7EYE5BOQjs.init_cjs_shims.call(void 0, );
17
- var qs = _chunk7EYE5BOQjs.__require.call(void 0, "querystring");
18
- function parse(req) {
19
- let raw = req.url;
20
- if (raw == null)
21
- return;
22
- let prev = req._parsedUrl;
23
- if (prev && prev.raw === raw)
24
- return prev;
25
- let pathname = raw, search = "", query;
26
- if (raw.length > 1) {
27
- let idx = raw.indexOf("?", 1);
28
- if (idx !== -1) {
29
- search = raw.substring(idx);
30
- pathname = raw.substring(0, idx);
31
- if (search.length > 1) {
32
- query = qs.parse(search.substring(1));
33
- }
34
- }
35
- }
36
- return req._parsedUrl = { pathname, search, query, raw };
37
- }
38
- exports.parse = parse;
39
- }
40
- });
41
-
42
- // ../../node_modules/.pnpm/totalist@1.1.0/node_modules/totalist/sync/index.js
43
- var require_sync = _chunk7EYE5BOQjs.__commonJS.call(void 0, {
44
- "../../node_modules/.pnpm/totalist@1.1.0/node_modules/totalist/sync/index.js"(exports, module) {
45
- _chunk7EYE5BOQjs.init_cjs_shims.call(void 0, );
46
- var { join: join2, resolve: resolve2 } = _chunk7EYE5BOQjs.__require.call(void 0, "path");
47
- var { readdirSync, statSync } = _chunk7EYE5BOQjs.__require.call(void 0, "fs");
48
- module.exports = function list(dir, callback, pre = "") {
49
- dir = resolve2(".", dir);
50
- let arr = readdirSync(dir);
51
- let i = 0, abs, stats;
52
- for (; i < arr.length; i++) {
53
- abs = join2(dir, arr[i]);
54
- stats = statSync(abs);
55
- stats.isDirectory() ? list(abs, callback, join2(pre, arr[i])) : callback(join2(pre, arr[i]), abs, stats);
56
- }
57
- };
58
- }
59
- });
60
-
61
- // ../../node_modules/.pnpm/mime@2.5.2/node_modules/mime/Mime.js
62
- var require_Mime = _chunk7EYE5BOQjs.__commonJS.call(void 0, {
63
- "../../node_modules/.pnpm/mime@2.5.2/node_modules/mime/Mime.js"(exports, module) {
64
- _chunk7EYE5BOQjs.init_cjs_shims.call(void 0, );
65
- "use strict";
66
- function Mime() {
67
- this._types = Object.create(null);
68
- this._extensions = Object.create(null);
69
- for (let i = 0; i < arguments.length; i++) {
70
- this.define(arguments[i]);
71
- }
72
- this.define = this.define.bind(this);
73
- this.getType = this.getType.bind(this);
74
- this.getExtension = this.getExtension.bind(this);
75
- }
76
- Mime.prototype.define = function(typeMap, force) {
77
- for (let type in typeMap) {
78
- let extensions = typeMap[type].map(function(t) {
79
- return t.toLowerCase();
80
- });
81
- type = type.toLowerCase();
82
- for (let i = 0; i < extensions.length; i++) {
83
- const ext = extensions[i];
84
- if (ext[0] === "*") {
85
- continue;
86
- }
87
- if (!force && ext in this._types) {
88
- throw new Error('Attempt to change mapping for "' + ext + '" extension from "' + this._types[ext] + '" to "' + type + '". Pass `force=true` to allow this, otherwise remove "' + ext + '" from the list of extensions for "' + type + '".');
89
- }
90
- this._types[ext] = type;
91
- }
92
- if (force || !this._extensions[type]) {
93
- const ext = extensions[0];
94
- this._extensions[type] = ext[0] !== "*" ? ext : ext.substr(1);
95
- }
96
- }
97
- };
98
- Mime.prototype.getType = function(path) {
99
- path = String(path);
100
- let last = path.replace(/^.*[/\\]/, "").toLowerCase();
101
- let ext = last.replace(/^.*\./, "").toLowerCase();
102
- let hasPath = last.length < path.length;
103
- let hasDot = ext.length < last.length - 1;
104
- return (hasDot || !hasPath) && this._types[ext] || null;
105
- };
106
- Mime.prototype.getExtension = function(type) {
107
- type = /^\s*([^;\s]*)/.test(type) && RegExp.$1;
108
- return type && this._extensions[type.toLowerCase()] || null;
109
- };
110
- module.exports = Mime;
111
- }
112
- });
113
-
114
- // ../../node_modules/.pnpm/mime@2.5.2/node_modules/mime/types/standard.js
115
- var require_standard = _chunk7EYE5BOQjs.__commonJS.call(void 0, {
116
- "../../node_modules/.pnpm/mime@2.5.2/node_modules/mime/types/standard.js"(exports, module) {
117
- _chunk7EYE5BOQjs.init_cjs_shims.call(void 0, );
118
- module.exports = { "application/andrew-inset": ["ez"], "application/applixware": ["aw"], "application/atom+xml": ["atom"], "application/atomcat+xml": ["atomcat"], "application/atomdeleted+xml": ["atomdeleted"], "application/atomsvc+xml": ["atomsvc"], "application/atsc-dwd+xml": ["dwd"], "application/atsc-held+xml": ["held"], "application/atsc-rsat+xml": ["rsat"], "application/bdoc": ["bdoc"], "application/calendar+xml": ["xcs"], "application/ccxml+xml": ["ccxml"], "application/cdfx+xml": ["cdfx"], "application/cdmi-capability": ["cdmia"], "application/cdmi-container": ["cdmic"], "application/cdmi-domain": ["cdmid"], "application/cdmi-object": ["cdmio"], "application/cdmi-queue": ["cdmiq"], "application/cu-seeme": ["cu"], "application/dash+xml": ["mpd"], "application/davmount+xml": ["davmount"], "application/docbook+xml": ["dbk"], "application/dssc+der": ["dssc"], "application/dssc+xml": ["xdssc"], "application/ecmascript": ["ecma", "es"], "application/emma+xml": ["emma"], "application/emotionml+xml": ["emotionml"], "application/epub+zip": ["epub"], "application/exi": ["exi"], "application/fdt+xml": ["fdt"], "application/font-tdpfr": ["pfr"], "application/geo+json": ["geojson"], "application/gml+xml": ["gml"], "application/gpx+xml": ["gpx"], "application/gxf": ["gxf"], "application/gzip": ["gz"], "application/hjson": ["hjson"], "application/hyperstudio": ["stk"], "application/inkml+xml": ["ink", "inkml"], "application/ipfix": ["ipfix"], "application/its+xml": ["its"], "application/java-archive": ["jar", "war", "ear"], "application/java-serialized-object": ["ser"], "application/java-vm": ["class"], "application/javascript": ["js", "mjs"], "application/json": ["json", "map"], "application/json5": ["json5"], "application/jsonml+json": ["jsonml"], "application/ld+json": ["jsonld"], "application/lgr+xml": ["lgr"], "application/lost+xml": ["lostxml"], "application/mac-binhex40": ["hqx"], "application/mac-compactpro": ["cpt"], "application/mads+xml": ["mads"], "application/manifest+json": ["webmanifest"], "application/marc": ["mrc"], "application/marcxml+xml": ["mrcx"], "application/mathematica": ["ma", "nb", "mb"], "application/mathml+xml": ["mathml"], "application/mbox": ["mbox"], "application/mediaservercontrol+xml": ["mscml"], "application/metalink+xml": ["metalink"], "application/metalink4+xml": ["meta4"], "application/mets+xml": ["mets"], "application/mmt-aei+xml": ["maei"], "application/mmt-usd+xml": ["musd"], "application/mods+xml": ["mods"], "application/mp21": ["m21", "mp21"], "application/mp4": ["mp4s", "m4p"], "application/mrb-consumer+xml": ["*xdf"], "application/mrb-publish+xml": ["*xdf"], "application/msword": ["doc", "dot"], "application/mxf": ["mxf"], "application/n-quads": ["nq"], "application/n-triples": ["nt"], "application/node": ["cjs"], "application/octet-stream": ["bin", "dms", "lrf", "mar", "so", "dist", "distz", "pkg", "bpk", "dump", "elc", "deploy", "exe", "dll", "deb", "dmg", "iso", "img", "msi", "msp", "msm", "buffer"], "application/oda": ["oda"], "application/oebps-package+xml": ["opf"], "application/ogg": ["ogx"], "application/omdoc+xml": ["omdoc"], "application/onenote": ["onetoc", "onetoc2", "onetmp", "onepkg"], "application/oxps": ["oxps"], "application/p2p-overlay+xml": ["relo"], "application/patch-ops-error+xml": ["*xer"], "application/pdf": ["pdf"], "application/pgp-encrypted": ["pgp"], "application/pgp-signature": ["asc", "sig"], "application/pics-rules": ["prf"], "application/pkcs10": ["p10"], "application/pkcs7-mime": ["p7m", "p7c"], "application/pkcs7-signature": ["p7s"], "application/pkcs8": ["p8"], "application/pkix-attr-cert": ["ac"], "application/pkix-cert": ["cer"], "application/pkix-crl": ["crl"], "application/pkix-pkipath": ["pkipath"], "application/pkixcmp": ["pki"], "application/pls+xml": ["pls"], "application/postscript": ["ai", "eps", "ps"], "application/provenance+xml": ["provx"], "application/pskc+xml": ["pskcxml"], "application/raml+yaml": ["raml"], "application/rdf+xml": ["rdf", "owl"], "application/reginfo+xml": ["rif"], "application/relax-ng-compact-syntax": ["rnc"], "application/resource-lists+xml": ["rl"], "application/resource-lists-diff+xml": ["rld"], "application/rls-services+xml": ["rs"], "application/route-apd+xml": ["rapd"], "application/route-s-tsid+xml": ["sls"], "application/route-usd+xml": ["rusd"], "application/rpki-ghostbusters": ["gbr"], "application/rpki-manifest": ["mft"], "application/rpki-roa": ["roa"], "application/rsd+xml": ["rsd"], "application/rss+xml": ["rss"], "application/rtf": ["rtf"], "application/sbml+xml": ["sbml"], "application/scvp-cv-request": ["scq"], "application/scvp-cv-response": ["scs"], "application/scvp-vp-request": ["spq"], "application/scvp-vp-response": ["spp"], "application/sdp": ["sdp"], "application/senml+xml": ["senmlx"], "application/sensml+xml": ["sensmlx"], "application/set-payment-initiation": ["setpay"], "application/set-registration-initiation": ["setreg"], "application/shf+xml": ["shf"], "application/sieve": ["siv", "sieve"], "application/smil+xml": ["smi", "smil"], "application/sparql-query": ["rq"], "application/sparql-results+xml": ["srx"], "application/srgs": ["gram"], "application/srgs+xml": ["grxml"], "application/sru+xml": ["sru"], "application/ssdl+xml": ["ssdl"], "application/ssml+xml": ["ssml"], "application/swid+xml": ["swidtag"], "application/tei+xml": ["tei", "teicorpus"], "application/thraud+xml": ["tfi"], "application/timestamped-data": ["tsd"], "application/toml": ["toml"], "application/ttml+xml": ["ttml"], "application/ubjson": ["ubj"], "application/urc-ressheet+xml": ["rsheet"], "application/urc-targetdesc+xml": ["td"], "application/voicexml+xml": ["vxml"], "application/wasm": ["wasm"], "application/widget": ["wgt"], "application/winhlp": ["hlp"], "application/wsdl+xml": ["wsdl"], "application/wspolicy+xml": ["wspolicy"], "application/xaml+xml": ["xaml"], "application/xcap-att+xml": ["xav"], "application/xcap-caps+xml": ["xca"], "application/xcap-diff+xml": ["xdf"], "application/xcap-el+xml": ["xel"], "application/xcap-error+xml": ["xer"], "application/xcap-ns+xml": ["xns"], "application/xenc+xml": ["xenc"], "application/xhtml+xml": ["xhtml", "xht"], "application/xliff+xml": ["xlf"], "application/xml": ["xml", "xsl", "xsd", "rng"], "application/xml-dtd": ["dtd"], "application/xop+xml": ["xop"], "application/xproc+xml": ["xpl"], "application/xslt+xml": ["*xsl", "xslt"], "application/xspf+xml": ["xspf"], "application/xv+xml": ["mxml", "xhvml", "xvml", "xvm"], "application/yang": ["yang"], "application/yin+xml": ["yin"], "application/zip": ["zip"], "audio/3gpp": ["*3gpp"], "audio/adpcm": ["adp"], "audio/amr": ["amr"], "audio/basic": ["au", "snd"], "audio/midi": ["mid", "midi", "kar", "rmi"], "audio/mobile-xmf": ["mxmf"], "audio/mp3": ["*mp3"], "audio/mp4": ["m4a", "mp4a"], "audio/mpeg": ["mpga", "mp2", "mp2a", "mp3", "m2a", "m3a"], "audio/ogg": ["oga", "ogg", "spx", "opus"], "audio/s3m": ["s3m"], "audio/silk": ["sil"], "audio/wav": ["wav"], "audio/wave": ["*wav"], "audio/webm": ["weba"], "audio/xm": ["xm"], "font/collection": ["ttc"], "font/otf": ["otf"], "font/ttf": ["ttf"], "font/woff": ["woff"], "font/woff2": ["woff2"], "image/aces": ["exr"], "image/apng": ["apng"], "image/avif": ["avif"], "image/bmp": ["bmp"], "image/cgm": ["cgm"], "image/dicom-rle": ["drle"], "image/emf": ["emf"], "image/fits": ["fits"], "image/g3fax": ["g3"], "image/gif": ["gif"], "image/heic": ["heic"], "image/heic-sequence": ["heics"], "image/heif": ["heif"], "image/heif-sequence": ["heifs"], "image/hej2k": ["hej2"], "image/hsj2": ["hsj2"], "image/ief": ["ief"], "image/jls": ["jls"], "image/jp2": ["jp2", "jpg2"], "image/jpeg": ["jpeg", "jpg", "jpe"], "image/jph": ["jph"], "image/jphc": ["jhc"], "image/jpm": ["jpm"], "image/jpx": ["jpx", "jpf"], "image/jxr": ["jxr"], "image/jxra": ["jxra"], "image/jxrs": ["jxrs"], "image/jxs": ["jxs"], "image/jxsc": ["jxsc"], "image/jxsi": ["jxsi"], "image/jxss": ["jxss"], "image/ktx": ["ktx"], "image/ktx2": ["ktx2"], "image/png": ["png"], "image/sgi": ["sgi"], "image/svg+xml": ["svg", "svgz"], "image/t38": ["t38"], "image/tiff": ["tif", "tiff"], "image/tiff-fx": ["tfx"], "image/webp": ["webp"], "image/wmf": ["wmf"], "message/disposition-notification": ["disposition-notification"], "message/global": ["u8msg"], "message/global-delivery-status": ["u8dsn"], "message/global-disposition-notification": ["u8mdn"], "message/global-headers": ["u8hdr"], "message/rfc822": ["eml", "mime"], "model/3mf": ["3mf"], "model/gltf+json": ["gltf"], "model/gltf-binary": ["glb"], "model/iges": ["igs", "iges"], "model/mesh": ["msh", "mesh", "silo"], "model/mtl": ["mtl"], "model/obj": ["obj"], "model/stl": ["stl"], "model/vrml": ["wrl", "vrml"], "model/x3d+binary": ["*x3db", "x3dbz"], "model/x3d+fastinfoset": ["x3db"], "model/x3d+vrml": ["*x3dv", "x3dvz"], "model/x3d+xml": ["x3d", "x3dz"], "model/x3d-vrml": ["x3dv"], "text/cache-manifest": ["appcache", "manifest"], "text/calendar": ["ics", "ifb"], "text/coffeescript": ["coffee", "litcoffee"], "text/css": ["css"], "text/csv": ["csv"], "text/html": ["html", "htm", "shtml"], "text/jade": ["jade"], "text/jsx": ["jsx"], "text/less": ["less"], "text/markdown": ["markdown", "md"], "text/mathml": ["mml"], "text/mdx": ["mdx"], "text/n3": ["n3"], "text/plain": ["txt", "text", "conf", "def", "list", "log", "in", "ini"], "text/richtext": ["rtx"], "text/rtf": ["*rtf"], "text/sgml": ["sgml", "sgm"], "text/shex": ["shex"], "text/slim": ["slim", "slm"], "text/spdx": ["spdx"], "text/stylus": ["stylus", "styl"], "text/tab-separated-values": ["tsv"], "text/troff": ["t", "tr", "roff", "man", "me", "ms"], "text/turtle": ["ttl"], "text/uri-list": ["uri", "uris", "urls"], "text/vcard": ["vcard"], "text/vtt": ["vtt"], "text/xml": ["*xml"], "text/yaml": ["yaml", "yml"], "video/3gpp": ["3gp", "3gpp"], "video/3gpp2": ["3g2"], "video/h261": ["h261"], "video/h263": ["h263"], "video/h264": ["h264"], "video/iso.segment": ["m4s"], "video/jpeg": ["jpgv"], "video/jpm": ["*jpm", "jpgm"], "video/mj2": ["mj2", "mjp2"], "video/mp2t": ["ts"], "video/mp4": ["mp4", "mp4v", "mpg4"], "video/mpeg": ["mpeg", "mpg", "mpe", "m1v", "m2v"], "video/ogg": ["ogv"], "video/quicktime": ["qt", "mov"], "video/webm": ["webm"] };
119
- }
120
- });
121
-
122
- // ../../node_modules/.pnpm/mime@2.5.2/node_modules/mime/lite.js
123
- var require_lite = _chunk7EYE5BOQjs.__commonJS.call(void 0, {
124
- "../../node_modules/.pnpm/mime@2.5.2/node_modules/mime/lite.js"(exports, module) {
125
- _chunk7EYE5BOQjs.init_cjs_shims.call(void 0, );
126
- "use strict";
127
- var Mime = require_Mime();
128
- module.exports = new Mime(require_standard());
129
- }
130
- });
131
-
132
- // ../../node_modules/.pnpm/sirv@1.0.18/node_modules/sirv/build.js
133
- var require_build2 = _chunk7EYE5BOQjs.__commonJS.call(void 0, {
134
- "../../node_modules/.pnpm/sirv@1.0.18/node_modules/sirv/build.js"(exports, module) {
135
- _chunk7EYE5BOQjs.init_cjs_shims.call(void 0, );
136
- var fs2 = _chunk7EYE5BOQjs.__require.call(void 0, "fs");
137
- var { join: join2, normalize, resolve: resolve2 } = _chunk7EYE5BOQjs.__require.call(void 0, "path");
138
- var { parse } = require_build();
139
- var list = require_sync();
140
- var mime = require_lite();
141
- var noop = () => {
142
- };
143
- function isMatch(uri, arr) {
144
- for (let i = 0; i < arr.length; i++) {
145
- if (arr[i].test(uri))
146
- return true;
147
- }
148
- }
149
- function toAssume(uri, extns) {
150
- let i = 0, x, len = uri.length - 1;
151
- if (uri.charCodeAt(len) === 47) {
152
- uri = uri.substring(0, len);
153
- }
154
- let arr = [], tmp = `${uri}/index`;
155
- for (; i < extns.length; i++) {
156
- x = extns[i] ? `.${extns[i]}` : "";
157
- if (uri)
158
- arr.push(uri + x);
159
- arr.push(tmp + x);
160
- }
161
- return arr;
162
- }
163
- function viaCache(cache, uri, extns) {
164
- let i = 0, data, arr = toAssume(uri, extns);
165
- for (; i < arr.length; i++) {
166
- if (data = cache[arr[i]])
167
- return data;
168
- }
169
- }
170
- function viaLocal(dir, isEtag, uri, extns) {
171
- let i = 0, arr = toAssume(uri, extns);
172
- let abs, stats, name, headers;
173
- for (; i < arr.length; i++) {
174
- abs = normalize(join2(dir, name = arr[i]));
175
- if (abs.startsWith(dir) && fs2.existsSync(abs)) {
176
- stats = fs2.statSync(abs);
177
- if (stats.isDirectory())
178
- continue;
179
- headers = toHeaders(name, stats, isEtag);
180
- headers["Cache-Control"] = isEtag ? "no-cache" : "no-store";
181
- return { abs, stats, headers };
182
- }
183
- }
184
- }
185
- function is404(req, res) {
186
- return res.statusCode = 404, res.end();
187
- }
188
- function send(req, res, file, stats, headers) {
189
- let code = 200, tmp, opts = {};
190
- headers = _chunk7EYE5BOQjs.__spreadValues.call(void 0, {}, headers);
191
- for (let key in headers) {
192
- tmp = res.getHeader(key);
193
- if (tmp)
194
- headers[key] = tmp;
195
- }
196
- if (tmp = res.getHeader("content-type")) {
197
- headers["Content-Type"] = tmp;
198
- }
199
- if (req.headers.range) {
200
- code = 206;
201
- let [x, y] = req.headers.range.replace("bytes=", "").split("-");
202
- let end = opts.end = parseInt(y, 10) || stats.size - 1;
203
- let start = opts.start = parseInt(x, 10) || 0;
204
- if (start >= stats.size || end >= stats.size) {
205
- res.setHeader("Content-Range", `bytes */${stats.size}`);
206
- res.statusCode = 416;
207
- return res.end();
208
- }
209
- headers["Content-Range"] = `bytes ${start}-${end}/${stats.size}`;
210
- headers["Content-Length"] = end - start + 1;
211
- headers["Accept-Ranges"] = "bytes";
212
- }
213
- res.writeHead(code, headers);
214
- fs2.createReadStream(file, opts).pipe(res);
215
- }
216
- var ENCODING = {
217
- ".br": "br",
218
- ".gz": "gzip"
219
- };
220
- function toHeaders(name, stats, isEtag) {
221
- let enc = ENCODING[name.slice(-3)];
222
- let ctype = mime.getType(name.slice(0, enc && -3)) || "";
223
- if (ctype === "text/html")
224
- ctype += ";charset=utf-8";
225
- let headers = {
226
- "Content-Length": stats.size,
227
- "Content-Type": ctype,
228
- "Last-Modified": stats.mtime.toUTCString()
229
- };
230
- if (enc)
231
- headers["Content-Encoding"] = enc;
232
- if (isEtag)
233
- headers["ETag"] = `W/"${stats.size}-${stats.mtime.getTime()}"`;
234
- return headers;
235
- }
236
- module.exports = function(dir, opts = {}) {
237
- dir = resolve2(dir || ".");
238
- let isNotFound = opts.onNoMatch || is404;
239
- let setHeaders = opts.setHeaders || noop;
240
- let extensions = opts.extensions || ["html", "htm"];
241
- let gzips = opts.gzip && extensions.map((x) => `${x}.gz`).concat("gz");
242
- let brots = opts.brotli && extensions.map((x) => `${x}.br`).concat("br");
243
- const FILES = {};
244
- let fallback = "/";
245
- let isEtag = !!opts.etag;
246
- let isSPA = !!opts.single;
247
- if (typeof opts.single === "string") {
248
- let idx = opts.single.lastIndexOf(".");
249
- fallback += !!~idx ? opts.single.substring(0, idx) : opts.single;
250
- }
251
- let ignores = [];
252
- if (opts.ignores !== false) {
253
- ignores.push(/[/]([A-Za-z\s\d~$._-]+\.\w+){1,}$/);
254
- if (opts.dotfiles)
255
- ignores.push(/\/\.\w/);
256
- else
257
- ignores.push(/\/\.well-known/);
258
- [].concat(opts.ignores || []).forEach((x) => {
259
- ignores.push(new RegExp(x, "i"));
260
- });
261
- }
262
- let cc = opts.maxAge != null && `public,max-age=${opts.maxAge}`;
263
- if (cc && opts.immutable)
264
- cc += ",immutable";
265
- else if (cc && opts.maxAge === 0)
266
- cc += ",must-revalidate";
267
- if (!opts.dev) {
268
- list(dir, (name, abs, stats) => {
269
- if (/\.well-known[\\+\/]/.test(name)) {
270
- } else if (!opts.dotfiles && /(^\.|[\\+|\/+]\.)/.test(name))
271
- return;
272
- let headers = toHeaders(name, stats, isEtag);
273
- if (cc)
274
- headers["Cache-Control"] = cc;
275
- FILES["/" + name.normalize().replace(/\\+/g, "/")] = { abs, stats, headers };
276
- });
277
- }
278
- let lookup = opts.dev ? viaLocal.bind(0, dir, isEtag) : viaCache.bind(0, FILES);
279
- return function(req, res, next) {
280
- let extns = [""];
281
- let pathname = parse(req).pathname;
282
- let val = req.headers["accept-encoding"] || "";
283
- if (gzips && val.includes("gzip"))
284
- extns.unshift(...gzips);
285
- if (brots && /(br|brotli)/i.test(val))
286
- extns.unshift(...brots);
287
- extns.push(...extensions);
288
- if (pathname.indexOf("%") !== -1) {
289
- try {
290
- pathname = decodeURIComponent(pathname);
291
- } catch (err) {
292
- }
293
- }
294
- let data = lookup(pathname, extns) || isSPA && !isMatch(pathname, ignores) && lookup(fallback, extns);
295
- if (!data)
296
- return next ? next() : isNotFound(req, res);
297
- if (isEtag && req.headers["if-none-match"] === data.headers["ETag"]) {
298
- res.writeHead(304);
299
- return res.end();
300
- }
301
- if (gzips || brots) {
302
- res.setHeader("Vary", "Accept-Encoding");
303
- }
304
- setHeaders(res, pathname, data.stats);
305
- send(req, res, data.abs, data.stats, data.headers);
306
- };
307
- };
308
- }
309
- });
310
-
311
- // node/build.ts
312
- _chunk7EYE5BOQjs.init_cjs_shims.call(void 0, );
313
- var import_sirv = _chunk7EYE5BOQjs.__toModule.call(void 0, require_build2());
314
- var _path = require('path');
315
- var _http = require('http'); var _http2 = _interopRequireDefault(_http);
316
- var _fsextra = require('fs-extra'); var _fsextra2 = _interopRequireDefault(_fsextra);
317
- var _vite = require('vite');
318
- var _connect = require('connect'); var _connect2 = _interopRequireDefault(_connect);
319
- var _kolorist = require('kolorist');
320
- async function build(options, viteConfig = {}) {
321
- const indexPath = _path.resolve.call(void 0, options.userRoot, "index.html");
322
- const rawConfig = await _vite.resolveConfig.call(void 0, {}, "build");
323
- const pluginOptions = rawConfig.slidev || {};
324
- let originalIndexHTML;
325
- if (_fsextra2.default.existsSync(indexPath))
326
- originalIndexHTML = await _fsextra2.default.readFile(indexPath, "utf-8");
327
- await _fsextra2.default.writeFile(indexPath, await _chunkDVHCB7TLjs.getIndexHtml.call(void 0, options), "utf-8");
328
- let config = void 0;
329
- try {
330
- const inlineConfig = _vite.mergeConfig.call(void 0, viteConfig, {
331
- plugins: [
332
- await _chunkDVHCB7TLjs.ViteSlidevPlugin.call(void 0, options, pluginOptions),
333
- {
334
- name: "resolve-config",
335
- configResolved(_config) {
336
- config = _config;
337
- }
338
- }
339
- ],
340
- build: {
341
- chunkSizeWarningLimit: 2e3
342
- }
343
- });
344
- await _vite.build.call(void 0, inlineConfig);
345
- if (options.data.features.monaco) {
346
- if (options.data.config.monaco === "dev") {
347
- console.log(_kolorist.yellow.call(void 0, " Monaco is disabled in the build, to enabled it, set `monaco: true` in the frontmatter"));
348
- } else {
349
- console.log(_kolorist.blue.call(void 0, " building for Monaco...\n"));
350
- await _vite.build.call(void 0, _vite.mergeConfig.call(void 0, inlineConfig, {
351
- root: _path.join.call(void 0, options.clientRoot, "iframes/monaco"),
352
- base: `${config.base}iframes/monaco/`,
353
- build: {
354
- outDir: _path.resolve.call(void 0, config.build.outDir, "iframes/monaco"),
355
- rollupOptions: {
356
- output: {
357
- manualChunks: {
358
- jsonWorker: ["monaco-editor/esm/vs/language/json/json.worker"],
359
- cssWorker: ["monaco-editor/esm/vs/language/css/css.worker"],
360
- htmlWorker: ["monaco-editor/esm/vs/language/html/html.worker"],
361
- tsWorker: ["monaco-editor/esm/vs/language/typescript/ts.worker"],
362
- editorWorker: ["monaco-editor/esm/vs/editor/editor.worker"]
363
- }
364
- }
365
- }
366
- }
367
- }));
368
- }
369
- }
370
- } finally {
371
- if (originalIndexHTML != null)
372
- await _fsextra2.default.writeFile(indexPath, originalIndexHTML, "utf-8");
373
- else
374
- await _fsextra2.default.unlink(indexPath);
375
- }
376
- await _fsextra2.default.copyFile(_path.resolve.call(void 0, config.build.outDir, "index.html"), _path.resolve.call(void 0, config.build.outDir, "404.html"));
377
- const redirectsPath = _path.resolve.call(void 0, config.build.outDir, "_redirects");
378
- if (!_fsextra2.default.existsSync(redirectsPath))
379
- await _fsextra2.default.writeFile(redirectsPath, `${config.base}* ${config.base}index.html 200
380
- `, "utf-8");
381
- if ([true, "true", "auto"].includes(options.data.config.download)) {
382
- const { exportSlides } = await Promise.resolve().then(() => _chunk7EYE5BOQjs.__toModule.call(void 0, _chunk7EYE5BOQjs.__require.call(void 0, "./export-YPXOSS5M.js")));
383
- const port = 12445;
384
- const app = _connect2.default.call(void 0, );
385
- const server = _http2.default.createServer(app);
386
- app.use(config.base, (0, import_sirv.default)(config.build.outDir, {
387
- etag: true,
388
- single: true,
389
- dev: true
390
- }));
391
- server.listen(port);
392
- await exportSlides({
393
- port,
394
- total: options.data.slides.length,
395
- format: "pdf",
396
- output: _path.join.call(void 0, config.build.outDir, "slidev-exported.pdf"),
397
- base: config.base,
398
- dark: options.data.config.colorSchema === "dark",
399
- width: 1920,
400
- height: Math.round(1920 / options.data.config.aspectRatio),
401
- routerMode: options.data.config.routerMode
402
- });
403
- server.close();
404
- }
405
- }
406
-
407
-
408
- exports.build = build;