@serwist/build 9.0.0-preview.12 → 9.0.0-preview.14

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.
Files changed (46) hide show
  1. package/dist/chunks/glob.js +2 -2
  2. package/dist/chunks/injectManifest.js +5 -5
  3. package/dist/index.d.ts +2 -2
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/index.js +2 -26
  6. package/dist/index.schema.d.ts +13 -0
  7. package/dist/index.schema.d.ts.map +1 -0
  8. package/dist/index.schema.js +9 -0
  9. package/dist/lib/validate-options.d.ts +1 -3
  10. package/dist/lib/validate-options.d.ts.map +1 -1
  11. package/dist/schema/assertType.d.ts +1 -0
  12. package/dist/schema/assertType.d.ts.map +1 -1
  13. package/dist/schema/injectManifest.d.ts +3 -3
  14. package/dist/schema/injectManifest.d.ts.map +1 -1
  15. package/dist/{lib/serwist-config-error.d.ts → schema/serwistConfigError.d.ts} +1 -1
  16. package/dist/schema/serwistConfigError.d.ts.map +1 -0
  17. package/dist/types.d.ts +0 -143
  18. package/dist/types.d.ts.map +1 -1
  19. package/package.json +13 -21
  20. package/src/index.schema.ts +29 -0
  21. package/src/index.ts +2 -3
  22. package/src/lib/validate-options.ts +2 -23
  23. package/src/schema/assertType.ts +2 -0
  24. package/src/schema/injectManifest.ts +4 -4
  25. package/src/types.ts +0 -175
  26. package/dist/chunks/vite.js +0 -7
  27. package/dist/chunks/webpack.js +0 -33
  28. package/dist/index.next.d.ts +0 -3
  29. package/dist/index.next.d.ts.map +0 -1
  30. package/dist/index.next.js +0 -38
  31. package/dist/lib/serwist-config-error.d.ts.map +0 -1
  32. package/dist/lib/validate-next-options.d.ts +0 -3
  33. package/dist/lib/validate-next-options.d.ts.map +0 -1
  34. package/dist/schema/next.d.ts +0 -240
  35. package/dist/schema/next.d.ts.map +0 -1
  36. package/dist/schema/vite.d.ts +0 -196
  37. package/dist/schema/vite.d.ts.map +0 -1
  38. package/dist/schema/webpack.d.ts +0 -225
  39. package/dist/schema/webpack.d.ts.map +0 -1
  40. package/src/index.next.ts +0 -3
  41. package/src/lib/validate-next-options.ts +0 -14
  42. package/src/schema/next.ts +0 -33
  43. package/src/schema/vite.ts +0 -18
  44. package/src/schema/webpack.ts +0 -46
  45. package/dist/chunks/{serwist-config-error.js → validationErrorMap.js} +7 -7
  46. /package/src/{lib/serwist-config-error.ts → schema/serwistConfigError.ts} +0 -0
@@ -1,196 +0,0 @@
1
- import type { z } from "zod";
2
- export declare const viteInjectManifestOptions: z.ZodObject<{
3
- disablePrecacheManifest: z.ZodDefault<z.ZodBoolean>;
4
- maximumFileSizeToCacheInBytes: z.ZodDefault<z.ZodNumber>;
5
- additionalPrecacheEntries: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
6
- integrity: z.ZodOptional<z.ZodString>;
7
- revision: z.ZodNullable<z.ZodString>;
8
- url: z.ZodString;
9
- }, "strict", z.ZodTypeAny, {
10
- revision: string | null;
11
- url: string;
12
- integrity?: string | undefined;
13
- }, {
14
- revision: string | null;
15
- url: string;
16
- integrity?: string | undefined;
17
- }>]>, "many">>;
18
- dontCacheBustURLsMatching: z.ZodOptional<z.ZodType<RegExp, z.ZodTypeDef, RegExp>>;
19
- manifestTransforms: z.ZodOptional<z.ZodArray<z.ZodFunction<z.ZodTuple<[z.ZodArray<z.ZodObject<{
20
- integrity: z.ZodOptional<z.ZodString>;
21
- revision: z.ZodNullable<z.ZodString>;
22
- url: z.ZodString;
23
- size: z.ZodNumber;
24
- }, "strip", z.ZodTypeAny, {
25
- revision: string | null;
26
- url: string;
27
- size: number;
28
- integrity?: string | undefined;
29
- }, {
30
- revision: string | null;
31
- url: string;
32
- size: number;
33
- integrity?: string | undefined;
34
- }>, "many">, z.ZodOptional<z.ZodUnknown>], null>, z.ZodUnion<[z.ZodPromise<z.ZodObject<{
35
- manifest: z.ZodArray<z.ZodObject<{
36
- integrity: z.ZodOptional<z.ZodString>;
37
- revision: z.ZodNullable<z.ZodString>;
38
- url: z.ZodString;
39
- size: z.ZodNumber;
40
- }, "strip", z.ZodTypeAny, {
41
- revision: string | null;
42
- url: string;
43
- size: number;
44
- integrity?: string | undefined;
45
- }, {
46
- revision: string | null;
47
- url: string;
48
- size: number;
49
- integrity?: string | undefined;
50
- }>, "many">;
51
- warnings: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
52
- }, "strict", z.ZodTypeAny, {
53
- manifest: {
54
- revision: string | null;
55
- url: string;
56
- size: number;
57
- integrity?: string | undefined;
58
- }[];
59
- warnings?: string[] | undefined;
60
- }, {
61
- manifest: {
62
- revision: string | null;
63
- url: string;
64
- size: number;
65
- integrity?: string | undefined;
66
- }[];
67
- warnings?: string[] | undefined;
68
- }>>, z.ZodObject<{
69
- manifest: z.ZodArray<z.ZodObject<{
70
- integrity: z.ZodOptional<z.ZodString>;
71
- revision: z.ZodNullable<z.ZodString>;
72
- url: z.ZodString;
73
- size: z.ZodNumber;
74
- }, "strip", z.ZodTypeAny, {
75
- revision: string | null;
76
- url: string;
77
- size: number;
78
- integrity?: string | undefined;
79
- }, {
80
- revision: string | null;
81
- url: string;
82
- size: number;
83
- integrity?: string | undefined;
84
- }>, "many">;
85
- warnings: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
86
- }, "strict", z.ZodTypeAny, {
87
- manifest: {
88
- revision: string | null;
89
- url: string;
90
- size: number;
91
- integrity?: string | undefined;
92
- }[];
93
- warnings?: string[] | undefined;
94
- }, {
95
- manifest: {
96
- revision: string | null;
97
- url: string;
98
- size: number;
99
- integrity?: string | undefined;
100
- }[];
101
- warnings?: string[] | undefined;
102
- }>]>>, "many">>;
103
- modifyURLPrefix: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
104
- globFollow: z.ZodDefault<z.ZodBoolean>;
105
- globIgnores: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
106
- globPatterns: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
107
- globStrict: z.ZodDefault<z.ZodBoolean>;
108
- templatedURLs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>>;
109
- injectionPoint: z.ZodDefault<z.ZodString>;
110
- swSrc: z.ZodString;
111
- swDest: z.ZodString;
112
- globDirectory: z.ZodString;
113
- }, "strict", z.ZodTypeAny, {
114
- disablePrecacheManifest: boolean;
115
- maximumFileSizeToCacheInBytes: number;
116
- globFollow: boolean;
117
- globIgnores: string[];
118
- globPatterns: string[];
119
- globStrict: boolean;
120
- injectionPoint: string;
121
- swSrc: string;
122
- swDest: string;
123
- globDirectory: string;
124
- additionalPrecacheEntries?: (string | {
125
- revision: string | null;
126
- url: string;
127
- integrity?: string | undefined;
128
- })[] | undefined;
129
- dontCacheBustURLsMatching?: RegExp | undefined;
130
- manifestTransforms?: ((args_0: {
131
- revision: string | null;
132
- url: string;
133
- size: number;
134
- integrity?: string | undefined;
135
- }[], args_1: unknown) => {
136
- manifest: {
137
- revision: string | null;
138
- url: string;
139
- size: number;
140
- integrity?: string | undefined;
141
- }[];
142
- warnings?: string[] | undefined;
143
- } | Promise<{
144
- manifest: {
145
- revision: string | null;
146
- url: string;
147
- size: number;
148
- integrity?: string | undefined;
149
- }[];
150
- warnings?: string[] | undefined;
151
- }>)[] | undefined;
152
- modifyURLPrefix?: Record<string, string> | undefined;
153
- templatedURLs?: Record<string, string | string[]> | undefined;
154
- }, {
155
- swSrc: string;
156
- swDest: string;
157
- globDirectory: string;
158
- disablePrecacheManifest?: boolean | undefined;
159
- maximumFileSizeToCacheInBytes?: number | undefined;
160
- additionalPrecacheEntries?: (string | {
161
- revision: string | null;
162
- url: string;
163
- integrity?: string | undefined;
164
- })[] | undefined;
165
- dontCacheBustURLsMatching?: RegExp | undefined;
166
- manifestTransforms?: ((args_0: {
167
- revision: string | null;
168
- url: string;
169
- size: number;
170
- integrity?: string | undefined;
171
- }[], args_1: unknown) => {
172
- manifest: {
173
- revision: string | null;
174
- url: string;
175
- size: number;
176
- integrity?: string | undefined;
177
- }[];
178
- warnings?: string[] | undefined;
179
- } | Promise<{
180
- manifest: {
181
- revision: string | null;
182
- url: string;
183
- size: number;
184
- integrity?: string | undefined;
185
- }[];
186
- warnings?: string[] | undefined;
187
- }>)[] | undefined;
188
- modifyURLPrefix?: Record<string, string> | undefined;
189
- globFollow?: boolean | undefined;
190
- globIgnores?: string[] | undefined;
191
- globPatterns?: string[] | undefined;
192
- globStrict?: boolean | undefined;
193
- templatedURLs?: Record<string, string | string[]> | undefined;
194
- injectionPoint?: string | undefined;
195
- }>;
196
- //# sourceMappingURL=vite.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"vite.d.ts","sourceRoot":"","sources":["../../src/schema/vite.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAS7B,eAAO,MAAM,yBAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKmC,CAAC"}
@@ -1,225 +0,0 @@
1
- import { z } from "zod";
2
- export declare const webpackPartial: z.ZodObject<{
3
- chunks: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
4
- 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">>;
5
- excludeChunks: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
6
- 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">>;
7
- }, "strict", z.ZodTypeAny, {
8
- exclude: (string | RegExp | ((args_0: any) => boolean))[];
9
- chunks?: string[] | undefined;
10
- excludeChunks?: string[] | undefined;
11
- include?: (string | RegExp | ((args_0: any) => boolean))[] | undefined;
12
- }, {
13
- chunks?: string[] | undefined;
14
- exclude?: (string | RegExp | ((args_0: any) => boolean))[] | undefined;
15
- excludeChunks?: string[] | undefined;
16
- include?: (string | RegExp | ((args_0: any) => boolean))[] | undefined;
17
- }>;
18
- export declare const webpackInjectManifestPartial: z.ZodObject<{
19
- compileSrc: z.ZodDefault<z.ZodBoolean>;
20
- swDest: z.ZodOptional<z.ZodString>;
21
- webpackCompilationPlugins: z.ZodOptional<z.ZodArray<z.ZodAny, "many">>;
22
- }, "strict", z.ZodTypeAny, {
23
- compileSrc: boolean;
24
- swDest?: string | undefined;
25
- webpackCompilationPlugins?: any[] | undefined;
26
- }, {
27
- compileSrc?: boolean | undefined;
28
- swDest?: string | undefined;
29
- webpackCompilationPlugins?: any[] | undefined;
30
- }>;
31
- export declare const webpackInjectManifestOptions: z.ZodObject<{
32
- disablePrecacheManifest: z.ZodDefault<z.ZodBoolean>;
33
- maximumFileSizeToCacheInBytes: z.ZodDefault<z.ZodNumber>;
34
- additionalPrecacheEntries: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
35
- integrity: z.ZodOptional<z.ZodString>;
36
- revision: z.ZodNullable<z.ZodString>;
37
- url: z.ZodString;
38
- }, "strict", z.ZodTypeAny, {
39
- revision: string | null;
40
- url: string;
41
- integrity?: string | undefined;
42
- }, {
43
- revision: string | null;
44
- url: string;
45
- integrity?: string | undefined;
46
- }>]>, "many">>;
47
- dontCacheBustURLsMatching: z.ZodOptional<z.ZodType<RegExp, z.ZodTypeDef, RegExp>>;
48
- manifestTransforms: z.ZodOptional<z.ZodArray<z.ZodFunction<z.ZodTuple<[z.ZodArray<z.ZodObject<{
49
- integrity: z.ZodOptional<z.ZodString>;
50
- revision: z.ZodNullable<z.ZodString>;
51
- url: z.ZodString;
52
- size: z.ZodNumber;
53
- }, "strip", z.ZodTypeAny, {
54
- revision: string | null;
55
- url: string;
56
- size: number;
57
- integrity?: string | undefined;
58
- }, {
59
- revision: string | null;
60
- url: string;
61
- size: number;
62
- integrity?: string | undefined;
63
- }>, "many">, z.ZodOptional<z.ZodUnknown>], null>, z.ZodUnion<[z.ZodPromise<z.ZodObject<{
64
- manifest: z.ZodArray<z.ZodObject<{
65
- integrity: z.ZodOptional<z.ZodString>;
66
- revision: z.ZodNullable<z.ZodString>;
67
- url: z.ZodString;
68
- size: z.ZodNumber;
69
- }, "strip", z.ZodTypeAny, {
70
- revision: string | null;
71
- url: string;
72
- size: number;
73
- integrity?: string | undefined;
74
- }, {
75
- revision: string | null;
76
- url: string;
77
- size: number;
78
- integrity?: string | undefined;
79
- }>, "many">;
80
- warnings: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
81
- }, "strict", z.ZodTypeAny, {
82
- manifest: {
83
- revision: string | null;
84
- url: string;
85
- size: number;
86
- integrity?: string | undefined;
87
- }[];
88
- warnings?: string[] | undefined;
89
- }, {
90
- manifest: {
91
- revision: string | null;
92
- url: string;
93
- size: number;
94
- integrity?: string | undefined;
95
- }[];
96
- warnings?: string[] | undefined;
97
- }>>, z.ZodObject<{
98
- manifest: z.ZodArray<z.ZodObject<{
99
- integrity: z.ZodOptional<z.ZodString>;
100
- revision: z.ZodNullable<z.ZodString>;
101
- url: z.ZodString;
102
- size: z.ZodNumber;
103
- }, "strip", z.ZodTypeAny, {
104
- revision: string | null;
105
- url: string;
106
- size: number;
107
- integrity?: string | undefined;
108
- }, {
109
- revision: string | null;
110
- url: string;
111
- size: number;
112
- integrity?: string | undefined;
113
- }>, "many">;
114
- warnings: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
115
- }, "strict", z.ZodTypeAny, {
116
- manifest: {
117
- revision: string | null;
118
- url: string;
119
- size: number;
120
- integrity?: string | undefined;
121
- }[];
122
- warnings?: string[] | undefined;
123
- }, {
124
- manifest: {
125
- revision: string | null;
126
- url: string;
127
- size: number;
128
- integrity?: string | undefined;
129
- }[];
130
- warnings?: string[] | undefined;
131
- }>]>>, "many">>;
132
- modifyURLPrefix: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
133
- injectionPoint: z.ZodDefault<z.ZodString>;
134
- swSrc: z.ZodString;
135
- 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">>;
136
- chunks: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
137
- excludeChunks: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
138
- 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">>;
139
- compileSrc: z.ZodDefault<z.ZodBoolean>;
140
- swDest: z.ZodOptional<z.ZodString>;
141
- webpackCompilationPlugins: z.ZodOptional<z.ZodArray<z.ZodAny, "many">>;
142
- }, "strict", z.ZodTypeAny, {
143
- disablePrecacheManifest: boolean;
144
- maximumFileSizeToCacheInBytes: number;
145
- injectionPoint: string;
146
- swSrc: string;
147
- exclude: (string | RegExp | ((args_0: any) => boolean))[];
148
- compileSrc: boolean;
149
- additionalPrecacheEntries?: (string | {
150
- revision: string | null;
151
- url: string;
152
- integrity?: string | undefined;
153
- })[] | undefined;
154
- dontCacheBustURLsMatching?: RegExp | undefined;
155
- manifestTransforms?: ((args_0: {
156
- revision: string | null;
157
- url: string;
158
- size: number;
159
- integrity?: string | undefined;
160
- }[], args_1: unknown) => {
161
- manifest: {
162
- revision: string | null;
163
- url: string;
164
- size: number;
165
- integrity?: string | undefined;
166
- }[];
167
- warnings?: string[] | undefined;
168
- } | Promise<{
169
- manifest: {
170
- revision: string | null;
171
- url: string;
172
- size: number;
173
- integrity?: string | undefined;
174
- }[];
175
- warnings?: string[] | undefined;
176
- }>)[] | undefined;
177
- modifyURLPrefix?: Record<string, string> | undefined;
178
- chunks?: string[] | undefined;
179
- excludeChunks?: string[] | undefined;
180
- include?: (string | RegExp | ((args_0: any) => boolean))[] | undefined;
181
- swDest?: string | undefined;
182
- webpackCompilationPlugins?: any[] | undefined;
183
- }, {
184
- swSrc: string;
185
- disablePrecacheManifest?: boolean | undefined;
186
- maximumFileSizeToCacheInBytes?: number | undefined;
187
- additionalPrecacheEntries?: (string | {
188
- revision: string | null;
189
- url: string;
190
- integrity?: string | undefined;
191
- })[] | undefined;
192
- dontCacheBustURLsMatching?: RegExp | undefined;
193
- manifestTransforms?: ((args_0: {
194
- revision: string | null;
195
- url: string;
196
- size: number;
197
- integrity?: string | undefined;
198
- }[], args_1: unknown) => {
199
- manifest: {
200
- revision: string | null;
201
- url: string;
202
- size: number;
203
- integrity?: string | undefined;
204
- }[];
205
- warnings?: string[] | undefined;
206
- } | Promise<{
207
- manifest: {
208
- revision: string | null;
209
- url: string;
210
- size: number;
211
- integrity?: string | undefined;
212
- }[];
213
- warnings?: string[] | undefined;
214
- }>)[] | undefined;
215
- modifyURLPrefix?: Record<string, string> | undefined;
216
- injectionPoint?: string | undefined;
217
- exclude?: (string | RegExp | ((args_0: any) => boolean))[] | undefined;
218
- chunks?: string[] | undefined;
219
- excludeChunks?: string[] | undefined;
220
- include?: (string | RegExp | ((args_0: any) => boolean))[] | undefined;
221
- compileSrc?: boolean | undefined;
222
- swDest?: string | undefined;
223
- webpackCompilationPlugins?: any[] | undefined;
224
- }>;
225
- //# sourceMappingURL=webpack.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"webpack.d.ts","sourceRoot":"","sources":["../../src/schema/webpack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAcxB,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;EASmC,CAAC;AAE/D,eAAO,MAAM,4BAA4B;;;;;;;;;;;;EAMmC,CAAC;AAE7E,eAAO,MAAM,4BAA4B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKmC,CAAC"}
package/src/index.next.ts DELETED
@@ -1,3 +0,0 @@
1
- import { validateNextInjectManifestOptions } from "./lib/validate-next-options.js";
2
-
3
- export { validateNextInjectManifestOptions };
@@ -1,14 +0,0 @@
1
- import { nextInjectManifestOptions } from "../schema/next.js";
2
- import { validationErrorMap } from "../schema/validationErrorMap.js";
3
- import type { NextInjectManifestOptionsComplete } from "../types.js";
4
- import { SerwistConfigError } from "./serwist-config-error.js";
5
-
6
- export const validateNextInjectManifestOptions = (input: unknown): NextInjectManifestOptionsComplete => {
7
- const result = nextInjectManifestOptions.safeParse(input, {
8
- errorMap: validationErrorMap,
9
- });
10
- if (!result.success) {
11
- throw new SerwistConfigError({ moduleName: "@serwist/next", message: JSON.stringify(result.error.format(), null, 2) });
12
- }
13
- return result.data;
14
- };
@@ -1,33 +0,0 @@
1
- import { z } from "zod";
2
- import type {
3
- NextInjectManifestOptions,
4
- NextInjectManifestOptionsComplete,
5
- NextInjectManifestPartial,
6
- NextInjectManifestResolved,
7
- } from "../types.js";
8
- import { type Equals, assertType } from "./assertType.js";
9
- import { requiredSwDestPartial } from "./swDest.js";
10
- import { webpackInjectManifestOptions } from "./webpack.js";
11
-
12
- export const nextInjectManifestPartial = z
13
- .object({
14
- cacheOnNavigation: z.boolean().default(false),
15
- disable: z.boolean().default(false),
16
- register: z.boolean().default(true),
17
- reloadOnOnline: z.boolean().default(true),
18
- scope: z.string().optional(),
19
- swUrl: z.string().default("/sw.js"),
20
- globPublicPatterns: z.union([z.string(), z.array(z.string())]).default(["**/*"]),
21
- })
22
- .strict("Do not pass invalid properties to NextInjectManifestPartial!");
23
-
24
- export const nextInjectManifestOptions = webpackInjectManifestOptions
25
- .merge(requiredSwDestPartial)
26
- .merge(nextInjectManifestPartial)
27
- .omit({ disablePrecacheManifest: true })
28
- .strict("Do not pass invalid properties to NextInjectManifestOptions!");
29
-
30
- assertType<Equals<NextInjectManifestPartial, z.input<typeof nextInjectManifestPartial>>>();
31
- assertType<Equals<NextInjectManifestResolved, z.output<typeof nextInjectManifestPartial>>>();
32
- assertType<Equals<NextInjectManifestOptions, z.input<typeof nextInjectManifestOptions>>>();
33
- assertType<Equals<NextInjectManifestOptionsComplete, z.output<typeof nextInjectManifestOptions>>>();
@@ -1,18 +0,0 @@
1
- import type { z } from "zod";
2
- import type { ViteInjectManifestOptions, ViteInjectManifestOptionsComplete } from "../types.js";
3
- import { type Equals, assertType } from "./assertType.js";
4
- import { basePartial } from "./base.js";
5
- import { globPartial } from "./glob.js";
6
- import { requiredGlobDirectoryPartial } from "./glob.js";
7
- import { injectPartial } from "./injectManifest.js";
8
- import { requiredSwDestPartial } from "./swDest.js";
9
-
10
- export const viteInjectManifestOptions = basePartial
11
- .merge(globPartial)
12
- .merge(injectPartial)
13
- .merge(requiredSwDestPartial)
14
- .merge(requiredGlobDirectoryPartial)
15
- .strict("Do not pass invalid properties to ViteInjectManifestPartial!");
16
-
17
- assertType<Equals<ViteInjectManifestOptions, z.input<typeof viteInjectManifestOptions>>>();
18
- assertType<Equals<ViteInjectManifestOptionsComplete, z.output<typeof viteInjectManifestOptions>>>();
@@ -1,46 +0,0 @@
1
- import { z } from "zod";
2
- import type {
3
- WebpackInjectManifestOptions,
4
- WebpackInjectManifestOptionsComplete,
5
- WebpackInjectManifestPartial,
6
- WebpackInjectManifestResolved,
7
- WebpackPartial,
8
- WebpackResolved,
9
- } from "../types.js";
10
- import { type Equals, assertType } from "./assertType.js";
11
- import { basePartial } from "./base.js";
12
- import { injectPartial } from "./injectManifest.js";
13
- import { optionalSwDestPartial } from "./swDest.js";
14
-
15
- export const webpackPartial = z
16
- .object({
17
- chunks: z.array(z.string()).optional(),
18
- exclude: z
19
- .array(z.union([z.string(), z.instanceof(RegExp), z.function(z.tuple([z.any()]), z.boolean())]))
20
- .default([/\.map$/, /^manifest.*\.js$/]),
21
- excludeChunks: z.array(z.string()).optional(),
22
- include: z.array(z.union([z.string(), z.instanceof(RegExp), z.function(z.tuple([z.any()]), z.boolean())])).optional(),
23
- })
24
- .strict("Do not pass invalid properties to WebpackPartial!");
25
-
26
- export const webpackInjectManifestPartial = z
27
- .object({
28
- compileSrc: z.boolean().default(true),
29
- swDest: z.string().optional(),
30
- webpackCompilationPlugins: z.array(z.any()).optional(),
31
- })
32
- .strict("Do not pass invalid properties to WebpackInjectManifestPartial!");
33
-
34
- export const webpackInjectManifestOptions = basePartial
35
- .merge(webpackPartial)
36
- .merge(injectPartial)
37
- .merge(optionalSwDestPartial)
38
- .merge(webpackInjectManifestPartial)
39
- .strict("Do not pass invalid properties to WebpackInjectManifestOptions!");
40
-
41
- assertType<Equals<z.input<typeof webpackPartial>, WebpackPartial>>();
42
- assertType<Equals<WebpackResolved, z.output<typeof webpackPartial>>>();
43
- assertType<Equals<WebpackInjectManifestPartial, z.input<typeof webpackInjectManifestPartial>>>();
44
- assertType<Equals<WebpackInjectManifestResolved, z.output<typeof webpackInjectManifestPartial>>>();
45
- assertType<Equals<WebpackInjectManifestOptions, z.input<typeof webpackInjectManifestOptions>>>();
46
- assertType<Equals<WebpackInjectManifestOptionsComplete, z.output<typeof webpackInjectManifestOptions>>>();
@@ -1,5 +1,12 @@
1
1
  import { z } from 'zod';
2
2
 
3
+ class SerwistConfigError extends Error {
4
+ constructor({ moduleName, message }){
5
+ super(`Received an invalid ${moduleName ?? "Serwist"} configuration: ${message}`);
6
+ Object.setPrototypeOf(this, new.target.prototype);
7
+ }
8
+ }
9
+
3
10
  const validationErrorMap = (error, ctx)=>{
4
11
  switch(error.code){
5
12
  case z.ZodIssueCode.invalid_type:
@@ -44,11 +51,4 @@ const validationErrorMap = (error, ctx)=>{
44
51
  };
45
52
  };
46
53
 
47
- class SerwistConfigError extends Error {
48
- constructor({ moduleName, message }){
49
- super(`Received an invalid ${moduleName ?? "Serwist"} configuration: ${message}`);
50
- Object.setPrototypeOf(this, new.target.prototype);
51
- }
52
- }
53
-
54
54
  export { SerwistConfigError as S, validationErrorMap as v };