@serwist/build 10.0.0-preview.1 → 10.0.0-preview.11

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 (114) hide show
  1. package/dist/chunks/constants.js +59 -0
  2. package/dist/chunks/get-manifest.js +11 -0
  3. package/dist/chunks/glob.js +50 -30
  4. package/dist/chunks/inject-manifest.js +29 -0
  5. package/dist/get-manifest.d.ts +1 -1
  6. package/dist/get-manifest.d.ts.map +1 -1
  7. package/dist/index.d.ts +3 -11
  8. package/dist/index.d.ts.map +1 -1
  9. package/dist/index.js +16 -151
  10. package/dist/index.schema.d.ts +9 -9
  11. package/dist/index.schema.d.ts.map +1 -1
  12. package/dist/index.schema.js +4 -4
  13. package/dist/inject-manifest.d.ts.map +1 -1
  14. package/dist/lib/additional-precache-entries-transform.d.ts +3 -7
  15. package/dist/lib/additional-precache-entries-transform.d.ts.map +1 -1
  16. package/dist/lib/constants.d.ts +2 -0
  17. package/dist/lib/constants.d.ts.map +1 -0
  18. package/dist/lib/escape-regexp.d.ts.map +1 -1
  19. package/dist/lib/get-file-details.d.ts +2 -1
  20. package/dist/lib/get-file-details.d.ts.map +1 -1
  21. package/dist/lib/get-file-manifest-entries.d.ts.map +1 -1
  22. package/dist/lib/modify-url-prefix-transform.d.ts.map +1 -1
  23. package/dist/lib/no-revision-for-urls-matching-transform.d.ts.map +1 -1
  24. package/dist/lib/transform-manifest.d.ts +2 -1
  25. package/dist/lib/transform-manifest.d.ts.map +1 -1
  26. package/dist/lib/validate-options.d.ts.map +1 -1
  27. package/dist/schema/{assertType.d.ts → assert-type.d.ts} +1 -1
  28. package/dist/schema/assert-type.d.ts.map +1 -0
  29. package/dist/schema/base.d.ts +5 -166
  30. package/dist/schema/base.d.ts.map +1 -1
  31. package/dist/schema/{serwistConfigError.d.ts → error.d.ts} +3 -1
  32. package/dist/schema/error.d.ts.map +1 -0
  33. package/dist/schema/get-manifest.d.ts +16 -0
  34. package/dist/schema/get-manifest.d.ts.map +1 -0
  35. package/dist/schema/glob.d.ts +6 -26
  36. package/dist/schema/glob.d.ts.map +1 -1
  37. package/dist/schema/inject-manifest.d.ts +23 -0
  38. package/dist/schema/inject-manifest.d.ts.map +1 -0
  39. package/dist/schema/manifest-entry.d.ts +16 -0
  40. package/dist/schema/manifest-entry.d.ts.map +1 -0
  41. package/dist/schema/manifest-transform.d.ts +8 -0
  42. package/dist/schema/manifest-transform.d.ts.map +1 -0
  43. package/dist/schema/sw-dest.d.ts +8 -0
  44. package/dist/schema/sw-dest.d.ts.map +1 -0
  45. package/dist/schema/utils.d.ts +16 -0
  46. package/dist/schema/utils.d.ts.map +1 -0
  47. package/dist/types.d.ts +12 -28
  48. package/dist/types.d.ts.map +1 -1
  49. package/package.json +13 -12
  50. package/src/get-manifest.ts +1 -1
  51. package/src/index.schema.ts +10 -8
  52. package/src/index.ts +5 -11
  53. package/src/inject-manifest.ts +2 -1
  54. package/src/lib/additional-precache-entries-transform.ts +5 -6
  55. package/src/lib/constants.ts +1 -0
  56. package/src/lib/get-file-details.ts +3 -4
  57. package/src/lib/get-file-manifest-entries.ts +3 -4
  58. package/src/lib/modify-url-prefix-transform.ts +1 -1
  59. package/src/lib/no-revision-for-urls-matching-transform.ts +1 -1
  60. package/src/lib/rebase-path.ts +1 -1
  61. package/src/lib/transform-manifest.ts +3 -3
  62. package/src/lib/translate-url-to-sourcemap-paths.ts +4 -4
  63. package/src/lib/validate-options.ts +12 -6
  64. package/src/schema/base.ts +13 -15
  65. package/src/schema/error.ts +53 -0
  66. package/src/schema/{getManifest.ts → get-manifest.ts} +7 -6
  67. package/src/schema/glob.ts +15 -20
  68. package/src/schema/inject-manifest.ts +24 -0
  69. package/src/schema/manifest-entry.ts +11 -0
  70. package/src/schema/manifest-transform.ts +14 -0
  71. package/src/schema/{swDest.ts → sw-dest.ts} +7 -11
  72. package/src/schema/utils.ts +48 -0
  73. package/src/types.ts +9 -32
  74. package/dist/chunks/getManifest.js +0 -6
  75. package/dist/chunks/injectManifest.js +0 -23
  76. package/dist/chunks/validationErrorMap.js +0 -54
  77. package/dist/lib/errors.d.ts +0 -47
  78. package/dist/lib/errors.d.ts.map +0 -1
  79. package/dist/lib/get-composite-details.d.ts +0 -3
  80. package/dist/lib/get-composite-details.d.ts.map +0 -1
  81. package/dist/lib/get-file-hash.d.ts +0 -2
  82. package/dist/lib/get-file-hash.d.ts.map +0 -1
  83. package/dist/lib/get-file-size.d.ts +0 -2
  84. package/dist/lib/get-file-size.d.ts.map +0 -1
  85. package/dist/lib/get-string-details.d.ts +0 -3
  86. package/dist/lib/get-string-details.d.ts.map +0 -1
  87. package/dist/lib/get-string-hash.d.ts +0 -3
  88. package/dist/lib/get-string-hash.d.ts.map +0 -1
  89. package/dist/schema/assertType.d.ts.map +0 -1
  90. package/dist/schema/getManifest.d.ts +0 -192
  91. package/dist/schema/getManifest.d.ts.map +0 -1
  92. package/dist/schema/injectManifest.d.ts +0 -213
  93. package/dist/schema/injectManifest.d.ts.map +0 -1
  94. package/dist/schema/manifestEntry.d.ts +0 -15
  95. package/dist/schema/manifestEntry.d.ts.map +0 -1
  96. package/dist/schema/manifestTransform.d.ts +0 -125
  97. package/dist/schema/manifestTransform.d.ts.map +0 -1
  98. package/dist/schema/serwistConfigError.d.ts.map +0 -1
  99. package/dist/schema/swDest.d.ts +0 -16
  100. package/dist/schema/swDest.d.ts.map +0 -1
  101. package/dist/schema/validationErrorMap.d.ts +0 -3
  102. package/dist/schema/validationErrorMap.d.ts.map +0 -1
  103. package/src/lib/errors.ts +0 -93
  104. package/src/lib/get-composite-details.ts +0 -31
  105. package/src/lib/get-file-hash.ts +0 -21
  106. package/src/lib/get-file-size.ts +0 -22
  107. package/src/lib/get-string-details.ts +0 -16
  108. package/src/lib/get-string-hash.ts +0 -15
  109. package/src/schema/injectManifest.ts +0 -25
  110. package/src/schema/manifestEntry.ts +0 -9
  111. package/src/schema/manifestTransform.ts +0 -15
  112. package/src/schema/serwistConfigError.ts +0 -6
  113. package/src/schema/validationErrorMap.ts +0 -36
  114. /package/src/schema/{assertType.ts → assert-type.ts} +0 -0
@@ -1,172 +1,11 @@
1
1
  import { z } from "zod";
2
+ import type { ManifestEntry, ManifestTransform } from "../types.js";
2
3
  export declare const basePartial: z.ZodObject<{
3
- additionalPrecacheEntries: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
4
- integrity: z.ZodOptional<z.ZodString>;
5
- revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
6
- url: z.ZodString;
7
- }, "strict", z.ZodTypeAny, {
8
- url: string;
9
- integrity?: string | undefined;
10
- revision?: string | null | undefined;
11
- }, {
12
- url: string;
13
- integrity?: string | undefined;
14
- revision?: string | null | undefined;
15
- }>]>, "many">>;
4
+ additionalPrecacheEntries: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodType<ManifestEntry, ManifestEntry, z.core.$ZodTypeInternals<ManifestEntry, ManifestEntry>>]>>>;
16
5
  disablePrecacheManifest: z.ZodDefault<z.ZodBoolean>;
17
- dontCacheBustURLsMatching: z.ZodOptional<z.ZodType<RegExp, z.ZodTypeDef, RegExp>>;
18
- manifestTransforms: z.ZodOptional<z.ZodArray<z.ZodFunction<z.ZodTuple<[z.ZodArray<z.ZodObject<z.objectUtil.extendShape<{
19
- integrity: z.ZodOptional<z.ZodString>;
20
- revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
21
- url: z.ZodString;
22
- }, {
23
- size: z.ZodNumber;
24
- }>, "strip", z.ZodTypeAny, {
25
- url: string;
26
- size: number;
27
- integrity?: string | undefined;
28
- revision?: string | null | undefined;
29
- }, {
30
- url: string;
31
- size: number;
32
- integrity?: string | undefined;
33
- revision?: string | null | undefined;
34
- }>, "many">, z.ZodOptional<z.ZodUnknown>], null>, z.ZodUnion<[z.ZodPromise<z.ZodObject<{
35
- manifest: z.ZodArray<z.ZodObject<z.objectUtil.extendShape<{
36
- integrity: z.ZodOptional<z.ZodString>;
37
- revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
38
- url: z.ZodString;
39
- }, {
40
- size: z.ZodNumber;
41
- }>, "strip", z.ZodTypeAny, {
42
- url: string;
43
- size: number;
44
- integrity?: string | undefined;
45
- revision?: string | null | undefined;
46
- }, {
47
- url: string;
48
- size: number;
49
- integrity?: string | undefined;
50
- revision?: string | null | undefined;
51
- }>, "many">;
52
- warnings: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
53
- }, "strict", z.ZodTypeAny, {
54
- manifest: {
55
- url: string;
56
- size: number;
57
- integrity?: string | undefined;
58
- revision?: string | null | undefined;
59
- }[];
60
- warnings?: string[] | undefined;
61
- }, {
62
- manifest: {
63
- url: string;
64
- size: number;
65
- integrity?: string | undefined;
66
- revision?: string | null | undefined;
67
- }[];
68
- warnings?: string[] | undefined;
69
- }>>, z.ZodObject<{
70
- manifest: z.ZodArray<z.ZodObject<z.objectUtil.extendShape<{
71
- integrity: z.ZodOptional<z.ZodString>;
72
- revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
73
- url: z.ZodString;
74
- }, {
75
- size: z.ZodNumber;
76
- }>, "strip", z.ZodTypeAny, {
77
- url: string;
78
- size: number;
79
- integrity?: string | undefined;
80
- revision?: string | null | undefined;
81
- }, {
82
- url: string;
83
- size: number;
84
- integrity?: string | undefined;
85
- revision?: string | null | undefined;
86
- }>, "many">;
87
- warnings: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
88
- }, "strict", z.ZodTypeAny, {
89
- manifest: {
90
- url: string;
91
- size: number;
92
- integrity?: string | undefined;
93
- revision?: string | null | undefined;
94
- }[];
95
- warnings?: string[] | undefined;
96
- }, {
97
- manifest: {
98
- url: string;
99
- size: number;
100
- integrity?: string | undefined;
101
- revision?: string | null | undefined;
102
- }[];
103
- warnings?: string[] | undefined;
104
- }>]>>, "many">>;
6
+ dontCacheBustURLsMatching: z.ZodOptional<z.ZodCustom<RegExp, RegExp>>;
7
+ manifestTransforms: z.ZodOptional<z.ZodArray<z.ZodType<ManifestTransform, ManifestTransform, z.core.$ZodTypeInternals<ManifestTransform, ManifestTransform>>>>;
105
8
  maximumFileSizeToCacheInBytes: z.ZodDefault<z.ZodNumber>;
106
9
  modifyURLPrefix: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
107
- }, "strict", z.ZodTypeAny, {
108
- disablePrecacheManifest: boolean;
109
- maximumFileSizeToCacheInBytes: number;
110
- additionalPrecacheEntries?: (string | {
111
- url: string;
112
- integrity?: string | undefined;
113
- revision?: string | null | undefined;
114
- })[] | undefined;
115
- dontCacheBustURLsMatching?: RegExp | undefined;
116
- manifestTransforms?: ((args_0: {
117
- url: string;
118
- size: number;
119
- integrity?: string | undefined;
120
- revision?: string | null | undefined;
121
- }[], args_1: unknown) => {
122
- manifest: {
123
- url: string;
124
- size: number;
125
- integrity?: string | undefined;
126
- revision?: string | null | undefined;
127
- }[];
128
- warnings?: string[] | undefined;
129
- } | Promise<{
130
- manifest: {
131
- url: string;
132
- size: number;
133
- integrity?: string | undefined;
134
- revision?: string | null | undefined;
135
- }[];
136
- warnings?: string[] | undefined;
137
- }>)[] | undefined;
138
- modifyURLPrefix?: Record<string, string> | undefined;
139
- }, {
140
- disablePrecacheManifest?: boolean | undefined;
141
- maximumFileSizeToCacheInBytes?: number | undefined;
142
- additionalPrecacheEntries?: (string | {
143
- url: string;
144
- integrity?: string | undefined;
145
- revision?: string | null | undefined;
146
- })[] | undefined;
147
- dontCacheBustURLsMatching?: RegExp | undefined;
148
- manifestTransforms?: ((args_0: {
149
- url: string;
150
- size: number;
151
- integrity?: string | undefined;
152
- revision?: string | null | undefined;
153
- }[], args_1: unknown) => {
154
- manifest: {
155
- url: string;
156
- size: number;
157
- integrity?: string | undefined;
158
- revision?: string | null | undefined;
159
- }[];
160
- warnings?: string[] | undefined;
161
- } | Promise<{
162
- manifest: {
163
- url: string;
164
- size: number;
165
- integrity?: string | undefined;
166
- revision?: string | null | undefined;
167
- }[];
168
- warnings?: string[] | undefined;
169
- }>)[] | undefined;
170
- modifyURLPrefix?: Record<string, string> | undefined;
171
- }>;
10
+ }, z.core.$strict>;
172
11
  //# sourceMappingURL=base.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/schema/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAOxB,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EASmC,CAAC"}
1
+ {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/schema/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAA6B,aAAa,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAM/F,eAAO,MAAM,WAAW;;;;;;;kBAOtB,CAAC"}
@@ -1,7 +1,9 @@
1
+ import type { z } from "zod";
1
2
  export declare class SerwistConfigError extends Error {
2
3
  constructor({ moduleName, message }: {
3
4
  moduleName?: string;
4
5
  message?: string;
5
6
  });
6
7
  }
7
- //# sourceMappingURL=serwistConfigError.d.ts.map
8
+ export declare const validationErrorMap: z.core.$ZodErrorMap;
9
+ //# sourceMappingURL=error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"error.d.ts","sourceRoot":"","sources":["../../src/schema/error.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,qBAAa,kBAAmB,SAAQ,KAAK;gBAC/B,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE;QAAE,UAAU,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE;CAI/E;AAyBD,eAAO,MAAM,kBAAkB,EAAE,CAAC,CAAC,IAAI,CAAC,YAoBvC,CAAC"}
@@ -0,0 +1,16 @@
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.ZodType<import("../types.js").ManifestEntry, import("../types.js").ManifestEntry, z.core.$ZodTypeInternals<import("../types.js").ManifestEntry, import("../types.js").ManifestEntry>>]>>>;
10
+ disablePrecacheManifest: z.ZodDefault<z.ZodBoolean>;
11
+ dontCacheBustURLsMatching: z.ZodOptional<z.ZodCustom<RegExp, RegExp>>;
12
+ manifestTransforms: z.ZodOptional<z.ZodArray<z.ZodType<import("../types.js").ManifestTransform, import("../types.js").ManifestTransform, z.core.$ZodTypeInternals<import("../types.js").ManifestTransform, import("../types.js").ManifestTransform>>>>;
13
+ maximumFileSizeToCacheInBytes: z.ZodDefault<z.ZodNumber>;
14
+ modifyURLPrefix: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
15
+ }, z.core.$strict>;
16
+ //# 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;AAWxB,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,23 @@
1
+ import { z } from "zod";
2
+ export declare const baseInjectPartial: z.ZodObject<{
3
+ injectionPoint: z.ZodPrefault<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.ZodPrefault<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.ZodType<import("../types.js").ManifestEntry, import("../types.js").ManifestEntry, z.core.$ZodTypeInternals<import("../types.js").ManifestEntry, import("../types.js").ManifestEntry>>]>>>;
17
+ disablePrecacheManifest: z.ZodDefault<z.ZodBoolean>;
18
+ dontCacheBustURLsMatching: z.ZodOptional<z.ZodCustom<RegExp, RegExp>>;
19
+ manifestTransforms: z.ZodOptional<z.ZodArray<z.ZodType<import("../types.js").ManifestTransform, import("../types.js").ManifestTransform, z.core.$ZodTypeInternals<import("../types.js").ManifestTransform, import("../types.js").ManifestTransform>>>>;
20
+ maximumFileSizeToCacheInBytes: z.ZodDefault<z.ZodNumber>;
21
+ modifyURLPrefix: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
22
+ }, z.core.$strict>;
23
+ //# 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,16 @@
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
+ export declare const sizeObject: z.ZodObject<{
8
+ size: z.ZodNumber;
9
+ }, z.core.$strip>;
10
+ export declare const manifestEntryWithSize: z.ZodObject<{
11
+ size: z.ZodNumber;
12
+ integrity: z.ZodOptional<z.ZodString>;
13
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
14
+ url: z.ZodString;
15
+ }, z.core.$strip>;
16
+ //# 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;AAEH,eAAO,MAAM,UAAU;;iBAAiC,CAAC;AAEzD,eAAO,MAAM,qBAAqB;;;;;iBAA4D,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { z } from "zod";
2
+ import type { ManifestEntryWithSize, ManifestTransformResult } from "../types.js";
3
+ export declare const manifestTransformResult: z.ZodObject<{
4
+ manifest: z.ZodArray<z.ZodType<ManifestEntryWithSize, ManifestEntryWithSize, z.core.$ZodTypeInternals<ManifestEntryWithSize, ManifestEntryWithSize>>>;
5
+ warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
6
+ }, z.core.$strict>;
7
+ export declare const manifestTransform: z.ZodType<(args_0: ManifestEntryWithSize[], args_1?: unknown) => import("@serwist/utils").MaybePromise<ManifestTransformResult>, (args_0: ManifestEntryWithSize[], args_1?: unknown) => import("@serwist/utils").MaybePromise<ManifestTransformResult>, z.core.$ZodTypeInternals<(args_0: ManifestEntryWithSize[], args_1?: unknown) => import("@serwist/utils").MaybePromise<ManifestTransformResult>, (args_0: ManifestEntryWithSize[], args_1?: unknown) => import("@serwist/utils").MaybePromise<ManifestTransformResult>>>;
8
+ //# 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;AACxB,OAAO,KAAK,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AAIlF,eAAO,MAAM,uBAAuB;;;kBAGlC,CAAC;AAEH,eAAO,MAAM,iBAAiB,igBAG5B,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,16 @@
1
+ import type { MaybePromise } from "@serwist/utils";
2
+ import { z } from "zod";
3
+ /**
4
+ * Prevents TS from inlining a schema’s inferred type.
5
+ * @internal
6
+ */
7
+ export declare const reference: <Output, Input = Output>(schema: z.ZodType<Output, Input>) => z.ZodType<Output, Input, z.core.$ZodTypeInternals<Output, Input>>;
8
+ export declare const asyncFn: <TInput extends [z.ZodType, ...z.ZodType[]], TOutput extends z.ZodType>({ input, output, }: {
9
+ input: TInput;
10
+ output: TOutput;
11
+ }) => z.ZodType<(...args: z.input<z.ZodTuple<TInput, null>>) => MaybePromise<z.output<TOutput>>, (...args: z.output<z.ZodTuple<TInput, null>>) => MaybePromise<z.input<TOutput>>>;
12
+ export declare const fn: <TInput extends [z.ZodType, ...z.ZodType[]], TOutput extends z.ZodType>({ input, output, }: {
13
+ input: TInput;
14
+ output: TOutput;
15
+ }) => z.ZodType<(...args: z.input<z.ZodTuple<TInput, null>>) => z.output<TOutput>, (...args: z.output<z.ZodTuple<TInput, null>>) => z.input<TOutput>>;
16
+ //# 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,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACnD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;;GAGG;AACH,eAAO,MAAM,SAAS,GAAI,MAAM,EAAE,KAAK,GAAG,MAAM,EAAE,QAAQ,CAAC,CAAC,OAAO,CAAC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1,15 @@
1
- import type { Require, Prettify } from "@serwist/utils";
2
- import type { PackageJson } from "type-fest";
1
+ import type { Prettify, Require } from "@serwist/utils";
3
2
  import type { z } from "zod";
4
- import type { manifestEntry } from "./schema/manifestEntry.js";
5
- import type { manifestTransform, manifestTransformResult } from "./schema/manifestTransform.js";
6
- export type ManifestEntry = z.input<typeof manifestEntry>;
7
- export type ManifestTransformResult = z.input<typeof manifestTransformResult>;
8
- export type ManifestTransform = z.input<typeof manifestTransform>;
3
+ import type { manifestEntry, manifestEntryWithSize } from "./schema/manifest-entry.js";
4
+ import type { manifestTransform, manifestTransformResult } from "./schema/manifest-transform.js";
5
+ export interface ManifestTransformResult extends z.infer<typeof manifestTransformResult> {
6
+ }
7
+ export interface ManifestEntry extends z.infer<typeof manifestEntry> {
8
+ }
9
+ export interface ManifestEntryWithSize extends z.infer<typeof manifestEntryWithSize> {
10
+ }
11
+ export interface ManifestTransform extends z.infer<typeof manifestTransform> {
12
+ }
9
13
  export interface BasePartial {
10
14
  /**
11
15
  * A list of entries to be precached, in addition to any entries that are
@@ -104,7 +108,7 @@ export interface GlobPartial {
104
108
  * [`node-glob`'s Glob Primer](https://github.com/isaacs/node-glob#glob-primer).
105
109
  * @default
106
110
  * ```
107
- * ["**\/*.{js,css,html}"]
111
+ * ["**\/*.{js,css,html,ico,apng,png,avif,jpg,jpeg,jfif,pjpeg,pjp,gif,svg,webp,json,webmanifest}"]
108
112
  * ```
109
113
  */
110
114
  globPatterns?: string[];
@@ -174,24 +178,4 @@ export interface GetManifestResult {
174
178
  export type BuildResult = Omit<GetManifestResult, "manifestEntries"> & {
175
179
  filePaths: string[];
176
180
  };
177
- /**
178
- * @private
179
- */
180
- export interface FileDetails {
181
- file: string;
182
- hash: string | null;
183
- size: number;
184
- }
185
- /**
186
- * @private
187
- */
188
- export type BuildType = "dev" | "prod";
189
- /**
190
- * @private
191
- */
192
- export type SerwistPackageJSON = Prettify<PackageJson>;
193
- /**
194
- * @private
195
- */
196
- export type MethodNames = "GetManifest" | "InjectManifest" | "WebpackInjectManifest" | "ViteInjectManifest";
197
181
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,QAAQ,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,W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ACjB;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"}
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "@serwist/build",
3
- "version": "10.0.0-preview.1",
3
+ "version": "10.0.0-preview.11",
4
4
  "type": "module",
5
+ "sideEffects": false,
5
6
  "description": "A module that integrates into your build process, helping you generate a manifest of local files that should be precached.",
6
7
  "files": [
7
8
  "src",
@@ -17,7 +18,7 @@
17
18
  "file manifest"
18
19
  ],
19
20
  "engines": {
20
- "node": ">=18.0.0"
21
+ "node": ">=20.0.0"
21
22
  },
22
23
  "author": "Google's Web DevRel Team",
23
24
  "contributors": [
@@ -48,20 +49,19 @@
48
49
  "./package.json": "./package.json"
49
50
  },
50
51
  "dependencies": {
51
- "common-tags": "1.8.2",
52
- "glob": "10.4.5",
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.2",
56
- "@serwist/utils": "10.0.0-preview.1"
55
+ "zod": "4.0.5",
56
+ "@serwist/utils": "10.0.0-preview.11"
57
57
  },
58
58
  "devDependencies": {
59
59
  "@types/common-tags": "1.8.4",
60
- "@types/node": "22.13.5",
61
- "rollup": "4.34.8",
62
- "type-fest": "4.35.0",
63
- "typescript": "5.7.3",
64
- "@serwist/configs": "10.0.0-preview.1"
60
+ "@types/node": "24.0.14",
61
+ "rollup": "4.45.1",
62
+ "typescript": "5.8.3",
63
+ "@serwist/configs": "10.0.0-preview.11",
64
+ "@serwist/utils": "10.0.0-preview.11"
65
65
  },
66
66
  "peerDependencies": {
67
67
  "typescript": ">=5.0.0"
@@ -75,6 +75,7 @@
75
75
  "build": "rimraf dist && NODE_OPTIONS='--max-old-space-size=4096' NODE_ENV=production rollup --config rollup.config.js",
76
76
  "dev": "rollup --config rollup.config.js --watch",
77
77
  "lint": "biome lint ./src",
78
+ "qcheck": "biome check ./src",
78
79
  "typecheck": "tsc"
79
80
  }
80
81
  }
@@ -18,7 +18,7 @@ import type { GetManifestOptions, GetManifestResult } from "./types.js";
18
18
  * ```
19
19
  * // The following lists some common options; see the rest of the documentation
20
20
  * // for the full set of options and defaults.
21
- * const {count, manifestEntries, size, warnings} = await getManifest({
21
+ * const { count, manifestEntries, size, warnings } = await getManifest({
22
22
  * dontCacheBustURLsMatching: [new RegExp('...')],
23
23
  * globDirectory: '...',
24
24
  * globPatterns: ['...', '...'],
@@ -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,
package/src/index.ts CHANGED
@@ -4,10 +4,12 @@
4
4
  Use of this source code is governed by an MIT-style
5
5
  license that can be found in the LICENSE file or at
6
6
  https://opensource.org/licenses/MIT.
7
- */
7
+ */
8
+ import { errors } from "@serwist/utils/node";
9
+
8
10
  import { getManifest } from "./get-manifest.js";
9
11
  import { injectManifest } from "./inject-manifest.js";
10
- import { errors } from "./lib/errors.js";
12
+ import { DEFAULT_GLOB_PATTERNS } from "./lib/constants.js";
11
13
  import { escapeRegExp } from "./lib/escape-regexp.js";
12
14
  import { getFileManifestEntries } from "./lib/get-file-manifest-entries.js";
13
15
  import { getSourceMapURL } from "./lib/get-source-map-url.js";
@@ -17,16 +19,9 @@ import { transformManifest } from "./lib/transform-manifest.js";
17
19
  import { translateURLToSourcemapPaths } from "./lib/translate-url-to-sourcemap-paths.js";
18
20
  import { validateGetManifestOptions, validateInjectManifestOptions } from "./lib/validate-options.js";
19
21
 
20
- // TODO: remove in v10.
21
- /**
22
- * Use `JSON.stringify` instead.
23
- *
24
- * @deprecated
25
- */
26
- const stringify = JSON.stringify;
27
-
28
22
  export {
29
23
  errors,
24
+ DEFAULT_GLOB_PATTERNS,
30
25
  escapeRegExp,
31
26
  getFileManifestEntries,
32
27
  getManifest,
@@ -34,7 +29,6 @@ export {
34
29
  injectManifest,
35
30
  rebasePath,
36
31
  replaceAndUpdateSourceMap,
37
- stringify,
38
32
  transformManifest,
39
33
  translateURLToSourcemapPaths,
40
34
  validateGetManifestOptions,
@@ -9,8 +9,9 @@ import assert from "node:assert";
9
9
  import fsp from "node:fs/promises";
10
10
  import path from "node:path";
11
11
  import { toUnix } from "@serwist/utils";
12
+ import { errors } from "@serwist/utils/node";
12
13
  import type { RawSourceMap } from "source-map";
13
- import { errors } from "./lib/errors.js";
14
+
14
15
  import { escapeRegExp } from "./lib/escape-regexp.js";
15
16
  import { getFileManifestEntries } from "./lib/get-file-manifest-entries.js";
16
17
  import { getSourceMapURL } from "./lib/get-source-map-url.js";
@@ -5,17 +5,16 @@
5
5
  license that can be found in the LICENSE file or at
6
6
  https://opensource.org/licenses/MIT.
7
7
  */
8
+ import { errors } from "@serwist/utils/node";
9
+ import type { ManifestEntry, ManifestEntryWithSize } from "../types.js";
8
10
 
9
- import type { ManifestEntry } from "../types.js";
10
- import { errors } from "./errors.js";
11
-
12
- type AdditionalManifestEntriesTransform = (manifest: (ManifestEntry & { size: number })[]) => {
13
- manifest: (ManifestEntry & { size: number })[];
11
+ type AdditionalManifestEntriesTransform = (manifest: ManifestEntryWithSize[]) => {
12
+ manifest: ManifestEntryWithSize[];
14
13
  warnings: string[];
15
14
  };
16
15
 
17
16
  export const additionalPrecacheEntriesTransform = (additionalPrecacheEntries: (ManifestEntry | string)[]): AdditionalManifestEntriesTransform => {
18
- return (manifest: (ManifestEntry & { size: number })[]) => {
17
+ return (manifest: ManifestEntryWithSize[]) => {
19
18
  const warnings: string[] = [];
20
19
  const stringEntries = new Set<string>();
21
20
 
@@ -0,0 +1 @@
1
+ export const DEFAULT_GLOB_PATTERNS = ["**/*.{js,css,html,ico,apng,png,avif,jpg,jpeg,jfif,pjpeg,pjp,gif,svg,webp,json,webmanifest}"];
@@ -6,11 +6,10 @@
6
6
  https://opensource.org/licenses/MIT.
7
7
  */
8
8
  import path from "node:path";
9
+ import type { FileDetails } from "@serwist/utils";
10
+ import { errors, getFileHash, getFileSize } from "@serwist/utils/node";
9
11
  import { globSync } from "glob";
10
- import type { FileDetails, GlobPartial } from "../types.js";
11
- import { errors } from "./errors.js";
12
- import { getFileHash } from "./get-file-hash.js";
13
- import { getFileSize } from "./get-file-size.js";
12
+ import type { GlobPartial } from "../types.js";
14
13
 
15
14
  export const getFileDetails = ({
16
15
  globDirectory,