buddy-workbench 0.1.38 → 0.1.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -133,7 +133,7 @@
133
133
  .app-splash-logo { animation: none; }
134
134
  }
135
135
  </style>
136
- <script type="module" crossorigin src="/assets/index-DlBaxOIN.js"></script>
136
+ <script type="module" crossorigin src="/assets/index-EnuwkosA.js"></script>
137
137
  <link rel="stylesheet" crossorigin href="/assets/index-BWhse591.css">
138
138
  </head>
139
139
  <body>
package/ui/dist/sw.js ADDED
@@ -0,0 +1,62 @@
1
+
2
+ const CACHE_NAME = "devbuddy-ui--Dty-56mC.js|assetsindex-EnuwkosA.js|assetsmozjpeg_dec-muSO2n8T.wasm|assetsmozjpeg_enc-DO-zoExo.wasm|splash-9c68b5bd543c";
3
+ const PRECACHE_URLS = ["/index.html","/devbuddy-splash.svg","assets/mozjpeg_enc-DO-zoExo.wasm","assets/mozjpeg_dec-muSO2n8T.wasm","assets/index-BWhse591.css","assets/index-EnuwkosA.js","assets/index-Dty-56mC.js"];
4
+
5
+ self.addEventListener('install', (event) => {
6
+ event.waitUntil(
7
+ caches.open(CACHE_NAME).then((cache) => cache.addAll(PRECACHE_URLS))
8
+ );
9
+ self.skipWaiting();
10
+ });
11
+
12
+ self.addEventListener('activate', (event) => {
13
+ event.waitUntil(
14
+ caches.keys().then((cacheNames) => Promise.all(
15
+ cacheNames
16
+ .filter((cacheName) => cacheName.startsWith('devbuddy-ui-') && cacheName !== CACHE_NAME)
17
+ .map((cacheName) => caches.delete(cacheName))
18
+ ))
19
+ );
20
+ self.clients.claim();
21
+ });
22
+
23
+ self.addEventListener('fetch', (event) => {
24
+ const { request } = event;
25
+ if (request.method !== 'GET' || new URL(request.url).origin !== self.location.origin) return;
26
+
27
+ // The entry document must be refreshed from the server so changed asset
28
+ // hashes can be discovered. The cached copy is only an offline fallback.
29
+ if (request.mode === 'navigate' || new URL(request.url).pathname === '/index.html') {
30
+ event.respondWith(
31
+ fetch(request, { cache: 'no-store' })
32
+ .then((response) => {
33
+ if (response.ok) {
34
+ const copy = response.clone();
35
+ caches.open(CACHE_NAME).then((cache) => cache.put('/index.html', copy));
36
+ }
37
+ return response;
38
+ })
39
+ .catch(() => caches.match('/index.html'))
40
+ );
41
+ return;
42
+ }
43
+
44
+ if (new URL(request.url).pathname === '/devbuddy-splash.svg') {
45
+ event.respondWith(caches.match(request).then((cached) => cached || fetch(request)));
46
+ return;
47
+ }
48
+
49
+ // Hashed build assets are immutable within a release. Serve them locally,
50
+ // while still allowing assets added outside the precache to be cached on use.
51
+ if (new URL(request.url).pathname.startsWith('/assets/')) {
52
+ event.respondWith(
53
+ caches.match(request).then((cached) => cached || fetch(request).then((response) => {
54
+ if (response.ok) {
55
+ const copy = response.clone();
56
+ caches.open(CACHE_NAME).then((cache) => cache.put(request, copy));
57
+ }
58
+ return response;
59
+ }))
60
+ );
61
+ }
62
+ });