@serwist/next 9.0.0-preview.14 → 9.0.0-preview.15
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/dist/index.worker.js +26 -13
- package/dist/worker/defaultCache.d.ts.map +1 -1
- package/package.json +17 -17
- package/src/worker/defaultCache.ts +19 -2
package/dist/index.worker.js
CHANGED
|
@@ -16,7 +16,8 @@ const defaultCache = [
|
|
|
16
16
|
plugins: [
|
|
17
17
|
new ExpirationPlugin({
|
|
18
18
|
maxEntries: 4,
|
|
19
|
-
maxAgeSeconds: 365 * 24 * 60 * 60
|
|
19
|
+
maxAgeSeconds: 365 * 24 * 60 * 60,
|
|
20
|
+
maxAgeFrom: "last-used"
|
|
20
21
|
})
|
|
21
22
|
]
|
|
22
23
|
})
|
|
@@ -28,7 +29,8 @@ const defaultCache = [
|
|
|
28
29
|
plugins: [
|
|
29
30
|
new ExpirationPlugin({
|
|
30
31
|
maxEntries: 4,
|
|
31
|
-
maxAgeSeconds: 7 * 24 * 60 * 60
|
|
32
|
+
maxAgeSeconds: 7 * 24 * 60 * 60,
|
|
33
|
+
maxAgeFrom: "last-used"
|
|
32
34
|
})
|
|
33
35
|
]
|
|
34
36
|
})
|
|
@@ -40,7 +42,8 @@ const defaultCache = [
|
|
|
40
42
|
plugins: [
|
|
41
43
|
new ExpirationPlugin({
|
|
42
44
|
maxEntries: 4,
|
|
43
|
-
maxAgeSeconds: 7 * 24 * 60 * 60
|
|
45
|
+
maxAgeSeconds: 7 * 24 * 60 * 60,
|
|
46
|
+
maxAgeFrom: "last-used"
|
|
44
47
|
})
|
|
45
48
|
]
|
|
46
49
|
})
|
|
@@ -52,7 +55,8 @@ const defaultCache = [
|
|
|
52
55
|
plugins: [
|
|
53
56
|
new ExpirationPlugin({
|
|
54
57
|
maxEntries: 64,
|
|
55
|
-
maxAgeSeconds: 30 * 24 * 60 * 60
|
|
58
|
+
maxAgeSeconds: 30 * 24 * 60 * 60,
|
|
59
|
+
maxAgeFrom: "last-used"
|
|
56
60
|
})
|
|
57
61
|
]
|
|
58
62
|
})
|
|
@@ -64,7 +68,8 @@ const defaultCache = [
|
|
|
64
68
|
plugins: [
|
|
65
69
|
new ExpirationPlugin({
|
|
66
70
|
maxEntries: 64,
|
|
67
|
-
maxAgeSeconds: 24 * 60 * 60
|
|
71
|
+
maxAgeSeconds: 24 * 60 * 60,
|
|
72
|
+
maxAgeFrom: "last-used"
|
|
68
73
|
})
|
|
69
74
|
]
|
|
70
75
|
})
|
|
@@ -76,7 +81,8 @@ const defaultCache = [
|
|
|
76
81
|
plugins: [
|
|
77
82
|
new ExpirationPlugin({
|
|
78
83
|
maxEntries: 64,
|
|
79
|
-
maxAgeSeconds: 24 * 60 * 60
|
|
84
|
+
maxAgeSeconds: 24 * 60 * 60,
|
|
85
|
+
maxAgeFrom: "last-used"
|
|
80
86
|
})
|
|
81
87
|
]
|
|
82
88
|
})
|
|
@@ -88,7 +94,8 @@ const defaultCache = [
|
|
|
88
94
|
plugins: [
|
|
89
95
|
new ExpirationPlugin({
|
|
90
96
|
maxEntries: 32,
|
|
91
|
-
maxAgeSeconds: 24 * 60 * 60
|
|
97
|
+
maxAgeSeconds: 24 * 60 * 60,
|
|
98
|
+
maxAgeFrom: "last-used"
|
|
92
99
|
}),
|
|
93
100
|
new RangeRequestsPlugin()
|
|
94
101
|
]
|
|
@@ -101,7 +108,8 @@ const defaultCache = [
|
|
|
101
108
|
plugins: [
|
|
102
109
|
new ExpirationPlugin({
|
|
103
110
|
maxEntries: 32,
|
|
104
|
-
maxAgeSeconds: 24 * 60 * 60
|
|
111
|
+
maxAgeSeconds: 24 * 60 * 60,
|
|
112
|
+
maxAgeFrom: "last-used"
|
|
105
113
|
}),
|
|
106
114
|
new RangeRequestsPlugin()
|
|
107
115
|
]
|
|
@@ -114,7 +122,8 @@ const defaultCache = [
|
|
|
114
122
|
plugins: [
|
|
115
123
|
new ExpirationPlugin({
|
|
116
124
|
maxEntries: 48,
|
|
117
|
-
maxAgeSeconds: 24 * 60 * 60
|
|
125
|
+
maxAgeSeconds: 24 * 60 * 60,
|
|
126
|
+
maxAgeFrom: "last-used"
|
|
118
127
|
})
|
|
119
128
|
]
|
|
120
129
|
})
|
|
@@ -126,7 +135,8 @@ const defaultCache = [
|
|
|
126
135
|
plugins: [
|
|
127
136
|
new ExpirationPlugin({
|
|
128
137
|
maxEntries: 32,
|
|
129
|
-
maxAgeSeconds: 24 * 60 * 60
|
|
138
|
+
maxAgeSeconds: 24 * 60 * 60,
|
|
139
|
+
maxAgeFrom: "last-used"
|
|
130
140
|
})
|
|
131
141
|
]
|
|
132
142
|
})
|
|
@@ -138,7 +148,8 @@ const defaultCache = [
|
|
|
138
148
|
plugins: [
|
|
139
149
|
new ExpirationPlugin({
|
|
140
150
|
maxEntries: 32,
|
|
141
|
-
maxAgeSeconds: 24 * 60 * 60
|
|
151
|
+
maxAgeSeconds: 24 * 60 * 60,
|
|
152
|
+
maxAgeFrom: "last-used"
|
|
142
153
|
})
|
|
143
154
|
]
|
|
144
155
|
})
|
|
@@ -150,7 +161,8 @@ const defaultCache = [
|
|
|
150
161
|
plugins: [
|
|
151
162
|
new ExpirationPlugin({
|
|
152
163
|
maxEntries: 32,
|
|
153
|
-
maxAgeSeconds: 24 * 60 * 60
|
|
164
|
+
maxAgeSeconds: 24 * 60 * 60,
|
|
165
|
+
maxAgeFrom: "last-used"
|
|
154
166
|
})
|
|
155
167
|
]
|
|
156
168
|
})
|
|
@@ -171,7 +183,8 @@ const defaultCache = [
|
|
|
171
183
|
plugins: [
|
|
172
184
|
new ExpirationPlugin({
|
|
173
185
|
maxEntries: 16,
|
|
174
|
-
maxAgeSeconds: 24 * 60 * 60
|
|
186
|
+
maxAgeSeconds: 24 * 60 * 60,
|
|
187
|
+
maxAgeFrom: "last-used"
|
|
175
188
|
})
|
|
176
189
|
],
|
|
177
190
|
networkTimeoutSeconds: 10
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultCache.d.ts","sourceRoot":"","sources":["../../src/worker/defaultCache.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAKlD,eAAO,MAAM,YAAY,EAAE,cAAc,
|
|
1
|
+
{"version":3,"file":"defaultCache.d.ts","sourceRoot":"","sources":["../../src/worker/defaultCache.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAKlD,eAAO,MAAM,YAAY,EAAE,cAAc,EA8PxC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@serwist/next",
|
|
3
|
-
"version": "9.0.0-preview.
|
|
3
|
+
"version": "9.0.0-preview.15",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A module that integrates Serwist into your Next.js application.",
|
|
6
6
|
"files": [
|
|
@@ -65,31 +65,31 @@
|
|
|
65
65
|
"chalk": "5.3.0",
|
|
66
66
|
"glob": "10.3.10",
|
|
67
67
|
"zod": "3.22.4",
|
|
68
|
-
"@serwist/build": "9.0.0-preview.
|
|
69
|
-
"@serwist/core": "9.0.0-preview.
|
|
70
|
-
"@serwist/expiration": "9.0.0-preview.
|
|
71
|
-
"@serwist/range-requests": "9.0.0-preview.
|
|
72
|
-
"@serwist/strategies": "9.0.0-preview.
|
|
73
|
-
"@serwist/webpack-plugin": "9.0.0-preview.
|
|
74
|
-
"@serwist/window": "9.0.0-preview.
|
|
68
|
+
"@serwist/build": "9.0.0-preview.15",
|
|
69
|
+
"@serwist/core": "9.0.0-preview.15",
|
|
70
|
+
"@serwist/expiration": "9.0.0-preview.15",
|
|
71
|
+
"@serwist/range-requests": "9.0.0-preview.15",
|
|
72
|
+
"@serwist/strategies": "9.0.0-preview.15",
|
|
73
|
+
"@serwist/webpack-plugin": "9.0.0-preview.15",
|
|
74
|
+
"@serwist/window": "9.0.0-preview.15"
|
|
75
75
|
},
|
|
76
76
|
"devDependencies": {
|
|
77
|
-
"@types/node": "20.11.
|
|
78
|
-
"next": "14.1.
|
|
77
|
+
"@types/node": "20.11.30",
|
|
78
|
+
"next": "14.1.4",
|
|
79
79
|
"react": "18.2.0",
|
|
80
80
|
"react-dom": "18.2.0",
|
|
81
81
|
"rollup": "4.13.0",
|
|
82
|
-
"type-fest": "4.
|
|
83
|
-
"typescript": "5.5.0-dev.
|
|
84
|
-
"webpack": "5.
|
|
85
|
-
"@serwist/constants": "9.0.0-preview.
|
|
86
|
-
"@serwist/sw": "9.0.0-preview.
|
|
87
|
-
"@serwist/utils": "9.0.0-preview.
|
|
82
|
+
"type-fest": "4.13.1",
|
|
83
|
+
"typescript": "5.5.0-dev.20240323",
|
|
84
|
+
"webpack": "5.91.0",
|
|
85
|
+
"@serwist/constants": "9.0.0-preview.15",
|
|
86
|
+
"@serwist/sw": "9.0.0-preview.15",
|
|
87
|
+
"@serwist/utils": "9.0.0-preview.15"
|
|
88
88
|
},
|
|
89
89
|
"peerDependencies": {
|
|
90
90
|
"next": ">=14.0.0",
|
|
91
91
|
"typescript": ">=5.0.0",
|
|
92
|
-
"@serwist/sw": "9.0.0-preview.
|
|
92
|
+
"@serwist/sw": "9.0.0-preview.15"
|
|
93
93
|
},
|
|
94
94
|
"peerDependenciesMeta": {
|
|
95
95
|
"@serwist/sw": {
|
|
@@ -15,6 +15,7 @@ export const defaultCache: RuntimeCaching[] = [
|
|
|
15
15
|
new ExpirationPlugin({
|
|
16
16
|
maxEntries: 4,
|
|
17
17
|
maxAgeSeconds: 365 * 24 * 60 * 60, // 365 days
|
|
18
|
+
maxAgeFrom: "last-used",
|
|
18
19
|
}),
|
|
19
20
|
],
|
|
20
21
|
}),
|
|
@@ -27,6 +28,7 @@ export const defaultCache: RuntimeCaching[] = [
|
|
|
27
28
|
new ExpirationPlugin({
|
|
28
29
|
maxEntries: 4,
|
|
29
30
|
maxAgeSeconds: 7 * 24 * 60 * 60, // 7 days
|
|
31
|
+
maxAgeFrom: "last-used",
|
|
30
32
|
}),
|
|
31
33
|
],
|
|
32
34
|
}),
|
|
@@ -39,6 +41,7 @@ export const defaultCache: RuntimeCaching[] = [
|
|
|
39
41
|
new ExpirationPlugin({
|
|
40
42
|
maxEntries: 4,
|
|
41
43
|
maxAgeSeconds: 7 * 24 * 60 * 60, // 7 days
|
|
44
|
+
maxAgeFrom: "last-used",
|
|
42
45
|
}),
|
|
43
46
|
],
|
|
44
47
|
}),
|
|
@@ -51,6 +54,7 @@ export const defaultCache: RuntimeCaching[] = [
|
|
|
51
54
|
new ExpirationPlugin({
|
|
52
55
|
maxEntries: 64,
|
|
53
56
|
maxAgeSeconds: 30 * 24 * 60 * 60, // 30 days
|
|
57
|
+
maxAgeFrom: "last-used",
|
|
54
58
|
}),
|
|
55
59
|
],
|
|
56
60
|
}),
|
|
@@ -63,6 +67,7 @@ export const defaultCache: RuntimeCaching[] = [
|
|
|
63
67
|
new ExpirationPlugin({
|
|
64
68
|
maxEntries: 64,
|
|
65
69
|
maxAgeSeconds: 24 * 60 * 60, // 24 hours
|
|
70
|
+
maxAgeFrom: "last-used",
|
|
66
71
|
}),
|
|
67
72
|
],
|
|
68
73
|
}),
|
|
@@ -75,6 +80,7 @@ export const defaultCache: RuntimeCaching[] = [
|
|
|
75
80
|
new ExpirationPlugin({
|
|
76
81
|
maxEntries: 64,
|
|
77
82
|
maxAgeSeconds: 24 * 60 * 60, // 24 hours
|
|
83
|
+
maxAgeFrom: "last-used",
|
|
78
84
|
}),
|
|
79
85
|
],
|
|
80
86
|
}),
|
|
@@ -87,6 +93,7 @@ export const defaultCache: RuntimeCaching[] = [
|
|
|
87
93
|
new ExpirationPlugin({
|
|
88
94
|
maxEntries: 32,
|
|
89
95
|
maxAgeSeconds: 24 * 60 * 60, // 24 hours
|
|
96
|
+
maxAgeFrom: "last-used",
|
|
90
97
|
}),
|
|
91
98
|
new RangeRequestsPlugin(),
|
|
92
99
|
],
|
|
@@ -100,6 +107,7 @@ export const defaultCache: RuntimeCaching[] = [
|
|
|
100
107
|
new ExpirationPlugin({
|
|
101
108
|
maxEntries: 32,
|
|
102
109
|
maxAgeSeconds: 24 * 60 * 60, // 24 hours
|
|
110
|
+
maxAgeFrom: "last-used",
|
|
103
111
|
}),
|
|
104
112
|
new RangeRequestsPlugin(),
|
|
105
113
|
],
|
|
@@ -113,6 +121,7 @@ export const defaultCache: RuntimeCaching[] = [
|
|
|
113
121
|
new ExpirationPlugin({
|
|
114
122
|
maxEntries: 48,
|
|
115
123
|
maxAgeSeconds: 24 * 60 * 60, // 24 hours
|
|
124
|
+
maxAgeFrom: "last-used",
|
|
116
125
|
}),
|
|
117
126
|
],
|
|
118
127
|
}),
|
|
@@ -125,6 +134,7 @@ export const defaultCache: RuntimeCaching[] = [
|
|
|
125
134
|
new ExpirationPlugin({
|
|
126
135
|
maxEntries: 32,
|
|
127
136
|
maxAgeSeconds: 24 * 60 * 60, // 24 hours
|
|
137
|
+
maxAgeFrom: "last-used",
|
|
128
138
|
}),
|
|
129
139
|
],
|
|
130
140
|
}),
|
|
@@ -137,6 +147,7 @@ export const defaultCache: RuntimeCaching[] = [
|
|
|
137
147
|
new ExpirationPlugin({
|
|
138
148
|
maxEntries: 32,
|
|
139
149
|
maxAgeSeconds: 24 * 60 * 60, // 24 hours
|
|
150
|
+
maxAgeFrom: "last-used",
|
|
140
151
|
}),
|
|
141
152
|
],
|
|
142
153
|
}),
|
|
@@ -149,15 +160,20 @@ export const defaultCache: RuntimeCaching[] = [
|
|
|
149
160
|
new ExpirationPlugin({
|
|
150
161
|
maxEntries: 32,
|
|
151
162
|
maxAgeSeconds: 24 * 60 * 60, // 24 hours
|
|
163
|
+
maxAgeFrom: "last-used",
|
|
152
164
|
}),
|
|
153
165
|
],
|
|
154
166
|
}),
|
|
155
167
|
},
|
|
156
168
|
{
|
|
157
169
|
matcher: ({ sameOrigin, url: { pathname } }) => {
|
|
158
|
-
// Exclude /api/auth/callback/* to fix OAuth workflow in Safari without having
|
|
159
|
-
//
|
|
170
|
+
// Exclude /api/auth/callback/* to fix OAuth workflow in Safari without having
|
|
171
|
+
// an impact on other environments
|
|
172
|
+
// The above route is the default for next-auth, you may need to change it if
|
|
173
|
+
// your OAuth workflow has a different callback route.
|
|
160
174
|
// Issue: https://github.com/shadowwalker/next-pwa/issues/131#issuecomment-821894809
|
|
175
|
+
// TODO(ducanhgh): Investigate Auth.js's "/api/auth/*" failing when we allow them
|
|
176
|
+
// to be cached (the current behaviour).
|
|
161
177
|
if (!sameOrigin || pathname.startsWith("/api/auth/callback")) {
|
|
162
178
|
return false;
|
|
163
179
|
}
|
|
@@ -175,6 +191,7 @@ export const defaultCache: RuntimeCaching[] = [
|
|
|
175
191
|
new ExpirationPlugin({
|
|
176
192
|
maxEntries: 16,
|
|
177
193
|
maxAgeSeconds: 24 * 60 * 60, // 24 hours
|
|
194
|
+
maxAgeFrom: "last-used",
|
|
178
195
|
}),
|
|
179
196
|
],
|
|
180
197
|
networkTimeoutSeconds: 10, // fallback to cache if API does not response within 10 seconds
|