PageSourceSearch

https://ensar-eray-akkaya.netlify.app/sw.js

js ensar-eray-akkaya.netlify.app collected 2026-10-03 10:42:16 UTC 4,927 bytes, 167 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-v4.3.1/workbox-sw.js");
15workbox.setConfig({modulePathPrefix: "workbox-v4.3.1"});
16
17workbox.core.setCacheNameDetails({prefix: "gatsby-plugin-offline"});
18
19workbox.core.skipWaiting();
20
21workbox.core.clientsClaim();
22
23/**
24 * The workboxSW.precacheAndRoute() method efficiently caches and responds to
25 * requests for URLs in the manifest.
26 * See https://goo.gl/S9QRab
27 */
28self.__precacheManifest = [
29  {
30    "url": "webpack-runtime-5aff74e160083abf3a11.js"
31  },
32  {
33    "url": "framework-06f646d936b841f99ebd.js"
34  },
35  {
36    "url": "app-145de12af1b3365cef7a.js"
37  },
38  {
39    "url": "offline-plugin-app-shell-fallback/index.html",
40    "revision": "7078574dcb3ee186c3c6b40734a88d22"
41  },
42  {
43    "url": "component---cache-caches-gatsby-plugin-offline-app-shell-js-19245c8506e49b502b12.js"
44  },
45  {
46    "url": "polyfill-92b076c0eec7a7a7a6c5.js"
47  },
48  {
49    "url": "manifest.json",
50    "revision": "b773e901ef06ac93343dc05e67540787"
51  },
52  {
53    "url": "manifest.webmanifest",
54    "revision": "e3783b20aae8c5f88563d31081e454eb"
55  }
56].concat(self.__precacheManifest || []);
57workbox.precaching.precacheAndRoute(self.__precacheManifest, {});
58
59workbox.routing.registerRoute(/(\.js$|\.css$|static\/)/, new workbox.strategies.CacheFirst(), 'GET');
60workbox.routing.registerRoute(/^https?:.*\/page-data\/.*\.json/, new workbox.strategies.StaleWhileRevalidate(), 'GET');
61workbox.routing.registerRoute(/^https?:.*\.(png|jpg|jpeg|webp|svg|gif|tiff|js|woff|woff2|json|css)$/, new workbox.strategies.StaleWhileRevalidate(), 'GET');
62workbox.routing.registerRoute(/^https?:\/\/fonts\.googleapis\.com\/css/, new workbox.strategies.StaleWhileRevalidate(), 'GET');
63
64/* global importScripts, workbox, idbKeyval */
65importScripts(`idb-keyval-3.2.0-iife.min.js`)
66
67const { NavigationRoute } = workbox.routing
68
69let lastNavigationRequest = null
70let offlineShellEnabled = true
71
72// prefer standard object syntax to support more browsers
73const MessageAPI = {
74  setPathResources: (event, { path, resources }) => {
75    event.waitUntil(idbKeyval.set(`resources:${path}`, resources))
76  },
77
78  clearPathResources: event => {
79    event.waitUntil(idbKeyval.clear())
80  },
81
82  enableOfflineShell: () => {
83    offlineShellEnabled = true
84  },
85
86  disableOfflineShell: () => {
87    offlineShellEnabled = false
88  },
89}
90
91self.addEventListener(`message`, event => {
92  const { gatsbyApi: api } = event.data
93  if (api) MessageAPI[api](event, event.data)
94})
95
96function handleAPIRequest({ event }) {
97  const { pathname } = new URL(event.request.url)
98
99  const params = pathname.match(/:(.+)/)[1]
100  const data = {}
101
102  if (params.includes(`=`)) {
103    params.split(`&`).forEach(param => {
104      const [key, val] = param.split(`=`)
105      data[key] = val
106    })
107  } else {
108    data.api = params
109  }
110
111  if (MessageAPI[data.api] !== undefined) {
112    MessageAPI[data.api]()
113  }
114
115  if (!data.redirect) {
116    return new Response()
117  }
118
119  return new Response(null, {
120    status: 302,
121    headers: {
122      Location: lastNavigationRequest,
123    },
124  })
125}
126
127const navigationRoute = new NavigationRoute(async ({ event }) => {
128  // handle API requests separately to normal navigation requests, so do this
129  // check first
130  if (event.request.url.match(/\/.gatsby-plugin-offline:.+/)) {
131    return handleAPIRequest({ event })
132  }
133
134  if (!offlineShellEnabled) {
135    return await fetch(event.request)
136  }
137
138  lastNavigationRequest = event.request.url
139
140  let { pathname } = new URL(event.request.url)
141  pathname = pathname.replace(new RegExp(`^`), ``)
142
143  // Check for resources + the app bundle
144  // The latter may not exist if the SW is updating to a new version
145  const resources = await idbKeyval.get(`resources:${pathname}`)
146  if (!resources || !(await caches.match(`/app-145de12af1b3365cef7a.js`))) {
147    return await fetch(event.request)
148  }
149
150  for (const resource of resources) {
151    // As soon as we detect a failed resource, fetch the entire page from
152    // network - that way we won't risk being in an inconsistent state with
153    // some parts of the page failing.
154    if (!(await caches.match(resource))) {
155      return await fetch(event.request)
156    }
157  }
158
159  const offlineShell = `/offline-plugin-app-shell-fallback/index.html`
160  const offlineShellWithKey = workbox.precaching.getCacheKeyForURL(offlineShell)
161  return await caches.match(offlineShellWithKey)
162})
163
164workbox.routing.registerRoute(navigationRoute)
165
166// this route is used when performing a non-navigation request (e.g. fetch)
167workbox.routing.registerRoute(/\/.gatsby-plugin-offline:.+/, handleAPIRequest)

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.