Better/faster exporting

* add --build and --build-dir options to sapper export (#325)

* tweak export logging, update port-authority to prevent timeout bug

* better logging of export progress

* handle case where linked resource is already fetched

* default to .sapper/dev instead of .sapper

* handle query params and redirects

* dont write server_info.json either - second half of #318

* update changelog

* update lockfile

* try to track down ci test failures

* err wut

* curiouser and curiouser

* ok, seems to work now
This commit is contained in:
Rich Harris
2018-08-03 00:10:58 -04:00
committed by GitHub
parent 31327b3780
commit eae8351f77
11 changed files with 2734 additions and 472 deletions

View File

@@ -402,10 +402,24 @@ function get_page_handler(manifest: Manifest, store_getter: (req: Req) => Store)
return []; // appease TypeScript
}).then(preloaded => {
if (redirect) {
const location = `${req.baseUrl}/${redirect.location}`;
res.statusCode = redirect.statusCode;
res.setHeader('Location', `${req.baseUrl}/${redirect.location}`);
res.setHeader('Location', location);
res.end();
if (process.send) {
process.send({
__sapper__: true,
event: 'file',
url: req.url,
method: req.method,
status: redirect.statusCode,
type: 'text/html',
body: `<script>window.location.href = "${location}"</script>`
});
}
return;
}
@@ -498,7 +512,7 @@ function get_page_handler(manifest: Manifest, store_getter: (req: Req) => Store)
event: 'file',
url: req.url,
method: req.method,
status: 200,
status,
type: 'text/html',
body
});