PageSourceSearch

https://9y.co/sw.js

js 9y.co collected 2026-10-07 16:13:09 UTC 3,491 bytes, 108 lines download raw bytes

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-60bf022ea9c3f0fc7ca4.js"
30  },
31  {
32    "url": "framework-ac9b5dbfc53b5eded77d.js"
33  },
34  {
35    "url": "532a2f07-ec3b85e4c0f5cbbada9f.js"
36  },
37  {
38    "url": "app-74a8a0ee64683913178e.js"
39  },
40  {
41    "url": "component---node-modules-gatsby-plugin-offline-app-shell-js-2df9d2a5818dcdce6571.js"
42  },
43  {
44    "url": "offline-plugin-app-shell-fallback/index.html",
45    "revision": "621221e366809b149ec46c2f587c5bcc"
46  },
47  {
48    "url": "polyfill-c82602a4f90364ab8a24.js"
49  },
50  {
51    "url": "manifest.json",
52    "revision": "cb6dbf87da86c5a5d03d0e38aa03651f"
53  }
54].concat(self.__precacheManifest || []);
55workbox.precaching.suppressWarnings();
56workbox.precaching.precacheAndRoute(self.__precacheManifest, {});
57
58workbox.routing.registerRoute(/(\.js$|\.css$|static\/)/, workbox.strategies.cacheFirst(), 'GET');
59workbox.routing.registerRoute(/^https?:.*\page-data\/.*\/page-data\.json/, workbox.strategies.networkFirst(), 'GET');
60workbox.routing.registerRoute(/^https?:.*\.(png|jpg|jpeg|webp|svg|gif|tiff|js|woff|woff2|json|css)$/, workbox.strategies.staleWhileRevalidate(), 'GET');
61workbox.routing.registerRoute(/^https?:\/\/fonts\.googleapis\.com\/css/, workbox.strategies.staleWhileRevalidate(), 'GET');
62
63/* global importScripts, workbox, idbKeyval */
64
65importScripts(`idb-keyval-iife.min.js`)
66
67const { NavigationRoute } = workbox.routing
68
69const navigationRoute = new NavigationRoute(async ({ event }) => {
70  let { pathname } = new URL(event.request.url)
71  pathname = pathname.replace(new RegExp(`^`), ``)
72
73  // Check for resources + the app bundle
74  // The latter may not exist if the SW is updating to a new version
75  const resources = await idbKeyval.get(`resources:${pathname}`)
76  if (!resources || !(await caches.match(`/app-74a8a0ee64683913178e.js`))) {
77    return await fetch(event.request)
78  }
79
80  for (const resource of resources) {
81    // As soon as we detect a failed resource, fetch the entire page from
82    // network - that way we won't risk being in an inconsistent state with
83    // some parts of the page failing.
84    if (!(await caches.match(resource))) {
85      return await fetch(event.request)
86    }
87  }
88
89  const offlineShell = `/offline-plugin-app-shell-fallback/index.html`
90  return await caches.match(offlineShell)
91})
92
93workbox.routing.registerRoute(navigationRoute)
94
95const messageApi = {
96  setPathResources(event, { path, resources }) {
97    event.waitUntil(idbKeyval.set(`resources:${path}`, resources))
98  },
99
100  clearPathResources(event) {
101    event.waitUntil(idbKeyval.clear())
102  },
103}
104
105self.addEventListener(`message`, event => {
106  const { gatsbyApi } = event.data
107  if (gatsbyApi) messageApi[gatsbyApi](event, event.data)
108})

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.