From c140b128ee516b8946e8bdef407e3c2aa16700b3 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Sun, 18 Mar 2018 22:06:11 -0400 Subject: [PATCH 01/23] expect %sapper.base% --- src/cli/build.ts | 17 ++++++++++++----- src/cli/dev.ts | 7 +++++++ 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/src/cli/build.ts b/src/cli/build.ts index 4bafa49..c997f4a 100644 --- a/src/cli/build.ts +++ b/src/cli/build.ts @@ -13,6 +13,18 @@ export async function build() { mkdirp.sync(output); rimraf.sync(path.join(output, '**/*')); + // minify app/template.html + // TODO compile this to a function? could be quicker than str.replace(...).replace(...).replace(...) + const template = fs.readFileSync(`${locations.app()}/template.html`, 'utf-8'); + + // remove this in a future version + if (template.indexOf('%sapper.base%') === -1) { + console.log(`${clorox.bold.red(`> As of Sapper v0.10, your template.html file must include %sapper.base% in the `)}`); + process.exit(1); + } + + fs.writeFileSync(`${output}/template.html`, minify_html(template)); + const routes = create_routes(); // create app/manifest/client.js and app/manifest/server.js @@ -41,11 +53,6 @@ export async function build() { console.log(`${clorox.inverse(`\nbuilt service worker`)}`); console.log(serviceworker_stats.toString({ colors: true })); } - - // minify app/template.html - // TODO compile this to a function? could be quicker than str.replace(...).replace(...).replace(...) - const template = fs.readFileSync(`${locations.app()}/template.html`, 'utf-8'); - fs.writeFileSync(`${output}/template.html`, minify_html(template)); } function compile(compiler: any) { diff --git a/src/cli/dev.ts b/src/cli/dev.ts index 8b358e3..ea2a364 100644 --- a/src/cli/dev.ts +++ b/src/cli/dev.ts @@ -71,6 +71,13 @@ function create_hot_update_server(port: number, interval = 10000) { } export async function dev(opts: { port: number, open: boolean }) { + // remove this in a future version + const template = fs.readFileSync(path.join(locations.app(), 'template.html'), 'utf-8'); + if (template.indexOf('%sapper.base%') === -1) { + console.log(`${clorox.bold.red(`> As of Sapper v0.10, your template.html file must include %sapper.base% in the `)}`); + process.exit(1); + } + process.env.NODE_ENV = 'development'; let port = opts.port || +process.env.PORT; From 2c61f6d3960496168a5e86896dfabb1cca25f6d7 Mon Sep 17 00:00:00 2001 From: Rich Harris Date: Sun, 18 Mar 2018 22:17:53 -0400 Subject: [PATCH 02/23] -> v0.10.0 --- CHANGELOG.md | 9 +++++++++ package.json | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 14662b5..0d89546 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,14 @@ # sapper changelog +## 0.10.0 + +* Support mounting on a path (this requires `app/template.html` to include `%sapper.base%`) ([#180](https://github.com/sveltejs/sapper/issues/180)) +* Support per-request server-side `Store` with client-side hydration ([#178](https://github.com/sveltejs/sapper/issues/178)) +* Add `this.fetch` to `preload`, with credentials support ([#178](https://github.com/sveltejs/sapper/issues/178)) +* Exclude sourcemaps from preload links and `