@sveltejs/kit 1.0.0-next.40 → 1.0.0-next.402

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/README.md +12 -9
  2. package/assets/app/env.js +13 -0
  3. package/assets/app/navigation.js +24 -0
  4. package/assets/app/paths.js +1 -0
  5. package/assets/{runtime/app → app}/stores.js +33 -29
  6. package/assets/client/singletons.js +13 -0
  7. package/assets/client/start.js +1845 -0
  8. package/assets/components/error.svelte +18 -2
  9. package/assets/env/dynamic/private.js +1 -0
  10. package/assets/env/dynamic/public.js +1 -0
  11. package/assets/env-private.js +9 -0
  12. package/assets/env-public.js +9 -0
  13. package/assets/env.js +8 -0
  14. package/assets/{runtime/chunks/paths.js → paths.js} +4 -3
  15. package/assets/server/index.js +3579 -0
  16. package/dist/chunks/error.js +12 -0
  17. package/dist/chunks/filesystem.js +110 -0
  18. package/dist/chunks/index.js +541 -3385
  19. package/dist/chunks/index2.js +15631 -473
  20. package/dist/chunks/index3.js +189 -217
  21. package/dist/chunks/multipart-parser.js +458 -0
  22. package/dist/chunks/sync.js +1366 -0
  23. package/dist/chunks/utils.js +40 -57
  24. package/dist/chunks/write_tsconfig.js +273 -0
  25. package/dist/cli.js +85 -513
  26. package/dist/hooks.js +28 -0
  27. package/dist/node/polyfills.js +17778 -0
  28. package/dist/node.js +348 -0
  29. package/dist/prerender.js +788 -0
  30. package/dist/vite.js +2520 -0
  31. package/package.json +98 -64
  32. package/svelte-kit.js +10 -1
  33. package/types/ambient.d.ts +375 -0
  34. package/types/index.d.ts +298 -0
  35. package/types/internal.d.ts +335 -0
  36. package/types/private.d.ts +235 -0
  37. package/CHANGELOG.md +0 -411
  38. package/assets/runtime/app/env.js +0 -5
  39. package/assets/runtime/app/navigation.js +0 -41
  40. package/assets/runtime/app/paths.js +0 -1
  41. package/assets/runtime/chunks/utils.js +0 -19
  42. package/assets/runtime/internal/singletons.js +0 -23
  43. package/assets/runtime/internal/start.js +0 -770
  44. package/dist/chunks/index4.js +0 -526
  45. package/dist/chunks/index5.js +0 -761
  46. package/dist/chunks/index6.js +0 -322
  47. package/dist/chunks/standard.js +0 -99
  48. package/dist/ssr.js +0 -2523
@@ -0,0 +1,1366 @@
1
+ import path__default from 'path';
2
+ import fs__default from 'fs';
3
+ import { g as get_runtime_directory } from './utils.js';
4
+ import { p as posixify, c as copy, r as rimraf } from './filesystem.js';
5
+ import { fileURLToPath } from 'url';
6
+ import { w as write_if_changed, t as trim, a as write, v as valid_identifier, r as reserved, b as write_tsconfig } from './write_tsconfig.js';
7
+ import { $ } from './index.js';
8
+ import { loadEnv, normalizePath, loadConfigFromFile } from 'vite';
9
+
10
+ /**
11
+ * @param typeMap [Object] Map of MIME type -> Array[extensions]
12
+ * @param ...
13
+ */
14
+ function Mime$1() {
15
+ this._types = Object.create(null);
16
+ this._extensions = Object.create(null);
17
+
18
+ for (let i = 0; i < arguments.length; i++) {
19
+ this.define(arguments[i]);
20
+ }
21
+
22
+ this.define = this.define.bind(this);
23
+ this.getType = this.getType.bind(this);
24
+ this.getExtension = this.getExtension.bind(this);
25
+ }
26
+
27
+ /**
28
+ * Define mimetype -> extension mappings. Each key is a mime-type that maps
29
+ * to an array of extensions associated with the type. The first extension is
30
+ * used as the default extension for the type.
31
+ *
32
+ * e.g. mime.define({'audio/ogg', ['oga', 'ogg', 'spx']});
33
+ *
34
+ * If a type declares an extension that has already been defined, an error will
35
+ * be thrown. To suppress this error and force the extension to be associated
36
+ * with the new type, pass `force`=true. Alternatively, you may prefix the
37
+ * extension with "*" to map the type to extension, without mapping the
38
+ * extension to the type.
39
+ *
40
+ * e.g. mime.define({'audio/wav', ['wav']}, {'audio/x-wav', ['*wav']});
41
+ *
42
+ *
43
+ * @param map (Object) type definitions
44
+ * @param force (Boolean) if true, force overriding of existing definitions
45
+ */
46
+ Mime$1.prototype.define = function(typeMap, force) {
47
+ for (let type in typeMap) {
48
+ let extensions = typeMap[type].map(function(t) {
49
+ return t.toLowerCase();
50
+ });
51
+ type = type.toLowerCase();
52
+
53
+ for (let i = 0; i < extensions.length; i++) {
54
+ const ext = extensions[i];
55
+
56
+ // '*' prefix = not the preferred type for this extension. So fixup the
57
+ // extension, and skip it.
58
+ if (ext[0] === '*') {
59
+ continue;
60
+ }
61
+
62
+ if (!force && (ext in this._types)) {
63
+ throw new Error(
64
+ 'Attempt to change mapping for "' + ext +
65
+ '" extension from "' + this._types[ext] + '" to "' + type +
66
+ '". Pass `force=true` to allow this, otherwise remove "' + ext +
67
+ '" from the list of extensions for "' + type + '".'
68
+ );
69
+ }
70
+
71
+ this._types[ext] = type;
72
+ }
73
+
74
+ // Use first extension as default
75
+ if (force || !this._extensions[type]) {
76
+ const ext = extensions[0];
77
+ this._extensions[type] = (ext[0] !== '*') ? ext : ext.substr(1);
78
+ }
79
+ }
80
+ };
81
+
82
+ /**
83
+ * Lookup a mime type based on extension
84
+ */
85
+ Mime$1.prototype.getType = function(path) {
86
+ path = String(path);
87
+ let last = path.replace(/^.*[/\\]/, '').toLowerCase();
88
+ let ext = last.replace(/^.*\./, '').toLowerCase();
89
+
90
+ let hasPath = last.length < path.length;
91
+ let hasDot = ext.length < last.length - 1;
92
+
93
+ return (hasDot || !hasPath) && this._types[ext] || null;
94
+ };
95
+
96
+ /**
97
+ * Return file extension associated with a mime type
98
+ */
99
+ Mime$1.prototype.getExtension = function(type) {
100
+ type = /^\s*([^;\s]*)/.test(type) && RegExp.$1;
101
+ return type && this._extensions[type.toLowerCase()] || null;
102
+ };
103
+
104
+ var Mime_1 = Mime$1;
105
+
106
+ var standard = {"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":["es","ecma"],"application/emma+xml":["emma"],"application/emotionml+xml":["emotionml"],"application/epub+zip":["epub"],"application/exi":["exi"],"application/express":["exp"],"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/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/trig":["trig"],"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-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/step+xml":["stpx"],"model/step+zip":["stpz"],"model/step-xml+zip":["stpxz"],"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"]};
107
+
108
+ var other = {"application/prs.cww":["cww"],"application/vnd.1000minds.decision-model+xml":["1km"],"application/vnd.3gpp.pic-bw-large":["plb"],"application/vnd.3gpp.pic-bw-small":["psb"],"application/vnd.3gpp.pic-bw-var":["pvb"],"application/vnd.3gpp2.tcap":["tcap"],"application/vnd.3m.post-it-notes":["pwn"],"application/vnd.accpac.simply.aso":["aso"],"application/vnd.accpac.simply.imp":["imp"],"application/vnd.acucobol":["acu"],"application/vnd.acucorp":["atc","acutc"],"application/vnd.adobe.air-application-installer-package+zip":["air"],"application/vnd.adobe.formscentral.fcdt":["fcdt"],"application/vnd.adobe.fxp":["fxp","fxpl"],"application/vnd.adobe.xdp+xml":["xdp"],"application/vnd.adobe.xfdf":["xfdf"],"application/vnd.ahead.space":["ahead"],"application/vnd.airzip.filesecure.azf":["azf"],"application/vnd.airzip.filesecure.azs":["azs"],"application/vnd.amazon.ebook":["azw"],"application/vnd.americandynamics.acc":["acc"],"application/vnd.amiga.ami":["ami"],"application/vnd.android.package-archive":["apk"],"application/vnd.anser-web-certificate-issue-initiation":["cii"],"application/vnd.anser-web-funds-transfer-initiation":["fti"],"application/vnd.antix.game-component":["atx"],"application/vnd.apple.installer+xml":["mpkg"],"application/vnd.apple.keynote":["key"],"application/vnd.apple.mpegurl":["m3u8"],"application/vnd.apple.numbers":["numbers"],"application/vnd.apple.pages":["pages"],"application/vnd.apple.pkpass":["pkpass"],"application/vnd.aristanetworks.swi":["swi"],"application/vnd.astraea-software.iota":["iota"],"application/vnd.audiograph":["aep"],"application/vnd.balsamiq.bmml+xml":["bmml"],"application/vnd.blueice.multipass":["mpm"],"application/vnd.bmi":["bmi"],"application/vnd.businessobjects":["rep"],"application/vnd.chemdraw+xml":["cdxml"],"application/vnd.chipnuts.karaoke-mmd":["mmd"],"application/vnd.cinderella":["cdy"],"application/vnd.citationstyles.style+xml":["csl"],"application/vnd.claymore":["cla"],"application/vnd.cloanto.rp9":["rp9"],"application/vnd.clonk.c4group":["c4g","c4d","c4f","c4p","c4u"],"application/vnd.cluetrust.cartomobile-config":["c11amc"],"application/vnd.cluetrust.cartomobile-config-pkg":["c11amz"],"application/vnd.commonspace":["csp"],"application/vnd.contact.cmsg":["cdbcmsg"],"application/vnd.cosmocaller":["cmc"],"application/vnd.crick.clicker":["clkx"],"application/vnd.crick.clicker.keyboard":["clkk"],"application/vnd.crick.clicker.palette":["clkp"],"application/vnd.crick.clicker.template":["clkt"],"application/vnd.crick.clicker.wordbank":["clkw"],"application/vnd.criticaltools.wbs+xml":["wbs"],"application/vnd.ctc-posml":["pml"],"application/vnd.cups-ppd":["ppd"],"application/vnd.curl.car":["car"],"application/vnd.curl.pcurl":["pcurl"],"application/vnd.dart":["dart"],"application/vnd.data-vision.rdz":["rdz"],"application/vnd.dbf":["dbf"],"application/vnd.dece.data":["uvf","uvvf","uvd","uvvd"],"application/vnd.dece.ttml+xml":["uvt","uvvt"],"application/vnd.dece.unspecified":["uvx","uvvx"],"application/vnd.dece.zip":["uvz","uvvz"],"application/vnd.denovo.fcselayout-link":["fe_launch"],"application/vnd.dna":["dna"],"application/vnd.dolby.mlp":["mlp"],"application/vnd.dpgraph":["dpg"],"application/vnd.dreamfactory":["dfac"],"application/vnd.ds-keypoint":["kpxx"],"application/vnd.dvb.ait":["ait"],"application/vnd.dvb.service":["svc"],"application/vnd.dynageo":["geo"],"application/vnd.ecowin.chart":["mag"],"application/vnd.enliven":["nml"],"application/vnd.epson.esf":["esf"],"application/vnd.epson.msf":["msf"],"application/vnd.epson.quickanime":["qam"],"application/vnd.epson.salt":["slt"],"application/vnd.epson.ssf":["ssf"],"application/vnd.eszigno3+xml":["es3","et3"],"application/vnd.ezpix-album":["ez2"],"application/vnd.ezpix-package":["ez3"],"application/vnd.fdf":["fdf"],"application/vnd.fdsn.mseed":["mseed"],"application/vnd.fdsn.seed":["seed","dataless"],"application/vnd.flographit":["gph"],"application/vnd.fluxtime.clip":["ftc"],"application/vnd.framemaker":["fm","frame","maker","book"],"application/vnd.frogans.fnc":["fnc"],"application/vnd.frogans.ltf":["ltf"],"application/vnd.fsc.weblaunch":["fsc"],"application/vnd.fujitsu.oasys":["oas"],"application/vnd.fujitsu.oasys2":["oa2"],"application/vnd.fujitsu.oasys3":["oa3"],"application/vnd.fujitsu.oasysgp":["fg5"],"application/vnd.fujitsu.oasysprs":["bh2"],"application/vnd.fujixerox.ddd":["ddd"],"application/vnd.fujixerox.docuworks":["xdw"],"application/vnd.fujixerox.docuworks.binder":["xbd"],"application/vnd.fuzzysheet":["fzs"],"application/vnd.genomatix.tuxedo":["txd"],"application/vnd.geogebra.file":["ggb"],"application/vnd.geogebra.tool":["ggt"],"application/vnd.geometry-explorer":["gex","gre"],"application/vnd.geonext":["gxt"],"application/vnd.geoplan":["g2w"],"application/vnd.geospace":["g3w"],"application/vnd.gmx":["gmx"],"application/vnd.google-apps.document":["gdoc"],"application/vnd.google-apps.presentation":["gslides"],"application/vnd.google-apps.spreadsheet":["gsheet"],"application/vnd.google-earth.kml+xml":["kml"],"application/vnd.google-earth.kmz":["kmz"],"application/vnd.grafeq":["gqf","gqs"],"application/vnd.groove-account":["gac"],"application/vnd.groove-help":["ghf"],"application/vnd.groove-identity-message":["gim"],"application/vnd.groove-injector":["grv"],"application/vnd.groove-tool-message":["gtm"],"application/vnd.groove-tool-template":["tpl"],"application/vnd.groove-vcard":["vcg"],"application/vnd.hal+xml":["hal"],"application/vnd.handheld-entertainment+xml":["zmm"],"application/vnd.hbci":["hbci"],"application/vnd.hhe.lesson-player":["les"],"application/vnd.hp-hpgl":["hpgl"],"application/vnd.hp-hpid":["hpid"],"application/vnd.hp-hps":["hps"],"application/vnd.hp-jlyt":["jlt"],"application/vnd.hp-pcl":["pcl"],"application/vnd.hp-pclxl":["pclxl"],"application/vnd.hydrostatix.sof-data":["sfd-hdstx"],"application/vnd.ibm.minipay":["mpy"],"application/vnd.ibm.modcap":["afp","listafp","list3820"],"application/vnd.ibm.rights-management":["irm"],"application/vnd.ibm.secure-container":["sc"],"application/vnd.iccprofile":["icc","icm"],"application/vnd.igloader":["igl"],"application/vnd.immervision-ivp":["ivp"],"application/vnd.immervision-ivu":["ivu"],"application/vnd.insors.igm":["igm"],"application/vnd.intercon.formnet":["xpw","xpx"],"application/vnd.intergeo":["i2g"],"application/vnd.intu.qbo":["qbo"],"application/vnd.intu.qfx":["qfx"],"application/vnd.ipunplugged.rcprofile":["rcprofile"],"application/vnd.irepository.package+xml":["irp"],"application/vnd.is-xpr":["xpr"],"application/vnd.isac.fcs":["fcs"],"application/vnd.jam":["jam"],"application/vnd.jcp.javame.midlet-rms":["rms"],"application/vnd.jisp":["jisp"],"application/vnd.joost.joda-archive":["joda"],"application/vnd.kahootz":["ktz","ktr"],"application/vnd.kde.karbon":["karbon"],"application/vnd.kde.kchart":["chrt"],"application/vnd.kde.kformula":["kfo"],"application/vnd.kde.kivio":["flw"],"application/vnd.kde.kontour":["kon"],"application/vnd.kde.kpresenter":["kpr","kpt"],"application/vnd.kde.kspread":["ksp"],"application/vnd.kde.kword":["kwd","kwt"],"application/vnd.kenameaapp":["htke"],"application/vnd.kidspiration":["kia"],"application/vnd.kinar":["kne","knp"],"application/vnd.koan":["skp","skd","skt","skm"],"application/vnd.kodak-descriptor":["sse"],"application/vnd.las.las+xml":["lasxml"],"application/vnd.llamagraphics.life-balance.desktop":["lbd"],"application/vnd.llamagraphics.life-balance.exchange+xml":["lbe"],"application/vnd.lotus-1-2-3":["123"],"application/vnd.lotus-approach":["apr"],"application/vnd.lotus-freelance":["pre"],"application/vnd.lotus-notes":["nsf"],"application/vnd.lotus-organizer":["org"],"application/vnd.lotus-screencam":["scm"],"application/vnd.lotus-wordpro":["lwp"],"application/vnd.macports.portpkg":["portpkg"],"application/vnd.mapbox-vector-tile":["mvt"],"application/vnd.mcd":["mcd"],"application/vnd.medcalcdata":["mc1"],"application/vnd.mediastation.cdkey":["cdkey"],"application/vnd.mfer":["mwf"],"application/vnd.mfmp":["mfm"],"application/vnd.micrografx.flo":["flo"],"application/vnd.micrografx.igx":["igx"],"application/vnd.mif":["mif"],"application/vnd.mobius.daf":["daf"],"application/vnd.mobius.dis":["dis"],"application/vnd.mobius.mbk":["mbk"],"application/vnd.mobius.mqy":["mqy"],"application/vnd.mobius.msl":["msl"],"application/vnd.mobius.plc":["plc"],"application/vnd.mobius.txf":["txf"],"application/vnd.mophun.application":["mpn"],"application/vnd.mophun.certificate":["mpc"],"application/vnd.mozilla.xul+xml":["xul"],"application/vnd.ms-artgalry":["cil"],"application/vnd.ms-cab-compressed":["cab"],"application/vnd.ms-excel":["xls","xlm","xla","xlc","xlt","xlw"],"application/vnd.ms-excel.addin.macroenabled.12":["xlam"],"application/vnd.ms-excel.sheet.binary.macroenabled.12":["xlsb"],"application/vnd.ms-excel.sheet.macroenabled.12":["xlsm"],"application/vnd.ms-excel.template.macroenabled.12":["xltm"],"application/vnd.ms-fontobject":["eot"],"application/vnd.ms-htmlhelp":["chm"],"application/vnd.ms-ims":["ims"],"application/vnd.ms-lrm":["lrm"],"application/vnd.ms-officetheme":["thmx"],"application/vnd.ms-outlook":["msg"],"application/vnd.ms-pki.seccat":["cat"],"application/vnd.ms-pki.stl":["*stl"],"application/vnd.ms-powerpoint":["ppt","pps","pot"],"application/vnd.ms-powerpoint.addin.macroenabled.12":["ppam"],"application/vnd.ms-powerpoint.presentation.macroenabled.12":["pptm"],"application/vnd.ms-powerpoint.slide.macroenabled.12":["sldm"],"application/vnd.ms-powerpoint.slideshow.macroenabled.12":["ppsm"],"application/vnd.ms-powerpoint.template.macroenabled.12":["potm"],"application/vnd.ms-project":["mpp","mpt"],"application/vnd.ms-word.document.macroenabled.12":["docm"],"application/vnd.ms-word.template.macroenabled.12":["dotm"],"application/vnd.ms-works":["wps","wks","wcm","wdb"],"application/vnd.ms-wpl":["wpl"],"application/vnd.ms-xpsdocument":["xps"],"application/vnd.mseq":["mseq"],"application/vnd.musician":["mus"],"application/vnd.muvee.style":["msty"],"application/vnd.mynfc":["taglet"],"application/vnd.neurolanguage.nlu":["nlu"],"application/vnd.nitf":["ntf","nitf"],"application/vnd.noblenet-directory":["nnd"],"application/vnd.noblenet-sealer":["nns"],"application/vnd.noblenet-web":["nnw"],"application/vnd.nokia.n-gage.ac+xml":["*ac"],"application/vnd.nokia.n-gage.data":["ngdat"],"application/vnd.nokia.n-gage.symbian.install":["n-gage"],"application/vnd.nokia.radio-preset":["rpst"],"application/vnd.nokia.radio-presets":["rpss"],"application/vnd.novadigm.edm":["edm"],"application/vnd.novadigm.edx":["edx"],"application/vnd.novadigm.ext":["ext"],"application/vnd.oasis.opendocument.chart":["odc"],"application/vnd.oasis.opendocument.chart-template":["otc"],"application/vnd.oasis.opendocument.database":["odb"],"application/vnd.oasis.opendocument.formula":["odf"],"application/vnd.oasis.opendocument.formula-template":["odft"],"application/vnd.oasis.opendocument.graphics":["odg"],"application/vnd.oasis.opendocument.graphics-template":["otg"],"application/vnd.oasis.opendocument.image":["odi"],"application/vnd.oasis.opendocument.image-template":["oti"],"application/vnd.oasis.opendocument.presentation":["odp"],"application/vnd.oasis.opendocument.presentation-template":["otp"],"application/vnd.oasis.opendocument.spreadsheet":["ods"],"application/vnd.oasis.opendocument.spreadsheet-template":["ots"],"application/vnd.oasis.opendocument.text":["odt"],"application/vnd.oasis.opendocument.text-master":["odm"],"application/vnd.oasis.opendocument.text-template":["ott"],"application/vnd.oasis.opendocument.text-web":["oth"],"application/vnd.olpc-sugar":["xo"],"application/vnd.oma.dd2+xml":["dd2"],"application/vnd.openblox.game+xml":["obgx"],"application/vnd.openofficeorg.extension":["oxt"],"application/vnd.openstreetmap.data+xml":["osm"],"application/vnd.openxmlformats-officedocument.presentationml.presentation":["pptx"],"application/vnd.openxmlformats-officedocument.presentationml.slide":["sldx"],"application/vnd.openxmlformats-officedocument.presentationml.slideshow":["ppsx"],"application/vnd.openxmlformats-officedocument.presentationml.template":["potx"],"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":["xlsx"],"application/vnd.openxmlformats-officedocument.spreadsheetml.template":["xltx"],"application/vnd.openxmlformats-officedocument.wordprocessingml.document":["docx"],"application/vnd.openxmlformats-officedocument.wordprocessingml.template":["dotx"],"application/vnd.osgeo.mapguide.package":["mgp"],"application/vnd.osgi.dp":["dp"],"application/vnd.osgi.subsystem":["esa"],"application/vnd.palm":["pdb","pqa","oprc"],"application/vnd.pawaafile":["paw"],"application/vnd.pg.format":["str"],"application/vnd.pg.osasli":["ei6"],"application/vnd.picsel":["efif"],"application/vnd.pmi.widget":["wg"],"application/vnd.pocketlearn":["plf"],"application/vnd.powerbuilder6":["pbd"],"application/vnd.previewsystems.box":["box"],"application/vnd.proteus.magazine":["mgz"],"application/vnd.publishare-delta-tree":["qps"],"application/vnd.pvi.ptid1":["ptid"],"application/vnd.quark.quarkxpress":["qxd","qxt","qwd","qwt","qxl","qxb"],"application/vnd.rar":["rar"],"application/vnd.realvnc.bed":["bed"],"application/vnd.recordare.musicxml":["mxl"],"application/vnd.recordare.musicxml+xml":["musicxml"],"application/vnd.rig.cryptonote":["cryptonote"],"application/vnd.rim.cod":["cod"],"application/vnd.rn-realmedia":["rm"],"application/vnd.rn-realmedia-vbr":["rmvb"],"application/vnd.route66.link66+xml":["link66"],"application/vnd.sailingtracker.track":["st"],"application/vnd.seemail":["see"],"application/vnd.sema":["sema"],"application/vnd.semd":["semd"],"application/vnd.semf":["semf"],"application/vnd.shana.informed.formdata":["ifm"],"application/vnd.shana.informed.formtemplate":["itp"],"application/vnd.shana.informed.interchange":["iif"],"application/vnd.shana.informed.package":["ipk"],"application/vnd.simtech-mindmapper":["twd","twds"],"application/vnd.smaf":["mmf"],"application/vnd.smart.teacher":["teacher"],"application/vnd.software602.filler.form+xml":["fo"],"application/vnd.solent.sdkm+xml":["sdkm","sdkd"],"application/vnd.spotfire.dxp":["dxp"],"application/vnd.spotfire.sfs":["sfs"],"application/vnd.stardivision.calc":["sdc"],"application/vnd.stardivision.draw":["sda"],"application/vnd.stardivision.impress":["sdd"],"application/vnd.stardivision.math":["smf"],"application/vnd.stardivision.writer":["sdw","vor"],"application/vnd.stardivision.writer-global":["sgl"],"application/vnd.stepmania.package":["smzip"],"application/vnd.stepmania.stepchart":["sm"],"application/vnd.sun.wadl+xml":["wadl"],"application/vnd.sun.xml.calc":["sxc"],"application/vnd.sun.xml.calc.template":["stc"],"application/vnd.sun.xml.draw":["sxd"],"application/vnd.sun.xml.draw.template":["std"],"application/vnd.sun.xml.impress":["sxi"],"application/vnd.sun.xml.impress.template":["sti"],"application/vnd.sun.xml.math":["sxm"],"application/vnd.sun.xml.writer":["sxw"],"application/vnd.sun.xml.writer.global":["sxg"],"application/vnd.sun.xml.writer.template":["stw"],"application/vnd.sus-calendar":["sus","susp"],"application/vnd.svd":["svd"],"application/vnd.symbian.install":["sis","sisx"],"application/vnd.syncml+xml":["xsm"],"application/vnd.syncml.dm+wbxml":["bdm"],"application/vnd.syncml.dm+xml":["xdm"],"application/vnd.syncml.dmddf+xml":["ddf"],"application/vnd.tao.intent-module-archive":["tao"],"application/vnd.tcpdump.pcap":["pcap","cap","dmp"],"application/vnd.tmobile-livetv":["tmo"],"application/vnd.trid.tpt":["tpt"],"application/vnd.triscape.mxs":["mxs"],"application/vnd.trueapp":["tra"],"application/vnd.ufdl":["ufd","ufdl"],"application/vnd.uiq.theme":["utz"],"application/vnd.umajin":["umj"],"application/vnd.unity":["unityweb"],"application/vnd.uoml+xml":["uoml"],"application/vnd.vcx":["vcx"],"application/vnd.visio":["vsd","vst","vss","vsw"],"application/vnd.visionary":["vis"],"application/vnd.vsf":["vsf"],"application/vnd.wap.wbxml":["wbxml"],"application/vnd.wap.wmlc":["wmlc"],"application/vnd.wap.wmlscriptc":["wmlsc"],"application/vnd.webturbo":["wtb"],"application/vnd.wolfram.player":["nbp"],"application/vnd.wordperfect":["wpd"],"application/vnd.wqd":["wqd"],"application/vnd.wt.stf":["stf"],"application/vnd.xara":["xar"],"application/vnd.xfdl":["xfdl"],"application/vnd.yamaha.hv-dic":["hvd"],"application/vnd.yamaha.hv-script":["hvs"],"application/vnd.yamaha.hv-voice":["hvp"],"application/vnd.yamaha.openscoreformat":["osf"],"application/vnd.yamaha.openscoreformat.osfpvg+xml":["osfpvg"],"application/vnd.yamaha.smaf-audio":["saf"],"application/vnd.yamaha.smaf-phrase":["spf"],"application/vnd.yellowriver-custom-menu":["cmp"],"application/vnd.zul":["zir","zirz"],"application/vnd.zzazz.deck+xml":["zaz"],"application/x-7z-compressed":["7z"],"application/x-abiword":["abw"],"application/x-ace-compressed":["ace"],"application/x-apple-diskimage":["*dmg"],"application/x-arj":["arj"],"application/x-authorware-bin":["aab","x32","u32","vox"],"application/x-authorware-map":["aam"],"application/x-authorware-seg":["aas"],"application/x-bcpio":["bcpio"],"application/x-bdoc":["*bdoc"],"application/x-bittorrent":["torrent"],"application/x-blorb":["blb","blorb"],"application/x-bzip":["bz"],"application/x-bzip2":["bz2","boz"],"application/x-cbr":["cbr","cba","cbt","cbz","cb7"],"application/x-cdlink":["vcd"],"application/x-cfs-compressed":["cfs"],"application/x-chat":["chat"],"application/x-chess-pgn":["pgn"],"application/x-chrome-extension":["crx"],"application/x-cocoa":["cco"],"application/x-conference":["nsc"],"application/x-cpio":["cpio"],"application/x-csh":["csh"],"application/x-debian-package":["*deb","udeb"],"application/x-dgc-compressed":["dgc"],"application/x-director":["dir","dcr","dxr","cst","cct","cxt","w3d","fgd","swa"],"application/x-doom":["wad"],"application/x-dtbncx+xml":["ncx"],"application/x-dtbook+xml":["dtb"],"application/x-dtbresource+xml":["res"],"application/x-dvi":["dvi"],"application/x-envoy":["evy"],"application/x-eva":["eva"],"application/x-font-bdf":["bdf"],"application/x-font-ghostscript":["gsf"],"application/x-font-linux-psf":["psf"],"application/x-font-pcf":["pcf"],"application/x-font-snf":["snf"],"application/x-font-type1":["pfa","pfb","pfm","afm"],"application/x-freearc":["arc"],"application/x-futuresplash":["spl"],"application/x-gca-compressed":["gca"],"application/x-glulx":["ulx"],"application/x-gnumeric":["gnumeric"],"application/x-gramps-xml":["gramps"],"application/x-gtar":["gtar"],"application/x-hdf":["hdf"],"application/x-httpd-php":["php"],"application/x-install-instructions":["install"],"application/x-iso9660-image":["*iso"],"application/x-iwork-keynote-sffkey":["*key"],"application/x-iwork-numbers-sffnumbers":["*numbers"],"application/x-iwork-pages-sffpages":["*pages"],"application/x-java-archive-diff":["jardiff"],"application/x-java-jnlp-file":["jnlp"],"application/x-keepass2":["kdbx"],"application/x-latex":["latex"],"application/x-lua-bytecode":["luac"],"application/x-lzh-compressed":["lzh","lha"],"application/x-makeself":["run"],"application/x-mie":["mie"],"application/x-mobipocket-ebook":["prc","mobi"],"application/x-ms-application":["application"],"application/x-ms-shortcut":["lnk"],"application/x-ms-wmd":["wmd"],"application/x-ms-wmz":["wmz"],"application/x-ms-xbap":["xbap"],"application/x-msaccess":["mdb"],"application/x-msbinder":["obd"],"application/x-mscardfile":["crd"],"application/x-msclip":["clp"],"application/x-msdos-program":["*exe"],"application/x-msdownload":["*exe","*dll","com","bat","*msi"],"application/x-msmediaview":["mvb","m13","m14"],"application/x-msmetafile":["*wmf","*wmz","*emf","emz"],"application/x-msmoney":["mny"],"application/x-mspublisher":["pub"],"application/x-msschedule":["scd"],"application/x-msterminal":["trm"],"application/x-mswrite":["wri"],"application/x-netcdf":["nc","cdf"],"application/x-ns-proxy-autoconfig":["pac"],"application/x-nzb":["nzb"],"application/x-perl":["pl","pm"],"application/x-pilot":["*prc","*pdb"],"application/x-pkcs12":["p12","pfx"],"application/x-pkcs7-certificates":["p7b","spc"],"application/x-pkcs7-certreqresp":["p7r"],"application/x-rar-compressed":["*rar"],"application/x-redhat-package-manager":["rpm"],"application/x-research-info-systems":["ris"],"application/x-sea":["sea"],"application/x-sh":["sh"],"application/x-shar":["shar"],"application/x-shockwave-flash":["swf"],"application/x-silverlight-app":["xap"],"application/x-sql":["sql"],"application/x-stuffit":["sit"],"application/x-stuffitx":["sitx"],"application/x-subrip":["srt"],"application/x-sv4cpio":["sv4cpio"],"application/x-sv4crc":["sv4crc"],"application/x-t3vm-image":["t3"],"application/x-tads":["gam"],"application/x-tar":["tar"],"application/x-tcl":["tcl","tk"],"application/x-tex":["tex"],"application/x-tex-tfm":["tfm"],"application/x-texinfo":["texinfo","texi"],"application/x-tgif":["*obj"],"application/x-ustar":["ustar"],"application/x-virtualbox-hdd":["hdd"],"application/x-virtualbox-ova":["ova"],"application/x-virtualbox-ovf":["ovf"],"application/x-virtualbox-vbox":["vbox"],"application/x-virtualbox-vbox-extpack":["vbox-extpack"],"application/x-virtualbox-vdi":["vdi"],"application/x-virtualbox-vhd":["vhd"],"application/x-virtualbox-vmdk":["vmdk"],"application/x-wais-source":["src"],"application/x-web-app-manifest+json":["webapp"],"application/x-x509-ca-cert":["der","crt","pem"],"application/x-xfig":["fig"],"application/x-xliff+xml":["*xlf"],"application/x-xpinstall":["xpi"],"application/x-xz":["xz"],"application/x-zmachine":["z1","z2","z3","z4","z5","z6","z7","z8"],"audio/vnd.dece.audio":["uva","uvva"],"audio/vnd.digital-winds":["eol"],"audio/vnd.dra":["dra"],"audio/vnd.dts":["dts"],"audio/vnd.dts.hd":["dtshd"],"audio/vnd.lucent.voice":["lvp"],"audio/vnd.ms-playready.media.pya":["pya"],"audio/vnd.nuera.ecelp4800":["ecelp4800"],"audio/vnd.nuera.ecelp7470":["ecelp7470"],"audio/vnd.nuera.ecelp9600":["ecelp9600"],"audio/vnd.rip":["rip"],"audio/x-aac":["aac"],"audio/x-aiff":["aif","aiff","aifc"],"audio/x-caf":["caf"],"audio/x-flac":["flac"],"audio/x-m4a":["*m4a"],"audio/x-matroska":["mka"],"audio/x-mpegurl":["m3u"],"audio/x-ms-wax":["wax"],"audio/x-ms-wma":["wma"],"audio/x-pn-realaudio":["ram","ra"],"audio/x-pn-realaudio-plugin":["rmp"],"audio/x-realaudio":["*ra"],"audio/x-wav":["*wav"],"chemical/x-cdx":["cdx"],"chemical/x-cif":["cif"],"chemical/x-cmdf":["cmdf"],"chemical/x-cml":["cml"],"chemical/x-csml":["csml"],"chemical/x-xyz":["xyz"],"image/prs.btif":["btif"],"image/prs.pti":["pti"],"image/vnd.adobe.photoshop":["psd"],"image/vnd.airzip.accelerator.azv":["azv"],"image/vnd.dece.graphic":["uvi","uvvi","uvg","uvvg"],"image/vnd.djvu":["djvu","djv"],"image/vnd.dvb.subtitle":["*sub"],"image/vnd.dwg":["dwg"],"image/vnd.dxf":["dxf"],"image/vnd.fastbidsheet":["fbs"],"image/vnd.fpx":["fpx"],"image/vnd.fst":["fst"],"image/vnd.fujixerox.edmics-mmr":["mmr"],"image/vnd.fujixerox.edmics-rlc":["rlc"],"image/vnd.microsoft.icon":["ico"],"image/vnd.ms-dds":["dds"],"image/vnd.ms-modi":["mdi"],"image/vnd.ms-photo":["wdp"],"image/vnd.net-fpx":["npx"],"image/vnd.pco.b16":["b16"],"image/vnd.tencent.tap":["tap"],"image/vnd.valve.source.texture":["vtf"],"image/vnd.wap.wbmp":["wbmp"],"image/vnd.xiff":["xif"],"image/vnd.zbrush.pcx":["pcx"],"image/x-3ds":["3ds"],"image/x-cmu-raster":["ras"],"image/x-cmx":["cmx"],"image/x-freehand":["fh","fhc","fh4","fh5","fh7"],"image/x-icon":["*ico"],"image/x-jng":["jng"],"image/x-mrsid-image":["sid"],"image/x-ms-bmp":["*bmp"],"image/x-pcx":["*pcx"],"image/x-pict":["pic","pct"],"image/x-portable-anymap":["pnm"],"image/x-portable-bitmap":["pbm"],"image/x-portable-graymap":["pgm"],"image/x-portable-pixmap":["ppm"],"image/x-rgb":["rgb"],"image/x-tga":["tga"],"image/x-xbitmap":["xbm"],"image/x-xpixmap":["xpm"],"image/x-xwindowdump":["xwd"],"message/vnd.wfa.wsc":["wsc"],"model/vnd.collada+xml":["dae"],"model/vnd.dwf":["dwf"],"model/vnd.gdl":["gdl"],"model/vnd.gtw":["gtw"],"model/vnd.mts":["mts"],"model/vnd.opengex":["ogex"],"model/vnd.parasolid.transmit.binary":["x_b"],"model/vnd.parasolid.transmit.text":["x_t"],"model/vnd.sap.vds":["vds"],"model/vnd.usdz+zip":["usdz"],"model/vnd.valve.source.compiled-map":["bsp"],"model/vnd.vtu":["vtu"],"text/prs.lines.tag":["dsc"],"text/vnd.curl":["curl"],"text/vnd.curl.dcurl":["dcurl"],"text/vnd.curl.mcurl":["mcurl"],"text/vnd.curl.scurl":["scurl"],"text/vnd.dvb.subtitle":["sub"],"text/vnd.fly":["fly"],"text/vnd.fmi.flexstor":["flx"],"text/vnd.graphviz":["gv"],"text/vnd.in3d.3dml":["3dml"],"text/vnd.in3d.spot":["spot"],"text/vnd.sun.j2me.app-descriptor":["jad"],"text/vnd.wap.wml":["wml"],"text/vnd.wap.wmlscript":["wmls"],"text/x-asm":["s","asm"],"text/x-c":["c","cc","cxx","cpp","h","hh","dic"],"text/x-component":["htc"],"text/x-fortran":["f","for","f77","f90"],"text/x-handlebars-template":["hbs"],"text/x-java-source":["java"],"text/x-lua":["lua"],"text/x-markdown":["mkd"],"text/x-nfo":["nfo"],"text/x-opml":["opml"],"text/x-org":["*org"],"text/x-pascal":["p","pas"],"text/x-processing":["pde"],"text/x-sass":["sass"],"text/x-scss":["scss"],"text/x-setext":["etx"],"text/x-sfv":["sfv"],"text/x-suse-ymp":["ymp"],"text/x-uuencode":["uu"],"text/x-vcalendar":["vcs"],"text/x-vcard":["vcf"],"video/vnd.dece.hd":["uvh","uvvh"],"video/vnd.dece.mobile":["uvm","uvvm"],"video/vnd.dece.pd":["uvp","uvvp"],"video/vnd.dece.sd":["uvs","uvvs"],"video/vnd.dece.video":["uvv","uvvv"],"video/vnd.dvb.file":["dvb"],"video/vnd.fvt":["fvt"],"video/vnd.mpegurl":["mxu","m4u"],"video/vnd.ms-playready.media.pyv":["pyv"],"video/vnd.uvvu.mp4":["uvu","uvvu"],"video/vnd.vivo":["viv"],"video/x-f4v":["f4v"],"video/x-fli":["fli"],"video/x-flv":["flv"],"video/x-m4v":["m4v"],"video/x-matroska":["mkv","mk3d","mks"],"video/x-mng":["mng"],"video/x-ms-asf":["asf","asx"],"video/x-ms-vob":["vob"],"video/x-ms-wm":["wm"],"video/x-ms-wmv":["wmv"],"video/x-ms-wmx":["wmx"],"video/x-ms-wvx":["wvx"],"video/x-msvideo":["avi"],"video/x-sgi-movie":["movie"],"video/x-smv":["smv"],"x-conference/x-cooltalk":["ice"]};
109
+
110
+ let Mime = Mime_1;
111
+ var mime = new Mime(standard, other);
112
+
113
+ const param_pattern = /^(\.\.\.)?(\w+)(?:=(\w+))?$/;
114
+
115
+ /** @param {string} id */
116
+ function parse_route_id(id) {
117
+ /** @type {string[]} */
118
+ const names = [];
119
+
120
+ /** @type {string[]} */
121
+ const types = [];
122
+
123
+ // `/foo` should get an optional trailing slash, `/foo.json` should not
124
+ // const add_trailing_slash = !/\.[a-z]+$/.test(key);
125
+ let add_trailing_slash = true;
126
+
127
+ const pattern =
128
+ id === ''
129
+ ? /^\/$/
130
+ : new RegExp(
131
+ `^${decodeURIComponent(id)
132
+ .split(/(?:@[a-zA-Z0-9_-]+)?(?:\/|$)/)
133
+ .map((segment, i, segments) => {
134
+ // special case — /[...rest]/ could contain zero segments
135
+ const match = /^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(segment);
136
+ if (match) {
137
+ names.push(match[1]);
138
+ types.push(match[2]);
139
+ return '(?:/(.*))?';
140
+ }
141
+
142
+ const is_last = i === segments.length - 1;
143
+
144
+ return (
145
+ segment &&
146
+ '/' +
147
+ segment
148
+ .split(/\[(.+?)\]/)
149
+ .map((content, i) => {
150
+ if (i % 2) {
151
+ const match = param_pattern.exec(content);
152
+ if (!match) {
153
+ throw new Error(
154
+ `Invalid param: ${content}. Params and matcher names can only have underscores and alphanumeric characters.`
155
+ );
156
+ }
157
+
158
+ const [, rest, name, type] = match;
159
+ names.push(name);
160
+ types.push(type);
161
+ return rest ? '(.*?)' : '([^/]+?)';
162
+ }
163
+
164
+ if (is_last && content.includes('.')) add_trailing_slash = false;
165
+
166
+ return (
167
+ content // allow users to specify characters on the file system in an encoded manner
168
+ .normalize()
169
+ // We use [ and ] to denote parameters, so users must encode these on the file
170
+ // system to match against them. We don't decode all characters since others
171
+ // can already be epressed and so that '%' can be easily used directly in filenames
172
+ .replace(/%5[Bb]/g, '[')
173
+ .replace(/%5[Dd]/g, ']')
174
+ // '#', '/', and '?' can only appear in URL path segments in an encoded manner.
175
+ // They will not be touched by decodeURI so need to be encoded here, so
176
+ // that we can match against them.
177
+ // We skip '/' since you can't create a file with it on any OS
178
+ .replace(/#/g, '%23')
179
+ .replace(/\?/g, '%3F')
180
+ // escape characters that have special meaning in regex
181
+ .replace(/[.*+?^${}()|[\]\\]/g, '\\$&')
182
+ ); // TODO handle encoding
183
+ })
184
+ .join('')
185
+ );
186
+ })
187
+ .join('')}${add_trailing_slash ? '/?' : ''}$`
188
+ );
189
+
190
+ return { pattern, names, types };
191
+ }
192
+
193
+ /**
194
+ * A portion of a file or directory name where the name has been split into
195
+ * static and dynamic parts
196
+ * @typedef {{
197
+ * content: string;
198
+ * dynamic: boolean;
199
+ * rest: boolean;
200
+ * type: string | null;
201
+ * }} Part
202
+ */
203
+
204
+ /**
205
+ * A route, consisting of an endpoint module and/or an array of components
206
+ * (n layouts and one leaf) for successful navigations and an array of
207
+ * n error components to render if navigation fails
208
+ * @typedef {{
209
+ * id: string;
210
+ * pattern: RegExp;
211
+ * segments: Part[][];
212
+ * page?: {
213
+ * a: Array<string | undefined>;
214
+ * b: Array<string | undefined>;
215
+ * };
216
+ * endpoint?: string;
217
+ * }} Unit
218
+ */
219
+
220
+ /**
221
+ * @typedef {{
222
+ * error: string | undefined;
223
+ * layouts: Record<string, { file: string, name: string }>
224
+ * }} Node
225
+ */
226
+
227
+ /**
228
+ * @typedef {Map<string, Node>} Tree
229
+ */
230
+
231
+ const layout_pattern = /^__layout(?:-([a-zA-Z0-9_-]+))?(?:@([a-zA-Z0-9_-]+))?$/;
232
+ const dunder_pattern = /(^|\/)__(?!tests?__)/; // forbid __-prefixed files/directories except __error, __layout[-...], __test__, __tests__
233
+
234
+ const DEFAULT = 'default';
235
+
236
+ /**
237
+ * @param {{
238
+ * config: import('types').ValidatedConfig;
239
+ * fallback?: string;
240
+ * cwd?: string;
241
+ * }} opts
242
+ * @returns {import('types').ManifestData}
243
+ */
244
+ function create_manifest_data({
245
+ config,
246
+ fallback = `${get_runtime_directory(config.kit)}/components`,
247
+ cwd = process.cwd()
248
+ }) {
249
+ /** @type {import('types').RouteData[]} */
250
+ const routes = [];
251
+
252
+ /** @type {Map<string, Unit>} */
253
+ const units = new Map();
254
+
255
+ /** @type {Tree} */
256
+ const tree = new Map();
257
+
258
+ const default_layout = {
259
+ file: posixify(path__default.relative(cwd, `${fallback}/layout.svelte`)),
260
+ name: DEFAULT
261
+ };
262
+
263
+ // set default root layout/error
264
+ tree.set('', {
265
+ error: posixify(path__default.relative(cwd, `${fallback}/error.svelte`)),
266
+ layouts: { [DEFAULT]: default_layout }
267
+ });
268
+
269
+ const routes_base = posixify(path__default.relative(cwd, config.kit.files.routes));
270
+ const valid_extensions = [...config.extensions, ...config.kit.moduleExtensions];
271
+
272
+ if (fs__default.existsSync(config.kit.files.routes)) {
273
+ list_files(config.kit.files.routes).forEach((file) => {
274
+ const extension = valid_extensions.find((ext) => file.endsWith(ext));
275
+ if (!extension) return;
276
+
277
+ const id = file
278
+ .slice(0, -extension.length)
279
+ .replace(/(?:^|\/)index((?:@[a-zA-Z0-9_-]+)?(?:\.[a-z]+)?)?$/, '$1');
280
+ const project_relative = `${routes_base}/${file}`;
281
+
282
+ const segments = id.split('/');
283
+ const name = /** @type {string} */ (segments.pop());
284
+
285
+ if (name === '__layout.reset') {
286
+ throw new Error(
287
+ '__layout.reset has been removed in favour of named layouts: https://kit.svelte.dev/docs/layouts#named-layouts'
288
+ );
289
+ }
290
+
291
+ if (name === '__error' || layout_pattern.test(name)) {
292
+ const dir = segments.join('/');
293
+
294
+ if (!tree.has(dir)) {
295
+ tree.set(dir, {
296
+ error: undefined,
297
+ layouts: {}
298
+ });
299
+ }
300
+
301
+ const group = /** @type {Node} */ (tree.get(dir));
302
+
303
+ if (name === '__error') {
304
+ group.error = project_relative;
305
+ } else {
306
+ const match = /** @type {RegExpMatchArray} */ (layout_pattern.exec(name));
307
+
308
+ if (match[1] === DEFAULT) {
309
+ throw new Error(`${project_relative} cannot use reserved "${DEFAULT}" name`);
310
+ }
311
+
312
+ const layout_id = match[1] || DEFAULT;
313
+
314
+ const defined = group.layouts[layout_id];
315
+ if (defined && defined !== default_layout) {
316
+ throw new Error(
317
+ `Duplicate layout ${project_relative} already defined at ${defined.file}`
318
+ );
319
+ }
320
+
321
+ group.layouts[layout_id] = {
322
+ file: project_relative,
323
+ name
324
+ };
325
+ }
326
+
327
+ return;
328
+ } else if (dunder_pattern.test(file)) {
329
+ throw new Error(
330
+ `Files and directories prefixed with __ are reserved (saw ${project_relative})`
331
+ );
332
+ }
333
+
334
+ if (!config.kit.routes(file)) return;
335
+
336
+ if (/\]\[/.test(id)) {
337
+ throw new Error(`Invalid route ${project_relative} — parameters must be separated`);
338
+ }
339
+
340
+ if (count_occurrences('[', id) !== count_occurrences(']', id)) {
341
+ throw new Error(`Invalid route ${project_relative} — brackets are unbalanced`);
342
+ }
343
+
344
+ if (!units.has(id)) {
345
+ units.set(id, {
346
+ id,
347
+ pattern: parse_route_id(id).pattern,
348
+ segments: id
349
+ .split('/')
350
+ .filter(Boolean)
351
+ .map((segment) => {
352
+ /** @type {Part[]} */
353
+ const parts = [];
354
+ segment.split(/\[(.+?)\]/).map((content, i) => {
355
+ const dynamic = !!(i % 2);
356
+
357
+ if (!content) return;
358
+
359
+ parts.push({
360
+ content,
361
+ dynamic,
362
+ rest: dynamic && content.startsWith('...'),
363
+ type: (dynamic && content.split('=')[1]) || null
364
+ });
365
+ });
366
+ return parts;
367
+ }),
368
+ page: undefined,
369
+ endpoint: undefined
370
+ });
371
+ }
372
+
373
+ const unit = /** @type {Unit} */ (units.get(id));
374
+
375
+ if (config.extensions.find((ext) => file.endsWith(ext))) {
376
+ const { layouts, errors } = trace(project_relative, file, tree, config.extensions);
377
+ unit.page = {
378
+ a: layouts.concat(project_relative),
379
+ b: errors
380
+ };
381
+ } else {
382
+ unit.endpoint = project_relative;
383
+ }
384
+ });
385
+ }
386
+
387
+ /** @type {string[]} */
388
+ const components = [];
389
+
390
+ tree.forEach(({ layouts, error }) => {
391
+ // we do [default, error, ...other_layouts] so that components[0] and [1]
392
+ // are the root layout/error. kinda janky, there's probably a nicer way
393
+ if (layouts[DEFAULT]) {
394
+ components.push(layouts[DEFAULT].file);
395
+ }
396
+
397
+ if (error) {
398
+ components.push(error);
399
+ }
400
+
401
+ for (const id in layouts) {
402
+ if (id !== DEFAULT) components.push(layouts[id].file);
403
+ }
404
+ });
405
+
406
+ units.forEach((unit) => {
407
+ if (unit.page) {
408
+ const leaf = /** @type {string} */ (unit.page.a[unit.page.a.length - 1]);
409
+ components.push(leaf);
410
+ }
411
+ });
412
+
413
+ Array.from(units.values())
414
+ .sort(compare)
415
+ .forEach((unit) => {
416
+ // TODO when we introduce layout endpoints and scoped middlewares, we
417
+ // will probably want to have a single unified route type here
418
+ // (created in the list_files(...).forEach(...) callback)
419
+ if (unit.page) {
420
+ routes.push({
421
+ type: 'page',
422
+ id: unit.id,
423
+ pattern: unit.pattern,
424
+ path: unit.id.includes('[') ? '' : `/${unit.id.replace(/@(?:[a-zA-Z0-9_-]+)/g, '')}`,
425
+ shadow: unit.endpoint || null,
426
+ a: unit.page.a,
427
+ b: unit.page.b
428
+ });
429
+ } else if (unit.endpoint) {
430
+ routes.push({
431
+ type: 'endpoint',
432
+ id: unit.id,
433
+ pattern: unit.pattern,
434
+ file: unit.endpoint
435
+ });
436
+ }
437
+ });
438
+
439
+ /** @type {import('types').Asset[]} */
440
+ const assets = fs__default.existsSync(config.kit.files.assets)
441
+ ? list_files(config.kit.files.assets).map((file) => ({
442
+ file,
443
+ size: fs__default.statSync(`${config.kit.files.assets}/${file}`).size,
444
+ type: mime.getType(file)
445
+ }))
446
+ : [];
447
+
448
+ const params_base = path__default.relative(cwd, config.kit.files.params);
449
+
450
+ /** @type {Record<string, string>} */
451
+ const matchers = {};
452
+ if (fs__default.existsSync(config.kit.files.params)) {
453
+ for (const file of fs__default.readdirSync(config.kit.files.params)) {
454
+ const ext = path__default.extname(file);
455
+ if (!config.kit.moduleExtensions.includes(ext)) continue;
456
+ const type = file.slice(0, -ext.length);
457
+
458
+ if (/^\w+$/.test(type)) {
459
+ const matcher_file = path__default.join(params_base, file);
460
+
461
+ // Disallow same matcher with different extensions
462
+ if (matchers[type]) {
463
+ throw new Error(`Duplicate matchers: ${matcher_file} and ${matchers[type]}`);
464
+ } else {
465
+ matchers[type] = matcher_file;
466
+ }
467
+ } else {
468
+ throw new Error(
469
+ `Matcher names can only have underscores and alphanumeric characters — "${file}" is invalid`
470
+ );
471
+ }
472
+ }
473
+ }
474
+
475
+ return {
476
+ assets,
477
+ components,
478
+ routes,
479
+ matchers
480
+ };
481
+ }
482
+
483
+ /**
484
+ * @param {string} file
485
+ * @param {string} path
486
+ * @param {Tree} tree
487
+ * @param {string[]} extensions
488
+ */
489
+ function trace(file, path, tree, extensions) {
490
+ /** @type {Array<string | undefined>} */
491
+ const layouts = [];
492
+
493
+ /** @type {Array<string | undefined>} */
494
+ const errors = [];
495
+
496
+ const parts = path.split('/');
497
+ const filename = /** @type {string} */ (parts.pop());
498
+ const extension = /** @type {string} */ (extensions.find((ext) => path.endsWith(ext)));
499
+ const base = filename.slice(0, -extension.length);
500
+
501
+ let layout_id = base.includes('@') ? base.split('@')[1] : DEFAULT;
502
+
503
+ if (parts.findIndex((part) => part.indexOf('@') > -1) > -1) {
504
+ throw new Error(`Invalid route ${file} - named layouts are not allowed in directories`);
505
+ }
506
+
507
+ // walk up the tree, find which __layout and __error components
508
+ // apply to this page
509
+ while (true) {
510
+ const node = tree.get(parts.join('/'));
511
+ const layout = node?.layouts[layout_id];
512
+
513
+ if (layout?.file && layouts.indexOf(layout.file) > -1) {
514
+ throw new Error(`Recursive layout detected: ${layout.file} -> ${layouts.join(' -> ')}`);
515
+ }
516
+
517
+ // any segment that has neither a __layout nor an __error can be discarded.
518
+ // in other words these...
519
+ // layouts: [a, , b, c]
520
+ // errors: [d, , e, ]
521
+ //
522
+ // ...can be compacted to these:
523
+ // layouts: [a, b, c]
524
+ // errors: [d, e, ]
525
+ if (node?.error || layout?.file) {
526
+ errors.unshift(node?.error);
527
+ layouts.unshift(layout?.file);
528
+ }
529
+
530
+ if (layout?.name.includes('@')) {
531
+ layout_id = layout.name.split('@')[1];
532
+ } else {
533
+ if (layout) layout_id = DEFAULT;
534
+ if (parts.length === 0) break;
535
+ parts.pop();
536
+ }
537
+ }
538
+
539
+ if (layout_id !== DEFAULT) {
540
+ throw new Error(`${file} references missing layout "${layout_id}"`);
541
+ }
542
+
543
+ // trim empty space off the end of the errors array
544
+ let i = errors.length;
545
+ while (i--) if (errors[i]) break;
546
+ errors.length = i + 1;
547
+
548
+ return { layouts, errors };
549
+ }
550
+
551
+ /**
552
+ * @param {Unit} a
553
+ * @param {Unit} b
554
+ */
555
+ function compare(a, b) {
556
+ const max_segments = Math.max(a.segments.length, b.segments.length);
557
+ for (let i = 0; i < max_segments; i += 1) {
558
+ const sa = a.segments[i];
559
+ const sb = b.segments[i];
560
+
561
+ // /x < /x/y, but /[...x]/y < /[...x]
562
+ if (!sa) return a.id.includes('[...') ? +1 : -1;
563
+ if (!sb) return b.id.includes('[...') ? -1 : +1;
564
+
565
+ const max_parts = Math.max(sa.length, sb.length);
566
+ for (let i = 0; i < max_parts; i += 1) {
567
+ const pa = sa[i];
568
+ const pb = sb[i];
569
+
570
+ // xy < x[y], but [x].json < [x]
571
+ if (pa === undefined) return pb.dynamic ? -1 : +1;
572
+ if (pb === undefined) return pa.dynamic ? +1 : -1;
573
+
574
+ // x < [x]
575
+ if (pa.dynamic !== pb.dynamic) {
576
+ return pa.dynamic ? +1 : -1;
577
+ }
578
+
579
+ if (pa.dynamic) {
580
+ // [x] < [...x]
581
+ if (pa.rest !== pb.rest) {
582
+ return pa.rest ? +1 : -1;
583
+ }
584
+
585
+ // [x=type] < [x]
586
+ if (!!pa.type !== !!pb.type) {
587
+ return pa.type ? -1 : +1;
588
+ }
589
+ }
590
+ }
591
+ }
592
+
593
+ const a_is_endpoint = !a.page && a.endpoint;
594
+ const b_is_endpoint = !b.page && b.endpoint;
595
+
596
+ if (a_is_endpoint !== b_is_endpoint) {
597
+ return a_is_endpoint ? -1 : +1;
598
+ }
599
+
600
+ return a < b ? -1 : 1;
601
+ }
602
+
603
+ /**
604
+ * @param {string} needle
605
+ * @param {string} haystack
606
+ */
607
+ function count_occurrences(needle, haystack) {
608
+ let count = 0;
609
+ for (let i = 0; i < haystack.length; i += 1) {
610
+ if (haystack[i] === needle) count += 1;
611
+ }
612
+ return count;
613
+ }
614
+
615
+ /**
616
+ * @param {string} dir
617
+ * @param {string} [path]
618
+ * @param {string[]} [files]
619
+ */
620
+ function list_files(dir, path = '', files = []) {
621
+ fs__default.readdirSync(dir)
622
+ .sort((a, b) => {
623
+ // sort each directory in (__layout, __error, everything else) order
624
+ // so that we can trace layouts/errors immediately
625
+
626
+ if (a.startsWith('__layout')) {
627
+ if (!b.startsWith('__layout')) return -1;
628
+ } else if (b.startsWith('__layout')) {
629
+ return 1;
630
+ } else if (a.startsWith('__')) {
631
+ if (!b.startsWith('__')) return -1;
632
+ } else if (b.startsWith('__')) {
633
+ return 1;
634
+ }
635
+
636
+ return a < b ? -1 : 1;
637
+ })
638
+ .forEach((file) => {
639
+ const full = `${dir}/${file}`;
640
+ const stats = fs__default.statSync(full);
641
+ const joined = path ? `${path}/${file}` : file;
642
+
643
+ if (stats.isDirectory()) {
644
+ list_files(full, joined, files);
645
+ } else {
646
+ files.push(joined);
647
+ }
648
+ });
649
+
650
+ return files;
651
+ }
652
+
653
+ const filename = fileURLToPath(import.meta.url);
654
+ const dirname = path__default.dirname(filename);
655
+
656
+ /** @param {string} dest */
657
+ function copy_assets(dest) {
658
+ let prefix = '..';
659
+ do {
660
+ // we jump through these hoops so that this function
661
+ // works whether or not it's been bundled
662
+ const resolved = path__default.resolve(dirname, `${prefix}/assets`);
663
+
664
+ if (fs__default.existsSync(resolved)) {
665
+ copy(resolved, dest);
666
+ return;
667
+ }
668
+
669
+ prefix = `../${prefix}`;
670
+ } while (true);
671
+ }
672
+
673
+ const s = JSON.stringify;
674
+
675
+ /**
676
+ * Writes the client manifest to disk. The manifest is used to power the router. It contains the
677
+ * list of routes and corresponding Svelte components (i.e. pages and layouts).
678
+ * @param {import('types').ManifestData} manifest_data
679
+ * @param {string} base
680
+ * @param {string} output
681
+ */
682
+ function write_manifest(manifest_data, base, output) {
683
+ /** @type {Record<string, number>} */
684
+ const component_indexes = {};
685
+
686
+ /** @param {string} c */
687
+ const get_path = (c) => path__default.relative(base, c);
688
+
689
+ const components = `[
690
+ ${manifest_data.components
691
+ .map((component, i) => {
692
+ component_indexes[component] = i;
693
+
694
+ return `() => import(${s(get_path(component))})`;
695
+ })
696
+ .join(',\n\t\t\t\t\t')}
697
+ ]`.replace(/^\t/gm, '');
698
+
699
+ /** @param {Array<string | undefined>} parts */
700
+ const get_indices = (parts) =>
701
+ `[${parts.map((part) => (part ? component_indexes[part] : '')).join(', ')}]`;
702
+
703
+ const dictionary = `{
704
+ ${manifest_data.routes
705
+ .map((route) => {
706
+ if (route.type === 'page') {
707
+ const tuple = [get_indices(route.a), get_indices(route.b)];
708
+ if (route.shadow) tuple.push('1');
709
+
710
+ return `${s(route.id)}: [${tuple.join(', ')}]`;
711
+ }
712
+ })
713
+ .filter(Boolean)
714
+ .join(',\n\t\t')}
715
+ }`.replace(/^\t/gm, '');
716
+
717
+ write_if_changed(
718
+ `${output}/client-manifest.js`,
719
+ trim(`
720
+ export { matchers } from './client-matchers.js';
721
+
722
+ export const components = ${components};
723
+
724
+ export const dictionary = ${dictionary};
725
+ `)
726
+ );
727
+ }
728
+
729
+ /**
730
+ * @param {import('types').ManifestData} manifest_data
731
+ * @param {string} output
732
+ */
733
+ function write_matchers(manifest_data, output) {
734
+ const imports = [];
735
+ const matchers = [];
736
+
737
+ for (const key in manifest_data.matchers) {
738
+ const src = manifest_data.matchers[key];
739
+
740
+ imports.push(`import { match as ${key} } from ${s(path__default.relative(output, src))};`);
741
+ matchers.push(key);
742
+ }
743
+
744
+ const module = imports.length
745
+ ? `${imports.join('\n')}\n\nexport const matchers = { ${matchers.join(', ')} };`
746
+ : 'export const matchers = {};';
747
+
748
+ write_if_changed(`${output}/client-matchers.js`, module);
749
+ }
750
+
751
+ /**
752
+ * @param {import('types').ManifestData} manifest_data
753
+ * @param {string} output
754
+ */
755
+ function write_root(manifest_data, output) {
756
+ // TODO remove default layout altogether
757
+
758
+ const max_depth = Math.max(
759
+ ...manifest_data.routes.map((route) =>
760
+ route.type === 'page' ? route.a.filter(Boolean).length : 0
761
+ ),
762
+ 1
763
+ );
764
+
765
+ const levels = [];
766
+ for (let i = 0; i <= max_depth; i += 1) {
767
+ levels.push(i);
768
+ }
769
+
770
+ let l = max_depth;
771
+
772
+ let pyramid = `<svelte:component this={components[${l}]} {...(props_${l} || {})}/>`;
773
+
774
+ while (l--) {
775
+ pyramid = `
776
+ {#if components[${l + 1}]}
777
+ <svelte:component this={components[${l}]} {...(props_${l} || {})}>
778
+ ${pyramid.replace(/\n/g, '\n\t\t\t\t\t')}
779
+ </svelte:component>
780
+ {:else}
781
+ <svelte:component this={components[${l}]} {...(props_${l} || {})} />
782
+ {/if}
783
+ `
784
+ .replace(/^\t\t\t/gm, '')
785
+ .trim();
786
+ }
787
+
788
+ write_if_changed(
789
+ `${output}/root.svelte`,
790
+ trim(`
791
+ <!-- This file is generated by @sveltejs/kit — do not edit it! -->
792
+ <script>
793
+ import { setContext, afterUpdate, onMount } from 'svelte';
794
+
795
+ // stores
796
+ export let stores;
797
+ export let page;
798
+
799
+ export let components;
800
+ ${levels.map((l) => `export let props_${l} = null;`).join('\n\t\t\t\t')}
801
+
802
+ setContext('__svelte__', stores);
803
+
804
+ $: stores.page.set(page);
805
+ afterUpdate(stores.page.notify);
806
+
807
+ let mounted = false;
808
+ let navigated = false;
809
+ let title = null;
810
+
811
+ onMount(() => {
812
+ const unsubscribe = stores.page.subscribe(() => {
813
+ if (mounted) {
814
+ navigated = true;
815
+ title = document.title || 'untitled page';
816
+ }
817
+ });
818
+
819
+ mounted = true;
820
+ return unsubscribe;
821
+ });
822
+ </script>
823
+
824
+ ${pyramid.replace(/\n/g, '\n\t\t\t')}
825
+
826
+ {#if mounted}
827
+ <div id="svelte-announcer" aria-live="assertive" aria-atomic="true" style="position: absolute; left: 0; top: 0; clip: rect(0 0 0 0); clip-path: inset(50%); overflow: hidden; white-space: nowrap; width: 1px; height: 1px">
828
+ {#if navigated}
829
+ {title}
830
+ {/if}
831
+ </div>
832
+ {/if}
833
+ `)
834
+ );
835
+ }
836
+
837
+ /** @param {string} imports */
838
+ const header = (imports) => `
839
+ // this file is auto-generated
840
+ import type { ${imports} } from '@sveltejs/kit';`;
841
+
842
+ /** @param {string} arg */
843
+ const endpoint = (arg) => `
844
+ export type RequestHandler<Output = ResponseBody> = GenericRequestHandler<${arg}, Output>;`;
845
+
846
+ /** @param {string} arg */
847
+ const page = (arg) => `
848
+ export type Load<
849
+ InputProps extends Record<string, any> = Record<string, any>,
850
+ OutputProps extends Record<string, any> = InputProps
851
+ > = GenericLoad<${arg}, InputProps, OutputProps>;`;
852
+
853
+ /**
854
+ * @param {import('types').ValidatedConfig} config
855
+ * @param {import('types').ManifestData} manifest_data
856
+ */
857
+ function write_types(config, manifest_data) {
858
+ rimraf(`${config.kit.outDir}/types`);
859
+
860
+ /** @type {Map<string, { params: string[], type: 'page' | 'endpoint' | 'both' }>} */
861
+ const shadow_types = new Map();
862
+
863
+ manifest_data.routes.forEach((route) => {
864
+ const file = route.type === 'endpoint' ? route.file : route.shadow;
865
+
866
+ if (file) {
867
+ const ext = /** @type {string} */ (
868
+ config.kit.moduleExtensions.find((ext) => file.endsWith(ext))
869
+ );
870
+ const key = file.slice(0, -ext.length);
871
+ shadow_types.set(key, {
872
+ params: parse_route_id(key).names,
873
+ type: route.type === 'endpoint' ? 'endpoint' : 'both'
874
+ });
875
+ }
876
+ });
877
+
878
+ manifest_data.components.forEach((component) => {
879
+ if (component.startsWith('.')) return; // exclude fallback components
880
+
881
+ const ext = /** @type {string} */ (config.extensions.find((ext) => component.endsWith(ext)));
882
+ const key = component.slice(0, -ext.length);
883
+
884
+ if (!shadow_types.has(key)) {
885
+ shadow_types.set(key, { params: parse_route_id(key).names, type: 'page' });
886
+ }
887
+ });
888
+
889
+ shadow_types.forEach(({ params, type }, key) => {
890
+ const arg =
891
+ params.length > 0 ? `{ ${params.map((param) => `${param}: string`).join('; ')} }` : '{}';
892
+
893
+ const imports = [];
894
+ const content = [];
895
+
896
+ if (type !== 'page') {
897
+ imports.push('RequestHandler as GenericRequestHandler, ResponseBody');
898
+ content.push(endpoint(arg));
899
+ }
900
+
901
+ if (type !== 'endpoint') {
902
+ imports.push('Load as GenericLoad');
903
+ content.push(page(arg));
904
+ }
905
+
906
+ content.unshift(header(imports.join(', ')));
907
+
908
+ const parts = (key || 'index').split('/');
909
+ parts.push('__types', /** @type {string} */ (parts.pop()));
910
+
911
+ write(`${config.kit.outDir}/types/${parts.join('/')}.d.ts`, content.join('\n').trim());
912
+ });
913
+ }
914
+
915
+ /**
916
+ * @param {import('vite').ResolvedConfig} config
917
+ * @param {import('vite').ConfigEnv} config_env
918
+ * @return {Promise<import('vite').UserConfig>}
919
+ */
920
+ async function get_vite_config(config, config_env) {
921
+ const loaded = await loadConfigFromFile(
922
+ config_env,
923
+ config.configFile,
924
+ undefined,
925
+ config.logLevel
926
+ );
927
+
928
+ if (!loaded) {
929
+ throw new Error('Could not load Vite config');
930
+ }
931
+ return { ...loaded.config, mode: config_env.mode };
932
+ }
933
+
934
+ /**
935
+ * @param {...import('vite').UserConfig} configs
936
+ * @returns {import('vite').UserConfig}
937
+ */
938
+ function merge_vite_configs(...configs) {
939
+ return deep_merge(
940
+ ...configs.map((config) => ({
941
+ ...config,
942
+ resolve: {
943
+ ...config.resolve,
944
+ alias: normalize_alias(config.resolve?.alias || {})
945
+ }
946
+ }))
947
+ );
948
+ }
949
+
950
+ /**
951
+ * Takes zero or more objects and returns a new object that has all the values
952
+ * deeply merged together. None of the original objects will be mutated at any
953
+ * level, and the returned object will have no references to the original
954
+ * objects at any depth. If there's a conflict the last one wins, except for
955
+ * arrays which will be combined.
956
+ * @param {...Object} objects
957
+ * @returns {Record<string, any>} the merged object
958
+ */
959
+ function deep_merge(...objects) {
960
+ const result = {};
961
+ /** @type {string[]} */
962
+ objects.forEach((o) => merge_into(result, o));
963
+ return result;
964
+ }
965
+
966
+ /**
967
+ * normalize kit.vite.resolve.alias as an array
968
+ * @param {import('vite').AliasOptions} o
969
+ * @returns {import('vite').Alias[]}
970
+ */
971
+ function normalize_alias(o) {
972
+ if (Array.isArray(o)) return o;
973
+ return Object.entries(o).map(([find, replacement]) => ({ find, replacement }));
974
+ }
975
+
976
+ /**
977
+ * Merges b into a, recursively, mutating a.
978
+ * @param {Record<string, any>} a
979
+ * @param {Record<string, any>} b
980
+ */
981
+ function merge_into(a, b) {
982
+ /**
983
+ * Checks for "plain old Javascript object", typically made as an object
984
+ * literal. Excludes Arrays and built-in types like Buffer.
985
+ * @param {any} x
986
+ */
987
+ const is_plain_object = (x) => typeof x === 'object' && x.constructor === Object;
988
+
989
+ for (const prop in b) {
990
+ if (is_plain_object(b[prop])) {
991
+ if (!is_plain_object(a[prop])) {
992
+ a[prop] = {};
993
+ }
994
+ merge_into(a[prop], b[prop]);
995
+ } else if (Array.isArray(b[prop])) {
996
+ if (!Array.isArray(a[prop])) {
997
+ a[prop] = [];
998
+ }
999
+ a[prop].push(...b[prop]);
1000
+ } else {
1001
+ a[prop] = b[prop];
1002
+ }
1003
+ }
1004
+ }
1005
+
1006
+ /**
1007
+ * Transforms kit.alias to a valid vite.resolve.alias array.
1008
+ * Related to tsconfig path alias creation.
1009
+ *
1010
+ * @param {import('types').ValidatedKitConfig} config
1011
+ * */
1012
+ function get_aliases(config) {
1013
+ /** @type {import('vite').Alias[]} */
1014
+ const alias = [
1015
+ { find: '__GENERATED__', replacement: path__default.posix.join(config.outDir, 'generated') },
1016
+ { find: '$app', replacement: `${get_runtime_directory(config)}/app` },
1017
+ // For now, we handle `$lib` specially here rather than make it a default value for
1018
+ // `config.kit.alias` since it has special meaning for packaging, etc.
1019
+ { find: '$lib', replacement: config.files.lib }
1020
+ ];
1021
+
1022
+ for (let [key, value] of Object.entries(config.alias)) {
1023
+ if (value.endsWith('/*')) {
1024
+ value = value.slice(0, -2);
1025
+ }
1026
+ if (key.endsWith('/*')) {
1027
+ // Doing just `{ find: key.slice(0, -2) ,..}` would mean `import .. from "key"` would also be matched, which we don't want
1028
+ alias.push({
1029
+ find: new RegExp(`^${key.slice(0, -2)}\\/(.+)$`),
1030
+ replacement: `${path__default.resolve(value)}/$1`
1031
+ });
1032
+ } else if (key + '/*' in config.alias) {
1033
+ // key and key/* both exist -> the replacement for key needs to happen _only_ on import .. from "key"
1034
+ alias.push({ find: new RegExp(`^${key}$`), replacement: path__default.resolve(value) });
1035
+ } else {
1036
+ alias.push({ find: key, replacement: path__default.resolve(value) });
1037
+ }
1038
+ }
1039
+
1040
+ alias.push({
1041
+ find: '$env',
1042
+ replacement: `${get_runtime_directory(config)}/env`
1043
+ });
1044
+
1045
+ return alias;
1046
+ }
1047
+
1048
+ /**
1049
+ * Given an entry point like [cwd]/src/hooks, returns a filename like [cwd]/src/hooks.js or [cwd]/src/hooks/index.js
1050
+ * @param {string} entry
1051
+ * @returns {string|null}
1052
+ */
1053
+ function resolve_entry(entry) {
1054
+ if (fs__default.existsSync(entry)) {
1055
+ const stats = fs__default.statSync(entry);
1056
+ if (stats.isDirectory()) {
1057
+ return resolve_entry(path__default.join(entry, 'index'));
1058
+ }
1059
+
1060
+ return entry;
1061
+ } else {
1062
+ const dir = path__default.dirname(entry);
1063
+
1064
+ if (fs__default.existsSync(dir)) {
1065
+ const base = path__default.basename(entry);
1066
+ const files = fs__default.readdirSync(dir);
1067
+
1068
+ const found = files.find((file) => file.replace(/\.[^.]+$/, '') === base);
1069
+
1070
+ if (found) return path__default.join(dir, found);
1071
+ }
1072
+ }
1073
+
1074
+ return null;
1075
+ }
1076
+
1077
+ /**
1078
+ * @param {string} str
1079
+ * @param {number} times
1080
+ */
1081
+ function repeat(str, times) {
1082
+ return new Array(times + 1).join(str);
1083
+ }
1084
+
1085
+ /**
1086
+ * Create a formatted error for an illegal import.
1087
+ * @param {Array<{name: string, dynamic: boolean}>} stack
1088
+ * @param {string} out_dir The directory specified by config.kit.outDir
1089
+ */
1090
+ function format_illegal_import_chain(stack, out_dir) {
1091
+ const app = path__default.join(out_dir, 'runtime/env');
1092
+
1093
+ stack = stack.map((file) => {
1094
+ if (file.name.startsWith(app)) return { ...file, name: file.name.replace(app, '$env') };
1095
+ return { ...file, name: path__default.relative(process.cwd(), file.name) };
1096
+ });
1097
+
1098
+ const pyramid = stack
1099
+ .map(
1100
+ (file, i) =>
1101
+ `${repeat(' ', i * 2)}- ${file.name} ${
1102
+ file.dynamic ? '(imported by parent dynamically)' : ''
1103
+ }`
1104
+ )
1105
+ .join('\n');
1106
+
1107
+ return `Cannot import ${stack.at(-1)?.name} into client-side code:\n${pyramid}`;
1108
+ }
1109
+
1110
+ /**
1111
+ * Load environment variables from process.env and .env files
1112
+ * @param {string} mode
1113
+ * @param {string} prefix
1114
+ */
1115
+ function get_env(mode, prefix) {
1116
+ const entries = Object.entries(loadEnv(mode, process.cwd(), ''));
1117
+
1118
+ return {
1119
+ public: Object.fromEntries(entries.filter(([k]) => k.startsWith(prefix))),
1120
+ private: Object.fromEntries(entries.filter(([k]) => !k.startsWith(prefix)))
1121
+ };
1122
+ }
1123
+
1124
+ /**
1125
+ * @param {(id: string) => import('rollup').ModuleInfo | null} node_getter
1126
+ * @param {import('rollup').ModuleInfo} node
1127
+ * @param {Set<string>} illegal_imports Illegal module IDs -- be sure to call vite.normalizePath!
1128
+ * @param {string} out_dir The directory specified by config.kit.outDir
1129
+ */
1130
+ function prevent_illegal_rollup_imports(node_getter, node, illegal_imports, out_dir) {
1131
+ const chain = find_illegal_rollup_imports(node_getter, node, false, illegal_imports);
1132
+ if (chain) throw new Error(format_illegal_import_chain(chain, out_dir));
1133
+ }
1134
+
1135
+ /**
1136
+ * @param {(id: string) => import('rollup').ModuleInfo | null} node_getter
1137
+ * @param {import('rollup').ModuleInfo} node
1138
+ * @param {boolean} dynamic
1139
+ * @param {Set<string>} illegal_imports Illegal module IDs -- be sure to call vite.normalizePath!
1140
+ * @param {Set<string>} seen
1141
+ * @returns {Array<import('types').ImportNode> | null}
1142
+ */
1143
+ const find_illegal_rollup_imports = (
1144
+ node_getter,
1145
+ node,
1146
+ dynamic,
1147
+ illegal_imports,
1148
+ seen = new Set()
1149
+ ) => {
1150
+ const name = normalizePath(node.id);
1151
+ if (seen.has(name)) return null;
1152
+ seen.add(name);
1153
+
1154
+ if (illegal_imports.has(name)) {
1155
+ return [{ name, dynamic }];
1156
+ }
1157
+
1158
+ for (const id of node.importedIds) {
1159
+ const child = node_getter(id);
1160
+ const chain =
1161
+ child && find_illegal_rollup_imports(node_getter, child, false, illegal_imports, seen);
1162
+ if (chain) return [{ name, dynamic }, ...chain];
1163
+ }
1164
+
1165
+ for (const id of node.dynamicallyImportedIds) {
1166
+ const child = node_getter(id);
1167
+ const chain =
1168
+ child && find_illegal_rollup_imports(node_getter, child, true, illegal_imports, seen);
1169
+ if (chain) return [{ name, dynamic }, ...chain];
1170
+ }
1171
+
1172
+ return null;
1173
+ };
1174
+
1175
+ /**
1176
+ * Vite does some weird things with import trees in dev
1177
+ * for example, a Tailwind app.css will appear to import
1178
+ * every file in the project. This isn't a problem for
1179
+ * Rollup during build.
1180
+ * @param {Iterable<string>} config_module_types
1181
+ */
1182
+ const get_module_types = (config_module_types) => {
1183
+ return new Set([
1184
+ '.ts',
1185
+ '.js',
1186
+ '.svelte',
1187
+ '.mts',
1188
+ '.mjs',
1189
+ '.cts',
1190
+ '.cjs',
1191
+ '.svelte.md',
1192
+ '.svx',
1193
+ '.md',
1194
+ ...config_module_types
1195
+ ]);
1196
+ };
1197
+
1198
+ /**
1199
+ * Throw an error if a private module is imported from a client-side node.
1200
+ * @param {import('vite').ModuleNode} node
1201
+ * @param {Set<string>} illegal_imports Illegal module IDs -- be sure to call vite.normalizePath!
1202
+ * @param {Iterable<string>} module_types File extensions to analyze in addition to the defaults: `.ts`, `.js`, etc.
1203
+ * @param {string} out_dir The directory specified by config.kit.outDir
1204
+ */
1205
+ function prevent_illegal_vite_imports(node, illegal_imports, module_types, out_dir) {
1206
+ const chain = find_illegal_vite_imports(node, illegal_imports, get_module_types(module_types));
1207
+ if (chain) throw new Error(format_illegal_import_chain(chain, out_dir));
1208
+ }
1209
+
1210
+ /**
1211
+ * @param {import('vite').ModuleNode} node
1212
+ * @param {Set<string>} illegal_imports Illegal module IDs -- be sure to call vite.normalizePath!
1213
+ * @param {Set<string>} module_types File extensions to analyze: `.ts`, `.js`, etc.
1214
+ * @param {Set<string>} seen
1215
+ * @returns {Array<import('types').ImportNode> | null}
1216
+ */
1217
+ function find_illegal_vite_imports(node, illegal_imports, module_types, seen = new Set()) {
1218
+ if (!node.id) return null; // TODO when does this happen?
1219
+ const name = normalizePath(node.id);
1220
+
1221
+ if (seen.has(name) || !module_types.has(path__default.extname(name))) return null;
1222
+ seen.add(name);
1223
+
1224
+ if (name && illegal_imports.has(name)) {
1225
+ return [{ name, dynamic: false }];
1226
+ }
1227
+
1228
+ for (const child of node.importedModules) {
1229
+ const chain = child && find_illegal_vite_imports(child, illegal_imports, module_types, seen);
1230
+ if (chain) return [{ name, dynamic: false }, ...chain];
1231
+ }
1232
+
1233
+ return null;
1234
+ }
1235
+
1236
+ const autogen_comment = '// this file is generated — do not edit it\n';
1237
+ const types_reference = '/// <reference types="@sveltejs/kit" />\n\n';
1238
+
1239
+ /**
1240
+ * Writes ambient declarations including types reference to @sveltejs/kit,
1241
+ * and the existing environment variables in process.env to
1242
+ * $env/static/private and $env/static/public
1243
+ * @param {import('types').ValidatedKitConfig} config
1244
+ * @param {string} mode The Vite mode
1245
+ */
1246
+ function write_ambient(config, mode) {
1247
+ const env = get_env(mode, config.env.publicPrefix);
1248
+
1249
+ // TODO when testing src, `$app` points at `src/runtime/app`... will
1250
+ // probably need to fiddle with aliases
1251
+ write_if_changed(
1252
+ path__default.join(config.outDir, 'runtime/env/static/public.js'),
1253
+ create_env_module('$env/static/public', env.public)
1254
+ );
1255
+
1256
+ write_if_changed(
1257
+ path__default.join(config.outDir, 'runtime/env/static/private.js'),
1258
+ create_env_module('$env/static/private', env.private)
1259
+ );
1260
+
1261
+ write_if_changed(
1262
+ path__default.join(config.outDir, 'ambient.d.ts'),
1263
+ autogen_comment +
1264
+ types_reference +
1265
+ create_env_types('$env/static/public', env.public) +
1266
+ '\n\n' +
1267
+ create_env_types('$env/static/private', env.private)
1268
+ );
1269
+ }
1270
+
1271
+ /**
1272
+ * @param {string} id
1273
+ * @param {Record<string, string>} env
1274
+ * @returns {string}
1275
+ */
1276
+ function create_env_module(id, env) {
1277
+ /** @type {string[]} */
1278
+ const declarations = [];
1279
+
1280
+ for (const key in env) {
1281
+ const warning = !valid_identifier.test(key)
1282
+ ? 'not a valid identifier'
1283
+ : reserved.has(key)
1284
+ ? 'a reserved word'
1285
+ : null;
1286
+
1287
+ if (warning) {
1288
+ console.error(
1289
+ $
1290
+ .bold()
1291
+ .yellow(`Omitting environment variable "${key}" from ${id} as it is ${warning}`)
1292
+ );
1293
+ continue;
1294
+ }
1295
+
1296
+ const comment = `/** @type {import('${id}').${key}} */`;
1297
+ const declaration = `export const ${key} = ${JSON.stringify(env[key])};`;
1298
+
1299
+ declarations.push(`${comment}\n${declaration}`);
1300
+ }
1301
+
1302
+ return autogen_comment + declarations.join('\n\n');
1303
+ }
1304
+
1305
+ /**
1306
+ * @param {string} id
1307
+ * @param {Record<string, string>} env
1308
+ * @returns {string}
1309
+ */
1310
+ function create_env_types(id, env) {
1311
+ const declarations = Object.keys(env)
1312
+ .filter((k) => valid_identifier.test(k))
1313
+ .map((k) => `\texport const ${k}: string;`)
1314
+ .join('\n');
1315
+
1316
+ return `declare module '${id}' {\n${declarations}\n}`;
1317
+ }
1318
+
1319
+ /**
1320
+ * Initialize SvelteKit's generated files.
1321
+ * @param {import('types').ValidatedConfig} config
1322
+ * @param {string} mode
1323
+ */
1324
+ function init(config, mode) {
1325
+ copy_assets(path__default.join(config.kit.outDir, 'runtime'));
1326
+
1327
+ write_tsconfig(config.kit);
1328
+ write_ambient(config.kit, mode);
1329
+ }
1330
+
1331
+ /**
1332
+ * Update SvelteKit's generated files.
1333
+ * @param {import('types').ValidatedConfig} config
1334
+ */
1335
+ function update(config) {
1336
+ const manifest_data = create_manifest_data({ config });
1337
+
1338
+ const output = path__default.join(config.kit.outDir, 'generated');
1339
+ const base = path__default.relative('.', output);
1340
+
1341
+ write_manifest(manifest_data, base, output);
1342
+ write_root(manifest_data, output);
1343
+ write_matchers(manifest_data, output);
1344
+ write_types(config, manifest_data);
1345
+
1346
+ return { manifest_data };
1347
+ }
1348
+
1349
+ /**
1350
+ * Run sync.init and sync.update in series, returning the result from sync.update.
1351
+ * @param {import('types').ValidatedConfig} config
1352
+ * @param {string} mode The Vite mode
1353
+ */
1354
+ function all(config, mode) {
1355
+ init(config, mode);
1356
+ return update(config);
1357
+ }
1358
+
1359
+ var sync = /*#__PURE__*/Object.freeze({
1360
+ __proto__: null,
1361
+ init: init,
1362
+ update: update,
1363
+ all: all
1364
+ });
1365
+
1366
+ export { get_vite_config as a, get_env as b, parse_route_id as c, all as d, prevent_illegal_rollup_imports as e, sync as f, get_aliases as g, init as i, merge_vite_configs as m, prevent_illegal_vite_imports as p, resolve_entry as r, s, update as u };