mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-14 12:04:39 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2752c73ebb | ||
|
|
2547db39ac |
@@ -1,5 +1,10 @@
|
|||||||
# sapper changelog
|
# 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
|
## 0.7.1
|
||||||
|
|
||||||
* Add missing `tslib` dependency
|
* Add missing `tslib` dependency
|
||||||
|
|||||||
@@ -1,7 +1,5 @@
|
|||||||
let source;
|
let source;
|
||||||
|
|
||||||
console.log('!!!! hmr client');
|
|
||||||
|
|
||||||
function check() {
|
function check() {
|
||||||
if (module.hot.status() === 'idle') {
|
if (module.hot.status() === 'idle') {
|
||||||
module.hot.check(true).then(modules => {
|
module.hot.check(true).then(modules => {
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "sapper",
|
"name": "sapper",
|
||||||
"version": "0.7.1",
|
"version": "0.7.2",
|
||||||
"description": "Military-grade apps, engineered by Svelte",
|
"description": "Military-grade apps, engineered by Svelte",
|
||||||
"main": "middleware.js",
|
"main": "middleware.js",
|
||||||
"bin": {
|
"bin": {
|
||||||
@@ -12,6 +12,7 @@
|
|||||||
"middleware.js",
|
"middleware.js",
|
||||||
"runtime",
|
"runtime",
|
||||||
"runtime.js",
|
"runtime.js",
|
||||||
|
"hmr-client.js",
|
||||||
"webpack"
|
"webpack"
|
||||||
],
|
],
|
||||||
"directories": {
|
"directories": {
|
||||||
@@ -24,6 +25,7 @@
|
|||||||
"code-frame": "^5.0.0",
|
"code-frame": "^5.0.0",
|
||||||
"escape-html": "^1.0.3",
|
"escape-html": "^1.0.3",
|
||||||
"express": "^4.16.2",
|
"express": "^4.16.2",
|
||||||
|
"get-port": "^3.2.0",
|
||||||
"glob": "^7.1.2",
|
"glob": "^7.1.2",
|
||||||
"locate-character": "^2.0.5",
|
"locate-character": "^2.0.5",
|
||||||
"mime": "^2.2.0",
|
"mime": "^2.2.0",
|
||||||
@@ -51,7 +53,6 @@
|
|||||||
"electron": "^1.8.2",
|
"electron": "^1.8.2",
|
||||||
"eslint": "^4.13.1",
|
"eslint": "^4.13.1",
|
||||||
"eslint-plugin-import": "^2.8.0",
|
"eslint-plugin-import": "^2.8.0",
|
||||||
"get-port": "^3.2.0",
|
|
||||||
"mocha": "^4.0.1",
|
"mocha": "^4.0.1",
|
||||||
"nightmare": "^2.10.0",
|
"nightmare": "^2.10.0",
|
||||||
"npm-run-all": "^4.1.2",
|
"npm-run-all": "^4.1.2",
|
||||||
|
|||||||
@@ -182,33 +182,41 @@ export default async function dev(src: string, dir: string) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
return create_serviceworker({
|
create_serviceworker({
|
||||||
routes: create_routes({ src }),
|
routes: create_routes({ src }),
|
||||||
client_files,
|
client_files,
|
||||||
src
|
src
|
||||||
});
|
});
|
||||||
|
|
||||||
|
watch_serviceworker();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (compilers.serviceworker) {
|
let watch_serviceworker = compilers.serviceworker
|
||||||
compilers.serviceworker.plugin('invalid', (filename: string) => {
|
? function() {
|
||||||
times.serviceworker_start = Date.now();
|
watch_serviceworker = noop;
|
||||||
});
|
|
||||||
|
|
||||||
compilers.serviceworker.watch({}, (err: Error, stats: any) => {
|
compilers.serviceworker.plugin('invalid', (filename: string) => {
|
||||||
if (err) {
|
times.serviceworker_start = Date.now();
|
||||||
// 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();
|
compilers.serviceworker.watch({}, (err: Error, stats: any) => {
|
||||||
fs.writeFileSync(path.join(dir, 'serviceworker_info.json'), JSON.stringify(serviceworker_info, null, ' '));
|
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) {
|
if (dev) {
|
||||||
const hmr_client = posixify(
|
const hmr_client = posixify(
|
||||||
path.resolve(__dirname, 'src/hmr-client.js')
|
path.resolve(__dirname, 'hmr-client.js')
|
||||||
);
|
);
|
||||||
|
|
||||||
code += `
|
code += `
|
||||||
|
|||||||
Reference in New Issue
Block a user