Add service-worker generation in build process

This will precache all the required resources and will allow the
application to respond even when the internet connection is not
available.
This commit is contained in:
Pratik Borsadiya 2018-09-05 11:47:00 +05:30
parent 54c56d57ae
commit 2c335983d1
7 changed files with 379 additions and 3 deletions

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,78 @@
self.__precacheManifest = [
{
"revision": "be1df903f0d7711ef8a4e96b6ca56dc0",
"url": "flags/fr.svg"
},
{
"revision": "78de6acf30cc7fa4700207e205a52e88",
"url": "flags/br.svg"
},
{
"revision": "14a87aa00a5d4d217382",
"url": "vendor.js"
},
{
"revision": "617c6a550519013aed310e0fe85bb088",
"url": "flags/us.svg"
},
{
"revision": "a88d006ab7afa49d76ecd86dd1b11f77",
"url": "flags/th.svg"
},
{
"revision": "09ccf3b3b0a12dd5b3559acedc77858c",
"url": "flags/nl.svg"
},
{
"revision": "bedfd890b6c16afeb952546279242cf7",
"url": "flags/cn.svg"
},
{
"revision": "22084f478d0f401fa96288f7790ba8ef",
"url": "flags/tw.svg"
},
{
"revision": "4a936767fc2ac7335885d90b471d8629",
"url": "flags/pl.svg"
},
{
"revision": "d107c3019844d2d1f0a4d179cbd8046e",
"url": "flags/id.svg"
},
{
"revision": "4eb7af0db693855a4f24cb119a73110d",
"url": "flags/de.svg"
},
{
"revision": "8020fcd82cc09410f7bad1bc875c115a",
"url": "flags/es.svg"
},
{
"revision": "0f6e3867129940ef785c7c8720e0b56d",
"url": "flags/ru.svg"
},
{
"revision": "d5204a17fb30a59a4760b4109fbefe0b",
"url": "flags/it.svg"
},
{
"revision": "60fb243496d39972a15bf5a78b6e50ee",
"url": "flags/tr.svg"
},
{
"revision": "5d1c62c220e3dcc85d70e206d44a9d4c",
"url": "flags/cz.svg"
},
{
"revision": "5e7a66fb0660b714f1a47859b90767e0",
"url": "flags/ir.svg"
},
{
"revision": "fc5025122339e41903ba",
"url": "app.js"
},
{
"revision": "fc5025122339e41903ba",
"url": "app.css"
}
];

27
build/service-worker.js Normal file
View File

@ -0,0 +1,27 @@
/**
* Welcome to your Workbox-powered service worker!
*
* You'll need to register this file in your web app and you should
* disable HTTP caching for this file too.
* See https://goo.gl/nhQhGp
*
* The rest of the code is auto-generated. Please don't update this file
* directly; instead, make changes to your Workbox build configuration
* and re-run your build process.
* See https://goo.gl/2aRDsh
*/
importScripts("https://storage.googleapis.com/workbox-cdn/releases/3.4.1/workbox-sw.js");
importScripts(
"precache-manifest.58adef800aaa054bd9ecd4964e450548.js"
);
/**
* The workboxSW.precacheAndRoute() method efficiently caches and responds to
* requests for URLs in the manifest.
* See https://goo.gl/S9QRab
*/
self.__precacheManifest = [].concat(self.__precacheManifest || []);
workbox.precaching.suppressWarnings();
workbox.precaching.precacheAndRoute(self.__precacheManifest, {});

255
package-lock.json generated
View File

@ -493,6 +493,15 @@
} }
} }
}, },
"babel-runtime": {
"version": "6.26.0",
"resolved": "https://registry.npmjs.org/babel-runtime/-/babel-runtime-6.26.0.tgz",
"integrity": "sha1-llxwWGaOgrVde/4E/yM3vItWR/4=",
"requires": {
"core-js": "^2.4.0",
"regenerator-runtime": "^0.11.0"
}
},
"balanced-match": { "balanced-match": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.0.tgz",
@ -1065,6 +1074,11 @@
"resolved": "https://registry.npmjs.org/commander/-/commander-2.13.0.tgz", "resolved": "https://registry.npmjs.org/commander/-/commander-2.13.0.tgz",
"integrity": "sha512-MVuS359B+YzaWqjCL/c+22gfryv+mCBPHAv3zyVI2GN8EY6IRP8VwtasXn8jyyhvvq84R4ImN1OKRtcbIasjYA==" "integrity": "sha512-MVuS359B+YzaWqjCL/c+22gfryv+mCBPHAv3zyVI2GN8EY6IRP8VwtasXn8jyyhvvq84R4ImN1OKRtcbIasjYA=="
}, },
"common-tags": {
"version": "1.8.0",
"resolved": "https://registry.npmjs.org/common-tags/-/common-tags-1.8.0.tgz",
"integrity": "sha512-6P6g0uetGpW/sdyUy/iQQCbFF0kWVMSIVSyYz7Zgjcgh8mgw8PQzDNZeyZ5DQ2gM7LBoZPHmnjz8rUthkBG5tw=="
},
"commondir": { "commondir": {
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz", "resolved": "https://registry.npmjs.org/commondir/-/commondir-1.0.1.tgz",
@ -1147,6 +1161,11 @@
"resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz", "resolved": "https://registry.npmjs.org/copy-descriptor/-/copy-descriptor-0.1.1.tgz",
"integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=" "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40="
}, },
"core-js": {
"version": "2.5.7",
"resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.7.tgz",
"integrity": "sha512-RszJCAxg/PP6uzXVXL6BsxSXx/B05oJAQ2vkJRjyjrEcNVycaqOmNb5OTxZPE3xa5gwZduqza6L9JOCenh/Ecw=="
},
"core-util-is": { "core-util-is": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz",
@ -2090,6 +2109,16 @@
"readable-stream": "^2.0.0" "readable-stream": "^2.0.0"
} }
}, },
"fs-extra": {
"version": "4.0.3",
"resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-4.0.3.tgz",
"integrity": "sha512-q6rbdDd1o2mAnQreO7YADIxf/Whx4AHBiRf6d+/cVT8h44ss+lHgxf1FemcqDnQt9X3ct4McHr+JMGlYSsK7Cg==",
"requires": {
"graceful-fs": "^4.1.2",
"jsonfile": "^4.0.0",
"universalify": "^0.1.0"
}
},
"fs-write-stream-atomic": { "fs-write-stream-atomic": {
"version": "1.0.10", "version": "1.0.10",
"resolved": "https://registry.npmjs.org/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz", "resolved": "https://registry.npmjs.org/fs-write-stream-atomic/-/fs-write-stream-atomic-1.0.10.tgz",
@ -2862,6 +2891,11 @@
"minimalistic-crypto-utils": "^1.0.1" "minimalistic-crypto-utils": "^1.0.1"
} }
}, },
"hoek": {
"version": "4.2.1",
"resolved": "https://registry.npmjs.org/hoek/-/hoek-4.2.1.tgz",
"integrity": "sha512-QLg82fGkfnJ/4iy1xZ81/9SIJiq1NGFUMGs6ParyjBZr6jW2Ufj/snDqTHixNlHdPNwN2RLVD0Pi3igeK9+JfA=="
},
"hosted-git-info": { "hosted-git-info": {
"version": "2.7.1", "version": "2.7.1",
"resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.7.1.tgz", "resolved": "https://registry.npmjs.org/hosted-git-info/-/hosted-git-info-2.7.1.tgz",
@ -3407,6 +3441,14 @@
"resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz",
"integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE="
}, },
"isemail": {
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/isemail/-/isemail-3.1.3.tgz",
"integrity": "sha512-5xbsG5wYADIcB+mfLsd+nst1V/D+I7EU7LEZPo2GOIMu4JzfcRs5yQoypP4avA7QtUqgxYLKBYNv4IdzBmbhdw==",
"requires": {
"punycode": "2.x.x"
}
},
"isexe": { "isexe": {
"version": "2.0.0", "version": "2.0.0",
"resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
@ -3422,6 +3464,16 @@
"resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz", "resolved": "https://registry.npmjs.org/isstream/-/isstream-0.1.2.tgz",
"integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo=" "integrity": "sha1-R+Y/evVa+m+S4VAOaQ64uFKcCZo="
}, },
"joi": {
"version": "11.4.0",
"resolved": "https://registry.npmjs.org/joi/-/joi-11.4.0.tgz",
"integrity": "sha512-O7Uw+w/zEWgbL6OcHbyACKSj0PkQeUgmehdoXVSxt92QFCq4+1390Rwh5moI2K/OgC7D8RHRZqHZxT2husMJHA==",
"requires": {
"hoek": "4.x.x",
"isemail": "3.x.x",
"topo": "2.x.x"
}
},
"jquery": { "jquery": {
"version": "2.2.4", "version": "2.2.4",
"resolved": "https://registry.npmjs.org/jquery/-/jquery-2.2.4.tgz", "resolved": "https://registry.npmjs.org/jquery/-/jquery-2.2.4.tgz",
@ -3472,6 +3524,14 @@
"resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz",
"integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg=="
}, },
"json-stable-stringify": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/json-stable-stringify/-/json-stable-stringify-1.0.1.tgz",
"integrity": "sha1-mnWdOcXy/1A/1TAGRu1EX4jE+a8=",
"requires": {
"jsonify": "~0.0.0"
}
},
"json-stringify-safe": { "json-stringify-safe": {
"version": "5.0.1", "version": "5.0.1",
"resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz", "resolved": "https://registry.npmjs.org/json-stringify-safe/-/json-stringify-safe-5.0.1.tgz",
@ -3482,6 +3542,19 @@
"resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz", "resolved": "https://registry.npmjs.org/json5/-/json5-0.5.1.tgz",
"integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE=" "integrity": "sha1-Hq3nrMASA0rYTiOWdn6tn6VJWCE="
}, },
"jsonfile": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/jsonfile/-/jsonfile-4.0.0.tgz",
"integrity": "sha1-h3Gq4HmbZAdrdmQPygWPnBDjPss=",
"requires": {
"graceful-fs": "^4.1.6"
}
},
"jsonify": {
"version": "0.0.0",
"resolved": "https://registry.npmjs.org/jsonify/-/jsonify-0.0.0.tgz",
"integrity": "sha1-LHS27kHZPKUbe1qu6PUDYx0lKnM="
},
"jsprim": { "jsprim": {
"version": "1.4.1", "version": "1.4.1",
"resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz", "resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.1.tgz",
@ -3562,6 +3635,11 @@
"resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz", "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.10.tgz",
"integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg==" "integrity": "sha512-UejweD1pDoXu+AD825lWwp4ZGtSwgnpZxb3JDViD7StjQz+Nb/6l093lx4OQ0foGWNRoc19mWy7BzL+UAK2iVg=="
}, },
"lodash._reinterpolate": {
"version": "3.0.0",
"resolved": "https://registry.npmjs.org/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz",
"integrity": "sha1-DM8tiRZq8Ds2Y8eWU4t1rG4RTZ0="
},
"lodash.assign": { "lodash.assign": {
"version": "4.2.0", "version": "4.2.0",
"resolved": "https://registry.npmjs.org/lodash.assign/-/lodash.assign-4.2.0.tgz", "resolved": "https://registry.npmjs.org/lodash.assign/-/lodash.assign-4.2.0.tgz",
@ -3592,6 +3670,23 @@
"resolved": "https://registry.npmjs.org/lodash.tail/-/lodash.tail-4.1.1.tgz", "resolved": "https://registry.npmjs.org/lodash.tail/-/lodash.tail-4.1.1.tgz",
"integrity": "sha1-0jM6NtnncXyK0vfKyv7HwytERmQ=" "integrity": "sha1-0jM6NtnncXyK0vfKyv7HwytERmQ="
}, },
"lodash.template": {
"version": "4.4.0",
"resolved": "https://registry.npmjs.org/lodash.template/-/lodash.template-4.4.0.tgz",
"integrity": "sha1-5zoDhcg1VZF0bgILmWecaQ5o+6A=",
"requires": {
"lodash._reinterpolate": "~3.0.0",
"lodash.templatesettings": "^4.0.0"
}
},
"lodash.templatesettings": {
"version": "4.1.0",
"resolved": "https://registry.npmjs.org/lodash.templatesettings/-/lodash.templatesettings-4.1.0.tgz",
"integrity": "sha1-K01OlbpEDZFf8IvImeRVNmZxMxY=",
"requires": {
"lodash._reinterpolate": "~3.0.0"
}
},
"long": { "long": {
"version": "3.2.0", "version": "3.2.0",
"resolved": "https://registry.npmjs.org/long/-/long-3.2.0.tgz", "resolved": "https://registry.npmjs.org/long/-/long-3.2.0.tgz",
@ -4625,6 +4720,11 @@
"integrity": "sha512-McHPg0n1pIke+A/4VcaS2en+pTNjy4xF+Uuq86u/5dyDO59/TtFZtQ708QIRkEZ3qwKz3GVkVa6mpxK/CpB8Rg==", "integrity": "sha512-McHPg0n1pIke+A/4VcaS2en+pTNjy4xF+Uuq86u/5dyDO59/TtFZtQ708QIRkEZ3qwKz3GVkVa6mpxK/CpB8Rg==",
"dev": true "dev": true
}, },
"pretty-bytes": {
"version": "4.0.2",
"resolved": "https://registry.npmjs.org/pretty-bytes/-/pretty-bytes-4.0.2.tgz",
"integrity": "sha1-sr+C5zUNZcbDOqlaqlpPYyf2HNk="
},
"pretty-error": { "pretty-error": {
"version": "2.1.1", "version": "2.1.1",
"resolved": "https://registry.npmjs.org/pretty-error/-/pretty-error-2.1.1.tgz", "resolved": "https://registry.npmjs.org/pretty-error/-/pretty-error-2.1.1.tgz",
@ -4941,6 +5041,11 @@
"resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.0.tgz", "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.0.tgz",
"integrity": "sha512-1G6jJVDWrt0rK99kBjvEtziZNCICAuvIPkSiUFIQxVP06RCVpq3dmDo2oi6ABpYaDYaTRr67BEhL8r1wgEZZKg==" "integrity": "sha512-1G6jJVDWrt0rK99kBjvEtziZNCICAuvIPkSiUFIQxVP06RCVpq3dmDo2oi6ABpYaDYaTRr67BEhL8r1wgEZZKg=="
}, },
"regenerator-runtime": {
"version": "0.11.1",
"resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.11.1.tgz",
"integrity": "sha512-MguG95oij0fC3QV3URf4V2SDYGJhJnJGqvIIgdECeODCT98wSWDAJ94SSuVpYQUoTcGUIL6L4yNB7j1DFFHSBg=="
},
"regex-not": { "regex-not": {
"version": "1.0.2", "version": "1.0.2",
"resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz", "resolved": "https://registry.npmjs.org/regex-not/-/regex-not-1.0.2.tgz",
@ -5884,6 +5989,14 @@
"repeat-string": "^1.6.1" "repeat-string": "^1.6.1"
} }
}, },
"topo": {
"version": "2.0.2",
"resolved": "https://registry.npmjs.org/topo/-/topo-2.0.2.tgz",
"integrity": "sha1-zVYVdSU5BXwNwEkaYhw7xvvh0YI=",
"requires": {
"hoek": "4.x.x"
}
},
"toposort": { "toposort": {
"version": "1.0.7", "version": "1.0.7",
"resolved": "https://registry.npmjs.org/toposort/-/toposort-1.0.7.tgz", "resolved": "https://registry.npmjs.org/toposort/-/toposort-1.0.7.tgz",
@ -6046,6 +6159,11 @@
"imurmurhash": "^0.1.4" "imurmurhash": "^0.1.4"
} }
}, },
"universalify": {
"version": "0.1.2",
"resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz",
"integrity": "sha512-rBJeI5CXAlmy1pV+617WB9J63U6XcazHHF2f2dbJix4XzpUF0RS3Zbj0FGIOCAva5P/d/GBOYaACQ1w+0azUkg=="
},
"unpipe": { "unpipe": {
"version": "1.0.0", "version": "1.0.0",
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
@ -6335,6 +6453,143 @@
"string-width": "^1.0.2 || 2" "string-width": "^1.0.2 || 2"
} }
}, },
"workbox-background-sync": {
"version": "3.4.1",
"resolved": "https://registry.npmjs.org/workbox-background-sync/-/workbox-background-sync-3.4.1.tgz",
"integrity": "sha512-Ksb2nCg/2wOyBMhSBqSbtCEwuKaf5sHgTY8HdCxbLIQSzDh9/qZqg+1P11CKlgJmHtje3EK3B8EsrzukZo10xA==",
"requires": {
"workbox-core": "^3.4.1"
}
},
"workbox-broadcast-cache-update": {
"version": "3.4.1",
"resolved": "https://registry.npmjs.org/workbox-broadcast-cache-update/-/workbox-broadcast-cache-update-3.4.1.tgz",
"integrity": "sha512-+WPqHFk4ER4RICAMOYrP88yBbiUQ9ZOFNruqwbl9YxGfbADV16OEGmYpIs+Az6HT6DNDCx8eQqtFiaG8N3O11Q==",
"requires": {
"workbox-core": "^3.4.1"
}
},
"workbox-build": {
"version": "3.4.1",
"resolved": "https://registry.npmjs.org/workbox-build/-/workbox-build-3.4.1.tgz",
"integrity": "sha512-Qi04XdHjkXbRN0CV5XO1oqDWbJSIm7VYhxmxjtnVcKK8PrMT6rOUFUi9ziDI+8UQgcXbLK4ZChWf2ptZS1/MbA==",
"requires": {
"babel-runtime": "^6.26.0",
"common-tags": "^1.4.0",
"fs-extra": "^4.0.2",
"glob": "^7.1.2",
"joi": "^11.1.1",
"lodash.template": "^4.4.0",
"pretty-bytes": "^4.0.2",
"workbox-background-sync": "^3.4.1",
"workbox-broadcast-cache-update": "^3.4.1",
"workbox-cache-expiration": "^3.4.1",
"workbox-cacheable-response": "^3.4.1",
"workbox-core": "^3.4.1",
"workbox-google-analytics": "^3.4.1",
"workbox-navigation-preload": "^3.4.1",
"workbox-precaching": "^3.4.1",
"workbox-range-requests": "^3.4.1",
"workbox-routing": "^3.4.1",
"workbox-strategies": "^3.4.1",
"workbox-streams": "^3.4.1",
"workbox-sw": "^3.4.1"
}
},
"workbox-cache-expiration": {
"version": "3.4.1",
"resolved": "https://registry.npmjs.org/workbox-cache-expiration/-/workbox-cache-expiration-3.4.1.tgz",
"integrity": "sha512-AzOPB+dwfxg13v4+q5jWkxsw/oim9mPIzew1anu8ALA3vB8qySaJJToXp+ZlVh/Co+sDK0tgjlB76bvSFHgZ4g==",
"requires": {
"workbox-core": "^3.4.1"
}
},
"workbox-cacheable-response": {
"version": "3.4.1",
"resolved": "https://registry.npmjs.org/workbox-cacheable-response/-/workbox-cacheable-response-3.4.1.tgz",
"integrity": "sha512-SO2k830JT93GitPwc5tzJI49d9VwyVxXwiCbyvo+Sqo+dcvWSrmpsyuXdzy6zuasbPrWUF0vsFj1uGtZbOym8Q==",
"requires": {
"workbox-core": "^3.4.1"
}
},
"workbox-core": {
"version": "3.4.1",
"resolved": "https://registry.npmjs.org/workbox-core/-/workbox-core-3.4.1.tgz",
"integrity": "sha512-RqMV2so9/KLAu9aUxJ/85pvrZMUn835B8zoHmqRyGNetiDr8B1zSBeKXPZAjFlX/88KdhizNwiRlJtqlXtM4tA=="
},
"workbox-google-analytics": {
"version": "3.4.1",
"resolved": "https://registry.npmjs.org/workbox-google-analytics/-/workbox-google-analytics-3.4.1.tgz",
"integrity": "sha512-w6Osz2Rr1/4+W0gram6Yzg6NNWLvHP51RwFCNAZSpEnipr0qSEtD+yvwrdaHfiJHWhcK2yH/V6E1MV8Hrczmvw==",
"requires": {
"workbox-background-sync": "^3.4.1",
"workbox-core": "^3.4.1",
"workbox-routing": "^3.4.1",
"workbox-strategies": "^3.4.1"
}
},
"workbox-navigation-preload": {
"version": "3.4.1",
"resolved": "https://registry.npmjs.org/workbox-navigation-preload/-/workbox-navigation-preload-3.4.1.tgz",
"integrity": "sha512-P3FHAcyZ8db2QiW/BpMkuosC1OkRsEoUaT7U3QOgg7JSjjsJoEbF7G5olNe+P+PQYdVhJA7TCuptI6dy2gLS/g==",
"requires": {
"workbox-core": "^3.4.1"
}
},
"workbox-precaching": {
"version": "3.4.1",
"resolved": "https://registry.npmjs.org/workbox-precaching/-/workbox-precaching-3.4.1.tgz",
"integrity": "sha512-ykU2mly9xmRrCW6iMeUWYydWiso/WSE16+7wponhI0WC53jiQSt2JvykWm0VpWFJSs6ZTSZZ1WK2gs/brRnPug==",
"requires": {
"workbox-core": "^3.4.1"
}
},
"workbox-range-requests": {
"version": "3.4.1",
"resolved": "https://registry.npmjs.org/workbox-range-requests/-/workbox-range-requests-3.4.1.tgz",
"integrity": "sha512-ktgjl6liZrRTmQjPw1pBblC5umHnTb8XcvFVitdGz17B23jj6cUV4EXzEU2ilGn6jO6+MLV1Vn9SWajtLSc2Gg==",
"requires": {
"workbox-core": "^3.4.1"
}
},
"workbox-routing": {
"version": "3.4.1",
"resolved": "https://registry.npmjs.org/workbox-routing/-/workbox-routing-3.4.1.tgz",
"integrity": "sha512-6j6cXMUYfMPYTycmElxVOfBTr6WV5zAn/JUFJ7GJ5pYFIE9cqztprnrcOsWJ42+AiNIeHPbKfyIWE/rZVviMxQ==",
"requires": {
"workbox-core": "^3.4.1"
}
},
"workbox-strategies": {
"version": "3.4.1",
"resolved": "https://registry.npmjs.org/workbox-strategies/-/workbox-strategies-3.4.1.tgz",
"integrity": "sha512-7mJuzFsgejflzjfnChXCFma1S0mi9WC6wlSU2wE50M7bJmEuf9A3j3MojpKcsTEM58hbhbnU6QF/u9iIV7+opw==",
"requires": {
"workbox-core": "^3.4.1"
}
},
"workbox-streams": {
"version": "3.4.1",
"resolved": "https://registry.npmjs.org/workbox-streams/-/workbox-streams-3.4.1.tgz",
"integrity": "sha512-krw+5bp+oe9Za5c6WlTWM3SgZGfExYcqRSn1gsyYgKeXmgzTwf+DOb5Lwult0KSWlJfq8B3Wk7sW8Sl7lRzSbA==",
"requires": {
"workbox-core": "^3.4.1"
}
},
"workbox-sw": {
"version": "3.4.1",
"resolved": "https://registry.npmjs.org/workbox-sw/-/workbox-sw-3.4.1.tgz",
"integrity": "sha512-nnm2by5oaQGXRH7x4M5/n2KqjUGVmP4P8azUmJITnYa3DWVYn/ghDg3LJ5+h4A28vYq9V6ePgATaEPfb6B5pug=="
},
"workbox-webpack-plugin": {
"version": "3.4.1",
"resolved": "https://registry.npmjs.org/workbox-webpack-plugin/-/workbox-webpack-plugin-3.4.1.tgz",
"integrity": "sha512-dwIaEJK27xbGKMQv1sbSjywxhfX74nMW1zgUP9XUtpFeykH0e5Dm1j7wbQezXU3mFoaO7xuzqwGpAFxMKc0xMA==",
"requires": {
"json-stable-stringify": "^1.0.1",
"workbox-build": "^3.4.1"
}
},
"worker-farm": { "worker-farm": {
"version": "1.6.0", "version": "1.6.0",
"resolved": "https://registry.npmjs.org/worker-farm/-/worker-farm-1.6.0.tgz", "resolved": "https://registry.npmjs.org/worker-farm/-/worker-farm-1.6.0.tgz",

View File

@ -40,7 +40,8 @@
"sass-loader": "^7.1.0", "sass-loader": "^7.1.0",
"webpack": "^4.17.1", "webpack": "^4.17.1",
"webpack-bundle-analyzer": "^2.13.1", "webpack-bundle-analyzer": "^2.13.1",
"webpack-cli": "^3.1.0" "webpack-cli": "^3.1.0",
"workbox-webpack-plugin": "^3.4.1"
}, },
"devDependencies": { "devDependencies": {
"husky": "^1.0.0-rc.13", "husky": "^1.0.0-rc.13",

View File

@ -1,4 +1,4 @@
// WebUI Aria2 is an agular application // WebUI Aria2 is an angular 1.x application
// This file imports all the required modules for the application // This file imports all the required modules for the application
// Vendor libraries // Vendor libraries
@ -142,6 +142,19 @@ webui.config([
webui.directive("textarea", directiveTextarea); webui.directive("textarea", directiveTextarea);
if ("serviceWorker" in navigator && location.protocol === "https:") {
window.addEventListener("load", () => {
navigator.serviceWorker
.register("/service-worker.js")
.then(registration => {
console.log("SW registered: ", registration);
})
.catch(registrationError => {
console.log("SW registration failed: ", registrationError);
});
});
}
$(function() { $(function() {
if (!String.prototype.startsWith) { if (!String.prototype.startsWith) {
Object.defineProperty(String.prototype, "startsWith", { Object.defineProperty(String.prototype, "startsWith", {

View File

@ -4,6 +4,7 @@ const webpack = require("webpack");
const MiniCssExtractPlugin = require("mini-css-extract-plugin"); const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin"); const HtmlWebpackPlugin = require("html-webpack-plugin");
const CleanWebpackPlugin = require("clean-webpack-plugin"); const CleanWebpackPlugin = require("clean-webpack-plugin");
const WorkboxPlugin = require("workbox-webpack-plugin");
const BUILD_DIR = path.join(__dirname, "build"); const BUILD_DIR = path.join(__dirname, "build");
const APP_DIR = path.join(__dirname, "src", "js"); const APP_DIR = path.join(__dirname, "src", "js");
@ -42,6 +43,7 @@ const config = {
}, },
plugins: [ plugins: [
new CleanWebpackPlugin(["build"]), new CleanWebpackPlugin(["build"]),
new WorkboxPlugin.GenerateSW(),
new webpack.ProvidePlugin({ new webpack.ProvidePlugin({
"window.jQuery": "jquery", "window.jQuery": "jquery",
jQuery: "jquery", jQuery: "jquery",