1/** 2 * Welcome to your Workbox-powered service worker! 3 * 4 * You'll need to register this file in your web app and you should 5 * disable HTTP caching for this file too. 6 * See https://goo.gl/nhQhGp 7 * 8 * The rest of the code is auto-generated. Please don't update this file 9 * directly; instead, make changes to your Workbox build configuration 10 * and re-run your build process. 11 * See https://goo.gl/2aRDsh 12 */ 13 14importScripts("workbox-v3.6.3/workbox-sw.js"); 15workbox.setConfig({modulePathPrefix: "workbox-v3.6.3"}); 16 17workbox.core.setCacheNameDetails({prefix: "gatsby-plugin-offline"}); 18 19workbox.skipWaiting(); 20workbox.clientsClaim(); 21 22/** 23 * The workboxSW.precacheAndRoute() method efficiently caches and responds to 24 * requests for URLs in the manifest. 25 * See https://goo.gl/S9QRab 26 */ 27self.__precacheManifest = [ 28 { 29 "url": "webpack-runtime-c0327f42361c63b6070d.js" 30 }, 31 { 32 "url": "app-c578a64d485cd2ec695d.js" 33 }, 34 { 35 "url": "component---node-modules-gatsby-plugin-offline-app-shell-js-91534a17a9580bf9104a.js" 36 }, 37 { 38 "url": "offline-plugin-app-shell-fallback/index.html", 39 "revision": "21c48772a4b08d4d69695b3bfea1f79e" 40 }, 41 { 42 "url": "styles.c6fd8c3c80ae7767ea06.css" 43 }, 44 { 45 "url": "styles-5dbaab68fcc707b0175d.js" 46 }, 47 { 48 "url": "1-7fddcd14a2c890fe9b2a.js" 49 }, 50 { 51 "url": "2-6a16fab71e8ef46ec234.js" 52 }, 53 { 54 "url": "component---src-pages-404-js-56018bcffcf5642056cb.js" 55 }, 56 { 57 "url": "page-data/404.html/page-data.json", 58 "revision": "4943ae6b52db725de8a0ca10704293ca" 59 } 60].concat(self.__precacheManifest || []); 61workbox.precaching.suppressWarnings(); 62workbox.precaching.precacheAndRoute(self.__precacheManifest, {}); 63 64workbox.routing.registerRoute(/(\.js$|\.css$|static\/)/, workbox.strategies.cacheFirst(), 'GET'); 65workbox.routing.registerRoute(/^https?:.*\page-data\/.*\/page-data\.json/, workbox.strategies.networkFirst(), 'GET'); 66workbox.routing.registerRoute(/^https?:.*\.(png|jpg|jpeg|webp|svg|gif|tiff|js|woff|woff2|json|css)$/, workbox.strategies.staleWhileRevalidate(), 'GET'); 67workbox.routing.registerRoute(/^https?:\/\/fonts\.googleapis\.com\/css/, workbox.strategies.staleWhileRevalidate(), 'GET'); 68 69/* global importScripts, workbox, idbKeyval */ 70 71importScripts(`idb-keyval-iife.min.js`) 72const WHITELIST_KEY = `custom-navigation-whitelist` 73 74const navigationRoute = new workbox.routing.NavigationRoute(({ event }) => { 75 const { pathname } = new URL(event.request.url) 76 77 return idbKeyval.get(WHITELIST_KEY).then((customWhitelist = []) => { 78 // Respond with the offline shell if we match the custom whitelist 79 if (customWhitelist.includes(pathname)) { 80 const offlineShell = `/offline-plugin-app-shell-fallback/index.html` 81 const cacheName = workbox.core.cacheNames.precache 82 83 return caches.match(offlineShell, { cacheName }).then(cachedResponse => { 84 if (cachedResponse) return cachedResponse 85 86 console.error( 87 `The offline shell (${offlineShell}) was not found ` + 88 `while attempting to serve a response for ${pathname}` 89 ) 90 91 return fetch(offlineShell).then(response => { 92 if (response.ok) { 93 return caches.open(cacheName).then(cache => 94 // Clone is needed because put() consumes the response body. 95 cache.put(offlineShell, response.clone()).then(() => response) 96 ) 97 } else { 98 return fetch(event.request) 99 } 100 }) 101 }) 102 } 103 104 return fetch(event.request) 105 }) 106}) 107 108workbox.routing.registerRoute(navigationRoute) 109 110let updatingWhitelist = null 111 112function rawWhitelistPathnames(pathnames) { 113 if (updatingWhitelist !== null) { 114 // Prevent the whitelist from being updated twice at the same time 115 return updatingWhitelist.then(() => rawWhitelistPathnames(pathnames)) 116 } 117 118 updatingWhitelist = idbKeyval 119 .get(WHITELIST_KEY) 120 .then((customWhitelist = []) => { 121 pathnames.forEach(pathname => { 122 if (!customWhitelist.includes(pathname)) customWhitelist.push(pathname) 123 }) 124 125 return idbKeyval.set(WHITELIST_KEY, customWhitelist) 126 }) 127 .then(() => { 128 updatingWhitelist = null 129 }) 130 131 return updatingWhitelist 132} 133 134function rawResetWhitelist() { 135 if (updatingWhitelist !== null) { 136 return updatingWhitelist.then(() => rawResetWhitelist()) 137 } 138 139 updatingWhitelist = idbKeyval.set(WHITELIST_KEY, []).then(() => { 140 updatingWhitelist = null 141 }) 142 143 return updatingWhitelist 144} 145 146const messageApi = { 147 whitelistPathnames(event) { 148 let { pathnames } = event.data 149 150 pathnames = pathnames.map(({ pathname, includesPrefix }) => { 151 if (!includesPrefix) { 152 return `${pathname}` 153 } else { 154 return pathname 155 } 156 }) 157 158 event.waitUntil(rawWhitelistPathnames(pathnames)) 159 }, 160 161 resetWhitelist(event) { 162 event.waitUntil(rawResetWhitelist()) 163 }, 164} 165 166self.addEventListener(`message`, event => { 167 const { gatsbyApi } = event.data 168 if (gatsbyApi) messageApi[gatsbyApi](event) 169})
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.