@serwist/build 10.0.0-preview.8 → 10.0.0-preview.9

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 (69) hide show
  1. package/dist/chunks/constants.js +34 -33
  2. package/dist/chunks/get-manifest.js +11 -0
  3. package/dist/chunks/glob.js +43 -25
  4. package/dist/chunks/inject-manifest.js +29 -0
  5. package/dist/index.js +10 -10
  6. package/dist/index.schema.d.ts +9 -9
  7. package/dist/index.schema.d.ts.map +1 -1
  8. package/dist/index.schema.js +3 -3
  9. package/dist/lib/transform-manifest.d.ts.map +1 -1
  10. package/dist/lib/validate-options.d.ts.map +1 -1
  11. package/dist/schema/{assertType.d.ts → assert-type.d.ts} +1 -1
  12. package/dist/schema/assert-type.d.ts.map +1 -0
  13. package/dist/schema/base.d.ts +44 -150
  14. package/dist/schema/base.d.ts.map +1 -1
  15. package/dist/schema/{serwistConfigError.d.ts → error.d.ts} +3 -1
  16. package/dist/schema/error.d.ts.map +1 -0
  17. package/dist/schema/get-manifest.d.ts +72 -0
  18. package/dist/schema/get-manifest.d.ts.map +1 -0
  19. package/dist/schema/glob.d.ts +6 -26
  20. package/dist/schema/glob.d.ts.map +1 -1
  21. package/dist/schema/inject-manifest.d.ts +79 -0
  22. package/dist/schema/inject-manifest.d.ts.map +1 -0
  23. package/dist/schema/manifest-entry.d.ts +7 -0
  24. package/dist/schema/manifest-entry.d.ts.map +1 -0
  25. package/dist/schema/manifest-transform.d.ts +64 -0
  26. package/dist/schema/manifest-transform.d.ts.map +1 -0
  27. package/dist/schema/sw-dest.d.ts +8 -0
  28. package/dist/schema/sw-dest.d.ts.map +1 -0
  29. package/dist/schema/utils.d.ts +10 -0
  30. package/dist/schema/utils.d.ts.map +1 -0
  31. package/dist/types.d.ts +11 -4
  32. package/dist/types.d.ts.map +1 -1
  33. package/package.json +11 -9
  34. package/src/index.schema.ts +10 -8
  35. package/src/lib/transform-manifest.ts +0 -1
  36. package/src/lib/translate-url-to-sourcemap-paths.ts +3 -3
  37. package/src/lib/validate-options.ts +12 -6
  38. package/src/schema/base.ts +11 -13
  39. package/src/schema/error.ts +53 -0
  40. package/src/schema/{getManifest.ts → get-manifest.ts} +7 -6
  41. package/src/schema/glob.ts +15 -21
  42. package/src/schema/inject-manifest.ts +24 -0
  43. package/src/schema/manifest-entry.ts +7 -0
  44. package/src/schema/manifest-transform.ts +17 -0
  45. package/src/schema/{swDest.ts → sw-dest.ts} +7 -11
  46. package/src/schema/utils.ts +27 -0
  47. package/src/types.ts +10 -4
  48. package/dist/chunks/getManifest.js +0 -7
  49. package/dist/chunks/injectManifest.js +0 -23
  50. package/dist/schema/assertType.d.ts.map +0 -1
  51. package/dist/schema/getManifest.d.ts +0 -192
  52. package/dist/schema/getManifest.d.ts.map +0 -1
  53. package/dist/schema/injectManifest.d.ts +0 -213
  54. package/dist/schema/injectManifest.d.ts.map +0 -1
  55. package/dist/schema/manifestEntry.d.ts +0 -15
  56. package/dist/schema/manifestEntry.d.ts.map +0 -1
  57. package/dist/schema/manifestTransform.d.ts +0 -125
  58. package/dist/schema/manifestTransform.d.ts.map +0 -1
  59. package/dist/schema/serwistConfigError.d.ts.map +0 -1
  60. package/dist/schema/swDest.d.ts +0 -16
  61. package/dist/schema/swDest.d.ts.map +0 -1
  62. package/dist/schema/validationErrorMap.d.ts +0 -3
  63. package/dist/schema/validationErrorMap.d.ts.map +0 -1
  64. package/src/schema/injectManifest.ts +0 -25
  65. package/src/schema/manifestEntry.ts +0 -9
  66. package/src/schema/manifestTransform.ts +0 -15
  67. package/src/schema/serwistConfigError.ts +0 -6
  68. package/src/schema/validationErrorMap.ts +0 -36
  69. /package/src/schema/{assertType.ts → assert-type.ts} +0 -0
@@ -0,0 +1,72 @@
1
+ import { z } from "zod";
2
+ export declare const getManifestOptions: z.ZodObject<{
3
+ globDirectory: z.ZodString;
4
+ globFollow: z.ZodDefault<z.ZodBoolean>;
5
+ globIgnores: z.ZodDefault<z.ZodArray<z.ZodString>>;
6
+ globPatterns: z.ZodDefault<z.ZodArray<z.ZodString>>;
7
+ globStrict: z.ZodDefault<z.ZodBoolean>;
8
+ templatedURLs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>>;
9
+ additionalPrecacheEntries: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
10
+ integrity: z.ZodOptional<z.ZodString>;
11
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
12
+ url: z.ZodString;
13
+ }, z.core.$strict>]>>>;
14
+ disablePrecacheManifest: z.ZodDefault<z.ZodBoolean>;
15
+ dontCacheBustURLsMatching: z.ZodOptional<z.ZodCustom<RegExp, RegExp>>;
16
+ manifestTransforms: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodCustom<z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
17
+ size: z.ZodNumber;
18
+ integrity: z.ZodOptional<z.ZodString>;
19
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
20
+ url: z.ZodString;
21
+ }, z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
22
+ manifest: z.ZodArray<z.ZodObject<{
23
+ size: z.ZodNumber;
24
+ integrity: z.ZodOptional<z.ZodString>;
25
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
26
+ url: z.ZodString;
27
+ }, z.core.$strip>>;
28
+ warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
29
+ }, z.core.$strict>>, z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
30
+ size: z.ZodNumber;
31
+ integrity: z.ZodOptional<z.ZodString>;
32
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
33
+ url: z.ZodString;
34
+ }, z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
35
+ manifest: z.ZodArray<z.ZodObject<{
36
+ size: z.ZodNumber;
37
+ integrity: z.ZodOptional<z.ZodString>;
38
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
39
+ url: z.ZodString;
40
+ }, z.core.$strip>>;
41
+ warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
42
+ }, z.core.$strict>>>, z.ZodTransform<z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
43
+ size: z.ZodNumber;
44
+ integrity: z.ZodOptional<z.ZodString>;
45
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
46
+ url: z.ZodString;
47
+ }, z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
48
+ manifest: z.ZodArray<z.ZodObject<{
49
+ size: z.ZodNumber;
50
+ integrity: z.ZodOptional<z.ZodString>;
51
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
52
+ url: z.ZodString;
53
+ }, z.core.$strip>>;
54
+ warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
55
+ }, z.core.$strict>>, z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
56
+ size: z.ZodNumber;
57
+ integrity: z.ZodOptional<z.ZodString>;
58
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
59
+ url: z.ZodString;
60
+ }, z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
61
+ manifest: z.ZodArray<z.ZodObject<{
62
+ size: z.ZodNumber;
63
+ integrity: z.ZodOptional<z.ZodString>;
64
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
65
+ url: z.ZodString;
66
+ }, z.core.$strip>>;
67
+ warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
68
+ }, z.core.$strict>>>>>>;
69
+ maximumFileSizeToCacheInBytes: z.ZodDefault<z.ZodNumber>;
70
+ modifyURLPrefix: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
71
+ }, z.core.$strict>;
72
+ //# sourceMappingURL=get-manifest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-manifest.d.ts","sourceRoot":"","sources":["../../src/schema/get-manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB,eAAO,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAI7B,CAAC"}
@@ -1,35 +1,15 @@
1
1
  import { z } from "zod";
2
2
  export declare const globPartial: z.ZodObject<{
3
3
  globFollow: z.ZodDefault<z.ZodBoolean>;
4
- globIgnores: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
5
- globPatterns: z.ZodDefault<z.ZodArray<z.ZodString, "many">>;
4
+ globIgnores: z.ZodDefault<z.ZodArray<z.ZodString>>;
5
+ globPatterns: z.ZodDefault<z.ZodArray<z.ZodString>>;
6
6
  globStrict: z.ZodDefault<z.ZodBoolean>;
7
- templatedURLs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodArray<z.ZodString, "many">]>>>;
8
- }, "strict", z.ZodTypeAny, {
9
- globFollow: boolean;
10
- globIgnores: string[];
11
- globPatterns: string[];
12
- globStrict: boolean;
13
- templatedURLs?: Record<string, string | string[]> | undefined;
14
- }, {
15
- globFollow?: boolean | undefined;
16
- globIgnores?: string[] | undefined;
17
- globPatterns?: string[] | undefined;
18
- globStrict?: boolean | undefined;
19
- templatedURLs?: Record<string, string | string[]> | undefined;
20
- }>;
7
+ templatedURLs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>>;
8
+ }, z.core.$strict>;
21
9
  export declare const optionalGlobDirectoryPartial: z.ZodObject<{
22
10
  globDirectory: z.ZodOptional<z.ZodString>;
23
- }, "strict", z.ZodTypeAny, {
24
- globDirectory?: string | undefined;
25
- }, {
26
- globDirectory?: string | undefined;
27
- }>;
11
+ }, z.core.$strict>;
28
12
  export declare const requiredGlobDirectoryPartial: z.ZodObject<{
29
13
  globDirectory: z.ZodString;
30
- }, "strict", z.ZodTypeAny, {
31
- globDirectory: string;
32
- }, {
33
- globDirectory: string;
34
- }>;
14
+ }, z.core.$strict>;
35
15
  //# sourceMappingURL=glob.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"glob.d.ts","sourceRoot":"","sources":["../../src/schema/glob.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAYxB,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;EAQmC,CAAC;AAE5D,eAAO,MAAM,4BAA4B;;;;;;EAImC,CAAC;AAI7E,eAAO,MAAM,4BAA4B;;;;;;EAImC,CAAC"}
1
+ {"version":3,"file":"glob.d.ts","sourceRoot":"","sources":["../../src/schema/glob.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAYxB,eAAO,MAAM,WAAW;;;;;;kBAMtB,CAAC;AAEH,eAAO,MAAM,4BAA4B;;kBAEvC,CAAC;AAIH,eAAO,MAAM,4BAA4B;;kBAEvC,CAAC"}
@@ -0,0 +1,79 @@
1
+ import { z } from "zod";
2
+ export declare const baseInjectPartial: z.ZodObject<{
3
+ injectionPoint: z.ZodDefault<z.ZodString>;
4
+ swSrc: z.ZodString;
5
+ }, z.core.$strict>;
6
+ export declare const injectManifestOptions: z.ZodObject<{
7
+ globDirectory: z.ZodString;
8
+ swDest: z.ZodString;
9
+ injectionPoint: z.ZodDefault<z.ZodString>;
10
+ swSrc: z.ZodString;
11
+ globFollow: z.ZodDefault<z.ZodBoolean>;
12
+ globIgnores: z.ZodDefault<z.ZodArray<z.ZodString>>;
13
+ globPatterns: z.ZodDefault<z.ZodArray<z.ZodString>>;
14
+ globStrict: z.ZodDefault<z.ZodBoolean>;
15
+ templatedURLs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodString, z.ZodArray<z.ZodString>]>>>;
16
+ additionalPrecacheEntries: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
17
+ integrity: z.ZodOptional<z.ZodString>;
18
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
19
+ url: z.ZodString;
20
+ }, z.core.$strict>]>>>;
21
+ disablePrecacheManifest: z.ZodDefault<z.ZodBoolean>;
22
+ dontCacheBustURLsMatching: z.ZodOptional<z.ZodCustom<RegExp, RegExp>>;
23
+ manifestTransforms: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodCustom<z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
24
+ size: z.ZodNumber;
25
+ integrity: z.ZodOptional<z.ZodString>;
26
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
27
+ url: z.ZodString;
28
+ }, z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
29
+ manifest: z.ZodArray<z.ZodObject<{
30
+ size: z.ZodNumber;
31
+ integrity: z.ZodOptional<z.ZodString>;
32
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
33
+ url: z.ZodString;
34
+ }, z.core.$strip>>;
35
+ warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
36
+ }, z.core.$strict>>, z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
37
+ size: z.ZodNumber;
38
+ integrity: z.ZodOptional<z.ZodString>;
39
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
40
+ url: z.ZodString;
41
+ }, z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
42
+ manifest: z.ZodArray<z.ZodObject<{
43
+ size: z.ZodNumber;
44
+ integrity: z.ZodOptional<z.ZodString>;
45
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
46
+ url: z.ZodString;
47
+ }, z.core.$strip>>;
48
+ warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
49
+ }, z.core.$strict>>>, z.ZodTransform<z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
50
+ size: z.ZodNumber;
51
+ integrity: z.ZodOptional<z.ZodString>;
52
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
53
+ url: z.ZodString;
54
+ }, z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
55
+ manifest: z.ZodArray<z.ZodObject<{
56
+ size: z.ZodNumber;
57
+ integrity: z.ZodOptional<z.ZodString>;
58
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
59
+ url: z.ZodString;
60
+ }, z.core.$strip>>;
61
+ warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
62
+ }, z.core.$strict>>, z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
63
+ size: z.ZodNumber;
64
+ integrity: z.ZodOptional<z.ZodString>;
65
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
66
+ url: z.ZodString;
67
+ }, z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
68
+ manifest: z.ZodArray<z.ZodObject<{
69
+ size: z.ZodNumber;
70
+ integrity: z.ZodOptional<z.ZodString>;
71
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
72
+ url: z.ZodString;
73
+ }, z.core.$strip>>;
74
+ warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
75
+ }, z.core.$strict>>>>>>;
76
+ maximumFileSizeToCacheInBytes: z.ZodDefault<z.ZodNumber>;
77
+ modifyURLPrefix: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
78
+ }, z.core.$strict>;
79
+ //# sourceMappingURL=inject-manifest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inject-manifest.d.ts","sourceRoot":"","sources":["../../src/schema/inject-manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,iBAAiB;;;kBAG5B,CAAC;AAEH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAMhC,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { z } from "zod";
2
+ export declare const manifestEntry: z.ZodObject<{
3
+ integrity: z.ZodOptional<z.ZodString>;
4
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
5
+ url: z.ZodString;
6
+ }, z.core.$strict>;
7
+ //# sourceMappingURL=manifest-entry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest-entry.d.ts","sourceRoot":"","sources":["../../src/schema/manifest-entry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,aAAa;;;;kBAIxB,CAAC"}
@@ -0,0 +1,64 @@
1
+ import { z } from "zod";
2
+ export declare const manifestTransformResult: z.ZodObject<{
3
+ manifest: z.ZodArray<z.ZodObject<{
4
+ size: z.ZodNumber;
5
+ integrity: z.ZodOptional<z.ZodString>;
6
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
7
+ url: z.ZodString;
8
+ }, z.core.$strip>>;
9
+ warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
10
+ }, z.core.$strict>;
11
+ export declare const manifestTransform: z.ZodPipe<z.ZodCustom<z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
12
+ size: z.ZodNumber;
13
+ integrity: z.ZodOptional<z.ZodString>;
14
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
15
+ url: z.ZodString;
16
+ }, z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
17
+ manifest: z.ZodArray<z.ZodObject<{
18
+ size: z.ZodNumber;
19
+ integrity: z.ZodOptional<z.ZodString>;
20
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
21
+ url: z.ZodString;
22
+ }, z.core.$strip>>;
23
+ warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
24
+ }, z.core.$strict>>, z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
25
+ size: z.ZodNumber;
26
+ integrity: z.ZodOptional<z.ZodString>;
27
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
28
+ url: z.ZodString;
29
+ }, z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
30
+ manifest: z.ZodArray<z.ZodObject<{
31
+ size: z.ZodNumber;
32
+ integrity: z.ZodOptional<z.ZodString>;
33
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
34
+ url: z.ZodString;
35
+ }, z.core.$strip>>;
36
+ warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
37
+ }, z.core.$strict>>>, z.ZodTransform<z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
38
+ size: z.ZodNumber;
39
+ integrity: z.ZodOptional<z.ZodString>;
40
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
41
+ url: z.ZodString;
42
+ }, z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
43
+ manifest: z.ZodArray<z.ZodObject<{
44
+ size: z.ZodNumber;
45
+ integrity: z.ZodOptional<z.ZodString>;
46
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
47
+ url: z.ZodString;
48
+ }, z.core.$strip>>;
49
+ warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
50
+ }, z.core.$strict>>, z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
51
+ size: z.ZodNumber;
52
+ integrity: z.ZodOptional<z.ZodString>;
53
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
54
+ url: z.ZodString;
55
+ }, z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
56
+ manifest: z.ZodArray<z.ZodObject<{
57
+ size: z.ZodNumber;
58
+ integrity: z.ZodOptional<z.ZodString>;
59
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
60
+ url: z.ZodString;
61
+ }, z.core.$strip>>;
62
+ warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
63
+ }, z.core.$strict>>>>;
64
+ //# sourceMappingURL=manifest-transform.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"manifest-transform.d.ts","sourceRoot":"","sources":["../../src/schema/manifest-transform.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAQxB,eAAO,MAAM,uBAAuB;;;;;;;;kBAGlC,CAAC;AAEH,eAAO,MAAM,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qBAG5B,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { z } from "zod";
2
+ export declare const optionalSwDestPartial: z.ZodObject<{
3
+ swDest: z.ZodOptional<z.ZodString>;
4
+ }, z.core.$strict>;
5
+ export declare const requiredSwDestPartial: z.ZodObject<{
6
+ swDest: z.ZodString;
7
+ }, z.core.$strict>;
8
+ //# sourceMappingURL=sw-dest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"sw-dest.d.ts","sourceRoot":"","sources":["../../src/schema/sw-dest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,qBAAqB;;kBAEhC,CAAC;AAEH,eAAO,MAAM,qBAAqB;;kBAEhC,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { z } from "zod";
2
+ export declare const fn: <TInput extends [z.ZodType, ...z.ZodType[]], TOutput extends z.ZodType>({ input, output }: {
3
+ input: TInput;
4
+ output: TOutput;
5
+ }) => z.ZodPipe<z.ZodCustom<z.core.$InferInnerFunctionType<z.ZodTuple<TInput, null>, TOutput>, z.core.$InferInnerFunctionType<z.ZodTuple<TInput, null>, TOutput>>, z.ZodTransform<(...args: TInput extends readonly [...infer Prefix extends z.core.SomeType[], infer Tail extends z.core.SomeType] ? Tail["_zod"]["optin"] extends "optional" ? [...Prefix extends readonly [...infer Prefix extends z.core.SomeType[], infer Tail extends z.core.SomeType] ? Tail["_zod"]["optin"] extends "optional" ? [...Prefix extends readonly [...infer Prefix extends z.core.SomeType[], infer Tail extends z.core.SomeType] ? Tail["_zod"]["optin"] extends "optional" ? [...Prefix extends readonly [...infer Prefix extends z.core.SomeType[], infer Tail extends z.core.SomeType] ? Tail["_zod"]["optin"] extends "optional" ? [...Prefix extends readonly [...infer Prefix extends z.core.SomeType[], infer Tail extends z.core.SomeType] ? Tail["_zod"]["optin"] extends "optional" ? [...Prefix extends readonly [...infer Prefix extends z.core.SomeType[], infer Tail extends z.core.SomeType] ? Tail["_zod"]["optin"] extends "optional" ? [...Prefix extends readonly [...infer Prefix extends z.core.SomeType[], infer Tail extends z.core.SomeType] ? Tail["_zod"]["optin"] extends "optional" ? [...Prefix extends readonly [...infer Prefix extends z.core.SomeType[], infer Tail extends z.core.SomeType] ? Tail["_zod"]["optin"] extends "optional" ? [...Prefix extends readonly [...infer Prefix extends z.core.SomeType[], infer Tail extends z.core.SomeType] ? Tail["_zod"]["optin"] extends "optional" ? [...Prefix extends readonly [...infer Prefix extends z.core.SomeType[], infer Tail extends z.core.SomeType] ? Tail["_zod"]["optin"] extends "optional" ? [...Prefix extends readonly [...infer Prefix extends z.core.SomeType[], infer Tail extends z.core.SomeType] ? Tail["_zod"]["optin"] extends "optional" ? [.../*elided*/ any, (z.core.input<Tail> | undefined)?] : { [k in keyof Prefix]: z.core.input<Prefix[k]>; } : [], (z.core.input<Tail> | undefined)?] : { [k in keyof Prefix]: z.core.input<Prefix[k]>; } : [], (z.core.input<Tail> | undefined)?] : { [k in keyof Prefix]: z.core.input<Prefix[k]>; } : [], (z.core.input<Tail> | undefined)?] : { [k in keyof Prefix]: z.core.input<Prefix[k]>; } : [], (z.core.input<Tail> | undefined)?] : { [k in keyof Prefix]: z.core.input<Prefix[k]>; } : [], (z.core.input<Tail> | undefined)?] : { [k in keyof Prefix]: z.core.input<Prefix[k]>; } : [], (z.core.input<Tail> | undefined)?] : { [k in keyof Prefix]: z.core.input<Prefix[k]>; } : [], (z.core.input<Tail> | undefined)?] : { [k in keyof Prefix]: z.core.input<Prefix[k]>; } : [], (z.core.input<Tail> | undefined)?] : { [k in keyof Prefix]: z.core.input<Prefix[k]>; } : [], (z.core.input<Tail> | undefined)?] : { [k in keyof Prefix]: z.core.input<Prefix[k]>; } : [], (z.core.input<Tail> | undefined)?] : { [k_1 in keyof TInput]: z.core.input<TInput[k_1]>; } : []) => z.core.input<TOutput> extends z.core.output<TOutput> ? z.core.output<TOutput> & z.core.input<TOutput> : z.core.output<TOutput>, z.core.$InferInnerFunctionType<z.ZodTuple<TInput, null>, TOutput>>>;
6
+ export declare const asyncFn: <TInput extends [z.ZodType, ...z.ZodType[]], TOutput extends z.ZodType>({ input, output, }: {
7
+ input: TInput;
8
+ output: TOutput;
9
+ }) => z.ZodPipe<z.ZodCustom<z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<TInput, null>, TOutput>, z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<TInput, null>, TOutput>>, z.ZodTransform<Awaited<z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<TInput, null>, TOutput> extends infer T ? T extends z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<TInput, null>, TOutput> ? T extends z.core.$InferOuterFunctionTypeAsync<z.ZodTuple<TInput, null>, TOutput> ? T : z.core.$InferOuterFunctionTypeAsync<z.ZodTuple<TInput, null>, TOutput> : never : never>, z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<TInput, null>, TOutput>>>;
10
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../src/schema/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,EAAE,GAAI,MAAM,SAAS,CAAC,CAAC,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC,EAAE,OAAO,SAAS,CAAC,CAAC,OAAO,EAAE,mBAAmB;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,OAAO,CAAA;CAAE,uiGAQ9I,CAAC;AAEF,eAAO,MAAM,OAAO,GAAI,MAAM,SAAS,CAAC,CAAC,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC,EAAE,OAAO,SAAS,CAAC,CAAC,OAAO,EAAE,oBAG5F;IACD,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;CACjB,umBAQA,CAAC"}
package/dist/types.d.ts CHANGED
@@ -1,11 +1,18 @@
1
- import type { Prettify, Require } from "@serwist/utils";
1
+ import type { MaybePromise, Prettify, Require } from "@serwist/utils";
2
2
  import type { PackageJson } from "type-fest";
3
3
  import type { z } from "zod";
4
- import type { manifestEntry } from "./schema/manifestEntry.js";
5
- import type { manifestTransform, manifestTransformResult } from "./schema/manifestTransform.js";
4
+ import type { manifestEntry } from "./schema/manifest-entry.js";
5
+ import type { manifestTransformResult } from "./schema/manifest-transform.js";
6
6
  export type ManifestEntry = z.input<typeof manifestEntry>;
7
7
  export type ManifestTransformResult = z.input<typeof manifestTransformResult>;
8
- export type ManifestTransform = z.input<typeof manifestTransform>;
8
+ export type ManifestTransform = (entries: (ManifestEntry & {
9
+ size: number;
10
+ })[], params?: unknown) => MaybePromise<{
11
+ manifest: (ManifestEntry & {
12
+ size: number;
13
+ })[];
14
+ warnings?: string[] | undefined;
15
+ }>;
9
16
  export interface BasePartial {
10
17
  /**
11
18
  * A list of entries to be precached, in addition to any entries that are
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AACxD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAC7B,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAEhG,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,aAAa,CAAC,CAAC;AAE1D,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,uBAAuB,CAAC,CAAC;AAE9E,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AAElE,MAAM,WAAW,WAAW;IAC1B;;;OAGG;IACH,yBAAyB,CAAC,EAAE,CAAC,MAAM,GAAG,aAAa,CAAC,EAAE,CAAC;IACvD;;;;OAIG;IACH,uBAAuB,CAAC,EAAE,OAAO,CAAC;IAClC;;;;;;;OAOG;IACH,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,iBAAiB,EAAE,CAAC;IACzC;;;;;OAKG;IACH,6BAA6B,CAAC,EAAE,MAAM,CAAC;IACvC;;;;;;;;;;;;;;;;;;OAkBG;IACH,eAAe,CAAC,EAAE;QAChB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAC;KACvB,CAAC;CACH;AAED,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAC,OAAO,CAAC,WAAW,EAAE,yBAAyB,GAAG,+B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M,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,sBAAsB,GAAG,QAAQ,CAAC,qBAAqB,CAAC,CAAC;AAErE,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CAAC,WAAW,GAAG,WAAW,GAAG,4BAA4B,CAAC,CAAC;AAEpG,MAAM,MAAM,0BAA0B,GAAG,QAAQ,CAAC,YAAY,GAAG,YAAY,GAAG,6BAA6B,CAAC,CAAC;AAE/G,MAAM,MAAM,qBAAqB,GAAG,QAAQ,CAAC,WAAW,GAAG,WAAW,GAAG,aAAa,GAAG,qBAAqB,GAAG,4BAA4B,CAAC,CAAC;AAE/I,MAAM,MAAM,6BAA6B,GAAG,QAAQ,CAClD,YAAY,GAAG,YAAY,GAAG,cAAc,GAAG,sBAAsB,GAAG,6BAA6B,CACtG,CAAC;AAEF,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,eAAe,EAAE,aAAa,EAAE,GAAG,SAAS,CAAC;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,MAAM,WAAW,GAAG,IAAI,CAAC,iBAAiB,EAAE,iBAAiB,CAAC,GAAG;IACrE,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,MAAM,CAAC;AAEvC;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,QAAQ,CAAC,WAAW,CAAC,CAAC;AAEvD;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,aAAa,GAAG,gBAAgB,GAAG,uBAAuB,GAAG,oBAAoB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@serwist/build",
3
- "version": "10.0.0-preview.8",
3
+ "version": "10.0.0-preview.9",
4
4
  "type": "module",
5
5
  "sideEffects": false,
6
6
  "description": "A module that integrates into your build process, helping you generate a manifest of local files that should be precached.",
@@ -49,18 +49,20 @@
49
49
  "./package.json": "./package.json"
50
50
  },
51
51
  "dependencies": {
52
- "glob": "11.0.1",
53
- "pretty-bytes": "6.1.1",
52
+ "glob": "11.0.3",
53
+ "pretty-bytes": "7.0.0",
54
54
  "source-map": "0.8.0-beta.0",
55
- "zod": "3.24.3",
56
- "@serwist/utils": "10.0.0-preview.8"
55
+ "zod": "4.0.5",
56
+ "@serwist/utils": "10.0.0-preview.9"
57
57
  },
58
58
  "devDependencies": {
59
- "@types/node": "22.14.1",
60
- "rollup": "4.40.0",
61
- "type-fest": "4.40.0",
59
+ "@types/common-tags": "1.8.4",
60
+ "@types/node": "24.0.14",
61
+ "rollup": "4.45.1",
62
+ "type-fest": "4.41.0",
62
63
  "typescript": "5.8.3",
63
- "@serwist/configs": "10.0.0-preview.8"
64
+ "@serwist/configs": "10.0.0-preview.9",
65
+ "@serwist/utils": "10.0.0-preview.9"
64
66
  },
65
67
  "peerDependencies": {
66
68
  "typescript": ">=5.0.0"
@@ -1,16 +1,18 @@
1
- import { type Assignable, type Equals, assertType } from "./schema/assertType.js";
1
+ import { type Assignable, assertType, type Equals } from "./schema/assert-type.js";
2
2
  import { basePartial } from "./schema/base.js";
3
- import { getManifestOptions } from "./schema/getManifest.js";
3
+ import { SerwistConfigError, validationErrorMap } from "./schema/error.js";
4
+ import { getManifestOptions } from "./schema/get-manifest.js";
4
5
  import { globPartial, optionalGlobDirectoryPartial, requiredGlobDirectoryPartial } from "./schema/glob.js";
5
- import { baseInjectPartial, injectManifestOptions } from "./schema/injectManifest.js";
6
- import { manifestEntry } from "./schema/manifestEntry.js";
7
- import { manifestTransform, manifestTransformResult } from "./schema/manifestTransform.js";
8
- import { SerwistConfigError } from "./schema/serwistConfigError.js";
9
- import { optionalSwDestPartial, requiredSwDestPartial } from "./schema/swDest.js";
10
- import { validationErrorMap } from "./schema/validationErrorMap.js";
6
+ import { baseInjectPartial, injectManifestOptions } from "./schema/inject-manifest.js";
7
+ import { manifestEntry } from "./schema/manifest-entry.js";
8
+ import { manifestTransform, manifestTransformResult } from "./schema/manifest-transform.js";
9
+ import { optionalSwDestPartial, requiredSwDestPartial } from "./schema/sw-dest.js";
10
+ import { asyncFn, fn } from "./schema/utils.js";
11
11
 
12
12
  export {
13
13
  assertType,
14
+ fn,
15
+ asyncFn,
14
16
  basePartial,
15
17
  globPartial,
16
18
  baseInjectPartial as injectPartial,
@@ -156,7 +156,6 @@ export async function transformManifest({
156
156
  let size = 0;
157
157
  for (const manifestEntry of transformedManifest as (ManifestEntry & { size?: number })[]) {
158
158
  size += manifestEntry.size || 0;
159
- // biome-ignore lint/performance/noDelete: These values are no longer necessary.
160
159
  delete manifestEntry.size;
161
160
  }
162
161
 
@@ -19,9 +19,9 @@ export function translateURLToSourcemapPaths(
19
19
  srcPath: string | undefined;
20
20
  warning: string | undefined;
21
21
  } {
22
- let destPath: string | undefined = undefined;
23
- let srcPath: string | undefined = undefined;
24
- let warning: string | undefined = undefined;
22
+ let destPath: string | undefined;
23
+ let srcPath: string | undefined;
24
+ let warning: string | undefined;
25
25
 
26
26
  if (url && !url.startsWith("data:")) {
27
27
  const possibleSrcPath = path.resolve(path.dirname(swSrc), url);
@@ -1,4 +1,4 @@
1
- import { SerwistConfigError } from "../schema/serwistConfigError.js";
1
+ import { z } from "zod";
2
2
  /*
3
3
  Copyright 2021 Google LLC
4
4
 
@@ -6,21 +6,27 @@ import { SerwistConfigError } from "../schema/serwistConfigError.js";
6
6
  license that can be found in the LICENSE file or at
7
7
  https://opensource.org/licenses/MIT.
8
8
  */
9
- import { validationErrorMap } from "../schema/validationErrorMap.js";
9
+ import { SerwistConfigError, validationErrorMap } from "../schema/error.js";
10
10
  import type { GetManifestOptionsComplete, InjectManifestOptionsComplete } from "../types.js";
11
11
 
12
12
  export const validateGetManifestOptions = async (input: unknown): Promise<GetManifestOptionsComplete> => {
13
- const result = await (await import("../schema/getManifest.js")).getManifestOptions.spa(input, { errorMap: validationErrorMap });
13
+ const result = await (await import("../schema/get-manifest.js")).getManifestOptions.spa(input, { error: validationErrorMap });
14
14
  if (!result.success) {
15
- throw new SerwistConfigError({ moduleName: "@serwist/build", message: JSON.stringify(result.error.format(), null, 2) });
15
+ throw new SerwistConfigError({
16
+ moduleName: "@serwist/build",
17
+ message: z.prettifyError(result.error),
18
+ });
16
19
  }
17
20
  return result.data;
18
21
  };
19
22
 
20
23
  export const validateInjectManifestOptions = async (input: unknown): Promise<InjectManifestOptionsComplete> => {
21
- const result = await (await import("../schema/injectManifest.js")).injectManifestOptions.spa(input, { errorMap: validationErrorMap });
24
+ const result = await (await import("../schema/inject-manifest.js")).injectManifestOptions.spa(input, { error: validationErrorMap });
22
25
  if (!result.success) {
23
- throw new SerwistConfigError({ moduleName: "@serwist/build", message: JSON.stringify(result.error.format(), null, 2) });
26
+ throw new SerwistConfigError({
27
+ moduleName: "@serwist/build",
28
+ message: z.prettifyError(result.error),
29
+ });
24
30
  }
25
31
  return result.data;
26
32
  };
@@ -1,20 +1,18 @@
1
1
  import { z } from "zod";
2
2
 
3
3
  import type { BasePartial, BaseResolved } from "../types.js";
4
- import { type Equals, assertType } from "./assertType.js";
5
- import { manifestEntry } from "./manifestEntry.js";
6
- import { manifestTransform } from "./manifestTransform.js";
4
+ import { assertType, type Equals } from "./assert-type.js";
5
+ import { manifestEntry } from "./manifest-entry.js";
6
+ import { manifestTransform } from "./manifest-transform.js";
7
7
 
8
- export const basePartial = z
9
- .object({
10
- additionalPrecacheEntries: z.array(z.union([z.string(), manifestEntry])).optional(),
11
- disablePrecacheManifest: z.boolean().default(false),
12
- dontCacheBustURLsMatching: z.instanceof(RegExp).optional(),
13
- manifestTransforms: z.array(manifestTransform).optional(),
14
- maximumFileSizeToCacheInBytes: z.number().default(2097152),
15
- modifyURLPrefix: z.record(z.string(), z.string()).optional(),
16
- })
17
- .strict("Do not pass invalid properties to BasePartial!");
8
+ export const basePartial = z.strictObject({
9
+ additionalPrecacheEntries: z.array(z.union([z.string(), manifestEntry])).optional(),
10
+ disablePrecacheManifest: z.boolean().default(false),
11
+ dontCacheBustURLsMatching: z.instanceof(RegExp).optional(),
12
+ manifestTransforms: z.array(manifestTransform).optional(),
13
+ maximumFileSizeToCacheInBytes: z.number().default(2097152),
14
+ modifyURLPrefix: z.record(z.string(), z.string()).optional(),
15
+ });
18
16
 
19
17
  assertType<Equals<BasePartial, z.input<typeof basePartial>>>();
20
18
  assertType<Equals<BaseResolved, z.output<typeof basePartial>>>();
@@ -0,0 +1,53 @@
1
+ import type { z } from "zod";
2
+
3
+ export class SerwistConfigError extends Error {
4
+ constructor({ moduleName, message }: { moduleName?: string; message?: string }) {
5
+ super(`Invalid ${moduleName ?? "Serwist"} configuration:\n${message}`);
6
+ Object.setPrototypeOf(this, new.target.prototype);
7
+ }
8
+ }
9
+
10
+ const parsedType = (data: any): string => {
11
+ const t = typeof data;
12
+
13
+ switch (t) {
14
+ case "number": {
15
+ return Number.isNaN(data) ? "NaN" : "number";
16
+ }
17
+ case "object": {
18
+ if (Array.isArray(data)) {
19
+ return "array";
20
+ }
21
+ if (data === null) {
22
+ return "null";
23
+ }
24
+
25
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
26
+ return data.constructor.name;
27
+ }
28
+ }
29
+ }
30
+ return t;
31
+ };
32
+
33
+ export const validationErrorMap: z.core.$ZodErrorMap = (error) => {
34
+ /* This is where you override the various error codes */
35
+ switch (error.code) {
36
+ case "invalid_type": {
37
+ return `${error.message ?? "Received invalid type"}: expected ${error.expected}, received ${parsedType(error.input)}.`;
38
+ }
39
+ case "invalid_value": {
40
+ return `${error.message ?? "Received invalid value"}: expected ${error.expected}, received ${parsedType(error.input)}.`;
41
+ }
42
+ case "invalid_union": {
43
+ return `${error.message ?? "Received invalid union"}:\n${error.errors.flatMap((err) => err.map((e) => ` → ${e.message}`)).join("\n")}`;
44
+ }
45
+ case "unrecognized_keys": {
46
+ return `${error.message ?? "Received unrecognized keys"}: ${error.keys.join(".")}`;
47
+ }
48
+ case "custom": {
49
+ return error.message ?? undefined;
50
+ }
51
+ }
52
+ return undefined;
53
+ };
@@ -1,13 +1,14 @@
1
- import type { z } from "zod";
1
+ import { z } from "zod";
2
2
  import type { GetManifestOptions, GetManifestOptionsComplete } from "../types.js";
3
- import { type Equals, assertType } from "./assertType.js";
3
+ import { assertType, type Equals } from "./assert-type.js";
4
4
  import { basePartial } from "./base.js";
5
5
  import { globPartial, requiredGlobDirectoryPartial } from "./glob.js";
6
6
 
7
- export const getManifestOptions = basePartial
8
- .merge(globPartial)
9
- .merge(requiredGlobDirectoryPartial)
10
- .strict("Do not pass invalid properties to GetManifestOptions!");
7
+ export const getManifestOptions = z.strictObject({
8
+ ...basePartial.shape,
9
+ ...globPartial.shape,
10
+ ...requiredGlobDirectoryPartial.shape,
11
+ });
11
12
 
12
13
  assertType<Equals<GetManifestOptions, z.input<typeof getManifestOptions>>>();
13
14
  assertType<Equals<GetManifestOptionsComplete, z.output<typeof getManifestOptions>>>();