@serwist/next 9.5.6 → 9.5.8
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/chunks/schema-BhRhcBIb.js +22 -0
- package/dist/chunks/schema-BhRhcBIb.js.map +1 -0
- package/dist/index.config.d.mts +50 -0
- package/dist/index.config.d.mts.map +1 -0
- package/dist/index.config.mjs +89 -0
- package/dist/index.config.mjs.map +1 -0
- package/dist/index.d.mts +111 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +242 -0
- package/dist/index.mjs.map +1 -0
- package/dist/index.react.d.mts +41 -0
- package/dist/index.react.d.mts.map +1 -0
- package/dist/index.react.mjs +73 -0
- package/dist/index.react.mjs.map +1 -0
- package/dist/index.schema.d.mts +94 -0
- package/dist/index.schema.d.mts.map +1 -0
- package/dist/index.schema.mjs +2 -0
- package/dist/index.worker.d.mts +18 -0
- package/dist/index.worker.d.mts.map +1 -0
- package/dist/index.worker.mjs +227 -0
- package/dist/index.worker.mjs.map +1 -0
- package/dist/sw-entry-worker.d.mts +11 -0
- package/dist/sw-entry-worker.d.mts.map +1 -0
- package/dist/sw-entry-worker.mjs +25 -0
- package/dist/sw-entry-worker.mjs.map +1 -0
- package/dist/sw-entry.d.mts +9 -0
- package/dist/sw-entry.d.mts.map +1 -0
- package/dist/sw-entry.mjs +37 -0
- package/dist/sw-entry.mjs.map +1 -0
- package/package.json +39 -40
- package/src/index.react.tsx +2 -2
- package/src/index.ts +2 -2
- package/src/lib/config/utils.ts +3 -2
- package/dist/chunks/schema.js +0 -24
- package/dist/index.config.d.ts +0 -36
- package/dist/index.config.d.ts.map +0 -1
- package/dist/index.config.js +0 -118
- package/dist/index.d.ts +0 -13
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -285
- package/dist/index.react.d.ts +0 -25
- package/dist/index.react.d.ts.map +0 -1
- package/dist/index.react.js +0 -88
- package/dist/index.schema.d.ts +0 -3
- package/dist/index.schema.d.ts.map +0 -1
- package/dist/index.schema.js +0 -4
- package/dist/index.worker.d.ts +0 -14
- package/dist/index.worker.d.ts.map +0 -1
- package/dist/index.worker.js +0 -261
- package/dist/internal-types.d.ts +0 -15
- package/dist/internal-types.d.ts.map +0 -1
- package/dist/lib/config/constants.d.ts +0 -2
- package/dist/lib/config/constants.d.ts.map +0 -1
- package/dist/lib/config/types.d.ts +0 -11
- package/dist/lib/config/types.d.ts.map +0 -1
- package/dist/lib/config/utils.d.ts +0 -3
- package/dist/lib/config/utils.d.ts.map +0 -1
- package/dist/lib/context.d.ts +0 -7
- package/dist/lib/context.d.ts.map +0 -1
- package/dist/lib/find-first-truthy.d.ts +0 -8
- package/dist/lib/find-first-truthy.d.ts.map +0 -1
- package/dist/lib/get-content-hash.d.ts +0 -3
- package/dist/lib/get-content-hash.d.ts.map +0 -1
- package/dist/lib/get-file-hash.d.ts +0 -3
- package/dist/lib/get-file-hash.d.ts.map +0 -1
- package/dist/lib/get-package-version.d.ts +0 -7
- package/dist/lib/get-package-version.d.ts.map +0 -1
- package/dist/lib/index.d.ts +0 -7
- package/dist/lib/index.d.ts.map +0 -1
- package/dist/lib/load-tsconfig.d.ts +0 -3
- package/dist/lib/load-tsconfig.d.ts.map +0 -1
- package/dist/lib/logger.d.ts +0 -7
- package/dist/lib/logger.d.ts.map +0 -1
- package/dist/lib/schema.d.ts +0 -90
- package/dist/lib/schema.d.ts.map +0 -1
- package/dist/lib/types.d.ts +0 -95
- package/dist/lib/types.d.ts.map +0 -1
- package/dist/lib/validator.d.ts +0 -3
- package/dist/lib/validator.d.ts.map +0 -1
- package/dist/sw-entry-worker.d.ts +0 -8
- package/dist/sw-entry-worker.d.ts.map +0 -1
- package/dist/sw-entry-worker.js +0 -33
- package/dist/sw-entry.d.ts +0 -7
- package/dist/sw-entry.d.ts.map +0 -1
- package/dist/sw-entry.js +0 -43
- package/dist/utils.d.ts +0 -4
- package/dist/utils.d.ts.map +0 -1
package/dist/index.worker.js
DELETED
|
@@ -1,261 +0,0 @@
|
|
|
1
|
-
import { NetworkOnly, CacheFirst, StaleWhileRevalidate, NetworkFirst, ExpirationPlugin, RangeRequestsPlugin } from 'serwist';
|
|
2
|
-
|
|
3
|
-
const PAGES_CACHE_NAME = {
|
|
4
|
-
rscPrefetch: "pages-rsc-prefetch",
|
|
5
|
-
rsc: "pages-rsc",
|
|
6
|
-
html: "pages"
|
|
7
|
-
};
|
|
8
|
-
const defaultCache = process.env.NODE_ENV !== "production" ? [
|
|
9
|
-
{
|
|
10
|
-
matcher: /.*/i,
|
|
11
|
-
handler: new NetworkOnly()
|
|
12
|
-
}
|
|
13
|
-
] : [
|
|
14
|
-
{
|
|
15
|
-
matcher: /^https:\/\/fonts\.(?:gstatic)\.com\/.*/i,
|
|
16
|
-
handler: new CacheFirst({
|
|
17
|
-
cacheName: "google-fonts-webfonts",
|
|
18
|
-
plugins: [
|
|
19
|
-
new ExpirationPlugin({
|
|
20
|
-
maxEntries: 4,
|
|
21
|
-
maxAgeSeconds: 365 * 24 * 60 * 60,
|
|
22
|
-
maxAgeFrom: "last-used"
|
|
23
|
-
})
|
|
24
|
-
]
|
|
25
|
-
})
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
matcher: /^https:\/\/fonts\.(?:googleapis)\.com\/.*/i,
|
|
29
|
-
handler: new StaleWhileRevalidate({
|
|
30
|
-
cacheName: "google-fonts-stylesheets",
|
|
31
|
-
plugins: [
|
|
32
|
-
new ExpirationPlugin({
|
|
33
|
-
maxEntries: 4,
|
|
34
|
-
maxAgeSeconds: 7 * 24 * 60 * 60,
|
|
35
|
-
maxAgeFrom: "last-used"
|
|
36
|
-
})
|
|
37
|
-
]
|
|
38
|
-
})
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
matcher: /\.(?:eot|otf|ttc|ttf|woff|woff2|font.css)$/i,
|
|
42
|
-
handler: new StaleWhileRevalidate({
|
|
43
|
-
cacheName: "static-font-assets",
|
|
44
|
-
plugins: [
|
|
45
|
-
new ExpirationPlugin({
|
|
46
|
-
maxEntries: 4,
|
|
47
|
-
maxAgeSeconds: 7 * 24 * 60 * 60,
|
|
48
|
-
maxAgeFrom: "last-used"
|
|
49
|
-
})
|
|
50
|
-
]
|
|
51
|
-
})
|
|
52
|
-
},
|
|
53
|
-
{
|
|
54
|
-
matcher: /\.(?:jpg|jpeg|gif|png|svg|ico|webp)$/i,
|
|
55
|
-
handler: new StaleWhileRevalidate({
|
|
56
|
-
cacheName: "static-image-assets",
|
|
57
|
-
plugins: [
|
|
58
|
-
new ExpirationPlugin({
|
|
59
|
-
maxEntries: 64,
|
|
60
|
-
maxAgeSeconds: 30 * 24 * 60 * 60,
|
|
61
|
-
maxAgeFrom: "last-used"
|
|
62
|
-
})
|
|
63
|
-
]
|
|
64
|
-
})
|
|
65
|
-
},
|
|
66
|
-
{
|
|
67
|
-
matcher: /\/_next\/static.+\.js$/i,
|
|
68
|
-
handler: new CacheFirst({
|
|
69
|
-
cacheName: "next-static-js-assets",
|
|
70
|
-
plugins: [
|
|
71
|
-
new ExpirationPlugin({
|
|
72
|
-
maxEntries: 64,
|
|
73
|
-
maxAgeSeconds: 24 * 60 * 60,
|
|
74
|
-
maxAgeFrom: "last-used"
|
|
75
|
-
})
|
|
76
|
-
]
|
|
77
|
-
})
|
|
78
|
-
},
|
|
79
|
-
{
|
|
80
|
-
matcher: /\/_next\/image\?url=.+$/i,
|
|
81
|
-
handler: new StaleWhileRevalidate({
|
|
82
|
-
cacheName: "next-image",
|
|
83
|
-
plugins: [
|
|
84
|
-
new ExpirationPlugin({
|
|
85
|
-
maxEntries: 64,
|
|
86
|
-
maxAgeSeconds: 24 * 60 * 60,
|
|
87
|
-
maxAgeFrom: "last-used"
|
|
88
|
-
})
|
|
89
|
-
]
|
|
90
|
-
})
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
matcher: /\.(?:mp3|wav|ogg)$/i,
|
|
94
|
-
handler: new CacheFirst({
|
|
95
|
-
cacheName: "static-audio-assets",
|
|
96
|
-
plugins: [
|
|
97
|
-
new ExpirationPlugin({
|
|
98
|
-
maxEntries: 32,
|
|
99
|
-
maxAgeSeconds: 24 * 60 * 60,
|
|
100
|
-
maxAgeFrom: "last-used"
|
|
101
|
-
}),
|
|
102
|
-
new RangeRequestsPlugin()
|
|
103
|
-
]
|
|
104
|
-
})
|
|
105
|
-
},
|
|
106
|
-
{
|
|
107
|
-
matcher: /\.(?:mp4|webm)$/i,
|
|
108
|
-
handler: new CacheFirst({
|
|
109
|
-
cacheName: "static-video-assets",
|
|
110
|
-
plugins: [
|
|
111
|
-
new ExpirationPlugin({
|
|
112
|
-
maxEntries: 32,
|
|
113
|
-
maxAgeSeconds: 24 * 60 * 60,
|
|
114
|
-
maxAgeFrom: "last-used"
|
|
115
|
-
}),
|
|
116
|
-
new RangeRequestsPlugin()
|
|
117
|
-
]
|
|
118
|
-
})
|
|
119
|
-
},
|
|
120
|
-
{
|
|
121
|
-
matcher: /\.(?:js)$/i,
|
|
122
|
-
handler: new StaleWhileRevalidate({
|
|
123
|
-
cacheName: "static-js-assets",
|
|
124
|
-
plugins: [
|
|
125
|
-
new ExpirationPlugin({
|
|
126
|
-
maxEntries: 48,
|
|
127
|
-
maxAgeSeconds: 24 * 60 * 60,
|
|
128
|
-
maxAgeFrom: "last-used"
|
|
129
|
-
})
|
|
130
|
-
]
|
|
131
|
-
})
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
matcher: /\.(?:css|less)$/i,
|
|
135
|
-
handler: new StaleWhileRevalidate({
|
|
136
|
-
cacheName: "static-style-assets",
|
|
137
|
-
plugins: [
|
|
138
|
-
new ExpirationPlugin({
|
|
139
|
-
maxEntries: 32,
|
|
140
|
-
maxAgeSeconds: 24 * 60 * 60,
|
|
141
|
-
maxAgeFrom: "last-used"
|
|
142
|
-
})
|
|
143
|
-
]
|
|
144
|
-
})
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
matcher: /\/_next\/data\/.+\/.+\.json$/i,
|
|
148
|
-
handler: new NetworkFirst({
|
|
149
|
-
cacheName: "next-data",
|
|
150
|
-
plugins: [
|
|
151
|
-
new ExpirationPlugin({
|
|
152
|
-
maxEntries: 32,
|
|
153
|
-
maxAgeSeconds: 24 * 60 * 60,
|
|
154
|
-
maxAgeFrom: "last-used"
|
|
155
|
-
})
|
|
156
|
-
]
|
|
157
|
-
})
|
|
158
|
-
},
|
|
159
|
-
{
|
|
160
|
-
matcher: /\.(?:json|xml|csv)$/i,
|
|
161
|
-
handler: new NetworkFirst({
|
|
162
|
-
cacheName: "static-data-assets",
|
|
163
|
-
plugins: [
|
|
164
|
-
new ExpirationPlugin({
|
|
165
|
-
maxEntries: 32,
|
|
166
|
-
maxAgeSeconds: 24 * 60 * 60,
|
|
167
|
-
maxAgeFrom: "last-used"
|
|
168
|
-
})
|
|
169
|
-
]
|
|
170
|
-
})
|
|
171
|
-
},
|
|
172
|
-
{
|
|
173
|
-
matcher: /\/api\/auth\/.*/,
|
|
174
|
-
handler: new NetworkOnly({
|
|
175
|
-
networkTimeoutSeconds: 10
|
|
176
|
-
})
|
|
177
|
-
},
|
|
178
|
-
{
|
|
179
|
-
matcher: ({ sameOrigin, url: { pathname } })=>sameOrigin && pathname.startsWith("/api/"),
|
|
180
|
-
method: "GET",
|
|
181
|
-
handler: new NetworkFirst({
|
|
182
|
-
cacheName: "apis",
|
|
183
|
-
plugins: [
|
|
184
|
-
new ExpirationPlugin({
|
|
185
|
-
maxEntries: 16,
|
|
186
|
-
maxAgeSeconds: 24 * 60 * 60,
|
|
187
|
-
maxAgeFrom: "last-used"
|
|
188
|
-
})
|
|
189
|
-
],
|
|
190
|
-
networkTimeoutSeconds: 10
|
|
191
|
-
})
|
|
192
|
-
},
|
|
193
|
-
{
|
|
194
|
-
matcher: ({ request, url: { pathname }, sameOrigin })=>request.headers.get("RSC") === "1" && request.headers.get("Next-Router-Prefetch") === "1" && sameOrigin && !pathname.startsWith("/api/"),
|
|
195
|
-
handler: new NetworkFirst({
|
|
196
|
-
cacheName: PAGES_CACHE_NAME.rscPrefetch,
|
|
197
|
-
plugins: [
|
|
198
|
-
new ExpirationPlugin({
|
|
199
|
-
maxEntries: 32,
|
|
200
|
-
maxAgeSeconds: 24 * 60 * 60
|
|
201
|
-
})
|
|
202
|
-
]
|
|
203
|
-
})
|
|
204
|
-
},
|
|
205
|
-
{
|
|
206
|
-
matcher: ({ request, url: { pathname }, sameOrigin })=>request.headers.get("RSC") === "1" && sameOrigin && !pathname.startsWith("/api/"),
|
|
207
|
-
handler: new NetworkFirst({
|
|
208
|
-
cacheName: PAGES_CACHE_NAME.rsc,
|
|
209
|
-
plugins: [
|
|
210
|
-
new ExpirationPlugin({
|
|
211
|
-
maxEntries: 32,
|
|
212
|
-
maxAgeSeconds: 24 * 60 * 60
|
|
213
|
-
})
|
|
214
|
-
]
|
|
215
|
-
})
|
|
216
|
-
},
|
|
217
|
-
{
|
|
218
|
-
matcher: ({ request, url: { pathname }, sameOrigin })=>request.headers.get("Content-Type")?.includes("text/html") && sameOrigin && !pathname.startsWith("/api/"),
|
|
219
|
-
handler: new NetworkFirst({
|
|
220
|
-
cacheName: PAGES_CACHE_NAME.html,
|
|
221
|
-
plugins: [
|
|
222
|
-
new ExpirationPlugin({
|
|
223
|
-
maxEntries: 32,
|
|
224
|
-
maxAgeSeconds: 24 * 60 * 60
|
|
225
|
-
})
|
|
226
|
-
]
|
|
227
|
-
})
|
|
228
|
-
},
|
|
229
|
-
{
|
|
230
|
-
matcher: ({ url: { pathname }, sameOrigin })=>sameOrigin && !pathname.startsWith("/api/"),
|
|
231
|
-
handler: new NetworkFirst({
|
|
232
|
-
cacheName: "others",
|
|
233
|
-
plugins: [
|
|
234
|
-
new ExpirationPlugin({
|
|
235
|
-
maxEntries: 32,
|
|
236
|
-
maxAgeSeconds: 24 * 60 * 60
|
|
237
|
-
})
|
|
238
|
-
]
|
|
239
|
-
})
|
|
240
|
-
},
|
|
241
|
-
{
|
|
242
|
-
matcher: ({ sameOrigin })=>!sameOrigin,
|
|
243
|
-
handler: new NetworkFirst({
|
|
244
|
-
cacheName: "cross-origin",
|
|
245
|
-
plugins: [
|
|
246
|
-
new ExpirationPlugin({
|
|
247
|
-
maxEntries: 32,
|
|
248
|
-
maxAgeSeconds: 60 * 60
|
|
249
|
-
})
|
|
250
|
-
],
|
|
251
|
-
networkTimeoutSeconds: 10
|
|
252
|
-
})
|
|
253
|
-
},
|
|
254
|
-
{
|
|
255
|
-
matcher: /.*/i,
|
|
256
|
-
method: "GET",
|
|
257
|
-
handler: new NetworkOnly()
|
|
258
|
-
}
|
|
259
|
-
];
|
|
260
|
-
|
|
261
|
-
export { PAGES_CACHE_NAME, defaultCache };
|
package/dist/internal-types.d.ts
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { Asset, Compilation } from "webpack";
|
|
2
|
-
export type SerwistNextOptionsKey = "self.__SERWIST_SW_ENTRY";
|
|
3
|
-
export interface SerwistNextOptions {
|
|
4
|
-
sw: string;
|
|
5
|
-
scope: string;
|
|
6
|
-
cacheOnNavigation: boolean;
|
|
7
|
-
register: boolean;
|
|
8
|
-
reloadOnOnline: boolean;
|
|
9
|
-
swEntryWorker: string | undefined;
|
|
10
|
-
}
|
|
11
|
-
export interface ExcludeParams {
|
|
12
|
-
asset: Asset;
|
|
13
|
-
compilation: Compilation;
|
|
14
|
-
}
|
|
15
|
-
//# sourceMappingURL=internal-types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"internal-types.d.ts","sourceRoot":"","sources":["../src/internal-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAElD,MAAM,MAAM,qBAAqB,GAAG,yBAAyB,CAAC;AAE9D,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,iBAAiB,EAAE,OAAO,CAAC;IAC3B,QAAQ,EAAE,OAAO,CAAC;IAClB,cAAc,EAAE,OAAO,CAAC;IACxB,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;CACnC;AAED,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,KAAK,CAAC;IACb,WAAW,EAAE,WAAW,CAAC;CAC1B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../src/lib/config/constants.ts"],"names":[],"mappings":""}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { BuildOptions } from "@serwist/cli";
|
|
2
|
-
import type { Optional } from "@serwist/utils";
|
|
3
|
-
export interface SerwistOptions extends Optional<BuildOptions, "globDirectory"> {
|
|
4
|
-
/**
|
|
5
|
-
* Whether Serwist should precache prerendered routes.
|
|
6
|
-
*
|
|
7
|
-
* @default true
|
|
8
|
-
*/
|
|
9
|
-
precachePrerendered?: boolean;
|
|
10
|
-
}
|
|
11
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/lib/config/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAE/C,MAAM,WAAW,cAAe,SAAQ,QAAQ,CAAC,YAAY,EAAE,eAAe,CAAC;IAC7E;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/lib/config/utils.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,cAAc,GAAI,KAAK,MAAM,EAAE,OAAO,OAAO,4EAKzD,CAAC;AAEF,eAAO,MAAM,oBAAoB,GAAI,SAAS,MAAM,aAGnD,CAAC"}
|
package/dist/lib/context.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { Serwist } from "@serwist/window";
|
|
2
|
-
export interface SerwistContextValues {
|
|
3
|
-
serwist: Serwist | null;
|
|
4
|
-
}
|
|
5
|
-
export declare const SerwistContext: import("react").Context<SerwistContextValues>;
|
|
6
|
-
export declare const useSerwist: () => SerwistContextValues;
|
|
7
|
-
//# sourceMappingURL=context.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/lib/context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAG/C,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;CACzB;AAED,eAAO,MAAM,cAAc,+CAA6C,CAAC;AAEzE,eAAO,MAAM,UAAU,4BAMtB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"find-first-truthy.d.ts","sourceRoot":"","sources":["../../src/lib/find-first-truthy.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,eAAe,GAAI,CAAC,EAAE,CAAC,EAAE,KAAK,CAAC,EAAE,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,+BAQhE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-content-hash.d.ts","sourceRoot":"","sources":["../../src/lib/get-content-hash.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAI9B,eAAO,MAAM,cAAc,GAAI,MAAM,EAAE,CAAC,oBAAoB,EAAE,OAAO,OAAO,WAK3E,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-file-hash.d.ts","sourceRoot":"","sources":["../../src/lib/get-file-hash.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,SAAS,CAAC;AAEzB,eAAO,MAAM,WAAW,GAAI,MAAM,EAAE,CAAC,oBAAoB,WAAyE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"get-package-version.d.ts","sourceRoot":"","sources":["../../src/lib/get-package-version.ts"],"names":[],"mappings":"AAIA;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,GAAI,aAAa,MAAM,KAAG,MAAM,GAAG,SAMhE,CAAC"}
|
package/dist/lib/index.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export { findFirstTruthy } from "./find-first-truthy.js";
|
|
2
|
-
export { getContentHash } from "./get-content-hash.js";
|
|
3
|
-
export { getFileHash } from "./get-file-hash.js";
|
|
4
|
-
export { getPackageVersion } from "./get-package-version.js";
|
|
5
|
-
export { loadTSConfig } from "./load-tsconfig.js";
|
|
6
|
-
export * as logger from "./logger.js";
|
|
7
|
-
//# sourceMappingURL=index.d.ts.map
|
package/dist/lib/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/lib/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"load-tsconfig.d.ts","sourceRoot":"","sources":["../../src/lib/load-tsconfig.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,YAAY,IAAI,YAAY,EAAE,MAAM,WAAW,CAAC;AAI9D,eAAO,MAAM,YAAY,GAAI,SAAS,MAAM,EAAE,sBAAsB,MAAM,GAAG,SAAS,KAAG,YAAY,GAAG,SAevG,CAAC"}
|
package/dist/lib/logger.d.ts
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export type LoggingMethods = "wait" | "error" | "warn" | "info" | "event";
|
|
2
|
-
export declare const wait: (...message: any[]) => void;
|
|
3
|
-
export declare const error: (...message: any[]) => void;
|
|
4
|
-
export declare const warn: (...message: any[]) => void;
|
|
5
|
-
export declare const info: (...message: any[]) => void;
|
|
6
|
-
export declare const event: (...message: any[]) => void;
|
|
7
|
-
//# sourceMappingURL=logger.d.ts.map
|
package/dist/lib/logger.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../../src/lib/logger.ts"],"names":[],"mappings":"AAQA,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC;AAyC1E,eAAO,MAAM,IAAI,GAAI,GAAG,SAAS,GAAG,EAAE,SAAoC,CAAC;AAE3E,eAAO,MAAM,KAAK,GAAI,GAAG,SAAS,GAAG,EAAE,SAAqC,CAAC;AAE7E,eAAO,MAAM,IAAI,GAAI,GAAG,SAAS,GAAG,EAAE,SAAoC,CAAC;AAE3E,eAAO,MAAM,IAAI,GAAI,GAAG,SAAS,GAAG,EAAE,SAAoC,CAAC;AAE3E,eAAO,MAAM,KAAK,GAAI,GAAG,SAAS,GAAG,EAAE,SAAqC,CAAC"}
|
package/dist/lib/schema.d.ts
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
export declare const injectPartial: z.ZodObject<{
|
|
3
|
-
cacheOnNavigation: z.ZodDefault<z.ZodBoolean>;
|
|
4
|
-
disable: z.ZodDefault<z.ZodBoolean>;
|
|
5
|
-
register: z.ZodDefault<z.ZodBoolean>;
|
|
6
|
-
reloadOnOnline: z.ZodDefault<z.ZodBoolean>;
|
|
7
|
-
scope: z.ZodOptional<z.ZodString>;
|
|
8
|
-
swUrl: z.ZodDefault<z.ZodString>;
|
|
9
|
-
globPublicPatterns: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
10
|
-
}, z.core.$strict>;
|
|
11
|
-
export declare const injectManifestOptions: z.ZodObject<{
|
|
12
|
-
additionalPrecacheEntries: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
|
|
13
|
-
integrity: z.ZodOptional<z.ZodString>;
|
|
14
|
-
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
15
|
-
url: z.ZodString;
|
|
16
|
-
}, z.core.$strict>]>>>;
|
|
17
|
-
dontCacheBustURLsMatching: z.ZodOptional<z.ZodCustom<RegExp, RegExp>>;
|
|
18
|
-
manifestTransforms: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodCustom<z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
|
|
19
|
-
size: z.ZodNumber;
|
|
20
|
-
integrity: z.ZodOptional<z.ZodString>;
|
|
21
|
-
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
22
|
-
url: z.ZodString;
|
|
23
|
-
}, z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
|
|
24
|
-
manifest: z.ZodArray<z.ZodObject<{
|
|
25
|
-
size: z.ZodNumber;
|
|
26
|
-
integrity: z.ZodOptional<z.ZodString>;
|
|
27
|
-
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
28
|
-
url: z.ZodString;
|
|
29
|
-
}, z.core.$strip>>;
|
|
30
|
-
warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
31
|
-
}, z.core.$strict>>, z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
|
|
32
|
-
size: z.ZodNumber;
|
|
33
|
-
integrity: z.ZodOptional<z.ZodString>;
|
|
34
|
-
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
35
|
-
url: z.ZodString;
|
|
36
|
-
}, z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
|
|
37
|
-
manifest: z.ZodArray<z.ZodObject<{
|
|
38
|
-
size: z.ZodNumber;
|
|
39
|
-
integrity: z.ZodOptional<z.ZodString>;
|
|
40
|
-
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
41
|
-
url: z.ZodString;
|
|
42
|
-
}, z.core.$strip>>;
|
|
43
|
-
warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
44
|
-
}, z.core.$strict>>>, z.ZodTransform<z.core.$InferOuterFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
|
|
45
|
-
size: z.ZodNumber;
|
|
46
|
-
integrity: z.ZodOptional<z.ZodString>;
|
|
47
|
-
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
48
|
-
url: z.ZodString;
|
|
49
|
-
}, z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
|
|
50
|
-
manifest: z.ZodArray<z.ZodObject<{
|
|
51
|
-
size: z.ZodNumber;
|
|
52
|
-
integrity: z.ZodOptional<z.ZodString>;
|
|
53
|
-
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
54
|
-
url: z.ZodString;
|
|
55
|
-
}, z.core.$strip>>;
|
|
56
|
-
warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
57
|
-
}, z.core.$strict>>, z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
|
|
58
|
-
size: z.ZodNumber;
|
|
59
|
-
integrity: z.ZodOptional<z.ZodString>;
|
|
60
|
-
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
61
|
-
url: z.ZodString;
|
|
62
|
-
}, z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
|
|
63
|
-
manifest: z.ZodArray<z.ZodObject<{
|
|
64
|
-
size: z.ZodNumber;
|
|
65
|
-
integrity: z.ZodOptional<z.ZodString>;
|
|
66
|
-
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
67
|
-
url: z.ZodString;
|
|
68
|
-
}, z.core.$strip>>;
|
|
69
|
-
warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
70
|
-
}, z.core.$strict>>>>>>;
|
|
71
|
-
maximumFileSizeToCacheInBytes: z.ZodDefault<z.ZodNumber>;
|
|
72
|
-
modifyURLPrefix: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
73
|
-
injectionPoint: z.ZodDefault<z.ZodString>;
|
|
74
|
-
swSrc: z.ZodString;
|
|
75
|
-
swDest: z.ZodString;
|
|
76
|
-
cacheOnNavigation: z.ZodDefault<z.ZodBoolean>;
|
|
77
|
-
disable: z.ZodDefault<z.ZodBoolean>;
|
|
78
|
-
register: z.ZodDefault<z.ZodBoolean>;
|
|
79
|
-
reloadOnOnline: z.ZodDefault<z.ZodBoolean>;
|
|
80
|
-
scope: z.ZodOptional<z.ZodString>;
|
|
81
|
-
swUrl: z.ZodDefault<z.ZodString>;
|
|
82
|
-
globPublicPatterns: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
83
|
-
compileSrc: z.ZodDefault<z.ZodBoolean>;
|
|
84
|
-
webpackCompilationPlugins: z.ZodOptional<z.ZodArray<z.ZodAny>>;
|
|
85
|
-
chunks: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
86
|
-
exclude: z.ZodDefault<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<RegExp, RegExp>, z.ZodPipe<z.ZodCustom<z.core.$InferInnerFunctionType<z.ZodTuple<[z.ZodAny], null>, z.ZodBoolean>, z.core.$InferInnerFunctionType<z.ZodTuple<[z.ZodAny], null>, z.ZodBoolean>>, z.ZodTransform<(args_0: any) => boolean, z.core.$InferInnerFunctionType<z.ZodTuple<[z.ZodAny], null>, z.ZodBoolean>>>]>>>;
|
|
87
|
-
excludeChunks: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
88
|
-
include: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodCustom<RegExp, RegExp>, z.ZodPipe<z.ZodCustom<z.core.$InferInnerFunctionType<z.ZodTuple<[z.ZodAny], null>, z.ZodBoolean>, z.core.$InferInnerFunctionType<z.ZodTuple<[z.ZodAny], null>, z.ZodBoolean>>, z.ZodTransform<(args_0: any) => boolean, z.core.$InferInnerFunctionType<z.ZodTuple<[z.ZodAny], null>, z.ZodBoolean>>>]>>>;
|
|
89
|
-
}, z.core.$strict>;
|
|
90
|
-
//# sourceMappingURL=schema.d.ts.map
|
package/dist/lib/schema.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/lib/schema.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,aAAa;;;;;;;;kBAQxB,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAMQ,CAAC"}
|
package/dist/lib/types.d.ts
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import type { RequiredSwDestPartial, RequiredSwDestResolved } from "@serwist/build";
|
|
2
|
-
import type { Require } from "@serwist/utils";
|
|
3
|
-
import type { InjectManifestOptions as WebpackInjectManifestOptions, InjectManifestOptionsComplete as WebpackInjectManifestOptionsComplete } from "@serwist/webpack-plugin";
|
|
4
|
-
export interface InjectPartial {
|
|
5
|
-
/**
|
|
6
|
-
* Enables additional route caching when users navigate through pages with
|
|
7
|
-
* `next/link`. This improves the user experience in some cases but it
|
|
8
|
-
* also adds a bit of overhead due to additional network calls.
|
|
9
|
-
* @default false
|
|
10
|
-
*/
|
|
11
|
-
cacheOnNavigation?: boolean;
|
|
12
|
-
/**
|
|
13
|
-
* Whether Serwist should be disabled.
|
|
14
|
-
* @default false
|
|
15
|
-
*/
|
|
16
|
-
disable?: boolean;
|
|
17
|
-
/**
|
|
18
|
-
* Whether `@serwist/next` should automatically register the service worker for you. If
|
|
19
|
-
* you want to register the service worker yourself, set this to `false` and run
|
|
20
|
-
* `window.serwist.register()` in `componentDidMount` or `useEffect`.
|
|
21
|
-
* @example
|
|
22
|
-
* ```tsx
|
|
23
|
-
* // app/register-pwa.tsx
|
|
24
|
-
* "use client";
|
|
25
|
-
* import { useEffect } from "react";
|
|
26
|
-
* import type { Serwist } from "@serwist/window";
|
|
27
|
-
*
|
|
28
|
-
* declare global {
|
|
29
|
-
* interface Window {
|
|
30
|
-
* serwist: Serwist;
|
|
31
|
-
* }
|
|
32
|
-
* }
|
|
33
|
-
*
|
|
34
|
-
* export default function RegisterPWA() {
|
|
35
|
-
* useEffect(() => {
|
|
36
|
-
* if ("serviceWorker" in navigator && window.serwist !== undefined) {
|
|
37
|
-
* window.serwist.register();
|
|
38
|
-
* }
|
|
39
|
-
* }, []);
|
|
40
|
-
* return <></>;
|
|
41
|
-
* }
|
|
42
|
-
*
|
|
43
|
-
* // app/layout.tsx
|
|
44
|
-
* import RegisterPWA from "./register-pwa";
|
|
45
|
-
*
|
|
46
|
-
* export default function RootLayout({
|
|
47
|
-
* children,
|
|
48
|
-
* }: {
|
|
49
|
-
* children: React.ReactNode;
|
|
50
|
-
* }) {
|
|
51
|
-
* return (
|
|
52
|
-
* <html lang="en">
|
|
53
|
-
* <head />
|
|
54
|
-
* <body>
|
|
55
|
-
* <RegisterPWA />
|
|
56
|
-
* {children}
|
|
57
|
-
* </body>
|
|
58
|
-
* </html>
|
|
59
|
-
* );
|
|
60
|
-
* }
|
|
61
|
-
* ```
|
|
62
|
-
* @default true
|
|
63
|
-
*/
|
|
64
|
-
register?: boolean;
|
|
65
|
-
/**
|
|
66
|
-
* Whether Serwist should reload the app when it goes online.
|
|
67
|
-
* @default true
|
|
68
|
-
*/
|
|
69
|
-
reloadOnOnline?: boolean;
|
|
70
|
-
/**
|
|
71
|
-
* The service worker's URL scope. Set to `/foo/` so that paths under `/foo/` are under the service
|
|
72
|
-
* worker's control while others are not.
|
|
73
|
-
* @default nextConfig.basePath
|
|
74
|
-
*/
|
|
75
|
-
scope?: string;
|
|
76
|
-
/**
|
|
77
|
-
* The URL to the service worker.
|
|
78
|
-
* @default "/sw.js"
|
|
79
|
-
*/
|
|
80
|
-
swUrl?: string;
|
|
81
|
-
/**
|
|
82
|
-
* Files in the public directory matching any of these patterns
|
|
83
|
-
* will be included in the precache manifest. For more information,
|
|
84
|
-
* see [`node-glob`'s Glob Primer](https://github.com/isaacs/node-glob#glob-primer).
|
|
85
|
-
* @default
|
|
86
|
-
* ```
|
|
87
|
-
* ["**\/*"]
|
|
88
|
-
* ```
|
|
89
|
-
*/
|
|
90
|
-
globPublicPatterns?: string[];
|
|
91
|
-
}
|
|
92
|
-
export type InjectResolved = Require<InjectPartial, "cacheOnNavigation" | "disable" | "register" | "reloadOnOnline" | "swUrl" | "globPublicPatterns">;
|
|
93
|
-
export type InjectManifestOptions = Omit<WebpackInjectManifestOptions & RequiredSwDestPartial & InjectPartial, "disablePrecacheManifest">;
|
|
94
|
-
export type InjectManifestOptionsComplete = Omit<WebpackInjectManifestOptionsComplete & RequiredSwDestResolved & InjectResolved, "disablePrecacheManifest">;
|
|
95
|
-
//# sourceMappingURL=types.d.ts.map
|
package/dist/lib/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/lib/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,sBAAsB,EAAE,MAAM,gBAAgB,CAAC;AACpF,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC9C,OAAO,KAAK,EACV,qBAAqB,IAAI,4BAA4B,EACrD,6BAA6B,IAAI,oCAAoC,EACtE,MAAM,yBAAyB,CAAC;AAEjC,MAAM,WAAW,aAAa;IAC5B;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA8CG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;;;;;;;OAQG;IACH,kBAAkB,CAAC,EAAE,MAAM,EAAE,CAAC;CAC/B;AAED,MAAM,MAAM,cAAc,GAAG,OAAO,CAAC,aAAa,EAAE,mBAAmB,GAAG,SAAS,GAAG,UAAU,GAAG,gBAAgB,GAAG,OAAO,GAAG,oBAAoB,CAAC,CAAC;AAEtJ,MAAM,MAAM,qBAAqB,GAAG,IAAI,CAAC,4BAA4B,GAAG,qBAAqB,GAAG,aAAa,EAAE,yBAAyB,CAAC,CAAC;AAE1I,MAAM,MAAM,6BAA6B,GAAG,IAAI,CAC9C,oCAAoC,GAAG,sBAAsB,GAAG,cAAc,EAC9E,yBAAyB,CAC1B,CAAC"}
|
package/dist/lib/validator.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../src/lib/validator.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,YAAY,CAAC;AAEhE,eAAO,MAAM,6BAA6B,GAAI,OAAO,OAAO,KAAG,6BAQ9D,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sw-entry-worker.d.ts","sourceRoot":"","sources":["../src/sw-entry-worker.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,WAAW,GACnB;IACE,IAAI,EAAE,wBAAwB,CAAC;IAC/B,GAAG,EAAE,GAAG,GAAG,MAAM,CAAC;CACnB,GACD;IACE,IAAI,EAAE,qBAAqB,CAAC;IAC5B,GAAG,EAAE,GAAG,GAAG,MAAM,CAAC;CACnB,CAAC"}
|
package/dist/sw-entry-worker.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
self.onmessage = async (ev)=>{
|
|
2
|
-
switch(ev.data.type){
|
|
3
|
-
case "__START_URL_CACHE__":
|
|
4
|
-
{
|
|
5
|
-
const url = ev.data.url;
|
|
6
|
-
const response = await fetch(url);
|
|
7
|
-
if (!response.redirected) {
|
|
8
|
-
const startUrlCache = await caches.open("start-url");
|
|
9
|
-
return startUrlCache.put(url, response);
|
|
10
|
-
}
|
|
11
|
-
return Promise.resolve();
|
|
12
|
-
}
|
|
13
|
-
case "__FRONTEND_NAV_CACHE__":
|
|
14
|
-
{
|
|
15
|
-
const url = ev.data.url;
|
|
16
|
-
const pagesCache = await caches.open("pages");
|
|
17
|
-
const isPageCached = !!await pagesCache.match(url, {
|
|
18
|
-
ignoreSearch: true
|
|
19
|
-
});
|
|
20
|
-
if (isPageCached) {
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
const page = await fetch(url);
|
|
24
|
-
if (!page.ok) {
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
pagesCache.put(url, page.clone());
|
|
28
|
-
return Promise.resolve();
|
|
29
|
-
}
|
|
30
|
-
default:
|
|
31
|
-
return Promise.resolve();
|
|
32
|
-
}
|
|
33
|
-
};
|