PageSourceSearch

https://adrian-philipp.com/sw.js

js adrian-philipp.com collected 2026-10-09 01:50:17 UTC 3,844 bytes, 113 lines download raw bytes

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

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.