@serwist/next 9.0.0-preview.20 → 9.0.0-preview.24
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.d.ts.map +1 -1
- package/dist/index.js +3 -7
- package/dist/index.worker.js +2 -2
- package/dist/worker/defaultCache.d.ts +1 -1
- package/dist/worker/defaultCache.d.ts.map +1 -1
- package/package.json +12 -13
- package/src/index.ts +5 -9
- package/src/worker/defaultCache.ts +3 -3
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAIvC,OAAO,KAAK,EAAE,qBAAqB,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAC;AAC3F,OAAO,EAAE,6BAA6B,EAAE,MAAM,oBAAoB,CAAC;AAInE;;;;GAIG;AACH,QAAA,MAAM,eAAe,gBAAiB,qBAAqB,mBAAkB,UAAU,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAIvC,OAAO,KAAK,EAAE,qBAAqB,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAC;AAC3F,OAAO,EAAE,6BAA6B,EAAE,MAAM,oBAAoB,CAAC;AAInE;;;;GAIG;AACH,QAAA,MAAM,eAAe,gBAAiB,qBAAqB,mBAAkB,UAAU,KAAK,UAoN3F,CAAC;AAEF,eAAe,eAAe,CAAC;AAC/B,OAAO,EAAE,6BAA6B,EAAE,CAAC;AACzC,YAAY,EAAE,qBAAqB,IAAI,aAAa,EAAE,6BAA6B,IAAI,qBAAqB,EAAE,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -118,7 +118,6 @@ const withSerwistInit = (userOptions)=>{
|
|
|
118
118
|
if (!config.plugins) {
|
|
119
119
|
config.plugins = [];
|
|
120
120
|
}
|
|
121
|
-
event(`Compiling for ${options.isServer ? "server" : "client (static)"}...`);
|
|
122
121
|
const _sw = path.posix.join(basePath, swUrl);
|
|
123
122
|
const _scope = path.posix.join(scope, "/");
|
|
124
123
|
config.plugins.push(new webpack.DefinePlugin({
|
|
@@ -156,10 +155,9 @@ const withSerwistInit = (userOptions)=>{
|
|
|
156
155
|
};
|
|
157
156
|
if (!options.isServer) {
|
|
158
157
|
if (!register) {
|
|
159
|
-
info("
|
|
160
|
-
info(" window.serwist.register()");
|
|
158
|
+
info("The service worker will not be automatically registered, please call 'window.serwist.register()' in 'componentDidMount' or 'useEffect'.");
|
|
161
159
|
if (!tsConfigJson?.compilerOptions?.types?.includes("@serwist/next/typings")) {
|
|
162
|
-
info("You may also want to add '@serwist/next/typings' to
|
|
160
|
+
info("You may also want to add '@serwist/next/typings' to your TypeScript/JavaScript configuration file at 'compilerOptions.types'.");
|
|
163
161
|
}
|
|
164
162
|
}
|
|
165
163
|
const { swSrc: userSwSrc, swDest: userSwDest, additionalPrecacheEntries, exclude, manifestTransforms = [], ...otherBuildOptions } = buildOptions;
|
|
@@ -206,9 +204,7 @@ const withSerwistInit = (userOptions)=>{
|
|
|
206
204
|
config.plugins.push(new webpack.DefinePlugin({
|
|
207
205
|
"self.__SERWIST_SW_ENTRY.swEntryWorker": swEntryPublicPath && `'${swEntryPublicPath}'`
|
|
208
206
|
}));
|
|
209
|
-
|
|
210
|
-
info(` URL: ${_sw}`);
|
|
211
|
-
info(` Scope: ${_scope}`);
|
|
207
|
+
event(`Bundling the service worker script with the URL '${_sw}' and the scope '${_scope}'...`);
|
|
212
208
|
let resolvedManifestEntries = additionalPrecacheEntries;
|
|
213
209
|
if (!resolvedManifestEntries) {
|
|
214
210
|
const publicScan = globSync(globPublicPatterns, {
|
package/dist/index.worker.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ExpirationPlugin, RangeRequestsPlugin } from '
|
|
2
|
-
import { CacheFirst, StaleWhileRevalidate, NetworkFirst } from '
|
|
1
|
+
import { ExpirationPlugin, RangeRequestsPlugin } from 'serwist/plugins';
|
|
2
|
+
import { CacheFirst, StaleWhileRevalidate, NetworkFirst } from 'serwist/strategies';
|
|
3
3
|
|
|
4
4
|
const PAGES_CACHE_NAME = {
|
|
5
5
|
rscPrefetch: "pages-rsc-prefetch",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"defaultCache.d.ts","sourceRoot":"","sources":["../../src/worker/defaultCache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"defaultCache.d.ts","sourceRoot":"","sources":["../../src/worker/defaultCache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAM9C;;;;;GAKG;AACH,eAAO,MAAM,YAAY,EAAE,cAAc,EAiQlC,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.24",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A module that integrates Serwist into your Next.js application.",
|
|
6
6
|
"files": [
|
|
@@ -63,25 +63,24 @@
|
|
|
63
63
|
},
|
|
64
64
|
"dependencies": {
|
|
65
65
|
"chalk": "5.3.0",
|
|
66
|
-
"glob": "10.3.
|
|
66
|
+
"glob": "10.3.12",
|
|
67
67
|
"zod": "3.22.4",
|
|
68
|
-
"@serwist/build": "9.0.0-preview.
|
|
69
|
-
"@serwist/
|
|
70
|
-
"@serwist/
|
|
71
|
-
"
|
|
72
|
-
"@serwist/window": "9.0.0-preview.20"
|
|
68
|
+
"@serwist/build": "9.0.0-preview.24",
|
|
69
|
+
"@serwist/webpack-plugin": "9.0.0-preview.24",
|
|
70
|
+
"@serwist/window": "9.0.0-preview.24",
|
|
71
|
+
"serwist": "9.0.0-preview.24"
|
|
73
72
|
},
|
|
74
73
|
"devDependencies": {
|
|
75
|
-
"@types/node": "20.
|
|
74
|
+
"@types/node": "20.12.4",
|
|
76
75
|
"next": "14.1.4",
|
|
77
76
|
"react": "18.2.0",
|
|
78
77
|
"react-dom": "18.2.0",
|
|
79
|
-
"rollup": "4.
|
|
80
|
-
"type-fest": "4.
|
|
81
|
-
"typescript": "5.5.0-dev.
|
|
78
|
+
"rollup": "4.14.0",
|
|
79
|
+
"type-fest": "4.15.0",
|
|
80
|
+
"typescript": "5.5.0-dev.20240404",
|
|
82
81
|
"webpack": "5.91.0",
|
|
83
|
-
"@serwist/constants": "9.0.0-preview.
|
|
84
|
-
"@serwist/utils": "9.0.0-preview.
|
|
82
|
+
"@serwist/constants": "9.0.0-preview.24",
|
|
83
|
+
"@serwist/utils": "9.0.0-preview.24"
|
|
85
84
|
},
|
|
86
85
|
"peerDependencies": {
|
|
87
86
|
"next": ">=14.0.0",
|
package/src/index.ts
CHANGED
|
@@ -53,8 +53,6 @@ const withSerwistInit = (userOptions: InjectManifestOptions): ((nextConfig?: Nex
|
|
|
53
53
|
config.plugins = [];
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
logger.event(`Compiling for ${options.isServer ? "server" : "client (static)"}...`);
|
|
57
|
-
|
|
58
56
|
const _sw = path.posix.join(basePath, swUrl);
|
|
59
57
|
const _scope = path.posix.join(scope, "/");
|
|
60
58
|
|
|
@@ -92,13 +90,13 @@ const withSerwistInit = (userOptions: InjectManifestOptions): ((nextConfig?: Nex
|
|
|
92
90
|
if (!options.isServer) {
|
|
93
91
|
if (!register) {
|
|
94
92
|
logger.info(
|
|
95
|
-
"
|
|
93
|
+
"The service worker will not be automatically registered, please call 'window.serwist.register()' in 'componentDidMount' or 'useEffect'.",
|
|
96
94
|
);
|
|
97
95
|
|
|
98
|
-
logger.info(" window.serwist.register()");
|
|
99
|
-
|
|
100
96
|
if (!tsConfigJson?.compilerOptions?.types?.includes("@serwist/next/typings")) {
|
|
101
|
-
logger.info(
|
|
97
|
+
logger.info(
|
|
98
|
+
"You may also want to add '@serwist/next/typings' to your TypeScript/JavaScript configuration file at 'compilerOptions.types'.",
|
|
99
|
+
);
|
|
102
100
|
}
|
|
103
101
|
}
|
|
104
102
|
|
|
@@ -161,9 +159,7 @@ const withSerwistInit = (userOptions: InjectManifestOptions): ((nextConfig?: Nex
|
|
|
161
159
|
} satisfies Record<`${SerwistNextOptionsKey}.${Extract<keyof SerwistNextOptions, "swEntryWorker">}`, string | undefined>),
|
|
162
160
|
);
|
|
163
161
|
|
|
164
|
-
logger.
|
|
165
|
-
logger.info(` URL: ${_sw}`);
|
|
166
|
-
logger.info(` Scope: ${_scope}`);
|
|
162
|
+
logger.event(`Bundling the service worker script with the URL '${_sw}' and the scope '${_scope}'...`);
|
|
167
163
|
|
|
168
164
|
// Precache files in public folder
|
|
169
165
|
let resolvedManifestEntries = additionalPrecacheEntries;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { RuntimeCaching } from "
|
|
2
|
-
import { ExpirationPlugin, RangeRequestsPlugin } from "
|
|
3
|
-
import { CacheFirst, NetworkFirst, StaleWhileRevalidate } from "
|
|
1
|
+
import type { RuntimeCaching } from "serwist";
|
|
2
|
+
import { ExpirationPlugin, RangeRequestsPlugin } from "serwist/plugins";
|
|
3
|
+
import { CacheFirst, NetworkFirst, StaleWhileRevalidate } from "serwist/strategies";
|
|
4
4
|
|
|
5
5
|
import { PAGES_CACHE_NAME } from "./constants.js";
|
|
6
6
|
|