@serwist/build 9.0.15 → 9.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/dist/chunks/error.js +55 -0
  2. package/dist/chunks/get-manifest.js +10 -0
  3. package/dist/chunks/glob.js +43 -25
  4. package/dist/chunks/inject-manifest.js +29 -0
  5. package/dist/index.js +11 -11
  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 +4 -4
  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 +6 -6
  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 +13 -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 +14 -20
  42. package/src/schema/{injectManifest.ts → inject-manifest.ts} +13 -14
  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 -6
  49. package/dist/chunks/injectManifest.js +0 -23
  50. package/dist/chunks/validationErrorMap.js +0 -54
  51. package/dist/schema/assertType.d.ts.map +0 -1
  52. package/dist/schema/getManifest.d.ts +0 -192
  53. package/dist/schema/getManifest.d.ts.map +0 -1
  54. package/dist/schema/injectManifest.d.ts +0 -213
  55. package/dist/schema/injectManifest.d.ts.map +0 -1
  56. package/dist/schema/manifestEntry.d.ts +0 -15
  57. package/dist/schema/manifestEntry.d.ts.map +0 -1
  58. package/dist/schema/manifestTransform.d.ts +0 -125
  59. package/dist/schema/manifestTransform.d.ts.map +0 -1
  60. package/dist/schema/serwistConfigError.d.ts.map +0 -1
  61. package/dist/schema/swDest.d.ts +0 -16
  62. package/dist/schema/swDest.d.ts.map +0 -1
  63. package/dist/schema/validationErrorMap.d.ts +0 -3
  64. package/dist/schema/validationErrorMap.d.ts.map +0 -1
  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,55 @@
1
+ class SerwistConfigError extends Error {
2
+ constructor({ moduleName, message }){
3
+ super(`Invalid ${moduleName ?? "Serwist"} configuration:\n${message}`);
4
+ Object.setPrototypeOf(this, new.target.prototype);
5
+ }
6
+ }
7
+ const parsedType = (data)=>{
8
+ const t = typeof data;
9
+ switch(t){
10
+ case "number":
11
+ {
12
+ return Number.isNaN(data) ? "NaN" : "number";
13
+ }
14
+ case "object":
15
+ {
16
+ if (Array.isArray(data)) {
17
+ return "array";
18
+ }
19
+ if (data === null) {
20
+ return "null";
21
+ }
22
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) {
23
+ return data.constructor.name;
24
+ }
25
+ }
26
+ }
27
+ return t;
28
+ };
29
+ const validationErrorMap = (error)=>{
30
+ switch(error.code){
31
+ case "invalid_type":
32
+ {
33
+ return `${error.message ?? "Received invalid type"}: expected ${error.expected}, received ${parsedType(error.input)}.`;
34
+ }
35
+ case "invalid_value":
36
+ {
37
+ return `${error.message ?? "Received invalid value"}: expected ${error.expected}, received ${parsedType(error.input)}.`;
38
+ }
39
+ case "invalid_union":
40
+ {
41
+ return `${error.message ?? "Received invalid union"}:\n${error.errors.flatMap((err)=>err.map((e)=>` → ${e.message}`)).join("\n")}`;
42
+ }
43
+ case "unrecognized_keys":
44
+ {
45
+ return `${error.message ?? "Received unrecognized keys"}: ${error.keys.join(".")}`;
46
+ }
47
+ case "custom":
48
+ {
49
+ return error.message ?? undefined;
50
+ }
51
+ }
52
+ return undefined;
53
+ };
54
+
55
+ export { SerwistConfigError as S, validationErrorMap as v };
@@ -0,0 +1,10 @@
1
+ import { z } from 'zod';
2
+ import { r as requiredGlobDirectoryPartial, g as globPartial, b as basePartial } from './glob.js';
3
+
4
+ const getManifestOptions = z.strictObject({
5
+ ...basePartial.shape,
6
+ ...globPartial.shape,
7
+ ...requiredGlobDirectoryPartial.shape
8
+ });
9
+
10
+ export { getManifestOptions };
@@ -1,28 +1,46 @@
1
1
  import { z } from 'zod';
2
2
 
3
- const manifestEntry = z.object({
3
+ const manifestEntry = z.strictObject({
4
4
  integrity: z.string().optional(),
5
5
  revision: z.string().nullable().optional(),
6
6
  url: z.string()
7
- }).strict("Do not pass invalid properties to ManifestEntry!");
7
+ });
8
8
 
9
- const manifestTransformResult = z.object({
10
- manifest: z.array(manifestEntry.merge(z.object({
11
- size: z.number()
12
- }))),
9
+ const fn = ({ input, output })=>{
10
+ const schema = z.function({
11
+ input: z.tuple(input),
12
+ output
13
+ });
14
+ return z.custom((arg)=>typeof arg === "function").transform((arg)=>schema.implement(arg));
15
+ };
16
+ const asyncFn = ({ input, output })=>{
17
+ const schema = z.function({
18
+ input: z.tuple(input),
19
+ output
20
+ });
21
+ return z.custom((arg)=>typeof arg === "function").transform((arg)=>schema.implementAsync(arg));
22
+ };
23
+
24
+ const sizeObject = z.object({
25
+ size: z.number()
26
+ });
27
+ const manifestEntryWithSize = z.object({
28
+ ...manifestEntry.shape,
29
+ ...sizeObject.shape
30
+ });
31
+ const manifestTransformResult = z.strictObject({
32
+ manifest: z.array(manifestEntryWithSize),
13
33
  warnings: z.array(z.string()).optional()
14
- }).strict("Do not pass invalid properties to ManifestTransformResult!");
15
- const manifestTransform = z.function(z.tuple([
16
- z.array(manifestEntry.merge(z.object({
17
- size: z.number()
18
- }))),
19
- z.unknown().optional()
20
- ]), z.union([
21
- z.promise(manifestTransformResult),
22
- manifestTransformResult
23
- ]));
34
+ });
35
+ const manifestTransform = asyncFn({
36
+ input: [
37
+ z.array(manifestEntryWithSize),
38
+ z.unknown().optional()
39
+ ],
40
+ output: manifestTransformResult
41
+ });
24
42
 
25
- const basePartial = z.object({
43
+ const basePartial = z.strictObject({
26
44
  additionalPrecacheEntries: z.array(z.union([
27
45
  z.string(),
28
46
  manifestEntry
@@ -32,9 +50,9 @@ const basePartial = z.object({
32
50
  manifestTransforms: z.array(manifestTransform).optional(),
33
51
  maximumFileSizeToCacheInBytes: z.number().default(2097152),
34
52
  modifyURLPrefix: z.record(z.string(), z.string()).optional()
35
- }).strict("Do not pass invalid properties to BasePartial!");
53
+ });
36
54
 
37
- const globPartial = z.object({
55
+ const globPartial = z.strictObject({
38
56
  globFollow: z.boolean().default(true),
39
57
  globIgnores: z.array(z.string()).default([
40
58
  "**/node_modules/**/*"
@@ -47,12 +65,12 @@ const globPartial = z.object({
47
65
  z.string(),
48
66
  z.array(z.string())
49
67
  ])).optional()
50
- }).strict("Do not pass invalid properties to GlobPartial!");
51
- const optionalGlobDirectoryPartial = z.object({
68
+ });
69
+ const optionalGlobDirectoryPartial = z.strictObject({
52
70
  globDirectory: z.string().optional()
53
- }).strict("Do not pass invalid properties to OptionalGlobDirectoryPartial!");
54
- const requiredGlobDirectoryPartial = z.object({
71
+ });
72
+ const requiredGlobDirectoryPartial = z.strictObject({
55
73
  globDirectory: z.string()
56
- }).strict("Do not pass invalid properties to RequiredGlobDirectoryPartial!");
74
+ });
57
75
 
58
- export { manifestTransform as a, basePartial as b, manifestTransformResult as c, globPartial as g, manifestEntry as m, optionalGlobDirectoryPartial as o, requiredGlobDirectoryPartial as r };
76
+ export { asyncFn as a, basePartial as b, manifestTransform as c, manifestTransformResult as d, fn as f, globPartial as g, manifestEntry as m, optionalGlobDirectoryPartial as o, requiredGlobDirectoryPartial as r };
@@ -0,0 +1,29 @@
1
+ import { z } from 'zod';
2
+ import { r as requiredGlobDirectoryPartial, g as globPartial, b as basePartial } from './glob.js';
3
+
4
+ const optionalSwDestPartial = z.strictObject({
5
+ swDest: z.string().optional()
6
+ });
7
+ const requiredSwDestPartial = z.strictObject({
8
+ swDest: z.string()
9
+ });
10
+
11
+ const baseInjectPartial = z.strictObject({
12
+ injectionPoint: z.string().default("self.__SW_MANIFEST"),
13
+ swSrc: z.string()
14
+ });
15
+ const injectManifestOptions = z.strictObject({
16
+ ...basePartial.shape,
17
+ ...globPartial.shape,
18
+ ...baseInjectPartial.shape,
19
+ ...requiredSwDestPartial.shape,
20
+ ...requiredGlobDirectoryPartial.shape
21
+ });
22
+
23
+ var injectManifest = /*#__PURE__*/Object.freeze({
24
+ __proto__: null,
25
+ baseInjectPartial: baseInjectPartial,
26
+ injectManifestOptions: injectManifestOptions
27
+ });
28
+
29
+ export { injectManifest as a, baseInjectPartial as b, injectManifestOptions as i, optionalSwDestPartial as o, requiredSwDestPartial as r };
package/dist/index.js CHANGED
@@ -5,10 +5,10 @@ import path from 'node:path';
5
5
  import { globSync } from 'glob';
6
6
  import fs, { readFileSync } from 'node:fs';
7
7
  import prettyBytes from 'pretty-bytes';
8
- import { v as validationErrorMap, S as SerwistConfigError } from './chunks/validationErrorMap.js';
8
+ import { z } from 'zod';
9
+ import { v as validationErrorMap, S as SerwistConfigError } from './chunks/error.js';
9
10
  import fsp from 'node:fs/promises';
10
11
  import { SourceMapGenerator, SourceMapConsumer } from 'source-map';
11
- import 'zod';
12
12
 
13
13
  const errors = {
14
14
  "unable-to-get-rootdir": "Unable to get the root directory of your web app.",
@@ -428,25 +428,25 @@ const getFileManifestEntries = async ({ additionalPrecacheEntries, dontCacheBust
428
428
  };
429
429
 
430
430
  const validateGetManifestOptions = async (input)=>{
431
- const result = await (await import('./chunks/getManifest.js')).getManifestOptions.spa(input, {
432
- errorMap: validationErrorMap
431
+ const result = await (await import('./chunks/get-manifest.js')).getManifestOptions.spa(input, {
432
+ error: validationErrorMap
433
433
  });
434
434
  if (!result.success) {
435
435
  throw new SerwistConfigError({
436
436
  moduleName: "@serwist/build",
437
- message: JSON.stringify(result.error.format(), null, 2)
437
+ message: z.prettifyError(result.error)
438
438
  });
439
439
  }
440
440
  return result.data;
441
441
  };
442
442
  const validateInjectManifestOptions = async (input)=>{
443
- const result = await (await import('./chunks/injectManifest.js').then(function (n) { return n.a; })).injectManifestOptions.spa(input, {
444
- errorMap: validationErrorMap
443
+ const result = await (await import('./chunks/inject-manifest.js').then(function (n) { return n.a; })).injectManifestOptions.spa(input, {
444
+ error: validationErrorMap
445
445
  });
446
446
  if (!result.success) {
447
447
  throw new SerwistConfigError({
448
448
  moduleName: "@serwist/build",
449
- message: JSON.stringify(result.error.format(), null, 2)
449
+ message: z.prettifyError(result.error)
450
450
  });
451
451
  }
452
452
  return result.data;
@@ -538,9 +538,9 @@ async function replaceAndUpdateSourceMap({ jsFilename, originalMap, originalSour
538
538
  }
539
539
 
540
540
  function translateURLToSourcemapPaths(url, swSrc, swDest) {
541
- let destPath = undefined;
542
- let srcPath = undefined;
543
- let warning = undefined;
541
+ let destPath;
542
+ let srcPath;
543
+ let warning;
544
544
  if (url && !url.startsWith("data:")) {
545
545
  const possibleSrcPath = path.resolve(path.dirname(swSrc), url);
546
546
  if (fs.existsSync(possibleSrcPath)) {
@@ -1,13 +1,13 @@
1
- import { type Assignable, type Equals, assertType } from "./schema/assertType.js";
1
+ import { type Assignable, type Equals, assertType } from "./schema/assert-type.js";
2
2
  import { basePartial } from "./schema/base.js";
3
- import { getManifestOptions } from "./schema/getManifest.js";
3
+ import { getManifestOptions } from "./schema/get-manifest.js";
4
4
  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";
11
- export { assertType, basePartial, globPartial, baseInjectPartial as injectPartial, injectManifestOptions, getManifestOptions, manifestEntry, manifestTransform, manifestTransformResult, optionalGlobDirectoryPartial, requiredGlobDirectoryPartial, optionalSwDestPartial, requiredSwDestPartial, validationErrorMap, SerwistConfigError, };
5
+ import { baseInjectPartial, injectManifestOptions } from "./schema/inject-manifest.js";
6
+ import { manifestEntry } from "./schema/manifest-entry.js";
7
+ import { manifestTransform, manifestTransformResult } from "./schema/manifest-transform.js";
8
+ import { SerwistConfigError, validationErrorMap } from "./schema/error.js";
9
+ import { optionalSwDestPartial, requiredSwDestPartial } from "./schema/sw-dest.js";
10
+ import { fn, asyncFn } from "./schema/utils.js";
11
+ export { assertType, fn, asyncFn, basePartial, globPartial, baseInjectPartial as injectPartial, injectManifestOptions, getManifestOptions, manifestEntry, manifestTransform, manifestTransformResult, optionalGlobDirectoryPartial, requiredGlobDirectoryPartial, optionalSwDestPartial, requiredSwDestPartial, validationErrorMap, SerwistConfigError, };
12
12
  export type { Assignable, Equals };
13
13
  //# sourceMappingURL=index.schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.schema.d.ts","sourceRoot":"","sources":["../src/index.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,MAAM,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAClF,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,4BAA4B,EAAE,4BAA4B,EAAE,MAAM,kBAAkB,CAAC;AAC3G,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACtF,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,+BAA+B,CAAC;AAC3F,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAClF,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAEpE,OAAO,EACL,UAAU,EACV,WAAW,EACX,WAAW,EACX,iBAAiB,IAAI,aAAa,EAClC,qBAAqB,EACrB,kBAAkB,EAClB,aAAa,EACb,iBAAiB,EACjB,uBAAuB,EACvB,4BAA4B,EAC5B,4BAA4B,EAC5B,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,GACnB,CAAC;AACF,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC"}
1
+ {"version":3,"file":"index.schema.d.ts","sourceRoot":"","sources":["../src/index.schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,UAAU,EAAE,KAAK,MAAM,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACnF,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAC9D,OAAO,EAAE,WAAW,EAAE,4BAA4B,EAAE,4BAA4B,EAAE,MAAM,kBAAkB,CAAC;AAC3G,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AACvF,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,MAAM,gCAAgC,CAAC;AAC5F,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAE,qBAAqB,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AACnF,OAAO,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAEhD,OAAO,EACL,UAAU,EACV,EAAE,EACF,OAAO,EACP,WAAW,EACX,WAAW,EACX,iBAAiB,IAAI,aAAa,EAClC,qBAAqB,EACrB,kBAAkB,EAClB,aAAa,EACb,iBAAiB,EACjB,uBAAuB,EACvB,4BAA4B,EAC5B,4BAA4B,EAC5B,qBAAqB,EACrB,qBAAqB,EACrB,kBAAkB,EAClB,kBAAkB,GACnB,CAAC;AACF,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,CAAC"}
@@ -1,7 +1,7 @@
1
- export { b as basePartial, g as globPartial, m as manifestEntry, a as manifestTransform, c as manifestTransformResult, o as optionalGlobDirectoryPartial, r as requiredGlobDirectoryPartial } from './chunks/glob.js';
2
- export { getManifestOptions } from './chunks/getManifest.js';
3
- export { i as injectManifestOptions, b as injectPartial, o as optionalSwDestPartial, r as requiredSwDestPartial } from './chunks/injectManifest.js';
4
- export { S as SerwistConfigError, v as validationErrorMap } from './chunks/validationErrorMap.js';
1
+ export { a as asyncFn, b as basePartial, f as fn, g as globPartial, m as manifestEntry, c as manifestTransform, d as manifestTransformResult, o as optionalGlobDirectoryPartial, r as requiredGlobDirectoryPartial } from './chunks/glob.js';
2
+ export { getManifestOptions } from './chunks/get-manifest.js';
3
+ export { i as injectManifestOptions, b as injectPartial, o as optionalSwDestPartial, r as requiredSwDestPartial } from './chunks/inject-manifest.js';
4
+ export { S as SerwistConfigError, v as validationErrorMap } from './chunks/error.js';
5
5
  import 'zod';
6
6
 
7
7
  function assertType() {}
@@ -1 +1 @@
1
- {"version":3,"file":"transform-manifest.d.ts","sourceRoot":"","sources":["../../src/lib/transform-manifest.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAqB,MAAM,aAAa,CAAC;AAO/F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,UAAU,mCAAmC;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,EAAE,aAAa,EAAE,GAAG,SAAS,CAAC;IAC7C,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAID,UAAU,wBACR,SAAQ,IAAI,CACV,YAAY,EACV,2BAA2B,GAC3B,2BAA2B,GAC3B,oBAAoB,GACpB,+BAA+B,GAC/B,iBAAiB,GACjB,yBAAyB,CAC5B;IACD,WAAW,EAAE,WAAW,EAAE,CAAC;IAG3B,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,wBAAsB,iBAAiB,CAAC,EACtC,yBAAyB,EACzB,yBAAyB,EACzB,WAAW,EACX,kBAAkB,EAClB,6BAA6B,EAC7B,eAAe,EACf,cAAc,EACd,uBAAuB,GACxB,EAAE,wBAAwB,GAAG,OAAO,CAAC,mCAAmC,CAAC,CAuEzE"}
1
+ {"version":3,"file":"transform-manifest.d.ts","sourceRoot":"","sources":["../../src/lib/transform-manifest.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAqB,MAAM,aAAa,CAAC;AAO/F;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,UAAU,mCAAmC;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,EAAE,aAAa,EAAE,GAAG,SAAS,CAAC;IAC7C,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAID,UAAU,wBACR,SAAQ,IAAI,CACV,YAAY,EACV,2BAA2B,GAC3B,2BAA2B,GAC3B,oBAAoB,GACpB,+BAA+B,GAC/B,iBAAiB,GACjB,yBAAyB,CAC5B;IACD,WAAW,EAAE,WAAW,EAAE,CAAC;IAG3B,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B;AAED,wBAAsB,iBAAiB,CAAC,EACtC,yBAAyB,EACzB,yBAAyB,EACzB,WAAW,EACX,kBAAkB,EAClB,6BAA6B,EAC7B,eAAe,EACf,cAAc,EACd,uBAAuB,GACxB,EAAE,wBAAwB,GAAG,OAAO,CAAC,mCAAmC,CAAC,CAsEzE"}
@@ -1 +1 @@
1
- {"version":3,"file":"validate-options.d.ts","sourceRoot":"","sources":["../../src/lib/validate-options.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,0BAA0B,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAC;AAE7F,eAAO,MAAM,0BAA0B,GAAU,OAAO,OAAO,KAAG,OAAO,CAAC,0BAA0B,CAMnG,CAAC;AAEF,eAAO,MAAM,6BAA6B,GAAU,OAAO,OAAO,KAAG,OAAO,CAAC,6BAA6B,CAMzG,CAAC"}
1
+ {"version":3,"file":"validate-options.d.ts","sourceRoot":"","sources":["../../src/lib/validate-options.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,0BAA0B,EAAE,6BAA6B,EAAE,MAAM,aAAa,CAAC;AAE7F,eAAO,MAAM,0BAA0B,GAAU,OAAO,OAAO,KAAG,OAAO,CAAC,0BAA0B,CASnG,CAAC;AAEF,eAAO,MAAM,6BAA6B,GAAU,OAAO,OAAO,KAAG,OAAO,CAAC,6BAA6B,CASzG,CAAC"}
@@ -1,4 +1,4 @@
1
1
  export type Equals<T, S> = [T] extends [S] ? ([S] extends [T] ? true : false) : false;
2
2
  export type Assignable<T, U> = [U] extends [T] ? true : false;
3
3
  export declare function assertType<_T extends true>(): void;
4
- //# sourceMappingURL=assertType.d.ts.map
4
+ //# sourceMappingURL=assert-type.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"assert-type.d.ts","sourceRoot":"","sources":["../../src/schema/assert-type.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,MAAM,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,KAAK,CAAC,GAAG,KAAK,CAAC;AAEtF,MAAM,MAAM,UAAU,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,IAAI,GAAG,KAAK,CAAC;AAE9D,wBAAgB,UAAU,CAAC,EAAE,SAAS,IAAI,UAEzC"}
@@ -1,172 +1,66 @@
1
1
  import { z } from "zod";
2
2
  export declare const basePartial: z.ZodObject<{
3
- additionalPrecacheEntries: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
3
+ additionalPrecacheEntries: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
4
4
  integrity: z.ZodOptional<z.ZodString>;
5
5
  revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
6
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">>;
7
+ }, z.core.$strict>]>>>;
16
8
  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<{
9
+ dontCacheBustURLsMatching: z.ZodOptional<z.ZodCustom<RegExp, RegExp>>;
10
+ manifestTransforms: z.ZodOptional<z.ZodArray<z.ZodPipe<z.ZodCustom<z.core.$InferInnerFunctionTypeAsync<z.ZodTuple<[z.ZodArray<z.ZodObject<{
11
+ size: z.ZodNumber;
19
12
  integrity: z.ZodOptional<z.ZodString>;
20
13
  revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
21
14
  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<{
15
+ }, z.core.$strip>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
35
16
  manifest: z.ZodArray<z.ZodObject<{
17
+ size: z.ZodNumber;
36
18
  integrity: z.ZodOptional<z.ZodString>;
37
19
  revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
38
20
  url: z.ZodString;
39
- } & {
21
+ }, z.core.$strip>>;
22
+ warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
23
+ }, z.core.$strict>>, 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<{
40
30
  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<{
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.ZodTransform<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<{
70
42
  manifest: z.ZodArray<z.ZodObject<{
43
+ size: z.ZodNumber;
71
44
  integrity: z.ZodOptional<z.ZodString>;
72
45
  revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
73
46
  url: z.ZodString;
74
- } & {
47
+ }, z.core.$strip>>;
48
+ warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
49
+ }, z.core.$strict>>, 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<{
75
56
  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">>;
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>>>>>>;
105
63
  maximumFileSizeToCacheInBytes: z.ZodDefault<z.ZodNumber>;
106
64
  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
- }>;
65
+ }, z.core.$strict>;
172
66
  //# 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;AAOxB,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,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"}