@serwist/build 9.0.0-preview.16 → 9.0.0-preview.17

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.
@@ -2,7 +2,7 @@ import { z } from 'zod';
2
2
 
3
3
  const manifestEntry = z.object({
4
4
  integrity: z.string().optional(),
5
- revision: z.string().nullable(),
5
+ revision: z.string().nullable().optional(),
6
6
  url: z.string()
7
7
  }).strict("Do not pass invalid properties to ManifestEntry!");
8
8
 
package/dist/index.js CHANGED
@@ -3,11 +3,13 @@ export { default as stringify } from 'fast-json-stable-stringify';
3
3
  import assert from 'node:assert';
4
4
  import { oneLine } from 'common-tags';
5
5
  import crypto from 'node:crypto';
6
+ import path from 'node:path';
6
7
  import { globSync } from 'glob';
7
- import upath from 'upath';
8
+ import { readFileSync } from 'node:fs';
8
9
  import fse from 'fs-extra';
9
10
  import prettyBytes from 'pretty-bytes';
10
11
  import { v as validationErrorMap, S as SerwistConfigError } from './chunks/validationErrorMap.js';
12
+ import upath from 'upath';
11
13
  import { SourceMapGenerator, SourceMapConsumer } from 'source-map';
12
14
  import 'zod';
13
15
 
@@ -100,7 +102,7 @@ const getCompositeDetails = (compositeURL, dependencyDetails)=>{
100
102
  let compositeHash = "";
101
103
  for (const fileDetails of dependencyDetails){
102
104
  totalSize += fileDetails.size;
103
- compositeHash += fileDetails.hash;
105
+ compositeHash += fileDetails.hash === null ? "" : fileDetails.hash;
104
106
  }
105
107
  const md5 = crypto.createHash("md5");
106
108
  md5.update(compositeHash);
@@ -118,14 +120,14 @@ function getStringHash(input) {
118
120
  return md5.digest("hex");
119
121
  }
120
122
 
121
- function getFileHash(file) {
123
+ const getFileHash = (file)=>{
122
124
  try {
123
- const buffer = fse.readFileSync(file);
125
+ const buffer = readFileSync(file);
124
126
  return getStringHash(buffer);
125
127
  } catch (err) {
126
128
  throw new Error(`${errors["unable-to-get-file-hash"]} '${err instanceof Error && err.message ? err.message : ""}'`);
127
129
  }
128
- }
130
+ };
129
131
 
130
132
  function getFileSize(file) {
131
133
  try {
@@ -160,12 +162,12 @@ const getFileDetails = ({ globDirectory, globFollow, globIgnores, globPattern })
160
162
  }
161
163
  const globbedFileDetails = [];
162
164
  for (const file of globbedFiles){
163
- const fullPath = upath.join(globDirectory, file);
165
+ const fullPath = path.join(globDirectory, file);
164
166
  const fileSize = getFileSize(fullPath);
165
167
  if (fileSize !== null) {
166
168
  const fileHash = getFileHash(fullPath);
167
169
  globbedFileDetails.push({
168
- file: `${upath.relative(globDirectory, fullPath)}`,
170
+ file: path.relative(globDirectory, fullPath),
169
171
  hash: fileHash,
170
172
  size: fileSize
171
173
  });
@@ -177,13 +179,11 @@ const getFileDetails = ({ globDirectory, globFollow, globIgnores, globPattern })
177
179
  };
178
180
  };
179
181
 
180
- function getStringDetails(url, str) {
181
- return {
182
+ const getStringDetails = (url, str)=>({
182
183
  file: url,
183
184
  hash: getStringHash(str),
184
185
  size: str.length
185
- };
186
- }
186
+ });
187
187
 
188
188
  const additionalPrecacheEntriesTransform = (additionalPrecacheEntries)=>{
189
189
  return (manifest)=>{
@@ -198,7 +198,7 @@ const additionalPrecacheEntriesTransform = (additionalPrecacheEntries)=>{
198
198
  url: additionalEntry
199
199
  });
200
200
  } else {
201
- if (additionalEntry && additionalEntry.revision === undefined) {
201
+ if (additionalEntry && !additionalEntry.integrity && additionalEntry.revision === undefined) {
202
202
  stringEntries.add(additionalEntry.url);
203
203
  }
204
204
  manifest.push(Object.assign({
@@ -306,13 +306,11 @@ async function transformManifest({ additionalPrecacheEntries, dontCacheBustURLsM
306
306
  };
307
307
  }
308
308
  const allWarnings = [];
309
- const normalizedManifest = fileDetails.map((fileDetails)=>{
310
- return {
309
+ const normalizedManifest = fileDetails.map((fileDetails)=>({
311
310
  url: fileDetails.file.replace(/\\/g, "/"),
312
311
  revision: fileDetails.hash,
313
312
  size: fileDetails.size
314
- };
315
- });
313
+ }));
316
314
  const transformsToApply = [];
317
315
  if (maximumFileSizeToCacheInBytes) {
318
316
  transformsToApply.push(maximumSizeTransform(maximumFileSizeToCacheInBytes));
@@ -352,7 +350,7 @@ async function transformManifest({ additionalPrecacheEntries, dontCacheBustURLsM
352
350
  };
353
351
  }
354
352
 
355
- async function getFileManifestEntries({ additionalPrecacheEntries, dontCacheBustURLsMatching, globDirectory, globFollow, globIgnores, globPatterns = [], globStrict, manifestTransforms, maximumFileSizeToCacheInBytes, modifyURLPrefix, templatedURLs, disablePrecacheManifest }) {
353
+ const getFileManifestEntries = async ({ additionalPrecacheEntries, dontCacheBustURLsMatching, globDirectory, globFollow, globIgnores, globPatterns = [], globStrict, manifestTransforms, maximumFileSizeToCacheInBytes, modifyURLPrefix, templatedURLs, disablePrecacheManifest })=>{
356
354
  if (disablePrecacheManifest) {
357
355
  return {
358
356
  count: 0,
@@ -430,7 +428,7 @@ async function getFileManifestEntries({ additionalPrecacheEntries, dontCacheBust
430
428
  });
431
429
  transformedManifest.warnings.push(...warnings);
432
430
  return transformedManifest;
433
- }
431
+ };
434
432
 
435
433
  const validateGetManifestOptions = async (input)=>{
436
434
  const result = await (await import('./chunks/getManifest.js')).getManifestOptions.spa(input, {
@@ -1,9 +1,4 @@
1
- import type { GlobPartial } from "../types.js";
2
- interface FileDetails {
3
- file: string;
4
- hash: string;
5
- size: number;
6
- }
1
+ import type { FileDetails, GlobPartial } from "../types.js";
7
2
  export declare const getFileDetails: ({ globDirectory, globFollow, globIgnores, globPattern, }: Omit<GlobPartial, "globPatterns" | "templatedURLs" | "globDirectory"> & {
8
3
  globDirectory: string;
9
4
  globPattern: string;
@@ -11,5 +6,4 @@ export declare const getFileDetails: ({ globDirectory, globFollow, globIgnores,
11
6
  globbedFileDetails: FileDetails[];
12
7
  warning: string;
13
8
  };
14
- export {};
15
9
  //# sourceMappingURL=get-file-details.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-file-details.d.ts","sourceRoot":"","sources":["../../src/lib/get-file-details.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAK/C,UAAU,WAAW;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,cAAc;mBAOV,MAAM;iBACR,MAAM;;wBAEC,WAAW,EAAE;aACxB,MAAM;CAkChB,CAAC"}
1
+ {"version":3,"file":"get-file-details.d.ts","sourceRoot":"","sources":["../../src/lib/get-file-details.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAK5D,eAAO,MAAM,cAAc;mBAOV,MAAM;iBACR,MAAM;;wBAEC,WAAW,EAAE;aACxB,MAAM;CAkChB,CAAC"}
@@ -1,2 +1,2 @@
1
- export declare function getFileHash(file: string): string;
1
+ export declare const getFileHash: (file: string) => string;
2
2
  //# sourceMappingURL=get-file-hash.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-file-hash.d.ts","sourceRoot":"","sources":["../../src/lib/get-file-hash.ts"],"names":[],"mappings":"AAaA,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAOhD"}
1
+ {"version":3,"file":"get-file-hash.d.ts","sourceRoot":"","sources":["../../src/lib/get-file-hash.ts"],"names":[],"mappings":"AAaA,eAAO,MAAM,WAAW,SAAU,MAAM,KAAG,MAO1C,CAAC"}
@@ -1,3 +1,3 @@
1
- import type { GetManifestOptions, GetManifestResult } from "../types.js";
2
- export declare function getFileManifestEntries({ additionalPrecacheEntries, dontCacheBustURLsMatching, globDirectory, globFollow, globIgnores, globPatterns, globStrict, manifestTransforms, maximumFileSizeToCacheInBytes, modifyURLPrefix, templatedURLs, disablePrecacheManifest, }: GetManifestOptions): Promise<GetManifestResult>;
1
+ import type { GetManifestOptionsComplete, GetManifestResult } from "../types.js";
2
+ export declare const getFileManifestEntries: ({ additionalPrecacheEntries, dontCacheBustURLsMatching, globDirectory, globFollow, globIgnores, globPatterns, globStrict, manifestTransforms, maximumFileSizeToCacheInBytes, modifyURLPrefix, templatedURLs, disablePrecacheManifest, }: GetManifestOptionsComplete) => Promise<GetManifestResult>;
3
3
  //# sourceMappingURL=get-file-manifest-entries.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-file-manifest-entries.d.ts","sourceRoot":"","sources":["../../src/lib/get-file-manifest-entries.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAe,kBAAkB,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAOtF,wBAAsB,sBAAsB,CAAC,EAC3C,yBAAyB,EACzB,yBAAyB,EACzB,aAAa,EACb,UAAU,EACV,WAAW,EACX,YAAiB,EACjB,UAAU,EACV,kBAAkB,EAClB,6BAA6B,EAC7B,eAAe,EACf,aAAa,EACb,uBAAuB,GACxB,EAAE,kBAAkB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CA+FjD"}
1
+ {"version":3,"file":"get-file-manifest-entries.d.ts","sourceRoot":"","sources":["../../src/lib/get-file-manifest-entries.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAe,0BAA0B,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAO9F,eAAO,MAAM,sBAAsB,4OAahC,0BAA0B,KAAG,QAAQ,iBAAiB,CA+FxD,CAAC"}
@@ -1,3 +1,3 @@
1
1
  import type { FileDetails } from "../types.js";
2
- export declare function getStringDetails(url: string, str: string): FileDetails;
2
+ export declare const getStringDetails: (url: string, str: string) => FileDetails;
3
3
  //# sourceMappingURL=get-string-details.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"get-string-details.d.ts","sourceRoot":"","sources":["../../src/lib/get-string-details.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG/C,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,WAAW,CAMtE"}
1
+ {"version":3,"file":"get-string-details.d.ts","sourceRoot":"","sources":["../../src/lib/get-string-details.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG/C,eAAO,MAAM,gBAAgB,QAAS,MAAM,OAAO,MAAM,KAAG,WAI1D,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { BasePartial, FileDetails, ManifestEntry } from "../types.js";
1
+ import type { BaseResolved, FileDetails, ManifestEntry } from "../types.js";
2
2
  /**
3
3
  * A `ManifestTransform` function can be used to modify the modify the `url` or
4
4
  * `revision` properties of some or all of the
@@ -53,9 +53,10 @@ interface ManifestTransformResultWithWarnings {
53
53
  manifestEntries: ManifestEntry[] | undefined;
54
54
  warnings: string[];
55
55
  }
56
- export declare function transformManifest({ additionalPrecacheEntries, dontCacheBustURLsMatching, fileDetails, manifestTransforms, maximumFileSizeToCacheInBytes, modifyURLPrefix, transformParam, disablePrecacheManifest, }: BasePartial & {
56
+ interface TransformManifestOptions extends Pick<BaseResolved, "additionalPrecacheEntries" | "dontCacheBustURLsMatching" | "manifestTransforms" | "maximumFileSizeToCacheInBytes" | "modifyURLPrefix" | "disablePrecacheManifest"> {
57
57
  fileDetails: FileDetails[];
58
58
  transformParam?: unknown;
59
- }): Promise<ManifestTransformResultWithWarnings>;
59
+ }
60
+ export declare function transformManifest({ additionalPrecacheEntries, dontCacheBustURLsMatching, fileDetails, manifestTransforms, maximumFileSizeToCacheInBytes, modifyURLPrefix, transformParam, disablePrecacheManifest, }: TransformManifestOptions): Promise<ManifestTransformResultWithWarnings>;
60
61
  export {};
61
62
  //# sourceMappingURL=transform-manifest.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"transform-manifest.d.ts","sourceRoot":"","sources":["../../src/lib/transform-manifest.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,WAAW,EAAE,WAAW,EAAE,aAAa,EAAqB,MAAM,aAAa,CAAC;AAO9F;;;;;;;;;;;;;;;;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AAc,EACd,uBAAuB,GACxB,EAAE,wBAAwB,GAAG,OAAO,CAAC,mCAAmC,CAAC,CAuEzE"}
@@ -2,100 +2,100 @@ import { z } from "zod";
2
2
  export declare const basePartial: z.ZodObject<{
3
3
  additionalPrecacheEntries: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
4
4
  integrity: z.ZodOptional<z.ZodString>;
5
- revision: z.ZodNullable<z.ZodString>;
5
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
6
6
  url: z.ZodString;
7
7
  }, "strict", z.ZodTypeAny, {
8
- revision: string | null;
9
8
  url: string;
10
9
  integrity?: string | undefined;
10
+ revision?: string | null | undefined;
11
11
  }, {
12
- revision: string | null;
13
12
  url: string;
14
13
  integrity?: string | undefined;
14
+ revision?: string | null | undefined;
15
15
  }>]>, "many">>;
16
16
  disablePrecacheManifest: z.ZodDefault<z.ZodBoolean>;
17
17
  dontCacheBustURLsMatching: z.ZodOptional<z.ZodType<RegExp, z.ZodTypeDef, RegExp>>;
18
18
  manifestTransforms: z.ZodOptional<z.ZodArray<z.ZodFunction<z.ZodTuple<[z.ZodArray<z.ZodObject<{
19
19
  integrity: z.ZodOptional<z.ZodString>;
20
- revision: z.ZodNullable<z.ZodString>;
20
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
21
21
  url: z.ZodString;
22
22
  size: z.ZodNumber;
23
23
  }, "strip", z.ZodTypeAny, {
24
- revision: string | null;
25
24
  url: string;
26
25
  size: number;
27
26
  integrity?: string | undefined;
27
+ revision?: string | null | undefined;
28
28
  }, {
29
- revision: string | null;
30
29
  url: string;
31
30
  size: number;
32
31
  integrity?: string | undefined;
32
+ revision?: string | null | undefined;
33
33
  }>, "many">, z.ZodOptional<z.ZodUnknown>], null>, z.ZodUnion<[z.ZodPromise<z.ZodObject<{
34
34
  manifest: z.ZodArray<z.ZodObject<{
35
35
  integrity: z.ZodOptional<z.ZodString>;
36
- revision: z.ZodNullable<z.ZodString>;
36
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
37
37
  url: z.ZodString;
38
38
  size: z.ZodNumber;
39
39
  }, "strip", z.ZodTypeAny, {
40
- revision: string | null;
41
40
  url: string;
42
41
  size: number;
43
42
  integrity?: string | undefined;
43
+ revision?: string | null | undefined;
44
44
  }, {
45
- revision: string | null;
46
45
  url: string;
47
46
  size: number;
48
47
  integrity?: string | undefined;
48
+ revision?: string | null | undefined;
49
49
  }>, "many">;
50
50
  warnings: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
51
51
  }, "strict", z.ZodTypeAny, {
52
52
  manifest: {
53
- revision: string | null;
54
53
  url: string;
55
54
  size: number;
56
55
  integrity?: string | undefined;
56
+ revision?: string | null | undefined;
57
57
  }[];
58
58
  warnings?: string[] | undefined;
59
59
  }, {
60
60
  manifest: {
61
- revision: string | null;
62
61
  url: string;
63
62
  size: number;
64
63
  integrity?: string | undefined;
64
+ revision?: string | null | undefined;
65
65
  }[];
66
66
  warnings?: string[] | undefined;
67
67
  }>>, z.ZodObject<{
68
68
  manifest: z.ZodArray<z.ZodObject<{
69
69
  integrity: z.ZodOptional<z.ZodString>;
70
- revision: z.ZodNullable<z.ZodString>;
70
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
71
71
  url: z.ZodString;
72
72
  size: z.ZodNumber;
73
73
  }, "strip", z.ZodTypeAny, {
74
- revision: string | null;
75
74
  url: string;
76
75
  size: number;
77
76
  integrity?: string | undefined;
77
+ revision?: string | null | undefined;
78
78
  }, {
79
- revision: string | null;
80
79
  url: string;
81
80
  size: number;
82
81
  integrity?: string | undefined;
82
+ revision?: string | null | undefined;
83
83
  }>, "many">;
84
84
  warnings: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
85
85
  }, "strict", z.ZodTypeAny, {
86
86
  manifest: {
87
- revision: string | null;
88
87
  url: string;
89
88
  size: number;
90
89
  integrity?: string | undefined;
90
+ revision?: string | null | undefined;
91
91
  }[];
92
92
  warnings?: string[] | undefined;
93
93
  }, {
94
94
  manifest: {
95
- revision: string | null;
96
95
  url: string;
97
96
  size: number;
98
97
  integrity?: string | undefined;
98
+ revision?: string | null | undefined;
99
99
  }[];
100
100
  warnings?: string[] | undefined;
101
101
  }>]>>, "many">>;
@@ -105,61 +105,61 @@ export declare const basePartial: z.ZodObject<{
105
105
  disablePrecacheManifest: boolean;
106
106
  maximumFileSizeToCacheInBytes: number;
107
107
  additionalPrecacheEntries?: (string | {
108
- revision: string | null;
109
108
  url: string;
110
109
  integrity?: string | undefined;
110
+ revision?: string | null | undefined;
111
111
  })[] | undefined;
112
112
  dontCacheBustURLsMatching?: RegExp | undefined;
113
113
  manifestTransforms?: ((args_0: {
114
- revision: string | null;
115
114
  url: string;
116
115
  size: number;
117
116
  integrity?: string | undefined;
117
+ revision?: string | null | undefined;
118
118
  }[], args_1: unknown) => {
119
119
  manifest: {
120
- revision: string | null;
121
120
  url: string;
122
121
  size: number;
123
122
  integrity?: string | undefined;
123
+ revision?: string | null | undefined;
124
124
  }[];
125
125
  warnings?: string[] | undefined;
126
126
  } | Promise<{
127
127
  manifest: {
128
- revision: string | null;
129
128
  url: string;
130
129
  size: number;
131
130
  integrity?: string | undefined;
131
+ revision?: string | null | undefined;
132
132
  }[];
133
133
  warnings?: string[] | undefined;
134
134
  }>)[] | undefined;
135
135
  modifyURLPrefix?: Record<string, string> | undefined;
136
136
  }, {
137
137
  additionalPrecacheEntries?: (string | {
138
- revision: string | null;
139
138
  url: string;
140
139
  integrity?: string | undefined;
140
+ revision?: string | null | undefined;
141
141
  })[] | undefined;
142
142
  disablePrecacheManifest?: boolean | undefined;
143
143
  dontCacheBustURLsMatching?: RegExp | undefined;
144
144
  manifestTransforms?: ((args_0: {
145
- revision: string | null;
146
145
  url: string;
147
146
  size: number;
148
147
  integrity?: string | undefined;
148
+ revision?: string | null | undefined;
149
149
  }[], args_1: unknown) => {
150
150
  manifest: {
151
- revision: string | null;
152
151
  url: string;
153
152
  size: number;
154
153
  integrity?: string | undefined;
154
+ revision?: string | null | undefined;
155
155
  }[];
156
156
  warnings?: string[] | undefined;
157
157
  } | Promise<{
158
158
  manifest: {
159
- revision: string | null;
160
159
  url: string;
161
160
  size: number;
162
161
  integrity?: string | undefined;
162
+ revision?: string | null | undefined;
163
163
  }[];
164
164
  warnings?: string[] | undefined;
165
165
  }>)[] | undefined;
@@ -4,99 +4,99 @@ export declare const getManifestOptions: z.ZodObject<{
4
4
  maximumFileSizeToCacheInBytes: z.ZodDefault<z.ZodNumber>;
5
5
  additionalPrecacheEntries: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
6
6
  integrity: z.ZodOptional<z.ZodString>;
7
- revision: z.ZodNullable<z.ZodString>;
7
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
8
8
  url: z.ZodString;
9
9
  }, "strict", z.ZodTypeAny, {
10
- revision: string | null;
11
10
  url: string;
12
11
  integrity?: string | undefined;
12
+ revision?: string | null | undefined;
13
13
  }, {
14
- revision: string | null;
15
14
  url: string;
16
15
  integrity?: string | undefined;
16
+ revision?: string | null | undefined;
17
17
  }>]>, "many">>;
18
18
  dontCacheBustURLsMatching: z.ZodOptional<z.ZodType<RegExp, z.ZodTypeDef, RegExp>>;
19
19
  manifestTransforms: z.ZodOptional<z.ZodArray<z.ZodFunction<z.ZodTuple<[z.ZodArray<z.ZodObject<{
20
20
  integrity: z.ZodOptional<z.ZodString>;
21
- revision: z.ZodNullable<z.ZodString>;
21
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
22
22
  url: z.ZodString;
23
23
  size: z.ZodNumber;
24
24
  }, "strip", z.ZodTypeAny, {
25
- revision: string | null;
26
25
  url: string;
27
26
  size: number;
28
27
  integrity?: string | undefined;
28
+ revision?: string | null | undefined;
29
29
  }, {
30
- revision: string | null;
31
30
  url: string;
32
31
  size: number;
33
32
  integrity?: string | undefined;
33
+ revision?: string | null | undefined;
34
34
  }>, "many">, z.ZodOptional<z.ZodUnknown>], null>, z.ZodUnion<[z.ZodPromise<z.ZodObject<{
35
35
  manifest: z.ZodArray<z.ZodObject<{
36
36
  integrity: z.ZodOptional<z.ZodString>;
37
- revision: z.ZodNullable<z.ZodString>;
37
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
38
38
  url: z.ZodString;
39
39
  size: z.ZodNumber;
40
40
  }, "strip", z.ZodTypeAny, {
41
- revision: string | null;
42
41
  url: string;
43
42
  size: number;
44
43
  integrity?: string | undefined;
44
+ revision?: string | null | undefined;
45
45
  }, {
46
- revision: string | null;
47
46
  url: string;
48
47
  size: number;
49
48
  integrity?: string | undefined;
49
+ revision?: string | null | undefined;
50
50
  }>, "many">;
51
51
  warnings: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
52
52
  }, "strict", z.ZodTypeAny, {
53
53
  manifest: {
54
- revision: string | null;
55
54
  url: string;
56
55
  size: number;
57
56
  integrity?: string | undefined;
57
+ revision?: string | null | undefined;
58
58
  }[];
59
59
  warnings?: string[] | undefined;
60
60
  }, {
61
61
  manifest: {
62
- revision: string | null;
63
62
  url: string;
64
63
  size: number;
65
64
  integrity?: string | undefined;
65
+ revision?: string | null | undefined;
66
66
  }[];
67
67
  warnings?: string[] | undefined;
68
68
  }>>, z.ZodObject<{
69
69
  manifest: z.ZodArray<z.ZodObject<{
70
70
  integrity: z.ZodOptional<z.ZodString>;
71
- revision: z.ZodNullable<z.ZodString>;
71
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
72
72
  url: z.ZodString;
73
73
  size: z.ZodNumber;
74
74
  }, "strip", z.ZodTypeAny, {
75
- revision: string | null;
76
75
  url: string;
77
76
  size: number;
78
77
  integrity?: string | undefined;
78
+ revision?: string | null | undefined;
79
79
  }, {
80
- revision: string | null;
81
80
  url: string;
82
81
  size: number;
83
82
  integrity?: string | undefined;
83
+ revision?: string | null | undefined;
84
84
  }>, "many">;
85
85
  warnings: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
86
86
  }, "strict", z.ZodTypeAny, {
87
87
  manifest: {
88
- revision: string | null;
89
88
  url: string;
90
89
  size: number;
91
90
  integrity?: string | undefined;
91
+ revision?: string | null | undefined;
92
92
  }[];
93
93
  warnings?: string[] | undefined;
94
94
  }, {
95
95
  manifest: {
96
- revision: string | null;
97
96
  url: string;
98
97
  size: number;
99
98
  integrity?: string | undefined;
99
+ revision?: string | null | undefined;
100
100
  }[];
101
101
  warnings?: string[] | undefined;
102
102
  }>]>>, "many">>;
@@ -116,30 +116,30 @@ export declare const getManifestOptions: z.ZodObject<{
116
116
  globStrict: boolean;
117
117
  globDirectory: string;
118
118
  additionalPrecacheEntries?: (string | {
119
- revision: string | null;
120
119
  url: string;
121
120
  integrity?: string | undefined;
121
+ revision?: string | null | undefined;
122
122
  })[] | undefined;
123
123
  dontCacheBustURLsMatching?: RegExp | undefined;
124
124
  manifestTransforms?: ((args_0: {
125
- revision: string | null;
126
125
  url: string;
127
126
  size: number;
128
127
  integrity?: string | undefined;
128
+ revision?: string | null | undefined;
129
129
  }[], args_1: unknown) => {
130
130
  manifest: {
131
- revision: string | null;
132
131
  url: string;
133
132
  size: number;
134
133
  integrity?: string | undefined;
134
+ revision?: string | null | undefined;
135
135
  }[];
136
136
  warnings?: string[] | undefined;
137
137
  } | Promise<{
138
138
  manifest: {
139
- revision: string | null;
140
139
  url: string;
141
140
  size: number;
142
141
  integrity?: string | undefined;
142
+ revision?: string | null | undefined;
143
143
  }[];
144
144
  warnings?: string[] | undefined;
145
145
  }>)[] | undefined;
@@ -150,30 +150,30 @@ export declare const getManifestOptions: z.ZodObject<{
150
150
  disablePrecacheManifest?: boolean | undefined;
151
151
  maximumFileSizeToCacheInBytes?: number | undefined;
152
152
  additionalPrecacheEntries?: (string | {
153
- revision: string | null;
154
153
  url: string;
155
154
  integrity?: string | undefined;
155
+ revision?: string | null | undefined;
156
156
  })[] | undefined;
157
157
  dontCacheBustURLsMatching?: RegExp | undefined;
158
158
  manifestTransforms?: ((args_0: {
159
- revision: string | null;
160
159
  url: string;
161
160
  size: number;
162
161
  integrity?: string | undefined;
162
+ revision?: string | null | undefined;
163
163
  }[], args_1: unknown) => {
164
164
  manifest: {
165
- revision: string | null;
166
165
  url: string;
167
166
  size: number;
168
167
  integrity?: string | undefined;
168
+ revision?: string | null | undefined;
169
169
  }[];
170
170
  warnings?: string[] | undefined;
171
171
  } | Promise<{
172
172
  manifest: {
173
- revision: string | null;
174
173
  url: string;
175
174
  size: number;
176
175
  integrity?: string | undefined;
176
+ revision?: string | null | undefined;
177
177
  }[];
178
178
  warnings?: string[] | undefined;
179
179
  }>)[] | undefined;
@@ -14,99 +14,99 @@ export declare const injectManifestOptions: z.ZodObject<{
14
14
  maximumFileSizeToCacheInBytes: z.ZodDefault<z.ZodNumber>;
15
15
  additionalPrecacheEntries: z.ZodOptional<z.ZodArray<z.ZodUnion<[z.ZodString, z.ZodObject<{
16
16
  integrity: z.ZodOptional<z.ZodString>;
17
- revision: z.ZodNullable<z.ZodString>;
17
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
18
18
  url: z.ZodString;
19
19
  }, "strict", z.ZodTypeAny, {
20
- revision: string | null;
21
20
  url: string;
22
21
  integrity?: string | undefined;
22
+ revision?: string | null | undefined;
23
23
  }, {
24
- revision: string | null;
25
24
  url: string;
26
25
  integrity?: string | undefined;
26
+ revision?: string | null | undefined;
27
27
  }>]>, "many">>;
28
28
  dontCacheBustURLsMatching: z.ZodOptional<z.ZodType<RegExp, z.ZodTypeDef, RegExp>>;
29
29
  manifestTransforms: z.ZodOptional<z.ZodArray<z.ZodFunction<z.ZodTuple<[z.ZodArray<z.ZodObject<{
30
30
  integrity: z.ZodOptional<z.ZodString>;
31
- revision: z.ZodNullable<z.ZodString>;
31
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
32
32
  url: z.ZodString;
33
33
  size: z.ZodNumber;
34
34
  }, "strip", z.ZodTypeAny, {
35
- revision: string | null;
36
35
  url: string;
37
36
  size: number;
38
37
  integrity?: string | undefined;
38
+ revision?: string | null | undefined;
39
39
  }, {
40
- revision: string | null;
41
40
  url: string;
42
41
  size: number;
43
42
  integrity?: string | undefined;
43
+ revision?: string | null | undefined;
44
44
  }>, "many">, z.ZodOptional<z.ZodUnknown>], null>, z.ZodUnion<[z.ZodPromise<z.ZodObject<{
45
45
  manifest: z.ZodArray<z.ZodObject<{
46
46
  integrity: z.ZodOptional<z.ZodString>;
47
- revision: z.ZodNullable<z.ZodString>;
47
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
48
48
  url: z.ZodString;
49
49
  size: z.ZodNumber;
50
50
  }, "strip", z.ZodTypeAny, {
51
- revision: string | null;
52
51
  url: string;
53
52
  size: number;
54
53
  integrity?: string | undefined;
54
+ revision?: string | null | undefined;
55
55
  }, {
56
- revision: string | null;
57
56
  url: string;
58
57
  size: number;
59
58
  integrity?: string | undefined;
59
+ revision?: string | null | undefined;
60
60
  }>, "many">;
61
61
  warnings: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
62
62
  }, "strict", z.ZodTypeAny, {
63
63
  manifest: {
64
- revision: string | null;
65
64
  url: string;
66
65
  size: number;
67
66
  integrity?: string | undefined;
67
+ revision?: string | null | undefined;
68
68
  }[];
69
69
  warnings?: string[] | undefined;
70
70
  }, {
71
71
  manifest: {
72
- revision: string | null;
73
72
  url: string;
74
73
  size: number;
75
74
  integrity?: string | undefined;
75
+ revision?: string | null | undefined;
76
76
  }[];
77
77
  warnings?: string[] | undefined;
78
78
  }>>, z.ZodObject<{
79
79
  manifest: z.ZodArray<z.ZodObject<{
80
80
  integrity: z.ZodOptional<z.ZodString>;
81
- revision: z.ZodNullable<z.ZodString>;
81
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
82
82
  url: z.ZodString;
83
83
  size: z.ZodNumber;
84
84
  }, "strip", z.ZodTypeAny, {
85
- revision: string | null;
86
85
  url: string;
87
86
  size: number;
88
87
  integrity?: string | undefined;
88
+ revision?: string | null | undefined;
89
89
  }, {
90
- revision: string | null;
91
90
  url: string;
92
91
  size: number;
93
92
  integrity?: string | undefined;
93
+ revision?: string | null | undefined;
94
94
  }>, "many">;
95
95
  warnings: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
96
96
  }, "strict", z.ZodTypeAny, {
97
97
  manifest: {
98
- revision: string | null;
99
98
  url: string;
100
99
  size: number;
101
100
  integrity?: string | undefined;
101
+ revision?: string | null | undefined;
102
102
  }[];
103
103
  warnings?: string[] | undefined;
104
104
  }, {
105
105
  manifest: {
106
- revision: string | null;
107
106
  url: string;
108
107
  size: number;
109
108
  integrity?: string | undefined;
109
+ revision?: string | null | undefined;
110
110
  }[];
111
111
  warnings?: string[] | undefined;
112
112
  }>]>>, "many">>;
@@ -132,30 +132,30 @@ export declare const injectManifestOptions: z.ZodObject<{
132
132
  globDirectory: string;
133
133
  swDest: string;
134
134
  additionalPrecacheEntries?: (string | {
135
- revision: string | null;
136
135
  url: string;
137
136
  integrity?: string | undefined;
137
+ revision?: string | null | undefined;
138
138
  })[] | undefined;
139
139
  dontCacheBustURLsMatching?: RegExp | undefined;
140
140
  manifestTransforms?: ((args_0: {
141
- revision: string | null;
142
141
  url: string;
143
142
  size: number;
144
143
  integrity?: string | undefined;
144
+ revision?: string | null | undefined;
145
145
  }[], args_1: unknown) => {
146
146
  manifest: {
147
- revision: string | null;
148
147
  url: string;
149
148
  size: number;
150
149
  integrity?: string | undefined;
150
+ revision?: string | null | undefined;
151
151
  }[];
152
152
  warnings?: string[] | undefined;
153
153
  } | Promise<{
154
154
  manifest: {
155
- revision: string | null;
156
155
  url: string;
157
156
  size: number;
158
157
  integrity?: string | undefined;
158
+ revision?: string | null | undefined;
159
159
  }[];
160
160
  warnings?: string[] | undefined;
161
161
  }>)[] | undefined;
@@ -168,30 +168,30 @@ export declare const injectManifestOptions: z.ZodObject<{
168
168
  disablePrecacheManifest?: boolean | undefined;
169
169
  maximumFileSizeToCacheInBytes?: number | undefined;
170
170
  additionalPrecacheEntries?: (string | {
171
- revision: string | null;
172
171
  url: string;
173
172
  integrity?: string | undefined;
173
+ revision?: string | null | undefined;
174
174
  })[] | undefined;
175
175
  dontCacheBustURLsMatching?: RegExp | undefined;
176
176
  manifestTransforms?: ((args_0: {
177
- revision: string | null;
178
177
  url: string;
179
178
  size: number;
180
179
  integrity?: string | undefined;
180
+ revision?: string | null | undefined;
181
181
  }[], args_1: unknown) => {
182
182
  manifest: {
183
- revision: string | null;
184
183
  url: string;
185
184
  size: number;
186
185
  integrity?: string | undefined;
186
+ revision?: string | null | undefined;
187
187
  }[];
188
188
  warnings?: string[] | undefined;
189
189
  } | Promise<{
190
190
  manifest: {
191
- revision: string | null;
192
191
  url: string;
193
192
  size: number;
194
193
  integrity?: string | undefined;
194
+ revision?: string | null | undefined;
195
195
  }[];
196
196
  warnings?: string[] | undefined;
197
197
  }>)[] | undefined;
@@ -1,15 +1,15 @@
1
1
  import { z } from "zod";
2
2
  export declare const manifestEntry: z.ZodObject<{
3
3
  integrity: z.ZodOptional<z.ZodString>;
4
- revision: z.ZodNullable<z.ZodString>;
4
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
5
5
  url: z.ZodString;
6
6
  }, "strict", z.ZodTypeAny, {
7
- revision: string | null;
8
7
  url: string;
9
8
  integrity?: string | undefined;
9
+ revision?: string | null | undefined;
10
10
  }, {
11
- revision: string | null;
12
11
  url: string;
13
12
  integrity?: string | undefined;
13
+ revision?: string | null | undefined;
14
14
  }>;
15
15
  //# sourceMappingURL=manifestEntry.d.ts.map
@@ -2,119 +2,119 @@ import { z } from "zod";
2
2
  export declare const manifestTransformResult: z.ZodObject<{
3
3
  manifest: z.ZodArray<z.ZodObject<{
4
4
  integrity: z.ZodOptional<z.ZodString>;
5
- revision: z.ZodNullable<z.ZodString>;
5
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
6
6
  url: z.ZodString;
7
7
  size: z.ZodNumber;
8
8
  }, "strip", z.ZodTypeAny, {
9
- revision: string | null;
10
9
  url: string;
11
10
  size: number;
12
11
  integrity?: string | undefined;
12
+ revision?: string | null | undefined;
13
13
  }, {
14
- revision: string | null;
15
14
  url: string;
16
15
  size: number;
17
16
  integrity?: string | undefined;
17
+ revision?: string | null | undefined;
18
18
  }>, "many">;
19
19
  warnings: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
20
20
  }, "strict", z.ZodTypeAny, {
21
21
  manifest: {
22
- revision: string | null;
23
22
  url: string;
24
23
  size: number;
25
24
  integrity?: string | undefined;
25
+ revision?: string | null | undefined;
26
26
  }[];
27
27
  warnings?: string[] | undefined;
28
28
  }, {
29
29
  manifest: {
30
- revision: string | null;
31
30
  url: string;
32
31
  size: number;
33
32
  integrity?: string | undefined;
33
+ revision?: string | null | undefined;
34
34
  }[];
35
35
  warnings?: string[] | undefined;
36
36
  }>;
37
37
  export declare const manifestTransform: z.ZodFunction<z.ZodTuple<[z.ZodArray<z.ZodObject<{
38
38
  integrity: z.ZodOptional<z.ZodString>;
39
- revision: z.ZodNullable<z.ZodString>;
39
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
40
40
  url: z.ZodString;
41
41
  size: z.ZodNumber;
42
42
  }, "strip", z.ZodTypeAny, {
43
- revision: string | null;
44
43
  url: string;
45
44
  size: number;
46
45
  integrity?: string | undefined;
46
+ revision?: string | null | undefined;
47
47
  }, {
48
- revision: string | null;
49
48
  url: string;
50
49
  size: number;
51
50
  integrity?: string | undefined;
51
+ revision?: string | null | undefined;
52
52
  }>, "many">, z.ZodOptional<z.ZodUnknown>], null>, z.ZodUnion<[z.ZodPromise<z.ZodObject<{
53
53
  manifest: z.ZodArray<z.ZodObject<{
54
54
  integrity: z.ZodOptional<z.ZodString>;
55
- revision: z.ZodNullable<z.ZodString>;
55
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
56
56
  url: z.ZodString;
57
57
  size: z.ZodNumber;
58
58
  }, "strip", z.ZodTypeAny, {
59
- revision: string | null;
60
59
  url: string;
61
60
  size: number;
62
61
  integrity?: string | undefined;
62
+ revision?: string | null | undefined;
63
63
  }, {
64
- revision: string | null;
65
64
  url: string;
66
65
  size: number;
67
66
  integrity?: string | undefined;
67
+ revision?: string | null | undefined;
68
68
  }>, "many">;
69
69
  warnings: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
70
70
  }, "strict", z.ZodTypeAny, {
71
71
  manifest: {
72
- revision: string | null;
73
72
  url: string;
74
73
  size: number;
75
74
  integrity?: string | undefined;
75
+ revision?: string | null | undefined;
76
76
  }[];
77
77
  warnings?: string[] | undefined;
78
78
  }, {
79
79
  manifest: {
80
- revision: string | null;
81
80
  url: string;
82
81
  size: number;
83
82
  integrity?: string | undefined;
83
+ revision?: string | null | undefined;
84
84
  }[];
85
85
  warnings?: string[] | undefined;
86
86
  }>>, z.ZodObject<{
87
87
  manifest: z.ZodArray<z.ZodObject<{
88
88
  integrity: z.ZodOptional<z.ZodString>;
89
- revision: z.ZodNullable<z.ZodString>;
89
+ revision: z.ZodOptional<z.ZodNullable<z.ZodString>>;
90
90
  url: z.ZodString;
91
91
  size: z.ZodNumber;
92
92
  }, "strip", z.ZodTypeAny, {
93
- revision: string | null;
94
93
  url: string;
95
94
  size: number;
96
95
  integrity?: string | undefined;
96
+ revision?: string | null | undefined;
97
97
  }, {
98
- revision: string | null;
99
98
  url: string;
100
99
  size: number;
101
100
  integrity?: string | undefined;
101
+ revision?: string | null | undefined;
102
102
  }>, "many">;
103
103
  warnings: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
104
104
  }, "strict", z.ZodTypeAny, {
105
105
  manifest: {
106
- revision: string | null;
107
106
  url: string;
108
107
  size: number;
109
108
  integrity?: string | undefined;
109
+ revision?: string | null | undefined;
110
110
  }[];
111
111
  warnings?: string[] | undefined;
112
112
  }, {
113
113
  manifest: {
114
- revision: string | null;
115
114
  url: string;
116
115
  size: number;
117
116
  integrity?: string | undefined;
117
+ revision?: string | null | undefined;
118
118
  }[];
119
119
  warnings?: string[] | undefined;
120
120
  }>]>>;
package/dist/types.d.ts CHANGED
@@ -179,7 +179,7 @@ export type BuildResult = Omit<GetManifestResult, "manifestEntries"> & {
179
179
  */
180
180
  export interface FileDetails {
181
181
  file: string;
182
- hash: string;
182
+ hash: string | null;
183
183
  size: number;
184
184
  }
185
185
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAC9C,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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,GAAG,YAAY,GAAG,cAAc,GAAG,sBAAsB,GAAG,6BAA6B,CAAC;AAElJ,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,eAAe,EAAE,aAAa,EAAE,GAAG,SAAS,CAAC;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,MAAM,WAAW,GAAG,IAAI,CAAC,iBAAiB,EAAE,iBAAiB,CAAC,GAAG;IACrE,SAAS,EAAE,MAAM,EAAE,CAAC;CACrB,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,KAAK,GAAG,MAAM,CAAC;AAEvC;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG,WAAW,CAAC;AAE7C;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,aAAa,GAAG,gBAAgB,GAAG,uBAAuB,GAAG,oBAAoB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@serwist/build",
3
- "version": "9.0.0-preview.16",
3
+ "version": "9.0.0-preview.17",
4
4
  "type": "module",
5
5
  "description": "A module that integrates into your build process, helping you generate a manifest of local files that should be precached.",
6
6
  "files": [
@@ -54,7 +54,7 @@
54
54
  "source-map": "0.8.0-beta.0",
55
55
  "upath": "2.0.1",
56
56
  "zod": "3.22.4",
57
- "@serwist/core": "9.0.0-preview.16"
57
+ "@serwist/core": "9.0.0-preview.17"
58
58
  },
59
59
  "devDependencies": {
60
60
  "@types/common-tags": "1.8.4",
@@ -63,8 +63,8 @@
63
63
  "@types/stringify-object": "4.0.5",
64
64
  "type-fest": "4.13.1",
65
65
  "typescript": "5.5.0-dev.20240323",
66
- "@serwist/constants": "9.0.0-preview.16",
67
- "@serwist/utils": "9.0.0-preview.16"
66
+ "@serwist/constants": "9.0.0-preview.17",
67
+ "@serwist/utils": "9.0.0-preview.17"
68
68
  },
69
69
  "peerDependencies": {
70
70
  "typescript": ">=5.0.0"
@@ -30,7 +30,7 @@ export const additionalPrecacheEntriesTransform = (additionalPrecacheEntries: (M
30
30
  url: additionalEntry,
31
31
  });
32
32
  } else {
33
- if (additionalEntry && additionalEntry.revision === undefined) {
33
+ if (additionalEntry && !additionalEntry.integrity && additionalEntry.revision === undefined) {
34
34
  stringEntries.add(additionalEntry.url);
35
35
  }
36
36
  manifest.push(Object.assign({ size: 0 }, additionalEntry));
@@ -16,7 +16,7 @@ export const getCompositeDetails = (compositeURL: string, dependencyDetails: Fil
16
16
 
17
17
  for (const fileDetails of dependencyDetails) {
18
18
  totalSize += fileDetails.size;
19
- compositeHash += fileDetails.hash;
19
+ compositeHash += fileDetails.hash === null ? "" : fileDetails.hash;
20
20
  }
21
21
 
22
22
  const md5 = crypto.createHash("md5");
@@ -5,21 +5,13 @@
5
5
  license that can be found in the LICENSE file or at
6
6
  https://opensource.org/licenses/MIT.
7
7
  */
8
-
8
+ import path from "node:path";
9
9
  import { globSync } from "glob";
10
- import upath from "upath";
11
-
12
- import type { GlobPartial } from "../types.js";
10
+ import type { FileDetails, GlobPartial } from "../types.js";
13
11
  import { errors } from "./errors.js";
14
12
  import { getFileHash } from "./get-file-hash.js";
15
13
  import { getFileSize } from "./get-file-size.js";
16
14
 
17
- interface FileDetails {
18
- file: string;
19
- hash: string;
20
- size: number;
21
- }
22
-
23
15
  export const getFileDetails = ({
24
16
  globDirectory,
25
17
  globFollow,
@@ -52,12 +44,12 @@ export const getFileDetails = ({
52
44
 
53
45
  const globbedFileDetails: FileDetails[] = [];
54
46
  for (const file of globbedFiles) {
55
- const fullPath = upath.join(globDirectory, file);
47
+ const fullPath = path.join(globDirectory, file);
56
48
  const fileSize = getFileSize(fullPath);
57
49
  if (fileSize !== null) {
58
50
  const fileHash = getFileHash(fullPath);
59
51
  globbedFileDetails.push({
60
- file: `${upath.relative(globDirectory, fullPath)}`,
52
+ file: path.relative(globDirectory, fullPath),
61
53
  hash: fileHash,
62
54
  size: fileSize,
63
55
  });
@@ -6,16 +6,16 @@
6
6
  https://opensource.org/licenses/MIT.
7
7
  */
8
8
 
9
- import fse from "fs-extra";
9
+ import { readFileSync } from "node:fs";
10
10
 
11
11
  import { errors } from "./errors.js";
12
12
  import { getStringHash } from "./get-string-hash.js";
13
13
 
14
- export function getFileHash(file: string): string {
14
+ export const getFileHash = (file: string): string => {
15
15
  try {
16
- const buffer = fse.readFileSync(file);
16
+ const buffer = readFileSync(file);
17
17
  return getStringHash(buffer);
18
18
  } catch (err) {
19
19
  throw new Error(`${errors["unable-to-get-file-hash"]} '${err instanceof Error && err.message ? err.message : ""}'`);
20
20
  }
21
- }
21
+ };
@@ -8,14 +8,14 @@
8
8
 
9
9
  import assert from "node:assert";
10
10
 
11
- import type { FileDetails, GetManifestOptions, GetManifestResult } from "../types.js";
11
+ import type { FileDetails, GetManifestOptionsComplete, GetManifestResult } from "../types.js";
12
12
  import { errors } from "./errors.js";
13
13
  import { getCompositeDetails } from "./get-composite-details.js";
14
14
  import { getFileDetails } from "./get-file-details.js";
15
15
  import { getStringDetails } from "./get-string-details.js";
16
16
  import { transformManifest } from "./transform-manifest.js";
17
17
 
18
- export async function getFileManifestEntries({
18
+ export const getFileManifestEntries = async ({
19
19
  additionalPrecacheEntries,
20
20
  dontCacheBustURLsMatching,
21
21
  globDirectory,
@@ -28,7 +28,7 @@ export async function getFileManifestEntries({
28
28
  modifyURLPrefix,
29
29
  templatedURLs,
30
30
  disablePrecacheManifest,
31
- }: GetManifestOptions): Promise<GetManifestResult> {
31
+ }: GetManifestOptionsComplete): Promise<GetManifestResult> => {
32
32
  if (disablePrecacheManifest) {
33
33
  return {
34
34
  count: 0,
@@ -123,4 +123,4 @@ export async function getFileManifestEntries({
123
123
  transformedManifest.warnings.push(...warnings);
124
124
 
125
125
  return transformedManifest;
126
- }
126
+ };
@@ -9,10 +9,8 @@
9
9
  import type { FileDetails } from "../types.js";
10
10
  import { getStringHash } from "./get-string-hash.js";
11
11
 
12
- export function getStringDetails(url: string, str: string): FileDetails {
13
- return {
14
- file: url,
15
- hash: getStringHash(str),
16
- size: str.length,
17
- };
18
- }
12
+ export const getStringDetails = (url: string, str: string): FileDetails => ({
13
+ file: url,
14
+ hash: getStringHash(str),
15
+ size: str.length,
16
+ });
@@ -6,7 +6,7 @@
6
6
  https://opensource.org/licenses/MIT.
7
7
  */
8
8
 
9
- import type { BasePartial, FileDetails, ManifestEntry, ManifestTransform } from "../types.js";
9
+ import type { BaseResolved, FileDetails, ManifestEntry, ManifestTransform } from "../types.js";
10
10
  import { additionalPrecacheEntriesTransform } from "./additional-precache-entries-transform.js";
11
11
  import { errors } from "./errors.js";
12
12
  import { maximumSizeTransform } from "./maximum-size-transform.js";
@@ -68,6 +68,25 @@ interface ManifestTransformResultWithWarnings {
68
68
  manifestEntries: ManifestEntry[] | undefined;
69
69
  warnings: string[];
70
70
  }
71
+ interface ManifestEntryWithSize extends ManifestEntry {
72
+ size: number;
73
+ }
74
+ interface TransformManifestOptions
75
+ extends Pick<
76
+ BaseResolved,
77
+ | "additionalPrecacheEntries"
78
+ | "dontCacheBustURLsMatching"
79
+ | "manifestTransforms"
80
+ | "maximumFileSizeToCacheInBytes"
81
+ | "modifyURLPrefix"
82
+ | "disablePrecacheManifest"
83
+ > {
84
+ fileDetails: FileDetails[];
85
+ // When this is called by the webpack plugin, transformParam will be the
86
+ // current webpack compilation.
87
+ transformParam?: unknown;
88
+ }
89
+
71
90
  export async function transformManifest({
72
91
  additionalPrecacheEntries,
73
92
  dontCacheBustURLsMatching,
@@ -77,12 +96,7 @@ export async function transformManifest({
77
96
  modifyURLPrefix,
78
97
  transformParam,
79
98
  disablePrecacheManifest,
80
- }: BasePartial & {
81
- fileDetails: FileDetails[];
82
- // When this is called by the webpack plugin, transformParam will be the
83
- // current webpack compilation.
84
- transformParam?: unknown;
85
- }): Promise<ManifestTransformResultWithWarnings> {
99
+ }: TransformManifestOptions): Promise<ManifestTransformResultWithWarnings> {
86
100
  if (disablePrecacheManifest) {
87
101
  return {
88
102
  count: 0,
@@ -96,13 +110,11 @@ export async function transformManifest({
96
110
 
97
111
  // Take the array of fileDetail objects and convert it into an array of
98
112
  // {url, revision, size} objects, with \ replaced with /.
99
- const normalizedManifest = fileDetails.map((fileDetails) => {
100
- return {
101
- url: fileDetails.file.replace(/\\/g, "/"),
102
- revision: fileDetails.hash,
103
- size: fileDetails.size,
104
- };
105
- });
113
+ const normalizedManifest: ManifestEntryWithSize[] = fileDetails.map((fileDetails) => ({
114
+ url: fileDetails.file.replace(/\\/g, "/"),
115
+ revision: fileDetails.hash,
116
+ size: fileDetails.size,
117
+ }));
106
118
 
107
119
  const transformsToApply: ManifestTransform[] = [];
108
120
 
@@ -128,7 +140,7 @@ export async function transformManifest({
128
140
  transformsToApply.push(additionalPrecacheEntriesTransform(additionalPrecacheEntries));
129
141
  }
130
142
 
131
- let transformedManifest: (ManifestEntry & { size: number })[] = normalizedManifest;
143
+ let transformedManifest: ManifestEntryWithSize[] = normalizedManifest;
132
144
  for (const transform of transformsToApply) {
133
145
  const result = await transform(transformedManifest, transformParam);
134
146
  if (!("manifest" in result)) {
@@ -3,7 +3,7 @@ import { z } from "zod";
3
3
  export const manifestEntry = z
4
4
  .object({
5
5
  integrity: z.string().optional(),
6
- revision: z.string().nullable(),
6
+ revision: z.string().nullable().optional(),
7
7
  url: z.string(),
8
8
  })
9
9
  .strict("Do not pass invalid properties to ManifestEntry!");
package/src/types.ts CHANGED
@@ -205,7 +205,7 @@ export type BuildResult = Omit<GetManifestResult, "manifestEntries"> & {
205
205
  */
206
206
  export interface FileDetails {
207
207
  file: string;
208
- hash: string;
208
+ hash: string | null;
209
209
  size: number;
210
210
  }
211
211