@serwist/next 9.0.15 → 9.1.0

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.
@@ -2,7 +2,7 @@ import { requiredSwDestPartial } from '@serwist/build/schema';
2
2
  import { injectManifestOptions as injectManifestOptions$1 } from '@serwist/webpack-plugin/schema';
3
3
  import { z } from 'zod';
4
4
 
5
- const injectPartial = z.object({
5
+ const injectPartial = z.strictObject({
6
6
  cacheOnNavigation: z.boolean().default(false),
7
7
  disable: z.boolean().default(false),
8
8
  register: z.boolean().default(true),
@@ -12,9 +12,13 @@ const injectPartial = z.object({
12
12
  globPublicPatterns: z.array(z.string()).default([
13
13
  "**/*"
14
14
  ])
15
- }).strict("Do not pass invalid properties to NextInjectManifestPartial!");
16
- const injectManifestOptions = injectManifestOptions$1.merge(requiredSwDestPartial).merge(injectPartial).omit({
15
+ });
16
+ const injectManifestOptions = z.strictObject({
17
+ ...injectManifestOptions$1.shape,
18
+ ...requiredSwDestPartial.shape,
19
+ ...injectPartial.shape
20
+ }).omit({
17
21
  disablePrecacheManifest: true
18
- }).strict("Do not pass invalid properties to NextInjectManifestOptions!");
22
+ });
19
23
 
20
24
  export { injectManifestOptions as a, injectPartial as i };
package/dist/index.js CHANGED
@@ -8,9 +8,9 @@ import crypto from 'node:crypto';
8
8
  import { createRequire } from 'node:module';
9
9
  import chalk from 'chalk';
10
10
  import { validationErrorMap, SerwistConfigError } from '@serwist/build/schema';
11
+ import { z } from 'zod';
11
12
  import { a as injectManifestOptions } from './chunks/schema.js';
12
13
  import '@serwist/webpack-plugin/schema';
13
- import 'zod';
14
14
 
15
15
  const findFirstTruthy = (arr, fn)=>{
16
16
  for (const i of arr){
@@ -86,12 +86,12 @@ const event = (...message)=>{
86
86
 
87
87
  const validateInjectManifestOptions = (input)=>{
88
88
  const result = injectManifestOptions.safeParse(input, {
89
- errorMap: validationErrorMap
89
+ error: validationErrorMap
90
90
  });
91
91
  if (!result.success) {
92
92
  throw new SerwistConfigError({
93
93
  moduleName: "@serwist/next",
94
- message: JSON.stringify(result.error.format(), null, 2)
94
+ message: z.prettifyError(result.error)
95
95
  });
96
96
  }
97
97
  return result.data;
@@ -193,8 +193,8 @@ const withSerwistInit = (userOptions)=>{
193
193
  });
194
194
  }
195
195
  const shouldBuildSWEntryWorker = cacheOnNavigation;
196
- let swEntryPublicPath = undefined;
197
- let swEntryWorkerDest = undefined;
196
+ let swEntryPublicPath;
197
+ let swEntryWorkerDest;
198
198
  if (shouldBuildSWEntryWorker) {
199
199
  const swEntryWorkerSrc = path.join(dirname, "sw-entry-worker.js");
200
200
  const swEntryName = `swe-worker-${getContentHash(swEntryWorkerSrc, dev)}.js`;
@@ -236,7 +236,7 @@ const withSerwistInit = (userOptions)=>{
236
236
  ({ asset, compilation })=>{
237
237
  const swDestRelativeOutput = relativeToOutputPath(compilation, swDest);
238
238
  const swAsset = compilation.getAsset(swDestRelativeOutput);
239
- return asset.name === swAsset?.name || asset.name.startsWith("server/") || /^[^\/]*\.json$/.test(asset.name) || dev && !asset.name.startsWith("static/runtime/");
239
+ return asset.name === swAsset?.name || asset.name.startsWith("server/") || /^[^/]*\.json$/.test(asset.name) || dev && !asset.name.startsWith("static/runtime/");
240
240
  }
241
241
  ],
242
242
  manifestTransforms: [
@@ -6,240 +6,85 @@ export declare const injectPartial: z.ZodObject<{
6
6
  reloadOnOnline: z.ZodDefault<z.ZodBoolean>;
7
7
  scope: z.ZodOptional<z.ZodString>;
8
8
  swUrl: z.ZodDefault<z.ZodString>;
9
- globPublicPatterns: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
10
- }, "strict", z.ZodTypeAny, {
11
- cacheOnNavigation: boolean;
12
- disable: boolean;
13
- register: boolean;
14
- reloadOnOnline: boolean;
15
- swUrl: string;
16
- globPublicPatterns: string[];
17
- scope?: string | undefined;
18
- }, {
19
- cacheOnNavigation?: boolean | undefined;
20
- disable?: boolean | undefined;
21
- register?: boolean | undefined;
22
- reloadOnOnline?: boolean | undefined;
23
- scope?: string | undefined;
24
- swUrl?: string | undefined;
25
- globPublicPatterns?: string[] | undefined;
26
- }>;
27
- export declare const injectManifestOptions: z.ZodObject<Omit<{
28
- additionalPrecacheEntries: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
9
+ globPublicPatterns: z.ZodDefault<z.ZodArray<z.ZodString>>;
10
+ }, z.core.$strict>;
11
+ export declare const injectManifestOptions: z.ZodObject<{
12
+ cacheOnNavigation: z.ZodDefault<z.ZodBoolean>;
13
+ disable: z.ZodDefault<z.ZodBoolean>;
14
+ register: z.ZodDefault<z.ZodBoolean>;
15
+ reloadOnOnline: z.ZodDefault<z.ZodBoolean>;
16
+ scope: z.ZodOptional<z.ZodString>;
17
+ swUrl: z.ZodDefault<z.ZodString>;
18
+ globPublicPatterns: z.ZodDefault<z.ZodArray<z.ZodString>>;
19
+ swDest: z.ZodString;
20
+ compileSrc: z.ZodDefault<z.ZodBoolean>;
21
+ webpackCompilationPlugins: z.ZodOptional<z.ZodArray<z.ZodAny>>;
22
+ injectionPoint: z.ZodDefault<z.ZodString>;
23
+ swSrc: z.ZodString;
24
+ chunks: z.ZodOptional<z.ZodArray<z.ZodString>>;
25
+ 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>>>]>>>;
26
+ excludeChunks: z.ZodOptional<z.ZodArray<z.ZodString>>;
27
+ 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>>>]>>>;
28
+ additionalPrecacheEntries: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
29
29
  integrity: z.ZodOptional<z.ZodString>;
30
30
  revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
31
31
  url: z.ZodString;
32
- }, "strict", z.ZodTypeAny, {
33
- url: string;
34
- integrity?: string | undefined;
35
- revision?: string | null | undefined;
36
- }, {
37
- url: string;
38
- integrity?: string | undefined;
39
- revision?: string | null | undefined;
40
- }>]>, "many">>;
41
- disablePrecacheManifest: z.ZodDefault<z.ZodBoolean>;
42
- dontCacheBustURLsMatching: z.ZodOptional<z.ZodType<RegExp, z.ZodTypeDef, RegExp>>;
43
- manifestTransforms: z.ZodOptional<z.ZodArray<z.ZodFunction<z.ZodTuple<[z.ZodArray<z.ZodObject<{
32
+ }, z.core.$strict>]>>>;
33
+ dontCacheBustURLsMatching: z.ZodOptional<z.ZodCustom<RegExp, RegExp>>;
34
+ manifestTransforms: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodCustom<z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
35
+ size: z.ZodNumber;
44
36
  integrity: z.ZodOptional<z.ZodString>;
45
37
  revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
46
38
  url: z.ZodString;
47
- } & {
48
- size: z.ZodNumber;
49
- }, "strip", z.ZodTypeAny, {
50
- url: string;
51
- size: number;
52
- integrity?: string | undefined;
53
- revision?: string | null | undefined;
54
- }, {
55
- url: string;
56
- size: number;
57
- integrity?: string | undefined;
58
- revision?: string | null | undefined;
59
- }>, "many">, z.ZodOptional<z.ZodUnknown>], null>, z.ZodUnion<[z.ZodPromise<z.ZodObject<{
39
+ }, z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
60
40
  manifest: z.ZodArray<z.ZodObject<{
41
+ size: z.ZodNumber;
61
42
  integrity: z.ZodOptional<z.ZodString>;
62
43
  revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
63
44
  url: z.ZodString;
64
- } & {
45
+ }, z.core.$strip>>;
46
+ warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
47
+ }, z.core.$strict>>, z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
48
+ size: z.ZodNumber;
49
+ integrity: z.ZodOptional<z.ZodString>;
50
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
51
+ url: z.ZodString;
52
+ }, z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
53
+ manifest: z.ZodArray<z.ZodObject<{
65
54
  size: z.ZodNumber;
66
- }, "strip", z.ZodTypeAny, {
67
- url: string;
68
- size: number;
69
- integrity?: string | undefined;
70
- revision?: string | null | undefined;
71
- }, {
72
- url: string;
73
- size: number;
74
- integrity?: string | undefined;
75
- revision?: string | null | undefined;
76
- }>, "many">;
77
- warnings: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
78
- }, "strict", z.ZodTypeAny, {
79
- manifest: {
80
- url: string;
81
- size: number;
82
- integrity?: string | undefined;
83
- revision?: string | null | undefined;
84
- }[];
85
- warnings?: string[] | undefined;
86
- }, {
87
- manifest: {
88
- url: string;
89
- size: number;
90
- integrity?: string | undefined;
91
- revision?: string | null | undefined;
92
- }[];
93
- warnings?: string[] | undefined;
94
- }>>, z.ZodObject<{
55
+ integrity: z.ZodOptional<z.ZodString>;
56
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
57
+ url: z.ZodString;
58
+ }, z.core.$strip>>;
59
+ warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
60
+ }, z.core.$strict>>>, z.ZodTransform<z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
61
+ size: z.ZodNumber;
62
+ integrity: z.ZodOptional<z.ZodString>;
63
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
64
+ url: z.ZodString;
65
+ }, z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
95
66
  manifest: z.ZodArray<z.ZodObject<{
67
+ size: z.ZodNumber;
96
68
  integrity: z.ZodOptional<z.ZodString>;
97
69
  revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
98
70
  url: z.ZodString;
99
- } & {
71
+ }, z.core.$strip>>;
72
+ warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
73
+ }, z.core.$strict>>, z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
74
+ size: z.ZodNumber;
75
+ integrity: z.ZodOptional<z.ZodString>;
76
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
77
+ url: z.ZodString;
78
+ }, z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
79
+ manifest: z.ZodArray<z.ZodObject<{
100
80
  size: z.ZodNumber;
101
- }, "strip", z.ZodTypeAny, {
102
- url: string;
103
- size: number;
104
- integrity?: string | undefined;
105
- revision?: string | null | undefined;
106
- }, {
107
- url: string;
108
- size: number;
109
- integrity?: string | undefined;
110
- revision?: string | null | undefined;
111
- }>, "many">;
112
- warnings: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
113
- }, "strict", z.ZodTypeAny, {
114
- manifest: {
115
- url: string;
116
- size: number;
117
- integrity?: string | undefined;
118
- revision?: string | null | undefined;
119
- }[];
120
- warnings?: string[] | undefined;
121
- }, {
122
- manifest: {
123
- url: string;
124
- size: number;
125
- integrity?: string | undefined;
126
- revision?: string | null | undefined;
127
- }[];
128
- warnings?: string[] | undefined;
129
- }>]>>, "many">>;
81
+ integrity: z.ZodOptional<z.ZodString>;
82
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
83
+ url: z.ZodString;
84
+ }, z.core.$strip>>;
85
+ warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
86
+ }, z.core.$strict>>>>>>;
130
87
  maximumFileSizeToCacheInBytes: z.ZodDefault<z.ZodNumber>;
131
88
  modifyURLPrefix: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
132
- chunks: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
133
- 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">>;
134
- excludeChunks: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
135
- 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">>;
136
- injectionPoint: z.ZodDefault<z.ZodString>;
137
- swSrc: z.ZodString;
138
- compileSrc: z.ZodDefault<z.ZodBoolean>;
139
- webpackCompilationPlugins: z.ZodOptional<z.ZodArray<z.ZodAny, "many">>;
140
- } & {
141
- swDest: z.ZodString;
142
- } & {
143
- cacheOnNavigation: z.ZodDefault<z.ZodBoolean>;
144
- disable: z.ZodDefault<z.ZodBoolean>;
145
- register: z.ZodDefault<z.ZodBoolean>;
146
- reloadOnOnline: z.ZodDefault<z.ZodBoolean>;
147
- scope: z.ZodOptional<z.ZodString>;
148
- swUrl: z.ZodDefault<z.ZodString>;
149
- globPublicPatterns: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
150
- }, "disablePrecacheManifest">, "strict", z.ZodTypeAny, {
151
- cacheOnNavigation: boolean;
152
- disable: boolean;
153
- register: boolean;
154
- reloadOnOnline: boolean;
155
- swUrl: string;
156
- globPublicPatterns: string[];
157
- maximumFileSizeToCacheInBytes: number;
158
- exclude: (string | RegExp | ((args_0: any) => boolean))[];
159
- injectionPoint: string;
160
- swSrc: string;
161
- compileSrc: boolean;
162
- swDest: string;
163
- scope?: string | undefined;
164
- additionalPrecacheEntries?: (string | {
165
- url: string;
166
- integrity?: string | undefined;
167
- revision?: string | null | undefined;
168
- })[] | undefined;
169
- dontCacheBustURLsMatching?: RegExp | undefined;
170
- manifestTransforms?: ((args_0: {
171
- url: string;
172
- size: number;
173
- integrity?: string | undefined;
174
- revision?: string | null | undefined;
175
- }[], args_1: unknown) => {
176
- manifest: {
177
- url: string;
178
- size: number;
179
- integrity?: string | undefined;
180
- revision?: string | null | undefined;
181
- }[];
182
- warnings?: string[] | undefined;
183
- } | Promise<{
184
- manifest: {
185
- url: string;
186
- size: number;
187
- integrity?: string | undefined;
188
- revision?: string | null | undefined;
189
- }[];
190
- warnings?: string[] | undefined;
191
- }>)[] | undefined;
192
- modifyURLPrefix?: Record<string, string> | undefined;
193
- chunks?: string[] | undefined;
194
- excludeChunks?: string[] | undefined;
195
- include?: (string | RegExp | ((args_0: any) => boolean))[] | undefined;
196
- webpackCompilationPlugins?: any[] | undefined;
197
- }, {
198
- swSrc: string;
199
- swDest: string;
200
- cacheOnNavigation?: boolean | undefined;
201
- disable?: boolean | undefined;
202
- register?: boolean | undefined;
203
- reloadOnOnline?: boolean | undefined;
204
- scope?: string | undefined;
205
- swUrl?: string | undefined;
206
- globPublicPatterns?: string[] | undefined;
207
- additionalPrecacheEntries?: (string | {
208
- url: string;
209
- integrity?: string | undefined;
210
- revision?: string | null | undefined;
211
- })[] | undefined;
212
- dontCacheBustURLsMatching?: RegExp | undefined;
213
- manifestTransforms?: ((args_0: {
214
- url: string;
215
- size: number;
216
- integrity?: string | undefined;
217
- revision?: string | null | undefined;
218
- }[], args_1: unknown) => {
219
- manifest: {
220
- url: string;
221
- size: number;
222
- integrity?: string | undefined;
223
- revision?: string | null | undefined;
224
- }[];
225
- warnings?: string[] | undefined;
226
- } | Promise<{
227
- manifest: {
228
- url: string;
229
- size: number;
230
- integrity?: string | undefined;
231
- revision?: string | null | undefined;
232
- }[];
233
- warnings?: string[] | undefined;
234
- }>)[] | undefined;
235
- maximumFileSizeToCacheInBytes?: number | undefined;
236
- modifyURLPrefix?: Record<string, string> | undefined;
237
- chunks?: string[] | undefined;
238
- exclude?: (string | RegExp | ((args_0: any) => boolean))[] | undefined;
239
- excludeChunks?: string[] | undefined;
240
- include?: (string | RegExp | ((args_0: any) => boolean))[] | undefined;
241
- injectionPoint?: string | undefined;
242
- compileSrc?: boolean | undefined;
243
- webpackCompilationPlugins?: any[] | undefined;
244
- }>;
89
+ }, z.core.$strict>;
245
90
  //# sourceMappingURL=schema.d.ts.map
@@ -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;;;;;;;iBAKm8B,CAAC;gBAAsC,CAAC;;;iBAA4E,CAAC;gBAAsC,CAAC;;;;;;;;;;;;;iBAA4iB,CAAC;gBAAsC,CAAC;;;;iBAAkG,CAAC;gBAAsC,CAAC;;;;;;;;;;;qBAAgd,CAAC;oBAA0C,CAAC;;;;qBAAkH,CAAC;oBAA0C,CAAC;;;;;;;qBAAiP,CAAC;oBAA0C,CAAC;;gBAA0D,CAAC;;;;;qBAA6H,CAAC;oBAA0C,CAAC;;gBAA0D,CAAC;;;;;;;;;;;qBAAqY,CAAC;oBAA0C,CAAC;;;;qBAAkH,CAAC;oBAA0C,CAAC;;;;;;;qBAAiP,CAAC;oBAA0C,CAAC;;gBAA0D,CAAC;;;;;qBAA6H,CAAC;oBAA0C,CAAC;;gBAA0D,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAA3U,CAAC;oBAA0C,CAAC;;;;;;;qBAAvrC,CAAC;oBAA0C,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAAm0C,CAAC;oBAA0C,CAAC;;;;;;;qBAAvrC,CAAC;oBAA0C,CAAC;;;;;;;;;;;;;EADj7F,CAAC"}
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"}
@@ -1 +1 @@
1
- {"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../src/lib/validator.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,6BAA6B,EAAE,MAAM,YAAY,CAAC;AAEhE,eAAO,MAAM,6BAA6B,GAAI,OAAO,OAAO,KAAG,6BAQ9D,CAAC"}
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"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@serwist/next",
3
- "version": "9.0.15",
3
+ "version": "9.1.0",
4
4
  "type": "module",
5
5
  "description": "A module that integrates Serwist into your Next.js application.",
6
6
  "files": [
@@ -64,23 +64,23 @@
64
64
  "dependencies": {
65
65
  "chalk": "5.4.1",
66
66
  "glob": "10.4.5",
67
- "zod": "3.25.63",
68
- "@serwist/build": "9.0.15",
69
- "@serwist/webpack-plugin": "9.0.15",
70
- "@serwist/window": "9.0.15",
71
- "serwist": "9.0.15"
67
+ "zod": "4.0.5",
68
+ "@serwist/build": "9.1.0",
69
+ "@serwist/webpack-plugin": "9.1.0",
70
+ "@serwist/window": "9.1.0",
71
+ "serwist": "9.1.0"
72
72
  },
73
73
  "devDependencies": {
74
- "@types/node": "24.0.1",
75
- "next": "15.3.3",
74
+ "@types/node": "24.0.14",
75
+ "next": "15.4.1",
76
76
  "react": "19.1.0",
77
77
  "react-dom": "19.1.0",
78
- "rollup": "4.43.0",
78
+ "rollup": "4.45.1",
79
79
  "type-fest": "4.41.0",
80
80
  "typescript": "5.8.3",
81
- "webpack": "5.99.9",
82
- "@serwist/configs": "9.0.15",
83
- "@serwist/utils": "9.0.15"
81
+ "webpack": "5.100.2",
82
+ "@serwist/configs": "9.1.0",
83
+ "@serwist/utils": "9.1.0"
84
84
  },
85
85
  "peerDependencies": {
86
86
  "next": ">=14.0.0",
package/src/index.ts CHANGED
@@ -146,8 +146,8 @@ const withSerwistInit = (userOptions: InjectManifestOptions): ((nextConfig?: Nex
146
146
  }
147
147
 
148
148
  const shouldBuildSWEntryWorker = cacheOnNavigation;
149
- let swEntryPublicPath: string | undefined = undefined;
150
- let swEntryWorkerDest: string | undefined = undefined;
149
+ let swEntryPublicPath: string | undefined;
150
+ let swEntryWorkerDest: string | undefined;
151
151
 
152
152
  if (shouldBuildSWEntryWorker) {
153
153
  const swEntryWorkerSrc = path.join(dirname, "sw-entry-worker.js");
@@ -206,7 +206,7 @@ const withSerwistInit = (userOptions: InjectManifestOptions): ((nextConfig?: Nex
206
206
  // This excludes all JSON files in the compilation directory by filtering
207
207
  // out paths that have slashes or don't end with `.json`. Only said files
208
208
  // match this criterion.
209
- /^[^\/]*\.json$/.test(asset.name) ||
209
+ /^[^/]*\.json$/.test(asset.name) ||
210
210
  (dev && !asset.name.startsWith("static/runtime/"))
211
211
  );
212
212
  },
package/src/lib/schema.ts CHANGED
@@ -2,20 +2,20 @@ import { requiredSwDestPartial } from "@serwist/build/schema";
2
2
  import { injectManifestOptions as webpackInjectManifestOptions } from "@serwist/webpack-plugin/schema";
3
3
  import { z } from "zod";
4
4
 
5
- export const injectPartial = z
6
- .object({
7
- cacheOnNavigation: z.boolean().default(false),
8
- disable: z.boolean().default(false),
9
- register: z.boolean().default(true),
10
- reloadOnOnline: z.boolean().default(true),
11
- scope: z.string().optional(),
12
- swUrl: z.string().default("/sw.js"),
13
- globPublicPatterns: z.array(z.string()).default(["**/*"]),
14
- })
15
- .strict("Do not pass invalid properties to NextInjectManifestPartial!");
5
+ export const injectPartial = z.strictObject({
6
+ cacheOnNavigation: z.boolean().default(false),
7
+ disable: z.boolean().default(false),
8
+ register: z.boolean().default(true),
9
+ reloadOnOnline: z.boolean().default(true),
10
+ scope: z.string().optional(),
11
+ swUrl: z.string().default("/sw.js"),
12
+ globPublicPatterns: z.array(z.string()).default(["**/*"]),
13
+ });
16
14
 
17
- export const injectManifestOptions = webpackInjectManifestOptions
18
- .merge(requiredSwDestPartial)
19
- .merge(injectPartial)
20
- .omit({ disablePrecacheManifest: true })
21
- .strict("Do not pass invalid properties to NextInjectManifestOptions!");
15
+ export const injectManifestOptions = z
16
+ .strictObject({
17
+ ...webpackInjectManifestOptions.shape,
18
+ ...requiredSwDestPartial.shape,
19
+ ...injectPartial.shape,
20
+ })
21
+ .omit({ disablePrecacheManifest: true });
@@ -1,13 +1,14 @@
1
1
  import { SerwistConfigError, validationErrorMap } from "@serwist/build/schema";
2
+ import { z } from "zod";
2
3
  import { injectManifestOptions } from "./schema.js";
3
4
  import type { InjectManifestOptionsComplete } from "./types.js";
4
5
 
5
6
  export const validateInjectManifestOptions = (input: unknown): InjectManifestOptionsComplete => {
6
7
  const result = injectManifestOptions.safeParse(input, {
7
- errorMap: validationErrorMap,
8
+ error: validationErrorMap,
8
9
  });
9
10
  if (!result.success) {
10
- throw new SerwistConfigError({ moduleName: "@serwist/next", message: JSON.stringify(result.error.format(), null, 2) });
11
+ throw new SerwistConfigError({ moduleName: "@serwist/next", message: z.prettifyError(result.error) });
11
12
  }
12
13
  return result.data;
13
14
  };