@sveltejs/kit 1.0.0-next.31 → 1.0.0-next.310
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -9
- package/assets/app/env.js +20 -0
- package/assets/app/navigation.js +24 -0
- package/assets/app/paths.js +1 -0
- package/assets/app/stores.js +97 -0
- package/assets/client/singletons.js +13 -0
- package/assets/client/start.js +1655 -0
- package/assets/components/error.svelte +18 -2
- package/assets/env.js +8 -0
- package/assets/paths.js +13 -0
- package/assets/server/index.js +2862 -0
- package/dist/chunks/amp_hook.js +56 -0
- package/dist/chunks/cert.js +28154 -0
- package/dist/chunks/constants.js +663 -0
- package/dist/chunks/filesystem.js +110 -0
- package/dist/chunks/index.js +515 -0
- package/dist/chunks/index2.js +1326 -0
- package/dist/chunks/index3.js +118 -0
- package/dist/chunks/index4.js +185 -0
- package/dist/chunks/index5.js +251 -0
- package/dist/chunks/index6.js +15585 -0
- package/dist/chunks/index7.js +4207 -0
- package/dist/chunks/misc.js +78 -0
- package/dist/chunks/multipart-parser.js +449 -0
- package/dist/chunks/object.js +83 -0
- package/dist/chunks/sync.js +983 -0
- package/dist/chunks/url.js +56 -0
- package/dist/cli.js +1023 -91
- package/dist/hooks.js +28 -0
- package/dist/install-fetch.js +6518 -0
- package/dist/node.js +94 -0
- package/package.json +92 -54
- package/svelte-kit.js +2 -0
- package/types/ambient.d.ts +298 -0
- package/types/index.d.ts +258 -0
- package/types/internal.d.ts +314 -0
- package/types/private.d.ts +269 -0
- package/CHANGELOG.md +0 -344
- package/assets/runtime/app/navigation.js +0 -23
- package/assets/runtime/app/navigation.js.map +0 -1
- package/assets/runtime/app/paths.js +0 -2
- package/assets/runtime/app/paths.js.map +0 -1
- package/assets/runtime/app/stores.js +0 -78
- package/assets/runtime/app/stores.js.map +0 -1
- package/assets/runtime/internal/singletons.js +0 -15
- package/assets/runtime/internal/singletons.js.map +0 -1
- package/assets/runtime/internal/start.js +0 -591
- package/assets/runtime/internal/start.js.map +0 -1
- package/assets/runtime/utils-85ebcc60.js +0 -18
- package/assets/runtime/utils-85ebcc60.js.map +0 -1
- package/dist/api.js +0 -44
- package/dist/api.js.map +0 -1
- package/dist/cli.js.map +0 -1
- package/dist/create_app.js +0 -580
- package/dist/create_app.js.map +0 -1
- package/dist/index.js +0 -375
- package/dist/index.js.map +0 -1
- package/dist/index2.js +0 -12205
- package/dist/index2.js.map +0 -1
- package/dist/index3.js +0 -549
- package/dist/index3.js.map +0 -1
- package/dist/index4.js +0 -74
- package/dist/index4.js.map +0 -1
- package/dist/index5.js +0 -468
- package/dist/index5.js.map +0 -1
- package/dist/index6.js +0 -735
- package/dist/index6.js.map +0 -1
- package/dist/renderer.js +0 -2425
- package/dist/renderer.js.map +0 -1
- package/dist/standard.js +0 -103
- package/dist/standard.js.map +0 -1
- package/dist/utils.js +0 -58
- package/dist/utils.js.map +0 -1
- package/svelte-kit +0 -3
package/dist/create_app.js
DELETED
|
@@ -1,580 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var fs = require('fs');
|
|
4
|
-
var path = require('path');
|
|
5
|
-
var standard = require('./standard.js');
|
|
6
|
-
var utils = require('./utils.js');
|
|
7
|
-
|
|
8
|
-
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.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-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.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"]};
|
|
9
|
-
|
|
10
|
-
var mime = new standard.Mime_1(standard.standard, other);
|
|
11
|
-
|
|
12
|
-
function posixify(str) {
|
|
13
|
-
return str.replace(/\\/g, '/');
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const previous_contents = new Map();
|
|
17
|
-
|
|
18
|
-
function write_if_changed(file, code) {
|
|
19
|
-
if (code !== previous_contents.get(file)) {
|
|
20
|
-
previous_contents.set(file, code);
|
|
21
|
-
utils.mkdirp(path.dirname(file));
|
|
22
|
-
fs.writeFileSync(file, code);
|
|
23
|
-
fudge_mtime(file);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function fudge_mtime(file) {
|
|
28
|
-
// need to fudge the mtime so that webpack doesn't go doolally
|
|
29
|
-
const { atime, mtime } = fs.statSync(file);
|
|
30
|
-
fs.utimesSync(file, new Date(atime.getTime() - 999999), new Date(mtime.getTime() - 999999));
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
const reserved_words = new Set([
|
|
34
|
-
'arguments',
|
|
35
|
-
'await',
|
|
36
|
-
'break',
|
|
37
|
-
'case',
|
|
38
|
-
'catch',
|
|
39
|
-
'class',
|
|
40
|
-
'const',
|
|
41
|
-
'continue',
|
|
42
|
-
'debugger',
|
|
43
|
-
'default',
|
|
44
|
-
'delete',
|
|
45
|
-
'do',
|
|
46
|
-
'else',
|
|
47
|
-
'enum',
|
|
48
|
-
'eval',
|
|
49
|
-
'export',
|
|
50
|
-
'extends',
|
|
51
|
-
'false',
|
|
52
|
-
'finally',
|
|
53
|
-
'for',
|
|
54
|
-
'function',
|
|
55
|
-
'if',
|
|
56
|
-
'implements',
|
|
57
|
-
'import',
|
|
58
|
-
'in',
|
|
59
|
-
'instanceof',
|
|
60
|
-
'interface',
|
|
61
|
-
'let',
|
|
62
|
-
'new',
|
|
63
|
-
'null',
|
|
64
|
-
'package',
|
|
65
|
-
'private',
|
|
66
|
-
'protected',
|
|
67
|
-
'public',
|
|
68
|
-
'return',
|
|
69
|
-
'static',
|
|
70
|
-
'super',
|
|
71
|
-
'switch',
|
|
72
|
-
'this',
|
|
73
|
-
'throw',
|
|
74
|
-
'true',
|
|
75
|
-
'try',
|
|
76
|
-
'typeof',
|
|
77
|
-
'var',
|
|
78
|
-
'void',
|
|
79
|
-
'while',
|
|
80
|
-
'with',
|
|
81
|
-
'yield'
|
|
82
|
-
]);
|
|
83
|
-
|
|
84
|
-
function create_manifest_data(config, extensions = '.svelte') {
|
|
85
|
-
// TODO support .svelte.md etc?
|
|
86
|
-
const cwd = config.files.routes;
|
|
87
|
-
const component_extensions = extensions.split(' ');
|
|
88
|
-
|
|
89
|
-
function find_layout(file_name, component_name, dir = '') {
|
|
90
|
-
const ext = component_extensions.find((ext) =>
|
|
91
|
-
fs.existsSync(path.join(cwd, dir, `${file_name}${ext}`))
|
|
92
|
-
);
|
|
93
|
-
const file = posixify(path.join(dir, `${file_name}${ext}`));
|
|
94
|
-
const url = `/${config.appDir}/routes/${file}.js`;
|
|
95
|
-
|
|
96
|
-
return ext
|
|
97
|
-
? {
|
|
98
|
-
name: component_name,
|
|
99
|
-
file,
|
|
100
|
-
url
|
|
101
|
-
}
|
|
102
|
-
: null;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
const components = [];
|
|
106
|
-
const pages = [];
|
|
107
|
-
const endpoints = [];
|
|
108
|
-
|
|
109
|
-
const seen = new Map();
|
|
110
|
-
const check_pattern = (pattern, file) => {
|
|
111
|
-
pattern = pattern.toString();
|
|
112
|
-
|
|
113
|
-
if (seen.has(pattern)) {
|
|
114
|
-
throw new Error(`The ${seen.get(pattern)} and ${file} routes clash`);
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
seen.set(pattern, file);
|
|
118
|
-
};
|
|
119
|
-
|
|
120
|
-
const default_layout = {
|
|
121
|
-
name: '$default_layout',
|
|
122
|
-
url: `/${config.appDir}/assets/components/layout.svelte.js`
|
|
123
|
-
};
|
|
124
|
-
|
|
125
|
-
const default_error = {
|
|
126
|
-
name: '$default_error',
|
|
127
|
-
url: `/${config.appDir}/assets/components/error.svelte.js`
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
function walk(dir, parent_segments, parent_params, stack) {
|
|
131
|
-
const items = fs.readdirSync(dir)
|
|
132
|
-
.map((basename) => {
|
|
133
|
-
const resolved = path.join(dir, basename);
|
|
134
|
-
const file = path.relative(cwd, resolved);
|
|
135
|
-
const is_dir = fs.statSync(resolved).isDirectory();
|
|
136
|
-
|
|
137
|
-
const ext = path.extname(basename);
|
|
138
|
-
|
|
139
|
-
if (basename[0] === '$') return null; // $layout, $error
|
|
140
|
-
if (basename[0] === '_') return null; // private files
|
|
141
|
-
if (basename[0] === '.' && basename !== '.well-known') return null;
|
|
142
|
-
if (!is_dir && !/^\.[a-z]+$/i.test(ext)) return null; // filter out tmp files etc
|
|
143
|
-
|
|
144
|
-
const segment = is_dir ? basename : basename.slice(0, -ext.length);
|
|
145
|
-
|
|
146
|
-
if (/\]\[/.test(segment)) {
|
|
147
|
-
throw new Error(`Invalid route ${file} — parameters must be separated`);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
const parts = get_parts(segment);
|
|
151
|
-
const is_index = is_dir ? false : basename.startsWith('index.');
|
|
152
|
-
const is_page = component_extensions.indexOf(ext) !== -1;
|
|
153
|
-
const route_suffix = basename.slice(basename.indexOf('.'), -ext.length);
|
|
154
|
-
|
|
155
|
-
parts.forEach((part) => {
|
|
156
|
-
if (part.qualifier && /[()?:]/.test(part.qualifier.slice(1, -1))) {
|
|
157
|
-
throw new Error(`Invalid route ${file} — cannot use (, ), ? or : in route qualifiers`);
|
|
158
|
-
}
|
|
159
|
-
});
|
|
160
|
-
|
|
161
|
-
return {
|
|
162
|
-
basename,
|
|
163
|
-
ext,
|
|
164
|
-
parts,
|
|
165
|
-
file: posixify(file),
|
|
166
|
-
is_dir,
|
|
167
|
-
is_index,
|
|
168
|
-
is_page,
|
|
169
|
-
route_suffix
|
|
170
|
-
};
|
|
171
|
-
})
|
|
172
|
-
.filter(Boolean)
|
|
173
|
-
.sort(comparator);
|
|
174
|
-
|
|
175
|
-
items.forEach((item) => {
|
|
176
|
-
const segments = parent_segments.slice();
|
|
177
|
-
|
|
178
|
-
if (item.is_index) {
|
|
179
|
-
if (item.route_suffix) {
|
|
180
|
-
if (segments.length > 0) {
|
|
181
|
-
const last_segment = segments[segments.length - 1].slice();
|
|
182
|
-
const last_part = last_segment[last_segment.length - 1];
|
|
183
|
-
|
|
184
|
-
if (last_part.dynamic) {
|
|
185
|
-
last_segment.push({ dynamic: false, content: item.route_suffix });
|
|
186
|
-
} else {
|
|
187
|
-
last_segment[last_segment.length - 1] = {
|
|
188
|
-
dynamic: false,
|
|
189
|
-
content: `${last_part.content}${item.route_suffix}`
|
|
190
|
-
};
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
segments[segments.length - 1] = last_segment;
|
|
194
|
-
} else {
|
|
195
|
-
segments.push(item.parts);
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
} else {
|
|
199
|
-
segments.push(item.parts);
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
const params = parent_params.slice();
|
|
203
|
-
params.push(...item.parts.filter((p) => p.dynamic).map((p) => p.content));
|
|
204
|
-
|
|
205
|
-
if (item.is_dir) {
|
|
206
|
-
const component = find_layout('$layout', `${get_slug(item.file)}__layout`, item.file);
|
|
207
|
-
|
|
208
|
-
if (component) components.push(component);
|
|
209
|
-
|
|
210
|
-
walk(
|
|
211
|
-
path.join(dir, item.basename),
|
|
212
|
-
segments,
|
|
213
|
-
params,
|
|
214
|
-
component ? stack.concat(component) : stack
|
|
215
|
-
);
|
|
216
|
-
} else if (item.is_page) {
|
|
217
|
-
const component = {
|
|
218
|
-
name: get_slug(item.file),
|
|
219
|
-
file: item.file,
|
|
220
|
-
url: `/${config.appDir}/routes/${item.file}.js`
|
|
221
|
-
};
|
|
222
|
-
|
|
223
|
-
components.push(component);
|
|
224
|
-
|
|
225
|
-
const parts =
|
|
226
|
-
item.is_index && stack[stack.length - 1] === null
|
|
227
|
-
? stack.slice(0, -1).concat(component)
|
|
228
|
-
: stack.concat(component);
|
|
229
|
-
|
|
230
|
-
const pattern = get_pattern(segments, true);
|
|
231
|
-
check_pattern(pattern, item.file);
|
|
232
|
-
|
|
233
|
-
pages.push({
|
|
234
|
-
pattern,
|
|
235
|
-
params,
|
|
236
|
-
parts
|
|
237
|
-
});
|
|
238
|
-
} else {
|
|
239
|
-
const pattern = get_pattern(segments, !item.route_suffix);
|
|
240
|
-
check_pattern(pattern, item.file);
|
|
241
|
-
|
|
242
|
-
endpoints.push({
|
|
243
|
-
name: `route_${get_slug(item.file)}`,
|
|
244
|
-
pattern,
|
|
245
|
-
file: item.file,
|
|
246
|
-
url: `/${config.appDir}/routes/${item.file.replace(/\.\w+$/, '.js')}`,
|
|
247
|
-
params
|
|
248
|
-
});
|
|
249
|
-
}
|
|
250
|
-
});
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
const layout = find_layout('$layout', 'main') || default_layout;
|
|
254
|
-
const error = find_layout('$error', 'error') || default_error;
|
|
255
|
-
|
|
256
|
-
walk(cwd, [], [], []);
|
|
257
|
-
|
|
258
|
-
return {
|
|
259
|
-
assets: fs.existsSync(config.files.assets) ? list_files(config.files.assets, '') : [],
|
|
260
|
-
layout,
|
|
261
|
-
error,
|
|
262
|
-
components,
|
|
263
|
-
pages,
|
|
264
|
-
endpoints
|
|
265
|
-
};
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
function is_spread(path) {
|
|
269
|
-
const spread_pattern = /\[\.{3}/g;
|
|
270
|
-
return spread_pattern.test(path);
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
function comparator(a, b) {
|
|
274
|
-
if (a.is_index !== b.is_index) {
|
|
275
|
-
if (a.is_index) return is_spread(a.file) ? 1 : -1;
|
|
276
|
-
|
|
277
|
-
return is_spread(b.file) ? -1 : 1;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
const max = Math.max(a.parts.length, b.parts.length);
|
|
281
|
-
|
|
282
|
-
for (let i = 0; i < max; i += 1) {
|
|
283
|
-
const a_sub_part = a.parts[i];
|
|
284
|
-
const b_sub_part = b.parts[i];
|
|
285
|
-
|
|
286
|
-
if (!a_sub_part) return 1; // b is more specific, so goes first
|
|
287
|
-
if (!b_sub_part) return -1;
|
|
288
|
-
|
|
289
|
-
// if spread && index, order later
|
|
290
|
-
if (a_sub_part.spread && b_sub_part.spread) {
|
|
291
|
-
return a.is_index ? 1 : -1;
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
// If one is ...spread order it later
|
|
295
|
-
if (a_sub_part.spread !== b_sub_part.spread) return a_sub_part.spread ? 1 : -1;
|
|
296
|
-
|
|
297
|
-
if (a_sub_part.dynamic !== b_sub_part.dynamic) {
|
|
298
|
-
return a_sub_part.dynamic ? 1 : -1;
|
|
299
|
-
}
|
|
300
|
-
|
|
301
|
-
if (!a_sub_part.dynamic && a_sub_part.content !== b_sub_part.content) {
|
|
302
|
-
return (
|
|
303
|
-
b_sub_part.content.length - a_sub_part.content.length ||
|
|
304
|
-
(a_sub_part.content < b_sub_part.content ? -1 : 1)
|
|
305
|
-
);
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
// If both parts dynamic, check for regexp patterns
|
|
309
|
-
if (a_sub_part.dynamic && b_sub_part.dynamic) {
|
|
310
|
-
const regexp_pattern = /\((.*?)\)/;
|
|
311
|
-
const a_match = regexp_pattern.exec(a_sub_part.content);
|
|
312
|
-
const b_match = regexp_pattern.exec(b_sub_part.content);
|
|
313
|
-
|
|
314
|
-
if (!a_match && b_match) {
|
|
315
|
-
return 1; // No regexp, so less specific than b
|
|
316
|
-
}
|
|
317
|
-
if (!b_match && a_match) {
|
|
318
|
-
return -1;
|
|
319
|
-
}
|
|
320
|
-
if (a_match && b_match && a_match[1] !== b_match[1]) {
|
|
321
|
-
return b_match[1].length - a_match[1].length;
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
function get_parts(part) {
|
|
328
|
-
return part
|
|
329
|
-
.split(/\[(.+?\(.+?\)|.+?)\]/)
|
|
330
|
-
.map((str, i) => {
|
|
331
|
-
if (!str) return null;
|
|
332
|
-
const dynamic = i % 2 === 1;
|
|
333
|
-
|
|
334
|
-
const [, content, qualifier] = dynamic ? /([^(]+)(\(.+\))?$/.exec(str) : [null, str, null];
|
|
335
|
-
|
|
336
|
-
return {
|
|
337
|
-
content,
|
|
338
|
-
dynamic,
|
|
339
|
-
spread: dynamic && /^\.{3}.+$/.test(content),
|
|
340
|
-
qualifier
|
|
341
|
-
};
|
|
342
|
-
})
|
|
343
|
-
.filter(Boolean);
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
function get_slug(file) {
|
|
347
|
-
let name = file
|
|
348
|
-
.replace(/[\\/]index/, '')
|
|
349
|
-
.replace(/[/\\]/g, '_')
|
|
350
|
-
.replace(/\.\w+$/, '')
|
|
351
|
-
.replace(/\[([^(]+)(?:\([^(]+\))?\]/, '$$$1')
|
|
352
|
-
.replace(/[^a-zA-Z0-9_$]/g, (c) => {
|
|
353
|
-
return c === '.' ? '_' : `$${c.charCodeAt(0)}`;
|
|
354
|
-
});
|
|
355
|
-
|
|
356
|
-
if (reserved_words.has(name)) name += '_';
|
|
357
|
-
return name;
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
function get_pattern(segments, add_trailing_slash) {
|
|
361
|
-
const path = segments
|
|
362
|
-
.map((segment) => {
|
|
363
|
-
return segment
|
|
364
|
-
.map((part) => {
|
|
365
|
-
return part.dynamic
|
|
366
|
-
? part.qualifier || (part.spread ? '(.+)' : '([^/]+?)')
|
|
367
|
-
: encodeURI(part.content.normalize())
|
|
368
|
-
.replace(/\?/g, '%3F')
|
|
369
|
-
.replace(/#/g, '%23')
|
|
370
|
-
.replace(/%5B/g, '[')
|
|
371
|
-
.replace(/%5D/g, ']')
|
|
372
|
-
.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
373
|
-
})
|
|
374
|
-
.join('');
|
|
375
|
-
})
|
|
376
|
-
.join('\\/');
|
|
377
|
-
|
|
378
|
-
const trailing = add_trailing_slash && segments.length ? '\\/?$' : '$';
|
|
379
|
-
|
|
380
|
-
return new RegExp(`^\\/${path}${trailing}`);
|
|
381
|
-
}
|
|
382
|
-
|
|
383
|
-
function list_files(dir, path, files = []) {
|
|
384
|
-
fs.readdirSync(dir).forEach((file) => {
|
|
385
|
-
const full = `${dir}/${file}`;
|
|
386
|
-
|
|
387
|
-
const stats = fs.statSync(full);
|
|
388
|
-
const joined = path ? `${path}/${file}` : file;
|
|
389
|
-
|
|
390
|
-
if (stats.isDirectory()) {
|
|
391
|
-
list_files(full, joined, files);
|
|
392
|
-
} else {
|
|
393
|
-
if (file === '.DS_Store') return;
|
|
394
|
-
files.push({
|
|
395
|
-
file: joined,
|
|
396
|
-
size: stats.size,
|
|
397
|
-
type: mime.getType(joined)
|
|
398
|
-
});
|
|
399
|
-
}
|
|
400
|
-
});
|
|
401
|
-
|
|
402
|
-
return files;
|
|
403
|
-
}
|
|
404
|
-
|
|
405
|
-
function create_app({ manifest_data, output }) {
|
|
406
|
-
write_if_changed(`${output}/generated/manifest.js`, generate_client_manifest(manifest_data));
|
|
407
|
-
|
|
408
|
-
write_if_changed(`${output}/generated/root.svelte`, generate_app(manifest_data));
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
function trim(str) {
|
|
412
|
-
return str.replace(/^\t\t/gm, '').trim();
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
function generate_client_manifest(manifest_data) {
|
|
416
|
-
const page_ids = new Set(manifest_data.pages.map((page) => page.pattern.toString()));
|
|
417
|
-
|
|
418
|
-
const endpoints_to_ignore = manifest_data.endpoints.filter(
|
|
419
|
-
(route) => !page_ids.has(route.pattern.toString())
|
|
420
|
-
);
|
|
421
|
-
|
|
422
|
-
const component_indexes = {};
|
|
423
|
-
|
|
424
|
-
const components = `[
|
|
425
|
-
${manifest_data.components
|
|
426
|
-
.map((component, i) => {
|
|
427
|
-
component_indexes[component.name] = i;
|
|
428
|
-
|
|
429
|
-
return `() => import(${JSON.stringify(component.url)})`;
|
|
430
|
-
})
|
|
431
|
-
.join(',\n\t\t\t\t')}
|
|
432
|
-
]`.replace(/^\t/gm, '');
|
|
433
|
-
|
|
434
|
-
const pages = `[
|
|
435
|
-
${manifest_data.pages
|
|
436
|
-
.map((page) => {
|
|
437
|
-
const params = page.params.length
|
|
438
|
-
? '(m) => ({ ' +
|
|
439
|
-
page.params
|
|
440
|
-
.map((param, i) => {
|
|
441
|
-
return param.startsWith('...')
|
|
442
|
-
? `${param.slice(3)}: d(m[${i + 1}]).split('/')`
|
|
443
|
-
: `${param}: d(m[${i + 1}])`;
|
|
444
|
-
})
|
|
445
|
-
.join(', ') +
|
|
446
|
-
'})'
|
|
447
|
-
: 'empty';
|
|
448
|
-
|
|
449
|
-
return `{
|
|
450
|
-
// ${page.parts[page.parts.length - 1].file}
|
|
451
|
-
pattern: ${page.pattern},
|
|
452
|
-
params: ${params},
|
|
453
|
-
parts: [${page.parts.map((part) => `components[${component_indexes[part.name]}]`).join(', ')}]
|
|
454
|
-
}`;
|
|
455
|
-
})
|
|
456
|
-
.join(',\n\n\t\t')}
|
|
457
|
-
]`.replace(/^\t/gm, '');
|
|
458
|
-
|
|
459
|
-
return trim(`
|
|
460
|
-
import * as layout from ${JSON.stringify(manifest_data.layout.url)};
|
|
461
|
-
|
|
462
|
-
const components = ${components};
|
|
463
|
-
|
|
464
|
-
const d = decodeURIComponent;
|
|
465
|
-
const empty = () => ({});
|
|
466
|
-
|
|
467
|
-
export const pages = ${pages};
|
|
468
|
-
|
|
469
|
-
export const ignore = [
|
|
470
|
-
${endpoints_to_ignore.map((route) => route.pattern).join(',\n\t\t\t')}
|
|
471
|
-
];
|
|
472
|
-
|
|
473
|
-
export { layout };
|
|
474
|
-
`);
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
function generate_app(manifest_data) {
|
|
478
|
-
// TODO remove default layout altogether
|
|
479
|
-
|
|
480
|
-
const max_depth = Math.max(
|
|
481
|
-
...manifest_data.pages.map((page) => page.parts.filter(Boolean).length)
|
|
482
|
-
);
|
|
483
|
-
|
|
484
|
-
const levels = [];
|
|
485
|
-
for (let i = 0; i <= max_depth; i += 1) {
|
|
486
|
-
levels.push(i);
|
|
487
|
-
}
|
|
488
|
-
|
|
489
|
-
let l = max_depth;
|
|
490
|
-
|
|
491
|
-
let pyramid = `<svelte:component this={components[${l}]} {...(props_${l} || {})}/>`;
|
|
492
|
-
|
|
493
|
-
while (l-- > 1) {
|
|
494
|
-
pyramid = `
|
|
495
|
-
<svelte:component this={components[${l}]} {...(props_${l} || {})}>
|
|
496
|
-
{#if components[${l + 1}]}
|
|
497
|
-
${pyramid.replace(/\n/g, '\n\t\t\t\t\t')}
|
|
498
|
-
{/if}
|
|
499
|
-
</svelte:component>
|
|
500
|
-
`
|
|
501
|
-
.replace(/^\t\t\t/gm, '')
|
|
502
|
-
.trim();
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
return trim(`
|
|
506
|
-
<!-- This file is generated by @sveltejs/kit — do not edit it! -->
|
|
507
|
-
<script>
|
|
508
|
-
import { setContext, afterUpdate, onMount } from 'svelte';
|
|
509
|
-
import ErrorComponent from ${JSON.stringify(manifest_data.error.url)};
|
|
510
|
-
|
|
511
|
-
// error handling
|
|
512
|
-
export let status = undefined;
|
|
513
|
-
export let error = undefined;
|
|
514
|
-
|
|
515
|
-
// stores
|
|
516
|
-
export let stores;
|
|
517
|
-
export let page;
|
|
518
|
-
|
|
519
|
-
export let components;
|
|
520
|
-
${levels.map((l) => `export let props_${l} = null;`).join('\n\t\t\t')}
|
|
521
|
-
|
|
522
|
-
const Layout = components[0];
|
|
523
|
-
|
|
524
|
-
setContext('__svelte__', stores);
|
|
525
|
-
|
|
526
|
-
$: stores.page.set(page);
|
|
527
|
-
afterUpdate(stores.page.notify);
|
|
528
|
-
|
|
529
|
-
let mounted = false;
|
|
530
|
-
let navigated = false;
|
|
531
|
-
let title = null;
|
|
532
|
-
|
|
533
|
-
onMount(() => {
|
|
534
|
-
const unsubscribe = stores.page.subscribe(() => {
|
|
535
|
-
if (mounted) {
|
|
536
|
-
navigated = true;
|
|
537
|
-
title = document.title;
|
|
538
|
-
}
|
|
539
|
-
});
|
|
540
|
-
|
|
541
|
-
mounted = true;
|
|
542
|
-
return unsubscribe;
|
|
543
|
-
});
|
|
544
|
-
</script>
|
|
545
|
-
|
|
546
|
-
<Layout {...(props_0 || {})}>
|
|
547
|
-
{#if error}
|
|
548
|
-
<ErrorComponent {status} {error}/>
|
|
549
|
-
{:else}
|
|
550
|
-
${pyramid.replace(/\n/g, '\n\t\t\t\t')}
|
|
551
|
-
{/if}
|
|
552
|
-
</Layout>
|
|
553
|
-
|
|
554
|
-
{#if mounted}
|
|
555
|
-
<div id="svelte-announcer" aria-live="assertive" aria-atomic="true">
|
|
556
|
-
{#if navigated}
|
|
557
|
-
Navigated to {title}
|
|
558
|
-
{/if}
|
|
559
|
-
</div>
|
|
560
|
-
{/if}
|
|
561
|
-
|
|
562
|
-
<style>
|
|
563
|
-
#svelte-announcer {
|
|
564
|
-
position: absolute;
|
|
565
|
-
left: 0;
|
|
566
|
-
top: 0;
|
|
567
|
-
clip: rect(0 0 0 0);
|
|
568
|
-
clip-path: inset(50%);
|
|
569
|
-
overflow: hidden;
|
|
570
|
-
white-space: nowrap;
|
|
571
|
-
width: 1px;
|
|
572
|
-
height: 1px;
|
|
573
|
-
}
|
|
574
|
-
</style>
|
|
575
|
-
`);
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
exports.create_app = create_app;
|
|
579
|
-
exports.create_manifest_data = create_manifest_data;
|
|
580
|
-
//# sourceMappingURL=create_app.js.map
|