mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-13 11:35:28 +00:00
Compare commits
3 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2752c73ebb | ||
|
|
2547db39ac | ||
|
|
1285739cc5 |
@@ -1,5 +1,14 @@
|
||||
# sapper changelog
|
||||
|
||||
## 0.7.2
|
||||
|
||||
* Add `hmr-client.js` to package
|
||||
* Wait until first successful client build before creating service-worker.js
|
||||
|
||||
## 0.7.1
|
||||
|
||||
* Add missing `tslib` dependency
|
||||
|
||||
## 0.7.0
|
||||
|
||||
* Restructure app layout (see [migration guide](https://sapper.svelte.technology/guide#0-6-to-0-7)) ([#126](https://github.com/sveltejs/sapper/pull/126))
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
let source;
|
||||
|
||||
console.log('!!!! hmr client');
|
||||
|
||||
function check() {
|
||||
if (module.hot.status() === 'idle') {
|
||||
module.hot.check(true).then(modules => {
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "sapper",
|
||||
"version": "0.7.0",
|
||||
"version": "0.7.2",
|
||||
"description": "Military-grade apps, engineered by Svelte",
|
||||
"main": "middleware.js",
|
||||
"bin": {
|
||||
@@ -12,6 +12,7 @@
|
||||
"middleware.js",
|
||||
"runtime",
|
||||
"runtime.js",
|
||||
"hmr-client.js",
|
||||
"webpack"
|
||||
],
|
||||
"directories": {
|
||||
@@ -24,6 +25,7 @@
|
||||
"code-frame": "^5.0.0",
|
||||
"escape-html": "^1.0.3",
|
||||
"express": "^4.16.2",
|
||||
"get-port": "^3.2.0",
|
||||
"glob": "^7.1.2",
|
||||
"locate-character": "^2.0.5",
|
||||
"mime": "^2.2.0",
|
||||
@@ -35,6 +37,7 @@
|
||||
"rimraf": "^2.6.2",
|
||||
"sander": "^0.6.0",
|
||||
"serialize-javascript": "^1.4.0",
|
||||
"tslib": "^1.8.1",
|
||||
"url-parse": "^1.2.0",
|
||||
"wait-port": "^0.2.2",
|
||||
"walk-sync": "^0.3.2",
|
||||
@@ -50,7 +53,6 @@
|
||||
"electron": "^1.8.2",
|
||||
"eslint": "^4.13.1",
|
||||
"eslint-plugin-import": "^2.8.0",
|
||||
"get-port": "^3.2.0",
|
||||
"mocha": "^4.0.1",
|
||||
"nightmare": "^2.10.0",
|
||||
"npm-run-all": "^4.1.2",
|
||||
@@ -63,7 +65,6 @@
|
||||
"svelte": "^1.49.1",
|
||||
"svelte-loader": "^2.3.2",
|
||||
"ts-node": "^4.1.0",
|
||||
"tslib": "^1.8.1",
|
||||
"typescript": "^2.6.2"
|
||||
},
|
||||
"scripts": {
|
||||
|
||||
@@ -182,33 +182,41 @@ export default async function dev(src: string, dir: string) {
|
||||
});
|
||||
});
|
||||
|
||||
return create_serviceworker({
|
||||
create_serviceworker({
|
||||
routes: create_routes({ src }),
|
||||
client_files,
|
||||
src
|
||||
});
|
||||
|
||||
watch_serviceworker();
|
||||
}
|
||||
});
|
||||
|
||||
if (compilers.serviceworker) {
|
||||
compilers.serviceworker.plugin('invalid', (filename: string) => {
|
||||
times.serviceworker_start = Date.now();
|
||||
});
|
||||
let watch_serviceworker = compilers.serviceworker
|
||||
? function() {
|
||||
watch_serviceworker = noop;
|
||||
|
||||
compilers.serviceworker.watch({}, (err: Error, stats: any) => {
|
||||
if (err) {
|
||||
// TODO notify client
|
||||
} else if (stats.hasErrors()) {
|
||||
// print errors. TODO notify client
|
||||
stats.toJson().errors.forEach((error: Error) => {
|
||||
console.error(error); // TODO make this look nice
|
||||
});
|
||||
} else {
|
||||
console.log(`built service worker in ${Date.now() - times.serviceworker_start}ms`); // TODO prettify
|
||||
compilers.serviceworker.plugin('invalid', (filename: string) => {
|
||||
times.serviceworker_start = Date.now();
|
||||
});
|
||||
|
||||
const serviceworker_info = stats.toJson();
|
||||
fs.writeFileSync(path.join(dir, 'serviceworker_info.json'), JSON.stringify(serviceworker_info, null, ' '));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
compilers.serviceworker.watch({}, (err: Error, stats: any) => {
|
||||
if (err) {
|
||||
// TODO notify client
|
||||
} else if (stats.hasErrors()) {
|
||||
// print errors. TODO notify client
|
||||
stats.toJson().errors.forEach((error: Error) => {
|
||||
console.error(error); // TODO make this look nice
|
||||
});
|
||||
} else {
|
||||
console.log(`built service worker in ${Date.now() - times.serviceworker_start}ms`); // TODO prettify
|
||||
|
||||
const serviceworker_info = stats.toJson();
|
||||
fs.writeFileSync(path.join(dir, 'serviceworker_info.json'), JSON.stringify(serviceworker_info, null, ' '));
|
||||
}
|
||||
});
|
||||
}
|
||||
: noop;
|
||||
}
|
||||
|
||||
function noop() {}
|
||||
@@ -41,7 +41,7 @@ function generate_client(routes: Route[], src: string, dev: boolean, dev_port?:
|
||||
|
||||
if (dev) {
|
||||
const hmr_client = posixify(
|
||||
path.resolve(__dirname, 'src/hmr-client.js')
|
||||
path.resolve(__dirname, 'hmr-client.js')
|
||||
);
|
||||
|
||||
code += `
|
||||
|
||||
Reference in New Issue
Block a user