@serwist/next 8.1.1 → 8.2.0
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.
- package/README.md +1 -0
- package/dist/index.browser.d.cts +0 -0
- package/dist/{index.old.cjs → index.cjs} +2 -2
- package/dist/index.d.cts +0 -0
- package/dist/internal-types.d.cts +0 -0
- package/dist/sw-entry-worker.cjs +35 -0
- package/dist/sw-entry-worker.d.cts +0 -0
- package/dist/sw-entry.d.cts +0 -0
- package/dist/types.d.cts +0 -0
- package/dist/types.d.ts +15 -16
- package/dist/utils/find-first-truthy.d.cts +0 -0
- package/dist/utils/get-content-hash.d.cts +0 -0
- package/dist/utils/get-file-hash.d.cts +0 -0
- package/dist/utils/get-package-version.d.cts +0 -0
- package/dist/utils/index.d.cts +0 -0
- package/dist/utils/load-tsconfig.d.cts +0 -0
- package/dist/utils/logger.d.cts +0 -0
- package/dist/utils.d.cts +0 -0
- package/package.json +13 -13
- package/dist/index.browser.old.d.cts +0 -2
- package/dist/index.old.d.cts +0 -5
- package/dist/sw-entry.old.d.cts +0 -6
- /package/dist/{index.browser.old.cjs → index.browser.cjs} +0 -0
- /package/dist/{sw-entry.old.cjs → sw-entry.cjs} +0 -0
package/README.md
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
This module's documentation can be found at https://serwist.vercel.app/docs/next
|
|
File without changes
|
|
@@ -40,7 +40,7 @@ const getContentHash = (file, isDev)=>{
|
|
|
40
40
|
return getFileHash(file).slice(0, 16);
|
|
41
41
|
};
|
|
42
42
|
|
|
43
|
-
node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('index.
|
|
43
|
+
node_module.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href)));
|
|
44
44
|
|
|
45
45
|
const loadTSConfig = (baseDir, relativeTSConfigPath)=>{
|
|
46
46
|
try {
|
|
@@ -760,7 +760,7 @@ const event = (...message)=>{
|
|
|
760
760
|
prefixedLog("event", ...message);
|
|
761
761
|
};
|
|
762
762
|
|
|
763
|
-
const __dirname$1 = node_url.fileURLToPath(new URL(".", (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('index.
|
|
763
|
+
const __dirname$1 = node_url.fileURLToPath(new URL(".", (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))));
|
|
764
764
|
const withPWAInit = (pluginOptions)=>{
|
|
765
765
|
return (nextConfig = {})=>({
|
|
766
766
|
...nextConfig,
|
package/dist/index.d.cts
ADDED
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
self.onmessage = async (ev)=>{
|
|
4
|
+
switch(ev.data.type){
|
|
5
|
+
case "__START_URL_CACHE__":
|
|
6
|
+
{
|
|
7
|
+
const url = ev.data.url;
|
|
8
|
+
const response = await fetch(url);
|
|
9
|
+
if (!response.redirected) {
|
|
10
|
+
const startUrlCache = await caches.open("start-url");
|
|
11
|
+
return startUrlCache.put(url, response);
|
|
12
|
+
}
|
|
13
|
+
return Promise.resolve();
|
|
14
|
+
}
|
|
15
|
+
case "__FRONTEND_NAV_CACHE__":
|
|
16
|
+
{
|
|
17
|
+
const url = ev.data.url;
|
|
18
|
+
const pagesCache = await caches.open("pages");
|
|
19
|
+
const isPageCached = !!await pagesCache.match(url, {
|
|
20
|
+
ignoreSearch: true
|
|
21
|
+
});
|
|
22
|
+
if (isPageCached) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
const page = await fetch(url);
|
|
26
|
+
if (!page.ok) {
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
pagesCache.put(url, page.clone());
|
|
30
|
+
return Promise.resolve();
|
|
31
|
+
}
|
|
32
|
+
default:
|
|
33
|
+
return Promise.resolve();
|
|
34
|
+
}
|
|
35
|
+
};
|
|
File without changes
|
|
File without changes
|
package/dist/types.d.cts
ADDED
|
File without changes
|
package/dist/types.d.ts
CHANGED
|
@@ -14,21 +14,9 @@ export interface PluginOptions extends Require<WebpackInjectManifestOptions, "sw
|
|
|
14
14
|
*/
|
|
15
15
|
disable?: boolean;
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*/
|
|
21
|
-
scope?: string;
|
|
22
|
-
/**
|
|
23
|
-
* The URL to the service worker.
|
|
24
|
-
* @default "/sw.js"
|
|
25
|
-
*/
|
|
26
|
-
swUrl?: string;
|
|
27
|
-
/**
|
|
28
|
-
* Allow this plugin to automatically register the service worker for you. Set
|
|
29
|
-
* this to `false` if you want to register the service worker yourself, which
|
|
30
|
-
* can be done by running `window.serwist.register()` in
|
|
31
|
-
* `componentDidMount` or `useEffect`.
|
|
17
|
+
* Whether `@serwist/next` should automatically register the service worker for you. If
|
|
18
|
+
* you want to register the service worker yourself, set this to `false` and run
|
|
19
|
+
* `window.serwist.register()` in `componentDidMount` or `useEffect`.
|
|
32
20
|
* @example
|
|
33
21
|
* ```tsx
|
|
34
22
|
* // app/register-pwa.tsx
|
|
@@ -74,9 +62,20 @@ export interface PluginOptions extends Require<WebpackInjectManifestOptions, "sw
|
|
|
74
62
|
*/
|
|
75
63
|
register?: boolean;
|
|
76
64
|
/**
|
|
77
|
-
*
|
|
65
|
+
* Whether Serwist should reload the app when it goes online.
|
|
78
66
|
* @default true
|
|
79
67
|
*/
|
|
80
68
|
reloadOnOnline?: boolean;
|
|
69
|
+
/**
|
|
70
|
+
* The service worker's URL scope. Set to `/foo/` so that paths under `/foo/` are under the service
|
|
71
|
+
* worker's control while others are not.
|
|
72
|
+
* @default nextConfig.basePath
|
|
73
|
+
*/
|
|
74
|
+
scope?: string;
|
|
75
|
+
/**
|
|
76
|
+
* The URL to the service worker.
|
|
77
|
+
* @default "/sw.js"
|
|
78
|
+
*/
|
|
79
|
+
swUrl?: string;
|
|
81
80
|
}
|
|
82
81
|
export {};
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
package/dist/utils.d.cts
ADDED
|
File without changes
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@serwist/next",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.2.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A module that integrates Serwist into your Next.js application.",
|
|
6
6
|
"files": [
|
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"repository": "serwist/serwist",
|
|
21
21
|
"bugs": "https://github.com/serwist/serwist/issues",
|
|
22
|
-
"homepage": "https://
|
|
22
|
+
"homepage": "https://serwist.vercel.app",
|
|
23
23
|
"module": "./dist/index.js",
|
|
24
|
-
"main": "./dist/index.
|
|
24
|
+
"main": "./dist/index.cjs",
|
|
25
25
|
"types": "./dist/index.d.ts",
|
|
26
26
|
"exports": {
|
|
27
27
|
".": {
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"default": "./dist/index.js"
|
|
31
31
|
},
|
|
32
32
|
"require": {
|
|
33
|
-
"types": "./dist/index.
|
|
34
|
-
"default": "./dist/index.
|
|
33
|
+
"types": "./dist/index.d.cts",
|
|
34
|
+
"default": "./dist/index.cjs"
|
|
35
35
|
}
|
|
36
36
|
},
|
|
37
37
|
"./browser": {
|
|
@@ -40,8 +40,8 @@
|
|
|
40
40
|
"default": "./dist/index.browser.js"
|
|
41
41
|
},
|
|
42
42
|
"require": {
|
|
43
|
-
"types": "./dist/index.browser.
|
|
44
|
-
"default": "./dist/index.browser.
|
|
43
|
+
"types": "./dist/index.browser.d.cts",
|
|
44
|
+
"default": "./dist/index.browser.cjs"
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
47
|
"./typings": {
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"types": "./dist/sw-entry.d.ts"
|
|
50
50
|
},
|
|
51
51
|
"require": {
|
|
52
|
-
"types": "./dist/sw-entry.
|
|
52
|
+
"types": "./dist/sw-entry.d.cts"
|
|
53
53
|
}
|
|
54
54
|
},
|
|
55
55
|
"./package.json": "./package.json"
|
|
@@ -67,9 +67,9 @@
|
|
|
67
67
|
"dependencies": {
|
|
68
68
|
"clean-webpack-plugin": "4.0.0",
|
|
69
69
|
"fast-glob": "3.3.2",
|
|
70
|
-
"@serwist/build": "8.
|
|
71
|
-
"@serwist/webpack-plugin": "8.
|
|
72
|
-
"@serwist/window": "8.
|
|
70
|
+
"@serwist/build": "8.2.0",
|
|
71
|
+
"@serwist/webpack-plugin": "8.2.0",
|
|
72
|
+
"@serwist/window": "8.2.0"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
75
|
"@types/node": "20.10.5",
|
|
@@ -79,9 +79,9 @@
|
|
|
79
79
|
"react-dom": "18.2.0",
|
|
80
80
|
"rollup": "4.9.1",
|
|
81
81
|
"type-fest": "4.8.3",
|
|
82
|
-
"typescript": "5.4.0-dev.
|
|
82
|
+
"typescript": "5.4.0-dev.20231226",
|
|
83
83
|
"webpack": "5.89.0",
|
|
84
|
-
"@serwist/constants": "8.
|
|
84
|
+
"@serwist/constants": "8.2.0"
|
|
85
85
|
},
|
|
86
86
|
"peerDependencies": {
|
|
87
87
|
"next": ">=14.0.0",
|
package/dist/index.old.d.cts
DELETED
package/dist/sw-entry.old.d.cts
DELETED
|
File without changes
|
|
File without changes
|