@serwist/next 9.0.2 → 9.0.4

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,4 +1,4 @@
1
- import { CacheFirst, ExpirationPlugin, StaleWhileRevalidate, RangeRequestsPlugin, NetworkFirst } from 'serwist';
1
+ import { NetworkOnly, CacheFirst, ExpirationPlugin, StaleWhileRevalidate, RangeRequestsPlugin, NetworkFirst } from 'serwist';
2
2
 
3
3
  const PAGES_CACHE_NAME = {
4
4
  rscPrefetch: "pages-rsc-prefetch",
@@ -6,7 +6,12 @@ const PAGES_CACHE_NAME = {
6
6
  html: "pages"
7
7
  };
8
8
 
9
- const defaultCache = process.env.NODE_ENV !== "production" ? [] : [
9
+ const defaultCache = process.env.NODE_ENV !== "production" ? [
10
+ {
11
+ matcher: /.*/i,
12
+ handler: new NetworkOnly()
13
+ }
14
+ ] : [
10
15
  {
11
16
  matcher: /^https:\/\/fonts\.(?:gstatic)\.com\/.*/i,
12
17
  handler: new CacheFirst({
@@ -1 +1 @@
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,cAAe,CAAC,EAAE,MAAM,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,+BAQhE,CAAC"}
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,OAAO,CAAC,EAAE,MAAM,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,+BAQhE,CAAC"}
@@ -1,4 +1,3 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
1
  import type fs from "node:fs";
3
2
  export declare const getContentHash: (file: fs.PathOrFileDescriptor, isDev: boolean) => string;
4
3
  //# sourceMappingURL=get-content-hash.d.ts.map
@@ -1 +1 @@
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,SAAU,GAAG,oBAAoB,SAAS,OAAO,WAK3E,CAAC"}
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,SAAU,EAAE,CAAC,oBAAoB,SAAS,OAAO,WAK3E,CAAC"}
@@ -1,4 +1,3 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
1
  import fs from "node:fs";
3
2
  export declare const getFileHash: (file: fs.PathOrFileDescriptor) => string;
4
3
  //# sourceMappingURL=get-file-hash.d.ts.map
@@ -1 +1 @@
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,SAAU,GAAG,oBAAoB,WAAyE,CAAC"}
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,SAAU,EAAE,CAAC,oBAAoB,WAAyE,CAAC"}
@@ -24,11 +24,7 @@ export declare const injectPartial: z.ZodObject<{
24
24
  swUrl?: string | undefined;
25
25
  globPublicPatterns?: string[] | undefined;
26
26
  }>;
27
- export declare const injectManifestOptions: z.ZodObject<Omit<{
28
- chunks: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
29
- exclude: z.ZodDefault<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>, z.ZodFunction<z.ZodTuple<[z.ZodAny], null>, z.ZodBoolean>]>, "many">>;
30
- excludeChunks: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
31
- include: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>, z.ZodFunction<z.ZodTuple<[z.ZodAny], null>, z.ZodBoolean>]>, "many">>;
27
+ export declare const injectManifestOptions: z.ZodObject<Omit<z.objectUtil.extendShape<z.objectUtil.extendShape<z.objectUtil.extendShape<z.objectUtil.extendShape<z.objectUtil.extendShape<z.objectUtil.extendShape<{
32
28
  additionalPrecacheEntries: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
33
29
  integrity: z.ZodOptional<z.ZodString>;
34
30
  revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
@@ -44,12 +40,13 @@ export declare const injectManifestOptions: z.ZodObject<Omit<{
44
40
  }>]>, "many">>;
45
41
  disablePrecacheManifest: z.ZodDefault<z.ZodBoolean>;
46
42
  dontCacheBustURLsMatching: z.ZodOptional<z.ZodType<RegExp, z.ZodTypeDef, RegExp>>;
47
- manifestTransforms: z.ZodOptional<z.ZodArray<z.ZodFunction<z.ZodTuple<[z.ZodArray<z.ZodObject<{
43
+ manifestTransforms: z.ZodOptional<z.ZodArray<z.ZodFunction<z.ZodTuple<[z.ZodArray<z.ZodObject<z.objectUtil.extendShape<{
48
44
  integrity: z.ZodOptional<z.ZodString>;
49
45
  revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
50
46
  url: z.ZodString;
47
+ }, {
51
48
  size: z.ZodNumber;
52
- }, "strip", z.ZodTypeAny, {
49
+ }>, "strip", z.ZodTypeAny, {
53
50
  url: string;
54
51
  size: number;
55
52
  integrity?: string | undefined;
@@ -60,12 +57,13 @@ export declare const injectManifestOptions: z.ZodObject<Omit<{
60
57
  integrity?: string | undefined;
61
58
  revision?: string | null | undefined;
62
59
  }>, "many">, z.ZodOptional<z.ZodUnknown>], null>, z.ZodUnion<[z.ZodPromise<z.ZodObject<{
63
- manifest: z.ZodArray<z.ZodObject<{
60
+ manifest: z.ZodArray<z.ZodObject<z.objectUtil.extendShape<{
64
61
  integrity: z.ZodOptional<z.ZodString>;
65
62
  revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
66
63
  url: z.ZodString;
64
+ }, {
67
65
  size: z.ZodNumber;
68
- }, "strip", z.ZodTypeAny, {
66
+ }>, "strip", z.ZodTypeAny, {
69
67
  url: string;
70
68
  size: number;
71
69
  integrity?: string | undefined;
@@ -94,12 +92,13 @@ export declare const injectManifestOptions: z.ZodObject<Omit<{
94
92
  }[];
95
93
  warnings?: string[] | undefined;
96
94
  }>>, z.ZodObject<{
97
- manifest: z.ZodArray<z.ZodObject<{
95
+ manifest: z.ZodArray<z.ZodObject<z.objectUtil.extendShape<{
98
96
  integrity: z.ZodOptional<z.ZodString>;
99
97
  revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
100
98
  url: z.ZodString;
99
+ }, {
101
100
  size: z.ZodNumber;
102
- }, "strip", z.ZodTypeAny, {
101
+ }>, "strip", z.ZodTypeAny, {
103
102
  url: string;
104
103
  size: number;
105
104
  integrity?: string | undefined;
@@ -130,11 +129,23 @@ export declare const injectManifestOptions: z.ZodObject<Omit<{
130
129
  }>]>>, "many">>;
131
130
  maximumFileSizeToCacheInBytes: z.ZodDefault<z.ZodNumber>;
132
131
  modifyURLPrefix: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
132
+ }, {
133
+ chunks: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
134
+ exclude: z.ZodDefault<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>, z.ZodFunction<z.ZodTuple<[z.ZodAny], null>, z.ZodBoolean>]>, "many">>;
135
+ excludeChunks: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
136
+ include: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodType<RegExp, z.ZodTypeDef, RegExp>, z.ZodFunction<z.ZodTuple<[z.ZodAny], null>, z.ZodBoolean>]>, "many">>;
137
+ }>, {
133
138
  injectionPoint: z.ZodDefault<z.ZodString>;
134
139
  swSrc: z.ZodString;
140
+ }>, {
141
+ swDest: z.ZodOptional<z.ZodString>;
142
+ }>, {
135
143
  compileSrc: z.ZodDefault<z.ZodBoolean>;
136
- swDest: z.ZodString;
144
+ swDest: z.ZodOptional<z.ZodString>;
137
145
  webpackCompilationPlugins: z.ZodOptional<z.ZodArray<z.ZodAny, "many">>;
146
+ }>, {
147
+ swDest: z.ZodString;
148
+ }>, {
138
149
  cacheOnNavigation: z.ZodDefault<z.ZodBoolean>;
139
150
  disable: z.ZodDefault<z.ZodBoolean>;
140
151
  register: z.ZodDefault<z.ZodBoolean>;
@@ -142,23 +153,20 @@ export declare const injectManifestOptions: z.ZodObject<Omit<{
142
153
  scope: z.ZodOptional<z.ZodString>;
143
154
  swUrl: z.ZodDefault<z.ZodString>;
144
155
  globPublicPatterns: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
145
- }, "disablePrecacheManifest">, "strict", z.ZodTypeAny, {
156
+ }>, "disablePrecacheManifest">, "strict", z.ZodTypeAny, {
146
157
  cacheOnNavigation: boolean;
147
158
  disable: boolean;
148
159
  register: boolean;
149
160
  reloadOnOnline: boolean;
150
161
  swUrl: string;
151
162
  globPublicPatterns: string[];
152
- exclude: (string | RegExp | ((args_0: any) => boolean))[];
153
163
  maximumFileSizeToCacheInBytes: number;
164
+ exclude: (string | RegExp | ((args_0: any) => boolean))[];
154
165
  injectionPoint: string;
155
166
  swSrc: string;
156
- compileSrc: boolean;
157
167
  swDest: string;
168
+ compileSrc: boolean;
158
169
  scope?: string | undefined;
159
- chunks?: string[] | undefined;
160
- excludeChunks?: string[] | undefined;
161
- include?: (string | RegExp | ((args_0: any) => boolean))[] | undefined;
162
170
  additionalPrecacheEntries?: (string | {
163
171
  url: string;
164
172
  integrity?: string | undefined;
@@ -188,6 +196,9 @@ export declare const injectManifestOptions: z.ZodObject<Omit<{
188
196
  warnings?: string[] | undefined;
189
197
  }>)[] | undefined;
190
198
  modifyURLPrefix?: Record<string, string> | undefined;
199
+ chunks?: string[] | undefined;
200
+ excludeChunks?: string[] | undefined;
201
+ include?: (string | RegExp | ((args_0: any) => boolean))[] | undefined;
191
202
  webpackCompilationPlugins?: any[] | undefined;
192
203
  }, {
193
204
  swSrc: string;
@@ -199,10 +210,6 @@ export declare const injectManifestOptions: z.ZodObject<Omit<{
199
210
  scope?: string | undefined;
200
211
  swUrl?: string | undefined;
201
212
  globPublicPatterns?: string[] | undefined;
202
- chunks?: string[] | undefined;
203
- exclude?: (string | RegExp | ((args_0: any) => boolean))[] | undefined;
204
- excludeChunks?: string[] | undefined;
205
- include?: (string | RegExp | ((args_0: any) => boolean))[] | undefined;
206
213
  additionalPrecacheEntries?: (string | {
207
214
  url: string;
208
215
  integrity?: string | undefined;
@@ -233,6 +240,10 @@ export declare const injectManifestOptions: z.ZodObject<Omit<{
233
240
  }>)[] | undefined;
234
241
  maximumFileSizeToCacheInBytes?: number | undefined;
235
242
  modifyURLPrefix?: Record<string, string> | undefined;
243
+ chunks?: string[] | undefined;
244
+ exclude?: (string | RegExp | ((args_0: any) => boolean))[] | undefined;
245
+ excludeChunks?: string[] | undefined;
246
+ include?: (string | RegExp | ((args_0: any) => boolean))[] | undefined;
236
247
  injectionPoint?: string | undefined;
237
248
  compileSrc?: boolean | undefined;
238
249
  webpackCompilationPlugins?: any[] | undefined;
@@ -1 +1 @@
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;;;;;;;;;;;;;;;;;;;;;;;;EAU+C,CAAC;AAE1E,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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
- /// <reference types="node" resolution-mode="require"/>
2
1
  import fs from "node:fs";
3
2
  export declare const getFileHash: (file: fs.PathOrFileDescriptor) => string;
4
3
  export declare const getContentHash: (file: fs.PathOrFileDescriptor, isDev: boolean) => string;
@@ -1 +1 @@
1
- {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,SAAS,CAAC;AAEzB,eAAO,MAAM,WAAW,SAAU,GAAG,oBAAoB,WAAyE,CAAC;AAEnI,eAAO,MAAM,cAAc,SAAU,GAAG,oBAAoB,SAAS,OAAO,WAK3E,CAAC"}
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,SAAS,CAAC;AAEzB,eAAO,MAAM,WAAW,SAAU,EAAE,CAAC,oBAAoB,WAAyE,CAAC;AAEnI,eAAO,MAAM,cAAc,SAAU,EAAE,CAAC,oBAAoB,SAAS,OAAO,WAK3E,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"defaultCache.d.ts","sourceRoot":"","sources":["../../src/worker/defaultCache.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAK9C;;;;;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;AAK9C;;;;;GAKG;AACH,eAAO,MAAM,YAAY,EAAE,cAAc,EAsQlC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@serwist/next",
3
- "version": "9.0.2",
3
+ "version": "9.0.4",
4
4
  "type": "module",
5
5
  "description": "A module that integrates Serwist into your Next.js application.",
6
6
  "files": [
@@ -63,24 +63,24 @@
63
63
  },
64
64
  "dependencies": {
65
65
  "chalk": "5.3.0",
66
- "glob": "10.3.12",
67
- "zod": "3.22.4",
68
- "@serwist/build": "9.0.2",
69
- "@serwist/webpack-plugin": "9.0.2",
70
- "@serwist/window": "9.0.2",
71
- "serwist": "9.0.2"
66
+ "glob": "11.0.0",
67
+ "zod": "3.23.8",
68
+ "@serwist/build": "9.0.4",
69
+ "@serwist/webpack-plugin": "9.0.4",
70
+ "@serwist/window": "9.0.4",
71
+ "serwist": "9.0.4"
72
72
  },
73
73
  "devDependencies": {
74
- "@types/node": "20.12.7",
75
- "next": "14.2.1",
76
- "react": "18.2.0",
77
- "react-dom": "18.2.0",
78
- "rollup": "4.14.3",
79
- "type-fest": "4.15.0",
80
- "typescript": "5.5.0-dev.20240415",
81
- "webpack": "5.91.0",
82
- "@serwist/configs": "9.0.2",
83
- "@serwist/utils": "9.0.2"
74
+ "@types/node": "20.14.10",
75
+ "next": "14.2.5",
76
+ "react": "18.3.1",
77
+ "react-dom": "18.3.1",
78
+ "rollup": "4.18.1",
79
+ "type-fest": "4.21.0",
80
+ "typescript": "5.5.3",
81
+ "webpack": "5.93.0",
82
+ "@serwist/configs": "9.0.4",
83
+ "@serwist/utils": "9.0.4"
84
84
  },
85
85
  "peerDependencies": {
86
86
  "next": ">=14.0.0",
@@ -1,5 +1,5 @@
1
1
  import type { RuntimeCaching } from "serwist";
2
- import { CacheFirst, ExpirationPlugin, NetworkFirst, RangeRequestsPlugin, StaleWhileRevalidate } from "serwist";
2
+ import { CacheFirst, ExpirationPlugin, NetworkFirst, NetworkOnly, RangeRequestsPlugin, StaleWhileRevalidate } from "serwist";
3
3
 
4
4
  import { PAGES_CACHE_NAME } from "./constants.js";
5
5
 
@@ -11,7 +11,12 @@ import { PAGES_CACHE_NAME } from "./constants.js";
11
11
  */
12
12
  export const defaultCache: RuntimeCaching[] =
13
13
  process.env.NODE_ENV !== "production"
14
- ? []
14
+ ? [
15
+ {
16
+ matcher: /.*/i,
17
+ handler: new NetworkOnly(),
18
+ },
19
+ ]
15
20
  : [
16
21
  {
17
22
  matcher: /^https:\/\/fonts\.(?:gstatic)\.com\/.*/i,