@serwist/build 10.0.0-preview.10 → 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.
- package/dist/chunks/glob.js +19 -16
- package/dist/get-manifest.d.ts +1 -1
- package/dist/lib/additional-precache-entries-transform.d.ts +3 -7
- package/dist/lib/additional-precache-entries-transform.d.ts.map +1 -1
- package/dist/schema/base.d.ts +3 -58
- package/dist/schema/base.d.ts.map +1 -1
- package/dist/schema/get-manifest.d.ts +2 -58
- package/dist/schema/get-manifest.d.ts.map +1 -1
- package/dist/schema/inject-manifest.d.ts +2 -58
- package/dist/schema/inject-manifest.d.ts.map +1 -1
- package/dist/schema/manifest-entry.d.ts +9 -0
- package/dist/schema/manifest-entry.d.ts.map +1 -1
- package/dist/schema/manifest-transform.d.ts +3 -59
- package/dist/schema/manifest-transform.d.ts.map +1 -1
- package/dist/schema/utils.d.ts +10 -4
- package/dist/schema/utils.d.ts.map +1 -1
- package/dist/types.d.ts +11 -26
- package/dist/types.d.ts.map +1 -1
- package/package.json +4 -5
- package/src/get-manifest.ts +1 -1
- package/src/lib/additional-precache-entries-transform.ts +4 -4
- package/src/schema/base.ts +4 -4
- package/src/schema/manifest-entry.ts +4 -0
- package/src/schema/manifest-transform.ts +6 -9
- package/src/schema/utils.ts +28 -7
- package/src/types.ts +8 -28
package/dist/chunks/glob.js
CHANGED
|
@@ -6,49 +6,52 @@ const manifestEntry = z.strictObject({
|
|
|
6
6
|
revision: z.string().nullable().optional(),
|
|
7
7
|
url: z.string()
|
|
8
8
|
});
|
|
9
|
+
const sizeObject = z.object({
|
|
10
|
+
size: z.number()
|
|
11
|
+
});
|
|
12
|
+
const manifestEntryWithSize = z.object({
|
|
13
|
+
...manifestEntry.shape,
|
|
14
|
+
...sizeObject.shape
|
|
15
|
+
});
|
|
9
16
|
|
|
10
|
-
const
|
|
17
|
+
const reference = (schema)=>{
|
|
18
|
+
return schema;
|
|
19
|
+
};
|
|
20
|
+
const asyncFn = ({ input, output })=>{
|
|
11
21
|
const schema = z.function({
|
|
12
22
|
input: z.tuple(input),
|
|
13
23
|
output
|
|
14
24
|
});
|
|
15
|
-
return z.custom((arg)=>typeof arg === "function").transform((arg)=>schema.
|
|
25
|
+
return z.custom((arg)=>typeof arg === "function").transform((arg)=>schema.implementAsync(arg));
|
|
16
26
|
};
|
|
17
|
-
const
|
|
27
|
+
const fn = ({ input, output })=>{
|
|
18
28
|
const schema = z.function({
|
|
19
29
|
input: z.tuple(input),
|
|
20
30
|
output
|
|
21
31
|
});
|
|
22
|
-
return z.custom((arg)=>typeof arg === "function").transform((arg)=>schema.
|
|
32
|
+
return z.custom((arg)=>typeof arg === "function").transform((arg)=>schema.implement(arg));
|
|
23
33
|
};
|
|
24
34
|
|
|
25
|
-
const sizeObject = z.object({
|
|
26
|
-
size: z.number()
|
|
27
|
-
});
|
|
28
|
-
const manifestEntryWithSize = z.object({
|
|
29
|
-
...manifestEntry.shape,
|
|
30
|
-
...sizeObject.shape
|
|
31
|
-
});
|
|
32
35
|
const manifestTransformResult = z.strictObject({
|
|
33
|
-
manifest: z.array(manifestEntryWithSize),
|
|
36
|
+
manifest: z.array(reference(manifestEntryWithSize)),
|
|
34
37
|
warnings: z.array(z.string()).optional()
|
|
35
38
|
});
|
|
36
39
|
const manifestTransform = asyncFn({
|
|
37
40
|
input: [
|
|
38
|
-
z.array(manifestEntryWithSize),
|
|
41
|
+
z.array(reference(manifestEntryWithSize)),
|
|
39
42
|
z.unknown().optional()
|
|
40
43
|
],
|
|
41
|
-
output: manifestTransformResult
|
|
44
|
+
output: reference(manifestTransformResult)
|
|
42
45
|
});
|
|
43
46
|
|
|
44
47
|
const basePartial = z.strictObject({
|
|
45
48
|
additionalPrecacheEntries: z.array(z.union([
|
|
46
49
|
z.string(),
|
|
47
|
-
manifestEntry
|
|
50
|
+
reference(manifestEntry)
|
|
48
51
|
])).optional(),
|
|
49
52
|
disablePrecacheManifest: z.boolean().default(false),
|
|
50
53
|
dontCacheBustURLsMatching: z.instanceof(RegExp).optional(),
|
|
51
|
-
manifestTransforms: z.array(manifestTransform).optional(),
|
|
54
|
+
manifestTransforms: z.array(reference(manifestTransform)).optional(),
|
|
52
55
|
maximumFileSizeToCacheInBytes: z.number().default(2097152),
|
|
53
56
|
modifyURLPrefix: z.record(z.string(), z.string()).optional()
|
|
54
57
|
});
|
package/dist/get-manifest.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ import type { GetManifestOptions, GetManifestResult } from "./types.js";
|
|
|
7
7
|
* ```
|
|
8
8
|
* // The following lists some common options; see the rest of the documentation
|
|
9
9
|
* // for the full set of options and defaults.
|
|
10
|
-
* const {count, manifestEntries, size, warnings} = await getManifest({
|
|
10
|
+
* const { count, manifestEntries, size, warnings } = await getManifest({
|
|
11
11
|
* dontCacheBustURLsMatching: [new RegExp('...')],
|
|
12
12
|
* globDirectory: '...',
|
|
13
13
|
* globPatterns: ['...', '...'],
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import type { ManifestEntry } from "../types.js";
|
|
2
|
-
type AdditionalManifestEntriesTransform = (manifest:
|
|
3
|
-
|
|
4
|
-
})[]) => {
|
|
5
|
-
manifest: (ManifestEntry & {
|
|
6
|
-
size: number;
|
|
7
|
-
})[];
|
|
1
|
+
import type { ManifestEntry, ManifestEntryWithSize } from "../types.js";
|
|
2
|
+
type AdditionalManifestEntriesTransform = (manifest: ManifestEntryWithSize[]) => {
|
|
3
|
+
manifest: ManifestEntryWithSize[];
|
|
8
4
|
warnings: string[];
|
|
9
5
|
};
|
|
10
6
|
export declare const additionalPrecacheEntriesTransform: (additionalPrecacheEntries: (ManifestEntry | string)[]) => AdditionalManifestEntriesTransform;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"additional-precache-entries-transform.d.ts","sourceRoot":"","sources":["../../src/lib/additional-precache-entries-transform.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"additional-precache-entries-transform.d.ts","sourceRoot":"","sources":["../../src/lib/additional-precache-entries-transform.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAExE,KAAK,kCAAkC,GAAG,CAAC,QAAQ,EAAE,qBAAqB,EAAE,KAAK;IAC/E,QAAQ,EAAE,qBAAqB,EAAE,CAAC;IAClC,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,kCAAkC,GAAI,2BAA2B,CAAC,aAAa,GAAG,MAAM,CAAC,EAAE,KAAG,kCAqC1G,CAAC"}
|
package/dist/schema/base.d.ts
CHANGED
|
@@ -1,65 +1,10 @@
|
|
|
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<readonly [z.ZodString, z.
|
|
4
|
-
integrity: z.ZodOptional<z.ZodString>;
|
|
5
|
-
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
6
|
-
url: z.ZodString;
|
|
7
|
-
}, z.core.$strict>]>>>;
|
|
4
|
+
additionalPrecacheEntries: z.ZodOptional<z.ZodArray<z.ZodUnion<readonly [z.ZodString, z.ZodType<ManifestEntry, ManifestEntry, z.core.$ZodTypeInternals<ManifestEntry, ManifestEntry>>]>>>;
|
|
8
5
|
disablePrecacheManifest: z.ZodDefault<z.ZodBoolean>;
|
|
9
6
|
dontCacheBustURLsMatching: z.ZodOptional<z.ZodCustom<RegExp, RegExp>>;
|
|
10
|
-
manifestTransforms: z.ZodOptional<z.ZodArray<z.
|
|
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>>, z.ZodOptional<z.ZodUnknown>], null>, z.ZodObject<{
|
|
16
|
-
manifest: 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>>;
|
|
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<{
|
|
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.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<{
|
|
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.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>>>>>>;
|
|
7
|
+
manifestTransforms: z.ZodOptional<z.ZodArray<z.ZodType<ManifestTransform, ManifestTransform, z.core.$ZodTypeInternals<ManifestTransform, ManifestTransform>>>>;
|
|
63
8
|
maximumFileSizeToCacheInBytes: z.ZodDefault<z.ZodNumber>;
|
|
64
9
|
modifyURLPrefix: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
65
10
|
}, z.core.$strict>;
|
|
@@ -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;
|
|
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"}
|
|
@@ -6,66 +6,10 @@ export declare const getManifestOptions: z.ZodObject<{
|
|
|
6
6
|
globPatterns: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
7
7
|
globStrict: z.ZodDefault<z.ZodBoolean>;
|
|
8
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.
|
|
10
|
-
integrity: z.ZodOptional<z.ZodString>;
|
|
11
|
-
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
12
|
-
url: z.ZodString;
|
|
13
|
-
}, z.core.$strict>]>>>;
|
|
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>>]>>>;
|
|
14
10
|
disablePrecacheManifest: z.ZodDefault<z.ZodBoolean>;
|
|
15
11
|
dontCacheBustURLsMatching: z.ZodOptional<z.ZodCustom<RegExp, RegExp>>;
|
|
16
|
-
manifestTransforms: z.ZodOptional<z.ZodArray<z.
|
|
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>>>>>>;
|
|
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>>>>;
|
|
69
13
|
maximumFileSizeToCacheInBytes: z.ZodDefault<z.ZodNumber>;
|
|
70
14
|
modifyURLPrefix: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
71
15
|
}, z.core.$strict>;
|
|
@@ -1 +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
|
|
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"}
|
|
@@ -13,66 +13,10 @@ export declare const injectManifestOptions: z.ZodObject<{
|
|
|
13
13
|
globPatterns: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
14
14
|
globStrict: z.ZodDefault<z.ZodBoolean>;
|
|
15
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.
|
|
17
|
-
integrity: z.ZodOptional<z.ZodString>;
|
|
18
|
-
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
19
|
-
url: z.ZodString;
|
|
20
|
-
}, z.core.$strict>]>>>;
|
|
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>>]>>>;
|
|
21
17
|
disablePrecacheManifest: z.ZodDefault<z.ZodBoolean>;
|
|
22
18
|
dontCacheBustURLsMatching: z.ZodOptional<z.ZodCustom<RegExp, RegExp>>;
|
|
23
|
-
manifestTransforms: z.ZodOptional<z.ZodArray<z.
|
|
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>>>>>>;
|
|
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>>>>;
|
|
76
20
|
maximumFileSizeToCacheInBytes: z.ZodDefault<z.ZodNumber>;
|
|
77
21
|
modifyURLPrefix: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
78
22
|
}, z.core.$strict>;
|
|
@@ -1 +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
|
|
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"}
|
|
@@ -4,4 +4,13 @@ export declare const manifestEntry: z.ZodObject<{
|
|
|
4
4
|
revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
5
5
|
url: z.ZodString;
|
|
6
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>;
|
|
7
16
|
//# sourceMappingURL=manifest-entry.d.ts.map
|
|
@@ -1 +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"}
|
|
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"}
|
|
@@ -1,64 +1,8 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
+
import type { ManifestEntryWithSize, ManifestTransformResult } from "../types.js";
|
|
2
3
|
export declare const manifestTransformResult: z.ZodObject<{
|
|
3
|
-
manifest: z.ZodArray<z.
|
|
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>>;
|
|
4
|
+
manifest: z.ZodArray<z.ZodType<ManifestEntryWithSize, ManifestEntryWithSize, z.core.$ZodTypeInternals<ManifestEntryWithSize, ManifestEntryWithSize>>>;
|
|
9
5
|
warnings: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
10
6
|
}, z.core.$strict>;
|
|
11
|
-
export declare const manifestTransform: z.
|
|
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>>>>;
|
|
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>>>;
|
|
64
8
|
//# sourceMappingURL=manifest-transform.d.ts.map
|
|
@@ -1 +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;
|
|
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"}
|
package/dist/schema/utils.d.ts
CHANGED
|
@@ -1,10 +1,16 @@
|
|
|
1
|
+
import type { MaybePromise } from "@serwist/utils";
|
|
1
2
|
import { z } from "zod";
|
|
2
|
-
|
|
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, }: {
|
|
3
9
|
input: TInput;
|
|
4
10
|
output: TOutput;
|
|
5
|
-
}) => z.
|
|
6
|
-
export declare const
|
|
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, }: {
|
|
7
13
|
input: TInput;
|
|
8
14
|
output: TOutput;
|
|
9
|
-
}) => z.
|
|
15
|
+
}) => z.ZodType<(...args: z.input<z.ZodTuple<TInput, null>>) => z.output<TOutput>, (...args: z.output<z.ZodTuple<TInput, null>>) => z.input<TOutput>>;
|
|
10
16
|
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -1 +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,
|
|
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,MAAM,EAAE,KAAK,CAAC,sEAEjF,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,KAAG,CAAC,CAAC,OAAO,CACX,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,KAAK,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,EAC/E,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,KAAK,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAShF,CAAC;AAEF,eAAO,MAAM,EAAE,GAAI,MAAM,SAAS,CAAC,CAAC,CAAC,OAAO,EAAE,GAAG,CAAC,CAAC,OAAO,EAAE,CAAC,EAAE,OAAO,SAAS,CAAC,CAAC,OAAO,EAAE,oBAGvF;IACD,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,OAAO,CAAC;CACjB,KAAG,CAAC,CAAC,OAAO,CACX,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,EACjE,CAAC,GAAG,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CASlE,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,18 +1,15 @@
|
|
|
1
|
-
import type {
|
|
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/manifest-entry.js";
|
|
5
|
-
import type { manifestTransformResult } from "./schema/manifest-transform.js";
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
warnings?: string[] | undefined;
|
|
15
|
-
}>;
|
|
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
|
+
}
|
|
16
13
|
export interface BasePartial {
|
|
17
14
|
/**
|
|
18
15
|
* A list of entries to be precached, in addition to any entries that are
|
|
@@ -181,16 +178,4 @@ export interface GetManifestResult {
|
|
|
181
178
|
export type BuildResult = Omit<GetManifestResult, "manifestEntries"> & {
|
|
182
179
|
filePaths: string[];
|
|
183
180
|
};
|
|
184
|
-
/**
|
|
185
|
-
* @private
|
|
186
|
-
*/
|
|
187
|
-
export type BuildType = "dev" | "prod";
|
|
188
|
-
/**
|
|
189
|
-
* @private
|
|
190
|
-
*/
|
|
191
|
-
export type SerwistPackageJSON = Prettify<PackageJson>;
|
|
192
|
-
/**
|
|
193
|
-
* @private
|
|
194
|
-
*/
|
|
195
|
-
export type MethodNames = "GetManifest" | "InjectManifest" | "WebpackInjectManifest" | "ViteInjectManifest";
|
|
196
181
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@serwist/build",
|
|
3
|
-
"version": "10.0.0-preview.
|
|
3
|
+
"version": "10.0.0-preview.11",
|
|
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.",
|
|
@@ -53,16 +53,15 @@
|
|
|
53
53
|
"pretty-bytes": "7.0.0",
|
|
54
54
|
"source-map": "0.8.0-beta.0",
|
|
55
55
|
"zod": "4.0.5",
|
|
56
|
-
"@serwist/utils": "10.0.0-preview.
|
|
56
|
+
"@serwist/utils": "10.0.0-preview.11"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
59
|
"@types/common-tags": "1.8.4",
|
|
60
60
|
"@types/node": "24.0.14",
|
|
61
61
|
"rollup": "4.45.1",
|
|
62
|
-
"type-fest": "4.41.0",
|
|
63
62
|
"typescript": "5.8.3",
|
|
64
|
-
"@serwist/
|
|
65
|
-
"@serwist/
|
|
63
|
+
"@serwist/configs": "10.0.0-preview.11",
|
|
64
|
+
"@serwist/utils": "10.0.0-preview.11"
|
|
66
65
|
},
|
|
67
66
|
"peerDependencies": {
|
|
68
67
|
"typescript": ">=5.0.0"
|
package/src/get-manifest.ts
CHANGED
|
@@ -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: ['...', '...'],
|
|
@@ -6,15 +6,15 @@
|
|
|
6
6
|
https://opensource.org/licenses/MIT.
|
|
7
7
|
*/
|
|
8
8
|
import { errors } from "@serwist/utils/node";
|
|
9
|
-
import type { ManifestEntry } from "../types.js";
|
|
9
|
+
import type { ManifestEntry, ManifestEntryWithSize } from "../types.js";
|
|
10
10
|
|
|
11
|
-
type AdditionalManifestEntriesTransform = (manifest:
|
|
12
|
-
manifest:
|
|
11
|
+
type AdditionalManifestEntriesTransform = (manifest: ManifestEntryWithSize[]) => {
|
|
12
|
+
manifest: ManifestEntryWithSize[];
|
|
13
13
|
warnings: string[];
|
|
14
14
|
};
|
|
15
15
|
|
|
16
16
|
export const additionalPrecacheEntriesTransform = (additionalPrecacheEntries: (ManifestEntry | string)[]): AdditionalManifestEntriesTransform => {
|
|
17
|
-
return (manifest:
|
|
17
|
+
return (manifest: ManifestEntryWithSize[]) => {
|
|
18
18
|
const warnings: string[] = [];
|
|
19
19
|
const stringEntries = new Set<string>();
|
|
20
20
|
|
package/src/schema/base.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
|
|
3
|
-
import type { BasePartial, BaseResolved } from "../types.js";
|
|
2
|
+
import type { BasePartial, BaseResolved, ManifestEntry, ManifestTransform } from "../types.js";
|
|
4
3
|
import { assertType, type Equals } from "./assert-type.js";
|
|
5
4
|
import { manifestEntry } from "./manifest-entry.js";
|
|
6
5
|
import { manifestTransform } from "./manifest-transform.js";
|
|
6
|
+
import { reference } from "./utils.js";
|
|
7
7
|
|
|
8
8
|
export const basePartial = z.strictObject({
|
|
9
|
-
additionalPrecacheEntries: z.array(z.union([z.string(), manifestEntry])).optional(),
|
|
9
|
+
additionalPrecacheEntries: z.array(z.union([z.string(), reference<ManifestEntry>(manifestEntry)])).optional(),
|
|
10
10
|
disablePrecacheManifest: z.boolean().default(false),
|
|
11
11
|
dontCacheBustURLsMatching: z.instanceof(RegExp).optional(),
|
|
12
|
-
manifestTransforms: z.array(manifestTransform).optional(),
|
|
12
|
+
manifestTransforms: z.array(reference<ManifestTransform>(manifestTransform)).optional(),
|
|
13
13
|
maximumFileSizeToCacheInBytes: z.number().default(2097152),
|
|
14
14
|
modifyURLPrefix: z.record(z.string(), z.string()).optional(),
|
|
15
15
|
});
|
|
@@ -5,3 +5,7 @@ export const manifestEntry = z.strictObject({
|
|
|
5
5
|
revision: z.string().nullable().optional(),
|
|
6
6
|
url: z.string(),
|
|
7
7
|
});
|
|
8
|
+
|
|
9
|
+
export const sizeObject = z.object({ size: z.number() });
|
|
10
|
+
|
|
11
|
+
export const manifestEntryWithSize = z.object({ ...manifestEntry.shape, ...sizeObject.shape });
|
|
@@ -1,17 +1,14 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
const sizeObject = z.object({ size: z.number() });
|
|
6
|
-
|
|
7
|
-
const manifestEntryWithSize = z.object({ ...manifestEntry.shape, ...sizeObject.shape });
|
|
2
|
+
import type { ManifestEntryWithSize, ManifestTransformResult } from "../types.js";
|
|
3
|
+
import { manifestEntryWithSize } from "./manifest-entry.js";
|
|
4
|
+
import { asyncFn, reference } from "./utils.js";
|
|
8
5
|
|
|
9
6
|
export const manifestTransformResult = z.strictObject({
|
|
10
|
-
manifest: z.array(manifestEntryWithSize),
|
|
7
|
+
manifest: z.array(reference<ManifestEntryWithSize>(manifestEntryWithSize)),
|
|
11
8
|
warnings: z.array(z.string()).optional(),
|
|
12
9
|
});
|
|
13
10
|
|
|
14
11
|
export const manifestTransform = asyncFn({
|
|
15
|
-
input: [z.array(manifestEntryWithSize), z.unknown().optional()],
|
|
16
|
-
output: manifestTransformResult,
|
|
12
|
+
input: [z.array(reference<ManifestEntryWithSize>(manifestEntryWithSize)), z.unknown().optional()],
|
|
13
|
+
output: reference<ManifestTransformResult>(manifestTransformResult),
|
|
17
14
|
});
|
package/src/schema/utils.ts
CHANGED
|
@@ -1,27 +1,48 @@
|
|
|
1
|
+
import type { MaybePromise } from "@serwist/utils";
|
|
1
2
|
import { z } from "zod";
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
/**
|
|
5
|
+
* Prevents TS from inlining a schema’s inferred type.
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
8
|
+
export const reference = <Output, Input = Output>(schema: z.ZodType<Output, Input>) => {
|
|
9
|
+
return schema;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export const asyncFn = <TInput extends [z.ZodType, ...z.ZodType[]], TOutput extends z.ZodType>({
|
|
13
|
+
input,
|
|
14
|
+
output,
|
|
15
|
+
}: {
|
|
16
|
+
input: TInput;
|
|
17
|
+
output: TOutput;
|
|
18
|
+
}): z.ZodType<
|
|
19
|
+
(...args: z.input<z.ZodTuple<TInput, null>>) => MaybePromise<z.output<TOutput>>,
|
|
20
|
+
(...args: z.output<z.ZodTuple<TInput, null>>) => MaybePromise<z.input<TOutput>>
|
|
21
|
+
> => {
|
|
4
22
|
const schema = z.function({
|
|
5
23
|
input: z.tuple(input),
|
|
6
24
|
output,
|
|
7
25
|
});
|
|
8
26
|
return z
|
|
9
|
-
.custom<z.
|
|
10
|
-
.transform((arg) => schema.
|
|
27
|
+
.custom<(...args: z.output<z.ZodTuple<TInput, null>>) => MaybePromise<z.input<TOutput>>>((arg) => typeof arg === "function")
|
|
28
|
+
.transform((arg) => schema.implementAsync(arg));
|
|
11
29
|
};
|
|
12
30
|
|
|
13
|
-
export const
|
|
31
|
+
export const fn = <TInput extends [z.ZodType, ...z.ZodType[]], TOutput extends z.ZodType>({
|
|
14
32
|
input,
|
|
15
33
|
output,
|
|
16
34
|
}: {
|
|
17
35
|
input: TInput;
|
|
18
36
|
output: TOutput;
|
|
19
|
-
})
|
|
37
|
+
}): z.ZodType<
|
|
38
|
+
(...args: z.input<z.ZodTuple<TInput, null>>) => z.output<TOutput>,
|
|
39
|
+
(...args: z.output<z.ZodTuple<TInput, null>>) => z.input<TOutput>
|
|
40
|
+
> => {
|
|
20
41
|
const schema = z.function({
|
|
21
42
|
input: z.tuple(input),
|
|
22
43
|
output,
|
|
23
44
|
});
|
|
24
45
|
return z
|
|
25
|
-
.custom<z.
|
|
26
|
-
.transform((arg) => schema.
|
|
46
|
+
.custom<(...args: z.output<z.ZodTuple<TInput, null>>) => z.input<TOutput>>((arg) => typeof arg === "function")
|
|
47
|
+
.transform((arg) => schema.implement(arg));
|
|
27
48
|
};
|
package/src/types.ts
CHANGED
|
@@ -1,20 +1,15 @@
|
|
|
1
|
-
import type {
|
|
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/manifest-entry.js";
|
|
5
|
-
import type { manifestTransformResult } from "./schema/manifest-transform.js";
|
|
3
|
+
import type { manifestEntry, manifestEntryWithSize } from "./schema/manifest-entry.js";
|
|
4
|
+
import type { manifestTransform, manifestTransformResult } from "./schema/manifest-transform.js";
|
|
6
5
|
|
|
7
|
-
export
|
|
6
|
+
export interface ManifestTransformResult extends z.infer<typeof manifestTransformResult> {}
|
|
8
7
|
|
|
9
|
-
export
|
|
8
|
+
export interface ManifestEntry extends z.infer<typeof manifestEntry> {}
|
|
10
9
|
|
|
11
|
-
export
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
) => MaybePromise<{
|
|
15
|
-
manifest: (ManifestEntry & { size: number })[];
|
|
16
|
-
warnings?: string[] | undefined;
|
|
17
|
-
}>;
|
|
10
|
+
export interface ManifestEntryWithSize extends z.infer<typeof manifestEntryWithSize> {}
|
|
11
|
+
|
|
12
|
+
export interface ManifestTransform extends z.infer<typeof manifestTransform> {}
|
|
18
13
|
|
|
19
14
|
export interface BasePartial {
|
|
20
15
|
/**
|
|
@@ -207,18 +202,3 @@ export interface GetManifestResult {
|
|
|
207
202
|
export type BuildResult = Omit<GetManifestResult, "manifestEntries"> & {
|
|
208
203
|
filePaths: string[];
|
|
209
204
|
};
|
|
210
|
-
|
|
211
|
-
/**
|
|
212
|
-
* @private
|
|
213
|
-
*/
|
|
214
|
-
export type BuildType = "dev" | "prod";
|
|
215
|
-
|
|
216
|
-
/**
|
|
217
|
-
* @private
|
|
218
|
-
*/
|
|
219
|
-
export type SerwistPackageJSON = Prettify<PackageJson>;
|
|
220
|
-
|
|
221
|
-
/**
|
|
222
|
-
* @private
|
|
223
|
-
*/
|
|
224
|
-
export type MethodNames = "GetManifest" | "InjectManifest" | "WebpackInjectManifest" | "ViteInjectManifest";
|