@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.
@@ -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,UAwN3F,CAAC;AAEF,eAAe,eAAe,CAAC;AAC/B,OAAO,EAAE,6BAA6B,EAAE,CAAC;AACzC,YAAY,EAAE,qBAAqB,IAAI,aAAa,EAAE,6BAA6B,IAAI,qBAAqB,EAAE,CAAC"}
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("Service worker won't be automatically registered as per the config, please call the following code in componentDidMount or useEffect:");
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 compilerOptions.types in your tsconfig.json/jsconfig.json.");
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
- info(`Service worker: ${swDest}`);
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, {
@@ -1,5 +1,5 @@
1
- import { ExpirationPlugin, RangeRequestsPlugin } from '@serwist/sw/plugins';
2
- import { CacheFirst, StaleWhileRevalidate, NetworkFirst } from '@serwist/sw/strategies';
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,4 +1,4 @@
1
- import type { RuntimeCaching } from "@serwist/sw";
1
+ import type { RuntimeCaching } from "serwist";
2
2
  /**
3
3
  * The default, recommended list of caching strategies for applications
4
4
  * built with Next.js.
@@ -1 +1 @@
1
- {"version":3,"file":"defaultCache.d.ts","sourceRoot":"","sources":["../../src/worker/defaultCache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAMlD;;;;;GAKG;AACH,eAAO,MAAM,YAAY,EAAE,cAAc,EAiQlC,CAAC"}
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.20",
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.10",
66
+ "glob": "10.3.12",
67
67
  "zod": "3.22.4",
68
- "@serwist/build": "9.0.0-preview.20",
69
- "@serwist/core": "9.0.0-preview.20",
70
- "@serwist/sw": "9.0.0-preview.20",
71
- "@serwist/webpack-plugin": "9.0.0-preview.20",
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.11.30",
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.13.0",
80
- "type-fest": "4.13.1",
81
- "typescript": "5.5.0-dev.20240323",
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.20",
84
- "@serwist/utils": "9.0.0-preview.20"
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
- "Service worker won't be automatically registered as per the config, please call the following code in componentDidMount or useEffect:",
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("You may also want to add '@serwist/next/typings' to compilerOptions.types in your tsconfig.json/jsconfig.json.");
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.info(`Service worker: ${swDest}`);
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 "@serwist/sw";
2
- import { ExpirationPlugin, RangeRequestsPlugin } from "@serwist/sw/plugins";
3
- import { CacheFirst, NetworkFirst, StaleWhileRevalidate } from "@serwist/sw/strategies";
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