@serwist/sw 9.0.0-preview.0 → 9.0.0-preview.1

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.
Files changed (2) hide show
  1. package/dist/index.js +3 -11
  2. package/package.json +14 -15
package/dist/index.js CHANGED
@@ -46,11 +46,7 @@ const fallbacks = ({ runtimeCaching, entries, precacheOptions })=>{
46
46
 
47
47
  const handlePrecaching = ({ precacheEntries, precacheOptions, cleanupOutdatedCaches: shouldCleanupOutdatedCaches = false, ...options })=>{
48
48
  if (!!precacheEntries && precacheEntries.length > 0) {
49
- /**
50
- * The precacheAndRoute() method efficiently caches and responds to
51
- * requests for URLs in the manifest.
52
- * See https://goo.gl/S9QRab
53
- */ precacheAndRoute(precacheEntries, precacheOptions);
49
+ precacheAndRoute(precacheEntries, precacheOptions);
54
50
  }
55
51
  if (shouldCleanupOutdatedCaches) cleanupOutdatedCaches();
56
52
  if (options.navigateFallback) {
@@ -80,7 +76,7 @@ const registerRuntimeCaching = (...runtimeCachingList)=>{
80
76
  }
81
77
  for (const rcEntry of runtimeCachingList){
82
78
  if (typeof rcEntry.handler === "string") {
83
- const { cacheName, networkTimeoutSeconds, fetchOptions, matchOptions, plugins, backgroundSync, broadcastUpdate, cacheableResponse, expiration, precacheFallback, rangeRequests } = rcEntry.options; // entry.options is always defined when entry.handler is of type 'string'.
79
+ const { cacheName, networkTimeoutSeconds, fetchOptions, matchOptions, plugins, backgroundSync, broadcastUpdate, cacheableResponse, expiration, precacheFallback, rangeRequests } = rcEntry.options;
84
80
  const Handler = HANDLER_NAME_TO_METHOD[rcEntry.handler];
85
81
  registerRoute(rcEntry.urlPattern, new Handler({
86
82
  cacheName: cacheName ?? undefined,
@@ -91,7 +87,6 @@ const registerRuntimeCaching = (...runtimeCachingList)=>{
91
87
  ...plugins ?? [],
92
88
  backgroundSync && new BackgroundSyncPlugin(backgroundSync.name, backgroundSync.options),
93
89
  broadcastUpdate && new BroadcastUpdatePlugin({
94
- // @ts-expect-error weird...
95
90
  channelName: broadcastUpdate.channelName,
96
91
  ...broadcastUpdate.options
97
92
  }),
@@ -107,10 +102,7 @@ const registerRuntimeCaching = (...runtimeCachingList)=>{
107
102
  }
108
103
  };
109
104
 
110
- /**
111
- * A function that abstracts away the core APIs of Serwist.
112
- * @param options - `installSerwist` options.
113
- */ const installSerwist = ({ precacheEntries, precacheOptions, cleanupOutdatedCaches, skipWaiting = false, importScripts, navigationPreload = false, cacheId, clientsClaim: clientsClaim$1 = false, runtimeCaching, offlineAnalyticsConfig, disableDevLogs: disableDevLogs$1, fallbacks: fallbacks$1, ...options })=>{
105
+ const installSerwist = ({ precacheEntries, precacheOptions, cleanupOutdatedCaches, skipWaiting = false, importScripts, navigationPreload = false, cacheId, clientsClaim: clientsClaim$1 = false, runtimeCaching, offlineAnalyticsConfig, disableDevLogs: disableDevLogs$1, fallbacks: fallbacks$1, ...options })=>{
114
106
  if (!!importScripts && importScripts.length > 0) self.importScripts(...importScripts);
115
107
  if (navigationPreload) enable();
116
108
  if (cacheId !== undefined) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@serwist/sw",
3
- "version": "9.0.0-preview.0",
3
+ "version": "9.0.0-preview.1",
4
4
  "type": "module",
5
5
  "description": "This module makes it easy to get started with the Serwist service worker libraries.",
6
6
  "files": [
@@ -28,24 +28,23 @@
28
28
  "./package.json": "./package.json"
29
29
  },
30
30
  "dependencies": {
31
- "@serwist/background-sync": "9.0.0-preview.0",
32
- "@serwist/broadcast-update": "9.0.0-preview.0",
33
- "@serwist/cacheable-response": "9.0.0-preview.0",
34
- "@serwist/core": "9.0.0-preview.0",
35
- "@serwist/expiration": "9.0.0-preview.0",
36
- "@serwist/google-analytics": "9.0.0-preview.0",
37
- "@serwist/navigation-preload": "9.0.0-preview.0",
38
- "@serwist/precaching": "9.0.0-preview.0",
39
- "@serwist/range-requests": "9.0.0-preview.0",
40
- "@serwist/routing": "9.0.0-preview.0",
41
- "@serwist/strategies": "9.0.0-preview.0"
31
+ "@serwist/background-sync": "9.0.0-preview.1",
32
+ "@serwist/broadcast-update": "9.0.0-preview.1",
33
+ "@serwist/cacheable-response": "9.0.0-preview.1",
34
+ "@serwist/core": "9.0.0-preview.1",
35
+ "@serwist/expiration": "9.0.0-preview.1",
36
+ "@serwist/google-analytics": "9.0.0-preview.1",
37
+ "@serwist/navigation-preload": "9.0.0-preview.1",
38
+ "@serwist/precaching": "9.0.0-preview.1",
39
+ "@serwist/range-requests": "9.0.0-preview.1",
40
+ "@serwist/routing": "9.0.0-preview.1",
41
+ "@serwist/strategies": "9.0.0-preview.1"
42
42
  },
43
43
  "devDependencies": {
44
44
  "rollup": "4.9.6",
45
45
  "typescript": "5.4.0-dev.20240203",
46
- "@serwist/build": "9.0.0-preview.0",
47
- "@serwist/constants": "9.0.0-preview.0",
48
- "@serwist/utils": "9.0.0-preview.0"
46
+ "@serwist/constants": "9.0.0-preview.1",
47
+ "@serwist/utils": "9.0.0-preview.1"
49
48
  },
50
49
  "peerDependencies": {
51
50
  "typescript": ">=5.0.0"