diff --git a/cli/README.md b/cli/README.md index 7c418a8b..a305ab30 100644 --- a/cli/README.md +++ b/cli/README.md @@ -47,7 +47,7 @@ The default values for each `config` option can be found in the [`codecs.js`][co Squoosh CLI has an _experimental_ auto optimizer that compresses an image as much as possible, trying to hit a specific [Butteraugli] target value. The higher the Butteraugli target value, the more artifacts can be introduced. -You can make use of the auto optimizer buy using “auto” as the config object. +You can make use of the auto optimizer by using “auto” as the config object. ``` $ npx @squoosh/cli --wp2 auto test.png diff --git a/rollup.config.js b/rollup.config.js index a16d32bd..9d5026a0 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -112,7 +112,9 @@ export default async function ({ watch }) { plugins: [ { resolveFileUrl, resolveImportMeta }, OMT({ loader: await omtLoaderPromise }), - serviceWorkerPlugin({ output: 'static/sw.js' }), + serviceWorkerPlugin({ + output: 'static/serviceworker.js', + }), ...commonPlugins(), commonjs(), resolve(), diff --git a/src/copy/sw-bridge.894ac.js b/src/copy/sw-bridge.894ac.js new file mode 100644 index 00000000..f0fc97ff --- /dev/null +++ b/src/copy/sw-bridge.894ac.js @@ -0,0 +1,137 @@ +(self.webpackJsonp = self.webpackJsonp || []).push([ + [0], + { + 54: function (e, t, n) { + 'use strict'; + n.d(t, 'a', function () { + return o; + }), + n.d(t, 'b', function () { + return s; + }); + class r { + constructor(e = 'keyval-store', t = 'keyval') { + (this.storeName = t), + (this._dbp = new Promise((n, r) => { + const a = indexedDB.open(e, 1); + (a.onerror = () => r(a.error)), + (a.onsuccess = () => n(a.result)), + (a.onupgradeneeded = () => { + a.result.createObjectStore(t); + }); + })); + } + _withIDBStore(e, t) { + return this._dbp.then( + (n) => + new Promise((r, a) => { + const i = n.transaction(this.storeName, e); + (i.oncomplete = () => r()), + (i.onabort = i.onerror = () => a(i.error)), + t(i.objectStore(this.storeName)); + }), + ); + } + } + let a; + function i() { + return a || (a = new r()), a; + } + function o(e, t = i()) { + let n; + return t + ._withIDBStore('readonly', (t) => { + n = t.get(e); + }) + .then(() => n.result); + } + function s(e, t, n = i()) { + return n._withIDBStore('readwrite', (n) => { + n.put(t, e); + }); + } + }, + 56: function (e, t, n) { + 'use strict'; + n.r(t), + function (e) { + n.d(t, 'getSharedImage', function () { + return i; + }), + n.d(t, 'offliner', function () { + return o; + }), + n.d(t, 'mainAppLoaded', function () { + return s; + }); + var r = n(54); + async function a(e) { + if (e.waiting) return; + const t = await (async function (e) { + return e.installing + ? e.installing + : new Promise((t) => { + e.addEventListener('updatefound', () => t(e.installing), { + once: !0, + }); + }); + })(e); + return new Promise((e) => { + t.addEventListener('statechange', () => { + 'installed' === t.state && e(); + }); + }); + } + function i() { + return new Promise((e) => { + const t = (n) => { + 'load-image' === n.data.action && + (e(n.data.file), + navigator.serviceWorker.removeEventListener('message', t)); + }; + navigator.serviceWorker.addEventListener('message', t), + navigator.serviceWorker.controller.postMessage('share-ready'); + }); + } + async function o(t) { + if ('boolean' == typeof PRERENDER) return; + navigator.serviceWorker.register(e); + const n = !!navigator.serviceWorker.controller; + if ( + (navigator.serviceWorker.addEventListener( + 'controllerchange', + async () => { + n + ? location.reload() + : t('Ready to work offline', { timeout: 5e3 }); + }, + ), + !n) + ) + return; + const r = await navigator.serviceWorker.getRegistration(); + r && + (await a(r), + 'reload' === + (await t('Update available', { + actions: ['reload', 'dismiss'], + })) && + (async function () { + const e = await navigator.serviceWorker.getRegistration(); + e && e.waiting && e.waiting.postMessage('skip-waiting'); + })()); + } + async function s() { + if (await Object(r.a)('user-interacted')) return; + Object(r.b)('user-interacted', !0); + const e = await (async function () { + const e = await navigator.serviceWorker.getRegistration(); + return e ? e.active || e.waiting || e.installing : null; + })(); + e && e.postMessage('cache-all'); + } + }.call(this, n.p + 'serviceworker.js'); + }, + }, +]); +//# sourceMappingURL=sw-bridge.894ac.js.map diff --git a/src/copy/sw.js b/src/copy/sw.js new file mode 100644 index 00000000..43849e63 --- /dev/null +++ b/src/copy/sw.js @@ -0,0 +1,4 @@ +// I accidentally shipped with the wrong service worker name. +// This picks up users that still might be using that version. +// We'll be able to delete this file eventually. +skipWaiting(); diff --git a/src/shared/prerendered-app/Intro/imgs/logo-with-text.svg b/src/shared/prerendered-app/Intro/imgs/logo-with-text.svg index 8ea594f2..b4cfbec6 100644 --- a/src/shared/prerendered-app/Intro/imgs/logo-with-text.svg +++ b/src/shared/prerendered-app/Intro/imgs/logo-with-text.svg @@ -1 +1,10 @@ -Squoosh \ No newline at end of file + + +Squoosh